# Pcmreadcallback and FMOD Studio Live update

**URL:** https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023
**Category:** FMOD Studio
**Tags:** ue4
**Created:** [April 12, 2021, 1:35am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023 "2021-04-12T01:35:17Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![jblaswu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jblaswu/32/1117_2.png) [@jblaswu](https://qa.fmod.com/u/jblaswu)
#### Post date: [April 12, 2021, 1:35am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/1 "2021-04-12T01:35:17Z")

</div>

We are using FMOD with UE for a new project we are making and got a component that sets some rendered audio (using elias for that) into the callback that is set at pcmreadcallback on FMOD\_CREATESOUNDEXINFO.

So far it seems to work…the rendered audio will be modified if we add some DSP effects so we assume it’s actually working, however this is where we are lost. We expected that we could somehow see this input on FMOD Studio ( and tweak it with Live Update ) or even add it to some group on the mixer and allow our Audio Engineers to apply group parameters.

The documentation about DSP plugins makes it look very low level. Is there any way to expose this to our audio engineers? Is there any way the audio is added to a group in the mixer?

We would greatly appreciate some help here.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [April 16, 2021, 5:43am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/2 "2021-04-16T05:43:59Z")

</div>

> [@jblaswu](#):
>
> Is there any way to expose this to our audio engineers? Is there any way the audio is added to a group in the mixer?

To do this you would need to make a DSP plugin as a stand alone dynamic library: [FMOD - White Papers | DSP Plugin API](https://www.fmod.com/resources/documentation-api?version=2.2&page=white-papers-dsp-plugin-api.html).

---

<div class="post-metadata">

### Author: ![jblaswu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jblaswu/32/1117_2.png) [@jblaswu](https://qa.fmod.com/u/jblaswu)
#### Post date: [April 17, 2021, 7:10am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/3 "2021-04-17T07:10:36Z")

</div>

Thanks for the help (and answering the other topic, sadly programmer instrument didn’t help me). Before making our own dsp plugin we were wondering…will this allow our audio engineers to tweak the values using Live Update? because we do know that adding the DSP effect with c++ works (as stated on your documentation) but that’s exactly what we want to avoid, since it won’t be as friendly as we need.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [April 18, 2021, 10:23pm UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/4 "2021-04-18T22:23:52Z")

</div>

Apologies, I should have also linked the Studio docs: [FMOD - Plug-in Reference](https://fmod.com/resources/documentation-studio?version=2.2&page=plugin-reference.html).

You can create plugins, and a custom UI, for your audio engineers to use in Studio. You can then tweak the values using Live Update as you would with any other effect.

---

<div class="post-metadata">

### Author: ![jblaswu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jblaswu/32/1117_2.png) [@jblaswu](https://qa.fmod.com/u/jblaswu)
#### Post date: [April 25, 2021, 6:08pm UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/5 "2021-04-25T18:08:55Z")

</div>

One last question. We were used to have our music affected by global variables depending on the situation we are currently. If we create a DSP plugin it means that the only effect that will affect this stream will be from the DSP? or we still can have one single variable to change “something” as if it were a regular event?  
(sorry if this doesn’t makes too much sense, streaming and dsp plugins are new waters for us)

PS: we managed to do the following:  
-Create a programmer sound using an event with a progammer sound (with 1second duration, need some info about why it has to be 1 second long)  
-On the FMOD\_STUDIO\_EVENT\_CALLBACK\_CREATE\_PROGRAMMER\_SOUND we created the stream  
-On the FMOD\_STUDIO\_EVENT\_CALLBACK\_DESTROY\_PROGRAMMER\_SOUND we kept the code from the sample (release the sound)  
-Live update now allows us to modify this event. giving us the result we wanted.

Would it work fine? it’s kind of weird to have to create the stream each second, will it affect the performance? is there any way to have the duration to infinite and only create the stream once?

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [April 25, 2021, 10:58pm UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/6 "2021-04-25T22:58:56Z")

</div>

When you use programmer sounds on an event made in Studio, it will work as a regular event. Any other DSP/effects added down the line will still affect it. You can even expose properties from your DSP as parameters on the even rather than trying to set the values through the DSP API.

> [@jblaswu](#):
>
> is there any way to have the duration to infinite and only create the stream once?

This may be to do with your event, if you were to add a loop region to the instrument or make the instrument ‘async’ then it shouldn’t cut off your programmer sound. (If this does not help then I will need some more information on the issue.)

---

<div class="post-metadata">

### Author: ![jblaswu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jblaswu/32/1117_2.png) [@jblaswu](https://qa.fmod.com/u/jblaswu)
#### Post date: [April 26, 2021, 2:24am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/7 "2021-04-26T02:24:07Z")

</div>

It did have a loop region but found that it seems to be depending on the length of the event (both fmod event and the event paremeters created in code). We found that matching the length on the FMOD\_CREATESOUNDEXINFO and the length of the fmod event seems to work but were expecting to set the length in FMOD\_CREATESOUNDEXINFO to infinite (not sure uint\_max would do the trick) and hoped fmod studio would assume that an event with loop should be treated as infinite too.  
Matching the values work, i could put something like…1min and the callback will be called every minute, but my question remains as…how expensive is it to be creating this stream sound every, let’s say, 1min? (it seems like it could be 10min or even 1 hour but we are curious now as if it’s actually that expensive performance-wise)

Thanks for the help so far.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [April 26, 2021, 4:24am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/8 "2021-04-26T04:24:57Z")

</div>

The loop region will need to be inside the length of the programmer instrument, otherwise the programmer sound will keep starting and stopping.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/e0b9640813144024cdffc56dd9427ffdcbc419aa.png)

Making the instrument async is a nicer way to do a similar thing, it will just keep the event alive as long as the instrument is playing.

Streams are not something you want to be stopping and starting for short sounds. Depending on what you are playing and how many effects it is using will determine how expensive it is, but over a minute playing 60 streams will be a lot more expensive than playing just one.

---

<div class="post-metadata">

### Author: ![jblaswu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jblaswu/32/1117_2.png) [@jblaswu](https://qa.fmod.com/u/jblaswu)
#### Post date: [April 26, 2021, 5:32am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/9 "2021-04-26T05:32:31Z")

</div>

No matter what i do it seems like it keeps following the length specified on FMOD\_CREATESOUNDEXINFO, after that time is done the callback is triggered for FMOD\_STUDIO\_EVENT\_CALLBACK\_DESTROY\_PROGRAMMER\_SOUND and then it doesn’t triggers again (unless i match the length of the info and the event).  
Even with the loop region or the Async option it doesn’t seems to be working as described. (Using 2.01.08)

But i think we can work with what we got so far. We will probably just go with the option of making it replay every minute (or 10) which seems to work (we are playing a background music in loop). Thanks again for all the help

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [April 26, 2021, 5:39am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/10 "2021-04-26T05:39:45Z")

</div>

You should not need to specify a length in `FMOD_CREATESOUNDEXINFO`, every property except `cbsize` is optional. [FMOD - Core API Reference | System (fmod createsoundexinfo)](https://fmod.com/resources/documentation-api?version=2.0&page=core-api-system.html#fmod_createsoundexinfo)

---

<div class="post-metadata">

### Author: ![jblaswu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jblaswu/32/1117_2.png) [@jblaswu](https://qa.fmod.com/u/jblaswu)
#### Post date: [April 26, 2021, 6:06am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/11 "2021-04-26T06:06:31Z")

</div>

I did try without setting the length but then it doesn’t even play (i just tried right now not setting anything other than the pcmreadcallback), the pcmreadcallback from the Stream that is created for the programmer instrument gets called once and then never again. Then the ProgrammerSoundCallback get’s called after the loop region restarts on the fmod studio event.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [April 26, 2021, 11:04pm UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/12 "2021-04-26T23:04:47Z")

</div>

Are you checking the result returned from the `createSound/Stream` function? If there is a problem it will give you details on the issue.

---

<div class="post-metadata">

### Author: ![jblaswu](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jblaswu/32/1117_2.png) [@jblaswu](https://qa.fmod.com/u/jblaswu)
#### Post date: [April 27, 2021, 5:26am UTC](https://qa.fmod.com/t/pcmreadcallback-and-fmod-studio-live-update/17023/13 "2021-04-27T05:26:50Z")

</div>

Checking on your examples i see that there is one that does almost the same as what we do for creating the stream (user\_created\_sound.cpp). If i pass an info without any params it will return FMOD\_ERR\_INVALID\_PARAM.  
Seeing that example it’s starting to make sense, the length is the duration that we are expecting for our user created sound, which should be the same as the event. Once the event loops it should match the length that we were expecting when creating the sound, even if it’s not really looping for us, which is why i mentioned about the infinite duration. It makes sense that the info for user created sounds has a duration (if you created it thinking on a single sound) but it doesn’t if what we are playing is background music (stream)  
Assuming that we got that right, it doesn’t really matter if we set the length to 1min or 1hour, as long as both event and info are synced.
