Improve midi responsiveness and add error checking

Bug #635872 reported by Guy Martin on 2010-09-11
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Guy Martin
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

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 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
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) on 2010-09-14
Changed in mixxx:
status: Confirmed → Fix Committed
RJ Skerry-Ryan (rryan) on 2010-10-05
Changed in mixxx:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers