summaryrefslogtreecommitdiffstats
path: root/src/plugins/coreaudio/coreaudiodeviceinfo.mm
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2014-03-06 12:33:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-07 14:58:25 +0100
commit175bdda34701fb3ee9688b40a974a402975b910f (patch)
tree986991f58729fc43f8ce0585666666ae7633d5cb /src/plugins/coreaudio/coreaudiodeviceinfo.mm
parentb6b974361ab000be0585998dabfe8019ad6b39c1 (diff)
CoreAudio: Set default audio category to Playback on iOS
This fixes the issue that when we use QSoundEffect we dont need to get permission to use the microphone. This was because we were defaulting to PlayAndRecord. Now we only switch to the PlayAndRecord category when we try and use an input device. [ChangeLog][QtMultimedia][iOS] Using QSoundEffect (or SoundEffect in QML) no longer requires permission to use the microphone. Change-Id: I94535215497a718005c280bfd84b428b4bf1b16a Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/coreaudio/coreaudiodeviceinfo.mm')
-rw-r--r--src/plugins/coreaudio/coreaudiodeviceinfo.mm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/coreaudio/coreaudiodeviceinfo.mm b/src/plugins/coreaudio/coreaudiodeviceinfo.mm
index bb1f046a6..74a692c10 100644
--- a/src/plugins/coreaudio/coreaudiodeviceinfo.mm
+++ b/src/plugins/coreaudio/coreaudiodeviceinfo.mm
@@ -61,6 +61,11 @@ CoreAudioDeviceInfo::CoreAudioDeviceInfo(const QByteArray &device, QAudio::Mode
m_deviceId = AudioDeviceID(deviceID);
#else //iOS
m_device = device;
+ if (mode == QAudio::AudioInput) {
+ if (CoreAudioSessionManager::instance().category() != CoreAudioSessionManager::PlayAndRecord) {
+ CoreAudioSessionManager::instance().setCategory(CoreAudioSessionManager::PlayAndRecord);
+ }
+ }
#endif
}
@@ -379,6 +384,12 @@ QList<QByteArray> CoreAudioDeviceInfo::availableDevices(QAudio::Mode mode)
}
}
#else //iOS
+ if (mode == QAudio::AudioInput) {
+ if (CoreAudioSessionManager::instance().category() != CoreAudioSessionManager::PlayAndRecord) {
+ CoreAudioSessionManager::instance().setCategory(CoreAudioSessionManager::PlayAndRecord);
+ }
+ }
+
CoreAudioSessionManager::instance().setActive(true);
if (mode == QAudio::AudioOutput)