Esempio n. 1
0
 def _recolor_mixer_track(self, index):
     if index != 0:
         for i in range(channels.channelCount()):
             if channels.getTargetFxTrack(i) == index:
                 mixer.setTrackColor(index, channels.getChannelColor(i))
                 return
     mixer.setTrackColor(index, -10261391)
Esempio n. 2
0
 def sync_current_color(unused_param_value):
     """Sync channel color"""
     selected = channels.selectedChannel()
     if selected < 0:
         return
     mixer_index = channels.getTargetFxTrack(selected)
     if mixer_index <= 0:
         return
     color = channels.getChannelColor(selected)
     mixer.setTrackColor(mixer_index, color)
Esempio n. 3
0
 def sync_all_colors(unused_param_value):
     """Sync all colors"""
     num_channels = channels.channelCount()
     for i in range(num_channels):
         color = channels.getChannelColor(i)
         mixer_index = channels.getTargetFxTrack(i)
         if mixer_index <= 0:
             # Nothing to sync
             continue
         mixer.setTrackColor(mixer_index, color)
Esempio n. 4
0
def process(command):
    # Add event processor to actions list (useful for debugging)
    command.actions.addProcessor("Colour Picker Processor")

    if command.type == eventconsts.TYPE_PAD and command.coord_X != 8:
        command.handled == True
        if command.is_lift:

            colour = COLOUR_HEX_MAP[command.coord_X][command.coord_Y]

            if internal.window.active_fl_window == internal.consts.WINDOW_PLAYLIST:
                patterns.setPatternColor(patterns.patternNumber(), colour)

            if internal.window.active_fl_window == internal.consts.WINDOW_MIXER:
                mixer.setTrackColor(mixer.trackNumber(), colour)

            if internal.window.active_fl_window == internal.consts.WINDOW_CHANNEL_RACK:
                channels.setChannelColor(channels.channelNumber(), colour)

            command.actions.appendAction("Set colour to " + str(colour))
            # quit the colour picker
            ui.escape()

    return
Esempio n. 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