Important: Please read the Qt Code of Conduct -

Qt5 and USB Sound Box 5.1

  • Dear all,
    I have a USB sound box that allows to output sound in 5.1 audio format. The goal is to use each of 4 available channels indepedently to others. At any time only one of channels is being busy while others just wait.
    I started with QAudioDeviceInfo (Qt5.6 on a 32- and/or 64-bit windows), but the simple code:

    QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); 
    foreach(QAudioDeviceInfo device, devices)     
        qDebug() << device.supportedChannelCounts();

    tells me:

    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) (USB Sound Box line)
    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)

    It thinks that my soundbox supports up to 18 channels - which is definitely wrong. So I started to think that this functionality in Qt5 is a bit raw.
    That is why I'm asking you, could you please give me some recommendations/tips on how to integrate 5.1 usb external sound card into existing Qt5 project in a way described above.
    Thank you in advance!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, on Linux, this information comes from GStreamer. You should also check with it whether you get the same data.

  • @SGaist Thank you for the answer) Linux support doesn't have any priority for this project. Unfortunately, windows - above all. So.. imagine that you have a usb sound card with 4 independent outputs and you need to play track1.mp3 at time_1 and track2.mp3 at time_2 etc. Important note - only one channel/track playing is allowed at any moment. So how do you think what's the easiest way to implement such a functionality?

  • Lifetime Qt Champion

    If I understand your use case correctly, you want to do some advanced mixing/routing. If so then the QtMultimedia module is out of its depth.

    Real-time is also a must ?

  • @SGaist Well.. i guess the word "routing" can be applied in this case. According to current system state the software should decide where (i mean, which audio channel - because of they will be connected to speakers in different rooms) and what to play.. I'm sorry, could you please explain what do you mean saying about realtime?

  • Lifetime Qt Champion

    Then I confirm, QtMultimedia is out of its depth for that kind of stuff. PortAudio might be an interesting alternative and can be easily integrated in a Qt application.

    By realtime I mean applying effects to an audio stream with a minimal delay.

  • @SGaist Thank you for the tip, Sir! I have no experience in sound related area at all, that's why my questions in here might look a bit strange/nooby-style.
    As for realtime - now i see what you mean and, thanks God, there is no need in any sound processing - just play predefined sound files and that's it.

Log in to reply