diff options
Diffstat (limited to 'apps/voice_thread.c')
-rw-r--r-- | apps/voice_thread.c | 17 |
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 | |||
116 | /* Structure to store clip data callback info */ | 116 | /* Structure to store clip data callback info */ |
117 | struct voice_info | 117 | struct voice_info |
118 | { | 118 | { |
119 | pcm_play_callback_type get_more; /* Callback to get more clips */ | 119 | /* Callback to get more clips */ |
120 | unsigned char *start; /* Start of clip */ | 120 | void (*get_more)(unsigned char** start, size_t* size); |
121 | size_t size; /* Size of clip */ | 121 | /* Start of clip */ |
122 | unsigned char *start; | ||
123 | /* Size of clip */ | ||
124 | size_t size; | ||
122 | }; | 125 | }; |
123 | 126 | ||
124 | /* Private thread data for its current state that must be passed to its | 127 | /* Private thread data for its current state that must be passed to its |
@@ -148,14 +151,14 @@ static inline int voice_unplayed_frames(void) | |||
148 | } | 151 | } |
149 | 152 | ||
150 | /* Mixer channel callback */ | 153 | /* Mixer channel callback */ |
151 | static void voice_pcm_callback(unsigned char **start, size_t *size) | 154 | static void voice_pcm_callback(const void **start, size_t *size) |
152 | { | 155 | { |
153 | if (voice_unplayed_frames() == 0) | 156 | if (voice_unplayed_frames() == 0) |
154 | return; /* Done! */ | 157 | return; /* Done! */ |
155 | 158 | ||
156 | unsigned int i = ++cur_buf_out % VOICE_FRAMES; | 159 | unsigned int i = ++cur_buf_out % VOICE_FRAMES; |
157 | 160 | ||
158 | *start = (unsigned char *)voicebuf[i]; | 161 | *start = voicebuf[i]; |
159 | *size = voicebuf_sizes[i]; | 162 | *size = voicebuf_sizes[i]; |
160 | } | 163 | } |
161 | 164 | ||
@@ -167,7 +170,7 @@ static void voice_start_playback(void) | |||
167 | 170 | ||
168 | unsigned int i = cur_buf_out % VOICE_FRAMES; | 171 | unsigned int i = cur_buf_out % VOICE_FRAMES; |
169 | mixer_channel_play_data(PCM_MIXER_CHAN_VOICE, voice_pcm_callback, | 172 | mixer_channel_play_data(PCM_MIXER_CHAN_VOICE, voice_pcm_callback, |
170 | (unsigned char *)voicebuf[i], voicebuf_sizes[i]); | 173 | voicebuf[i], voicebuf_sizes[i]); |
171 | } | 174 | } |
172 | 175 | ||
173 | /* Stop the voice channel */ | 176 | /* Stop the voice channel */ |
@@ -198,7 +201,7 @@ static void voice_buf_commit(size_t size) | |||
198 | 201 | ||
199 | /* Stop any current clip and start playing a new one */ | 202 | /* Stop any current clip and start playing a new one */ |
200 | void mp3_play_data(const unsigned char* start, int size, | 203 | void mp3_play_data(const unsigned char* start, int size, |
201 | pcm_play_callback_type get_more) | 204 | void (*get_more)(unsigned char** start, size_t* size)) |
202 | { | 205 | { |
203 | if (get_more != NULL && start != NULL && (ssize_t)size > 0) | 206 | if (get_more != NULL && start != NULL && (ssize_t)size > 0) |
204 | { | 207 | { |