constant Size { value: 1024 }
signal SineTable [Size] { rate: none }
SineTableGenerator ( size: Size ) >> SineTable;
module SineTableGenerator {
input: none
output: Output
propertyName: 'size'
propertyDirection: in
propertyBlock: constant Size { value: 128 } # This forces size to be local to SineTableGenerator (global scope lost)
internalBlock: [
signal Output [Size] {
default: 0.0
rate: none
},
reaction FillTable {
output: Samples
terminateWhen: Stop
internalBlock: [
signal Sample {
default: 0.0
rate: Size
reset: none
},
signal Index {
default: 1
rate: Size
reset: none
},
signal Samples [Size] {
default: 0.0
rate: none
reset: none
},
switch Stop { default: off reset: none }
]
streams: [
Oscillator ( type: 'Sine' frequency: 1.0 ) >> Sample >> Samples [Index];
Index + 1 >> Index >> Compare ( value: Size operator: 'Greater' ) >> Stop;
]
}
]
streams: FillTable () >> Output;
}