I just realized it's almost trivial to define a with-sound that
puts each note in a separate thread:


(defmacro with-threaded-sound (args . body)
  `(with-sound-helper (lambda ()
                        (for-each 
                         (lambda (expr)
                           (call-with-new-thread
                            (lambda ()
                              (eval expr (current-module)))))
                         ',body)
                        (let ((us (current-thread)))
                          (for-each 
                           (lambda (expr) 
                             (if (and (not (thread-exited? expr))
                                      (not (eq? expr us)))
                                 (join-thread expr)))
                           (all-threads))))
                      ,@args))

(with-threaded-sound ()
  (fm-violin 0 1 440 .1)
  (fm-violin 0 1 660 .1))


Now to get rid of that "eval"...



_______________________________________________
Cmdist mailing list
[email protected]
http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to