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

Steve's patch for "Chains compatibility 2.0.4 to 2.0.3"

This commit is contained in:
v.audacity 2013-02-24 03:48:34 +00:00
parent c26b3c6b49
commit a8c69337c2
3 changed files with 33 additions and 12 deletions

View File

@ -148,13 +148,13 @@ bool BatchCommands::ReadChain(const wxString & chain)
// Backward compatibility for old Chain scripts
if (cmd == wxT("SaveMP3_56k_before"))
cmd = wxT("ExportMP3_56k_before");
if (cmd == wxT("SaveMP3_56k_after"))
else if (cmd == wxT("SaveMP3_56k_after"))
cmd = wxT("ExportMP3_56k_after");
if (cmd == wxT("ExportFlac"))
else if (cmd == wxT("ExportFlac"))
cmd = wxT("ExportFLAC");
if (cmd == wxT("ExportMp3"))
else if (cmd == wxT("ExportMp3"))
cmd = wxT("ExportMP3");
if (cmd == wxT("ExportWav"))
else if (cmd == wxT("ExportWav"))
cmd = wxT("ExportWAV");
// Add to lists
@ -197,6 +197,18 @@ bool BatchCommands::WriteChain(const wxString & chain)
// Copy over the commands
int lines = mCommandChain.GetCount();
for (int i = 0; i < lines; i++) {
// restore deprecated commands in chain script
if (mCommandChain[i] == wxT("ExportMP3_56k_before"))
mCommandChain[i] = wxT("SaveMP3_56k_before");
else if (mCommandChain[i] == wxT("ExportMP3_56k_after"))
mCommandChain[i] = wxT("SaveMP3_56k_after");
else if (mCommandChain[i] == wxT("ExportFLAC"))
mCommandChain[i] = wxT("ExportFlac");
else if (mCommandChain[i] == wxT("ExportMP3"))
mCommandChain[i] = wxT("ExportMp3");
else if (mCommandChain[i] == wxT("ExportWAV"))
mCommandChain[i] = wxT("ExportWav");
tf.AddLine(mCommandChain[i] + wxT(":") + mParamsChain[ i ]);
}
@ -454,11 +466,20 @@ bool BatchCommands::ApplySpecialCommand(int iCommand, const wxString command,con
}
wxString filename;
wxString extension; // required for correct message
if (command == wxT("ExportWAV"))
extension = wxT(".wav");
else if (command == wxT("ExportOgg"))
extension = wxT(".ogg");
else if (command == wxT("ExportFLAC"))
extension = wxT(".flac");
else extension = wxT(".mp3");
if (mFileName.IsEmpty()) {
filename = project->BuildCleanFileName(project->GetFileName());
filename = project->BuildCleanFileName(project->GetFileName(), extension);
}
else {
filename = project->BuildCleanFileName(mFileName);
filename = project->BuildCleanFileName(mFileName, extension);
}
// We have a command index, but we don't use it!

View File

@ -6192,7 +6192,7 @@ void AudacityProject::OnEditChains()
dlg.ShowModal();
}
wxString AudacityProject::BuildCleanFileName(wxString fileName)
wxString AudacityProject::BuildCleanFileName(wxString fileName, wxString extension)
{
wxFileName newFileName(fileName);
wxString justName = newFileName.GetName();
@ -6216,8 +6216,8 @@ wxString AudacityProject::BuildCleanFileName(wxString fileName)
// double startTime = 0.0;
//OnSelectAll();
pathName = gPrefs->Read(wxT("/DefaultOpenPath"), ::wxGetCwd());
::wxMessageBox(wxString::Format(wxT("Export recording to %s\n/cleaned/%s.mp3"),
pathName.c_str(), justName.c_str()),
::wxMessageBox(wxString::Format(wxT("Export recording to %s\n/cleaned/%s%s"),
pathName.c_str(), justName.c_str(), extension.c_str()),
wxT("Export recording"),
wxOK | wxCENTRE);
pathName += wxT("/");
@ -6233,7 +6233,7 @@ wxString AudacityProject::BuildCleanFileName(wxString fileName)
cleanedName += wxT("/");
cleanedName += justName;
cleanedName += wxT(".mp3");
cleanedName += extension;
wxGetApp().AddFileToHistory(cleanedName);
return cleanedName;

View File

@ -364,7 +364,7 @@ void OnExportCleanSpeechPresets();
#endif // CLEANSPEECH
void OnStereoToMono(int index);
wxString BuildCleanFileName(wxString fileName);
wxString BuildCleanFileName(wxString fileName, wxString extension);
// Help Menu