first time scripting

RELATED
PRODUCTS

Post

Cheers, yes it was the typo that confused me. I look forward to trying this code tomorrow. Getting there very slowly hehe

Best

Post

hi guys. I tried this new code, and although it didn't break the script it didn't work... unless i've done something wrong. I'll paste my code screengrabs below.

What is happening is that when i'm recording if i press the 4th button, it stops playing. Then i press it again and it undos. Then every addition press it undos some more steps back.

My aim is to have the button stop, undo, start - all in one go. This seems like it should be a really simple fundamental thing. I don't see how i will ever master this if such a easy one is proving tricky - how would i hope to achieve a more complex function lol! :-)

all help appreciated!

best

(pasted into INIT function)
Screen Shot 2015-12-30 at 20.44.27.png
(pasted into main transport part)
Screen Shot 2015-12-30 at 20.45.21.png
You do not have the required permissions to view the files attached to this post.

Post

Replace the code above with this;

Since there is no debugger, you need to trace everything to make sure the flow is what you expect.

Post back with the traces of what pressing the button does a couple times.

Code: Select all

var isTriggered = false;
application = host.createApplication();
transport = host.createTransport();
transport.addIsPlayingObserver(function(val){
    if (!val && isTriggered){
        println("enter if() isTriggered:" + isTriggered);
        transport.play();
        println("transport.play() isTriggered:" + isTriggered));
        isTriggered = false;
    }
});
and

Code: Select all

else if (data1 - S1 == 3)
{
    println("Button pressed");
    transport.stop();
    println("transport.stop()");
    application.undo();
    println("application.undo()");
    isTriggered = true;
}
Mike
Michael Schmalle
http://www.teotigraphix.com
Surfing on sine waves

Maschine4Bitwig - Studio, MK2, MikroMK2, MK1
http://www.teotigraphix.com/bitwig/maschine

Post Reply

Return to “Controller Scripting”