1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 09:39:42 +02:00

Fix data loss saving a stereo track lossless or compressed...

... in case clip boundaries don't match and the right channel covers a greater
time extent than the left.

Don't lose those parts of the right channel, before or after, and also make the
start time of the project correct in case the right channel starts earlier.

This is an old bug, going back as far as the git history.
This commit is contained in:
Paul Licameli 2018-12-20 12:41:46 -05:00
parent 03b82618b2
commit 340bd20fc6

View File

@ -3752,7 +3752,9 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
// xmlFile.WriteAttr(wxT("channel"), t->GetChannel());
// xmlFile.WriteAttr(wxT("linked"), t->GetLinked());
xmlFile.WriteAttr(wxT("offset"), pWaveTrack->GetOffset(), 8);
const auto offset =
TrackList::Channels( pWaveTrack ).min( &WaveTrack::GetOffset );
xmlFile.WriteAttr(wxT("offset"), offset, 8);
xmlFile.WriteAttr(wxT("mute"), pWaveTrack->GetMute());
xmlFile.WriteAttr(wxT("solo"), pWaveTrack->GetSolo());
xmlFile.WriteAttr(wxT("height"), pWaveTrack->GetActualHeight());
@ -4168,10 +4170,12 @@ bool AudacityProject::SaveCopyWaveTracks(const wxString & strProjectPathName,
channel->SetSelected(true);
uniqueTrackFileName = wxFileName(strDataDirPathName, pTrack->GetName(), extension);
FileNames::MakeNameUnique(mStrOtherNamesArray, uniqueTrackFileName);
const auto startTime = channels.min( &Track::GetStartTime );
const auto endTime = channels.max( &Track::GetEndTime );
bSuccess =
theExporter.Process(this, channels.size(),
fileFormat, uniqueTrackFileName.GetFullPath(), true,
pTrack->GetStartTime(), pTrack->GetEndTime());
startTime, endTime);
if (!bSuccess)
// If only some exports succeed, the cleanup is not done here