Beispiel #1
0
def channelToggleSolo(selectedChannelNum):
    channels.soloChannel(selectedChannelNum)
    if channels.isChannelSolo(selectedChannelNum) is 1:
        return "Channel rack: Solo channel: " + getChannelName(
            selectedChannelNum)
    else:
        return "Channel rack: Unsolo channel: " + getChannelName(
            selectedChannelNum)
Beispiel #2
0
 def OnTrackSolo(self, event):
     debug.log('OnTrackSolo', 'Dispatched', event=event)
     playlist_mode = self._navigation.GetMode() == 'Playlist Track'
     if self._button_mode == arturia_macros.SAVE_BUTTON or playlist_mode:
         current_track = arturia_playlist.current_playlist_track()
         playlist.soloTrack(current_track)
         status = playlist.isTrackSolo(current_track)
         self._display_playlist_track_op_hint("Solo Playlist: %d" % status)
         self._button_hold_action_committed = True
     else:
         channels.soloChannel(channels.selectedChannel())
Beispiel #3
0
def processMuteSolo(channel, command):

    if channels.channelCount() <= channel:
        command.handle("Channel out of range. Couldn't process mute",
                       silent=True)
        return

    if command.value == 0: return
    if channels.isChannelSolo(channel) and channels.channelCount() != 1:
        channels.soloChannel(channel)
        action = "Unsolo channel"

    elif command.is_double_click:
        channels.soloChannel(channel)
        action = "Solo channel"
    else:
        channels.muteChannel(channel)
        if channels.isChannelMuted(channel):
            action = "Mute channel"
        else:
            action = "Unmute channel"

    command.handle(action)
Beispiel #4
0
    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
