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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_EditClip.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
11namespace tracktion { inline namespace engine
12{
13
14//==============================================================================
19class EditClip : public AudioClipBase,
20 private EditSnapshot::Listener
21{
22public:
23 //==============================================================================
25 ~EditClip() override;
26
28
33 AudioFileInfo getWaveInfo() override { return waveInfo; }
34
36 EditSnapshot::Ptr getEditSnapshot() noexcept { return editSnapshot; }
37
38 AudioFile getAudioFile() const override;
39
40 //==============================================================================
41 void initialise() override;
42 void cloneFrom (Clip*) override;
43
44 bool isMidi() const override { return false; }
45 bool canHaveEffects() const override { return false; }
46
47 double getCurrentStretchRatio() const;
48
49 //==============================================================================
51
52 juce::File getOriginalFile() const override;
53 HashCode getHash() const override { return hash; }
54
55 void setLoopDefaults() override;
56
57 void setTracksToRender (const juce::Array<EditItemID>& trackIDs);
58
59 //==============================================================================
60 bool needsRender() const override;
61 RenderManager::Job::Ptr getRenderJob (const AudioFile& destFile) override;
62 void renderComplete() override;
65
66 //==============================================================================
67 TimeDuration getSourceLength() const override { return editSnapshot == nullptr ? 0_td : editSnapshot->getLength(); }
68 bool usesSourceFile() const override { return false; }
69 void sourceMediaChanged() override;
70 void changed() override;
71
72 bool isUsingFile (const AudioFile& af) override;
73
74 RenderOptions& getRenderOptions() const noexcept { jassert (renderOptions != nullptr); return *renderOptions; }
75
76 ProjectItem::Ptr createUniqueCopy();
77 HashCode generateHash();
78
79 juce::CachedValue<bool> copyColourFromMarker, trimToMarker, renderEnabled;
80
81protected:
82 void valueTreePropertyChanged (juce::ValueTree&, const juce::Identifier&) override;
83
84private:
85 //==============================================================================
86 AsyncCaller sourceIdUpdater;
87
88 //==============================================================================
89 ProjectItemID lastSourceId;
90 EditSnapshot::Ptr editSnapshot;
92
93 AudioFileInfo waveInfo;
94 HashCode hash = 0;
96 bool sourceMediaReEntrancyCheck = false;
97
98 //==============================================================================
99 void updateWaveInfo();
100 void updateReferencedEdits();
101 void updateLoopInfoBasedOnSource (bool updateLength);
102
103 void editChanged (EditSnapshot&) override;
104
105 //==============================================================================
107};
108
109}} // namespace tracktion { inline namespace engine
Base class for Clips that produce some kind of audio e.g.
Base class for items that can contain clips.
A clip in an edit.
This is the main source of an Edit clip and is responsible for managing its properties.
bool canHaveEffects() const override
Returns true if this clip can have ClipEffects added to it.
void sourceMediaChanged() override
Called when the source media file reference (attribute "source") has changed - i.e.
AudioFileInfo getWaveInfo() override
Returns the AudioFileInfo for an edit clip.
bool usesSourceFile() const override
True if it references a source file - i.e.
bool isMidi() const override
Returns true if this is a MidiClip.
juce::String getRenderMessage() override
Override this to return a custom message to be displayed over waveforms during rendering.
TimeDuration getSourceLength() const override
Must return the length in seconds of the source material e.g.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
void initialise() override
Initialises the Clip.
bool needsRender() const override
Subclasses should override this to return true if they need the rest of the render callbacks.
RenderManager::Job::Ptr getRenderJob(const AudioFile &destFile) override
Subclasses should override this to return a RenderJob suitable for rendering its source file.
void renderComplete() override
Callback to indicate that the render has completed.
void cloneFrom(Clip *) override
Clones the given clip to this clip.
juce::String getClipMessage() override
Override this to return a custom message to display over the clip where the "file missing" text usual...
void changed() override
This should be called to send a change notification to any SelectableListeners that are registered wi...
EditSnapshot::Ptr getEditSnapshot() noexcept
Returns the cached EditSnapshot that represents the current state of the source.
void setLoopDefaults() override
Override this to fill in the LoopInfo structure as best fits the source.
AudioFile getAudioFile() const override
Returns the file used to play back the source and will get proxied etc.
juce::File getOriginalFile() const override
Must return the file that the source ProjectItemID refers to.
bool isUsingFile(const AudioFile &af) override
Should return true if the clip is referencing the file in any way.
HashCode getHash() const override
Must return a unique hash for this clip's source.
Holds a snapshot of an Edit file of the last time it was saved.
An ID representing one of the items in a Project.
Represents a set of user properties used to control a render operation, using a ValueTree to hold the...
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Represents a duration in real-life time.
Asyncronously call a function.
ID for objects of type EditElement - e.g.