So far, so good, except that now, I want to stream the audio directly into an instance of a programmer instrument in Fmod Studio to have more controls.
And that’s where I’m stuck.
I’ve already checked the following resource Using FMOD with voice chat utilizing OnAudioFilterRead()
but I think I’m not quite understanding how exactly you can grab the Fmod.sound and put it inside a programmer instrument.
Do I have to use a callback for this, or using only Sound.lock and Sound.unlock, is enough?
If anybody can explain step by step how it would work would be awesome.
Thank you!
What version of the FMOD integration are you using? Could you please explain what controls you are looking for over the programmer instrument? It might be possible to avoid having to use a programmer instrument and control the sound directly.
Initially, I wanted to spatialize the audio stream, and I’ve figured it out using the set3DAttributes on the channel Group.
But now, I need to duck another bus group when the audio stream is present, using a sidechain compressor.
And that’s where I think implementing the audio stream to a programmer instrument would be easier to manage for me, as I’m not sure if I would need to implement other features afterwards (like, adding reverb, or else).
The only difference is we will want to call lockChannelGroup() (FMOD Engine | Studio API Reference - Bus::lockChannelGroup) which will ensure that the channel group is kept in memory when we attach the sound. Here is how I retrieved the channel group:
FMODUnity.RuntimeManager.StudioSystem.getBus("bus:/VideoGroup", out FMOD.Studio.Bus videoGroupBus);
if (videoBus.isValid())
{
videoBus.lockChannelGroup();
FMODUnity.RuntimeManager.StudioSystem.flushCommands();
videoBus.getChannelGroup(out FMOD.ChannelGroup videoChannelGroup);
}
else
{
Debug.Log("Failed to lock Channel Group");
}