ReactOS  0.4.15-dev-1039-gb9754fa
mmixer.c File Reference
#include "wdmaud.h"
#include <winreg.h>
#include <setupapi.h>
#include <mmixer.h>
#include <ndk/rtlfuncs.h>
#include <ndk/iofuncs.h>
#include <debug.h>
#include <mmebuddy_debug.h>
Include dependency graph for mmixer.c:

Go to the source code of this file.

Macros

#define NTOS_MODE_USER
 
#define NDEBUG
 

Functions

PVOID Alloc (ULONG NumBytes)
 
MIXER_STATUS Close (HANDLE hDevice)
 
VOID Free (PVOID Block)
 
VOID Copy (PVOID Src, PVOID Dst, ULONG NumBytes)
 
MIXER_STATUS Open (IN LPWSTR DevicePath, OUT PHANDLE hDevice)
 
MIXER_STATUS Control (IN HANDLE hMixer, IN ULONG dwIoControlCode, IN PVOID lpInBuffer, IN ULONG nInBufferSize, OUT PVOID lpOutBuffer, ULONG nOutBufferSize, PULONG lpBytesReturned)
 
MIXER_STATUS Enum (IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR *DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey)
 
MIXER_STATUS OpenKey (IN HANDLE hKey, IN LPWSTR SubKey, IN ULONG DesiredAccess, OUT PHANDLE OutKey)
 
MIXER_STATUS CloseKey (IN HANDLE hKey)
 
MIXER_STATUS QueryKeyValue (IN HANDLE hKey, IN LPWSTR KeyName, OUT PVOID *ResultBuffer, OUT PULONG ResultLength, OUT PULONG KeyType)
 
PVOID AllocEventData (IN ULONG ExtraSize)
 
VOID FreeEventData (IN PVOID EventData)
 
BOOL WdmAudInitUserModeMixer ()
 
MMRESULT WdmAudCleanupByMMixer ()
 
MMRESULT WdmAudGetMixerCapabilities (IN ULONG DeviceId, LPMIXERCAPSW Capabilities)
 
MMRESULT WdmAudGetLineInfo (IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINEW MixLine, IN ULONG Flags)
 
MMRESULT WdmAudGetLineControls (IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINECONTROLSW MixControls, IN ULONG Flags)
 
