Class: MIDI::Controller

Inherits:
ChannelEvent show all
Defined in:
lib/midilib/event.rb

Instance Attribute Summary collapse

Attributes inherited from ChannelEvent

#channel

Attributes inherited from Event

#delta_time, #print_channel_numbers_from_one, #print_decimal_numbers, #print_note_names, #status, #time_from_start

Instance Method Summary collapse

Methods inherited from Event

#<=>, #channel_to_s, #number_to_s, #quantize_to

Constructor Details

#initialize(channel = 0, controller = 0, value = 0, delta_time = 0) ⇒ Controller

Returns a new instance of Controller.



187
188
189
190
191
# File 'lib/midilib/event.rb', line 187

def initialize(channel = 0, controller = 0, value = 0, delta_time = 0)
  super(CONTROLLER, channel, delta_time)
  @controller = controller
  @value = value
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



185
186
187
# File 'lib/midilib/event.rb', line 185

def controller
  @controller
end

#valueObject

Returns the value of attribute value.



185
186
187
# File 'lib/midilib/event.rb', line 185

def value
  @value
end

Instance Method Details

#data_as_bytesObject



193
194
195
196
197
198
# File 'lib/midilib/event.rb', line 193

def data_as_bytes
  data = []
  data << (@status + @channel)
  data << @controller
  data << @value
end

#to_sObject



200
201
202
# File 'lib/midilib/event.rb', line 200

def to_s
  super << "cntl #{number_to_s(@controller)} #{number_to_s(@value)}"
end