1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-02 02:53:32 +02:00

Add sample rate mismatch check to sound effects

Sound effects already get recreated if the number of channels
mismatches, but the same could be true if the sample rate mismatches
too, which was the case with music tracks as described in #886.

So, just to be sure - and to be consistent with music tracks - sound
effects now check that the sample rate matches, too, and if not, will be
recreated.
This commit is contained in:
Misa 2023-03-18 16:40:24 -07:00
parent d54e98200f
commit d6bc319535

View File

@ -145,7 +145,8 @@ end:
{
FAudioVoiceDetails details;
FAudioVoice_GetVoiceDetails(voices[i], &details);
if (details.InputChannels != format.nChannels)
if (details.InputSampleRate != format.nSamplesPerSec ||
details.InputChannels != format.nChannels)
{
VVV_freefunc(FAudioVoice_DestroyVoice, voices[i]);
FAudio_CreateSourceVoice(faudioctx, &voices[i], &format, 0, 2.0f, NULL, NULL, NULL);