mirror of
https://github.com/brunoherbelin/vimix.git
synced 2026-01-06 23:15:27 +01:00
Introducing modes of Metronome synchronicity
This commit is contained in:
13
Metronome.h
13
Metronome.h
@@ -2,7 +2,6 @@
|
||||
#define METRONOME_H
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
|
||||
class Metronome
|
||||
@@ -14,6 +13,12 @@ class Metronome
|
||||
|
||||
public:
|
||||
|
||||
typedef enum {
|
||||
SYNC_NONE = 0,
|
||||
SYNC_BEAT,
|
||||
SYNC_PHASE
|
||||
} Synchronicity;
|
||||
|
||||
static Metronome& manager ()
|
||||
{
|
||||
// The only instance
|
||||
@@ -41,10 +46,14 @@ public:
|
||||
double beats () const;
|
||||
double phase () const;
|
||||
|
||||
// mechanisms to delay execution to next beat of phase
|
||||
// mechanisms to delay execution to next beat
|
||||
std::chrono::microseconds timeToBeat();
|
||||
void executeAtBeat( std::function<void()> f );
|
||||
|
||||
// mechanisms to delay execution to next phase
|
||||
std::chrono::microseconds timeToPhase();
|
||||
void executeAtPhase( std::function<void()> f );
|
||||
|
||||
size_t peers () const;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user