Difference between parameters and slots? / Csound

Rick Taube hkt@cmp-nxt1.music.uiuc.edu
Tue, 12 Nov 1996 20:15:02 -0600


Here is a cound example of formatting-slots to output the contents of a
slot called 'stuff' as an &rest parameter:

(defobject i2 (csound-note)
  (dur freq stuff))

(defmethod write-event ((object i2 ) (stream csound-score-file))
  (formatting-slots (object (slot-value stream 'stream)  :eol t )
     ins time dur freq &rest stuff)))

; test it out

(algorithm foo i2 (length 10)
  (setf rhythm (between .1 1))
  (setf dur (interpl count 0 .2 9 10))
  (setf freq (item (pitches c4 d ef f g in heap)))
  (setf stuff (list 1 (pick '(a b c) ) (between 10 20))))

Stella [Top-Level]: open test.sco
Stella [Top-Level]: mix foo 0

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

; Common Music output of 12-Nov-96 20:7:57

s
I2 0 0.2 391.995 1 A 16
I2 0.702 1.2 261.625 1 C 16
I2 1.297 2.3 311.126 1 A 14
I2 1.990 3.466 349.228 1 A 16
I2 2.904 4.555 293.664 1 A 14
I2 3.084 5.644 349.228 1 A 14
I2 3.548 6.733 311.126 1 A 12
I2 4.065 7.822 391.995 1 C 16
I2 4.469 8.911 261.625 1 B 13
I2 4.738 10 293.664 1 A 18
e