1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-14 07:10:24 +02:00

Inserting CLEANSPEECH ifdef's around anything CleanSpeech so that CleanSpeech can be removed easily in the (not to distant) future. The idea is never to turn CLEANSPEECH on, but fix any (unexpected) differences this may make.

This commit is contained in:
martynshaw99 2012-04-26 22:57:04 +00:00
parent 08b68fd96a
commit 758a8f65e6
24 changed files with 632 additions and 206 deletions

View File

@ -1,50 +0,0 @@
/* XPM */
static const char * CleanSpeech[] = {
"16 16 31 1",
" c None",
". c #000000",
"+ c #FFED71",
"@ c #FFE06B",
"# c #FFDA68",
"$ c #FFD666",
"% c #F0C05C",
"& c #634E25",
"* c #FCCC62",
"= c #F5C25D",
"- c #F4C15C",
"; c #F0BE5A",
"> c #CAA04C",
", c #4B3B1C",
"' c #E8B858",
") c #E2B356",
"! c #BD9647",
"~ c #44361A",
"{ c #FF0000",
"] c #E2B255",
"^ c #BC9547",
"/ c #443619",
"( c #DDAF53",
"_ c #B89245",
": c #B89246",
"< c #9E7D3C",
"[ c #403218",
"} c #624E25",
"| c #4A3B1C",
"1 c #3F3218",
"2 c #1E180B",
"................",
"................",
"..+@########$%&.",
"..@*=-------;>,.",
"..#='''''''')!~.",
".....#-'{]^/....",
"....#-'{{{]^/...",
"...#-'{{{{{]^/..",
"...#-'{{{{{]^/..",
"...#-'{{{{{]^/..",
"....#-'{{{]^/...",
".....#-'{]^/....",
"..$;)]]]]]]](_/.",
"..%>!^^^^^^^:<[.",
"..}|~////////12.",
"................"};

View File

@ -1,47 +0,0 @@
/* XPM */
static const char * CleanSpeechAlpha[] = {
"16 16 28 1",
" c None",
". c #000000",
"+ c #0C0C0C",
"@ c #4B4B4B",
"# c #757575",
"$ c #7D7D7D",
"% c #646464",
"& c #2A2A2A",
"* c #848484",
"= c #F0F0F0",
"- c #FFFFFF",
"; c #C6C6C6",
"> c #3B3B3B",
", c #1C1C1C",
"' c #D7D7D7",
") c #747474",
"! c #EEEEEE",
"~ c #161616",
"{ c #7C7C7C",
"] c #CACACA",
"^ c #F4F4F4",
"/ c #FDFDFD",
"( c #E4E4E4",
"_ c #AAAAAA",
": c #474747",
"< c #BABABA",
"[ c #DCDCDC",
"} c #181818",
".....+@#$%&.....",
"...+*=-----;>...",
"..,'---------)..",
".+'-----------%.",
".*------------!~",
"+=-------------{",
"@--------------]",
"#--------------^",
"$--------------/",
"%--------------(",
"&--------------_",
".;-------------:",
".>------------<.",
"..)----------[}.",
"...%!-------<}..",
"....~{]^/(_:...."};

View File

@ -1,69 +0,0 @@
/* XPM */
static const char * CleanSpeechDisabled[] = {
"16 16 50 1",
" c None",
". c #6B6B6B",
"+ c #6E6D6D",
"@ c #807979",
"# c #8B8080",
"$ c #8C8181",
"% c #857C7C",
"& c #757272",
"* c #918585",
"= c #AE9999",
"- c #AF9999",
"; c #AC9898",
"> c #AB9696",
", c #AA9696",
"' c #A99595",
") c #998A8A",
"! c #787474",
"~ c #737070",
"{ c #B09A9A",
"] c #A79494",
"^ c #A59393",
"/ c #A59292",
"( c #A39191",
"_ c #837B7B",
": c #A49292",
"< c #A49191",
"[ c #9F8E8E",
"} c #7D7777",
"| c #A19090",
"1 c #968888",
"2 c #A29090",
"3 c #9B8C8C",
"4 c #7F7878",
"5 c #A79393",
"6 c #9E8D8D",
"7 c #8A8080",
"8 c #AD9898",
"9 c #908484",
"0 c #9E8E8E",
"a c #8F8484",
"b c #847C7C",
"c c #9C8C8C",
"d c #897F7F",
"e c #978989",
"f c #8F8383",
"g c #9F8F8F",
"h c #948787",
"i c #A29191",
"j c #6D6C6C",
"k c #978888",
".....+@#$%&.....",
"...+*=-;>,')!...",
"..~'{,]^//^^(_..",
".+'-]::<<<<:([}.",
".*{]:<<<<<<((|1+",
"+=,:<<<<<<<((234",
"@-5:<<<<<<<<((67",
"#8^<<<<<<<<<<([9",
"$>:<<<<<<<<<<(0a",
"b,/<<<<<<<<<((cd",
"&'^<<<<<<<<<(2e@",
".)^:((<<<<<((6f~",
".!(((((<<(((gh@.",
".._[|i((((26h%j.",
"...}kc6[0cef@j..",
"....+479ad@~...."};

