Simple sine wave tremolo with adjustable frequency and gain!
#define m_SR 44100 class TremoloPatch : public SampleBasedPatch { private: double omega; public: TremoloPatch() : omega(0) {} void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output){ float phi, gain; getParameterValue(PARAMETER_A, phi); getParameterValue(PARAMETER_B, gain); int size = input.getSize(); float buf[size]; input.getSamples(0, size, buf); for(int i=0; i<size; ++i){ omega += phi * 10 * 2*PI / m_SR; buf[i] = (float)(((1 + cos(omega))/2) * buf[i] * gain); } output.setSamples(0, size, buf); } };