27 |
#include "DLS.h" |
#include "DLS.h" |
28 |
#include <vector> |
#include <vector> |
29 |
|
|
30 |
|
#ifndef __has_feature |
31 |
|
# define __has_feature(x) 0 |
32 |
|
#endif |
33 |
|
#ifndef HAVE_RTTI |
34 |
|
# if __GXX_RTTI || __has_feature(cxx_rtti) || _CPPRTTI |
35 |
|
# define HAVE_RTTI 1 |
36 |
|
# else |
37 |
|
# define HAVE_RTTI 0 |
38 |
|
# endif |
39 |
|
#endif |
40 |
|
#if HAVE_RTTI |
41 |
|
# include <typeinfo> |
42 |
|
#endif |
43 |
|
|
44 |
#if WORDS_BIGENDIAN |
#if WORDS_BIGENDIAN |
45 |
# define LIST_TYPE_3PRG 0x33707267 |
# define LIST_TYPE_3PRG 0x33707267 |
46 |
# define LIST_TYPE_3EWL 0x3365776C |
# define LIST_TYPE_3EWL 0x3365776C |
79 |
# define CHUNK_ID_SCSL 0x4c534353 // own gig format extension |
# define CHUNK_ID_SCSL 0x4c534353 // own gig format extension |
80 |
#endif // WORDS_BIGENDIAN |
#endif // WORDS_BIGENDIAN |
81 |
|
|
82 |
|
#ifndef GIG_DECLARE_ENUM |
83 |
|
# define GIG_DECLARE_ENUM(type, ...) enum type { __VA_ARGS__ } |
84 |
|
#endif |
85 |
|
|
86 |
// just symbol prototyping (since Serialization.h not included by default here) |
// just symbol prototyping (since Serialization.h not included by default here) |
87 |
namespace Serialization { class Archive; } |
namespace Serialization { class Archive; } |
88 |
|
|
111 |
} |
} |
112 |
}; |
}; |
113 |
|
|
114 |
/** Standard types of sample loops. */ |
/** Standard types of sample loops. |
115 |
typedef enum { |
* |
116 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
117 |
|
*/ |
118 |
|
GIG_DECLARE_ENUM(loop_type_t, |
119 |
loop_type_normal = 0x00000000, ///< Loop forward (normal) |
loop_type_normal = 0x00000000, ///< Loop forward (normal) |
120 |
loop_type_bidirectional = 0x00000001, ///< Alternating loop (forward/backward, also known as Ping Pong) |
loop_type_bidirectional = 0x00000001, ///< Alternating loop (forward/backward, also known as Ping Pong) |
121 |
loop_type_backward = 0x00000002 ///< Loop backward (reverse) |
loop_type_backward = 0x00000002 ///< Loop backward (reverse) |
122 |
} loop_type_t; |
); |
123 |
|
|
124 |
/** Society of Motion Pictures and Television E time format. */ |
/** Society of Motion Pictures and Television E time format. |
125 |
typedef enum { |
* |
126 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
127 |
|
*/ |
128 |
|
GIG_DECLARE_ENUM(smpte_format_t, |
129 |
smpte_format_no_offset = 0x00000000, ///< no SMPTE offset |
smpte_format_no_offset = 0x00000000, ///< no SMPTE offset |
130 |
smpte_format_24_frames = 0x00000018, ///< 24 frames per second |
smpte_format_24_frames = 0x00000018, ///< 24 frames per second |
131 |
smpte_format_25_frames = 0x00000019, ///< 25 frames per second |
smpte_format_25_frames = 0x00000019, ///< 25 frames per second |
132 |
smpte_format_30_frames_dropping = 0x0000001D, ///< 30 frames per second with frame dropping (30 drop) |
smpte_format_30_frames_dropping = 0x0000001D, ///< 30 frames per second with frame dropping (30 drop) |
133 |
smpte_format_30_frames = 0x0000001E ///< 30 frames per second |
smpte_format_30_frames = 0x0000001E ///< 30 frames per second |
134 |
} smpte_format_t; |
); |
135 |
|
|
136 |
/** Defines the shape of a function graph. */ |
/** Defines the shape of a function graph. |
137 |
typedef enum { |
* |
138 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
139 |
|
*/ |
140 |
|
GIG_DECLARE_ENUM(curve_type_t, |
141 |
curve_type_nonlinear = 0, |
curve_type_nonlinear = 0, |
142 |
curve_type_linear = 1, |
curve_type_linear = 1, |
143 |
curve_type_special = 2, |
curve_type_special = 2, |
144 |
curve_type_unknown = 0xffffffff |
curve_type_unknown = 0xffffffff |
145 |
} curve_type_t; |
); |
146 |
|
|
147 |
/** Dimensions allow to bypass one of the following controllers. */ |
/** Dimensions allow to bypass one of the following controllers. |
148 |
typedef enum { |
* |
149 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
150 |
|
*/ |
151 |
|
GIG_DECLARE_ENUM(dim_bypass_ctrl_t, |
152 |
dim_bypass_ctrl_none, |
dim_bypass_ctrl_none, |
153 |
dim_bypass_ctrl_94, ///< Effect 4 Depth (MIDI Controller 94) |
dim_bypass_ctrl_94, ///< Effect 4 Depth (MIDI Controller 94) |
154 |
dim_bypass_ctrl_95 ///< Effect 5 Depth (MIDI Controller 95) |
dim_bypass_ctrl_95 ///< Effect 5 Depth (MIDI Controller 95) |
155 |
} dim_bypass_ctrl_t; |
); |
156 |
|
|
157 |
/** Defines how LFO3 is controlled by. */ |
/** Defines how LFO3 is controlled by. |
158 |
typedef enum { |
* |
159 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
160 |
|
*/ |
161 |
|
GIG_DECLARE_ENUM(lfo3_ctrl_t, |
162 |
lfo3_ctrl_internal = 0x00, ///< Only internally controlled. |
lfo3_ctrl_internal = 0x00, ///< Only internally controlled. |
163 |
lfo3_ctrl_modwheel = 0x01, ///< Only controlled by external modulation wheel. |
lfo3_ctrl_modwheel = 0x01, ///< Only controlled by external modulation wheel. |
164 |
lfo3_ctrl_aftertouch = 0x02, ///< Only controlled by aftertouch controller. |
lfo3_ctrl_aftertouch = 0x02, ///< Only controlled by aftertouch controller. |
165 |
lfo3_ctrl_internal_modwheel = 0x03, ///< Controlled internally and by external modulation wheel. |
lfo3_ctrl_internal_modwheel = 0x03, ///< Controlled internally and by external modulation wheel. |
166 |
lfo3_ctrl_internal_aftertouch = 0x04 ///< Controlled internally and by aftertouch controller. |
lfo3_ctrl_internal_aftertouch = 0x04 ///< Controlled internally and by aftertouch controller. |
167 |
} lfo3_ctrl_t; |
); |
168 |
|
|
169 |
/** Defines how LFO2 is controlled by. */ |
/** Defines how LFO2 is controlled by. |
170 |
typedef enum { |
* |
171 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
172 |
|
*/ |
173 |
|
GIG_DECLARE_ENUM(lfo2_ctrl_t, |
174 |
lfo2_ctrl_internal = 0x00, ///< Only internally controlled. |
lfo2_ctrl_internal = 0x00, ///< Only internally controlled. |
175 |
lfo2_ctrl_modwheel = 0x01, ///< Only controlled by external modulation wheel. |
lfo2_ctrl_modwheel = 0x01, ///< Only controlled by external modulation wheel. |
176 |
lfo2_ctrl_foot = 0x02, ///< Only controlled by external foot controller. |
lfo2_ctrl_foot = 0x02, ///< Only controlled by external foot controller. |
177 |
lfo2_ctrl_internal_modwheel = 0x03, ///< Controlled internally and by external modulation wheel. |
lfo2_ctrl_internal_modwheel = 0x03, ///< Controlled internally and by external modulation wheel. |
178 |
lfo2_ctrl_internal_foot = 0x04 ///< Controlled internally and by external foot controller. |
lfo2_ctrl_internal_foot = 0x04 ///< Controlled internally and by external foot controller. |
179 |
} lfo2_ctrl_t; |
); |
180 |
|
|
181 |
/** Defines how LFO1 is controlled by. */ |
/** Defines how LFO1 is controlled by. |
182 |
typedef enum { |
* |
183 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
184 |
|
*/ |
185 |
|
GIG_DECLARE_ENUM(lfo1_ctrl_t, |
186 |
lfo1_ctrl_internal = 0x00, ///< Only internally controlled. |
lfo1_ctrl_internal = 0x00, ///< Only internally controlled. |
187 |
lfo1_ctrl_modwheel = 0x01, ///< Only controlled by external modulation wheel. |
lfo1_ctrl_modwheel = 0x01, ///< Only controlled by external modulation wheel. |
188 |
lfo1_ctrl_breath = 0x02, ///< Only controlled by external breath controller. |
lfo1_ctrl_breath = 0x02, ///< Only controlled by external breath controller. |
189 |
lfo1_ctrl_internal_modwheel = 0x03, ///< Controlled internally and by external modulation wheel. |
lfo1_ctrl_internal_modwheel = 0x03, ///< Controlled internally and by external modulation wheel. |
190 |
lfo1_ctrl_internal_breath = 0x04 ///< Controlled internally and by external breath controller. |
lfo1_ctrl_internal_breath = 0x04 ///< Controlled internally and by external breath controller. |
191 |
} lfo1_ctrl_t; |
); |
192 |
|
|
193 |
/** Defines how the filter cutoff frequency is controlled by. */ |
/** Defines how the filter cutoff frequency is controlled by. |
194 |
typedef enum { |
* |
195 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
196 |
|
*/ |
197 |
|
GIG_DECLARE_ENUM(vcf_cutoff_ctrl_t, |
198 |
vcf_cutoff_ctrl_none = 0x00, |
vcf_cutoff_ctrl_none = 0x00, |
199 |
vcf_cutoff_ctrl_none2 = 0x01, ///< The difference between none and none2 is unknown |
vcf_cutoff_ctrl_none2 = 0x01, ///< The difference between none and none2 is unknown |
200 |
vcf_cutoff_ctrl_modwheel = 0x81, ///< Modulation Wheel (MIDI Controller 1) |
vcf_cutoff_ctrl_modwheel = 0x81, ///< Modulation Wheel (MIDI Controller 1) |
207 |
vcf_cutoff_ctrl_genpurpose7 = 0xd2, ///< General Purpose Controller 7 (Button, MIDI Controller 82) |
vcf_cutoff_ctrl_genpurpose7 = 0xd2, ///< General Purpose Controller 7 (Button, MIDI Controller 82) |
208 |
vcf_cutoff_ctrl_genpurpose8 = 0xd3, ///< General Purpose Controller 8 (Button, MIDI Controller 83) |
vcf_cutoff_ctrl_genpurpose8 = 0xd3, ///< General Purpose Controller 8 (Button, MIDI Controller 83) |
209 |
vcf_cutoff_ctrl_aftertouch = 0x80 ///< Key Pressure |
vcf_cutoff_ctrl_aftertouch = 0x80 ///< Key Pressure |
210 |
} vcf_cutoff_ctrl_t; |
); |
211 |
|
|
212 |
/** Defines how the filter resonance is controlled by. */ |
/** Defines how the filter resonance is controlled by. |
213 |
typedef enum { |
* |
214 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
215 |
|
*/ |
216 |
|
GIG_DECLARE_ENUM(vcf_res_ctrl_t, |
217 |
vcf_res_ctrl_none = 0xffffffff, |
vcf_res_ctrl_none = 0xffffffff, |
218 |
vcf_res_ctrl_genpurpose3 = 0, ///< General Purpose Controller 3 (Slider, MIDI Controller 18) |
vcf_res_ctrl_genpurpose3 = 0, ///< General Purpose Controller 3 (Slider, MIDI Controller 18) |
219 |
vcf_res_ctrl_genpurpose4 = 1, ///< General Purpose Controller 4 (Slider, MIDI Controller 19) |
vcf_res_ctrl_genpurpose4 = 1, ///< General Purpose Controller 4 (Slider, MIDI Controller 19) |
220 |
vcf_res_ctrl_genpurpose5 = 2, ///< General Purpose Controller 5 (Button, MIDI Controller 80) |
vcf_res_ctrl_genpurpose5 = 2, ///< General Purpose Controller 5 (Button, MIDI Controller 80) |
221 |
vcf_res_ctrl_genpurpose6 = 3 ///< General Purpose Controller 6 (Button, MIDI Controller 81) |
vcf_res_ctrl_genpurpose6 = 3 ///< General Purpose Controller 6 (Button, MIDI Controller 81) |
222 |
} vcf_res_ctrl_t; |
); |
223 |
|
|
224 |
/** |
/** |
225 |
* Defines a controller that has a certain contrained influence on a |
* Defines a controller that has a certain contrained influence on a |
230 |
* attenuation_ctrl_t, eg1_ctrl_t or eg2_ctrl_t) in your code! |
* attenuation_ctrl_t, eg1_ctrl_t or eg2_ctrl_t) in your code! |
231 |
*/ |
*/ |
232 |
struct leverage_ctrl_t { |
struct leverage_ctrl_t { |
233 |
typedef enum { |
/** Defines possible controllers. |
234 |
|
* |
235 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
236 |
|
*/ |
237 |
|
GIG_DECLARE_ENUM(type_t, |
238 |
type_none = 0x00, ///< No controller defined |
type_none = 0x00, ///< No controller defined |
239 |
type_channelaftertouch = 0x2f, ///< Channel Key Pressure |
type_channelaftertouch = 0x2f, ///< Channel Key Pressure |
240 |
type_velocity = 0xff, ///< Key Velocity |
type_velocity = 0xff, ///< Key Velocity |
241 |
type_controlchange = 0xfe ///< Ordinary MIDI control change controller, see field 'controller_number' |
type_controlchange = 0xfe ///< Ordinary MIDI control change controller, see field 'controller_number' |
242 |
} type_t; |
); |
243 |
|
|
244 |
type_t type; ///< Controller type |
type_t type; ///< Controller type |
245 |
uint controller_number; ///< MIDI controller number if this controller is a control change controller, 0 otherwise |
uint controller_number; ///< MIDI controller number if this controller is a control change controller, 0 otherwise |
274 |
* dimension zones is always a power of two. All dimensions can have up |
* dimension zones is always a power of two. All dimensions can have up |
275 |
* to 32 zones (except the layer dimension with only up to 8 zones and |
* to 32 zones (except the layer dimension with only up to 8 zones and |
276 |
* the samplechannel dimension which currently allows only 2 zones). |
* the samplechannel dimension which currently allows only 2 zones). |
277 |
|
* |
278 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
279 |
*/ |
*/ |
280 |
typedef enum { |
GIG_DECLARE_ENUM(dimension_t, |
281 |
dimension_none = 0x00, ///< Dimension not in use. |
dimension_none = 0x00, ///< Dimension not in use. |
282 |
dimension_samplechannel = 0x80, ///< If used sample has more than one channel (thus is not mono). |
dimension_samplechannel = 0x80, ///< If used sample has more than one channel (thus is not mono). |
283 |
dimension_layer = 0x81, ///< For layering of up to 8 instruments (and eventually crossfading of 2 or 4 layers). |
dimension_layer = 0x81, ///< For layering of up to 8 instruments (and eventually crossfading of 2 or 4 layers). |
312 |
dimension_effect3depth = 0x5d, ///< Effect 3 Depth (MIDI Controller 93) |
dimension_effect3depth = 0x5d, ///< Effect 3 Depth (MIDI Controller 93) |
313 |
dimension_effect4depth = 0x5e, ///< Effect 4 Depth (MIDI Controller 94) |
dimension_effect4depth = 0x5e, ///< Effect 4 Depth (MIDI Controller 94) |
314 |
dimension_effect5depth = 0x5f ///< Effect 5 Depth (MIDI Controller 95) |
dimension_effect5depth = 0x5f ///< Effect 5 Depth (MIDI Controller 95) |
315 |
} dimension_t; |
); |
316 |
|
|
317 |
/** |
/** |
318 |
* Intended for internal usage: will be used to convert a dimension value |
* Intended for internal usage: will be used to convert a dimension value |
319 |
* into the corresponding dimension bit number. |
* into the corresponding dimension bit number. |
320 |
|
* |
321 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
322 |
*/ |
*/ |
323 |
typedef enum { |
GIG_DECLARE_ENUM(split_type_t, |
324 |
split_type_normal, ///< dimension value between 0-127 |
split_type_normal, ///< dimension value between 0-127 |
325 |
split_type_bit ///< dimension values are already the sought bit number |
split_type_bit ///< dimension values are already the sought bit number |
326 |
} split_type_t; |
); |
327 |
|
|
328 |
/** General dimension definition. */ |
/** General dimension definition. */ |
329 |
struct dimension_def_t { |
struct dimension_def_t { |
334 |
float zone_size; ///< Intended for internal usage: reflects the size of each zone (128/zones) for normal split types only, 0 otherwise. |
float zone_size; ///< Intended for internal usage: reflects the size of each zone (128/zones) for normal split types only, 0 otherwise. |
335 |
}; |
}; |
336 |
|
|
337 |
/** Defines which frequencies are filtered by the VCF. */ |
/** Defines which frequencies are filtered by the VCF. |
338 |
typedef enum { |
* |
339 |
|
* @see countEnum(), enumKey(), enumKeys(), enumValue() |
340 |
|
*/ |
341 |
|
GIG_DECLARE_ENUM(vcf_type_t, |
342 |
vcf_type_lowpass = 0x00, |
vcf_type_lowpass = 0x00, |
343 |
vcf_type_lowpassturbo = 0xff, ///< More poles than normal lowpass |
vcf_type_lowpassturbo = 0xff, ///< More poles than normal lowpass |
344 |
vcf_type_bandpass = 0x01, |
vcf_type_bandpass = 0x01, |
345 |
vcf_type_highpass = 0x02, |
vcf_type_highpass = 0x02, |
346 |
vcf_type_bandreject = 0x03 |
vcf_type_bandreject = 0x03 |
347 |
} vcf_type_t; |
); |
348 |
|
|
349 |
/** |
/** |
350 |
* Defines the envelope of a crossfade. |
* Defines the envelope of a crossfade. |
1367 |
void PrintMessage(); |
void PrintMessage(); |
1368 |
}; |
}; |
1369 |
|
|
1370 |
|
#if HAVE_RTTI |
1371 |
|
size_t countEnum(const std::type_info& type); |
1372 |
|
size_t countEnum(String typeName); |
1373 |
|
const char* enumKey(const std::type_info& type, size_t value); |
1374 |
|
const char* enumKey(String typeName, size_t value); |
1375 |
|
bool enumKey(const std::type_info& type, String key); |
1376 |
|
bool enumKey(String typeName, String key); |
1377 |
|
const char** enumKeys(const std::type_info& type); |
1378 |
|
const char** enumKeys(String typeName); |
1379 |
|
size_t enumValue(String key); |
1380 |
|
#endif // HAVE_RTTI |
1381 |
|
|
1382 |
String libraryName(); |
String libraryName(); |
1383 |
String libraryVersion(); |
String libraryVersion(); |
1384 |
|
|