mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-12 22:57:43 +02:00
Disallow punch and roll from t=0.0
Punch and roll from 0.0 deletes the whole track before punch and rolling. That is unlikely to be what the user intended, since there is then no audio cue, so disallow it. Also reduced indentation.
This commit is contained in:
parent
ed34e6b029
commit
66a87ecaa9
@ -8518,7 +8518,8 @@ int AudacityProject::DialogForLabelName(const wxString& initialValue, wxString&
|
||||
#ifdef EXPERIMENTAL_PUNCH_AND_ROLL
|
||||
void AudacityProject::OnPunchAndRoll(const CommandContext &WXUNUSED(context))
|
||||
{
|
||||
if (!gAudioIO->IsBusy()) {
|
||||
if (gAudioIO->IsBusy())
|
||||
return;
|
||||
|
||||
// Ignore all but left edge of the selection.
|
||||
mViewInfo.selectedRegion.collapseToT0();
|
||||
@ -8548,7 +8549,10 @@ void AudacityProject::OnPunchAndRoll(const CommandContext &WXUNUSED(context))
|
||||
gPrefs->Read(AUDIO_ROLL_CROSSFADE_KEY, DEFAULT_ROLL_CROSSFADE_MS)
|
||||
/ 1000.0;
|
||||
for (const auto &wt : tracks) {
|
||||
if (!wt->GetClipAtSample(sampleCount(floor(t1 * wt->GetRate())))) {
|
||||
// The test for t1 == 0.0 stops punch and roll deleting everything where the
|
||||
// selection is at zero. There wouldn't be any cued audio to play in
|
||||
// that case, so a normal record, not a punch and roll, is called for.
|
||||
if (!wt->GetClipAtSample(sampleCount(floor(t1 * wt->GetRate()))) || t1 ==0.0) {
|
||||
auto message = _("Please select a time within a clip.");
|
||||
AudacityMessageBox(message);
|
||||
return;
|
||||
@ -8600,7 +8604,6 @@ void AudacityProject::OnPunchAndRoll(const CommandContext &WXUNUSED(context))
|
||||
// Roll back the deletions
|
||||
RollbackState();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int AudacityProject::DoAddLabel(const SelectedRegion ®ion, bool preserveFocus)
|
||||
|
Loading…
x
Reference in New Issue
Block a user