Page 1 of 1

repeated or looped CC message on botton on

Posted: 22 Feb 2012 17:15
by BFred
Hi,

I would like to have a button or pad to act like a computer key, to send the same CC message repeatedly as long as the button is pressed. I intended to use it for the nudge and step bar functions in cubase.

I have limited scripting skills but I'm learning every day...

Any idea how to do that?

Thanks for any help!

Fred

Re: repeated or looped CC message on botton on

Posted: 22 Feb 2012 17:34
by axel_liine
Ok, first create your Pad object.
Then inside the object, create an expression called 'delay' and set it to a value in seconds than represents the delay between messages while the Pad is pressed. For instance, delay=0.5 for one message every 500 milliseconds.
Inside the Pad object, create another expression called 'last_trigger', and set it to zero. This will hold the last instant the message was sent.
Last, inside the Pad object, create a script called "action', set it to "On Frame", and type the following :

Code: Select all

if (x>0)
{
    if (time - last_trigger > delay)
    {
        ctlout(0, 50, 127, 1);
        last_trigger = time;
    }
}
else
{
    last_trigger = 0;
}
Just change the parameters inside ctlout() to whatever you need : target, control number, value, channel

Re: repeated or looped CC message on botton on

Posted: 22 Feb 2012 17:52
by BFred
Wow!

That just works!

Thanks for your fast response

Fred

Re: repeated or looped CC message on botton on

Posted: 22 Feb 2012 20:19
by Phil999
I'm also grateful for this. :)