Use Non-Frames Version Previous Page Next Page
Instrument Control: Program Flow Control

igoto, tigoto, kgoto, goto, if, timout

           igoto      label
           tigoto     label
           kgoto      label
           goto       label
           if         ia  R  ib  igoto  label
           if         ka  R  kb  kgoto  label
           if         ia  R  ib  goto   label
           timout     istrt, idur, label

Description

where label is in the same instrument block and is not an expression, and where R is one of the Relational operators (<, =, <=, ==, !=) (and = for convenience, see also under Conditional Values).

These statements are used to control the order in which statements in an instrument block are to be executed. i-time and p-time passes can be controlled separately as follows:

igoto – During the i-time pass only, unconditionally transfer control to the statement labeled by label.

tigoto – similar to igoto, but effective only during an i-time pass at which a new note is being 'tied' onto a previously held note (see i Statement); no-op when a tie has not taken place. Allows an instrument to skip initialization of units according to whether a proposed tie was in fact successful (see also tival, delay).

kgoto – During the p-time passes only, unconditionally transfer control to the statement labeled by label.

goto – (combination of igoto and kgoto) Transfer control to label on every pass.

if...igoto – conditional branch at i-time, depending on the truth value of the logical expression ia R ib. The branch is taken only if the result is true.

if...kgoto – conditional branch during p-time, depending on the truth value of the logical expression ka R kb. The branch is taken only if the result is true.

if...goto – combination of the above. Condition tested on every pass. Note that when if tests a k-rate variable, the if test and the goto will be ignored during the i-time pass, even if the k-rate variable has already been assigned an appropriate value by an earlier init statement.

timout – conditional branch during p-time, depending on elapsed note time. istrt and idur specify time in seconds. The branch to label will become effective at time istrt, and will remain so for just idur seconds. Note that timout can be reinitialized for multiple activation within a single note (see example under reinit).

Example

    if k3  p5 + 10 kgoto next

Use Non-Frames Version Previous Page Next Page
Instrument Control: Program Flow Control