pesky digits

Rick Taube hkt@zkm.de
Wed, 24 Aug 94 07:17:05 GMT+0100


As of the last release of cm (10-Aug-94) the formatting-slots macro supports  
a :decimals formatting control.  Here is a patched version of rt's  
write-event method that rounds to 3 decimals. This code should be compiled  
before using. There isnt any way to automatically load a patch file in akcl  
that I know of, so you should either: 

1) Replace the write-event method in rt.lisp with the one below, then  
recompile rt.lisp, then quit lisp and rebuild cm to save a new image.
2) Compile as a patch file and load by hand each time you start up cm.
	-hkt

;;;-------------------

(in-package :stella)

(defmethod write-event ((object playnote) (stream rt-file))
  ;; output prefers last= or overlap= values over at=time.
  ;; this complicates things enough so that we dont try to use
  ;; formatting-slots on these values. 

  (let ((file (slot-value stream 'stream))) 

    (write-string "playnote(" file)
    (let ((last (careful-slot-value object 'last))
          (overlap (careful-slot-value object 'overlap)))
      (cond (last
             (when overlap 

               (error "LAST and OVERLAP are mutually exclusive."))
             (format file "last=~S," last))
            (overlap
             (when last
               (error "LAST and OVERLAP are mutually exclusive."))
             (format file "overlap=~S," last))
            (t (format file "at=~S," (slot-value object 'time)))))
    (formatting-slots (object file :postamble ")" :eol t 

                       :prefix (lambda (slot)
		                 (format nil "~(~A~)=" slot))
                       :delimiter #\, :print-if :value)
      (snd :print-if t) (track :print-if t) 

      (gain :decimals 3) (transp :decimals 3) (skip :decimals 3) 

      (dur :decimals 3) (end :decimals 3) (rev :decimals 3)
      (last :decimals 3) (overlap :decimals 3) (pan :decimals 3)
      (amp   :prefix "amp("   :suffix ")"
             :printer rt-envelope-printer)
      (ampl  :prefix "ampl("  :suffix ")"
             :printer rt-envelope-printer)
      (ampr  :prefix "ampr("  :suffix ")"
             :printer rt-envelope-printer)
      (gliss :prefix "gliss(" :suffix ")"
             :printer rt-envelope-printer))))