summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/mpeg.c16
-rw-r--r--apps/pcmbuf.c2
-rw-r--r--apps/playback.c26
-rw-r--r--apps/playback.h1
4 files changed, 28 insertions, 17 deletions
diff --git a/apps/mpeg.c b/apps/mpeg.c
index e28260b6a7..079faac13c 100644
--- a/apps/mpeg.c
+++ b/apps/mpeg.c
@@ -533,9 +533,9 @@ static void recalculate_watermark(int bitrate)
533} 533}
534 534
535#ifdef HAVE_DISK_STORAGE 535#ifdef HAVE_DISK_STORAGE
536void audio_set_buffer_margin(int seconds) 536void audio_set_buffer_margin(int setting)
537{ 537{
538 low_watermark_margin = seconds; 538 low_watermark_margin = setting; /* in seconds */
539} 539}
540#endif 540#endif
541 541
@@ -2040,7 +2040,7 @@ static void mpeg_thread(void)
2040} 2040}
2041#endif /* !SIMULATOR */ 2041#endif /* !SIMULATOR */
2042 2042
2043struct mp3entry* audio_current_track() 2043struct mp3entry* audio_current_track(void)
2044{ 2044{
2045#ifdef SIMULATOR 2045#ifdef SIMULATOR
2046 struct mp3entry *id3 = &taginfo; 2046 struct mp3entry *id3 = &taginfo;
@@ -2069,7 +2069,7 @@ struct mp3entry* audio_current_track()
2069#endif /* !SIMULATOR */ 2069#endif /* !SIMULATOR */
2070} 2070}
2071 2071
2072struct mp3entry* audio_next_track() 2072struct mp3entry* audio_next_track(void)
2073{ 2073{
2074#ifdef SIMULATOR 2074#ifdef SIMULATOR
2075 return &taginfo; 2075 return &taginfo;
@@ -2771,12 +2771,12 @@ void audio_prev(void)
2771#endif /* SIMULATOR */ 2771#endif /* SIMULATOR */
2772} 2772}
2773 2773
2774void audio_ff_rewind(long newtime) 2774void audio_ff_rewind(long newpos)
2775{ 2775{
2776#ifndef SIMULATOR 2776#ifndef SIMULATOR
2777 queue_post(&mpeg_queue, MPEG_FF_REWIND, newtime); 2777 queue_post(&mpeg_queue, MPEG_FF_REWIND, newpos);
2778#else /* SIMULATOR */ 2778#else /* SIMULATOR */
2779 (void)newtime; 2779 (void)newpos;
2780#endif /* SIMULATOR */ 2780#endif /* SIMULATOR */
2781} 2781}
2782 2782
@@ -2811,10 +2811,12 @@ int audio_status(void)
2811 return ret; 2811 return ret;
2812} 2812}
2813 2813
2814/* Unused function
2814unsigned int audio_error(void) 2815unsigned int audio_error(void)
2815{ 2816{
2816 return mpeg_errno; 2817 return mpeg_errno;
2817} 2818}
2819*/
2818 2820
2819void audio_error_clear(void) 2821void audio_error_clear(void)
2820{ 2822{
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index 7d5d71413b..a75c110694 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -1196,7 +1196,7 @@ void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude)
1196 bufstart = minibuf; 1196 bufstart = minibuf;
1197 bufend = SKIPBYTES(bufstart, MINIBUF_SIZE); 1197 bufend = SKIPBYTES(bufstart, MINIBUF_SIZE);
1198 } 1198 }
1199 else if (audio_buffer_state() != AUDIOBUF_STATE_TRASHED) 1199 else if (!audio_buffer_state_trashed())
1200 { 1200 {
1201 /* Use pcmbuffer */ 1201 /* Use pcmbuffer */
1202 bufstart = (int16_t *)pcmbuffer; 1202 bufstart = (int16_t *)pcmbuffer;
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
diff --git a/apps/playback.h b/apps/playback.h
index 403848418f..760408a02f 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -76,6 +76,7 @@ void audio_post_track_change(bool pcmbuf);
76int get_audio_hid(void); 76int get_audio_hid(void);
77int *get_codec_hid(void); 77int *get_codec_hid(void);
78void audio_set_prev_elapsed(unsigned long setting); 78void audio_set_prev_elapsed(unsigned long setting);
79bool audio_buffer_state_trashed(void);
79 80
80/* Define one constant that includes recording related functionality */ 81/* Define one constant that includes recording related functionality */
81#if defined(HAVE_RECORDING) && !defined(SIMULATOR) 82#if defined(HAVE_RECORDING) && !defined(SIMULATOR)