ReactOS  0.4.15-dev-1049-g1062a29
wdmaud.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#include <mmddk.h>
#include <mmebuddy.h>
#include <ks.h>
#include <ksmedia.h>
#include <interface.h>
#include <devioctl.h>
#include <setupapi.h>
Include dependency graph for wdmaud.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 

Functions

BOOL WdmAudInitUserModeMixer (VOID)
 
ULONG WdmAudGetWaveOutCount (VOID)
 
ULONG WdmAudGetWaveInCount (VOID)
 
ULONG WdmAudGetMixerCount (VOID)
 
MMRESULT WdmAudGetNumWdmDevsByMMixer (IN MMDEVICE_TYPE DeviceType, OUT DWORD *DeviceCount)
 
MMRESULT WdmAudCommitWaveBufferByLegacy (IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
 
MMRESULT WriteFileEx_Remixer (IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
 
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 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 WdmAudSetWaveDeviceFormatByMMixer (IN PSOUND_DEVICE_INSTANCE Instance, IN DWORD DeviceId, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
 
MMRESULT WdmAudGetDeviceInterfaceStringByMMixer (IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN LPWSTR Interface, IN DWORD InterfaceLength, OUT DWORD *InterfaceSize)
 
MMRESULT WdmAudSetMixerDeviceFormatByMMixer (IN PSOUND_DEVICE_INSTANCE Instance, IN DWORD DeviceId, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
 
MMRESULT WdmAudQueryMixerInfoByMMixer (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN DWORD DeviceId, IN UINT uMsg, IN LPVOID Parameter, IN DWORD Flags)
 
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)
 
MMRESULT WdmAudCommitWaveBufferByMMixer (IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
 
MMRESULT WdmAudCleanupByMMixer (VOID)
 
MMRESULT WdmAudCleanupByLegacy (VOID)
 
MMRESULT WdmAudGetCapabilitiesByLegacy (IN PSOUND_DEVICE SoundDevice, IN DWORD DeviceId, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
 
MMRESULT WdmAudOpenSoundDeviceByLegacy (IN PSOUND_DEVICE SoundDevice, OUT PVOID *Handle)
 
MMRESULT WdmAudCloseSoundDeviceByLegacy (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN PVOID Handle)
 
MMRESULT WdmAudGetDeviceInterfaceStringByLegacy (IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN LPWSTR Interface, IN DWORD InterfaceLength, OUT DWORD *InterfaceSize)
 
MMRESULT WdmAudSetMixerDeviceFormatByLegacy (IN PSOUND_DEVICE_INSTANCE Instance, IN DWORD DeviceId, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
 
MMRESULT WdmAudQueryMixerInfoByLegacy (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN DWORD DeviceId, IN UINT uMsg, IN LPVOID Parameter, IN DWORD Flags)
 
MMRESULT WdmAudSetWaveDeviceFormatByLegacy (IN PSOUND_DEVICE_INSTANCE Instance, IN DWORD DeviceId, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
 
MMRESULT WdmAudSetWaveStateByLegacy (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN BOOL bStart)
 
MMRESULT WdmAudResetStreamByLegacy (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN MMDEVICE_TYPE DeviceType, IN BOOLEAN bStartReset)
 
MMRESULT WdmAudGetWavePositionByLegacy (IN struct _SOUND_DEVICE_INSTANCE *SoundDeviceInstance, IN MMTIME *Time)
 
MMRESULT WriteFileEx_Committer2 (IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
 
MMRESULT WdmAudGetNumWdmDevsByLegacy (IN MMDEVICE_TYPE DeviceType, OUT DWORD *DeviceCount)
 
DWORD WINAPI MixerEventThreadRoutine (LPVOID Parameter)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 7 of file wdmaud.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 8 of file wdmaud.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 6 of file wdmaud.h.

Function Documentation

◆ MixerEventThreadRoutine()

DWORD WINAPI MixerEventThreadRoutine ( LPVOID  Parameter)

Definition at line 29 of file legacy.c.

31 {
32  HANDLE WaitObjects[2];
33  DWORD dwResult;
37 
38  /* setup wait objects */
39  WaitObjects[0] = Instance->hNotifyEvent;
40  WaitObjects[1] = Instance->hStopEvent;
41 
42  /* zero device info */
44 
45  DeviceInfo.hDevice = Instance->Handle;
46  DeviceInfo.DeviceType = MIXER_DEVICE_TYPE;
47 
48  do
49  {
50  dwResult = WaitForMultipleObjects(2, WaitObjects, FALSE, INFINITE);
51 
52  if (dwResult == WAIT_OBJECT_0 + 1)
53  {
54  /* stop event was signalled */
55  break;
56  }
57 
58  do
59  {
62  (LPVOID) &DeviceInfo,
63  sizeof(WDMAUD_DEVICE_INFO),
64  (LPVOID) &DeviceInfo,
65  sizeof(WDMAUD_DEVICE_INFO),
66  NULL);
67 
68  if (Result == MMSYSERR_NOERROR)
69  {
70  DriverCallback(Instance->WinMM.ClientCallback,
71  HIWORD(Instance->WinMM.Flags),
72  Instance->WinMM.Handle,
73  DeviceInfo.u.MixerEvent.NotificationType,
74  Instance->WinMM.ClientCallbackInstanceData,
75  (DWORD_PTR)DeviceInfo.u.MixerEvent.Value,
76  0);
77  }
78  }while(Result == MMSYSERR_NOERROR);
79  }while(TRUE);
80 
81  /* done */
82  return 0;
83 }
HANDLE KernelHandle
Definition: legacy.c:24
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
_In_ PVOID Parameter
Definition: ldrtypes.h:241
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
struct _SOUND_DEVICE_INSTANCE * PSOUND_DEVICE_INSTANCE
#define FALSE
Definition: types.h:117
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
#define WAIT_OBJECT_0
Definition: winbase.h:387
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
unsigned long DWORD
Definition: ntddk_ex.h:95
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:298
uint32_t DWORD_PTR
Definition: typedefs.h:65
IN PVOID Instance
Definition: pci.h:361
#define HIWORD(l)
Definition: typedefs.h:247
#define IOCTL_GET_MIXER_EVENT
Definition: interface.h:359
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
#define INFINITE
Definition: serial.h:102

Referenced by WdmAudSetMixerDeviceFormatByLegacy().

◆ WdmAudCleanupByLegacy()

MMRESULT WdmAudCleanupByLegacy ( VOID  )

◆ WdmAudCleanupByMMixer()

MMRESULT WdmAudCleanupByMMixer ( VOID  )

◆ WdmAudCloseSoundDeviceByLegacy()

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

Definition at line 320 of file legacy.c.

323 {
327  PSOUND_DEVICE SoundDevice;
328 
329  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
330 
331  if ( ! MMSUCCESS(Result) )
332  {
334  }
335 
336  if ( OpenCount == 0 )
337  {
338  return MMSYSERR_NOERROR;
339  }
340 
342 
343  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
345 
346  if (SoundDeviceInstance->Handle != (PVOID)KernelHandle)
347  {
349 
350  DeviceInfo.DeviceType = DeviceType;
351  DeviceInfo.hDevice = SoundDeviceInstance->Handle;
352 
353  /* First stop the stream */
355  {
356  DeviceInfo.u.State = KSSTATE_PAUSE;
359  (LPVOID) &DeviceInfo,
360  sizeof(WDMAUD_DEVICE_INFO),
361  (LPVOID) &DeviceInfo,
362  sizeof(WDMAUD_DEVICE_INFO),
363  NULL);
364 
365  DeviceInfo.u.State = KSSTATE_ACQUIRE;
368  (LPVOID) &DeviceInfo,
369  sizeof(WDMAUD_DEVICE_INFO),
370  (LPVOID) &DeviceInfo,
371  sizeof(WDMAUD_DEVICE_INFO),
372  NULL);
373 
374 
375  DeviceInfo.u.State = KSSTATE_STOP;
378  (LPVOID) &DeviceInfo,
379  sizeof(WDMAUD_DEVICE_INFO),
380  (LPVOID) &DeviceInfo,
381  sizeof(WDMAUD_DEVICE_INFO),
382  NULL);
383  }
384 
387  (LPVOID) &DeviceInfo,
388  sizeof(WDMAUD_DEVICE_INFO),
389  (LPVOID) &DeviceInfo,
390  sizeof(WDMAUD_DEVICE_INFO),
391  NULL);
392  }
393 
395  {
396  SetEvent(SoundDeviceInstance->hStopEvent);
397  CloseHandle(SoundDeviceInstance->hStopEvent);
398  CloseHandle(SoundDeviceInstance->hNotifyEvent);
399  }
400 
401  --OpenCount;
402 
403  if ( OpenCount < 1 )
404  {
407  }
408 
409  return MMSYSERR_NOERROR;
410 }
#define IOCTL_SETDEVICE_STATE
Definition: interface.h:134
#define CloseHandle
Definition: compat.h:487
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
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
struct _DeviceInfo DeviceInfo
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:298
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
DWORD OpenCount
Definition: legacy.c:25
#define IOCTL_CLOSE_WDMAUD
Definition: interface.h:99
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)

◆ 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)

◆ WdmAudCommitWaveBufferByLegacy()

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

Definition at line 615 of file legacy.c.

621 {
622  HANDLE Handle;
625  PSOUND_DEVICE SoundDevice;
627  BOOL Ret;
628 
629  VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance );
630  VALIDATE_MMSYS_PARAMETER( OffsetPtr );
631  VALIDATE_MMSYS_PARAMETER( Overlap );
633 
634  GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
636 
637  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
638 
639  if ( ! MMSUCCESS(Result) )
640  {
642  }
643 
644  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
646 
648  if (!DeviceInfo)
649  {
650  // no memory
651  return MMSYSERR_NOMEM;
652  }
653 
654  DeviceInfo->Header.FrameExtent = Length;
656  {
657  DeviceInfo->Header.DataUsed = Length;
658  }
659  DeviceInfo->Header.Data = OffsetPtr;
660  DeviceInfo->Header.Size = sizeof(WDMAUD_DEVICE_INFO);
661  DeviceInfo->Header.PresentationTime.Numerator = 1;
662  DeviceInfo->Header.PresentationTime.Denominator = 1;
663  DeviceInfo->hDevice = Handle;
664  DeviceInfo->DeviceType = DeviceType;
665 
666 
667  // create completion event
668  Overlap->Standard.hEvent = Handle = CreateEventW(NULL, FALSE, FALSE, NULL);
669  if (Overlap->Standard.hEvent == NULL)
670  {
671  // no memory
673  return MMSYSERR_NOMEM;
674  }
675 
676  Overlap->OriginalCompletionRoutine = CompletionRoutine;
677  Overlap->CompletionContext = (PVOID)DeviceInfo;
678 
680  {
682  if (Ret)
684  }
685  else if (DeviceType == WAVE_IN_DEVICE_TYPE)
686  {
688  if (Ret)
690  }
691 
692  // close event handle
694 
695  return MMSYSERR_NOERROR;
696 }
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
#define CloseHandle
Definition: compat.h:487
HANDLE KernelHandle
Definition: legacy.c:24
#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
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
BOOL WINAPI ReadFileEx(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead OPTIONAL, IN LPOVERLAPPED lpOverlapped, IN LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
Definition: rw.c:299
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID CALLBACK LegacyCompletionRoutine(IN DWORD dwErrorCode, IN DWORD dwNumberOfBytesTransferred, IN LPOVERLAPPED lpOverlapped)
Definition: legacy.c:597
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
WCHAR Data[ANYSIZE_ARRAY]
void * PVOID
Definition: retypes.h:9
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct _DeviceInfo DeviceInfo
_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
struct WDMAUD_DEVICE_INFO * PWDMAUD_DEVICE_INFO
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_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)
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)
#define INFINITE
Definition: serial.h:102
BOOL WINAPI WriteFileEx(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, IN LPOVERLAPPED lpOverlapped, IN LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
Definition: rw.c:262
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ 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)

