def processMacros(command):
    global prev_param_index
    if command.type == eventconsts.TYPE_BASIC_FADER and command.coord_X < NUM_MACROS:
        param_str = MACRO + " " + str(command.coord_X + 1)
        prev_param_index = pluginswrapper.setParamByName(
                                param_str, 
                                command.value, -1, prev_param_index, command)
Beispiel #2
0
def process(command):
    command.actions.addProcessor("BBCSO Processor")

    if command.type is eventconsts.TYPE_BASIC_PAD:

        if config.USE_FULL_KEYSWITCHES or command.coord_Y == 1:

            keyswitch_num = processorhelpers.keyswitches.getNum(
                command.coord_X, command.coord_Y, 4, 2)

            command.edit(
                processorhelpers.RawEvent(0x90, keyswitch_num, command.value),
                "Remap keyswitches")

    #
    # Map parameters
    #

    value = processorhelpers.toFloat(command.value)

    if command.type is eventconsts.TYPE_BASIC_FADER:
        if command.coord_X == 0:
            spitfire_generic.setExpression(command)
        elif command.coord_X == 1:
            spitfire_generic.setDynamics(command)

    if command.type is eventconsts.TYPE_BASIC_KNOB:
        if command.coord_X == 0:
            spitfire_generic.setReverb(command)
        elif command.coord_X == 1:
            spitfire_generic.setRelease(command)
        elif command.coord_X == 2:
            spitfire_generic.setTightness(command)

        elif command.coord_X == 3:
            pluginswrapper.setParamByName("Variation", command.value, -1,
                                          VARIATION, command)

        elif command.coord_X == 4:
            spitfire_generic.setVibrato(command)

    return
def processOsc(command):
    global prev_param_index, selected_osc
    
    param_str =  OSCILLATOR + " " + str(selected_osc) + " "
    
    if not pluginswrapper.getParamByName(param_str + OSC_ENABLED):
        selected_osc = 0
    
    if command.type is eventconsts.TYPE_BASIC_PAD and command.coord_Y == 1:
        # Change oscillators
        if command.coord_X < NUM_OSCS:
            osc_num = command.coord_X + 1
            param_str = OSCILLATOR + " " + str(osc_num) + " "
            
            # Acting on selected oscillator
            if osc_num == selected_osc:
                # If disabled
                if not pluginswrapper.getParamByName(param_str + OSC_ENABLED):
                    pluginswrapper.setParamByName(param_str + OSC_ENABLED, 1.0)
                    command.handle("Vital: Enable oscillator " + str(osc_num))
                else:
                    pluginswrapper.setParamByName(param_str + OSC_ENABLED, 0.0)
                    selected_osc = 0
                    command.handle("Vital: Disable oscillator " + str(osc_num))
            
            else:
                # If disabled
                if not pluginswrapper.getParamByName(param_str + OSC_ENABLED):
                    pluginswrapper.setParamByName(param_str + OSC_ENABLED, 1.0)
                    selected_osc = osc_num
                    command.handle("Vital: Enable oscillator " + str(osc_num))
                else:
                    selected_osc = osc_num
                    command.handle("Vital: Select oscillator " + str(osc_num))
        
        else:
            command.handle("Pads catch-all", 1)
            
    # No oscilator selected
    if selected_osc == 0:
        return

    if command.type == eventconsts.TYPE_BASIC_FADER:
        if command.coord_X < len(OSC_FADERS):
            prev_param_index = pluginswrapper.setParamByName(param_str + OSC_FADERS[command.coord_X], command.value, -1, prev_param_index, command)
    
    elif command.type ==  eventconsts.TYPE_BASIC_KNOB:
        if command.coord_X < len(OSC_KNOBS):
            prev_param_index = pluginswrapper.setParamByName(param_str + OSC_KNOBS[command.coord_X], command.value, -1, prev_param_index, command)
