[CM] clm-3 and cmucl-19a problem

Bill Schottstaedt bil@ccrma.Stanford.EDU
Mon, 24 Jan 2005 03:18:26 -0800


 > i get segfaults everytime i run a particular instrument...

There were several bugs here, but the one causing the segfault
involved the "skip" argument -- if it caused the readin start
location to be too big, mus_make_readin got confused because
of a "cut-and-paste" typo in mus.lisp (mus-location where
I meant mus-channel).

Thanks for the bug report!

I think squelchy needs a couple more checks for the stereo case:

(definstrument squelchy (beg dur file skip squelch)
   (let* ((skipsamp (floor (* (or skip 0) (sound-srate file))))
	 (fdA (open-input file :channel 0 :start skipsamp :verbose t))
	 (two-chans (and (= (sound-chans file) 2) (= (mus-channels *output*) 2)))
	 (fdB (and two-chans (open-input file :channel 1 :start skipsamp :verbose t)))
	 (rdA (make-readin fdA))
	 (rdB (and two-chans (make-readin fdB)))
          (st (floor (* *srate* beg)))
          (nd (+ st (floor (* *srate* dur)))))
     (run
      (loop for i from st below nd do
	   (let ((outvalA (readin rdA))
		 (outvalB (if two-chans (readin rdB) 0.0)))
	     (if (< (* -1 squelch) outvalA squelch)
	       (setf outvalA 0))
	     (if (and two-chans
		      (< (* -1 squelch) outvalB squelch))
	       (setf outvalB 0))
	     (outa i outvalA)
	     (if two-chans (outb i outvalB)))
	   ))
     (close-input fdA)
     (if two-chans (close-input fdB))))