Preserve dotted timing on subseqent loops (#1231)

This commit is contained in:
Jeremy Stashewsky 2022-05-14 01:25:05 -07:00 committed by GitHub
parent b72a094421
commit e46af576fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,9 +59,10 @@ static int32_t music_player_worker_thread_callback(void* context) {
float frequency = NOTE_C4 * powf(TWO_POW_TWELTH_ROOT, note_from_a4); float frequency = NOTE_C4 * powf(TWO_POW_TWELTH_ROOT, note_from_a4);
float duration = float duration =
60.0 * osKernelGetTickFreq() * 4 / instance->bpm / note_block->duration; 60.0 * osKernelGetTickFreq() * 4 / instance->bpm / note_block->duration;
while(note_block->dots > 0) { uint32_t dots = note_block->dots;
while(dots > 0) {
duration += duration / 2; duration += duration / 2;
note_block->dots--; dots--;
} }
uint32_t next_tick = furi_hal_get_tick() + duration; uint32_t next_tick = furi_hal_get_tick() + duration;
float volume = instance->volume; float volume = instance->volume;