Cursor Clip Bug?

Post Reply New Topic
RELATED
PRODUCTS

Post

hey guys, is this a bug or am I doing something wrong? Here's my code for adding step observers for the cursorClip.

Code: Select all

SEQ_STEPS=16;
SEQ_KEYS=12;

Code: Select all

cursorClip = host.createCursorClip(SEQ_STEPS, SEQ_KEYS);
cursorClip.addStepDataObserver(onStepExists);

Code: Select all

function onStepExists (step, key, exists)
{
	stepSet[step] = exists;
	stepSet[step] ? stepKey[step] = key : stepKey[step] = 0;
}
The bug happens when I try to move the notes up and down in the piano roll. Moving a note up, fine. Moving a note DOWN doesn't seem to register with the observer. This can be shown in the gyfcat below (sorry I couldn't figure out how to embed it). The top line is the stepSet array and the bottom line is the sepKey array. You can see the observer works fine when I click to add a note and when I move the note up, but when I move the note down the observer just thinks the step is gone. So is this a bug in the API or an issue with my code?

http://gfycat.com/ScornfulElegantFirebelliedtoad

Post

Just an update, this is definitely my script because it works with the Launchpad4Bitwig script.

Post

The usage of the ternary operator looks a bit unusual to me.

You could do:

Code: Select all

function onStepExists (step, key, exists)
{
   stepSet[step] = exists;
   stepKey[step] = stepSet[step] ? key : 0;
}
You could also use an object to represent your steps state instead of two arrays, which might look something like:

Code: Select all


var steps = {};

function onStepExists (step, key, exists)
{
   steps[step] = {
     'exists': exists,
     'key': exists ? key : 0
   }
}

Post

Look in CursorClipProxy.js in our Framework: https://github.com/teotigraphix/Framework4Bitwig

Post

Yup. The problem was trying to define the observer to two separate arrays. Once I made it into a single 2D array it worked fine. Thanks for all the help guys!

Post Reply

Return to “Controller Scripting”