LMMS
Loading...
Searching...
No Matches
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
167 OFF = 0, ON = 1
168};
169
181
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
204struct SYNTH_T {
206 :samplerate(44100), buffersize(256), oscilsize(1024)
207 {
208 alias();
209 }
210
212 unsigned int samplerate;
213
223
230
231 //Alias for above terms
237
238 inline void alias(void)
239 {
242 bufferbytes = buffersize * sizeof(float);
244 }
245 static float numRandom(void); //defined in Util.cpp for now
246};
247
248extern SYNTH_T *synth;
249#endif
SYNTH_T * synth
Definition LocalZynAddSubFx.cpp:47
ONOFFTYPE
Definition globals.h:166
@ ON
Definition globals.h:167
LegatoMsg
Definition globals.h:182
@ LM_FadeIn
Definition globals.h:183
@ LM_FadeOut
Definition globals.h:183
@ LM_Norm
Definition globals.h:183
@ LM_CatchUp
Definition globals.h:183
@ LM_ToNorm
Definition globals.h:183
MidiControllers
Definition globals.h:170
@ C_panning
Definition globals.h:172
@ C_nrpnlo
Definition globals.h:179
@ C_sustain
Definition globals.h:175
@ C_fmamp
Definition globals.h:174
@ C_NULL
Definition globals.h:171
@ C_bandwidth
Definition globals.h:173
@ C_expression
Definition globals.h:172
@ C_pitchwheel
Definition globals.h:171
@ C_resonance_bandwidth
Definition globals.h:177
@ C_portamento
Definition globals.h:177
@ C_dataentrylo
Definition globals.h:179
@ C_resonance_center
Definition globals.h:177
@ C_allsoundsoff
Definition globals.h:175
@ C_filtercutoff
Definition globals.h:173
@ C_dataentryhi
Definition globals.h:179
@ C_nrpnhi
Definition globals.h:179
@ C_resetallcontrollers
Definition globals.h:176
@ C_volume
Definition globals.h:175
@ C_bankselectlsb
Definition globals.h:172
@ C_bankselectmsb
Definition globals.h:171
@ C_modwheel
Definition globals.h:173
@ C_filterq
Definition globals.h:173
@ C_allnotesoff
Definition globals.h:175
#define OFF
Definition inffast.c:28
Definition globals.h:204
float buffersize_f
Definition globals.h:234
int buffersize
Definition globals.h:222
void alias(void)
Definition globals.h:238
static float numRandom(void)
Definition Util.cpp:210
float halfsamplerate_f
Definition globals.h:233
SYNTH_T(void)
Definition globals.h:205
int bufferbytes
Definition globals.h:235
float oscilsize_f
Definition globals.h:236
int oscilsize
Definition globals.h:229
float samplerate_f
Definition globals.h:232
unsigned int samplerate
Definition globals.h:212