Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Joystick event queue

Describes how the joystick event queue is implemented.

The Brew MP event queue

The event queue limits the number of events so that the queue does not use too much memory. The maximum number of joystick events, pointer events, and jogdial events that the queue can hold is 50 for each type of event.

Joystick events

There are two event counters for joystick, one that counts the number of moves in the queue (which is used to determine events that are dropped), and the other that counts the number of events received so far (including both events dropped and events queued).

Incoming joystick events are queued and dropped according to the following rules:

  • If the number of moves in the queue < 30, then no events are dropped.
  • If the number of moves in the queue is between 30 and 39, then every even-numbered incoming event is added to the queue, and other incoming events are dropped.
  • If the number of moves in the queue is between 40 and 44, then every third incoming event is added to the queue, and other incoming events are dropped.
  • If the number of moves in the queue is between 45 and 48, then every fourth incoming event is added to the queue, and other incoming events are dropped.
  • If the number of moves in the queue is 49, then every fifth incoming event is added to the queue, and other incoming events are dropped.
  • If the number of moves in the queue > 50, then all incoming events are dropped.