cigoto

Name

cigoto --  Conditionally transfer control during the i-time pass.

Description

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

Syntax

cigoto condition, label

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).

Examples

Here is an example of the cigoto opcode. It uses the files cigoto.orc and cigoto.sco.

Example 15-1. Example of the cigoto opcode.

/* cigoto.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  ; Get the value of the 4th p-field from the score.
  iparam = p4

  ; If iparam is 1 then play the high note.
  ; If not then play the low note.
  cigoto (iparam ==1), highnote
    igoto lownote

highnote:
  ifreq = 880
  goto playit

lownote:
  ifreq = 440
  goto playit

playit:
  ; Print the values of iparam and ifreq.
  print iparam
  print ifreq

  a1 oscil 10000, ifreq, 1
  out a1
endin
/* cigoto.orc */
        
/* cigoto.sco */
; Table #1: a simple sine wave.
f 1 0 32768 10 1

; p4: 1 = high note, anything else = low note
; Play Instrument #1 for one second, a low note.
i 1 0 1 0
; Play a Instrument #1 for one second, a high note.
i 1 1 1 1
e
/* cigoto.sco */
        
Its output should include lines like:
instr 1:  iparam = 0.000
instr 1:  ifreq = 440.000
instr 1:  iparam = 1.000
instr 1:  ifreq = 880.000
      

See Also

cggoto, ckgoto, cngoto, goto, if, kgoto, rigoto, tigoto, timout

Credits

Added a note by Jim Aikin.

Example written by Kevin Conder.