Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencapabilities.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS Sound System "MME Buddy" Library 00003 * LICENSE: GPL - See COPYING in the top level directory 00004 * FILE: lib/drivers/sound/mmebuddy/capabilities.c 00005 * 00006 * PURPOSE: Queries sound devices for their capabilities. 00007 * 00008 * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) 00009 */ 00010 00011 #include "precomp.h" 00012 00013 /* 00014 Obtains the capabilities of a sound device. This routine ensures that the 00015 supplied CapabilitiesSize parameter at least meets the minimum size of the 00016 relevant capabilities structure. 00017 00018 Ultimately, it will call the GetCapabilities function specified in the 00019 sound device's function table. Note that there are several of these, in a 00020 union. This is simply to avoid manually typecasting when implementing the 00021 functions. 00022 */ 00023 MMRESULT 00024 GetSoundDeviceCapabilities( 00025 IN PSOUND_DEVICE SoundDevice, 00026 IN DWORD DeviceId, 00027 OUT PVOID Capabilities, 00028 IN DWORD CapabilitiesSize) 00029 { 00030 MMDEVICE_TYPE DeviceType; 00031 PMMFUNCTION_TABLE FunctionTable; 00032 BOOLEAN GoodSize = FALSE; 00033 MMRESULT Result; 00034 00035 VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) ); 00036 VALIDATE_MMSYS_PARAMETER( Capabilities ); 00037 VALIDATE_MMSYS_PARAMETER( CapabilitiesSize > 0 ); 00038 00039 /* Obtain the device type */ 00040 Result = GetSoundDeviceType(SoundDevice, &DeviceType); 00041 SND_ASSERT( Result == MMSYSERR_NOERROR ); 00042 00043 if ( ! MMSUCCESS(Result) ) 00044 return TranslateInternalMmResult(Result); 00045 00046 /* Obtain the function table */ 00047 Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); 00048 SND_ASSERT( Result == MMSYSERR_NOERROR ); 00049 00050 if ( ! MMSUCCESS(Result) ) 00051 return TranslateInternalMmResult(Result); 00052 00053 SND_ASSERT( IS_VALID_SOUND_DEVICE_TYPE(DeviceType) ); 00054 00055 /* Check that the capabilities structure is of a valid size */ 00056 switch ( DeviceType ) 00057 { 00058 case WAVE_OUT_DEVICE_TYPE : 00059 { 00060 GoodSize = CapabilitiesSize >= sizeof(WAVEOUTCAPSW); 00061 break; 00062 } 00063 case WAVE_IN_DEVICE_TYPE : 00064 { 00065 GoodSize = CapabilitiesSize >= sizeof(WAVEINCAPSW); 00066 break; 00067 } 00068 case MIDI_OUT_DEVICE_TYPE : 00069 { 00070 GoodSize = CapabilitiesSize >= sizeof(MIDIOUTCAPSW); 00071 break; 00072 } 00073 case MIDI_IN_DEVICE_TYPE : 00074 { 00075 GoodSize = CapabilitiesSize >= sizeof(MIDIINCAPSW); 00076 break; 00077 } 00078 case AUX_DEVICE_TYPE : 00079 { 00080 GoodSize = CapabilitiesSize >= sizeof(AUXCAPSW); 00081 break; 00082 } 00083 case MIXER_DEVICE_TYPE : 00084 { 00085 GoodSize = CapabilitiesSize >= sizeof(MIXERCAPSW); 00086 break; 00087 } 00088 }; 00089 00090 if ( ! GoodSize ) 00091 { 00092 SND_ERR(L"Device capabilities structure too small\n"); 00093 return MMSYSERR_INVALPARAM; 00094 } 00095 00096 /* Call the "get capabilities" function within the function table */ 00097 SND_ASSERT( FunctionTable->GetCapabilities ); 00098 00099 if ( ! FunctionTable->GetCapabilities ) 00100 return MMSYSERR_NOTSUPPORTED; 00101 00102 return FunctionTable->GetCapabilities(SoundDevice, 00103 DeviceId, 00104 Capabilities, 00105 CapabilitiesSize); 00106 } Generated on Fri May 25 2012 04:34:38 for ReactOS by
1.7.6.1
|