forked from len0rd/rockbox
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
This commit is contained in:
parent
beaeb28a29
commit
ef373c03b9
1 changed files with 2 additions and 2 deletions
|
@ -211,6 +211,7 @@ static Uint8 *ROCKBOXAUD_GetAudioBuf(_THIS)
|
||||||
|
|
||||||
static void ROCKBOXAUD_CloseAudio(_THIS)
|
static void ROCKBOXAUD_CloseAudio(_THIS)
|
||||||
{
|
{
|
||||||
|
rb->pcm_play_stop();
|
||||||
if ( this->hidden->mixbuf != NULL ) {
|
if ( this->hidden->mixbuf != NULL ) {
|
||||||
SDL_FreeAudioMem(this->hidden->mixbuf);
|
SDL_FreeAudioMem(this->hidden->mixbuf);
|
||||||
this->hidden->mixbuf = NULL;
|
this->hidden->mixbuf = NULL;
|
||||||
|
@ -221,7 +222,6 @@ static void ROCKBOXAUD_CloseAudio(_THIS)
|
||||||
if(this->hidden->rb_buf[i])
|
if(this->hidden->rb_buf[i])
|
||||||
SDL_FreeAudioMem(this->hidden->rb_buf[i]);
|
SDL_FreeAudioMem(this->hidden->rb_buf[i]);
|
||||||
}
|
}
|
||||||
rb->pcm_play_stop();
|
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
|
||||||
SDL_CalculateAudioSpec(spec);
|
SDL_CalculateAudioSpec(spec);
|
||||||
|
|
||||||
LOGF("samplerate %d", spec->freq);
|
LOGF("samplerate %d", spec->freq);
|
||||||
rb->mixer_set_frequency(spec->freq);
|
rb->pcm_set_frequency(spec->freq);
|
||||||
|
|
||||||
/* Allocate mixing buffer */
|
/* Allocate mixing buffer */
|
||||||
this->hidden->mixlen = spec->size;
|
this->hidden->mixlen = spec->size;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue