예제 #1
0
	def pad_hit(event):

		if event.midiId == 144:
			temp_step.clear()
			temp_step.append(event.data1 + offset[Switch.offset_iter])

		if ui.getFocused(5) and plugins.isValid(channels.selectedChannel()):
			if event.midiId == 128 and event.data2 != 0:
				print('skip')
			elif plugins.getPluginName(channels.selectedChannel()) == 'FPC' and event.data1 in alesis_pads:
				print('FPC')
				channels.midiNoteOn(channels.selectedChannel(), FPC_pads[alesis_pads.index(event.data1 + offset[Switch.offset_iter])], event.data2)
				event.handled = True

		elif Switch.mode_toggle == 1 and event.midiId == 144:						
			if channels.getGridBit(channels.selectedChannel(), event.data1 - 60 + offset[Switch.offset_iter]) == 0:						
				channels.setGridBit(channels.selectedChannel(), event.data1 - 60 + offset[Switch.offset_iter], 1)	
				event.handled = True
			else:															
				channels.setGridBit(channels.selectedChannel(), event.data1 - 60 + offset[Switch.offset_iter], 0)    
				event.handled = True	

		elif Switch.mode_toggle == 2  and 60 <= event.data1 < (channels.channelCount() + 60):
			channels.setChannelPitch(event.data1-60,  mapvalues(Switch.pitch_num, -1, 1, 0, 127))
			channels.selectOneChannel(event.data1-60)  
			channels.midiNoteOn(event.data1-60, 60, event.data2, Switch.pitch_num)
			print('a pad has been hit')
			event.handled = True
예제 #2
0
def getTrackArmID():
    #loop over all plugins (we take the channelCount because we can't know for sure how much plugin are initialized
    #but we can be sure that it's not more than the number of channel)
    for y in range(0,channels.channelCount()):
        #necessary check (or it display an error)
        if plugins.isValid(y):
            #if the name of the plugin is Plume
            if plugins.getPluginName(y) == "Plume":
                #loop over all the parameter of Plume
                for x in range(0,plugins.getParamCount(y)):
                    #if the parameter is call track_arm return it
                    if plugins.getParamName(x,y) == "track_arm":
                        return x
예제 #3
0
 def getPluginIndex(self):
     """Returns the index of the currently selected plugin
     
     Returns:
         int: Index of current plugin
     """
     try:
         if not plugins.getPluginName(
                 self.active_plugin_index) == self.active_plugin:
             self.active_plugin_index = -1
         return self.active_plugin_index
     except:
         # No plugin selected
         return -1
예제 #4
0
	def plugin_control(self):
		
		self.plugin = plugins.getPluginName(self.channel)	
		self.param_count = plugins.getParamCount(self.channel)

		if self.data_one < self.param_count + 19:				#this is probably unneccessary
			if self.plugin in plugin_dict:
				print('has plugin')			
				# print(plugin_dict[self.plugin][knob_num.index(self.data_one)])                                                                             																		
				plugins.setParamValue(mapvalues(self.data_two, 0, 1, 0, 127), plugin_dict[self.plugin][knob_num.index(self.data_one)], self.channel)
				return
			else:		
				print('else')
				plugins.setParamValue(mapvalues(self.data_two, 0, 1, 0, 127), self.data_one - 20, self.channel)
				return
예제 #5
0
def isPlumeTrack(ID):
    PlumeTab = []
    for y in range(0,channels.channelCount()):
        try :
            if plugins.getPluginName(y) == "Plume":
                #if the plugin at the y indice is Plume add the indice to the array PlumeTab
                PlumeTab.append(y)
        except:
            pass
    try:
        #if we can find the ID passed in the function in the PlumeTab we return true, else we return false
        PlumeTab.index(ID)
        return True
    except:
        return False
        pass
    def Sync(self):
        """ Syncs up all visual indicators on keyboard with changes from FL Studio. """
        # Update buttons
        active_index = channels.selectedChannel()
        led_map = {
            ArturiaLights.ID_TRANSPORTS_RECORD: ArturiaLights.AsOnOffByte(transport.isRecording()),
            ArturiaLights.ID_TRANSPORTS_LOOP: ArturiaLights.AsOnOffByte(ui.isLoopRecEnabled()),
            ArturiaLights.ID_GLOBAL_METRO: ArturiaLights.AsOnOffByte(ui.isMetronomeEnabled()),
            ArturiaLights.ID_GLOBAL_SAVE: ArturiaLights.AsOnOffByte(transport.getLoopMode() == 1),
            ArturiaLights.ID_GLOBAL_UNDO: ArturiaLights.AsOnOffByte(general.getUndoHistoryLast() == 0),
            ArturiaLights.ID_TRACK_SOLO: ArturiaLights.AsOnOffByte(channels.isChannelSolo(active_index)),
            ArturiaLights.ID_TRACK_MUTE: ArturiaLights.AsOnOffByte(channels.isChannelMuted(active_index)),
            ArturiaLights.ID_TRANSPORTS_STOP: ArturiaLights.AsOnOffByte(not transport.isPlaying()),
            ArturiaLights.ID_TRANSPORTS_PLAY: ArturiaLights.AsOnOffByte(transport.getSongPos() > 0),
            ArturiaLights.ID_GLOBAL_OUT: ArturiaLights.AsOnOffByte(
                arrangement.selectionEnd() > arrangement.selectionStart()),
        }
        self._lights.SetLights(led_map)

        # Update selected channel
        bank_lights = [ArturiaLights.LED_OFF] * 9
        if active_index < len(bank_lights):
            bank_lights[active_index] = ArturiaLights.LED_ON
        self._lights.SetBankLights(bank_lights)

        # Update display
        channel_name = channels.getChannelName(active_index)
        pattern_number = patterns.patternNumber()
        pattern_name = patterns.getPatternName(pattern_number)

        # Update knob mode
        if self._encoders.GetCurrentMode() == ArturiaInputControls.INPUT_MODE_CHANNEL_PLUGINS:
            plugin_name = plugins.getPluginName(active_index) if plugins.isValid(active_index) else ''
            self._encoders.SetKnobMode(plugin_name)
            self._encoders.SetSliderMode(plugin_name)

        if channel_name.startswith('Analog Lab'):
            channel_name='Analog Lab'

        self._paged_display.SetPageLines(
            'main',
            line1='[%d:%d] %s' % (active_index + 1, pattern_number, channel_name),
            line2='%s' % pattern_name)
        self._encoders.Refresh()
