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

Never permit import of MIDI as audio...

... It was seen to happen, at least for some MIDI files on Windows, because
the FFmpeg library may render them without reporting an error, but the rendering
was really bad!
This commit is contained in:
Paul Licameli
2017-07-19 21:01:18 -04:00
parent f725e937a4
commit cfab325af2

View File

@@ -340,6 +340,15 @@ bool Importer::Import(const wxString &fName,
wxString extension = fName.AfterLast(wxT('.')); wxString extension = fName.AfterLast(wxT('.'));
// 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 ((extension.IsSameAs(wxT("midi"), false)) || (extension.IsSameAs(wxT("mid"), false))) {
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.c_str());
return false;
}
#endif
using ImportPluginPtrs = std::vector< ImportPlugin* >; using ImportPluginPtrs = std::vector< ImportPlugin* >;
// This list is used to call plugins in correct order // This list is used to call plugins in correct order
@@ -562,14 +571,6 @@ bool Importer::Import(const wxString &fName,
/* warnings for unsupported data types */ /* warnings for unsupported data types */
#ifdef USE_MIDI
// MIDI files must be imported, not opened
if ((extension.IsSameAs(wxT("midi"), false))||(extension.IsSameAs(wxT("mid"), false))) {
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.c_str());
return false;
}
#endif
if (compatiblePlugins.empty()) if (compatiblePlugins.empty())
{ {
// if someone has sent us a .cda file, send them away // if someone has sent us a .cda file, send them away