How to create streaming instances of FMOD Events in code

hi folks! i’m not sure i’ve seen this exact situation come up…

i was wondering if there’s a way to set the output of a particular event in the API so that it comes out as a stream independent of the global mixer? this may be a low level API question. the developer wants the ability to access each event in a separate data stream - in effect to ‘record’ the event onto a timeline but not to mix it globally.

the other option is to be able to instance FMOD Studio’s output separately so that each global instance is a separate stream that can be recorded. either method would be fine. any help appreciated! this is through Xcode for an iOS app.

The Studio API does not provide a way to reroute the output of events at runtime. Are you looking to write an event’s output to a wav file? If so, I think you’ll need to write a custom DSP.

The API documentation has an introduction to FMOD’s DSP plugin SDK…

The Low Level API installer also comes with several code examples of how to write a custom DSP…

There’s an Xcode workspace under “FMOD Programmers API/api/lowlevel/examples/xcode32”. Take a look at the “dsp_custom” example.

The “examples/plugins” directory contains more examples of custom DSP code. These are the source to some real-world DSP effects that are used in Studio.

Hopefully that’s enough for you to get started on making a custom DSP that writes its incoming signal to a file, and then passes silence to its output.

The next step would be registering your DSP, creating an instance, then attaching it to the ChannelGroup head of a playing event. That will involve a few calls to the Low Level API. The steps would go something like this:

(1) Obtain the low level System object with Studio::System::getLowLevelSystem().
(2) Register your DSP with System::registerDSP().
(3) Create an instance of your DSP with System::createDSPByPlugin().
(4) Retrieve the ChannelGroup of a playing event with Studio::EventInstance::getChannelGroup().
(5) Attach the DSP to the head of the ChannelGroup with ChannelGroup::addDSP().

Some API documentation links…

Please take particular note of the remarks section for Studio::EventInstance::getChannelGroup, which describes a bunch of caveats that are involved in manipulating the internal ChannelGroup of an event instance.

So yeah, this stuff is not exactly for the faint-hearted. Feel free to yell if you need more help.

Lastly, I’m actually not sure if I correctly interpreted your original question. If I got it wrong, please disregard all of the above. :wink:

1 Like