Support SDL audio devices that require float32 samples.

Fixes missing audio when playing on Windows with SDL 2.0.7, which started
using WASAPI, which demands floating point audio.
This commit is contained in:
Ryan C. Gordon 2018-04-13 14:05:12 -04:00
parent 3377f9981a
commit 4f8c7c2f2f
5 changed files with 26 additions and 4 deletions

View file

@ -96,7 +96,9 @@ static struct
{ AUDIO_U16LSB, "AUDIO_U16LSB" },
{ AUDIO_S16LSB, "AUDIO_S16LSB" },
{ AUDIO_U16MSB, "AUDIO_U16MSB" },
{ AUDIO_S16MSB, "AUDIO_S16MSB" }
{ AUDIO_S16MSB, "AUDIO_S16MSB" },
{ AUDIO_F32LSB, "AUDIO_F32LSB" },
{ AUDIO_F32MSB, "AUDIO_F32MSB" }
};
static int formatToStringTableSize = ARRAY_LEN( formatToStringTable );
@ -228,7 +230,8 @@ qboolean SNDDMA_Init(void)
}
dmapos = 0;
dma.samplebits = obtained.format & 0xFF; // first byte of format is bits.
dma.samplebits = SDL_AUDIO_BITSIZE(obtained.format);
dma.isfloat = SDL_AUDIO_ISFLOAT(obtained.format);
dma.channels = obtained.channels;
dma.samples = tmp;
dma.submission_chunk = 1;