View File

@ -62,8 +62,10 @@ from there. Audacity will look for a file called "Pause.png".
DEFINE_IMAGE( bmpFFwdDisabled, wxImage( 16, 16 ), wxT("FFwdDisabled"));
DEFINE_IMAGE( bmpRecord, wxImage( 16, 16 ), wxT("Record"));
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 );
DEFINE_IMAGE( bmpUpButtonLarge, wxImage( 48, 48 ), wxT("UpButtonLarge"));

View File

@ -978,11 +978,13 @@ bool AudacityApp::OnInit()
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
#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
// discovery writes configuration to the correct directory
// on OSX with case-sensitive file systems.
@ -1044,7 +1046,9 @@ bool AudacityApp::OnInit()
//
wxString home = wxGetHomeDir();
#ifdef CLEANSPEECH
mAppHomeDir = home;
#endif // CLEANSPEECH
theTheme.EnsureInitialised();
// AColor depends on theTheme.
@ -1145,6 +1149,7 @@ bool AudacityApp::OnInit()
if (lang == wxT(""))
lang = GetSystemLanguageCode();
#ifdef CLEANSPEECH
#ifdef NOT_RQD
//TIDY-ME: (CleanSpeech) Language prompt??
// The prompt for language only happens ONCE on a system.
@ -1155,7 +1160,7 @@ bool AudacityApp::OnInit()
//lda if (lang == "")
//lda lang = ChooseLanguage(NULL);
#endif
#endif // CLEANSPEECH
mLocale = NULL;
InitLang( lang );
@ -1168,7 +1173,9 @@ bool AudacityApp::OnInit()
}
// More initialization
#ifdef CLEANSPEECH
InitCleanSpeech();
#endif // CLEANSPEECH
InitDitherers();
InitAudioIO();
@ -1434,6 +1441,7 @@ void AudacityApp::OnReceiveCommand(AppCommandEvent &event)
mCmdHandler->OnReceiveCommand(event);
}
#ifdef CLEANSPEECH //is this actually useful?
bool AudacityApp::InitCleanSpeech()
{
wxString userdatadir = FileNames::DataDir();
@ -1482,6 +1490,7 @@ bool AudacityApp::InitCleanSpeech()
gPrefs->Write(wxT("/Directories/PresetsDir"), presets);
return true;
}
#endif // CLEANSPEECH
bool AudacityApp::InitTempDir()
{

View File

@ -27,6 +27,7 @@
#include "widgets/FileHistory.h"
#include "ondemand/ODTaskThread.h"
#include "Experimental.h"
class IPCServ;
class Importer;
@ -97,12 +98,14 @@ class AudacityApp:public wxApp {
virtual int OnExit(void);
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 );
// These are currently only used on Mac OS, where it's
@ -224,6 +227,7 @@ class AudacityApp:public wxApp {
/* utility method for printing the command line help message */
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"
@ -232,12 +236,15 @@ class AudacityApp:public wxApp {
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;
#if defined(__WXMSW__)

View File

@ -49,7 +49,8 @@ See also BatchCommandDialog and BatchProcessDialog.
enum eCommandType { CtEffect, CtMenu, CtSpecial };
// TIDY-ME: Not currently translated,
// but there are issues to address if we do.
// but there are issues to address if we do.
// CLEANSPEECH remnant
wxString SpecialCommands[] = {
wxT("NoAction"),
wxT("Import"),
@ -61,8 +62,11 @@ wxString SpecialCommands[] = {
wxT("ExportOgg"),
wxT("ExportWav")
};
// end CLEANSPEECH remnant
#ifdef CLEANSPEECH
static const wxString CleanSpeech = wxT("CleanSpeech");
#endif // CLEANSPEECH
static const wxString MP3Conversion = wxT("MP3 Conversion");
BatchCommands::BatchCommands()
@ -70,11 +74,13 @@ BatchCommands::BatchCommands()
ResetChain();
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) {
AddChain(MP3Conversion);
@ -222,6 +228,7 @@ bool BatchCommands::RenameChain(const wxString & oldchain, const wxString & newc
return wxRenameFile(oname.GetFullPath(), nname.GetFullPath());
}
#ifdef CLEANSPEECH
void BatchCommands::SetCleanSpeechChain()
{
ResetChain();
@ -239,8 +246,9 @@ void BatchCommands::SetCleanSpeechChain()
AddToChain( wxT("Normalize") );
AddToChain( wxT("ExportMp3") );
}
#endif // CLEANSPEECH
void BatchCommands::SetWavToMp3Chain()
void BatchCommands::SetWavToMp3Chain() // a function per default chain? This is flawed design! MJS
{
ResetChain();
@ -262,14 +270,19 @@ wxArrayString BatchCommands::GetAllCommands()
EffectArray * effects;
unsigned int i;
// CLEANSPEECH remnant
for(i=0;i<sizeof(SpecialCommands)/sizeof(SpecialCommands[0]);i++)
{
commands.Add( SpecialCommands[i] );
}
// end CLEANSPEECH remnant
int additionalEffects=ADVANCED_EFFECT;
#ifdef CLEANSPEECH
if( project->GetCleanSpeechMode() )
additionalEffects = 0;
#endif // CLEANSPEECH
effects = EffectManager::Get().GetEffects(PROCESS_EFFECT | BUILTIN_EFFECT | additionalEffects);
for(i=0; i<effects->GetCount(); i++) {
command=(*effects)[i]->GetEffectIdentifier();
@ -410,6 +423,7 @@ bool BatchCommands::WriteMp3File( const wxString Name, int bitrate )
// If you find yourself adding lots of existing commands from the menus here, STOP
// and think again.
// ======= IMPORTANT ========
// CLEANSPEECH remnant
bool BatchCommands::ApplySpecialCommand(int iCommand, const wxString command,const wxString params)
{
if (ReportAndSkip(command, params))
@ -491,6 +505,7 @@ bool BatchCommands::ApplySpecialCommand(int iCommand, const wxString command,con
wxMessageBox(wxString::Format(_("Command %s not implemented yet"),command.c_str()));
return false;
}
// end CLEANSPEECH remnant
bool BatchCommands::SetCurrentParametersFor( Effect * f, const wxString command, const wxString params)
{
@ -528,30 +543,24 @@ bool BatchCommands::ApplyEffectCommand( Effect * f, const wxString command, co
return project->OnEffect(ALL_EFFECTS | CONFIGURED_EFFECT , f, params, false);
}
bool BatchCommands::ApplyMenuCommand(const wxString command, const wxString params)
{
if( ReportAndSkip(command, params))
return true;
return true;
}
bool BatchCommands::ApplyCommand(const wxString command, const wxString params)
{
unsigned int i;
// Test for a special command.
// CLEANSPEECH remnant
for(i=0;i<sizeof(SpecialCommands)/sizeof(SpecialCommands[0]);i++)
{
if( command == SpecialCommands[i] )
return ApplySpecialCommand( i, command, params );
}
// end CLEANSPEECH remnant
// Test for an effect.
Effect * f = EffectManager::Get().GetEffectByIdentifier( command );
if( f!=NULL )
return ApplyEffectCommand( f, command, params );
// return ApplyMenuCommand( command, params );
wxMessageBox(
wxString::Format(
_("Your batch command of %s was not recognised."), command.c_str() ));
@ -701,10 +710,14 @@ wxArrayString BatchCommands::GetNames()
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)
return true;
#endif // CLEANSPEECH
return false;
}
@ -713,6 +726,7 @@ void BatchCommands::RestoreChain(const wxString & name)
// TIDY-ME: Effects change their name with localisation.
// 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) {
@ -721,6 +735,10 @@ void BatchCommands::RestoreChain(const wxString & name)
else if (name == MP3Conversion) {
SetWavToMp3Chain();
}
#else
if (name == MP3Conversion)
SetWavToMp3Chain();
#endif // CLEANSPEECH
}
void BatchCommands::Split(const wxString & str, wxString & command, wxString & param)

View File

@ -29,7 +29,6 @@ class BatchCommands {
bool ApplyCommandInBatchMode(const wxString & command, const wxString &params);
bool ApplySpecialCommand(int iCommand, const wxString command,const wxString params);
bool ApplyEffectCommand(Effect * f, const wxString command, const wxString params);
bool ApplyMenuCommand(const wxString command, const wxString params);
bool ReportAndSkip( const wxString command, const wxString params );
void AbortBatch();
@ -62,7 +61,9 @@ class BatchCommands {
int GetCount();
void SetWavToMp3Chain();
#ifdef CLEANSPEECH
void SetCleanSpeechChain();
#endif // CLEANSPEECH
bool IsFixed(const wxString & name);

View File

@ -64,6 +64,8 @@ BatchProcessDialog::BatchProcessDialog(wxWindow * parent):
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
AudacityProject * p = GetActiveProject();
#ifdef CLEANSPEECH
if (p->GetCleanSpeechMode())
{
/*i18n-hint: CleanSpeech is the name of a mode Audacity can operate
@ -71,6 +73,7 @@ BatchProcessDialog::BatchProcessDialog(wxWindow * parent):
* pauses and background noise.*/
SetTitle(_("CleanSpeech Batch Processing"));
}
#endif // CLEANSPEECH
SetLabel(_("Apply Chain")); // Provide visual label
SetName(_("Apply Chain")); // Provide audible label
@ -124,7 +127,12 @@ void BatchProcessDialog::PopulateOrExchange(ShuttleGui &S)
}
// 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(""));
#endif // CLEANSPEECH
int item = mChains->FindItem(-1, name);
if (item == -1) {
item = 0;
@ -207,10 +215,14 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent &event)
}
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...");
#endif // CLEANSPEECH
FormatList l;
wxString filter;
@ -425,7 +437,11 @@ void EditChainsDialog::Populate()
// ----------------------- End of main section --------------
// 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(""));
#endif // CLEANSPEECH
// Go populate the chains list.
PopulateChains();

View File

@ -157,4 +157,4 @@
//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
//#define CLEANSPEECH 1

View File

@ -174,8 +174,12 @@ void AudacityProjectCommandFunctor::operator()(int index )
/// CreateMenusAndCommands builds the menus, and also rebuilds them after
/// changes in configured preferences - for example changes in key-bindings
/// 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()
{
CommandManager *c = &mCommandManager;
@ -213,7 +217,8 @@ void AudacityProject::CreateMenusAndCommands()
c->AddItem(wxT("Close"), _("&Close"), FN(OnClose), wxT("Ctrl+W"));
if (!mCleanSpeechMode) {
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->AddItem(wxT("Save"), _("&Save Project"), FN(OnSave), wxT("Ctrl+S"),
AudioIONotBusyFlag | UnsavedChangesFlag,
AudioIONotBusyFlag | UnsavedChangesFlag);
@ -222,6 +227,15 @@ void AudacityProject::CreateMenusAndCommands()
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"),
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
#endif // CLEANSPEECH
c->AddItem(wxT("CheckDeps"), _("Chec&k Dependencies..."), FN(OnCheckDependencies));
@ -233,8 +247,8 @@ void AudacityProject::CreateMenusAndCommands()
/////////////////////////////////////////////////////////////////////////////
if (!mCleanSpeechMode) {
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->BeginSubMenu(_("&Import"));
c->AddItem(wxT("ImportAudio"), _("&Audio..."), FN(OnImport), wxT("Ctrl+Shift+I"));
@ -248,6 +262,20 @@ void AudacityProject::CreateMenusAndCommands()
c->AddSeparator();
}
#else // 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();
#endif // CLEANSPEECH
/////////////////////////////////////////////////////////////////////////////
@ -261,8 +289,8 @@ void AudacityProject::CreateMenusAndCommands()
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag);
if (!mCleanSpeechMode) {
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->AddSeparator();
c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels),
@ -277,12 +305,28 @@ void AudacityProject::CreateMenusAndCommands()
AudioIONotBusyFlag | NoteTracksSelectedFlag);
#endif
}
#else // CLEANSPEECH
c->AddSeparator();
c->AddItem(wxT("ExportLabels"), _("Export &Labels..."), FN(OnExportLabels),
AudioIONotBusyFlag | LabelTracksExistFlag,
AudioIONotBusyFlag | LabelTracksExistFlag);
c->AddItem(wxT("ExportMultiple"), _("Export &Multiple..."), FN(OnExportMultiple),
AudioIONotBusyFlag | TracksExistFlag,
AudioIONotBusyFlag | TracksExistFlag);
#if defined(USE_MIDI)
c->AddItem(wxT("ExportMIDI"), _("Export MIDI..."), FN(OnExportMIDI),
AudioIONotBusyFlag | NoteTracksSelectedFlag,
AudioIONotBusyFlag | NoteTracksSelectedFlag);
#endif
#endif // CLEANSPEECH
c->AddItem(wxT("ApplyChain"), _("Appl&y Chain..."), FN(OnApplyChain),
AudioIONotBusyFlag,
AudioIONotBusyFlag);
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));
@ -304,6 +348,22 @@ void AudacityProject::CreateMenusAndCommands()
AudioIONotBusyFlag | TracksExistFlag,
AudioIONotBusyFlag | TracksExistFlag);
}
#else // CLEANSPEECH
#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);
#endif // CLEANSPEECH
c->AddSeparator();
@ -395,6 +455,7 @@ void AudacityProject::CreateMenusAndCommands()
/* i18n-hint: (verb)*/
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) {
@ -402,6 +463,7 @@ void AudacityProject::CreateMenusAndCommands()
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | StereoRequiredFlag | WaveTracksSelectedFlag);
}
#endif // CLEANSPEECH
c->AddSeparator();
@ -684,7 +746,8 @@ void AudacityProject::CreateMenusAndCommands()
#endif
c->AddItem(wxT("RescanDevices"), _("R&escan Audio Devices"), FN(OnRescanDevices));
if (!mCleanSpeechMode) {
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
//////////////////////////////////////////////////////////////////////////
// Tracks Menu (formerly Project Menu)
@ -708,8 +771,8 @@ void AudacityProject::CreateMenusAndCommands()
c->AddSeparator();
// StereoToMono moves to the Edit menu when in CleanSpeech mode.
// It belongs here normally, because it is a kind of mix-down.
// 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);
@ -882,7 +945,207 @@ void AudacityProject::CreateMenusAndCommands()
#endif // EFFECT_CATEGORIES
c->EndMenu();
}
} // end of CLEANSPEECH 'if'
#else // 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();
#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),
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"));
c->AddItem(wxT("UnMuteAllTracks"), _("&UnMute All Tracks"), FN(OnUnMuteAllTracks), wxT("Ctrl+Shift+U"));
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->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();
#endif // CLEANSPEECH
/////////////////////////////////////////////////////////////////////////////
// Effect Menu
@ -905,8 +1168,12 @@ void AudacityProject::CreateMenusAndCommands()
c->AddSeparator();
#ifdef CLEANSPEECH
// Cleanspeech doesn't have advanced effects
int additionalEffects = mCleanSpeechMode ? 0 : ADVANCED_EFFECT;
#else
int additionalEffects = ADVANCED_EFFECT;
#endif // CLEANSPEECH
// 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
@ -923,7 +1190,8 @@ void AudacityProject::CreateMenusAndCommands()
}
delete effects;
if (!mCleanSpeechMode) {
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
effects = em.GetEffects(PROCESS_EFFECT | PLUGIN_EFFECT);
if (effects->GetCount()) {
c->AddSeparator();
@ -935,18 +1203,32 @@ void AudacityProject::CreateMenusAndCommands()
}
delete effects;
}
#else // 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;
#endif // CLEANSPEECH
c->EndMenu();
#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;
#endif // CLEANSPEECH
// The categories form a DAG, so we start at the roots (the categories
// without incoming links)
CategorySet roots = em.GetRootCategories();
@ -973,7 +1255,8 @@ void AudacityProject::CreateMenusAndCommands()
#endif
if (!mCleanSpeechMode) {
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
//////////////////////////////////////////////////////////////////////////
// Analyze Menu
@ -1044,7 +1327,78 @@ void AudacityProject::CreateMenusAndCommands()
#endif // EFFECT_CATEGORIES
c->EndMenu();
} // end of CLEANSPEECH if
#else // 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();
#endif // CLEANSPEECH
/////////////////////////////////////////////////////////////////////////////
// Help Menu
@ -1057,17 +1411,22 @@ void AudacityProject::CreateMenusAndCommands()
c->BeginMenu(_("&Help"));
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));
#endif // CLEANSPEECH
c->AddItem(wxT("QuickHelp"), _("&Quick Help (in web browser)"), FN(OnQuickHelp));
c->AddItem(wxT("Manual"), _("&Manual (in web browser)"), FN(OnManual));
if (!mCleanSpeechMode) {
#ifdef CLEANSPEECH
if (!mCleanSpeechMode) { // CLEANSPEECH
c->AddSeparator();
@ -1085,7 +1444,25 @@ void AudacityProject::CreateMenusAndCommands()
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->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));
#endif // CLEANSPEECH
c->EndMenu();
@ -2825,9 +3202,11 @@ void AudacityProject::OnProcessAny(int index)
void AudacityProject::OnProcessEffect(int index)
{
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);
}
@ -5587,6 +5966,8 @@ void AudacityProject::OnEditLabels()
#define PRESET_FORMAT 20050428
// #define PRESET_COUNT 16
#define PRESET_COUNT 14
#ifdef CLEANSPEECH
void AudacityProject::OnExportCleanSpeechPresets()
{
wxString userdatadir = FileNames::DataDir();
@ -5751,6 +6132,8 @@ void AudacityProject::OnImportCleanSpeechPresets()
} while(!fileOkay);
}
#endif // CLEANSPEECH
void AudacityProject::OnApplyChain()
{
BatchProcessDialog dlg(this);

View File

@ -353,12 +353,16 @@ void OnProcessPlugin(int index);
void OnAnalyzeEffect(int index);
void OnAnalyzePlugin(int index);
//lda CleanSpeech Menu
//lda CleanSpeech Menu //CLEANSPEECH
void OnApplyChain();
void OnEditChains();
#ifdef CLEANSPEECH
void OnImportCleanSpeechPresets();
void OnExportCleanSpeechPresets();
#endif // CLEANSPEECH
void OnStereoToMono(int index);
wxString BuildCleanFileName(wxString fileName);

View File

@ -740,7 +740,9 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mAudioIOToken(-1),
mIsDeleting(false),
mTracksFitVerticallyZoomed(false), //lda
#ifdef CLEANSPEECH
mCleanSpeechMode(false), //lda
#endif // CLEANSPEECH
mShowId3Dialog(true), //lda
mLastFocusedWindow(NULL),
mKeyboardCaptured(false),
@ -1019,8 +1021,10 @@ void AudacityProject::UpdatePrefsVariables()
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
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/EmptyCanBeDirty"), &mEmptyCanBeDirty, true );
@ -1162,7 +1166,11 @@ void AudacityProject::SetProjectTitle()
wxString name = GetName();
if( name.IsEmpty() )
{
#ifdef CLEANSPEECH
name = mCleanSpeechMode ? wxT("Audacity CleanSpeech") : wxT("Audacity");
#else
name = wxT("Audacity");
#endif // CLEANSPEECH
}
if (mIsRecovered)
@ -3085,6 +3093,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
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.
@ -3096,6 +3105,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
Exporter e;
return e.Process(this, false, 0.0, mTracks->GetEndTime());
}
#endif // CLEANSPEECH
}
//
@ -3509,9 +3519,16 @@ bool AudacityProject::SaveAs(bool bWantSaveCompressed /*= false*/)
{
wxString path = wxPathOnly(mFileName);
wxString fName;
#ifdef CLEANSPEECH
wxString ext = mCleanSpeechMode ? wxT(".wav") : wxT(".aup");
#else // CLEANSPEECH
wxString ext = wxT(".aup");
#endif // CLEANSPEECH
fName = GetName().Len()? GetName() + ext : wxString(wxT(""));
#ifdef CLEANSPEECH
if( mCleanSpeechMode )
{
fName = FileSelector(_("Save Speech As:"),
@ -3549,6 +3566,34 @@ bool AudacityProject::SaveAs(bool bWantSaveCompressed /*= false*/)
// smaller files too, or prompt to move them.
wxFD_SAVE | wxRESIZE_BORDER, this);
}
#else // CLEANSPEECH
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);
#endif // CLEANSPEECH
if (fName == wxT(""))
return false;

