summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2013-11-26 16:34:29 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-02 14:34:18 +0100
commitdd11f6d0527bfac17d855909397f66fe816a0d1f (patch)
treeb004fbc5f78f3a3704e386db43d039b2848135bb
parent9b7fd8c7691981bb1d89704f595ebf50daf8876e (diff)
CoreAudio: fix supported input and output channel count.
Only the maximum number of channels was reported as being supported. We now report all possible configurations up to the maximum number of channels to be supported. Task-number: QTBUG-34639 Change-Id: Ib4c599ea8b772ebeaaca95137d24bac49dbd80d3 Reviewed-by: Christian Stromme <christian.stromme@digia.com> Reviewed-by: Ivan Romanov <drizt@land.ru> Reviewed-by: Andy Nichols <andy.nichols@digia.com>
-rw-r--r--src/plugins/coreaudio/coreaudiodeviceinfo.mm25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/plugins/coreaudio/coreaudiodeviceinfo.mm b/src/plugins/coreaudio/coreaudiodeviceinfo.mm
index 77a9b835d..92ce9886f 100644
--- a/src/plugins/coreaudio/coreaudiodeviceinfo.mm
+++ b/src/plugins/coreaudio/coreaudiodeviceinfo.mm
@@ -188,11 +188,11 @@ QList<int> CoreAudioDeviceInfo::supportedSampleRates()
QList<int> CoreAudioDeviceInfo::supportedChannelCounts()
{
- QSet<int> supportedChannels;
+ QList<int> supportedChannels;
+ int maxChannels = 0;
#if defined(Q_OS_OSX)
UInt32 propSize = 0;
- int channels = 0;
AudioObjectPropertyScope scope = m_mode == QAudio::AudioInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
AudioObjectPropertyAddress streamConfigurationPropertyAddress = { kAudioDevicePropertyStreamConfiguration,
scope,
@@ -203,24 +203,25 @@ QList<int> CoreAudioDeviceInfo::supportedChannelCounts()
if (audioBufferList != 0) {
if (AudioObjectGetPropertyData(m_deviceId, &streamConfigurationPropertyAddress, 0, NULL, &propSize, audioBufferList) == noErr) {
- for (int i = 0; i < int(audioBufferList->mNumberBuffers); ++i) {
- channels += audioBufferList->mBuffers[i].mNumberChannels;
- supportedChannels << channels;
- }
+ for (int i = 0; i < int(audioBufferList->mNumberBuffers); ++i)
+ maxChannels += audioBufferList->mBuffers[i].mNumberChannels;
}
free(audioBufferList);
}
}
#else //iOS
- if (m_mode == QAudio::AudioInput) {
- supportedChannels << CoreAudioSessionManager::instance().inputChannelCount();
- } else if (m_mode == QAudio::AudioOutput) {
- supportedChannels << CoreAudioSessionManager::instance().outputChannelCount();
- }
+ if (m_mode == QAudio::AudioInput)
+ maxChannels = CoreAudioSessionManager::instance().inputChannelCount();
+ else if (m_mode == QAudio::AudioOutput)
+ maxChannels = CoreAudioSessionManager::instance().outputChannelCount();
#endif
- return supportedChannels.toList();
+ // Assume all channel configurations are supported up to the maximum number of channels
+ for (int i = 1; i <= maxChannels; ++i)
+ supportedChannels.append(i);
+
+ return supportedChannels;
}