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. It can run normally in pyqt5, how to run in pyside6?
Qt 6.11 is out! See what's new in the release blog

It can run normally in pyqt5, how to run in pyside6?

Scheduled Pinned Locked Moved Solved Qt for Python
4 Posts 2 Posters 1.2k 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.
  • W Offline
    W Offline
    WangQi1005
    wrote on last edited by
    #1

    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()
    
    1 Reply Last reply
    0
    • F Offline
      F Offline
      friedemannkleint
      wrote on last edited by friedemannkleint
      #2

      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

      ?

      F 1 Reply Last reply
      1
      • F friedemannkleint

        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

        ?

        F Offline
        F Offline
        friedemannkleint
        wrote on last edited by
        #3

        There is also a blog post: https://www.qt.io/blog/qt-multimedia-in-qt-6

        W 1 Reply Last reply
        1
        • F friedemannkleint

          There is also a blog post: https://www.qt.io/blog/qt-multimedia-in-qt-6

          W Offline
          W Offline
          WangQi1005
          wrote on last edited by
          #4

          @friedemannkleint Thank you for providing the information, it is very helpful.

          1 Reply Last reply
          0
          • W WangQi1005 has marked this topic as solved on

          • Login

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