tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_LaunchHandle.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11#pragma once
12
13namespace tracktion { inline namespace engine
14{
15
16//==============================================================================
17//==============================================================================
26{
27public:
28 //==============================================================================
29 enum class PlayState
30 {
31 stopped,
32 playing
33 };
34
35 enum class QueueState
36 {
37 stopQueued,
38 playQueued
39 };
40
41 //==============================================================================
43 LaunchHandle() = default;
44
46 PlayState getPlayingStatus() const;
47
50
53
56
59
60 //==============================================================================
63 {
64 bool playing1 = false, playing2 = false;
65 BeatRange range1, range2;
66
67 bool isSplit = false;
68 std::optional<BeatPosition> playStartTime1, playStartTime2;
69 };
70
79
80 //==============================================================================
85
90
92 std::optional<BeatRange> getLastPlayedRange() const;
93
94private:
95 //==============================================================================
96 struct State
97 {
98 State();
99
100 PlayState status = PlayState::stopped;
101 std::optional<BeatRange> playedRange, lastPlayedRange;
102 std::optional<MonotonicBeatRange> playedMonotonicRange;
103
104 std::optional<QueueState> nextStatus;
105 std::optional<MonotonicBeat> nextEventTime;
106 };
107
109
111
112 State getState() const { return state.load(); }
113 void setState (State s) { state.store (std::move (s)); }
114};
115
116}} // namespace tracktion { inline namespace engine
Wraps a seqlock to allow a thread-safe object with wait-free reads with respect to each other.
A handle used to control the launching of a clip.
std::optional< QueueState > getQueuedStatus() const
Returns the current queue state.
PlayState getPlayingStatus() const
Returns the current playback state.
std::optional< MonotonicBeatRange > getPlayedMonotonicRange() const
Returns the monotonic beat range this has been playing for.
std::optional< BeatRange > getPlayedRange() const
Returns the Edit beat range this has been playing for.
LaunchHandle()=default
Creates a LaunchHandle.
void stop(std::optional< MonotonicBeat >)
Stop playing, optionally at a given beat position.
std::optional< MonotonicBeat > getQueuedEventPosition() const
Returns the current queued event time.
void play(std::optional< MonotonicBeat >)
Start playing, optionally at a given beat position.
SplitStatus advance(const SyncRange &)
Advance the state.
Represents two beat ranges where the play state can be different in each.
T is_pointer_v