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.



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

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.



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

def program
  @program
end

Instance Method Details

#data_as_bytesObject



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

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

#to_sObject



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

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