Problem setting oscillator gain

Hi! I have a custom oscillator class with a gain variable:

struct Osc : public juce::dsp::Oscillator<float>
{
private:
    juce::dsp::Gain<float> gain;
}

In my PluginProcessor::createParameterLayout I have this:

    layout.add(std::make_unique<AudioParameterFloat>(juce::ParameterID(params.at(Names::Osc1_Level), 1),
                                                     params.at(Names::Osc1_Level),
                                                     NormalisableRange<float>(0.f, 1.0f, 0.01f, 1),
                                                     1.0f));

And in my processBlock:

auto& osc1Level = *apvts.getRawParameterValue (params.at(Names::Osc1_Level));
osc1.setParams (osc1Level);

And this in my Osc:

void Osc::setParams (const float level)
{
    setLevel (level);
}

void Osc::setLevel(const float level)
{
    gain.setGainLinear (level);
}

This does not work. Any ideas?