def OnEncoderDecreased(self, control, event): control_type, control_name, control_id, control_note_or_color = control.split( ".") control_number = int(control_name) if ui.getFocused(midi.widMixer): index = mixer.trackNumber() + control_number - 1 if self.mixer.encodersTarget == ENCODERS_NUM_TARGETS.MIXER.TRACK_VOL: mixer.setTrackVolume(index, mixer.getTrackVolume(index) - VOL_INC) elif self.mixer.encodersTarget == ENCODERS_NUM_TARGETS.MIXER.TRACK_PAN: mixer.setTrackPan(index, mixer.getTrackPan(index) - PAN_INC) elif ui.getFocused(midi.widChannelRack ) and control_number <= channels.channelCount(): index = channels.channelNumber() + control_number - 1 if self.channels.encodersTarget == ENCODERS_NUM_TARGETS.CHANNELS.CHANNEL_VOL: channels.setChannelVolume( index, channels.getChannelVolume(index) - VOL_INC) elif self.channels.encodersTarget == ENCODERS_NUM_TARGETS.CHANNELS.CHANNEL_PAN: channels.setChannelPan(index, channels.getChannelPan(index) - PAN_INC) elif ui.getFocused(midi.widPlaylist): index = playlist.trackNumber() + control_number - 1 if self.playlist.encodersTarget == ENCODERS_NUM_TARGETS.TRACK_VOL: pass
def OnMidiIn(self, event): #tbuttons if (event.data1 == playb): transport.start() #play self.UpdateLEDs() if (event.data1 == recb): transport.record() #record self.UpdateLEDs() if (event.data1 == stopb): transport.stop() #stop self.UpdateLEDs() if (event.data1 == loopb): transport.setLoopMode() #loop/pattern mode self.UpdateLEDs() if (event.data1 == metrob): # metronome/button transport.globalTransport(midi.FPT_Metronome, 110) self.UpdateLEDs() if (event.data1 == tempob): transport.stop() #tap tempo if (event.data1 == quantizeb): transport.globalTransport(midi.FPT_Snap, 48) #snap toggle if (event.data1 == squantizeb): ui.snapMode(1) #snap toggle if (event.data1 == srecb): transport.globalTransport(midi.FPT_CountDown, 115) #countdown before recordin #if (event.data1 == sstopb): # transport.globalTransport(midi.FPT_F12, 71) #clear all windows if (event.data1 == undob): general.undoUp() #undo if (event.data1 == sundob): general.undo() #redo if (event.data1 == squantizeb): transport.globalTransport(midi.FPT_SnapMode, 49, event.pmeFlags) #snap toggle self.UpdateLEDs() if (event.data1 == tempob): transport.globalTransport(midi.FPT_TapTempo, 106) #tap tempo #4D controller if (event.data1 == knobe): transport.globalTransport(midi.FPT_Enter, 80) #enter if (event.data1 == knobsp) & (event.data2 == right): #4d encoder spin right ui.jog(1) elif (event.data1 == knobsp) & (event.data2 == left): #4d encoder spin left ui.jog(-1) if (event.data1 == knoblr) & (event.data2 == right): #4d encoder push right transport.globalTransport(midi.FPT_Right, 1) elif (event.data1 == knoblr) & (event.data2 == left): #4d encoder push left transport.globalTransport(midi.FPT_Left, 1) if (event.data1 == knobud) & (event.data2 == up): #4d encoder push up transport.globalTransport(midi.FPT_Up, 1) elif (event.data1 == knobud) & (event.data2 == down): #4d encoder push down transport.globalTransport(midi.FPT_Down, 1) #8 volume knobs for mixer & channel rack, 8 tracks at a time volinc = .005 #volume increments paninc = .01 # pan increments if ui.getFocused(0) == 1: #mixer volume control if (event.data1 == muteb): mixer.enableTrack(mixer.trackNumber()) #mute if (event.data1 == solob): mixer.soloTrack(mixer.trackNumber()) #solo # VOLUME CONTROL #knob 1 if (event.data1 == knob1): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 0, mixer.getTrackVolume(mixer.trackNumber()) + 0 - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 0, mixer.getTrackVolume(mixer.trackNumber()) + 0 + volinc) # volume values go up #knob 2 if (event.data1 == knob2): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 1, mixer.getTrackVolume(mixer.trackNumber() + 1) - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 1, mixer.getTrackVolume(mixer.trackNumber() + 1) + volinc) # volume values go up #knob 3 if (event.data1 == knob3): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 2, mixer.getTrackVolume(mixer.trackNumber() + 2) - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 2, mixer.getTrackVolume(mixer.trackNumber() + 2) + volinc) # volume values go up #knob 4 if (event.data1 == knob4): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 3, mixer.getTrackVolume(mixer.trackNumber() + 3) - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 3, mixer.getTrackVolume(mixer.trackNumber() + 3) + volinc) # volume values go up #knob5 if (event.data1 == knob5): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 4, mixer.getTrackVolume(mixer.trackNumber() + 4) - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 4, mixer.getTrackVolume(mixer.trackNumber() + 4) + volinc) # volume values go up #knob 6 if (event.data1 == knob6): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 5, mixer.getTrackVolume(mixer.trackNumber() + 5) - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 5, mixer.getTrackVolume(mixer.trackNumber() + 5) + volinc) # volume values go up #knob 7 if (event.data1 == knob7): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 6, mixer.getTrackVolume(mixer.trackNumber() + 6) - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 6, mixer.getTrackVolume(mixer.trackNumber() + 6) + volinc) # volume values go up #knob 8 if (event.data1 == knob8): if event.data2 == 127: mixer.setTrackVolume( mixer.trackNumber() + 7, mixer.getTrackVolume(mixer.trackNumber() + 7) - volinc) # volume values go down elif event.data2 == 1: mixer.setTrackVolume( mixer.trackNumber() + 7, mixer.getTrackVolume(mixer.trackNumber() + 7) + volinc) # volume values go up # PAN CONTROL #sknob 1 if (event.data1 == sknob1): if event.data2 == 127: mixer.setTrackPan(mixer.trackNumber() + 0, mixer.getTrackPan(mixer.trackNumber()) + 0 - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan(mixer.trackNumber() + 0, mixer.getTrackPan(mixer.trackNumber()) + 0 + paninc) # volume values go up #sknob 2 if (event.data1 == sknob2): if event.data2 == 127: mixer.setTrackPan( mixer.trackNumber() + 1, mixer.getTrackPan(mixer.trackNumber() + 1) - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan( mixer.trackNumber() + 1, mixer.getTrackPan(mixer.trackNumber() + 1) + paninc) # volume values go up #sknob 3 if (event.data1 == sknob3): if event.data2 == 127: mixer.setTrackPan( mixer.trackNumber() + 2, mixer.getTrackPan(mixer.trackNumber() + 2) - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan( mixer.trackNumber() + 2, mixer.getTrackPan(mixer.trackNumber() + 2) + paninc) # volume values go up #sknob 4 if (event.data1 == sknob4): if event.data2 == 127: mixer.setTrackPan( mixer.trackNumber() + 3, mixer.getTrackPan(mixer.trackNumber() + 3) - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan( mixer.trackNumber() + 3, mixer.getTrackPan(mixer.trackNumber() + 3) + paninc) # volume values go up #sknob5 if (event.data1 == sknob5): if event.data2 == 127: mixer.setTrackPan( mixer.trackNumber() + 4, mixer.getTrackPan(mixer.trackNumber() + 4) - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan( mixer.trackNumber() + 4, mixer.getTrackPan(mixer.trackNumber() + 4) + paninc) # volume values go up #sknob 6 if (event.data1 == sknob6): if event.data2 == 127: mixer.setTrackPan( mixer.trackNumber() + 5, mixer.getTrackPan(mixer.trackNumber() + 5) - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan( mixer.trackNumber() + 5, mixer.getTrackPan(mixer.trackNumber() + 5) + paninc) # volume values go up #sknob 7 if (event.data1 == sknob7): if event.data2 == 127: mixer.setTrackPan( mixer.trackNumber() + 6, mixer.getTrackPan(mixer.trackNumber() + 6) - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan( mixer.trackNumber() + 6, mixer.getTrackPan(mixer.trackNumber() + 6) + paninc) # volume values go up #sknob 8 if (event.data1 == sknob8): if event.data2 == 127: mixer.setTrackPan( mixer.trackNumber() + 7, mixer.getTrackPan(mixer.trackNumber() + 7) - paninc) # volume values go down elif event.data2 == 1: mixer.setTrackPan( mixer.trackNumber() + 7, mixer.getTrackPan(mixer.trackNumber() + 7) + paninc) # volume values go up elif ui.getFocused(0) == 0: # channel rack if (event.data1 == muteb): channels.muteChannel(channels.channelNumber()) #mute if (event.data1 == solob): channels.soloChannel(channels.channelNumber()) #solo # VOLUME CONTROL #knob 1 if (event.data1 == knob1): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 0, channels.getChannelVolume(channels.channelNumber() + 0) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 0, channels.getChannelVolume(channels.channelNumber() + 0) + volinc) # volume values go up #knob 2 if (event.data1 == knob2): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 1, channels.getChannelVolume(channels.channelNumber() + 1) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 1, channels.getChannelVolume(channels.channelNumber() + 1) + volinc) # volume values go up #knob 3 if (event.data1 == knob3): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 2, channels.getChannelVolume(channels.channelNumber() + 2) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 2, channels.getChannelVolume(channels.channelNumber() + 2) + volinc) # volume values go up #knob 4 if (event.data1 == knob4): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 3, channels.getChannelVolume(channels.channelNumber() + 3) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 3, channels.getChannelVolume(channels.channelNumber() + 3) + volinc) # volume values go up #knob 5 if (event.data1 == knob5): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 4, channels.getChannelVolume(channels.channelNumber() + 4) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 4, channels.getChannelVolume(channels.channelNumber() + 4) + volinc) # volume values go up #knob 6 if (event.data1 == knob6): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 5, channels.getChannelVolume(channels.channelNumber() + 5) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 5, channels.getChannelVolume(channels.channelNumber() + 5) + volinc) # volume values go up #knob 7 if (event.data1 == knob7): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 6, channels.getChannelVolume(channels.channelNumber() + 6) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 6, channels.getChannelVolume(channels.channelNumber() + 6) + volinc) # volume values go up #knob 8 if (event.data1 == knob8): if event.data2 == 127: channels.setChannelVolume( channels.channelNumber() + 7, channels.getChannelVolume(channels.channelNumber() + 7) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelVolume( channels.channelNumber() + 7, channels.getChannelVolume(channels.channelNumber() + 7) + volinc) # volume values go up # PAN CONTROL #sknob 1 if (event.data1 == sknob1): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 0, channels.getChannelPan(channels.channelNumber() + 0) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 0, channels.getChannelPan(channels.channelNumber() + 0) + volinc) # volume values go up #sknob 2 if (event.data1 == sknob2): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 1, channels.getChannelPan(channels.channelNumber() + 1) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 1, channels.getChannelPan(channels.channelNumber() + 1) + volinc) # volume values go up #sknob 3 if (event.data1 == sknob3): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 2, channels.getChannelPan(channels.channelNumber() + 2) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 2, channels.getChannelPan(channels.channelNumber() + 2) + volinc) # volume values go up #sknob 4 if (event.data1 == sknob4): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 3, channels.getChannelPan(channels.channelNumber() + 3) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 3, channels.getChannelPan(channels.channelNumber() + 3) + volinc) # volume values go up #sknob 5 if (event.data1 == sknob5): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 4, channels.getChannelPan(channels.channelNumber() + 4) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 4, channels.getChannelPan(channels.channelNumber() + 4) + volinc) # volume values go up #sknob 6 if (event.data1 == sknob6): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 5, channels.getChannelPan(channels.channelNumber() + 5) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 5, channels.getChannelPan(channels.channelNumber() + 5) + volinc) # volume values go up #sknob 7 if (event.data1 == sknob7): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 6, channels.getChannelPan(channels.channelNumber() + 6) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 6, channels.getChannelPan(channels.channelNumber() + 6) + volinc) # volume values go up #sknob 8 if (event.data1 == sknob8): if event.data2 == 127: channels.setChannelPan( channels.channelNumber() + 7, channels.getChannelPan(channels.channelNumber() + 7) - volinc) # volume values go down elif event.data2 == 1: channels.setChannelPan( channels.channelNumber() + 7, channels.getChannelPan(channels.channelNumber() + 7) + volinc) # volume values go up
def OnUpdatePanning(self, delta): channel = channels.selectedChannel() pan = self.clip(-1., 1., channels.getChannelPan(channel) + (delta / 100.0)) channels.setChannelPan(channel, pan)
def get_panning_line(): return ' [%d%%]' % int( channels.getChannelPan(channels.selectedChannel()) * 100)