◆ WdmAudGetCapabilitiesByLegacy()

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

Definition at line 133 of file legacy.c.

138 {
142 
143  SND_ASSERT( SoundDevice );
145 
146  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
148 
149  if ( ! MMSUCCESS(Result) )
150  return Result;
151 
152  SND_TRACE(L"WDMAUD - GetWdmDeviceCapabilities DeviceType %u DeviceId %u\n", DeviceType, DeviceId);
153 
155  DeviceInfo.DeviceType = DeviceType;
156  DeviceInfo.DeviceIndex = DeviceId;
157 
160  (LPVOID) &DeviceInfo,
161  sizeof(WDMAUD_DEVICE_INFO),
162  (LPVOID) &DeviceInfo,
163  sizeof(WDMAUD_DEVICE_INFO),
164  NULL);
165 
166  if ( ! MMSUCCESS(Result) )
167  {
169  }
170 
171  /* This is pretty much a big hack right now */
172  switch ( DeviceType )
173  {
174  case MIXER_DEVICE_TYPE:
175  {
176  LPMIXERCAPSW MixerCaps = (LPMIXERCAPSW) Capabilities;
177 
178  DeviceInfo.u.MixCaps.szPname[MAXPNAMELEN-1] = L'\0';
179  CopyWideString(MixerCaps->szPname, DeviceInfo.u.MixCaps.szPname);
180 
181  MixerCaps->cDestinations = DeviceInfo.u.MixCaps.cDestinations;
182  MixerCaps->fdwSupport = DeviceInfo.u.MixCaps.fdwSupport;
183  MixerCaps->vDriverVersion = DeviceInfo.u.MixCaps.vDriverVersion;
184  MixerCaps->wMid = DeviceInfo.u.MixCaps.wMid;
185  MixerCaps->wPid = DeviceInfo.u.MixCaps.wPid;
186  break;
187  }
188  case WAVE_OUT_DEVICE_TYPE :
189  {
191 
192  DeviceInfo.u.WaveOutCaps.szPname[MAXPNAMELEN-1] = L'\0';
193  WaveOutCaps->wMid = DeviceInfo.u.WaveOutCaps.wMid;
194  WaveOutCaps->wPid = DeviceInfo.u.WaveOutCaps.wPid;
195 
196  WaveOutCaps->vDriverVersion = DeviceInfo.u.WaveOutCaps.vDriverVersion;
197  CopyWideString(WaveOutCaps->szPname, DeviceInfo.u.WaveOutCaps.szPname);
198 
199  WaveOutCaps->dwFormats = DeviceInfo.u.WaveOutCaps.dwFormats;
200  WaveOutCaps->wChannels = DeviceInfo.u.WaveOutCaps.wChannels;
201  WaveOutCaps->dwSupport = DeviceInfo.u.WaveOutCaps.dwSupport;
202  break;
203  }
204  case WAVE_IN_DEVICE_TYPE :
205  {
207 
208  DeviceInfo.u.WaveInCaps.szPname[MAXPNAMELEN-1] = L'\0';
209 
210  WaveInCaps->wMid = DeviceInfo.u.WaveInCaps.wMid;
211  WaveInCaps->wPid = DeviceInfo.u.WaveInCaps.wPid;
212 
213  WaveInCaps->vDriverVersion = DeviceInfo.u.WaveInCaps.vDriverVersion;
214  CopyWideString(WaveInCaps->szPname, DeviceInfo.u.WaveInCaps.szPname);
215 
216  WaveInCaps->dwFormats = DeviceInfo.u.WaveInCaps.dwFormats;
217  WaveInCaps->wChannels = DeviceInfo.u.WaveInCaps.wChannels;
218  WaveInCaps->wReserved1 = 0;
219  break;
220  }
221  case MIDI_IN_DEVICE_TYPE :
222  {
224 
225  DeviceInfo.u.MidiInCaps.szPname[MAXPNAMELEN-1] = L'\0';
226 
227  MidiInCaps->vDriverVersion = DeviceInfo.u.MidiInCaps.vDriverVersion;
228  MidiInCaps->wMid = DeviceInfo.u.MidiInCaps.wMid;
229  MidiInCaps->wPid = DeviceInfo.u.MidiInCaps.wPid;
230  MidiInCaps->dwSupport = DeviceInfo.u.MidiInCaps.dwSupport;
231 
232  CopyWideString(MidiInCaps->szPname, DeviceInfo.u.MidiInCaps.szPname);
233  break;
234  }
235  case MIDI_OUT_DEVICE_TYPE :
236  {
238 
239  DeviceInfo.u.MidiOutCaps.szPname[MAXPNAMELEN-1] = L'\0';
240 
241  MidiOutCaps->vDriverVersion = DeviceInfo.u.MidiOutCaps.vDriverVersion;
242  MidiOutCaps->wMid = DeviceInfo.u.MidiOutCaps.wMid;
243  MidiOutCaps->wPid = DeviceInfo.u.MidiOutCaps.wPid;
244  MidiOutCaps->dwSupport = DeviceInfo.u.MidiOutCaps.dwSupport;
245 
246  CopyWideString(MidiOutCaps->szPname, DeviceInfo.u.MidiOutCaps.szPname);
247  break;
248  }
249  }
250 
251  return MMSYSERR_NOERROR;
252 }
struct tagWAVEINCAPSW * LPWAVEINCAPSW
DWORD fdwSupport
Definition: mmsystem.h:1227
#define IOCTL_GETCAPABILITIES
Definition: interface.h:204
MMVERSION vDriverVersion
Definition: mmsystem.h:1145
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1060
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
struct tagMIXERCAPSW * LPMIXERCAPSW
DWORD cDestinations
Definition: mmsystem.h:1228
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
#define CopyWideString(dest, source)
Definition: mmebuddy.h:39
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1146
MMVERSION vDriverVersion
Definition: mmsystem.h:1125
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
MMVERSION vDriverVersion
Definition: mmsystem.h:1059
DWORD dwFormats
Definition: mmsystem.h:1061
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
struct tagMIDIINCAPSW * LPMIDIINCAPSW
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1126
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct tagWAVEOUTCAPSW * LPWAVEOUTCAPSW
struct _DeviceInfo DeviceInfo
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1039
MMVERSION vDriverVersion
Definition: mmsystem.h:1225
static const WCHAR L[]
Definition: oid.c:1250
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:298
MMVERSION vDriverVersion
Definition: mmsystem.h:1038
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
DWORD dwSupport
Definition: mmsystem.h:1147
#define MAXPNAMELEN
Definition: mmsystem.h:24
struct tagMIDIOUTCAPSW * LPMIDIOUTCAPSW
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1226
#define SND_TRACE(...)

