From 7fa73dbde7eca1897a631a8be2e3a20751941143 Mon Sep 17 00:00:00 2001 From: James Crook Date: Fri, 9 Feb 2018 19:12:25 +0000 Subject: [PATCH] SetClip, SetLabel, SetProject added - SetTrack also updated with more options. --- src/LabelTrack.h | 3 +- src/Menus.cpp | 32 +++-- src/Menus.h | 2 +- src/MixerBoard.cpp | 2 +- src/SelectedRegion.h | 3 +- src/commands/Command.cpp | 4 + src/commands/GetInfoCommand.cpp | 56 ++++---- src/commands/GetInfoCommand.h | 2 +- src/commands/HelpCommand.cpp | 2 +- src/commands/LoadCommands.cpp | 9 +- src/commands/ScreenshotCommand.cpp | 18 +-- src/commands/SetClipCommand.cpp | 123 ++++++++++++++++++ src/commands/SetClipCommand.h | 51 ++++++++ src/commands/SetLabelCommand.cpp | 104 +++++++++++++++ src/commands/SetLabelCommand.h | 53 ++++++++ src/commands/SetProjectCommand.cpp | 72 ++++++++++ src/commands/SetProjectCommand.h | 54 ++++++++ src/commands/SetTrackInfoCommand.cpp | 79 +++++++---- src/commands/SetTrackInfoCommand.h | 22 ++-- src/effects/AutoDuck.cpp | 10 +- src/effects/AutoDuck.h | 2 +- src/effects/ChangeSpeed.cpp | 8 +- src/effects/Distortion.cpp | 14 +- src/effects/EffectManager.cpp | 15 ++- src/effects/EffectManager.h | 3 +- src/effects/Equalization.cpp | 16 +-- src/effects/Noise.cpp | 14 +- src/effects/ScienFilter.cpp | 28 ++-- src/effects/ToneGen.cpp | 28 ++-- src/effects/TruncSilence.cpp | 18 +-- src/ondemand/ODComputeSummaryTask.cpp | 4 +- win/Projects/Audacity/Audacity.vcxproj | 6 + .../Audacity/Audacity.vcxproj.filters | 18 +++ 33 files changed, 708 insertions(+), 167 deletions(-) create mode 100644 src/commands/SetClipCommand.cpp create mode 100644 src/commands/SetClipCommand.h create mode 100644 src/commands/SetLabelCommand.cpp create mode 100644 src/commands/SetLabelCommand.h create mode 100644 src/commands/SetProjectCommand.cpp create mode 100644 src/commands/SetProjectCommand.h diff --git a/src/LabelTrack.h b/src/LabelTrack.h index e6ecf66dc..a13715e09 100644 --- a/src/LabelTrack.h +++ b/src/LabelTrack.h @@ -321,7 +321,8 @@ private: protected: std::shared_ptr GetControls() override; std::shared_ptr GetVRulerControls() override; - friend class GetInfoCommand; + friend class GetInfoCommand; // to get labels. + friend class SetLabelCommand; // to set labels. }; #endif diff --git a/src/Menus.cpp b/src/Menus.cpp index 0b8186649..8217d3968 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -1598,6 +1598,10 @@ void AudacityProject::CreateMenusAndCommands() AudioIONotBusyFlag, AudioIONotBusyFlag); c->AddItem(wxT("CompareAudio"), _("Compare Audio..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); + c->AddItem(wxT("GetPreference"), _("Get Preference..."), FN(OnAudacityCommand), + AudioIONotBusyFlag, AudioIONotBusyFlag); + c->AddItem(wxT("GetInfo"), _("Get Info..."), FN(OnAudacityCommand), + AudioIONotBusyFlag, AudioIONotBusyFlag); c->AddItem(wxT("SelectTime"), _("Select Time..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); c->AddItem(wxT("SelectTracks"), _("Select Tracks..."), FN(OnAudacityCommand), @@ -1606,14 +1610,14 @@ void AudacityProject::CreateMenusAndCommands() AudioIONotBusyFlag, AudioIONotBusyFlag); c->AddItem(wxT("SetPreference"), _("Set Preference..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); - c->AddItem(wxT("SetTrackInfo"), _("Set Track Info..."), FN(OnAudacityCommand), + c->AddItem(wxT("SetClip"), _("Set Clip..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); - c->AddItem(wxT("GetPreference"), _("Get Preference..."), FN(OnAudacityCommand), + c->AddItem(wxT("SetLabel"), _("Set Label..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); - c->AddItem(wxT("GetInfo"), _("Get Info..."), FN(OnAudacityCommand), + c->AddItem(wxT("SetProject"), _("Set Project..."), FN(OnAudacityCommand), + AudioIONotBusyFlag, AudioIONotBusyFlag); + c->AddItem(wxT("SetTrack"), _("Set Track..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); -// c->AddItem(wxT("GetTrackInfo"), _("Get Track Info..."), FN(OnAudacityCommand), -// AudioIONotBusyFlag, AudioIONotBusyFlag); c->EndSubMenu(); @@ -6365,7 +6369,7 @@ int AudacityProject::FindClips(double t0, double t1, bool next, std::vector results; int nTracksSearched = 0; - int trackNumber = 1; + int trackNum = 1; while (track) { if (track->GetKind() == Track::Wave && (!anyWaveTracksSelected || track->GetSelected())) { auto waveTrack = static_cast(track); @@ -6374,7 +6378,7 @@ int AudacityProject::FindClips(double t0, double t1, bool next, std::vector results; int nTracksSearched = 0; - int trackNumber = 1; + int trackNum = 1; while (track) { if (track->GetKind() == Track::Wave && (!anyWaveTracksSelected || track->GetSelected())) { auto waveTrack = static_cast(track); @@ -7460,7 +7464,7 @@ int AudacityProject::FindClipBoundaries(double time, bool next, std::vector 0) { - result.trackNumber = trackNumber; + result.trackNum = trackNum; result.channel = stereoAndDiff; results.push_back(result); } @@ -7469,7 +7473,7 @@ int AudacityProject::FindClipBoundaries(double time, bool next, std::vector 0) { - result.trackNumber = trackNumber; + result.trackNum = trackNum; result.channel = stereoAndDiff; results.push_back(result); } @@ -7478,7 +7482,7 @@ int AudacityProject::FindClipBoundaries(double time, bool next, std::vectorGetName(); auto shortName = name == waveTrack->GetDefaultName() /* i18n-hint: compose a name identifying an unnamed track by number */ - ? wxString::Format( _("Track %d"), trackNumber ) + ? wxString::Format( _("Track %d"), trackNum ) : name; auto longName = shortName; if (channel) { diff --git a/src/Menus.h b/src/Menus.h index 3983c8aa7..d570e7c26 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -312,7 +312,7 @@ void OnSelectCursorToNextClipBoundary(const CommandContext &context ); void OnSelectClipBoundary(bool next); struct FoundTrack { const WaveTrack* waveTrack{}; - int trackNumber{}; + int trackNum{}; bool channel{}; wxString ComposeTrackName() const; diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index 964cae4bc..4d5db94d3 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -599,7 +599,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1) // rmsRight[i] *= gain; // } // if ( mMeter ) mMeter->UpdateDisplay( - // 2, // If mono, show left track values in both meters, as in MeterToolBar, rather than kNumChannels. + // 2, // If mono, show left track values in both meters, as in MeterToolBar, rather than nChannels. // kFramesPerBuffer, // maxLeft, rmsLeft, // maxRight, rmsRight, diff --git a/src/SelectedRegion.h b/src/SelectedRegion.h index de49cb2d3..957ef82b8 100644 --- a/src/SelectedRegion.h +++ b/src/SelectedRegion.h @@ -222,7 +222,6 @@ public: const wxChar *legacyT0Name = sDefaultT0Name, const wxChar *legacyT1Name = sDefaultT1Name); -private: bool ensureOrdering() { if (mT1 < mT0) { @@ -235,6 +234,8 @@ private: return false; } +private: + #ifdef EXPERIMENTAL_SPECTRAL_EDITING bool ensureFrequencyOrdering() { diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 1ab45883a..ffe8018dc 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -286,7 +286,11 @@ bool CommandImplementation::Apply(const CommandContext & WXUNUSED(context)) } // Hackery so that we don't have to update the makefiles on linux (yet) +// When we do, these all can leave here. #if defined( __LINUX__ ) #include "CommandTargets.cpp" +#include "SetClipCommand.cpp" +#include "SetLabelCommand.cpp" +#include "SetProjectCommand.cpp" #endif diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index 7d608adbe..1e3339dd4 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -38,10 +38,21 @@ This class now lists #include "../ShuttleGui.h" #include "CommandContext.h" -const int nTypes =6; +enum { + kCommands, + kCommandsPlus, + kMenus, + kTracks, + kClips, + kLabels, + kBoxes, + nTypes +}; + static const wxString kTypes[nTypes] = { XO("Commands"), + XO("Commands+"), XO("Menus"), XO("Tracks"), XO("Clips"), @@ -50,16 +61,12 @@ static const wxString kTypes[nTypes] = }; enum { - kCommands, - kMenus, - kTracks, - kClips, - kLabels, - kBoxes + kJson, + kLisp, + kBrief, + nFormats }; - -const int nFormats =3; static const wxString kFormats[nFormats] = { XO("JSON"), @@ -67,11 +74,6 @@ static const wxString kFormats[nFormats] = XO("Brief") }; -enum { - kJson , - kLisp, - kBrief -}; bool GetInfoCommand::DefineParams( ShuttleParams & S ){ @@ -125,12 +127,13 @@ bool GetInfoCommand::Apply(const CommandContext &context) bool GetInfoCommand::ApplyInner(const CommandContext &context) { switch( mInfoType ){ - case kCommands : return SendCommands( context ); - case kMenus : return SendMenus( context ); - case kTracks : return SendTracks( context ); - case kClips : return SendClips( context ); - case kLabels : return SendLabels( context ); - case kBoxes : return SendBoxes( context ); + case kCommands : return SendCommands( context, 0 ); + case kCommandsPlus : return SendCommands( context, 1 ); + case kMenus : return SendMenus( context ); + case kTracks : return SendTracks( context ); + case kClips : return SendClips( context ); + case kLabels : return SendLabels( context ); + case kBoxes : return SendBoxes( context ); default: context.Status( "Command options not recognised" ); } @@ -167,7 +170,7 @@ bool GetInfoCommand::SendMenus(const CommandContext &context) /** Send the list of commands. */ -bool GetInfoCommand::SendCommands(const CommandContext &context ) +bool GetInfoCommand::SendCommands(const CommandContext &context, int flags ) { context.StartArray(); PluginManager & pm = PluginManager::Get(); @@ -178,7 +181,7 @@ bool GetInfoCommand::SendCommands(const CommandContext &context ) { auto command = em.GetCommandIdentifier(plug->GetID()); if (!command.IsEmpty()){ - em.GetCommandDefinition( plug->GetID(), context ); + em.GetCommandDefinition( plug->GetID(), context, flags ); } plug = pm.GetNextPlugin(PluginTypeEffect | PluginTypeAudacityCommand ); } @@ -255,12 +258,13 @@ bool GetInfoCommand::SendClips(const CommandContext &context) while (t) { if (t->GetKind() == Track::Wave) { WaveTrack *waveTrack = static_cast(t); - for(const auto &clip : waveTrack->GetAllClips()) { + WaveClipPointers ptrs( waveTrack->SortedClipArray()); + for(WaveClip * pClip : ptrs ) { context.StartStruct(); context.AddItem( (double)i, "track" ); - context.AddItem( clip->GetStartTime(), "start" ); - context.AddItem( clip->GetEndTime(), "end" ); - context.AddItem( clip->GetColourIndex(), "color" ); + context.AddItem( pClip->GetStartTime(), "start" ); + context.AddItem( pClip->GetEndTime(), "end" ); + context.AddItem( pClip->GetColourIndex(), "color" ); context.EndStruct(); } } diff --git a/src/commands/GetInfoCommand.h b/src/commands/GetInfoCommand.h index 38cef1c7b..0d41cf3c7 100644 --- a/src/commands/GetInfoCommand.h +++ b/src/commands/GetInfoCommand.h @@ -47,7 +47,7 @@ public: int mFormat; private: - bool SendCommands(const CommandContext & context); + bool SendCommands(const CommandContext & context, int flags); bool SendMenus(const CommandContext & context); bool SendTracks(const CommandContext & context); bool SendLabels(const CommandContext & context); diff --git a/src/commands/HelpCommand.cpp b/src/commands/HelpCommand.cpp index ac18fabf9..e31443886 100644 --- a/src/commands/HelpCommand.cpp +++ b/src/commands/HelpCommand.cpp @@ -43,7 +43,7 @@ bool HelpCommand::Apply(const CommandContext & context){ if( ID.IsEmpty() ) context.Status( "Command not found" ); else - em.GetCommandDefinition( ID, context); + em.GetCommandDefinition( ID, context, 1); return true; } diff --git a/src/commands/LoadCommands.cpp b/src/commands/LoadCommands.cpp index 8e4491dee..356ea8585 100644 --- a/src/commands/LoadCommands.cpp +++ b/src/commands/LoadCommands.cpp @@ -32,6 +32,10 @@ modelled on BuiltinEffectsModule #include "../commands/HelpCommand.h" #include "../commands/ImportExportCommands.h" #include "../commands/OpenSaveCommands.h" +#include "../commands/SetLabelCommand.h" +#include "../commands/SetClipCommand.h" +#include "../commands/SetProjectCommand.h" + // // Define the list of COMMANDs that will be autoregistered and how to instantiate each @@ -40,7 +44,10 @@ modelled on BuiltinEffectsModule COMMAND( DEMO, DemoCommand, () ) \ COMMAND( SCREENSHOT, ScreenshotCommand, () ) \ COMMAND( COMPARE_AUDIO, CompareAudioCommand, () ) \ - COMMAND( SET_TRACK_INFO, SetTrackInfoCommand, () ) \ + COMMAND( SET_TRACK, SetTrackCommand, () ) \ + COMMAND( SET_CLIP, SetClipCommand, () ) \ + COMMAND( SET_LABEL, SetLabelCommand, () ) \ + COMMAND( SET_PROJECT, SetProjectCommand, () ) \ COMMAND( SELECT, SelectCommand, () ) \ COMMAND( SELECT_TIME, SelectTimeCommand, () ) \ COMMAND( SELECT_TRACKS, SelectTracksCommand, () ) \ diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index c5bccc936..32cf766e7 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -73,10 +73,10 @@ enum kCaptureTypes ktracks, kfirsttrack, ksecondtrack, - kNumCaptureWhats + nCaptureWhats }; -static const wxString kCaptureWhatStrings[kNumCaptureWhats] = +static const wxString kCaptureWhatStrings[nCaptureWhats] = { XO("Window"), XO("Full_Window"), @@ -111,10 +111,10 @@ enum kBackgrounds kBlue, kWhite, kNone, - kNumBackgrounds + nBackgrounds }; -static const wxString kBackgroundStrings[kNumBackgrounds] = +static const wxString kBackgroundStrings[nBackgrounds] = { XO("Blue"), XO("White"), @@ -123,9 +123,9 @@ static const wxString kBackgroundStrings[kNumBackgrounds] = bool ScreenshotCommand::DefineParams( ShuttleParams & S ){ - wxArrayString whats(kNumCaptureWhats, kCaptureWhatStrings); - wxArrayString backs(kNumBackgrounds, kBackgroundStrings); - S.Define( mPath, wxT("Path"), wxT(""), wxT(""), wxT(""), wxT("")); + wxArrayString whats(nCaptureWhats, kCaptureWhatStrings); + wxArrayString backs(nBackgrounds, kBackgroundStrings); + S.Define( mPath, wxT("Path"), wxT(""), wxT(""), wxT(""), wxT("")); S.DefineEnum( mWhat, wxT("CaptureWhat"), wxT("Window"), whats ); S.DefineEnum( mBack, wxT("Background"), wxT("None"), backs ); return true; @@ -133,8 +133,8 @@ bool ScreenshotCommand::DefineParams( ShuttleParams & S ){ void ScreenshotCommand::PopulateOrExchange(ShuttleGui & S) { - wxArrayString whats(kNumCaptureWhats, kCaptureWhatStrings); - wxArrayString backs(kNumBackgrounds, kBackgroundStrings); + wxArrayString whats(nCaptureWhats, kCaptureWhatStrings); + wxArrayString backs(nBackgrounds, kBackgroundStrings); S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); diff --git a/src/commands/SetClipCommand.cpp b/src/commands/SetClipCommand.cpp new file mode 100644 index 000000000..6233f733b --- /dev/null +++ b/src/commands/SetClipCommand.cpp @@ -0,0 +1,123 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + Dan Horgan + James Crook + +******************************************************************//** + +\file SetClipCommand.cpp +\brief Definitions for SetClipCommand + +\class SetClipCommand +\brief Command that sets clip information + +*//*******************************************************************/ + +#include "SetClipCommand.h" +#include "../Project.h" +#include "../Track.h" +#include "../TrackPanel.h" +#include "../WaveTrack.h" +#include "../ShuttleGui.h" +#include "CommandContext.h" + +SetClipCommand::SetClipCommand() +{/* + mTrackIndex = 0; + mTrackName = "unnamed"; + mPan = 0.0f; + mGain = 1.0f; + bSelected = false; + bFocused = false; + bSolo = false; + bMute = false; +*/ +} + +enum kColours +{ + kColour0, + kColour1, + kColour2, + kColour3, + nColours +}; + +static const wxString kColourStrings[nColours] = +{ + XO("Color0"), + XO("Color1"), + XO("Color2"), + XO("Color3"), +}; + + +bool SetClipCommand::DefineParams( ShuttleParams & S ){ + wxArrayString colours( nColours, kColourStrings ); + S.Define( mClipIndex, wxT("ClipIndex"), 0, 0, 100 ); + S.Optional( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours ); + // Allowing a negative start time is not a mistake. + // It will be used in demonstrating time before zero. + S.Optional( bHasT0 ).Define( mT0, wxT("Start"), -5.0, 0.0, 1000000.0); + return true; +}; + +void SetClipCommand::PopulateOrExchange(ShuttleGui & S) +{ + wxArrayString colours( nColours, kColourStrings ); + + S.AddSpace(0, 5); + + S.StartMultiColumn(2, wxALIGN_CENTER); + { + S.TieNumericTextBox( _("Clip Index"), mClipIndex ); + } + S.EndMultiColumn(); + S.StartMultiColumn(3, wxALIGN_CENTER); + { + S.Optional( bHasColour ).TieChoice( _("Colour:"), mColour, &colours ); + S.Optional( bHasT0 ).TieNumericTextBox( _("Start:"), mT0 ); + } + S.EndMultiColumn(); +} + +bool SetClipCommand::Apply(const CommandContext & context) +{ + TrackList *tracks = context.GetProject()->GetTracks(); + TrackListIterator iter(tracks); + Track *t = iter.First(); + WaveClip * pClip = NULL; + int i=0; + + while (t && i <= mClipIndex) { + if (t->GetKind() == Track::Wave) { + WaveTrack *waveTrack = static_cast(t); + WaveClipPointers ptrs( waveTrack->SortedClipArray()); + for(auto it = ptrs.begin(); (it != ptrs.end()) && (i<=mClipIndex); it++,i++ ){ + pClip = *it; + } + } + t = iter.Next(); + } + + if (i <= mClipIndex || !pClip) + { + context.Error(wxT("ClipIndex was invalid.")); + return false; + } + + if( bHasColour ) + pClip->SetColourIndex(mColour); + + // No validation of overlap yet. We assume the user is sensible! + if( bHasT0 ) + pClip->SetOffset(mT0); + + // \todo Use SetClip to move a clip between tracks too. + + return true; +} diff --git a/src/commands/SetClipCommand.h b/src/commands/SetClipCommand.h new file mode 100644 index 000000000..b050586bb --- /dev/null +++ b/src/commands/SetClipCommand.h @@ -0,0 +1,51 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + Dan Horgan + James Crook + +******************************************************************//** + +\file SetClipCommand.h +\brief Declarations of SetClipCommand and SetClipCommandType classes + +*//*******************************************************************/ + +#ifndef __SET_CLIP_COMMAND__ +#define __SET_CLIP_COMMAND__ + +#include "Command.h" +#include "CommandType.h" + +#define SET_CLIP_PLUGIN_SYMBOL XO("Set Clip") + +class SetClipCommand : public AudacityCommand +{ +public: + SetClipCommand(); + // CommandDefinitionInterface overrides + wxString GetSymbol() override {return SET_CLIP_PLUGIN_SYMBOL;}; + wxString GetDescription() override {return _("Sets various values for a clip.");}; + bool DefineParams( ShuttleParams & S ) override; + void PopulateOrExchange(ShuttleGui & S) override; + + // AudacityCommand overrides + wxString ManualPage() override {return wxT("Extra_Menu:_Tools#set_clip");}; + + bool Apply(const CommandContext & context) override; + +public: + int mClipIndex; + int mColour; + double mT0; + +// For tracking optional parameters. + bool bHasColour; + bool bHasT0; +}; + + +#endif /* End of include guard: __SETTRACKINFOCOMMAND__ */ diff --git a/src/commands/SetLabelCommand.cpp b/src/commands/SetLabelCommand.cpp new file mode 100644 index 000000000..47d7bb166 --- /dev/null +++ b/src/commands/SetLabelCommand.cpp @@ -0,0 +1,104 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + Dan Horgan + James Crook + +******************************************************************//** + +\file SetLabelCommand.cpp +\brief Definitions for SetLabelCommand + +\class SetLabelCommand +\brief Command that sets label information + +*//*******************************************************************/ + +#include "SetLabelCommand.h" +#include "../Project.h" +#include "../Track.h" +#include "../TrackPanel.h" +#include "../WaveTrack.h" +#include "../LabelTrack.h" +#include "../ShuttleGui.h" +#include "CommandContext.h" + +SetLabelCommand::SetLabelCommand() +{ +} + + +bool SetLabelCommand::DefineParams( ShuttleParams & S ){ + S.Define( mLabelIndex, wxT("LabelIndex"), 0, 0, 100 ); + S.Optional( bHasText ).Define( mText, wxT("Text"), wxT("empty") ); + S.Optional( bHasT0 ).Define( mT0, wxT("Start"), 0.0, 0.0, 100000.0); + S.Optional( bHasT1 ).Define( mT1, wxT("End"), 0.0, 0.0, 100000.0); + return true; +}; + +void SetLabelCommand::PopulateOrExchange(ShuttleGui & S) +{ + S.AddSpace(0, 5); + + S.StartMultiColumn(2, wxALIGN_CENTER); + { + S.TieNumericTextBox( _("Label Index"), mLabelIndex ); + } + S.EndMultiColumn(); + S.StartMultiColumn(3, wxALIGN_CENTER); + { + S.Optional( bHasText ).TieTextBox( _("Text:"), mText ); + S.Optional( bHasT0 ).TieNumericTextBox( _("Start:"), mT0 ); + S.Optional( bHasT1 ).TieNumericTextBox( _("End:"), mT1 ); + } + S.EndMultiColumn(); +} + +bool SetLabelCommand::Apply(const CommandContext & context) +{ + // \todo we have similar code for finding the nth Label, Clip, Track etc. + // this code could be put in subroutines/reduced. + + //wxString mode = GetString(wxT("Type")); + TrackList *tracks = context.GetProject()->GetTracks(); + TrackListIterator iter(tracks); + Track *t = iter.First(); + LabelStruct * pLabel = NULL; + int i=0; + + while (t && i<=mLabelIndex) { + if (t->GetKind() == Track::Label) { + LabelTrack *labelTrack = static_cast(t); + if( labelTrack ) + { + for (int nn = 0; + (nn< (int)labelTrack->mLabels.size()) && i<=mLabelIndex; + nn++) { + i++; + pLabel = &labelTrack->mLabels[nn]; + } + } + } + t = iter.Next(); + } + + if ( (i< mLabelIndex) || (pLabel == NULL)) + { + context.Error(wxT("LabelIndex was invalid.")); + return false; + } + if( bHasText ) + pLabel->title = mText; + if( bHasT0 ) + pLabel->selectedRegion.setT0(mT0, false); + if( bHasT1 ) + pLabel->selectedRegion.setT1(mT1, false); + + if( bHasT0 || bHasT1 ) + pLabel->selectedRegion.ensureOrdering(); + + return true; +} diff --git a/src/commands/SetLabelCommand.h b/src/commands/SetLabelCommand.h new file mode 100644 index 000000000..7cb65c946 --- /dev/null +++ b/src/commands/SetLabelCommand.h @@ -0,0 +1,53 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + Dan Horgan + James Crook + +******************************************************************//** + +\file SetLabelCommand.h +\brief Declarations of SetLabelCommand and SetLabelCommandType classes + +*//*******************************************************************/ + +#ifndef __SET_LABEL_COMMAND__ +#define __SET_LABEL_COMMAND__ + +#include "Command.h" +#include "CommandType.h" + +#define SET_LABEL_PLUGIN_SYMBOL XO("Set Label") + +class SetLabelCommand : public AudacityCommand +{ +public: + SetLabelCommand(); + // CommandDefinitionInterface overrides + wxString GetSymbol() override {return SET_LABEL_PLUGIN_SYMBOL;}; + wxString GetDescription() override {return _("Sets various values for a label.");}; + bool DefineParams( ShuttleParams & S ) override; + void PopulateOrExchange(ShuttleGui & S) override; + + // AudacityCommand overrides + wxString ManualPage() override {return wxT("Extra_Menu:_Tools#set_label");}; + + bool Apply(const CommandContext & context) override; + +public: + int mLabelIndex; + wxString mText; + double mT0; + double mT1; + +// For tracking optional parameters. + bool bHasText; + bool bHasT0; + bool bHasT1; +}; + + +#endif /* End of include guard: __SETTRACKINFOCOMMAND__ */ diff --git a/src/commands/SetProjectCommand.cpp b/src/commands/SetProjectCommand.cpp new file mode 100644 index 000000000..b038699a1 --- /dev/null +++ b/src/commands/SetProjectCommand.cpp @@ -0,0 +1,72 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + Dan Horgan + James Crook + +******************************************************************//** + +\file SetProjectCommand.cpp +\brief Definitions for SetProjectCommand + +\class SetProjectCommand +\brief Command that sets project information + +*//*******************************************************************/ + +#include "SetProjectCommand.h" +#include "../Project.h" +#include "../Track.h" +#include "../TrackPanel.h" +#include "../WaveTrack.h" +#include "../ShuttleGui.h" +#include "CommandContext.h" + +SetProjectCommand::SetProjectCommand() +{ +} + + +bool SetProjectCommand::DefineParams( ShuttleParams & S ){ + S.Optional( bHasName ).Define( mName, wxT("Name"), _("Project") ); + S.Optional( bHasSizing ).Define( mPosX, wxT("X"), 10.0, 0.0, 2000.0); + S.Optional( bHasSizing ).Define( mPosY, wxT("Y"), 10.0, 0.0, 2000.0); + S.Optional( bHasSizing ).Define( mWidth, wxT("Width"), 1000.0, 200.0, 4000.0); + S.Optional( bHasSizing ).Define( mHeight, wxT("Height"), 900.0, 200.0, 4000.0); + return true; +}; + +void SetProjectCommand::PopulateOrExchange(ShuttleGui & S) +{ + S.AddSpace(0, 5); + S.StartMultiColumn(3, wxALIGN_CENTER); + { + S.Optional( bHasName ).TieTextBox( _("Name:"), mName ); + S.TieCheckBox( "Resize:", bHasSizing ); + } + S.EndMultiColumn(); + S.StartMultiColumn(2, wxALIGN_CENTER); + { + S.TieNumericTextBox( _("X:"), mPosX ); + S.TieNumericTextBox( _("Y:"), mPosY ); + S.TieNumericTextBox( _("Width:"), mWidth ); + S.TieNumericTextBox( _("Height:"), mHeight ); + } + S.EndMultiColumn(); +} + +bool SetProjectCommand::Apply(const CommandContext & context) +{ + AudacityProject * pProj = context.GetProject(); + if( bHasName ) + pProj->SetLabel(mName); + if( bHasSizing ) + { + pProj->SetPosition( wxPoint( mPosX, mPosY)); + pProj->SetSize( wxSize( mWidth, mHeight )); + } + return true; +} diff --git a/src/commands/SetProjectCommand.h b/src/commands/SetProjectCommand.h new file mode 100644 index 000000000..09081aa10 --- /dev/null +++ b/src/commands/SetProjectCommand.h @@ -0,0 +1,54 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + Dan Horgan + James Crook + +******************************************************************//** + +\file SetProjectCommand.h +\brief Declarations of SetProjectCommand and SetProjectCommandType classes + +*//*******************************************************************/ + +#ifndef __SET_PROJECT_COMMAND__ +#define __SET_PROJECT_COMMAND__ + +#include "Command.h" +#include "CommandType.h" + +#define SET_PROJECT_PLUGIN_SYMBOL XO("Set Project") + +class SetProjectCommand : public AudacityCommand +{ +public: + SetProjectCommand(); + // CommandDefinitionInterface overrides + wxString GetSymbol() override {return SET_PROJECT_PLUGIN_SYMBOL;}; + wxString GetDescription() override {return _("Sets various values for a project.");}; + bool DefineParams( ShuttleParams & S ) override; + void PopulateOrExchange(ShuttleGui & S) override; + + // AudacityCommand overrides + wxString ManualPage() override {return wxT("Extra_Menu:_Tools#set_project");}; + + bool Apply(const CommandContext & context) override; + +public: + + wxString mName; + int mPosX; + int mPosY; + int mWidth; + int mHeight; + +// For tracking optional parameters. + bool bHasName; + bool bHasSizing; +}; + + +#endif /* End of include guard: __SETTRACKINFOCOMMAND__ */ diff --git a/src/commands/SetTrackInfoCommand.cpp b/src/commands/SetTrackInfoCommand.cpp index a0bb37972..f7c87aaae 100644 --- a/src/commands/SetTrackInfoCommand.cpp +++ b/src/commands/SetTrackInfoCommand.cpp @@ -9,11 +9,11 @@ ******************************************************************//** -\file SetTrackInfoCommand.cpp -\brief Definitions for SetTrackInfoCommand and SetTrackInfoCommandType classes +\file SetTrackCommand.cpp +\brief Definitions for SetTrackCommand -\class SetTrackInfoCommand -\brief Command that sets track information , name, mute/sol etc. +\class SetTrackCommand +\brief Command that sets track information, name, mute/solo etc. *//*******************************************************************/ @@ -26,8 +26,8 @@ #include "../ShuttleGui.h" #include "CommandContext.h" -SetTrackInfoCommand::SetTrackInfoCommand() -{ +SetTrackCommand::SetTrackCommand() +{/* mTrackIndex = 0; mTrackName = "unnamed"; mPan = 0.0f; @@ -36,22 +36,45 @@ SetTrackInfoCommand::SetTrackInfoCommand() bFocused = false; bSolo = false; bMute = false; +*/ } -bool SetTrackInfoCommand::DefineParams( ShuttleParams & S ){ - S.Define( mTrackIndex, wxT("TrackIndex"), 0, 0, 100 ); - S.Optional( bHasTrackName ).Define( mTrackName, wxT("Name"), wxT("Unnamed") ); - S.Optional( bHasPan ).Define( mPan, wxT("Pan"), 0.0, -1.0, 1.0); - S.Optional( bHasGain ).Define( mGain, wxT("Gain"), 1.0, 0.0, 10.0); - S.Optional( bHasSelected ).Define( bSelected, wxT("Selected"), false ); - S.Optional( bHasFocused ).Define( bFocused, wxT("Focuseed"), false ); - S.Optional( bHasSolo ).Define( bSolo, wxT("Solo"), false ); - S.Optional( bHasMute ).Define( bMute, wxT("Mute"), false ); +enum kColours +{ + kColour0, + kColour1, + kColour2, + kColour3, + nColours +}; + +static const wxString kColourStrings[nColours] = +{ + XO("Color0"), + XO("Color1"), + XO("Color2"), + XO("Color3"), +}; + +bool SetTrackCommand::DefineParams( ShuttleParams & S ){ + wxArrayString colours( nColours, kColourStrings ); + S.Define( mTrackIndex, wxT("TrackIndex"), 0, 0, 100 ); + S.Optional( bHasTrackName ).Define( mTrackName, wxT("Name"), wxT("Unnamed") ); + S.Optional( bHasPan ).Define( mPan, wxT("Pan"), 0.0, -1.0, 1.0); + S.Optional( bHasGain ).Define( mGain, wxT("Gain"), 1.0, 0.0, 10.0); + S.Optional( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 700 ); + S.Optional( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours ); + S.Optional( bHasSelected ).Define( bSelected, wxT("Selected"), false ); + S.Optional( bHasFocused ).Define( bFocused, wxT("Focuseed"), false ); + S.Optional( bHasSolo ).Define( bSolo, wxT("Solo"), false ); + S.Optional( bHasMute ).Define( bMute, wxT("Mute"), false ); return true; }; -void SetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S) +void SetTrackCommand::PopulateOrExchange(ShuttleGui & S) { + wxArrayString colours( nColours, kColourStrings ); + S.AddSpace(0, 5); S.StartMultiColumn(2, wxALIGN_CENTER); @@ -61,22 +84,24 @@ void SetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S) S.EndMultiColumn(); S.StartMultiColumn(3, wxALIGN_CENTER); { - S.Optional( bHasTrackName ).TieTextBox( _("Name"), mTrackName ); - S.Optional( bHasPan ).TieSlider( _("Pan"), mPan, 1.0, -1.0); - S.Optional( bHasGain ).TieSlider( _("Gain"), mGain, 10.0, 0.0); + S.Optional( bHasTrackName ).TieTextBox( _("Name:"), mTrackName ); + S.Optional( bHasPan ).TieSlider( _("Pan:"), mPan, 1.0, -1.0); + S.Optional( bHasGain ).TieSlider( _("Gain:"), mGain, 10.0, 0.0); + S.Optional( bHasHeight ).TieNumericTextBox( _("Height:"), mHeight ); + S.Optional( bHasColour ).TieChoice( _("Colour:"), mColour, &colours ); } S.EndMultiColumn(); S.StartMultiColumn(2, wxALIGN_CENTER); { - S.Optional( bHasSelected ).TieCheckBox( _("Selected"), bSelected ); - S.Optional( bHasFocused ).TieCheckBox( _("Focused"), bFocused); - S.Optional( bHasSolo ).TieCheckBox( _("Solo"), bSolo); - S.Optional( bHasMute ).TieCheckBox( _("Mute"), bMute); + S.Optional( bHasSelected ).TieCheckBox( _("Selected:"), bSelected ); + S.Optional( bHasFocused ).TieCheckBox( _("Focused:"), bFocused); + S.Optional( bHasSolo ).TieCheckBox( _("Solo:"), bSolo); + S.Optional( bHasMute ).TieCheckBox( _("Mute:"), bMute); } S.EndMultiColumn(); } -bool SetTrackInfoCommand::Apply(const CommandContext & context) +bool SetTrackCommand::Apply(const CommandContext & context) { //wxString mode = GetString(wxT("Type")); @@ -104,6 +129,10 @@ bool SetTrackInfoCommand::Apply(const CommandContext & context) wt->SetPan(mPan); if( wt && bHasGain ) wt->SetGain(mGain); + if( wt && bHasColour ) + wt->SetWaveColorIndex( mColour ); + if( t && bHasHeight ) + t->SetHeight( mHeight ); if( bHasSelected ) t->SetSelected(bSelected); if( bHasFocused ) @@ -118,3 +147,5 @@ bool SetTrackInfoCommand::Apply(const CommandContext & context) return true; } + + diff --git a/src/commands/SetTrackInfoCommand.h b/src/commands/SetTrackInfoCommand.h index ece5bf643..76b546bbb 100644 --- a/src/commands/SetTrackInfoCommand.h +++ b/src/commands/SetTrackInfoCommand.h @@ -9,31 +9,31 @@ ******************************************************************//** -\file SetTrackInfoCommand.h -\brief Declarations of SetTrackInfoCommand and SetTrackInfoCommandType classes +\file SetTrackCommand.h +\brief Declarations of SetTrackCommand and SetTrackCommandType classes *//*******************************************************************/ -#ifndef __SETTRACKINFOCOMMAND__ -#define __SETTRACKINFOCOMMAND__ +#ifndef __SET_TRACK_COMMAND__ +#define __SET_TRACK_COMMAND__ #include "Command.h" #include "CommandType.h" -#define SET_TRACK_INFO_PLUGIN_SYMBOL XO("Set Track Info") +#define SET_TRACK_PLUGIN_SYMBOL XO("Set Track") -class SetTrackInfoCommand : public AudacityCommand +class SetTrackCommand : public AudacityCommand { public: - SetTrackInfoCommand(); + SetTrackCommand(); // CommandDefinitionInterface overrides - wxString GetSymbol() override {return SET_TRACK_INFO_PLUGIN_SYMBOL;}; + wxString GetSymbol() override {return SET_TRACK_PLUGIN_SYMBOL;}; wxString GetDescription() override {return _("Sets various values for a track.");}; bool DefineParams( ShuttleParams & S ) override; void PopulateOrExchange(ShuttleGui & S) override; // AudacityCommand overrides - wxString ManualPage() override {return wxT("Extra_Menu:_Tools#set_track_info");}; + wxString ManualPage() override {return wxT("Extra_Menu:_Tools#set_track");}; bool Apply(const CommandContext & context) override; @@ -42,6 +42,8 @@ public: wxString mTrackName; double mPan; double mGain; + int mColour; + int mHeight; bool bSelected; bool bFocused; bool bSolo; @@ -51,6 +53,8 @@ public: bool bHasTrackName; bool bHasPan; bool bHasGain; + bool bHasColour; + bool bHasHeight; bool bHasSelected; bool bHasFocused; bool bHasSolo; diff --git a/src/effects/AutoDuck.cpp b/src/effects/AutoDuck.cpp index 73598e565..4f14e2606 100644 --- a/src/effects/AutoDuck.cpp +++ b/src/effects/AutoDuck.cpp @@ -397,7 +397,7 @@ bool EffectAutoDuck::Process() SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks.get()); Track *iterTrack = iter.First(); - int trackNumber = 0; + int trackNum = 0; while (iterTrack) { @@ -406,7 +406,7 @@ bool EffectAutoDuck::Process() for (size_t i = 0; i < regions.size(); i++) { const AutoDuckRegion& region = regions[i]; - if (ApplyDuckFade(trackNumber, t, region.t0, region.t1)) + if (ApplyDuckFade(trackNum, t, region.t0, region.t1)) { cancel = true; break; @@ -417,7 +417,7 @@ bool EffectAutoDuck::Process() break; iterTrack = iter.Next(); - trackNumber++; + trackNum++; } } @@ -518,7 +518,7 @@ bool EffectAutoDuck::TransferDataFromWindow() // EffectAutoDuck implementation // this currently does an exponential fade -bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t, +bool EffectAutoDuck::ApplyDuckFade(int trackNum, WaveTrack* t, double t0, double t1) { bool cancel = false; @@ -571,7 +571,7 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNumber, WaveTrack* t, float curTime = t->LongSamplesToTime(pos); float fractionFinished = (curTime - mT0) / (mT1 - mT0); - if (TotalProgress( (trackNumber + 1 + fractionFinished) / + if (TotalProgress( (trackNum + 1 + fractionFinished) / (GetNumWaveTracks() + 1) )) { cancel = true; diff --git a/src/effects/AutoDuck.h b/src/effects/AutoDuck.h index 4098a23a6..8f0c318af 100644 --- a/src/effects/AutoDuck.h +++ b/src/effects/AutoDuck.h @@ -63,7 +63,7 @@ public: private: // EffectAutoDuck implementation - bool ApplyDuckFade(int trackNumber, WaveTrack *t, double t0, double t1); + bool ApplyDuckFade(int trackNum, WaveTrack *t, double t0, double t1); void OnValueChanged(wxCommandEvent & evt); diff --git a/src/effects/ChangeSpeed.cpp b/src/effects/ChangeSpeed.cpp index 16fdb29f8..e81aac8f6 100644 --- a/src/effects/ChangeSpeed.cpp +++ b/src/effects/ChangeSpeed.cpp @@ -47,10 +47,10 @@ enum kVinyl kVinyl_45, kVinyl_78, kVinyl_NA, - kNumVinyl + nVinyl }; -static const wxChar *kVinylStrings[kNumVinyl] = +static const wxChar *kVinylStrings[nVinyl] = { wxT("33\u2153"), wxT("45"), @@ -338,10 +338,10 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S) /* i18n-hint: "rpm" is an English abbreviation meaning "revolutions per minute". */ S.AddUnits(_("Standard Vinyl rpm:")); - wxASSERT(kNumVinyl == WXSIZEOF(kVinylStrings)); + wxASSERT(nVinyl == WXSIZEOF(kVinylStrings)); wxArrayString vinylChoices; - for (int i = 0; i < kNumVinyl; i++) + for (int i = 0; i < nVinyl; i++) { if (i == kVinyl_NA) { diff --git a/src/effects/Distortion.cpp b/src/effects/Distortion.cpp index d8d5576c3..679853b24 100644 --- a/src/effects/Distortion.cpp +++ b/src/effects/Distortion.cpp @@ -54,10 +54,10 @@ enum kTableType kLeveller, kRectifier, kHardLimiter, - kNumTableTypes + nTableTypes }; -static const wxString kTableTypeStrings[kNumTableTypes] = +static const wxString kTableTypeStrings[nTableTypes] = { XO("Hard Clipping"), XO("Soft Clipping"), @@ -76,7 +76,7 @@ static const wxString kTableTypeStrings[kNumTableTypes] = // (Note: 'Repeats' is the total number of times the effect is applied.) // // Name Type Key Def Min Max Scale -Param( TableTypeIndx, int, wxT("Type"), 0, 0, kNumTableTypes-1, 1 ); +Param( TableTypeIndx, int, wxT("Type"), 0, 0, nTableTypes-1, 1 ); Param( DCBlock, bool, wxT("DC Block"), false, false, true, 1 ); Param( Threshold_dB, double, wxT("Threshold dB"), -6.0, -100.0, 0.0, 1000.0f ); Param( NoiseFloor, double, wxT("Noise Floor"), -70.0, -80.0, -20.0, 1 ); @@ -168,7 +168,7 @@ END_EVENT_TABLE() EffectDistortion::EffectDistortion() { - wxASSERT(kNumTableTypes == WXSIZEOF(kTableTypeStrings)); + wxASSERT(nTableTypes == WXSIZEOF(kTableTypeStrings)); mParams.mTableChoiceIndx = DEF_TableTypeIndx; mParams.mDCBlock = DEF_DCBlock; @@ -280,7 +280,7 @@ size_t EffectDistortion::RealtimeProcess(int group, return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples); } bool EffectDistortion::DefineParams( ShuttleParams & S ){ - wxArrayString tables( kNumTableTypes, kTableTypeStrings ); + wxArrayString tables( nTableTypes, kTableTypeStrings ); S.SHUTTLE_ENUM_PARAM( mParams.mTableChoiceIndx, TableTypeIndx, tables ); S.SHUTTLE_PARAM( mParams.mDCBlock, DCBlock ); S.SHUTTLE_PARAM( mParams.mThreshold_dB, Threshold_dB ); @@ -306,7 +306,7 @@ bool EffectDistortion::GetAutomationParameters(CommandAutomationParameters & par bool EffectDistortion::SetAutomationParameters(CommandAutomationParameters & parms) { - ReadAndVerifyEnum(TableTypeIndx, wxArrayString(kNumTableTypes, kTableTypeStrings)); + ReadAndVerifyEnum(TableTypeIndx, wxArrayString(nTableTypes, kTableTypeStrings)); ReadAndVerifyBool(DCBlock); ReadAndVerifyDouble(Threshold_dB); ReadAndVerifyDouble(NoiseFloor); @@ -360,7 +360,7 @@ bool EffectDistortion::LoadFactoryPreset(int id) void EffectDistortion::PopulateOrExchange(ShuttleGui & S) { - for (int i = 0; i < kNumTableTypes; i++) + for (int i = 0; i < nTableTypes; i++) { mTableTypes.Add(wxGetTranslation(kTableTypeStrings[i])); } diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index 5b8fe6194..1c5d68591 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -190,7 +190,7 @@ wxString EffectManager::GetCommandDescription(const PluginID & ID) return wxEmptyString; } -void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandContext & context) +void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandContext & context, int flags) { ParamsInterface *command; command = GetEffect(ID); @@ -201,7 +201,8 @@ void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandConte ShuttleParams NullShuttle; // Test if it defines any parameters at all. - if( !command->DefineParams( NullShuttle ) ) + bool bHasParams = command->DefineParams( NullShuttle ); + if( (flags ==0) && !bHasParams ) return; // This is capturing the output context into the shuttle. @@ -209,10 +210,12 @@ void EffectManager::GetCommandDefinition(const PluginID & ID, const CommandConte S.StartStruct(); S.AddItem( GetCommandIdentifier( ID ), "id" ); S.AddItem( GetCommandName( ID ), "name" ); - S.AddField( "params" ); - S.StartArray(); - command->DefineParams( S ); - S.EndArray(); + if( bHasParams ){ + S.AddField( "params" ); + S.StartArray(); + command->DefineParams( S ); + S.EndArray(); + } S.EndStruct(); } diff --git a/src/effects/EffectManager.h b/src/effects/EffectManager.h index 9545eeee8..0666e9a2a 100644 --- a/src/effects/EffectManager.h +++ b/src/effects/EffectManager.h @@ -91,7 +91,8 @@ public: wxString GetCommandName(const PluginID & ID); wxString GetCommandIdentifier(const PluginID & ID); wxString GetCommandDescription(const PluginID & ID); - void GetCommandDefinition(const PluginID & ID, const CommandContext & context); + // flags control which commands are included. + void GetCommandDefinition(const PluginID & ID, const CommandContext & context, int flags); bool IsHidden(const PluginID & ID); /** Support for batch commands */ diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 646deb776..fec248b5d 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -136,7 +136,7 @@ enum kInterpolations kBspline, kCosine, kCubic, - kNumInterpolations + nInterpolations }; // Increment whenever EQCurves.xml is updated @@ -144,7 +144,7 @@ enum kInterpolations #define EQCURVES_REVISION 0 #define UPDATE_ALL 0 // 0 = merge NEW presets only, 1 = Update all factory presets. -static const wxString kInterpStrings[kNumInterpolations] = +static const wxString kInterpStrings[nInterpolations] = { /* i18n-hint: Technical term for a kind of curve.*/ XO("B-spline"), @@ -229,7 +229,7 @@ EffectEqualization::EffectEqualization() GetPrivateConfig(GetCurrentSettingsGroup(), wxT("DrawMode"), mDrawMode, DEF_DrawMode); GetPrivateConfig(GetCurrentSettingsGroup(), wxT("DrawGrid"), mDrawGrid, DEF_DrawGrid); - for (int i = 0; i < kNumInterpolations; i++) + for (int i = 0; i < nInterpolations; i++) { mInterpolations.Add(wxGetTranslation(kInterpStrings[i])); } @@ -309,7 +309,7 @@ EffectType EffectEqualization::GetType() // EffectClientInterface implementation bool EffectEqualization::DefineParams( ShuttleParams & S ){ - wxArrayString interp(kNumInterpolations, kInterpStrings); + wxArrayString interp(nInterpolations, kInterpStrings); S.SHUTTLE_PARAM( mM, FilterLength ); S.SHUTTLE_PARAM( mCurveName, CurveName); S.SHUTTLE_PARAM( mLin, InterpLin); @@ -323,7 +323,7 @@ bool EffectEqualization::GetAutomationParameters(CommandAutomationParameters & p parms.Write(KEY_FilterLength, (unsigned long)mM); parms.Write(KEY_CurveName, mCurveName); parms.Write(KEY_InterpLin, mLin); - parms.WriteEnum(KEY_InterpMeth, mInterp, wxArrayString(kNumInterpolations, kInterpStrings)); + parms.WriteEnum(KEY_InterpMeth, mInterp, wxArrayString(nInterpolations, kInterpStrings)); return true; } @@ -333,7 +333,7 @@ bool EffectEqualization::SetAutomationParameters(CommandAutomationParameters & p // Pretty sure the interpolation name shouldn't have been interpreted when // specified in chains, but must keep it that way for compatibility. wxArrayString interpolations(mInterpolations); - for (int i = 0; i < kNumInterpolations; i++) + for (int i = 0; i < nInterpolations; i++) { interpolations.Add(kInterpStrings[i]); } @@ -348,9 +348,9 @@ bool EffectEqualization::SetAutomationParameters(CommandAutomationParameters & p mLin = InterpLin; mInterp = InterpMeth; - if (InterpMeth >= kNumInterpolations) + if (InterpMeth >= nInterpolations) { - InterpMeth -= kNumInterpolations; + InterpMeth -= nInterpolations; } mEnvelope = (mLin ? mLinEnvelope : mLogEnvelope).get(); diff --git a/src/effects/Noise.cpp b/src/effects/Noise.cpp index 4a51a9a64..b91ade8de 100644 --- a/src/effects/Noise.cpp +++ b/src/effects/Noise.cpp @@ -32,10 +32,10 @@ enum kTypes kWhite, kPink, kBrownian, - kNumTypes + nTypes }; -static const wxChar *kTypeStrings[kNumTypes] = +static const wxChar *kTypeStrings[nTypes] = { XO("White"), XO("Pink"), @@ -45,7 +45,7 @@ static const wxChar *kTypeStrings[kNumTypes] = // Define keys, defaults, minimums, and maximums for the effect parameters // // Name Type Key Def Min Max Scale -Param( Type, int, wxT("Type"), kWhite, 0, kNumTypes - 1, 1 ); +Param( Type, int, wxT("Type"), kWhite, 0, nTypes - 1, 1 ); Param( Amp, double, wxT("Amplitude"), 0.8, 0.0, 1.0, 1 ); // @@ -162,7 +162,7 @@ size_t EffectNoise::ProcessBlock(float **WXUNUSED(inbuf), float **outbuf, size_t return size; } bool EffectNoise::DefineParams( ShuttleParams & S ){ - wxArrayString types( kNumTypes, kTypeStrings ); + wxArrayString types( nTypes, kTypeStrings ); S.SHUTTLE_ENUM_PARAM( mType, Type, types ); S.SHUTTLE_PARAM( mAmp, Amp ); return true; @@ -178,7 +178,7 @@ bool EffectNoise::GetAutomationParameters(CommandAutomationParameters & parms) bool EffectNoise::SetAutomationParameters(CommandAutomationParameters & parms) { - ReadAndVerifyEnum(Type, wxArrayString(kNumTypes, kTypeStrings)); + ReadAndVerifyEnum(Type, wxArrayString(nTypes, kTypeStrings)); ReadAndVerifyDouble(Amp); mType = Type; @@ -219,10 +219,10 @@ bool EffectNoise::Startup() void EffectNoise::PopulateOrExchange(ShuttleGui & S) { - wxASSERT(kNumTypes == WXSIZEOF(kTypeStrings)); + wxASSERT(nTypes == WXSIZEOF(kTypeStrings)); wxArrayString typeChoices; - for (int i = 0; i < kNumTypes; i++) + for (int i = 0; i < nTypes; i++) { typeChoices.Add(wxGetTranslation(kTypeStrings[i])); } diff --git a/src/effects/ScienFilter.cpp b/src/effects/ScienFilter.cpp index e1e7a69a7..c8dc12bd0 100644 --- a/src/effects/ScienFilter.cpp +++ b/src/effects/ScienFilter.cpp @@ -83,10 +83,10 @@ enum kTypes kButterworth, kChebyshevTypeI, kChebyshevTypeII, - kNumTypes + nTypes }; -static const wxChar *kTypeStrings[kNumTypes] = +static const wxChar *kTypeStrings[nTypes] = { /*i18n-hint: Butterworth is the name of the person after whom the filter type is named.*/ XO("Butterworth"), @@ -100,10 +100,10 @@ enum kSubTypes { kLowPass, kHighPass, - kNumSubTypes + nSubTypes }; -static const wxChar *kSubTypeStrings[kNumSubTypes] = +static const wxChar *kSubTypeStrings[nSubTypes] = { XO("Lowpass"), XO("Highpass") @@ -112,8 +112,8 @@ static const wxChar *kSubTypeStrings[kNumSubTypes] = // Define keys, defaults, minimums, and maximums for the effect parameters // // Name Type Key Def Min Max Scale -Param( Type, int, wxT("FilterType"), kButterworth, 0, kNumTypes - 1, 1 ); -Param( Subtype, int, wxT("FilterSubtype"), kLowPass, 0, kNumSubTypes - 1, 1 ); +Param( Type, int, wxT("FilterType"), kButterworth, 0, nTypes - 1, 1 ); +Param( Subtype, int, wxT("FilterSubtype"), kLowPass, 0, nSubTypes - 1, 1 ); Param( Order, int, wxT("Order"), 1, 1, 10, 1 ); Param( Cutoff, float, wxT("Cutoff"), 1000.0, 1.0, FLT_MAX, 1 ); Param( Passband, float, wxT("PassbandRipple"), 1.0, 0.0, 100.0, 1 ); @@ -241,8 +241,8 @@ size_t EffectScienFilter::ProcessBlock(float **inBlock, float **outBlock, size_t return blockLen; } bool EffectScienFilter::DefineParams( ShuttleParams & S ){ - wxArrayString filters( kNumTypes, kTypeStrings ); - wxArrayString subtypes( kNumSubTypes, kSubTypeStrings ); + wxArrayString filters( nTypes, kTypeStrings ); + wxArrayString subtypes( nSubTypes, kSubTypeStrings ); S.SHUTTLE_ENUM_PARAM( mFilterType, Type, filters ); S.SHUTTLE_ENUM_PARAM( mFilterSubtype, Subtype, subtypes ); S.SHUTTLE_PARAM( mOrder, Order ); @@ -266,8 +266,8 @@ bool EffectScienFilter::GetAutomationParameters(CommandAutomationParameters & pa bool EffectScienFilter::SetAutomationParameters(CommandAutomationParameters & parms) { - ReadAndVerifyEnum(Type, wxArrayString(kNumTypes, kTypeStrings)); - ReadAndVerifyEnum(Subtype, wxArrayString(kNumSubTypes, kSubTypeStrings)); + ReadAndVerifyEnum(Type, wxArrayString(nTypes, kTypeStrings)); + ReadAndVerifyEnum(Subtype, wxArrayString(nSubTypes, kSubTypeStrings)); ReadAndVerifyInt(Order); ReadAndVerifyFloat(Cutoff); ReadAndVerifyFloat(Passband); @@ -467,10 +467,10 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S) S.SetSizerProportion(0); S.StartMultiColumn(8, wxALIGN_CENTER); { - wxASSERT(kNumTypes == WXSIZEOF(kTypeStrings)); + wxASSERT(nTypes == WXSIZEOF(kTypeStrings)); wxArrayString typeChoices; - for (int i = 0; i < kNumTypes; i++) + for (int i = 0; i < nTypes; i++) { typeChoices.Add(wxGetTranslation(kTypeStrings[i])); } @@ -499,10 +499,10 @@ void EffectScienFilter::PopulateOrExchange(ShuttleGui & S) mRippleCtl->SetValidator(vldRipple); mRippleCtlU = S.AddVariableText(_("dB"), false, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - wxASSERT(kNumSubTypes == WXSIZEOF(kSubTypeStrings)); + wxASSERT(nSubTypes == WXSIZEOF(kSubTypeStrings)); wxArrayString subTypeChoices; - for (int i = 0; i < kNumSubTypes; i++) + for (int i = 0; i < nSubTypes; i++) { subTypeChoices.Add(wxGetTranslation(kSubTypeStrings[i])); } diff --git a/src/effects/ToneGen.cpp b/src/effects/ToneGen.cpp index a94245b39..3cbae1955 100644 --- a/src/effects/ToneGen.cpp +++ b/src/effects/ToneGen.cpp @@ -36,10 +36,10 @@ enum kInterpolations { kLinear, kLogarithmic, - kNumInterpolations + nInterpolations }; -static const wxString kInterStrings[kNumInterpolations] = +static const wxString kInterStrings[nInterpolations] = { XO("Linear"), XO("Logarithmic") @@ -51,10 +51,10 @@ enum kWaveforms kSquare, kSawtooth, kSquareNoAlias, - kNumWaveforms + nWaveforms }; -static const wxString kWaveStrings[kNumWaveforms] = +static const wxString kWaveStrings[nWaveforms] = { XO("Sine"), XO("Square"), @@ -71,8 +71,8 @@ Param( StartAmp, double, wxT("StartAmp"), 0.8, 0.0, 1.0, Param( EndAmp, double, wxT("EndAmp"), 0.1, 0.0, 1.0, 1 ); Param( Frequency, double, wxT("Frequency"), 440.0, 1.0, DBL_MAX, 1 ); Param( Amplitude, double, wxT("Amplitude"), 0.8, 0.0, 1.0, 1 ); -Param( Waveform, int, wxT("Waveform"), 0, 0, kNumWaveforms - 1, 1 ); -Param( Interp, int, wxT("Interpolation"), 0, 0, kNumInterpolations - 1, 1 ); +Param( Waveform, int, wxT("Waveform"), 0, 0, nWaveforms - 1, 1 ); +Param( Interp, int, wxT("Interpolation"), 0, 0, nInterpolations - 1, 1 ); // // EffectToneGen @@ -84,8 +84,8 @@ END_EVENT_TABLE(); EffectToneGen::EffectToneGen(bool isChirp) { - wxASSERT(kNumWaveforms == WXSIZEOF(kWaveStrings)); - wxASSERT(kNumInterpolations == WXSIZEOF(kInterStrings)); + wxASSERT(nWaveforms == WXSIZEOF(kWaveStrings)); + wxASSERT(nInterpolations == WXSIZEOF(kInterStrings)); mChirp = isChirp; @@ -96,12 +96,12 @@ EffectToneGen::EffectToneGen(bool isChirp) mAmplitude[1] = DEF_EndAmp; mInterpolation = DEF_Interp; - for (int i = 0; i < kNumWaveforms; i++) + for (int i = 0; i < nWaveforms; i++) { mWaveforms.Add(wxGetTranslation(kWaveStrings[i])); } - for (int i = 0; i < kNumInterpolations; i++) + for (int i = 0; i < nInterpolations; i++) { mInterpolations.Add(wxGetTranslation(kInterStrings[i])); } @@ -263,8 +263,8 @@ bool EffectToneGen::DefineParams( ShuttleParams & S ){ S.SHUTTLE_PARAM( mFrequency[0], Frequency ); S.SHUTTLE_PARAM( mAmplitude[0], Amplitude ); } - wxArrayString waves( kNumWaveforms, kWaveStrings ); - wxArrayString interps( kNumInterpolations ,kInterStrings ); + wxArrayString waves( nWaveforms, kWaveStrings ); + wxArrayString interps( nInterpolations ,kInterStrings ); S.SHUTTLE_ENUM_PARAM( mWaveform, Waveform, waves ); S.SHUTTLE_ENUM_PARAM( mInterpolation, Interp, interps ); @@ -299,8 +299,8 @@ bool EffectToneGen::GetAutomationParameters(CommandAutomationParameters & parms) bool EffectToneGen::SetAutomationParameters(CommandAutomationParameters & parms) { - ReadAndVerifyEnum(Waveform, wxArrayString(kNumWaveforms, kWaveStrings)); - ReadAndVerifyEnum(Interp, wxArrayString(kNumInterpolations, kInterStrings)); + ReadAndVerifyEnum(Waveform, wxArrayString(nWaveforms, kWaveStrings)); + ReadAndVerifyEnum(Interp, wxArrayString(nInterpolations, kInterStrings)); if (mChirp) { ReadAndVerifyDouble(StartFreq); diff --git a/src/effects/TruncSilence.cpp b/src/effects/TruncSilence.cpp index e94582b1e..51fa94a49 100644 --- a/src/effects/TruncSilence.cpp +++ b/src/effects/TruncSilence.cpp @@ -41,10 +41,10 @@ enum kActions { kTruncate, kCompress, - kNumActions + nActions }; -static const wxChar *kActionStrings[kNumActions] = +static const wxChar *kActionStrings[nActions] = { XO("Truncate Detected Silence"), XO("Compress Excess Silence") @@ -60,7 +60,7 @@ static const wxChar *kActionStrings[kNumActions] = // // Name Type Key Def Min Max Scale Param( DbIndex, int, wxT("Db"), 0, 0, Enums::NumDbChoices - 1, 1 ); -Param( ActIndex, int, wxT("Action"), kTruncate, 0, kNumActions - 1, 1 ); +Param( ActIndex, int, wxT("Action"), kTruncate, 0, nActions - 1, 1 ); Param( Minimum, double, wxT("Minimum"), 0.5, 0.001, 10000.0, 1 ); Param( Truncate, double, wxT("Truncate"), 0.5, 0.0, 10000.0, 1 ); Param( Compress, double, wxT("Compress"), 50.0, 0.0, 99.9, 1 ); @@ -135,7 +135,7 @@ EffectType EffectTruncSilence::GetType() // EffectClientInterface implementation bool EffectTruncSilence::DefineParams( ShuttleParams & S ){ - wxArrayString actions(kNumActions, kActionStrings); + wxArrayString actions(nActions, kActionStrings); //actions.Insert(wxT("0"), 0); // Compatible with 2.1.0 and before //actions.Insert(wxT("1"), 1); // Compatible with 2.1.0 and before @@ -162,7 +162,7 @@ bool EffectTruncSilence::GetAutomationParameters(CommandAutomationParameters & p bool EffectTruncSilence::SetAutomationParameters(CommandAutomationParameters & parms) { - wxArrayString actions(kNumActions, kActionStrings); + wxArrayString actions(nActions, kActionStrings); actions.Insert(wxT("0"), 0); // Compatible with 2.1.0 and before actions.Insert(wxT("1"), 1); // Compatible with 2.1.0 and before @@ -181,9 +181,9 @@ bool EffectTruncSilence::SetAutomationParameters(CommandAutomationParameters & p mbIndependent = Independent; // Readjust for 2.1.0 or before - if (mActionIndex >= kNumActions) + if (mActionIndex >= nActions) { - mActionIndex -= kNumActions; + mActionIndex -= nActions; } return true; @@ -713,10 +713,10 @@ bool EffectTruncSilence::Analyze(RegionList& silenceList, void EffectTruncSilence::PopulateOrExchange(ShuttleGui & S) { - wxASSERT(kNumActions == WXSIZEOF(kActionStrings)); + wxASSERT(nActions == WXSIZEOF(kActionStrings)); wxArrayString actionChoices; - for (int i = 0; i < kNumActions; i++) + for (int i = 0; i < nActions; i++) { actionChoices.Add(wxGetTranslation(kActionStrings[i])); } diff --git a/src/ondemand/ODComputeSummaryTask.cpp b/src/ondemand/ODComputeSummaryTask.cpp index 0035c0928..28910c0c2 100644 --- a/src/ondemand/ODComputeSummaryTask.cpp +++ b/src/ondemand/ODComputeSummaryTask.cpp @@ -26,7 +26,7 @@ updating the ODPCMAliasBlockFile and the GUI of the newly available data. #include //36 blockfiles > 3 minutes stereo 44.1kHz per ODTask::DoSome -#define kNumBlockFilesPerDoSome 36 +#define nBlockFilesPerDoSome 36 ///Creates a NEW task that computes summaries for a wavetrack that needs to be specified through SetWaveTrack() ODComputeSummaryTask::ODComputeSummaryTask() @@ -138,7 +138,7 @@ float ODComputeSummaryTask::ComputeNextWorkUntilPercentageComplete() float nextPercent; mPercentCompleteMutex.Lock(); - nextPercent=mPercentComplete + ((float)kNumBlockFilesPerDoSome/(mMaxBlockFiles+1)); + nextPercent=mPercentComplete + ((float)nBlockFilesPerDoSome/(mMaxBlockFiles+1)); mPercentCompleteMutex.Unlock(); return nextPercent; diff --git a/win/Projects/Audacity/Audacity.vcxproj b/win/Projects/Audacity/Audacity.vcxproj index b0004580e..1f507c042 100755 --- a/win/Projects/Audacity/Audacity.vcxproj +++ b/win/Projects/Audacity/Audacity.vcxproj @@ -143,6 +143,9 @@ + + + @@ -481,6 +484,9 @@ + + + diff --git a/win/Projects/Audacity/Audacity.vcxproj.filters b/win/Projects/Audacity/Audacity.vcxproj.filters index bb097b7b3..aba5649c5 100755 --- a/win/Projects/Audacity/Audacity.vcxproj.filters +++ b/win/Projects/Audacity/Audacity.vcxproj.filters @@ -1064,6 +1064,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands + @@ -2122,6 +2131,15 @@ src\commands + + src\commands + + + src\commands + + + src\commands +