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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_Clipboard.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
17{
18public:
19 //==============================================================================
20 Clipboard();
21 ~Clipboard();
22
24
25 //==============================================================================
27 {
28 virtual ~ContentType();
29
31 {
34
35 Edit& edit;
36 EditInsertPoint& insertPoint;
37 Track::Ptr startTrack;
38 TimePosition startTime;
39 EditItemID targetClipOwnerID;
40 SelectionManager* selectionManager = nullptr;
41 bool silent = false;
42 FileDragList::PreferredLayout preferredLayout = FileDragList::sameTrack;
43 bool setTransportToEnd = false;
44 };
45
46 virtual bool pasteIntoEdit (Edit&, EditInsertPoint&, SelectionManager*) const;
47 virtual bool pasteIntoEdit (const EditPastingOptions&) const;
48 };
49
50 struct ProjectItems : public ContentType
51 {
53 ~ProjectItems() override;
54
55 using ContentType::pasteIntoEdit;
56 bool pasteIntoEdit (const EditPastingOptions&) const override;
57 bool pasteIntoProject (Project&) const;
58
59 struct ItemInfo
60 {
61 ProjectItemID itemID;
62 TimeRange range;
63 };
64
66 };
67
68 struct Clips : public ContentType
69 {
70 Clips();
71 ~Clips() override;
72
73 bool pasteIntoEdit (Edit&, EditInsertPoint&, SelectionManager*) const override;
74 bool pasteIntoEdit (const EditPastingOptions&) const override;
75
76 bool pasteInsertingAtCursorPos (Edit&, EditInsertPoint&, SelectionManager&) const;
77 bool pasteAfterSelected (Edit&, EditInsertPoint&, SelectionManager&) const;
78
80 {
81 no,
82 yes
83 };
84
85 void addClip (int trackOffset, const juce::ValueTree& state);
86 void addSelectedClips (const SelectableList&, TimeRange, AutomationLocked);
87 void addAutomation (const juce::Array<TrackSection>&, TimeRange);
88
89 struct ClipInfo
90 {
91 juce::ValueTree state;
92 int trackOffset = 0;
93 std::optional<int> slotOffset;
94 bool hasBeatTimes = false;
95 BeatPosition startBeats;
96 BeatDuration lengthBeats;
97 BeatPosition offsetBeats;
98 bool grouped = false;
99 };
100
102
104 {
105 juce::String pluginName, paramID;
106 int trackOffset = 0;
108 juce::Range<float> valueRange;
109 };
110
112 };
113
114 struct Scenes : public ContentType
115 {
116 Scenes();
117 ~Scenes() override;
118
120 {
121 juce::ValueTree state;
123 };
124
126
127 using ContentType::pasteIntoEdit;
128 bool pasteIntoEdit (const EditPastingOptions&) const override;
129 };
130
131 struct Tracks : public ContentType
132 {
133 Tracks();
134 ~Tracks() override;
135
136 using ContentType::pasteIntoEdit;
137 bool pasteIntoEdit (const EditPastingOptions&) const override;
138
140 };
141
142 struct TempoChanges : public ContentType
143 {
144 TempoChanges (const TempoSequence&, TimeRange);
145 ~TempoChanges() override;
146
147 using ContentType::pasteIntoEdit;
148 bool pasteIntoEdit (const EditPastingOptions&) const override;
149
150 bool pasteTempoSequence (TempoSequence&, TimeRange targetRange) const;
151
153 {
154 BeatPosition beat;
155 double bpm;
156 float curve;
157 };
158
160 };
161
163 {
164 AutomationPoints (const AutomationCurve&, TimeRange);
165 ~AutomationPoints() override;
166
167 using ContentType::pasteIntoEdit;
168 bool pasteIntoEdit (const EditPastingOptions&) const override;
169
170 bool pasteAutomationCurve (AutomationCurve&, TimeRange targetRange) const;
171
173 juce::Range<float> valueRange;
174 };
175
176 struct MIDIEvents : public ContentType
177 {
178 MIDIEvents();
179 ~MIDIEvents() override;
180
182 const juce::Array<MidiNote*>& selectedNotes,
183 const juce::Array<MidiControllerEvent*>& selectedEvents,
184 TimePosition cursorPosition, const std::function<BeatPosition (BeatPosition)>& snapBeat,
185 int destController) const;
186
187
188 using ContentType::pasteIntoEdit;
189 bool pasteIntoEdit (const EditPastingOptions&) const override;
190
193
194 private:
195 juce::Array<MidiNote*> pasteNotesIntoClip (MidiClip&, const juce::Array<MidiNote*>& selectedNotes,
196 TimePosition cursorPosition, const std::function<BeatPosition (BeatPosition)>& snapBeat) const;
197
198 juce::Array<MidiControllerEvent*> pasteControllersIntoClip (MidiClip& clip,
199 const juce::Array<MidiNote*>& selectedNotes,
200 const juce::Array<MidiControllerEvent*>& selectedEvents,
201 TimePosition cursorPosition, const std::function<BeatPosition (BeatPosition)>& snapBeat,
202 int destController) const;
203 };
204
205 struct Pitches : public ContentType
206 {
207 Pitches();
208 ~Pitches() override;
209
210 using ContentType::pasteIntoEdit;
211 bool pasteIntoEdit (const EditPastingOptions&) const override;
212
214 };
215
216 struct TimeSigs : public ContentType
217 {
218 TimeSigs();
219 ~TimeSigs() override;
220
221 using ContentType::pasteIntoEdit;
222 bool pasteIntoEdit (const EditPastingOptions&) const override;
223
225 };
226
227 struct Plugins : public ContentType
228 {
229 Plugins (const Plugin::Array&);
230 ~Plugins() override;
231
232 using ContentType::pasteIntoEdit;
233 bool pasteIntoEdit (const EditPastingOptions&) const override;
234
237 };
238
239 struct Takes : public ContentType
240 {
241 Takes (const WaveCompManager&);
242 ~Takes() override;
243
244 bool pasteIntoClip (WaveAudioClip&) const;
245
246 juce::ValueTree items;
247 };
248
249 struct Modifiers : public ContentType
250 {
251 Modifiers();
252 ~Modifiers() override;
253
254 using ContentType::pasteIntoEdit;
255 bool pasteIntoEdit (const EditPastingOptions&) const override;
256
258 };
259
260 //==============================================================================
261 void clear();
262 bool isEmpty() const;
263
264 void setContent (std::unique_ptr<ContentType> newContent);
265 const ContentType* getContent() const;
266
267 template <typename Type, typename... Args>
268 void makeContent (Args&&... args) { setContent (std::unique_ptr<Type> (new Type (std::forward<Args> (args)...))); }
269
270 template <typename Type>
271 const Type* getContentWithType() const { return dynamic_cast<const Type*> (getContent()); }
272
273 template <typename Type>
274 bool hasContentWithType() const { return getContentWithType<Type>() != nullptr; }
275
276 //==============================================================================
277 void addListener (juce::ChangeListener*);
278 void removeListener (juce::ChangeListener*);
279
280private:
282 juce::ChangeBroadcaster broadcaster;
283
285};
286
287AudioTrack* getOrInsertAudioTrackNearestIndex (Edit& edit, int trackIndex);
288
289}} // namespace tracktion { inline namespace engine
An EditInsertPoint is like a "paste location".
The Tracktion Edit class!
An ID representing one of the items in a Project.
Manages a list of items that are currently selected.
Holds a list of TempoSetting objects, to form a sequence of tempo changes.
An audio clip that uses an audio file as its source.
T is_pointer_v
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_DECLARE_SINGLETON(Classname, doNotRecreateAfterDeletion)
Represents a duration in beats.
Represents a position in beats.
Represents a position in real-life time.
ID for objects of type EditElement - e.g.
A list of Selectables, similar to a juce::Array but contains a cached list of the SelectableClasses f...