◆ 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().

◆ WdmAudGetDeviceInterfaceStringByLegacy()

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

Definition at line 742 of file legacy.c.

748 {
751 
753  DeviceInfo.DeviceType = DeviceType;
754  DeviceInfo.DeviceIndex = DeviceId;
755 
756 
759  (LPVOID) &DeviceInfo,
760  sizeof(WDMAUD_DEVICE_INFO),
761  (LPVOID) &DeviceInfo,
762  sizeof(WDMAUD_DEVICE_INFO),
763  NULL);
764 
765 
766  if ( ! MMSUCCESS(Result) )
767  {
769  }
770 
771 
772  if (!Interface)
773  {
774  SND_ASSERT(InterfaceSize);
775 
776  *InterfaceSize = DeviceInfo.u.Interface.DeviceInterfaceStringSize;
777  return MMSYSERR_NOERROR;
778  }
779 
780  if (InterfaceLength < DeviceInfo.u.Interface.DeviceInterfaceStringSize)
781  {
782  /* buffer is too small */
783  return MMSYSERR_MOREDATA;
784  }
785 
786  DeviceInfo.u.Interface.DeviceInterfaceStringSize = InterfaceLength;
787  DeviceInfo.u.Interface.DeviceInterfaceString = Interface;
788 
791  (LPVOID) &DeviceInfo,
792  sizeof(WDMAUD_DEVICE_INFO),
793  (LPVOID) &DeviceInfo,
794  sizeof(WDMAUD_DEVICE_INFO),
795  NULL);
796 
797  if ( MMSUCCESS(Result) && InterfaceLength > 2)
798  {
799  Interface[1] = L'\\';
800  Interface[InterfaceLength-1] = L'\0';
801  }
802 
803  return Result;
804 }
#define IOCTL_QUERYDEVICEINTERFACESTRING
Definition: interface.h:343
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
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
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
static const WCHAR L[]
Definition: oid.c:1250
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:298
#define MMSYSERR_MOREDATA
Definition: mmsystem.h:117

