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")
    """ Link to parameters - Fix this once API updates
    if command.id == eventconsts.BASIC_FADER_1:
        command.edit(eventprocessor.rawEvent(0xB0, EXPRESSION, command.value))
    
    if command.id == eventconsts.BASIC_FADER_2:
        command.edit(eventprocessor.rawEvent(0xB0, DYNAMICS, command.value))
    
    if command.id == eventconsts.BASIC_FADER_3:
        command.edit(eventprocessor.rawEvent(0xB0, REVERB, command.value))
    """

    return
def process(command):
    command.actions.addProcessor("Error note handler")
    
    if (command.type is eventconsts.TYPE_BASIC_PAD or command.type == eventconsts.TYPE_PAD) and command.is_lift and command.getPadCoord() == (8, 1):
        internal.errors.recoverError(False, True)
        command.handle("Recover error")
        
    elif (command.type is eventconsts.TYPE_BASIC_PAD or command.type == eventconsts.TYPE_PAD) and command.is_lift and command.getPadCoord() == (8, 0):
        internal.errors.recoverError(True, True)
        command.handle("Recover error, entered debug mode")
            
    elif config.CHAOTIC_EVIL_ERROR_NOTE_HANDLER and command.type is eventconsts.TYPE_NOTE:
        
        # Do chaotic evil things
        if not command.is_lift:
            
            notes_list = [processorhelpers.RawEvent(0, x, 127) for x in range(127, -1, -1)]
            
            note = processorhelpers.ExtensibleNote(command, notes_list)
            
            internal.notesDown.noteOn(note)
            
            command.handle("All notes on")
            
        else:
            internal.notesDown.allNotesOff()
            command.handle("All notes off")
    else:
        if not (command.type in internal.consts.SHIFT_IGNORE_TYPES):
            command.handle("Device in error state")
Ejemplo n.º 3
0
def process(command):
    """Called with an event to be processed by your note processor. Events aren't filtered so you'll want to make sure your processor checks that events are notes.

    Args:
        command (ParsedEvent): An event for your function to modify/act on.
    """
    command.addProcessor("Omni Mode Processor")
    # If command is a note
    if command.type is eventconsts.TYPE_NOTE:
        # Set status byte to channel 0xD (Omni preview channel)
        new_status = (command.status_nibble << 4) + internal.consts.OMNI_CHANNEL_STATUS
        command.edit(processorhelpers.RawEvent(new_status, command.note, command.value), "Remap for omni mode")
        command.ignore("Switch to omni channel", True)
    
    elif command.type is eventconsts.TYPE_BASIC_PAD or command.type is eventconsts.TYPE_PAD:
        if command.coord_X < 8:
            new_status = (9 << 4) + internal.consts.OMNI_CHANNEL_STATUS
            new_velocity = (config.DRUM_PADS_FULL_VELOCITY * 127 + (not config.DRUM_PADS_FULL_VELOCITY) * command.value) * (command.value != 0)
            command.edit(processorhelpers.RawEvent(new_status, PAD_MAPPINGS[command.coord_X][command.coord_Y], new_velocity), "Remap for omni mode")
            command.ignore("Remap to omni mode", True)
def process(command):
    """Called with an event to be processed by your note processor. Events aren't filtered so you'll want to make sure your processor checks that events are notes.

    Args:
        command (ParsedEvent): An event for your function to modify/act on.
    """
    global current_set
    command.addProcessor("Note Randomiser Processor")

    # If the note processor isn't initialised, call the initialise function instead
    if not INIT_COMPLETE:
        processInit(command)
        return

    # If command is a note
    if command.type is eventconsts.TYPE_NOTE:
        if command.value:
            new_note = chord_sets[current_set][math.floor(
                abs(rng.random() * len(chord_sets[current_set]) - 0.01))]
            internal.notesDown.noteOn(
                processorhelpers.ExtensibleNote(command, [
                    processorhelpers.RawEvent(command.status, new_note,
                                              command.value)
                ]))
            command.handle("Randomise note")
        else:
            internal.notesDown.noteOff(command)
            command.handle("Randomise note off", True)

    elif command.id == eventconsts.PEDAL:
        if command.is_lift:
            command.handle("Pedal lift", True)
        else:
            toNextSet()
            if not internal.getPortExtended():
                # Forward note
                internal.sendCompleteInternalMidiMessage(command.getDataMIDI())
            command.handle("Next chord set")

    elif command.type is eventconsts.TYPE_PAD:
        if command.coord_Y == 1 and command.coord_X < 8:
            if len(chord_sets[command.coord_X]):
                current_set = command.coord_X
                command.handle("Set chord set number")
            else:
                command.handle("Chord set doesn't exist")
        elif command.coord_Y == 0 and command.coord_X < 8:
            command.handle("Drum pads catch-all", True)
