Class: MIDI::ProgramChange

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, program = 0, delta_time = 0) ⇒ ProgramChange

Returns a new instance of ProgramChange.



208
209
210
211
# File 'lib/midilib/event.rb', line 208

def initialize(channel = 0, program = 0, delta_time = 0)
  super(PROGRAM_CHANGE, channel, delta_time)
  @program = program
end

Instance Attribute Details

#programObject

Returns the value of attribute program.



206
207
208
# File 'lib/midilib/event.rb', line 206

def program
  @program
end

Instance Method Details

#data_as_bytesObject



213
214
215
216
217
# File 'lib/midilib/event.rb', line 213

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

#to_sObject



219
220
221
# File 'lib/midilib/event.rb', line 219

def to_s
  super << "prog #{number_to_s(@program)}"
end