On Sat, Jun 4, 2011 at 4:02 AM, Ged Murphy <gedmurphy@gmail.com> wrote:
Can you use the reactos / ansi coding standard.
This code is almost unreadable, which makes it very difficult to review

Sorry, I will keep that in mind from next time onwards 
On 3 June 2011 22:41,  <nyadav@svn.reactos.org> wrote:
> Author: nyadav
> Date: Fri Jun  3 21:41:26 2011
> New Revision: 52076
>
> URL: http://svn.reactos.org/svn/reactos?rev=52076&view=rev
> Log:
> [AUDSRV] finish upto actual mixing functions
>
> Added:
>    branches/nyadav-audio-branch/base/services/audsrv/mixer.c   (with props)
> Modified:
>    branches/nyadav-audio-branch/base/services/audsrv/CMakeLists.txt
>    branches/nyadav-audio-branch/base/services/audsrv/audsrv.c
>    branches/nyadav-audio-branch/base/services/audsrv/audsrv.h
>    branches/nyadav-audio-branch/base/services/audsrv/rpc.c
>    branches/nyadav-audio-branch/base/services/audsrv/stream.c
>    branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c
>    branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.spec
>    branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c
>    branches/nyadav-audio-branch/include/reactos/idl/audsrvrpc.idl
>    branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h
>
> Modified: branches/nyadav-audio-branch/base/services/audsrv/CMakeLists.txt
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/services/audsrv/CMakeLists.txt?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/base/services/audsrv/CMakeLists.txt [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/base/services/audsrv/CMakeLists.txt [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -7,6 +7,7 @@
>     audsrv.c
>     audsrv.rc
>     rpc.c
> +       mixer.c
>        stream.c)
>
>  add_executable(audsrv ${SOURCE})
>
> Modified: branches/nyadav-audio-branch/base/services/audsrv/audsrv.c
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/services/audsrv/audsrv.c?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/base/services/audsrv/audsrv.c [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/base/services/audsrv/audsrv.c [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -41,6 +41,7 @@
>  const GUID KSMEDIUMSETID_Standard               = {0x4747B320L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
>  const GUID KSDATAFORMAT_TYPE_AUDIO              = {0x73647561L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
>  const GUID KSDATAFORMAT_SUBTYPE_PCM             = {0x00000001L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
> +const GUID KSDATAFORMAT_SUBTYPE_IEEE_FLOAT      = {0x00000003L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
>  const GUID KSDATAFORMAT_SPECIFIER_WAVEFORMATEX  = {0x05589f81L, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
>
>  MixerEngine engine,*pengine;
> @@ -152,24 +153,31 @@
>
>
>
> -
> -void fill(MixerEngine * mixer,int buffer)
> -{
> -       DWORD Length;
> -       UINT i = 0;
> -Sleep(100);
> -       Length = mixer->masterfreq * mixer->masterchannels * mixer->masterbitspersample / 8;
> -       mixer->masterbuf[buffer] = (PSHORT)HeapAlloc(GetProcessHeap(), 0, Length);
> -    while (i < Length / 2)
> -    {
> -        mixer->masterbuf[buffer][i] = 0x7FFF * sin(0.5 * (i - 1) * 500 * _2pi / 48000);
> -        i++;
> -        mixer->masterbuf[buffer][i] = 0x7FFF * sin(0.5 * (i - 2) * 500 * _2pi / 48000);
> -        i++;
> -    }
> -       mixer->bytes_to_play = Length;
> -}
> -
> +void mixandfill(MixerEngine * mixer,int buffer)
> +{
> +       while(WaitForSingleObject(mixer->streampresent,100)!=0){if(mixer->dead) return;} /*Check if there is at least one stream present.*/
> +       if(mixer->masterdatatype == 0)/*signed int*/
> +       {
> +               if(mixer->masterbitspersample == 8)mixs8(mixer,buffer);else if(mixer->masterbitspersample == 16) mixs16(mixer,buffer);else if(mixer->masterbitspersample == 32) mixs32(mixer,buffer);else if(mixer->masterbitspersample == 64) mixs64(mixer,buffer);
> +       }
> +       else if (mixer->masterdatatype == 1)/*unsigned int*/
> +       {
> +               if(mixer->masterbitspersample == 8)mixu8(mixer,buffer);else if(mixer->masterbitspersample == 16) mixu16(mixer,buffer);else if(mixer->masterbitspersample == 32) mixu32(mixer,buffer);else if(mixer->masterbitspersample == 64) mixu64(mixer,buffer);
> +       }
> +       else if(mixer->masterdatatype == 2)/*Float*/
> +       {
> +               if(mixer->masterbitspersample == 32)mixfl32(mixer,buffer);else if(mixer->masterbitspersample == 64) mixfl64(mixer,buffer);
> +       }
> +
> +       mixer->masterbuf[buffer] = HeapAlloc(GetProcessHeap(), 0, mixer->serverstreamlist->length_filtered);
> +       CopyMemory(mixer->masterbuf[buffer],mixer->serverstreamlist->filteredbuf,mixer->serverstreamlist->length_filtered);
> +       mixer->bytes_to_play = mixer->serverstreamlist->length_filtered;
> +}
> +void freebuffer()
> +{
> +       HeapFree(GetProcessHeap(), 0, pengine->masterbuf[pengine->playcurrent]);
> +       pengine->masterbuf[pengine->playcurrent] = NULL;
> +}
>  void playbuffer(MixerEngine * mixer,int buffer)
>  {
>        SP_DEVICE_INTERFACE_DATA InterfaceData;
> @@ -276,7 +284,10 @@
>     DataFormat->Flags = 0;
>     DataFormat->Reserved = 0;
>     DataFormat->MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
> -    DataFormat->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
> +       if(mixer->masterdatatype == 0 || mixer->masterdatatype == 1)
> +               DataFormat->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
> +       else
> +               DataFormat->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
>     DataFormat->Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
>     DataFormat->SampleSize = mixer->masterchannels * mixer->masterbitspersample / 8;
>     DataFormat->FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEXTENSIBLE);
> @@ -290,9 +301,11 @@
>     WaveFormat->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
>        WaveFormat->dwChannelMask = mixer->masterchannelmask;
>     WaveFormat->Samples.wValidBitsPerSample = mixer->masterbitspersample;
> -    WaveFormat->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
> -
> -    //printf("Creating pin\n");
> +       if(mixer->masterdatatype == 0 || mixer->masterdatatype == 1)
> +               WaveFormat->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
> +       else
> +               WaveFormat->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
> +
>
>        //
>     // Create the pin
> @@ -367,12 +380,9 @@
>        SetEvent(mixer->played);
>        while(1)
>        {
> -       while(WaitForSingleObject(mixer->streampresent,100)!=0){if(mixer->dead)goto DEAD;} /*Check if there is at least one stream present.*/
> -
>        while(WaitForSingleObject(mixer->played,100)!=0){if(mixer->dead)goto DEAD;}
> -       fill(mixer,1-mixer->playcurrent);
> +       mixandfill(mixer,1-mixer->playcurrent);
>        SetEvent(mixer->filled);
> -
>        }
>  DEAD:
>        printf("\nMixer Thread Ended\n");
> @@ -386,7 +396,7 @@
>                while(WaitForSingleObject(mixer->filled,100)!=0){if(mixer->dead)goto DEAD;}
>                SetEvent(mixer->played);
>                playbuffer(mixer,mixer->playcurrent);
> -
> +               freebuffer();
>                mixer->playcurrent=1-mixer->playcurrent;
>        }
>
> @@ -468,6 +478,7 @@
>        pengine->mute=FALSE;
>
>        pengine->dead=0;
> +       pengine->streamidpool=0;
>        pengine->playcurrent=1;
>        pengine->masterbuf[0] = NULL;
>        pengine->masterbuf[1] = NULL;
> @@ -501,6 +512,7 @@
>        pengine->mute=FALSE;
>
>        pengine->dead=0;
> +       pengine->streamidpool=0;
>        pengine->playcurrent=1;
>        pengine->masterbuf[0] = NULL;
>        pengine->masterbuf[1] = NULL;
>
> Modified: branches/nyadav-audio-branch/base/services/audsrv/audsrv.h
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/services/audsrv/audsrv.h?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/base/services/audsrv/audsrv.h [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/base/services/audsrv/audsrv.h [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -29,15 +29,24 @@
>
>  typedef struct ServerStream
>  {
> +       long streamid;
>        int volume;
>        LONG freq;
>        int bitspersample;
> +       int datatype;  /*0=signed int,1=unsigned int,2=float*/
>        int channels;
>        ULONG channelmask;
>        HANDLE played;
> -       HANDLE streamready;
> +       HANDLE threadready;
>        HANDLE thread;
>        float balance;
> +       BOOL ready;
> +       PVOID genuinebuf;
> +       int length_genuine;
> +       PVOID filteredbuf;
> +       int length_filtered;
> +       PVOID minsamplevalue;
> +       PVOID maxsamplevalue;
>        struct ServerStream * next;
>  } ServerStream;
>
> @@ -45,6 +54,7 @@
>  {
>  /*Should be Initialized at Server Start*/
>        char dead;
> +       long streamidpool;
>        HANDLE played;
>        HANDLE filled;
>        HANDLE streampresent;
> @@ -60,7 +70,8 @@
>        int masterchannels;
>        unsigned long masterchannelmask;
>        int masterbitspersample;
> -       PSHORT masterbuf[2];
> +       int masterdatatype;
> +       PVOID masterbuf[2];
>  /*Currently don't know the future of following variables*/
>        long bytes_to_play;
>        HANDLE FilterHandle;
> @@ -75,10 +86,22 @@
>  /* rpc.c */
>  DWORD WINAPI RunRPCThread(LPVOID lpParameter);
>  /* audsrv.c*/
> -void fill(MixerEngine * mixer,int buffer);
> +void mixandfill(MixerEngine * mixer,int buffer);
>  void playbuffer(MixerEngine * mixer,int buffer);
>  /*stream.c*/
> -HANDLE addstream(LONG frequency,int channels,int bitspersample, ULONG channelmask,int volume,int mute,float balance);
> +long getnewstreamid();
> +long addstream(LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance);
> +/*mixer.c*/
> +void * mixs8(MixerEngine * mixer,int buffer);
> +void * mixs16(MixerEngine * mixer,int buffer);
> +void * mixs32(MixerEngine * mixer,int buffer);
> +void * mixs64(MixerEngine * mixer,int buffer);
> +void * mixu8(MixerEngine * mixer,int buffer);
> +void * mixu16(MixerEngine * mixer,int buffer);
> +void * mixu32(MixerEngine * mixer,int buffer);
> +void * mixu64(MixerEngine * mixer,int buffer);
> +void * mixfl32(MixerEngine * mixer,int buffer);
> +void * mixfl64(MixerEngine * mixer,int buffer);
>  /********************************/
>
>  #endif  /* __AUDSRV_H__ */
>
> Added: branches/nyadav-audio-branch/base/services/audsrv/mixer.c
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/services/audsrv/mixer.c?rev=52076&view=auto
> ==============================================================================
> --- branches/nyadav-audio-branch/base/services/audsrv/mixer.c (added)
> +++ branches/nyadav-audio-branch/base/services/audsrv/mixer.c [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -1,0 +1,35 @@
> +
> +#include "audsrv.h"
> +void * mixs8(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixs16(MixerEngine * mixer,int buffer)
> +{
> +       mixer->masterbuf[buffer] = HeapAlloc(GetProcessHeap(), 0, mixer->serverstreamlist->length_filtered);
> +       CopyMemory(mixer->masterbuf[buffer],mixer->serverstreamlist->filteredbuf,mixer->serverstreamlist->length_filtered);
> +       mixer->bytes_to_play = mixer->serverstreamlist->length_filtered;
> +}
> +void * mixs32(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixs64(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixu8(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixu16(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixu32(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixu64(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixfl32(MixerEngine * mixer,int buffer)
> +{
> +}
> +void * mixfl64(MixerEngine * mixer,int buffer)
> +{
> +}
>
> Propchange: branches/nyadav-audio-branch/base/services/audsrv/mixer.c
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: branches/nyadav-audio-branch/base/services/audsrv/mixer.c
> ------------------------------------------------------------------------------
>    svn:mime-type = text/plain
>
> Modified: branches/nyadav-audio-branch/base/services/audsrv/rpc.c
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/services/audsrv/rpc.c?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/base/services/audsrv/rpc.c [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/base/services/audsrv/rpc.c [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -45,13 +45,13 @@
>
>  /*************************RPC Functions**********************************/
>
> -int AUDInitStream(     IN RPC_BINDING_HANDLE hBinding,LONG frequency,int channels,int bitspersample, ULONG channelmask,int volume,int mute,float balance)
> +long AUDInitStream(    IN RPC_BINDING_HANDLE hBinding,LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance)
>  {
> -       HANDLE stream;
> -       printf("Client Connected and Initiated Stream Freq: %ld,Channle: %d,Bitspersample: %d,Mask: %ld,Volume: %d,Mute: %d,Balance: %f\n",frequency,channels,bitspersample,channelmask,volume,mute,balance);
> -       stream = addstream(frequency,channels,bitspersample,channelmask,volume,mute,balance);
> -       if( stream == NULL ){return 0;}else{printf("Stream added\n");}
> -    return (int)stream;
> +       long stream;
> +       printf("Client Connected and Initiated Stream Freq: %ld,Channle: %d,Bitspersample: %d,Datatype: %d,Mask: %ld,Volume: %d,Mute: %d,Balance: %f\n",frequency,channels,bitspersample,datatype,channelmask,volume,mute,balance);
> +       stream = addstream(frequency,channels,bitspersample,datatype,channelmask,volume,mute,balance);
> +       if( stream != 0 ){printf("Stream added\n");}
> +    return stream;
>  }
>  /*************************************************************************/
>  void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
>
> Modified: branches/nyadav-audio-branch/base/services/audsrv/stream.c
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/services/audsrv/stream.c?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- 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] Fri Jun  3 21:41:26 2011
> @@ -1,17 +1,40 @@
>  #include "audsrv.h"
>
> +long getnewstreamid()
> +{
> +       long streamid= pengine->streamidpool;
> +       pengine->streamidpool+=1;
> +       return streamid;
> +}
>  DWORD WINAPI RunStreamThread(LPVOID param)
>  {
> +       UINT i = 0;
>        ServerStream * localstream = (ServerStream *) param;
>
> -       SetEvent(localstream->streamready);
> +
>        printf("Signaling Mixer Thread For First Stream\n");
> -       SetEvent(pengine->streampresent);
> +/*HACK fill filtered buffer (1 second duration in the master stream format) directly until we are in a condition to get buffer directly from the client*/
> +/******************************************************/
> +PSHORT tempbuf;
> +localstream->ready =TRUE;
> +localstream->length_filtered = localstream->freq * localstream->channels * localstream->bitspersample / 8;
> +tempbuf = (PSHORT)HeapAlloc(GetProcessHeap(), 0, localstream->length_filtered);
> +    while (i < localstream->length_filtered / 2)
> +    {
> +        tempbuf[i] = 0x7FFF * sin(0.5 * (i - 1) * 500 * 6.28 / 48000);
> +        i++;
> +        tempbuf[i] = 0x7FFF * sin(0.5 * (i - 2) * 500 * 6.28 / 48000);
> +        i++;
> +    }
> +localstream->filteredbuf = tempbuf;
> +/******************************************************/
> +       SetEvent(localstream->threadready);
> +
>        while (1){OutputDebugStringA("Stream Thread Running.");Sleep(100);};
>        /*Clean Stream's data*/
>  }
>
> -HANDLE addstream(LONG frequency,int channels,int bitspersample, ULONG channelmask,int volume,int mute,float balance)
> +long addstream(LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance)
>  {
>        ServerStream * newstream,*localstream;
>        DWORD dwID;
> @@ -23,37 +46,56 @@
>        if(volume < 0) {newstream->volume = 0;}else if (volume > 1000) {newstream->volume = 1000;}else {newstream->volume = volume;}
>        if(volume < -1.0) {newstream->volume = -1.0;}else if (volume > 1.0) {newstream->volume = 1.0;}else {newstream->volume = volume;}
>        newstream->freq = frequency;  /*TODO frequency validation required*/
> +       if(datatype==0 || datatype==1 || datatype==2){newstream->datatype=datatype;}else goto error;
> +       if      ((datatype==0 && (bitspersample == 8 || bitspersample == 16 || bitspersample == 32 || bitspersample == 64 )) ||
> +               (datatype==1 && (bitspersample == 8 || bitspersample == 16 || bitspersample == 32 || bitspersample == 64)) ||
> +               (datatype==2 && (bitspersample == 32 || bitspersample == 64)) )
>        newstream->bitspersample = bitspersample; /*TODO bitspersample validation*/
> +       else goto error;
> +
>        newstream->channels = channels; /*TODO validation*/
>        newstream->channelmask = channelmask; /*TODO validation*/
>
> +       newstream->ready = FALSE;
> +       newstream->length_genuine = 0;
> +       newstream->genuinebuf = NULL;
> +       newstream->length_filtered = 0;
> +       newstream->filteredbuf = NULL;
> +       newstream->minsamplevalue = NULL;
> +       newstream->maxsamplevalue = NULL;
> +
>        newstream->next = NULL;
>        newstream->played = CreateEvent(NULL,FALSE,FALSE,NULL);
> -       newstream->streamready = CreateEvent(NULL,FALSE,FALSE,NULL);
> +       newstream->threadready = CreateEvent(NULL,FALSE,FALSE,NULL);
>
> -       if(newstream->played == NULL || newstream->streamready == NULL) {goto error;}
> +       if(newstream->played == NULL || newstream->threadready == NULL) {goto error;}
>        newstream->thread=CreateThread(NULL,0,RunStreamThread,newstream,0,&dwID);
>        if(newstream->thread == NULL) {goto error;}
>
> -       WaitForSingleObject(newstream->streamready,INFINITE);
>
> +       WaitForSingleObject(newstream->threadready,INFINITE);
> +
> +       newstream->streamid=getnewstreamid();
>        if(localstream == NULL)
>        {
> -       pengine->serverstreamlist = localstream;
> +       pengine->serverstreamlist = newstream;
>
>        pengine->masterfreq=frequency;
>        pengine->masterchannels=channels;
>        pengine->masterchannelmask=channelmask;
>        pengine->masterbitspersample=bitspersample;
> +       pengine->masterdatatype = datatype;
>        }
>        else
>        {
>                while(localstream->next != NULL){localstream = localstream->next;}
>                localstream->next = newstream;
>        }
> -       return newstream->thread;
> +       SetEvent(pengine->streampresent);
> +       return newstream->streamid;
>
>  error:
> +       printf("Stream Rejected \n");
>        HeapFree(GetProcessHeap(), 0, newstream);
> -       return NULL;
> +       return 0;
>  }
>
> Modified: branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -5,9 +5,9 @@
>  /*Initialize an audio stream
>  *Return -1 if callbacks are NULL pointers
>  */
> -WINAPI int initstream (ClientStream * clientstream,LONG frequency,int channels,int bitspersample, ULONG channelmask,int volume,int mute,float balance)
> +WINAPI int initstream (ClientStream * clientstream,LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance)
>  {
> -       int streamid;
> +       long streamid;
>        if (clientstream == NULL ) return -1;
>        if (clientstream->callbacks.OpenComplete == NULL || clientstream->callbacks.BufferCopied == NULL || clientstream->callbacks.PlayComplete == NULL) return -2;
>        /*Validity of all other data will be checked at server*/
> @@ -16,8 +16,9 @@
>
>        RpcTryExcept
>     {
> -               streamid = AUDInitStream (audsrv_v0_0_c_ifspec,frequency,channels,bitspersample,channelmask,volume,mute,balance);
> -               printf("AUDInitStream Returned %d",streamid);
> +               streamid = AUDInitStream (audsrv_v0_0_c_ifspec,frequency,channels,bitspersample,datatype,channelmask,volume,mute,balance);
> +               printf("AUDInitStream Returned %ld",streamid);
> +               if(streamid != 0) {clientstream->stream = streamid;}
>     }
>     RpcExcept(1)
>     {
> @@ -28,8 +29,6 @@
>
>        /*Analyse the return by the function*/
>        /*Currently Suppose the return is 0 and a valid streamid is returned*/
> -       clientstream->stream = &status;
> -
>        clientstream->ClientEventPool[0]=CreateEvent(NULL,FALSE,FALSE,NULL);
>        clientstream->dead = 0;
>
>
> Modified: branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.spec
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.spec?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.spec [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.spec [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -1,4 +1,4 @@
> -@ stdcall initstream (ptr long long long long long long long)
> +@ stdcall initstream (ptr long long long long long long long long)
>  @ stdcall playaudio ( ptr);
>  @ stdcall stopaudio (ptr );
>  @ stdcall Volume(ptr ptr );
>
> Modified: branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/drivers/wdm/audio/backpln/audclient/audclient.c [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -8,7 +8,7 @@
>  void buffercopied (int error );
>  void playcomplete (int error );
>
> -ClientStream clientstream = {NULL,0,{NULL},{opencomplete,buffercopied,playcomplete}};/*This initialization should not be necessary for a typical client*/
> +ClientStream clientstream = {0,0,{NULL},{opencomplete,buffercopied,playcomplete}};/*This initialization should not be necessary for a typical client*/
>
>  DWORD WINAPI RunAudioThread(LPVOID param)
>  {
> @@ -39,12 +39,12 @@
>        char input='\0';
>        printf("ReactOS Audio Mixer Sample Client.Enter 'a' to Stop.\n");
>        //if (clientstream->callbacks.OpenComplete == NULL || clientstream->callbacks.BufferCopied == NULL || clientstream->callbacks.PlayComplete == NULL) printf("");
> -       error = initstream ( &clientstream , 44100 , 2 , 16 , KSAUDIO_SPEAKER_STEREO , 1000 , 0, 0.0 ); /*[out]HANDLE * streamhandle,[in] long frequency,[in] int number of channels,[in] int bitspersample,[in]ULONG channelmask,[in] int volume,[in] int mute,[in] float balance*/
> +       error = initstream ( &clientstream , 44100 , 2 , 16 ,0, KSAUDIO_SPEAKER_STEREO , 1000 , 0, 0.0 ); /*[out]HANDLE * streamhandle,[in] long frequency,[in] int number of channels,[in] int bitspersample,[in]ULONG channelmask,[in] int volume,[in] int mute,[in] float balance*/
>        if ( error )
>                printf("Failed to Initialize Stream.Error %d\n", error);
>        else
>        {
> -               printf("StreamID : %d\n",*((int *)clientstream.stream));
> +               printf("StreamID : %ld\n",clientstream.stream);
>                audiothread = CreateThread(NULL,0,RunAudioThread,&clientstream,0,&dwID);
>        }
>        while ( input != 'a' )
>
> Modified: branches/nyadav-audio-branch/include/reactos/idl/audsrvrpc.idl
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/include/reactos/idl/audsrvrpc.idl?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/include/reactos/idl/audsrvrpc.idl [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/include/reactos/idl/audsrvrpc.idl [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -39,6 +39,6 @@
>  interface audsrv
>  {
>
> -    int AUDInitStream([in] handle_t h1,[in]LONG frequency,[in]int channels,[in]int bitspersample,[in] ULONG channelmask,[in]int volume,[in]int mute,[in]float balance);
> +    long AUDInitStream([in] handle_t h1,[in]LONG frequency,[in]int channels,[in]int bitspersample,[in]int datatype,[in] ULONG channelmask,[in]int volume,[in]int mute,[in]float balance);
>
>  }
>
> Modified: branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h
> URL: http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h?rev=52076&r1=52075&r2=52076&view=diff
> ==============================================================================
> --- branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h [iso-8859-1] (original)
> +++ branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h [iso-8859-1] Fri Jun  3 21:41:26 2011
> @@ -17,14 +17,14 @@
>
>  typedef struct ClientStream
>  {
> -HANDLE stream;
> +long stream;
>  int dead;
>  HANDLE ClientEventPool[1];  //0]th event is for Activescheduler
>  struct CallBacks callbacks;
>  } ClientStream;
>
>  /********************API Functions******************/
> -WINAPI int initstream (ClientStream * clientstream,LONG frequency,int channels,int bitspersample, ULONG channelmask,int volume,int mute,float balance);
> +WINAPI int initstream (ClientStream * clientstream,LONG frequency,int channels,int bitspersample,int datatype, ULONG channelmask,int volume,int mute,float balance);
>  WINAPI int playaudio ( ClientStream * clientstream);
>  WINAPI int stopaudio (ClientStream * clientstream );
>  WINAPI int Volume(ClientStream * clientstream, int * volume );
>
>
>

_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev