From e9eb80017a77618e888a238906b6fffbcb37a298 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Tue, 8 Mar 2005 17:23:26 +0000 Subject: [PATCH] bugfix: correctly increment the out->p pointer git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@840 423420c4-83ab-492f-b58f-81f9feb106b5 --- rdpsnd_libao.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rdpsnd_libao.c b/rdpsnd_libao.c index 09cd139..25a0de8 100644 --- a/rdpsnd_libao.c +++ b/rdpsnd_libao.c @@ -190,6 +190,11 @@ wave_out_play(void) for (i = 0; (i < ((WAVEOUTBUF / 4) * (3 - g_samplewidth))) && (out->p < out->end); i++) { + /* On a stereo-channel we must make sure that left and right + does not get mixed up, so we need to expand the sample- + data with channels in mind: 1234 -> 12123434 + If we have a mono-channel, we can expand the data by simply + doubling the sample-data: 1234 -> 11223344 */ if (g_channels == 2) offset = ((i * 2) - (i & 1)) * g_samplewidth; else @@ -197,8 +202,8 @@ wave_out_play(void) memcpy(&outbuf[offset], out->p, g_samplewidth); memcpy(&outbuf[g_channels * g_samplewidth + offset], out->p, g_samplewidth); - out->p += 2; + out->p += g_samplewidth; len += 2 * g_samplewidth; } }