11namespace tracktion {
inline namespace engine
27 return item->getSourceFile();
35 for (
auto& i : e->getReferencedItems())
36 if (i.itemID == itemID)
47 const auto time = timeRange.getStart();
48 const auto length = timeRange.getLength();
50 if (doTempoTrackFirst)
53 for (
auto ct : getTracksOfType<ClipTrack> (edit,
true))
56 ct->insertSpaceIntoTrack (
time, length);
59 if (! doTempoTrackFirst)
66 const auto timeToInsertAt = ts.
toTime (beatRange.getStart());
67 auto& tempoAtInsertionPoint = ts.getTempoAt (timeToInsertAt - TimeDuration::fromSeconds (0.0001));
69 const auto lengthInTimeToInsert = TimeDuration::fromSeconds (beatRange.getLength().inBeats() * tempoAtInsertionPoint.getApproxBeatLength().inSeconds());
90 return getTracksOfType<AudioTrack> (edit,
true);
95 return getTracksOfType<ClipTrack> (edit,
true);
107 return findTrackForPredicate (edit, [
id] (
Track& t) {
return t.itemID == id; });
132 return findTrackForPredicate (edit, [&] (
Track& t) {
return t.state == v; });
142 return findTrackForPredicate (edit, [&track] (
Track& t) {
return &track == &t; }) !=
nullptr;
147 if (
auto t =
dynamic_cast<AudioTrack*
> (&track))
148 return &t->getOutput();
151 return t->getOutput();
160 if (
auto first = tracks[0])
164 for (
auto t : allTracks)
165 if (
int index = allTracks.indexOf (t); index >= 0)
179 tracks.
add (allTracks[bit]);
186 auto tracks = items.getItemsOfType<
Track>();
188 if (tracks.isEmpty())
189 for (
auto& i : items.getItemsOfType<
TrackItem>())
190 if (
auto t = i->getTrack())
191 tracks.addIfNotAlreadyThere (t);
193 if (tracks.isEmpty())
194 for (
auto& cs : items.getItemsOfType<
ClipSlot>())
195 tracks.addIfNotAlreadyThere (&cs->track);
200 return t1->getIndexInEditTrackList() < t2->getIndexInEditTrackList();
208 auto clipTracks = items.getItemsOfType<
ClipTrack>();
210 if (clipTracks.isEmpty())
211 for (
auto& clip : items.getItemsOfType<
Clip>())
212 clipTracks.add (clip->getClipTrack());
217 for (
auto& t : clipTracks)
219 auto index = t->getIndexInEditTrackList();
221 if (index < firstIndex)
233 auto n = c.state.createCopy();
234 EditItemID::remapIDs (n,
nullptr, c.edit);
235 auto newClipID = EditItemID::fromID (n);
236 jassert (newClipID != EditItemID::fromID (c.state));
237 jassert (c.edit.clipCache.findItem (newClipID) ==
nullptr);
239 if (
auto t = c.getClipTrack())
241 jassert (! t->state.getChildWithProperty (IDs::id, newClipID).
isValid());
242 t->state.appendChild (n, c.getUndoManager());
244 if (
auto newClip = t->findClipForID (newClipID))
260 if (c->getEditTimeRange().contains (
time))
261 if (
auto ct = c->getClipTrack())
262 if (
auto newClip = ct->splitClip (*c,
time))
263 newClips.add (newClip);
272 if (
auto track = c.getClipTrack())
277 const auto clipTimeRange = c.getEditTimeRange();
279 if (timeRangeToDelete.contains (clipTimeRange))
281 c.removeFromParent();
283 else if (clipTimeRange.getStart() < timeRangeToDelete.getStart() && clipTimeRange.getEnd() > timeRangeToDelete.getEnd())
285 if (
auto newClip = track->splitClip (c, timeRangeToDelete.getStart()))
287 newClip->setStart (timeRangeToDelete.getEnd(),
true,
false);
288 c.setEnd (timeRangeToDelete.getStart(),
true);
293 c.trimAwayOverlap (timeRangeToDelete);
299 CloseGap closeGap,
bool moveAllSubsequentClipsOnTrack)
301 Clip::Array selectedClips;
303 for (
auto c : selectionManager.getItemsOfType<
Clip>())
304 selectedClips.add (c);
307 for (
int j = 0; j < cc->getNumClips(); ++j)
308 selectedClips.add (cc->getClip(j));
310 if (selectedClips.isEmpty())
313 auto& edit = selectedClips[0]->edit;
315 for (
auto c : edit.engine.getUIBehaviour().getAssociatedClipsToEdit (selectedClips).getItemsOfType<
Clip>())
316 selectedClips.addIfNotAlreadyThere (c);
323 for (
auto c : selectedClips)
324 jassert (c->getClipTrack() !=
nullptr);
327 for (
auto c : selectedClips)
328 if (c->getPosition().time.overlaps (rangeToDelete))
329 if (
auto t = c->getClipTrack())
340 for (
auto c : selectedClips)
341 if (c->getPosition().time.overlaps (rangeToDelete))
342 if (
auto t = c->getClipTrack())
343 t->deleteRegionOfClip (c, rangeToDelete, &selectionManager);
347 const auto centreTime = rangeToDelete.getCentre();
349 if (moveAllSubsequentClipsOnTrack)
351 for (
auto& t : tracks)
352 for (
auto c : t->getClips())
353 if (c->getPosition().getStart() > centreTime)
354 c->setStart (c->getPosition().getStart() - rangeToDelete.getLength(),
false,
true);
358 for (
auto c : selectionManager.getItemsOfType<
Clip>())
359 if (c->getPosition().getStart() > centreTime)
360 c->setStart (c->getPosition().getStart() - rangeToDelete.getLength(),
false,
true);
371 jassert (selectionManager !=
nullptr);
373 if (selectionManager !=
nullptr)
375 for (
auto track : selectionManager->getItemsOfType<
Track>())
378 for (
auto t : track->getAllSubTracks (
true))
388 if (tracks.
size() == 0 || rangeToDelete.getLength() <= TimeDuration::fromSeconds (0.0001))
393 if (selectionManager !=
nullptr)
396 selectionManager->deselectAll();
399 Plugin::Array pluginsInRacks;
403 if (r.type !=
nullptr)
404 for (
auto p : r.type->getPlugins())
405 pluginsInRacks.addIfNotAlreadyThere (p);
408 auto removeAutomationRangeOfPlugin = [&] (
Plugin& p)
410 for (
auto param : p.getAutomatableParameters())
411 param->getCurve().removeRegionAndCloseGap (rangeToDelete);
414 auto removeAutomationRangeFindingRackPlugins = [&] (
Track& t)
416 for (
auto p : t.pluginList)
418 removeAutomationRangeOfPlugin (*p);
422 addPluginsInRack (*rf);
426 for (
int i = tracks.
size(); --i >= 0;)
428 if (
auto t =
dynamic_cast<ClipTrack*
> (tracks[i]))
430 t->deleteRegion (rangeToDelete, selectionManager);
435 for (
auto& c : t->getClips())
436 if (c->getPosition().getLength() < TimeDuration::fromSeconds (0.0001))
437 clipsToRemove.
add (c);
439 for (
auto c : clipsToRemove)
440 c->removeFromParent();
444 for (
auto& c : t->getClips())
445 if (c->getPosition().getStart() > rangeToDelete.getCentre())
446 c->setStart (c->getPosition().getStart() - rangeToDelete.getLength(),
false,
true);
448 removeAutomationRangeFindingRackPlugins (*t);
451 else if (
auto ft =
dynamic_cast<FolderTrack*
> (tracks[i]))
453 removeAutomationRangeFindingRackPlugins (*ft);
457 for (
auto p : pluginsInRacks)
458 removeAutomationRangeOfPlugin (*p);
470 auto firstClip = selectedObjects.getFirstOfType<
Clip>();
471 auto firstCClip = selectedObjects.getFirstOfType<
CollectionClip>();
473 if (firstClip ==
nullptr && firstCClip ==
nullptr)
476 auto& ed = firstClip ? firstClip->edit
488 if (automationLocked)
490 if (
auto cc = c->getGroupClip())
493 ts.position = cc->getPosition().time;
494 ts.
src = cc->getTrack();
495 ts.
dst = cc->getTrack();
504 c->setStart (c->getPosition().getStart() + delta,
false,
true);
518 if (automationLocked)
526 if (mode == MoveClipAction::moveStartToCursor || mode == MoveClipAction::moveEndToCursor)
530 auto delta = edit.
getTransport().
getPosition() - (mode == MoveClipAction::moveEndToCursor ? selectedRange.getEnd()
531 : selectedRange.getStart());
533 moveClipsAndAutomation (expandedList.getItemsOfType<
Clip>(), delta);
534 moveCollectionClipAutomation (selectedObjects.getItemsOfType<
CollectionClip>(), delta);
542 for (
auto s : expandedList)
543 if (
auto c =
dynamic_cast<Clip*
> (s))
544 if (c->getTrack() == track)
545 clipsInTrack.
add (c);
551 if (mode == MoveClipAction::moveToEndOfLast)
553 if (
auto previousClip = track->getClips()[track->getClips().indexOf (clipsInTrack.
getFirst()) - 1])
554 moveClipsAndAutomation (clipsInTrack, previousClip->getPosition().getEnd() - clipsInTrack.
getFirst()->getPosition().getStart());
556 else if (mode == MoveClipAction::moveToStartOfNext)
558 if (
auto nextClip = track->getClips()[track->getClips().indexOf (clipsInTrack.
getLast()) + 1])
559 moveClipsAndAutomation (clipsInTrack, nextClip->getPosition().getStart() - clipsInTrack.
getLast()->getPosition().getEnd());
570 if (in.size() > 1000)
574 selectables.
reserve (
static_cast<size_t> (in.size()));
576 for (
auto ti : in.getItemsOfType<
TrackItem>())
578 if (
auto clip =
dynamic_cast<Clip*
> (ti))
582 for (
auto c : cc->getClips())
586 return stable_remove_duplicates (selectables);
590 for (
auto ti : in.getItemsOfType<
TrackItem>())
592 if (
auto clip =
dynamic_cast<Clip*
> (ti))
593 result.addIfNotAlreadyThere (clip);
596 for (
auto c : cc->getClips())
597 result.addIfNotAlreadyThere (c);
609 for (
auto clip : audioTrack->getClips())
611 if (
auto effects = waveClip->getClipEffects())
612 for (
auto effect : *effects)
629 return containerClip;
643 for (
auto cs : at->getClipSlotList().getClipSlots())
645 if (cs->itemID ==
id)
662 return at->getClipSlotList().getClipSlots().indexOf (&slot);
672 Clip* result =
nullptr;
676 if (
auto c = t.findClipForID (clipID))
682 for (
auto cc : getTrackItemsOfType<ContainerClip> (t))
699 Clip* result =
nullptr;
703 if (
auto c =
dynamic_cast<Clip*
> (&t))
720 return findTrackForPredicate (edit,
723 if (t.indexOfTrackItem (clip) >= 0)
727 for (
auto slot : at->getClipSlotList().getClipSlots())
728 if (clip == slot->getClip())
731 for (
auto cc : getTrackItemsOfType<ContainerClip> (t))
732 if (cc->getClips().contains (clip))
743 auto numItems = t.getNumTrackItems();
745 for (
int i = 0; i < numItems; ++i)
747 if (
auto ti = t.getTrackItem (i))
753 for (
auto slot : at->getClipSlotList().getClipSlots())
754 if (
auto c = slot->getClip())
758 for (
auto cc : getTrackItemsOfType<ContainerClip> (t))
759 for (
auto c : cc->getClips())
769 auto items = selected.getItemsOfType<
TrackItem>();
776 for (
auto& i : items)
777 range = range.getUnionWith (i->getEditTimeRange());
789 if (
auto c =
dynamic_cast<MidiClip*
> (&t))
791 if (
auto n = c->getSequence().getNoteFor (v))
807 if (c->getClipTrack() ==
nullptr || c->getClipTrack()->isFrozen (
Track::anyFreeze))
814 if (
auto track = first->getClipTrack())
816 if (
auto newClip = track->insertMIDIClip (first->getName(), first->getPosition().time, sm))
818 newClip->setQuantisation (first->getQuantisation());
819 newClip->setGrooveTemplate (first->getGrooveTemplate());
820 newClip->setMidiChannel (first->getMidiChannel());
822 auto startBeat = BeatPosition::fromBeats (1.0e10);
823 auto startTime = TimePosition::fromSeconds (1.0e10);
828 startBeat =
juce::jmin (startBeat, c->getStartBeat());
829 startTime =
juce::jmin (startTime, c->getPosition().getStart());
830 endTime =
juce::jmax (endTime, c->getPosition().getEnd());
839 sourceList.
copyFrom (c->getSequenceLooped(),
nullptr);
841 const auto offset = BeatDuration::fromBeats (c->getPosition().getOffset().inSeconds() * c->edit.tempoSequence.getBeatsPerSecondAt (c->getPosition().getStart(),
true));
843 sourceList.trimOutside (toPosition (offset), toPosition (offset + c->getLengthInBeats()),
nullptr);
844 sourceList.moveAllBeatPositions (c->getStartBeat() - startBeat - offset,
nullptr);
846 destinationList.
addFrom (sourceList,
nullptr);
849 newClip->setPosition ({ { startTime, endTime },
TimeDuration() });
850 newClip->getSequence().addFrom (destinationList, &track->edit.getUndoManager());
852 for (
int i = clips.
size(); --i >= 0;)
872 if (MidiList::readSeparateTracksFromFile (midiFile, lists,
873 tempoChangeBeatNumbers, bpms,
874 numerators, denominators, len,
875 importAsNoteExpression))
887 if (
auto l = lists.getFirst())
890 const auto endTime = ts.toTime (l->getLastBeatNumber());
891 const auto barsBeats = ts.toBarsAndBeats (endTime);
892 const auto totalBars = barsBeats.getTotalBars();
893 const auto nextBar =
static_cast<int> (
std::ceil (totalBars));
894 const auto clipEndTime = ts.toTime ({ nextBar });
898 c->setName (l->getImportedFileName ());
916 list.addArray (t.getAllPlugins());
920 for (
auto clip : at->getClips())
924 if (
auto pluginList = abc->getPluginList())
925 list.addArray (pluginList->getPlugins());
927 if (
auto clipEffects = abc->getClipEffects())
928 for (
auto effect : *clipEffects)
929 if (
auto pluginEffect =
dynamic_cast<PluginEffect*
> (effect))
930 if (pluginEffect->plugin !=
nullptr)
931 list.add (pluginEffect->plugin);
941 list.addIfNotAlreadyThere (p);
944 for (
auto p : r->getPlugins())
947 if (includeMasterVolume)
973 return findTrackForPredicate (edit, [p] (
Track& t) {
return t.containsPlugin (p); });
1003 for (
auto p : allPlugins)
1007 for (
auto p : allPlugins)
1008 p->setEnabled (numEnabled == 0);
1015 if (
auto at =
dynamic_cast<AudioTrack*
> (p->getOwnerTrack()))
1016 for (
auto& m : messages)
1017 at->injectLiveMidiMessage (m, MidiMessageArray::notMPE);
1029 for (
auto chan = 1; chan <= 16; ++chan)
1040 Edit::ScopedRenderStatus srd (edit,
true);
1051 destArray.
add (mpl);
1056 if (
auto mpl = m->getMacroParameterList())
1057 destArray.add (mpl);
1059 destArray.addArray (t.getAllAutomatableEditItems());
1065 if (
auto mpl = p->getMacroParameterList())
1066 destArray.add (mpl);
1073 for (
auto p : r->getPlugins())
1077 if (
auto mpl = p->getMacroParameterList())
1078 destArray.add (mpl);
1081 if (
auto mpl = r->getMacroParameterList())
1082 destArray.add (mpl);
1084 destArray.addArray (r->getModifierList().getModifiers());
1094 if (selectedClips.containsType<
Clip>())
1098 for (
auto plugin : section.track->pluginList)
1100 for (
auto& param : plugin->getAutomatableParameters())
1102 auto& curve = param->getCurve();
1104 if (curve.countPointsInRegion (section.range.expanded (TimeDuration::fromSeconds (0.0001))))
1106 auto start = curve.getValueAt (section.range.getStart());
1107 auto end = curve.getValueAt (section.range.getEnd());
1109 curve.removePointsInRegion (section.range.expanded (TimeDuration::fromSeconds (0.0001)));
1110 curve.addPoint (section.range.getStart(), start, 1.0f);
1111 curve.addPoint (section.range.getEnd(), end, 0.0f);
1127 sources.
addArray (mpe->getMacroParameters());
1137 modifiers.
addArray (r->getModifierList().getModifiers());
1141 if (
auto modifierList = t.getModifierList())
1142 modifiers.
addArray (modifierList->getModifiers());
1153 if (modifier->itemID ==
id)
1161 for (
auto modifier : rack.getModifierList().getModifiers())
1162 if (modifier->itemID ==
id)
1173 return findTrackForPredicate (edit, [m] (
Track& t)
1175 if (
auto list = t.getModifierList())
1176 return list->getModifiers().contains (m);
1211 InputDeviceInstance::RecordingParameters params;
1213 const auto& edit = context.edit;
1219 const auto loopRange = context.transport.
getLoopRange();
1220 params.punchRange = params.punchRange.withStart (
std::max (params.punchRange.getStart(), loopRange.getStart() - 0.5s));
1222 if (edit.
getNumCountInBeats() > 0 && context.getLoopTimes().getStart() > loopRange.getStart())
1223 params.punchRange = params.punchRange.withStart (context.getLoopTimes().getStart());
1226 if (playStart < loopRange.getEnd() - 0.5s)
1227 params.punchRange = params.punchRange.withEnd (loopRange.getEnd());
1229 else if (context.isLooping())
1231 params.punchRange = params.punchRange.withStart (context.getLoopTimes().getStart());
1240 TRACKTION_ASSERT_MESSAGE_THREAD
1241 InputDeviceInstance::Destination* dest =
nullptr;
1245 if (inputDest->targetID == targetID)
1258 if (! dest->recordEnabled)
1262 InputDeviceInstance::RecordingParameters params;
1276 jassert (transport.isPlaying());
1278 InputDeviceInstance::StopRecordingParameters params;
1281 params.targetsToStop.push_back (targetID);
1283 if (
auto epc = transport.getCurrentPlaybackContext())
1284 params.unloopedTimeToEndRecording = epc->getUnloopedPosition();
1286 params.isLooping = transport.looping;
1287 params.markedRange = transport.getLoopRange();
1288 params.discardRecordings =
false;
1295 for (
auto input : epc.getAllInputs())
1296 if (input->isRecording())
ElementType getUnchecked(int index) const
bool isEmpty() const noexcept
void addArray(const Type *elementsToAdd, int numElementsToAdd)
int size() const noexcept
ElementType getFirst() const noexcept
void add(const ElementType &newElement)
bool contains(ParameterType elementToLookFor) const
bool addIfNotAlreadyThere(ParameterType newElement)
ElementType getLast() const noexcept
int findNextSetBit(int startIndex) const noexcept
BigInteger & setBit(int bitNumber)
bool isValid() const noexcept
static MidiMessage allNotesOff(int channel) noexcept
void addArray(const ReferenceCountedArray &arrayToAddFrom, int startIndex=0, int numElementsToAdd=-1) noexcept
ReferencedType * get() const noexcept
static Result fail(const String &errorMessage) noexcept
static Result ok() noexcept
static void JUCE_CALLTYPE callAfterDelay(int milliseconds, std::function< void()> functionToCall)
Base class for Clips that produce some kind of audio e.g.
Base class for items that can contain clips.
virtual Edit & getClipOwnerEdit()=0
Must return the Edit this ClipOwner belongs to.
Represents a slot on a track that a Clip can live in to be played as a launched clip.
Track & track
The Track this ClipSlot belongs to.
A clip that can contain multiple other clips and mix their output together.
The Tracktion Edit class!
VolumeAndPanPlugin::Ptr getMasterVolumePlugin() const
Returns the master VolumeAndPanPlugin.
static TimeRange getMaximumEditTimeRange()
Returns the maximum length an Edit can be.
TransportControl & getTransport() const noexcept
Returns the TransportControl which is used to stop/stop/position playback and recording.
TimecodeDisplayFormat getTimecodeFormat() const
Returns the current TimecodeDisplayFormat.
TempoSequence tempoSequence
The global TempoSequence of this Edit.
MacroParameterElement & getGlobalMacros() const
Returns global MacroParameterElement.
TempoTrack * getTempoTrack() const
Returns the global TempoTrack.
int getNumCountInBeats() const
Returns the number of beats of the count in.
void visitAllTracksRecursive(std::function< bool(Track &)>) const
Visits all tracks in the Edit with the given function.
juce::CachedValue< bool > recordingPunchInOut
Whether recoridng only happens within the in/out markers.
juce::UndoManager & getUndoManager() noexcept
Returns the juce::UndoManager used for this Edit.
PluginList & getMasterPluginList() const noexcept
Returns the master PluginList.
void visitAllTracks(std::function< bool(Track &)>, bool recursive) const
Visits all tracks in the Edit with the given function.
RackTypeList & getRackList() const noexcept
Returns the RackTypeList which contains all the RackTypes for the Edit.
Engine & engine
A reference to the Engine.
UIBehaviour & getUIBehaviour() const
Returns the UIBehaviour class.
ProjectManager & getProjectManager() const
Returns the ProjectManager instance.
static juce::Array< Exportable * > addAllExportables(Edit &)
Returns all the Exportables contained in an Edit.
Base class for elements which can contain macro parameters.
MacroParameterList * getMacroParameterList()
If no parameters have been created, this may return nullptr.
void copyFrom(const MidiList &, juce::UndoManager *)
Clears the current list and copies the others contents and properties.
void setMidiChannel(MidiChannel chanNum)
Gives the list a channel number that it'll use when generating real midi messages.
void addFrom(const MidiList &, juce::UndoManager *)
Adds copies of the events in another list to this one.
An ID representing one of the items in a Project.
ProjectItem::Ptr getProjectItem(ProjectItemID)
tries to find the project that contains an id, and open it as a ProjectItem.
Manages a list of items that are currently selected.
TimePosition toTime(BeatPosition) const
Converts a number of beats a time.
void deleteRegion(TimeRange)
Removes a region in a sequence, shifting TempoSettings and TimeSigs.
void insertSpaceIntoTrack(TimePosition, TimeDuration) override
Should insert empty space in to the track, shuffling down any items after the time.
Base class for EditItems that live in a Track, e.g.
static void sortByTime(ArrayType &items)
Helper function to sort an array of TrackItem[s] by their start time.
TimeRange getEditTimeRange() const
Returns the time range of this item.
Represents the destination output device(s) for a track.
Base class for tracks which contain clips and plugins and can be added to Edit[s].
@ individualFreeze
Freezes a track in to a single audio file.
@ groupFreeze
Freezes multiple tracks together in to a single file.
@ anyFreeze
Either a group or individual freeze.
TimePosition getPosition() const
Returns the current transport position.
bool isRecording() const
Returns true if recording is in progress.
TimeRange getLoopRange() const noexcept
Returns the loop range.
virtual SelectableList getAssociatedClipsToEdit(const SelectableList &items)
If your UI has the concept of edit groups, you should return an expanded list of selected items that ...
virtual void showWarningMessage(const juce::String &message)
Should display a temporary warning message.
#define TRANS(stringLiteral)
constexpr Type jmin(Type a, Type b)
constexpr Type jmax(Type a, Type b)
juce::File getEditFileFromProjectManager(Edit &edit)
Uses the ProjectManager to look up the file for an Edit.
juce::Array< MacroParameterElement * > getAllMacroParameterElements(const Edit &edit)
Returns all the MacroParameterElement in an Edit.
bool referencesProjectItem(Edit &edit, ProjectItemID itemID)
Returns true if the ProjectItemID is being used for any of the Edit's elements.
AudioTrack * getFirstAudioTrack(const Edit &edit)
Returns the first audio track in an Edit.
void insertSpaceIntoEdit(Edit &edit, TimeRange timeRange)
Inserts blank space in to an Edit, splitting clips if necessary.
TrackOutput * getTrackOutput(Track &track)
Returns the TrackOutput if the given track has one.
SelectableList splitClips(const SelectableList &clips, TimePosition time)
Splits the clips at a given time.
SelectableList getClipSelectionWithCollectionClipContents(const SelectableList &in)
Returns a list of clips.
Track * findTrackForState(const Edit &edit, const juce::ValueTree &v)
Returns the Track with a given state if contained in the Edit.
void deleteAutomation(const SelectableList &selectedClips)
Deletes the automation covered by the selected clips.
Clip * findClipForState(ClipOwner &co, const juce::ValueTree &v)
Returns a clip with the given state if the ClipOwner contains it.
juce::Array< Track * > toTrackArray(Edit &edit, const juce::BigInteger &tracksToAdd)
Returns an Array of Track[s] corresponding to the set bits of all tracks in an Edit.
juce::Array< Track * > getTopLevelTracks(const Edit &edit)
Returns all of the non-foldered tracks in an Edit.
void insertSpaceIntoEditFromBeatRange(Edit &edit, BeatRange beatRange)
Inserts a number of blank beats in to the Edit.
juce::Result mergeMidiClips(juce::Array< MidiClip * > clips, SelectionManager *sm)
Merges a set of MIDI clips in to one new one.
TimeRange getTimeRangeForSelectedItems(const SelectableList &selected)
Returns the time range covered by the given items.
Clip::Ptr duplicateClip(const Clip &c)
Creates a unique copy of this clip with a new EditItemID.
Clip * findClipForID(ClipOwner &co, EditItemID id)
Returns a clip with the given ID if the ClipOwner contains it.
CloseGap
An enum to specify if gaps deleted should be closed or not.
@ yes
Do move up subsequent track content.
ClipTrack * findFirstClipTrackFromSelection(const SelectableList &items)
Returns the first ClipTrack from the selected tracks or clips.
bool areAnyPluginsMissing(const Edit &edit)
Returns true if any plugins couldn't be loaded beacuse their files are missing.
juce::Array< MacroParameterList * > getAllMacroParameterLists(const Edit &edit)
Returns all the MacroParameterLists in an Edit.
juce::Array< Track * > getAllTracks(const Edit &edit)
Returns all the tracks in an Edit.
int findClipSlotIndex(ClipSlot &slot)
Returns the index of the ClipSlot in the list it is owned by.
ClipOwner * findClipOwnerForID(const Edit &edit, EditItemID id)
Returns the ClipOwner with a given ID if it can be found in the Edit.
bool containsTrack(const Edit &edit, const Track &track)
Returns true if the Edit contains this Track.
juce::Array< Track * > findTracksForIDs(const Edit &edit, const juce::Array< EditItemID > &ids)
Returns the Tracks for the given IDs in the Edit.
tl::expected< Clip::Array, juce::String > punchOutRecording(InputDeviceInstance &instance)
If the instance is currently recording, this will stop it and return any created clips or an error me...
juce::Array< AudioTrack * > getAudioTracks(const Edit &edit)
Returns all the AudioTracks in an Edit.
void visitAllTrackItems(const Edit &edit, std::function< bool(TrackItem &)> f)
Calls a function for all TrackItems in an Edit.
Track * getTrackContainingPlugin(const Edit &edit, const Plugin *p)
Returns the track for the track which the plugin is located on.
juce::BigInteger toBitSet(const juce::Array< Track * > &tracks)
Returns the set of tracks as a BigInteger with each bit corresponding to the array of all tracks in a...
juce::Array< AutomatableParameter::ModifierSource * > getAllModifierSources(const Edit &edit)
Returns all the ModifierSources in an Edit.
MidiNote * findNoteForState(const Edit &edit, const juce::ValueTree &v)
Returns the MidiNote with a given state.
Plugin::Ptr findPluginForState(const Edit &edit, const juce::ValueTree &v)
Returns the plugin with given state.
ClipSlot * findClipSlotForID(const Edit &edit, EditItemID id)
Returns the ClipSlot for the given ID.
void deleteRegionOfClip(Clip &c, TimeRange timeRangeToDelete)
Deletes a time range of a Clip.
ProjectItem::Ptr getProjectItemForEdit(const Edit &e)
Tries to find the project item that refers to this edit (but may return nullptr!)
juce::Array< ClipTrack * > getClipTracks(const Edit &edit)
Returns all the ClipTracks in an Edit.
juce::ReferenceCountedArray< Modifier > getAllModifiers(const Edit &edit)
Returns all the Modifiers in an Edit.
Plugin::Ptr findPluginForID(const Edit &edit, EditItemID id)
Returns the plugin with given EditItemID.
void deleteRegionOfTracks(Edit &edit, TimeRange rangeToDelete, bool onlySelected, CloseGap closeGap, SelectionManager *selectionManager)
Deletes a time range of an Edit, optionally closing the gap.
juce::Array< RackInstance * > getRackInstancesInEditForType(const RackType &rt)
Returns all of the instances of a specific RackType in an Edit.
Modifier::Ptr findModifierForID(ModifierList &ml, EditItemID modifierID)
Returns a Modifier if it can be found in the list.
void moveAutomation(const juce::Array< TrackAutomationSection > &origSections, TimeDuration offset, bool copy)
Moves a set of automation optionally applying an offset and copying the automation (rather than movin...
int getTotalNumTracks(const Edit &edit)
Returns the total number of Tracks in an Edit.
juce::Array< AutomatableEditItem * > getAllAutomatableEditItems(const Edit &edit)
Returns all AutomatableEditItems in an Edit.
void deleteRegionOfSelectedClips(SelectionManager &selectionManager, TimeRange rangeToDelete, CloseGap closeGap, bool moveAllSubsequentClipsOnTrack)
Deletes a time range of a Clip selection, optionally closing the gap.
std::pair< std::vector< std::unique_ptr< InputDeviceInstance::RecordingContext > >, juce::StringArray > extract(InputDeviceInstance::PreparedContext &&pc)
Splits the PreparedContext in to valid RecordingContexts and an array of error messages.
juce::Result prepareAndPunchRecord(InputDeviceInstance &instance, EditItemID targetID)
Starts an InputDeviceInstance recording to the given target without any count-in etc.
Track * getTrackContainingModifier(const Edit &edit, const Modifier::Ptr &m)
Returns the Track containing a Modifier.
juce::OwnedArray< MidiList > readFileToMidiList(juce::File midiFile, bool importAsNoteExpression)
Helper function to read a file to a number of MidiLists.
void injectMIDIToAllPlugins(const Edit &edit, const std::span< juce::MidiMessage > &messages)
Sends a list of MIDI messages to all the plugins in this edit.
MidiClip::Ptr insertMIDIClip(ClipOwner &parent, const juce::String &name, TimeRange position)
Inserts a new MidiClip into the ClipOwner's clip list.
Track * findTrackForID(const Edit &edit, EditItemID id)
Returns the Track with a given ID if contained in the Edit.
void muteOrUnmuteAllPlugins(const Edit &edit)
Toggles the enabled state of all plugins in an Edit.
Project::Ptr getProjectForEdit(const Edit &e)
Tries to find the project that contains this edit (but may return nullptr!)
SafeSelectable< SelectableType > makeSafeRef(SelectableType &selectable)
Creates a SafeSelectable for a given selectable object.
void moveSelectedClips(const SelectableList &selectedObjectsIn, Edit &edit, MoveClipAction mode, bool automationLocked)
Moves the selected clips within their track.
juce::Array< Track * > findAllTracksContainingSelectedItems(const SelectableList &items)
Returns all the tracks containing the selected tracks or TrackItems.
bool isRecording(EditPlaybackContext &epc)
Returns true if any inputs are currently recording.
void midiPanic(Edit &edit, bool resetPlugins)
Performs a "MIDI panic" on the edit, by resetting playback, and sending some all-note-off messages to...
InputDeviceInstance::RecordingParameters getDefaultRecordingParameters(const EditPlaybackContext &context, TimePosition playStart, TimePosition punchIn)
Returns the default set of recording parameters.
AudioTrack * findAudioTrackForID(const Edit &edit, EditItemID id)
Returns the AudioTrack with a given ID if contained in the Edit.
MoveClipAction
Enum to dictate move clip behaviour.
MidiClip::Ptr createClipFromFile(juce::File midiFile, ClipOwner &owner, bool importAsNoteExpression)
Helper function to read a MIDI file and create a MidiClip from it.
bool containsClip(const Edit &edit, Clip *clip)
Returns true if an Edit contains a given clip.
Plugin::Array getAllPlugins(const Edit &edit, bool includeMasterVolume)
Returns all the plugins in a given Edit.
juce::Array< ClipEffect * > getAllClipEffects(Edit &edit)
Returns all clip effects.
Represents a duration in beats.
Represents a duration in real-life time.
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...
Holds a reference to a section of automation for a given Track.
Track::Ptr src
The time range of the automation section.
Track::Ptr dst
The source Track.
static juce::Array< TrackSection > findSections(const TrackItemArray &trackItems)
Returns a set of TrackSections for the given TrackItems.
#define CRASH_TRACER
This macro adds the current location to a stack which gets logged if a crash happens.