Lich toggle button

Is it possible to program the Lich buttons as toggle buttons? So you press or trigger them and the light and value go on and you press again for off?

Well, detecting gate changes and generating trigger as events in your patch is not hard, obviously. But as for actual physical button / LED, they behave as button, not switches. And you can’t have both at the same time.

It’s possible to customize firmware to have different behavior if you think that you really need it. Just changing button click processing is not hard (as in editing 2 lines of code), but there could be other issues caused by this change. For example, if there’s no hardware debouncing for buttons on Lich, you would be getting multiple events on button press. So you would need a few extra lines of code to ignore triggers coming faster than every 10-20ms.

Would it instead be possible to have the button LED available as a separate output, instead of it being hard-linked to the button and gate input? This way, I could implement the toggle functionality in patch itself, simply by making the button LED go on or off based on whatever condition I want in my patch.

It should be possible to do this in the patch, using output BUTTON_A and BUTTON_B to control the LEDs. So for each incoming ‘on’ button event you toggle your internal state, and set the LED correspondingly.

It’s a bit of an edge use case so not sure we have any demo patches :slight_smile:

And this should already work now?

Yes, try it out! What language are you using, FAUST?

Yes, faust. I’ll try later today. I guess it would be by using attach to a button?

You can use ba.impulsify to convert gates to trigger. But I’m not sure about getting and setting the same button - it might work if there won’t be problems using both slider and bargraph + attach with it. I don’t think it ever got tested before.

Actually, FAUST handles buttons and checkboxes separately, so we could handle checkbox widgets as switches, while button would behave the same way as currently.

1 Like

The checkbox vs button would be great!

So I gave it s shot but it doesn’t seem to work. There is a short flash of the LED when pressing it, but that’s all.
It works when I use one button to toggle the other (change the button on line 11 to B1).

See here: https://www.rebeltech.org/patch-library/patch/lich_toggle_button

I would say that even if it worked, it would be too ugly compared to just using checkbox. I’ll try to get this working with a native widget. My Lich didn’t arrive yet, but I can use OWL1 for testing using its pushbutton.

1 Like

It’s indeed quite ugly. If you want me to test something on the Lich, just send it over!

Sorry to say this, but it looks like it’s impossible to implement this kind of switch with a patch in current OWL firmware. I’ve discussed this with Martin and we’ll see if it can be solved in a new firmware release.

Currently patch can set CV gate value, but not internal button state. This is why you’ve only seen a flash when you toggle button value. Button would be reset on each UI update. The same happens if I set it from the FAUST integration code.

I think that firmware will eventually be updated to allow user patches to fully control internal button state, but no idea when it would happen.

I can set the state of one button with the other button though. In the patch I linked above, if one of the OWL:B2’s is changed to B1, it works as expected. Of course, it is quite a waste to use one button to toggle the other.

I am trying to get this to work with Gen~ right now - a bit different actually - holding the button would switch a knob to modify another parameter after 2 seconds. Works in Max but no dice on the lich so far. Will update with findings on why it wasn’t a simple 1:1 translation

Dang, i think “Latch” is not supported - it works like gate but keeps the last value that passed before output is switched. Am I missing it or was there a reason it wasn’t included?

*edit: is Counter also not supported? I think it creates definitions for “count” and “carry” but I am not seeing them in genlib_ops.h

Is it correct that the compiler definitions are circa 2012?

quicklook makes me think Cycling 74 never defined these objects in the genlib - even the one from 2016 - yet it exports them in the cpp for the patch. Or they don’t need to be since they are so simple?

edit: dont mean to spam - but might as well document.
Latch works correctly!
Counter seems to be an issue at the moment, will continue to investigate

edit2: looks like C++ awesomeness - in gen~ you can scale 0. 1. to 1. 0. to flip the range. Seems like this wasn’t working correctly. Will look into it more and then post a button example. This thread got me thinking on minimal interfaces with 2 buttons modifying knobs or entering sub menus of sorts ala Mutable Instruments - love it

@mars maybe we need a list of supported gen~ objects just like it was done for PD?

AFAIK they should all work. Let me know if that is not correct.

1 Like

I just did it ! :grin:
The solution is in the « problem » !
If the led do not stay « ON » because of the Lich’s refresh thing, just refresh the LED ! :laughing: