1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-17 17:17:40 +02:00

Better punch-in precision: quantize start and end times for rate...

... So that samples of a new track align precisely with the old track, at least
in case the old track has the same rate and starts exactly at 0, which is
the likely usual case.
This commit is contained in:
Paul Licameli 2018-05-26 23:39:12 -04:00
parent a3abacd55d
commit f0ebf5823a

View File

@ -983,7 +983,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
}
}
if(!hasWave)
// Treat append-record like record record to new, when there are
// Treat append-record like record to new, when there are
// no wave tracks to append onto.
appendRecord = false;
@ -1149,7 +1149,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
}
if( recordingTracks.empty() )
{ // recording to new track.
{ // recording to new track(s).
bool recordingNameCustom, useTrackNumber, useDateStamp, useTimeStamp;
wxString defaultTrackName, defaultRecordingTrackName;
@ -1162,7 +1162,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
}
numTracks++;
recordingChannels = gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2);
recordingChannels = std::max(1L, gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2));
gPrefs->Read(wxT("/GUI/TrackNames/RecordingNameCustom"), &recordingNameCustom, false);
gPrefs->Read(wxT("/GUI/TrackNames/TrackNumber"), &useTrackNumber, false);
@ -1178,6 +1178,12 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
p->GetTrackFactory()->NewWaveTrack().release()
};
// Quantize bounds to the rate of the new track.
if (c == 0) {
t0 = newTrack->LongSamplesToTime(newTrack->TimeToLongSamples(t0));
t1 = newTrack->LongSamplesToTime(newTrack->TimeToLongSamples(t1));
}
newTrack->SetOffset(t0);
wxString nameSuffix = wxString(wxT(""));