|
|
|
01-20-2019, 11:16 AM
|
#1
|
Human being with feelings
Join Date: Mar 2016
Posts: 1,239
|
Deferred script acting on MIDI input
Hi all
Another question please - I appreciate all the help and advice here.
Suppose I want to create a script which can be "switched on and off" so it persists once turned on, until it's turned off. Whilst running, I need it to act based on MIDI input from a control knob.
I understand (or at least, I think I do!) that I defer the script main function once it's started, in order for it to keep running repeatedly. But beyond that, some questions about how to do it....
1) I think I need get_action_context in order to "listen" for the MIDI input, but I can't find a resource to explain properly how to use it.
2) I need to execute one block of code if the MIDI knob value is increased from the last time, and another if decreased. I'm sure this should be possible if I can figure out how to get the MIDI value change into a variable.
3) How do I terminate the deferred script with an atexit section?
Sorry for all the basic questions, but I'm a beginner at coding of any kind, not just ReaScript!
Thanks
Andy
|
|
|
01-20-2019, 02:56 PM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Have you made a demo-script, where calling get_action_context() change its returned values in every defer-cycle?
That way you can see, whether it's possible in the first place(as far as I remember not, but I might be wrong).
|
|
|
01-20-2019, 03:09 PM
|
#3
|
Human being with feelings
Join Date: Mar 2016
Posts: 1,239
|
No, because I don't understand enough about get-action-context to do so.
I don't know how to tell it which controller/input to "look at" for example.
Hence asking for a basic explanation of how to use it.
Thanks
Andy
|
|
|
01-20-2019, 10:59 PM
|
#4
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
|
To handle Midi input it might be a better idea to do a JSFX instead of a script.
-Michael
|
|
|
01-21-2019, 02:24 AM
|
#5
|
Human being with feelings
Join Date: Mar 2016
Posts: 1,239
|
LOL the last thing I need right now is to have to learn a whole new language!!
What I'm trying to do is create some item editing scripts which respond to some kind of physical controller (I don't actually care whether it's a MIDI knob, or something like a Contour Shuttle which can send standard key commands).
So, for instance, a rotary knob which sends a "click up/down" command as it is turned. I need the script to recognise a "click down", and do its stuff (which acts on lots of items, conditional on Ripple states etc).
The only reasons I'm thinking of making this a "persistent" script are 1) that running a single script each time the "click" input is received makes Undo History management harder (because I might turn the knob 50 clicks to get to where I want it, and then I don't want 50 entries in the Undo to go through) and b) some of the items move according to conditions met on the FIRST click.
I can solve the second one using ExtStates and a "toggle mode" kind of script to define when I want to consider the editing to start and stop, and then call each click of the wheel/knob as a separate script. But the Undo History thing is trickier, unless I can stop some of the functions I'm using within the script from generating entries in the Undo list (even though the whole script has no Undo block code).
Does that make sense?
|
|
|
01-21-2019, 06:28 AM
|
#6
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
|
Quote:
Originally Posted by andyp24
LOL the last thing I need right now is to have to learn a whole new language!!
|
???
JSFX and ReaScript both can be done using EEL.
Quote:
Originally Posted by andyp24
What I'm trying to do is create some item editing scripts which respond to some kind of physical controller
|
Maybe "CSI" can help without you doing any programming/scripting but just providing configuration files. See the "Control Surface" subforum.
-Michael
|
|
|
01-21-2019, 06:44 AM
|
#7
|
Human being with feelings
Join Date: Mar 2016
Posts: 1,239
|
Thanks.... I've been trying to learn Lua, as I was told it's easier than EEL. So, although ReaScript and JS both use EEL, it's still another language I'd have to learn.
And the item editing I'm creating is something that can't be done natively (it changes the way Ripple works, among other things) so I do need the scripting element either way.
Cheers
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:38 AM.
|