def setParamByIndex(param_index, value,  plugin_index=-1, command=None):
    """Sets a parameter in a plugin given the name of the parameter.

    Args:
        param_index (int): index where the parameter is.
        
        value:
         *  (float):    Value to set the parameter to.
         *  (int):      MIDI value to set the parameter to (will be converted to a float between
                0 and 1).
        
        plugin_index (optional)
         *  (int):              Plugin index to search. Use -1 for currently-selected
                                    plugin's index.
         *  (tuple: 2 ints):    Respectively, mixer track and plugin index to search.
        
        command (ParsedEvent, optional): Command to add handling message to        
    """
    
    if type(value) is int:
        value = processorhelpers.toFloat(value)
    
    plugin_index = _getPluginIndexTuple(plugin_index)
    
    # No plugin selected
    if plugin_index[1] == -1:
        return
    
    plugins.setParamValue(value, param_index, plugin_index[1], plugin_index[0])
    
    if command is not None:
        # For generators, use name on channel rack
        if plugin_index[0] == -1:
            plug_name = channels.getChannelName(plugin_index[1])
        else:
            plug_name = plugins.getPluginName(plugin_index[1], plugin_index[0])
        command.handle(plug_name
                       + ": Set "
                       + plugins.getParamName(param_index, plugin_index[1], plugin_index[0])
                       + " to " + str(round(value * 100)) + "%"
                    )
def TOnRefresh(HW_Dirty_LEDs):
    """ Wrapper for the OnRefresh thread. """
    # PLAY button
    if transport.isPlaying() == True:
        nihia.buttonSetLight("PLAY", 1)

    elif transport.isPlaying() == False:
        nihia.buttonSetLight("PLAY", 0)

    # STOP button
    if transport.isPlaying() == True:
        nihia.buttonSetLight("STOP", 0)

    elif transport.isPlaying() == False:
        nihia.buttonSetLight("STOP", 1)

    # REC button
    if transport.isRecording() == True:
        nihia.buttonSetLight("REC", 1)

    elif transport.isRecording() == False:
        nihia.buttonSetLight("REC", 0)

    # COUNT-IN button
    if ui.isPrecountEnabled() == True:
        nihia.buttonSetLight("COUNT_IN", 1)

    elif ui.isPrecountEnabled() == False:
        nihia.buttonSetLight("COUNT_IN", 0)

    # CLEAR button (moved to OnIdle, since OnRefresh isn't called when focused window changes)

    # LOOP button
    if ui.isLoopRecEnabled() == True:
        nihia.buttonSetLight("LOOP", 1)

    elif ui.isLoopRecEnabled() == False:
        nihia.buttonSetLight("LOOP", 0)

    # METRO button
    if ui.isMetronomeEnabled() == True:
        nihia.buttonSetLight("METRO", 1)

    elif ui.isMetronomeEnabled() == False:
        nihia.buttonSetLight("METRO", 0)

    # MUTE button
    if mixer.isTrackMuted(mixer.trackNumber()) == True:
        nihia.buttonSetLight("MUTE_SELECTED", 1)

    elif mixer.isTrackMuted(mixer.trackNumber()) == False:
        nihia.buttonSetLight("MUTE_SELECTED", 0)

    # SOLO button
    if mixer.isTrackSolo(mixer.trackNumber()) == True:
        nihia.buttonSetLight("SOLO_SELECTED", 1)

    elif mixer.isTrackSolo(mixer.trackNumber()) == False:
        nihia.buttonSetLight("SOLO_SELECTED", 0)

    # Update mixer but peak meters
    updateMixer()

    # Tell the device if a mixer track is selected or not
    # It enables the ability to control mixer tracks using the 4D Encoder on S-Series keyboards
    # Disabled due to lack of awareness on how it is enabled and disabled correctly
    # if ui.getFocused(midi.widMixer) == True:
    #     nihia.mixerSendInfoSelected("SELECTED", "GENERIC")
    #
    # if ui.getFocused(midi.widMixer) == False:
    #     nihia.mixerSendInfoSelected("SELECTED", "EMPTY")

    # Check if the selected plugin is a Komplete Kontrol instance
    if (plugins.isValid(
            channels.channelNumber()) == True):  # Checks if plugin exists
        # If it does, sends the instance ID
        if plugins.getPluginName(
                channels.channelNumber()) == "Komplete Kontrol":
            nihia.mixerSendInfo("KOMPLETE_INSTANCE",
                                0,
                                info=plugins.getParamName(
                                    0, channels.channelNumber()))

        # If it doesn't, tells the keyboard about it
        else:
            nihia.mixerSendInfo("KOMPLETE_INSTANCE", 0, info="")

    else:
        nihia.mixerSendInfo("KOMPLETE_INSTANCE", 0, info="")