Skip to content

Commit

Permalink
Automatically start audio updates even when no hardware has update re…
Browse files Browse the repository at this point in the history
…sponsibility
  • Loading branch information
PaulStoffregen committed Aug 24, 2022
1 parent 4e35529 commit 503cd9f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion teensy3/AudioStream.cpp
Expand Up @@ -81,8 +81,17 @@ void AudioStream::initialize_memory(audio_block_t *data, unsigned int num)
for (i=0; i < num; i++) {
data[i].memory_pool_index = i;
}
if (update_scheduled == false) {
// if no hardware I/O has taken responsibility for update,
// start a timer which will call update_all() at the correct rate
IntervalTimer *timer = new IntervalTimer();
if (timer) {
float usec = 1e6 * AUDIO_BLOCK_SAMPLES / AUDIO_SAMPLE_RATE_EXACT;
timer->begin(update_all, usec);
update_setup();
}
}
__enable_irq();

}

// Allocate 1 audio data block. If successful
Expand Down
11 changes: 10 additions & 1 deletion teensy4/AudioStream.cpp
Expand Up @@ -73,8 +73,17 @@ FLASHMEM void AudioStream::initialize_memory(audio_block_t *data, unsigned int n
for (i=0; i < num; i++) {
data[i].memory_pool_index = i;
}
if (update_scheduled == false) {
// if no hardware I/O has taken responsibility for update,
// start a timer which will call update_all() at the correct rate
IntervalTimer *timer = new IntervalTimer();
if (timer) {
float usec = 1e6 * AUDIO_BLOCK_SAMPLES / AUDIO_SAMPLE_RATE_EXACT;
timer->begin(update_all, usec);
update_setup();
}
}
__enable_irq();

}

// Allocate 1 audio data block. If successful
Expand Down

0 comments on commit 503cd9f

Please sign in to comment.