diff options
author | Steve Bavin <pondlife@pondlife.me> | 2006-11-13 09:07:18 +0000 |
---|---|---|
committer | Steve Bavin <pondlife@pondlife.me> | 2006-11-13 09:07:18 +0000 |
commit | 6a27006a5ddf70926f9d45a0ce17a26473ecc403 (patch) | |
tree | 82c4af20edea4ba4150f4b4d7216a854804b271f /apps | |
parent | 0297873f6ac3a9dc0844dc3da9d432e4253d555d (diff) | |
download | rockbox-6a27006a5ddf70926f9d45a0ce17a26473ecc403.tar.gz rockbox-6a27006a5ddf70926f9d45a0ce17a26473ecc403.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playback.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c index 62dd039274..dccae587b9 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -192,7 +192,7 @@ static bool audio_is_initialized = false; | |||
192 | /* Variables are commented with the threads that use them: * | 192 | /* Variables are commented with the threads that use them: * |
193 | * A=audio, C=codec, V=voice. A suffix of - indicates that * | 193 | * A=audio, C=codec, V=voice. A suffix of - indicates that * |
194 | * the variable is read but not updated on that thread. */ | 194 | * the variable is read but not updated on that thread. */ |
195 | /* TBD: Split out "audio" and "calling" threads */ | 195 | /* TBD: Split out "audio" and "playback" (ie. calling) threads */ |
196 | 196 | ||
197 | /* Main state control */ | 197 | /* Main state control */ |
198 | static struct event_queue codec_callback_queue; /* Queue for codec callback responses */ | 198 | 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, | |||
348 | void mp3_play_stop(void) | 348 | void mp3_play_stop(void) |
349 | { | 349 | { |
350 | #ifdef PLAYBACK_VOICE | 350 | #ifdef PLAYBACK_VOICE |
351 | queue_remove_from_head(&voice_queue, Q_VOICE_STOP); | ||
351 | LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); | 352 | LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); |
352 | queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); | 353 | queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); |
353 | #endif | 354 | #endif |
@@ -807,7 +808,7 @@ void voice_stop(void) | |||
807 | 808 | ||
808 | LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); | 809 | LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); |
809 | queue_post(&voice_queue, Q_VOICE_STOP, 0); | 810 | queue_post(&voice_queue, Q_VOICE_STOP, 0); |
810 | while (voice_is_playing) | 811 | while (voice_is_playing || !queue_empty(&voice_queue)) |
811 | yield(); | 812 | yield(); |
812 | if (!playing) | 813 | if (!playing) |
813 | pcmbuf_play_stop(); | 814 | pcmbuf_play_stop(); |
@@ -1880,13 +1881,15 @@ static void codec_thread(void) | |||
1880 | LOGFQUEUE("codec > voice Q_ENCODER_RECORD"); | 1881 | LOGFQUEUE("codec > voice Q_ENCODER_RECORD"); |
1881 | queue_post(&voice_queue, Q_ENCODER_RECORD, NULL); | 1882 | queue_post(&voice_queue, Q_ENCODER_RECORD, NULL); |
1882 | } | 1883 | } |
1883 | #endif | ||
1884 | mutex_lock(&mutex_codecthread); | 1884 | mutex_lock(&mutex_codecthread); |
1885 | #endif | ||
1885 | logf("loading encoder"); | 1886 | logf("loading encoder"); |
1886 | current_codec = CODEC_IDX_AUDIO; | 1887 | current_codec = CODEC_IDX_AUDIO; |
1887 | ci.stop_codec = false; | 1888 | ci.stop_codec = false; |
1888 | status = codec_load_file((const char *)ev.data, &ci); | 1889 | status = codec_load_file((const char *)ev.data, &ci); |
1890 | #ifdef PLAYBACK_VOICE | ||
1889 | mutex_unlock(&mutex_codecthread); | 1891 | mutex_unlock(&mutex_codecthread); |
1892 | #endif | ||
1890 | logf("encoder stopped"); | 1893 | logf("encoder stopped"); |
1891 | break; | 1894 | break; |
1892 | #endif /* AUDIO_HAVE_RECORDING */ | 1895 | #endif /* AUDIO_HAVE_RECORDING */ |