ReactOS  0.4.13-dev-92-gf251225
mxdMessage.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Sound System "MME Buddy" Library
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: lib/sound/mmebuddy/mixer/mxdMessage.c
5  *
6  * PURPOSE: Provides the mxdMessage exported function, as required by
7  * the MME API, for mixer device support.
8  *
9  * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org)
10 */
11 
12 #include "precomp.h"
13 
16  IN UINT DeviceId,
17  IN UINT Message,
18  IN DWORD_PTR PrivateHandle,
19  IN DWORD_PTR Parameter1,
20  IN DWORD_PTR Parameter2)
21 {
23  PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
24  PSOUND_DEVICE SoundDevice;
26 
27  //SND_TRACE(L"Getting mixer info %u\n", Message);
28 
29  if ( PrivateHandle == 0 )
30  {
31  Result = GetSoundDevice(MIXER_DEVICE_TYPE, DeviceId, &SoundDevice);
32 
33  if ( ! MMSUCCESS(Result) )
35 
37  if ( ! MMSUCCESS(Result) )
39 
40  Result = FunctionTable->QueryMixerInfo(NULL, DeviceId, Message, (LPVOID)Parameter1, Parameter2);
41  return Result;
42  }
43 
44  VALIDATE_MMSYS_PARAMETER( PrivateHandle );
45  SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
46 
47  Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
48  if ( ! MMSUCCESS(Result) )
50 
52  if ( ! MMSUCCESS(Result) )
54 
55  if ( ! FunctionTable->QueryMixerInfo )
56  return MMSYSERR_NOTSUPPORTED;
57 
58  Result = FunctionTable->QueryMixerInfo(SoundDeviceInstance, DeviceId, Message, (LPVOID)Parameter1, Parameter2);
59 
60  return Result;
61 }
62 
63 
64 /*
65  Standard MME driver entry-point for messages relating to mixers.
66 */
67 DWORD
70  UINT DeviceId,
71  UINT Message,
72  DWORD_PTR PrivateHandle,
73  DWORD_PTR Parameter1,
74  DWORD_PTR Parameter2)
75 {
77 
79 
80  //SND_TRACE(L"mxdMessage - Message type %d\n", Message);
81 
82  switch ( Message )
83  {
84  case MXDM_GETNUMDEVS :
85  {
87  break;
88  }
89 
90  case MXDM_GETDEVCAPS :
91  {
93  DeviceId,
94  (PVOID) Parameter1,
95  Parameter2);
96  break;
97  }
98 
99  case MXDM_INIT :
100  {
102  break;
103  }
104 
105  case MXDM_OPEN :
106  {
108  DeviceId,
109  (LPWAVEOPENDESC) Parameter1, /* unused */
110  Parameter2,
111  (DWORD_PTR*) PrivateHandle);
112  VALIDATE_MMSYS_PARAMETER(*(DWORD_PTR*)PrivateHandle);
113  break;
114  }
115 
116  case MXDM_CLOSE :
117  {
118  Result = MmeCloseDevice(PrivateHandle);
119 
120  break;
121  }
122 
124  {
125  Result = MmeGetLineInfo(DeviceId,
126  Message,
127  PrivateHandle,
128  Parameter1,
129  Parameter2);
130 
131  break;
132  }
133 
135  {
136  Result = MmeGetLineInfo(DeviceId,
137  Message,
138  PrivateHandle,
139  Parameter1,
140  Parameter2);
141 
142  break;
143  }
144 
145  case MXDM_GETLINECONTROLS :
146  {
147  Result = MmeGetLineInfo(DeviceId,
148  Message,
149  PrivateHandle,
150  Parameter1,
151  Parameter2);
152 
153  break;
154  }
155 
156  case MXDM_GETLINEINFO :
157  {
158  Result = MmeGetLineInfo(DeviceId,
159  Message,
160  PrivateHandle,
161  Parameter1,
162  Parameter2);
163 
164  break;
165  }
166 
168  {
169  Result = MmeGetDeviceInterfaceString(MIXER_DEVICE_TYPE, DeviceId, NULL, 0, (DWORD*)Parameter1); //FIXME DWORD_PTR
170  break;
171  }
172 
174  {
175  Result = MmeGetDeviceInterfaceString(MIXER_DEVICE_TYPE, DeviceId, (LPWSTR)Parameter1, Parameter2, NULL); //FIXME DWORD_PTR
176  break;
177  }
178 
179  }
180 
181  //SND_TRACE(L"mxdMessage returning MMRESULT %d\n", Result);
182 
184 
185  return Result;
186 }
MMRESULT MmeGetDeviceInterfaceString(IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN LPWSTR Interface, IN DWORD InterfaceLength, OUT DWORD *InterfaceSize)
Definition: mmewrap.c:294
#define IN
Definition: typedefs.h:38
#define MXDM_GETDEVCAPS
Definition: mmddk.h:192
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
#define MXDM_CLOSE
Definition: mmddk.h:194
DWORD APIENTRY mxdMessage(UINT DeviceId, UINT Message, DWORD_PTR PrivateHandle, DWORD_PTR Parameter1, DWORD_PTR Parameter2)
Definition: mxdMessage.c:69
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
UINT MMRESULT
Definition: mmsystem.h:962
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
MMRESULT GetSoundDevice(IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceIndex, OUT PSOUND_DEVICE *Device)
Definition: devicelist.c:289
MMRESULT MmeGetSoundDeviceCapabilities(IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN PVOID Capabilities, IN DWORD CapabilitiesSize)
Definition: mmewrap.c:103
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
struct _SOUND_DEVICE_INSTANCE * PSOUND_DEVICE_INSTANCE
MMRESULT GetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, OUT PMMFUNCTION_TABLE *FunctionTable)
Definition: functiontable.c:47
VOID AcquireEntrypointMutex(IN MMDEVICE_TYPE DeviceType)
Definition: reentrancy.c:75
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 MXDM_SETCONTROLDETAILS
Definition: mmddk.h:198
ULONG GetSoundDeviceCount(IN MMDEVICE_TYPE DeviceType)
Definition: devicelist.c:67
#define MXDM_GETCONTROLDETAILS
Definition: mmddk.h:197
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
MMRESULT MmeGetLineInfo(IN UINT DeviceId, IN UINT Message, IN DWORD_PTR PrivateHandle, IN DWORD_PTR Parameter1, IN DWORD_PTR Parameter2)
Definition: mxdMessage.c:15
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
CHAR Message[80]
Definition: alive.c:5
MMRESULT MmeCloseDevice(IN DWORD_PTR PrivateHandle)
Definition: mmewrap.c:225
#define MXDM_GETLINECONTROLS
Definition: mmddk.h:196
uint32_t DWORD_PTR
Definition: typedefs.h:63
MMRESULT MmeOpenDevice(IN MMDEVICE_TYPE DeviceType, IN UINT DeviceId, IN LPWAVEOPENDESC OpenParameters, IN DWORD Flags, OUT DWORD_PTR *PrivateHandle)
Definition: mmewrap.c:132
#define MXDM_GETNUMDEVS
Definition: mmddk.h:191
unsigned int UINT
Definition: ndis.h:50
#define MXDM_INIT
Definition: mmddk.h:187
VOID ReleaseEntrypointMutex(IN MMDEVICE_TYPE DeviceType)
Definition: reentrancy.c:92
static WLX_DISPATCH_VERSION_1_4 FunctionTable
Definition: wlx.c:736
MMRESULT GetSoundDeviceFromInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PSOUND_DEVICE *SoundDevice)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
#define MXDM_GETLINEINFO
Definition: mmddk.h:195
#define MXDM_OPEN
Definition: mmddk.h:193
#define APIENTRY
Definition: api.h:79