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>)


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

def buffer
  @device.buffer
end

#clear_bufferArray

Clears the input buffer

Returns:

  • (Array)


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

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>)


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

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>)


41
42
43
# File 'lib/unimidi/input/buffer_access.rb', line 41

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>)


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

def gets_buffer_s(*_args)
  @device.buffer.map do |msg|
    msg[:data] = TypeConversion.numeric_byte_array_to_hex_string(msg[:data])
    msg
  end
end