1
#ifndef INCLUDED_OSCILLATOR_H
2
#define INCLUDED_OSCILLATOR_H
7
#include "ctrl-source.h"
10
* Base class for various oscillators
12
* Unlike finite controller sources, oscillators
13
* produce new values infinately.
15
class OSCILLATOR : public CONTROLLER_SOURCE {
19
virtual void set_initial_value(parameter_t arg) {}
24
* @param freq Oscillator frequency
25
* @param phase Initial phase, multiple of pi
27
OSCILLATOR(parameter_t freq = 0, parameter_t initial_phase = 0) {
29
phase_value = initial_phase * M_PI;
34
parameter_t freq_value, phase_value;
38
parameter_t phase_offset(void) const { return(phase_value); }
39
parameter_t frequency(void) const { return(freq_value); }
41
void phase_offset(parameter_t v) { phase_value = v; }
42
void frequency(parameter_t v) { freq_value = v; }