I have just started having a go with creating my first script. My basic plan is to create a turntable style pitch(tempo) control. So the idea is the tempo will be grabbed at load time then used to map +/-8% range to a controller which will adjust the tempo. (Not sure I have explained that particularly well there!).
I seem to have stumbled at the first hurdle. For some reason when I perform a tempo().get() as part of the init() it always returns 0. However once the script is loaded and I do something like println(transport.tempo().get()) in the console it works!
Here's my code:
Code: Select all
loadAPI(2);
host.defineController("adamcathersides", "test", "1.0", "1503f960-9c54-11eb-8ab0-0800200c9a66");
host.defineMidiPorts(0, 0);
function init()
{
transport = host.createTransport();
transport.tempo.markInterested();
getTempo()
}
function exit()
{
println('Exited');
}
function flush()
{
}
function getTempo()
{
currentTempo = transport.tempo().get(); //* 646 + 20;
println(currentTempo);
upperRange = currentTempo + currentTempo / 100 * 8
lowerRange = currentTempo - currentTempo / 100 * 8
stepInc = upperRange - lowerRange / 128
println(stepInc)
}
