- [Psy-X] fix setting SPU pitch=0 not doing anything

This commit is contained in:
Ilya Shurumov 2021-07-09 21:17:59 +06:00 committed by InspirationByte
parent cc9daa6ca1
commit 35b21611de

View File

@ -665,6 +665,14 @@ void SpuSetVoiceAttr(SpuVoiceAttr *arg)
// update pitch // update pitch
if (arg->mask & SPU_VOICE_PITCH) if (arg->mask & SPU_VOICE_PITCH)
{ {
ALint state;
alGetSourcei(alSource, AL_SOURCE_STATE, &state);
if (arg->pitch == 0 && state == AL_PLAYING)
alSourcePause(alSource);
else if (voice->attr.pitch == 0 && state == AL_PAUSED)
alSourcePlay(alSource);
voice->attr.pitch = arg->pitch; voice->attr.pitch = arg->pitch;
pitch = (float)(voice->attr.pitch) / 4096.0f; pitch = (float)(voice->attr.pitch) / 4096.0f;