mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 07:52:55 +02:00
mac build fix
This commit is contained in:
parent
358f042f32
commit
52637320f0
1 changed files with 24 additions and 27 deletions
|
@ -517,40 +517,37 @@ QString defaultAudioDeviceName(QAudio::Mode mode) {
|
||||||
QString deviceName;
|
QString deviceName;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (devices.size() > 1) {
|
AudioDeviceID defaultDeviceID = 0;
|
||||||
AudioDeviceID defaultDeviceID = 0;
|
uint32_t propertySize = sizeof(AudioDeviceID);
|
||||||
uint32_t propertySize = sizeof(AudioDeviceID);
|
AudioObjectPropertyAddress propertyAddress = {
|
||||||
AudioObjectPropertyAddress propertyAddress = {
|
kAudioHardwarePropertyDefaultInputDevice,
|
||||||
kAudioHardwarePropertyDefaultInputDevice,
|
kAudioObjectPropertyScopeGlobal,
|
||||||
kAudioObjectPropertyScopeGlobal,
|
kAudioObjectPropertyElementMaster
|
||||||
kAudioObjectPropertyElementMaster
|
};
|
||||||
};
|
|
||||||
|
|
||||||
if (mode == QAudio::AudioOutput) {
|
if (mode == QAudio::AudioOutput) {
|
||||||
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OSStatus getPropertyError = AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
OSStatus getPropertyError = AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
||||||
&propertyAddress,
|
&propertyAddress,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
&propertySize,
|
&propertySize,
|
||||||
&defaultDeviceID);
|
&defaultDeviceID);
|
||||||
|
|
||||||
|
if (!getPropertyError && propertySize) {
|
||||||
|
CFStringRef devName = NULL;
|
||||||
|
propertySize = sizeof(devName);
|
||||||
|
propertyAddress.mSelector = kAudioDevicePropertyDeviceNameCFString;
|
||||||
|
getPropertyError = AudioObjectGetPropertyData(defaultDeviceID, &propertyAddress, 0,
|
||||||
|
NULL, &propertySize, &devName);
|
||||||
|
|
||||||
if (!getPropertyError && propertySize) {
|
if (!getPropertyError && propertySize) {
|
||||||
CFStringRef deviceName = NULL;
|
deviceName = CFStringGetCStringPtr(devName, kCFStringEncodingMacRoman));
|
||||||
propertySize = sizeof(deviceName);
|
|
||||||
propertyAddress.mSelector = kAudioDevicePropertyDeviceNameCFString;
|
|
||||||
getPropertyError = AudioObjectGetPropertyData(defaultDeviceID, &propertyAddress, 0,
|
|
||||||
NULL, &propertySize, &deviceName);
|
|
||||||
|
|
||||||
if (!getPropertyError && propertySize) {
|
|
||||||
deviceName = CFStringGetCStringPtr(deviceName, kCFStringEncodingMacRoman));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
//Check for Windows Vista or higher, IMMDeviceEnumerator doesn't work below that.
|
//Check for Windows Vista or higher, IMMDeviceEnumerator doesn't work below that.
|
||||||
|
|
Loading…
Reference in a new issue