summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-05-31 04:13:39 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-05-31 04:13:39 -0400
commit344b9d09860af193a0a297438432339f4108c574 (patch)
tree6178600bfbfb140bf20475ce578ff4748fdf4630 /apps
parent5857c44017a1641fce7f00da7f16c143daacbaf6 (diff)
Some corrections after 5857c44.
Playback needs to receive a couple of settings-related messages even when not playing. Put the message reply back where it was when loading an encoder for recording. Change-Id: I8cc80f46e42a0afd119991d698510e1ebef38ead
Diffstat (limited to 'apps')
-rw-r--r--apps/audio_thread.c15
-rw-r--r--apps/playback.c4
-rw-r--r--apps/recorder/pcm_record.c6
3 files changed, 18 insertions, 7 deletions
diff --git a/apps/audio_thread.c b/apps/audio_thread.c
index 2f01f7a8c2..56f3853c6c 100644
--- a/apps/audio_thread.c
+++ b/apps/audio_thread.c
@@ -79,6 +79,14 @@ static void NORETURN_ATTR audio_thread(void)
audio_playback_handler(&ev);
continue;
+ /* Playback has to handle these, even if not playing */
+ case Q_AUDIO_REMAKE_AUDIO_BUFFER:
+#ifdef HAVE_DISK_STORAGE
+ case Q_AUDIO_UPDATE_WATERMARK:
+#endif
+ audio_playback_handler(&ev);
+ break;
+
#ifdef AUDIO_HAVE_RECORDING
/* Starts the recording engine branch */
case Q_AUDIO_INIT_RECORDING:
@@ -132,10 +140,6 @@ void audio_init(void)
logf("audio: initializing");
- playback_init();
-
- /* Recording doesn't need init call */
-
/* Initialize queues before giving control elsewhere in case it likes
to send messages. Thread creation will be delayed however so nothing
starts running until ready if something yields such as talk_init. */
@@ -151,6 +155,9 @@ void audio_init(void)
queue_enable_queue_send(&audio_queue, &audio_queue_sender_list,
audio_thread_id);
+ playback_init();
+ /* Recording doesn't need init call */
+
/* ...now...audio_reset_buffer must know the size of voicefile buffer so
init talk first which will init the buffers */
talk_init();
diff --git a/apps/playback.c b/apps/playback.c
index 01fa7a9dda..894c379b7e 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -3078,6 +3078,8 @@ void audio_playback_handler(struct queue_event *ev)
/* buffer needs to be reinitialized */
LOGFQUEUE("playback < Q_AUDIO_REMAKE_AUDIO_BUFFER");
audio_start_playback(0, AUDIO_START_RESTART | AUDIO_START_NEWBUF);
+ if (play_status == PLAY_STOPPED)
+ return; /* just need to change buffer state */
break;
#ifdef HAVE_DISK_STORAGE
@@ -3086,6 +3088,8 @@ void audio_playback_handler(struct queue_event *ev)
LOGFQUEUE("playback < Q_AUDIO_UPDATE_WATERMARK: %d",
(int)ev->data);
audio_update_filebuf_watermark(ev->data);
+ if (play_status == PLAY_STOPPED)
+ return; /* just need to update setting */
break;
#endif /* HAVE_DISK_STORAGE */
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index a45dcc2d11..3b3211afab 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -1191,7 +1191,6 @@ static void pcmrec_close(void)
/* PCMREC_OPTIONS */
static void pcmrec_set_recording_options(
- struct event_queue *q,
struct audio_recording_options *options)
{
/* stop everything */
@@ -1237,9 +1236,10 @@ static void pcmrec_set_recording_options(
/* apply hardware setting to start monitoring now */
pcm_apply_settings();
+ queue_reply(&audio_queue, 0); /* Release sender */
+
if (codec_load(-1, enc_config.afmt | CODEC_TYPE_ENCODER))
{
- queue_reply(q, true);
/* run immediately */
codec_go();
@@ -1487,7 +1487,7 @@ void audio_recording_handler(struct queue_event *ev)
return; /* no more recording */
case Q_AUDIO_RECORDING_OPTIONS:
- pcmrec_set_recording_options(&audio_queue,
+ pcmrec_set_recording_options(
(struct audio_recording_options *)ev->data);
break;