global and detune parameters refactor
[zyn.git] / formant_filter.h
blob6887476f56bbfbbdd4b3bc023da2d28a10e7b77b
1 /*
2 ZynAddSubFX - a software synthesizer
4 FormantFilter.h - formant filter
5 Copyright (C) 2002-2005 Nasca Octavian Paul
6 Author: Nasca Octavian Paul
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of version 2 of the GNU General Public License
10 as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License (version 2) for more details.
17 You should have received a copy of the GNU General Public License (version 2)
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef FORMANT_FILTER_H
24 #define FORMANT_FILTER_H
26 struct zyn_formant
28 float frequency;
29 float amplitude;
30 float q_factor;
33 class FormantFilter : public Filter_
35 public:
36 FormantFilter() {};
37 ~FormantFilter() {};
39 void init(float sample_rate, FilterParams *pars);
40 void filterout(float *smp);
41 void setfreq(float frequency);
42 void setfreq_and_q(float frequency,float q_);
43 void setq(float q_);
45 void cleanup();
46 private:
47 AnalogFilter m_formants[FF_MAX_FORMANTS];
48 float m_inbuffer[SOUND_BUFFER_SIZE];
49 float m_tmpbuf[SOUND_BUFFER_SIZE];
51 struct zyn_formant m_formantpar[FF_MAX_VOWELS][FF_MAX_FORMANTS];
52 struct zyn_formant m_currentformants[FF_MAX_FORMANTS];
54 struct {
55 unsigned char nvowel;
56 } m_sequence[FF_MAX_SEQUENCE];
58 float m_oldformantamp[FF_MAX_FORMANTS];
60 int m_sequencesize;
61 int m_numformants;
62 int m_firsttime;
63 float m_oldinput;
64 float m_slowinput;
65 float m_Qfactor;
66 float m_formantslowness;
67 float m_oldQfactor;
68 float m_vowelclearness;
69 float m_sequencestretch;
71 void setpos(float input);
74 #endif