You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

60 lines
1.2 KiB

#pragma once
#ifndef DSY_TREMOLO_H
#define DSY_TREMOLO_H
#include <stdint.h>
#ifdef __cplusplus
#include <math.h>
#include "Synthesis/oscillator.h"
/** @file tremolo.h */
namespace daisysp
{
/**
@brief Tremolo effect.
@author Ben Sergentanis
@date Jan 2021
Based on https://christianfloisand.wordpress.com/2012/04/18/coding-some-tremolo/ \n
*/
class Tremolo
{
public:
Tremolo() {}
~Tremolo() {}
/** Initializes the module
\param sample_rate The sample rate of the audio engine being run.
*/
void Init(float sample_rate);
/**
\param in Input sample.
\return Next floating point sample.
*/
float Process(float in);
/** Sets the tremolo rate.
\param freq Tremolo freq in Hz.
*/
void SetFreq(float freq);
/** Shape of the modulating lfo
\param waveform Oscillator waveform. Use Oscillator::WAVE_SIN for example.
*/
void SetWaveform(int waveform);
/** How much to modulate your volume.
\param depth Works 0-1.
*/
void SetDepth(float depth);
private:
float sample_rate_, dc_os_;
Oscillator osc_;
};
} // namespace daisysp
#endif
#endif