force use of alsa when using QSound
Unsolved
Qt for Python
-
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?