23 auto &[clipStartEndTimes, clipRealStartEndTimes, clipNames] = results;
30 for (
const auto &clip : oldTrack.
GetClips()) {
31 auto clipStartT = clip->GetPlayStartTime();
32 auto clipEndT = clip->GetPlayEndTime();
33 if (clipEndT <= startT)
35 if (clipStartT >= startT + lenT)
39 clipRealStartEndTimes.emplace_back(clipStartT, clipEndT);
41 if (clipStartT < startT)
43 if(clipEndT > startT + lenT)
44 clipEndT = startT + lenT;
47 clipStartEndTimes.emplace_back(clipStartT, clipEndT);
48 clipNames.push_back(clip->GetName());
60 const auto &[clipStartEndTimes, clipRealStartEndTimes, clipNames] = data;
75 for (
unsigned int i = 0; i < clipStartEndTimes.size(); ++i) {
77 auto [start,
end] = clipStartEndTimes[i];
80 auto toClipOutput = newContents.
Copy(start - startT,
end - startT);
81 oldTrack.
Paste(start, *toClipOutput);
91 auto [realStart, realEnd] = clipRealStartEndTimes[i];
92 if ((realStart != start || realEnd !=
end) &&
93 !(realStart <= startT && realEnd >= startT + lenT))
94 oldTrack.
Join(realStart, realEnd);
void PasteOverPreservingClips(const ClipData &data, WaveTrack &oldTrack, sampleCount start, sampleCount len, const WaveTrack &newContents)
Substitute new contents into existing track, preserving clip boundaries.
ClipData CollectClipData(const WaveTrack &oldTrack, sampleCount start, sampleCount len)
Collect clip boundary and name information.
void SetName(const wxString &name)
A Track that contains audio waveform data.
const WaveClip * GetClipAtTime(double time) const
void Join(double t0, double t1)
void Clear(double t0, double t1) override
bool IsLeader() const override
void Paste(double t0, const Track &src) override
double GetRate() const override
TrackListHolder Copy(double t0, double t1, bool forClipboard=true) const override
Create new tracks and don't modify this track.
WaveClipHolders & GetClips()
size_t NChannels() const override
May report more than one only when this is a leader track.
double LongSamplesToTime(sampleCount pos) const
Positions or offsets within audio files need a wide type.
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.