Module: UniMIDI::Input::BufferAccess
- Included in:
- UniMIDI::Input
- Defined in:
- lib/unimidi/input/buffer_access.rb
Instance Method Summary collapse
-
#buffer ⇒ Array<Hash>
The device buffer.
-
#clear_buffer ⇒ Array
Clears the input buffer.
-
#gets_buffer(*_args) ⇒ Array<Hash>
Gets any messages in the buffer in the same format as Input::StreamReader#gets.
-
#gets_buffer_data(*_args) ⇒ Array<Integer>
Gets any messages in the buffer in the same format as Input#gets_data.
-
#gets_buffer_s(*_args) ⇒ Array<Hash>
Gets any messages in the buffer in the same format as Input#gets_s.
Instance Method Details
#buffer ⇒ Array<Hash>
The device buffer
8 9 10 |
# File 'lib/unimidi/input/buffer_access.rb', line 8 def buffer @device.buffer end |
#clear_buffer ⇒ Array
Clears the input buffer
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
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
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
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 |