summaryrefslogtreecommitdiff
path: root/apps/voice_thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/voice_thread.c')
-rw-r--r--apps/voice_thread.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 1a86dc7cfa..c9520e6165 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -161,11 +161,18 @@ static int move_callback(int handle, void *current, void *new)
161 /* Have to adjust the pointers that point into things in voice_buf */ 161 /* Have to adjust the pointers that point into things in voice_buf */
162 off_t diff = new - current; 162 off_t diff = new - current;
163 struct voice_thread_data *td = voice_buf->td; 163 struct voice_thread_data *td = voice_buf->td;
164 td->src.p32[0] = SKIPBYTES(td->src.p32[0], diff); 164
165 td->src.p32[1] = SKIPBYTES(td->src.p32[1], diff); 165 if (td != NULL)
166 if (td->dst != NULL) /* Only when calling dsp_process */ 166 {
167 td->dst->p16out = SKIPBYTES(td->dst->p16out, diff); 167 td->src.p32[0] = SKIPBYTES(td->src.p32[0], diff);
168 mixer_adjust_channel_address(PCM_MIXER_CHAN_VOICE, diff); 168 td->src.p32[1] = SKIPBYTES(td->src.p32[1], diff);
169
170 if (td->dst != NULL) /* Only when calling dsp_process */
171 td->dst->p16out = SKIPBYTES(td->dst->p16out, diff);
172
173 mixer_adjust_channel_address(PCM_MIXER_CHAN_VOICE, diff);
174 }
175
169 voice_buf = new; 176 voice_buf = new;
170 177
171 return BUFLIB_CB_OK; 178 return BUFLIB_CB_OK;
@@ -322,10 +329,7 @@ static void voice_data_init(struct voice_thread_data *td)
322 dsp_configure(td->dsp, DSP_SET_STEREO_MODE, STEREO_MONO); 329 dsp_configure(td->dsp, DSP_SET_STEREO_MODE, STEREO_MONO);
323 330
324 mixer_channel_set_amplitude(PCM_MIXER_CHAN_VOICE, MIX_AMP_UNITY); 331 mixer_channel_set_amplitude(PCM_MIXER_CHAN_VOICE, MIX_AMP_UNITY);
325
326 voice_buf->frame_in = voice_buf->frame_out = 0;
327 voice_buf->td = td; 332 voice_buf->td = td;
328 td->dst = NULL;
329} 333}
330 334
331/* Voice thread message processing */ 335/* Voice thread message processing */
@@ -536,6 +540,8 @@ void voice_thread_init(void)
536 return; 540 return;
537 } 541 }
538 542
543 memset(voice_buf, 0, sizeof (*voice_buf));
544
539 logf("Starting voice thread"); 545 logf("Starting voice thread");
540 queue_init(&voice_queue, false); 546 queue_init(&voice_queue, false);
541 547