Removed hooks for prepare/unprepare/stream of WAVEHDR. These are handled
[reactos.git] / reactos / lib / drivers / sound / mmebuddy / wave / wodMessage.c
1 /*
2 * PROJECT: ReactOS Sound System "MME Buddy" Library
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/drivers/sound/mmebuddy/wave/wodMessage.c
5 *
6 * PURPOSE: Provides the wodMessage exported function, as required by
7 * the MME API, for wave output device support.
8 *
9 * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org)
10 */
11
12 #include <windows.h>
13 #include <mmsystem.h>
14 #include <mmddk.h>
15
16 #include <ntddsnd.h>
17 #include <sndtypes.h>
18
19 #include <mmebuddy.h>
20
21 #if 0
22 MMRESULT HelloWorld(PSOUND_DEVICE_INSTANCE Instance, PVOID String)
23 {
24 PWSTR WString = (PWSTR) String;
25 SND_TRACE(WString);
26 return MMSYSERR_NOTSUPPORTED;
27 }
28 #endif
29
30 /*
31 Standard MME driver entry-point for messages relating to wave audio
32 output.
33 */
34 APIENTRY DWORD
35 wodMessage(
36 DWORD DeviceId,
37 DWORD Message,
38 DWORD PrivateHandle,
39 DWORD Parameter1,
40 DWORD Parameter2)
41 {
42 MMRESULT Result = MMSYSERR_NOTSUPPORTED;
43
44 AcquireEntrypointMutex(WAVE_OUT_DEVICE_TYPE);
45
46 SND_TRACE(L"wodMessage - Message type %d\n", Message);
47
48 switch ( Message )
49 {
50 case WODM_GETNUMDEVS :
51 {
52 Result = GetSoundDeviceCount(WAVE_OUT_DEVICE_TYPE);
53 break;
54 }
55
56 case WODM_GETDEVCAPS :
57 {
58 Result = MmeGetSoundDeviceCapabilities(WAVE_OUT_DEVICE_TYPE,
59 DeviceId,
60 (PVOID) Parameter1,
61 Parameter2);
62 break;
63 }
64
65 case WODM_OPEN :
66 {
67 Result = MmeOpenWaveDevice(WAVE_OUT_DEVICE_TYPE,
68 DeviceId,
69 (LPWAVEOPENDESC) Parameter1,
70 Parameter2,
71 (DWORD*) PrivateHandle);
72 break;
73 }
74
75 case WODM_CLOSE :
76 {
77 Result = MmeCloseDevice(PrivateHandle);
78
79 break;
80 }
81
82 case WODM_PREPARE :
83 {
84 /* TODO: Do we need to pass 2nd parameter? */
85 Result = MmePrepareWaveHeader(PrivateHandle, Parameter1);
86 break;
87 }
88
89 case WODM_UNPREPARE :
90 {
91 Result = MmeUnprepareWaveHeader(PrivateHandle, Parameter1);
92 break;
93 }
94
95 case WODM_WRITE :
96 {
97 Result = MmeWriteWaveHeader(PrivateHandle, Parameter1);
98 break;
99 }
100
101 case WODM_GETPOS :
102 {
103 #if 0
104 /* Hacky code to test the threading */
105 PSOUND_DEVICE_INSTANCE Instance = (PSOUND_DEVICE_INSTANCE)PrivateHandle;
106 CallSoundThread(Instance->Thread, HelloWorld, Instance, L"Hello World!");
107 CallSoundThread(Instance->Thread, HelloWorld, Instance, L"Hello Universe!");
108 #endif
109 break;
110 }
111 }
112
113 SND_TRACE(L"wodMessage returning MMRESULT %d\n", Result);
114
115 ReleaseEntrypointMutex(WAVE_OUT_DEVICE_TYPE);
116
117 return Result;
118 }