LMMS
Loading...
Searching...
No Matches
plugins
ZynAddSubFx
zynaddsubfx
src
globals.h
Go to the documentation of this file.
1
/*
2
ZynAddSubFX - a software synthesizer
3
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
8
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.
12
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 or later) for more details.
17
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
21
22
*/
23
24
25
#ifndef GLOBALS_H
26
#define GLOBALS_H
27
#include <stdint.h>
28
29
34
#define MAX_AD_HARMONICS 128
35
36
40
#define MAX_SUB_HARMONICS 64
41
42
43
/*
44
* The maximum number of samples that are used for 1 PADsynth instrument(or item)
45
*/
46
#define PAD_MAX_SAMPLES 64
47
48
49
/*
50
* Number of parts
51
*/
52
#define NUM_MIDI_PARTS 16
53
54
/*
55
* Number of Midi channes
56
*/
57
#define NUM_MIDI_CHANNELS 16
58
59
/*
60
* The number of voices of additive synth for a single note
61
*/
62
#define NUM_VOICES 8
63
64
/*
65
* The poliphony (notes)
66
*/
67
#define POLIPHONY 128
68
69
/*
70
* Number of system effects
71
*/
72
#define NUM_SYS_EFX 4
73
74
75
/*
76
* Number of insertion effects
77
*/
78
#define NUM_INS_EFX 8
79
80
/*
81
* Number of part's insertion effects
82
*/
83
#define NUM_PART_EFX 3
84
85
/*
86
* Maximum number of the instrument on a part
87
*/
88
#define NUM_KIT_ITEMS 16
89
90
91
/*
92
* How is applied the velocity sensing
93
*/
94
#define VELOCITY_MAX_SCALE 8.0f
95
96
/*
97
* The maximum length of instrument's name
98
*/
99
#define PART_MAX_NAME_LEN 30
100
101
/*
102
* The maximum number of bands of the equaliser
103
*/
104
#define MAX_EQ_BANDS 8
105
#if (MAX_EQ_BANDS >= 20)
106
#error "Too many EQ bands in globals.h"
107
#endif
108
109
110
/*
111
* Maximum filter stages
112
*/
113
#define MAX_FILTER_STAGES 5
114
115
/*
116
* Formant filter (FF) limits
117
*/
118
#define FF_MAX_VOWELS 6
119
#define FF_MAX_FORMANTS 12
120
#define FF_MAX_SEQUENCE 8
121
122
#define LOG_2 0.693147181f
123
#define PI 3.1415926536f
124
#define LOG_10 2.302585093f
125
126
/*
127
* The threshold for the amplitude interpolation used if the amplitude
128
* is changed (by LFO's or Envelope's). If the change of the amplitude
129
* is below this, the amplitude is not interpolated
130
*/
131
#define AMPLITUDE_INTERPOLATION_THRESHOLD 0.0001f
132
133
/*
134
* How the amplitude threshold is computed
135
*/
136
#define ABOVE_AMPLITUDE_THRESHOLD(a, b) ((2.0f * fabs((b) - (a)) \
137
/ (fabs((b) + (a) \
138
+ 0.0000000001f))) > \
139
AMPLITUDE_INTERPOLATION_THRESHOLD)
140
141
/*
142
* Interpolate Amplitude
143
*/
144
#define INTERPOLATE_AMPLITUDE(a, b, x, size) ((a) \
145
+ ((b) \
146
- (a)) * (float)(x) \
147
/ (float) (size))
148
149
150
/*
151
* dB
152
*/
153
#define dB2rap(dB) ((expf((dB) * LOG_10 / 20.0f)))
154
#define rap2dB(rap) ((20 * logf(rap) / LOG_10))
155
156
#define ZERO(data, size) {char *data_ = (char *) data; for(int i = 0; \
157
i < size; \
158
i++) \
159
data_[i] = 0; }
160
#define ZERO_float(data, size) {float *data_ = (float *) data; \
161
for(int i = 0; \
162
i < size; \
163
i++) \
164
data_[i] = 0.0f; }
165
166
enum
ONOFFTYPE
{
167
OFF
= 0,
ON
= 1
168
};
169
170
enum
MidiControllers
{
171
C_bankselectmsb
= 0,
C_pitchwheel
= 1000,
C_NULL
= 1001,
172
C_expression
= 11,
C_panning
= 10,
C_bankselectlsb
= 32,
173
C_filtercutoff
= 74,
C_filterq
= 71,
C_bandwidth
= 75,
C_modwheel
= 1,
174
C_fmamp
= 76,
175
C_volume
= 7,
C_sustain
= 64,
C_allnotesoff
= 123,
C_allsoundsoff
= 120,
176
C_resetallcontrollers
= 121,
177
C_portamento
= 65,
C_resonance_center
= 77,
C_resonance_bandwidth
= 78,
178
179
C_dataentryhi
= 0x06,
C_dataentrylo
= 0x26,
C_nrpnhi
= 99,
C_nrpnlo
= 98
180
};
181
182
enum
LegatoMsg
{
183
LM_Norm
,
LM_FadeIn
,
LM_FadeOut
,
LM_CatchUp
,
LM_ToNorm
184
};
185
186
//is like i=(int)(floor(f))
187
#ifdef ASM_F2I_YES
188
#define F2I(f, \
189
i) __asm__ __volatile__ ("fistpl %0" : "=m" (i) : "t" (f \
190
- \
191
0.49999999f) \
192
: "st");
193
#else
194
#define F2I(f, i) (i) = ((f > 0) ? ((int)(f)) : ((int)(f - 1.0f)));
195
#endif
196
197
198
199
#ifndef O_BINARY
200
#define O_BINARY 0
201
#endif
202
203
//temporary include for synth->{samplerate/buffersize} members
204
struct
SYNTH_T
{
205
SYNTH_T
(
void
)
206
:
samplerate
(44100),
buffersize
(256),
oscilsize
(1024)
207
{
208
alias
();
209
}
210
212
unsigned
int
samplerate
;
213
222
int
buffersize
;
223
229
int
oscilsize
;
230
231
//Alias for above terms
232
float
samplerate_f
;
233
float
halfsamplerate_f
;
234
float
buffersize_f
;
235
int
bufferbytes
;
236
float
oscilsize_f
;
237
238
inline
void
alias
(
void
)
239
{
240
halfsamplerate_f
= (
samplerate_f
=
samplerate
) / 2.0f;
241
buffersize_f
=
buffersize
;
242
bufferbytes
=
buffersize
*
sizeof
(float);
243
oscilsize_f
=
oscilsize
;
244
}
245
static
float
numRandom
(
void
);
//defined in Util.cpp for now
246
};
247
248
extern
SYNTH_T
*
synth
;
249
#endif
synth
SYNTH_T * synth
Definition
LocalZynAddSubFx.cpp:47
ONOFFTYPE
ONOFFTYPE
Definition
globals.h:166
ON
@ ON
Definition
globals.h:167
LegatoMsg
LegatoMsg
Definition
globals.h:182
LM_FadeIn
@ LM_FadeIn
Definition
globals.h:183
LM_FadeOut
@ LM_FadeOut
Definition
globals.h:183
LM_Norm
@ LM_Norm
Definition
globals.h:183
LM_CatchUp
@ LM_CatchUp
Definition
globals.h:183
LM_ToNorm
@ LM_ToNorm
Definition
globals.h:183
MidiControllers
MidiControllers
Definition
globals.h:170
C_panning
@ C_panning
Definition
globals.h:172
C_nrpnlo
@ C_nrpnlo
Definition
globals.h:179
C_sustain
@ C_sustain
Definition
globals.h:175
C_fmamp
@ C_fmamp
Definition
globals.h:174
C_NULL
@ C_NULL
Definition
globals.h:171
C_bandwidth
@ C_bandwidth
Definition
globals.h:173
C_expression
@ C_expression
Definition
globals.h:172
C_pitchwheel
@ C_pitchwheel
Definition
globals.h:171
C_resonance_bandwidth
@ C_resonance_bandwidth
Definition
globals.h:177
C_portamento
@ C_portamento
Definition
globals.h:177
C_dataentrylo
@ C_dataentrylo
Definition
globals.h:179
C_resonance_center
@ C_resonance_center
Definition
globals.h:177
C_allsoundsoff
@ C_allsoundsoff
Definition
globals.h:175
C_filtercutoff
@ C_filtercutoff
Definition
globals.h:173
C_dataentryhi
@ C_dataentryhi
Definition
globals.h:179
C_nrpnhi
@ C_nrpnhi
Definition
globals.h:179
C_resetallcontrollers
@ C_resetallcontrollers
Definition
globals.h:176
C_volume
@ C_volume
Definition
globals.h:175
C_bankselectlsb
@ C_bankselectlsb
Definition
globals.h:172
C_bankselectmsb
@ C_bankselectmsb
Definition
globals.h:171
C_modwheel
@ C_modwheel
Definition
globals.h:173
C_filterq
@ C_filterq
Definition
globals.h:173
C_allnotesoff
@ C_allnotesoff
Definition
globals.h:175
OFF
#define OFF
Definition
inffast.c:28
SYNTH_T
Definition
globals.h:204
SYNTH_T::buffersize_f
float buffersize_f
Definition
globals.h:234
SYNTH_T::buffersize
int buffersize
Definition
globals.h:222
SYNTH_T::alias
void alias(void)
Definition
globals.h:238
SYNTH_T::numRandom
static float numRandom(void)
Definition
Util.cpp:210
SYNTH_T::halfsamplerate_f
float halfsamplerate_f
Definition
globals.h:233
SYNTH_T::SYNTH_T
SYNTH_T(void)
Definition
globals.h:205
SYNTH_T::bufferbytes
int bufferbytes
Definition
globals.h:235
SYNTH_T::oscilsize_f
float oscilsize_f
Definition
globals.h:236
SYNTH_T::oscilsize
int oscilsize
Definition
globals.h:229
SYNTH_T::samplerate_f
float samplerate_f
Definition
globals.h:232
SYNTH_T::samplerate
unsigned int samplerate
Definition
globals.h:212
Generated on
for LMMS by
1.16.1