From c9a78621aff7ae9f8c1e2f6dfbccde9ed1d936bb Mon Sep 17 00:00:00 2001 From: Steve Bavin Date: Thu, 28 Sep 2006 15:17:59 +0000 Subject: [PATCH] Another fix for crashing when changing crossfade settings git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11086 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index 5996886d7e..b80cee7486 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -625,10 +625,12 @@ void audio_set_crossfade(int enable) gui_syncsplash(0, true, (char *)str(LANG_RESTARTING_PLAYBACK)); LOGFQUEUE("audio > audio Q_AUDIO_STOP"); queue_post(&audio_queue, Q_AUDIO_STOP, 0); - while (audio_codec_loaded || playing) + while (audio_codec_loaded) yield(); } + voice_stop(); + /* Re-initialize audio system. */ pcmbuf_init(size); pcmbuf_crossfade_enable(enable); @@ -646,7 +648,7 @@ void audio_set_crossfade(int enable) /* Wait for the playback to start again (and display the splash screen during that period. */ - while (!playing && !audio_codec_loaded) + while (!playing) yield(); } } @@ -698,15 +700,7 @@ void voice_init(void) return; /* Audio buffers not yet set up */ if (voice_thread_p) - { - logf("Terminating voice codec"); - remove_thread(voice_thread_p); - if (current_codec == CODEC_IDX_VOICE) - mutex_unlock(&mutex_codecthread); - queue_delete(&voice_queue); - voice_thread_p = NULL; - voice_codec_loaded = false; - } + return; if (!talk_voice_required()) return; @@ -733,7 +727,7 @@ void voice_stop(void) LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); queue_post(&voice_queue, Q_VOICE_STOP, 0); - while (voice_is_playing && !queue_empty(&voice_queue)) + while (voice_is_playing) yield(); if (!playing) pcmbuf_play_stop();