Module: UniMIDI::Input::BufferAccess

Included in:
UniMIDI::Input
Defined in:
lib/unimidi/input/buffer_access.rb

Instance Method Summary collapse

Instance Method Details

#bufferArray<Hash>

The device buffer

Returns:

  • (Array<Hash>)


9
10
11
# File 'lib/unimidi/input/buffer_access.rb', line 9

def buffer
  @device.buffer
end

#clear_bufferArray

Clears the input buffer

Returns:

  • (Array)


15
16
17
# File 'lib/unimidi/input/buffer_access.rb', line 15

def clear_buffer
  @device.buffer.clear
end

#gets_buffer(*args) ⇒ Array<Hash>

Gets any messages in the buffer in the same format as Input::StreamReader#gets. This doesn’t remove the messages from the buffer or have any effect on the StreamReader pointer position

Parameters:

  • args (*Object)

Returns:

  • (Array<Hash>)


23
24
25
# File 'lib/unimidi/input/buffer_access.rb', line 23

def gets_buffer(*args)
  @device.buffer
end

#gets_buffer_data(*args) ⇒ Array<Integer>

Gets any messages in the buffer in the same format as Input#gets_data. . This doesn’t remove the messages from the buffer or have any effect on the StreamReader pointer position

Parameters:

  • args (*Object)

Returns:

  • (Array<Integer>)


39
40
41
# File 'lib/unimidi/input/buffer_access.rb', line 39

def gets_buffer_data(*args)
  @device.buffer.map { |msg| msg[:data] }
end

#gets_buffer_s(*args) ⇒ Array<Hash>

Gets any messages in the buffer in the same format as Input#gets_s. This doesn’t remove the messages from the buffer or have any effect on the StreamReader pointer position

Parameters:

  • args (*Object)

Returns:

  • (Array<Hash>)


31
32
33
# File 'lib/unimidi/input/buffer_access.rb', line 31

def gets_buffer_s(*args)
  @device.buffer.map { |msg| msg[:data] = TypeConversion.numeric_byte_array_to_hex_string(msg[:data]); msg }
end