Improve midi responsiveness and add error checking

Bug #635872 reported by Guy Martin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Medium
Guy Martin
1.8
Fix Released
Medium
Guy Martin

Bug Description

The attached patch does 2 things :
 - add error checking when reading midi messages
 - only sleep if there are no new midi messages after processing the current ones

This should slightly improve responsiveness when a lot of midi messages are being received.
When adding some debugging, it's mostly useful for sliders which generate a lot of messages.

Related branches

Revision history for this message
Guy Martin (gmsoft) wrote :
Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Hey Guy,

Thanks for the patch! A couple notes:

The check for events coming during the processing time should be done within the if (m_pInputStream) block in case m_pInputStream is NULL.

The m_sPMLock is not unlocked before usleep'ing, so multiple PortMIDI devices may fight over this lock since it is shared across all PortMIDI devices.

Are all PortMIDI errors (Pm_Poll or Pm_Read returning <0) unrecoverable? Given the error checking you added, it will break out of the processing loop, causing the device to need to be re-enabled in the preferences.

I've fixed 1+2 and once I learn the answer to 3 I'll commit this.

RJ

Thanks,
RJ

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

I'm wondering if this could have something to do with us losing random MIDI messages sent to devices on Linux. If we were only polling PortMIDI every 5ms, this might have led to overflows. Though that was with sending messages and this is for receiving them.

Changed in mixxx:
status: New → Confirmed
assignee: nobody → Guy Martin (gmsoft)
importance: Undecided → Medium
Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

After reading some of the PortMIDI docs it looks like errors are often things like buffer-overflow and the like, which aren't unrecoverable. I'm going to take the break statements out and commit this. Thanks again!

RJ Skerry-Ryan (rryan)
Changed in mixxx:
status: Confirmed → Fix Committed
RJ Skerry-Ryan (rryan)
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/5512

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.