mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02:00
Import.cpp does not depend on subclasses of ImportPlugin...
... freeing 15 files from the big strongly connected component: ImportFFmpeg & ODDecodeFFMpegTask (still in a cycle of two) ImportFLAC ImportGStreamer ImportLOF ImportMIDI ImportMP3 ImportOGG ImportPCM ImportQT ProjectFileManager ProjectFSCK ProjectManager ProjectSelectionManager ODDecodeFlacTask And eight header files in src/import are deleted. This breaks a lot of cycles because Import, which is still in the big component, no longer includes ImportLOF, which recursively uses ProjectManager. A registration system for the subclasses of ImportFileHandle allows that recursion without the cyclic compilation dependencies.
This commit is contained in:
@@ -38,6 +38,8 @@ and ImportLOF.cpp.
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
#include "Import.h"
|
||||
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <wx/textctrl.h>
|
||||
@@ -51,14 +53,6 @@ and ImportLOF.cpp.
|
||||
#include "../Project.h"
|
||||
#include "../WaveTrack.h"
|
||||
|
||||
#include "ImportPCM.h"
|
||||
#include "ImportMP3.h"
|
||||
#include "ImportOGG.h"
|
||||
#include "ImportQT.h"
|
||||
#include "ImportLOF.h"
|
||||
#include "ImportFLAC.h"
|
||||
#include "ImportFFmpeg.h"
|
||||
#include "ImportGStreamer.h"
|
||||
#include "../Prefs.h"
|
||||
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
@@ -83,30 +77,52 @@ Importer::~Importer()
|
||||
{
|
||||
}
|
||||
|
||||
ImportPluginList &Importer::sImportPluginList()
|
||||
{
|
||||
static ImportPluginList theList;
|
||||
return theList;
|
||||
}
|
||||
|
||||
Importer::RegisteredImportPlugin::RegisteredImportPlugin(
|
||||
std::unique_ptr<ImportPlugin> pPlugin )
|
||||
{
|
||||
if ( pPlugin )
|
||||
sImportPluginList().emplace_back( std::move( pPlugin ) );
|
||||
}
|
||||
|
||||
UnusableImportPluginList &Importer::sUnusableImportPluginList()
|
||||
{
|
||||
static UnusableImportPluginList theList;
|
||||
return theList;
|
||||
}
|
||||
|
||||
Importer::RegisteredUnusableImportPlugin::RegisteredUnusableImportPlugin(
|
||||
std::unique_ptr<UnusableImportPlugin> pPlugin )
|
||||
{
|
||||
if ( pPlugin )
|
||||
sUnusableImportPluginList().emplace_back( std::move( pPlugin ) );
|
||||
}
|
||||
|
||||
bool Importer::Initialize()
|
||||
{
|
||||
ImportPluginList{}.swap(mImportPluginList);
|
||||
UnusableImportPluginList{}.swap(mUnusableImportPluginList);
|
||||
ExtImportItems{}.swap(mExtImportItems);
|
||||
|
||||
// build the list of import plugin and/or unusableImporters.
|
||||
// order is significant. If none match, they will all be tried
|
||||
// in the order defined here.
|
||||
GetPCMImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
GetOGGImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
GetFLACImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
GetMP3ImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
GetLOFImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
|
||||
#if defined(USE_FFMPEG)
|
||||
GetFFmpegImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
#endif
|
||||
#ifdef USE_QUICKTIME
|
||||
GetQTImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
#endif
|
||||
#if defined(USE_GSTREAMER)
|
||||
GetGStreamerImportPlugin(mImportPluginList, mUnusableImportPluginList);
|
||||
#endif
|
||||
// They were pushed on the array at static initialization time in an
|
||||
// unspecified sequence. Sort according to the sequence numbers they
|
||||
// report to make the order determinate.
|
||||
auto &list = sImportPluginList();
|
||||
std::sort( list.begin(), list.end(),
|
||||
[]( const ImportPluginList::value_type &a,
|
||||
const ImportPluginList::value_type &b ){
|
||||
return a->SequenceNumber() < b->SequenceNumber();
|
||||
}
|
||||
);
|
||||
|
||||
// Ordering of the unusable plugin list is not important.
|
||||
|
||||
ExtImportItems{}.swap(mExtImportItems);
|
||||
|
||||
ReadImportItems();
|
||||
|
||||
@@ -116,15 +132,13 @@ bool Importer::Initialize()
|
||||
bool Importer::Terminate()
|
||||
{
|
||||
WriteImportItems();
|
||||
ImportPluginList{}.swap( mImportPluginList );
|
||||
UnusableImportPluginList{}.swap( mUnusableImportPluginList );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Importer::GetSupportedImportFormats(FormatList *formatList)
|
||||
{
|
||||
for(const auto &importPlugin : mImportPluginList)
|
||||
for(const auto &importPlugin : sImportPluginList())
|
||||
{
|
||||
formatList->emplace_back(importPlugin->GetPluginFormatDescription(),
|
||||
importPlugin->GetSupportedExtensions());
|
||||
@@ -206,7 +220,7 @@ void Importer::ReadImportItems()
|
||||
for (size_t i = 0; i < new_item->filters.size(); i++)
|
||||
{
|
||||
bool found = false;
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
for (const auto &importPlugin : sImportPluginList())
|
||||
{
|
||||
if (importPlugin->GetPluginStringID() == new_item->filters[i])
|
||||
{
|
||||
@@ -220,7 +234,7 @@ void Importer::ReadImportItems()
|
||||
new_item->filter_objects.push_back(nullptr);
|
||||
}
|
||||
/* Find all filter objects that are not present in the filter list */
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
for (const auto &importPlugin : sImportPluginList())
|
||||
{
|
||||
bool found = false;
|
||||
for (size_t i = 0; i < new_item->filter_objects.size(); i++)
|
||||
@@ -317,7 +331,7 @@ std::unique_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
|
||||
new_item->extensions.push_back(wxT("*"));
|
||||
new_item->mime_types.push_back(wxT("*"));
|
||||
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
for (const auto &importPlugin : sImportPluginList())
|
||||
{
|
||||
new_item->filters.push_back(importPlugin->GetPluginStringID());
|
||||
new_item->filter_objects.push_back(importPlugin.get());
|
||||
@@ -371,7 +385,7 @@ bool Importer::Import(const FilePath &fName,
|
||||
|
||||
if (usersSelectionOverrides)
|
||||
{
|
||||
for (const auto &plugin : mImportPluginList)
|
||||
for (const auto &plugin : sImportPluginList())
|
||||
{
|
||||
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
||||
{
|
||||
@@ -441,16 +455,16 @@ bool Importer::Import(const FilePath &fName,
|
||||
|
||||
// Add all plugins that support the extension
|
||||
|
||||
// Here we rely on the fact that the first plugin in mImportPluginList is libsndfile.
|
||||
// Here we rely on the fact that the first plugin in sImportPluginList() is libsndfile.
|
||||
// We want to save this for later insertion ahead of libmad, if libmad supports the extension.
|
||||
// The order of plugins in mImportPluginList is determined by the Importer constructor alone and
|
||||
// The order of plugins in sImportPluginList() is determined by the Importer constructor alone and
|
||||
// is not changed by user selection overrides or any other mechanism, but we include an assert
|
||||
// in case subsequent code revisions to the constructor should break this assumption that
|
||||
// libsndfile is first.
|
||||
ImportPlugin *libsndfilePlugin = mImportPluginList.begin()->get();
|
||||
ImportPlugin *libsndfilePlugin = sImportPluginList().begin()->get();
|
||||
wxASSERT(libsndfilePlugin->GetPluginStringID() == wxT("libsndfile"));
|
||||
|
||||
for (const auto &plugin : mImportPluginList)
|
||||
for (const auto &plugin : sImportPluginList())
|
||||
{
|
||||
// Make sure its not already in the list
|
||||
if (importPlugins.end() ==
|
||||
@@ -486,7 +500,7 @@ bool Importer::Import(const FilePath &fName,
|
||||
// Otherwise, if FFmpeg (libav) has not been installed, libmad will still be there near the
|
||||
// end of the preference list importPlugins, where it will claim success importing FFmpeg file
|
||||
// formats unsuitable for it, and produce distorted results.
|
||||
for (const auto &plugin : mImportPluginList)
|
||||
for (const auto &plugin : sImportPluginList())
|
||||
{
|
||||
if (!(plugin->GetPluginStringID() == wxT("libmad")))
|
||||
{
|
||||
@@ -565,7 +579,7 @@ bool Importer::Import(const FilePath &fName,
|
||||
// None of our plugins can handle this file. It might be that
|
||||
// Audacity supports this format, but support was not compiled in.
|
||||
// If so, notify the user of this fact
|
||||
for (const auto &unusableImportPlugin : mUnusableImportPluginList)
|
||||
for (const auto &unusableImportPlugin : sUnusableImportPluginList())
|
||||
{
|
||||
if( unusableImportPlugin->SupportsExtension(extension) )
|
||||
{
|
||||
|
@@ -88,6 +88,19 @@ class ExtImportItem
|
||||
|
||||
class Importer {
|
||||
public:
|
||||
|
||||
// Objects of this type are statically constructed in files implementing
|
||||
// subclasses of ImportPlugin
|
||||
struct RegisteredImportPlugin{
|
||||
RegisteredImportPlugin( std::unique_ptr<ImportPlugin> );
|
||||
};
|
||||
|
||||
// Objects of this type are statically constructed in files, to identify
|
||||
// unsupported import formats; typically in a conditional compilation
|
||||
struct RegisteredUnusableImportPlugin{
|
||||
RegisteredUnusableImportPlugin( std::unique_ptr<UnusableImportPlugin> );
|
||||
};
|
||||
|
||||
Importer();
|
||||
~Importer();
|
||||
|
||||
@@ -148,8 +161,8 @@ private:
|
||||
static Importer mInstance;
|
||||
|
||||
ExtImportItems mExtImportItems;
|
||||
ImportPluginList mImportPluginList;
|
||||
UnusableImportPluginList mUnusableImportPluginList;
|
||||
static ImportPluginList &sImportPluginList();
|
||||
static UnusableImportPluginList &sUnusableImportPluginList();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@@ -21,7 +21,6 @@ Licensed under the GNU General Public License v2 or later
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h" // needed before FFmpeg.h // for USE_* macros
|
||||
#include "ImportFFmpeg.h"
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
@@ -152,6 +151,7 @@ static const auto exts = {
|
||||
};
|
||||
|
||||
// all the includes live here by default
|
||||
#include "Import.h"
|
||||
#include "../Tags.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "ImportPlugin.h"
|
||||
@@ -182,6 +182,8 @@ public:
|
||||
|
||||
///! Probes the file and opens it if appropriate
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
};
|
||||
|
||||
///! Does acual import, returned by FFmpegImportPlugin::Open
|
||||
@@ -282,13 +284,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
void GetFFmpegImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList.push_back( std::make_unique<FFmpegImportPlugin>() );
|
||||
}
|
||||
|
||||
|
||||
wxString FFmpegImportPlugin::GetPluginFormatDescription()
|
||||
{
|
||||
return DESC;
|
||||
@@ -336,6 +331,15 @@ std::unique_ptr<ImportFileHandle> FFmpegImportPlugin::Open(const FilePath &filen
|
||||
return std::move(handle);
|
||||
}
|
||||
|
||||
unsigned FFmpegImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 60;
|
||||
}
|
||||
|
||||
static Importer::RegisteredImportPlugin registered{
|
||||
std::make_unique< FFmpegImportPlugin >()
|
||||
};
|
||||
|
||||
|
||||
FFmpegImportFileHandle::FFmpegImportFileHandle(const FilePath & name)
|
||||
: ImportFileHandle(name)
|
||||
|
@@ -1,19 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportFFmpeg.h
|
||||
|
||||
LRN
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_FFMPEG__
|
||||
#define __AUDACITY_IMPORT_FFMPEG__
|
||||
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetFFmpegImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
@@ -23,7 +23,6 @@
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
#include "ImportFLAC.h"
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
@@ -39,6 +38,7 @@
|
||||
#include <wx/intl.h> // needed for _("translated stings") even if we
|
||||
// don't have libflac available
|
||||
|
||||
#include "Import.h"
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
#include "../Tags.h"
|
||||
@@ -56,14 +56,10 @@ static const auto exts = {
|
||||
|
||||
#ifndef USE_LIBFLAC
|
||||
|
||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
unusableImportPluginList.push_back(
|
||||
static Importer::RegisteredUnusableImportPlugin registered{
|
||||
std::make_unique<UnusableImportPlugin>
|
||||
(DESC, FileExtensions( exts.begin(), exts.end() ) )
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#else /* USE_LIBFLAC */
|
||||
|
||||
@@ -138,6 +134,8 @@ class FLACImportPlugin final : public ImportPlugin
|
||||
wxString GetPluginStringID() override { return wxT("libflac"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -285,14 +283,6 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra
|
||||
}, MakeSimpleGuard(FLAC__STREAM_DECODER_WRITE_STATUS_ABORT) );
|
||||
}
|
||||
|
||||
|
||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList.push_back( std::make_unique<FLACImportPlugin>() );
|
||||
}
|
||||
|
||||
|
||||
wxString FLACImportPlugin::GetPluginFormatDescription()
|
||||
{
|
||||
return DESC;
|
||||
@@ -340,6 +330,14 @@ std::unique_ptr<ImportFileHandle> FLACImportPlugin::Open(const FilePath &filenam
|
||||
return std::move(handle);
|
||||
}
|
||||
|
||||
unsigned FLACImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
static Importer::RegisteredImportPlugin registered{
|
||||
std::make_unique< FLACImportPlugin >()
|
||||
};
|
||||
|
||||
FLACImportFileHandle::FLACImportFileHandle(const FilePath & name)
|
||||
: ImportFileHandle(name),
|
||||
|
@@ -1,20 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportFLAC.h
|
||||
|
||||
Sami Liedes
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_FLAC__
|
||||
#define __AUDACITY_IMPORT_FLAC__
|
||||
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
|
||||
#endif
|
@@ -248,6 +248,8 @@ public:
|
||||
|
||||
///! Probes the file and opens it if appropriate
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
@@ -256,10 +258,9 @@ public:
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Instantiate GStreamerImportPlugin and add to the list of known importers
|
||||
void
|
||||
GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
|
||||
static
|
||||
Importer::RegisteredImportPlugin{ []() -> std::unique_ptr< ImportPlugin > {
|
||||
wxLogMessage(_TS("Audacity is built against GStreamer version %d.%d.%d-%d"),
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
@@ -281,7 +282,7 @@ GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
||||
wxLogMessage(wxT("Failed to initialize GStreamer. Error %d: %s"),
|
||||
error.get()->code,
|
||||
wxString::FromUTF8(error.get()->message));
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
|
||||
guint major, minor, micro, nano;
|
||||
@@ -297,11 +298,11 @@ GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
||||
|
||||
// No supported extensions...no gstreamer plugins installed
|
||||
if (plug->GetSupportedExtensions().size() == 0)
|
||||
return;
|
||||
return {};
|
||||
|
||||
// Add to list of importers
|
||||
importPluginList.push_back( std::move(plug) );
|
||||
}
|
||||
return std::move(plug);
|
||||
}() } registered;
|
||||
|
||||
// ============================================================================
|
||||
// GStreamerImportPlugin Class
|
||||
@@ -1145,6 +1146,11 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
return updateResult;
|
||||
}
|
||||
|
||||
unsigned GStreamerImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 80;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Message handlers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1,19 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportGStreamer.h
|
||||
|
||||
LRN
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_GSTREAMER__
|
||||
#define __AUDACITY_IMPORT_GSTREAMER__
|
||||
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
void GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
@@ -70,7 +70,6 @@
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
#include "ImportLOF.h"
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/utils.h>
|
||||
@@ -84,6 +83,7 @@
|
||||
#include "../FileNames.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "ImportPlugin.h"
|
||||
#include "Import.h"
|
||||
#include "../Menus.h"
|
||||
#include "../NoteTrack.h"
|
||||
#include "../Project.h"
|
||||
@@ -116,6 +116,8 @@ public:
|
||||
wxString GetPluginStringID() override { return wxT("lof"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -171,12 +173,6 @@ LOFImportFileHandle::LOFImportFileHandle
|
||||
{
|
||||
}
|
||||
|
||||
void GetLOFImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList.push_back( std::make_unique<LOFImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString LOFImportPlugin::GetPluginFormatDescription()
|
||||
{
|
||||
return DESC;
|
||||
@@ -272,6 +268,15 @@ ProgressResult LOFImportFileHandle::Import(
|
||||
return ProgressResult::Success;
|
||||
}
|
||||
|
||||
unsigned LOFImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
|
||||
static Importer::RegisteredImportPlugin registered{
|
||||
std::make_unique< LOFImportPlugin >()
|
||||
};
|
||||
|
||||
/** @brief Processes a single line from a LOF text file, doing whatever is
|
||||
* indicated on the line.
|
||||
*
|
||||
|
@@ -1,62 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportLOF.h
|
||||
|
||||
David I. Murray
|
||||
|
||||
Supports the opening of ".lof" files which are text files that contain
|
||||
a list of individual files to open in audacity in specific formats.
|
||||
|
||||
(In BNF) The syntax for an LOF file, denoted by <lof>:
|
||||
|
||||
<lof> ::= [<window> | <file> | <#>]*
|
||||
<window> ::= window [<window-parameter>]* <newline>
|
||||
<window-parameter> ::= offset <time> | duration <time>
|
||||
<time> ::= [<digit>]+ [ . [<digit>]* ]
|
||||
<file> ::= file [<file-parameter>]* <newline>
|
||||
<file-parameter> ::= offset <time>
|
||||
<#> ::= <comment> <newline>
|
||||
|
||||
EXAMPLE LOF file:
|
||||
|
||||
# everything following the hash character is ignored
|
||||
window # an initial window command is implicit and optional
|
||||
file "C:\folder1\sample1.wav" # sample1.wav is displayed
|
||||
file "C:\sample2.wav" offset 5 # sample2 is displayed with a 5s offset
|
||||
File "C:\sample3.wav" # sample3 is displayed with no offset
|
||||
window offset 5 duration 10 # open a NEW window, zoom to display
|
||||
# 10 seconds total starting at 5 (ending at 15) seconds
|
||||
file "C:\sample3.wav" offset 2.5
|
||||
|
||||
SEMANTICS:
|
||||
|
||||
There are two commands: "window" creates a NEW window, and "file"
|
||||
appends a track to the current window and displays the file there. The
|
||||
first file is always placed in a NEW window, whether or not an initial
|
||||
"window" command is given.
|
||||
|
||||
Commands have optional keyword parameters that may be listed in any
|
||||
order. A parameter should only occur once per command. The "offset"
|
||||
parameter specifies a time offset. For windows, this is the leftmost
|
||||
time displayed in the window. For files, the offset is an amount by
|
||||
which the file is shifted in time before display (only enabled for audio;
|
||||
not midi). The offset is specified as an integer or decimal number of
|
||||
seconds, and the default value is zero.
|
||||
|
||||
Windows may also have a "duration" parameter, which specifies how much
|
||||
time should be displayed in the window. The default duration is equal
|
||||
to the duration of the longest track currently displayed.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_LOF__
|
||||
#define __AUDACITY_IMPORT_LOF__
|
||||
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetLOFImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
@@ -27,7 +27,6 @@
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
#include "ImportMP3.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
@@ -40,6 +39,7 @@
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include "../Prefs.h"
|
||||
#include "Import.h"
|
||||
#include "ImportPlugin.h"
|
||||
#include "../Tags.h"
|
||||
#include "../prefs/QualityPrefs.h"
|
||||
@@ -55,14 +55,10 @@ static const auto exts = {
|
||||
|
||||
#ifndef USE_LIBMAD
|
||||
|
||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
unusableImportPluginList.push_back(
|
||||
static Importer::RegisteredUnusableImportPlugin registered{
|
||||
std::make_unique<UnusableImportPlugin>
|
||||
(DESC, FileExtensions( exts.begin(), exts.end() ) )
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#else /* USE_LIBMAD */
|
||||
|
||||
@@ -120,6 +116,8 @@ public:
|
||||
wxString GetPluginStringID() override { return wxT("libmad"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
};
|
||||
|
||||
class MP3ImportFileHandle final : public ImportFileHandle
|
||||
@@ -157,12 +155,6 @@ private:
|
||||
mad_decoder mDecoder;
|
||||
};
|
||||
|
||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList.push_back( std::make_unique<MP3ImportPlugin>() );
|
||||
}
|
||||
|
||||
/* The MAD callbacks */
|
||||
enum mad_flow input_cb(void *_data, struct mad_stream *stream);
|
||||
enum mad_flow output_cb(void *_data,
|
||||
@@ -263,6 +255,15 @@ ProgressResult MP3ImportFileHandle::Import(
|
||||
return privateData.updateResult;
|
||||
}
|
||||
|
||||
unsigned MP3ImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 40;
|
||||
}
|
||||
|
||||
static Importer::RegisteredImportPlugin registered{
|
||||
std::make_unique< MP3ImportPlugin >()
|
||||
};
|
||||
|
||||
MP3ImportFileHandle::~MP3ImportFileHandle()
|
||||
{
|
||||
}
|
||||
|
@@ -1,19 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportMP3.h
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_MP3__
|
||||
#define __AUDACITY_IMPORT_MP3__
|
||||
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
@@ -29,7 +29,6 @@
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
#include "ImportOGG.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
@@ -39,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include <wx/intl.h>
|
||||
#include "Import.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Tags.h"
|
||||
#include "../prefs/QualityPrefs.h"
|
||||
@@ -55,14 +55,10 @@ static const auto exts = {
|
||||
/* BPF There is no real reason to compile without LIBVORBIS, but if you do, you will needs this header */
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
unusableImportPluginList.push_back(
|
||||
static Importer::RegisteredUnusableImportPlugin registered{
|
||||
std::make_unique<UnusableImportPlugin>
|
||||
(DESC, FileExtensions( exts.begin(), exts.end() ) )
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#else /* USE_LIBVORBIS */
|
||||
|
||||
@@ -94,6 +90,8 @@ public:
|
||||
wxString GetPluginStringID() override { return wxT("liboggvorbis"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -159,11 +157,6 @@ private:
|
||||
sampleFormat mFormat;
|
||||
};
|
||||
|
||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList.push_back( std::make_unique<OggImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString OggImportPlugin::GetPluginFormatDescription()
|
||||
{
|
||||
@@ -216,6 +209,15 @@ std::unique_ptr<ImportFileHandle> OggImportPlugin::Open(const FilePath &filename
|
||||
return std::make_unique<OggImportFileHandle>(filename, std::move(file), std::move(vorbisFile));
|
||||
}
|
||||
|
||||
unsigned OggImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
static Importer::RegisteredImportPlugin registered{
|
||||
std::make_unique< OggImportPlugin >()
|
||||
};
|
||||
|
||||
wxString OggImportFileHandle::GetFileDescription()
|
||||
{
|
||||
return DESC;
|
||||
|
@@ -1,19 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportOGG.h
|
||||
|
||||
Joshua Haberman
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_OGG__
|
||||
#define __AUDACITY_IMPORT_OGG__
|
||||
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
@@ -20,8 +20,8 @@
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
#include "ImportPCM.h"
|
||||
|
||||
#include "Import.h"
|
||||
#include "../Tags.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
wxString GetPluginStringID() override { return wxT("libsndfile"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -115,12 +117,6 @@ private:
|
||||
sampleFormat mFormat;
|
||||
};
|
||||
|
||||
void GetPCMImportPlugin(ImportPluginList & importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList.push_back( std::make_unique<PCMImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString PCMImportPlugin::GetPluginFormatDescription()
|
||||
{
|
||||
return DESC;
|
||||
@@ -190,6 +186,15 @@ std::unique_ptr<ImportFileHandle> PCMImportPlugin::Open(const FilePath &filename
|
||||
return std::make_unique<PCMImportFileHandle>(filename, std::move(file), info);
|
||||
}
|
||||
|
||||
unsigned PCMImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
static Importer::RegisteredImportPlugin registered{
|
||||
std::make_unique< PCMImportPlugin >()
|
||||
};
|
||||
|
||||
PCMImportFileHandle::PCMImportFileHandle(const FilePath &name,
|
||||
SFFile &&file, SF_INFO info)
|
||||
: ImportFileHandle(name),
|
||||
|
@@ -1,20 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportPCM.h
|
||||
|
||||
Dominic Mazzoni
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_PCM__
|
||||
#define __AUDACITY_IMPORT_PCM__
|
||||
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetPCMImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
|
||||
#endif
|
@@ -40,16 +40,6 @@ been compiled or are not available in this version of Audacity. Has
|
||||
enough information to identify the file extensions that would be used,
|
||||
but little else.
|
||||
|
||||
*//****************************************************************//**
|
||||
|
||||
\class ImportPluginList
|
||||
\brief An ImportPlugin list.
|
||||
|
||||
*//****************************************************************//**
|
||||
|
||||
\class UnusableImportPluginList
|
||||
\brief An UnusableImportPlugin list.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORTER__
|
||||
@@ -104,6 +94,8 @@ public:
|
||||
// state.
|
||||
virtual std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) = 0;
|
||||
|
||||
virtual unsigned SequenceNumber() const = 0;
|
||||
|
||||
virtual ~ImportPlugin() { }
|
||||
|
||||
protected:
|
||||
|
@@ -14,8 +14,8 @@
|
||||
**********************************************************************/
|
||||
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
#include "ImportQT.h"
|
||||
|
||||
#include "Import.h"
|
||||
#include "ImportPlugin.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
@@ -38,19 +38,17 @@ static const auto exts = {
|
||||
|
||||
#ifndef USE_QUICKTIME
|
||||
|
||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
// Bug 2068: misleading error message about QuickTime
|
||||
// Bug 2068: misleading error message about QuickTime
|
||||
// In 64 bit versions we cannot compile in (obsolete) QuickTime
|
||||
// So don't register the QuickTime extensions, so ensuring we never report
|
||||
// "This version of Audacity was not compiled with QuickTime files support"
|
||||
// When attempting to import MP4 files.
|
||||
// unusableImportPluginList.push_back(
|
||||
// std::make_unique<UnusableImportPlugin>(DESC,
|
||||
// FileExtensions( exts.begin(), exts.end() ) )
|
||||
// );
|
||||
}
|
||||
/*
|
||||
static Importer::RegisteredUnusableImportPlugin registered{
|
||||
std::make_unique<UnusableImportPlugin>(DESC,
|
||||
FileExtensions( exts.begin(), exts.end() ) )
|
||||
};
|
||||
*/
|
||||
|
||||
#else /* USE_QUICKTIME */
|
||||
|
||||
@@ -126,6 +124,8 @@ class QTImportPlugin final : public ImportPlugin
|
||||
wxString GetPluginFormatDescription();
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString & Filename) override;
|
||||
|
||||
unsigned SequenceNumber() const override;
|
||||
|
||||
private:
|
||||
bool mInitialized;
|
||||
};
|
||||
@@ -175,12 +175,6 @@ class QTImportFileHandle final : public ImportFileHandle
|
||||
Movie mMovie;
|
||||
};
|
||||
|
||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
importPluginList.push_back( std::make_unique<QTImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString QTImportPlugin::GetPluginFormatDescription()
|
||||
{
|
||||
return DESC;
|
||||
@@ -226,6 +220,15 @@ std::unique_ptr<ImportFileHandle> QTImportPlugin::Open(const wxString & Filename
|
||||
return std::make_unique<QTImportFileHandle>(Filename, theMovie);
|
||||
}
|
||||
|
||||
unsigned QTImportPlugin::SequenceNumber() const
|
||||
{
|
||||
return 70;
|
||||
}
|
||||
|
||||
static Importer::RegisteredImportPlugin registered{
|
||||
std::make_unique< QTImportPlugin >()
|
||||
};
|
||||
|
||||
|
||||
wxString QTImportFileHandle::GetFileDescription()
|
||||
{
|
||||
|
@@ -1,19 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ImportQT.h
|
||||
|
||||
Joshua Haberman
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_QT__
|
||||
#define __AUDACITY_IMPORT_QT__
|
||||
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user