I have many sounds playing on channels under the master ChannelGroup. At runtime I want to capture only a specific subset of those channels’ mixed audio as a separate real-time PCM stream (to drive a secondary output), without affecting normal playback.
Constraint: I can’t pre-assign these sounds to a dedicated ChannelGroup when they’re created — I only learn which channels are “of interest” after they start playing, and the set changes constantly as sounds start and stop. They all just play flat under master.
Approach I’m considering — is this the correct pattern?
- Create a capture DSP and connect it as a (silent) input into the master’s head DSP via
DSP::addInput, so it gets processed each mix but outputs silence and doesn’t alter the master output. - For each “interesting” channel,
captureDSP->addInput(channelHeadDSP)(the channel’s head DSP, viagetDSP(FMOD_CHANNELCONTROL_DSP_HEAD)), so the channel feeds the capture DSP in addition to its normal path to master. - Read the mixed result in the capture DSP’s read callback — and output silence there, so these sounds aren’t doubled into the master mix.
Questions:
- Is a side-chain capture DSP fed by per-channel
DSP::addInputthe right/standard way to capture a chosen subset of channels? Or is per-channelChannel::addDSPthe intended approach? (per-channeladdDSPcrashed for me — multiple channels sharing one DSP seemed to corrupt the graph.) - How do I safely manage these connections as channels stop / are released? I’m worried stale
DSPConnections after a channel ends will crash. Should IDSP::disconnectFromproactively when a channel stops, or does FMOD clean up the input connection automatically when that channel’s head DSP is freed?
Thanks!