loop selected region

Post Reply New Topic
RELATED
PRODUCTS

Post

hi, is there a way to trigger the "loop selected region" from a script? i can't find it in the api.
i would also be able to move the loop start and length with rotary encoders.

any ideas?

thanks

Post

Hi,

did you found and answer? I'm lloking for the same things!

Post

All items in the shortcut list are "Actions". Get an action with

Code: Select all

Action getAction (String  id)
from Application and call invoke().

To find the ID you can list all actions with getActions().

Here is my test script for actions:

Code: Select all

loadAPI(7);

host.defineController("Moss", "Dump Actions", "1.0", "A2A82633-EC3A-48AD-A5B2-51EBD38F1CB1", "Jürgen Moßgraber");
host.defineMidiPorts(0, 0);

var application = null;
var actions = null;
var formattedActions = null;
var actionList = null;

function init ()
{
    application = host.createApplication ();
    actions = application.getActions ();
    println (actions.length + " actions available.");
    formatActions ();

    var preferences = host.getPreferences ();

    preferences.getSignalSetting (" ", "Dump", "Dump first 200 to console").addSignalObserver (function () {
        for (var i = 0; i < 200; i++)
            println (i + ":" + actions[i].getId () + ":" + actions[i].getCategory ().getName () + ":" + actions[i].getName ());
    });
    preferences.getSignalSetting ("  ", "Dump", "Dump rest to console").addSignalObserver (function () {
        for (var i = 200; i < actions.length; i++)
            println (i + ":" + actions[i].getId () + ":" + actions[i].getCategory ().getName () + ":" + actions[i].getName ());
    });

    actionList = preferences.getEnumSetting ("Actions", "Execute", formattedActions, formattedActions[0]);
    actionList.markInterested ();

    preferences.getSignalSetting ("   ", "Execute", "Execute").addSignalObserver (function () {
        var action = actionList.get ();
        for (var i = 0; i < formattedActions.length; i++)
        {
            if (action == formattedActions[i])
            {
                println ("Executing: " + actions[i].getName ());
                actions[i].invoke ();
            }
        }
    });
}

function formatActions ()
{
    formattedActions = [];
    for (var i = 0; i < actions.length; i++)
        formattedActions[i] = actions[i].getName ();
}

function callAction (actionID)
{
    var action = application.getAction (actionID);
    if (action == null)
        println("Action not found.");
    else
    {
        println("Executing: " + action.getName ());
        action.invoke ();
    }
}

function exit()
{
   println ("Exit");
}

Post

That is awesome Moss! Thanks for the handy script too!
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post Reply

Return to “Controller Scripting”