Script example with scene launcher button, generic action toggle, 6 faders, 3 potentiometers

Post Reply New Topic
RELATED
PRODUCTS

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Dear forum members
I've written a small controller script for my homebrew controller with 3 potentiometers, 5 faders and two push buttons.
In my workflow, I'm assigning m faders and potentiometers ad hoc to different controls. For these, the script just assigns the same names as printed on my hardware. My controller also has two push buttons. One is assigned to the generic application action to toggle the assignment panel. The second starts the next scene in the mixer view. The user can tell the controller which scene to start next using the controller menu.
You can find the code on gitlab: https://gitlab.com/mad4linux/gidim43/-/ ... type=heads (https://gitlab.com/mad4linux/gidim43/-/tree/main/gidim43bitwig-controller-script?ref_type=heads)

The bit tricky part was starting the next scene with a button. My solution is getting a scene bank with one scene.

Code: Select all (#)

sceneStrip = host.createSceneBank(1);
Then, we need to be able to read two variables later:

Code: Select all (#)

sceneStrip.scrollPosition().markInterested();
sceneStrip.itemCount().markInterested();
The user input field is an ordinary text input:

Code: Select all (#)

activeScene = host.DocumentState.getStringSetting("Pressing B2 starts scene", "Gidim43", 1, "1");
The code above is called during the init routine.
Then, when pressing the assigned button, the value from the text input is read, checked for non numeric values and also boundaries of the song:

Code: Select all (#)

let actScene = parseInt(activeScene.get()) - 1; // indexes from 0, scenes from scene1
if (isNaN(actScene)) { actScene = 0; }
if (actScene < 0) { actScene = 0; } 
else if (actScene >= parseInt(sceneStrip.itemCount().get())) { 
			actScene = parseInt(sceneStrip.itemCount().get()) - 1; 
}
Then, the scene bank is moved to the desired position and the only bank in it is started:

Code: Select all (#)

sceneStrip.scrollPosition().set(actScene);  
sceneStrip.launch(0);
At least, the value in the text input is increased to the next number for the next button press:

Code: Select all (#)

activeScene.set(parseInt(actScene + 2)); // increase by one

Post Reply

Return to “Controller Scripting”