From 6bb2f84c49b629b9ef82d9fda27bdee77d7c819c Mon Sep 17 00:00:00 2001 From: Sivery <50551841+siveryt@users.noreply.github.com> Date: Sun, 26 May 2024 15:16:29 +0200 Subject: [PATCH] Fixed that the BPM don't get higher with the BPMeasure --- Toolbox/Functions/Metronome.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Toolbox/Functions/Metronome.swift b/Toolbox/Functions/Metronome.swift index 0734dc3..1fad6b9 100644 --- a/Toolbox/Functions/Metronome.swift +++ b/Toolbox/Functions/Metronome.swift @@ -128,7 +128,7 @@ struct Metronome: View { } private func setupTimer() { - let interval = 60.0 / bpm + let interval = 60.0 / (bpm * bpmeasure) timer = Timer.scheduledTimer(withTimeInterval: interval / 100, repeats: true) { _ in self.updateProgress() } @@ -136,11 +136,11 @@ struct Metronome: View { private func updateProgress() { progress += 0.01 - distributeProgress() if progress >= bpmeasure { progress = 0 progressFrom = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] } + distributeProgress() if progress.truncatingRemainder(dividingBy: 1) < 0.01 { playClickSound() }