Author: silverblade
Date: Fri Jan 2 19:23:15 2009
New Revision: 38515
URL:
http://svn.reactos.org/svn/reactos?rev=38515&view=rev
Log:
Move MME interface-wrapping code into its own file (mmewrap.c), implement
device closure code. Still need to list/unlist instances but for now this
seems to work.
Added:
branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c (with props)
Modified:
branches/silverblade-audio/dll/win32/sndblst/sndblst.c
branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h
branches/silverblade-audio/include/reactos/libs/sound/mment4.h
branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild
branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c
branches/silverblade-audio/lib/drivers/sound/mment4/control.c
Modified: branches/silverblade-audio/dll/win32/sndblst/sndblst.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/dll/win32/snd…
==============================================================================
--- branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] (original)
+++ branches/silverblade-audio/dll/win32/sndblst/sndblst.c [iso-8859-1] Fri Jan 2
19:23:15 2009
@@ -101,6 +101,7 @@
FuncTable.QueryWaveFormatSupport = QueryNt4WaveDeviceFormatSupport;
FuncTable.SetWaveFormat = SetNt4WaveDeviceFormat;
FuncTable.Open = OpenNt4SoundDevice;
+ FuncTable.Close = CloseNt4SoundDevice;
SetSoundDeviceFunctionTable(SoundDevice, &FuncTable);
Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
==============================================================================
--- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1]
(original)
+++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Jan
2 19:23:15 2009
@@ -164,7 +164,7 @@
OUT PVOID* Handle);
typedef MMRESULT (*MMCLOSE_FUNC)(
- IN struct _SOUND_DEVICE* SoundDevice,
+ IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
IN PVOID Handle); /* not sure about this */
typedef struct _MMFUNCTION_TABLE
@@ -221,7 +221,7 @@
/*
- capabilities.c
+ mme.c
*/
MMRESULT
@@ -230,139 +230,6 @@
IN DWORD DeviceId,
IN PVOID Capabilities,
IN DWORD CapabilitiesSize);
-
-MMRESULT
-GetSoundDeviceCapabilities(
- IN PSOUND_DEVICE SoundDevice,
- OUT PVOID Capabilities,
- IN DWORD CapabilitiesSize);
-
-
-/*
- devicelist.c
-*/
-
-ULONG
-GetSoundDeviceCount(
- IN MMDEVICE_TYPE DeviceType);
-
-BOOLEAN
-IsValidSoundDevice(
- IN PSOUND_DEVICE SoundDevice);
-
-MMRESULT
-ListSoundDevice(
- IN MMDEVICE_TYPE DeviceType,
- IN PVOID Identifier OPTIONAL,
- OUT PSOUND_DEVICE* SoundDevice OPTIONAL);
-
-MMRESULT
-UnlistSoundDevice(
- IN MMDEVICE_TYPE DeviceType,
- IN PSOUND_DEVICE SoundDevice);
-
-MMRESULT
-UnlistSoundDevices(
- IN MMDEVICE_TYPE DeviceType);
-
-VOID
-UnlistAllSoundDevices();
-
-MMRESULT
-GetSoundDevice(
- IN MMDEVICE_TYPE DeviceType,
- IN DWORD DeviceIndex,
- OUT PSOUND_DEVICE* Device);
-
-MMRESULT
-GetSoundDeviceIdentifier(
- IN PSOUND_DEVICE SoundDevice,
- OUT PVOID* Identifier);
-
-MMRESULT
-GetSoundDeviceType(
- IN PSOUND_DEVICE SoundDevice,
- OUT PMMDEVICE_TYPE DeviceType);
-
-
-/*
- functiontable.c
-*/
-
-MMRESULT
-SetSoundDeviceFunctionTable(
- IN PSOUND_DEVICE SoundDevice,
- IN PMMFUNCTION_TABLE FunctionTable);
-
-MMRESULT
-GetSoundDeviceFunctionTable(
- IN PSOUND_DEVICE SoundDevice,
- OUT PMMFUNCTION_TABLE* FunctionTable);
-
-
-/*
- deviceinstance.c
-*/
-
-BOOLEAN
-IsValidSoundDeviceInstance(
- IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
-
-MMRESULT
-CreateSoundDeviceInstance(
- IN PSOUND_DEVICE SoundDevice,
- OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance);
-
-MMRESULT
-DestroySoundDeviceInstance(
- IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
-
-MMRESULT
-DestroyAllSoundDeviceInstances(
- IN PSOUND_DEVICE SoundDevice);
-
-MMRESULT
-GetSoundDeviceFromInstance(
- IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
- OUT PSOUND_DEVICE* SoundDevice);
-
-MMRESULT
-GetSoundDeviceInstanceHandle(
- IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
- OUT PVOID* Handle);
-
-
-/*
- utility.c
-*/
-
-PVOID
-AllocateMemory(
- IN UINT Size);
-
-VOID
-FreeMemory(
- IN PVOID Pointer);
-
-UINT
-GetMemoryAllocationCount();
-
-UINT
-GetDigitCount(
- IN UINT Number);
-
-MMRESULT
-Win32ErrorToMmResult(
- IN UINT ErrorCode);
-
-MMRESULT
-TranslateInternalMmResult(
- IN MMRESULT Result);
-
-
-/*
- wave/format.c
-*/
MMRESULT
MmeOpenWaveDevice(
@@ -371,6 +238,148 @@
IN LPWAVEOPENDESC OpenParameters,
IN DWORD Flags,
OUT DWORD* PrivateHandle);
+
+MMRESULT
+MmeCloseDevice(
+ IN DWORD PrivateHandle);
+
+
+/*
+ capabilities.c
+*/
+
+MMRESULT
+GetSoundDeviceCapabilities(
+ IN PSOUND_DEVICE SoundDevice,
+ OUT PVOID Capabilities,
+ IN DWORD CapabilitiesSize);
+
+
+/*
+ devicelist.c
+*/
+
+ULONG
+GetSoundDeviceCount(
+ IN MMDEVICE_TYPE DeviceType);
+
+BOOLEAN
+IsValidSoundDevice(
+ IN PSOUND_DEVICE SoundDevice);
+
+MMRESULT
+ListSoundDevice(
+ IN MMDEVICE_TYPE DeviceType,
+ IN PVOID Identifier OPTIONAL,
+ OUT PSOUND_DEVICE* SoundDevice OPTIONAL);
+
+MMRESULT
+UnlistSoundDevice(
+ IN MMDEVICE_TYPE DeviceType,
+ IN PSOUND_DEVICE SoundDevice);
+
+MMRESULT
+UnlistSoundDevices(
+ IN MMDEVICE_TYPE DeviceType);
+
+VOID
+UnlistAllSoundDevices();
+
+MMRESULT
+GetSoundDevice(
+ IN MMDEVICE_TYPE DeviceType,
+ IN DWORD DeviceIndex,
+ OUT PSOUND_DEVICE* Device);
+
+MMRESULT
+GetSoundDeviceIdentifier(
+ IN PSOUND_DEVICE SoundDevice,
+ OUT PVOID* Identifier);
+
+MMRESULT
+GetSoundDeviceType(
+ IN PSOUND_DEVICE SoundDevice,
+ OUT PMMDEVICE_TYPE DeviceType);
+
+
+/*
+ functiontable.c
+*/
+
+MMRESULT
+SetSoundDeviceFunctionTable(
+ IN PSOUND_DEVICE SoundDevice,
+ IN PMMFUNCTION_TABLE FunctionTable);
+
+MMRESULT
+GetSoundDeviceFunctionTable(
+ IN PSOUND_DEVICE SoundDevice,
+ OUT PMMFUNCTION_TABLE* FunctionTable);
+
+
+/*
+ deviceinstance.c
+*/
+
+BOOLEAN
+IsValidSoundDeviceInstance(
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
+
+MMRESULT
+CreateSoundDeviceInstance(
+ IN PSOUND_DEVICE SoundDevice,
+ OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance);
+
+MMRESULT
+DestroySoundDeviceInstance(
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
+
+MMRESULT
+DestroyAllSoundDeviceInstances(
+ IN PSOUND_DEVICE SoundDevice);
+
+MMRESULT
+GetSoundDeviceFromInstance(
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
+ OUT PSOUND_DEVICE* SoundDevice);
+
+MMRESULT
+GetSoundDeviceInstanceHandle(
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
+ OUT PVOID* Handle);
+
+
+/*
+ utility.c
+*/
+
+PVOID
+AllocateMemory(
+ IN UINT Size);
+
+VOID
+FreeMemory(
+ IN PVOID Pointer);
+
+UINT
+GetMemoryAllocationCount();
+
+UINT
+GetDigitCount(
+ IN UINT Number);
+
+MMRESULT
+Win32ErrorToMmResult(
+ IN UINT ErrorCode);
+
+MMRESULT
+TranslateInternalMmResult(
+ IN MMRESULT Result);
+
+
+/*
+ wave/format.c
+*/
MMRESULT
QueryWaveDeviceFormatSupport(
Modified: branches/silverblade-audio/include/reactos/libs/sound/mment4.h
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
==============================================================================
--- branches/silverblade-audio/include/reactos/libs/sound/mment4.h [iso-8859-1]
(original)
+++ branches/silverblade-audio/include/reactos/libs/sound/mment4.h [iso-8859-1] Fri Jan 2
19:23:15 2009
@@ -82,7 +82,7 @@
MMRESULT
CloseNt4SoundDevice(
- IN PSOUND_DEVICE SoundDevice,
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN PVOID Handle);
#endif
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1] Fri
Jan 2 19:23:15 2009
@@ -14,37 +14,6 @@
#include <ntddk.h>
#include <ntddsnd.h>
#include <mmebuddy.h>
-
-/*
- This is a helper function to alleviate some of the repetition involved with
- implementing the various MME message functions.
-*/
-MMRESULT
-MmeGetSoundDeviceCapabilities(
- IN MMDEVICE_TYPE DeviceType,
- IN DWORD DeviceId,
- IN PVOID Capabilities,
- IN DWORD CapabilitiesSize)
-{
- PSOUND_DEVICE SoundDevice;
- MMRESULT Result;
-
- SND_TRACE(L"MME *_GETCAPS for device %d of type %d\n", DeviceId,
DeviceType);
-
- /* FIXME: Validate device type and ID */
- VALIDATE_MMSYS_PARAMETER( Capabilities );
- VALIDATE_MMSYS_PARAMETER( CapabilitiesSize > 0 );
-
- /* Our parameter checks are done elsewhere */
- Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice);
-
- if ( Result != MMSYSERR_NOERROR )
- return Result;
-
- return GetSoundDeviceCapabilities(SoundDevice,
- Capabilities,
- CapabilitiesSize);
-}
/*
Obtains the capabilities of a sound device. This routine ensures that the
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1]
Fri Jan 2 19:23:15 2009
@@ -37,7 +37,7 @@
FreeSoundDeviceInstance(
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
{
- SND_ASSERT( SoundDeviceInstance );
+ SND_ASSERT( IsValidSoundDeviceInstance(SoundDeviceInstance) );
FreeMemory(SoundDeviceInstance);
}
@@ -107,6 +107,8 @@
return TranslateInternalMmResult(Result);
}
+ /* TODO: List device */
+
return MMSYSERR_NOERROR;
}
@@ -114,7 +116,45 @@
DestroySoundDeviceInstance(
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
{
- return MMSYSERR_NOTSUPPORTED;
+ MMRESULT Result;
+ PMMFUNCTION_TABLE FunctionTable;
+ PSOUND_DEVICE SoundDevice;
+ PVOID Handle;
+
+ SND_TRACE(L"Destroying a sound device instance\n");
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+
+ Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
+ if ( Result != MMSYSERR_NOERROR )
+ return TranslateInternalMmResult(Result);
+
+ /* TODO: Unlist */
+
+ Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
+ if ( Result != MMSYSERR_NOERROR )
+ return TranslateInternalMmResult(Result);
+
+ /* Get the "close" routine from the function table, and validate it */
+ Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable);
+ if ( Result != MMSYSERR_NOERROR )
+ return TranslateInternalMmResult(Result);
+
+ SND_ASSERT( FunctionTable->Close );
+ if ( FunctionTable->Close == NULL )
+ {
+ /* Bad practice, really! If you can open, why not close?! */
+ return MMSYSERR_NOTSUPPORTED;
+ }
+
+ /* Try and close the device */
+ Result = FunctionTable->Close(SoundDeviceInstance, Handle);
+ if ( Result != MMSYSERR_NOERROR )
+ return TranslateInternalMmResult(Result);
+
+ FreeSoundDeviceInstance(SoundDeviceInstance);
+
+ return MMSYSERR_NOERROR;
}
MMRESULT
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] Fri
Jan 2 19:23:15 2009
@@ -7,6 +7,7 @@
<file>devicelist.c</file>
<file>deviceinstance.c</file>
<file>functiontable.c</file>
+ <file>mmewrap.c</file>
<file>reentrancy.c</file>
<file>utility.c</file>
<file>kernel.c</file>
Added: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c (added)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c [iso-8859-1] Fri Jan
2 19:23:15 2009
@@ -1,0 +1,130 @@
+/*
+ * PROJECT: ReactOS Sound System "MME Buddy" Library
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: lib/sound/mmebuddy/mmewrap.c
+ *
+ * PURPOSE: Interface between MME functions and MME Buddy's own.
+ *
+ * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org)
+*/
+
+#include <windows.h>
+#include <mmsystem.h>
+#include <mmddk.h>
+#include <ntddk.h>
+#include <ntddsnd.h>
+#include <mmebuddy.h>
+
+/*
+ This is a helper function to alleviate some of the repetition involved with
+ implementing the various MME message functions.
+*/
+MMRESULT
+MmeGetSoundDeviceCapabilities(
+ IN MMDEVICE_TYPE DeviceType,
+ IN DWORD DeviceId,
+ IN PVOID Capabilities,
+ IN DWORD CapabilitiesSize)
+{
+ PSOUND_DEVICE SoundDevice;
+ MMRESULT Result;
+
+ SND_TRACE(L"MME *_GETCAPS for device %d of type %d\n", DeviceId,
DeviceType);
+
+ /* FIXME: Validate device type and ID */
+ VALIDATE_MMSYS_PARAMETER( Capabilities );
+ VALIDATE_MMSYS_PARAMETER( CapabilitiesSize > 0 );
+
+ /* Our parameter checks are done elsewhere */
+ Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice);
+
+ if ( Result != MMSYSERR_NOERROR )
+ return Result;
+
+ return GetSoundDeviceCapabilities(SoundDevice,
+ Capabilities,
+ CapabilitiesSize);
+}
+
+MMRESULT
+MmeOpenWaveDevice(
+ IN MMDEVICE_TYPE DeviceType,
+ IN DWORD DeviceId,
+ IN LPWAVEOPENDESC OpenParameters,
+ IN DWORD Flags,
+ OUT DWORD* PrivateHandle)
+{
+ MMRESULT Result;
+
+ PSOUND_DEVICE SoundDevice;
+ PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
+ LPWAVEFORMATEX Format;
+
+ SND_TRACE(L"Opening wave device (WIDM_OPEN / WODM_OPEN)");
+
+ VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) ); /* FIXME? wave in
too? */
+ VALIDATE_MMSYS_PARAMETER( OpenParameters );
+
+ Format = OpenParameters->lpFormat;
+
+ Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice);
+ if ( Result != MMSYSERR_NOERROR )
+ return TranslateInternalMmResult(Result);
+
+ /* Does this device support the format? */
+ Result = QueryWaveDeviceFormatSupport(SoundDevice, Format, sizeof(WAVEFORMATEX));
+ if ( Result != MMSYSERR_NOERROR )
+ {
+ SND_ERR(L"Format not supported\n");
+ return TranslateInternalMmResult(Result);
+ }
+
+ /* If the caller just wanted to know if a format is supported, end here */
+ if ( Flags & WAVE_FORMAT_QUERY )
+ return MMSYSERR_NOERROR;
+
+ /* Check that winmm gave us a private handle to fill */
+ VALIDATE_MMSYS_PARAMETER( PrivateHandle );
+
+ /* Create a sound device instance and open the sound device */
+ Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance);
+ if ( Result != MMSYSERR_NOERROR )
+ return TranslateInternalMmResult(Result);
+
+ Result = SetWaveDeviceFormat(SoundDeviceInstance, Format, sizeof(WAVEFORMATEX));
+ if ( Result != MMSYSERR_NOERROR )
+ {
+ /* TODO: Destroy sound instance */
+ return TranslateInternalMmResult(Result);
+ }
+
+ /* Store the device instance pointer in the private handle - is DWORD safe here? */
+ *PrivateHandle = (DWORD) SoundDeviceInstance;
+
+ /* TODO: Call the client application back to say the device is open */
+ ReleaseEntrypointMutex(DeviceType);
+ /* ... */
+ AcquireEntrypointMutex(DeviceType);
+
+ SND_TRACE(L"Wave device now open\n");
+
+ return MMSYSERR_NOERROR;
+}
+
+MMRESULT
+MmeCloseDevice(
+ IN DWORD PrivateHandle)
+{
+ /* FIXME - Where do we call the callback?? */
+ MMRESULT Result;
+ PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
+
+ SND_TRACE(L"Closing wave device (WIDM_CLOSE / WODM_CLOSE)\n");
+
+ VALIDATE_MMSYS_PARAMETER( PrivateHandle );
+ SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
+
+ Result = DestroySoundDeviceInstance(SoundDeviceInstance);
+
+ return Result;
+}
Propchange: branches/silverblade-audio/lib/drivers/sound/mmebuddy/mmewrap.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1] Fri
Jan 2 19:23:15 2009
@@ -14,72 +14,6 @@
#include <ntddk.h>
#include <ntddsnd.h>
#include <mmebuddy.h>
-
-/* Adapted from MmeQueryWaveFormat... TODO: Move elsewhere */
-MMRESULT
-MmeOpenWaveDevice(
- IN MMDEVICE_TYPE DeviceType,
- IN DWORD DeviceId,
- IN LPWAVEOPENDESC OpenParameters,
- IN DWORD Flags,
- OUT DWORD* PrivateHandle)
-{
- MMRESULT Result;
-
- PSOUND_DEVICE SoundDevice;
- PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
- LPWAVEFORMATEX Format;
-
- SND_TRACE(L"Opening wave device (WIM_OPEN / WOM_OPEN)");
-
- VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) ); /* FIXME? wave in
too? */
- VALIDATE_MMSYS_PARAMETER( OpenParameters );
-
- Format = OpenParameters->lpFormat;
-
- Result = GetSoundDevice(DeviceType, DeviceId, &SoundDevice);
- if ( Result != MMSYSERR_NOERROR )
- return TranslateInternalMmResult(Result);
-
- /* Does this device support the format? */
- Result = QueryWaveDeviceFormatSupport(SoundDevice, Format, sizeof(WAVEFORMATEX));
- if ( Result != MMSYSERR_NOERROR )
- {
- SND_ERR(L"Format not supported\n");
- return TranslateInternalMmResult(Result);
- }
-
- /* If the caller just wanted to know if a format is supported, end here */
- if ( Flags & WAVE_FORMAT_QUERY )
- return MMSYSERR_NOERROR;
-
- /* Check that winmm gave us a private handle to fill */
- VALIDATE_MMSYS_PARAMETER( PrivateHandle );
-
- /* Create a sound device instance and open the sound device */
- Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance);
- if ( Result != MMSYSERR_NOERROR )
- return TranslateInternalMmResult(Result);
-
- Result = SetWaveDeviceFormat(SoundDeviceInstance, Format, sizeof(WAVEFORMATEX));
- if ( Result != MMSYSERR_NOERROR )
- {
- /* TODO: Destroy sound instance */
- return TranslateInternalMmResult(Result);
- }
-
- /* Store the device instance pointer in the private handle - is DWORD safe here? */
- *PrivateHandle = (DWORD) SoundDeviceInstance;
-
- /* TODO: Call the client application back to say the device is open */
- ReleaseEntrypointMutex(DeviceType);
- /* ... */
- AcquireEntrypointMutex(DeviceType);
-
- SND_TRACE(L"Wave device now open\n");
-
- return MMSYSERR_NOERROR;
-}
MMRESULT
QueryWaveDeviceFormatSupport(
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1]
Fri Jan 2 19:23:15 2009
@@ -59,97 +59,6 @@
(LPWAVEOPENDESC) Parameter1,
Parameter2,
(DWORD*) PrivateHandle);
-#if 0
- PSOUND_DEVICE SoundDevice;
- PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
- LPWAVEOPENDESC OpenDescriptor = (LPWAVEOPENDESC) Parameter1;
-
- /* FIXME? Do we need the 2nd parameter to go to this routine? */
- Result = MmeQueryWaveDeviceFormatSupport(WAVE_OUT_DEVICE_TYPE,
- DeviceId,
- OpenDescriptor);
-
- if ( ( Parameter2 & WAVE_FORMAT_QUERY ) ||
- ( Result == MMSYSERR_NOTSUPPORTED) )
- {
- /* Nothing more to be done */
- break;
- }
-
- /* The MME API should provide us with a place to store a handle */
- if ( ! PrivateHandle )
- {
- /* Not so much an invalid parameter as something messed up!! */
- SND_ERR(L"MME API supplied a NULL private handle pointer!\n");
- Result = MMSYSERR_ERROR;
- break;
- }
-
- /* Spawn an instance of the sound device */
- /*Result = MmeOpenWaveDevice(WAVE_OUT_DEVICE_TYPE, DeviceId,
OpenDescriptor);*/
- /*GetSoundDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, &SoundDevice);
- Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance);*/
-
- /* TODO... */
-#endif
-#if 0
- PSOUND_DEVICE SoundDevice;
- PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
- LPWAVEOPENDESC OpenParameters = (LPWAVEOPENDESC) Parameter1;
-
- /* Obtain the sound device */
- Result = GetSoundDevice(WAVE_OUT_DEVICE_TYPE, DeviceId, &SoundDevice);
-
- if ( Result != MMSYSERR_NOERROR )
- {
- Result = TranslateInternalMmResult(Result);
- break;
- }
-
- /* See if the device supports this format */
- Result = QueryWaveDeviceFormatSupport(SoundDevice,
- OpenParameters->lpFormat,
- sizeof(WAVEFORMATEX));
-
- if ( Parameter2 & WAVE_FORMAT_QUERY )
- {
- /* Nothing more to be done - keep the result */
- Result = TranslateInternalMmResult(Result);
- break;
- }
-
-
- SND_ASSERT( PrivateHandle );
- if ( ! PrivateHandle )
- {
- /* Not so much an invalid parameter as something messed up!! */
- SND_ERR(L"MME API supplied a NULL private handle pointer!\n");
- Result = MMSYSERR_ERROR;
- break;
- }
-
- /* Spawn an instance of the sound device */
- Result = CreateSoundDeviceInstance(SoundDevice, &SoundDeviceInstance);
-
- if ( Result != MMSYSERR_NOERROR )
- {
- SND_ERR(L"Failed to create sound device instance\n");
- break;
- }
-
- /* Set the sample rate, bits per sample, etc. */
- Result = SetWaveDeviceFormat(SoundDeviceInstance,
- OpenParameters->lpFormat,
- sizeof(WAVEFORMATEX));
-
- if ( Result != MMSYSERR_NOERROR )
- {
- SND_ERR(L"Failed to set wave device format\n");
- DestroySoundDeviceInstance(SoundDeviceInstance);
- break;
- }
-
-#endif
break;
}
@@ -160,6 +69,8 @@
- Validate the sound device instance
- Destroy it
*/
+ Result = MmeCloseDevice(PrivateHandle);
+
break;
}
}
Modified: branches/silverblade-audio/lib/drivers/sound/mment4/control.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mment4/control.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/mment4/control.c [iso-8859-1] Fri Jan 2
19:23:15 2009
@@ -64,12 +64,12 @@
MMRESULT
CloseNt4SoundDevice(
- IN PSOUND_DEVICE SoundDevice,
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN PVOID Handle)
{
SND_TRACE(L"Closing NT4 style sound device\n");
- VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
return CloseKernelSoundDevice((HANDLE) Handle);
}