summaryrefslogtreecommitdiffstats
path: root/apps/voice_thread.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-10-23 13:13:00 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-10-23 13:13:00 +0000
commiteffceea22915a087c1c85ff30d2e62110413edaf (patch)
tree6f1340835c950d44fc521bb17ca022e151059762 /apps/voice_thread.c
parent188e898e3c40bafa472fa038167764ebcccf713d (diff)
downloadrockbox-effceea22915a087c1c85ff30d2e62110413edaf.tar.gz
rockbox-effceea22915a087c1c85ff30d2e62110413edaf.tar.bz2
rockbox-effceea22915a087c1c85ff30d2e62110413edaf.zip
Remove the event object in the kernel since it's rather extraneous at the moment. This makes the codecs and the plugins incompatible, so update fully.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18867 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/voice_thread.c')
-rw-r--r--apps/voice_thread.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index aeffa5bd7c..084c3872c6 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -61,8 +61,8 @@ static const char voice_thread_name[] = "voice";
/* Voice thread synchronization objects */
static struct event_queue voice_queue SHAREDBSS_ATTR;
static struct mutex voice_mutex SHAREDBSS_ATTR;
-static struct event voice_event SHAREDBSS_ATTR;
static struct queue_sender_list voice_queue_sender_list SHAREDBSS_ATTR;
+static bool voice_done SHAREDDATA_ATTR = true;
/* Buffer for decoded samples */
static spx_int16_t voice_output_buf[VOICE_FRAME_SIZE] CACHEALIGN_ATTR;
@@ -189,9 +189,9 @@ void voice_wait(void)
/* NOTE: One problem here is that we can't tell if another thread started a
* new clip by the time we wait. This should be resolvable if conditions
* ever require knowing the very clip you requested has finished. */
- event_wait(&voice_event, STATE_SIGNALED);
+
/* Wait for PCM buffer to be exhausted. Works only if not playing. */
- while(!playback_is_playing() && pcm_is_playing())
+ while(!voice_done || (!playback_is_playing() && pcm_is_playing()))
sleep(1);
}
@@ -219,7 +219,7 @@ static void voice_message(struct voice_thread_data *td)
case Q_VOICE_PLAY:
LOGFQUEUE("voice < Q_VOICE_PLAY");
/* Put up a block for completion signal */
- event_set_state(&voice_event, STATE_NONSIGNALED);
+ voice_done = false;
/* Copy the clip info */
td->vi = *(struct voice_info *)td->ev.data;
@@ -264,7 +264,7 @@ static void voice_message(struct voice_thread_data *td)
cancel_cpu_boost();
td->state = TSTATE_STOPPED;
- event_set_state(&voice_event, STATE_SIGNALED);
+ voice_done = true;
break;
case Q_VOICE_STATE:
@@ -433,7 +433,7 @@ void voice_thread_init(void)
logf("Starting voice thread");
queue_init(&voice_queue, false);
mutex_init(&voice_mutex);
- event_init(&voice_event, STATE_SIGNALED | EVENT_MANUAL);
+
voice_thread_p = create_thread(voice_thread, voice_stack,
sizeof(voice_stack), CREATE_THREAD_FROZEN,
voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU));