Error calling getCurrentlyPlayingNote()

#1

I’m getting the error: Cannot initialize object parameter of type ‘const juce::MPESynthesiserVoice’ with an expression of type ‘Voice’

This is in the DSP Tutorial, the error appeared when I tried to add the second oscillator. Perhaps there is something I don’t understand about inheritance in C++.

Here is the code:

class Voice : public juce::MPESynthesiserVoice
{
public:
Voice()
{
auto& masterGain = processorChain.get();
masterGain.setGainLinear (0.7f);
}

//==============================================================================
void prepare (const juce::dsp::ProcessSpec& spec)
{
    tempBlock = juce::dsp::AudioBlock<float> (heapBlock, spec.numChannels, spec.maximumBlockSize);
    processorChain.prepare (spec);
}

//==============================================================================
void noteStarted() override
{
    auto velocity = getCurrentlyPlayingNote().noteOnVelocity.asUnsignedFloat();
    auto freqHz = (float) getCurrentlyPlayingNote().getFrequencyInHertz();

    processorChain.get<osc1Index>().setFrequency (freqHz, true);
    processorChain.get<osc1Index>().setLevel (velocity);

    processorChain.get<osc2Index>().setFrequency (freqHz, true);
    processorChain.get<osc2Index>().setLevel (velocity);

}

//==============================================================================
void notePitchbendChanged() override
{
    auto freqHz = (float) getCurrentlyPlayingNote().getFrequencyInHertz();
    processorChain.get<osc1Index>().setFrequency (freqHz);
    processorChain.get<osc1Index>().setFrequency (freqHz * 1.01f);
}