Cleanup audio.h, related functions

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23651 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jeffrey Goode 2009-11-16 20:09:46 +00:00
parent 0d93a00e37
commit db82be4390
5 changed files with 56 additions and 50 deletions

View file

@ -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)
{

View file

@ -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;

View file

@ -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

View file

@ -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)