Dynamic keyboard colouring
-
@d-healey said in Dynamic keyboard colouring:
SMP[i].getChildSynthByIndex(idx == i);
That doesn't do anything.I don't know what else to call...
Im trying to get the index for a sampler based on what button that was pressed so I could colour the correct key(inside theupdateCode()
block),local idx = SMP_COLOUR_buttons.indexOf(component);
That doesn't do anything either (really it should return an error) since there is nocomponent
in that function. So what it will always give you is the value 0.Appologies, I should have removed it from
updateCode()
But, on line 60 (inside theonbtn_COLOUR_SMP_Control
) its calling the index of the buttons.What's this for?
(idx == i);
Index of a button. ??
Heres an updated snippet;
HiseSnippet 3797.3oc6a0sbaabEFTxvVjIJwwSlosyjNCpRaGpXYIRpercjcConHsUMkDGRYYmwiGkU.qHgMH.F.PIw3QSyksOB8tbSun4p9H366Mcl9BjGg7DT2yYW7yBveDkirqSiXaf4d1yt624mc2ucITcGKUpqqkiTpz6zylJk58ka1yzqc41DcSoMVWJ0Txk2t11OrgzZ8rIttTMoTol7dXsoReII1me3KViXPLUoQhjj10RWkVSuitWjzup3CzMLpRzn6n2QP6kJtgpkYYKCqt.RlTNmjMQ84jVzsHnZSHKk5xUzz8rbZ5Q7ntRotzZVZ8Z115HSt96p6puuAEKjWpIzQbwUsLzPDiRkJ2V2PqdfE6JIk5J0ir+I41+GKuotldn7H+vUYUnD0BQ+QpIFE7xKBubiO7RI.uKwg2GI2T0Q21KpFDaen7l.L2vzi5b.ABChPiquzDtWUtrEngo27cHOmV0AJD1hr2Z4byorbtbytZloy3PaonuJ+eel++p5F7EVTR4tJO4oqJHnomitYqUyjABjtdJGRbTHF1sIfhACKQS6AlV6mclRXEyLmBLj3.p.eX5NuK0qAwrEMKTSgkWdNk7IqN6Ltd8LnPimYWpimtJwXl90Q2i1gmMgixwUqVh8oeE2uUL0xw9.pEYDNTsAYBMnZPaVNejE.JNb76W4HPenF8gcNrRp1oi7VNTp4fv98vJf1kOWgH3yzd3FPX0C.fqrT0pKUoeEGFDSn1.cIQlw9FcoCxJVCjiFwxKFYDntC2FBpcDQgHU5yJy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dHGtUKpSbxfCvdJ44AS4DORTCpAk3JLo82VrltIk3Dep7YxUbJTHSMlgqeoLGtJ3xXuawyYpfeGgcgXjJN57Xm+hggROUjBqC4OyORFmFe7kvVmppCGWOdPAV92efX8A62bfsBx4Un5b47fS9yxyCNtttOvOmQgS44caJ7uuLayJEjaw+OSeWMnq.ay+67IWSRMwYZrq4v.XZXHNYzEnMgPB+MV4uXTcv8cuDmc25nc2jbHkOGFstDriPQapqV2BbjvbHbhq7pvHw6KXQmFVVLRw2AFrZVOf1Kn.6GFLplcQbwM56q6W3OgttF9WqH2li3hSjWXW3fHcntKrIr0CrbqlNYgcKTB+OkrNzCKL+wyt.DGz5pRctQSpiNn6ZqOWy0mqdkFkY5r374lcg0.aABVKruV9aXZsCwlN+QjCkVuqsgtJjGj7VwFCRwENOHEa+VjTr8nHEOUwKHEeAo3KHEmjI3nHEesjjhK75wJF4VcAq3289ICFDdkjtfh3ETD+YDEwoj2xxoCw30hj3DAjD+EXWw7Qgr69T4WTuw1+wJk2YupaWa8JMNYGGchYKC5d2XEs0X7y3TKuj7JKEQl72KRy7SiXVh8d.uR47EtYDuRVHiQjzmJEwe2StkAbmz7q.WKvOpx.t+E9FIfcguWQdokxmKlNfigqVsnqINnXr1fBdLKKTnd+HChyZVGEcPcAEens8.kGhAOeAwoz1GI8UE8dqJRRe0WOR5puYHoejtW6yEZ5KdAM8KnoeAM8KnoGQSewKnoeAM8KnoeAM8Knom3tbOGoouhHQy4tfl9Hoo+1HmqCQ0wZOU9ekUXl2TLI.bLYA5oj8c9A+YcIma9bRc.hG6opxAMjrF7Gen1d1DGncdrcHwW40A9hCInD51BKtGeLeO4Gg+ImyRzYu1MSIeCv8iiK6MugAACqiDpnsdq1A0nG9SRhnCe+frLM54OyNt0cE9KR2HLtDMHs7lXYkEO6MYoydSV9r2jUN6M4lm8lbqQ0DjUZotdVc36ICBpWguNVpvYKP18+EfgRBUO
but I'm still puzzled on how to correct this.
-
SMP[i].getChildSynthByIndex(idx == i);
This line isn't doing anything for a couple of reasons. Firstly you are not storing the return value anywhere. It should be
variable = function();
.
But this won't work anyway because SMP is already an array of child synths, you have this on line 53
SMP[i] = Synth.getChildSynth("SMP" + (i+1));
Im trying to get the index for a sampler based on what button that was pressed so I could colour the correct key
Why do you need the index of the sampler when you have the index of the button?
-
You're right, I don't need the index of the sampler.
In the SMP loop from @Line 71
SMP[i].getChildSynthByIndex(idx == i);
I can't use.showControl
for the keyboard. What else can I do? -
@ten7kur Just get rid of that line because it's not needed.
-
@d-healey
Even if I remove the SMP for loop, I still have the problem of both sampler1 and sampler2 keys being coloured on the keyboard. -
@ten7kur I know but removing any code that is not doing anything will make it easier to work out what needs to be fixed.
-
@d-healey
Yes. That is true.
I actually had the code like this before. :exclamation_question_mark: I don't understand why its colouring both sampler keys... -
Any thoughts?
-
I don't have time at the moment to look through the code again, so for now you're on your own. I'll have another look when I get chance.
-
@d-healey
Ok. Thanks. Appreciate it!
Ill keep trying..