diff options
author | Roland Reichwein <mail@reichwein.it> | 2025-01-04 13:48:34 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2025-01-04 13:48:34 +0100 |
commit | 39ec820c931b07bc0cec98add36f106a5965e137 (patch) | |
tree | d1f2f0feb07ff325f363e767181ffaeeab94e20b /BPMDetect.h | |
parent | b2c35cdf69a9084806ac7930cf4475980d596cf6 (diff) |
BPM detect
Diffstat (limited to 'BPMDetect.h')
-rw-r--r-- | BPMDetect.h | 27 |
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; +}; + |