Grouping channels together
Another great feature of FMOD is that it lets us add different channels to a group and control them simultaneously. This is very useful for video games, where sound tends to fall into categories (such as background music, sound effects, or speech). To create a channel group we use the createChannelGroup()
method of the system object:
FMOD::ChannelGroup* musicGroup; system->createChannelGroup("music", &musicGroup);
Then we can easily add a channel to a group using the setChannelGroup()
method of the channel object:
channel->setChannelGroup(musicGroup);
It is also possible to add a group as a child of another group, creating a hierarchy. This is done using the addGroup()
method of the parent channel group object:
channelGroup->addGroup(anotherGroup);
There is also a global channel group called the master channel group, where every channel is placed every time you play a sound. You can get a reference to the master channel group by calling the getMasterChannelGroup...