Minor detune bandwidth optimization
[zyn.git] / lfo.h
blobcd09b7e0adb43d52dba95012d191fe22522e905d
1 /*
2 ZynAddSubFX - a software synthesizer
4 LFO.h - LFO implementation
5 Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
6 Copyright (C) 2002-2005 Nasca Octavian Paul
7 Author: Nasca Octavian Paul
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of version 2 of the GNU General Public License
11 as published by the Free Software Foundation.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License (version 2) for more details.
18 You should have received a copy of the GNU General Public License (version 2)
19 along with this program; if not, write to the Free Software Foundation,
20 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef LFO_H
25 #define LFO_H
27 #define ZYN_LFO_TYPE_FREQUENCY 0
28 #define ZYN_LFO_TYPE_AMPLITUDE 1
29 #define ZYN_LFO_TYPE_FILTER 2
31 class LFO
33 public:
34 LFO();
36 void
37 init(
38 float sample_rate,
39 float base_frequency, // note
40 const struct zyn_lfo_parameters * parameters_ptr,
41 unsigned int type); // one of ZYN_LFO_TYPE_XXX
43 ~LFO();
45 float lfoout();
47 float amplfoout();
49 private:
50 void computenextincrnd();
52 float m_x;
54 float m_incx;
55 float m_incrnd;
56 float m_nextincrnd;
58 // used for randomness
59 float m_amp1;
60 float m_amp2;
62 float m_lfointensity;
64 bool m_depth_randomness_enabled;
65 float m_depth_randomness;
66 bool m_frequency_randomness_enabled;
67 float m_frequency_randomness;
69 float m_delay;
71 char m_shape;
73 float m_sample_rate;
76 #endif