[PD] FLUSH

Michael Casey mkc at media.mit.edu
Tue Jan 22 18:22:13 CET 2002


Hi Eric, Krzysztof,

"flush" messages indicate MIDI input queue over-runs. All MIDI queuing
originates in s_unix.c (a comment suggests rename the file to s_midi.c).
The FLUSH message originates in the function,

void sys_midibytein(int portno, int byte){...}

This function maintains a circular queue of MIDI events. When the queue
fills up, the head hits the tail and this triggers the flush message. The
queue size is defined by MIDIQSIZE and is only 256 bytes. Therefore if PD
does not process the MIDI messages in a reasonable time the queue is
flushed as new messages come in.

For example, I get flush messages when using an electric-field sensing
controller (Fish) with my laptop running Windows 2000 Pro.  The Fish
outputs control change messages at a very high rate and thus fills the
queue rather quickly, therefore yielding said "flush" messages.

To fix this, I use [metro] to downsample all [ctlin] messages using a
[float] buffer for temporary storage between bangs. This way I process
control messages at 50ms intervals but the float buffer updates at the
rate of MIDI control input. This works because the excess messages are
handled efficiently, thus the MIDI-IN event queue drains faster than it
fills.

Best regards,

Michael Casey
http://www.media.mit.edu/~mkc
















More information about the Pd-list mailing list