getdetune() coding style cleanup
[zyn.git] / filter_parameters.h
blob94fd6bdb3cd280b1fede1d56bafd32073a9cbbcd
1 /*
2 ZynAddSubFX - a software synthesizer
4 FilterParams.h - Parameters for 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 FILTER_PARAMS_H
24 #define FILTER_PARAMS_H
26 class FilterParams
28 public:
29 void
30 init(
31 float sample_rate,
32 unsigned char Ptype_,
33 unsigned char Pfreq,
34 unsigned char Pq_);
36 void defaults();
38 REALTYPE getfreq();
39 REALTYPE getq();
40 REALTYPE getfreqtracking(REALTYPE notefreq);
42 unsigned char m_category; // Filter category, one of ZYN_FILTER_TYPE_XXX
43 unsigned char Ptype;// Filter type (for analog lpf,hpf,bpf..)
44 unsigned char Pfreq;// Frequency (64-central frequency)
45 unsigned char Pq; // Q parameters (resonance or bandwidth)
46 unsigned char m_additional_stages; // filter stages, 0..4, 0 for one stage, 1 for two stages, etc. up to five stages
47 float m_frequency_tracking; //how the filter frequency is changing according the note frequency, -1 .. 1
48 float m_gain; // filter's output gain, in dB, -30 .. 30
50 //Formant filter parameters
51 unsigned char Pnumformants;//how many formants are used
52 unsigned char Pformantslowness;//how slow varies the formants
53 unsigned char Pvowelclearness;//how vowels are kept clean (how much try to avoid "mixed" vowels)
54 unsigned char Pcenterfreq,Poctavesfreq;//the center frequency of the res. func., and the number of octaves
56 struct {
57 struct {
58 unsigned char freq,amp,q;//frequency,amplitude,Q
59 }formants[FF_MAX_FORMANTS];
60 }Pvowels[FF_MAX_VOWELS];
63 unsigned char Psequencesize;//how many vowels are in the sequence
64 unsigned char Psequencestretch;//how the sequence is stretched (how the input from filter envelopes/LFOs/etc. is "stretched")
65 unsigned char Psequencereversed;//if the input from filter envelopes/LFOs/etc. is reversed(negated)
66 struct {
67 unsigned char nvowel;//the vowel from the position
68 } Psequence[FF_MAX_SEQUENCE];
70 REALTYPE getcenterfreq();
71 REALTYPE getoctavesfreq();
72 REALTYPE getfreqpos(REALTYPE freq);
73 REALTYPE getfreqx(REALTYPE x);
75 void formantfilterH(int nvowel,int nfreqs,REALTYPE *freqs);//used by UI
77 REALTYPE getformantfreq(unsigned char freq);
78 REALTYPE getformantamp(unsigned char amp);
79 REALTYPE getformantq(unsigned char q);
81 private:
82 void defaults(int n);
84 float m_sample_rate;
86 //stored default parameters
87 unsigned char Dtype;
88 unsigned char Dfreq;
89 unsigned char Dq;
92 #endif