From 8b242555570b9afe260026721737ae4ba2eef563 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 9 Mar 2018 10:53:03 -0800 Subject: Request the device's sample type for SDL2 --- Alc/backends/sdl2.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Alc/backends') diff --git a/Alc/backends/sdl2.c b/Alc/backends/sdl2.c index f301cf48..2955fb25 100644 --- a/Alc/backends/sdl2.c +++ b/Alc/backends/sdl2.c @@ -96,9 +96,21 @@ static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; SDL_AudioSpec want, have; + SDL_zero(want); + SDL_zero(have); + want.freq = device->Frequency; - want.format = AUDIO_F32; + switch(device->FmtType) + { + case DevFmtUByte: want.format = AUDIO_U8; break; + case DevFmtByte: want.format = AUDIO_S8; break; + case DevFmtUShort: want.format = AUDIO_U16SYS; break; + case DevFmtShort: want.format = AUDIO_S16SYS; break; + case DevFmtUInt: /* fall-through */ + case DevFmtInt: want.format = AUDIO_S32SYS; break; + case DevFmtFloat: want.format = AUDIO_F32; break; + } want.channels = (device->FmtChans == DevFmtMono) ? 1 : 2; want.samples = device->UpdateSize; want.callback = ALCsdl2Backend_audioCallback; -- cgit v1.2.3