MMRESULT WdmAudSetControlDetails (IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
 
MMRESULT WdmAudGetControlDetails (IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
 
MMRESULT WdmAudGetWaveOutCapabilities (IN ULONG DeviceId, LPWAVEOUTCAPSW Capabilities)
 
MMRESULT WdmAudGetWaveInCapabilities (IN ULONG DeviceId, LPWAVEINCAPSW Capabilities)
 
MMRESULT WdmAudSetWaveDeviceFormatByMMixer (IN PSOUND_DEVICE_INSTANCE Instance, IN DWORD DeviceId, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
 
MMRESULT WdmAudGetCapabilitiesByMMixer (IN PSOUND_DEVICE SoundDevice, IN DWORD DeviceId, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
 
MMRESULT WdmAudOpenSoundDeviceByMMixer (IN struct _SOUND_DEVICE *SoundDevice, OUT PVOID *Handle)
 
MMRESULT WdmAudCloseSoundDeviceByMMixer (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN PVOID Handle)
 
MMRESULT WdmAudGetNumWdmDevsByMMixer (IN MMDEVICE_TYPE DeviceType, OUT DWORD *DeviceCount)
 
MMRESULT WdmAudQueryMixerInfoByMMixer (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN DWORD MixerId, IN UINT uMsg, IN LPVOID Parameter, IN DWORD Flags)
 
MMRESULT WdmAudGetDeviceInterfaceStringByMMixer (IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN LPWSTR Interface, IN DWORD InterfaceLength, OUT DWORD *InterfaceSize)
 
VOID CALLBACK MixerEventCallback (IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
 
MMRESULT WdmAudSetMixerDeviceFormatByMMixer (IN PSOUND_DEVICE_INSTANCE Instance, IN DWORD DeviceId, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
 
MMRESULT WdmAudSetWaveStateByMMixer (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN BOOL bStart)
 
MMRESULT WdmAudResetStreamByMMixer (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN MMDEVICE_TYPE DeviceType, IN BOOLEAN bStartReset)
 
MMRESULT WdmAudGetWavePositionByMMixer (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN MMTIME *Time)
 
static VOID WINAPI CommitWaveBufferApc (PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved)
 
MMRESULT WdmAudCommitWaveBufferByMMixer (IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
 

Variables

BOOL MMixerLibraryInitialized = FALSE
 
MIXER_CONTEXT MixerContext
 
GUID CategoryGuid = {STATIC_KSCATEGORY_AUDIO}
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 19 of file mmixer.c.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 15 of file mmixer.c.

Function Documentation

◆ Alloc()

PVOID Alloc ( ULONG  NumBytes)

Definition at line 105 of file mmixer.c.

106 {
107  return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, NumBytes);
108 }
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

◆ AllocEventData()

PVOID AllocEventData ( IN ULONG  ExtraSize)

Definition at line 307 of file mmixer.c.

309 {
311  if (!Data)
312  return NULL;
313 
314  Data->EventHandle.Event = CreateEventW(NULL, FALSE, FALSE, NULL);
315  if (!Data->EventHandle.Event)
316  {
318  return NULL;
319  }
320 
321  Data->NotificationType = KSEVENTF_EVENT_HANDLE;
322  return Data;
323 }
struct KSEVENTDATA * PKSEVENTDATA
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:971
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define KSEVENTF_EVENT_HANDLE
Definition: ks.h:1778
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ Close()

MIXER_STATUS Close ( HANDLE  hDevice)

Definition at line 111 of file mmixer.c.

112 {
113  if (CloseHandle(hDevice))
114  return MM_STATUS_SUCCESS;
115  else
116  return MM_STATUS_UNSUCCESSFUL;
117 }
#define CloseHandle
Definition: compat.h:487

◆ CloseKey()

MIXER_STATUS CloseKey ( IN HANDLE  hKey)

Definition at line 97 of file mmixer.c.

99 {
100  RegCloseKey((HKEY)hKey);
101  return MM_STATUS_SUCCESS;
102 }
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423

◆ CommitWaveBufferApc()

static VOID WINAPI CommitWaveBufferApc ( PVOID  ApcContext,
PIO_STATUS_BLOCK  IoStatusBlock,
ULONG  Reserved 
)
static

Definition at line 785 of file mmixer.c.

788 {
789  DWORD dwErrorCode;
790  PSOUND_OVERLAPPED Overlap;
792 
794  Overlap = (PSOUND_OVERLAPPED)IoStatusBlock;
795  lpHeader = Overlap->CompletionContext;
796 
797  /* Call mmebuddy overlap routine */
798  Overlap->OriginalCompletionRoutine(dwErrorCode,
799  lpHeader->DataUsed, &Overlap->Standard);
800 
802 }
TCHAR lpHeader[80]
Definition: ctm.c:66
PVOID CompletionContext
Definition: mmebuddy.h:126
OVERLAPPED Standard
Definition: mmebuddy.h:120
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
struct _SOUND_OVERLAPPED * PSOUND_OVERLAPPED
#define GetProcessHeap()
Definition: compat.h:484
unsigned long DWORD
Definition: ntddk_ex.h:95
LPOVERLAPPED_COMPLETION_ROUTINE OriginalCompletionRoutine
Definition: mmebuddy.h:125
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by WdmAudCommitWaveBufferByMMixer().

◆ Control()

MIXER_STATUS Control ( IN HANDLE  hMixer,
IN ULONG  dwIoControlCode,
IN PVOID  lpInBuffer,
IN ULONG  nInBufferSize,
OUT PVOID  lpOutBuffer,
ULONG  nOutBufferSize,
PULONG  lpBytesReturned 
)

Definition at line 153 of file mmixer.c.

161 {
162  OVERLAPPED Overlapped;
163  BOOLEAN IoResult;
164  DWORD Transferred = 0;
165 
166  /* Overlapped I/O is done here - this is used for waiting for completion */
167  ZeroMemory(&Overlapped, sizeof(OVERLAPPED));
168  Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
169 
170  if ( ! Overlapped.hEvent )
171  return MM_STATUS_NO_MEMORY;
172 
173  /* Talk to the device */
174  IoResult = DeviceIoControl(hMixer,
176  lpInBuffer,
177  nInBufferSize,
178  lpOutBuffer,
179  nOutBufferSize,
180  &Transferred,
181  &Overlapped);
182 
183  /* If failure occurs, make sure it's not just due to the overlapped I/O */
184  if ( ! IoResult )
185  {
186  if ( GetLastError() != ERROR_IO_PENDING )
187  {
188  CloseHandle(Overlapped.hEvent);
189 
191  {
192  if ( lpBytesReturned )
193  *lpBytesReturned = Transferred;
194  return MM_STATUS_MORE_ENTRIES;
195  }
196 
197  return MM_STATUS_UNSUCCESSFUL;
198  }
199  }
200 
201  /* Wait for the I/O to complete */
202  IoResult = GetOverlappedResult(hMixer,
203  &Overlapped,
204  &Transferred,
205  TRUE);
206 
207  /* Don't need this any more */
208  CloseHandle(Overlapped.hEvent);
209 
210  if ( ! IoResult )
211  return MM_STATUS_UNSUCCESSFUL;
212 
213  if ( lpBytesReturned )
214  *lpBytesReturned = Transferred;
215 
216  return MM_STATUS_SUCCESS;
217 }
#define CreateEvent
Definition: winbase.h:3588
#define CloseHandle
Definition: compat.h:487
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:204
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define FALSE
Definition: types.h:117
HMIXER hMixer
Definition: test.c:10
HANDLE hEvent
Definition: winbase.h:798
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_MORE_DATA
Definition: dderror.h:13
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
_In_ DWORD _In_ DWORD _In_ DWORD _Out_ LPDWORD lpBytesReturned
Definition: winddi.h:1704
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
_In_ DWORD dwIoControlCode
Definition: winddi.h:1700

◆ Copy()

VOID Copy ( PVOID  Src,
PVOID  Dst,
ULONG  NumBytes 
)

Definition at line 126 of file mmixer.c.

127 {
128  RtlMoveMemory(Src, Dst, NumBytes);
129 }
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define Dst
Definition: mesh.h:153

Referenced by DECLARE_INTERFACE_(), IopQueueTargetDeviceEvent(), NtUserInternalGetWindowText(), PrependPacket(), and RepairList().

◆ Enum()

MIXER_STATUS Enum ( IN PVOID  EnumContext,
IN ULONG  DeviceIndex,
OUT LPWSTR DeviceName,
OUT PHANDLE  OutHandle,
OUT PHANDLE  OutKey 
)

Definition at line 220 of file mmixer.c.

226 {
230  BOOL Result;
231  DWORD Length;
233 
234  //printf("Enum EnumContext %p DeviceIndex %lu OutHandle %p\n", EnumContext, DeviceIndex, OutHandle);
235 
236  InterfaceData.cbSize = sizeof(InterfaceData);
237  InterfaceData.Reserved = 0;
238 
239  Result = SetupDiEnumDeviceInterfaces(EnumContext,
240  NULL,
241  &CategoryGuid,
242  DeviceIndex,
243  &InterfaceData);
244 
245  if (!Result)
246  {
248  {
250  }
251  return MM_STATUS_UNSUCCESSFUL;
252  }
253 
256  0,
257  Length);
258  DetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
259  DeviceData.cbSize = sizeof(DeviceData);
260  DeviceData.Reserved = 0;
261 
263  &InterfaceData,
264  DetailData,
265  Length,
266  NULL,
267  &DeviceData);
268 
269  if (!Result)
270  {
271  DPRINT("SetupDiGetDeviceInterfaceDetailW failed with %lu\n", GetLastError());
272  return MM_STATUS_UNSUCCESSFUL;
273  }
274 
275 
276  *OutKey = SetupDiOpenDeviceInterfaceRegKey(EnumContext, &InterfaceData, 0, KEY_READ);
277  if ((HKEY)*OutKey == INVALID_HANDLE_VALUE)
278  {
279  HeapFree(GetProcessHeap(), 0, DetailData);
280  return MM_STATUS_UNSUCCESSFUL;
281  }
282 
283  Status = Open(DetailData->DevicePath, OutHandle);
284 
285  if (Status != MM_STATUS_SUCCESS)
286  {
287  RegCloseKey((HKEY)*OutKey);
288  HeapFree(GetProcessHeap(), 0, DetailData);
289  return Status;
290  }
291 
292  *DeviceName = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(DetailData->DevicePath)+1) * sizeof(WCHAR));
293  if (*DeviceName == NULL)
294  {
295  CloseHandle(*OutHandle);
296  RegCloseKey((HKEY)*OutKey);
297  HeapFree(GetProcessHeap(), 0, DetailData);
298  return MM_STATUS_NO_MEMORY;
299  }
300  wcscpy(*DeviceName, DetailData->DevicePath);
301  HeapFree(GetProcessHeap(), 0, DetailData);
302 
303  return Status;
304 }
#define CloseHandle
Definition: compat.h:487
WCHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:850
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define KEY_READ
Definition: nt_native.h:1023
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:3016
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
WCHAR DeviceName[]
Definition: adapter.cpp:21
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA_W
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
void DPRINT(...)
Definition: polytest.cpp:61
GUID CategoryGuid
Definition: mmixer.c:58
MIXER_STATUS Open(IN LPWSTR DevicePath, OUT PHANDLE hDevice)
Definition: mmixer.c:132
HKEY WINAPI SetupDiOpenDeviceInterfaceRegKey(IN HDEVINFO DeviceInfoSet, IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, IN DWORD Reserved, IN REGSAM samDesired)
Definition: interface.c:547
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W * PSP_DEVICE_INTERFACE_DETAIL_DATA_W
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
Status
Definition: gdiplustypes.h:24
MIXER_STATUS
Definition: mmixer.h:3
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
IN PVOID IN PVOID InterfaceData
Definition: pci.h:361
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by Moniker_Enum(), test_Hlink_Navigate(), test_HlinkClone(), test_HlinkGetSetMonikerReference(), test_HlinkSite(), USBH_ChangeIndicationWorker(), WdmAudInitUserModeMixer(), WdmAudMixerInitialize(), and WshCollection__NewEnum().

◆ Free()

VOID Free ( PVOID  Block)

Definition at line 120 of file mmixer.c.

121 {
122  HeapFree(GetProcessHeap(), 0, Block);
123 }
#define GetProcessHeap()
Definition: compat.h:484
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ FreeEventData()

VOID FreeEventData ( IN PVOID  EventData)

Definition at line 326 of file mmixer.c.

327 {
328  PKSEVENTDATA Data = (PKSEVENTDATA)EventData;
329 
330  CloseHandle(Data->EventHandle.Event);
332 }
#define CloseHandle
Definition: compat.h:487
struct KSEVENTDATA * PKSEVENTDATA
#define GetProcessHeap()
Definition: compat.h:484
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ MixerEventCallback()

VOID CALLBACK MixerEventCallback ( IN PVOID  MixerEventContext,
IN HANDLE  hMixer,
IN ULONG  NotificationType,
IN ULONG  Value 
)

Definition at line 672 of file mmixer.c.

677 {
679 
680  DriverCallback(Instance->WinMM.ClientCallback,
681  HIWORD(Instance->WinMM.Flags),
682  Instance->WinMM.Handle,
683  NotificationType,
684  Instance->WinMM.ClientCallbackInstanceData,
685  (DWORD_PTR)Value,
686  0);
687 }
struct _SOUND_DEVICE_INSTANCE * PSOUND_DEVICE_INSTANCE
IN UCHAR Value
Definition: halp.h:394
uint32_t DWORD_PTR
Definition: typedefs.h:65
IN PVOID Instance
Definition: pci.h:361
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)

Referenced by WdmAudSetMixerDeviceFormatByMMixer().

◆ Open()

MIXER_STATUS Open ( IN LPWSTR  DevicePath,
OUT PHANDLE  hDevice 
)

Definition at line 132 of file mmixer.c.

135 {
136  DevicePath[1] = L'\\';
137  *hDevice = CreateFileW(DevicePath,
139  0,
140  NULL,
143  NULL);
144  if (*hDevice == INVALID_HANDLE_VALUE)
145  {
146  return MM_STATUS_UNSUCCESSFUL;
147  }
148 
149  return MM_STATUS_SUCCESS;
150 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:523
static const WCHAR L[]
Definition: oid.c:1250
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:489
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46

Referenced by Enum().

◆ OpenKey()

MIXER_STATUS OpenKey ( IN HANDLE  hKey,
IN LPWSTR  SubKey,
IN ULONG  DesiredAccess,
OUT PHANDLE  OutKey 
)

Definition at line 84 of file mmixer.c.

89 {
90  if (RegOpenKeyExW((HKEY)hKey, SubKey, 0, DesiredAccess, (PHKEY)OutKey) == ERROR_SUCCESS)
91  return MM_STATUS_SUCCESS;
92 
94 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4137
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366

◆ QueryKeyValue()

MIXER_STATUS QueryKeyValue ( IN HANDLE  hKey,
IN LPWSTR  KeyName,
OUT PVOID ResultBuffer,
OUT PULONG  ResultLength,
OUT PULONG  KeyType 
)

Definition at line 61 of file mmixer.c.

67 {
70 
72  if (*ResultBuffer == NULL)
73  return MM_STATUS_NO_MEMORY;
74 
76  {
79  }
80  return MM_STATUS_SUCCESS;
81 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define ERROR_SUCCESS
Definition: deptool.c:10
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
PKMT_RESULTBUFFER ResultBuffer
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ WdmAudCleanupByMMixer()

MMRESULT WdmAudCleanupByMMixer ( )

Definition at line 382 of file mmixer.c.

383 {
384  /* TODO */
385  return MMSYSERR_NOERROR;
386 }
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96

◆ WdmAudCloseSoundDeviceByMMixer()

MMRESULT WdmAudCloseSoundDeviceByMMixer ( IN struct _SOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN PVOID  Handle 
)

Definition at line 557 of file mmixer.c.

560 {
562  PSOUND_DEVICE SoundDevice;
564 
565  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
566 
567  if ( ! MMSUCCESS(Result) )
568  {
570  }
571 
572  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
574 
576  {
577  /* no op */
578  return MMSYSERR_NOERROR;
579  }
581  {
582  /* make sure the pin is stopped */
583  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
584  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
585  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_STOP);
586 
588  return MMSYSERR_NOERROR;
589  }
590 
591  /* midi is not supported */
592  return MMSYSERR_ERROR;
593 }
#define CloseHandle
Definition: compat.h:487
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
UINT MMRESULT
Definition: mmsystem.h:962
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
#define SND_ASSERT(condition)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
MIXER_STATUS MMixerSetWaveStatus(IN PMIXER_CONTEXT MixerContext, IN HANDLE PinHandle, IN KSSTATE State)
Definition: wave.c:607
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)

◆ WdmAudCommitWaveBufferByMMixer()

MMRESULT WdmAudCommitWaveBufferByMMixer ( IN PSOUND_DEVICE_INSTANCE  SoundDeviceInstance,
IN PVOID  OffsetPtr,
IN DWORD  Length,
IN PSOUND_OVERLAPPED  Overlap,
IN LPOVERLAPPED_COMPLETION_ROUTINE  CompletionRoutine 
)

Definition at line 805 of file mmixer.c.

811 {
812  PSOUND_DEVICE SoundDevice;
815  ULONG IoCtl;
818 
819  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
820 
821  if ( ! MMSUCCESS(Result) )
822  {
824  }
825 
826  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
828 
830  if ( ! lpHeader )
831  {
832  /* no memory */
833  return MMSYSERR_NOMEM;
834  }
835 
836  /* setup stream packet */
837  lpHeader->Size = sizeof(KSSTREAM_HEADER);
838  lpHeader->PresentationTime.Numerator = 1;
839  lpHeader->PresentationTime.Denominator = 1;
840  lpHeader->Data = OffsetPtr;
841  lpHeader->FrameExtent = Length;
842  Overlap->CompletionContext = lpHeader;
843  Overlap->OriginalCompletionRoutine = CompletionRoutine;
845 
847  {
848  lpHeader->DataUsed = Length;
849  }
850 
851  Status = NtDeviceIoControlFile(SoundDeviceInstance->Handle,
852  NULL,
854  NULL,
855  (PIO_STATUS_BLOCK)Overlap,
856  IoCtl,
857  NULL,
858  0,
859  lpHeader,
860  sizeof(KSSTREAM_HEADER));
861 
862  if (!NT_SUCCESS(Status))
863  {
864  DPRINT1("NtDeviceIoControlFile() failed with status %08lx\n", Status);
865  return MMSYSERR_ERROR;
866  }
867 
868  return MMSYSERR_NOERROR;
869 }
TCHAR lpHeader[80]
Definition: ctm.c:66
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:139
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
#define IOCTL_KS_READ_STREAM
Definition: ks.h:142
DeviceType
Definition: mmdrv.h:41
LONG NTSTATUS
Definition: precomp.h:26
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
UINT MMRESULT
Definition: mmsystem.h:962
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
smooth NULL
Definition: ftsmooth.c:416
#define SND_ASSERT(condition)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
static VOID WINAPI CommitWaveBufferApc(PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved)
Definition: mmixer.c:785
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define DPRINT1
Definition: precomp.h:8
_In_ PIRP _In_opt_ PVOID _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
Definition: fsrtlfuncs.h:673
unsigned int ULONG
Definition: retypes.h:1
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)

◆ WdmAudGetCapabilitiesByMMixer()

MMRESULT WdmAudGetCapabilitiesByMMixer ( IN PSOUND_DEVICE  SoundDevice,
IN DWORD  DeviceId,
OUT PVOID  Capabilities,
IN DWORD  CapabilitiesSize 
)

Definition at line 514 of file mmixer.c.

519 {
522 
523  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
525 
527  {
529  }
530  else if (DeviceType == WAVE_OUT_DEVICE_TYPE)
531  {
533  }
534  else if (DeviceType == WAVE_IN_DEVICE_TYPE)
535  {
537  }
538  else
539  {
540  // not supported
541  return MMSYSERR_ERROR;
542  }
543 }
DeviceType
Definition: mmdrv.h:41
UINT MMRESULT
Definition: mmsystem.h:962
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
MMRESULT WdmAudGetMixerCapabilities(IN ULONG DeviceId, LPMIXERCAPSW Capabilities)
Definition: mmixer.c:389
#define SND_ASSERT(condition)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
MMRESULT WdmAudGetWaveInCapabilities(IN ULONG DeviceId, LPWAVEINCAPSW Capabilities)
Definition: mmixer.c:465
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
MMRESULT WdmAudGetWaveOutCapabilities(IN ULONG DeviceId, LPWAVEOUTCAPSW Capabilities)
Definition: mmixer.c:453

◆ WdmAudGetControlDetails()

MMRESULT WdmAudGetControlDetails ( IN HANDLE  hMixer,
IN DWORD  MixerId,
IN LPMIXERCONTROLDETAILS  MixDetails,
IN ULONG  Flags 
)

Definition at line 440 of file mmixer.c.

445 {
446  if (MMixerGetControlDetails(&MixerContext, hMixer, MixerId, Flags, MixDetails) == MM_STATUS_SUCCESS)
447  return MMSYSERR_NOERROR;
448 
449  return MMSYSERR_ERROR;
450 }
MIXER_STATUS MMixerGetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERCONTROLDETAILS MixerControlDetails)
Definition: mixer.c:566
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
HMIXER hMixer
Definition: test.c:10
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97

