Class: MIDIMessage::SystemExclusive::Message

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

Overview

A SysEx message with no implied type

Constant Summary

Constants included from Base

Base::EndByte, Base::StartByte

Instance Attribute Summary collapse

Attributes included from Base

#address, #checksum, #node

Instance Method Summary collapse

Methods included from Base

#name, #to_hex_s, #to_numeric_byte_array, #type_byte

Constructor Details

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

Returns a new instance of Message.



141
142
143
144
# File 'lib/midi-message/system_exclusive.rb', line 141

def initialize(data, options = {})
  @data = (data.kind_of?(Array) && data.length.eql?(1)) ? data[0] : data
  initialize_sysex(nil, options)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



139
140
141
# File 'lib/midi-message/system_exclusive.rb', line 139

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



147
148
149
150
151
152
153
154
155
156
157
# File 'lib/midi-message/system_exclusive.rb', line 147

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