diff options
| author | Jeffrey Goode <jeffg7@gmail.com> | 2009-11-16 20:09:46 +0000 |
|---|---|---|
| committer | Jeffrey Goode <jeffg7@gmail.com> | 2009-11-16 20:09:46 +0000 |
| commit | db82be4390d294c8d460f50c06add41ffa6686f5 (patch) | |
| tree | 070f9e3df3841eaabf2b81b774eae07f773329bc /apps | |
| parent | 0d93a00e37b5f0c5e2977d77393c88d8baf58f38 (diff) | |
| download | rockbox-db82be4390d294c8d460f50c06add41ffa6686f5.zip rockbox-db82be4390d294c8d460f50c06add41ffa6686f5.tar.gz rockbox-db82be4390d294c8d460f50c06add41ffa6686f5.tar.bz2 rockbox-db82be4390d294c8d460f50c06add41ffa6686f5.tar.xz | |
Cleanup audio.h, related functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23651 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/mpeg.c | 16 | ||||
| -rw-r--r-- | apps/pcmbuf.c | 2 | ||||
| -rw-r--r-- | apps/playback.c | 26 | ||||
| -rw-r--r-- | apps/playback.h | 1 |
4 files changed, 28 insertions, 17 deletions
diff --git a/apps/mpeg.c b/apps/mpeg.c index e28260b..079faac 100644 --- a/apps/mpeg.c +++ b/apps/mpeg.c @@ -533,9 +533,9 @@ static void recalculate_watermark(int bitrate) } #ifdef HAVE_DISK_STORAGE -void audio_set_buffer_margin(int seconds) +void audio_set_buffer_margin(int setting) { - low_watermark_margin = seconds; + low_watermark_margin = setting; /* in seconds */ } #endif @@ -2040,7 +2040,7 @@ static void mpeg_thread(void) } #endif /* !SIMULATOR */ -struct mp3entry* audio_current_track() +struct mp3entry* audio_current_track(void) { #ifdef SIMULATOR struct mp3entry *id3 = &taginfo; @@ -2069,7 +2069,7 @@ struct mp3entry* audio_current_track() #endif /* !SIMULATOR */ } -struct mp3entry* audio_next_track() +struct mp3entry* audio_next_track(void) { #ifdef SIMULATOR return &taginfo; @@ -2771,12 +2771,12 @@ void audio_prev(void) #endif /* SIMULATOR */ } -void audio_ff_rewind(long newtime) +void audio_ff_rewind(long newpos) { #ifndef SIMULATOR - queue_post(&mpeg_queue, MPEG_FF_REWIND, newtime); + queue_post(&mpeg_queue, MPEG_FF_REWIND, newpos); #else /* SIMULATOR */ - (void)newtime; + (void)newpos; #endif /* SIMULATOR */ } @@ -2811,10 +2811,12 @@ int audio_status(void) return ret; } +/* Unused function unsigned int audio_error(void) { return mpeg_errno; } +*/ void audio_error_clear(void) { diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 7d5d714..a75c110 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -1196,7 +1196,7 @@ void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude) bufstart = minibuf; bufend = SKIPBYTES(bufstart, MINIBUF_SIZE); } - else if (audio_buffer_state() != AUDIOBUF_STATE_TRASHED) + else if (!audio_buffer_state_trashed()) { /* Use pcmbuffer */ bufstart = (int16_t *)pcmbuffer; diff --git a/apps/playback.c b/apps/playback.c index a9d419b..f0794fa 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -116,6 +116,12 @@ static size_t filebuflen = 0; /* Size of buffer (A/C-) */ /* FIXME: make buf_ridx (C/A-) */ /* Possible arrangements of the buffer */ +enum audio_buffer_state +{ + AUDIOBUF_STATE_TRASHED = -1, /* trashed; must be reset */ + AUDIOBUF_STATE_INITIALIZED = 0, /* voice+audio OR audio-only */ + AUDIOBUF_STATE_VOICED_ONLY = 1, /* voice-only */ +}; static int buffer_state = AUDIOBUF_STATE_TRASHED; /* Buffer state */ /* 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); /**************************************/ + +/** Pcmbuf callbacks */ + /* Between the codec and PCM track change, we need to keep updating the - "elapsed" value of the previous (to the codec, but current to the - user/PCM/WPS) track, so that the progressbar reaches the end. - During that transition, the WPS will display othertrack_id3. */ + * "elapsed" value of the previous (to the codec, but current to the + * user/PCM/WPS) track, so that the progressbar reaches the end. + * During that transition, the WPS will display othertrack_id3. */ void audio_pcmbuf_position_callback(unsigned int time) { time += othertrack_id3->elapsed; @@ -258,9 +267,7 @@ void audio_post_track_change(bool pcmbuf) } } -/* Scan the pcmbuf queue and return true if a message pulled. - * Permissible Context(s): Thread - */ +/* Scan the pcmbuf queue and return true if a message pulled */ static bool pcmbuf_queue_scan(struct queue_event *ev) { if (!queue_empty(&pcmbuf_queue)) @@ -276,7 +283,8 @@ static bool pcmbuf_queue_scan(struct queue_event *ev) return false; } -/* --- Helper functions --- */ + +/** Helper functions */ static struct mp3entry *bufgetid3(int handle_id) { @@ -439,9 +447,9 @@ unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size) return buf; } -int audio_buffer_state(void) +bool audio_buffer_state_trashed(void) { - return buffer_state; + return buffer_state == AUDIOBUF_STATE_TRASHED; } #ifdef HAVE_RECORDING diff --git a/apps/playback.h b/apps/playback.h index 4038484..760408a 100644 --- a/apps/playback.h +++ b/apps/playback.h @@ -76,6 +76,7 @@ void audio_post_track_change(bool pcmbuf); int get_audio_hid(void); int *get_codec_hid(void); void audio_set_prev_elapsed(unsigned long setting); +bool audio_buffer_state_trashed(void); /* Define one constant that includes recording related functionality */ #if defined(HAVE_RECORDING) && !defined(SIMULATOR) |