--- sourceforge.net/trunk/rdesktop/rdpsnd_dsp.c 2006/10/02 08:01:24 1292 +++ sourceforge.net/trunk/rdesktop/rdpsnd_dsp.c 2007/01/08 04:47:06 1372 @@ -1,7 +1,7 @@ /* rdesktop: A Remote Desktop Protocol client. Sound DSP routines - Copyright (C) Michael Gernoth 2006 + Copyright (C) Michael Gernoth 2006-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ } void -rdpsnd_dsp_softvol(unsigned char *buffer, unsigned int size, WAVEFORMATEX * format) +rdpsnd_dsp_softvol(unsigned char *buffer, unsigned int size, RD_WAVEFORMATEX * format) { unsigned int factor_left, factor_right; unsigned char *posin = buffer; @@ -111,7 +111,7 @@ } void -rdpsnd_dsp_swapbytes(unsigned char *buffer, unsigned int size, WAVEFORMATEX * format) +rdpsnd_dsp_swapbytes(unsigned char *buffer, unsigned int size, RD_WAVEFORMATEX * format) { int i; uint8 swap; @@ -127,7 +127,7 @@ } } -BOOL +RD_BOOL rdpsnd_dsp_resample_set(uint32 device_srate, uint16 device_bitspersample, uint16 device_channels) { #ifdef HAVE_LIBSAMPLERATE @@ -158,8 +158,8 @@ return True; } -BOOL -rdpsnd_dsp_resample_supported(WAVEFORMATEX * format) +RD_BOOL +rdpsnd_dsp_resample_supported(RD_WAVEFORMATEX * format) { if (format->wFormatTag != WAVE_FORMAT_PCM) return False; @@ -173,7 +173,7 @@ uint32 rdpsnd_dsp_resample(unsigned char **out, unsigned char *in, unsigned int size, - WAVEFORMATEX * format, BOOL stream_be) + RD_WAVEFORMATEX * format, RD_BOOL stream_be) { #ifdef HAVE_LIBSAMPLERATE SRC_DATA resample_data; @@ -308,7 +308,7 @@ if (source * resample_to_channels + samplewidth > size) break; -#if 0 /* Linear resampling, TODO: soundquality fixes */ +#if 0 /* Linear resampling, TODO: soundquality fixes (LP filter) */ if (samplewidth == 1) { sint8 cval1, cval2; @@ -321,7 +321,7 @@ in + ((source + 1) * resample_to_channels * samplewidth) + (samplewidth * j), samplewidth); - cval1 += (cval2 * part) / 100; + cval1 += (sint8) (cval2 * part) / 100; memcpy(*out + (i * resample_to_channels * samplewidth) + (samplewidth * j), &cval1, samplewidth); @@ -339,7 +339,7 @@ in + ((source + 1) * resample_to_channels * samplewidth) + (samplewidth * j), samplewidth); - sval1 += (sval2 * part) / 100; + sval1 += (sint16) (sval2 * part) / 100; memcpy(*out + (i * resample_to_channels * samplewidth) + (samplewidth * j), &sval1, samplewidth); @@ -384,20 +384,21 @@ } STREAM -rdpsnd_dsp_process(STREAM s, struct audio_driver * current_driver, WAVEFORMATEX * format) +rdpsnd_dsp_process(unsigned char *data, unsigned int size, struct audio_driver * current_driver, + RD_WAVEFORMATEX * format) { static struct stream out; - BOOL stream_be = False; + RD_BOOL stream_be = False; /* softvol and byteswap do not change the amount of data they return, so they can operate on the input-stream */ if (current_driver->wave_out_volume == rdpsnd_dsp_softvol_set) - rdpsnd_dsp_softvol(s->data, s->size, format); + rdpsnd_dsp_softvol(data, size, format); #ifdef B_ENDIAN if (current_driver->need_byteswap_on_be) { - rdpsnd_dsp_swapbytes(s->data, s->size, format); + rdpsnd_dsp_swapbytes(data, size, format); stream_be = True; } #endif @@ -405,13 +406,13 @@ out.data = NULL; if (current_driver->need_resampling) - out.size = rdpsnd_dsp_resample(&out.data, s->data, s->size, format, stream_be); + out.size = rdpsnd_dsp_resample(&out.data, data, size, format, stream_be); if (out.data == NULL) { - out.data = xmalloc(s->size); - memcpy(out.data, s->data, s->size); - out.size = s->size; + out.data = xmalloc(size); + memcpy(out.data, data, size); + out.size = size; } out.p = out.data;