1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Removal of all the stuff marked as 'Experimental CLEANSPEECH' about a year ago.

This commit is contained in:
martynshaw99 2013-04-29 23:23:14 +00:00
parent 4ca5984081
commit 1af35d4168
20 changed files with 4 additions and 1220 deletions

View File

@ -62,10 +62,6 @@ from there. Audacity will look for a file called "Pause.png".
DEFINE_IMAGE( bmpFFwdDisabled, wxImage( 16, 16 ), wxT("FFwdDisabled")); DEFINE_IMAGE( bmpFFwdDisabled, wxImage( 16, 16 ), wxT("FFwdDisabled"));
DEFINE_IMAGE( bmpRecord, wxImage( 16, 16 ), wxT("Record")); DEFINE_IMAGE( bmpRecord, wxImage( 16, 16 ), wxT("Record"));
DEFINE_IMAGE( bmpRecordDisabled, wxImage( 16, 16 ), wxT("RecordDisabled")); DEFINE_IMAGE( bmpRecordDisabled, wxImage( 16, 16 ), wxT("RecordDisabled"));
#ifdef CLEANSPEECH
DEFINE_IMAGE( bmpCleanSpeech, wxImage( 16, 16 ), wxT("CleanSpeech"));
DEFINE_IMAGE( bmpCleanSpeechDisabled, wxImage( 16, 16 ), wxT("CleanSpeechDisabled"));
#endif // CLEANSPEECH
SET_THEME_FLAGS( resFlagNewLine ); SET_THEME_FLAGS( resFlagNewLine );
DEFINE_IMAGE( bmpUpButtonLarge, wxImage( 48, 48 ), wxT("UpButtonLarge")); DEFINE_IMAGE( bmpUpButtonLarge, wxImage( 48, 48 ), wxT("UpButtonLarge"));

View File

