Assigning values from OwnedArray<Slider> to Array<var>*

Hello all,

I’m trying to parse through the values updated on UI with sliders, which are stored in OwnedArray<Slider> and convert them into Array<var>*

BG: An array of sliders is created of type OwnedArray<Slider>, and Array<var>* is exported to the Engine, so all the values from OwnedArray<Slider> (when updated when slider change on UI) are needed to be converted to Array<var>* which can be then exported to the engine

Any help is appreciated! TIA

Not 100% sure what you’re asking for, but it sounds like you just want a function that takes the list of sliders, and returns a list of their values?

juce::Array<juce::var> readValues (const juce::OwnedArray<juce::Slider>& sliders)
    juce::Array<juce::var> values;

    for (const auto* const slider : sliders)
        values.add (slider->getValue());

    return values;

Yes something similar,
my sliders are defined of type OwnedArray juce::Slider Sliderarray;
The engine takes values of type Array* sliderVals; ,

so when I update the UI, those sliders values are in Sliderarray and I need to assign these values to sliderVals so that I can export the sliderVals to engine and update it as UI changes

Your suggestion would help, but values.add (slider->getValue()); runs in exception