fixed two warnings
This commit is contained in:
parent
233c34ba45
commit
15e44213a7
1 changed files with 50 additions and 35 deletions
|
@ -140,6 +140,7 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
|
|||
|
||||
// Get available input/output devices --------------------------------------
|
||||
UInt32 iPropertySize;
|
||||
AudioObjectPropertyAddress stPropertyAddress;
|
||||
|
||||
// first get property size of devices array and allocate memory
|
||||
AudioHardwareGetPropertyInfo ( kAudioHardwarePropertyDevices,
|
||||
|
@ -161,12 +162,12 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
|
|||
strDriverNames[lNumDevs] = "System Default In/Out Devices";
|
||||
|
||||
iPropertySize = sizeof ( AudioDeviceID );
|
||||
AudioObjectPropertyAddress ePropertyInDevAddress = { kAudioHardwarePropertyDefaultInputDevice,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster };
|
||||
stPropertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
||||
stPropertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
stPropertyAddress.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject,
|
||||
&ePropertyInDevAddress,
|
||||
&stPropertyAddress,
|
||||
0,
|
||||
NULL,
|
||||
&iPropertySize,
|
||||
|
@ -177,12 +178,12 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* ar
|
|||
}
|
||||
|
||||
iPropertySize = sizeof ( AudioDeviceID );
|
||||
AudioObjectPropertyAddress ePropertyOutDevAddress = { kAudioHardwarePropertyDefaultOutputDevice,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster };
|
||||
stPropertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||
stPropertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
stPropertyAddress.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject,
|
||||
&ePropertyOutDevAddress,
|
||||
&stPropertyAddress,
|
||||
0,
|
||||
NULL,
|
||||
&iPropertySize,
|
||||
|
@ -247,14 +248,46 @@ void CSound::GetAudioDeviceInfos ( const AudioDeviceID DeviceID,
|
|||
bool& bIsInput,
|
||||
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
|
||||
UInt32 iPropertySize = sizeof ( CFStringRef );
|
||||
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,
|
||||
false,
|
||||
kAudioObjectPropertyName,
|
||||
NULL,
|
||||
&iPropertySize,
|
||||
&sPropertyStringValue );
|
||||
|
||||
|
@ -275,24 +308,6 @@ void CSound::GetAudioDeviceInfos ( const AudioDeviceID DeviceID,
|
|||
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 )
|
||||
|
|
Loading…
Reference in a new issue