Go Back   Cockos Incorporated Forums > Other Software Discussion > OSCII-bot forum

Reply
 
Thread Tools Display Modes
Old 01-27-2018, 09:20 AM   #1
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,048
Default Does toggle button work with a custom script?

Hey all,

I have a Steinberg CMC-CH and I'm just diving into OSCIIBot.
So far, I am able to turn on and off the light of a button

But before I continue, here the following info:

- there is an "open VST instrument" button on the device
- I have a script, that looks for the first VST instrument on a track and toggles open and close of the GUI


I would like to know if this is possible:

- when I select a track, that shows the VST instrument GUI, I would like the "open VST instrument" button light turned on. And when I press the button, the GUI should disappear and turn off the light as well.

Now, I'm not quite sure, if this can be achieved. Does my LUA script need a toggle, so that Reaper can send a "VST instrument is not showing"?
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 01-27-2018, 10:13 AM   #2
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 189
Default

One probably does need to identify & follow whether or not the FX Gui is opened or not, so one would use a toggle, as in storing the state within the OSCII-bot EEL script. If the script follows this, then the opening and closing and LED switching can all be controlled from the EEL script.

See this post from Erriez https://forum.cockos.com/showpost.ph...84&postcount=2 that should be helpful. The useful hints here helped implementstion of the instrument mode for the MIDIMIX control surface which opens selected FX/instruments on a track, so looking at its script may help.
goldenarpharazon is offline   Reply With Quote
Old 01-27-2018, 10:16 AM   #3
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,048
Default

Thanks goldenarpharazon! That's really good news. Will check out that thread.

I'm studying your MIDIMix script. Thanks for that one! I'm familiar with LUA, but EEL2 was new to me. Now that I know what "?" and ":" means, it all makes way more sense to me
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 01-29-2018, 12:22 PM   #4
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,048
Default

I'm pretty far already, but I somehow can't solve this problem.

My button action looks like this:

Code:
msg1 == 0x90 ? + msg2 == 0x2d + msg3 == 0x7F ? // if VST instrument button is pressed
(
     oscmatch("/fxinst/openui") + oscparm(0, f) == 0 ? // if VST instrument GUI is closed
     oscsend(osc_out, "b/fxinst/openui", 1) // open VST instrument GUI
);
This works perfectly for opening the GUI, however, now I need a second if condition, that will look for the oscparm(0, f) == 1. I tried several things, but I can't seem to get nested if conditions working. How can I write:
(pseudo code)
Code:
if button is pressed
   if /fxinst/openui and oscparm(0,f) == 0
      open VSTi GUI
   elseif /fxinst/openui and oscparm(0,f) == 1
      close VSTi GUI
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 01-29-2018, 02:18 PM   #5
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 189
Default

Reckon it might need splitting into two separate code blocks, one to process midi inputs, one to process the OSC feedback from Reaper with a single flag UIopen that tracks the GUI state.

Loosely in pseudo code something like

Code:
@midimsg
if button is pressed
   if UIopen
      close VSTi GUI
   else
      open VSTi GUI


@oscmsg
if /fxinst/openui 
    if oscparm(0,f) == 0
      UIopen=false     // it is closed
    if oscparm(0,f) == 1
      UIopen=true      // it is open
goldenarpharazon is offline   Reply With Quote
Old 01-29-2018, 03:34 PM   #6
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,048
Default

That worked, awesome, thanks a lot!!!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 01-29-2018, 10:41 PM   #7
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,636
Default

Quote:
Originally Posted by goldenarpharazon View Post

Code:
@midimsg

@oscmsg
if /fxinst/openui 
    if oscparm(0,f) == 0
      UIopen=false     // it is closed
    if oscparm(0,f) == 1
      UIopen=true      // it is open
nitpicking mode on
Are there really other values but 0 and 1 ? Else :

@osemsg
UIopen=oscparm(0,f);

-Michael
mschnell is offline   Reply With Quote
Old 01-30-2018, 11:08 AM   #8
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,048
Default

Yep, that's how I did it
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ 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 04:32 AM.


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