Class: MIDIEvents::SystemExclusive::Message

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

Overview

A SysEx message with no implied type

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Message.



95
96
97
98
99
100
101
102
# File 'lib/midi-events/system_exclusive.rb', line 95

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

#addressObject (readonly) Originally defined in module InstanceMethods

Returns the value of attribute address.

#checksumObject (readonly) Originally defined in module InstanceMethods

#dataObject

Returns the value of attribute data.



93
94
95
# File 'lib/midi-events/system_exclusive.rb', line 93

def data
  @data
end

#nodeObject Originally defined in module InstanceMethods

Returns the value of attribute node.

Instance Method Details

#==(other_message) ⇒ Object



118
119
120
121
# File 'lib/midi-events/system_exclusive.rb', line 118

def ==(other_message)
  self.class == other_message.class &&
    to_a == other_message.to_a
end

#end_byteObject Originally defined in module InstanceMethods

#nameObject Also known as: verbose_name Originally defined in module InstanceMethods

#start_byteObject Originally defined in module InstanceMethods

#to_a(options = {}) ⇒ Object

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



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/midi-events/system_exclusive.rb', line 105

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

#to_hex_sObject Also known as: to_bytestr Originally defined in module InstanceMethods

string representation of the object's bytes

#to_numeric_byte_array(options = {}) ⇒ Object Also known as: to_numeric_bytes, to_byte_array, to_bytes, to_byte_a Originally defined in module InstanceMethods

a flat array of message bytes

#type_byteObject Originally defined in module InstanceMethods