[CM] wrapper macro strategies

Bill Schottstaedt bil@ccrma.Stanford.EDU
Fri, 25 Jul 2003 05:30:10 -0700


Bret F Battey wrote:

>(balance-sounds () (mix soundfile1) (mix soundfile2))
>
>But given that defmacro can only take one &body, I'm really not sure on how to pull this off.
>  
>
sound.lisp has several examples -- &body is a list of all the statements 
in the
body of the macro, so you can use ,.body or ,@body to plug them in anywhere.
A very simple example is

(defmacro without-warnings (&body body) `(progn ,.body))

For (balance-processed-sound () (contrast-sound (:fm-index 2) (mix soundfile1))),
I'd save the maxamp (or whatever) of soundfile1, save the output of contrast-sound
via sound-let, get the ratio to match the original, scale the new output, mixing
that into the overall output.  sound-let's can be nested, as can with-sound's.
If you get stuck, send me the actual code you're trying to use.