1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Fix loading sounds with non-16 bit depths

This fixes an issue where sound effects of bit depths that weren't 16,
such as 8, were being played incorrectly, as described in #886.

The problem is that when loading the sound effect, we would always set
the bit depth to 16 no matter what! Instead, we should set the bit depth
to the actual bit depth of the file.

Fixes #886.
This commit is contained in:
Misa 2023-03-18 15:59:17 -07:00
parent 671c90f7dc
commit d54e98200f

View file

@ -116,7 +116,7 @@ public:
format.nChannels = spec.channels; format.nChannels = spec.channels;
format.nSamplesPerSec = spec.freq; format.nSamplesPerSec = spec.freq;
format.wFormatTag = FAUDIO_FORMAT_PCM; format.wFormatTag = FAUDIO_FORMAT_PCM;
format.wBitsPerSample = 16; format.wBitsPerSample = SDL_AUDIO_BITSIZE(spec.format);
format.nBlockAlign = format.nChannels * format.wBitsPerSample; format.nBlockAlign = format.nChannels * format.wBitsPerSample;
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign; format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
format.cbSize = 0; format.cbSize = 0;