I'm sorry to bother you good folks, but I'm at my wits end.
I have two classes handling serial and midi communications respectively. Then I have a class with sliders etc. I need to update the sliders from the two other classes.
So I made a fourth class, wherein I create a public Array<Value> faderValues, and refer the sliders to these. This seems works fine, but how do I update Vauea in that Array from the midi and serial classes?
I tried variations of:
ArrayClassName arrayClassName;
arrayClassName.faderValues[0].setValue (10); // Does nothing and no errors
Probably some basic understanding I'm missing, so my apologies :-) Thankyou for your patience.
Be aware that getReference() won’t check array bounds. I’m also not sure whether there is a better alternative for this than using an Array (which I think is rather thought for PODs and the like).
Thankyou for your suggestion! Unfortunately, nothing changed. Using the introducer I've made a simple project, just using a single Value object and a slider. I still can't change the Value object from outside the class, in a way the slider sees. Here's the code (without Main.cpp, and only a few lines from MainComponent.cpp).
What am I doing wrong (besides lacking knowledge :-) )?
It looks like you have two separate instances of ValueClass each with their own Value. One in MainComponent (which you refer the slider to) and a separate one in SerialClass which has no relation to the one in MainComponent. You'll need to make both Value's point to the same underlying data for it to have a chance to work.