VST parameter automation issues in Reaper


Hi all,


I'm using Juce to produce a VST plugin. Recently I've been wrestling with the issue of automation in Reaper - ordinarily I can solve most issues by sifting through the class references and various forum posts, but this time I am completely stumped.


The main problem that I'm having is that with Reaper I don't seem to get a setValue callback from the host when I try to record automation. I've condensed my subclass of AudioProcessorParameter to a much simpler class in order to facilitate debugging:


class SimpleParameter : public AudioProcessorParameter
{
public:
    SimpleParameter()
        : _value(0.0f)
    {
    }
    ~SimpleParameter() {}
    void setValue(float f) override
    {
        _value = f;
    }
    float getValue() const override
    {
        return _value;
    }
    String getName(int len) const override
    {
        String name = "myName";
        return name.substring(0, len);
    }
    String getLabel() const override
    {
        return "ms";
    }
    float getDefaultValue() const override
    {
        return 0.0f;
    }
    float getValueForText (const String& text) const override
    {
        return 0.0f;
    }
private:
    float _value;
};


The SimpleParameter is then added to the parameter list using the following call in the AudioProcessor constructor:

addParameter(new SimpleParameter());

For those of you who use Reaper, I am attempting to record automation as follows:


1) Insert->Virtual instrument on new track, and then select my VST plugin
2) Param->FX Parameter list->Show track envelope, and then pick my parameter
3) Right click on the new track, and select write mode
4) Click play and twiddle the knob on the envelope track


When I follow these steps for another VST (e.g. Cockos ReaSynth which comes with Reaper), I can clearly see the knob twiddles being recorded. However, when I do this for my VST, the recording flatlines at 0.0. I have set breakpoints in my simple parameter class - I can see that getValue is being called repetitively, but the breakpoint in setValue is never triggered.


Obviously if setValue is never called, getValue always returns the default value of 0.0, so the observed behaviour makes sense. However, I have read the class API a thousand times, and cannot for the life of me understand why setValue is not getting called. Is there anything wrong with my code? Any feedback or suggestions are most welcome.

 

Looks OK to me.. You didn't override isParameterAutomatable() in your processor class, did you?

Nope, haven't overriden it. As a sanity check, I set a breakpoint in the AudioProcessor::isParameterAutomatable() function, so I can confirm that this function is called, and the parameter indeed returns true when isAutomatable() is called.

Could it be an issue with Reaper? I'm willing to test with another DAW if anyone has any suggestions.

Cheers, Simon

except for:


float getValueForText (const String& text) const override     
{         
    return 0.0f;     
}

But that shouldn't be the problem...

How is your GUI updating the parameter value?

I think this could be in fact the problem. Some DAWs (for some unknown reason) convert to a string representation and back again when doing automation. Try setting a breakpoint there or removing it altogether.

@Andrew, I've deliberately not coupled the parameter with my GUI, so the only way the parameter can be updated is from the host via setValue (if my understanding is correct). So there is no way for my GUI to interfere with the getting or setting of the parameter value.

@Daniel and Fabian, I wondered the same initially, and stuck a breakpoint in getValueForText() early on. However, the breakpoint does not trigger - instead, the getValue() breakpoint triggers repeatedly and returns a value of 0.0. It seems to me that the issue lies with the fact that the host does not call setValue(). Am I right in thinking that this is the only function that a host calls to set a value, or is there another?

Cheers

Simon

Update: I've just tested one of the example plugins with Reaper and it works fine, so I'm obviously doing something horribly wrong somewhere! I've got something to work from now, so I should be able to work out where I'm going wrong. Thanks for the helpful suggestions chaps!

If a call to beginParameterChangeGesture occured in the plugin that would (should) prevent a host from calling setParameter. Maybe add a break point in there to see if that is being called?

...and please check this as well: http://www.juce.com/comment/321777#comment-321777

Maybe an assert of any kind could be added, if someone calls addParameter and overrides some of the vintage callbacks? I don't know if it's possible...