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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_SpeedRampWaveNode.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//==============================================================================
19{
20 TimeRange inTimeRange, outTimeRange;
21 AudioFadeCurve::Type fadeInType, fadeOutType;
22
23 bool isEmpty() const
24 {
25 return inTimeRange.isEmpty() && outTimeRange.isEmpty();
26 }
27};
28
29
30//==============================================================================
31//==============================================================================
35{
36public:
46 TimeRange editTime,
47 TimeDuration offset,
48 TimeRange loopSection,
50 double speedRatio,
51 const juce::AudioChannelSet& sourceChannelsToUse,
52 const juce::AudioChannelSet& destChannelsToFill,
55 bool isOfflineRender,
57
58 //==============================================================================
61 bool isReadyToProcess() override;
62 void process (ProcessContext&) override;
63
64private:
65 //==============================================================================
66 TimeRange editPosition, loopSection;
67 TimeDuration offset;
68 double originalSpeedRatio = 0, outputSampleRate = 44100.0;
69 const EditItemID editItemID;
70 bool isOfflineRender = false;
71 const SpeedFadeDescription speedFadeDescription;
72
73 AudioFile audioFile;
74 LiveClipLevel clipLevel;
75 juce::Range<int64_t> editPositionInSamples;
76 double audioFileSampleRate = 0;
77 const juce::AudioChannelSet channelsToUse, destChannels;
79
80 struct PerChannelState;
82 bool playedLastBlock = false;
83
84 //==============================================================================
85 int64_t editTimeToFileSample (TimePosition) const noexcept;
86 bool updateFileSampleRate();
87 void processSection (ProcessContext&, juce::Range<int64_t> timelineRange);
88
89 //==============================================================================
90 static double rescale (AudioFadeCurve::Type, double proportion, bool rampUp);
91};
92
93}} // namespace tracktion { inline namespace engine
94
95#ifndef DOXYGEN
96template<>
97struct std::hash<tracktion::engine::SpeedFadeDescription>
98{
99 size_t operator() (const tracktion::engine::SpeedFadeDescription& d) const noexcept
100 {
101 size_t seed = 0;
102 tracktion::hash_combine (seed, d.inTimeRange);
103 tracktion::hash_combine (seed, d.outTimeRange);
104 tracktion::hash_combine (seed, static_cast<int> (d.fadeInType));
105 tracktion::hash_combine (seed, static_cast<int> (d.fadeOutType));
106
107 return seed;
108 }
109};
110#endif
An Node that plays back a wave file.
tracktion::graph::NodeProperties getNodeProperties() override
Should return the properties of the node.
bool isReadyToProcess() override
Should return true when this node is ready to be processed.
void process(ProcessContext &) override
Called when the node is to be processed.
void prepareToPlay(const tracktion::graph::PlaybackInitialisationInfo &) override
Called once before playback begins for each node.
Base class for Nodes that provides information about the current process call.
Main graph Node processor class.
Struct to describe a single iteration of a process call.
T is_pointer_v
T operator()(T... args)
typedef int64_t
Represents a duration in real-life time.
Represents a position in real-life time.
Type
A enumeration of the curve classes available.
ID for objects of type EditElement - e.g.
Provides a thread-safe way to share a clip's levels with an audio engine without worrying about the C...
Holds the state of a process call.
Describes the time and type of the speed fade in/outs.
Holds some really basic properties of a node.
Passed into Nodes when they are being initialised, to give them useful contextual information that th...