Class: MIDI::ChannelPressure

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, pressure = 0, delta_time = 0) ⇒ ChannelPressure

Returns a new instance of ChannelPressure.



227
228
229
230
# File 'lib/midilib/event.rb', line 227

def initialize(channel = 0, pressure = 0, delta_time = 0)
  super(CHANNEL_PRESSURE, channel, delta_time)
  @pressure = pressure
end

Instance Attribute Details

#pressureObject

Returns the value of attribute pressure.



225
226
227
# File 'lib/midilib/event.rb', line 225

def pressure
  @pressure
end

Instance Method Details

#data_as_bytesObject



232
233
234
235
236
# File 'lib/midilib/event.rb', line 232

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

#to_sObject



238
239
240
# File 'lib/midilib/event.rb', line 238

def to_s
  super << "chan press #{number_to_s(@pressure)}"
end