ReactOS  0.4.14-dev-98-gb0d4763
widMessage.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/wave/widMessage.c
5  *
6  * PURPOSE: Provides the widMessage exported function, as required by
7  * the MME API, for wave input device support.
8  *
9  * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org)
10 */
11 
12 #include "precomp.h"
13 
14 /*
15  Standard MME driver entry-point for messages relating to wave audio
16  input.
17 */
18 DWORD
21  UINT DeviceId,
22  UINT Message,
23  DWORD_PTR PrivateHandle,
24  DWORD_PTR Parameter1,
25  DWORD_PTR Parameter2)
26 {
28 
30 
31  SND_TRACE(L"widMessage - Message type %d\n", Message);
32 
33  switch ( Message )
34  {
35  case WIDM_GETNUMDEVS :
36  {
38  break;
39  }
40 
41  case WIDM_START :
42  {
43  Result = MmeSetState(PrivateHandle, TRUE);
44  break;
45  }
46 
47  case WIDM_STOP :
48  {
49  Result = MmeSetState(PrivateHandle, FALSE);
50  break;
51  }
52 
53  case WIDM_GETDEVCAPS :
54  {
55 
57  DeviceId,
58  (PVOID) Parameter1,
59  Parameter2);
60  break;
61  }
62  case WIDM_OPEN :
63  {
65  DeviceId,
66  (LPWAVEOPENDESC) Parameter1,
67  Parameter2,
68  (DWORD_PTR*) PrivateHandle);
69  break;
70  }
71 
72  case WIDM_CLOSE :
73  {
74  Result = MmeCloseDevice(PrivateHandle);
75 
76  break;
77  }
78 
79  case WIDM_PREPARE :
80  {
81  /* TODO: Do we need to pass 2nd parameter? */
82  Result = MmePrepareWaveHeader(PrivateHandle, Parameter1);
83  break;
84  }
85 
86  case WIDM_UNPREPARE :
87  {
88  Result = MmeUnprepareWaveHeader(PrivateHandle, Parameter1);
89  break;
90  }
91 
92  case WIDM_RESET :
93  {
94  /* Stop playback, reset position to zero */
95  Result = MmeResetWavePlayback(PrivateHandle);
96  break;
97  }
98 
99  case WIDM_ADDBUFFER :
100  {
101  Result = MmeWriteWaveHeader(PrivateHandle, Parameter1);
102  break;
103  }
104 
106  {
107  Result = MmeGetDeviceInterfaceString(WAVE_IN_DEVICE_TYPE, DeviceId, NULL, 0, (DWORD*)Parameter1); //FIXME DWORD_PTR
108  break;
109  }
110 
112  {
113  Result = MmeGetDeviceInterfaceString(WAVE_IN_DEVICE_TYPE, DeviceId, (LPWSTR)Parameter1, Parameter2, NULL); //FIXME DWORD_PTR
114  break;
115  }
116 
117 
118  }
119 
120  SND_TRACE(L"widMessage returning MMRESULT %d\n", Result);
121 
123 
124  return Result;
125 }
MMRESULT MmeGetDeviceInterfaceString(IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN LPWSTR Interface, IN DWORD InterfaceLength, OUT DWORD *InterfaceSize)
Definition: mmewrap.c:294
#define WIDM_GETDEVCAPS
Definition: mmddk.h:137
#define TRUE
Definition: types.h:120
#define WIDM_RESET
Definition: mmddk.h:145
#define WIDM_START
Definition: mmddk.h:143
#define WIDM_STOP
Definition: mmddk.h:144
#define WIDM_GETNUMDEVS
Definition: mmddk.h:136
UINT MMRESULT
Definition: mmsystem.h:962
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
MMRESULT MmeGetSoundDeviceCapabilities(IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN PVOID Capabilities, IN DWORD CapabilitiesSize)
Definition: mmewrap.c:103
DWORD APIENTRY widMessage(UINT DeviceId, UINT Message, DWORD_PTR PrivateHandle, DWORD_PTR Parameter1, DWORD_PTR Parameter2)
Definition: widMessage.c:20
#define MmeUnprepareWaveHeader(private_handle, header)
Definition: mmebuddy.h:391
#define WIDM_ADDBUFFER
Definition: mmddk.h:142
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
ULONG GetSoundDeviceCount(IN MMDEVICE_TYPE DeviceType)
Definition: devicelist.c:67
#define WIDM_PREPARE
Definition: mmddk.h:140
#define MmeWriteWaveHeader(private_handle, header)
Definition: mmebuddy.h:394
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
static const WCHAR L[]
Definition: oid.c:1250
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define WIDM_UNPREPARE
Definition: mmddk.h:141
MMRESULT MmeOpenDevice(IN MMDEVICE_TYPE DeviceType, IN UINT DeviceId, IN LPWAVEOPENDESC OpenParameters, IN DWORD Flags, OUT DWORD_PTR *PrivateHandle)
Definition: mmewrap.c:132
MMRESULT MmeSetState(IN DWORD_PTR PrivateHandle, IN BOOL bStart)
Definition: mmewrap.c:19
unsigned int UINT
Definition: ndis.h:50
VOID ReleaseEntrypointMutex(IN MMDEVICE_TYPE DeviceType)
Definition: reentrancy.c:92
#define WIDM_OPEN
Definition: mmddk.h:138
#define WIDM_CLOSE
Definition: mmddk.h:139
WCHAR * LPWSTR
Definition: xmlstorage.h:184
MMRESULT MmeResetWavePlayback(IN DWORD_PTR PrivateHandle)
Definition: mmewrap.c:280
#define MmePrepareWaveHeader(private_handle, header)
Definition: mmebuddy.h:388
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
#define SND_TRACE(...)
#define APIENTRY
Definition: api.h:79