def read_pending_actions
      Array(input).collect do |midi_message|
        (code, note, velocity) = midi_message[:message]
        data = {
          :timestamp  => midi_message[:timestamp],
          :state      => (velocity == 127 ? :down : :up)
        }
        data[:type] = CODE_NOTE_TO_DATA_TYPE[[code, note]] || :grid
        if data[:type] == :grid
          data[:x] = note % 16
          data[:y] = note / 16
        end
        data
      end
    end
def read_pending_actions
      Array(input).collect do |midi_message|
        (code, note, velocity) = midi_message[:message]
        data = {
          :timestamp  => midi_message[:timestamp],
          :state      => (velocity == 127 ? :down : :up)
        }
        data[:type] = CODE_NOTE_TO_DATA_TYPE[[code, note]] || :grid
        if data[:type] == :grid
          data[:x] = note % 16
          data[:y] = note / 16
        end
        data
      end
    end
Reads user actions (button presses/releases) that haven't been handled yet.
 This is non-blocking, so when nothing happend yet you'll get an empty array.

 Returns:

 an array of hashes with (see Launchpad for values):

 [<tt>:timestamp</tt>] integer indicating the time when the action occured
 [<tt>:state</tt>]     state of the button after action
 [<tt>:type</tt>]      type of the button
 [<tt>:x</tt>]         x coordinate
 [<tt>:y</tt>]         y coordinate

 Errors raised:

 [Launchpad::NoInputAllowedError] when input is not enabled