Class: MIDI::Controller
- Inherits:
-
ChannelEvent
- Object
- Event
- ChannelEvent
- MIDI::Controller
- Defined in:
- lib/midilib/event.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from ChannelEvent
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
- #data_as_bytes ⇒ Object
-
#initialize(channel = 0, controller = 0, value = 0, delta_time = 0) ⇒ Controller
constructor
A new instance of Controller.
- #to_s ⇒ Object
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.
184 185 186 187 188 |
# File 'lib/midilib/event.rb', line 184 def initialize(channel = 0, controller = 0, value = 0, delta_time = 0) super(CONTROLLER, channel, delta_time) @controller = controller @value = value end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
182 183 184 |
# File 'lib/midilib/event.rb', line 182 def controller @controller end |
#value ⇒ Object
Returns the value of attribute value.
182 183 184 |
# File 'lib/midilib/event.rb', line 182 def value @value end |
Instance Method Details
#data_as_bytes ⇒ Object
190 191 192 193 194 195 |
# File 'lib/midilib/event.rb', line 190 def data_as_bytes data = [] data << (@status + @channel) data << @controller data << @value end |
#to_s ⇒ Object
197 198 199 |
# File 'lib/midilib/event.rb', line 197 def to_s return super << "cntl #{number_to_s(@controller)} #{number_to_s(@value)}" end |