summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index 56ebacb24c..b24e261371 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -269,7 +269,6 @@ void convert_stereo_mode(long *dest, long *src, int samplecount)
269 } 269 }
270} 270}
271 271
272/* Not yet functional. */
273void scale_up(long *dest, short *src, int samplecount) 272void scale_up(long *dest, short *src, int samplecount)
274{ 273{
275 int i; 274 int i;
@@ -287,8 +286,6 @@ void scale_up_convert_stereo_mode(long *dest, short *src, int samplecount)
287 for (i = 0; i < samplecount; i++) { 286 for (i = 0; i < samplecount; i++) {
288 dest[i] = (long)(src[i*2+0] << SAMPLE_DEPTH); 287 dest[i] = (long)(src[i*2+0] << SAMPLE_DEPTH);
289 dest[i+samplecount] = (long)(src[i*2+1] << SAMPLE_DEPTH); 288 dest[i+samplecount] = (long)(src[i*2+1] << SAMPLE_DEPTH);
290 //dest[i] = (long)(((src[i*2 + 0] << 8)&0x7fff) | ((1L << 31) & src[i*2+0]<<15));
291 //dest[i+samplecount] = (long)(((src[i*2 + 1] << 8)&0x7fff) | ((1L << 31) & src[i*2+1]<<15));
292 } 289 }
293} 290}
294 291
@@ -307,21 +304,22 @@ int dsp_process(char *dest, char *src, int samplecount)
307 p = src; 304 p = src;
308 /* Scale up to 32-bit samples. */ 305 /* Scale up to 32-bit samples. */
309 if (dsp_config.sample_depth <= SAMPLE_DEPTH) { 306 if (dsp_config.sample_depth <= SAMPLE_DEPTH) {
310 if (dsp_config.stereo_mode == STEREO_INTERLEAVED) 307 if (dsp_config.stereo_mode == STEREO_INTERLEAVED) {
311 scale_up_convert_stereo_mode((long *)samplebuf, 308 scale_up_convert_stereo_mode((long *)samplebuf,
312 (short *)p, copy_n); 309 (short *)p, copy_n);
313 else 310 } else {
314 scale_up((long *)samplebuf, (short *)p, copy_n); 311 scale_up((long *)samplebuf, (short *)p, copy_n);
312 }
315 p = samplebuf; 313 p = samplebuf;
316 fracbits = 31; 314 fracbits = 31;
317 } 315 }
318 316
319 /* Convert to non-interleaved stereo. */ 317 /* Convert to non-interleaved stereo. */
320 else if (dsp_config.stereo_mode == STEREO_INTERLEAVED) { 318 else if (dsp_config.stereo_mode == STEREO_INTERLEAVED) {
321 convert_stereo_mode((long *)samplebuf, (long *)p, copy_n); 319 convert_stereo_mode((long *)samplebuf, (long *)p, copy_n / 2);
322 p = samplebuf; 320 p = samplebuf;
323 } 321 }
324 322
325 /* Apply DSP functions. */ 323 /* Apply DSP functions. */
326 if (dsp_config.stereo_mode == STEREO_INTERLEAVED) { 324 if (dsp_config.stereo_mode == STEREO_INTERLEAVED) {
327 channel = 0; 325 channel = 0;
@@ -330,6 +328,12 @@ int dsp_process(char *dest, char *src, int samplecount)
330 channel = 1; 328 channel = 1;
331 process((short *)dest, (long *)p, copy_n / 2); 329 process((short *)dest, (long *)p, copy_n / 2);
332 dest += rc; 330 dest += rc;
331 } else if (dsp_config.stereo_mode == STEREO_MONO) {
332 channel = 0;
333 rc = process((short *)dest, (long *)p, copy_n) * 4;
334 channel = 1;
335 process((short *)dest, (long *)p, copy_n);
336 dest += rc;
333 } else { 337 } else {
334 rc = process((short *)dest, (long *)p, copy_n) * 2; 338 rc = process((short *)dest, (long *)p, copy_n) * 2;
335 dest += rc * 2; 339 dest += rc * 2;