mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +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:
parent
5bc3ae659c
commit
176eb49a1e
@ -380,13 +380,6 @@ sqlite3 *ProjectFileIO::OpenDB(FilePath fileName)
|
||||
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())
|
||||
{
|
||||
CloseDB();
|
||||
@ -1480,6 +1473,13 @@ bool ProjectFileIO::WriteDoc(const char *table,
|
||||
// IDs.
|
||||
bool ProjectFileIO::ImportProject(const FilePath &fileName)
|
||||
{
|
||||
// Get access to the active tracklist
|
||||
auto pProject = mpProject.lock();
|
||||
if (!pProject)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
bool restore = true;
|
||||
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
|
||||
for (wxXmlNode *node = doc.GetRoot()->GetChildren(); node; node = node->GetNext())
|
||||
{
|
||||
|
@ -1208,7 +1208,7 @@ bool ProjectFileManager::Import(
|
||||
}
|
||||
|
||||
// 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 );
|
||||
|
||||
history.PushState(XO("Imported '%s'").Format( fileName ), XO("Import"));
|
||||
|
@ -193,6 +193,8 @@ Importer::GetFileTypes( const FileNames::FileType &extraType )
|
||||
l.emplace_back(importPlugin->GetPluginFormatDescription(),
|
||||
importPlugin->GetSupportedExtensions());
|
||||
}
|
||||
|
||||
l.push_back({XO("AUP3 project files"), {wxT("aup3")}});
|
||||
|
||||
using ExtensionSet = std::unordered_set< FileExtension >;
|
||||
FileExtensions allList = extraType.extensions, newList;
|
||||
|
@ -854,15 +854,17 @@ bool AUPImportFileHandle::HandleTimeTrack(XMLTagHandler *&handler)
|
||||
{
|
||||
auto &tracks = TrackList::Get(mProject);
|
||||
|
||||
// Bypass this timetrack if the project already has one
|
||||
// (See HandleTimeEnvelope and HandleControlPoint also)
|
||||
if (*tracks.Any<TimeTrack>().begin())
|
||||
{
|
||||
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"),
|
||||
wxOK | wxICON_EXCLAMATION | wxCENTRE,
|
||||
&GetProjectFrame(mProject));
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto &trackFactory = TrackFactory::Get(mProject);
|
||||
@ -1020,7 +1022,7 @@ bool AUPImportFileHandle::HandleWaveClip(XMLTagHandler *&handler)
|
||||
|
||||
mClip = static_cast<WaveClip *>(handler);
|
||||
|
||||
return handler;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AUPImportFileHandle::HandleEnvelope(XMLTagHandler *&handler)
|
||||
@ -1029,9 +1031,14 @@ bool AUPImportFileHandle::HandleEnvelope(XMLTagHandler *&handler)
|
||||
|
||||
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
|
||||
// these versions, we get or create the only clip in the track.
|
||||
@ -1047,7 +1054,7 @@ bool AUPImportFileHandle::HandleEnvelope(XMLTagHandler *&handler)
|
||||
handler = waveclip->GetEnvelope();
|
||||
}
|
||||
|
||||
return handler;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AUPImportFileHandle::HandleControlPoint(XMLTagHandler *&handler)
|
||||
@ -1056,12 +1063,17 @@ bool AUPImportFileHandle::HandleControlPoint(XMLTagHandler *&handler)
|
||||
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user