◆ 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().

◆ WdmAudGetMixerCount()

ULONG WdmAudGetMixerCount ( VOID  )

◆ WdmAudGetNumWdmDevsByLegacy()

MMRESULT WdmAudGetNumWdmDevsByLegacy ( IN MMDEVICE_TYPE  DeviceType,
OUT DWORD DeviceCount 
)

Definition at line 98 of file legacy.c.

101 {
104 
108 
110  DeviceInfo.DeviceType = DeviceType;
111 
114  (LPVOID) &DeviceInfo,
115  sizeof(WDMAUD_DEVICE_INFO),
116  (LPVOID) &DeviceInfo,
117  sizeof(WDMAUD_DEVICE_INFO),
118  NULL);
119 
120  if ( ! MMSUCCESS( Result ) )
121  {
122  SND_ERR(L"Call to IOCTL_GETNUMDEVS_TYPE failed\n");
123  *DeviceCount = 0;
125  }
126 
127  *DeviceCount = DeviceInfo.DeviceCount;
128 
129  return MMSYSERR_NOERROR;
130 }
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
ULONG DeviceCount
Definition: mpu401.c:26
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
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define SND_ERR(...)
#define IOCTL_GETNUMDEVS_TYPE
Definition: interface.h:117
struct _DeviceInfo DeviceInfo
static const WCHAR L[]
Definition: oid.c:1250
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:298
#define IS_VALID_SOUND_DEVICE_TYPE(x)
Definition: sndtypes.h:43

◆ 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

◆ WdmAudGetWaveInCount()

ULONG WdmAudGetWaveInCount ( VOID  )

◆ WdmAudGetWaveOutCount()

ULONG WdmAudGetWaveOutCount ( VOID  )

◆ WdmAudGetWavePositionByLegacy()

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

Definition at line 807 of file legacy.c.

