CVS: rdesktop rdpsnd_libao.c,1.5,1.6

Michael Gernoth <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25874

Modified Files:
	rdpsnd_libao.c 
Log Message:
add upsampling for mono-channels


Index: rdpsnd_libao.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_libao.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rdpsnd_libao.c	8 Mar 2005 12:29:19 -0000	1.5
--- rdpsnd_libao.c	8 Mar 2005 17:03:08 -0000	1.6
***************
*** 28,32 ****
  
  #define MAX_QUEUE	10
! #define WAVEOUTBUF	32
  
  int g_dsp_fd;
--- 28,32 ----
  
  #define MAX_QUEUE	10
! #define WAVEOUTBUF	64
  
  int g_dsp_fd;
***************
*** 34,37 ****
--- 34,38 ----
  int default_driver;
  int g_samplerate;
+ int g_channels;
  BOOL g_dsp_busy = False;
  static short g_samplewidth;
***************
*** 55,58 ****
--- 56,60 ----
  	format.bits = 16;
  	format.channels = 2;
+ 	g_channels = 2;
  	format.rate = 44100;
  	g_samplerate = 44100;
***************
*** 112,115 ****
--- 114,118 ----
  	format.bits = pwfx->wBitsPerSample;
  	format.channels = pwfx->nChannels;
+ 	g_channels = pwfx->nChannels;
  	format.rate = 44100;
  	g_samplerate = pwfx->nSamplesPerSec;
***************
*** 185,200 ****
  	{
  		/* Resample to 44100 */
! 		for (i = 0; (i < ((WAVEOUTBUF / 8) * (3 - g_samplewidth))) && (out->p < out->end);
  		     i++)
  		{
! 			offset = i * 4 * g_samplewidth;
! 			memcpy(&outbuf[0 * g_samplewidth + offset], out->p, g_samplewidth);
! 			memcpy(&outbuf[2 * g_samplewidth + offset], out->p, g_samplewidth);
! 			out->p += 2;
  
! 			memcpy(&outbuf[1 * g_samplewidth + offset], out->p, g_samplewidth);
! 			memcpy(&outbuf[3 * g_samplewidth + offset], out->p, g_samplewidth);
  			out->p += 2;
! 			len += 4 * g_samplewidth;
  		}
  	}
--- 188,204 ----
  	{
  		/* Resample to 44100 */
! 		for (i = 0; (i < ((WAVEOUTBUF / 4) * (3 - g_samplewidth))) && (out->p < out->end);
  		     i++)
  		{
! 			if (g_channels == 2)
! 				offset = ((i * 2) - (i & 1)) * g_samplewidth;
! 			else
! 				offset = (i * 2) * g_samplewidth;
  
! 			memcpy(&outbuf[offset], out->p, g_samplewidth);
! 			memcpy(&outbuf[g_channels * g_samplewidth + offset], out->p, g_samplewidth);
  			out->p += 2;
! 
! 			len += 2 * g_samplewidth;
  		}
  	}



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.