;;
;; sets the number of voices for this instrument
;;
(bind-func set_polyphony
(lambda (inst:i8* val:i64)
(stop_running inst) ;; force a stop on all notes before changing poly count
(if (and (> val 0) (< val (+ 1 MAXPOLYPHONY)))
(begin (cset! (cast inst [void]*) poly val i64)
void)
(begin (println "Invalid argument, must be greater than 0 and less than MAXPOLYPHONY")
void))
void))