Module: MIDIMessage::ShortMessage

Overview

common behavior amongst all Message types

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/midi-message/short_message.rb', line 9

def name
  @name
end

#statusObject (readonly)

Returns the value of attribute status.



9
10
11
# File 'lib/midi-message/short_message.rb', line 9

def status
  @status
end

#verbose_nameObject (readonly)

Returns the value of attribute verbose_name.



9
10
11
# File 'lib/midi-message/short_message.rb', line 9

def verbose_name
  @verbose_name
end

Instance Method Details

#initialize_short_message(status_nibble_1, status_nibble_2) ⇒ Object



13
14
15
16
# File 'lib/midi-message/short_message.rb', line 13

def initialize_short_message(status_nibble_1, status_nibble_2)
  @status = [status_nibble_1, status_nibble_2]
  populate_using_const
end

#to_aObject Also known as: to_byte_a, to_byte_array, to_bytes

byte array representation of the object eg [0x90, 0x40, 0x40] for NoteOn(0x40, 0x40)



19
20
21
22
# File 'lib/midi-message/short_message.rb', line 19

def to_a
  data = @data.nil? ? [] : [@data[0], @data[1]] 
  [(@status[0] << 4) + @status[1], *data].compact
end

#to_hex_sObject Also known as: to_bytestr

string representation of the object’s bytes eg “904040” for NoteOn(0x40, 0x40)



28
29
30
# File 'lib/midi-message/short_message.rb', line 28

def to_hex_s
  TypeConversion.numeric_byte_array_to_hex_string(to_a)
end