Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

View Poll Results: Could this work?
Yes it could work and I want it 3 60.00%
Yes it could work 1 20.00%
No, it cannot work, because ... 1 20.00%
Voters: 5. You may not vote on this poll

Reply
 
Thread Tools Display Modes
Old 09-10-2016, 11:01 AM   #1
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 19,677
Default "Control Surface" in a LUA script?

As I understand it, a control surface sends control messages to Reaper in some format, these are decoded by the Control Surface plug-in and passed to Reaper. And back the other way.

Now, some keyboard controllers just send MIDI messages. So (and this may be impractical / a daft idea) how about a LUA script to receive these messages, work out what to do and pass them to Reaper, interrogate Reaper and send MIDI messages back to the hardware (to turn on LEDs etc).

You could also have a pop-up GUI showing what's going on.

I think that LUA would need an API to execute any Reaper action (perhaps it already has one) and, probably some new API functions.

That way, "ordinary" MIDI controllers and those without established Control surfaces for Reaper, could be made much more powerful.
__________________
DarkStar ... interesting, if true. . . . Inspired by ...

Last edited by DarkStar; 09-11-2016 at 12:53 AM.
DarkStar is offline   Reply With Quote
Old 09-10-2016, 11:44 AM   #2
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

This is already possible. There is something in the API to send messages to the control path.

To get the messages, it's there - haven't really unraveled it all, but I believe it's possible - it might be necessary to use Jeffos' MIDItoReaControlPath, but I doubt it.

to send messages to the control path is pretty straightforward

Quote:

C: void StuffMIDIMessage(int mode, int msg1, int msg2, int msg3)

EEL: StuffMIDIMessage(int mode, int msg1, int msg2, int msg3)

Lua: reaper.StuffMIDIMessage(integer mode, integer msg1, integer msg2, integer msg3)

Python: RPR_StuffMIDIMessage(Int mode, Int msg1, Int msg2, Int msg3)

Stuffs a 3 byte MIDI message into either the Virtual MIDI Keyboard queue, or the MIDI-as-control input queue. mode=0 for VKB, 1 for control (actions map etc), 2 for VKB-on-current-channel.

(yeah, so the script just needs to be some GUI to configure and rearrange the messages and provide feedback)


I'm working on a few thing in EEL that utilize this, Because there is no API that can manipulate the MONITOR FX chain, and that's what I want to do

So yeah, it just really hasn't been done yet. I think the API that is there isn't exactly intended to be use this way, so it's a little rough, but it's possible as far as I can tell.

Last edited by James HE; 09-10-2016 at 11:57 AM.
James HE is offline   Reply With Quote
Old 09-10-2016, 02:33 PM   #3
semiquaver
Human being with feelings
 
Join Date: Jun 2008
Posts: 4,923
Default

ooh... monitor controller...
semiquaver is offline   Reply With Quote
Old 09-10-2016, 04:24 PM   #4
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

Quote:
Originally Posted by semiquaver View Post
ooh... monitor controller...
Exactly!
James HE is offline   Reply With Quote
Old 09-10-2016, 05:17 PM   #5
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by James HE View Post
To get the messages, it's there - haven't really unraveled it all, but I believe it's possible - it might be necessary to use Jeffos' MIDItoReaControlPath, but I doubt it.
I don't think getting incoming MIDI messages is in the ReaScript API. I've been complaining a few times about how that isn't possible. And I'd rather not use an external plugin to do that unless it was explicitly designed to allow ReaScript access to the incoming MIDI messages. (Such a plugin is possible to do with the C++ extension API though.)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 09-10-2016, 05:22 PM   #6
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by DarkStar View Post

I think that LUA need an API to execute any Reaper action (perhaps it already has one) and, probably some new API functions.

That way, "ordinary" MIDI controllers and those without established Control surfaces for Reaper, could be made much more powerful.
Your proposal is very welcome and something I've been wanting to have for some time. Unfortunately at the moment the ReaScript API is not comprehensive enough to implement it. What is missing is the ability to get MIDI messages coming from the hardware MIDI inputs into ReaScript. (Running Reaper's built-in actions is certainly available, since the early days of the C extension API. API functions to control track parameters etc of course also exist.)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 09-10-2016, 07:15 PM   #7
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

I heard some time ago devs are working on integration OSCIIbot in ReaScript. Not sure that was true.
mpl is offline   Reply With Quote
Old 09-10-2016, 08:09 PM   #8
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

Quote:
Originally Posted by James HE View Post
I'm working on a few thing in EEL that utilize this, Because there is no API that can manipulate the MONITOR FX chain, and that's what I want to do
I don't know much about this, or what you are up to. But I remembered seeing this:

Code:
C: int TrackFX_GetRecCount(MediaTrack* track)

EEL: int TrackFX_GetRecCount(MediaTrack track)

Lua: integer reaper.TrackFX_GetRecCount(MediaTrack track)

Python: Int RPR_TrackFX_GetRecCount(MediaTrack track)

returns count of record input FX. To access record input FX, use a FX indices [0x1000000..0x1000000+n). On the master track, this accesses monitoring FX rather than record input FX.
and this seems to work:
(But maybe you are asking for more? Well, just in case...)
Code:
local r = reaper
mt = r.GetMasterTrack()
retval,str = r.TrackFX_GetParamName(mt, 0x1000000+1, 1, "")
woops, remembered GetMasterTrack is supposed to have ReaProject. GetMasterTrack(0). lol, worked anyway...

Last edited by FnA; 09-10-2016 at 08:26 PM. Reason: woops
FnA is offline   Reply With Quote
Old 09-10-2016, 08:24 PM   #9
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

Quote:
Originally Posted by FnA View Post
I don't know much about this, or what you are up to. But I remembered seeing this:

Code:
C: int TrackFX_GetRecCount(MediaTrack* track)

EEL: int TrackFX_GetRecCount(MediaTrack track)

Lua: integer reaper.TrackFX_GetRecCount(MediaTrack track)

Python: Int RPR_TrackFX_GetRecCount(MediaTrack track)

returns count of record input FX. To access record input FX, use a FX indices [0x1000000..0x1000000+n). On the master track, this accesses monitoring FX rather than record input FX.
and this seems to work:
(But maybe you are asking for more? Well, just in case...)
Code:
local r = reaper
mt = r.GetMasterTrack()
retval,str = r.TrackFX_GetParamName(mt, 0x1000000+1, 1, "")
WOW! I asked justin about a year ago about this, and at the time there was no way to acces the MONITOR fx chain. not sure when it was added, totally missed it thanks!
James HE is offline   Reply With Quote
Old 09-11-2016, 02:19 AM   #10
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by mpl View Post
I heard some time ago devs are working on integration OSCIIbot in ReaScript. Not sure that was true.
I hope they add Lua support for that if they are working on it...OsciiBot is currently scriptable only with Eel.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   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 01:28 AM.


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