Class: MIDIMessage::SystemExclusive::Node

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

Overview

The SystemExclusive::Node represents a destination for a message. For example a hardware synthesizer or sampler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(manufacturer, options = {}) ⇒ Node

Returns a new instance of Node.



135
136
137
138
139
# File 'lib/midi-message/system_exclusive.rb', line 135

def initialize(manufacturer, options = {})
  @device_id = options[:device_id]
  @model_id = options[:model_id]
  @manufacturer_id = get_manufacturer_id(manufacturer)
end

Instance Attribute Details

#device_idObject

Returns the value of attribute device_id.



132
133
134
# File 'lib/midi-message/system_exclusive.rb', line 132

def device_id
  @device_id
end

#manufacturer_idObject (readonly)

Returns the value of attribute manufacturer_id.



133
134
135
# File 'lib/midi-message/system_exclusive.rb', line 133

def manufacturer_id
  @manufacturer_id
end

#model_idObject (readonly)

Returns the value of attribute model_id.



133
134
135
# File 'lib/midi-message/system_exclusive.rb', line 133

def model_id
  @model_id
end

Instance Method Details

#command(*a) ⇒ Object

create a new Command message associated with this node



160
161
162
163
164
# File 'lib/midi-message/system_exclusive.rb', line 160

def command(*a)
  command = Command.new(*a)
  command.node = self
  command
end

#new_message_from(prototype_message) ⇒ Object

this message takes a prototype message, copies it, and returns the copy with its node set to this node



153
154
155
156
157
# File 'lib/midi-message/system_exclusive.rb', line 153

def new_message_from(prototype_message)
  copy = prototype_message.clone
  copy.node = self
  copy
end

#request(*a) ⇒ Object

create a new Request message associated with this node



167
168
169
170
171
# File 'lib/midi-message/system_exclusive.rb', line 167

def request(*a)
  request = Request.new(*a)
  request.node = self
  request
end

#to_a(options = {}) ⇒ Object



141
142
143
144
145
146
147
148
149
# File 'lib/midi-message/system_exclusive.rb', line 141

def to_a(options = {})
  omit = options[:omit] || []
  properties = [:manufacturer, :device, :model].map do |property|
    unless omit.include?(property) || omit.include?("#{property.to_s}_id")
      instance_variable_get("@#{property.to_s}_id")
    end
  end
  properties.compact
end