Declares a constant block or a constant block bundle using the keyword constant
.
# constant block
constant LABEL {
value: none
meta: none
}
# constant block bundle
constant LABEL [SIZE] {
value: none
meta: none
}
definition: | the label of the block |
---|
definition: | the size of the block bundle |
---|---|
type: | constant integer port (CIP) |
# constant block
BasicType >> LABEL;
# constant block bundle
BasicTypeList >> LABEL;
Port | Name | Direction | Type | Connection | Access | Default | Required |
---|---|---|---|---|---|---|---|
1 | output | output | CIP, CRP, CSP (2) | multiple | LABEL >> | none |
no (1) |
assignment | |||||||
2 | value |
input | CIP, CRP, CSP | single | >> LABEL | none |
yes |
property | |||||||
3 | meta |
input | CSP | single | property | none |
no |
1 Warning issued during compilation if the port is left unconnected.
2 The port’s type is the same as value
port’s type.
A constant
block can be assigned one of the basic types. Its value
is assigned during declaration. Its output
port type is the same as its value
port type.
The following code declares a constant
block called ‘SamplingRate’. The value
property is assigned an Integer. The output port type of the block is constant integer.
constant SamplingRate {
value: 2048
meta: 'The sampling rate for analog input.'
}
# Shorthand Declaration
2048 >> SamplingRate;
The following code declares a constant
block called ‘StandardPitch’. The value
property is assigned a Real. The output port type of the block is constant real.
constant StandardPitch {
value: 440.0
meta: 'The musical pitch for all instrument.'
}
# Shorthand Declaration
440.0 >> StandardPitch;
The following code declares a constant
block called ‘OutgoingIP’. The value
property is assigned a String. The output port type of the block is constant string.
constant OutgoingIP {
value: '192.168.1.13'
meta: 'The IP address of the server.'
}
# Shorthand Declaration
'192.168.1.13' >> OutgoingIP;
The following code declares a constant
block bundle called ‘Frequencies’. The value
property is assigned a Real list. The output port type of the block is constant real.
constant Frequencies [2] {
value: [440.0, 880.0]
meta: 'Frequencies of A4 and A5.'
}
# Shorthand Declaration
[440.0, 880.0] >> Frequencies;