Hello Folks!
I'm very happy with the Teensy Boards and am currently building a polyphonic synthesizer based on the Teensy 4.0 and the Audio Shield Rev C.
Therefore, I'd like to store some AudioSynthWaveform objects into an Array, so I can easily access them, but apparently this is impossible.
Following Code doesn't work:
Is it somehow possibly to reference these Audio Objects in an Array? (maybe with Pointers, but this doesn't work either as far as i've tried)
If it is needed, I could maybe write a custom class containing the Audio Objects which I can then reference in my code, but I'd like to stay simple there.
Thanks in advance!
I'm very happy with the Teensy Boards and am currently building a polyphonic synthesizer based on the Teensy 4.0 and the Audio Shield Rev C.
Therefore, I'd like to store some AudioSynthWaveform objects into an Array, so I can easily access them, but apparently this is impossible.
Following Code doesn't work:
Code:
#include <Audio.h>
// GUItool: begin automatically generated code
AudioSynthWaveform waveform1; //xy=470.183349609375,212.99998474121094
AudioOutputI2S i2s1; //xy=680.183349609375,211.99998474121094
AudioConnection patchCord1(waveform1, 0, i2s1, 0);
AudioConnection patchCord2(waveform1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=470.183349609375,443.00001525878906
// GUItool: end automatically generated code
AudioSynthWaveform waveforms [1] = {waveform1};
void setup() {
Serial.begin(9600);
AudioMemory(10);
sgtl5000_1.enable();
sgtl5000_1.volume(0.01);
// This here produces Sound
// waveform1.begin(WAVEFORM_TRIANGLE);
// waveform1.frequency(440);
// waveform1.amplitude(0.01);
// This here produces no Sound
waveforms[0].begin(WAVEFORM_TRIANGLE);
waveforms[0].frequency(440);
waveforms[0].amplitude(0.01);
}
void loop() {
}
Is it somehow possibly to reference these Audio Objects in an Array? (maybe with Pointers, but this doesn't work either as far as i've tried)
If it is needed, I could maybe write a custom class containing the Audio Objects which I can then reference in my code, but I'd like to stay simple there.
Thanks in advance!