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 19 APIENTRY 20 widMessage( 21 UINT DeviceId, 22 UINT Message, 23 DWORD_PTR PrivateHandle, 24 DWORD_PTR Parameter1, 25 DWORD_PTR Parameter2) 26 { 27 MMRESULT Result = MMSYSERR_NOTSUPPORTED; 28 29 AcquireEntrypointMutex(WAVE_IN_DEVICE_TYPE); 30 31 SND_TRACE(L"widMessage - Message type %d\n", Message); 32 33 switch ( Message ) 34 { 35 case WIDM_GETNUMDEVS : 36 { 37 Result = GetSoundDeviceCount(WAVE_IN_DEVICE_TYPE); 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 56 Result = MmeGetSoundDeviceCapabilities(WAVE_IN_DEVICE_TYPE, 57 DeviceId, 58 (PVOID) Parameter1, 59 Parameter2); 60 break; 61 } 62 case WIDM_OPEN : 63 { 64 Result = MmeOpenDevice(WAVE_IN_DEVICE_TYPE, 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 105 case DRV_QUERYDEVICEINTERFACESIZE : 106 { 107 Result = MmeGetDeviceInterfaceString(WAVE_IN_DEVICE_TYPE, DeviceId, NULL, 0, (DWORD*)Parameter1); //FIXME DWORD_PTR 108 break; 109 } 110 111 case DRV_QUERYDEVICEINTERFACE : 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 122 ReleaseEntrypointMutex(WAVE_IN_DEVICE_TYPE); 123 124 return Result; 125 } 126