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.



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

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.



203
204
205
# File 'lib/midilib/event.rb', line 203

def program
  @program
end

Instance Method Details

#data_as_bytesObject



210
211
212
213
214
# File 'lib/midilib/event.rb', line 210

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

#to_sObject



216
217
218
# File 'lib/midilib/event.rb', line 216

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