View File

@ -222,8 +222,10 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
bool GetShowId3Dialog() { return mShowId3Dialog; } //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
void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda
@ -512,7 +514,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
bool mIsDeleting;
bool mTracksFitVerticallyZoomed; //lda
bool mNormalizeOnLoad; //lda
#ifdef CLEANSPEECH
bool mCleanSpeechMode; //lda
#endif // CLEANSPEECH
bool mShowId3Dialog; //lda
bool mEmptyCanBeDirty;
bool mSelectAllOnNone;

View File

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

View File

@ -75,7 +75,6 @@ bool EffectDtmf::Init()
gPrefs->Read(wxT("/Effects/DtmfGen/SequenceDuration"), &mDuration, 1L);
mIsSelection = false;
}
/// \todo this code shouldn't be using /CsPresets - need to review its use
gPrefs->Read(wxT("/Effects/DtmfGen/String"), &dtmfString, wxT("audacity"));
gPrefs->Read(wxT("/Effects/DtmfGen/DutyCycle"), &dtmfDutyCycle, 550L);
gPrefs->Read(wxT("/Effects/DtmfGen/Amplitude"), &dtmfAmplitude, 0.8f);

View File

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

View File

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

View File

@ -237,7 +237,6 @@ void LoadEffects()
const int SIMPLE_EFFECT = BUILTIN_EFFECT | PROCESS_EFFECT;
// In this list, designating an effect as 'SIMPLE_EFFECT' just means
// that it should be included in even the most basic of menus.
// This was introduced for CleanSpeech mode.
em.RegisterEffect(new EffectAutoDuck());
em.RegisterEffect(new EffectBassBoost());