Referenced by WdmAudDeviceControl(), and WdmAudQueryMixerInfoByMMixer().

◆ WdmAudGetDeviceInterfaceStringByMMixer()

MMRESULT WdmAudGetDeviceInterfaceStringByMMixer ( IN MMDEVICE_TYPE  DeviceType,
IN DWORD  DeviceId,
IN LPWSTR  Interface,
IN DWORD  InterfaceLength,
OUT DWORD InterfaceSize 
)

Definition at line 659 of file mmixer.c.

665 {
666  /* FIXME */
667  return MMSYSERR_NOTSUPPORTED;
668 }
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104

◆ WdmAudGetLineControls()

MMRESULT WdmAudGetLineControls ( IN HANDLE  hMixer,
IN DWORD  MixerId,
IN LPMIXERLINECONTROLSW  MixControls,
IN ULONG  Flags 
)

Definition at line 413 of file mmixer.c.

418 {
419  if (MMixerGetLineControls(&MixerContext, hMixer, MixerId, Flags, MixControls) == MM_STATUS_SUCCESS)
420  return MMSYSERR_NOERROR;
421 
422  return MMSYSERR_ERROR;
423 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
HMIXER hMixer
Definition: test.c:10
MIXER_STATUS MMixerGetLineControls(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINECONTROLSW MixerLineControls)
Definition: mixer.c:332
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97

Referenced by WdmAudDeviceControl(), and WdmAudQueryMixerInfoByMMixer().

◆ WdmAudGetLineInfo()

MMRESULT WdmAudGetLineInfo ( IN HANDLE  hMixer,
IN DWORD  MixerId,
IN LPMIXERLINEW  MixLine,
IN ULONG  Flags 
)

Definition at line 400 of file mmixer.c.

405 {
406  if (MMixerGetLineInfo(&MixerContext, hMixer, MixerId, Flags, MixLine) == MM_STATUS_SUCCESS)
407  return MMSYSERR_NOERROR;
408 
409  return MMSYSERR_ERROR;
410 }
MIXER_STATUS MMixerGetLineInfo(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERLINEW MixerLine)
Definition: mixer.c:149
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
HMIXER hMixer
Definition: test.c:10
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97

Referenced by WdmAudDeviceControl(), and WdmAudQueryMixerInfoByMMixer().

◆ WdmAudGetMixerCapabilities()

MMRESULT WdmAudGetMixerCapabilities ( IN ULONG  DeviceId,
LPMIXERCAPSW  Capabilities 
)

Definition at line 389 of file mmixer.c.

392 {
394  return MMSYSERR_NOERROR;
395 
396  return MMSYSERR_BADDEVICEID;
397 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
MIXER_STATUS MMixerGetCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerIndex, OUT LPMIXERCAPSW MixerCaps)
Definition: mixer.c:38

Referenced by WdmAudGetCapabilitiesByMMixer().

◆ WdmAudGetNumWdmDevsByMMixer()

MMRESULT WdmAudGetNumWdmDevsByMMixer ( IN MMDEVICE_TYPE  DeviceType,
OUT DWORD DeviceCount 
)

Definition at line 596 of file mmixer.c.

599 {
600  switch(DeviceType)
601  {
602  case MIXER_DEVICE_TYPE:
604  break;
607  break;
608  case WAVE_IN_DEVICE_TYPE:
610  break;
611  default:
612  *DeviceCount = 0;
613  }
614  return MMSYSERR_NOERROR;
615 }
ULONG MMixerGetWaveInCount(IN PMIXER_CONTEXT MixerContext)
Definition: wave.c:563
DeviceType
Definition: mmdrv.h:41
ULONG MMixerGetCount(IN PMIXER_CONTEXT MixerContext)
Definition: mixer.c:15
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
ULONG DeviceCount
Definition: mpu401.c:26
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
ULONG MMixerGetWaveOutCount(IN PMIXER_CONTEXT MixerContext)
Definition: wave.c:585

◆ WdmAudGetWaveInCapabilities()

MMRESULT WdmAudGetWaveInCapabilities ( IN ULONG  DeviceId,
LPWAVEINCAPSW  Capabilities 
)

Definition at line 465 of file mmixer.c.

468 {
470  return MMSYSERR_NOERROR;
471 
472  return MMSYSERR_ERROR;
473 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
MIXER_STATUS MMixerWaveInCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEINCAPSW Caps)
Definition: wave.c:491

Referenced by WdmAudGetCapabilitiesByMMixer().

◆ WdmAudGetWaveOutCapabilities()

MMRESULT WdmAudGetWaveOutCapabilities ( IN ULONG  DeviceId,
LPWAVEOUTCAPSW  Capabilities 
)

Definition at line 453 of file mmixer.c.

456 {
458  return MMSYSERR_NOERROR;
459 
460  return MMSYSERR_ERROR;
461 
462 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
MIXER_STATUS MMixerWaveOutCapabilities(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, OUT LPWAVEOUTCAPSW Caps)
Definition: wave.c:527

Referenced by WdmAudGetCapabilitiesByMMixer().

◆ WdmAudGetWavePositionByMMixer()

MMRESULT WdmAudGetWavePositionByMMixer ( IN struct _SOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN MMTIME Time 
)

Definition at line 775 of file mmixer.c.

778 {
779  /* FIXME */
780  return MMSYSERR_NOTSUPPORTED;
781 }
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104

◆ WdmAudInitUserModeMixer()

BOOL WdmAudInitUserModeMixer ( )

Definition at line 336 of file mmixer.c.

337 {
340 
342  {
343  /* library is already initialized */
344  return TRUE;
345  }
346 
347 
348  /* create a device list */
350  NULL,
351  NULL,
352  DIGCF_DEVICEINTERFACE/* FIXME |DIGCF_PRESENT*/);
353 
355  {
356  /* failed to create a device list */
357  return FALSE;
358  }
359 
360 
361  /* initialize the mixer library */
363 
364  /* free device list */
366 
367  if (Status != MM_STATUS_SUCCESS)
368  {
369  /* failed to initialize mixer library */
370  DPRINT1("Failed to initialize mixer library with %x\n", Status);
371  return FALSE;
372  }
373 
374  /* library is now initialized */
376 
377  /* completed successfully */
378  return TRUE;
379 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
MIXER_STATUS MMixerInitialize(IN PMIXER_CONTEXT MixerContext, IN PMIXER_ENUM EnumFunction, IN PVOID EnumContext)
Definition: mixer.c:770
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
BOOL MMixerLibraryInitialized
Definition: mmixer.c:24
#define FALSE
Definition: types.h:117
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
smooth NULL
Definition: ftsmooth.c:416
GUID CategoryGuid
Definition: mmixer.c:58
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
Status
Definition: gdiplustypes.h:24
#define SetupDiGetClassDevs
Definition: setupapi.h:2588
MIXER_STATUS Enum(IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR *DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey)
Definition: mmixer.c:220
MIXER_STATUS
Definition: mmixer.h:3
#define DPRINT1
Definition: precomp.h:8
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174

Referenced by WdmAudOpenSoundDeviceByMMixer().

◆ WdmAudOpenSoundDeviceByMMixer()

MMRESULT WdmAudOpenSoundDeviceByMMixer ( IN struct _SOUND_DEVICE SoundDevice,
OUT PVOID Handle 
)

Definition at line 546 of file mmixer.c.

549 {
551  return MMSYSERR_NOERROR;
552  else
553  return MMSYSERR_ERROR;
554 }
BOOL WdmAudInitUserModeMixer()
Definition: mmixer.c:336
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97

◆ WdmAudQueryMixerInfoByMMixer()

MMRESULT WdmAudQueryMixerInfoByMMixer ( IN struct _SOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN DWORD  MixerId,
IN UINT  uMsg,
IN LPVOID  Parameter,
IN DWORD  Flags 
)

Definition at line 618 of file mmixer.c.

624 {
625  LPMIXERLINEW MixLine;
626  LPMIXERLINECONTROLSW MixControls;
627  LPMIXERCONTROLDETAILS MixDetails;
628  HANDLE hMixer = NULL;
629 
630  MixLine = (LPMIXERLINEW)Parameter;
631  MixControls = (LPMIXERLINECONTROLSW)Parameter;
632  MixDetails = (LPMIXERCONTROLDETAILS)Parameter;
633 
634  /* FIXME param checks */
635 
636  if (SoundDeviceInstance)
637  {
638  hMixer = SoundDeviceInstance->Handle;
639  }
640 
641  switch(uMsg)
642  {
643  case MXDM_GETLINEINFO:
644  return WdmAudGetLineInfo(hMixer, MixerId, MixLine, Flags);
646  return WdmAudGetLineControls(hMixer, MixerId, MixControls, Flags);
648  return WdmAudSetControlDetails(hMixer, MixerId, MixDetails, Flags);
650  return WdmAudGetControlDetails(hMixer, MixerId, MixDetails, Flags);
651  default:
652  DPRINT1("MixerId %lu, uMsg %lu, Parameter %p, Flags %lu\n", MixerId, uMsg, Parameter, Flags);
653  SND_ASSERT(0);
654  return MMSYSERR_NOTSUPPORTED;
655  }
656 }
MMRESULT WdmAudGetLineInfo(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINEW MixLine, IN ULONG Flags)
Definition: mmixer.c:400
struct tMIXERCONTROLDETAILS * LPMIXERCONTROLDETAILS
_In_ PVOID Parameter
Definition: ldrtypes.h:241
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
MMRESULT WdmAudSetControlDetails(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
Definition: mmixer.c:426
HMIXER hMixer
Definition: test.c:10
MMRESULT WdmAudGetControlDetails(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
Definition: mmixer.c:440
smooth NULL
Definition: ftsmooth.c:416
#define SND_ASSERT(condition)
#define MXDM_SETCONTROLDETAILS
Definition: mmddk.h:198
#define MXDM_GETCONTROLDETAILS
Definition: mmddk.h:197
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
MMRESULT WdmAudGetLineControls(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINECONTROLSW MixControls, IN ULONG Flags)
Definition: mmixer.c:413
struct tagMIXERLINEW * LPMIXERLINEW
#define MXDM_GETLINECONTROLS
Definition: mmddk.h:196
#define DPRINT1
Definition: precomp.h:8
struct tagMIXERLINECONTROLSW * LPMIXERLINECONTROLSW
#define MXDM_GETLINEINFO
Definition: mmddk.h:195

◆ WdmAudResetStreamByMMixer()

MMRESULT WdmAudResetStreamByMMixer ( IN struct _SOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN MMDEVICE_TYPE  DeviceType,
IN BOOLEAN  bStartReset 
)

Definition at line 753 of file mmixer.c.

757 {
759 
761  {
762  Status = MMixerSetWaveResetState(&MixerContext, SoundDeviceInstance->Handle, bStartReset);
763  if (Status == MM_STATUS_SUCCESS)
764  {
765  /* completed successfully */
766  return MMSYSERR_NOERROR;
767  }
768  }
769 
770 
771  return MMSYSERR_NOTSUPPORTED;
772 }
DeviceType
Definition: mmdrv.h:41
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
Status
Definition: gdiplustypes.h:24
MIXER_STATUS MMixerSetWaveResetState(IN PMIXER_CONTEXT MixerContext, IN HANDLE PinHandle, IN ULONG bBegin)
Definition: wave.c:634
MIXER_STATUS
Definition: mmixer.h:3

◆ WdmAudSetControlDetails()

MMRESULT WdmAudSetControlDetails ( IN HANDLE  hMixer,
IN DWORD  MixerId,
IN LPMIXERCONTROLDETAILS  MixDetails,
IN ULONG  Flags 
)

Definition at line 426 of file mmixer.c.

431 {
432  if (MMixerSetControlDetails(&MixerContext, hMixer, MixerId, Flags, MixDetails) == MM_STATUS_SUCCESS)
433  return MMSYSERR_NOERROR;
434 
435  return MMSYSERR_ERROR;
436 
437 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
HMIXER hMixer
Definition: test.c:10
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
MIXER_STATUS MMixerSetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE MixerHandle, IN ULONG MixerId, IN ULONG Flags, OUT LPMIXERCONTROLDETAILS MixerControlDetails)
Definition: mixer.c:496

Referenced by WdmAudDeviceControl(), and WdmAudQueryMixerInfoByMMixer().

◆ WdmAudSetMixerDeviceFormatByMMixer()

MMRESULT WdmAudSetMixerDeviceFormatByMMixer ( IN PSOUND_DEVICE_INSTANCE  Instance,
IN DWORD  DeviceId,
IN PWAVEFORMATEX  WaveFormat,
IN DWORD  WaveFormatSize 
)

Definition at line 690 of file mmixer.c.

695 {
697  return MMSYSERR_NOERROR;
698 
699  return MMSYSERR_BADDEVICEID;
700 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
VOID CALLBACK MixerEventCallback(IN PVOID MixerEventContext, IN HANDLE hMixer, IN ULONG NotificationType, IN ULONG Value)
Definition: mmixer.c:672
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
IN PVOID Instance
Definition: pci.h:361
MIXER_STATUS MMixerOpen(IN PMIXER_CONTEXT MixerContext, IN ULONG MixerId, IN PVOID MixerEventContext, IN PMIXER_EVENT MixerEventRoutine, OUT PHANDLE MixerHandle)
Definition: mixer.c:77

◆ WdmAudSetWaveDeviceFormatByMMixer()

MMRESULT WdmAudSetWaveDeviceFormatByMMixer ( IN PSOUND_DEVICE_INSTANCE  Instance,
IN DWORD  DeviceId,
IN PWAVEFORMATEX  WaveFormat,
IN DWORD  WaveFormatSize 
)

Definition at line 476 of file mmixer.c.

481 {
483  PSOUND_DEVICE SoundDevice;
485  BOOL bWaveIn;
486 
487  Result = GetSoundDeviceFromInstance(Instance, &SoundDevice);
488 
489  if ( ! MMSUCCESS(Result) )
490  {
492  }
493 
494  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
496 
497  bWaveIn = (DeviceType == WAVE_IN_DEVICE_TYPE ? TRUE : FALSE);
498 
499  if (MMixerOpenWave(&MixerContext, DeviceId, bWaveIn, WaveFormat, NULL, NULL, &Instance->Handle) == MM_STATUS_SUCCESS)
500  {
502  {
506  }
507  return MMSYSERR_NOERROR;
508  }
509  return MMSYSERR_ERROR;
510 }
MIXER_STATUS MMixerOpenWave(IN PMIXER_CONTEXT MixerContext, IN ULONG DeviceIndex, IN ULONG bWaveIn, IN LPWAVEFORMATEX WaveFormat, IN PIN_CREATE_CALLBACK CreateCallback, IN PVOID Context, OUT PHANDLE PinHandle)
Definition: wave.c:436
#define TRUE
Definition: types.h:120
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
UINT MMRESULT
Definition: mmsystem.h:962
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
#define FALSE
Definition: types.h:117
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define SND_ASSERT(condition)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
MIXER_STATUS MMixerSetWaveStatus(IN PMIXER_CONTEXT MixerContext, IN HANDLE PinHandle, IN KSSTATE State)
Definition: wave.c:607
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
IN PVOID Instance
Definition: pci.h:361
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)

◆ WdmAudSetWaveStateByMMixer()

MMRESULT WdmAudSetWaveStateByMMixer ( IN struct _SOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN BOOL  bStart 
)

Definition at line 703 of file mmixer.c.

706 {
708  PSOUND_DEVICE SoundDevice;
710 
711  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
713 
714 
715  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
717 
719  {
720  if (bStart)
721  {
722  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
723  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
724  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_RUN);
725  }
726  else
727  {
728  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
729  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
730  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_STOP);
731  }
732  }
734  {
735  if (bStart)
736  {
737  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
738  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
739  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_RUN);
740  }
741  else
742  {
743  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
744  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
745  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_STOP);
746  }
747  }
748 
749  return MMSYSERR_NOERROR;
750 }
MIXER_STATUS MMixerSetMidiStatus(IN PMIXER_CONTEXT MixerContext, IN HANDLE PinHandle, IN KSSTATE State)
Definition: midi.c:437
DeviceType
Definition: mmdrv.h:41
UINT MMRESULT
Definition: mmsystem.h:962
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
#define SND_ASSERT(condition)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
MIXER_STATUS MMixerSetWaveStatus(IN PMIXER_CONTEXT MixerContext, IN HANDLE PinHandle, IN KSSTATE State)
Definition: wave.c:607
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)

