From 4e0bc7940586d785cd2986431b43658fa5969769 Mon Sep 17 00:00:00 2001 From: kub Date: Tue, 23 Feb 2021 23:23:32 +0100 Subject: [PATCH] use native byte order for audio --- linux/sndout_alsa.c | 2 +- sndout_sdl.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linux/sndout_alsa.c b/linux/sndout_alsa.c index f1d9ca3..9297967 100644 --- a/linux/sndout_alsa.c +++ b/linux/sndout_alsa.c @@ -51,7 +51,7 @@ int sndout_alsa_start(int rate_, int stereo) ret = snd_pcm_hw_params_any(handle, hwparams); ret |= snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); - ret |= snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16_LE); + ret |= snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16); ret |= snd_pcm_hw_params_set_channels(handle, hwparams, stereo ? 2 : 1); ret |= snd_pcm_hw_params_set_rate_near(handle, hwparams, &rate, 0); ret |= snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size); diff --git a/sndout_sdl.c b/sndout_sdl.c index a7be5ed..c0c57ab 100644 --- a/sndout_sdl.c +++ b/sndout_sdl.c @@ -62,7 +62,7 @@ int sndout_sdl_init(void) int sndout_sdl_start(int rate, int stereo) { - SDL_AudioSpec desired; + SDL_AudioSpec desired = { 0 }; int samples, shift; int ret; @@ -70,7 +70,7 @@ int sndout_sdl_start(int rate, int stereo) sndout_sdl_stop(); desired.freq = rate; - desired.format = AUDIO_S16LSB; + desired.format = AUDIO_S16SYS; desired.channels = stereo ? 2 : 1; desired.callback = callback; desired.userdata = NULL; -- 2.39.5