ReactOS  0.4.13-dev-259-g5ca9c9c
mmixer.c File Reference
#include "wdmaud.h"
#include <winreg.h>
#include <setupapi.h>
#include <mmixer.h>
#include <debug.h>
#include <mmebuddy_debug.h>
Include dependency graph for mmixer.c:

Go to the source code of this file.

Classes

struct  IO_PACKET
 

Macros

#define NDEBUG
 

Typedefs

typedef struct IO_PACKETLPIO_PACKET
 

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)
 
DWORD WINAPI IoStreamingThread (LPVOID lpParameter)
 
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 16 of file mmixer.c.

Typedef Documentation

◆ LPIO_PACKET

Function Documentation

◆ Alloc()

PVOID Alloc ( ULONG  NumBytes)

Definition at line 110 of file mmixer.c.

111 {
112  return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, NumBytes);
113 }
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

◆ AllocEventData()

PVOID AllocEventData ( IN ULONG  ExtraSize)

Definition at line 312 of file mmixer.c.

314 {
316  if (!Data)
317  return NULL;
318 
319  Data->EventHandle.Event = CreateEventW(NULL, FALSE, FALSE, NULL);
320  if (!Data->EventHandle.Event)
321  {
323  return NULL;
324  }
325 
326  Data->NotificationType = KSEVENTF_EVENT_HANDLE;
327  return Data;
328 }
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:597
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define KSEVENTF_EVENT_HANDLE
Definition: ks.h:1808
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ Close()

MIXER_STATUS Close ( HANDLE  hDevice)

Definition at line 116 of file mmixer.c.

117 {
118  if (CloseHandle(hDevice))
119  return MM_STATUS_SUCCESS;
120  else
121  return MM_STATUS_UNSUCCESSFUL;
122 }
#define CloseHandle
Definition: compat.h:398

◆ CloseKey()

MIXER_STATUS CloseKey ( IN HANDLE  hKey)

Definition at line 102 of file mmixer.c.

104 {
105  RegCloseKey((HKEY)hKey);
106  return MM_STATUS_SUCCESS;
107 }
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423

◆ 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 158 of file mmixer.c.

166 {
167  OVERLAPPED Overlapped;
168  BOOLEAN IoResult;
169  DWORD Transferred = 0;
170 
171  /* Overlapped I/O is done here - this is used for waiting for completion */
172  ZeroMemory(&Overlapped, sizeof(OVERLAPPED));
173  Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
174 
175  if ( ! Overlapped.hEvent )
176  return MM_STATUS_NO_MEMORY;
177 
178  /* Talk to the device */
179  IoResult = DeviceIoControl(hMixer,
181  lpInBuffer,
182  nInBufferSize,
183  lpOutBuffer,
184  nOutBufferSize,
185  &Transferred,
186  &Overlapped);
187 
188  /* If failure occurs, make sure it's not just due to the overlapped I/O */
189  if ( ! IoResult )
190  {
191  if ( GetLastError() != ERROR_IO_PENDING )
192  {
193  CloseHandle(Overlapped.hEvent);
194 
196  {
197  if ( lpBytesReturned )
198  *lpBytesReturned = Transferred;
199  return MM_STATUS_MORE_ENTRIES;
200  }
201 
202  return MM_STATUS_UNSUCCESSFUL;
203  }
204  }
205 
206  /* Wait for the I/O to complete */
207  IoResult = GetOverlappedResult(hMixer,
208  &Overlapped,
209  &Transferred,
210  TRUE);
211 
212  /* Don't need this any more */
213  CloseHandle(Overlapped.hEvent);
214 
215  if ( ! IoResult )
216  return MM_STATUS_UNSUCCESSFUL;
217 
218  if ( lpBytesReturned )
219  *lpBytesReturned = Transferred;
220 
221  return MM_STATUS_SUCCESS;
222 }
#define CreateEvent
Definition: winbase.h:3562
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:204
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
#define ERROR_IO_PENDING
Definition: dderror.h:15
HMIXER hMixer
Definition: test.c:10
HANDLE hEvent
Definition: winbase.h:792
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 131 of file mmixer.c.