810 {
812  PSOUND_DEVICE SoundDevice;
815  HANDLE Handle;
816 
817  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
818 
819  if ( ! MMSUCCESS(Result) )
820  {
822  }
823 
824  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
826 
827  Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
829 
831  DeviceInfo.hDevice = Handle;
832  DeviceInfo.DeviceType = DeviceType;
833 
836  (LPVOID) &DeviceInfo,
837  sizeof(WDMAUD_DEVICE_INFO),
838  (LPVOID) &DeviceInfo,
839  sizeof(WDMAUD_DEVICE_INFO),
840  NULL);
841 
842  if ( ! MMSUCCESS(Result) )
843  {
845  }
846 
847  Time->wType = TIME_BYTES;
848  Time->u.cb = (DWORD)DeviceInfo.u.Position;
849 
850  return MMSYSERR_NOERROR;
851 }
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
struct _LARGE_INTEGER::@2263 u
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
#define DWORD
Definition: nt_native.h:44
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
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 IOCTL_OPEN_WDMAUD
Definition: interface.h:82
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
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:298
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
#define TIME_BYTES
Definition: mmsystem.h:30
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)
static PLARGE_INTEGER Time
Definition: time.c:105

◆ 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 ( VOID  )

◆ WdmAudOpenSoundDeviceByLegacy()

MMRESULT WdmAudOpenSoundDeviceByLegacy ( IN PSOUND_DEVICE  SoundDevice,
OUT PVOID Handle 
)

Definition at line 255 of file legacy.c.

258 {
259  HDEVINFO hDevInfo;
260  SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
261  GUID SWBusGuid = {STATIC_KSCATEGORY_WDMAUD};
262  PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData;
263 
265  {
267  if (!hDevInfo)
268  {
269  // failed
270  return MMSYSERR_ERROR;
271  }
272 
273  DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
274  if (!SetupDiEnumDeviceInterfaces(hDevInfo, NULL, &SWBusGuid, 0, &DeviceInterfaceData))
275  {
276  // failed
278  return MMSYSERR_ERROR;
279  }
280 
281  DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA_W)HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) + sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W));
282  if (!DeviceInterfaceDetailData)
283  {
284  // failed
286  return MMSYSERR_ERROR;
287  }
288 
289  DeviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
290  if (!SetupDiGetDeviceInterfaceDetailW(hDevInfo, &DeviceInterfaceData, DeviceInterfaceDetailData,MAX_PATH * sizeof(WCHAR) + sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W), NULL, NULL))
291  {
292  // failed
293  HeapFree(GetProcessHeap(), 0, DeviceInterfaceDetailData);
295  return MMSYSERR_ERROR;
296  }
297  SND_TRACE(L"Opening wdmaud device '%s'\n",DeviceInterfaceDetailData->DevicePath);
298  KernelHandle = CreateFileW(DeviceInterfaceDetailData->DevicePath,
300  0,
301  NULL,
304  NULL);
305 
306  HeapFree(GetProcessHeap(), 0, DeviceInterfaceDetailData);
308  }
309 
310 
312  return MMSYSERR_ERROR;
313 
314  ++ OpenCount;
315  return MMSYSERR_NOERROR;
316 
317 }
WCHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:850
#define STATIC_KSCATEGORY_WDMAUD
Definition: ksmedia.h:219
HANDLE KernelHandle
Definition: legacy.c:24
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2297
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
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA_W
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:523
#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
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define MAX_PATH
Definition: compat.h:34
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W * PSP_DEVICE_INTERFACE_DETAIL_DATA_W
static const WCHAR L[]
Definition: oid.c:1250
#define GENERIC_READ
Definition: compat.h:135
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
DWORD OpenCount
Definition: legacy.c:25
#define CreateFileW
Definition: compat.h:489
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
struct _SP_DEVICE_INTERFACE_DATA SP_DEVICE_INTERFACE_DATA
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define HeapFree(x, y, z)
Definition: compat.h:483
#define SND_TRACE(...)
#define DIGCF_PRESENT
Definition: setupapi.h:171

◆ 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

◆ WdmAudQueryMixerInfoByLegacy()

MMRESULT WdmAudQueryMixerInfoByLegacy ( IN struct _SOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN DWORD  DeviceId,
IN UINT  uMsg,
IN LPVOID  Parameter,
IN DWORD  Flags 
)

Definition at line 883 of file legacy.c.

889 {
892  HANDLE Handle;
894  LPMIXERLINEW MixLine;
895  LPMIXERLINECONTROLSW MixControls;
896  LPMIXERCONTROLDETAILS MixDetails;
897 
898  SND_TRACE(L"uMsg %x Flags %x\n", uMsg, Flags);
899 
900  Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
902 
904  DeviceInfo.hDevice = Handle;
905  DeviceInfo.DeviceIndex = DeviceId;
906  DeviceInfo.DeviceType = MIXER_DEVICE_TYPE;
907  DeviceInfo.Flags = Flags;
908 
909  MixLine = (LPMIXERLINEW)Parameter;
910  MixControls = (LPMIXERLINECONTROLSW)Parameter;
911  MixDetails = (LPMIXERCONTROLDETAILS)Parameter;
912 
913  switch(uMsg)
914  {
915  case MXDM_GETLINEINFO:
916  RtlCopyMemory(&DeviceInfo.u.MixLine, MixLine, sizeof(MIXERLINEW));
918  break;
920  RtlCopyMemory(&DeviceInfo.u.MixControls, MixControls, sizeof(MIXERLINECONTROLSW));
922  break;
924  RtlCopyMemory(&DeviceInfo.u.MixDetails, MixDetails, sizeof(MIXERCONTROLDETAILS));
926  break;
928  RtlCopyMemory(&DeviceInfo.u.MixDetails, MixDetails, sizeof(MIXERCONTROLDETAILS));
930  break;
931  default:
932  SND_ASSERT(0);
933  return MMSYSERR_NOTSUPPORTED;
934  }
935 
938  (LPVOID) &DeviceInfo,
939  sizeof(WDMAUD_DEVICE_INFO),
940  (LPVOID) &DeviceInfo,
941  sizeof(WDMAUD_DEVICE_INFO),
942  NULL);
943 
944  if ( ! MMSUCCESS(Result) )
945  {
946  return Result;
947  }
948 
949  switch(uMsg)
950  {
951  case MXDM_GETLINEINFO:
952  {
953  RtlCopyMemory(MixLine, &DeviceInfo.u.MixLine, sizeof(MIXERLINEW));
954  break;
955  }
956  }
957 
958  return Result;
959 }
#define IOCTL_GETCONTROLDETAILS
Definition: interface.h:325
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
struct tMIXERCONTROLDETAILS * LPMIXERCONTROLDETAILS
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
#define IOCTL_GETLINEINFO
Definition: interface.h:272
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
_In_ PVOID Parameter
Definition: ldrtypes.h:241
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define IOCTL_GETLINECONTROLS
Definition: interface.h:290
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 MXDM_SETCONTROLDETAILS
Definition: mmddk.h:198
#define MXDM_GETCONTROLDETAILS
Definition: mmddk.h:197
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
struct tagMIXERLINEW * LPMIXERLINEW
#define MXDM_GETLINECONTROLS
Definition: mmddk.h:196
static const WCHAR L[]
Definition: oid.c:1250
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:298
struct tagMIXERLINECONTROLSW * LPMIXERLINECONTROLSW
#define IOCTL_SETCONTROLDETAILS
Definition: interface.h:307
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)
#define MXDM_GETLINEINFO
Definition: mmddk.h:195
#define SND_TRACE(...)

