ReactOS 0.4.15-dev-7681-g776c3a3
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*/
21 UINT DeviceId,
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 {
64
65 /* Do sanity checks for 'recording' SamplesPerSec value */
66 LPWAVEOPENDESC OpenParameters = (LPWAVEOPENDESC)Parameter1;
67 if (OpenParameters->lpFormat->nSamplesPerSec > 100000)
68 OpenParameters->lpFormat->nSamplesPerSec = 100000;
69 if (OpenParameters->lpFormat->nSamplesPerSec < 5000)
70 OpenParameters->lpFormat->nSamplesPerSec = 5000;
71
73 DeviceId,
74 (LPWAVEOPENDESC) Parameter1,
75 Parameter2,
76 (DWORD_PTR*) PrivateHandle);
77 break;
78 }
79
80 case WIDM_CLOSE :
81 {
82 Result = MmeCloseDevice(PrivateHandle);
83
84 break;
85 }
86
87 case WIDM_PREPARE :
88 {
89 /* TODO: Do we need to pass 2nd parameter? */
90 Result = MmePrepareWaveHeader(PrivateHandle, Parameter1);
91 break;
92 }
93
94 case WIDM_UNPREPARE :
95 {
96 Result = MmeUnprepareWaveHeader(PrivateHandle, Parameter1);
97 break;
98 }
99
100 case WIDM_RESET :
101 {
102 /* Stop playback, reset position to zero */
103 Result = MmeResetWavePlayback(PrivateHandle);
104 break;
105 }
106
107 case WIDM_ADDBUFFER :
108 {
109 Result = MmeWriteWaveHeader(PrivateHandle, Parameter1);
110 break;
111 }
112
114 {
115 Result = MmeGetDeviceInterfaceString(WAVE_IN_DEVICE_TYPE, DeviceId, NULL, 0, (DWORD*)Parameter1); //FIXME DWORD_PTR
116 break;
117 }
118
120 {
121 Result = MmeGetDeviceInterfaceString(WAVE_IN_DEVICE_TYPE, DeviceId, (LPWSTR)Parameter1, Parameter2, NULL); //FIXME DWORD_PTR
122 break;
123 }
124
125
126 }
127
128 SND_TRACE(L"widMessage returning MMRESULT %d\n", Result);
129
131
132 return Result;
133}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
#define WIDM_GETNUMDEVS
Definition: mmddk.h:136
#define WIDM_STOP
Definition: mmddk.h:144
struct WAVEOPENDESC * LPWAVEOPENDESC
#define WIDM_START
Definition: mmddk.h:143
#define WIDM_GETDEVCAPS
Definition: mmddk.h:137
#define WIDM_CLOSE
Definition: mmddk.h:139
#define WIDM_PREPARE
Definition: mmddk.h:140
#define WIDM_ADDBUFFER
Definition: mmddk.h:142
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
#define WIDM_RESET
Definition: mmddk.h:145
#define WIDM_UNPREPARE
Definition: mmddk.h:141
#define WIDM_OPEN
Definition: mmddk.h:138
static const WCHAR Message[]
Definition: register.c:74
unsigned long DWORD
Definition: ntddk_ex.h:95
MMRESULT MmeOpenDevice(IN MMDEVICE_TYPE DeviceType, IN UINT DeviceId, IN LPWAVEOPENDESC OpenParameters, IN DWORD Flags, OUT DWORD_PTR *PrivateHandle)
Definition: mmewrap.c:132
MMRESULT MmeCloseDevice(IN DWORD_PTR PrivateHandle)
Definition: mmewrap.c:225
#define MmePrepareWaveHeader(private_handle, header)
Definition: mmebuddy.h:388
VOID AcquireEntrypointMutex(IN MMDEVICE_TYPE DeviceType)
Definition: reentrancy.c:75
ULONG GetSoundDeviceCount(IN MMDEVICE_TYPE DeviceType)
Definition: devicelist.c:67
MMRESULT MmeGetDeviceInterfaceString(IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN LPWSTR Interface, IN DWORD InterfaceLength, OUT DWORD *InterfaceSize)
Definition: mmewrap.c:294
MMRESULT MmeSetState(IN DWORD_PTR PrivateHandle, IN BOOL bStart)
Definition: mmewrap.c:19
MMRESULT MmeResetWavePlayback(IN DWORD_PTR PrivateHandle)
Definition: mmewrap.c:280
#define MmeUnprepareWaveHeader(private_handle, header)
Definition: mmebuddy.h:391
#define MmeWriteWaveHeader(private_handle, header)
Definition: mmebuddy.h:394
VOID ReleaseEntrypointMutex(IN MMDEVICE_TYPE DeviceType)
Definition: reentrancy.c:92
MMRESULT MmeGetSoundDeviceCapabilities(IN MMDEVICE_TYPE DeviceType, IN DWORD DeviceId, IN PVOID Capabilities, IN DWORD CapabilitiesSize)
Definition: mmewrap.c:103
#define SND_TRACE(...)
UINT MMRESULT
Definition: mmsystem.h:962
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
@ WAVE_IN_DEVICE_TYPE
Definition: sndtypes.h:28
LPWAVEFORMATEX lpFormat
Definition: mmddk.h:399
DWORD nSamplesPerSec
Definition: mmreg.h:80
uint32_t DWORD_PTR
Definition: typedefs.h:65
DWORD APIENTRY widMessage(UINT DeviceId, UINT Message, DWORD_PTR PrivateHandle, DWORD_PTR Parameter1, DWORD_PTR Parameter2)
Definition: widMessage.c:20
_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:409
WCHAR * LPWSTR
Definition: xmlstorage.h:184