Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 12-15-2018, 10:05 AM   #1
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
Default Please improve get_action_context()!

get_action_context() desperately needs to return:
  1. the MIDI event value that was bound to the action (e.g. CC or note number)
  2. the MIDI channel of the event
  3. the full OSC message string

The basic reason is to improve script/action reusability.

One specific use-case: with Reaticulate, one can activate up to 128 articulations on 16 channels. I have an action "activate articulation by CC" which allows you to bind a CC to that action and activate an articulation based on the CC.

Because get_action_context() doesn't return the MIDI channel of the triggering event, I need to have 16 separate such actions (activate on channel 1, channel 2, ..., 16). Although still annoying and spammy, this isn't the end of the world when you're talking about 16 variants of all the applicable actions, and there's certainly enough precedent within Reaper's native actions.

However, users are asking to be able to activate articulations by note events or program change events. Now I have a problem: because get_action_context() doesn't tell me the note/program number, I would need to create 128*16=2048 individual Reaper actions to solve this (128 actions for each of the 128 programs times 16 channels). I could do it theoretically, but I would be inundating the user's action list with Reaticulate actions.

If get_action_context() returned the note/program number as well as the source channel, all I'd need is one action "Activate articulation by MIDI event" and the user could bind the CC, plus all relevant notes and program changes on all channels to a single action.

Tedious for the user to set up (though not nearly as tedious as having separate actions), but at least I'm avoiding the explosion of discrete actions spamming the user's action list.

Last edited by tack; 12-15-2018 at 01:37 PM.
tack is offline   Reply With Quote
Old 12-15-2018, 10:40 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Totally agree.


Meanwhile, I created the Last MIDI event monitor jsfx (avaible in my free reapack repo),
when an action is trigger it check the value of this slider to get the channel of the last MIDI event.
Works pretty well, but not as handy as a native solution.
X-Raym is offline   Reply With Quote
Old 08-01-2019, 06:41 PM   #3
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
Default

Thought I'd bump this again. Again in need of discovering which event (note and channel) it was that triggered an action, and the best I can do is detect velocity, which isn't actually useful for my case.
tack is offline   Reply With Quote
Old 08-02-2019, 09:16 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

Should be placed into Feature-Requests.

I would love to have track, item, take, position, envelopeidx, envelope-point as well.
This would help for scripts, who are run from context-menus after rightclicking an item, envelope-point, etc.

Maybe midi-note in a MidiMediaItem would be nice as well, but don't know, how Midi-Notes are numbered(haven't looked into that yet).
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-23-2021, 11:12 AM   #5
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
Default

Just another plea for this enhancement of get_action_context().

(Mods please feel free to move to the FR subforum if it's better suited there.)
tack is offline   Reply With Quote
Old 01-23-2021, 01:04 PM   #6
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

I agree!

(and moved to Feature Requests)
juliansader is offline   Reply With Quote
Old 01-23-2021, 01:24 PM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

This would be great. One could have shortcut/osc-message/midi-message sensitive scripts that react accordingly without having tons of these scripts in the actionlist.


I would add:

The shortcut-codes(as stored as well in the kb.ini) should be gettable as well. So I could have a script, that reacts different to being run with Ctr/Alt/Shift versus without.

Ctrl+E makes a different thing than just E.

The codes are documented by me, so adding that would be easy to do for scripters.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-23-2021, 11:42 PM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,776
Default

Quote:
Originally Posted by tack View Post
get_action_context() desperately needs to return:
  1. the MIDI event value that was bound to the action (e.g. CC or note number)
  2. the MIDI channel of the event
  3. the full OSC message string
Quote:
Originally Posted by Meo-Ada Mespotine View Post
The shortcut-codes(as stored as well in the kb.ini) should be gettable as well. So I could have a script, that reacts different to being run with Ctr/Alt/Shift versus without.
I also failed to find out if/how get_action_context() could be used for messages resulting from OSC events (i.e. scripts fired by actions that were "learned" to OSC events) at all. This is rather frustrating in certain cases.

Of course (supposedly?) get_action_context() only "sees" what is encoded in the Control Path message that fired the script and that was generated by Reaper as a result of some event. Such events might be:
  • incoming Midi with "Control" enabled in the midi device settings. I suppose this reacts only on CC message hence maybe the Midi message type is not encoded in the Control path message AFAIK, the channel is used in the "Learn" process.
  • OSC messages (I fail to know any details)
  • The "MidiToReaControlPath" VST plugin (reacts not only on Midi CCs, but on certain other Midi messages, as well)
  • Reaper extensions and scripts (via the Raeper API, but I don't know the details)
  • ???
So I don't know what exactly can be encoded in such a Reaper Control Path message. It seems for Midi Type generated Control Path messages, the channel is encoded there (as it's used by "Learn" but the message type might be lost right away. Maybe get_action_context() does not provide the channelas it its supposed to be already decoded via the "Learn" Algoritm (and OSC might not be coniudered at all)
-Michael

Last edited by mschnell; 01-24-2021 at 04:28 PM.
mschnell is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.