Previous topic

Propagating Rates: streamRate

Next topic

Oscillators and Generator Modules

This Page

Control with Presets

# Constant bundle declaration
constant Preset [8] {
        value:  [ 'Sine', 440.0. 0.5, 'Saw', 330.0, 0.25 ]
        meta:   'A constant bundle'
}

# Constant bundle shorthand declaration
[ 'Sine', 440.0, 0.5, 'Saw', 330.0, 0.25 ] >> Preset;

signal Type             { default: 'Sine' rate: none }
signal Frequency        { default: 110.0 rate: none }
signal Amplitude        { default: 0.1 rate: none }

signal Index            { default: 1 rate: none }

ControlIn[1]
>> OnChange()
>> Map ( minimum: 0.0 maximum: 2.0 )
>> Round ( mode: Floor )
>> Index;

Preset
>> GetPort ( index: [ 1 : 3 ] + Index * 3 )
>> [ Type, Frequency, Amplitude ];

Oscillator (
        type:           Type
        frequency:      Frequency
        amplitude:      Amplitude
)
>> AudioOut[1:2];
Preset
>> GetPort ( index: [ 2 : 3 ] )
>> [ Frequency, Amplitude ];