From fc1617ff2fb6543230baea1a3b41d7002dfb07a2 Mon Sep 17 00:00:00 2001 From: BusinessmanProgrammerSteve Date: Mon, 12 Apr 2010 15:29:53 +0000 Subject: [PATCH] Fix problem with linked label tracks and truncate silence --- src/LabelTrack.cpp | 29 +++++++---------------------- src/effects/TruncSilence.cpp | 2 +- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index e8e1268ca..9dfbcc8a1 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -2152,7 +2152,7 @@ bool LabelTrack::Save(wxTextFile * out, bool overwrite) bool LabelTrack::Cut(double t0, double t1, Track **dest) { - if (!SplitCut(t0, t1, dest)) + if (!Copy(t0, t1, dest)) return false; if (!Clear(t0, t1)) return false; @@ -2162,27 +2162,12 @@ bool LabelTrack::Cut(double t0, double t1, Track **dest) bool LabelTrack::SplitCut(double t0, double t1, Track ** dest) { - *dest = new LabelTrack(GetDirManager()); - int len = mLabels.Count(); - - for (int i = 0; i < len; i++) { - if (t0 <= mLabels[i]->t && mLabels[i]->t <= t1) { - mLabels[i]->t -= t0; - mLabels[i]->t1 -= t0; - ((LabelTrack *) (*dest))->mLabels.Add(mLabels[i]); - //Don't use DeleteLabel() since we've only moved it. - mLabels.RemoveAt(i); - // JC: ALWAYS unselect, since RemoveAt renumbers labels. - mSelIndex=-1; - len--; - i--; - } - else if (mLabels[i]->t > t1) { - mLabels[i]->t -= (t1 - t0); - mLabels[i]->t1 -= (t1 - t0); - } - } - ((LabelTrack *) (*dest))->mClipLen = (t1 - t0); + // SplitCut() == Copy() + SplitDelete() + + if (!Copy(t0, t1, dest)) + return false; + if (!SplitDelete(t0, t1)) + return false; return true; } diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index 84656f397..4d3a327f0 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -680,7 +680,7 @@ bool EffectTruncSilence::Process() // Non-wave tracks: just do a sync adjust double cutStart = (r->start + r->end - cutLen) / 2; double cutEnd = cutStart + cutLen; - t->SyncAdjust(cutStart, cutEnd); + t->SyncAdjust(cutEnd, cutStart); } } ++whichReg;