[CM] a with-sound question
Fernando Pablo Lopez-Lezcano
nando@ccrma.Stanford.EDU
14 Jan 2003 12:09:05 -0800
> (defmethod write-ins ((obj src-player-gen))
> (let ((time (ins-time obj))
> (sample-path (get-path (typecase (ins-sample obj)
> (pattern
> (eval (next (ins-sample obj))))
> (t (ins-sample obj)))))
> (rate (get-item (ins-rate obj)))
> (amplitude (get-item (ins-amp obj)))
> (width (get-item (ins-width obj)))
> (skip (get-item (ins-skip obj)))
> (trim (get-item (ins-trim obj))))
> (list 'src-player sample-path time rate amplitude width skip trim)))
You are returning a list from something that should be executing the
code instead. Just remember that whatever you put into with-sound has to
eventually execute a clm instrument call or calls to generate samples.
What (I think) your code does is to return a list and execute nothing,
with-sound does nothing with the side effects (ie: returned values) from
whatever is in its body.
I think that changing it this should work:
> (defmethod write-ins ((obj src-player-gen))
> (let ((time (ins-time obj))
> (sample-path (get-path (typecase (ins-sample obj)
> (pattern
> (eval (next (ins-sample obj))))
> (t (ins-sample obj)))))
> (rate (get-item (ins-rate obj)))
> (amplitude (get-item (ins-amp obj)))
> (width (get-item (ins-width obj)))
> (skip (get-item (ins-skip obj)))
> (trim (get-item (ins-trim obj))))
> (src-player sample-path time rate amplitude width skip trim))
Now you are actually calling the instrument when you execute write-ins
(which could be named "perform-ins" now :-)
Neat code...
-- Fernando