Declares a complex block or a switch block bundle using the keyword switch
.
#complex block
complex LABEL {
default: [ 0.0, 0.0 ]
rate: AudioRate
reset: MasterReset
meta: none
}
#switch block bundle
complex LABEL [SIZE] {
default: [ 0.0, 0.0 ] | [ [ 0.0, 0.0 ], ... ]
rate: AudioRate
reset: MasterReset
meta: none
}
definition: | the label of the block |
---|
definition: | the size of the block bundle |
---|---|
type: | constant integer port (CIP) |
Table here
DESCRIPTION
A complex signal
constant Real {
value: 1
meta: 'Real part of complex block C'
}
constant Imag {
value: 1
meta: 'Imaginary part of complex block C'
}
complex Complex {
default: [ Real , Imag ]
rate: AudioRate
reset: MasterReset
meta: 'A complex number in Stream'
}
Shorthand declaration of complex signals
# Shorthand notation
complex C {}
# Shorthand setter notation
# C must be declared as a complex block
[ Real, Imag ] >> C;
Real >> SetPort ( index: 1) >> C;
Imag >> SetPort ( index: 2) >> C;
C >> GetPort ( index: 1) >> Real;
C >> GetPort ( index: 2) >> Imag;
# Shorthand getter notation
C >> CxReal () >> Real;
C >> CxImag () >> Imag;
# Properties
C >> CxMagnitude () >> Magnitude;
C >> CxPhase () >> Phase;
Bundled complex signals
# complex bundle
complex ComplexBundle [2] {
default: [[R1,I1], [R2,I2]]
rate: AudioRate
reset: MasterReset
meta: 'Bundle of two complex numbers'
}
ComplexBundle[1] >> CxReal () >> R1;
ComplexBundle[1] >> CxImag () >> I1;
ComplexBundle[2] >> CxReal () >> R2;
ComplexBundle[2] >> CxImag () >> I2;
Arithmetic operations on complex signals:
# Arithmetic Operations
[C1,C2] >> CxAdd () >> C3;
[C1,C2] >> CxMultiply () >> C3;