exitnow

exitnow — Exit Csound as fast as possible, with no cleaning up.

Description

In Csound4 calls an exit function to leave Csound as fast as possible. On Csound5 and later it exits back to the driving code.

Syntax

exitnow [ivalue]

Initialisation

Stops Csound on the initialisation cycle, returning the result ivalue, which defaults to zero. Note that it is usual for this opcode to be alone in an instrument.

Examples

Here is an example of the exitnow opcode. Play exitnow.csd

Example 275. Example of the exitnow 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
-odac     ;;;realtime audio out
; For Non-realtime ouput leave only the line below:
; -o exitnow.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

; plays a sine wav, forces a stop after 2 seconds
instr 1
	; generate a line from 0 to 1 over 2 seconds
	kStop line 0, 2, 1

	; launch instrument 2 once kStop signal is greater than 1
	if(kStop>=1) then
		schedulek 2, 0, 1
	endif

	; print kStop signal every .1 seconds
	printk .1, kStop

	; make some noise
	aSig oscil 1, 440
	outs aSig, aSig
endin

; forces an instant exit of csound
instr 2
	exitnow
endin

</CsInstruments>
<CsScore>
; play oscil instrument infinitely
i 1 0 z
</CsScore>
</CsoundSynthesizer>