11namespace tracktion {
inline namespace engine
22 : projectManager (pm), handleSize (handleSizeToUse) {}
29 add (projectItem, 0, projectItem->getLength());
37 projectItem->verifyLength();
38 const double srcLen = projectItem->getLength() + 0.001;
40 const double start =
juce::jlimit (0.0, srcLen, startTime - handleSize);
41 const double end =
juce::jlimit (0.0, srcLen, startTime + length + handleSize);
43 add (projectItem, start, end - start);
49 add (item.itemID, item.firstTimeUsed, item.lengthUsed);
52 void add (
const ProjectItem::Ptr& mop,
double start,
double length)
57 auto itemID = mop->getID();
59 for (
int i = ids.size(); --i >= 0;)
61 if (itemID == ids.getReference(i))
63 excerpts[i]->addInterval (start, length);
69 auto intervals =
new IntervalList();
70 intervals->addInterval (start, length);
71 excerpts.add (intervals);
75 juce::String getReassignedFileName (ProjectItemID
id,
double requiredTime,
76 double& newStartTime,
double& newLength)
const
80 if (
auto il = getIntervalsForID (
id))
82 for (
int j = il->getNumIntervals(); --j >= 0;)
84 if (requiredTime >= il->getStart(j) - 0.001
85 && requiredTime <= il->getEnd(j))
87 newStartTime = il->getStart(j);
88 newLength = il->getLength(j);
97 withoutExtension <<
"_" << j;
99 return withoutExtension
100 + projectItem->getFileName()
101 .
substring (projectItem->getFileName().lastIndexOfChar (
'.'));
113 int getTotalNumThingsToExport()
117 for (
auto e : excerpts)
118 tot += e->getNumIntervals();
129 int getNumIntervals()
const {
return starts.
size(); }
130 double getStart (
int index)
const {
return starts[index]; }
131 double getLength (
int index)
const {
return ends[index] - starts[index]; }
132 double getEnd (
int index)
const {
return ends[index]; }
134 void addInterval (
double start,
double length)
137 ends.
add (start + length);
140 for (
int i = getNumIntervals(); --i >= 0;)
142 double s1 = getStart(i);
143 double e1 = getEnd(i);
145 for (
int j = getNumIntervals(); --j > i;)
147 const double s2 = getStart(j);
148 const double e2 = getEnd(j);
150 if (e1 >= s2 && s1 <= e2)
178 for (
int i = ids.
size(); --i >= 0;)
int size() const noexcept
void remove(int indexToRemove)
void add(const ElementType &newElement)
void set(int indexToChange, ParameterType newValue)
ElementType & getReference(int index) noexcept
File getChildFile(StringRef relativeOrAbsolutePath) const
static File getCurrentWorkingDirectory()
String getFileNameWithoutExtension() const
String substring(int startIndex, int endIndex) const
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.
A list of all the source files needed by an edit (or a section of an edit).
void add(ProjectItemID id)
Adds the whole of a media id to the list.
void add(ProjectItemID id, double startTime, double length)
Adds just a section of a media id to the list.
constexpr Type jmin(Type a, Type b)
constexpr Type jmax(Type a, Type b)
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Represents the sections of a wave file that are being used.