def process(command):
    """Called with an event to be processed by your note processor. Events aren't filtered so you'll want to make sure your processor checks that events are notes.

    Args:
        command (ParsedEvent): An event for your function to modify/act on.
    """
    command.addProcessor("Scale Processor")

    if not INIT_COMPLETE:
        processInit(command)

    # If command is a note
    elif command.type is eventconsts.TYPE_NOTE:
        if not command.is_lift:
            note = command.note % 12
            octave = command.note // 12

            if SNAP_NOTES == None:
                return

            closest_distance = 13
            closest_note = None
            closest_octave = 0
            for x in SNAP_NOTES:
                distance = abs(note - x)
                if distance < closest_distance:
                    closest_note = x
                    closest_distance = distance
                    if distance == 0:
                        break

            new_note = closest_note + octave * 12 + closest_octave * 12
            if PREVENT_NONSCALE and new_note != command.note:
                command.handle("Prevent non-scale note", True)
                return
            internal.notesDown.noteOn(
                processorhelpers.ExtensibleNote(command, [
                    processorhelpers.RawEvent(command.status, new_note,
                                              command.value)
                ]))
            command.handle("Snapped note on", True)
        else:
            internal.notesDown.noteOff(command)
            command.handle("Snapped note off", True)

    pass
Ejemplo n.º 6
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
Ejemplo n.º 7
0
def process(command):
    """Called when processing commands. 

    Args:
        command (ParsedEvent): contains useful information about the event. 
            Use this to determing what actions your processor will take.
    """

    # Add event processor to actions list (useful for debugging)
    command.actions.addProcessor("Slicex Processor")

    if command.type == eventconsts.TYPE_BASIC_PAD and command.coord_Y == 1:
        keyswitch_num = processorhelpers.keyswitches.getNum(
            command.coord_X, command.coord_Y, -1, -1, 0)

        if internal.window.active_plugin == "Slicex":
            keyswitch_num += 60

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

    return
Ejemplo n.º 8
0
def process(command):
    """Called with an event to be processed by your note processor. Events aren't filtered so you'll want to make sure your processor checks that events are notes.

    Args:
        command (ParsedEvent): An event for your function to modify/act on.
    """
    global RECENT_NOTE_UPPER, RECENT_NOTE_LOWER
    command.addProcessor("Chord Processor")
    
    if not INIT_COMPLETE:
        processInit(command)
        return
    
    # If command is a note
    elif command.type is eventconsts.TYPE_NOTE:
        if not command.is_lift:
            # How far note is up scale
            scale_pos = command.note - ROOT_NOTE
            
            notes_list = chords.getChord(scale_pos)
            
            if DO_INVERSIONS:
                """
                print(ROOT_NOTE)
                print(ROOT_NOTE_UNADJUSTED)
                print(notes_list)
                for note_num in range(len(notes_list)):
                    if notes_list[note_num] + ROOT_NOTE - ROOT_NOTE_UNADJUSTED > 12:
                        notes_list[note_num] -= 12
                    if notes_list[note_num] + ROOT_NOTE - ROOT_NOTE_UNADJUSTED <= -12:
                        notes_list[note_num] += 12
                """
                
                if RECENT_NOTE_LOWER != -1:
                    for note_num in range(len(notes_list)):
                        if (RECENT_NOTE_LOWER < (notes_list[note_num] - 12) < RECENT_NOTE_UPPER) \
                            or abs( (notes_list[note_num] - 12) - RECENT_NOTE_LOWER ) < abs( (notes_list[note_num]) - RECENT_NOTE_UPPER ):
                                notes_list[note_num] -= 12
                        elif (RECENT_NOTE_LOWER < (notes_list[note_num] + 12) < RECENT_NOTE_UPPER) \
                            or abs( (notes_list[note_num] + 12) - RECENT_NOTE_UPPER ) < abs( (notes_list[note_num]) - RECENT_NOTE_LOWER ):
                                notes_list[note_num] += 12
                                
                notes_list = sorted(notes_list)
                RECENT_NOTE_LOWER = notes_list[0]
                RECENT_NOTE_UPPER = notes_list[-1]
                               
                
            
            notes_events = []
            for i in range(len(notes_list)):
                if ENABLE_RANDOMNESS:
                    new_velocity = int(2*(rng.random() - 0.5) * MAX_VEL_OFFSET * (command.value/127)) + command.value
                    if new_velocity > 127:
                        new_velocity = 127
                    elif new_velocity < 0:
                        new_velocity = 0
                else:
                    new_velocity = command.value
                notes_events.append(processorhelpers.RawEvent(command.status, notes_list[i] + ROOT_NOTE, new_velocity))
            
            send_notes = processorhelpers.ExtensibleNote(command, notes_events)
            command.handle("Chord on: " + chords.getRecentName())
            
            notesDown.noteOn(send_notes)
        else:
            command.handle("Chord off")
            notesDown.noteOff(command)
    
    pass