Module: MIDIMessage::SystemExclusive::InstanceMethods
- Included in:
- Message
- Defined in:
- lib/midi-message/system_exclusive.rb
Overview
Common SysEx data that a message class will contain
Constant Summary collapse
- StartByte =
0xF0
- EndByte =
0xF7
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#checksum ⇒ Object
readonly
alternate method from www.2writers.com/eddie/TutSysEx.htm.
-
#node ⇒ Object
Returns the value of attribute node.
Instance Method Summary collapse
- #end_byte ⇒ Object
- #name ⇒ Object (also: #verbose_name)
- #start_byte ⇒ Object
-
#to_a(options = {}) ⇒ Object
an array of message parts.
-
#to_hex_s ⇒ Object
(also: #to_bytestr)
string representation of the object’s bytes.
-
#to_numeric_byte_array(options = {}) ⇒ Object
(also: #to_numeric_bytes, #to_byte_array, #to_bytes, #to_byte_a)
a flat array of message bytes.
- #type_byte ⇒ Object
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
16 17 18 |
# File 'lib/midi-message/system_exclusive.rb', line 16 def address @address end |
#checksum ⇒ Object (readonly)
alternate method from www.2writers.com/eddie/TutSysEx.htm
77 78 79 |
# File 'lib/midi-message/system_exclusive.rb', line 77 def checksum @checksum end |
#node ⇒ Object
Returns the value of attribute node.
15 16 17 |
# File 'lib/midi-message/system_exclusive.rb', line 15 def node @node end |
Instance Method Details
#end_byte ⇒ Object
67 68 69 |
# File 'lib/midi-message/system_exclusive.rb', line 67 def end_byte self.class::EndByte end |
#name ⇒ Object Also known as: verbose_name
58 59 60 |
# File 'lib/midi-message/system_exclusive.rb', line 58 def name "System Exclusive" end |
#start_byte ⇒ Object
63 64 65 |
# File 'lib/midi-message/system_exclusive.rb', line 63 def start_byte self.class::StartByte end |
#to_a(options = {}) ⇒ Object
an array of message parts. multiple byte parts will be represented as an array of bytes
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/midi-message/system_exclusive.rb', line 22 def to_a( = {}) omit = [:omit] || [] node = @node.to_a() unless @node.nil? || omit.include?(:node) # this may need to be cached when properties are updated # might be worth benchmarking [ start_byte, node, (type_byte unless omit.include?(:type)), [address].compact.flatten, [value].compact.flatten, (checksum unless omit.include?(:checksum)), end_byte ].compact end |
#to_hex_s ⇒ Object Also known as: to_bytestr
string representation of the object’s bytes
48 49 50 51 52 53 54 55 |
# File 'lib/midi-message/system_exclusive.rb', line 48 def to_hex_s strings = to_bytes.map do |byte| string = byte.to_s(16) string = "0#{string}" if string.length == 1 string end strings.join.upcase end |
#to_numeric_byte_array(options = {}) ⇒ Object Also known as: to_numeric_bytes, to_byte_array, to_bytes, to_byte_a
a flat array of message bytes
39 40 41 |
# File 'lib/midi-message/system_exclusive.rb', line 39 def to_numeric_byte_array( = {}) to_a().flatten end |
#type_byte ⇒ Object
71 72 73 |
# File 'lib/midi-message/system_exclusive.rb', line 71 def type_byte self.class::TypeByte end |