1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 08:38:39 +02:00

Steve's patch for "[Audacity-quality] Export commands in Chains - inconsistencies"

This commit is contained in:
v.audacity 2013-02-14 23:41:08 +00:00
parent cfc7ef4422
commit 6af101f15d

View File

@ -54,13 +54,13 @@ enum eCommandType { CtEffect, CtMenu, CtSpecial };
wxString SpecialCommands[] = { wxString SpecialCommands[] = {
wxT("NoAction"), wxT("NoAction"),
// wxT("Import"), // non-functioning // wxT("Import"), // non-functioning
wxT("SaveMP3_56k_before"), wxT("ExportMP3_56k_before"),
wxT("SaveMP3_56k_after"), wxT("ExportMP3_56k_after"),
wxT("StereoToMono"), wxT("StereoToMono"),
wxT("ExportFlac"), wxT("ExportFLAC"),
wxT("ExportMp3"), wxT("ExportMP3"),
wxT("ExportOgg"), wxT("ExportOgg"),
wxT("ExportWav") wxT("ExportWAV")
}; };
// end CLEANSPEECH remnant // end CLEANSPEECH remnant
@ -144,6 +144,18 @@ bool BatchCommands::ReadChain(const wxString & chain)
// Parse and clean // Parse and clean
wxString cmd = tf[i].Left(splitAt).Strip(wxString::both); wxString cmd = tf[i].Left(splitAt).Strip(wxString::both);
wxString parm = tf[i].Mid(splitAt + 1).Strip(wxString::trailing); wxString parm = tf[i].Mid(splitAt + 1).Strip(wxString::trailing);
// Backward compatibility for old Chain scripts
if (cmd == wxT("SaveMP3_56k_before"))
cmd = wxT("ExportMP3_56k_before");
if (cmd == wxT("SaveMP3_56k_after"))
cmd = wxT("ExportMP3_56k_after");
if (cmd == wxT("ExportFlac"))
cmd = wxT("ExportFLAC");
if (cmd == wxT("ExportMp3"))
cmd = wxT("ExportMP3");
if (cmd == wxT("ExportWav"))
cmd = wxT("ExportWAV");
// Add to lists // Add to lists
mCommandChain.Add(cmd); mCommandChain.Add(cmd);
@ -239,12 +251,12 @@ void BatchCommands::SetCleanSpeechChain()
/* i18n-hint: Effect name translations must agree with those used elsewhere, or batch won't find them */ /* i18n-hint: Effect name translations must agree with those used elsewhere, or batch won't find them */
AddToChain( wxT("StereoToMono") ); AddToChain( wxT("StereoToMono") );
AddToChain( wxT("Normalize") ); AddToChain( wxT("Normalize") );
AddToChain( wxT("SaveMP3_56k_before") ); AddToChain( wxT("ExportMP3_56k_before") );
AddToChain( wxT("NoiseRemoval") ); AddToChain( wxT("NoiseRemoval") );
AddToChain( wxT("TruncateSilence") ); AddToChain( wxT("TruncateSilence") );
AddToChain( wxT("Leveller") ); AddToChain( wxT("Leveller") );
AddToChain( wxT("Normalize") ); AddToChain( wxT("Normalize") );
AddToChain( wxT("ExportMp3") ); AddToChain( wxT("ExportMP3") );
} }
#endif // CLEANSPEECH #endif // CLEANSPEECH
@ -253,7 +265,7 @@ void BatchCommands::SetWavToMp3Chain() // a function per default chain? This is
ResetChain(); ResetChain();
AddToChain( wxT("Normalize") ); AddToChain( wxT("Normalize") );
AddToChain( wxT("ExportMp3") ); AddToChain( wxT("ExportMP3") );
} }
// Gets all commands that are valid for this mode. // Gets all commands that are valid for this mode.
@ -434,11 +446,11 @@ bool BatchCommands::ApplySpecialCommand(int iCommand, const wxString command,con
AudacityProject *project = GetActiveProject(); AudacityProject *project = GetActiveProject();
int numChannels = 1; //used to switch between mono and stereo export int numChannels = 1; //used to switch between mono and stereo export
if (IsMono()) { if (IsMono()) {
numChannels = 1; //export in mono numChannels = 1; //export in mono
} else { } else {
numChannels = 2; //export in stereo numChannels = 2; //export in stereo
} }
wxString filename; wxString filename;
@ -457,10 +469,10 @@ bool BatchCommands::ApplySpecialCommand(int iCommand, const wxString command,con
} else if (!mFileName.IsEmpty() && command == wxT("Import")) { } else if (!mFileName.IsEmpty() && command == wxT("Import")) {
// historically this was in use, now ignored if there // historically this was in use, now ignored if there
return true; return true;
} else if (command == wxT("SaveMP3_56k_before")) { } else if (command == wxT("ExportMP3_56k_before")) {
filename.Replace(wxT("cleaned/"), wxT("cleaned/MasterBefore_"), false); filename.Replace(wxT("cleaned/"), wxT("cleaned/MasterBefore_"), false);
return WriteMp3File(filename, 56); return WriteMp3File(filename, 56);
} else if (command == wxT("SaveMP3_56k_after")) { } else if (command == wxT("ExportMP3_56k_after")) {
filename.Replace(wxT("cleaned/"), wxT("cleaned/MasterAfter_"), false); filename.Replace(wxT("cleaned/"), wxT("cleaned/MasterAfter_"), false);
return WriteMp3File(filename, 56); return WriteMp3File(filename, 56);
} else if (command == wxT("StereoToMono")) { } else if (command == wxT("StereoToMono")) {
@ -471,9 +483,9 @@ bool BatchCommands::ApplySpecialCommand(int iCommand, const wxString command,con
} }
wxMessageBox(_("Stereo to Mono Effect not found")); wxMessageBox(_("Stereo to Mono Effect not found"));
return false; return false;
} else if (command == wxT("ExportMp3")) { } else if (command == wxT("ExportMP3")) {
return WriteMp3File(filename, 0); // 0 bitrate means use default/current return WriteMp3File(filename, 0); // 0 bitrate means use default/current
} else if (command == wxT("ExportWav")) { } else if (command == wxT("ExportWAV")) {
filename.Replace(wxT(".mp3"), wxT(".wav"), false); filename.Replace(wxT(".mp3"), wxT(".wav"), false);
double endTime = GetEndTime(); double endTime = GetEndTime();
if (endTime <= 0.0f) { if (endTime <= 0.0f) {
@ -492,7 +504,7 @@ bool BatchCommands::ApplySpecialCommand(int iCommand, const wxString command,con
wxMessageBox(_("Ogg Vorbis support is not included in this build of Audacity")); wxMessageBox(_("Ogg Vorbis support is not included in this build of Audacity"));
return false; return false;
#endif #endif
} else if (command == wxT("ExportFlac")) { } else if (command == wxT("ExportFLAC")) {
#ifdef USE_LIBFLAC #ifdef USE_LIBFLAC
filename.Replace(wxT(".mp3"), wxT(".flac"), false); filename.Replace(wxT(".mp3"), wxT(".flac"), false);
double endTime = GetEndTime(); double endTime = GetEndTime();