def processFilter(command):
    global prev_param_index, selected_filter
    
    param_str =  FILTER + " " + str(selected_filter) + " "
    
    if not pluginswrapper.getParamByName(param_str + FILTER_ENABLED):
        selected_filter = 0
        
    if command.type is eventconsts.TYPE_BASIC_PAD and command.coord_Y == 1:
        # Change filters
        if command.coord_X < NUM_FILTERS:
            filter_num = command.coord_X + 1
            param_str = FILTER + " " + str(filter_num) + " "
            
            # Acting on selected filter
            if filter_num == selected_filter:
                # If disabled
                if not pluginswrapper.getParamByName(param_str + FILTER_ENABLED):
                    pluginswrapper.setParamByName(param_str + FILTER_ENABLED, 1.0)
                    command.handle("Vital: Enable filter " + str(filter_num))
                else:
                    pluginswrapper.setParamByName(param_str + FILTER_ENABLED, 0.0)
                    selected_osc = 0
                    command.handle("Vital: Disable filter " + str(filter_num))
            
            else:
                # If disabled
                if not pluginswrapper.getParamByName(param_str + FILTER_ENABLED):
                    pluginswrapper.setParamByName(param_str + FILTER_ENABLED, 1.0)
                    selected_filter = filter_num
                    command.handle("Vital: Enable filter " + str(filter_num))
                else:
                    selected_filter = filter_num
                    command.handle("Vital: Select filter " + str(filter_num))
        
        else:
            command.handle("Pads catch-all", 1)
        
    # No filter selected
    if selected_filter == 0:
        return

    if command.type == eventconsts.TYPE_BASIC_FADER:
        if command.coord_X < len(FILTER_FADERS):
            prev_param_index = pluginswrapper.setParamByName(param_str + FILTER_FADERS[command.coord_X], command.value, -1, prev_param_index, command)
    
    elif command.type ==  eventconsts.TYPE_BASIC_KNOB:
        if command.coord_X < len(FILTER_KNOBS):
            prev_param_index = pluginswrapper.setParamByName(param_str + FILTER_KNOBS[command.coord_X], command.value, -1, prev_param_index, command)
def processEnv(command):
    global prev_param_index, selected_envelope
    
    param_str =  ENVELOPE + " " + str(selected_envelope) + " "
        
    if command.type is eventconsts.TYPE_BASIC_PAD and command.coord_Y == 1:
        # Change envelopes
        if command.coord_X < NUM_ENVELOPES:
            selected_envelope = command.coord_X + 1
            command.handle("Select envelope")
        
        else:
            command.handle("Pads catch-all", 1)

    if command.type == eventconsts.TYPE_BASIC_KNOB:
        if command.coord_X < len(ENV_KNOBS):
            prev_param_index = pluginswrapper.setParamByName(param_str + ENV_KNOBS[command.coord_X], command.value, -1, prev_param_index, command)
def setVibrato(command):
    global EXPECTED_VIBRATO
    EXPECTED_VIBRATO = pluginswrapper.setParamByName("Vibrato", command.value,
                                                     -1, EXPECTED_VIBRATO,
                                                     command)
def setTightness(command):
    global EXPECTED_TIGHTNESS
    EXPECTED_TIGHTNESS = pluginswrapper.setParamByName("Tightness",
                                                       command.value, -1,
                                                       EXPECTED_TIGHTNESS,
                                                       command)
def setRelease(command):
    global EXPECTED_RELEASE
    EXPECTED_RELEASE = pluginswrapper.setParamByName("Release", command.value,
                                                     -1, EXPECTED_RELEASE,
                                                     command)
def setReverb(command):
    global EXPECTED_REVERB
    EXPECTED_REVERB = pluginswrapper.setParamByName("Reverb", command.value,
                                                    -1, EXPECTED_REVERB,
                                                    command)
def setDynamics(command):
    global EXPECTED_DYNAMICS
    EXPECTED_DYNAMICS = pluginswrapper.setParamByName("Dynamics",
                                                      command.value, -1,
                                                      EXPECTED_DYNAMICS,
                                                      command)
def setExpression(command):
    global EXPECTED_EXPRESSION
    EXPECTED_EXPRESSION = pluginswrapper.setParamByName(
        "Expression", command.value, -1, EXPECTED_EXPRESSION, command)