132 {
133  RtlMoveMemory(Src, Dst, NumBytes);
134 }
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#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 225 of file mmixer.c.

231 {
235  BOOL Result;
236  DWORD Length;
238 
239  //printf("Enum EnumContext %p DeviceIndex %lu OutHandle %p\n", EnumContext, DeviceIndex, OutHandle);
240 
241  InterfaceData.cbSize = sizeof(InterfaceData);
242  InterfaceData.Reserved = 0;
243 
244  Result = SetupDiEnumDeviceInterfaces(EnumContext,
245  NULL,
246  &CategoryGuid,
247  DeviceIndex,
248  &InterfaceData);
249 
250  if (!Result)
251  {
253  {
255  }
256  return MM_STATUS_UNSUCCESSFUL;
257  }
258 
261  0,
262  Length);
263  DetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
264  DeviceData.cbSize = sizeof(DeviceData);
265  DeviceData.Reserved = 0;
266 
268  &InterfaceData,
269  DetailData,
270  Length,
271  NULL,
272  &DeviceData);
273 
274  if (!Result)
275  {
276  DPRINT("SetupDiGetDeviceInterfaceDetailW failed with %lu\n", GetLastError());
277  return MM_STATUS_UNSUCCESSFUL;
278  }
279 
280 
281  *OutKey = SetupDiOpenDeviceInterfaceRegKey(EnumContext, &InterfaceData, 0, KEY_READ);
282  if ((HKEY)*OutKey == INVALID_HANDLE_VALUE)
283  {
284  HeapFree(GetProcessHeap(), 0, DetailData);
285  return MM_STATUS_UNSUCCESSFUL;
286  }
287 
288  Status = Open(DetailData->DevicePath, OutHandle);
289 
290  if (Status != MM_STATUS_SUCCESS)
291  {
292  RegCloseKey((HKEY)*OutKey);
293  HeapFree(GetProcessHeap(), 0, DetailData);
294  return Status;
295  }
296 
297  *DeviceName = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(DetailData->DevicePath)+1) * sizeof(WCHAR));
298  if (*DeviceName == NULL)
299  {
300  CloseHandle(*OutHandle);
301  RegCloseKey((HKEY)*OutKey);
302  HeapFree(GetProcessHeap(), 0, DetailData);
303  return MM_STATUS_NO_MEMORY;
304  }
305  wcscpy(*DeviceName, DetailData->DevicePath);
306  HeapFree(GetProcessHeap(), 0, DetailData);
307 
308  return Status;
309 }
#define CloseHandle
Definition: compat.h:398
WCHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:850
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#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:391
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:63
MIXER_STATUS Open(IN LPWSTR DevicePath, OUT PHANDLE hDevice)
Definition: mmixer.c:137
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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
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:359
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394

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 125 of file mmixer.c.

126 {
127  HeapFree(GetProcessHeap(), 0, Block);
128 }
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ FreeEventData()

VOID FreeEventData ( IN PVOID  EventData)

Definition at line 331 of file mmixer.c.

332 {
333  PKSEVENTDATA Data = (PKSEVENTDATA)EventData;
334 
335  CloseHandle(Data->EventHandle.Event);
337 }
#define CloseHandle
Definition: compat.h:398
struct KSEVENTDATA * PKSEVENTDATA
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ IoStreamingThread()

DWORD WINAPI IoStreamingThread ( LPVOID  lpParameter)

Definition at line 790 of file mmixer.c.

