In unity, Is it possible to combine the studio events with more low level code?


I’ve used FMOD before, code only. This time I thought I’d check out the studio approach in combination with Unity. So I am using event emitters and such and set up my sound banks in the Studio app.

But now it turns out I cannot access DSP in the way I need it. What I am doing:

Users can add sounds in a 3D world and have them move around. In the world are also DSP objects at fixed locations. The sounds should be impacted by the DSP objects when they get near to them.

In code I would just add a new dsp object to a sound when it comes close, alter its impact the closer it gets and remove it when it is farther away.

But now I don’t have sound and channel objects. Only StudioEventEmitters and EventInstances. If I understand correctly, EventInstances are the Channels in traditional setup. But can I somehow get the channel that is in there, so that I can connect DSP’s to them?

Or does this mean I have to start over and just do without the Studio Application?



You can access the channel group via the Emitter Event Instance (Unity Integration | Studio API Reference).

  1. Retrieve the Channel Group (FMOD API | Core API Reference) from the emitter using FMOD.RESULT result = emitter.EventInstance.getChannelGroup(out FMOD.ChannelGroup topChannelGroup);.
  2. Dig down through the channel groups till you find the one with the channel attached
topChannelGroup.getChannelGroup(out newChannelGroup);
newChannelGroup.getNumChannels(out int numChannels);
if (numChannels != 0)
    newChannelGroup.getChannel(out FMOD.Channel channel);
    // Keep digging
channel.addDSP(0, effectDSP); 

You can also attach the DSP to any of the channel groups if you would like it to affect more than one event.

Hope this helps!