Table of Contents:
For this plugin, we will define a few new parameters, including phase shift and gain.
namespace Steinberg {
enum SinSynthParameters {
kPhaseShift = 100,
kGain = 101,
}
}
public:
float mGain = 0.5f; //needed for parameters
float mPhaseShift = 0.f;
float mFrequency = 0.f; //needed for sine wave generation
float mPhase = 0.f;
After this remember the steps from chapter one to serialize not only in the controller but also the processor.
Vst::Sample32* outL;
Vst::Sample32* outR;
for (int i = 0; i < data.numSamples; i++) {
outL[i] = sin((i * mFrequency) + mPhase);
outL[i] *= 1 + (9 * mGain);
outR[i] = sin((i * mFrequency) + mPhase + mPhaseShift);
outR[i] *= 1 + (9 * mGain);
}