Controlling a SpecificVst3Device on any channel with its corresponding fader

Post Reply New Topic
RELATED
PRODUCTS
Bitwig Studio 6$399.00Buy

Post

Hi.

I made a custom script for my M-Audio Axiom Pro 61 2nd Gen from snippets and custom code. It uses the keys and transport in the standard way except for FFW/FREV which cycles the cursor track over the channels. The pads are used for opening master bus effect windows, buttons toggle solo per channel and this all works fine so far. I also have some preferences and notifications but stripped all that away in the following code.
consoleControlStripped.control.js.7z
What I want and can't achieve is this: Each of the 8 faders of the controller shall open the plugin window of a SpecificVst3Device and control its level parameter. These devices are channel strip plugins (which can be either a channel or a bus plugin). In some version of the script I successfully identified and filtered the devices and controlled the level but I can only do it on one channel but not on any channel the plugin occurs on. It's an issue with my javascript skills and the callback/scope thing. Unfortunately I can't just fill an array and access it on the fader move because of this, that much I know but I can't figure it out. Basically the script gets fishy and fails from lines 128 to 151. It's rather how I want it to work than valid code. ^^ Any help would be much appreciated. Thank you very much.

Bo
You do not have the required permissions to view the files attached to this post.

Post

You need to use Java to find specific devices. See my tutorial about it:

Post

Hi moss,

thank you for your quick reply and sorrry for me being late. I saw your tutorial, that's how I was able to do this: "In some version of the script I successfully identified and filtered the devices and controlled the level but I can only do it on one channel but not on any channel the plugin occurs on."
Now i succeeded in filtering plugins, creating and controlling parameters by faders and opening plugin windows on the whole trackBank as well.
It's possible with javscript btw. luckily no need for java, which I never used. I was able to do it in js only because of my COFFEE experience in Cinema4D btw. ;)

Cheers.

Post

synesthetic wrote: Sat Feb 20, 2021 2:54 pm Hi moss,

thank you for your quick reply and sorrry for me being late. I saw your tutorial, that's how I was able to do this: "In some version of the script I successfully identified and filtered the devices and controlled the level but I can only do it on one channel but not on any channel the plugin occurs on."
Now i succeeded in filtering plugins, creating and controlling parameters by faders and opening plugin windows on the whole trackBank as well.
It's possible with javscript btw. luckily no need for java, which I never used. I was able to do it in js only because of my COFFEE experience in Cinema4D btw. ;)

Cheers.
So, I guess you did not use Bitwig devices? Or did you find a way to create an instance of UUID?

Post

Yes, it's SpecificVst3Devices. Strangely I can filter channel and bus plugins and open their plugin windows but only access the level parameter of one kind, either channel or bus plugins. In this case (see attached image) the faders on my controller open the plugin windows correctly but only the level of the left one can be controlled although the parameter ID ("levelID") of both plugins is the same. Any ideas how to solve this?
Snippet:

Code: Select all

function callFader(index, noteVelocity)
{
	consoleDevice= consoleDevices[index];
	consoleDevice.isWindowOpen().set(true); 
	levelParam= levelParameters[index];
	levelParam.setIndication(true);
	levelParam.value().set(noteVelocity, 128);
}

function init() {
	println("____consoleStripped");
	transport = host.createTransport();
	host.getMidiInPort(0).setMidiCallback(onMidi);
	host.getMidiInPort(0).setSysexCallback(onSysex);
	noteInput = host.getMidiInPort(0).createNoteInput("Axiom Pro 61", "80????", "90????", "B001??", "B002??", "B00B??", "B040??", "C0????", "D0????", "E0????");
	noteInput.setShouldConsumeEvents(false);

	cursorTrack = host.createCursorTrack("cid", "CursorTrack", 4, 0, true);	
	cursorTrack.name().markInterested();
    trackBank = host.createTrackBank(8, 0, 0);
	var bankSize= trackBank.getSizeOfBank();
	var delta= 0;
 	for (var t = 0; t < bankSize; t++)
	{
		var track = trackBank.getItemAt(t);
		track.name().markInterested();
		track.name().addValueObserver(20, "", nameCallbackFunction(t, function(index, name)
		{
			trackNames[t]= track.name().get();
		}));
		filterDeviceBank= track.createDeviceBank(1);
		consoleDeviceMatcher=  host.createVST3DeviceMatcher(consoleID);
		consoleBusDeviceMatcher=  host.createVST3DeviceMatcher(consoleBusID);
		orDeviceMatcher= host.createOrDeviceMatcher(consoleDeviceMatcher, consoleBusDeviceMatcher);
		filterDeviceBank.setDeviceMatcher(orDeviceMatcher);
		filteredDevice= filterDeviceBank.getItemAt(0);
		filteredDevice.name().addValueObserver(20, "", nameCallbackFunction(t, function(index, name)
		{
			consoleDeviceNames[t] = name;
		}));
		specificVSTDevice= filteredDevice.createSpecificVst3Device(consoleID);
		if(specificVSTDevice == undefined) specificVSTDevice= filteredDevice.createSpecificVst3Device(consoleBusID);

		consoleDevices[t]= filteredDevice; 
		specificVSTDevices[t]= specificVSTDevice;
		levelParam= specificVSTDevice.createParameter(levelID);
		levelParam.value().markInterested();
		levelParameters[t]= levelParam;
	} 
		
    host.showPopupNotification("consoleControlStripped initialized!");
}