Beispiel #5
0
	def switch_moment(event):
		"""handles momentary witch midi events"""
		if event.data1 == button["pad_mode_toggle"]:				# This Rotates through pad modes - standard, step sequencer, pad to channel		
			Switch.mode_toggle += 1
			if Switch.mode_toggle == 4:
				Switch.mode_toggle = 0
			print('Pad Mode: ' + mode[Switch.mode_toggle])
			ui.setHintMsg(mode[Switch.mode_toggle])

		elif event.midiId == 224: 								# pitch wheel
			Switch.pitch_num = event.data2	
			if Switch.shift_status == True:
				print(data.notes_list[int(mapvalues(Switch.pitch_num, 0, 11, 0, 244))])

		elif event.data1 == button["play"]:			
			transport.start()
			event.handled = True

		elif event.data1 == button["offset_range"]:
			Switch.offset_iter += 1
			if Switch.offset_iter == 2:     								# 2 here will limit to 32 steps, knobs. Changing to 4 will allow up to 64 steps, knobs. 
				Switch.offset_iter = 0
			ui.setHintMsg("Offset Range: " + str(Switch.offset_iter))
	
		elif event.data1 == button["stop"]:
			print('Stop')
			transport.stop()
			event.handled = True						
																	
		elif event.data1 == button["record"]:			
			print('Record')
			transport.record()
			event.handled = True

		elif event.data1 == button["pattern_down"]:
			if ui.getFocused(5):
				print("Previous Preset")
				ui.previous()
			else:
				print('Pattern Down')
				transport.globalTransport(midi.FPT_PatternJog, -1)
				event.handled = True
					
		elif event.data1 == button["pattern_up"]:
			if ui.getFocused(5):
				print("Next Preset")
				ui.next()
			else:
				print('Pattern Up')
				transport.globalTransport(midi.FPT_PatternJog, 1)
				event.handled = True
																	# Set mod wheel to control channels when channels focused and tracks when mixer
		elif event.data1 == button["mod_wheel"]:					
			if ui.getFocused(0):
				mixer.setTrackNumber(int(mapvalues(event.data2, 0, 64, 0, 127)))
				ui.scrollWindow(midi.widMixer, mixer.trackNumber())
			elif ui.getFocused(1):
				print("Channel Number: " + str(channels.selectedChannel()))
				channels.selectOneChannel(int(round(mapvalues(event.data2, channels.channelCount()-1, 0, 0, 127), 0)))				

		elif event.data1 == 72:
			print(channels.getChannelColor(channels.selectedChannel())) 
			Switch.color_num += 1
			if Switch.color_num == len(colors):
				Switch.color_num = 0
			if ui.getFocused(1):
				channels.setChannelColor(channels.selectedChannel(), colors[Switch.color_num])
			elif ui.getFocused(0):
				mixer.setTrackColor(mixer.trackNumber(), colors[Switch.color_num])
			event.handled = True
		
		elif event.data1 == button["enter"]:
			if ui.getFocused(4):
				print("Select Browser Item")
				ui.selectBrowserMenuItem()		
				event.handled = True
			elif ui.getFocused(1):
				print("Mute Channel")
				channels.muteChannel(channels.selectedChannel())
			elif ui.getFocused(0):
				print("Mute Track")
				mixer.muteTrack(mixer.trackNumber())
			else:
				print('enter')
				ui.enter()
				event.handled = True

		elif event.data1 in range(59, 64) and config.PATTERN_JUMP_ON:						# Sets jump to pattern
			patterns.jumpToPattern(event.data1 - 58)
			event.handled = True		

		elif event.data1 in range(75, 80) and config.PATTERN_JUMP_ON:
			patterns.jumpToPattern(event.data1 - 69)
			event.handled = True

		elif event.data1 == button["solo"]:
			print('Solo')
			if ui.getFocused(0):
				mixer.soloTrack(mixer.trackNumber())
			elif ui.getFocused(1):
				channels.soloChannel(channels.selectedChannel())

		elif event.data1 == button["view_plugin_picker"]:
			print('View Plugin Picker')
			transport.globalTransport(midi.FPT_F8, 67)
			event.handled = True	
			
		elif event.data1 == button["song_mode_toggle"]:			
			print('Toggle Song and Pattern Mode')
			transport.setLoopMode()
			event.handled = True
			
		elif event.data1 == button["view_playlist"]:			
			print('View Playlist')
			transport.globalTransport(midi.FPT_F5, 65)
			event.handled = True
			
		elif event.data1 == button["view_piano_roll"]:
			print('View Piano Roll')
			transport.globalTransport(midi.FPT_F7, 66)
			event.handled = True
		
		elif event.data1 == button["view_channel_rack"]:
			print('View Channel Rack')
			transport.globalTransport(midi.FPT_F6, 65)
			event.handled = True
			
		elif event.data1 == button["view_mixer"]:
			print('View Mixer')
			transport.globalTransport(midi.FPT_F9, 68)
			event.handled = True
																	# Toggle through step parameter options - pitch, pan etc. No Shift control right now. 
		elif event.data1 == button["step_parameter"]:
			
			if ui.getFocused(1) and Switch.mode_toggle == 1:
				print('Toggle Step Parameter')
				Switch.parameter += 1
				if Switch.parameter == 7:
					Switch.parameter = 0
				print(Switch.parameter)
				ui.setHintMsg(parameters[Switch.parameter])

			elif ui.getFocused(0):
				Switch.mixer_num += 1
				if Switch.mixer_num == 2:
					Switch.mixer_num = 0
				print('Mixer Mode: ' + str(Switch.mixer_num))
				ui.setHintMsg(mixer_choice[Switch.mixer_num])
			event.handled = True

		elif event.data1 == button["open_channel_sampler"]:			
			print('Open Sampler Channel')
			channels.showCSForm(channels.channelNumber(), -1)
			event.handled = True					
							
		elif event.data1 == button["left"]:							
			print('Left')
			ui.left()
			event.handled = True	
		
		elif event.data1 == button["down"]:							
			print('Down')
			ui.down()
			event.handled = True				
			
		elif event.data1 == button["right"]:						
			print('Right')
			ui.right()
			event.handled = True			

		elif event.data1 == button["save"]:
			print('Save')
			transport.globalTransport(midi.FPT_Save, 92)
																	# If mixer is open and mute mode selected, top row will mute respective track 
		elif event.data1 == button["undo"]:					
				print('Undo')
				transport.globalTransport(midi.FPT_Undo, 20)
				device.midiOutMsg(144, 1, 63, 80)
				event.handled = True

		elif event.data1 == button["escape"]:
			print('Escape')
			ui.escape()
			event.handled = True
		
		elif event.data1 == button["up"]:
			print('Up')
			ui.up()
			event.handled = True			

		elif event.data1 == button["rotate_window"]:				
			print('Rotate Window')
			ui.nextWindow()
			event.handled = True

		elif event.data1 == button["browser"]:				
			print('Browser')
			if Switch.shift_status == False:
				if ui.getFocused(4):
					ui.hideWindow(4)
					event.handled = True
				else:
					ui.showWindow(4)
					ui.setFocused(4)
					event.handled = True
			
		elif event.data1 == button["step_rec"]:	
			if ui.getFocused(0):
				mixer.armTrack(mixer.trackNumber())	
				print("Toggle Track Rec")
			else:			
				transport.globalTransport(midi.FPT_StepEdit, 114)
				print('Step Record')
				event.handled = True							

		elif event.data1 == button["quantize"]:
			print('quantize')
			channels.quickQuantize(channels.channelNumber())
			event.handled = True

		elif event.data1 == button["link_chan"]:
			print('link channel')
			mixer.linkTrackToChannel(0)

		elif event.data1 == button["rand_steps"]:
			print("Random")
			print(f'Pitch Bend: {event.pitchBend}')
			for i in range(patterns.getPatternLength(patterns.patternNumber())):
				channels.setGridBit(channels.channelNumber(), i, 0)
			for z in range (patterns.getPatternLength(patterns.patternNumber())):
				y = num_gen()
				if y > ( Switch.pitch_num * 516):
					channels.setGridBit(channels.channelNumber(), z, 1)
				else:
					pass
			event.handled = True

		elif event.data1 == button["rand_notes"]:
			print("Randomize Notes")
			Switch.note_gen()
			event.handled = True
 def OnTrackSolo(self, event):
     debug.log('OnTrackSolo', 'Dispatched', event=event)
     channels.soloChannel(channels.selectedChannel())
