Module: MIDIMessage::SystemExclusive::Base
Overview
basic 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
- #name ⇒ Object (also: #verbose_name)
-
#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.
13 14 15 |
# File 'lib/midi-message/system_exclusive.rb', line 13 def address @address end |
#checksum ⇒ Object (readonly)
alternate method from www.2writers.com/eddie/TutSysEx.htm
61 62 63 |
# File 'lib/midi-message/system_exclusive.rb', line 61 def checksum @checksum end |
#node ⇒ Object
Returns the value of attribute node.
12 13 14 |
# File 'lib/midi-message/system_exclusive.rb', line 12 def node @node end |
Instance Method Details
#name ⇒ Object Also known as: verbose_name
50 51 52 |
# File 'lib/midi-message/system_exclusive.rb', line 50 def name "System Exclusive" end |
#to_a(options = {}) ⇒ Object
an array of message parts. multiple byte parts will be represented as an array of bytes
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/midi-message/system_exclusive.rb', line 20 def to_a( = {}) omit = [:omit] || [] # this may need to be cached when properties are updated # might be worth benchmarking [ self.class::StartByte, (@node.to_a() unless @node.nil? || omit.include?(:node)), (type_byte unless omit.include?(:type)), [address].compact.flatten, [value].compact.flatten, (checksum unless omit.include?(:checksum)), self.class::EndByte ].compact end |
#to_hex_s ⇒ Object Also known as: to_bytestr
string representation of the object’s bytes
45 46 47 |
# File 'lib/midi-message/system_exclusive.rb', line 45 def to_hex_s to_bytes.map { |b| s = b.to_s(16); s.length.eql?(1) ? "0#{s}" : s }.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
36 37 38 |
# File 'lib/midi-message/system_exclusive.rb', line 36 def to_numeric_byte_array( = {}) to_a().flatten end |
#type_byte ⇒ Object
55 56 57 |
# File 'lib/midi-message/system_exclusive.rb', line 55 def type_byte self.class::TypeByte end |