summaryrefslogtreecommitdiffhomepage
path: root/Click.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2025-01-03 20:17:26 +0100
committerRoland Reichwein <mail@reichwein.it>2025-01-03 20:17:26 +0100
commit6bf4770e950299da92952f2965cccf86a903fc9f (patch)
tree9854c706f0fc8104f1f85fe0f6ff58b56661a5a6 /Click.h
parent81ef3f08215a62d469c49762ccd492cb806150c4 (diff)
Added config
Diffstat (limited to 'Click.h')
-rw-r--r--Click.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/Click.h b/Click.h
new file mode 100644
index 0000000..0c2d0c7
--- /dev/null
+++ b/Click.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#include <boost/signals2.hpp>
+
+#include "config.h"
+
+// Virtual base class
+// Abstraction of BPM detection / setting
+class Click
+{
+public:
+ Click(){}
+ virtual ~Click(){}
+};
+
+// Internally generated
+// Configured via: BPM
+class InternalClick: public Click
+{
+public:
+ InternalClick(Config& config): m_bpm(config.get_bpm()){}
+ virtual ~InternalClick(){}
+
+private:
+ int m_bpm;
+};
+
+// Generated from MIDI notes
+// Configured via channel and note to listen to
+class NoteClick: public Click
+{
+public:
+ NoteClick(Config& config):
+ m_channel(config.get_midi_channel()),
+ m_note(config.get_midi_note())
+ {
+ }
+
+ virtual ~NoteClick(){}
+
+ boost::signals2::signal<void()> signal_click;
+
+ void receive_note(int channel, int note)
+ {
+ if (true || (channel == m_channel && note == m_note)) {
+ signal_click();
+ }
+ }
+
+private:
+ int m_channel;
+ int m_note;
+};
+
+// Generated from MIDI Clock
+class ClockClick: public Click
+{
+public:
+ ClockClick(){}
+ virtual ~ClockClick(){}
+};
+