It can run normally in pyqt5, how to run in pyside6?
-
This code works in pyqt5. But in pyside6, there is no setSampleSize, setCodec, setByteOrder and setSampleType in QAudioFormat. And the usage of QAudioOutput also seems to have changed. How should this code be modified?
class CAudioRender(QObject): def __init__(self, parent=None): super().__init__(parent=parent) self.m_audio_output = 0 self.m_audio_fmt = 0 self.m_io_device = 0 def open_audio_render(self, channels, bits, samples): self.m_audio_fmt = QAudioFormat() self.m_audio_fmt.setChannelCount(2) self.m_audio_fmt.setSampleRate(48000) self.m_audio_fmt.setSampleSize(16) self.m_audio_fmt.setCodec("audio/pcm") self.m_audio_fmt.setByteOrder(QAudioFormat.LittleEndian) self.m_audio_fmt.setSampleType(QAudioFormat.UnSignedInt) self.m_audio_output = QAudioOutput(self.m_audio_fmt, self) self.m_io_device = self.m_audio_output.start() -
The Qt multimedia API has changed in Qt 6, have you checked the Audio output example
https://doc.qt.io/qtforpython-6/examples/example_multimedia_audiooutput.html?
-
The Qt multimedia API has changed in Qt 6, have you checked the Audio output example
https://doc.qt.io/qtforpython-6/examples/example_multimedia_audiooutput.html?
There is also a blog post: https://www.qt.io/blog/qt-multimedia-in-qt-6
-
There is also a blog post: https://www.qt.io/blog/qt-multimedia-in-qt-6
@friedemannkleint Thank you for providing the information, it is very helpful.
-
W WangQi1005 has marked this topic as solved on