summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/synti/zynaddsubfx/Params/ADnoteParameters.h
blob: 1773f2cdc02947baf1ca34864260c28a7d582f78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
/*
  ZynAddSubFX - a software synthesizer
 
  ADnoteParameters.h - Parameters for ADnote (ADsynth)
  Copyright (C) 2002-2005 Nasca Octavian Paul
  Author: Nasca Octavian Paul

  This program is free software; you can redistribute it and/or modify
  it under the terms of version 2 of the GNU General Public License 
  as published by the Free Software Foundation.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License (version 2) for more details.

  You should have received a copy of the GNU General Public License (version 2)
  along with this program; if not, write to the Free Software Foundation,
  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA

*/

#ifndef AD_NOTE_PARAMETERS_H
#define AD_NOTE_PARAMETERS_H


#include "../globals.h"
#include "EnvelopeParams.h"
#include "LFOParams.h"
#include "FilterParams.h"
#include "../Synth/OscilGen.h"
#include "../Synth/Resonance.h"
#include "../Misc/Util.h"
#include "../Misc/XMLwrapper.h"
#include "../DSP/FFTwrapper.h"
#include "Presets.h"

  enum FMTYPE{NONE,MORPH,RING_MOD,PHASE_MOD,FREQ_MOD,PITCH_MOD};
    
   /*****************************************************************/
   /*                    GLOBAL PARAMETERS                          */
   /*****************************************************************/

    struct ADnoteGlobalParam{
	
       /* The instrument type  - MONO/STEREO
	  If the mode is MONO, the panning of voices are not used
	  Stereo=1, Mono=0. */
	 
	unsigned char PStereo; 
	  
    
       /******************************************
	*     FREQUENCY GLOBAL PARAMETERS        *
	******************************************/
	unsigned short int PDetune;//fine detune
	unsigned short int PCoarseDetune;//coarse detune+octave
	unsigned char PDetuneType;//detune type
	
	unsigned char PBandwidth;//how much the relative fine detunes of the voices are changed

	EnvelopeParams *FreqEnvelope; //Frequency Envelope
    
	LFOParams *FreqLfo;//Frequency LFO

       /********************************************
	*     AMPLITUDE GLOBAL PARAMETERS          *
	********************************************/

	/* Panning -  0 - random 
		      1 - left
		     64 - center
		    127 - right */
	unsigned char PPanning;

	unsigned char PVolume;

	unsigned char PAmpVelocityScaleFunction;

	EnvelopeParams *AmpEnvelope;
   
	LFOParams *AmpLfo;   

	unsigned char PPunchStrength,PPunchTime,PPunchStretch,PPunchVelocitySensing;

       /******************************************
	*        FILTER GLOBAL PARAMETERS        *
	******************************************/
	FilterParams *GlobalFilter;

	// filter velocity sensing
	unsigned char PFilterVelocityScale; 

	// filter velocity sensing
	unsigned char PFilterVelocityScaleFunction;
    
	EnvelopeParams *FilterEnvelope;
    
	LFOParams *FilterLfo;
	
	// RESONANCE
	Resonance *Reson;
	
	//how the randomness is applied to the harmonics on more voices using the same oscillator
	unsigned char Hrandgrouping;
    };  


    
   /***********************************************************/
   /*                    VOICE PARAMETERS                     */
   /***********************************************************/
    struct ADnoteVoiceParam{

        /* If the voice is enabled */
        unsigned char Enabled; 

	/* Type of the voice (0=Sound,1=Noise)*/
	unsigned char Type;
    
	/* Voice Delay */
        unsigned char PDelay;

	/* If the resonance is enabled for this voice */
	unsigned char Presonance;
	
	// What external oscil should I use, -1 for internal OscilSmp&FMSmp
        short int Pextoscil,PextFMoscil;
	// it is not allowed that the externoscil,externFMoscil => current voice

	// oscillator phases
	unsigned char Poscilphase,PFMoscilphase;

	// filter bypass
	unsigned char Pfilterbypass;

        /* Voice oscillator */ 
        OscilGen *OscilSmp;    

        /**********************************
	*     FREQUENCY PARAMETERS        *
	**********************************/

	/* If the base frequency is fixed to 440 Hz*/
	unsigned char Pfixedfreq;
	
	/* Equal temperate (this is used only if the Pfixedfreq is enabled)
	   If this parameter is 0, the frequency is fixed (to 440 Hz);
	   if this parameter is 64, 1 MIDI halftone -> 1 frequency halftone */
	unsigned char PfixedfreqET;

	/* Fine detune */
	unsigned short int PDetune;

	/* Coarse detune + octave */
	unsigned short int PCoarseDetune;

	/* Detune type */
	unsigned char PDetuneType;
    
	/* Frequency Envelope */
	unsigned char PFreqEnvelopeEnabled;
	EnvelopeParams *FreqEnvelope;

	/* Frequency LFO */
	unsigned char PFreqLfoEnabled;
	LFOParams *FreqLfo;
    

	/***************************
	*   AMPLITUDE PARAMETERS   *
	***************************/

	/* Panning       0 - random
			 1 - left
		        64 - center
		       127 - right
	   The Panning is ignored if the instrument is mono */          
	unsigned char PPanning;

	/* Voice Volume */
	unsigned char PVolume;
	
	/* If the Volume negative */
	unsigned char PVolumeminus;

	/* Velocity sensing */
	unsigned char PAmpVelocityScaleFunction;

	/* Amplitude Envelope */
	unsigned char PAmpEnvelopeEnabled;
	EnvelopeParams *AmpEnvelope;
    
	/* Amplitude LFO */
	unsigned char PAmpLfoEnabled;
	LFOParams *AmpLfo;



	/*************************
	*   FILTER PARAMETERS    *
	*************************/
    
	/* Voice Filter */
	unsigned char PFilterEnabled;
	FilterParams *VoiceFilter;
    
	/* Filter Envelope */
	unsigned char PFilterEnvelopeEnabled;
	EnvelopeParams *FilterEnvelope;
    
	/* LFO Envelope */
	unsigned char PFilterLfoEnabled;
	LFOParams *FilterLfo;

	/****************************
	*   MODULLATOR PARAMETERS   *
	****************************/

	/* Modullator Parameters (0=off,1=Morph,2=RM,3=PM,4=FM.. */
	unsigned char PFMEnabled;
        
	/* Voice that I use as modullator instead of FMSmp. 
	   It is -1 if I use FMSmp(default).
	   It maynot be equal or bigger than current voice */
	short int PFMVoice;
	
	/* Modullator oscillator */
	OscilGen *FMSmp;    

	/* Modullator Volume */
	unsigned char PFMVolume;

	/* Modullator damping at higher frequencies */
	unsigned char PFMVolumeDamp;

	/* Modullator Velocity Sensing */
	unsigned char PFMVelocityScaleFunction;

	/* Fine Detune of the Modullator*/
	unsigned short int PFMDetune; 

	/* Coarse Detune of the Modullator */
	unsigned short int PFMCoarseDetune; 

	/* The detune type */
	unsigned char PFMDetuneType;
	    
	/* Frequency Envelope of the Modullator */
	unsigned char PFMFreqEnvelopeEnabled;
	EnvelopeParams *FMFreqEnvelope;

	/* Frequency Envelope of the Modullator */
	unsigned char PFMAmpEnvelopeEnabled;
	EnvelopeParams *FMAmpEnvelope;
    }; 

class ADnoteParameters:public Presets{
    public:
	ADnoteParameters(FFTwrapper *fft_);
	~ADnoteParameters();

	ADnoteGlobalParam GlobalPar;
	ADnoteVoiceParam VoicePar[NUM_VOICES];

	void defaults();
	void add2XML(XMLwrapper *xml);
        void getfromXML(XMLwrapper *xml);

	REALTYPE getBandwidthDetuneMultiplier();
    private:
	void defaults(int n);//n is the nvoice

	void EnableVoice(int nvoice);		
	void KillVoice(int nvoice);		
	FFTwrapper *fft;	

	void add2XMLsection(XMLwrapper *xml,int n);
        void getfromXMLsection(XMLwrapper *xml,int n);
};

#endif