diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2012-02-23 08:14:46 -0500 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2012-03-03 07:23:38 +0100 |
| commit | 286a4c5caa1945c8d1cb365a3d90fb09d5700cb2 (patch) | |
| tree | 4835f46d16ec78d035ec9f49333079fe618384c1 /apps | |
| parent | 3f82f3aca14eb954e55f761721ffdd2684f0e812 (diff) | |
| download | rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.zip rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.gz rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.bz2 rockbox-286a4c5caa1945c8d1cb365a3d90fb09d5700cb2.tar.xz | |
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')
| -rw-r--r-- | apps/beep.c | 4 | ||||
| -rw-r--r-- | apps/pcmbuf.c | 2 | ||||
| -rw-r--r-- | apps/plugin.h | 13 | ||||
| -rw-r--r-- | apps/plugins/beatbox/beatbox.c | 8 | ||||
| -rw-r--r-- | apps/plugins/doom/i_sound.c | 6 | ||||
| -rw-r--r-- | apps/plugins/fft/fft.c | 4 | ||||
| -rw-r--r-- | apps/plugins/metronome.c | 2 | ||||
| -rw-r--r-- | apps/plugins/midi/midiplay.c | 14 | ||||
| -rw-r--r-- | apps/plugins/mikmod/mikmod.c | 10 | ||||
| -rw-r--r-- | apps/plugins/mpegplayer/pcm_output.c | 2 | ||||
| -rw-r--r-- | apps/plugins/pacbox/pacbox.c | 6 | ||||
| -rw-r--r-- | apps/plugins/pdbox/PDa/src/s_audio_rockbox.c | 10 | ||||
| -rw-r--r-- | apps/plugins/pitch_detector.c | 7 | ||||
| -rw-r--r-- | apps/plugins/rockboy/rbsound.c | 6 | ||||
| -rw-r--r-- | apps/plugins/test_sampr.c | 6 | ||||
| -rw-r--r-- | apps/plugins/zxbox/spsound.c | 9 | ||||
| -rw-r--r-- | apps/recorder/pcm_record.c | 36 | ||||
| -rw-r--r-- | apps/voice_thread.c | 17 |
18 files changed, 85 insertions, 77 deletions
diff --git a/apps/beep.c b/apps/beep.c index d3345af..3b02e5d 100644 --- a/apps/beep.c +++ b/apps/beep.c @@ -46,7 +46,7 @@ static int16_t beep_buf[BEEP_BUF_COUNT*2] IBSS_ATTR __attribute__((aligned(4))); /* Callback to generate the beep frames - also don't want inlining of call below in beep_play */ static void __attribute__((noinline)) -beep_get_more(unsigned char **start, size_t *size) +beep_get_more(const void **start, size_t *size) { int count = beep_count; @@ -87,7 +87,7 @@ void beep_play(unsigned int frequency, unsigned int duration, #endif /* If it fits - avoid cb overhead */ - unsigned char *start; + const void *start; size_t size; /* Generate first frame here */ diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index e0bfa1f..7ba4eee 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -694,7 +694,7 @@ void pcmbuf_start_track_change(enum pcm_track_change_type type) /** Playback */ /* PCM driver callback */ -static void pcmbuf_pcm_callback(unsigned char **start, size_t *size) +static void pcmbuf_pcm_callback(const void **start, size_t *size) { /*- Process the chunk that just finished -*/ size_t index = chunk_ridx; diff --git a/apps/plugin.h b/apps/plugin.h index 2fb085d..e07ec92 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -153,12 +153,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 216 +#define PLUGIN_API_VERSION 217 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 216 +#define PLUGIN_MIN_API_VERSION 217 /* plugin return codes */ /* internal returns start at 0x100 to make exit(1..255) work */ @@ -651,7 +651,8 @@ struct plugin_api { const unsigned long *hw_freq_sampr; void (*pcm_apply_settings)(void); void (*pcm_play_data)(pcm_play_callback_type get_more, - unsigned char* start, size_t size); + pcm_status_callback_type status_cb, + const void *start, size_t size); void (*pcm_play_stop)(void); void (*pcm_set_frequency)(unsigned int frequency); bool (*pcm_is_playing)(void); @@ -669,6 +670,7 @@ struct plugin_api { void (*pcm_init_recording)(void); void (*pcm_close_recording)(void); void (*pcm_record_data)(pcm_rec_callback_type more_ready, + pcm_status_callback_type status_cb, void *start, size_t size); void (*pcm_stop_recording)(void); void (*pcm_calculate_rec_peaks)(int *left, int *right); @@ -689,12 +691,13 @@ struct plugin_api { int (*dsp_output_count)(struct dsp_config *dsp, int count); enum channel_status (*mixer_channel_status)(enum pcm_mixer_channel channel); - void * (*mixer_channel_get_buffer)(enum pcm_mixer_channel channel, int *count); + const void * (*mixer_channel_get_buffer)(enum pcm_mixer_channel channel, + int *count); void (*mixer_channel_calculate_peaks)(enum pcm_mixer_channel channel, int *left, int *right); void (*mixer_channel_play_data)(enum pcm_mixer_channel channel, pcm_play_callback_type get_more, - unsigned char *start, size_t size); + const void *start, size_t size); void (*mixer_channel_play_pause)(enum pcm_mixer_channel channel, bool play); void (*mixer_channel_stop)(enum pcm_mixer_channel channel); void (*mixer_channel_set_amplitude)(enum pcm_mixer_channel channel, diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c index 8ecbabd..8c7413c 100644 --- a/apps/plugins/beatbox/beatbox.c +++ b/apps/plugins/beatbox/beatbox.c @@ -509,7 +509,7 @@ void redrawScreen(unsigned char force) rb->lcd_update(); } -void get_more(unsigned char** start, size_t* size) +void get_more(const void** start, size_t* size) { #ifndef SYNC if(lastswap!=swap) @@ -523,10 +523,10 @@ void get_more(unsigned char** start, size_t* size) *size = BUF_SIZE*sizeof(short); #ifndef SYNC - *start = (unsigned char*)((swap ? gmbuf : gmbuf + BUF_SIZE)); + *start = swap ? gmbuf : gmbuf + BUF_SIZE; swap=!swap; #else - *start = (unsigned char*)(gmbuf); + *start = gmbuf; #endif } @@ -537,7 +537,7 @@ int beatboxmain() numberOfSamples=44100/10; synthbuf(); - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); rb->lcd_set_background(0x000000); rb->lcd_clear_display(); diff --git a/apps/plugins/doom/i_sound.c b/apps/plugins/doom/i_sound.c index 2d7b592..bdf70c1 100644 --- a/apps/plugins/doom/i_sound.c +++ b/apps/plugins/doom/i_sound.c @@ -457,11 +457,11 @@ void I_UpdateSound( void ) // only output be done asynchronous? // -void get_more(unsigned char** start, size_t* size) +void get_more(const void** start, size_t* size) { I_UpdateSound(); // Force sound update - *start = (unsigned char*)(mixbuffer); + *start = mixbuffer; *size = SAMPLECOUNT*2*sizeof(short); } @@ -471,7 +471,7 @@ void I_SubmitSound(void) if (!enable_sound) return; - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); } void I_ShutdownSound(void) diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index 1c4e1b4..f7d8943 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c @@ -1186,8 +1186,8 @@ static inline bool fft_init_fft_lib(void) static inline bool fft_get_fft(void) { int count; - int16_t *value = - (int16_t *) rb->mixer_channel_get_buffer(PCM_MIXER_CHAN_PLAYBACK, &count); + const int16_t *value = + rb->mixer_channel_get_buffer(PCM_MIXER_CHAN_PLAYBACK, &count); /* This block can introduce discontinuities in our data. Meaning, the * FFT will not be done a continuous segment of the signal. Which can * be bad. Or not. diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index da035a7..2974055 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c @@ -721,7 +721,7 @@ static void prepare_tock(void) static void play_tock(void) { - rb->pcm_play_data(NULL,(unsigned char *)sndbuf,sizeof(sndbuf)); + rb->pcm_play_data(NULL, NULL, sndbuf, sizeof(sndbuf)); } #endif /* CONFIG_CODEC != SWCODEC */ diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c index 40b4f1c..1412d4c 100644 --- a/apps/plugins/midi/midiplay.c +++ b/apps/plugins/midi/midiplay.c @@ -319,7 +319,7 @@ static inline void synthbuf(void) samples_in_buf = BUF_SIZE-i; } -static void get_more(unsigned char** start, size_t* size) +static void get_more(const void** start, size_t* size) { #ifndef SYNC if(lastswap != swap) @@ -333,10 +333,10 @@ static void get_more(unsigned char** start, size_t* size) *size = samples_in_buf*sizeof(int32_t); #ifndef SYNC - *start = (unsigned char*)((swap ? gmbuf : gmbuf + BUF_SIZE)); + *start = swap ? gmbuf : gmbuf + BUF_SIZE; swap = !swap; #else - *start = (unsigned char*)(gmbuf); + *start = gmbuf; #endif } @@ -396,7 +396,7 @@ static int midimain(const void * filename) samples_this_second = 0; synthbuf(); - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); while (!quit) { @@ -445,7 +445,7 @@ static int midimain(const void * filename) seekBackward(5); midi_debug("Rewind to %d:%02d\n", playing_time/60, playing_time%60); if (is_playing) - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); break; } @@ -455,7 +455,7 @@ static int midimain(const void * filename) seekForward(5); midi_debug("Skip to %d:%02d\n", playing_time/60, playing_time%60); if (is_playing) - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); break; } @@ -470,7 +470,7 @@ static int midimain(const void * filename) { midi_debug("Playing from %d:%02d\n", playing_time/60, playing_time%60); is_playing = true; - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); } break; } diff --git a/apps/plugins/mikmod/mikmod.c b/apps/plugins/mikmod/mikmod.c index a7eeb50..eb3be13 100644 --- a/apps/plugins/mikmod/mikmod.c +++ b/apps/plugins/mikmod/mikmod.c @@ -268,7 +268,7 @@ static inline void synthbuf(void) VC_WriteBytes(outptr, BUF_SIZE); } -void get_more(unsigned char** start, size_t* size) +void get_more(const void** start, size_t* size) { #ifndef SYNC if (lastswap != swap) @@ -282,10 +282,10 @@ void get_more(unsigned char** start, size_t* size) *size = BUF_SIZE; #ifndef SYNC - *start = (unsigned char*)((swap ? gmbuf : gmbuf + BUF_SIZE)); + *start = swap ? gmbuf : gmbuf + BUF_SIZE; swap = !swap; #else - *start = (unsigned char*)(gmbuf); + *start = gmbuf; #endif } @@ -660,7 +660,7 @@ int playfile(char* filename) { display = DISPLAY_INFO; Player_Start(module); - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); } #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -804,7 +804,7 @@ int playfile(char* filename) } else { - rb->pcm_play_data(&get_more, NULL, 0); + rb->pcm_play_data(&get_more, NULL, NULL, 0); } Player_TogglePause(); break; diff --git a/apps/plugins/mpegplayer/pcm_output.c b/apps/plugins/mpegplayer/pcm_output.c index 8db9531..8694ae4 100644 --- a/apps/plugins/mpegplayer/pcm_output.c +++ b/apps/plugins/mpegplayer/pcm_output.c @@ -85,7 +85,7 @@ static inline ssize_t pcm_output_bytes_free(void) } /* Audio DMA handler */ -static void get_more(unsigned char **start, size_t *size) +static void get_more(const void **start, size_t *size) { ssize_t sz; diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index 5165ff3..efba47b 100644 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c @@ -286,7 +286,7 @@ static int16_t raw_buf[NBSAMPLES] IBSS_ATTR; /* Audio callback */ -static void get_more(unsigned char **start, size_t *size) +static void get_more(const void **start, size_t *size) { int32_t *out, *outend; int16_t *raw; @@ -306,7 +306,7 @@ static void get_more(unsigned char **start, size_t *size) } while (out < outend); - *start = (unsigned char *)sound_buf; + *start = sound_buf; *size = NBSAMPLES*sizeof(sound_buf[0]); } @@ -339,7 +339,7 @@ static void start_sound(void) wsg3_set_sampling_rate(rb->hw_freq_sampr[sr_index]); rb->pcm_set_frequency(rb->hw_freq_sampr[sr_index]); - rb->pcm_play_data(get_more, NULL, 0); + rb->pcm_play_data(get_more, NULL, NULL, 0); sound_playing = true; } diff --git a/apps/plugins/pdbox/PDa/src/s_audio_rockbox.c b/apps/plugins/pdbox/PDa/src/s_audio_rockbox.c index 76a50fa..6571f74 100644 --- a/apps/plugins/pdbox/PDa/src/s_audio_rockbox.c +++ b/apps/plugins/pdbox/PDa/src/s_audio_rockbox.c @@ -26,7 +26,7 @@ #include "s_stuff.h" /* Declare functions that go to IRAM. */ -void pdbox_get_more(unsigned char** start, size_t* size) ICODE_ATTR; +void pdbox_get_more(const void** start, size_t* size) ICODE_ATTR; int rockbox_send_dacs(void) ICODE_ATTR; /* Extern variables. */ @@ -90,12 +90,12 @@ void rockbox_close_audio(void) } /* Rockbox audio callback. */ -void pdbox_get_more(unsigned char** start, size_t* size) +void pdbox_get_more(const void** start, size_t* size) { if(outbuf_fill > 0) { /* Store output data address and size. */ - *start = (unsigned char*) outbuf[outbuf_tail].data; + *start = outbuf[outbuf_tail].data; *size = sizeof(outbuf[outbuf_tail].data); /* Free this part of output buffer. */ @@ -116,8 +116,6 @@ void pdbox_get_more(unsigned char** start, size_t* size) playing = false; /* Nothing to play. */ - *start = NULL; - *size = 0; } } @@ -185,7 +183,7 @@ int rockbox_send_dacs(void) if(!playing && outbuf_fill > 0) { /* Start playing. */ - rb->pcm_play_data(pdbox_get_more, NULL, 0); + rb->pcm_play_data(pdbox_get_more, NULL, NULL, 0); /* Set status flag. */ playing = true; diff --git a/apps/plugins/pitch_detector.c b/apps/plugins/pitch_detector.c index c30d48a..4ae43b3 100644 --- a/apps/plugins/pitch_detector.c +++ b/apps/plugins/pitch_detector.c @@ -952,7 +952,7 @@ static uint32_t ICODE_ATTR buffer_magnitude(int16_t *input) } /* Stop the recording when the buffer is full */ -static void recording_callback(int status, void **start, size_t *size) +static void recording_callback(void **start, size_t *size) { int tail = audio_tail ^ 1; @@ -963,8 +963,6 @@ static void recording_callback(int status, void **start, size_t *size) /* Always record full buffer, even if not required */ *start = audio_data[tail]; *size = BUFFER_SIZE * sizeof (int16_t); - - (void)status; } #endif /* SIMULATOR */ @@ -973,7 +971,8 @@ static void record_data(void) { #ifndef SIMULATOR /* Always record full buffer, even if not required */ - rb->pcm_record_data(recording_callback, audio_data[audio_tail], + rb->pcm_record_data(recording_callback, NULL, + audio_data[audio_tail], BUFFER_SIZE * sizeof (int16_t)); #endif } diff --git a/apps/plugins/rockboy/rbsound.c b/apps/plugins/rockboy/rbsound.c index c0d0277..628879b 100644 --- a/apps/plugins/rockboy/rbsound.c +++ b/apps/plugins/rockboy/rbsound.c @@ -16,10 +16,10 @@ static unsigned short *buf=0, *hwbuf=0; static bool newly_started; -static void get_more(unsigned char** start, size_t* size) +static void get_more(const void** start, size_t* size) { memcpy(hwbuf, &buf[pcm.len*doneplay], BUF_SIZE*sizeof(short)); - *start = (unsigned char*)(hwbuf); + *start = hwbuf; *size = BUF_SIZE*sizeof(short); doneplay=1; } @@ -76,7 +76,7 @@ int rockboy_pcm_submit(void) if(newly_started) { - rb->pcm_play_data(&get_more,NULL,0); + rb->pcm_play_data(&get_more, NULL, NULL,0); newly_started = false; } diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c index db8301b..fc2f695 100644 --- a/apps/plugins/test_sampr.c +++ b/apps/plugins/test_sampr.c @@ -90,13 +90,13 @@ static int16_t ICODE_ATTR fsin(uint32_t phase) } /* ISR handler to get next block of data */ -static void get_more(unsigned char **start, size_t *size) +static void get_more(const void **start, size_t *size) { /* Free previous buffer */ output_head += output_step; output_step = 0; - *start = (unsigned char *)output_buf[output_head & OUTPUT_CHUNK_MASK]; + *start = output_buf[output_head & OUTPUT_CHUNK_MASK]; *size = OUTPUT_CHUNK_SIZE; /* Keep repeating previous if source runs low */ @@ -236,7 +236,7 @@ static void play_tone(bool volume_set) IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); - rb->pcm_play_data(get_more, NULL, 0); + rb->pcm_play_data(get_more, NULL, NULL, 0); #ifndef HAVE_VOLUME_IN_LIST if (volume_set) diff --git a/apps/plugins/zxbox/spsound.c b/apps/plugins/zxbox/spsound.c index 8b3aa3d..9d3eefa 100644 --- a/apps/plugins/zxbox/spsound.c +++ b/apps/plugins/zxbox/spsound.c @@ -189,12 +189,11 @@ void autoclose_sound(void) } #endif } -static void get_more(unsigned char** start, size_t* size) +static void get_more(const void** start, size_t* size) { doneplay = 1; - rb->pcm_play_stop(); - (void)*start; - (void)*size; + (void)start; + (void)size; } /* sp_sound_buf is Unsigned 8 bit, Rate 8000 Hz, Mono */ @@ -219,7 +218,7 @@ static void write_buf(void){ = my_buf[j+10] = my_buf[j+11] \ = (((byte)sp_sound_buf[i])<<8) >> settings.volume; - rb->pcm_play_data(&get_more,(unsigned char*)(my_buf),TMNUM*4*3*2); + rb->pcm_play_data(&get_more,NULL,(unsigned char*)(my_buf),TMNUM*4*3*2); #if 0 /* can use to save and later analyze what we produce */ diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c index 90a6163..d904be9 100644 --- a/apps/recorder/pcm_record.c +++ b/apps/recorder/pcm_record.c @@ -257,20 +257,9 @@ enum /*******************************************************************/ /* Callback for when more data is ready - called in interrupt context */ -static void pcm_rec_have_more(int status, void **start, size_t *size) +static void pcm_rec_have_more(void **start, size_t *size) { - if (status < 0) - { - /* some error condition */ - if (status == DMA_REC_ERROR_DMA) - { - /* Flush recorded data to disk and stop recording */ - queue_post(&pcmrec_queue, PCMREC_STOP, 0); - return; - } - /* else try again next transmission - frame is invalid */ - } - else if (!dma_lock) + if (!dma_lock) { /* advance write position */ int next_pos = (dma_wr_pos + PCM_CHUNK_SIZE) & PCM_CHUNK_MASK; @@ -287,6 +276,23 @@ static void pcm_rec_have_more(int status, void **start, size_t *size) *size = PCM_CHUNK_SIZE; } /* pcm_rec_have_more */ +static enum pcm_dma_status pcm_rec_status_callback(enum pcm_dma_status status) +{ + if (status < PCM_DMAST_OK) + { + /* some error condition */ + if (status == PCM_DMAST_ERR_DMA) + { + /* Flush recorded data to disk and stop recording */ + queue_post(&pcmrec_queue, PCMREC_STOP, 0); + return status; + } + /* else try again next transmission - frame is invalid */ + } + + return PCM_DMAST_OK; +} /* pcm_rec_status_callback */ + static void reset_hardware(void) { /* reset pcm to defaults */ @@ -1239,8 +1245,8 @@ static void pcmrec_set_recording_options( { /* start DMA transfer */ dma_lock = pre_record_ticks == 0; - pcm_record_data(pcm_rec_have_more, GET_PCM_CHUNK(dma_wr_pos), - PCM_CHUNK_SIZE); + pcm_record_data(pcm_rec_have_more, pcm_rec_status_callback, + GET_PCM_CHUNK(dma_wr_pos), PCM_CHUNK_SIZE); } else { diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 2f216cd..5d23a74 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) { |