The Alternative Csound Reference Manual
Previous |  | Next

# xin

xin -- Passes variables from a user-defined opcode block,

## Description

The xin and xout opcodes copy variables to and from the opcode definition, allowing communication with the calling instrument.

The types of input and output variables are defined by the parameters intypes and outtypes.

| Notes

- xin and xout should be called only once, and xin should precede xout, otherwise an init error and deactivation of the current instrument may occur.

- These opcodes actually run only at i-time. Performance time copying is done by the user opcode call. This means that skipping xin or xout with kgoto has no effect, while skipping with igoto affects both init and performance time operation.

## Syntax

xinarg1 [, xinarg2] ... [xinargN] xin

## Performance

xinarg1, xinarg2, ... - input arguments. The number and type of variables must agree with the user-defined opcode's intypes declaration. However, xin does not check for incorrect use of init-time and control-rate variables.

The syntax of a user-defined opcode block is as follows:

opcode name, outtypes, intypes
xinarg1 [, xinarg2] [, xinarg3] ... [xinargN] xin
[setksmps iksmps]
... the rest of the instrument's code.
xout xoutarg1 [, xoutarg2] [, xoutarg3] ... [xoutargN]
endop

The new opcode can then be used with the usual syntax:

[xinarg1] [, xinarg2] ... [xinargN] name [xoutarg1] [, xoutarg2] ... [xoutargN] [, iksmps]

## Examples

See the example for the opcode opcode.

## See Also

endop, opcode, setksmps, xout

## Credits

Author: Istvan Varga, 2002; based on code by Matt J. Ingalls

New in version 4.22

Previous | Home | Next
xadsr | Up | xout