Dont understand oversampling example - ProcessGen?

Hi there,
I try to oversample a Oscillator with the IPlug Oversampler. In the example oversampling of an audio input signal is done in the following line:
outputs[1][i] = outputs[0][i] = mOverSampler.Process(inputs[0][s], [](sample input) { return std::tanh(input); });

From the header I got that “T ProcessGen(std::function<T()> genFunc)” should be called if i want to generate samples. But how do i do this? how can i call oscillator.nextSample() with this f.e.?
outputs[1][i] = outputs[0][i] = mOverSampler.ProcessGen( “how can i call oscillator.nextSample() here?”);

If this is a noobquestion i apologize, i´m still learning…

does anyone have an example where you use mOverSampler.ProcessGen()?

you have to use a lambda capture so you can call the oscillator process function.

mOverSampler.ProcessGen([this]() { return this->mOscillator.Process(440); });

ok i tried. but it gives me the following error: 2039

1>C:\iPlug2-master\IPlug\Extras\Oversampler.h(375,1): error C2039: ‘process_block’: is not a member of ‘WDL_PtrList<hiir::Downsampler2xFPU<2,T>>’
1> with
1> [
1> T=iplug::sample
1> ]
1>C:\iPlug2-master\IPlug\Extras\Oversampler.h(521): message : see declaration of ‘WDL_PtrList<hiir::Downsampler2xFPU<2,T>>’
1> with
1> [
1> T=iplug::sample
1> ]

1>C:\iPlug2-master\IPlug\Extras\Oversampler.h(419,1): error C2039: ‘__this’: is not a member of ‘WDL_PtrList<hiir::Downsampler2xFPU<12,T>>’
1> with
1> [
1> T=iplug::sample
1> ]
1>C:\iPlug2-master\IPlug\Extras\Oversampler.h(518): message : see declaration of ‘WDL_PtrList<hiir::Downsampler2xFPU<12,T>>’
1> with
1> [
1> T=iplug::sample
1> ]

which is odd because if i use:
outputs[1][i] = outputs[0][i] = mOverSampler.Process(voiceManager.nextSample(), [](sample input) { return std::tanh(input); });

everything works fine… it just doesnt oversample of course.

i had forgotten to update ProcessGen(), fixed on master

allright the project builds now and i can execute my code like in your example:

mOverSampler.ProcessGen([this]() { return this->mOscillator.Process(440); });

THANKS A LOT BTW. much aprechiated!
but it doesn´t remove the aliasing… do i have to implement the filter after generating the waveform myself ? or did i get sth. wrong?

this is what im doing in the waveform generation method “nextSample()”:

double OverOscil::nextSample() {
value = (2.0 * mPhase / twoPI) - 1.0;
mPhase += mPhaseIncrement;
  while (mPhase >= twoPI) {
    mPhase -= twoPI;
  }
  return value;
}

i’m sorry but this is digressing in to “please do my job for me” territory

good luck with your project. :slight_smile: