1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-01 20:14:49 +02:00

fix recording starting position (refs #1183)

This commit is contained in:
Vitaly Sverchinsky
2021-07-16 17:49:11 +03:00
committed by Paul Licameli
parent 731af5109a
commit 8bdf5cdf9b
3 changed files with 14 additions and 23 deletions

View File

@@ -520,9 +520,10 @@ void ProjectAudioManager::OnRecord(bool altAppearance)
}
existingTracks = ChooseExistingRecordingTracks(*p, false, options.rate);
t0 = std::max( t0, trackRange.max( &Track::GetEndTime ) );
if(!existingTracks.empty())
t0 = std::max( t0, trackRange.max( &Track::GetEndTime ) );
// If suitable tracks still not found, will record into NEW ones,
// but the choice of t0 does not depend on that.
// starting with t0
}
// Whether we decided on NEW tracks or not:
@@ -641,14 +642,7 @@ bool ProjectAudioManager::DoRecord(AudacityProject &project,
// Less than or equal, not just less than, to ensure a clip boundary.
// when append recording.
if (endTime <= t0) {
// Pad the recording track with silence, up to the
// maximum time.
auto newTrack = pending->EmptyCopy();
newTrack->InsertSilence(0.0, t0 - endTime);
newTrack->Flush();
pending->Clear(endTime, t0);
pending->Paste(endTime, newTrack.get());
pending->CreateClip(t0);
}
transportTracks.captureTracks.push_back(pending);
}