237 |
EG(); |
EG(); |
238 |
}; |
}; |
239 |
|
|
240 |
|
// Fixed size array with copy-on-write semantics |
241 |
|
template<class T> |
242 |
|
class Array |
243 |
|
{ |
244 |
|
private: |
245 |
|
struct Rep { |
246 |
|
int refcount; |
247 |
|
T a[128]; |
248 |
|
|
249 |
|
Rep() : refcount(1) { } |
250 |
|
static void release(Rep* rep) { |
251 |
|
if (!--rep->refcount) delete rep; |
252 |
|
} |
253 |
|
} *ptr; |
254 |
|
public: |
255 |
|
Array() : ptr(0) { } |
256 |
|
~Array() { Rep::release(ptr); } |
257 |
|
|
258 |
|
Array& operator=(const Array& array) { |
259 |
|
if (this != &array) { |
260 |
|
ptr = array.ptr; |
261 |
|
if (ptr) ptr->refcount++; |
262 |
|
} |
263 |
|
return *this; |
264 |
|
} |
265 |
|
|
266 |
|
const T& operator[](int i) const { return ptr->a[i]; } |
267 |
|
|
268 |
|
void set(int i, const T& v) { |
269 |
|
if (!ptr) { |
270 |
|
ptr = new Rep; |
271 |
|
} else if (ptr->refcount > 1 && ptr->a[i] != v) { |
272 |
|
Rep* newptr = new Rep(*ptr); |
273 |
|
newptr->refcount = 1; |
274 |
|
Rep::release(ptr); |
275 |
|
ptr = newptr; |
276 |
|
} |
277 |
|
ptr->a[i] = v; |
278 |
|
} |
279 |
|
}; |
280 |
|
|
281 |
///////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////// |
282 |
// class Definition |
// class Definition |
283 |
|
|
295 |
int lochan; int hichan; |
int lochan; int hichan; |
296 |
int lokey; int hikey; |
int lokey; int hikey; |
297 |
int lovel; int hivel; |
int lovel; int hivel; |
298 |
std::vector<int> locc; std::vector<int> hicc; |
Array<int> locc; Array<int> hicc; |
299 |
int lobend; int hibend; |
int lobend; int hibend; |
300 |
int lobpm; int hibpm; |
int lobpm; int hibpm; |
301 |
int lochanaft; int hichanaft; |
int lochanaft; int hichanaft; |
307 |
int seq_length; |
int seq_length; |
308 |
int seq_position; |
int seq_position; |
309 |
|
|
310 |
std::vector<int> start_locc; std::vector<int> start_hicc; |
Array<int> start_locc; Array<int> start_hicc; |
311 |
std::vector<int> stop_locc; std::vector<int> stop_hicc; |
Array<int> stop_locc; Array<int> stop_hicc; |
312 |
|
|
313 |
int sw_lokey; int sw_hikey; |
int sw_lokey; int sw_hikey; |
314 |
int sw_last; |
int sw_last; |
323 |
optional<int> off_by; |
optional<int> off_by; |
324 |
off_mode_t off_mode; |
off_mode_t off_mode; |
325 |
|
|
326 |
std::vector<int> on_locc; std::vector<int> on_hicc; |
Array<int> on_locc; Array<int> on_hicc; |
327 |
|
|
328 |
// sample player |
// sample player |
329 |
optional<int> count; |
optional<int> count; |
330 |
optional<float> delay; optional<float> delay_random; std::vector<optional<float> > delay_oncc; |
optional<float> delay; optional<float> delay_random; Array<optional<float> > delay_oncc; |
331 |
optional<int> delay_beats; optional<int> stop_beats; |
optional<int> delay_beats; optional<int> stop_beats; |
332 |
optional<int> delay_samples; std::vector<optional<int> > delay_samples_oncc; |
optional<int> delay_samples; Array<optional<int> > delay_samples_oncc; |
333 |
optional<int> end; |
optional<int> end; |
334 |
optional<float> loop_crossfade; |
optional<float> loop_crossfade; |
335 |
optional<int> offset; optional<int> offset_random; std::vector<optional<int> > offset_oncc; |
optional<int> offset; optional<int> offset_random; Array<optional<int> > offset_oncc; |
336 |
loop_mode_t loop_mode; |
loop_mode_t loop_mode; |
337 |
optional<int> loop_start; optional<int> loop_end; |
optional<int> loop_start; optional<int> loop_end; |
338 |
optional<int> sync_beats; |
optional<int> sync_beats; |
343 |
float pan; |
float pan; |
344 |
float width; |
float width; |
345 |
float position; |
float position; |
346 |
float amp_keytrack; int amp_keycenter; float amp_veltrack; std::vector<float> amp_velcurve; float amp_random; |
float amp_keytrack; int amp_keycenter; float amp_veltrack; Array<float> amp_velcurve; float amp_random; |
347 |
float rt_decay; |
float rt_decay; |
348 |
std::vector<float> gain_oncc; |
Array<float> gain_oncc; |
349 |
int xfin_lokey; int xfin_hikey; |
int xfin_lokey; int xfin_hikey; |
350 |
int xfout_lokey; int xfout_hikey; |
int xfout_lokey; int xfout_hikey; |
351 |
curve_t xf_keycurve; |
curve_t xf_keycurve; |
352 |
int xfin_lovel; int xfin_hivel; |
int xfin_lovel; int xfin_hivel; |
353 |
int xfout_lovel; int xfout_hivel; |
int xfout_lovel; int xfout_hivel; |
354 |
curve_t xf_velcurve; |
curve_t xf_velcurve; |
355 |
std::vector<int> xfin_locc; std::vector<int> xfin_hicc; |
Array<int> xfin_locc; Array<int> xfin_hicc; |
356 |
std::vector<int> xfout_locc; std::vector<int> xfout_hicc; |
Array<int> xfout_locc; Array<int> xfout_hicc; |
357 |
curve_t xf_cccurve; |
curve_t xf_cccurve; |
358 |
|
|
359 |
// pitch |
// pitch |
365 |
// filter |
// filter |
366 |
filter_t fil_type; filter_t fil2_type; |
filter_t fil_type; filter_t fil2_type; |
367 |
optional<float> cutoff; optional<float> cutoff2; |
optional<float> cutoff; optional<float> cutoff2; |
368 |
std::vector<int> cutoff_oncc; std::vector<int> cutoff2_oncc; |
Array<int> cutoff_oncc; Array<int> cutoff2_oncc; |
369 |
std::vector<int> cutoff_smoothcc; std::vector<int> cutoff2_smoothcc; |
Array<int> cutoff_smoothcc; Array<int> cutoff2_smoothcc; |
370 |
std::vector<int> cutoff_stepcc; std::vector<int> cutoff2_stepcc; |
Array<int> cutoff_stepcc; Array<int> cutoff2_stepcc; |
371 |
std::vector<int> cutoff_curvecc; std::vector<int> cutoff2_curvecc; |
Array<int> cutoff_curvecc; Array<int> cutoff2_curvecc; |
372 |
int cutoff_chanaft; int cutoff2_chanaft; |
int cutoff_chanaft; int cutoff2_chanaft; |
373 |
int cutoff_polyaft; int cutoff2_polyaft; |
int cutoff_polyaft; int cutoff2_polyaft; |
374 |
float resonance; float resonance2; |
float resonance; float resonance2; |
375 |
std::vector<int> resonance_oncc; std::vector<int> resonance2_oncc; |
Array<int> resonance_oncc; Array<int> resonance2_oncc; |
376 |
std::vector<int> resonance_smoothcc; std::vector<int> resonance2_smoothcc; |
Array<int> resonance_smoothcc; Array<int> resonance2_smoothcc; |
377 |
std::vector<int> resonance_stepcc; std::vector<int> resonance2_stepcc; |
Array<int> resonance_stepcc; Array<int> resonance2_stepcc; |
378 |
std::vector<int> resonance_curvecc; std::vector<int> resonance2_curvecc; |
Array<int> resonance_curvecc; Array<int> resonance2_curvecc; |
379 |
int fil_keytrack; int fil2_keytrack; |
int fil_keytrack; int fil2_keytrack; |
380 |
int fil_keycenter; int fil2_keycenter; |
int fil_keycenter; int fil2_keycenter; |
381 |
int fil_veltrack; int fil2_veltrack; |
int fil_veltrack; int fil2_veltrack; |
383 |
|
|
384 |
// per voice equalizer |
// per voice equalizer |
385 |
float eq1_freq; float eq2_freq; float eq3_freq; |
float eq1_freq; float eq2_freq; float eq3_freq; |
386 |
std::vector<float> eq1_freq_oncc; std::vector<float> eq2_freq_oncc; std::vector<float> eq3_freq_oncc; |
Array<float> eq1_freq_oncc; Array<float> eq2_freq_oncc; Array<float> eq3_freq_oncc; |
387 |
float eq1_vel2freq; float eq2_vel2freq; float eq3_vel2freq; |
float eq1_vel2freq; float eq2_vel2freq; float eq3_vel2freq; |
388 |
float eq1_bw; float eq2_bw; float eq3_bw; |
float eq1_bw; float eq2_bw; float eq3_bw; |
389 |
std::vector<float> eq1_bw_oncc; std::vector<float> eq2_bw_oncc; std::vector<float> eq3_bw_oncc; |
Array<float> eq1_bw_oncc; Array<float> eq2_bw_oncc; Array<float> eq3_bw_oncc; |
390 |
float eq1_gain; float eq2_gain; float eq3_gain; |
float eq1_gain; float eq2_gain; float eq3_gain; |
391 |
std::vector<float> eq1_gain_oncc; std::vector<float> eq2_gain_oncc; std::vector<float> eq3_gain_oncc; |
Array<float> eq1_gain_oncc; Array<float> eq2_gain_oncc; Array<float> eq3_gain_oncc; |
392 |
float eq1_vel2gain; float eq2_vel2gain; float eq3_vel2gain; |
float eq1_vel2gain; float eq2_vel2gain; float eq3_vel2gain; |
393 |
|
|
394 |
//Deprecated (from version 1) |
//Deprecated (from version 1) |