// set mute flag for a channel static void ctl_set_mute(u32 ch, bool val) { if(val) { mute[ch] = 1; // send zero to the DSP ctl_param_change(ampParamId[ch], 0); } else { mute[ch] = 0; // send the linear amplitude as a param change to the DSP ctl_param_change(ampParamId[ch], ampLin[ch]); } // update graphics render_chan(ch); }
// increment value io_t inc_param_value(u32 idx, io_t inc) { io_t in; s32 scaled; print_dbg("\r\n inc_param_value, index: "); print_dbg_ulong(idx); print_dbg(" , input: 0x"); print_dbg_hex(get_param_value(idx)); print_dbg(" , increment: 0x"); print_dbg_hex(inc); in = get_param_value(idx); // use scaler to increment and lookup scaled = scaler_inc( &(net->params[idx].scaler), &in, inc); print_dbg(" , new input: 0x"); print_dbg_hex(in); print_dbg(" , scaled: 0x"); print_dbg_hex(scaled); print_dbg("\r\n\r\n "); // store input value in pnode net->params[idx].data.value = in; net->params[idx].data.changed = 1; ctl_param_change(idx, scaled ); return in; }
// SET amplitude for a channel static void ctl_set_amp(u32 ch) { if(mute[ch]) { ;; // already muted, do nothing } else { // send the linear amplitude as a param change to the DSP ctl_param_change(ampParamId[ch], ampLin[ch]); } // update graphics render_chan(ch); }
// set value for param at given idx //-- see also net_set_in_value() // return sign of clamping operation, if clamped void set_param_value(u32 idx, io_t val) { s32 scaled = scaler_get_value( &(net->params[idx].scaler), val); /* print_dbg("\r\n set_param_value, index: "); */ /* print_dbg_ulong(idx); */ /* print_dbg(" , value: 0x"); */ /* print_dbg_hex(val); */ /* print_dbg(" , scaled: 0x"); */ /* print_dbg_hex(scaled); */ // netowrk data holds linear input value net->params[idx].data.value = val; net->params[idx].data.changed = 1; // scale ctl_param_change(idx, scaled ); }
// set the initial state void ctl_init(void) { int i; // set inputs to defaults for(i=0; i<4; i++) { level[i] = maxLevelInput; scale_level(maxLevelInput, &Lin[i], &Db[i]); ctl_set_amp(i); } // set other parameters to fixed values // adc multiplier slew // this integrator value is very fast, but enough to prevent clicks ctl_param_change( eParam_adcSlew0, 0x7fe00000); ctl_param_change( eParam_adcSlew1, 0x7fe00000); ctl_param_change( eParam_adcSlew2, 0x7fe00000); ctl_param_change( eParam_adcSlew3, 0x7fe00000); // cv slew ctl_param_change( eParam_cvSlew0, 0); ctl_param_change( eParam_cvSlew1, 0); ctl_param_change( eParam_cvSlew2, 0); ctl_param_change( eParam_cvSlew3, 0); // cv values ctl_param_change( eParam_cv0, 0); ctl_param_change( eParam_cv1, 0); ctl_param_change( eParam_cv2, 0); ctl_param_change( eParam_cv3, 0); }