Multi CC Remapper



  • Here's a handy little module that can remap as many CCs as a slider pack can handle and if you need more just load another copy of the script. You can also map a single CC to multiple target CCs. The script also displays the current value of each origin controller and you can move the value sliders to output CC values too.

    /**
     * Title: Multi CC Remapper v1.0.0.js
     * Author: David Healey
     * Date: 30/06/2017
     * Modified: 30/06/2017
     * License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html
    */
    
    Content.setHeight(275);
    
    const var COUNT = 15; //The number of CCs you want to remap
    
    const var origin = Content.addSliderPack("sliOrigin", 0, 0);
    const var target = Content.addSliderPack("sliTarget", 260, 0);
    const var ccValue = Content.addSliderPack("sliValue", 520, 0);
    
    origin.set("sliderAmount", COUNT);
    target.set("sliderAmount", COUNT);
    ccValue.set("sliderAmount", COUNT);
    origin.set("min", 0);
    target.set("min", 0);
    ccValue.set("min", 0);
    origin.set("max", 127);
    target.set("max", 127);
    ccValue.set("max", 127);
    origin.set("stepSize", 1);
    target.set("stepSize", 1);
    ccValue.set("stepSize", 1);
    origin.set("width", 250);
    target.set("width", 250);
    ccValue.set("width", 250);
    origin.set("height", 200);
    target.set("height", 200);
    ccValue.set("height", 200);
    
    const var lblOrigin = Content.addLabel("Origin", 105, 225);
    const var lblTarget = Content.addLabel("Target", 365, 225);
    const var lblValue = Content.addLabel("Value", 625, 225);
    
    function onNoteOn()
    {
    }
    
    function onNoteOff()
    {
    }
    
    function onController()
    {
    	for (i = 0; i < origin.getNumSliders(); i++)
    	{
    		if (origin.getSliderValueAt(i) == 0) continue; //0 = not used
    
    		if (Message.getControllerNumber() == origin.getSliderValueAt(i))
    		{
    			Message.ignoreEvent(true);
    			if (target.getSliderValueAt(i) > 0)
    			{
    				Synth.sendController(target.getSliderValueAt(i), Message.getControllerValue());
    				ccValue.setSliderAtIndex(i, Message.getControllerValue());
    			}
    		}
    	}
    }
    
    function onTimer()
    {
    }
    
    function onControl(number, value)
    {
    	if (number == ccValue)
    	{
    		if (target.getSliderValueAt(value) > 0)
    		{
    			Synth.sendController(target.getSliderValueAt(value), ccValue.getSliderValueAt(value));
    		}
    	}
    }
    

 

3
Online

353
Users

1.1k
Topics

7.5k
Posts