1 /* 2 * PROJECT: ReactOS Sound System "MME Buddy" Library 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: lib/sound/mmebuddy/mixer/mxdMessage.c 5 * 6 * PURPOSE: Provides the mxdMessage exported function, as required by 7 * the MME API, for mixer device support. 8 * 9 * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) 10 */ 11 12 #include "precomp.h" 13 14 MMRESULT 15 MmeGetLineInfo( 16 IN UINT DeviceId, 17 IN UINT Message, 18 IN DWORD_PTR PrivateHandle, 19 IN DWORD_PTR Parameter1, 20 IN DWORD_PTR Parameter2) 21 { 22 MMRESULT Result; 23 PSOUND_DEVICE_INSTANCE SoundDeviceInstance; 24 PSOUND_DEVICE SoundDevice; 25 PMMFUNCTION_TABLE FunctionTable; 26 27 //SND_TRACE(L"Getting mixer info %u\n", Message); 28 29 if ( PrivateHandle == 0 ) 30 { 31 Result = GetSoundDevice(MIXER_DEVICE_TYPE, DeviceId, &SoundDevice); 32 33 if ( ! MMSUCCESS(Result) ) 34 return TranslateInternalMmResult(Result); 35 36 Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); 37 if ( ! MMSUCCESS(Result) ) 38 return TranslateInternalMmResult(Result); 39 40 Result = FunctionTable->QueryMixerInfo(NULL, DeviceId, Message, (LPVOID)Parameter1, Parameter2); 41 return Result; 42 } 43 44 VALIDATE_MMSYS_PARAMETER( PrivateHandle ); 45 SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle; 46 47 Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); 48 if ( ! MMSUCCESS(Result) ) 49 return TranslateInternalMmResult(Result); 50 51 Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); 52 if ( ! MMSUCCESS(Result) ) 53 return TranslateInternalMmResult(Result); 54 55 if ( ! FunctionTable->QueryMixerInfo ) 56 return MMSYSERR_NOTSUPPORTED; 57 58 Result = FunctionTable->QueryMixerInfo(SoundDeviceInstance, DeviceId, Message, (LPVOID)Parameter1, Parameter2); 59 60 return Result; 61 } 62 63 64 /* 65 Standard MME driver entry-point for messages relating to mixers. 66 */ 67 DWORD 68 APIENTRY 69 mxdMessage( 70 UINT DeviceId, 71 UINT Message, 72 DWORD_PTR PrivateHandle, 73 DWORD_PTR Parameter1, 74 DWORD_PTR Parameter2) 75 { 76 MMRESULT Result = MMSYSERR_NOTSUPPORTED; 77 78 AcquireEntrypointMutex(MIXER_DEVICE_TYPE); 79 80 //SND_TRACE(L"mxdMessage - Message type %d\n", Message); 81 82 switch ( Message ) 83 { 84 case MXDM_GETNUMDEVS : 85 { 86 Result = GetSoundDeviceCount(MIXER_DEVICE_TYPE); 87 break; 88 } 89 90 case MXDM_GETDEVCAPS : 91 { 92 Result = MmeGetSoundDeviceCapabilities(MIXER_DEVICE_TYPE, 93 DeviceId, 94 (PVOID) Parameter1, 95 Parameter2); 96 break; 97 } 98 99 case MXDM_INIT : 100 { 101 Result = MMSYSERR_NOERROR; 102 break; 103 } 104 105 case MXDM_OPEN : 106 { 107 Result = MmeOpenDevice(MIXER_DEVICE_TYPE, 108 DeviceId, 109 (LPWAVEOPENDESC) Parameter1, /* unused */ 110 Parameter2, 111 (DWORD_PTR*) PrivateHandle); 112 VALIDATE_MMSYS_PARAMETER(*(DWORD_PTR*)PrivateHandle); 113 break; 114 } 115 116 case MXDM_CLOSE : 117 { 118 Result = MmeCloseDevice(PrivateHandle); 119 120 break; 121 } 122 123 case MXDM_GETCONTROLDETAILS : 124 { 125 Result = MmeGetLineInfo(DeviceId, 126 Message, 127 PrivateHandle, 128 Parameter1, 129 Parameter2); 130 131 break; 132 } 133 134 case MXDM_SETCONTROLDETAILS : 135 { 136 Result = MmeGetLineInfo(DeviceId, 137 Message, 138 PrivateHandle, 139 Parameter1, 140 Parameter2); 141 142 break; 143 } 144 145 case MXDM_GETLINECONTROLS : 146 { 147 Result = MmeGetLineInfo(DeviceId, 148 Message, 149 PrivateHandle, 150 Parameter1, 151 Parameter2); 152 153 break; 154 } 155 156 case MXDM_GETLINEINFO : 157 { 158 Result = MmeGetLineInfo(DeviceId, 159 Message, 160 PrivateHandle, 161 Parameter1, 162 Parameter2); 163 164 break; 165 } 166 167 case DRV_QUERYDEVICEINTERFACESIZE : 168 { 169 Result = MmeGetDeviceInterfaceString(MIXER_DEVICE_TYPE, DeviceId, NULL, 0, (DWORD*)Parameter1); //FIXME DWORD_PTR 170 break; 171 } 172 173 case DRV_QUERYDEVICEINTERFACE : 174 { 175 Result = MmeGetDeviceInterfaceString(MIXER_DEVICE_TYPE, DeviceId, (LPWSTR)Parameter1, Parameter2, NULL); //FIXME DWORD_PTR 176 break; 177 } 178 179 } 180 181 //SND_TRACE(L"mxdMessage returning MMRESULT %d\n", Result); 182 183 ReleaseEntrypointMutex(MIXER_DEVICE_TYPE); 184 185 return Result; 186 } 187