mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 08:31:14 +00:00
- fixed crash when setting sound pitch on non-existing channel
This applies to a lack of free channels, -nosound command line switch, missing OpenAL library, sound initialization failures, ... https://forum.zdoom.org/viewtopic.php?t=65926
This commit is contained in:
parent
86e8d4711d
commit
7ec33b6b92
1 changed files with 4 additions and 3 deletions
|
@ -1199,10 +1199,10 @@ static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyO
|
||||||
case SOURCE_Unattached: chan->Point[0] = pt->X; chan->Point[1] = pt->Y; chan->Point[2] = pt->Z; break;
|
case SOURCE_Unattached: chan->Point[0] = pt->X; chan->Point[1] = pt->Y; chan->Point[2] = pt->Z; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (spitch > 0.0)
|
if (spitch > 0.0)
|
||||||
S_SetPitch(chan, spitch);
|
S_SetPitch(chan, spitch);
|
||||||
|
}
|
||||||
|
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
@ -1849,6 +1849,7 @@ void S_ChangeSoundPitch(AActor *actor, int channel, double pitch)
|
||||||
|
|
||||||
void S_SetPitch(FSoundChan *chan, float pitch)
|
void S_SetPitch(FSoundChan *chan, float pitch)
|
||||||
{
|
{
|
||||||
|
assert(chan != nullptr);
|
||||||
GSnd->ChannelPitch(chan, MAX(0.0001f, pitch));
|
GSnd->ChannelPitch(chan, MAX(0.0001f, pitch));
|
||||||
chan->Pitch = MAX(1, int(float(NORM_PITCH) * pitch));
|
chan->Pitch = MAX(1, int(float(NORM_PITCH) * pitch));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue