summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/apps/playback.c b/apps/playback.c
index a9d419b13f..f0794faf87 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -116,6 +116,12 @@ static size_t filebuflen = 0; /* Size of buffer (A/C-) */
116/* FIXME: make buf_ridx (C/A-) */ 116/* FIXME: make buf_ridx (C/A-) */
117 117
118/* Possible arrangements of the buffer */ 118/* Possible arrangements of the buffer */
119enum audio_buffer_state
120{
121 AUDIOBUF_STATE_TRASHED = -1, /* trashed; must be reset */
122 AUDIOBUF_STATE_INITIALIZED = 0, /* voice+audio OR audio-only */
123 AUDIOBUF_STATE_VOICED_ONLY = 1, /* voice-only */
124};
119static int buffer_state = AUDIOBUF_STATE_TRASHED; /* Buffer state */ 125static int buffer_state = AUDIOBUF_STATE_TRASHED; /* Buffer state */
120 126
121/* These are used to store the current and next (or prev if the current is the last) 127/* These are used to store the current and next (or prev if the current is the last)
@@ -224,10 +230,13 @@ static void audio_stop_playback(void);
224 230
225/**************************************/ 231/**************************************/
226 232
233
234/** Pcmbuf callbacks */
235
227/* Between the codec and PCM track change, we need to keep updating the 236/* Between the codec and PCM track change, we need to keep updating the
228 "elapsed" value of the previous (to the codec, but current to the 237 * "elapsed" value of the previous (to the codec, but current to the
229 user/PCM/WPS) track, so that the progressbar reaches the end. 238 * user/PCM/WPS) track, so that the progressbar reaches the end.
230 During that transition, the WPS will display othertrack_id3. */ 239 * During that transition, the WPS will display othertrack_id3. */
231void audio_pcmbuf_position_callback(unsigned int time) 240void audio_pcmbuf_position_callback(unsigned int time)
232{ 241{
233 time += othertrack_id3->elapsed; 242 time += othertrack_id3->elapsed;
@@ -258,9 +267,7 @@ void audio_post_track_change(bool pcmbuf)
258 } 267 }
259} 268}
260 269
261/* Scan the pcmbuf queue and return true if a message pulled. 270/* Scan the pcmbuf queue and return true if a message pulled */
262 * Permissible Context(s): Thread
263 */
264static bool pcmbuf_queue_scan(struct queue_event *ev) 271static bool pcmbuf_queue_scan(struct queue_event *ev)
265{ 272{
266 if (!queue_empty(&pcmbuf_queue)) 273 if (!queue_empty(&pcmbuf_queue))
@@ -276,7 +283,8 @@ static bool pcmbuf_queue_scan(struct queue_event *ev)
276 return false; 283 return false;
277} 284}
278 285
279/* --- Helper functions --- */ 286
287/** Helper functions */
280 288
281static struct mp3entry *bufgetid3(int handle_id) 289static struct mp3entry *bufgetid3(int handle_id)
282{ 290{
@@ -439,9 +447,9 @@ unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size)
439 return buf; 447 return buf;
440} 448}
441 449
442int audio_buffer_state(void) 450bool audio_buffer_state_trashed(void)
443{ 451{
444 return buffer_state; 452 return buffer_state == AUDIOBUF_STATE_TRASHED;
445} 453}
446 454
447#ifdef HAVE_RECORDING 455#ifdef HAVE_RECORDING