Tri-State Button

This forum is for developers of Rack Extensions to discuss the RE SDK, share code, and offer tips to other developers.
FrankyCHAMBERS
Posts: 7
Joined: 19 Aug 2021

Post 27 Sep 2021

Hi,
I am learning how to build a rack extension and like to have a tri-state button.
grey : output not connected (disable)
green : output connected and sending sound enable (on)
red : output connected and sending sound disable (off)

I can do that by stacking a button and a static decoration at the same spot with visibility switch, but I can't drive visibility switch with an rt_scope value (/audio_outputs/outputxx/connected)

Anybody has a solution ?
Thanks.

User avatar
buddard
RE Developer
Posts: 1025
Joined: 17 Jan 2015
Location: Stockholm

Post 28 Sep 2021

FrankyCHAMBERS wrote:
27 Sep 2021
Hi,
I am learning how to build a rack extension and like to have a tri-state button.
grey : output not connected (disable)
green : output connected and sending sound enable (on)
red : output connected and sending sound disable (off)

I can do that by stacking a button and a static decoration at the same spot with visibility switch, but I can't drive visibility switch with an rt_scope value (/audio_outputs/outputxx/connected)

Anybody has a solution ?
Thanks.
The only two solutions I see is to either separate the LED from the button (so that they don't overlap), or draw the button in a custom display (which will remove the tooltip and make it impossible to Alt-click on it to automate).

User avatar
motuscott
Posts: 2470
Joined: 16 Jan 2015
Location: the New York

Post 28 Sep 2021

I live in the tri state area!
The Now Sound of MIDI Thru 🧂

User avatar
EpiGenetik
Posts: 401
Joined: 19 Jan 2015
Location: Glasgow, EU

Post 28 Sep 2021

Perhaps use a two state button for the functionality, and a small "LED" display to show if it is connected.

As Buddard said, the only way to do it precisely the way you want is with a Custom Display, but that removes some possibilities.

User avatar
pongasoft
RE Developer
Posts: 376
Joined: 21 Apr 2016
Location: Las Vegas

Post 28 Sep 2021

You are talking about a tri-state button, but it seems that what you describe is a tri-state LED? Or am I missing something?

Can you interact with your button or simply showing a status?

If it is a button that you can actually interact with and part of the look of the state is dictated by RT, then yes I would recommend a custom display. This is what I did for my A/B 12 Switch. The background image contains the button. The custom display simply paints a semi-opaque square on top and it works fairly well... (source on github)

Yan

FrankyCHAMBERS
Posts: 7
Joined: 19 Aug 2021

Post 28 Sep 2021

Thanks to all of you for your answer.
I will try the custom display solution and will look at the code from A/B 12 switch.

User avatar
pongasoft
RE Developer
Posts: 376
Joined: 21 Apr 2016
Location: Las Vegas

Post 28 Sep 2021

FrankyCHAMBERS wrote:
28 Sep 2021
Thanks to all of you for your answer.
I will try the custom display solution and will look at the code from A/B 12 switch.
This is the relevant code in display.lua. It determines the state of the button (based on various modes) and simply draw a colored rectangle (with an alpha set to 200).

FrankyCHAMBERS
Posts: 7
Joined: 19 Aug 2021

Post 30 Sep 2021

Thanks #pongasoft. I'll look at your code.

But I found another solution : have a momentary button et have a tri-state sequence meter. It does the job fine.

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests