igoto

igoto — Transfère le contrôle lors de la phase d'initialisation.

Description

Transfère le contrôle sans condition vers l'instruction étiquetée par label, lors de la phase d'initialisation seulement.

Syntaxe

igoto label

label se trouve dans le même bloc d'instrument et n'est pas une expression.

Exemples

Voici un exemple de l'opcode igoto. Il utilise le fichier igoto.csd.

Exemple 369. Exemple de l'opcode igoto.

Voir les sections Audio en Temps Réel et Options de la Ligne de Commande pour plus d'information sur l'utilisation des options de la ligne de commande.

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

; 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.
  if (iparam == 1) igoto 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


</CsInstruments>
<CsScore>

; 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


</CsScore>
</CsoundSynthesizer>


Sa sortie contiendra des lignes comme celles-ci :

instr 1:  iparam = 0.000
instr 1:  ifreq = 440.000
instr 1:  iparam = 1.000
instr 1:  ifreq = 880.000

Voir aussi

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

Crédits

Exemple écrit par Kevin Conder.