Module: MIDIMessage::Message
- Defined in:
- lib/midi-message/message.rb
Overview
Common behavior amongst all Message types
Instance Method Summary collapse
-
#initialize_message(status_nibble_1, status_nibble_2) ⇒ Object
Initialize the message status.
-
#to_a ⇒ Array<Fixnum>
(also: #to_byte_a, #to_byte_array, #to_bytes)
Byte array representation of the message eg [0x90, 0x40, 0x40] for NoteOn(0x40, 0x40).
-
#to_hex_s ⇒ String
(also: #to_bytestr)
String representation of the message’s bytes eg “904040” for NoteOn(0x40, 0x40).
- #update ⇒ Object
Instance Method Details
#initialize_message(status_nibble_1, status_nibble_2) ⇒ Object
Initialize the message status
9 10 11 12 |
# File 'lib/midi-message/message.rb', line 9 def (status_nibble_1, status_nibble_2) @status = [status_nibble_1, status_nibble_2] populate_using_const end |
#to_a ⇒ Array<Fixnum> Also known as: to_byte_a, to_byte_array, to_bytes
Byte array representation of the message eg [0x90, 0x40, 0x40] for NoteOn(0x40, 0x40)
16 17 18 19 20 |
# File 'lib/midi-message/message.rb', line 16 def to_a data = [@data[0], @data[1]] unless @data.nil? data ||= [] [status_as_byte, *data].compact end |
#to_hex_s ⇒ String Also known as: to_bytestr
String representation of the message’s bytes eg “904040” for NoteOn(0x40, 0x40)
27 28 29 |
# File 'lib/midi-message/message.rb', line 27 def to_hex_s TypeConversion.numeric_byte_array_to_hex_string(to_a) end |
#update ⇒ Object
32 33 34 |
# File 'lib/midi-message/message.rb', line 32 def update populate_using_const end |