@ -985,13 +985,6 @@ bool AudacityApp::OnInit()
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
#endif #endif
#ifdef CLEANSPEECH
//MERGE:
//Everything now uses Audacity name for preferences.
//(Audacity and CleanSpeech the same program and use
//the same preferences file).
//
#endif // CLEANSPEECH
// LL: Moved here from InitPreferences() to ensure VST effect // LL: Moved here from InitPreferences() to ensure VST effect
// discovery writes configuration to the correct directory // discovery writes configuration to the correct directory
// on OSX with case-sensitive file systems. // on OSX with case-sensitive file systems.
@ -1053,9 +1046,6 @@ bool AudacityApp::OnInit()
// //
wxString home = wxGetHomeDir(); wxString home = wxGetHomeDir();
#ifdef CLEANSPEECH
mAppHomeDir = home;
#endif // CLEANSPEECH
theTheme.EnsureInitialised(); theTheme.EnsureInitialised();
// AColor depends on theTheme. // AColor depends on theTheme.
@ -1156,18 +1146,6 @@ bool AudacityApp::OnInit()
if (lang == wxT("")) if (lang == wxT(""))
lang = GetSystemLanguageCode(); lang = GetSystemLanguageCode();
#ifdef CLEANSPEECH
#ifdef NOT_RQD
//TIDY-ME: (CleanSpeech) Language prompt??
// The prompt for language only happens ONCE on a system.
// I don't think we should disable it JKC
wxString lang = gPrefs->Read(wxT("/Locale/Language"), "en"); //lda
// Pop up a dialog the first time the program is run
//lda if (lang == "")
//lda lang = ChooseLanguage(NULL);
#endif
#endif // CLEANSPEECH
mLocale = NULL; mLocale = NULL;
InitLang( lang ); InitLang( lang );
@ -1180,9 +1158,6 @@ bool AudacityApp::OnInit()
} }
// More initialization // More initialization
#ifdef CLEANSPEECH
InitCleanSpeech();
#endif // CLEANSPEECH
InitDitherers(); InitDitherers();
InitAudioIO(); InitAudioIO();
@ -1447,56 +1422,6 @@ void AudacityApp::OnReceiveCommand(AppCommandEvent &event)
mCmdHandler->OnReceiveCommand(event); mCmdHandler->OnReceiveCommand(event);
} }
#ifdef CLEANSPEECH //is this actually useful?
bool AudacityApp::InitCleanSpeech()
{
wxString userdatadir = FileNames::DataDir();
wxString presetsFromPrefs = gPrefs->Read(wxT("/Directories/PresetsDir"), wxT(""));
wxString presets = wxT("");
#ifdef __WXGTK__
if (presetsFromPrefs.Length() > 0 && presetsFromPrefs[0] != wxT('/'))
presetsFromPrefs = wxT("");
#endif //__WXGTK__
wxString presetsDefaultLoc =
wxFileName(userdatadir, wxT("presets")).GetFullPath();
// Stop wxWidgets from printing its own error messages (not used ... does this really do anything?)
wxLogNull logNo;
// Try temp dir that was stored in prefs first
if (presetsFromPrefs != wxT("")) {
if (wxDirExists(presetsFromPrefs))
presets = presetsFromPrefs;
else if (wxMkdir(presetsFromPrefs))
presets = presetsFromPrefs;
}
// If that didn't work, try the default location
if ((presets == wxT("")) && (presetsDefaultLoc != wxT(""))) {
if (wxDirExists(presetsDefaultLoc))
presets = presetsDefaultLoc;
else if (wxMkdir(presetsDefaultLoc))
presets = presetsDefaultLoc;
}
if (presets == wxT("")) {
// Failed
wxMessageBox(wxT("Audacity could not find a place to store\n.csp CleanSpeech preset files\nAudacity is now going to exit. \nInstallation may be corrupt."));
return false;
}
// The permissions don't always seem to be set on
// some platforms. Hopefully this fixes it...
#ifdef __UNIX__
chmod(OSFILENAME(presets), 0755);
#endif
return (gPrefs->Write(wxT("/Directories/PresetsDir"), presets) && gPrefs->Flush());
}
#endif // CLEANSPEECH
bool AudacityApp::InitTempDir() bool AudacityApp::InitTempDir()
{ {
// We need to find a temp directory location. // We need to find a temp directory location.

View File

@ -98,14 +98,6 @@ class AudacityApp:public wxApp {
virtual int OnExit(void); virtual int OnExit(void);
virtual void OnFatalException(); virtual void OnFatalException();
#ifdef CLEANSPEECH
//LDA - Until we have a better way to save/restore binary data.
float* GetCleanSpeechNoiseGate() { return mCleanSpeechNoiseGate; }
int GetCleanSpeechNoiseGateExpectedCount() { return mCleanSpeechNoiseGateExpectedCount; }
void SetCleanSpeechNoiseGate(float* pNG) { mCleanSpeechNoiseGate = pNG; }
void SetCleanSpeechNoiseGateExpectedCount(int count) { mCleanSpeechNoiseGateExpectedCount = count; }
#endif // CLEANSPEECH
void InitLang( const wxString & lang ); void InitLang( const wxString & lang );
// These are currently only used on Mac OS, where it's // These are currently only used on Mac OS, where it's
@ -227,24 +219,6 @@ class AudacityApp:public wxApp {
/* utility method for printing the command line help message */ /* utility method for printing the command line help message */
void PrintCommandLineHelp(void); void PrintCommandLineHelp(void);
#ifdef CLEANSPEECH
//LDA - Until we have a better way to save/restore binary data.
// ToDo: ... look into how wxConfig works.
// ToDo: NoiseGate is an array of 1024 floats that is the "persistent result"
// of Step-1 of NoiseRemoval. Not sure if different size if
// other than 256 FFT size???
float* mCleanSpeechNoiseGate;
int mCleanSpeechNoiseGateExpectedCount;
bool InitCleanSpeech();
#endif // CLEANSPEECH
//LDA - Keep track of where Presets are stored ... for app, not just project
// ... ToDo: flawed for Linux/unix with restricted end-user privilege
// .... depends on whether [AudacityDir]\presets can be written
#ifdef CLEANSPEECH
wxString mAppHomeDir;
wxString mPresetsDir;
#endif // CLEANSPEECH
bool mWindowRectAlreadySaved; bool mWindowRectAlreadySaved;
#if defined(__WXMSW__) #if defined(__WXMSW__)

View File

@ -64,9 +64,6 @@ wxString SpecialCommands[] = {
}; };
// end CLEANSPEECH remnant // end CLEANSPEECH remnant
#ifdef CLEANSPEECH
static const wxString CleanSpeech = wxT("CleanSpeech");
#endif // CLEANSPEECH
static const wxString MP3Conversion = wxT("MP3 Conversion"); static const wxString MP3Conversion = wxT("MP3 Conversion");
BatchCommands::BatchCommands() BatchCommands::BatchCommands()
@ -74,13 +71,6 @@ BatchCommands::BatchCommands()
ResetChain(); ResetChain();
wxArrayString names = GetNames(); wxArrayString names = GetNames();
#ifdef CLEANSPEECH // possibly the rest of this fn
if (names.Index(CleanSpeech) == wxNOT_FOUND) {
AddChain(CleanSpeech);
RestoreChain(CleanSpeech);
WriteChain(CleanSpeech);
}
#endif // CLEANSPEECH
if (names.Index(MP3Conversion) == wxNOT_FOUND) { if (names.Index(MP3Conversion) == wxNOT_FOUND) {
AddChain(MP3Conversion); AddChain(MP3Conversion);
@ -252,26 +242,6 @@ bool BatchCommands::RenameChain(const wxString & oldchain, const wxString & newc
return wxRenameFile(oname.GetFullPath(), nname.GetFullPath()); return wxRenameFile(oname.GetFullPath(), nname.GetFullPath());
} }
#ifdef CLEANSPEECH
void BatchCommands::SetCleanSpeechChain()
{
ResetChain();
// TIDY-ME: Effects change their name with localisation.
// Commands (at least currently) don't. Messy.
/* i18n-hint: Effect name translations must agree with those used elsewhere, or batch won't find them */
AddToChain( wxT("StereoToMono") );
AddToChain( wxT("Normalize") );
AddToChain( wxT("ExportMP3_56k_before") );
AddToChain( wxT("NoiseRemoval") );
AddToChain( wxT("TruncateSilence") );
AddToChain( wxT("Leveller") );
AddToChain( wxT("Normalize") );
AddToChain( wxT("ExportMP3") );
}
#endif // CLEANSPEECH
void BatchCommands::SetWavToMp3Chain() // a function per default chain? This is flawed design! MJS void BatchCommands::SetWavToMp3Chain() // a function per default chain? This is flawed design! MJS
{ {
ResetChain(); ResetChain();
@ -302,10 +272,6 @@ wxArrayString BatchCommands::GetAllCommands()
// end CLEANSPEECH remnant // end CLEANSPEECH remnant
int additionalEffects=ADVANCED_EFFECT; int additionalEffects=ADVANCED_EFFECT;
#ifdef CLEANSPEECH
if( project->GetCleanSpeechMode() )
additionalEffects = 0;
#endif // CLEANSPEECH
effects = EffectManager::Get().GetEffects(PROCESS_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT | additionalEffects); effects = EffectManager::Get().GetEffects(PROCESS_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT | additionalEffects);
for(i=0; i<effects->GetCount(); i++) { for(i=0; i<effects->GetCount(); i++) {
@ -746,14 +712,8 @@ wxArrayString BatchCommands::GetNames()
bool BatchCommands::IsFixed(const wxString & name) bool BatchCommands::IsFixed(const wxString & name)
{ {
#ifdef CLEANSPEECH // probably the rest of this fn as well
if (name == CleanSpeech || name == MP3Conversion) {
return true;
}
#else
if (name == MP3Conversion) if (name == MP3Conversion)
return true; return true;
#endif // CLEANSPEECH
return false; return false;
} }
@ -762,19 +722,8 @@ void BatchCommands::RestoreChain(const wxString & name)
// TIDY-ME: Effects change their name with localisation. // TIDY-ME: Effects change their name with localisation.
// Commands (at least currently) don't. Messy. // Commands (at least currently) don't. Messy.
#ifdef CLEANSPEECH
/* i18n-hint: Effect name translations must agree with those used elsewhere, or batch won't find them */
if (name == CleanSpeech) {
SetCleanSpeechChain();
}
else if (name == MP3Conversion) {
SetWavToMp3Chain();
}
#else
if (name == MP3Conversion) if (name == MP3Conversion)
SetWavToMp3Chain(); SetWavToMp3Chain();
#endif // CLEANSPEECH
} }
void BatchCommands::Split(const wxString & str, wxString & command, wxString & param) void BatchCommands::Split(const wxString & str, wxString & command, wxString & param)

View File

@ -61,9 +61,6 @@ class BatchCommands {
int GetCount(); int GetCount();
void SetWavToMp3Chain(); void SetWavToMp3Chain();
#ifdef CLEANSPEECH
void SetCleanSpeechChain();
#endif // CLEANSPEECH
bool IsFixed(const wxString & name); bool IsFixed(const wxString & name);

View File

@ -66,16 +66,6 @@ BatchProcessDialog::BatchProcessDialog(wxWindow * parent):
{ {
AudacityProject * p = GetActiveProject(); AudacityProject * p = GetActiveProject();
#ifdef CLEANSPEECH
if (p->GetCleanSpeechMode())
{
/*i18n-hint: CleanSpeech is the name of a mode Audacity can operate
* in that was invented to process lots of sermons, remove long
* pauses and background noise.*/
SetTitle(_("CleanSpeech Batch Processing"));
}
#endif // CLEANSPEECH
SetLabel(_("Apply Chain")); // Provide visual label SetLabel(_("Apply Chain")); // Provide visual label
SetName(_("Apply Chain")); // Provide audible label SetName(_("Apply Chain")); // Provide audible label
Populate(); Populate();
@ -128,11 +118,7 @@ void BatchProcessDialog::PopulateOrExchange(ShuttleGui &S)
} }
// Get and validate the currently active chain // Get and validate the currently active chain
#ifdef CLEANSPEECH
wxString name = gPrefs->Read(wxT("/Batch/ActiveChain"), wxT("CleanSpeech"));
#else
wxString name = gPrefs->Read(wxT("/Batch/ActiveChain"), wxT("")); wxString name = gPrefs->Read(wxT("/Batch/ActiveChain"), wxT(""));
#endif // CLEANSPEECH
int item = mChains->FindItem(-1, name); int item = mChains->FindItem(-1, name);
if (item == -1) { if (item == -1) {
@ -218,14 +204,7 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent &event)
} }
wxString path = gPrefs->Read(wxT("/DefaultOpenPath"), ::wxGetCwd()); wxString path = gPrefs->Read(wxT("/DefaultOpenPath"), ::wxGetCwd());
#ifdef CLEANSPEECH
wxString prompt = project->GetCleanSpeechMode() ?
_("Select vocal file(s) for batch CleanSpeech Chain...") :
_("Select file(s) for batch processing...");
// CleanSpeech used to hard-code a restricted file type list here
#else
wxString prompt = _("Select file(s) for batch processing..."); wxString prompt = _("Select file(s) for batch processing...");
#endif // CLEANSPEECH
FormatList l; FormatList l;
wxString filter; wxString filter;
@ -442,11 +421,7 @@ void EditChainsDialog::Populate()
// ----------------------- End of main section -------------- // ----------------------- End of main section --------------
// Get and validate the currently active chain // Get and validate the currently active chain
#ifdef CLEANSPEECH
mActiveChain = gPrefs->Read(wxT("/Batch/ActiveChain"), wxT("CleanSpeech"));
#else
mActiveChain = gPrefs->Read(wxT("/Batch/ActiveChain"), wxT("")); mActiveChain = gPrefs->Read(wxT("/Batch/ActiveChain"), wxT(""));
#endif // CLEANSPEECH
// Go populate the chains list. // Go populate the chains list.
PopulateChains(); PopulateChains();

View File

@ -154,8 +154,3 @@
#define EXPERIMENTAL_TRUNC_SILENCE #define EXPERIMENTAL_TRUNC_SILENCE
#endif #endif
//MJS: make the CleanSpeech stuff experimental, rather than deleting it directly
// Normally disabled, for now.
// CleanSpeech should be done somehow else and not be polluting the code
//#define CLEANSPEECH 1

View File

@ -175,11 +175,6 @@ void AudacityProjectCommandFunctor::operator()(int index )
/// changes in configured preferences - for example changes in key-bindings /// changes in configured preferences - for example changes in key-bindings
/// affect the short-cut key legend that appears beside each command, /// affect the short-cut key legend that appears beside each command,
#ifdef CLEANSPEECH
/// and changes in 'CleanSpeech Mode' customise the menus to a restricted
/// subset
#endif // CLEANSPEECH
void AudacityProject::CreateMenusAndCommands() void AudacityProject::CreateMenusAndCommands()
{ {
CommandManager *c = &mCommandManager; CommandManager *c = &mCommandManager;
@ -217,17 +212,6 @@ void AudacityProject::CreateMenusAndCommands()
c->AddItem(wxT("Close"), _("&Close"), FN(OnClose), wxT("Ctrl+W")); c->AddItem(wxT("Close"), _("&Close"), FN(OnClose), wxT("Ctrl+W"));
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->AddItem(wxT("Save"), _("&Save Project"), FN(OnSave), wxT("Ctrl+S"),
AudioIONotBusyFlag | UnsavedChangesFlag,
AudioIONotBusyFlag | UnsavedChangesFlag);
c->AddItem(wxT("SaveAs"), _("Save Project &As..."), FN(OnSaveAs));
#ifdef USE_LIBVORBIS
c->AddItem(wxT("SaveCompressed"), _("Save Compressed Copy of Project..."), FN(OnSaveCompressed));
#endif
}
#else // CLEANSPEECH
c->AddItem(wxT("Save"), _("&Save Project"), FN(OnSave), wxT("Ctrl+S"), c->AddItem(wxT("Save"), _("&Save Project"), FN(OnSave), wxT("Ctrl+S"),
AudioIONotBusyFlag | UnsavedChangesFlag, AudioIONotBusyFlag | UnsavedChangesFlag,
AudioIONotBusyFlag | UnsavedChangesFlag); AudioIONotBusyFlag | UnsavedChangesFlag);
@ -235,7 +219,6 @@ void AudacityProject::CreateMenusAndCommands()
#ifdef USE_LIBVORBIS #ifdef USE_LIBVORBIS
c->AddItem(wxT("SaveCompressed"), _("Save Compressed Copy of Project..."), FN(OnSaveCompressed)); c->AddItem(wxT("SaveCompressed"), _("Save Compressed Copy of Project..."), FN(OnSaveCompressed));
#endif #endif
#endif // CLEANSPEECH
c->AddItem(wxT("CheckDeps"), _("Chec&k Dependencies..."), FN(OnCheckDependencies)); c->AddItem(wxT("CheckDeps"), _("Chec&k Dependencies..."), FN(OnCheckDependencies));
@ -247,22 +230,6 @@ void AudacityProject::CreateMenusAndCommands()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->BeginSubMenu(_("&Import"));
c->AddItem(wxT("ImportAudio"), _("&Audio..."), FN(OnImport), wxT("Ctrl+Shift+I"));
c->AddItem(wxT("ImportLabels"), _("&Labels..."), FN(OnImportLabels));
#ifdef USE_MIDI
c->AddItem(wxT("ImportMIDI"), _("&MIDI..."), FN(OnImportMIDI));
#endif // USE_MIDI
c->AddItem(wxT("ImportRaw"), _("&Raw Data..."), FN(OnImportRaw));
c->EndSubMenu();
c->AddSeparator();
}
#else // CLEANSPEECH
c->BeginSubMenu(_("&Import")); c->BeginSubMenu(_("&Import"));
c->AddItem(wxT("ImportAudio"), _("&Audio..."), FN(OnImport), wxT("Ctrl+Shift+I")); c->AddItem(wxT("ImportAudio"), _("&Audio..."), FN(OnImport), wxT("Ctrl+Shift+I"));
@ -275,7 +242,6 @@ void AudacityProject::CreateMenusAndCommands()
c->EndSubMenu(); c->EndSubMenu();
c->AddSeparator(); c->AddSeparator();
#endif // CLEANSPEECH
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -289,24 +255,6 @@ void AudacityProject::CreateMenusAndCommands()
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag, AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag); AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag);
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->AddSeparator();
c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels),
AudioIONotBusyFlag | LabelTracksExistFlag,
AudioIONotBusyFlag | LabelTracksExistFlag);
// Enable Export audio commands only when there are audio tracks.
c->AddItem(wxT("ExportMultiple"), _("Export &Multiple..."), FN(OnExportMultiple), wxT("Ctrl+Shift+L"),
AudioIONotBusyFlag | WaveTracksExistFlag,
AudioIONotBusyFlag | WaveTracksExistFlag);
#if defined(USE_MIDI)
c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI),
AudioIONotBusyFlag | NoteTracksSelectedFlag,
AudioIONotBusyFlag | NoteTracksSelectedFlag);
#endif
}
#else // CLEANSPEECH
c->AddSeparator(); c->AddSeparator();
c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels), c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels),
@ -321,36 +269,12 @@ void AudacityProject::CreateMenusAndCommands()
AudioIONotBusyFlag | NoteTracksSelectedFlag, AudioIONotBusyFlag | NoteTracksSelectedFlag,
AudioIONotBusyFlag | NoteTracksSelectedFlag); AudioIONotBusyFlag | NoteTracksSelectedFlag);
#endif #endif
#endif // CLEANSPEECH
c->AddItem(wxT("ApplyChain"), _("Appl&y Chain..."), FN(OnApplyChain), c->AddItem(wxT("ApplyChain"), _("Appl&y Chain..."), FN(OnApplyChain),
AudioIONotBusyFlag, AudioIONotBusyFlag,
AudioIONotBusyFlag); AudioIONotBusyFlag);
c->AddItem(wxT("EditChains"), _("Edit C&hains..."), FN(OnEditChains)); c->AddItem(wxT("EditChains"), _("Edit C&hains..."), FN(OnEditChains));
#ifdef CLEANSPEECH
if (mCleanSpeechMode) {
c->AddItem(wxT("ExportCcSettings"), _("Export CleanSpeech &Presets..."), FN(OnExportCleanSpeechPresets));
c->AddItem(wxT("ImportCcSettings"), _("I&mport CleanSpeech Presets..."), FN(OnImportCleanSpeechPresets));
}
else {
#ifdef EXPERIMENTAL_FTP
c->AddSeparator();
c->AddItem(wxT("Upload File"), _("&Upload File..."), FN(OnUpload));
#endif
c->AddSeparator();
c->AddItem(wxT("PageSetup"), _("Pa&ge Setup..."), FN(OnPageSetup),
AudioIONotBusyFlag | TracksExistFlag,
AudioIONotBusyFlag | TracksExistFlag);
/* i18n-hint: (verb) It's item on a menu. */
c->AddItem(wxT("Print"), _("&Print..."), FN(OnPrint),
AudioIONotBusyFlag | TracksExistFlag,
AudioIONotBusyFlag | TracksExistFlag);
}
#else // CLEANSPEECH
#ifdef EXPERIMENTAL_FTP #ifdef EXPERIMENTAL_FTP
c->AddSeparator(); c->AddSeparator();
c->AddItem(wxT("Upload File"), _("&Upload File..."), FN(OnUpload)); c->AddItem(wxT("Upload File"), _("&Upload File..."), FN(OnUpload));
@ -365,7 +289,6 @@ void AudacityProject::CreateMenusAndCommands()
c->AddItem(wxT("Print"), _("&Print..."), FN(OnPrint), c->AddItem(wxT("Print"), _("&Print..."), FN(OnPrint),
AudioIONotBusyFlag | TracksExistFlag, AudioIONotBusyFlag | TracksExistFlag,
AudioIONotBusyFlag | TracksExistFlag); AudioIONotBusyFlag | TracksExistFlag);
#endif // CLEANSPEECH
c->AddSeparator(); c->AddSeparator();
@ -461,16 +384,6 @@ void AudacityProject::CreateMenusAndCommands()
/* i18n-hint: (verb)*/ /* i18n-hint: (verb)*/
c->AddItem(wxT("Duplicate"), _("Duplic&ate"), FN(OnDuplicate), wxT("Ctrl+D")); c->AddItem(wxT("Duplicate"), _("Duplic&ate"), FN(OnDuplicate), wxT("Ctrl+D"));
#ifdef CLEANSPEECH
// An anomaly... StereoToMono is added here for CleanSpeech,
// which doesn't have a Tracks menu, but is under Tracks for normal Audacity.
if (mCleanSpeechMode) {
c->AddItem(wxT("Stereo to Mono"), _("Stereo Trac&k to Mono"), FN(OnStereoToMono),
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag);
}
#endif // CLEANSPEECH
c->AddSeparator(); c->AddSeparator();
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -762,212 +675,6 @@ void AudacityProject::CreateMenusAndCommands()
#endif #endif
c->AddItem(wxT("RescanDevices"), _("R&escan Audio Devices"), FN(OnRescanDevices)); c->AddItem(wxT("RescanDevices"), _("R&escan Audio Devices"), FN(OnRescanDevices));
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
//////////////////////////////////////////////////////////////////////////
// Tracks Menu (formerly Project Menu)
//////////////////////////////////////////////////////////////////////////
c->BeginMenu(_("&Tracks"));
c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag);
//////////////////////////////////////////////////////////////////////////
c->BeginSubMenu(_("Add &New"));
c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N"));
c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack));
c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack));
c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack));
c->EndSubMenu();
//////////////////////////////////////////////////////////////////////////
c->AddSeparator();
// StereoToMono moves to the Edit menu when in CleanSpeech mode. CLEANSPEECH
// It belongs here normally, because it is a kind of mix-down. CLEANSPEECH
c->AddItem(wxT("Stereo to Mono"), _("Stereo Trac&k to Mono"), FN(OnStereoToMono),
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag);
c->AddItem(wxT("MixAndRender"), _("Mi&x and Render"), FN(OnMixAndRender),
AudioIONotBusyFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | WaveTracksSelectedFlag);
c->AddCommand(wxT("MixAndRenderToNewTrack"), _("Mix and Render to New Track"), FN(OnMixAndRenderToNewTrack), wxT("Ctrl+Shift+M"),
AudioIONotBusyFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | WaveTracksSelectedFlag);
c->AddItem(wxT("Resample"), _("&Resample..."), FN(OnResample),
AudioIONotBusyFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | WaveTracksSelectedFlag);
c->AddSeparator();
c->AddItem(wxT("RemoveTracks"), _("Remo&ve Tracks"), FN(OnRemoveTracks),
AudioIONotBusyFlag | TracksSelectedFlag,
AudioIONotBusyFlag | TracksSelectedFlag);
c->AddSeparator();
c->AddItem(wxT("MuteAllTracks"), _("&Mute All Tracks"), FN(OnMuteAllTracks), wxT("Ctrl+U"),
WaveTracksExistFlag,
WaveTracksExistFlag);
c->AddItem(wxT("UnMuteAllTracks"), _("&Unmute All Tracks"), FN(OnUnMuteAllTracks), wxT("Ctrl+Shift+U"),
WaveTracksExistFlag,
WaveTracksExistFlag);
c->AddSeparator();
wxArrayString alignLabels;
alignLabels.Add(_("Align with &Zero"));
alignLabels.Add(_("Align with &Cursor"));
alignLabels.Add(_("Align with Selection &Start"));
alignLabels.Add(_("Align with Selection &End"));
alignLabels.Add(_("Align End with Cu&rsor"));
alignLabels.Add(_("Align End with Selection Star&t"));
alignLabels.Add(_("Align End with Selection En&d"));
alignLabels.Add(_("Align Tracks To&gether"));
c->SetDefaultFlags(WaveTracksExistFlag, WaveTracksExistFlag);
c->BeginSubMenu(_("&Align Tracks"));
c->AddItemList(wxT("Align"), alignLabels, FN(OnAlign));
c->SetCommandFlags(wxT("Align"),
AudioIONotBusyFlag | TracksSelectedFlag,
AudioIONotBusyFlag | TracksSelectedFlag);
c->EndSubMenu();
//////////////////////////////////////////////////////////////////////////
alignLabels.RemoveAt(7); // Can't align together and move cursor
//////////////////////////////////////////////////////////////////////////
c->BeginSubMenu(_("Ali&gn and Move Cursor"));
c->AddItemList(wxT("AlignMove"), alignLabels, FN(OnAlignMoveSel));
c->SetCommandFlags(wxT("AlignMove"),
AudioIONotBusyFlag | TracksSelectedFlag,
AudioIONotBusyFlag | TracksSelectedFlag);
c->EndSubMenu();
//////////////////////////////////////////////////////////////////////////
#ifdef EXPERIMENTAL_SCOREALIGN
c->AddItem(wxT("ScoreAlign"), _("Synchronize MIDI with Audio"), FN(OnScoreAlign),
AudioIONotBusyFlag | NoteTracksSelectedFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | NoteTracksSelectedFlag | WaveTracksSelectedFlag);
#endif // EXPERIMENTAL_SCOREALIGN
c->AddSeparator();
#ifdef EXPERIMENTAL_SYNC_LOCK
c->AddCheck(wxT("SyncLock"), _("Sync-&Lock Tracks"), FN(OnSyncLock), 0);
c->AddSeparator();
#endif
c->AddItem(wxT("AddLabel"), _("Add Label At &Selection"), FN(OnAddLabel), wxT("Ctrl+B"),
AlwaysEnabledFlag, AlwaysEnabledFlag);
c->AddItem(wxT("AddLabelPlaying"), _("Add Label At &Playback Position"),
FN(OnAddLabelPlaying),
#ifdef __WXMAC__
wxT("Ctrl+."),
#else
wxT("Ctrl+M"),
#endif
0, AudioIONotBusyFlag);
c->AddItem(wxT("EditLabels"), _("&Edit Labels..."), FN(OnEditLabels));
c->AddSeparator();
//////////////////////////////////////////////////////////////////////////
c->BeginSubMenu(_("S&ort Tracks"));
c->AddItem(wxT("SortByTime"), _("by &Start time"), FN(OnSortTime),
TracksExistFlag,
TracksExistFlag);
c->AddItem(wxT("SortByName"), _("by &Name"), FN(OnSortName),
TracksExistFlag,
TracksExistFlag);
c->EndSubMenu();
//////////////////////////////////////////////////////////////////////////
c->EndMenu();
//////////////////////////////////////////////////////////////////////////
// Generate Menu
//////////////////////////////////////////////////////////////////////////
c->BeginMenu(_("&Generate"));
c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag);
#ifndef EFFECT_CATEGORIES
effects = em.GetEffects(INSERT_EFFECT | BUILTIN_EFFECT);
if (effects->GetCount()) {
names.Clear();
for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("Generate"), names, FN(OnGenerateEffect));
}
delete effects;
effects = em.GetEffects(INSERT_EFFECT | PLUGIN_EFFECT);
if (effects->GetCount()) {
c->AddSeparator();
names.Clear();
for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("GeneratePlugin"), names, FN(OnGeneratePlugin), true);
}
delete effects;
#else
int flags;
flags = INSERT_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT;
EffectCategory* ac =
em.LookupCategory(wxT("http://lv2plug.in/ns/lv2core#GeneratorPlugin"));
CategorySet roots = ac->GetSubCategories();
EffectSet generators = ac->GetEffects();
EffectSet topLevel = CreateEffectSubmenus(c, roots, flags, 0);
std::copy(generators.begin(), generators.end(),
std::insert_iterator<EffectSet>(topLevel, topLevel.begin()));
AddEffectsToMenu(c, topLevel);
// Add all uncategorised effects in a special submenu
EffectSet unsorted =
em.GetUnsortedEffects(flags);
if (unsorted.size() > 0) {
c->AddSeparator();
c->BeginSubMenu(_("Unsorted"));
names.Clear();
indices.Clear();
EffectSet::const_iterator iter;
for (iter = unsorted.begin(); iter != unsorted.end(); ++iter) {
names.Add((*iter)->GetEffectName());
indices.Add((*iter)->GetID());
}
c->AddItemList(wxT("Generate"), names,
FNI(OnProcessAny, indices), true);
c->EndSubMenu();
}
#endif // EFFECT_CATEGORIES
c->EndMenu();
} // end of CLEANSPEECH 'if'
#else // CLEANSPEECH
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Tracks Menu (formerly Project Menu) // Tracks Menu (formerly Project Menu)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -990,10 +697,6 @@ void AudacityProject::CreateMenusAndCommands()
c->AddSeparator(); c->AddSeparator();
#ifdef CLEANSPEECH
// StereoToMono moves to the Edit menu when in CleanSpeech mode. CLEANSPEECH
// It belongs here normally, because it is a kind of mix-down. CLEANSPEECH
#endif // CLEANSPEECH
c->AddItem(wxT("Stereo to Mono"), _("Stereo Trac&k to Mono"), FN(OnStereoToMono), c->AddItem(wxT("Stereo to Mono"), _("Stereo Trac&k to Mono"), FN(OnStereoToMono),
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag, AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag); AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag);
@ -1167,7 +870,6 @@ void AudacityProject::CreateMenusAndCommands()
#endif // EFFECT_CATEGORIES #endif // EFFECT_CATEGORIES
c->EndMenu(); c->EndMenu();
#endif // CLEANSPEECH
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Effect Menu // Effect Menu
@ -1190,12 +892,7 @@ void AudacityProject::CreateMenusAndCommands()
c->AddSeparator(); c->AddSeparator();
#ifdef CLEANSPEECH
// Cleanspeech doesn't have advanced effects
int additionalEffects = mCleanSpeechMode ? 0 : ADVANCED_EFFECT;
#else
int additionalEffects = ADVANCED_EFFECT; int additionalEffects = ADVANCED_EFFECT;
#endif // CLEANSPEECH
// this is really ugly but we need to keep all the old code to get any // this is really ugly but we need to keep all the old code to get any
// effects at all in the menu when EFFECT_CATEGORIES is undefined // effects at all in the menu when EFFECT_CATEGORIES is undefined
@ -1212,20 +909,6 @@ void AudacityProject::CreateMenusAndCommands()
} }
delete effects; delete effects;
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
effects = em.GetEffects(PROCESS_EFFECT | PLUGIN_EFFECT);
if (effects->GetCount()) {
c->AddSeparator();
names.Clear();
for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("EffectPlugin"), names, FN(OnProcessPlugin), true);
}
delete effects;
}
#else // CLEANSPEECH
effects = em.GetEffects(PROCESS_EFFECT | PLUGIN_EFFECT); effects = em.GetEffects(PROCESS_EFFECT | PLUGIN_EFFECT);
if (effects->GetCount()) { if (effects->GetCount()) {
c->AddSeparator(); c->AddSeparator();
@ -1236,21 +919,11 @@ void AudacityProject::CreateMenusAndCommands()
c->AddItemList(wxT("EffectPlugin"), names, FN(OnProcessPlugin), true); c->AddItemList(wxT("EffectPlugin"), names, FN(OnProcessPlugin), true);
} }
delete effects; delete effects;
#endif // CLEANSPEECH
c->EndMenu(); c->EndMenu();
#else #else
#ifdef CLEANSPEECH
// We want plugins and builtins in the same menus, but we don't want plugins
// or "advanced" effects if we are building CleanSpeech
int flags = PROCESS_EFFECT | BUILTIN_EFFECT;
if (!mCleanSpeechMode) {
flags |= PLUGIN_EFFECT | ADVANCED_EFFECT;
}
#else // CLEANSPEECH
int flags = PROCESS_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT | ADVANCED_EFFECT; int flags = PROCESS_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT | ADVANCED_EFFECT;
#endif // CLEANSPEECH
// The categories form a DAG, so we start at the roots (the categories // The categories form a DAG, so we start at the roots (the categories
// without incoming links) // without incoming links)
CategorySet roots = em.GetRootCategories(); CategorySet roots = em.GetRootCategories();
@ -1277,80 +950,6 @@ void AudacityProject::CreateMenusAndCommands()
#endif #endif
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
//////////////////////////////////////////////////////////////////////////
// Analyze Menu
//////////////////////////////////////////////////////////////////////////
c->BeginMenu(_("&Analyze"));
c->AddItem(wxT("ContrastAnalyser"), _("Contrast..."), FN(OnContrast), wxT("Ctrl+Shift+T"),
AudioIONotBusyFlag | WaveTracksSelectedFlag | TimeSelectedFlag,
AudioIONotBusyFlag | WaveTracksSelectedFlag | TimeSelectedFlag);
c->AddItem(wxT("PlotSpectrum"), _("Plot Spectrum..."), FN(OnPlotSpectrum),
AudioIONotBusyFlag | WaveTracksSelectedFlag | TimeSelectedFlag,
AudioIONotBusyFlag | WaveTracksSelectedFlag | TimeSelectedFlag);
#ifndef EFFECT_CATEGORIES
effects = em.GetEffects(ANALYZE_EFFECT | BUILTIN_EFFECT);
if (effects->GetCount()) {
names.Clear();
for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("Analyze"), names, FN(OnAnalyzeEffect));
}
delete effects;
effects = em.GetEffects(ANALYZE_EFFECT | PLUGIN_EFFECT);
if (effects->GetCount()) {
c->AddSeparator();
names.Clear();
for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("AnalyzePlugin"), names, FN(OnAnalyzePlugin), true);
}
delete effects;
#else
flags = ANALYZE_EFFECT | BUILTIN_EFFECT | PLUGIN_EFFECT;
EffectCategory* ac =
em.LookupCategory(wxT("http://lv2plug.in/ns/lv2core#AnalyserPlugin"));
CategorySet roots = ac->GetSubCategories();
EffectSet analyzers = ac->GetEffects();
EffectSet topLevel = CreateEffectSubmenus(c, roots, flags, 0);
std::copy(analyzers.begin(), analyzers.end(),
std::insert_iterator<EffectSet>(topLevel, topLevel.begin()));
AddEffectsToMenu(c, topLevel);
// Add all uncategorised effects in a special submenu
EffectSet unsorted =
em.GetUnsortedEffects(flags);
if (unsorted.size() > 0) {
c->AddSeparator();
c->BeginSubMenu(_("Unsorted"));
names.Clear();
indices.Clear();
EffectSet::const_iterator iter;
for (iter = unsorted.begin(); iter != unsorted.end(); ++iter) {
names.Add((*iter)->GetEffectName());
indices.Add((*iter)->GetID());
}
c->AddItemList(wxT("Analyze"), names,
FNI(OnProcessAny, indices), true);
c->EndSubMenu();
}
#endif // EFFECT_CATEGORIES
c->EndMenu();
} // end of CLEANSPEECH if
#else // CLEANSPEECH
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Analyze Menu // Analyze Menu
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -1420,7 +1019,6 @@ void AudacityProject::CreateMenusAndCommands()
#endif // EFFECT_CATEGORIES #endif // EFFECT_CATEGORIES
c->EndMenu(); c->EndMenu();
#endif // CLEANSPEECH
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Help Menu // Help Menu
@ -1433,41 +1031,11 @@ void AudacityProject::CreateMenusAndCommands()
c->BeginMenu(_("&Help")); c->BeginMenu(_("&Help"));
c->SetDefaultFlags(AlwaysEnabledFlag, AlwaysEnabledFlag); c->SetDefaultFlags(AlwaysEnabledFlag, AlwaysEnabledFlag);
#ifdef CLEANSPEECH
if (mCleanSpeechMode) {
c->AddItem(wxT("About"), _("&About Audacity CleanSpeech..."), FN(OnAbout));
}
else {
c->AddItem(wxT("About"), _("&About Audacity..."), FN(OnAbout));
}
#else
c->AddItem(wxT("About"), _("&About Audacity..."), FN(OnAbout)); c->AddItem(wxT("About"), _("&About Audacity..."), FN(OnAbout));
#endif // CLEANSPEECH
c->AddItem(wxT("QuickHelp"), _("&Quick Help (in web browser)"), FN(OnQuickHelp)); c->AddItem(wxT("QuickHelp"), _("&Quick Help (in web browser)"), FN(OnQuickHelp));
c->AddItem(wxT("Manual"), _("&Manual (in web browser)"), FN(OnManual)); c->AddItem(wxT("Manual"), _("&Manual (in web browser)"), FN(OnManual));
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->AddSeparator();
c->AddItem(wxT("Screenshot"), _("&Screenshot Tools..."), FN(OnScreenshot));
#if IS_BETA
// TODO: What should we do here? Make benchmark a plug-in?
// Easy enough to do. We'd call it mod-self-test.
c->AddSeparator();
c->AddItem(wxT("Benchmark"), _("&Run Benchmark..."), FN(OnBenchmark));
#endif
c->AddSeparator();
c->AddItem(wxT("DeviceInfo"), _("Au&dio Device Info..."), FN(OnAudioDeviceInfo));
c->AddItem(wxT("Log"), _("Show &Log..."), FN(OnShowLog));
} // end of CLEANSPEECH if
#else // CLEANSPEECH
c->AddSeparator(); c->AddSeparator();
c->AddItem(wxT("Screenshot"), _("&Screenshot Tools..."), FN(OnScreenshot)); c->AddItem(wxT("Screenshot"), _("&Screenshot Tools..."), FN(OnScreenshot));
@ -1484,7 +1052,6 @@ void AudacityProject::CreateMenusAndCommands()
c->AddItem(wxT("DeviceInfo"), _("Au&dio Device Info..."), FN(OnAudioDeviceInfo)); c->AddItem(wxT("DeviceInfo"), _("Au&dio Device Info..."), FN(OnAudioDeviceInfo));
c->AddItem(wxT("Log"), _("Show &Log..."), FN(OnShowLog)); c->AddItem(wxT("Log"), _("Show &Log..."), FN(OnShowLog));
#endif // CLEANSPEECH
c->EndMenu(); c->EndMenu();
@ -3226,11 +2793,6 @@ void AudacityProject::OnProcessAny(int index)
void AudacityProject::OnProcessEffect(int index) void AudacityProject::OnProcessEffect(int index)
{ {
int additionalEffects=ADVANCED_EFFECT; int additionalEffects=ADVANCED_EFFECT;
#ifdef CLEANSPEECH
// set additionalEffects to zero to exclude the advanced effects.
if( mCleanSpeechMode )
additionalEffects = 0;
#endif // CLEANSPEECH
OnEffect(BUILTIN_EFFECT | PROCESS_EFFECT | additionalEffects, index); OnEffect(BUILTIN_EFFECT | PROCESS_EFFECT | additionalEffects, index);
} }
@ -6038,174 +5600,6 @@ void AudacityProject::OnEditLabels()
// #define PRESET_COUNT 16 // #define PRESET_COUNT 16
#define PRESET_COUNT 14 #define PRESET_COUNT 14
#ifdef CLEANSPEECH
void AudacityProject::OnExportCleanSpeechPresets()
{
wxString userdatadir = FileNames::DataDir();
#ifdef __WXMSW__
wxString presetsDefaultLoc = userdatadir + wxT("\\presets");
#else
wxString presetsDefaultLoc = userdatadir + wxT("/presets");
#endif
wxString path = gPrefs->Read(wxT("/Directories/PresetsDir"), presetsDefaultLoc);
wxString nameOnly;
wxString fName;
wxString extension = wxT(".csp");
bool fileOkay;
do {
fileOkay = true;
fName = FileSelector(_("Save CleanSpeech Preset File As:"),
path,
wxT("*.csp"), // default file extension
extension,
_("CleanSpeech Presets (*.csp)|*.csp"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
if (fName.empty()) { // if cancel selected
return;
}
if (fName.Length() >= 256) {
wxMessageBox(_("Sorry, pathnames longer than 256 characters not supported."));
fileOkay = false;
continue;
}
::wxSplitPath(fName, &path, &nameOnly, &extension);
wxFFile presetsFile(fName, wxT("wb"));
bool flag = presetsFile.IsOpened();
if (flag == true) {
int preset[PRESET_COUNT];
preset[0] = PRESET_FORMAT;
preset[1] = PRESET_COUNT;
preset[2] = gPrefs->Read(wxT("/CsPresets/ClickThresholdLevel"), 200L);
preset[3] = gPrefs->Read(wxT("/CsPresets/ClickWidth"), 20L);
preset[4] = gPrefs->Read(wxT("/CsPresets/LevellerDbChoiceIndex"), 10L);
preset[5] = gPrefs->Read(wxT("/CsPresets/LevellerNumPasses"), 2L);
preset[6] = gPrefs->Read(wxT("/CsPresets/Noise_Level"), 3L);
preset[7] = gPrefs->Read(wxT("/CsPresets/Norm_AmpDbGain"), 1L);
preset[8] = gPrefs->Read(wxT("/CsPresets/Norm_RemoveDcOffset"), 1L);
preset[9] = gPrefs->Read(wxT("/CsPresets/SpikeDbChoiceIndex"), 13L);
preset[10] = gPrefs->Read(wxT("/CsPresets/SpikeMaxDurationMs"), SKIP_EFFECT_MILLISECOND);
preset[11] = gPrefs->Read(wxT("/Effects/TruncateSilence/DbChoiceIndex"), 8L);
preset[12] = gPrefs->Read(wxT("/Effects/TruncateSilence/LongestAllowedSilentMs"), 1000L);
// preset[14] = gPrefs->Read(wxT("/GUI/Save128HqMasterAfter"), 0L);
// preset[15] = gPrefs->Read(wxT("/GUI/Save128HqMasterBefore"), 0L);
int expectedCount = wxGetApp().GetCleanSpeechNoiseGateExpectedCount();
float* pNoiseGate = wxGetApp().GetCleanSpeechNoiseGate();
double noiseGateSum = 0.0;
int lenNoiseGate = expectedCount / sizeof(float);
for (int i = 0; i < lenNoiseGate; ++i) {
noiseGateSum += fabs(pNoiseGate[i]);
}
int noiseCheckSum = abs((int)noiseGateSum);
preset[13] = noiseCheckSum;
gPrefs->Write(wxT("/Validate/NoiseGateSum"), noiseCheckSum);
gPrefs->Flush();
int lenPreset = sizeof(preset);
int count = presetsFile.Write(preset, lenPreset);
// ANSWER-ME: Vigilant Sentry notes "count" is unused after this assignment.
// Should be checked against expectedCount -- but CleanSpeech is going away!!! ;-)
count = presetsFile.Write(pNoiseGate, expectedCount);
presetsFile.Close();
}
else {
wxMessageBox(_("Problem encountered exporting presets."),
_("Unable to Export"),
wxOK | wxICON_WARNING);
fileOkay = false;
continue;
}
} while(!fileOkay);
}
void AudacityProject::OnImportCleanSpeechPresets()
{
wxString userdatadir = FileNames::DataDir();
#ifdef __WXMSW__
wxString presetsDefaultLoc = userdatadir + wxT("\\presets");
#else
wxString presetsDefaultLoc = userdatadir + wxT("/presets");
#endif
wxString path = gPrefs->Read(wxT("/Directories/PresetsDir"), presetsDefaultLoc);
wxString extension = wxT(".csp");
wxString fName;
bool fileOkay;
do {
fileOkay = true;
fName = FileSelector(wxT("Open CleanSpeech Preset File:"),
path,
wxT("*.csp"), // default file name
extension,
wxT("CleanSpeech Presets (*.csp)|*.csp"),
wxFD_OPEN | wxRESIZE_BORDER);
if (fName.empty()) { // if cancel selected
return;
}
wxFFile presetsFile(fName, wxT("rb"));
bool flag = presetsFile.IsOpened();
if (flag == true) {
int preset[PRESET_COUNT];
int lenPreset = sizeof(preset);
int count = presetsFile.Read(preset, lenPreset);
if (preset[0] != PRESET_FORMAT) {
wxMessageBox(wxString::Format(wxT("Preset may be invalid or corrupted.\nExpected format %d ... found %d"), PRESET_FORMAT, preset[0]),
wxT("Error opening preset"),
wxOK | wxCENTRE | wxICON_WARNING, this);
return;
}
int expectedCount = wxGetApp().GetCleanSpeechNoiseGateExpectedCount();
float* pNoiseGate = wxGetApp().GetCleanSpeechNoiseGate();
// ANSWER-ME: Vigilant Sentry notes "count" is unused after this assignment.
// Should be checked against expectedCount -- but CleanSpeech is going away!!! ;-)
count = presetsFile.Read(pNoiseGate, expectedCount);
gPrefs->Write(wxT("/CsPresets/ClickThresholdLevel"), preset[2]);
gPrefs->Write(wxT("/CsPresets/ClickWidth"), preset[3]);
gPrefs->Write(wxT("/CsPresets/LevellerDbChoiceIndex"), preset[4]);
gPrefs->Write(wxT("/CsPresets/LevellerNumPasses"), preset[5]);
gPrefs->Write(wxT("/CsPresets/Noise_Level"), preset[6]);
gPrefs->Write(wxT("/CsPresets/Norm_AmpDbGain"), preset[7]);
gPrefs->Write(wxT("/CsPresets/Norm_RemoveDcOffset"), preset[8]);
gPrefs->Write(wxT("/CsPresets/SpikeDbChoiceIndex"), preset[9]);
gPrefs->Write(wxT("/CsPresets/SpikeMaxDurationMs"), preset[10]);
gPrefs->Write(wxT("/Effects/TruncateSilence/DbChoiceIndex"), preset[11]);
gPrefs->Write(wxT("/Effects/TruncateSilence/LongestAllowedSilentMs"), preset[12]);
// gPrefs->Write(wxT("/GUI/Save128HqMasterAfter"), preset[14]);
// gPrefs->Write(wxT("/GUI/Save128HqMasterBefore"), preset[15]);
gPrefs->Flush();
double noiseGateSum = 0.0;
int lenNoiseGate = expectedCount / sizeof(float);
for (int i = 0; i < lenNoiseGate; ++i) {
noiseGateSum += fabs(pNoiseGate[i]);
}
preset[13] = abs((int)noiseGateSum);
presetsFile.Close();
}
else {
wxMessageBox(wxT("Problem encountered importing presets."),
wxT("Unable to import"),
wxOK | wxICON_WARNING);
fileOkay = false;
continue;
}
} while(!fileOkay);
}
#endif // CLEANSPEECH
void AudacityProject::OnApplyChain() void AudacityProject::OnApplyChain()
{ {

View File

@ -354,17 +354,8 @@ void OnProcessEffect(int index);
void OnProcessPlugin(int index); void OnProcessPlugin(int index);
void OnAnalyzeEffect(int index); void OnAnalyzeEffect(int index);
void OnAnalyzePlugin(int index); void OnAnalyzePlugin(int index);
//lda CleanSpeech Menu //CLEANSPEECH
void OnApplyChain(); void OnApplyChain();
void OnEditChains(); void OnEditChains();
#ifdef CLEANSPEECH
void OnImportCleanSpeechPresets();
void OnExportCleanSpeechPresets();
#endif // CLEANSPEECH
void OnStereoToMono(int index); void OnStereoToMono(int index);
wxString BuildCleanFileName(wxString fileName, wxString extension); wxString BuildCleanFileName(wxString fileName, wxString extension);

View File

@ -740,9 +740,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mAudioIOToken(-1), mAudioIOToken(-1),
mIsDeleting(false), mIsDeleting(false),
mTracksFitVerticallyZoomed(false), //lda mTracksFitVerticallyZoomed(false), //lda
#ifdef CLEANSPEECH
mCleanSpeechMode(false), //lda
#endif // CLEANSPEECH
mShowId3Dialog(true), //lda mShowId3Dialog(true), //lda
mLastFocusedWindow(NULL), mLastFocusedWindow(NULL),
mKeyboardCaptured(NULL), mKeyboardCaptured(NULL),
@ -1020,12 +1017,6 @@ void AudacityProject::UpdatePrefsVariables()
{ {
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true); gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"),&mNormalizeOnLoad, false); gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"),&mNormalizeOnLoad, false);
#ifdef CLEANSPEECH
//gPrefs->Read(wxT("/Batch/CleanSpeechMode"), &mCleanSpeechMode, false);
mCleanSpeechMode = false;
#endif // CLEANSPEECH
gPrefs->Read(wxT("/GUI/AutoScroll"), &mViewInfo.bUpdateTrackIndicator, true); gPrefs->Read(wxT("/GUI/AutoScroll"), &mViewInfo.bUpdateTrackIndicator, true);
gPrefs->Read(wxT("/GUI/EmptyCanBeDirty"), &mEmptyCanBeDirty, true ); gPrefs->Read(wxT("/GUI/EmptyCanBeDirty"), &mEmptyCanBeDirty, true );
gPrefs->Read(wxT("/GUI/Help"), &mHelpPref, wxT("InBrowser") ); gPrefs->Read(wxT("/GUI/Help"), &mHelpPref, wxT("InBrowser") );
@ -1166,11 +1157,7 @@ void AudacityProject::SetProjectTitle()
wxString name = GetName(); wxString name = GetName();
if( name.IsEmpty() ) if( name.IsEmpty() )
{ {
#ifdef CLEANSPEECH
name = mCleanSpeechMode ? wxT("Audacity CleanSpeech") : wxT("Audacity");
#else
name = wxT("Audacity"); name = wxT("Audacity");
#endif // CLEANSPEECH
} }
if (mIsRecovered) if (mIsRecovered)
@ -3102,20 +3089,6 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
return false; return false;
mImportedDependencies = false; // do not show again mImportedDependencies = false; // do not show again
} }
#ifdef CLEANSPEECH
//TIDY-ME: CleanSpeechMode could be split into a number of prefs?
// For example, this could be a preference to only work
// with wav files.
//
// CleanSpeechMode tries hard to ignore project files
// and just work with .Wav, so does an export on a save.
if( mCleanSpeechMode )
{
Exporter e;
return e.Process(this, false, 0.0, mTracks->GetEndTime());
}
#endif // CLEANSPEECH
} }
// //
@ -3530,53 +3503,10 @@ bool AudacityProject::SaveAs(bool bWantSaveCompressed /*= false*/)
wxString path = wxPathOnly(mFileName); wxString path = wxPathOnly(mFileName);
wxString fName; wxString fName;
#ifdef CLEANSPEECH
wxString ext = mCleanSpeechMode ? wxT(".wav") : wxT(".aup");
#else // CLEANSPEECH
wxString ext = wxT(".aup"); wxString ext = wxT(".aup");
#endif // CLEANSPEECH
fName = GetName().Len()? GetName() + ext : wxString(wxT("")); fName = GetName().Len()? GetName() + ext : wxString(wxT(""));
#ifdef CLEANSPEECH
if( mCleanSpeechMode )
{
fName = FileSelector(_("Save Speech As:"),
path, fName, wxT(""),
/* i18n-hint: Do not translate PCM.*/
_("Windows PCM Audio file (*.wav)|*.wav"), //lda
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER, this);
}
else
{
wxString sProjName = this->GetName();
if (sProjName.IsEmpty())
sProjName = _("<untitled>");
wxString sDialogTitle;
if (bWantSaveCompressed)
{
ShowWarningDialog(this, wxT("FirstProjectSave"),
_("Audacity compressed project files (.aup) save your work in a smaller, compressed (.ogg) format. \nCompressed project files are a good way to transmit your project online, because they are much smaller. \nTo open a compressed project takes longer than usual, as it imports each compressed track. \n\nMost other programs can't open Audacity project files.\nWhen you want to save a file that can be opened by other programs, select one of the\nExport commands."));
sDialogTitle.Printf(_("Save Compressed Project \"%s\" As..."), sProjName.c_str());
}
else
{
ShowWarningDialog(this, wxT("FirstProjectSave"),
_("You are saving an Audacity project file (.aup).\n\nSaving a project creates a file that only Audacity can open.\n\nTo save an audio file for other programs, use one of the \"File > Export\" commands.\n"));
sDialogTitle.Printf(_("Save Project \"%s\" As..."), sProjName.c_str());
}
fName = FileSelector(
sDialogTitle,
path, fName, wxT(""),
_("Audacity projects") + static_cast<wxString>(wxT(" (*.aup)|*.aup")),
// JKC: I removed 'wxFD_OVERWRITE_PROMPT' because we are checking
// for overwrite ourselves later, and we disallow it.
// We disallow overwrite because we would have to delete the many
// smaller files too, or prompt to move them.
wxFD_SAVE | wxRESIZE_BORDER, this);
}
#else // CLEANSPEECH
wxString sProjName = this->GetName(); wxString sProjName = this->GetName();
if (sProjName.IsEmpty()) if (sProjName.IsEmpty())
sProjName = _("<untitled>"); sProjName = _("<untitled>");
@ -3603,7 +3533,6 @@ bool AudacityProject::SaveAs(bool bWantSaveCompressed /*= false*/)
// We disallow overwrite because we would have to delete the many // We disallow overwrite because we would have to delete the many
// smaller files too, or prompt to move them. // smaller files too, or prompt to move them.
wxFD_SAVE | wxRESIZE_BORDER, this); wxFD_SAVE | wxRESIZE_BORDER, this);
#endif // CLEANSPEECH
if (fName == wxT("")) if (fName == wxT(""))
return false; return false;

