Splitting Audio Programatically

ChannelGroups are too “high level” for this task, you’ll need to drop down to the DSP level to create a second signal path. As you’ve discovered a ChannelGroup can only have one output, but you can use the DSP API to add a second one.

Assuming you already have two target ChannelGroups T1 and T2 and a single source ChannelGroup S1, here is what you need to do:

  • Route S1 into T1 with T1->addGroup(S1)
  • Get the tail DSP of T2 with T2->getDSP(FMOD_CHANNELCONTROL_DSP_TAIL, &D_T2).
  • Get the head DSP of S1 with S1->getDSP(FMOD_CHANNELCONTROL_DSP_HEAD, &D_S1).
  • Now connect the head of S1 to the tail of T2 with D_T2->addInput(D_S1).

This has now created the split you’re after, use the ChannelGroups as you like, when you want to mix it all back together just put T1 and T2 into the same parent ChannelGroup. Let me know if you have any troubles or something doesn’t make sense.

2 Likes