View File

@ -81,6 +81,7 @@ EffectNoiseRemoval::EffectNoiseRemoval()
mWindowSize = 2048;
mSpectrumSize = 1 + mWindowSize / 2;
#ifdef CLEANSPEECH
gPrefs->Read(wxT("/CsPresets/NoiseSensitivity"),
&mSensitivity, 0.0);
gPrefs->Read(wxT("/CsPresets/NoiseGain"),
@ -91,6 +92,18 @@ EffectNoiseRemoval::EffectNoiseRemoval()
&mAttackDecayTime, 0.15);
gPrefs->Read(wxT("/CsPresets/NoiseLeaveNoise"),
&mbLeaveNoise, false);
#else // CLEANSPEECH
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseSensitivity"),
&mSensitivity, 0.0);
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseGain"),
&mNoiseGain, -24.0);
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"),
&mFreqSmoothingHz, 150.0);
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"),
&mAttackDecayTime, 0.15);
gPrefs->Read(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"),
&mbLeaveNoise, false);
#endif // CLEANSPEECH
// mbLeaveNoise = false;
@ -100,11 +113,13 @@ EffectNoiseRemoval::EffectNoiseRemoval()
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();
}
@ -114,6 +129,7 @@ EffectNoiseRemoval::~EffectNoiseRemoval()
delete [] mNoiseThreshold;
}
#ifdef CLEANSPEECH
void EffectNoiseRemoval::CleanSpeechMayReadNoisegate()
{
int halfWindowSize = mWindowSize / 2;
@ -204,14 +220,24 @@ void EffectNoiseRemoval::CleanSpeechMayWriteNoiseGate()
}
}
#endif // CLEANSPEECH
#define MAX_NOISE_LEVEL 30
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);
if ((mLevel < 0) || (mLevel > MAX_NOISE_LEVEL)) { // corrupted Prefs?
mLevel = 0; //Off-skip
gPrefs->Write(wxT("/Effects/NoiseRemoval/Noise_Level"), mLevel);
}
#endif // CLEANSPEECH
return true;
}
@ -232,12 +258,14 @@ bool EffectNoiseRemoval::PromptUser()
dlog.mKeepSignal->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
// from an automation dialog, the only case in which we can
@ -266,11 +294,19 @@ bool EffectNoiseRemoval::PromptUser()
mFreqSmoothingHz = dlog.mFreq;
mAttackDecayTime = dlog.mTime;
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/NoiseGain"), mNoiseGain);
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseFreqSmoothing"), mFreqSmoothingHz);
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseAttackDecayTime"), mAttackDecayTime);
gPrefs->Write(wxT("/Effects/NoiseRemoval/NoiseLeaveNoise"), mbLeaveNoise);
#endif // CLEANSPEECH
mDoProfile = (dlog.GetReturnCode() == 1);
return true;
@ -286,6 +322,7 @@ bool EffectNoiseRemoval::TransferParameters( Shuttle & shuttle )
bool EffectNoiseRemoval::Process()
{
#ifdef CLEANSPEECH
if (!mDoProfile && !mHasProfile)
CleanSpeechMayReadNoisegate();
@ -296,6 +333,7 @@ bool EffectNoiseRemoval::Process()
_("Attempt to run Noise Removal without a noise profile.\n"));
return false;
}
#endif // CLEANSPEECH
Initialize();
@ -329,7 +367,9 @@ bool EffectNoiseRemoval::Process()
}
if (bGoodResult && mDoProfile) {
#ifdef CLEANSPEECH
CleanSpeechMayWriteNoiseGate();
#endif // CLEANSPEECH
mHasProfile = true;
mDoProfile = false;
}
@ -850,6 +890,7 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S)
wxString step2Label;
wxString step2Prompt;
#ifdef CLEANSPEECH
bool bCleanSpeechMode = false;
AudacityProject * project = GetActiveProject();
@ -882,6 +923,12 @@ void NoiseRemovalDialog::PopulateOrExchange(ShuttleGui & S)
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");
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");
#endif // CLEANSPEECH
S.StartHorizontalLay(wxCENTER, false);
{

View File

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

View File

@ -44,9 +44,11 @@
BEGIN_EVENT_TABLE(BatchPrefs, wxPanel)
END_EVENT_TABLE()
#ifdef CLEANSPEECH
enum { CleanSpeechID,
MP3ConversionID,
};
#endif // CLEANSPEECH
/// Constructor
BatchPrefs::BatchPrefs(wxWindow * parent):
@ -78,8 +80,10 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S )
S.TieCheckBox( _("&Don't apply effects in batch mode"),
wxT("/Batch/Debug"), false);
#endif
#ifdef CLEANSPEECH
// S.TieCheckBox( _("Cl&eanSpeech Mode (Customized GUI)"),
// wxT("/Batch/CleanSpeechMode"), false);
#endif // CLEANSPEECH
}
S.EndStatic();
S.EndHorizontalLay();
@ -87,6 +91,7 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S )
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
@ -97,6 +102,7 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S )
mode = gPrefs->Read(wxT("/Batch/CleanSpeechMode"), 1L);
proj->GetControlToolBar()->SetCleanSpeechMode(mode == 1);
#endif
#endif // CLEANSPEECH
/// Send changed values back to Prefs, and update Audacity.
bool BatchPrefs::Apply()
@ -104,6 +110,7 @@ bool BatchPrefs::Apply()
ShuttleGui S( this, eIsSavingToPrefs );
PopulateOrExchange( S );
#ifdef CLEANSPEECH
unsigned mode;
//mode = gPrefs->Read(wxT("/Batch/CleanSpeechMode"), 1L);
mode = 0;
@ -113,6 +120,7 @@ bool BatchPrefs::Apply()
gAudacityProjects[i]->SetCleanSpeechMode(mode == 1);
gAudacityProjects[i]->mToolManager->LayoutToolBars(); // Just to add/remove the CleanSpeech button.
}
#endif // CLEANSPEECH
return true;
}

