(bind-func cerberus_osc1_cc
(lambda ()
(let ((val 0.0:f)
(osc-octave 0)
(osc-tune 1.0)
(osc-octave-value 1.0))
(lambda (inst offset:i32 cc:i32 value:i32)
;; (println 'cerberus_osc1_cc cc value)
(set! val (/ (i32tof value) 127.0))
(cond ((= cc (+ offset 0)) ;; amplitude of osc 1
(set_osc1_amp inst val))
((= cc (+ offset 1)) ;; waveform of osc 1 (PARAM_SINE,PARAM_SAW,PARAM_PULSE,PARAM_TRI,PARAM_WT)
(set_osc1_wave inst (cerberus_get_waveform value)))
((= cc (+ offset 2)) ;; pulse width (for PARAM_PULSE wave) 0.0-1.0 (0.5 is square)
(set_osc1_pw inst val))
((= cc (+ offset 3)) ;; frequency shift of osc - tuning - 2.0 up
;; tune 0.5 down tune etc..
(set! osc-tune (+ 1.0 (+ -0.15 (* val 0.3))))
(set_osc1_tune inst (* osc-octave-value osc-tune)))
((= cc (+ offset 4))
(set! osc-octave (- (clamp value 61 70) 64))
(set! osc-octave-value (cerberus_octave_from_val val))
(set_osc1_tune inst (* osc-octave-value osc-tune))
void)
((= cc (+ offset 5)) ;; phase (default is 0.0)
(set_osc1_phase inst val)))))))