View File

@ -222,11 +222,6 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
bool GetShowId3Dialog() { return mShowId3Dialog; } //lda bool GetShowId3Dialog() { return mShowId3Dialog; } //lda
void SetShowId3Dialog(bool flag) { mShowId3Dialog = flag; } //lda void SetShowId3Dialog(bool flag) { mShowId3Dialog = flag; } //lda
#ifdef CLEANSPEECH
bool GetCleanSpeechMode() { return mCleanSpeechMode; } //lda
void SetCleanSpeechMode(bool flag) { mCleanSpeechMode = flag; } //lda
#endif // CLEANSPEECH
bool GetNormalizeOnLoad() { return mNormalizeOnLoad; } //lda bool GetNormalizeOnLoad() { return mNormalizeOnLoad; } //lda
void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda
@ -516,9 +511,6 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
bool mIsDeleting; bool mIsDeleting;
bool mTracksFitVerticallyZoomed; //lda bool mTracksFitVerticallyZoomed; //lda
bool mNormalizeOnLoad; //lda bool mNormalizeOnLoad; //lda
#ifdef CLEANSPEECH
bool mCleanSpeechMode; //lda
#endif // CLEANSPEECH
bool mShowId3Dialog; //lda bool mShowId3Dialog; //lda
bool mEmptyCanBeDirty; bool mEmptyCanBeDirty;
bool mSelectAllOnNone; bool mSelectAllOnNone;

