Most operations supported by channel groups are the same that we have seen already for individual channels. In particular, we can stop, pause, or mute all channels in a group, and control their volume and pitch. The syntax for these operations is the same as before, except for pitch, which is done through a setPitch()
method, that instead of a frequency, takes any value between 0
and 10
, and multiplies it by the current frequency.
// Calls stop on all channels in the group channelGroup->stop(); // Mute or pause all channels channelGroup->setMute(true); channelGroup->setPaused(true); // Halve the volume of all sounds in the group channelGroup->setVolume(0.5f); // Double the frequency of all sounds in the group channelGroup->setPitch(2.0f);
All of these changes propagate down the channel group hierarchy automatically, without overwriting the values stored inside the channels. The way these values are applied depends on the type of operation.
For operations...