From ef373c03b96b0be08babca581d9f10bccfd4931f Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Fri, 5 Jan 2018 17:30:09 -0500 Subject: sdl: clean up audio driver This prevents a (highly improbable) race condition when exiting, and uses pcm_set_frequency() instead of mixer_set_frequency(), since that seems like the Right Thing to Do (TM). Change-Id: Icb6a4597843215f08b3835490ac63f67c9a04736 --- apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c b/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c index 83bd0afb42..1c2e4b2de9 100644 --- a/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c +++ b/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c @@ -211,6 +211,7 @@ static Uint8 *ROCKBOXAUD_GetAudioBuf(_THIS) static void ROCKBOXAUD_CloseAudio(_THIS) { + rb->pcm_play_stop(); if ( this->hidden->mixbuf != NULL ) { SDL_FreeAudioMem(this->hidden->mixbuf); this->hidden->mixbuf = NULL; @@ -221,7 +222,6 @@ static void ROCKBOXAUD_CloseAudio(_THIS) if(this->hidden->rb_buf[i]) SDL_FreeAudioMem(this->hidden->rb_buf[i]); } - rb->pcm_play_stop(); rb->pcm_set_frequency(HW_SAMPR_DEFAULT); } @@ -236,7 +236,7 @@ static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) SDL_CalculateAudioSpec(spec); LOGF("samplerate %d", spec->freq); - rb->mixer_set_frequency(spec->freq); + rb->pcm_set_frequency(spec->freq); /* Allocate mixing buffer */ this->hidden->mixlen = spec->size; -- cgit v1.2.3