View File

@ -75,18 +75,6 @@ EffectClickRemoval::~EffectClickRemoval()
bool EffectClickRemoval::Init() bool EffectClickRemoval::Init()
{ {
#ifdef CLEANSPEECH
mThresholdLevel = gPrefs->Read(wxT("/CsPresets/ClickThresholdLevel"), 200);
if ((mThresholdLevel < MIN_THRESHOLD) || (mThresholdLevel > MAX_THRESHOLD)) { // corrupted Prefs?
mThresholdLevel = 0; //Off-skip
gPrefs->Write(wxT("/CsPresets/ClickThresholdLevel"), mThresholdLevel);
}
mClickWidth = gPrefs->Read(wxT("/CsPresets/ClickWidth"), 20);
if ((mClickWidth < MIN_CLICK_WIDTH) || (mClickWidth > MAX_CLICK_WIDTH)) { // corrupted Prefs?
mClickWidth = 0; //Off-skip
gPrefs->Write(wxT("/CsPresets/ClickWidth"), mClickWidth);
}
#else // CLEANSPEECH
mThresholdLevel = gPrefs->Read(wxT("/Effects/ClickRemoval/ClickThresholdLevel"), 200); mThresholdLevel = gPrefs->Read(wxT("/Effects/ClickRemoval/ClickThresholdLevel"), 200);
if ((mThresholdLevel < MIN_THRESHOLD) || (mThresholdLevel > MAX_THRESHOLD)) { // corrupted Prefs? if ((mThresholdLevel < MIN_THRESHOLD) || (mThresholdLevel > MAX_THRESHOLD)) { // corrupted Prefs?
mThresholdLevel = 0; //Off-skip mThresholdLevel = 0; //Off-skip
@ -97,7 +85,6 @@ bool EffectClickRemoval::Init()
mClickWidth = 0; //Off-skip mClickWidth = 0; //Off-skip
gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth); gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth);
} }
#endif // CLEANSPEECH
return gPrefs->Flush(); return gPrefs->Flush();
} }
@ -123,13 +110,8 @@ bool EffectClickRemoval::PromptUser()
mThresholdLevel = dlog.mThresh; mThresholdLevel = dlog.mThresh;
mClickWidth = dlog.mWidth; mClickWidth = dlog.mWidth;
#ifdef CLEANSPEECH
gPrefs->Write(wxT("/CsPresets/ClickThresholdLevel"), mThresholdLevel);
gPrefs->Write(wxT("/CsPresets/ClickWidth"), mClickWidth);
#else // CLEANSPEECH
gPrefs->Write(wxT("/Effects/ClickRemoval/ClickThresholdLevel"), mThresholdLevel); gPrefs->Write(wxT("/Effects/ClickRemoval/ClickThresholdLevel"), mThresholdLevel);
gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth); gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth);
#endif // CLEANSPEECH
return gPrefs->Flush(); return gPrefs->Flush();
} }

