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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_TrackCompManager.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//==============================================================================
18{
19public:
22
23 void initialise (const juce::ValueTree&);
24 int getNumGroups() const;
25
26 juce::StringArray getCompNames() const;
27 juce::String getCompName (int index);
28 void setCompName (int index, const juce::String& name);
29
30 int addGroup (const juce::String& name);
31 void removeGroup (int index);
32
33 juce::Array<Track*> getTracksInComp (int index);
34
35 //==============================================================================
37 {
40
42 static CompSection* createAndIncRefCount (const juce::ValueTree& v);
43
44 void updateFrom (juce::ValueTree&, const juce::Identifier&);
45
46 juce::ValueTree state;
47
48 EditItemID getTrack() const { return track; }
49 double getEnd() const { return end; }
50
51 private:
52 EditItemID track;
53 double end = 0.0;
54
55 void updateTrack();
56 void updateEnd();
57
60 };
61
62 //==============================================================================
63 struct TrackComp : public Selectable,
65 public ValueTreeObjectList<CompSection>
66 {
67 enum TimeFormat
68 {
69 seconds = 0,
70 beats
71 };
72
74 ~TrackComp() override;
75
77 static TrackComp* createAndIncRefCount (Edit&, const juce::ValueTree&);
78
80
81 TimeFormat getTimeFormat() const noexcept { return timeFormat; }
82
83 void setTimeFormat (TimeFormat);
84
85 static juce::Array<TimeRange> getMuteTimes (const juce::Array<TimeRange>& nonMuteTimes);
86 juce::Array<TimeRange> getNonMuteTimes (Track&, TimeDuration crossfadeTime) const;
87 TimeRange getTimeRange() const;
88
89 void setName (const juce::String&);
90
91 static EditItemID getSourceTrackID (const juce::ValueTree&);
92 static void setSourceTrackID (juce::ValueTree&, EditItemID, juce::UndoManager*);
93
94 void setSectionTrack (CompSection&, const Track::Ptr&);
95 void removeSection (CompSection&);
96
97 CompSection* moveSectionToEndAt (CompSection*, double newEndTime);
98 CompSection* moveSection (CompSection*, double timeDelta);
99 CompSection* moveSectionEndTime (CompSection*, double newTime);
100
101 int removeSectionsWithinRange (juce::Range<double>, CompSection* sectionToKeep);
102 juce::ValueTree addSection (EditItemID trackID, double endTime, juce::UndoManager*);
103 CompSection* addSection (Track::Ptr, double endTime);
104 CompSection* splitSectionAtTime (double);
105
106 CompSection* findSectionWithEdgeTimeWithin (const Track::Ptr&, juce::Range<double>, bool& startEdge) const;
107 CompSection* findSectionAtTime (const Track::Ptr&, double) const;
108
109 struct Section
110 {
111 CompSection* compSection;
112 juce::Range<double> timeRange;
113 };
114
115 juce::Array<Section> getSectionsForTrack (const Track::Ptr&) const;
116 bool isSuitableType (const juce::ValueTree&) const override;
117 CompSection* createNewObject (const juce::ValueTree&) override;
118 void deleteObject (CompSection*) override;
119 void newObjectAdded (CompSection*) override;
120 void objectRemoved (CompSection*) override;
121 void objectOrderChanged() override;
122 void valueTreePropertyChanged (juce::ValueTree&, const juce::Identifier&) override;
123
124 juce::ValueTree state;
125 Edit& edit;
126
128 juce::CachedValue<juce::Colour> includedColour, excludedColour;
129
130 private:
132
133 CompSection* getCompSectionFor (const juce::ValueTree&);
134 void convertFromSecondsToBeats();
135 void convertFromBeatsToSeconds();
136 void convertTimes (TimeFormat, TimeFormat);
137
139 };
140
141 TrackComp::Ptr getTrackComp (AudioTrack*);
142
143private:
144 struct TrackCompList;
145
146 Edit& edit;
147 juce::ValueTree state;
148 std::unique_ptr<TrackCompList> trackCompList;
149
151};
152
153}} // namespace tracktion { inline namespace engine
154
155namespace juce
156{
157 template <>
158 struct VariantConverter<tracktion::engine::TrackCompManager::TrackComp::TimeFormat>
159 {
160 static tracktion::engine::TrackCompManager::TrackComp::TimeFormat fromVar (const var& v) { return (tracktion::engine::TrackCompManager::TrackComp::TimeFormat) static_cast<int> (v); }
161 static var toVar (tracktion::engine::TrackCompManager::TrackComp::TimeFormat v) { return static_cast<int> (v); }
162 };
163}
The Tracktion Edit class!
Base class for things that can be selected, and whose properties can appear in the properties panel.
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)
#define JUCE_DECLARE_WEAK_REFERENCEABLE(Class)
Represents a duration in real-life time.
ID for objects of type EditElement - e.g.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.