Author: nyadav
Date: Sat Jun 18 10:37:54 2011
New Revision: 52328
URL:
http://svn.reactos.org/svn/reactos?rev=52328&view=rev
Log:
[AUDSRV] fix mixer routine, working now
Modified:
branches/nyadav-audio-branch/base/services/audsrv/mixer.c
branches/nyadav-audio-branch/base/services/audsrv/stream.c
Modified: branches/nyadav-audio-branch/base/services/audsrv/mixer.c
URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
==============================================================================
--- branches/nyadav-audio-branch/base/services/audsrv/mixer.c [iso-8859-1] (original)
+++ branches/nyadav-audio-branch/base/services/audsrv/mixer.c [iso-8859-1] Sat Jun 18
10:37:54 2011
@@ -43,11 +43,14 @@
stream = mixer->serverstreamlist;
minsamplevalue = *(short *) stream->minsamplevalue;
maxsamplevalue = *(short *) stream->maxsamplevalue;
- while(stream->next != NULL)
+
+ while( stream != NULL)
{
localsrcbuf = stream->filteredbuf;
if(stream->ready == TRUE )
{
+ coefficient = 1.0;
+
if( *(short *)stream->maxsamplevalue != maxsamplevalue ||
*(short *)stream->minsamplevalue != minsamplevalue )
{
@@ -56,18 +59,16 @@
coefficient = (float) maxsamplevalue / (float)*(short
*)stream->maxsamplevalue;
else
coefficient = (float) minsamplevalue / (float)*(short
*)stream->minsamplevalue;
-
- for(i=0;i<stream->length_filtered;i++)
- {
- localsinkbuf[i] = (short) (( (localsinkbuf[i] * streamcount) +
((short)((float) localsrcbuf[i] ) * coefficient) ) / (streamcount +1));
- }
}
+ for(i=0;i<stream->length_filtered/sizeof(short);i++)
+ {
+ localsinkbuf[i] = (short) (( (localsinkbuf[i] * streamcount) +
((short)((float) localsrcbuf[i] ) * coefficient) ) / (streamcount +1));
+ }
}
- stream->ready = 0;
+ //stream->ready = 0; /*TODO Enable it when actual filter thread starts
working*/
streamcount++;
stream = stream->next;
}
-
CopyMemory(mixer->masterbuf[buffer],mixer->serverstreamlist->filteredbuf,mixer->serverstreamlist->length_filtered);
return NULL;
}
Modified: branches/nyadav-audio-branch/base/services/audsrv/stream.c
URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
==============================================================================
--- branches/nyadav-audio-branch/base/services/audsrv/stream.c [iso-8859-1] (original)
+++ branches/nyadav-audio-branch/base/services/audsrv/stream.c [iso-8859-1] Sat Jun 18
10:37:54 2011
@@ -36,7 +36,11 @@
while (i < localstream->length_filtered / 2)
{
tempbuf[i] = 0x7FFF * sin(0.5 * (i - 1) * 500 * 6.28 / 48000);
- if(initmin)
+
+ if((localstream->streamid %2) == 0)
+ tempbuf[i] = 0;
+
+ if(initmin)
{
if(tempbuf[i]<minimum)
minimum = tempbuf[i];
@@ -57,6 +61,11 @@
i++;
tempbuf[i] = 0x7FFF * sin(0.5 * (i - 2) * 500 * 6.28 / 48000);
+
+ if((localstream->streamid %2) != 0)
+ tempbuf[i] = 0;
+
+
if(initmin)
{
if(tempbuf[i]<minimum)