lib/patchmaster/connection.rb in patchmaster-0.0.4 vs lib/patchmaster/connection.rb in patchmaster-0.0.5
- old
+ new
@@ -7,11 +7,11 @@
# filtered, then the remaining modified data is sent to the
# OutputInstrument.
class Connection
attr_accessor :input, :input_chan, :output, :output_chan,
- :pc_prog, :zone, :xpose, :filter
+ :bank, :pc_prog, :zone, :xpose, :filter
# If input_chan is nil than all messages from input will be sent to
# output.
#
# All channels (input_chan, output_chan, etc.) are 1-based here but are
@@ -23,11 +23,14 @@
@input_chan -= 1 if @input_chan
@output_chan -= 1 if @output_chan
end
def start(start_bytes=nil)
- midi_out(start_bytes) if start_bytes
- midi_out([PROGRAM_CHANGE + @output_chan, @pc_prog]) if pc?
+ bytes = []
+ bytes += start_bytes if start_bytes
+ bytes += [CC_BANK_SELECT + @output_chan, @bank] if @bank
+ bytes += [PROGRAM_CHANGE + @output_chan, @pc_prog] if @pc_prog
+ midi_out(bytes) unless bytes.empty?
@input.add_connection(self)
end
def stop(stop_bytes=nil)
midi_out(stop_bytes) if stop_bytes