ChannelControl::setPan and FMOD_DSP_PAN_MODE

What is the difference between ChannelControl::setPan and FMOD_DSP_PAN_2D_STEREO_POSITION?

I tested them myself:

	FMOD_System_PlaySound(g_System, g_Sound, NULL, TRUE, &channelA);
	FMOD_System_PlaySound(g_System, g_Sound, NULL, TRUE, &channelB);

	FMOD_Channel_SetPan(channelA, -0.5f);

	FMOD_DSP* panDSP;
	FMOD_System_CreateDSPByType(g_System, FMOD_DSP_TYPE_PAN, &panDSP);
	FMOD_DSP_SetParameterInt(panDSP, FMOD_DSP_PAN_MODE, FMOD_DSP_PAN_MODE_STEREO);
	FMOD_DSP_SetParameterFloat(panDSP, FMOD_DSP_PAN_2D_STEREO_POSITION, -50.0f);
	FMOD_Channel_AddDSP(channelB, FMOD_CHANNELCONTROL_DSP_TAIL, panDSP);
	// This is called to match the volume levels.
	FMOD_Channel_SetVolume(channelB, 0.7f);

	FMOD_Channel_SetPaused(channelA, FALSE);
	FMOD_Channel_SetPaused(channelB, FALSE);

	FMOD_Channel_SetMute(channelB, TRUE);

The reason why I lowered the volume of the second channel is it was much louder when FMOD_DSP_TYPE_PAN and FMOD_DSP_PAN_2D_STEREO_POSITION are applied.

I compared two channels switching between them, and I didn’t like the sound from the channel with FMOD_DSP_TYPE_PAN.

I don’t know how to describe it, but the first one felt more smooth and natural.
On the other hand, the sound via FMOD_DSP_PAN_2D_STEREO_POSITION doesn’t seem to be distributed to the left and right speakers smoothly as the first one.

  1. Why is this? Why the first one is quieter but more natural compared to the second one?
  2. Which one is better performance-wise?
    (In the case where the pan setting is very frequently adjusted, and in another case where the different pan settings are applied to a lot of sound sources.)

ChannelControl::setPan internally uses ChannelControl::setMixLevelsOutput to change the left and right levels of the channel.
FMOD_DSP_PAN_2D_STEREO_POSITION uses the Pan Effect, which uses more sophisticated mechanisms to pan between multiple speakers.

The Pan Effect uses a different algorithm to compute the left/right balance, with the goal of producing an even and accurate result across a range of different speaker configurations. ChannelControl::setPan just makes one channel quieter and the other louder in a balanced way. As for why it sounds more natural, that is a bit subjective but I’m happy to speculate- perhaps as the simpler panning algorithm, it is the more common one in audio software and the behavior feels more familiar?

Profiling yourself is always the best way to know for sure, but going on heursitics and the relative complexity of FMOD_DSP_PAN_2D_STEREO_POSITION, I would guess ChannelControl::setPan takes less cpu cycles.

1 Like

Thank you very much! :blush:

1 Like