Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. force use of alsa when using QSound
Forum Updated to NodeBB v4.3 + New Features

force use of alsa when using QSound

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 375 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rhx9
    wrote on 10 Apr 2021, 22:02 last edited by
    #1

    Hi,
    I'm trying to run a qt app in a raspberry pi in a minimal fashion.
    to keep things minimal i opted not to install pulseaudio and instead use just also.
    now when I play an audio file qt tries to play it using pulseaudio instead of alsa, how can I tell it to use alsa instead?

    a simple app to demonstrate the problem:

    import sys
    from PyQt5 import QtWidgets as qtw
    
    from PyQt5.QtMultimedia import QSound,QAudioDeviceInfo,QAudio
    
    
    class mainwindow(qtw.QWidget):
        def __init__(self,*args, **kwargs):
            
            super().__init__(*args, **kwargs)
            self.gridLayout = qtw.QGridLayout()
            self.setLayout(self.gridLayout)
            self.press = qtw.QPushButton('play sound')
            self.gridLayout.addWidget(self.press,1,1,1,1)
            say = QSound("reactivate.wav")
            self.press.clicked.connect(lambda:say.play())
            self.show()
    
    
    
    app = qtw.QApplication(sys.argv)
    
    w = mainwindow()
    ret = app.exec_()
    sys.exit(ret)
    

    when running the app on a system that uses pulseaudio or in windows the app works as expected, but when I move the app to the raspberrypi and run it it shows this:

    PulseAudioService: pa_context_connect() failed
    which should obviously not be happening since it should fallback to alsa, so how can I force qt to use alsa instead?

    1 Reply Last reply
    0

    1/1

    10 Apr 2021, 22:02

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved