realearn icon indicating copy to clipboard operation
realearn copied to clipboard

gmem source and target

Open helgoboss opened this issue 1 year ago • 2 comments

Some info here by mschnell: https://forum.cockos.com/showpost.php?p=2794223&postcount=4320 and https://forum.cockos.com/showthread.php?p=2794246#post2794246

helgoboss avatar Jul 06 '24 20:07 helgoboss

Just wrote to Justin after realizing that there's currently no safe way to read/write gmem from C++ extensions. Amazingly, he replied very quickly and added a way to read/write safely. Will be in next dev version. I don't know yet whether it will be official and documented, let's check the next changelog.

The question is now how this new possibility could be used in ReaLearn. I suppose starting with a ReaLearn "gmem source" would be most useful. The way I imagine it to work is this:

  1. A JSFX writes a single numeric (64-bit double) value to the start of a gmem segment with name bla. If that value is supposed to be an absolute value, it should be normalized (a number between 0.0 and 1.0 where 0.0 represents the minimum and 1.0 the maximum). If that value is supposed to be a relative discrete adjustment, any negative or positive integer is allowed.
  2. The ReaLearn source must be configured with the same name (bla). It then picks up any change of the first value of that gmem segment. Also, there's a character dropdown that allows the user to pick between "Absolute normalized" and " "Relative discrete" (so that the values are interpreted correctly).
  3. Whenever ReaLearn detects a change of that value, the source fires with the corresponding control value.
  4. As a result, it can trigger anything!

helgoboss avatar Aug 18 '24 18:08 helgoboss

This sounds amazing ! !

It was a really weird situation that ELL and LUA are able to work with gmem, but C++ / Rust can't :)

mschnell1 avatar Aug 18 '24 20:08 mschnell1