aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-09 10:53:03 -0800
committerChris Robinson <[email protected]>2018-03-09 10:53:03 -0800
commit8b242555570b9afe260026721737ae4ba2eef563 (patch)
tree862b210ee76daf247f53abe25dc97e4bb22231c6 /Alc
parent46e7e96eb3407405df9999cbb3134a5392c98a08 (diff)
Request the device's sample type for SDL2
Diffstat (limited to 'Alc')
-rw-r--r--Alc/backends/sdl2.c14
1 files changed, 13 insertions, 1 deletions
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;