fixed two warnings

This commit is contained in:
Volker Fischer 2015-11-13 21:41:07 +00:00
parent 233c34ba45
commit 15e44213a7

View file

@ -140,6 +140,7 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
// Get available input/output devices -------------------------------------- // Get available input/output devices --------------------------------------
UInt32 iPropertySize; UInt32 iPropertySize;
AudioObjectPropertyAddress stPropertyAddress;
// first get property size of devices array and allocate memory // first get property size of devices array and allocate memory
AudioHardwareGetPropertyInfo ( kAudioHardwarePropertyDevices, AudioHardwareGetPropertyInfo ( kAudioHardwarePropertyDevices,
@ -161,12 +162,12 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
strDriverNames[lNumDevs] = "System Default In/Out Devices"; strDriverNames[lNumDevs] = "System Default In/Out Devices";
iPropertySize = sizeof ( AudioDeviceID ); iPropertySize = sizeof ( AudioDeviceID );
AudioObjectPropertyAddress ePropertyInDevAddress = { kAudioHardwarePropertyDefaultInputDevice, stPropertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice;
kAudioObjectPropertyScopeGlobal, stPropertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
kAudioObjectPropertyElementMaster }; stPropertyAddress.mElement = kAudioObjectPropertyElementMaster;
if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject, if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject,
&ePropertyInDevAddress, &stPropertyAddress,
0, 0,
NULL, NULL,
&iPropertySize, &iPropertySize,
@ -177,12 +178,12 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
} }
iPropertySize = sizeof ( AudioDeviceID ); iPropertySize = sizeof ( AudioDeviceID );
AudioObjectPropertyAddress ePropertyOutDevAddress = { kAudioHardwarePropertyDefaultOutputDevice, stPropertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
kAudioObjectPropertyScopeGlobal, stPropertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
kAudioObjectPropertyElementMaster }; stPropertyAddress.mElement = kAudioObjectPropertyElementMaster;
if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject, if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject,
&ePropertyOutDevAddress, &stPropertyAddress,
0, 0,
NULL, NULL,
&iPropertySize, &iPropertySize,
@ -247,14 +248,46 @@ void CSound::GetAudioDeviceInfos ( const AudioDeviceID DeviceID,
bool& bIsInput, bool& bIsInput,
bool& bIsOutput ) bool& bIsOutput )
{ {
// check if device is input or output or both (is that possible?)
// we do this by trying to set the current device for the audio unit
// with the parameter input and output and then we simply check the
// error/ok result
bIsInput = !AudioUnitSetProperty ( audioInputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
1,
&DeviceID,
sizeof ( AudioDeviceID ) );
bIsOutput = !AudioUnitSetProperty ( audioOutputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&DeviceID,
sizeof ( AudioDeviceID ) );
// get property name // get property name
UInt32 iPropertySize = sizeof ( CFStringRef ); UInt32 iPropertySize = sizeof ( CFStringRef );
CFStringRef sPropertyStringValue; CFStringRef sPropertyStringValue;
AudioDeviceGetProperty ( DeviceID, AudioObjectPropertyAddress stPropertyAddress;
stPropertyAddress.mSelector = kAudioObjectPropertyName;
if ( bIsInput )
{
stPropertyAddress.mScope = kAudioDevicePropertyScopeInput;
}
else
{
stPropertyAddress.mScope = kAudioDevicePropertyScopeOutput;
}
stPropertyAddress.mElement = 0; // channel
AudioObjectGetPropertyData ( DeviceID,
&stPropertyAddress,
0, 0,
false, NULL,
kAudioObjectPropertyName,
&iPropertySize, &iPropertySize,
&sPropertyStringValue ); &sPropertyStringValue );
@ -275,24 +308,6 @@ void CSound::GetAudioDeviceInfos ( const AudioDeviceID DeviceID,
strDeviceName = sC_strPropValue; strDeviceName = sC_strPropValue;
} }
} }
// check if device is input or output or both (is that possible?)
// we do this by trying to set the current device for the audio unit
// with the parameter input and output and then we simply check the
// error/ok result
bIsInput = !AudioUnitSetProperty ( audioInputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
1,
&DeviceID,
sizeof ( AudioDeviceID ) );
bIsOutput = !AudioUnitSetProperty ( audioOutputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&DeviceID,
sizeof ( AudioDeviceID ) );
} }
QString CSound::LoadAndInitializeDriver ( int iDriverIdx ) QString CSound::LoadAndInitializeDriver ( int iDriverIdx )