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 "precomp.h" 13 14 #if 0 15 MMRESULT HelloWorld(PSOUND_DEVICE_INSTANCE Instance, PVOID String) 16 { 17 PWSTR WString = (PWSTR) String; 18 SND_TRACE(WString); 19 return MMSYSERR_NOTSUPPORTED; 20 } 21 #endif 22 23 /* 24 Standard MME driver entry-point for messages relating to wave audio 25 output. 26 */ 27 DWORD 28 APIENTRY 29 wodMessage( 30 UINT DeviceId, 31 UINT Message, 32 DWORD_PTR PrivateHandle, 33 DWORD_PTR Parameter1, 34 DWORD_PTR Parameter2) 35 { 36 MMRESULT Result = MMSYSERR_NOTSUPPORTED; 37 38 AcquireEntrypointMutex(WAVE_OUT_DEVICE_TYPE); 39 40 SND_TRACE(L"wodMessage - Message type %d\n", Message); 41 42 switch ( Message ) 43 { 44 case WODM_GETNUMDEVS : 45 { 46 Result = GetSoundDeviceCount(WAVE_OUT_DEVICE_TYPE); 47 break; 48 } 49 50 case WODM_GETDEVCAPS : 51 { 52 Result = MmeGetSoundDeviceCapabilities(WAVE_OUT_DEVICE_TYPE, 53 DeviceId, 54 (PVOID) Parameter1, 55 Parameter2); 56 break; 57 } 58 59 case WODM_OPEN : 60 { 61 Result = MmeOpenDevice(WAVE_OUT_DEVICE_TYPE, 62 DeviceId, 63 (LPWAVEOPENDESC) Parameter1, 64 Parameter2, 65 (DWORD_PTR*)PrivateHandle); 66 break; 67 } 68 69 case WODM_CLOSE : 70 { 71 Result = MmeCloseDevice(PrivateHandle); 72 73 break; 74 } 75 76 case WODM_PREPARE : 77 { 78 /* TODO: Do we need to pass 2nd parameter? */ 79 Result = MmePrepareWaveHeader(PrivateHandle, Parameter1); 80 break; 81 } 82 83 case WODM_UNPREPARE : 84 { 85 Result = MmeUnprepareWaveHeader(PrivateHandle, Parameter1); 86 break; 87 } 88 89 case WODM_WRITE : 90 { 91 Result = MmeWriteWaveHeader(PrivateHandle, Parameter1); 92 break; 93 } 94 95 case WODM_RESET : 96 { 97 /* Stop playback, reset position to zero */ 98 Result = MmeResetWavePlayback(PrivateHandle); 99 break; 100 } 101 102 case WODM_RESTART : 103 { 104 /* Continue playback when paused */ 105 Result = MmeSetState(PrivateHandle, TRUE); 106 break; 107 } 108 case WODM_PAUSE : 109 { 110 /* pause playback */ 111 Result = MmeSetState(PrivateHandle, FALSE); 112 break; 113 } 114 115 case WODM_GETPOS : 116 { 117 Result = MmeGetPosition(WAVE_OUT_DEVICE_TYPE, DeviceId, PrivateHandle, (MMTIME*)Parameter1, Parameter2); 118 break; 119 } 120 121 case WODM_GETVOLUME: 122 { 123 Result = MmeGetVolume(WAVE_OUT_DEVICE_TYPE, 124 DeviceId, 125 PrivateHandle, 126 Parameter1); 127 break; 128 } 129 130 case WODM_SETVOLUME: 131 { 132 Result = MmeSetVolume(WAVE_OUT_DEVICE_TYPE, 133 DeviceId, 134 PrivateHandle, 135 Parameter1); 136 break; 137 } 138 139 case DRV_QUERYDEVICEINTERFACESIZE : 140 { 141 Result = MmeGetDeviceInterfaceString(WAVE_OUT_DEVICE_TYPE, DeviceId, NULL, 0, (DWORD*)Parameter1); //FIXME DWORD_PTR 142 break; 143 } 144 145 case DRV_QUERYDEVICEINTERFACE : 146 { 147 Result = MmeGetDeviceInterfaceString(WAVE_OUT_DEVICE_TYPE, DeviceId, (LPWSTR)Parameter1, Parameter2, NULL); //FIXME DWORD_PTR 148 break; 149 } 150 } 151 152 SND_TRACE(L"wodMessage returning MMRESULT %d\n", Result); 153 154 ReleaseEntrypointMutex(WAVE_OUT_DEVICE_TYPE); 155 156 return Result; 157 } 158