Important: Please read the Qt Code of Conduct -

Phonon: only one output device

  • Hi,
    I have usb sound cards and i want to play music on this cards. Unfortunetly phonon don't see my card.

    When i'm waiting on notify signal:
    @connect(Phonon::BackendCapabilities::notifier(), SIGNAL(availableAudioOutputDevicesChanged()), this, SLOT(devicesChanged()));@
    I got only 1 device.

    In console i can see two cards: pactl list
    @Card #1
    Name: alsa_card.pci-0000_00_1b.0
    Driver: module-alsa-card.c
    Owner Module: 26
    alsa.card = "0"
    alsa.card_name = "HDA Intel PCH"
    alsa.long_card_name = "HDA Intel PCH at 0xd3610000 irq 46"
    alsa.driver_name = "snd_hda_intel"
    device.bus_path = "pci-0000:00:1b.0"
    sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"

    Card #2
    Name: alsa_card.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00-Device
    Driver: module-alsa-card.c
    Owner Module: 29
    alsa.card = "1"
    alsa.card_name = "USB PnP Sound Device"
    alsa.long_card_name = "C-Media Electronics Inc. USB PnP Sound Device at usb-0000:00:14.0-2.2, full spe"
    alsa.driver_name = "snd_usb_audio"
    device.bus_path = "pci-0000:00:14.0-usb-0:2.2:1.0"
    sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.0/sound/card1"

    Can you help?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What Distribution/Desktop environment are you running ?

  • Arch linux, XFCE with pulseaudio.

    When i call "QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)" i got 3 devices. This is ok but how to connect this with phonon?

    Any ideas?

  • How to use multiple sound cards to play mp3 or internet radio in QT? Can anyone help?

  • Lifetime Qt Champion

    IIRC, using phonon, you'll use what the backend is setup to use e.g. pulseaudio.

    If you want to play with several outputs at the same time, you should rather look at QtMultimedia

  • Do you have some examples how to do that? I know how to play (raw formats)wave but how to play mp3 or internet radio using QtMultimedia?

  • Lifetime Qt Champion

    QMediaPlayer comes to mind

  • In QMediaPlayer i can't found way to set output device.
    Do you know how to set it? I even looked at the code but i don't know how it works :/

  • Lifetime Qt Champion

    AFAIK, you can't just simply set it. You have to get a QAudioEndpointSelector from QMediaPlayer. However it might not be implement in all backends

  • I have Qt 5.3.1 and can't find QAudioEndpointSelector class.
    About what version Qt you are talking about? Do you have an example?

  • Lifetime Qt Champion

    Sorry, my bad it's a class from QtMobility, it's QAudioOutputSelectorControl that I was thinking about

  • What the qt-mobility is? It sounds like lib for mobile devices. Can i use it in desktop app?

  • Lifetime Qt Champion

    It was for the Qt 4 series, some of the classes have been integrated in Qt 5 others might need porting.

    Yes you can,

  • I don't know how to do that.
    Maybe you know some other C++ library than qt where can i play music on multiple sound cards? I use it on linux and want play music from internet radio.

  • Lifetime Qt Champion

    You can have a look at GStreamer and QGStreamer

Log in to reply