317
EFFECT_CHANNEL_ORDER::EFFECT_CHANNEL_ORDER (void)
323
EFFECT_CHANNEL_ORDER* EFFECT_CHANNEL_ORDER::clone(void) const
325
EFFECT_CHANNEL_ORDER *obj =
326
new EFFECT_CHANNEL_ORDER();
327
/* note: obj->sbuf_repp is shared but this is ok */
331
int EFFECT_CHANNEL_ORDER::output_channels(int i_channels) const
333
return out_channels_rep;
336
void EFFECT_CHANNEL_ORDER::parameter_description(int param, struct PARAM_DESCRIPTION *pd) const
338
/* these apply for all params */
339
pd->default_value = 1;
340
pd->description = "channel";
341
pd->bounded_above = false;
342
pd->upper_bound = 0.0f;
343
pd->bounded_below = true;
344
pd->lower_bound = 1.0f;
347
pd->logarithmic = false;
351
void EFFECT_CHANNEL_ORDER::set_parameter(int param, CHAIN_OPERATOR::parameter_t value)
353
int src_ch = static_cast<int>(value);
357
if (dst_ch > static_cast<int>(chsrc_map_rep.size())) {
358
chsrc_map_rep.resize(dst_ch);
361
chsrc_map_rep[dst_ch - 1] = src_ch - 1;
363
/* step: reset highest non-zero channel */
365
for(n = chsrc_map_rep.size() - 1;
367
if (chsrc_map_rep[n] >= 0)
370
out_channels_rep = n + 1;
374
CHAIN_OPERATOR::parameter_t EFFECT_CHANNEL_ORDER::get_parameter(int param) const
377
/* note: we ignore zero-src channel at the end of
378
* chsrc_map_rep to avoid infinite loops in
379
* e.g. ECA_OBJECT_FACTORY */
381
param <= out_channels_rep) {
383
DBC_CHECK(out_channels_rep <= static_cast<int>(chsrc_map_rep.size()));
386
return chsrc_map_rep[param - 1] + 1;
392
std::string EFFECT_CHANNEL_ORDER::parameter_names(void) const
396
while(ch < out_channels_rep) {
397
params += "src-ch-" + kvu_numtostr(ch + 1);
399
if (ch != out_channels_rep)
403
//return param_names_rep;
406
void EFFECT_CHANNEL_ORDER::init(SAMPLE_BUFFER *insample)
408
sbuf_repp = insample;
409
bouncebuf_rep.number_of_channels(sbuf_repp->number_of_channels());
410
bouncebuf_rep.length_in_samples(sbuf_repp->length_in_samples());
412
f_iter.init(&bouncebuf_rep);
413
t_iter.init(insample);
416
void EFFECT_CHANNEL_ORDER::release(void)
421
void EFFECT_CHANNEL_ORDER::process(void)
423
/* step: copy input buffer to a temporary buffer */
424
bouncebuf_rep.copy_all_content(*sbuf_repp);
426
/* step: route channels bouncebuf_rep -> sbuf_repp */
427
for(int dst_ch = 0; dst_ch < out_channels_rep; dst_ch++) {
428
int src_ch = chsrc_map_rep[dst_ch];
430
/* for development use only */
432
std::fprintf(stderr, "%sout#%d <-- in#%d (avail in=%d, out=%d)\n",
433
dst_ch == 0 ? "---\n" : "",
435
bouncebuf_rep.number_of_channels(),
436
sbuf_repp->number_of_channels());
439
if (src_ch >= 0 && src_ch < bouncebuf_rep.number_of_channels()) {
440
f_iter.begin(src_ch);
441
t_iter.begin(dst_ch);
442
while(!f_iter.end() && !t_iter.end()) {
443
*t_iter.current() = *f_iter.current();
449
sbuf_repp->make_silent(dst_ch);
453
/* step: make sure output buf has exactly N channels */
454
sbuf_repp->number_of_channels(out_channels_rep);