Author: nyadav
Date: Tue Jul 12 16:45:52 2011
New Revision: 52657
URL:
http://svn.reactos.org/svn/reactos?rev=52657&view=rev
Log:
[AUDSRV] Finally a working audio mixer :)
Modified:
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/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/audsrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
==============================================================================
--- 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] Tue Jul 12
16:45:52 2011
@@ -120,7 +120,7 @@
long WriteBuffer(LONG streamid,
LONG length,
- LPVOID buffer);
+ char * buffer);
/*mixer.c*/
void * MixS8(MixerEngine * mixer,
int buffer);
Modified: branches/nyadav-audio-branch/base/services/audsrv/rpc.c
URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/base/servic…
==============================================================================
--- 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] Tue Jul 12
16:45:52 2011
@@ -82,9 +82,9 @@
long AUDPlayBuffer( IN RPC_BINDING_HANDLE hBinding,
LONG streamid,
LONG length,
- LPVOID buffer)
+ char* buffer)
{
- WriteBuffer(streamid,length,NULL);
+ WriteBuffer(streamid,length,buffer);
return 0;
}
/*************************************************************************/
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] Tue Jul 12
16:45:52 2011
@@ -198,10 +198,8 @@
long WriteBuffer(LONG streamid,
LONG length,
- LPVOID buffer)
-{
- int i =0;
- PSHORT tempbuf;
+ char * buffer)
+{
ServerStream * localstream = pengine->serverstreamlist;
while(localstream!=NULL)
{
@@ -216,16 +214,12 @@
if(localstream->state == 0)
{
- localstream->length_genuine = localstream->freq * localstream->channels
* localstream->bitspersample / 8;
- localstream->genuinebuf = tempbuf = (PSHORT) HeapAlloc(GetProcessHeap(),
+ localstream->length_genuine = length;
+ localstream->genuinebuf = (PSHORT) HeapAlloc(GetProcessHeap(),
0,
-
localstream->length_genuine);
-
- while (i < localstream->length_genuine / 2)
- {
- tempbuf[i+1] = tempbuf[i] = 0x7FFF * sin(0.5 * i * 500 * 6.28 / 48000);
- i+=2;
- }
+ length);
+
+ memcpy(localstream->genuinebuf,buffer,length);
localstream->state = 1;
}
Modified: branches/nyadav-audio-branch/dll/win32/audsrvapi/audsrvapi.c
URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/dll/win32/a…
==============================================================================
--- 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] Tue Jul 12
16:45:52 2011
@@ -8,6 +8,7 @@
*/
#include "audsrvapi.h"
+#include <math.h>
/*All the wrappers for Remote Function should be here*/
int status = 0;
@@ -75,6 +76,10 @@
WINAPI
PlayAudio ( ClientStream * clientstream )
{
+ /******************************************/
+ int i =0;
+ PSHORT tempbuf;
+ /******************************************/
/*This is an ActiveScheduler*/
clientstream->callbacks.OpenComplete(0);
@@ -90,26 +95,39 @@
if(clientstream->dead)
break;
- /*Check Connection Status If not connected call Connect()*/
- /*If connected Properly call the remote audsrv_play() function,This will be a
blocking call, placing a dummy wait function here is a good idea.*/
- RpcTryExcept
- {
- AUDPlayBuffer (audsrv_v0_0_c_ifspec,
- clientstream->stream,
- 0,
- NULL);
- }
- RpcExcept(1)
- {
- status = RpcExceptionCode();
- }
- RpcEndExcept
-
- clientstream->callbacks.BufferCopied(0);
+ /*Check Connection Status If not connected call Connect()*/
+ /*If connected Properly call the remote audsrv_play() function,This will be a
blocking call, placing a dummy wait function here is a good idea.*/
+ tempbuf = (PSHORT) HeapAlloc(GetProcessHeap(),
+ 0,
+ 44100);
+
+ for(i = 0;i<22050;i+=2)
+ {
+ tempbuf[i+1] = tempbuf[i] = 0x7FFF * sin( i * 500 * 3.14 /
clientstream->wavefreq);
+ }
+
+ RpcTryExcept
+ {
+ AUDPlayBuffer (audsrv_v0_0_c_ifspec,
+ clientstream->stream,
+ 44100,
+ (char *)tempbuf);
+ }
+ RpcExcept(1)
+ {
+ status = RpcExceptionCode();
+ }
+ RpcEndExcept
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ tempbuf);
+
+ clientstream->callbacks.BufferCopied(0);
}
clientstream->callbacks.PlayComplete(0);
-/*Audio Thread Ended*/
+ /*Audio Thread Ended*/
return 0;
}
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…
==============================================================================
--- 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] Tue Jul 12 16:45:52 2011
@@ -58,8 +58,8 @@
DWORD dwID;
HANDLE audiothread = NULL;
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("");
+ printf("ReactOS Audio Mixer Sample Client.Enter 'a' to Stop.\nPlease
Enter the frequency of the sinusoidal wave [Hz] : ");
+ scanf("%ld",&(clientstream.wavefreq));
/*[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 ,
Modified: branches/nyadav-audio-branch/include/reactos/idl/audsrvrpc.idl
URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/include/rea…
==============================================================================
--- 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] Tue Jul 12
16:45:52 2011
@@ -2,7 +2,7 @@
* Event Log RPC interface definition
*/
-#include <ms-dtyp.idl>
+#include <wtypes.idl>
cpp_quote("#if !defined(__AUDSRV_H__) ")
@@ -40,5 +40,5 @@
{
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);
- long AUDPlayBuffer([in] handle_t h1,[in]LONG streamid,[in]LONG length,[in]LPVOID
buffer);
+ long AUDPlayBuffer([in] handle_t h1,[in]LONG streamid,[in]LONG length,[in,
size_is(length)]char* buffer);
}
Modified: branches/nyadav-audio-branch/include/reactos/libs/audsrv/audsrvapi.h
URL:
http://svn.reactos.org/svn/reactos/branches/nyadav-audio-branch/include/rea…
==============================================================================
--- 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] Tue
Jul 12 16:45:52 2011
@@ -21,6 +21,9 @@
int dead;
HANDLE ClientEventPool[1];
struct CallBacks callbacks;
+
+ /*Just for the time being when we dont have any audio source*/
+ long wavefreq;
} ClientStream;
/********************API Functions******************/