Variable Documentation

◆ CategoryGuid

GUID CategoryGuid = {STATIC_KSCATEGORY_AUDIO}

Definition at line 58 of file mmixer.c.

Referenced by Enum(), and WdmAudInitUserModeMixer().

◆ MixerContext

MIXER_CONTEXT MixerContext
Initial value:
=
{
sizeof(MIXER_CONTEXT),
}
MIXER_STATUS Control(IN HANDLE hMixer, IN ULONG dwIoControlCode, IN PVOID lpInBuffer, IN ULONG nInBufferSize, OUT PVOID lpOutBuffer, ULONG nOutBufferSize, PULONG lpBytesReturned)
Definition: mmixer.c:153
MIXER_STATUS QueryKeyValue(IN HANDLE hKey, IN LPWSTR KeyName, OUT PVOID *ResultBuffer, OUT PULONG ResultLength, OUT PULONG KeyType)
Definition: mmixer.c:61
PVOID AllocEventData(IN ULONG ExtraSize)
Definition: mmixer.c:307
MIXER_STATUS Close(HANDLE hDevice)
Definition: mmixer.c:111
PVOID Alloc(ULONG NumBytes)
Definition: mmixer.c:105
VOID FreeEventData(IN PVOID EventData)
Definition: mmixer.c:326
smooth NULL
Definition: ftsmooth.c:416
MIXER_STATUS Open(IN LPWSTR DevicePath, OUT PHANDLE hDevice)
Definition: mmixer.c:132
VOID Free(PVOID Block)
Definition: mmixer.c:120
MIXER_STATUS CloseKey(IN HANDLE hKey)
Definition: mmixer.c:97
MIXER_STATUS OpenKey(IN HANDLE hKey, IN LPWSTR SubKey, IN ULONG DesiredAccess, OUT PHANDLE OutKey)
Definition: mmixer.c:84
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:126

