;; Basic
;;
;; an example of the most basic instrument possible
;; simply plays back a sine wave
;;
(bind-func basic_note
(lambda ()
(lambda (data:NoteData* nargs:i64 dargs:SAMPLE*)
(let ((starttime (note_starttime data)) ;; start time
(frequency (note_frequency data)) ;; you'll probably want the note frequency (in hz)
(amplitude (note_amplitude data)) ;; you'll probably want the note amplitude (0.0-1.0)
(duration (note_duration data)) ;; you'll probably need the duration (in samples)
(osc (osc_mc_c 0.0)))
(lambda (time:i64 chan:i64)
;; you are responsible for stopping a note by setting note_running to #f!
(if (> (- time starttime) duration) (note_active data #f))
(osc chan amplitude frequency))))))