Beispiel #7
0
    def OnMidiMsg(self, event):
        event.handled = False

        # FOR PRINTING DATA ON SCRIPT OUTPUT

        print("status: {}, port: {}, midiId: {}, data1: {}, data2: {}".format(
            event.status, event.port, event.midiId, event.data1, event.data2))

        # CONTROL CHANGE EVENT FOR BUTTONS OF MIDI
        if event.midiId == midi.MIDI_CONTROLCHANGE:
            if event.data2 > 0:

                if event.data1 == Play:
                    print('Playback')
                    transport.start()
                    ui.setHintMsg("Play/Pause")
                    event.handled = True
                elif event.data1 == Record:
                    print('Record')
                    transport.record()
                    ui.setHintMsg("Record")
                    event.handled = True
                elif event.data1 == Stop:
                    print('Stop')
                    transport.stop()
                    ui.setHintMsg("Stop")
                    event.handled = True
                elif event.data1 == ToggleLoop:
                    print('Toggle Loop')
                    transport.setLoopMode()
                    ui.setHintMsg("Pattern/Song")
                    event.handled = True

                elif event.data1 == Left:
                    print('Previous Tab')
                    transport.globalTransport(midi.FPT_WindowJog, -1)
                    ui.setHintMsg("Previous Tab")
                    event.handled = True
                elif event.data1 == Right:
                    print('Next Tab')
                    transport.globalTransport(midi.FPT_WindowJog, 1)
                    ui.setHintMsg("Next Tab")
                    event.handled = True

                elif event.data1 == Up:
                    print('Undo Up')
                    general.undoUp()
                    ui.setHintMsg("Undo Up")
                    event.handled = True
                elif event.data1 == Down:
                    print('Undo Down/ReDo')
                    general.restoreUndo()
                    ui.setHintMsg("Undo Down/ReDo")
                    event.handled = True

                elif event.data1 in Knobs:
                    mixer.setTrackVolume(
                        mixer.trackNumber() + Knobs.index(event.data1),
                        event.data2 / 127)
                    event.handled = True

        #MIDI NOTE ON/OFF FOR NOTE EVENTS
        elif event.midiId == midi.MIDI_NOTEON:
            if (event.pmeFlags & midi.PME_System != 0):

                if event.data1 == Playlist:
                    print('Playlist')
                    transport.globalTransport(midi.FPT_F5, 1)
                    ui.setHintMsg("Playlist")
                    event.handled = True
                elif event.data1 == ChannelRack:
                    print('ChannelRack')
                    transport.globalTransport(midi.FPT_F6, 1)
                    ui.setHintMsg("ChannelRack")
                    event.handled = True
                elif event.data1 == PianoRoll:
                    print('PianoRoll')
                    transport.globalTransport(midi.FPT_F7, 1)
                    ui.setHintMsg("PianoRoll")
                    event.handled = True
                elif event.data1 == Mixer:
                    print('Mixer')
                    transport.globalTransport(midi.FPT_F9, 1)
                    ui.setHintMsg("Mixer")
                    event.handled = True

                elif event.data1 == Previous:
                    print('Previous')
                    ui.previous()
                    ui.setHintMsg("Previous")
                    event.handled = True
                elif event.data1 == Next:
                    print('Next')
                    ui.next()
                    ui.setHintMsg("Next")
                    event.handled = True

                elif event.data1 == Mute:
                    print('Mute')
                    channels.muteChannel(channels.channelNumber())
                    ui.setHintMsg("Mute")
                    event.handled = True
                elif event.data1 == Solo:
                    print('Solo')
                    channels.soloChannel(channels.channelNumber())
                    ui.setHintMsg("Solo")
                    event.handled = True

                elif event.data1 == PatternUp:
                    print('Pattern Up')
                    transport.globalTransport(midi.FPT_PatternJog, -1)
                    ui.setHintMsg("Pattern Up")
                    event.handled = True
                elif event.data1 == PatternDown:
                    print('Pattern Down')
                    transport.globalTransport(midi.FPT_PatternJog, 1)
                    ui.setHintMsg("Pattern Down")
                    event.handled = True

                elif event.data1 == Overdub:
                    print('Overdub')
                    transport.globalTransport(midi.FPT_Overdub, 1)
                    ui.setHintMsg("Overdub")
                    event.handled = True
                elif event.data1 == LoopRecord:
                    print('Loop Record')
                    transport.globalTransport(midi.FPT_LoopRecord, 1)
                    ui.setHintMsg("Loop Record")
                    event.handled = True

                elif event.data1 == SnapUp:
                    print('Snap -1')
                    transport.globalTransport(midi.FPT_SnapMode, -1)
                    ui.setHintMsg("Snap -1")
                    event.handled = True
                elif event.data1 == SnapDown:
                    print('Snap +1')
                    transport.globalTransport(midi.FPT_SnapMode, 1)
                    ui.setHintMsg("Snap +1")
                    event.handled = True

                elif event.data1 == TapTempo:
                    print('Tap Tempo')
                    transport.globalTransport(midi.FPT_TapTempo, 1)
                    ui.setHintMsg("Tap Tempo")
                    event.handled = True
                elif event.data1 == Metro:
                    print('Metronome')
                    transport.globalTransport(midi.FPT_Metronome, 1)
                    ui.setHintMsg("Metronome")
                    event.handled = True