mirror of
https://codeberg.org/tenacityteam/tenacity
synced 2025-09-28 17:26:23 +02:00
Fix paste on moved tracks with left trim
(cherry picked from commit 119a1c284639815babc8249268b10a5fe0073ea8) Signed-off-by: Avery King <gperson@disroot.org>
This commit is contained in:
committed by
Avery King
parent
8ed0f94cd6
commit
e68ca482a5
@@ -1139,13 +1139,16 @@ bool WaveClip::Paste(double t0, const WaveClip& o)
|
|||||||
ClearSequenceFinisher finisher;
|
ClearSequenceFinisher finisher;
|
||||||
|
|
||||||
//seems like edge cases cannot happen, see WaveTrack::PasteWaveTrack
|
//seems like edge cases cannot happen, see WaveTrack::PasteWaveTrack
|
||||||
double leftTrimDueToPaste = 0.0;
|
double pastePositionShift = 0.0;
|
||||||
|
double startPositionShift = 0.0;
|
||||||
auto &factory = GetFactory();
|
auto &factory = GetFactory();
|
||||||
if (t0 == GetPlayStartTime())
|
if (t0 == GetPlayStartTime())
|
||||||
{
|
{
|
||||||
|
pastePositionShift = t0;
|
||||||
|
startPositionShift = other.GetSequenceStartTime() + GetTrimLeft();
|
||||||
|
|
||||||
finisher = ClearSequence(GetSequenceStartTime(), t0);
|
finisher = ClearSequence(GetSequenceStartTime(), t0);
|
||||||
SetTrimLeft(other.GetTrimLeft());
|
SetTrimLeft(other.GetTrimLeft());
|
||||||
leftTrimDueToPaste = other.GetTrimLeft();
|
|
||||||
|
|
||||||
auto copy = std::make_shared<WaveClip>(other, factory, true);
|
auto copy = std::make_shared<WaveClip>(other, factory, true);
|
||||||
copy->ClearSequence(copy->GetPlayEndTime(), copy->GetSequenceEndTime())
|
copy->ClearSequence(copy->GetPlayEndTime(), copy->GetSequenceEndTime())
|
||||||
@@ -1199,7 +1202,7 @@ bool WaveClip::Paste(double t0, const WaveClip& o)
|
|||||||
newCutlines.push_back(std::move(cutlineCopy));
|
newCutlines.push_back(std::move(cutlineCopy));
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleCount s0 = TimeToSequenceSamples(t0);
|
sampleCount s0 = TimeToSequenceSamples(t0 - pastePositionShift);
|
||||||
|
|
||||||
// Because newClip was made above as a copy of (a copy of) other
|
// Because newClip was made above as a copy of (a copy of) other
|
||||||
assert(other.NChannels() == newClip->NChannels());
|
assert(other.NChannels() == newClip->NChannels());
|
||||||
@@ -1214,7 +1217,7 @@ bool WaveClip::Paste(double t0, const WaveClip& o)
|
|||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
MarkChanged();
|
MarkChanged();
|
||||||
|
|
||||||
SetSequenceStartTime(GetSequenceStartTime() - leftTrimDueToPaste);
|
SetSequenceStartTime(GetSequenceStartTime() + startPositionShift);
|
||||||
|
|
||||||
const auto sampleTime = 1.0 / GetRate();
|
const auto sampleTime = 1.0 / GetRate();
|
||||||
const auto timeOffsetInEnvelope =
|
const auto timeOffsetInEnvelope =
|
||||||
|
Reference in New Issue
Block a user