schedkwhennamed

schedkwhennamed — Similar to schedkwhen but uses a named instrument at init-time.

Description

Similar to schedkwhen but uses a named instrument at init-time.

Syntax

schedkwhennamed ktrigger, kmintim, kmaxnum, "name", kwhen, kdur \
      [, ip4] [, ip5] [...]

Initialization

ip4, ip5, ... -- Equivalent to p4, p5, etc., in a score i statement

Performance

ktrigger -- triggers a new score event. If ktrigger is 0, no new event is triggered.

kmintim -- minimum time between generated events, in seconds. If kmintim is less than or equal to 0, no time limit exists.

kmaxnum -- maximum number of simultaneous instances of named instrument allowed. If the number of extant instances of the named instrument is greater than or equal to kmaxnum, no new event is generated. If kmaxnum is less than or equal to 0, it is not used to limit event generation.

"name" -- the named instrument's name.

kwhen -- start time of the new event. Equivalent to p2 in a score i statement. Measured from the time of the triggering event. kwhen must be greater than or equal to 0. If kwhen greater than 0, the instrument will not be initialized until the actual time when it should start performing.

kdur -- duration of event. Equivalent to p3 in a score i statement. If kdur is 0, the instrument will only do an initialization pass, with no performance. If kdur is negative, a held note is initiated. (See ihold and i statement.)

Note: While waiting for events to be triggered by schedkwhennamed, the performance must be kept going, or Csound may quit if no score events are expected. To guarantee continued performance, an f0 statement may be used in the score.

Examples

Here is an example of the schedkwhennamed opcode. It uses the file schedkwhennamed.csd.

Example 416. Example of the schedkwhennamed opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d
; For Non-realtime ouput leave only the line below:
; -o schedkwhennamed.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

  sr	    =  48000
  ksmps	    =  16
  nchnls    =  2
  0dbfs	    =  1

; Example by Jonathan Murphy 2007

  gSinstr2  =  "printer"

    instr 1

  ktrig	    metro     1
if (ktrig == 1) then
  ;Call instrument "printer" once per second
	    schedkwhennamed   ktrig, 0, 1, gSinstr2, 0, 1

endif

    endin

    instr printer

  ktime	    timeinsts
	    printk2   ktime

    endin

</CsInstruments>
<CsScore>
i1 0 10
e
</CsScore>
</CsoundSynthesizer>


See Also

schedkwhen

Credits

Author: Rasmus Ekman
EMS, Stockholm, Sweden

New in Csound version 4.23