View File

@ -94,8 +94,10 @@ ControlToolBar::ControlToolBar()
mCutPreviewTracks = NULL;
gPrefs->Read(wxT("/GUI/ErgonomicTransportButtons"), &mErgonomicTransportButtons, true);
#ifdef CLEANSPEECH
// gPrefs->Read(wxT("/Batch/CleanSpeechMode"), &mCleanSpeechMode, false);
mCleanSpeechMode = false;
#endif // CLEANSPEECH
}
ControlToolBar::~ControlToolBar()
@ -193,9 +195,11 @@ void ControlToolBar::Populate()
mRecord = MakeButton(bmpRecord, bmpRecord, bmpRecordDisabled,
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
RegenerateToolsTooltips();
@ -216,7 +220,6 @@ void ControlToolBar::RegenerateToolsTooltips()
mRewind->SetToolTip(_("Skip to Start"));
mFF->SetToolTip(_("Skip to End"));
mRecord->SetToolTip(_("Record (Shift for Append Record)"));
// mBatch->SetToolTip(_("Clean Speech"));
#endif
}
@ -234,13 +237,16 @@ void ControlToolBar::UpdatePrefs()
updated = true;
}
#ifdef CLEANSPEECH
//gPrefs->Read( wxT("/Batch/CleanSpeechMode"), &active, false );
active = false;
if( mCleanSpeechMode != active )
{
mCleanSpeechMode = active;
updated = true;
}
#endif // CLEANSPEECH
if( updated )
{
@ -303,9 +309,11 @@ void ControlToolBar::ArrangeButtons()
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
mSizer->Layout();
@ -351,8 +359,6 @@ void ControlToolBar::EnableDisableButtons()
AudacityProject *p = GetActiveProject();
size_t numProjects = gAudacityProjects.Count();
bool tracks = false;
// bool cleaningSpeech = mBatch->IsDown();
bool cleaningSpeech = false;
bool playing = mPlay->IsDown();
bool recording = mRecord->IsDown();
bool busy = gAudioIO->IsBusy() || playing || recording;
@ -372,19 +378,20 @@ void ControlToolBar::EnableDisableButtons()
}
}
mPlay->SetEnabled((!recording) || (tracks && !busy && !cleaningSpeech));
mPlay->SetEnabled((!recording) || (tracks && !busy));
mRecord->SetEnabled(!busy && !playing);
#ifdef CLEANSPEECH
if (p && GetActiveProject()->GetCleanSpeechMode()) {
bool canRecord = !tracks;
canRecord &= !cleaningSpeech;
canRecord &= !busy;
canRecord &= ((numProjects == 0) || ((numProjects == 1) && !tracks));
mRecord->SetEnabled(canRecord);
//mBatch->SetEnabled(!busy && !recording);
}
#endif // CLEANSPEECH
mStop->SetEnabled(busy && !cleaningSpeech);
mStop->SetEnabled(busy);
mRewind->SetEnabled(tracks && !busy);
mFF->SetEnabled(tracks && !busy);
mPause->SetEnabled(true);
@ -765,6 +772,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
return;
}
AudacityProject *p = GetActiveProject();
#ifdef CLEANSPEECH
if (p && p->GetCleanSpeechMode()) {
size_t numProjects = gAudacityProjects.Count();
if (!p->GetTracks()->IsEmpty() || (numProjects > 1)) {
@ -777,6 +785,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
return;
}
}
#endif // CLEANSPEECH
if( evt.GetInt() == 1 ) // used when called by keyboard shortcut. Default (0) ignored.
mRecord->SetShift(true);

View File

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