Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
tempo_sync.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <cstdint>
6
7namespace pulp::playback {
8
10class TempoSyncSource;
11
17 public:
18 TempoSyncHostTime() = default;
19
20 private:
21 friend class MasterTransport;
22 friend class TempoSyncSource;
23 TempoSyncHostTime(std::int64_t micros, const TempoSyncSource* source) noexcept
24 : micros_(micros), source_(source) {}
25
26 std::int64_t micros_ = 0;
27 const TempoSyncSource* source_ = nullptr;
28};
29
33 double tempo_bpm = 120.0;
34 double beat = 0.0;
35 bool request_tempo = false;
36 bool request_beat = false;
37 bool request_playing = false;
38 bool playing = false;
39};
40
45 std::int64_t output_host_time_micros = 0;
46 std::uint32_t frame_count = 0;
47 double sample_rate = 0.0;
48 double quantum_beats = 4.0;
50};
51
57 double tempo_bpm = 120.0;
58 double beat_start = 0.0;
59 double beat_end = 0.0;
64 bool is_playing = false;
65};
66
72
82
90
91bool valid_tempo_sync_request(const TempoSyncBlockRequest& request) noexcept;
93bool tempo_sync_add_output_latency(std::int64_t clock_time_micros,
94 std::uint32_t output_latency_frames, double sample_rate,
95 std::int64_t& output_host_time_micros) noexcept;
97 std::int64_t& block_end) noexcept;
100 bool previous_playing) noexcept;
101
107 public:
110
111 virtual ~TempoSyncSource() = default;
112
114 TempoSyncBlockState& state) noexcept = 0;
115
116 protected:
117 TempoSyncHostTime make_host_time(std::int64_t micros) const noexcept {
118 return TempoSyncHostTime{micros, this};
119 }
120};
121
122} // namespace pulp::playback
Master musical transport with one control-thread writer and one audio-thread consumer.
Definition transport.hpp:197
Opaque host-clock timestamp produced by the TempoSyncSource that owns the corresponding clock domain.
Definition tempo_sync.hpp:16
friend class MasterTransport
Definition tempo_sync.hpp:21
friend class TempoSyncSource
Definition tempo_sync.hpp:22
Backend-neutral session-tempo boundary.
Definition tempo_sync.hpp:106
TempoSyncHostTime make_host_time(std::int64_t micros) const noexcept
Definition tempo_sync.hpp:117
static constexpr audio::RtSafetyClass capture_audio_block_rt_safety_class
Definition tempo_sync.hpp:108
virtual ~TempoSyncSource()=default
virtual TempoSyncError capture_audio_block(const TempoSyncBlockRequest &request, TempoSyncBlockState &state) noexcept=0
RtSafetyClass
Definition rt_safety_contract.hpp:11
@ AudioCallbackSafeAfterPrepare
Definition rt_safety_contract.hpp:13
Definition audio_renderer.hpp:20
bool tempo_sync_add_output_latency(std::int64_t clock_time_micros, std::uint32_t output_latency_frames, double sample_rate, std::int64_t &output_host_time_micros) noexcept
@ None
Definition automation_recording.hpp:29
@ InvalidRequest
Definition generated_event_source.hpp:140
bool tempo_sync_block_end_host_time_micros(const TempoSyncBlockRequest &request, std::int64_t &block_end) noexcept
bool valid_tempo_sync_request(const TempoSyncBlockRequest &request) noexcept
TempoSyncPlayingBoundary
Definition tempo_sync.hpp:67
@ InsideBlock
Definition tempo_sync.hpp:69
@ BeforeOrAtBlockStart
Definition tempo_sync.hpp:68
@ AtOrAfterBlockEnd
Definition tempo_sync.hpp:70
TempoSyncError
Definition tempo_sync.hpp:83
@ BackendFailure
Definition tempo_sync.hpp:88
@ Disabled
Definition tempo_sync.hpp:85
@ InvalidState
Definition tempo_sync.hpp:87
bool valid_tempo_sync_state(const TempoSyncBlockState &state) noexcept
TempoSyncPlayingProjection project_tempo_sync_playing(const TempoSyncBlockRequest &request, const TempoSyncBlockState &state, bool previous_playing) noexcept
SequencerStateChannel is the audio-safe transport for a plugin's structured NON-parameter state: the ...
Definition audio_device_manager.hpp:48
Timing information for one audio callback.
Definition tempo_sync.hpp:44
double sample_rate
Definition tempo_sync.hpp:47
TempoSyncCommand command
Definition tempo_sync.hpp:49
double quantum_beats
Definition tempo_sync.hpp:48
std::int64_t output_host_time_micros
Definition tempo_sync.hpp:45
std::uint32_t frame_count
Definition tempo_sync.hpp:46
Captured session mapping at both boundaries of one audio block.
Definition tempo_sync.hpp:56
bool is_playing
Definition tempo_sync.hpp:64
double tempo_bpm
Definition tempo_sync.hpp:57
double beat_end
Definition tempo_sync.hpp:59
std::int64_t is_playing_at_host_time_micros
Host-clock time at which is_playing becomes effective.
Definition tempo_sync.hpp:63
double beat_start
Definition tempo_sync.hpp:58
Backend-independent command bundle applied at the first output sample of an audio block.
Definition tempo_sync.hpp:32
bool request_tempo
Definition tempo_sync.hpp:35
double tempo_bpm
Definition tempo_sync.hpp:33
bool request_beat
Definition tempo_sync.hpp:36
bool request_playing
Definition tempo_sync.hpp:37
double beat
Definition tempo_sync.hpp:34
bool playing
Definition tempo_sync.hpp:38
Block-coherent projection of a timestamped start/stop state.
Definition tempo_sync.hpp:77
bool transition_deferred
Definition tempo_sync.hpp:80
TempoSyncPlayingBoundary boundary
Definition tempo_sync.hpp:78
bool playing_for_block
Definition tempo_sync.hpp:79