Class: MIDI::PitchBend
- Inherits:
-
ChannelEvent
- Object
- Event
- ChannelEvent
- MIDI::PitchBend
- Defined in:
- lib/midilib/event.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from ChannelEvent
Attributes inherited from Event
#delta_time, #print_decimal_numbers, #print_note_names, #status, #time_from_start
Instance Method Summary collapse
- #data_as_bytes ⇒ Object
-
#initialize(channel = 0, value = 0, delta_time = 0) ⇒ PitchBend
constructor
A new instance of PitchBend.
- #to_s ⇒ Object
Methods inherited from Event
#<=>, #channel?, #meta?, #note?, #note_off?, #note_on?, #number_to_s, #quantize_to, #realtime?, #system?
Constructor Details
#initialize(channel = 0, value = 0, delta_time = 0) ⇒ PitchBend
Returns a new instance of PitchBend.
276 277 278 279 |
# File 'lib/midilib/event.rb', line 276 def initialize(channel = 0, value = 0, delta_time = 0) super(PITCH_BEND, channel, delta_time) @value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
274 275 276 |
# File 'lib/midilib/event.rb', line 274 def value @value end |
Instance Method Details
#data_as_bytes ⇒ Object
281 282 283 284 285 286 287 |
# File 'lib/midilib/event.rb', line 281 def data_as_bytes data = '' data << (@status + @channel) data << ((@value >> 8) & 0xff) # msb data << (@value & 0xff) # lsb return data end |
#to_s ⇒ Object
289 290 291 |
# File 'lib/midilib/event.rb', line 289 def to_s return super << "pb #{number_to_s(@value)}" end |