sequencer
include
sequencer
backend
clock.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
sequencer/beats_per_minute.hpp
>
4
#include <
sequencer/midi/clock.hpp
>
5
6
#include <future>
7
#include <type_traits>
8
9
namespace
sequencer::backend
10
{
11
class
clock_t
12
{
13
public
:
14
template
<
class
Sender >
15
explicit
clock_t
( Sender sender )
16
: clock_done_{
start_clock_in_thread
(
17
clock_, [sender = std::move( sender )](
auto
message ) { sender( message ); } )}
18
{
19
}
20
21
~clock_t
()
22
{
23
clock_.shut_down();
24
}
25
26
void
start_clock
()
27
{
28
clock_.start();
29
}
30
31
void
stop_clock
()
32
{
33
if
( !clock_.is_running() )
34
{
35
clock_.reset();
36
return
;
37
}
38
39
clock_.stop();
40
}
41
42
void
set_clock_bpm
(
double
value )
43
{
44
clock_.set_tempo(
beats_per_minute
( value ) );
45
}
46
47
private
:
48
decltype(
midi::make_clock
() ) clock_ =
midi::make_clock
();
49
std::future< void > clock_done_;
50
};
51
}
// namespace sequencer::backend
beats_per_minute.hpp
sequencer::backend::clock_t::~clock_t
~clock_t()
Definition:
clock.hpp:21
clock.hpp
sequencer::beats_per_minute
Definition:
beats_per_minute.hpp:8
sequencer::backend::clock_t::start_clock
void start_clock()
Definition:
clock.hpp:26
sequencer::backend
Definition:
clock.hpp:9
sequencer::backend::clock_t::set_clock_bpm
void set_clock_bpm(double value)
Definition:
clock.hpp:42
sequencer::backend::clock_t
Definition:
clock.hpp:11
sequencer::backend::clock_t::stop_clock
void stop_clock()
Definition:
clock.hpp:31
sequencer::backend::clock_t::clock_t
clock_t(Sender sender)
Definition:
clock.hpp:15
sequencer::midi::start_clock_in_thread
auto start_clock_in_thread(MidiClock &midi_clock, const Sender &sender)
Definition:
clock.hpp:123
sequencer::midi::make_clock
auto make_clock()
Definition:
clock.hpp:114
Generated on Thu May 13 2021 16:06:04 for sequencer by
1.8.13