mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02:00
AUP3: Several little fixes
Handle bypassing of timetracks in AUP importer correctly Add bypassing of timetracks in AUP3 importer Move/add AUP3 in filter lists.
This commit is contained in:
@@ -380,13 +380,6 @@ sqlite3 *ProjectFileIO::OpenDB(FilePath fileName)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are here for easier research. Permanent settings should be done
|
|
||||||
// in the CMake list for SQLite.
|
|
||||||
#if 1
|
|
||||||
// rc = sqlite3_exec(mDB, "PRAGMA wal_autocheckpoint=1000;", nullptr, nullptr, nullptr);
|
|
||||||
// rc = sqlite3_exec(mDB, "PRAGMA journal_size_limit=1000000000;", nullptr, nullptr, nullptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!CheckVersion())
|
if (!CheckVersion())
|
||||||
{
|
{
|
||||||
CloseDB();
|
CloseDB();
|
||||||
@@ -1480,6 +1473,13 @@ bool ProjectFileIO::WriteDoc(const char *table,
|
|||||||
// IDs.
|
// IDs.
|
||||||
bool ProjectFileIO::ImportProject(const FilePath &fileName)
|
bool ProjectFileIO::ImportProject(const FilePath &fileName)
|
||||||
{
|
{
|
||||||
|
// Get access to the active tracklist
|
||||||
|
auto pProject = mpProject.lock();
|
||||||
|
if (!pProject)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
bool restore = true;
|
bool restore = true;
|
||||||
int rc;
|
int rc;
|
||||||
@@ -1599,6 +1599,28 @@ bool ProjectFileIO::ImportProject(const FilePath &fileName)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto &tracklist = TrackList::Get(*pProject);
|
||||||
|
|
||||||
|
// Search for a timetrack and remove if the project already has one
|
||||||
|
if (*tracklist.Any<TimeTrack>().begin())
|
||||||
|
{
|
||||||
|
// Find a timetrack and remove it if it exists
|
||||||
|
for (wxXmlNode *node = doc.GetRoot()->GetChildren(); node; node = node->GetNext())
|
||||||
|
{
|
||||||
|
if (node->GetName().IsSameAs(wxT("timetrack")))
|
||||||
|
{
|
||||||
|
AudacityMessageBox(
|
||||||
|
XO("The active project already has a time track and one was encountered in the project being imported, bypassing imported time track."),
|
||||||
|
XO("Project Import"),
|
||||||
|
wxOK | wxICON_EXCLAMATION | wxCENTRE,
|
||||||
|
&GetProjectFrame(*pProject));
|
||||||
|
|
||||||
|
root->RemoveChild(node);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find all waveblocks in all wavetracks
|
// Find all waveblocks in all wavetracks
|
||||||
for (wxXmlNode *node = doc.GetRoot()->GetChildren(); node; node = node->GetNext())
|
for (wxXmlNode *node = doc.GetRoot()->GetChildren(); node; node = node->GetNext())
|
||||||
{
|
{
|
||||||
|
@@ -1208,7 +1208,7 @@ bool ProjectFileManager::Import(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle AUP ("legacy project") files directly
|
// Handle AUP ("legacy project") files directly
|
||||||
if (fileName.AfterLast('.').IsSameAs(wxT("aup3"), false)) {
|
if (fileName.AfterLast('.').IsSameAs(wxT("aup"), false)) {
|
||||||
auto &history = ProjectHistory::Get( project );
|
auto &history = ProjectHistory::Get( project );
|
||||||
|
|
||||||
history.PushState(XO("Imported '%s'").Format( fileName ), XO("Import"));
|
history.PushState(XO("Imported '%s'").Format( fileName ), XO("Import"));
|
||||||
|
@@ -193,6 +193,8 @@ Importer::GetFileTypes( const FileNames::FileType &extraType )
|
|||||||
l.emplace_back(importPlugin->GetPluginFormatDescription(),
|
l.emplace_back(importPlugin->GetPluginFormatDescription(),
|
||||||
importPlugin->GetSupportedExtensions());
|
importPlugin->GetSupportedExtensions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
l.push_back({XO("AUP3 project files"), {wxT("aup3")}});
|
||||||
|
|
||||||
using ExtensionSet = std::unordered_set< FileExtension >;
|
using ExtensionSet = std::unordered_set< FileExtension >;
|
||||||
FileExtensions allList = extraType.extensions, newList;
|
FileExtensions allList = extraType.extensions, newList;
|
||||||
|
@@ -854,15 +854,17 @@ bool AUPImportFileHandle::HandleTimeTrack(XMLTagHandler *&handler)
|
|||||||
{
|
{
|
||||||
auto &tracks = TrackList::Get(mProject);
|
auto &tracks = TrackList::Get(mProject);
|
||||||
|
|
||||||
|
// Bypass this timetrack if the project already has one
|
||||||
|
// (See HandleTimeEnvelope and HandleControlPoint also)
|
||||||
if (*tracks.Any<TimeTrack>().begin())
|
if (*tracks.Any<TimeTrack>().begin())
|
||||||
{
|
{
|
||||||
AudacityMessageBox(
|
AudacityMessageBox(
|
||||||
XO("The active project already has a time track and one was encountered in the project being imported, bypassing time track in project file."),
|
XO("The active project already has a time track and one was encountered in the project being imported, bypassing imported time track."),
|
||||||
XO("Project Import"),
|
XO("Project Import"),
|
||||||
wxOK | wxICON_EXCLAMATION | wxCENTRE,
|
wxOK | wxICON_EXCLAMATION | wxCENTRE,
|
||||||
&GetProjectFrame(mProject));
|
&GetProjectFrame(mProject));
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto &trackFactory = TrackFactory::Get(mProject);
|
auto &trackFactory = TrackFactory::Get(mProject);
|
||||||
@@ -1020,7 +1022,7 @@ bool AUPImportFileHandle::HandleWaveClip(XMLTagHandler *&handler)
|
|||||||
|
|
||||||
mClip = static_cast<WaveClip *>(handler);
|
mClip = static_cast<WaveClip *>(handler);
|
||||||
|
|
||||||
return handler;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AUPImportFileHandle::HandleEnvelope(XMLTagHandler *&handler)
|
bool AUPImportFileHandle::HandleEnvelope(XMLTagHandler *&handler)
|
||||||
@@ -1029,9 +1031,14 @@ bool AUPImportFileHandle::HandleEnvelope(XMLTagHandler *&handler)
|
|||||||
|
|
||||||
if (mParentTag.IsSameAs(wxT("timetrack")))
|
if (mParentTag.IsSameAs(wxT("timetrack")))
|
||||||
{
|
{
|
||||||
TimeTrack *timetrack = static_cast<TimeTrack *>(node.handler);
|
// If an imported timetrack was bypassed, then we want to bypass the
|
||||||
|
// envelope as well. (See HandleTimeTrack and HandleControlPoint)
|
||||||
|
if (node.handler)
|
||||||
|
{
|
||||||
|
TimeTrack *timetrack = static_cast<TimeTrack *>(node.handler);
|
||||||
|
|
||||||
handler = timetrack->GetEnvelope();
|
handler = timetrack->GetEnvelope();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Earlier versions of Audacity had a single implied waveclip, so for
|
// Earlier versions of Audacity had a single implied waveclip, so for
|
||||||
// these versions, we get or create the only clip in the track.
|
// these versions, we get or create the only clip in the track.
|
||||||
@@ -1047,7 +1054,7 @@ bool AUPImportFileHandle::HandleEnvelope(XMLTagHandler *&handler)
|
|||||||
handler = waveclip->GetEnvelope();
|
handler = waveclip->GetEnvelope();
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AUPImportFileHandle::HandleControlPoint(XMLTagHandler *&handler)
|
bool AUPImportFileHandle::HandleControlPoint(XMLTagHandler *&handler)
|
||||||
@@ -1056,12 +1063,17 @@ bool AUPImportFileHandle::HandleControlPoint(XMLTagHandler *&handler)
|
|||||||
|
|
||||||
if (mParentTag.IsSameAs(wxT("envelope")))
|
if (mParentTag.IsSameAs(wxT("envelope")))
|
||||||
{
|
{
|
||||||
Envelope *envelope = static_cast<Envelope *>(node.handler);
|
// If an imported timetrack was bypassed, then we want to bypass the
|
||||||
|
// control points as well. (See HandleTimeTrack and HandleEnvelope)
|
||||||
|
if (node.handler)
|
||||||
|
{
|
||||||
|
Envelope *envelope = static_cast<Envelope *>(node.handler);
|
||||||
|
|
||||||
handler = envelope->HandleXMLChild(mCurrentTag);
|
handler = envelope->HandleXMLChild(mCurrentTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AUPImportFileHandle::HandleSequence(XMLTagHandler *&handler)
|
bool AUPImportFileHandle::HandleSequence(XMLTagHandler *&handler)
|
||||||
|
Reference in New Issue
Block a user