Expose "enabled" bool param of voice
[zyn.git] / globals.h
blobfac9847d6b4ebf1d7d10bd9b4e52f8af3296116f
1 /*
2 ZynAddSubFX - a software synthesizer
4 globals.h - it contains program settings and the program capabilities
5 like number of parts, of effects
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
25 #ifndef GLOBALS_H
26 #define GLOBALS_H
28 #include "common.h"
29 #include "util.h"
32 * The size of ADnote Oscillator
33 * Decrease this => poor quality
34 * Increase this => CPU requirements gets high (only at start of the note)
36 #define OSCIL_SIZE 512
39 * The number of harmonics of additive synth
40 * This must be smaller than OSCIL_SIZE/2
42 #define MAX_AD_HARMONICS 128
46 * The number of harmonics of substractive
48 #define MAX_SUB_HARMONICS 64
52 * The maximum number of samples that are used for 1 PADsynth instrument(or item)
54 #define PAD_MAX_SAMPLES 64
58 * Number of parts
60 #define NUM_MIDI_PARTS 16
63 * Number of Midi channes
65 #define NUM_MIDI_CHANNELS 16
68 * Number of system effects
70 #define NUM_SYS_EFX 4
74 * Number of insertion effects
76 #define NUM_INS_EFX 8
79 * Number of part's insertion effects
81 #define NUM_PART_EFX 3
84 * Maximum number of the instrument on a part
86 #define NUM_KIT_ITEMS 16
90 * The maximum length of instrument's name
92 #define PART_MAX_NAME_LEN 30
95 * The maximum number of bands of the equaliser
97 #define MAX_EQ_BANDS 8
98 #if (MAX_EQ_BANDS>=20)
99 #error "Too many EQ bands in globals.h"
100 #endif
104 * Maximum filter stages
106 #define MAX_FILTER_STAGES 5
109 * Formant filter (FF) limits
111 #define FF_MAX_VOWELS 6
112 #define FF_MAX_FORMANTS 12
113 #define FF_MAX_SEQUENCE 8
115 #define LOG_2 0.693147181 // natural logarithm of 2
116 #define PI 3.1415926536
117 #define LOG_10 2.302585093 // natural logarithm of 10
120 * The threshold for the amplitude interpolation used if the amplitude
121 * is changed (by LFO's or Envelope's). If the change of the amplitude
122 * is below this, the amplitude is not interpolated
124 #define AMPLITUDE_INTERPOLATION_THRESHOLD 0.0001
127 * How the amplitude threshold is computed
129 #define ABOVE_AMPLITUDE_THRESHOLD(a,b) ( ( 2.0*fabs( (b) - (a) ) / \
130 ( fabs( (b) + (a) + 0.0000000001) ) ) > AMPLITUDE_INTERPOLATION_THRESHOLD )
133 * Interpolate Amplitude
135 #define INTERPOLATE_AMPLITUDE(a,b,x,size) ( (a) + \
136 ( (b) - (a) ) * (REALTYPE)(x) / (REALTYPE) (size) )
140 * dB
142 #define dB2rap(dB) ((exp((dB)*LOG_10/20.0)))
143 #define rap2dB(rap) ((20*log(rap)/LOG_10))
145 #define RND zyn_random() // legacy
147 #define ZERO(data,size) {char *data_=(char *) data;for (int i=0;i<size;i++) data_[i]=0;};
149 enum MidiControllers{C_NULL=0,C_pitchwheel=1000,C_expression=11,C_panning=10,
150 C_filtercutoff=74,C_filterq=71,C_bandwidth=75,C_modwheel=1,C_fmamp=76,
151 C_volume=7,C_sustain=64,C_allnotesoff=123,C_allsoundsoff=120,C_resetallcontrollers=121,
152 C_portamento=65,C_resonance_center=77,C_resonance_bandwidth=78,
154 C_dataentryhi=0x06,C_dataentrylo=0x26,C_nrpnhi=99,C_nrpnlo=98};
157 //is like i=(int)(floor(f))
158 #ifdef ASM_F2I_YES
159 #define F2I(f,i) __asm__ __volatile__ ("fistpl %0" : "=m" (i) : "t" (f-0.49999999) : "st") ;
160 #else
161 #define F2I(f,i) (i)=((f>0) ? ( (int)(f) ) :( (int)(f-1.0) ));
162 #endif
166 #ifndef O_BINARY
167 #define O_BINARY 0
168 #endif
170 #endif