From 2607d43af54fb0396d1bc3225c5ee7d56239cc4d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Fri, 13 Nov 2015 22:38:44 +0000 Subject: [PATCH] fixed the last remaining compiler warning in this file --- mac/sound.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/mac/sound.cpp b/mac/sound.cpp index 5d0aea41..d0875bce 100755 --- a/mac/sound.cpp +++ b/mac/sound.cpp @@ -142,17 +142,29 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* ar UInt32 iPropertySize; AudioObjectPropertyAddress stPropertyAddress; + stPropertyAddress.mScope = kAudioObjectPropertyScopeGlobal; + stPropertyAddress.mElement = kAudioObjectPropertyElementMaster; + // first get property size of devices array and allocate memory - AudioHardwareGetPropertyInfo ( kAudioHardwarePropertyDevices, - &iPropertySize, - NULL ); + stPropertyAddress.mSelector = kAudioHardwarePropertyDevices; + + AudioObjectGetPropertyDataSize ( kAudioObjectSystemObject, + &stPropertyAddress, + 0, + NULL, + &iPropertySize ); AudioDeviceID* audioDevices = (AudioDeviceID*) malloc ( iPropertySize ); // now actually query all devices present in the system - AudioHardwareGetProperty ( kAudioHardwarePropertyDevices, - &iPropertySize, - audioDevices ); + stPropertyAddress.mSelector = kAudioHardwarePropertyDevices; + + AudioObjectGetPropertyData ( kAudioObjectSystemObject, + &stPropertyAddress, + 0, + NULL, + &iPropertySize, + audioDevices ); // calculate device count based on size of returned data array const UInt32 deviceCount = ( iPropertySize / sizeof ( AudioDeviceID ) ); @@ -163,8 +175,6 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* ar iPropertySize = sizeof ( AudioDeviceID ); stPropertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; - stPropertyAddress.mScope = kAudioObjectPropertyScopeGlobal; - stPropertyAddress.mElement = kAudioObjectPropertyElementMaster; if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject, &stPropertyAddress, @@ -179,8 +189,6 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* ar iPropertySize = sizeof ( AudioDeviceID ); stPropertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; - stPropertyAddress.mScope = kAudioObjectPropertyScopeGlobal; - stPropertyAddress.mElement = kAudioObjectPropertyElementMaster; if ( AudioObjectGetPropertyData ( kAudioObjectSystemObject, &stPropertyAddress,