With the sounds loaded into memory or prepared for streaming, all that is left is telling the system to play them using the playSound()
method:
FMOD::Channel* channel; system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
The first parameter selects in which channel the sound will play. You should usually let FMOD handle it automatically, by passing FMOD_CHANNEL_FREE
as the parameter.
The second parameter is a pointer to the FMOD::Sound
object that you want to play.
The third parameter controls whether the sound should start in a paused state, giving you a chance to modify some of its properties without the changes being audible. If you set this to true, you will also need to use the next parameter so that you can unpause it later.
The fourth parameter is an output parameter that returns a pointer to the FMOD::Channel
object in which the sound will play. You can use this handle to control the sound in multiple ways, which will be the main topic of the next chapter...