diff options
author | Roland Reichwein <mail@reichwein.it> | 2025-01-04 17:51:59 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2025-01-04 17:51:59 +0100 |
commit | 2e793141e5434043205763c70d3a597cf2d78eeb (patch) | |
tree | 8b6a14273fcc98ff7bf118cf63574257a637547f /Click.h | |
parent | 624a69994d89c71b1ce59dd3b2117a235400be2f (diff) |
Separate clocks
Diffstat (limited to 'Click.h')
-rw-r--r-- | Click.h | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/Click.h b/Click.h deleted file mode 100644 index 6d3d871..0000000 --- a/Click.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include <boost/signals2.hpp> - -#include "config.h" -#include "BPMDetect.h" - -// Internally generated -// Configured via: BPM -class InternalClick -{ -public: - InternalClick(Config& config): m_config(config){} - -private: - Config& m_config; -}; - -// Generated from MIDI notes -// Configured via channel and note to listen to -class NoteClick -{ -public: - // signals - boost::signals2::signal<void()> signal_click; - boost::signals2::signal<void(int)> signal_bpm; - - NoteClick(Config& config): - m_channel(config.get_midi_channel()), - m_note(config.get_midi_note()), - m_detect(1) - { - m_detect.signal_bpm.connect([&](int bpm){signal_bpm(bpm);}); - } - - // slots - void receive_note(int channel, int note, uint64_t timestamp) - { - (void) timestamp; - - if (true || (channel == m_channel && note == m_note)) { - signal_click(); - m_detect.receive_event(); - } - } - -private: - int m_channel; - int m_note; - - BPMDetect m_detect; -}; - -// Generated from MIDI Clock -class ClockClick -{ -public: - ClockClick(): m_detect(24) - { - m_detect.signal_bpm.connect([&](int bpm){signal_bpm(bpm);}); - } - - // signals - boost::signals2::signal<void(int)> signal_bpm; - - // slots - void receive_clock() - { - m_detect.receive_event(); - } - -private: - BPMDetect m_detect; -}; - |