Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. threading strategy question

threading strategy question

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 296 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.
  • VStevenPV Offline
    VStevenPV Offline
    VStevenP
    wrote on last edited by
    #1

    I use RtMidi for MIDI I/O support in my QtQuick application (https://github.com/thestk/rtmidi). I also use qmlmidi to easily use RtMidi from QML (https://github.com/jarnoh/qmlmidi).

    Now I would like to move the MIDI I/O operations to another thread(s), because in my application, the graphical knob updates can become slow when MIDI traffic is high and when there is a lot of pre-post MIDI processing to do.

    What is the best approach? I've read the QThread documentation, but it is not quite obvious which strategy I should use. I'm trying to think it through.

    I suppose I need a class that inherits from QAbstractListModel, which I can expose to QML via the root context, to provide data values to my on-screen graphical knobs. I guess this class should be instatiated in main() and root context set there. It is in the main thread.

    Then this class would have its model populated from the MIDI I/O results. Maybe I would have a "MIDI In" Worker object and also a "MIDI Out" Worker object, and each one would have its own Controller class with its own QThread.

    Finally, the object of my class which is derived from AbstractListModel model would need to interact with the Worker objects for MIDI In and Out via signals/slots.

    Is this approach reasonable?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      You are trying to create the MIDI objects in separate thread & trying to push the data using the signal/slot to model. This approach can be taken.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0

      • Login

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