PsychHID(‘KbQueueFlush’)

Psychtoolbox>PsychHID.{mex*} subfunction

[navail] = PsychHID(‘KbQueueFlush’ [, deviceIndex][, flushType=1])

Flushes all scored and unscored keyboard events from a queue.
Returns number of events ‘navail’ in keyboard event buffer before the flush
takes place.
If ‘flushType’ is 0, only the number of currently queued events will be
returned.
If ‘flushType’ is 1, only events returned by KbQueueCheck will be flushed. This
is the default.
If ‘flushType’ is 2, only events returned by KbQueueGetEvent will be flushed.
If ‘flushType’ is 3, events returned by both KbQueueCheck and KbQueueGetEvent
will be flushed.
If ‘flushType’ & 4, only the number of key-press events with valid, mapped ASCII
CookedKey field will be returned.
PsychHID(‘KbQueueCreate’) must be called before this routine.
The optional ‘deviceIndex’ is the index of the HID input device whose queue
should be flushed. If omitted, the queue of the default device will be flushed.

###See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck, KbQueueRelease