From 2e793141e5434043205763c70d3a597cf2d78eeb Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 4 Jan 2025 17:51:59 +0100 Subject: Separate clocks --- ClockClick.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 ClockClick.cpp (limited to 'ClockClick.cpp') 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(); +} -- cgit v1.2.3