File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,20 @@ static std::thread metronomeThread;
1616static int metronomeBeat = 0 ;
1717
1818static void bpmTick () {
19- auto interval = std::chrono::milliseconds (1000 );
20- if (sar_metronome.GetBool ()) {
21- auto isBar = metronomeBeat == 0 ;
22- metronomeBeat = (metronomeBeat + 1 ) % sar_metronome_beats.GetInt ();
23- auto sound = isBar ? sar_metronome_sound_bar.GetString () : sar_metronome_sound.GetString ();
24- engine->ExecuteCommand (Utils::ssprintf (" playvol \" %s\" %f" , sound, sar_metronome_volume.GetFloat ()).c_str ());
25- if (sar_metronome_bpm.GetFloat () > 0 ) {
26- interval = std::chrono::milliseconds ((int )(60000 / sar_metronome_bpm.GetFloat ()));
19+ while (true ) {
20+ while (sar_metronome.GetBool ()) {
21+ auto interval = std::chrono::milliseconds (1000 );
22+ auto isBar = metronomeBeat == 0 ;
23+ metronomeBeat = (metronomeBeat + 1 ) % sar_metronome_beats.GetInt ();
24+ auto sound = isBar ? sar_metronome_sound_bar.GetString () : sar_metronome_sound.GetString ();
25+ engine->ExecuteCommand (Utils::ssprintf (" playvol \" %s\" %f" , sound, sar_metronome_volume.GetFloat ()).c_str ());
26+ if (sar_metronome_bpm.GetFloat () > 0 ) {
27+ interval = std::chrono::milliseconds ((int )(60000 / sar_metronome_bpm.GetFloat ()));
28+ }
29+ std::this_thread::sleep_for (interval);
2730 }
31+ std::this_thread::sleep_for (std::chrono::milliseconds (1000 ));
2832 }
29- std::this_thread::sleep_for (interval);
30- bpmTick ();
3133}
3234
3335ON_INIT {
You can’t perform that action at this time.
0 commit comments