blob: a3c56e09b064bdfb148227ac0505c163039b98a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#pragma once
#include "config.h"
#include <chrono>
#include <deque>
#include <utility>
#include <boost/signals2.hpp>
class UI
{
public:
using clock_type = std::chrono::high_resolution_clock;
UI(Config& config);
void draw();
// signals
boost::signals2::signal<void()> bpm_plus;
boost::signals2::signal<void()> bpm_minus;
boost::signals2::signal<void()> note_set_from_midi;
boost::signals2::signal<void()> mode;
// slots
void count_main_loops();
void slot_active_sensing();
void slot_midi_note(int channel, int note, uint64_t timestamp);
private:
Config& m_config;
int get_main_loops_per_second();
uint64_t m_main_loops;
uint64_t m_main_loops_checkpoint;
std::chrono::time_point<clock_type> m_main_loops_timestamp;
std::chrono::time_point<clock_type> m_active_sensing_timestamp;
uint64_t m_midi_timestamp;
std::deque<std::pair<int,int>> m_midi_monitor;
};
|