792 {
793  DWORD Length;
794  //MMRESULT Result;
796 
797  /*Result = */ SyncOverlappedDeviceIoControl(Packet->hDevice,
798  Packet->IoCtl,
799  NULL,
800  0,
801  &Packet->Header,
802  sizeof(KSSTREAM_HEADER),
803  &Length);
804 
805  Packet->CompletionRoutine(ERROR_SUCCESS, Packet->Header.DataUsed, (LPOVERLAPPED)Packet->Overlap);
806 
808  return 0;
809 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
struct IO_PACKET * LPIO_PACKET
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LPVOID lpParameter
Definition: kernel32.h:234
DWORD SyncOverlappedDeviceIoControl(IN HANDLE Handle, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, OUT LPVOID OutBuffer, IN DWORD OutBufferSize, OUT LPDWORD BytesTransferred OPTIONAL)
Definition: misc.c:301
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by WdmAudCommitWaveBufferByMMixer().

◆ MixerEventCallback()

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

Definition at line 677 of file mmixer.c.

682 {
684 
685  DriverCallback(Instance->WinMM.ClientCallback,
686  HIWORD(Instance->WinMM.Flags),
687  Instance->WinMM.Handle,
688  NotificationType,
689  Instance->WinMM.ClientCallbackInstanceData,
690  (DWORD_PTR)Value,
691  0);
692 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
struct _SOUND_DEVICE_INSTANCE * PSOUND_DEVICE_INSTANCE
uint32_t DWORD_PTR
Definition: typedefs.h:63
IN PVOID Instance
Definition: pci.h:359
#define HIWORD(l)
Definition: typedefs.h:246
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 137 of file mmixer.c.

140 {
141  DevicePath[1] = L'\\';
142  *hDevice = CreateFileW(DevicePath,
144  0,
145  NULL,
148  NULL);
149  if (*hDevice == INVALID_HANDLE_VALUE)
150  {
151  return MM_STATUS_UNSUCCESSFUL;
152  }
153 
154  return MM_STATUS_SUCCESS;
155 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
static const WCHAR L[]
Definition: oid.c:1250
#define GENERIC_READ
Definition: compat.h:124
#define CreateFileW
Definition: compat.h:400
#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 89 of file mmixer.c.

94 {
95  if (RegOpenKeyExW((HKEY)hKey, SubKey, 0, DesiredAccess, (PHKEY)OutKey) == ERROR_SUCCESS)
96  return MM_STATUS_SUCCESS;
97 
99 }
#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:4157
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381

◆ QueryKeyValue()

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

Definition at line 66 of file mmixer.c.

72 {
75 
77  if (*ResultBuffer == NULL)
78  return MM_STATUS_NO_MEMORY;
79 
81  {
84  }
85  return MM_STATUS_SUCCESS;
86 }
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:395
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:4134
PKMT_RESULTBUFFER ResultBuffer
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ WdmAudCleanupByMMixer()

MMRESULT WdmAudCleanupByMMixer ( )

Definition at line 387 of file mmixer.c.

388 {
389  /* TODO */
390  return MMSYSERR_NOERROR;
391 }
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96

◆ WdmAudCloseSoundDeviceByMMixer()

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

Definition at line 562 of file mmixer.c.

565 {
567  PSOUND_DEVICE SoundDevice;
569 
570  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
571 
572  if ( ! MMSUCCESS(Result) )
573  {
575  }
576 
577  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
579 
581  {
582  /* no op */
583  return MMSYSERR_NOERROR;
584  }
586  {
587  /* make sure the pin is stopped */
588  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
589  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
590  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_STOP);
591 
593  return MMSYSERR_NOERROR;
594  }
595 
596  /* midi is not supported */
597  return MMSYSERR_ERROR;
598 }
#define CloseHandle
Definition: compat.h:398
#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:46
#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 812 of file mmixer.c.

818 {
819  PSOUND_DEVICE SoundDevice;
823  HANDLE hThread;
824 
825  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
826 
827  if ( ! MMSUCCESS(Result) )
828  {
830  }
831 
832  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
834 
836  if ( ! Packet )
837  {
838  /* no memory */
839  return MMSYSERR_NOMEM;
840  }
841 
842  /* setup stream packet */
843  Packet->Header.Size = sizeof(KSSTREAM_HEADER);
844  Packet->Header.PresentationTime.Numerator = 1;
845  Packet->Header.PresentationTime.Denominator = 1;
846  Packet->Header.Data = OffsetPtr;
847  Packet->Header.FrameExtent = Length;
848  Packet->hDevice = SoundDeviceInstance->Handle;
849  Packet->Overlap = Overlap;
850  Packet->CompletionRoutine = CompletionRoutine;
852 
854  {
855  Packet->Header.DataUsed = Length;
856  }
857 
859  if (hThread == NULL)
860  {
861  /* error */
862  return MMSYSERR_ERROR;
863  }
864 
866 
867  return MMSYSERR_NOERROR;
868 }
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:157
#define CloseHandle
Definition: compat.h:398
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
DWORD WINAPI IoStreamingThread(LPVOID lpParameter)
Definition: mmixer.c:790
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
#define IOCTL_KS_READ_STREAM
Definition: ks.h:164
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 MMSYSERR_NOMEM
Definition: mmsystem.h:103
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:111
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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HANDLE hThread
Definition: wizard.c:27
_In_ PIRP _In_opt_ PVOID _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
Definition: fsrtlfuncs.h:673
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 519 of file mmixer.c.

524 {
527 
528  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
530 
532  {
534  }
535  else if (DeviceType == WAVE_OUT_DEVICE_TYPE)
536  {
538  }
539  else if (DeviceType == WAVE_IN_DEVICE_TYPE)
540  {
542  }
543  else
544  {
545  // not supported
546  return MMSYSERR_ERROR;
547  }
548 }
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:394
#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:470
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
MMRESULT WdmAudGetWaveOutCapabilities(IN ULONG DeviceId, LPWAVEOUTCAPSW Capabilities)
Definition: mmixer.c:458

◆ WdmAudGetControlDetails()

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

Definition at line 445 of file mmixer.c.

450 {
451  if (MMixerGetControlDetails(&MixerContext, hMixer, MixerId, Flags, MixDetails) == MM_STATUS_SUCCESS)
452  return MMSYSERR_NOERROR;
453 
454  return MMSYSERR_ERROR;
455 }
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:46
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 664 of file mmixer.c.

670 {
671  /* FIXME */
672  return MMSYSERR_NOTSUPPORTED;
673 }
#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 418 of file mmixer.c.

423 {
424  if (MMixerGetLineControls(&MixerContext, hMixer, MixerId, Flags, MixControls) == MM_STATUS_SUCCESS)
425  return MMSYSERR_NOERROR;
426 
427  return MMSYSERR_ERROR;
428 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
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 405 of file mmixer.c.

410 {
411  if (MMixerGetLineInfo(&MixerContext, hMixer, MixerId, Flags, MixLine) == MM_STATUS_SUCCESS)
412  return MMSYSERR_NOERROR;
413 
414  return MMSYSERR_ERROR;
415 }
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:46
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 394 of file mmixer.c.

397 {
399  return MMSYSERR_NOERROR;
400 
401  return MMSYSERR_BADDEVICEID;
402 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
_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 601 of file mmixer.c.

604 {
605  switch(DeviceType)
606  {
607  case MIXER_DEVICE_TYPE:
609  break;
612  break;
613  case WAVE_IN_DEVICE_TYPE:
615  break;
616  default:
617  *DeviceCount = 0;
618  }
619  return MMSYSERR_NOERROR;
620 }
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:46
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 470 of file mmixer.c.

473 {
475  return MMSYSERR_NOERROR;
476 
477  return MMSYSERR_ERROR;
478 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
_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 458 of file mmixer.c.

461 {
463  return MMSYSERR_NOERROR;
464 
465  return MMSYSERR_ERROR;
466 
467 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
_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 780 of file mmixer.c.

783 {
784  /* FIXME */
785  return MMSYSERR_NOTSUPPORTED;
786 }
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104

◆ WdmAudInitUserModeMixer()

BOOL WdmAudInitUserModeMixer ( )

Definition at line 341 of file mmixer.c.

342 {
345 
347  {
348  /* library is already initialized */
349  return TRUE;
350  }
351 
352 
353  /* create a device list */
355  NULL,
356  NULL,
357  DIGCF_DEVICEINTERFACE/* FIXME |DIGCF_PRESENT*/);
358 
360  {
361  /* failed to create a device list */
362  return FALSE;
363  }
364 
365 
366  /* initialize the mixer library */
368 
369  /* free device list */
371 
372  if (Status != MM_STATUS_SUCCESS)
373  {
374  /* failed to initialize mixer library */
375  DPRINT1("Failed to initialize mixer library with %x\n", Status);
376  return FALSE;
377  }
378 
379  /* library is now initialized */
381 
382  /* completed successfully */
383  return TRUE;
384 }
#define TRUE
Definition: types.h:120
_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 INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL MMixerLibraryInitialized
Definition: mmixer.c:29
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
smooth NULL
Definition: ftsmooth.c:416
GUID CategoryGuid
Definition: mmixer.c:63
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define SetupDiGetClassDevs
Definition: setupapi.h:2587
MIXER_STATUS Enum(IN PVOID EnumContext, IN ULONG DeviceIndex, OUT LPWSTR *DeviceName, OUT PHANDLE OutHandle, OUT PHANDLE OutKey)
Definition: mmixer.c:225
Status
Definition: gdiplustypes.h:24
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 551 of file mmixer.c.

554 {
556  return MMSYSERR_NOERROR;
557  else
558  return MMSYSERR_ERROR;
559 }
BOOL WdmAudInitUserModeMixer()
Definition: mmixer.c:341
#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 623 of file mmixer.c.

629 {
630  LPMIXERLINEW MixLine;
631  LPMIXERLINECONTROLSW MixControls;
632  LPMIXERCONTROLDETAILS MixDetails;
633  HANDLE hMixer = NULL;
634 
635  MixLine = (LPMIXERLINEW)Parameter;
636  MixControls = (LPMIXERLINECONTROLSW)Parameter;
637  MixDetails = (LPMIXERCONTROLDETAILS)Parameter;
638 
639  /* FIXME param checks */
640 
641  if (SoundDeviceInstance)
642  {
643  hMixer = SoundDeviceInstance->Handle;
644  }
645 
646  switch(uMsg)
647  {
648  case MXDM_GETLINEINFO:
649  return WdmAudGetLineInfo(hMixer, MixerId, MixLine, Flags);
651  return WdmAudGetLineControls(hMixer, MixerId, MixControls, Flags);
653  return WdmAudSetControlDetails(hMixer, MixerId, MixDetails, Flags);
655  return WdmAudGetControlDetails(hMixer, MixerId, MixDetails, Flags);
656  default:
657  DPRINT1("MixerId %lu, uMsg %lu, Parameter %p, Flags %lu\n", MixerId, uMsg, Parameter, Flags);
658  SND_ASSERT(0);
659  return MMSYSERR_NOTSUPPORTED;
660  }
661 }
MMRESULT WdmAudGetLineInfo(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERLINEW MixLine, IN ULONG Flags)
Definition: mmixer.c:405
struct tMIXERCONTROLDETAILS * LPMIXERCONTROLDETAILS
_In_ PVOID Parameter
Definition: ldrtypes.h:240
_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:431
HMIXER hMixer
Definition: test.c:10
MMRESULT WdmAudGetControlDetails(IN HANDLE hMixer, IN DWORD MixerId, IN LPMIXERCONTROLDETAILS MixDetails, IN ULONG Flags)
Definition: mmixer.c:445
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:418
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 758 of file mmixer.c.

762 {
764 
766  {
767  Status = MMixerSetWaveResetState(&MixerContext, SoundDeviceInstance->Handle, bStartReset);
768  if (Status == MM_STATUS_SUCCESS)
769  {
770  /* completed successfully */
771  return MMSYSERR_NOERROR;
772  }
773  }
774 
775 
776  return MMSYSERR_NOTSUPPORTED;
777 }
DeviceType
Definition: mmdrv.h:41
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
#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 431 of file mmixer.c.

436 {
437  if (MMixerSetControlDetails(&MixerContext, hMixer, MixerId, Flags, MixDetails) == MM_STATUS_SUCCESS)
438  return MMSYSERR_NOERROR;
439 
440  return MMSYSERR_ERROR;
441 
442 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
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 695 of file mmixer.c.

700 {
702  return MMSYSERR_NOERROR;
703 
704  return MMSYSERR_BADDEVICEID;
705 }
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
#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:677
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
IN PVOID Instance
Definition: pci.h:359
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 481 of file mmixer.c.

486 {
488  PSOUND_DEVICE SoundDevice;
490  BOOL bWaveIn;
491 
492  Result = GetSoundDeviceFromInstance(Instance, &SoundDevice);
493 
494  if ( ! MMSUCCESS(Result) )
495  {
497  }
498 
499  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
501 
502  bWaveIn = (DeviceType == WAVE_IN_DEVICE_TYPE ? TRUE : FALSE);
503 
504  if (MMixerOpenWave(&MixerContext, DeviceId, bWaveIn, WaveFormat, NULL, NULL, &Instance->Handle) == MM_STATUS_SUCCESS)
505  {
507  {
511  }
512  return MMSYSERR_NOERROR;
513  }
514  return MMSYSERR_ERROR;
515 }
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
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
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:359
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 708 of file mmixer.c.

711 {
713  PSOUND_DEVICE SoundDevice;
715 
716  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
718 
719 
720  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
722 
724  {
725  if (bStart)
726  {
727  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
728  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
729  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_RUN);
730  }
731  else
732  {
733  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
734  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
735  MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_STOP);
736  }
737  }
739  {
740  if (bStart)
741  {
742  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
743  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
744  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_RUN);
745  }
746  else
747  {
748  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_PAUSE);
749  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_ACQUIRE);
750  MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle, KSSTATE_STOP);
751  }
752  }
753 
754  return MMSYSERR_NOERROR;
755 }
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
MaybeUInt64 bStart[BZ_MAX_HANDLED_BLOCKS]
Definition: bzip2recover.c:296
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
#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 63 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:158
MIXER_STATUS QueryKeyValue(IN HANDLE hKey, IN LPWSTR KeyName, OUT PVOID *ResultBuffer, OUT PULONG ResultLength, OUT PULONG KeyType)
Definition: mmixer.c:66
PVOID AllocEventData(IN ULONG ExtraSize)
Definition: mmixer.c:312
MIXER_STATUS Close(HANDLE hDevice)
Definition: mmixer.c:116
PVOID Alloc(ULONG NumBytes)
Definition: mmixer.c:110
VOID FreeEventData(IN PVOID EventData)
Definition: mmixer.c:331
smooth NULL
Definition: ftsmooth.c:416
MIXER_STATUS Open(IN LPWSTR DevicePath, OUT PHANDLE hDevice)
Definition: mmixer.c:137
VOID Free(PVOID Block)
Definition: mmixer.c:125
MIXER_STATUS CloseKey(IN HANDLE hKey)
Definition: mmixer.c:102
MIXER_STATUS OpenKey(IN HANDLE hKey, IN LPWSTR SubKey, IN ULONG DesiredAccess, OUT PHANDLE OutKey)
Definition: mmixer.c:89
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:131

Definition at line 46 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 29 of file mmixer.c.

Referenced by WdmAudInitUserModeMixer().