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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_ClipTrack.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
15class ClipTrack : public Track,
16 public ClipOwner
17{
18public:
19 ClipTrack (Edit&, const juce::ValueTree&, bool hasModifierList);
20 ~ClipTrack() override;
21
23
25 void initialise() override;
27 void flushStateToValueTree() override;
28
29 //==============================================================================
30 Clip* findClipForID (EditItemID) const override;
31
32 //==============================================================================
33 CollectionClip* getCollectionClip (int index) const noexcept;
34 CollectionClip* getCollectionClip (Clip*) const;
35 int getNumCollectionClips() const noexcept;
36 int indexOfCollectionClip (CollectionClip*) const;
37 int getIndexOfNextCollectionClipAt (TimePosition);
38 CollectionClip* getNextCollectionClipAt (TimePosition);
39 bool contains (CollectionClip*) const;
40 void addCollectionClip (CollectionClip*);
41 void removeCollectionClip (CollectionClip*);
42
43 //==============================================================================
44 int getNumTrackItems() const override;
45 TrackItem* getTrackItem (int idx) const override;
46 int indexOfTrackItem (TrackItem*) const override;
49
52
53 //==============================================================================
54 TimeDuration getLength() const;
55 TimeDuration getLengthIncludingInputTracks() const;
56 TimeRange getTotalRange() const;
57
58 //==============================================================================
59 bool addClip (const Clip::Ptr&);
60
61 Clip* insertClipWithState (juce::ValueTree);
62
63 Clip* insertClipWithState (const juce::ValueTree& stateToUse,
64 const juce::String& name, TrackItem::Type type,
65 ClipPosition position,
66 bool deleteExistingClips,
67 bool allowSpottingAdjustment);
68
69 Clip* insertNewClip (TrackItem::Type, TimeRange position, SelectionManager* selectionManagerToSelectWith);
70 Clip* insertNewClip (TrackItem::Type, const juce::String& name, TimeRange position, SelectionManager* selectionManagerToSelectWith);
71 Clip* insertNewClip (TrackItem::Type, const juce::String& name, ClipPosition position, SelectionManager* selectionManagerToSelectWith);
72
73 juce::ReferenceCountedObjectPtr<WaveAudioClip> insertWaveClip (const juce::String& name, const juce::File& sourceFile,
74 ClipPosition position, bool deleteExistingClips);
75
77 ClipPosition position, bool deleteExistingClips);
78
79 juce::ReferenceCountedObjectPtr<MidiClip> insertMIDIClip (TimeRange position,
80 SelectionManager* selectionManagerToSelectWith);
81
83 SelectionManager* selectionManagerToSelectWith);
84
85 juce::ReferenceCountedObjectPtr<EditClip> insertEditClip (TimeRange position, ProjectItemID sourceID);
86
87 void deleteRegion (TimeRange, SelectionManager*);
88 void deleteRegionOfClip (Clip::Ptr, TimeRange, SelectionManager*);
89
92
94 void splitAt (TimePosition);
95
98 TimePosition getPreviousTimeOfInterest (TimePosition beforeThisTime);
99
100 bool containsPlugin (const Plugin*) const override;
101 Plugin::Array getAllPlugins() const override;
102 void sendMirrorUpdateToAllPlugins (Plugin&) const override;
103
104 bool areAnyClipsUsingFile (const AudioFile&);
105 bool containsAnyMIDIClips() const;
106
110 EditItemID getClipOwnerID() override;
114 Edit& getClipOwnerEdit() override;
116 void clipCreated (Clip&) override;
118 void clipAddedOrRemoved() override;
120 void clipOrderChanged() override;
122 void clipPositionChanged() override;
123
124protected:
125 friend class Clip;
126
127 juce::Array<TimePosition> findAllTimesOfInterest();
128
129 struct CollectionClipList;
130 friend struct CollectionClipList;
131 std::unique_ptr<CollectionClipList> collectionClipList;
132
133 void refreshTrackItems() const;
134
135 mutable bool trackItemsDirty = false;
136 mutable juce::Array<TrackItem*> trackItems;
137
139};
140
141}} // namespace tracktion { inline namespace engine
Base class for items that can contain clips.
void flushStateToValueTree() override
Flushes all plugin states on the track to the state object.
Clip * findClipForID(EditItemID) const override
Returns a clip one with a matching ID can be found on this Track.
TimePosition getNextTimeOfInterest(TimePosition afterThisTime)
finds the next cut point
TrackItem * getTrackItem(int idx) const override
Should return the TrackItem at the given index.
EditItemID getClipOwnerID() override
Must return the ID of this ClipOwner.
void clipAddedOrRemoved() override
Called when a clip is added or removed.
Edit & getClipOwnerEdit() override
Must return the Edit this ClipOwner belongs to.
void sendMirrorUpdateToAllPlugins(Plugin &) const override
Sends a message to all plugins that the given plugin has changed.
void clipPositionChanged() override
Called when a clip start or end position has changed.
void insertSpaceIntoTrack(TimePosition, TimeDuration) override
inserts space and moves everything up
void initialise() override
Initialises the Track.
int getNumTrackItems() const override
Should return the number of TrackItem[s] on this Track.
Plugin::Array getAllPlugins() const override
Returns all pugins on this Track.
Clip * splitClip(Clip &, TimePosition)
breaks a clip into 2 bits
juce::ValueTree & getClipOwnerState() override
Must return the state of this ClipOwner.
TrackItem * getNextTrackItemAt(TimePosition) override
Should return the TrackItem after this time.
void splitAt(TimePosition)
split all clips at this time
void clipOrderChanged() override
Called when clips have moved times so that their order has changed.
bool containsPlugin(const Plugin *) const override
Tests whether this Track or a clip on it contains the given plugin.
int indexOfTrackItem(TrackItem *) const override
Should return the index of the given TrackItem.
void clipCreated(Clip &) override
Called when a clip is created which could be during Edit load.
int getIndexOfNextTrackItemAt(TimePosition) override
Should return the index of the TrackItem after this time.
Selectable * getClipOwnerSelectable() override
Must return the selectable if this ClipOwner is one.
A clip in an edit.
The Tracktion Edit class!
An ID representing one of the items in a Project.
Base class for things that can be selected, and whose properties can appear in the properties panel.
Manages a list of items that are currently selected.
Base class for EditItems that live in a Track, e.g.
Type
Defines the types of item that can live on Track[s].
Base class for tracks which contain clips and plugins and can be added to Edit[s].
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
MidiClip::Ptr insertMIDIClip(ClipOwner &parent, const juce::String &name, TimeRange position)
Inserts a new MidiClip into the ClipOwner's clip list.
juce::ReferenceCountedObjectPtr< WaveAudioClip > insertWaveClip(ClipOwner &parent, const juce::String &name, const juce::File &sourceFile, ClipPosition position, DeleteExistingClips deleteExistingClips)
Inserts a new WaveAudioClip into the ClipOwner's clip list.
Clip * insertNewClip(ClipOwner &parent, TrackItem::Type type, const juce::String &name, EditTimeRange pos)
Inserts a new clip with the given type and name.
Clip * insertClipWithState(ClipOwner &clipOwner, juce::ValueTree clipState)
Inserts a clip with the given state in to the ClipOwner's clip list.
Represents a duration in real-life time.
Represents a position in real-life time.
Represents the position of a clip on a timeline.
ID for objects of type EditElement - e.g.