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_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, value = 0, delta_time = 0) ⇒ PitchBend
constructor
A new instance of PitchBend.
- #to_s ⇒ Object
Methods inherited from Event
#<=>, #channel_to_s, #number_to_s, #quantize_to
Constructor Details
#initialize(channel = 0, value = 0, delta_time = 0) ⇒ PitchBend
Returns a new instance of PitchBend.
242 243 244 245 |
# File 'lib/midilib/event.rb', line 242 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.
240 241 242 |
# File 'lib/midilib/event.rb', line 240 def value @value end |
Instance Method Details
#data_as_bytes ⇒ Object
247 248 249 250 251 252 |
# File 'lib/midilib/event.rb', line 247 def data_as_bytes data = [] data << (@status + @channel) data << (@value & 0x7f) # lsb data << ((@value >> 7) & 0x7f) # msb end |
#to_s ⇒ Object
254 255 256 |
# File 'lib/midilib/event.rb', line 254 def to_s return super << "pb #{number_to_s(@value)}" end |