diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-11-09 20:49:54 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-11-09 20:49:54 +0000 |
| commit | 4d55a8b8254dff61fdc7b1959f6aef7eafbd9439 (patch) | |
| tree | fb5e56131a7c8b729641c70e7a87883ebaea5186 /macosx/plugins/Common/SDL/src | |
| parent | 71d6c56271e2650b1a2f5149521a5b1896084710 (diff) | |
| download | pcsxr-4d55a8b8254dff61fdc7b1959f6aef7eafbd9439.tar.gz | |
Patch 10767 (Durandal_1707).
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@72138 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/Common/SDL/src')
| -rw-r--r-- | macosx/plugins/Common/SDL/src/audio/macosx/SDL_coreaudio.c | 86 | ||||
| -rw-r--r-- | macosx/plugins/Common/SDL/src/haptic/darwin/SDL_syshaptic.c | 42 |
2 files changed, 70 insertions, 58 deletions
diff --git a/macosx/plugins/Common/SDL/src/audio/macosx/SDL_coreaudio.c b/macosx/plugins/Common/SDL/src/audio/macosx/SDL_coreaudio.c index 7d453a9c..0185e94f 100644 --- a/macosx/plugins/Common/SDL/src/audio/macosx/SDL_coreaudio.c +++ b/macosx/plugins/Common/SDL/src/audio/macosx/SDL_coreaudio.c @@ -64,18 +64,21 @@ static void build_device_list(int iscapture, COREAUDIO_DeviceList ** devices, int *devCount) { - Boolean outWritable = 0; OSStatus result = noErr; UInt32 size = 0; - AudioDeviceID *devs = NULL; + AudioObjectPropertyAddress propaddr; + AudioObjectID *devs = NULL; UInt32 i = 0; UInt32 max = 0; free_device_list(devices, devCount); - result = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, - &size, &outWritable); - + propaddr.mSelector = kAudioHardwarePropertyDevices; + propaddr.mScope = kAudioObjectPropertyScopeGlobal; + propaddr.mElement = kAudioObjectPropertyElementMaster; + + result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propaddr, 0, NULL, &size); + if (result != kAudioHardwareNoError) return; @@ -87,33 +90,32 @@ build_device_list(int iscapture, COREAUDIO_DeviceList ** devices, *devices = (COREAUDIO_DeviceList *) SDL_malloc(max * sizeof(**devices)); if (*devices == NULL) return; - - result = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, - &size, devs); + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propaddr, 0, NULL, &size, devs); if (result != kAudioHardwareNoError) return; for (i = 0; i < max; i++) { CFStringRef cfstr = NULL; char *ptr = NULL; - AudioDeviceID dev = devs[i]; + AudioObjectID dev = devs[i]; AudioBufferList *buflist = NULL; int usable = 0; CFIndex len = 0; - - result = AudioDeviceGetPropertyInfo(dev, 0, iscapture, - kAudioDevicePropertyStreamConfiguration, - &size, &outWritable); + + propaddr.mSelector = kAudioDevicePropertyStreamConfiguration; + propaddr.mScope = iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; + propaddr.mElement = kAudioObjectPropertyElementMaster; + + result = AudioObjectGetPropertyDataSize(dev, &propaddr, 0, NULL, &size); if (result != noErr) continue; buflist = (AudioBufferList *) SDL_malloc(size); if (buflist == NULL) continue; - - result = AudioDeviceGetProperty(dev, 0, iscapture, - kAudioDevicePropertyStreamConfiguration, - &size, buflist); + + result = AudioObjectGetPropertyData(dev, &propaddr, 0, NULL, &size, buflist); if (result == noErr) { UInt32 j; @@ -124,17 +126,19 @@ build_device_list(int iscapture, COREAUDIO_DeviceList ** devices, } } } - + SDL_free(buflist); - + if (!usable) continue; - + size = sizeof(CFStringRef); - result = AudioDeviceGetProperty(dev, 0, iscapture, - kAudioDevicePropertyDeviceNameCFString, - &size, &cfstr); - + propaddr.mSelector = kAudioDevicePropertyDeviceNameCFString; + propaddr.mScope = iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; + propaddr.mElement = kAudioObjectPropertyElementMaster; + + result = AudioObjectGetPropertyData(dev, &propaddr, 0, NULL, &size, &cfstr); + if (result != kAudioHardwareNoError) continue; @@ -364,20 +368,22 @@ COREAUDIO_CloseDevice(_THIS) static int find_device_by_name(_THIS, const char *devname, int iscapture) { - AudioDeviceID devid = 0; + AudioObjectID devid = 0; + AudioObjectPropertyAddress devaddr; OSStatus result = noErr; UInt32 size = 0; UInt32 alive = 0; pid_t pid = 0; if (devname == NULL) { - size = sizeof(AudioDeviceID); - const AudioHardwarePropertyID propid = - ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice : - kAudioHardwarePropertyDefaultOutputDevice); - - result = AudioHardwareGetProperty(propid, &size, &devid); - CHECK_RESULT("AudioHardwareGetProperty (default device)"); + size = sizeof(devid); + AudioObjectPropertyAddress propaddr; + propaddr.mSelector = ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice); + propaddr.mScope = kAudioObjectPropertyScopeGlobal; + propaddr.mElement = kAudioObjectPropertyElementMaster; + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propaddr, 0, NULL, &size, &devid); + CHECK_RESULT("AudioObjectGetPropertyData (default device)"); } else { if (!find_device_id(devname, iscapture, &devid)) { SDL_SetError("CoreAudio: No such audio device."); @@ -386,9 +392,12 @@ find_device_by_name(_THIS, const char *devname, int iscapture) } size = sizeof(alive); - result = AudioDeviceGetProperty(devid, 0, iscapture, - kAudioDevicePropertyDeviceIsAlive, - &size, &alive); + devaddr.mSelector = kAudioDevicePropertyDeviceIsAlive; + devaddr.mScope = iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; + devaddr.mElement = kAudioObjectPropertyElementMaster; + + result = AudioObjectGetPropertyData(devid, &devaddr, 0, NULL, &size, &alive); + CHECK_RESULT ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"); @@ -398,8 +407,11 @@ find_device_by_name(_THIS, const char *devname, int iscapture) } size = sizeof(pid); - result = AudioDeviceGetProperty(devid, 0, iscapture, - kAudioDevicePropertyHogMode, &size, &pid); + devaddr.mSelector = kAudioDevicePropertyHogMode; + devaddr.mScope = iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput; + devaddr.mElement = kAudioObjectPropertyElementMaster; + + result = AudioObjectGetPropertyData(devid, &devaddr, 0, NULL, &size, &pid); /* some devices don't support this property, so errors are fine here. */ if ((result == noErr) && (pid != -1)) { diff --git a/macosx/plugins/Common/SDL/src/haptic/darwin/SDL_syshaptic.c b/macosx/plugins/Common/SDL/src/haptic/darwin/SDL_syshaptic.c index 48a7c45c..9473b794 100644 --- a/macosx/plugins/Common/SDL/src/haptic/darwin/SDL_syshaptic.c +++ b/macosx/plugins/Common/SDL/src/haptic/darwin/SDL_syshaptic.c @@ -90,48 +90,48 @@ static const char * FFStrError(HRESULT err) { switch (err) { - case FFERR_DEVICEFULL: + case (HRESULT)FFERR_DEVICEFULL: return "device full"; /* This should be valid, but for some reason isn't defined... */ /*case FFERR_DEVICENOTREG: return "device not registered"; */ - case FFERR_DEVICEPAUSED: + case (HRESULT)FFERR_DEVICEPAUSED: return "device paused"; - case FFERR_DEVICERELEASED: + case (HRESULT)FFERR_DEVICERELEASED: return "device released"; - case FFERR_EFFECTPLAYING: + case (HRESULT)FFERR_EFFECTPLAYING: return "effect playing"; - case FFERR_EFFECTTYPEMISMATCH: + case (HRESULT)FFERR_EFFECTTYPEMISMATCH: return "effect type mismatch"; - case FFERR_EFFECTTYPENOTSUPPORTED: + case (HRESULT)FFERR_EFFECTTYPENOTSUPPORTED: return "effect type not supported"; - case FFERR_GENERIC: + case (HRESULT)FFERR_GENERIC: return "undetermined error"; - case FFERR_HASEFFECTS: + case (HRESULT)FFERR_HASEFFECTS: return "device has effects"; - case FFERR_INCOMPLETEEFFECT: + case (HRESULT)FFERR_INCOMPLETEEFFECT: return "incomplete effect"; - case FFERR_INTERNAL: + case (HRESULT)FFERR_INTERNAL: return "internal fault"; - case FFERR_INVALIDDOWNLOADID: + case (HRESULT)FFERR_INVALIDDOWNLOADID: return "invalid download id"; - case FFERR_INVALIDPARAM: + case (HRESULT)FFERR_INVALIDPARAM: return "invalid parameter"; - case FFERR_MOREDATA: + case (HRESULT)FFERR_MOREDATA: return "more data"; - case FFERR_NOINTERFACE: + case (HRESULT)FFERR_NOINTERFACE: return "interface not supported"; - case FFERR_NOTDOWNLOADED: + case (HRESULT)FFERR_NOTDOWNLOADED: return "effect is not downloaded"; - case FFERR_NOTINITIALIZED: + case (HRESULT)FFERR_NOTINITIALIZED: return "object has not been initialized"; - case FFERR_OUTOFMEMORY: + case (HRESULT)FFERR_OUTOFMEMORY: return "out of memory"; - case FFERR_UNPLUGGED: + case (HRESULT)FFERR_UNPLUGGED: return "device is unplugged"; - case FFERR_UNSUPPORTED: + case (HRESULT)FFERR_UNSUPPORTED: return "function call unsupported"; - case FFERR_UNSUPPORTEDAXIS: + case (HRESULT)FFERR_UNSUPPORTEDAXIS: return "axis unsupported"; default: @@ -426,7 +426,7 @@ SDL_SYS_HapticOpenFromService(SDL_Haptic * haptic, io_service_t service) /* Get supported features. */ ret2 = GetSupportedFeatures(haptic); - if (haptic->supported < 0) { + if (ret2 < 0) { goto open_err; } |
