How to store a getRawParameterValue?

#1

How do I retrieve the value of a tree.getRawParameterValue? At the applyDelay, the last parameter is where im trying to store the parameter value and the slider, and slider pointer is made in another class.

        if(magicVoice = dynamic_cast<SynthesizerVoice*>(magicSynth.getVoice(i))){
            
            magicVoice->getEnvelopeParams(tree.getRawParameterValue("attack"), tree.getRawParameterValue("decay"), tree.getRawParameterValue("sustain"), tree.getRawParameterValue("release"));
            
            magicVoice->getWaveType(tree.getRawParameterValue("waveType"));
            magicVoice->getWaveType2(tree.getRawParameterValue("waveType2"));

            magicVoice->getFilterParams(tree.getRawParameterValue("filterType"),
                            tree.getRawParameterValue("filterCutOff"),
                                        tree.getRawParameterValue("filterRes"));
            
            magicVoice->getMasterParams(tree.getRawParameterValue("masterGain");     
        }
    }
    
    
    buffer.clear();
    magicSynth.renderNextBlock(buffer, midiMessages,0, buffer.getNumSamples());
    applyDelay (buffer, delayBuffer, magicVoice->getFXParams(tree.getRawParameterValue("delay")));
    updateFilter();
    dsp::AudioBlock<float> block (buffer);
    stateVariableFilter.process(dsp::ProcessContextReplacing<float> (block));
0 Likes

#2

I’m not sure if I really understand your question, but since getRawParameterValue returns a pointer you need to store a pointer and dereference it to access its value. does that help?

0 Likes

#3

I see what you mean, at the top of the processBlock() method what I tried to do was

auto delayParamValue = Parameters.getParameter("delay")->getvalue();

to get the value of the parameter being pointed to, however, that gave me an error saying “Parameters” does not return a value which I am guessing leads back to your point, I will try doing what you suggested. Is there somewhere I can read about dereferencing pointers?

0 Likes

#4

Ouch… Do yourself a favor and don’t use auto if you don’t know what a function returns!
I recommend you learn the basics of c++ before you continue coding:
Introduction to Pointers

0 Likes