From e46af576fc35ba848820936d2bafade579441d68 Mon Sep 17 00:00:00 2001 From: Jeremy Stashewsky Date: Sat, 14 May 2022 01:25:05 -0700 Subject: [PATCH] Preserve dotted timing on subseqent loops (#1231) --- applications/music_player/music_player_worker.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/music_player/music_player_worker.c b/applications/music_player/music_player_worker.c index 7a5847c9..f43aa7be 100644 --- a/applications/music_player/music_player_worker.c +++ b/applications/music_player/music_player_worker.c @@ -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 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; - note_block->dots--; + dots--; } uint32_t next_tick = furi_hal_get_tick() + duration; float volume = instance->volume;