summaryrefslogtreecommitdiffhomepage
path: root/BPMDetect.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2025-01-04 13:48:34 +0100
committerRoland Reichwein <mail@reichwein.it>2025-01-04 13:48:34 +0100
commit39ec820c931b07bc0cec98add36f106a5965e137 (patch)
treed1f2f0feb07ff325f363e767181ffaeeab94e20b /BPMDetect.h
parentb2c35cdf69a9084806ac7930cf4475980d596cf6 (diff)
BPM detect
Diffstat (limited to 'BPMDetect.h')
-rw-r--r--BPMDetect.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/BPMDetect.h b/BPMDetect.h
new file mode 100644
index 0000000..7cd926e
--- /dev/null
+++ b/BPMDetect.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <boost/signals2.hpp>
+
+#include <chrono>
+#include <deque>
+
+class BPMDetect
+{
+public:
+ BPMDetect(int divider);
+ void receive_event();
+
+ // signal
+ boost::signals2::signal<void(int)> signal_bpm;
+
+private:
+ using clock_type = std::chrono::high_resolution_clock;
+ using time_point = std::chrono::time_point<clock_type>;
+
+ const int m_divider;
+
+ int m_count;
+
+ std::deque<time_point> m_timestamps;
+};
+