function onMidi(status, noteNumber, noteVelocity) {
    printMidi(status, noteNumber, noteVelocity);

    if (isChannelController(status)) { 
		switch(noteNumber) {
			case CC.FADER1:
				callFader(0, noteVelocity);
				break;
			case CC.FADER2:
				callFader(1, noteVelocity);
				break;
			case CC.FADER3:
				callFader(2, noteVelocity);
				break;
			case CC.FADER4:
				callFader(3, noteVelocity);
				break;
			case CC.FADER5:
				callFader(4, noteVelocity);
				break;
			case CC.FADER6:
				callFader(5, noteVelocity);
				break;
			case CC.FADER7:
				callFader(6, noteVelocity);
				break;
			case CC.FADER8:
				callFader(7, noteVelocity);
				break;
			case CC.CURSOR:
				cursorTrack.volume().set(noteVelocity, 128);
				break;
		}

        if (isUserCc(noteNumber)) {
            var index = ccToUserIndex[noteNumber];
            userControls.getControl(index).set(noteVelocity, 128);
        }
    }
}
You do not have the required permissions to view the files attached to this post.

Post

The line "if(specificVSTDevice == undefined)" will not work since you will always get an instance. What you need to do instead is to check the exists property, which means the filter has a match.

Post

Thanks, Moss. In case somebody is interested, I did the check on the parameter now, not the specificDevice. I also appended devices and parameters by .push() so I have no gaps on my faders. Everything is working fine now like this:

Code: Select all

function parameterCallbackFunction(device, entry, index, f)
{
	return function(value)
	{
		f(index, value);
		if(value)
		{
			consoleDevices.push(device);
			levelParameters.push(entry);
		}
	};
}

function callFader(index, noteVelocity)
{
	consoleDevices[index].isWindowOpen().set(true); 
	var levelParameter= levelParameters[index];
	levelParameter.setIndication(true);
	levelParameter.value().set(noteVelocity, 128);
}

function init() {
	println("____consoleStripped");
	transport = host.createTransport();
	host.getMidiInPort(0).setMidiCallback(onMidi);
	host.getMidiInPort(0).setSysexCallback(onSysex);
	noteInput = host.getMidiInPort(0).createNoteInput("Axiom Pro 61", "80????", "90????", "B001??", "B002??", "B00B??", "B040??", "C0????", "D0????", "E0????");
	noteInput.setShouldConsumeEvents(false);

	cursorTrack = host.createCursorTrack("cid", "CursorTrack", 4, 0, true);	
	cursorTrack.name().markInterested();
    trackBank = host.createTrackBank(8, 0, 0, true);
	var bankSize= trackBank.getSizeOfBank();
 	for (var t = 0; t < bankSize; t++)
	{
		var track = trackBank.getItemAt(t);
		var filterDeviceBank= track.createDeviceBank(1);
		var consoleDeviceMatcher=  host.createVST3DeviceMatcher(consoleID);
		var consoleBusDeviceMatcher=  host.createVST3DeviceMatcher(consoleBusID);
		var orDeviceMatcher= host.createOrDeviceMatcher(consoleDeviceMatcher, consoleBusDeviceMatcher);
		filterDeviceBank.setDeviceMatcher(orDeviceMatcher);
		var filteredDevice= filterDeviceBank.getItemAt(0);
		var specificVSTDevice= filteredDevice.createSpecificVst3Device(consoleID);
		var specificVSTDeviceBus= filteredDevice.createSpecificVst3Device(consoleBusID);
		var levelParam= specificVSTDevice.createParameter(levelID);
		var levelParamBus= specificVSTDeviceBus.createParameter(levelID);
 		levelParam.exists().addValueObserver(parameterCallbackFunction(filteredDevice, levelParam, t, function(index, newValue){ }));
		levelParamBus.exists().addValueObserver(parameterCallbackFunction(filteredDevice, levelParamBus, t, function(index, newValue){ }));
	} 
		
    host.showPopupNotification("consoleControlStripped initialized!");
}
Cheers.

Post Reply

Return to “Controller Scripting”