How to add a value to a fader via a button - single and matrix

Hi,

image

So what is my mistake ?
Cheers

You probably meant to write @{fader_1} instead of #{fader_1}, and what you should write is get("fader_1").

That's it ! Merci !

now lady and gentlemen let's me introduce you faders and buttons in a matrix !

So i learned a lot about matrix system but not enough to get this working...

So i have a matrix of buttons declared as this into the props field of the matrix :

{
  "id": "volume_up_#{$+1}",
  "mode": "tap",
  "label": "Vol à 0.5",
  "colorWidget": "pink",
  "linkId": "fad_#{$+1}",
  "script": "console.log(getIndex()); set(\"fader_#{$}\",0.5)"
}

and a matrix of faders declared as this

{
  "id": "fader_#{$+1}",
  "mode": "tap",
  "snap": true,
  "doubleTap": true,
  "steps": 11,
  "default": 0,
  "colorWidget": "orange",
  "linkId": "fad_#{$+1}",
  "address": "/sample/#{$+1}/volume"
}

fader_1, fader_2, fader_3, fader_4

So what i get is weird. If i click on the third button, the fader_2 is set to 0.5 and the fader_3 to 1 !

Notice that it's quite "normal" as i write "script": "console.log(getIndex()); set(\"fader_#{$}\",0.5)" into the button declaration. Why ? Because if i write "script": "console.log(getIndex()); set(\"fader_#{$+1}\",0.5)", a tap on a button set faders to 1 !

Here is the session file : [faders_matrix.json|attachment]
EDIT : the session file (not in mode frament) but not solved at all
faders_matrix.json (9.6 KB)

So again i need help from you all !

Cheers

The file doesn't work, you saved it as a fragment file (which only keeps the first widget in the session).

yep sorry about that. I have edited the post.

Hi

No idea at all folks ?

Hi, please be patient, my last reply is one day old.

Your problem is a conflict between the linkId usage and the script, remove either of these and it works, except that:

  • to use linkId you'll need to set the buttons' on property
  • to use script you'll need to write set('fader_#{$+1}' , 0.5), or preferably,
    set('fader_' + (getIndex() +1), 0.5)

Hi,
Merci beaucoup !
So here is a full working set to forgive me.

The session file :
buttons_controlling_faders_with_indicators_displaying_values.json (11.3 KB)
Hope it helps.
Cheers

It helps, i learned a lot of things thanks to you sharing this !

1 Like