ziw isig, indx zkw ksig, kndx zaw asig, kndx ziwm isig, indx[, imix] zkwm ksig, kndx[, kmix] zawm asig, kndx[, kmix]
Write to a location in zk space at either i-rate or k-rate, or a location in za space at a-rate. Writing can be with, or without, mixing.
indx - points to the zk location location to which to write.
isig - initializes the value of the zk location.
kndx - points to the zk or za location to which to write.
ksig - value to be written to the zk location.
asig - value to be written to the za location.
ziw writes isig into the zk variable specified by indx.
zkw writes ksig into the zk variable specified by kndx.
zaw writes asig into the za variable specified by kndx.
These opcodes are fast, and always check that the index is within the range of zk or za space. If not, an error is reported, 0 is returned, and no writing takes place.
ziwm, zkwm, and zawm are mixing opcodes, i.e. they add the signal to the current value of the variable. If no imix is specified, mixing always occurs, but if imix is specified, imix = 0 will cause overwriting, like ziw, zkw, and zaw, and any other value will cause mixing.
Caution: When using the mixing opcodes ziwm, zkwm, and zawm, care must be taken that the variables mixed to, are zeroed at the end (or start) of each k- or a-cycle. Continuing to add signals to them, can cause their values can drift to astronomical figures.
One approach would be to establish certain ranges of zk or za variables to be used for mixing, then use zkcl or zacl to clear those ranges.
instr 1 zkw kzoom, p8 ; p8 in the score line determines where ; in zk space kzoom is written endin instr 2 zkw kzoom, 7 ; always writes kzoom to zk location 7 endin instr 3 kxxx phasor 1 kdest = 40 + kxxx * 16 ; This will write azoom to locations 40 to 55 zaw azoom, kdest ; on a one second scan cycle endin