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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_TracktionEngineNode.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
20{
23
26
28 ProcessState (tracktion::graph::PlayHeadState&, const tempo::Sequence&);
29
31 enum class UpdateContinuityFlags { no, yes };
32
41 void update (double sampleRate, juce::Range<int64_t> referenceSampleRange, UpdateContinuityFlags);
42
46 void setPlaybackSpeedRatio (double newRatio);
47
49 void setTempoSequence (const tempo::Sequence*);
50
52 const tempo::Sequence* getTempoSequence() const;
53
56
65 SyncRange getSyncRange() const;
66
70 SyncPoint getSyncPoint() const;
71
76
78 void setSyncRange (SyncRange);
79
81 double sampleRate = 44100.0, playbackSpeedRatio = 1.0;
82 int numSamples = 0;
83 juce::Range<int64_t> referenceSampleRange, timelineSampleRange;
84 TimeRange editTimeRange;
85 BeatRange editBeatRange;
86
87private:
88 const tempo::Sequence* tempoSequence = nullptr;
90 crill::seqlock_object<SyncRange> syncRange { SyncRange() };
91};
92
93
94//==============================================================================
95//==============================================================================
100{
101public:
102 //==============================================================================
105
107 virtual ~TracktionEngineNode() = default;
108
109 //==============================================================================
111 int getNumSamples() const { return processState->numSamples; }
112
114 double getSampleRate() const { return processState->sampleRate; }
115
117 juce::Range<int64_t> getTimelineSampleRange() const { return processState->timelineSampleRange; }
118
120 TimeRange getEditTimeRange() const { return processState->editTimeRange; }
121
123 BeatRange getEditBeatRange() const { return processState->editBeatRange; }
124
126 juce::Range<int64_t> getReferenceSampleRange() const { return processState->referenceSampleRange; }
127
129 tempo::Key getKey() const;
130
132 double getPlaybackSpeedRatio() const;
133
134 //==============================================================================
137
140
141 //==============================================================================
143 tracktion::graph::PlayHeadState& getPlayHeadState() { return processState->playHeadState; }
144
147
149 ProcessState& getProcessState() { return *processState; }
150
151 //==============================================================================
153 void setProcessState (ProcessState&);
154
155private:
156 //==============================================================================
157 ProcessState* processState; // Must never be nullptr
158};
159
160
161//==============================================================================
162//==============================================================================
164{
165public:
167 virtual ~DynamicallyOffsettableNodeBase() = default;
168
173
178};
179
180
181}} // namespace tracktion { inline namespace engine
virtual void setDynamicOffsetBeats(BeatDuration)
Sets an offset to be applied to all times in this node, effectively shifting it forwards or backwards...
virtual void setDynamicOffsetTime(TimeDuration)
Sets an offset to be applied to all times in this node, effectively shifting it forwards or backwards...
Holds a list of TempoSetting objects, to form a sequence of tempo changes.
Base class for Nodes that provides information about the current process call.
int getNumSamples() const
Returns the number of samples in the current process block.
virtual ~TracktionEngineNode()=default
Destructor.
std::optional< TimePosition > getTimeOfNextChange() const
May return the time of the next tempo or time sig change.
TimeRange getEditTimeRange() const
Returns the edit time range of the current process block.
ProcessState & getProcessState()
Returns the ProcessState in use.
double getPlaybackSpeedRatio() const
Returns the playback speed ratio of the current process block.
BeatRange getEditBeatRange() const
Returns the edit beat range of the current process block.
tempo::Key getKey() const
Returns the key of the current process block.
juce::Range< int64_t > getTimelineSampleRange() const
Returns the timeline sample range of the current process block.
juce::Range< int64_t > getReferenceSampleRange() const
Returns the reference sample range (from the DeviceManager) of the current process block.
double getSampleRate() const
Returns the sample rate of the current process block.
std::optional< BeatPosition > getBeatOfNextChange() const
May return the time of the next tempo or time sig change.
tracktion::graph::PlayHeadState & getPlayHeadState()
Returns the PlayHeadState in use.
tracktion::graph::PlayHead & getPlayHead()
Returns the PlayHead in use.
Determines how this block releates to other previous render blocks and if the play head has jumped in...
Converts a monotonically increasing reference range in to a timeline range.
Holds a reference sample position and the Edit time and beat that it corresponds to.
Represents a duration in beats.
Represents a duration in real-life time.
A Sequence::Position is an iterator through a Sequence.
Holds the state of a process call.
const tempo::Sequence::Position * getTempoSequencePosition() const
Returns the tempo::Sequence::Position this state uses.
void update(double sampleRate, juce::Range< int64_t > referenceSampleRange, UpdateContinuityFlags)
Updates the internal state based on a reference sample range.
std::function< void()> onContinuityUpdated
Callback which can be set to be called when the continuity changes.
UpdateContinuityFlags
An enum to indicate if the PlayHeadState continuity should be updated.
SyncPoint getSyncPoint() const
Returns the end of the SyncRange.
SyncRange getSyncRange() const
Returns the SyncRange for the current audio block.
void setPlaybackSpeedRatio(double newRatio)
Sets a playback speed ratio.
const tempo::Sequence * getTempoSequence() const
Returns the tempo::Sequence this state has been initialised with one.
void setTempoSequence(const tempo::Sequence *)
Sets the TempoSequence this state utilises.