◆ WdmAudQueryMixerInfoByMMixer()

MMRESULT WdmAudQueryMixerInfoByMMixer ( IN struct _SOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN DWORD  DeviceId,
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

◆ WdmAudResetStreamByLegacy()

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

Definition at line 855 of file legacy.c.

859 {
861  HANDLE Handle;
863 
864  Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
866 
868  DeviceInfo.hDevice = Handle;
869  DeviceInfo.DeviceType = DeviceType;
870  DeviceInfo.u.ResetStream = (bStartReset ? KSRESET_BEGIN : KSRESET_END);
871 
874  (LPVOID) &DeviceInfo,
875  sizeof(WDMAUD_DEVICE_INFO),
876  (LPVOID) &DeviceInfo,
877  sizeof(WDMAUD_DEVICE_INFO),
878  NULL);
879  return Result;
880 }
HANDLE KernelHandle
Definition: legacy.c:24
DeviceType
Definition: mmdrv.h:41
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
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
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
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:298
#define IOCTL_RESET_STREAM
Definition: interface.h:374
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)

◆ 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().

◆ WdmAudSetMixerDeviceFormatByLegacy()

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

Definition at line 413 of file legacy.c.

418 {
421  HANDLE hThread;
422 
423  Instance->hNotifyEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
424  if ( ! Instance->hNotifyEvent )
425  return MMSYSERR_NOMEM;
426 
427  if (Instance->Handle != NULL)
428  {
429  /* device is already open */
430  return MMSYSERR_NOERROR;
431  }
432 
433  Instance->hStopEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
434  if ( ! Instance->hStopEvent )
435  return MMSYSERR_NOMEM;
436 
438  DeviceInfo.DeviceType = MIXER_DEVICE_TYPE;
439  DeviceInfo.DeviceIndex = DeviceId;
440  DeviceInfo.u.hNotifyEvent = Instance->hNotifyEvent;
441 
444  (LPVOID) &DeviceInfo,
445  sizeof(WDMAUD_DEVICE_INFO),
446  (LPVOID) &DeviceInfo,
447  sizeof(WDMAUD_DEVICE_INFO),
448  NULL);
449 
450  if ( ! MMSUCCESS(Result) )
451  {
452  CloseHandle(Instance->hNotifyEvent);
453  CloseHandle(Instance->hStopEvent);
455  }
456 
458  if ( hThread )
459  {
461  }
462 
463  /* Store sound device handle instance handle */
464  Instance->Handle = (PVOID)DeviceInfo.hDevice;
465 
466  return MMSYSERR_NOERROR;
467 }
#define CloseHandle
Definition: compat.h:487
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
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 MMSYSERR_NOMEM
Definition: mmsystem.h:103
DWORD WINAPI MixerEventThreadRoutine(LPVOID Parameter)
Definition: legacy.c:29
#define FALSE
Definition: types.h:117
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:136
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 * PVOID
Definition: retypes.h:9
#define IOCTL_OPEN_WDMAUD
Definition: interface.h:82
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
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:298
IN PVOID Instance
Definition: pci.h:361
HANDLE hThread
Definition: wizard.c:27

◆ 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

◆ WdmAudSetWaveDeviceFormatByLegacy()

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

Definition at line 470 of file legacy.c.

