diff options
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; +}; + |