How to change the pitch of the same sound file to play in multi-channel?

Under the test, only change the pitch to achieve some note sound effects. When playing, it will only be played in the same channel. Playing a note sound effect will replace the last played note sound effect, which will lead to broken sound. How to solve this problem? Try to call this interface: channelcontrol:: isplay. It is found that the isplaying state of the channel is false. It is possible to be true only when playing other different sound files.

Hi, a screenshot of your code will make it way clearer for someone to answer.

ISound* FmodSoundSystem::playSound3DControl(const FixedString &path, const SoundCreateInfo3D& createInfo, float pitch)
{
FMOD::Sound* pSound = getTriggerSoundResource(path, ST_3D, createInfo.isloop);
FmodSound* pSoundObj = NULL;

	if( pSound )
	{
		FMOD::Channel* pChannel = playSound(pSound, false, createInfo.volume, createInfo.isloop);
		FMOD::DSP* firstDSP = NULL;
		FMOD::DSP* secondDSP = NULL;

		if (pitch != 1.0f) {
			float fPitch = pitch, sPitch = 0.0f;
			if(pitch > 2.0f || pitch < 0.5f) {
				if(pitch > 2.0f) {
					fPitch = 2.0f;
					sPitch = pitch/2.0f;
				}
				if(pitch < 0.5f) {
					fPitch = 0.5f;
					sPitch = pitch/0.5f;
				}
			}
			m_pFmodSystem->lockDSP();
			FMOD_RESULT result = m_pFmodSystem->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &firstDSP);
			if (result == FMOD_OK) {
				firstDSP->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, fPitch);
				pChannel->addDSP(0, firstDSP);
			} else {
				firstDSP = NULL;
			}

			if(pitch > 2.0f || pitch < 0.5f) {
				FMOD_RESULT result = m_pFmodSystem->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &secondDSP);
				if (result == FMOD_OK) {
					secondDSP->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, sPitch);
					pChannel->addDSP(0, secondDSP);
				} else {
					secondDSP = NULL;
				}
			}
			m_pFmodSystem->unlockDSP();
		}
		
		pChannel->set3DMinMaxDistance(createInfo.mindistance, 10000.0f*100.0f);
		pChannel->set3DAttributes((FMOD_VECTOR*)&createInfo.pos, NULL);
		pSoundObj = new FmodSound(pChannel, firstDSP, secondDSP);
        pSoundObj->setSystem(this);
	}

	return pSoundObj;

}

The sound file path here is the same, and the pitch is different, but the assigned channels are indeed the same,channel id is 511.
However, what I want is a different channel to play.

Just to clarify, is your goal to play a series of notes, each with different pitch adjustment, and for each such note to continue playing to completion even when a new note has begun playing? Or do you instead want to play a series of notes, each with different pitch adjustment, and for each such note to fade out gracefully when a new note begins playing?

Yes! I need to be able to play each note on a separate channel, rather than only on the same channel, so that the previous note is not played and the next note occupies this channel to play.

I want to play the piano by changing the pitch of only one note file.

Each channel can only play one sound at a time. Thus, as you have observed, playing all your notes in the same channel will result in each note being cut off by the next.

If you need multiple notes to be playing simultaneously, each must be playing in a different channel.

Thanks.I know.