[AUDIO-BRINGUP]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Fri, 3 Dec 2010 11:47:43 +0000 (11:47 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Fri, 3 Dec 2010 11:47:43 +0000 (11:47 +0000)
- Check if library has already been initialized
- Remove function macro for legacy (wdmaud.sys connection)

svn path=/branches/audio-bringup/; revision=49919

dll/win32/wdmaud.drv/mmixer.c
dll/win32/wdmaud.drv/wdmaud.c
dll/win32/wdmaud.drv/wdmaud.rbuild

index 27a88b3..9caa8c9 100644 (file)
@@ -17,6 +17,10 @@ typedef struct
     LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine;
 }IO_PACKET, *LPIO_PACKET;
 
+BOOL MMixerLibraryInitialized = FALSE;
+
+
+
 PVOID Alloc(ULONG NumBytes);
 MIXER_STATUS Close(HANDLE hDevice);
 VOID Free(PVOID Block);
@@ -331,6 +335,13 @@ WdmAudInitUserModeMixer()
     HDEVINFO DeviceHandle;
     MIXER_STATUS Status;
 
+    if (MMixerLibraryInitialized)
+    {
+        /* library is already initialized */
+        return TRUE;
+    }
+
+
     /* create a device list */
     DeviceHandle = SetupDiGetClassDevs(&CategoryGuid,
                                        NULL,
@@ -357,6 +368,9 @@ WdmAudInitUserModeMixer()
         return FALSE;
     }
 
+    /* library is now initialized */
+    MMixerLibraryInitialized = TRUE;
+
     /* completed successfully */
     return TRUE;
 }
index 6255dee..e1da68a 100644 (file)
 
 #include "wdmaud.h"
 
-
-#ifndef USE_MMIXER_LIB
-#define FUNC_NAME(x) x##ByLegacy
-#else
-#define FUNC_NAME(x) x##ByMMixer
-#endif
-
 MMRESULT
 QueryWdmWaveDeviceFormatSupport(
     IN  PSOUND_DEVICE Device,
@@ -43,7 +36,7 @@ PopulateWdmDeviceList(
 
     VALIDATE_MMSYS_PARAMETER( IS_VALID_SOUND_DEVICE_TYPE(DeviceType) );
 
-    Result = FUNC_NAME(WdmAudGetNumWdmDevs)(DeviceType, &DeviceCount);
+    Result = WdmAudGetNumWdmDevsByMMixer(DeviceType, &DeviceCount);
 
     if ( ! MMSUCCESS(Result) )
     {
@@ -66,35 +59,35 @@ PopulateWdmDeviceList(
 
         /* Set up our function table */
         ZeroMemory(&FuncTable, sizeof(MMFUNCTION_TABLE));
-        FuncTable.GetCapabilities = FUNC_NAME(WdmAudGetCapabilities);
+        FuncTable.GetCapabilities = WdmAudGetCapabilitiesByMMixer;
         FuncTable.QueryWaveFormatSupport = QueryWdmWaveDeviceFormatSupport; //FIXME
-        FuncTable.Open = FUNC_NAME(WdmAudOpenSoundDevice);
-        FuncTable.Close = FUNC_NAME(WdmAudCloseSoundDevice);
-        FuncTable.GetDeviceInterfaceString = FUNC_NAME(WdmAudGetDeviceInterfaceString);
+        FuncTable.Open = WdmAudOpenSoundDeviceByMMixer;
+        FuncTable.Close = WdmAudCloseSoundDeviceByMMixer;
+        FuncTable.GetDeviceInterfaceString = WdmAudGetDeviceInterfaceStringByMMixer;
 
         if (DeviceType == MIXER_DEVICE_TYPE)
         {
-            FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetMixerDeviceFormat);
-            FuncTable.QueryMixerInfo = FUNC_NAME(WdmAudQueryMixerInfo);
+            FuncTable.SetWaveFormat = WdmAudSetMixerDeviceFormatByMMixer;
+            FuncTable.QueryMixerInfo = WdmAudQueryMixerInfoByMMixer;
         }
         else if (DeviceType == WAVE_IN_DEVICE_TYPE || DeviceType == WAVE_OUT_DEVICE_TYPE)
         {
-            FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetWaveDeviceFormat);
-            FuncTable.SetState = FUNC_NAME(WdmAudSetWaveState);
-            FuncTable.ResetStream = FUNC_NAME(WdmAudResetStream);
-            FuncTable.GetPos = FUNC_NAME(WdmAudGetWavePosition);
+            FuncTable.SetWaveFormat = WdmAudSetWaveDeviceFormatByMMixer;
+            FuncTable.SetState = WdmAudSetWaveStateByMMixer;
+            FuncTable.ResetStream = WdmAudResetStreamByMMixer;
+            FuncTable.GetPos = WdmAudGetWavePositionByMMixer;
 
 #ifndef USERMODE_MIXER
-            FuncTable.CommitWaveBuffer = FUNC_NAME(WdmAudCommitWaveBuffer);
+            FuncTable.CommitWaveBuffer = WdmAudCommitWaveBufferByMMixer;
 #else
             FuncTable.CommitWaveBuffer = WriteFileEx_Remixer;
 #endif
         }
         else if (DeviceType == MIDI_IN_DEVICE_TYPE || DeviceType == MIDI_OUT_DEVICE_TYPE)
         {
-            FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetMixerDeviceFormat);
-            FuncTable.SetState = FUNC_NAME(WdmAudSetWaveState);
-            FuncTable.GetPos = FUNC_NAME(WdmAudGetWavePosition);
+            FuncTable.SetWaveFormat = WdmAudSetWaveDeviceFormatByMMixer;
+            FuncTable.SetState = WdmAudSetWaveStateByMMixer;
+            FuncTable.GetPos = WdmAudGetWavePositionByMMixer;
         }
 
         SetSoundDeviceFunctionTable(SoundDevice, &FuncTable);
@@ -127,7 +120,7 @@ DriverProc(
             if ( ! MMSUCCESS(Result) )
                 return 0L;
 
-            Result = FUNC_NAME(WdmAudOpenSoundDevice)(NULL, &Handle);
+            Result = WdmAudOpenSoundDeviceByMMixer(NULL, &Handle);
 
             if ( Result != MMSYSERR_NOERROR )
             {
@@ -155,7 +148,7 @@ DriverProc(
         {
             SND_TRACE(L"DRV_FREE\n");
 
-            FUNC_NAME(WdmAudCleanup)();
+            WdmAudCleanupByMMixer();
 
             /* TODO: Clean up the path names! */
             UnlistAllSoundDevices();
index b63b9df..76097cf 100644 (file)
@@ -4,7 +4,6 @@
        <include base="ReactOS">include/reactos/libs/sound</include>
        <include base="mmixer">.</include>
        <include base="libsamplerate">.</include>
-       <define name="NDEBUG">1</define>
        <define name="USE_MMIXER_LIB">1</define>
        <!-- <define name="USERMODE_MIXER">1</define> Enable this line to for usermode mixing support -->
        <library>mmebuddy</library>