Resetting/setting fader/encoder value on button click | Intech Studio
💬 general GridRequest

Resetting/setting fader/encoder value on button click

lsdmtea · · 8 replies

Hey there! I'm currently setting up my controllers, the EF44 and EN16. My goal is to create a setup where holding down a button on the EF44 while pressing another on the EN16 resets a row of encoders and a fader to specific values. This would allow me to reset devices quickly with just one click.
So far, I've managed to get different values on an EN16 button when holding down an encoder on the EF44. I've also successfully set encoders and LEDs to specific values, but the catch is, it only works when I rotate the encoder a bit. It doesn't trigger when I just press the button.
Here's what I've tried so far:
EF44 Button Setup:
press ->
immediate_send(nil, nil, 'ef44_button_pressed = true')
release ->
immediate_send(nil, nil, 'ef44_button_pressed = false')

EN16 Init:
ef44_button_pressed = ef44_button_pressed or false

EN16 Button Configuration:
if ef44_button_pressed
then
led_value(num, 2, 255)
element[14]:encoder_value(127)
led_value(num, 2, 0)
element[6]:encoder_value(0)
led_value(num, 2, 0)
element[2]:encoder_value(0)
immediate_send(0, 2, 'element[6]:potmeter_value(0)')
else
self:encoder_value(0)
led_value(num, 2, 0)

The fader isn't changing its value as expected.
Encoders only reset when I rotate them a bit, not on button press.

I'm stuck here and could really use some insight. If anyone has a similar setup or knows what I might be missing, I'd love to hear your thoughts!

Replies (8)

kkerti kkerti ·

As you mention "only does X after encoder rotation", I assume your variable or function called under the uninteracted encoder event throws error, because it does not exist until triggering and therefore initializing the event.

kkerti kkerti ·

A chain of action blocks or code under an event (which is not the setup), has to be triggered first to take action -> be present during runtime.

kkerti kkerti ·

You can either bang the encoder events to have their defaults initialized or refractor your code based on this logic.

kkerti kkerti ·

To bang enocoders, use the event_trigger(INDEX,2) function. The event code is 2 for encoder event.

kkerti kkerti ·

Or.. Maybe the layer value for the led intensity is not right?

lsdmtea ·

Thanks for getting back to me! That really helps!

I'm now using this code:

event_trigger(14, 2)
event_trigger(6, 2)
event_trigger(2, 2)
element[14]:encoder_value(127)
led_value(num, 2, 255)
element[6]:encoder_value(0)
led_value(num, 2, 0)
element[2]:encoder_value(0)
led_value(num, 2, 0)
immediate_send(0, -1, 'event_trigger(6, 2)')
immediate_send(0, -1, 'element[6]:potmeter_value(0)')

It's working pretty well, but the fader isn't changing its value. The module is connected to the bottom of the EN16, and I've tried various combinations to get the fader to respond, but no luck so far.

Also, how can I add more code to a button? This code is maxing out the 390 characters, but I want to include additional controls on a second page that should also reset.

What’s the best way to add more reset values on another page and how can I set the fader value on the EF 44 from the EN16?

Thanks a lot for your help! ❤️

Screenshot_2025-03-21_at_08.25.21.png
lsdmtea ·

I figured out the fader issue! It was in the wrong position and had the wrong event code.

Here’s the code that’s working for me now:

event_trigger(14, 2)
event_trigger(6, 2)
event_trigger(2, 2)
element[14]:encoder_value(127)
led_value(num, 2, 255)
element[6]:encoder_value(0)
led_value(num, 2, 0)
element[2]:encoder_value(0)
led_value(num, 2, 0)
immediate_send(0, 1, 'event_trigger(6, 0)')
immediate_send(0, 1, 'element[6]:potmeter_value(0)')

The code is maxed out on characters, though. I’d really like to add more controls to reset on the second page when that button is pressed. Is there a way to do that?

Also, is there a method to prevent the fader from jumping? I want it so that when a button click sets the value, the fader should only start working again once it reaches its current value. It’s similar to how a CDJ works when you sync a track and then unsync it. you have to move the slider to the current BPM before you can change the value again. Is that doable?

Thanks! ❤️

kkerti kkerti ·

You can declare a table or variable under setup in the scope of an element and save snapshots of values for your different states. Then recall the previously saved values.

Discord

View on Discord

This post is from the Intech Studio Discord community.

Open thread →