Class: MIDIMessage::SystemExclusive::Message

Inherits:
Object
  • Object
show all
Includes:
InstanceMethods
Defined in:
lib/midi-message/system_exclusive.rb

Overview

A SysEx message with no implied type

Instance Attribute Summary collapse

Attributes included from InstanceMethods

#address, #checksum, #node

Instance Method Summary collapse

Methods included from InstanceMethods

#end_byte, #name, #start_byte, #to_hex_s, #to_numeric_byte_array, #type_byte

Constructor Details

#initialize(data, options = {}) ⇒ Message

Returns a new instance of Message


98
99
100
101
102
103
104
105
# File 'lib/midi-message/system_exclusive.rb', line 98

def initialize(data, options = {})
  @data = if data.kind_of?(Array) && data.length == 1
    data.first
  else
    data
  end
  initialize_sysex(nil, options)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data


96
97
98
# File 'lib/midi-message/system_exclusive.rb', line 96

def data
  @data
end

Instance Method Details

#to_a(options = {}) ⇒ Object

an array of message parts. multiple byte parts will be represented as an array of bytes


108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/midi-message/system_exclusive.rb', line 108

def to_a(options = {})
  omit = options[:omit] || []
  node = @node.to_a(options) unless @node.nil? || omit.include?(:node)
  # this may need to be cached when properties are updated
  # might be worth benchmarking
  [
    start_byte,
    node,
    @data,
    end_byte
  ].compact
end