475 {
477  PSOUND_DEVICE SoundDevice;
478  PVOID Identifier;
481 
482  Result = GetSoundDeviceFromInstance(Instance, &SoundDevice);
483 
484  if ( ! MMSUCCESS(Result) )
485  {
487  }
488 
489  Result = GetSoundDeviceIdentifier(SoundDevice, &Identifier);
490 
491  if ( ! MMSUCCESS(Result) )
492  {
494  }
495 
496  if (Instance->Handle != NULL)
497  {
498  /* device is already open */
499  return MMSYSERR_NOERROR;
500  }
501 
502  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
503 
505 
507  DeviceInfo.DeviceType = DeviceType;
508  DeviceInfo.DeviceIndex = DeviceId;
509  DeviceInfo.u.WaveFormatEx.cbSize = sizeof(WAVEFORMATEX); //WaveFormat->cbSize;
510  DeviceInfo.u.WaveFormatEx.wFormatTag = WaveFormat->wFormatTag;
511 #ifdef USERMODE_MIXER
512  DeviceInfo.u.WaveFormatEx.nChannels = 2;
513  DeviceInfo.u.WaveFormatEx.nSamplesPerSec = 44100;
514  DeviceInfo.u.WaveFormatEx.nBlockAlign = 4;
515  DeviceInfo.u.WaveFormatEx.nAvgBytesPerSec = 176400;
516  DeviceInfo.u.WaveFormatEx.wBitsPerSample = 16;
517 #else
518  DeviceInfo.u.WaveFormatEx.nChannels = WaveFormat->nChannels;
519  DeviceInfo.u.WaveFormatEx.nSamplesPerSec = WaveFormat->nSamplesPerSec;
520  DeviceInfo.u.WaveFormatEx.nBlockAlign = WaveFormat->nBlockAlign;
521  DeviceInfo.u.WaveFormatEx.nAvgBytesPerSec = WaveFormat->nAvgBytesPerSec;
522  DeviceInfo.u.WaveFormatEx.wBitsPerSample = (DeviceInfo.u.WaveFormatEx.nAvgBytesPerSec * 8) / (DeviceInfo.u.WaveFormatEx.nSamplesPerSec * DeviceInfo.u.WaveFormatEx.nChannels);
523 #endif
524 
527  (LPVOID) &DeviceInfo,
528  sizeof(WDMAUD_DEVICE_INFO),
529  (LPVOID) &DeviceInfo,
530  sizeof(WDMAUD_DEVICE_INFO),
531  NULL);
532 
533  if ( ! MMSUCCESS(Result) )
534  {
536  }
537 
538  if (WaveFormatSize >= sizeof(WAVEFORMAT))
539  {
540  /* Store format */
541  Instance->WaveFormatEx.wFormatTag = WaveFormat->wFormatTag;
542  Instance->WaveFormatEx.nChannels = WaveFormat->nChannels;
543  Instance->WaveFormatEx.nSamplesPerSec = WaveFormat->nSamplesPerSec;
544  Instance->WaveFormatEx.nBlockAlign = WaveFormat->nBlockAlign;
545  Instance->WaveFormatEx.nAvgBytesPerSec = WaveFormat->nAvgBytesPerSec;
546  }
547 
548  /* store details */
549  Instance->WaveFormatEx.cbSize = sizeof(WAVEFORMATEX);
550  Instance->WaveFormatEx.wBitsPerSample = (DeviceInfo.u.WaveFormatEx.nAvgBytesPerSec * 8) / (DeviceInfo.u.WaveFormatEx.nSamplesPerSec * DeviceInfo.u.WaveFormatEx.nChannels);
551 
552  /* Store sound device handle instance handle */
553  Instance->Handle = (PVOID)DeviceInfo.hDevice;
554 
555  /* Now determine framing requirements */
558  (LPVOID) &DeviceInfo,
559  sizeof(WDMAUD_DEVICE_INFO),
560  (LPVOID) &DeviceInfo,
561  sizeof(WDMAUD_DEVICE_INFO),
562  NULL);
563 
564  if ( MMSUCCESS(Result) )
565  {
566  if (DeviceInfo.u.FrameSize)
567  {
568  Instance->FrameSize = DeviceInfo.u.FrameSize * 2;
569  Instance->BufferCount = WaveFormat->nAvgBytesPerSec / Instance->FrameSize;
570  SND_TRACE(L"FrameSize %u BufferCount %u\n", Instance->FrameSize, Instance->BufferCount);
571  }
572  }
573  else
574  {
575  // use a default of 100 buffers
576  Instance->BufferCount = 100;
577  }
578 
579  /* Now acquire resources */
580  DeviceInfo.u.State = KSSTATE_ACQUIRE;
582 
583  /* pause the pin */
584  DeviceInfo.u.State = KSSTATE_PAUSE;
586 
587  /* start the pin */
588  DeviceInfo.u.State = KSSTATE_RUN;
590 
591 
592  return MMSYSERR_NOERROR;
593 }
#define IOCTL_SETDEVICE_STATE
Definition: interface.h:134
HANDLE KernelHandle
Definition: legacy.c:24
MMRESULT GetSoundDeviceIdentifier(IN PSOUND_DEVICE SoundDevice, OUT PVOID *Identifier)
Definition: devicelist.c:328
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
struct tWAVEFORMATEX WAVEFORMATEX
Definition: austream.idl:23
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
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
void * PVOID
Definition: retypes.h:9
#define IOCTL_OPEN_WDMAUD
Definition: interface.h:82
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
static const WCHAR L[]
Definition: oid.c:1250
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:298
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
IN PVOID Instance
Definition: pci.h:361
#define IOCTL_GETFRAMESIZE
Definition: interface.h:255
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)
#define SND_TRACE(...)

◆ 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)

◆ WdmAudSetWaveStateByLegacy()

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

Definition at line 699 of file legacy.c.

702 {
704  PSOUND_DEVICE SoundDevice;
707  HANDLE Handle;
708 
709  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
710 
711  if ( ! MMSUCCESS(Result) )
712  {
714  }
715 
716  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
718 
719  Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
721 
723  DeviceInfo.hDevice = Handle;
724  DeviceInfo.DeviceType = DeviceType;
725 
726  if (bStart)
727  DeviceInfo.u.State = KSSTATE_RUN;
728  else
729  DeviceInfo.u.State = KSSTATE_PAUSE;
732  (LPVOID) &DeviceInfo,
733  sizeof(WDMAUD_DEVICE_INFO),
734  (LPVOID) &DeviceInfo,
735  sizeof(WDMAUD_DEVICE_INFO),
736  NULL);
737 
738  return Result;
739 }
#define IOCTL_SETDEVICE_STATE
Definition: interface.h:134
HANDLE KernelHandle
Definition: legacy.c:24
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define ZeroMemory
Definition: winbase.h:1648
UINT MMRESULT
Definition: mmsystem.h:962
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
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
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct _DeviceInfo DeviceInfo
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:298
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)
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)

◆ 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)

