Hi All,
I have a very simple oscillator which looks like this:
void CZSaw::process(const ProcessArgs& args) {
// Calculate desired frequency
float freq = clamp(params[_FREQ_PARAM].getValue() + inputs[_MODF_INPUT].getVoltage(), -3.0f, 3.0f);
freq = 261.626f * powf(2.0f, freq);
// Calculate phase
phase += freq * args.sampleTime;
if (phase >= 1.0f)
phase -= 1.0f;
// Calculate the shape index
float shape = max((10 - clamp(params[_SHAPE_PARAM].getValue() + inputs[_MODS_INPUT].getVoltage(), 0.0f, 10.0f)) * 0.05f, 0.001f);
// Calculate the wave step
float a = phase * ((0.5f - shape) / shape);
float b = (-1 * phase + 1) * ((0.5f - shape) / (1 - shape));
float m = phase + min(a, b);
float out = cos(m * (M_2PI));
outputs[_WAVE_OUTPUT].setVoltage(out * 5);
}
I am wondering if someone could get me a tip on getting it polyphonic? It has been working fine monophonic. I have already looked at the source code for the fundamental, and befaco, and of course I am already lost and confused, as these oscillators do have much more functionality than mine. Sorry I keep asking these noobish questions, but if someone could give me a simplistic example to follow or some generic guideline I would be grateful.
Thanks, Marcelo.