Finally, we can also control the panning of some sounds, as long as they are mono or stereo, and 2D (as the FMOD engine automatically positions 3D sounds). When these conditions are met, you can change the panning of the sound using the setPan()
method, which takes any value from -1
(completely on the left) to 1
(completely on the right):
channel->setPan(-1.0f);
Panning works by modifying the volume of each output to give the illusion of position. However, the way FMOD calculates these values is different between mono and stereo sounds.
For mono sounds, the volume of each speaker follows a constant power curve that starts at 0 percent on one side, and goes to 100 percent on the other side, with the center position being at around 71 percent. This technique results in a smoother transition from one side to the other than using regular linear interpolation with 50 percent in the middle (because of the way we perceive sound intensity).
Stereo sounds, on the other hand...