1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 09:20:16 +01:00

AUP3: First round of updates

!!! THERE WILL NO DOUBT BE BUGS !!!

This is a big one and there's still several things to
complete. Just want to get this in the wild to start
receiving feedback.

One big thing right now is that it will NOT load pre-aup3
files.  An importer is on the way for that.
This commit is contained in:
Leland Lucius
2020-07-01 00:45:17 -05:00
parent b1beb20ae9
commit d39590cf41
74 changed files with 2902 additions and 6057 deletions

View File

@@ -68,11 +68,11 @@ static ProjectFileIORegistry::Entry registerFactory{
LabelTrack::Holder TrackFactory::NewLabelTrack()
{
return std::make_shared<LabelTrack>(mDirManager);
return std::make_shared<LabelTrack>(&mProject);
}
LabelTrack::LabelTrack(const std::shared_ptr<DirManager> &projDirManager):
Track(projDirManager),
LabelTrack::LabelTrack(AudacityProject *project):
Track(project),
mClipLen(0.0),
miLastLabel(-1)
{
@@ -627,53 +627,6 @@ void LabelTrack::WriteXML(XMLWriter &xmlFile) const
xmlFile.EndTag(wxT("labeltrack"));
}
#if LEGACY_PROJECT_FILE_SUPPORT
bool LabelTrack::Load(wxTextFile * in, DirManager * dirManager)
{
if (in->GetNextLine() != wxT("NumMLabels"))
return false;
unsigned long len;
if (!(in->GetNextLine().ToULong(&len)))
return false;
mLabels.clear();
mLabels.reserve(len);
for (int i = 0; i < len; i++) {
double t0;
if (!Internat::CompatibleToDouble(in->GetNextLine(), &t0))
return false;
// Legacy file format does not include label end-times.
// PRL: nothing NEW to do, legacy file support
mLabels.push_back(LabelStruct {
SelectedRegion{ t0, t0 }, in->GetNextLine()
});
}
if (in->GetNextLine() != wxT("MLabelsEnd"))
return false;
SortLabels();
return true;
}
bool LabelTrack::Save(wxTextFile * out, bool overwrite)
{
out->AddLine(wxT("NumMLabels"));
int len = mLabels.size();
out->AddLine(wxString::Format(wxT("%d"), len));
for (auto pLabel : mLabels) {
const auto &labelStruct = *pLabel;
out->AddLine(wxString::Format(wxT("%lf"), labelStruct.selectedRegion.mT0));
out->AddLine(labelStruct.title);
}
out->AddLine(wxT("MLabelsEnd"));
return true;
}
#endif
Track::Holder LabelTrack::Cut(double t0, double t1)
{
auto tmp = Copy(t0, t1);
@@ -699,7 +652,7 @@ Track::Holder LabelTrack::SplitCut(double t0, double t1)
Track::Holder LabelTrack::Copy(double t0, double t1, bool) const
{
auto tmp = std::make_shared<LabelTrack>(GetDirManager());
auto tmp = std::make_shared<LabelTrack>(GetProject());
const auto lt = static_cast<LabelTrack*>(tmp.get());
for (auto &labelStruct: mLabels) {