when-chording {form}* | [Macro] |
Used inside algorithm to insure that forms in its body are evaluated only if the algorithm is currently in the process of generating a chord.
See Also:
algorithm, status?, unless-chordingwhen-ending {form}* | [Macro] |
Used inside algorithm to insure that forms in its body are evaluated only if the algorithm is executing its last event.
See Also:
algorithm, status?, unless-endingwhen-resting {form}* | [Macro] |
Used inside algorithm to insure that forms in its body are evaluated only if the algorithm is currently in the process of resting.
See Also:
algorithm, status?, unless-restingwith-past-values ({var | {(var [length [value*])}+}) {form}*) | [Macro] |
Maintains length number of past values of each var, which may be variables or a slot names. Length defaults to 1. If length is specified, then up tolength number of explicit initial past values may also be supplied. If initial values are not specified they default to nil.
Forms in the body of the macro access previous values using the past-value macro:
past-value (var nth [default])
Returns the nth past value of var, or default if the past value is nil.
Example:
? (algorithm pv midi-note (length 6 rhythm 1 duration 1 amplitude .1) (setf note (between 1 2)) (with-past-values ((note 2 'a4 'b4)) (setf note (+ 60 count)) (format t "~%note=~S note[1]=~S note[2]=~S" note (past-value note 1) (past-value note 2)))) #<ALGORITHM: Pv> (run-object #!pv 0) note=60 note[1]=A4 note[2]=B4 note=61 note[1]=60 note[2]=A4 note=62 note[1]=61 note[2]=60 note=63 note[1]=62 note[2]=61 note=64 note[1]=63 note[2]=62 note=65 note[1]=64 note[2]=63
with-vars-snapshotted ({var}+}){form}*) | [Macro] |
Creates a new variable binding for each var. Use inside loop to allow algorithms to reference unique values of the same loop variable.
Example:
? (merge foo () (loop for i in '(30 40 50) do (with-vars-snapshotted (i) (algorithm nil midi-note (length 20 rhythm 1 duration 1 amplitude .1) (setf note (+ i (random 7))))))) #<Algorithm: Foo>
See Also:
Describing Music Algorithmically