I am trying to develop a script for the Launch Control XL, to use it as a Drum sequencer.
I am (ridiculously) stuck because of a test that didn't work.
I created a note observer with :
Code: Select all
cursorClip.addNoteStepObserver(NewNote);Code: Select all
function NewNote(note) {
println("X: "+note.x()+" Y: "+note.y()+" State: "+note.state());
if (note.state() == 1 ) { // if the note is on show "Catch"
println("Catch");
} else {
println("Not catch");
}
}
As expected, but why (the hell) my "if" return always "Not catch" ?X: 0 Y: 36 State: NoteOn
I try all possible variant I know, like creating a variable like this :
Code: Select all
var noteState = {
Empty: 0,
NoteOn: 1,
NoteSustain: 2,
};Code: Select all
if ( note.state() == noteState.NoteOn )It is written in the Bitwig "NoteStep.js" as reference :
Code: Select all
/**
* @since API version 10
*/
com.bitwig.extension.controller.api.NoteStep.State = {
Empty: 0,
NoteOn: 1,
NoteSustain: 2,
};