[Interest] How to get number of channels from QAudioDeviceInfo
Jason H
jhihn at gmx.com
Fri Jan 22 20:37:43 CET 2016
> Sent: Thursday, January 21, 2016 at 11:07 PM
> From: "Glenn Ramsey" <gr at componic.co.nz>
> To: interest at qt-project.org
> Subject: [Interest] How to get number of channels from QAudioDeviceInfo
>
> Hi,
>
> I would like to use the Qt5.x QtMultiMedia to output sound independently on
> multi-channel devices such as 5.1 and 7.1 sound cards. However I can't figure
> out to tell how many channels a device has.
>
> From the documentation I guess that QAudioDeviceInfo::supportedChannelCounts is
> the call that I need but that isn't giving the answers that I expect.
>
> PyQt5 test program (built with Qt 5.5.1 on OSX 10.10.5):
>
> from PyQt5.QtMultimedia import QAudioDeviceInfo, QAudio, QAudioFormat
>
> for d in QAudioDeviceInfo.availableDevices(QAudio.AudioOutput):
> print d.deviceName(), d.supportedChannelCounts()
> f = QAudioFormat(d.preferredFormat())
> f.setChannelCount(6)
> print d.isFormatSupported(f)
>
> Using OSX 10.10.5 on a MacBook Pro I have a 5.1 USB audio card plugged in and
> the output from the above program is:
>
> Built-in Output [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
> True
> USB Audio [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
> True
>
> I was expecting some information that would tell me that the built in output has
> 2 channels and that 6 isn't supported and the USB audio has 6 channels. I get I
> similar result on Windows 7.
>
> What is the right way to query the number of channels on a device?
I am mucking about the OSX multimedia stuff for an unrelated issue. From what I can tell the backends are for reading an writing multimedia from system sources. I don't know if you can count on Qt to be the equivalent of BandCamp, because so much of AVFoundation works differently from other platforms. Qt does a good job of the common stuff, but I think you'll have to go native for low-level details like that. You could extend Qt to those details or just use AVFoundation/CoreAudio directly.
Or I could be completely wrong. But that's how Interpret what I've seen so far.
More information about the Interest
mailing list