summaryrefslogtreecommitdiffstats
path: root/apps/voice_thread.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-02-23 08:14:46 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-03-03 07:23:38 +0100
commit286a4c5caa1945c8d1cb365a3d90fb09d5700cb2 (patch)
tree4835f46d16ec78d035ec9f49333079fe618384c1 /apps/voice_thread.c
parent3f82f3aca14eb954e55f761721ffdd2684f0e812 (diff)
downloadrockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.gz
rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.bz2
rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.zip
Revise the PCM callback system after adding multichannel audio.
Additional status callback is added to pcm_play/rec_data instead of using a special function to set it. Status includes DMA error reporting to the status callback. Playback and recording callback become more alike except playback uses "const void **addr" (because the data should not be altered) and recording uses "void **addr". "const" is put in place throughout where appropriate. Most changes are fairly trivial. One that should be checked in particular because it isn't so much is telechips, if anyone cares to bother. PP5002 is not so trivial either but that tested as working. Change-Id: I4928d69b3b3be7fb93e259f81635232df9bd1df2 Reviewed-on: http://gerrit.rockbox.org/166 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
Diffstat (limited to 'apps/voice_thread.c')
-rw-r--r--apps/voice_thread.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 2f216cde9d..5d23a74cbc 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -116,9 +116,12 @@ enum voice_thread_messages
/* Structure to store clip data callback info */
struct voice_info
{
- pcm_play_callback_type get_more; /* Callback to get more clips */
- unsigned char *start; /* Start of clip */
- size_t size; /* Size of clip */
+ /* Callback to get more clips */
+ void (*get_more)(unsigned char** start, size_t* size);
+ /* Start of clip */
+ unsigned char *start;
+ /* Size of clip */
+ size_t size;
};
/* Private thread data for its current state that must be passed to its
@@ -148,14 +151,14 @@ static inline int voice_unplayed_frames(void)
}
/* Mixer channel callback */
-static void voice_pcm_callback(unsigned char **start, size_t *size)
+static void voice_pcm_callback(const void **start, size_t *size)
{
if (voice_unplayed_frames() == 0)
return; /* Done! */
unsigned int i = ++cur_buf_out % VOICE_FRAMES;
- *start = (unsigned char *)voicebuf[i];
+ *start = voicebuf[i];
*size = voicebuf_sizes[i];
}
@@ -167,7 +170,7 @@ static void voice_start_playback(void)
unsigned int i = cur_buf_out % VOICE_FRAMES;
mixer_channel_play_data(PCM_MIXER_CHAN_VOICE, voice_pcm_callback,
- (unsigned char *)voicebuf[i], voicebuf_sizes[i]);
+ voicebuf[i], voicebuf_sizes[i]);
}
/* Stop the voice channel */
@@ -198,7 +201,7 @@ static void voice_buf_commit(size_t size)
/* Stop any current clip and start playing a new one */
void mp3_play_data(const unsigned char* start, int size,
- pcm_play_callback_type get_more)
+ void (*get_more)(unsigned char** start, size_t* size))
{
if (get_more != NULL && start != NULL && (ssize_t)size > 0)
{