View File

@ -34,10 +34,10 @@ class TimeWarper;
// ADVANCED_EFFECT was introduced for Lynn Allan's 'CleanSpeech' // ADVANCED_EFFECT was introduced for Lynn Allan's 'CleanSpeech'
// it allows the list of effects to be filtered to exclude // it allows the list of effects to be filtered to exclude
// the advanced effects. // the advanced effects.
// Left in when CLEANSPEECH is removed, as it may be useful at some point. // Left in when CLEANSPEECH was removed, as it may be useful at some point.
#define ADVANCED_EFFECT 0x0004 #define ADVANCED_EFFECT 0x0004
// HIDDEN_EFFECT allows an item to be excluded from the effects // HIDDEN_EFFECT allows an item to be excluded from the effects
// menu in both CleanSpeech and in normal builds. // CLEANSPEECH ?? // menu
#define HIDDEN_EFFECT 0x0008 #define HIDDEN_EFFECT 0x0008
#define INSERT_EFFECT 0x0010 #define INSERT_EFFECT 0x0010

View File

@ -47,18 +47,6 @@ EffectLeveller::EffectLeveller()
bool EffectLeveller::Init() bool EffectLeveller::Init()
{ {
#ifdef CLEANSPEECH
mLevellerNumPasses = gPrefs->Read(wxT("/CsPresets/LevellerNumPasses"), 2L) ;
if ((mLevellerNumPasses <= 0) || (mLevellerNumPasses > NUM_PASSES_CHOICES)) { // corrupted Prefs?
mLevellerNumPasses = 1;
gPrefs->Write(wxT("/CsPresets/LevellerNumPasses"), 1);
}
mLevellerDbChoiceIndex = gPrefs->Read(wxT("/CsPresets/LevellerDbChoiceIndex"), 10L);
if ((mLevellerDbChoiceIndex < 0) || (mLevellerDbChoiceIndex >= Enums::NumDbChoices)) { // corrupted Prefs?
mLevellerDbChoiceIndex = 0; //Least dB
gPrefs->Write(wxT("/CsPresets/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex);
}
#else // CLEANSPEECH
mLevellerNumPasses = gPrefs->Read(wxT("/Effects/Leveller/LevellerNumPasses"), 2L) ; mLevellerNumPasses = gPrefs->Read(wxT("/Effects/Leveller/LevellerNumPasses"), 2L) ;
if ((mLevellerNumPasses <= 0) || (mLevellerNumPasses > NUM_PASSES_CHOICES)) { // corrupted Prefs? if ((mLevellerNumPasses <= 0) || (mLevellerNumPasses > NUM_PASSES_CHOICES)) { // corrupted Prefs?
mLevellerNumPasses = 1; mLevellerNumPasses = 1;
@ -69,7 +57,6 @@ bool EffectLeveller::Init()
mLevellerDbChoiceIndex = 0; //Least dB mLevellerDbChoiceIndex = 0; //Least dB
gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex); gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex);
} }
#endif // CLEANSPEECH
gPrefs->Flush(); gPrefs->Flush();
mLevellerDbSilenceThreshold = Enums::Db2Signal[mLevellerDbChoiceIndex]; mLevellerDbSilenceThreshold = Enums::Db2Signal[mLevellerDbChoiceIndex];
@ -145,13 +132,9 @@ bool EffectLeveller::PromptUser()
mLevellerNumPasses = dlog.mLevellerNumPassesChoicIndex+1; mLevellerNumPasses = dlog.mLevellerNumPassesChoicIndex+1;
mLevellerDbChoiceIndex = dlog.mLevellerDbChoiceIndex; mLevellerDbChoiceIndex = dlog.mLevellerDbChoiceIndex;
mLevellerDbSilenceThreshold = Enums::Db2Signal[mLevellerDbChoiceIndex]; mLevellerDbSilenceThreshold = Enums::Db2Signal[mLevellerDbChoiceIndex];
#ifdef CLEANSPEECH
gPrefs->Write(wxT("/CsPresets/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex);
gPrefs->Write(wxT("/CsPresets/LevellerNumPasses"), mLevellerNumPasses);
#else // CLEANSPEECH
gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex); gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex);
gPrefs->Write(wxT("/Effects/Leveller/LevellerNumPasses"), mLevellerNumPasses); gPrefs->Write(wxT("/Effects/Leveller/LevellerNumPasses"), mLevellerNumPasses);
#endif // CLEANSPEECH
gPrefs->Flush(); gPrefs->Flush();
CalcLevellerFactors(); CalcLevellerFactors();

View File

@ -81,18 +81,6 @@ EffectNoiseRemoval::EffectNoiseRemoval()
mWindowSize = 2048; mWindowSize = 2048;
mSpectrumSize = 1 + mWindowSize / 2; mSpectrumSize = 1 + mWindowSize / 2;
#ifdef CLEANSPEECH
gPrefs->Read(wxT("/CsPresets/NoiseSensitivity"),
&mSensitivity, 0.0);
gPrefs->Read(wxT("/CsPresets/NoiseGain"),
&mNoiseGain, -24.0);
gPrefs->Read(wxT("/CsPresets/NoiseFreqSmoothing"),
&mFreqSmoothingHz, 150.0);
gPrefs->Read(wxT("/CsPresets/NoiseAttackDecayTime"),
&mAttackDecayTime, 0.15);
gPrefs->Read(wxT("/CsPresets/NoiseLeaveNoise"),
&mbLeaveNoise, false);
#else // CLEANSPEECH
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseSensitivity"), gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseSensitivity"),
&mSensitivity, 0.0); &mSensitivity, 0.0);
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseGain"), gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseGain"),
@ -103,7 +91,6 @@ EffectNoiseRemoval::EffectNoiseRemoval()
&mAttackDecayTime, 0.15); &mAttackDecayTime, 0.15);
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"), gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"),
&mbLeaveNoise, false); &mbLeaveNoise, false);
#endif // CLEANSPEECH
// mbLeaveNoise = false; // mbLeaveNoise = false;
@ -113,14 +100,6 @@ EffectNoiseRemoval::EffectNoiseRemoval()
mNoiseThreshold = new float[mSpectrumSize]; mNoiseThreshold = new float[mSpectrumSize];
#ifdef CLEANSPEECH
// This sequence is safe, even if not in CleanSpeechMode
wxGetApp().SetCleanSpeechNoiseGate(mNoiseThreshold);
wxGetApp().SetCleanSpeechNoiseGateExpectedCount(
mSpectrumSize * sizeof(float));
CleanSpeechMayReadNoisegate();
#endif // CLEANSPEECH
Init(); Init();
} }
@ -129,115 +108,14 @@ EffectNoiseRemoval::~EffectNoiseRemoval()
delete [] mNoiseThreshold; delete [] mNoiseThreshold;
} }
#ifdef CLEANSPEECH
void EffectNoiseRemoval::CleanSpeechMayReadNoisegate()
{
int halfWindowSize = mWindowSize / 2;
//lda-131a always try to get noisegate.nrp if in CleanSpeechMode
// and it exists
AudacityProject * project = GetActiveProject();
if (project == NULL) {
//int mode = gPrefs->Read(wxT("/Batch/CleanSpeechMode"), 0L);
int mode = 0;
if (mode == 0) {
return;
}
}
// Try to open the file.
if( !wxDirExists( FileNames::NRPDir() ))
return;
// if file doesn't exist, return quietly.
wxString fileName = FileNames::NRPFile();
if( !wxFileExists( fileName ))
return;
wxFFile noiseGateFile(fileName, wxT("rb"));
bool flag = noiseGateFile.IsOpened();
if (flag != true)
return;
// Now get its data.
int expectedCount = halfWindowSize * sizeof(float);
int count = noiseGateFile.Read(mNoiseThreshold, expectedCount);
noiseGateFile.Close();
if (count == expectedCount) {
for (int i = halfWindowSize; i < mSpectrumSize; ++i) {
mNoiseThreshold[i] = float(0.0); // only partly filled by Read?
}
mHasProfile = true;
mDoProfile = false;
}
}
void EffectNoiseRemoval::CleanSpeechMayWriteNoiseGate()
{
AudacityProject * project = GetActiveProject();
if( !project || !project->GetCleanSpeechMode() )
return;
// code borrowed from ThemeBase::SaveComponents() - MJS
// IF directory doesn't exist THEN create it
if( !wxDirExists( FileNames::NRPDir() ))
{
/// \bug 1 in wxWidgets documentation; wxMkDir returns false if
/// directory didn't exist, even if it successfully creates it.
/// so we create and then test if it exists instead.
/// \bug 2 in wxWidgets documentation; wxMkDir has only one argument
/// under MSW
#ifdef __WXMSW__
wxMkDir( FileNames::NRPDir().fn_str() );
#else
wxMkDir( FileNames::NRPDir().fn_str(), 0700 );
#endif
if( !wxDirExists( FileNames::NRPDir() ))
{
wxMessageBox(
wxString::Format(
_("Could not create directory:\n %s"),
FileNames::NRPDir().c_str() ));
return;
}
}
wxString fileName = FileNames::NRPFile();
fileName = PlatformCompatibility::GetLongFileName(fileName);
wxFFile noiseGateFile(fileName, wxT("wb"));
bool flag = noiseGateFile.IsOpened();
if (flag == true) {
int expectedCount = (mWindowSize / 2) * sizeof(float);
// FIX-ME: Should we check return value on Write?
noiseGateFile.Write(mNoiseThreshold, expectedCount);
noiseGateFile.Close();
}
else {
wxMessageBox(
wxString::Format(
_("Could not open file:\n %s"), fileName.c_str() ));
return;
}
}
#endif // CLEANSPEECH
#define MAX_NOISE_LEVEL 30 #define MAX_NOISE_LEVEL 30
bool EffectNoiseRemoval::Init() bool EffectNoiseRemoval::Init()
{ {
#ifdef CLEANSPEECH
mLevel = gPrefs->Read(wxT("/CsPresets/Noise_Level"), 3L);
if ((mLevel < 0) || (mLevel > MAX_NOISE_LEVEL)) { // corrupted Prefs?
mLevel = 0; //Off-skip
gPrefs->Write(wxT("/CsPresets/Noise_Level"), mLevel);
}
#else // CLEANSPEECH
mLevel = gPrefs->Read(wxT("/Effects/NoiseRemoval/Noise_Level"), 3L); mLevel = gPrefs->Read(wxT("/Effects/NoiseRemoval/Noise_Level"), 3L);
if ((mLevel < 0) || (mLevel > MAX_NOISE_LEVEL)) { // corrupted Prefs? if ((mLevel < 0) || (mLevel > MAX_NOISE_LEVEL)) { // corrupted Prefs?
mLevel = 0; //Off-skip mLevel = 0; //Off-skip
gPrefs->Write(wxT("/Effects/NoiseRemoval/Noise_Level"), mLevel); gPrefs->Write(wxT("/Effects/NoiseRemoval/Noise_Level"), mLevel);
} }
#endif // CLEANSPEECH
return gPrefs->Flush(); return gPrefs->Flush();
} }
@ -258,15 +136,6 @@ bool EffectNoiseRemoval::PromptUser()
dlog.mKeepSignal->SetValue(!mbLeaveNoise); dlog.mKeepSignal->SetValue(!mbLeaveNoise);
dlog.mKeepNoise->SetValue(mbLeaveNoise); dlog.mKeepNoise->SetValue(mbLeaveNoise);
#ifdef CLEANSPEECH
if( !mHasProfile )
{
AudacityProject * p = GetActiveProject();
if (p->GetCleanSpeechMode())
CleanSpeechMayReadNoisegate();
}
#endif // CLEANSPEECH
// We may want to twiddle the levels if we are setting // We may want to twiddle the levels if we are setting
// from an automation dialog, the only case in which we can // from an automation dialog, the only case in which we can
// get here without any wavetracks. // get here without any wavetracks.
@ -294,19 +163,12 @@ bool EffectNoiseRemoval::PromptUser()
mFreqSmoothingHz = dlog.mFreq; mFreqSmoothingHz = dlog.mFreq;
mAttackDecayTime = dlog.mTime; mAttackDecayTime = dlog.mTime;
mbLeaveNoise = dlog.mbLeaveNoise; mbLeaveNoise = dlog.mbLeaveNoise;
#ifdef CLEANSPEECH
gPrefs->Write(wxT("/CsPresets/NoiseSensitivity"), mSensitivity);
gPrefs->Write(wxT("/CsPresets/NoiseGain"), mNoiseGain);
gPrefs->Write(wxT("/CsPresets/NoiseFreqSmoothing"), mFreqSmoothingHz);
gPrefs->Write(wxT("/CsPresets/NoiseAttackDecayTime"), mAttackDecayTime);
gPrefs->Write(wxT("/CsPresets/NoiseLeaveNoise"), mbLeaveNoise);
#else // CLEANSPEECH
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseSensitivity"), mSensitivity); gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseSensitivity"), mSensitivity);
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseGain"), mNoiseGain); gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseGain"), mNoiseGain);
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"), mFreqSmoothingHz); gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"), mFreqSmoothingHz);
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"), mAttackDecayTime); gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"), mAttackDecayTime);
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"), mbLeaveNoise); gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"), mbLeaveNoise);
#endif // CLEANSPEECH
mDoProfile = (dlog.GetReturnCode() == 1); mDoProfile = (dlog.GetReturnCode() == 1);
return gPrefs->Flush(); return gPrefs->Flush();
@ -322,19 +184,6 @@ bool EffectNoiseRemoval::TransferParameters( Shuttle & shuttle )
bool EffectNoiseRemoval::Process() bool EffectNoiseRemoval::Process()
{ {
#ifdef CLEANSPEECH
if (!mDoProfile && !mHasProfile)
CleanSpeechMayReadNoisegate();
// If we still don't have a profile we have a problem.
// This should only happen in CleanSpeech.
if(!mDoProfile && !mHasProfile) {
wxMessageBox(
_("Attempt to run Noise Removal without a noise profile.\n"));
return false;
}
#endif // CLEANSPEECH
Initialize(); Initialize();
// This same code will both remove noise and profile it, // This same code will both remove noise and profile it,
@ -367,9 +216,6 @@ bool EffectNoiseRemoval::Process()
} }
if (bGoodResult && mDoProfile) { if (bGoodResult && mDoProfile) {
#ifdef CLEANSPEECH
CleanSpeechMayWriteNoiseGate();
#endif // CLEANSPEECH
mHasProfile = true; mHasProfile = true;
mDoProfile = false; mDoProfile = false;
} }
@ -890,45 +736,10 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S)
wxString step2Label; wxString step2Label;
wxString step2Prompt; wxString step2Prompt;
#ifdef CLEANSPEECH
bool bCleanSpeechMode = false;
AudacityProject * project = GetActiveProject();
if( project && project->GetCleanSpeechMode() ) {
bCleanSpeechMode = true;
}
if (bCleanSpeechMode) {
// We're not marking these as translatable because most people
// don't use CleanSpeech so it'd be a waste of time for most
// translators
step1Label = wxT("Preparation Step");
step1Prompt = wxT("Listen carefully to section with some speech "
wxT("and some silence to check before/after.\n")
wxT("Select a few seconds of just noise ('thinner' ")
wxT("part of wave pattern usually between\nspoken ")
wxT("phrases or during pauses) so Audacity knows ")
wxT("what to filter out, then click"));
step2Label = wxT("Actually Remove Noise");
step2Prompt = wxT("Select what part of the audio you want filtered "
wxT("(Ctrl-A = All), chose how much noise\nyou want ")
wxT("filtered out with sliders below, and then click ")
wxT("'OK' to remove noise.\nFind best setting with ")
wxT("Ctrl-Z to Undo, Select All, and change ")
wxT("the slider positions."));
}
else {
step1Label = _("Step 1");
step1Prompt = _("Select a few seconds of just noise so Audacity knows what to filter out,\nthen click Get Noise Profile:");
step2Label = _("Step 2");
step2Prompt = _("Select all of the audio you want filtered, choose how much noise you want\nfiltered out, and then click 'OK' to remove noise.\n");
}
#else
step1Label = _("Step 1"); step1Label = _("Step 1");
step1Prompt = _("Select a few seconds of just noise so Audacity knows what to filter out,\nthen click Get Noise Profile:"); step1Prompt = _("Select a few seconds of just noise so Audacity knows what to filter out,\nthen click Get Noise Profile:");
step2Label = _("Step 2"); step2Label = _("Step 2");
step2Prompt = _("Select all of the audio you want filtered, choose how much noise you want\nfiltered out, and then click 'OK' to remove noise.\n"); step2Prompt = _("Select all of the audio you want filtered, choose how much noise you want\nfiltered out, and then click 'OK' to remove noise.\n");
#endif // CLEANSPEECH
S.StartHorizontalLay(wxCENTER, false); S.StartHorizontalLay(wxCENTER, false);
{ {

View File

@ -62,10 +62,6 @@ public:
virtual bool Process(); virtual bool Process();
private: private:
#ifdef CLEANSPEECH
void CleanSpeechMayReadNoisegate();
void CleanSpeechMayWriteNoiseGate();
#endif // CLEANSPEECH
bool mDoProfile; bool mDoProfile;
bool mHasProfile; bool mHasProfile;

View File

@ -44,12 +44,6 @@
BEGIN_EVENT_TABLE(BatchPrefs, wxPanel) BEGIN_EVENT_TABLE(BatchPrefs, wxPanel)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef CLEANSPEECH
enum { CleanSpeechID,
MP3ConversionID,
};
#endif // CLEANSPEECH
/// Constructor /// Constructor
BatchPrefs::BatchPrefs(wxWindow * parent): BatchPrefs::BatchPrefs(wxWindow * parent):
PrefsPanel(parent, _("Batch")) PrefsPanel(parent, _("Batch"))
@ -80,10 +74,6 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S )
S.TieCheckBox( _("&Don't apply effects in batch mode"), S.TieCheckBox( _("&Don't apply effects in batch mode"),
wxT("/Batch/Debug"), false); wxT("/Batch/Debug"), false);
#endif #endif
#ifdef CLEANSPEECH
// S.TieCheckBox( _("Cl&eanSpeech Mode (Customized GUI)"),
// wxT("/Batch/CleanSpeechMode"), false);
#endif // CLEANSPEECH
} }
S.EndStatic(); S.EndStatic();
S.EndHorizontalLay(); S.EndHorizontalLay();
@ -91,36 +81,12 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S )
return; return;
} }
#ifdef CLEANSPEECH
// This commented out code might be useful as a first step if we want an immediate response to
// switching in and out of CleanSpeech mode.
// As things currently stand, the batch commands available will NOT reflect changes in
// CleanSpeech mode until we close and reopen the preferences dialog.
#if 0
int mode;
AudacityProject *proj = GetActiveProject();
mode = gPrefs->Read(wxT("/Batch/CleanSpeechMode"), 1L);
proj->GetControlToolBar()->SetCleanSpeechMode(mode == 1);
#endif
#endif // CLEANSPEECH
/// Send changed values back to Prefs, and update Audacity. /// Send changed values back to Prefs, and update Audacity.
bool BatchPrefs::Apply() bool BatchPrefs::Apply()
{ {
ShuttleGui S( this, eIsSavingToPrefs ); ShuttleGui S( this, eIsSavingToPrefs );
PopulateOrExchange( S ); PopulateOrExchange( S );
#ifdef CLEANSPEECH
unsigned mode;
//mode = gPrefs->Read(wxT("/Batch/CleanSpeechMode"), 1L);
mode = 0;
for(unsigned i=0; i<gAudacityProjects.GetCount(); i++)
if(gAudacityProjects[i])
{
gAudacityProjects[i]->SetCleanSpeechMode(mode == 1);
gAudacityProjects[i]->mToolManager->LayoutToolBars(); // Just to add/remove the CleanSpeech button.
}
#endif // CLEANSPEECH
return true; return true;
} }