Definition at line 41 of file mmixer.c.

Referenced by MMixerAddEvent(), MMixerAddMidiPin(), MMixerAddMixerControl(), MMixerAddMixerControlsToDestinationLine(), MMixerAddMixerControlsToMixerLineByNodeIndexArray(), MMixerAddMixerSourceLines(), MMixerAddPinConnection(), MMixerAddPinIndexToArray(), MMixerAddPinToPinConnection(), MMixerAllocatePinConnect(), MMixerAllocateTopology(), MMixerAllocateTopologyNodeArray(), MMixerAllocateTopologyPinArray(), MMixerApplyOutputFilterHack(), MMixerBuildMixerDestinationLine(), MMixerBuildMixerSourceLine(), MMixerBuildTopology(), MMixerCheckFilterPinMidiSupport(), MMixerClose(), MMixerCountMixerControls(), MMixerCreateDestinationLine(), MMixerCreateMixerData(), MMixerCreateTopology(), MMixerExploreTopology(), MMixerFreeMixerInfo(), MMixerGetAllUpOrDownstreamNodesFromNodeIndex(), MMixerGetAllUpOrDownstreamNodesFromPinIndex(), MMixerGetAllUpOrDownstreamPinsFromNodeIndex(), MMixerGetAllUpOrDownstreamPinsFromPinIndex(), MMixerGetAudioPinDataRanges(), MMixerGetCapabilities(), MMixerGetChannelCountEnhanced(), MMixerGetChannelCountLegacy(), MMixerGetComponentAndTargetType(), MMixerGetControlDetails(), MMixerGetCount(), MMixerGetDeviceName(), MMixerGetDeviceNameWithComponentId(), MMixerGetFilterPinCount(), MMixerGetFilterTopologyProperty(), MMixerGetLineControls(), MMixerGetLineInfo(), MMixerGetMaxChannelsForNode(), MMixerGetMidiDevicePath(), MMixerGetMidiInCount(), MMixerGetMidiOutCount(), MMixerGetMixerDataByDeviceHandle(), MMixerGetMixerInfoByIndex(), MMixerGetPhysicalConnection(), MMixerGetPinDataFlowAndCommunication(), MMixerGetPinInstanceCount(), MMixerGetPinName(), MMixerGetUpOrDownstreamNodes(), MMixerGetUpOrDownStreamPins(), MMixerGetWaveDevicePath(), MMixerGetWaveInCount(), MMixerGetWaveOutCount(), MMixerHandleAlternativeMixers(), MMixerHandleNodePinConnection(), MMixerHandleNodeToNodeConnection(), MMixerHandlePhysicalConnection(), MMixerHandleTopologyFilter(), MMixerInitialize(), MMixerInitializeFilter(), MMixerInitializeMidiForFilter(), MMixerInitializeTopologyNodes(), MMixerInitializeWaveInfo(), MMixerIsNodeConnectedToPin(), MMixerMidiInCapabilities(), MMixerMidiOutCapabilities(), MMixerOpen(), MMixerOpenMidi(), MMixerOpenMidiPin(), MMixerOpenWave(), MMixerOpenWavePin(), MMixerPrintMixers(), MMixerRemoveEvent(), MMixerSetControlDetails(), MMixerSetGetControlDetails(), MMixerSetGetMuteControlDetails(), MMixerSetGetMuxControlDetails(), MMixerSetGetVolumeControlDetails(), MMixerSetMidiStatus(), MMixerSetupFilter(), MMixerSetWaveResetState(), MMixerSetWaveStatus(), MMixerVerifyContext(), MMixerWaveInCapabilities(), MMixerWaveOutCapabilities(), WdmAudCloseAllMixers(), WdmAudCloseSoundDeviceByMMixer(), WdmAudControlCloseMixer(), WdmAudControlOpenMidi(), WdmAudControlOpenMixer(), WdmAudControlOpenWave(), WdmAudGetControlDetails(), WdmAudGetLineControls(), WdmAudGetLineInfo(), WdmAudGetMidiInDeviceCount(), WdmAudGetMidiOutDeviceCount(), WdmAudGetMixerCapabilities(), WdmAudGetMixerDeviceCount(), WdmAudGetNumWdmDevsByMMixer(), WdmAudGetPnpNameByIndexAndType(), WdmAudGetWaveInCapabilities(), WdmAudGetWaveInDeviceCount(), WdmAudGetWaveOutCapabilities(), WdmAudGetWaveOutDeviceCount(), WdmAudInitUserModeMixer(), WdmAudMidiCapabilities(), WdmAudMixerCapabilities(), WdmAudMixerInitialize(), WdmAudResetStreamByMMixer(), WdmAudSetControlDetails(), WdmAudSetMixerDeviceFormatByMMixer(), WdmAudSetWaveDeviceFormatByMMixer(), WdmAudSetWaveStateByMMixer(), and WdmAudWaveCapabilities().

◆ MMixerLibraryInitialized

BOOL MMixerLibraryInitialized = FALSE

Definition at line 24 of file mmixer.c.

Referenced by WdmAudInitUserModeMixer().