#include "InternalClick.h" #include "log.h" #include "debug.h" #include InternalClick::InternalClick(Config& config): m_config{config}, m_timestamp{clock_type::now()} { } void InternalClick::run_cyclic_50ms() { std::chrono::time_point now = clock_type::now(); std::chrono::duration duration{60.0 / static_cast(m_config.get_bpm())}; if (now - m_timestamp > duration) { std::chrono::duration offset = now - m_timestamp - duration; m_timestamp = now - std::chrono::duration_cast(offset); signal_click(offset); debug_cout << fmt::format("offset={}", offset.count()) << std::endl; } }