1
0
Fork 0
forked from len0rd/rockbox

Minor voice fixes; prevent voice queue overflow, fix compile of voice-less build

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11521 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2006-11-13 09:07:18 +00:00
parent 0297873f6a
commit 6a27006a5d

View file

@ -192,7 +192,7 @@ static bool audio_is_initialized = false;
/* Variables are commented with the threads that use them: * /* Variables are commented with the threads that use them: *
* A=audio, C=codec, V=voice. A suffix of - indicates that * * A=audio, C=codec, V=voice. A suffix of - indicates that *
* the variable is read but not updated on that thread. */ * the variable is read but not updated on that thread. */
/* TBD: Split out "audio" and "calling" threads */ /* TBD: Split out "audio" and "playback" (ie. calling) threads */
/* Main state control */ /* Main state control */
static struct event_queue codec_callback_queue; /* Queue for codec callback responses */ static struct event_queue codec_callback_queue; /* Queue for codec callback responses */
@ -348,6 +348,7 @@ void mp3_play_data(const unsigned char* start, int size,
void mp3_play_stop(void) void mp3_play_stop(void)
{ {
#ifdef PLAYBACK_VOICE #ifdef PLAYBACK_VOICE
queue_remove_from_head(&voice_queue, Q_VOICE_STOP);
LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); queue_post(&voice_queue, Q_VOICE_STOP, (void *)1);
#endif #endif
@ -807,7 +808,7 @@ void voice_stop(void)
LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
queue_post(&voice_queue, Q_VOICE_STOP, 0); queue_post(&voice_queue, Q_VOICE_STOP, 0);
while (voice_is_playing) while (voice_is_playing || !queue_empty(&voice_queue))
yield(); yield();
if (!playing) if (!playing)
pcmbuf_play_stop(); pcmbuf_play_stop();
@ -1880,13 +1881,15 @@ static void codec_thread(void)
LOGFQUEUE("codec > voice Q_ENCODER_RECORD"); LOGFQUEUE("codec > voice Q_ENCODER_RECORD");
queue_post(&voice_queue, Q_ENCODER_RECORD, NULL); queue_post(&voice_queue, Q_ENCODER_RECORD, NULL);
} }
#endif
mutex_lock(&mutex_codecthread); mutex_lock(&mutex_codecthread);
#endif
logf("loading encoder"); logf("loading encoder");
current_codec = CODEC_IDX_AUDIO; current_codec = CODEC_IDX_AUDIO;
ci.stop_codec = false; ci.stop_codec = false;
status = codec_load_file((const char *)ev.data, &ci); status = codec_load_file((const char *)ev.data, &ci);
#ifdef PLAYBACK_VOICE
mutex_unlock(&mutex_codecthread); mutex_unlock(&mutex_codecthread);
#endif
logf("encoder stopped"); logf("encoder stopped");
break; break;
#endif /* AUDIO_HAVE_RECORDING */ #endif /* AUDIO_HAVE_RECORDING */