◆ WriteFileEx_Committer2()

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

◆ WriteFileEx_Remixer()

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

Definition at line 423 of file mixer.c.

429 {
430  HANDLE Handle;
432  DWORD BufferLength, BufferLengthTemp;
433  PVOID BufferOut, BufferOutTemp;
434  DWORD Status;
435  BOOL Result;
436 
437  VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance );
438  VALIDATE_MMSYS_PARAMETER( OffsetPtr );
439  VALIDATE_MMSYS_PARAMETER( Overlap );
441 
442  GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
443 
445 
446  BufferOut = OffsetPtr;
448 
449  if (SoundDeviceInstance->WaveFormatEx.wBitsPerSample != 16)
450  {
451  Status = PerformQualityConversion(OffsetPtr,
452  Length,
453  SoundDeviceInstance->WaveFormatEx.wBitsPerSample,
454  16,
455  &BufferOut,
456  &BufferLength);
457  if (Status)
458  {
459  SND_TRACE(L"PerformQualityConversion failed\n");
460  return MMSYSERR_NOERROR;
461  }
462  }
463 
464  if (SoundDeviceInstance->WaveFormatEx.nChannels != 2)
465  {
466  Status = PerformChannelConversion(BufferOut,
467  BufferLength,
468  SoundDeviceInstance->WaveFormatEx.nChannels,
469  2,
470  16,
471  &BufferOutTemp,
472  &BufferLengthTemp);
473 
474  if (BufferOut != OffsetPtr)
475  {
476  HeapFree(GetProcessHeap(), 0, BufferOut);
477  }
478 
479  if (Status)
480  {
481  SND_TRACE(L"PerformChannelConversion failed\n");
482  return MMSYSERR_NOERROR;
483  }
484 
485  BufferOut = BufferOutTemp;
486  BufferLength = BufferLengthTemp;
487  }
488 
489  if (SoundDeviceInstance->WaveFormatEx.nSamplesPerSec != 44100)
490  {
492  BufferLength,
493  SoundDeviceInstance->WaveFormatEx.nSamplesPerSec,
494  44100,
495  2,
496  2,
497  &BufferOutTemp,
498  &BufferLengthTemp);
499 
500  if (BufferOut != OffsetPtr)
501  {
502  HeapFree(GetProcessHeap(), 0, BufferOut);
503  }
504 
505  if (Status)
506  {
507  SND_TRACE(L"PerformSampleRateConversion failed\n");
508  return MMSYSERR_NOERROR;
509  }
510 
511  BufferOut = BufferOutTemp;
512  BufferLength = BufferLengthTemp;
513  }
514 
516  DeviceInfo.hDevice = Handle;
517  DeviceInfo.DeviceType = WAVE_OUT_DEVICE_TYPE; //FIXME
518  DeviceInfo.Header.FrameExtent = BufferLength;
519  DeviceInfo.Header.DataUsed = BufferLength;
520  DeviceInfo.Header.Data = BufferOut;
521  DeviceInfo.Header.Size = sizeof(KSSTREAM_HEADER);
522  DeviceInfo.Header.PresentationTime.Numerator = 1;
523  DeviceInfo.Header.PresentationTime.Denominator = 1;
524 
525  Overlap->CompletionContext = UlongToPtr(Length);
526  Overlap->OriginalCompletionRoutine = CompletionRoutine;
527 
528  Overlap->Standard.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
529 
530  //SND_TRACE(L"OriginalLength %u NewLength %u\n", Length, BufferLength);
531 
532 #if 0
534 #else
536 #endif
537 
538  if ( ! Result )
539  {
540  SND_TRACE(L"WriteFileEx failed with %x\n", GetLastError());
541  return MMSYSERR_NOERROR;
542  }
543 
545 
546 #ifdef USERMODE_MIXER
547  // if (BufferOut != OffsetPtr)
548  // HeapFree(GetProcessHeap(), 0, BufferOut);
549 #endif
550 
551 
552  return MMSYSERR_NOERROR;
553 }
DWORD PerformQualityConversion(PUCHAR Buffer, ULONG BufferLength, ULONG OldWidth, ULONG NewWidth, PVOID *Result, PULONG ResultLength)
Definition: mixer.c:263
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
#define TRUE
Definition: types.h:120
DWORD PerformChannelConversion(PUCHAR Buffer, ULONG BufferLength, ULONG OldChannels, ULONG NewChannels, ULONG BitsPerSample, PVOID *Result, PULONG ResultLength)
Definition: mixer.c:140
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define ZeroMemory
Definition: winbase.h:1648
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
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
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
WCHAR Data[ANYSIZE_ARRAY]
#define UlongToPtr(u)
Definition: config.h:106
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:484
_In_ UCHAR BufferLength
Definition: scsi.h:4067
struct _DeviceInfo DeviceInfo
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
HANDLE KernelHandle
Definition: legacy.c:24
DWORD PerformSampleRateConversion(PUCHAR Buffer, ULONG BufferLength, ULONG OldRate, ULONG NewRate, ULONG BytesPerSample, ULONG NumChannels, PVOID *Result, PULONG ResultLength)
Definition: mixer.c:22
_In_ PIRP _In_opt_ PVOID _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
Definition: fsrtlfuncs.h:673
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)
#define INFINITE
Definition: serial.h:102
BOOL WINAPI WriteFileEx(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, IN LPOVERLAPPED lpOverlapped, IN LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
Definition: rw.c:262
#define HeapFree(x, y, z)
Definition: compat.h:483
VOID CALLBACK MixerCompletionRoutine(IN DWORD dwErrorCode, IN DWORD dwNumberOfBytesTransferred, IN LPOVERLAPPED lpOverlapped)
Definition: mixer.c:411
#define SND_TRACE(...)

Referenced by PopulateWdmDeviceList().