diff options
author | Roland Reichwein <mail@reichwein.it> | 2025-01-04 17:51:59 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2025-01-04 17:51:59 +0100 |
commit | 2e793141e5434043205763c70d3a597cf2d78eeb (patch) | |
tree | 8b6a14273fcc98ff7bf118cf63574257a637547f /ClockClick.cpp | |
parent | 624a69994d89c71b1ce59dd3b2117a235400be2f (diff) |
Separate clocks
Diffstat (limited to 'ClockClick.cpp')
-rw-r--r-- | ClockClick.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ClockClick.cpp b/ClockClick.cpp new file mode 100644 index 0000000..c9f6938 --- /dev/null +++ b/ClockClick.cpp @@ -0,0 +1,22 @@ +#include "ClockClick.h" + +ClockClick::ClockClick(): m_divider(24), m_count{}, m_detect(24) +{ + m_detect.signal_bpm.connect([&](int bpm){signal_bpm(bpm);}); +} + +// slots +void ClockClick::receive_clock() +{ + m_detect.receive_event(); + + // guard by divider + ++m_count; + if (m_count < m_divider) { + return; + } else { + m_count = 0; + } + + signal_click(); +} |