Skip to content

Commit 07345ac

Browse files
committed
GeneratorFromArray
1 parent a78f026 commit 07345ac

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/sandbox/streams-genfromarray-serial/streams-genfromarray-serial.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
int channels = 2;
44
int sample_rate = 5000;
55
int16_t array[] = {-16000, 0, 16000, 0 };
6-
int repeat = 1; // 0= endless
7-
GeneratorFromArray<int16_t> generator(array, repeat); // generator from table
6+
int repeat = 10; // 0= endless
7+
GeneratorFromArray<int16_t> generator(array, repeat, false); // generator from table
88
GeneratedSoundStream<int16_t> sound(generator); // Stream
99
CsvStream<int16_t> out(Serial); // Output
1010
StreamCopy copier(out, sound); // copies sound to out
@@ -23,17 +23,17 @@ void setup() {
2323
auto cfgGen = sound.defaultConfig();
2424
cfgGen.channels = channels;
2525
sound.begin(cfgGen); // setup channels
26-
sound.end(); // end to wait for start event in loop
27-
timeout = millis() + 5000;
26+
//timeout = millis() + 1000;
2827
}
2928

3029
void loop() {
3130
copier.copy();
3231

3332
// trigger a singal every 5 seconds
34-
if (millis()>timeout && !sound.isActive()){
35-
sound.begin();
36-
timeout = millis() + 5000;
33+
if (millis()>timeout && !generator.isRunning()){
34+
// reset generator
35+
generator.begin();
36+
timeout = millis() + 1000;
3737

3838
}
3939
}

0 commit comments

Comments
 (0)