View File

@ -133,21 +133,6 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
false); false);
} }
S.EndStatic(); S.EndStatic();
#ifdef CLEANSPEECH
S.StartStatic(_("Modes"));
{
S.TieCheckBox(_("Clea&nSpeech Mode (Customized GUI)"),
wxT("/Batch/CleanSpeechMode"),
false);
#ifdef __WXDEBUG__
S.TieCheckBox(_("Don't a&pply effects in batch mode"),
wxT("/Batch/Debug"),
false);
#endif
}
S.EndStatic();
#endif // CLEANSPEECH
} }
bool GUIPrefs::Apply() bool GUIPrefs::Apply()

View File

@ -94,10 +94,6 @@ ControlToolBar::ControlToolBar()
mCutPreviewTracks = NULL; mCutPreviewTracks = NULL;
gPrefs->Read(wxT("/GUI/ErgonomicTransportButtons"), &mErgonomicTransportButtons, true); gPrefs->Read(wxT("/GUI/ErgonomicTransportButtons"), &mErgonomicTransportButtons, true);
#ifdef CLEANSPEECH
// gPrefs->Read(wxT("/Batch/CleanSpeechMode"), &mCleanSpeechMode, false);
mCleanSpeechMode = false;
#endif // CLEANSPEECH
} }
ControlToolBar::~ControlToolBar() ControlToolBar::~ControlToolBar()
@ -195,12 +191,6 @@ void ControlToolBar::Populate()
mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled, mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled,
ID_RECORD_BUTTON, true, _("Record")); ID_RECORD_BUTTON, true, _("Record"));
#ifdef CLEANSPEECH
/* i18n-hint: (verb)*/
// mBatch = MakeButton(bmpCleanSpeech, bmpCleanSpeech, bmpCleanSpeechDisabled,
// ID_BATCH_BUTTON, false, _("Clean Speech"));
#endif // CLEANSPEECH
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
RegenerateToolsTooltips(); RegenerateToolsTooltips();
wxToolTip::Enable(true); wxToolTip::Enable(true);
@ -237,17 +227,6 @@ void ControlToolBar::UpdatePrefs()
updated = true; updated = true;
} }
#ifdef CLEANSPEECH
//gPrefs->Read( wxT("/Batch/CleanSpeechMode"), &active, false );
active = false;
if( mCleanSpeechMode != active )
{
mCleanSpeechMode = active;
updated = true;
}
#endif // CLEANSPEECH
if( updated ) if( updated )
{ {
ReCreateButtons(); ReCreateButtons();
@ -309,12 +288,6 @@ void ControlToolBar::ArrangeButtons()
mSizer->Add( mFF, 0, flags, 5 ); mSizer->Add( mFF, 0, flags, 5 );
} }
#ifdef CLEANSPEECH
// Add and possible hide the CleanSpeech button
// mSizer->Add( mBatch, 0, flags | wxLEFT, 5 );
// mSizer->Show( mBatch, mCleanSpeechMode );
#endif // CLEANSPEECH
// Layout the sizer // Layout the sizer
mSizer->Layout(); mSizer->Layout();
@ -381,16 +354,6 @@ void ControlToolBar::EnableDisableButtons()
mPlay->SetEnabled((!recording) || (tracks && !busy)); mPlay->SetEnabled((!recording) || (tracks && !busy));
mRecord->SetEnabled(!busy && !playing); mRecord->SetEnabled(!busy && !playing);
#ifdef CLEANSPEECH
if (p && GetActiveProject()->GetCleanSpeechMode()) {
bool canRecord = !tracks;
canRecord &= !busy;
canRecord &= ((numProjects == 0) || ((numProjects == 1) && !tracks));
mRecord->SetEnabled(canRecord);
//mBatch->SetEnabled(!busy && !recording);
}
#endif // CLEANSPEECH
mStop->SetEnabled(busy); mStop->SetEnabled(busy);
mRewind->SetEnabled(tracks && !busy); mRewind->SetEnabled(tracks && !busy);
mFF->SetEnabled(tracks && !busy); mFF->SetEnabled(tracks && !busy);
@ -772,20 +735,6 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
return; return;
} }
AudacityProject *p = GetActiveProject(); AudacityProject *p = GetActiveProject();
#ifdef CLEANSPEECH
if (p && p->GetCleanSpeechMode()) {
size_t numProjects = gAudacityProjects.Count();
if (!p->GetTracks()->IsEmpty() || (numProjects > 1)) {
wxMessageBox(_("Recording in CleanSpeech mode is not possible when a track, or more than one project, is already open."),
_("Recording not permitted"),
wxOK | wxICON_INFORMATION,
this);
mRecord->PopUp();
mRecord->Disable();
return;
}
}
#endif // CLEANSPEECH
if( evt.GetInt() == 1 ) // used when called by keyboard shortcut. Default (0) ignored. if( evt.GetInt() == 1 ) // used when called by keyboard shortcut. Default (0) ignored.
mRecord->SetShift(true); mRecord->SetShift(true);

View File

@ -123,11 +123,6 @@ class ControlToolBar:public ToolBar {
// Activate ergonomic order for transport buttons // Activate ergonomic order for transport buttons
bool mErgonomicTransportButtons; bool mErgonomicTransportButtons;
#ifdef CLEANSPEECH
// Show/hide cleanspeech button
bool mCleanSpeechMode;
#endif // CLEANSPEECH
//wxBoxSizer *mBatchGroup; //wxBoxSizer *mBatchGroup;
wxBoxSizer *mSizer; wxBoxSizer *mSizer;