1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Fewer inclusions of AudioIO.h and Import.h

This commit is contained in:
Paul Licameli 2019-06-06 12:48:39 -04:00
parent 6f3342a895
commit 0b85251885
18 changed files with 17 additions and 31 deletions

View File

@ -521,6 +521,15 @@ bool FileNames::IsTempDirectoryNameOK( const FilePath & Name )
return !(NameCanonical.StartsWith( BadPath ));
}
bool FileNames::IsMidi(const FilePath &fName)
{
const auto extension = fName.AfterLast(wxT('.'));
return
extension.IsSameAs(wxT("gro"), false) ||
extension.IsSameAs(wxT("midi"), false) ||
extension.IsSameAs(wxT("mid"), false);
}
static FilePaths sAudacityPathList;
const FilePaths &FileNames::AudacityPathList()

View File

@ -41,6 +41,8 @@ public:
static void SetDefaultTempDir( const FilePath &tempDir );
static bool IsTempDirectoryNameOK( const FilePath & Name );
static bool IsMidi(const FilePath &fName);
/** \brief A list of directories that should be searched for Audacity files
* (plug-ins, help files, etc.).
*

View File

@ -56,7 +56,6 @@ for drawing different aspects of the label and its text box.
#include <wx/tokenzr.h>
#include <wx/utils.h>
#include "AudioIO.h"
#include "DirManager.h"
#include "Prefs.h"
#include "RefreshCode.h"

View File

@ -333,7 +333,7 @@ public:
for (const auto &name : sortednames) {
#ifdef USE_MIDI
if (Importer::IsMidi(name))
if (FileNames::IsMidi(name))
FileActions::DoImportMIDI(mProject, name);
else
#endif
@ -1292,7 +1292,7 @@ void ProjectManager::OpenFile(const FilePath &fileNameArg, bool addtohistory)
{
#ifdef USE_MIDI
if (Importer::IsMidi(fileName))
if (FileNames::IsMidi(fileName))
FileActions::DoImportMIDI( &project, fileName );
else
#endif

View File

@ -51,7 +51,6 @@ Track classes.
#include "ProjectFileIORegistry.h"
#include "ProjectSettings.h"
#include "AudioIO.h"
#include "Prefs.h"
#include "ondemand/ODManager.h"

View File

@ -32,14 +32,11 @@ The summary is eventually computed and written to a file in a background thread.
#include "../FileFormats.h"
#include "../ondemand/ODManager.h"
#include "../AudioIO.h"
#include "NotYetAvailableException.h"
//#include <errno.h>
extern AudioIO *gAudioIO;
const int aheaderTagLen = 20;
char aheaderTag[aheaderTagLen + 1] = "AudacityBlockFile112";

View File

@ -46,6 +46,7 @@ and ImportLOF.cpp.
#include <wx/listbox.h>
#include <wx/log.h>
#include <wx/sizer.h> //for wxBoxSizer
#include "../FileNames.h"
#include "../ShuttleGui.h"
#include "../Project.h"
#include "../WaveTrack.h"
@ -325,15 +326,6 @@ std::unique_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
return new_item;
}
bool Importer::IsMidi(const FilePath &fName)
{
const auto extension = fName.AfterLast(wxT('.'));
return
extension.IsSameAs(wxT("gro"), false) ||
extension.IsSameAs(wxT("midi"), false) ||
extension.IsSameAs(wxT("mid"), false);
}
// returns number of tracks imported
bool Importer::Import(const FilePath &fName,
TrackFactory *trackFactory,
@ -349,7 +341,7 @@ bool Importer::Import(const FilePath &fName,
// Always refuse to import MIDI, even though the FFmpeg plugin pretends to know how (but makes very bad renderings)
#ifdef USE_MIDI
// MIDI files must be imported, not opened
if (IsMidi(fName)) {
if (FileNames::IsMidi(fName)) {
errorMessage.Printf(_("\"%s\" \nis a MIDI file, not an audio file. \nAudacity cannot open this type of file for playing, but you can\nedit it by clicking File > Import > MIDI."), fName);
return false;
}

View File

@ -137,8 +137,6 @@ public:
*/
std::unique_ptr<ExtImportItem> CreateDefaultImportItem();
static bool IsMidi(const FilePath &fName);
// if false, the import failed and errorMessage will be set.
bool Import(const FilePath &fName,
TrackFactory *trackFactory,

View File

@ -152,7 +152,6 @@ static const auto exts = {
};
// all the includes live here by default
#include "Import.h"
#include "../Tags.h"
#include "../WaveTrack.h"
#include "ImportPlugin.h"

View File

@ -39,7 +39,6 @@
#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"

View File

@ -48,7 +48,6 @@ Licensed under the GNU General Public License v2 or later
// all the includes live here by default
#include "../Tags.h"
#include "../WaveTrack.h"
#include "Import.h"
extern "C"
{

View File

@ -81,9 +81,9 @@
#ifdef USE_MIDI
#include "ImportMIDI.h"
#endif // USE_MIDI
#include "../FileNames.h"
#include "../WaveTrack.h"
#include "ImportPlugin.h"
#include "Import.h"
#include "../Menus.h"
#include "../NoteTrack.h"
#include "../Project.h"
@ -374,7 +374,7 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
#ifdef USE_MIDI
// If file is a midi
if (Importer::IsMidi(targetfile))
if (FileNames::IsMidi(targetfile))
{
mProject = FileActions::DoImportMIDI(mProject, targetfile);
}

View File

@ -40,7 +40,6 @@
#include <wx/intl.h>
#include "../Prefs.h"
#include "Import.h"
#include "ImportPlugin.h"
#include "../Tags.h"
#include "../prefs/QualityPrefs.h"

View File

@ -24,8 +24,6 @@ and sample size to help you importing data of an unknown format.
#include "../Audacity.h"
#include "ImportRaw.h"
#include "Import.h"
#include "../DirManager.h"
#include "../FileFormats.h"
#include "../Prefs.h"

View File

@ -36,7 +36,6 @@ other settings.
#include "portaudio.h"
#include "../AudioIO.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../DeviceManager.h"

View File

@ -49,7 +49,6 @@
#endif
#include "../AllThemeResources.h"
#include "../AudioIO.h"
#include "../ImageManipulation.h"
#include "../Menus.h"
#include "../Prefs.h"

View File

@ -34,7 +34,6 @@
#include <wx/gbsizer.h>
#include "../AllThemeResources.h"
#include "../AudioIO.h"
#include "../ProjectAudioIO.h"
#include "../widgets/Meter.h"

View File

@ -32,7 +32,6 @@
#include "../AdornedRulerPanel.h"
#include "../AllThemeResources.h"
#include "../AudioIO.h"
#include "../ImageManipulation.h"
#include "../Prefs.h"
#include "../UndoManager.h"