Commit 1ea43749 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Cleaned out functions deprecated in Mac OS X 10.6 SDK.

parent 51254fce
...@@ -67,16 +67,20 @@ findDevId(const char *name, AudioDeviceID devId, void *_data) ...@@ -67,16 +67,20 @@ findDevId(const char *name, AudioDeviceID devId, void *_data)
static void static void
build_device_list(int iscapture, addDevFn addfn, void *addfndata) build_device_list(int iscapture, addDevFn addfn, void *addfndata)
{ {
Boolean outWritable = 0;
OSStatus result = noErr; OSStatus result = noErr;
UInt32 size = 0; UInt32 size = 0;
AudioDeviceID *devs = NULL; AudioDeviceID *devs = NULL;
UInt32 i = 0; UInt32 i = 0;
UInt32 max = 0; UInt32 max = 0;
result = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, AudioObjectPropertyAddress addr = {
&size, &outWritable); kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster
};
result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &addr,
0, NULL, &size);
if (result != kAudioHardwareNoError) if (result != kAudioHardwareNoError)
return; return;
...@@ -84,8 +88,8 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata) ...@@ -84,8 +88,8 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
if (devs == NULL) if (devs == NULL)
return; return;
result = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr,
&size, devs); 0, NULL, &size, devs);
if (result != kAudioHardwareNoError) if (result != kAudioHardwareNoError)
return; return;
...@@ -98,9 +102,11 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata) ...@@ -98,9 +102,11 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
int usable = 0; int usable = 0;
CFIndex len = 0; CFIndex len = 0;
result = AudioDeviceGetPropertyInfo(dev, 0, iscapture, addr.mScope = iscapture ? kAudioDevicePropertyScopeInput :
kAudioDevicePropertyStreamConfiguration, kAudioDevicePropertyScopeOutput;
&size, &outWritable); addr.mSelector = kAudioDevicePropertyStreamConfiguration;
result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size);
if (result != noErr) if (result != noErr)
continue; continue;
...@@ -108,9 +114,8 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata) ...@@ -108,9 +114,8 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
if (buflist == NULL) if (buflist == NULL)
continue; continue;
result = AudioDeviceGetProperty(dev, 0, iscapture, result = AudioObjectGetPropertyData(dev, &addr, 0, NULL,
kAudioDevicePropertyStreamConfiguration, &size, buflist);
&size, buflist);
if (result == noErr) { if (result == noErr) {
UInt32 j; UInt32 j;
...@@ -127,11 +132,9 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata) ...@@ -127,11 +132,9 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
if (!usable) if (!usable)
continue; continue;
size = sizeof(CFStringRef); addr.mSelector = kAudioObjectPropertyName;
result = AudioDeviceGetProperty(dev, 0, iscapture, size = sizeof (CFStringRef);
kAudioDevicePropertyDeviceNameCFString, result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, &size, &cfstr);
&size, &cfstr);
if (result != kAudioHardwareNoError) if (result != kAudioHardwareNoError)
continue; continue;
...@@ -183,13 +186,19 @@ find_device_by_name(_THIS, const char *devname, int iscapture) ...@@ -183,13 +186,19 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
UInt32 alive = 0; UInt32 alive = 0;
pid_t pid = 0; pid_t pid = 0;
AudioObjectPropertyAddress addr = {
0,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster
};
if (devname == NULL) { if (devname == NULL) {
size = sizeof(AudioDeviceID); size = sizeof (AudioDeviceID);
const AudioHardwarePropertyID propid = addr.mSelector =
((iscapture) ? kAudioHardwarePropertyDefaultInputDevice : ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice :
kAudioHardwarePropertyDefaultOutputDevice); kAudioHardwarePropertyDefaultOutputDevice);
result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr,
result = AudioHardwareGetProperty(propid, &size, &devid); 0, NULL, &size, &devid);
CHECK_RESULT("AudioHardwareGetProperty (default device)"); CHECK_RESULT("AudioHardwareGetProperty (default device)");
} else { } else {
FindDevIdData data; FindDevIdData data;
...@@ -203,10 +212,12 @@ find_device_by_name(_THIS, const char *devname, int iscapture) ...@@ -203,10 +212,12 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
devid = data.devId; devid = data.devId;
} }
size = sizeof(alive); addr.mSelector = kAudioDevicePropertyDeviceIsAlive;
result = AudioDeviceGetProperty(devid, 0, iscapture, addr.mScope = iscapture ? kAudioDevicePropertyScopeInput :
kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyScopeOutput;
&size, &alive);
size = sizeof (alive);
result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive);
CHECK_RESULT CHECK_RESULT
("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"); ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)");
...@@ -215,9 +226,9 @@ find_device_by_name(_THIS, const char *devname, int iscapture) ...@@ -215,9 +226,9 @@ find_device_by_name(_THIS, const char *devname, int iscapture)
return 0; return 0;
} }
size = sizeof(pid); addr.mSelector = kAudioDevicePropertyHogMode;
result = AudioDeviceGetProperty(devid, 0, iscapture, size = sizeof (pid);
kAudioDevicePropertyHogMode, &size, &pid); result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid);
/* some devices don't support this property, so errors are fine here. */ /* some devices don't support this property, so errors are fine here. */
if ((result == noErr) && (pid != -1)) { if ((result == noErr) && (pid != -1)) {
......
...@@ -30,7 +30,7 @@ typedef struct ...@@ -30,7 +30,7 @@ typedef struct
typedef struct typedef struct
{ {
CFDictionaryRef moderef; const void *moderef;
} SDL_DisplayModeData; } SDL_DisplayModeData;
extern void Cocoa_InitModes(_THIS); extern void Cocoa_InitModes(_THIS);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment