activeInstrument Control:Realtime Performance Controlactiveactive
Returns the number of active instances of an instrument.
Description
Returns the number of active instances of an instrument with
options to ignore releasing instances.
Syntaxir active insnum [,iopt [,inorel]]ir active Sinsname [,iopt [,inorel]]kres active kinsnum [,iopt [,inorel]]Initializationinsnum -- number or string name of the instrument to be reported
Sinsname -- instrument name
iopt -- select currently active (zero, default),
or all every active (non zero)
inorel -- if non-zero ignore instruments in
release phase (zero, default), only valid if iopts is zero.
Performancekinsnum -- number or string name of the instrument to be reported
active returns the number of active
instances of instrument number
insnum/kinsnum (or named instrument
Sinsname). As of Csound 4.17 the output is
updated at k-rate (if input arg is k-rate), to allow running
count of instr instances.
As of Csound 5.17 if the instrument number is given as zero then
all instruments are counted.
Examples
Here is a simple example of the active opcode. It uses the file
active.csd.
Simple example of the active opcode.
See the sections Real-time
Audio and Command Line
Flags for more information on using command
line flags.
Its output should include lines like this:
instr 2: icount = 1.000
instr 2: icount = 2.000
Here is a more advanced example of the active opcode. It displays the results of the active opcode at k-rate instead of i-rate. It uses the file active_k.csd.
Example of the active opcode at k-rate.
Its output should include lines like:
i2 1.00000
i2 2.00000
Here is another example of the active opcode, using the number of instances to calculate gain. It uses the file active_scale.csd.
Example of the active opcode at k-rate.See alsoReal-time Performance ControlCreditsAuthor: &namejohn;University of Bath/Codemist Ltd.Bath, UKJuly, 1999Examples written by &namekevin;.New in Csound version 3.57; named instruments added version 5.13Option for all ever active new in 5.13Count of all instruments new in 5.17No release option new in 5.19