[CM] a with-sound question

cristopher pierson ewing cewing@u.washington.edu
Tue, 14 Jan 2003 13:53:36 -0800 (PST)


Thanks much, Fernando.  I should have figured that out myself, but I've
been staring at this code for too long!

C

********************************
Cris Ewing
CARTAH Assistant
University of Washington
Home Phone: (206) 365-3413
E-mail: cewing@u.washington.edu
*******************************


On 14 Jan 2003, Fernando Pablo Lopez-Lezcano wrote:

> > (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
>
>
>