Plugin Parameter Values Reset on Bypass


#1

Hey all,

I’ve come across a strange behavior with my plugin that I can’t really figure out: when I add my plugin to a given mixer track/effects slot, I can configure the parameters and make the effect sound the way I want to, then I can enable bypass in the host (tested in FL Studio and Renoise) and see the expected behavior, but then when I disable bypass in the host, my plugin resumes processing with the default parameter values, even though the GUI reflects the values I had previously set. As soon as I nudge a slider in my GUI the internal value snaps up to what the GUI is showing, but this means that enable/disable of the bypass in the host resets the internal state of my plugin to the default parameter settings, which is obviously undesirable.

Has anyone seen this? Did I miss some step of implementing the AudioProcessor interface?

Thank you!


#2

Ah ok, this was me being silly. I didn’t realize prepareToPlay was called when disabling host bypass (as in, re-enabling plugin processing).

I’ve updated my prepareToPlay method as follows:

if (m_lastKnownSampleRate == 0.0)
    for (int i = 0; i < m_dsps.size(); ++i)
        m_dsps.getUnchecked(i)->init(sampleRate); // init resets my internal parameters
else
    for (int i = 0; i < m_dsps.size(); ++i)
        m_dsps.getUnchecked(i)->instanceConstants(sampleRate); // instanceConstants does not

m_lastKnownSampleRate = sampleRate;

where m_lastKnownSampleRate is a member variable assigned to 0.0 when the class is instantiated.

Nevermind me :slight_smile: