SetClip, SetLabel, SetProject added

- SetTrack also updated with more options.
This commit is contained in:
James Crook 2018-02-09 19:12:25 +00:00 committed by Paul Licameli
parent 2180379a18
commit 1d9477a455
34 changed files with 729 additions and 168 deletions

View File

@ -1268,6 +1268,9 @@
5EF3E650203FBAFB006C6882 /* GetInfoCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E649203FBAFB006C6882 /* GetInfoCommand.cpp */; };
5EF3E651203FBAFB006C6882 /* LoadCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E64B203FBAFB006C6882 /* LoadCommands.cpp */; };
5EF3E653203FBBE0006C6882 /* CommandTargets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E652203FBBE0006C6882 /* CommandTargets.cpp */; };
5EF3E65A203FDACE006C6882 /* SetClipCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E654203FDACE006C6882 /* SetClipCommand.cpp */; };
5EF3E65B203FDACE006C6882 /* SetLabelCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E656203FDACE006C6882 /* SetLabelCommand.cpp */; };
5EF3E65C203FDACE006C6882 /* SetProjectCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E658203FDACE006C6882 /* SetProjectCommand.cpp */; };
5EF958851DEB121800191280 /* InconsistencyException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF958831DEB121800191280 /* InconsistencyException.cpp */; };
8406A93812D0F2510011EA01 /* EQDefaultCurves.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8406A93712D0F2510011EA01 /* EQDefaultCurves.xml */; };
8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8484F31213086237002DF7F0 /* DeviceManager.cpp */; };
@ -3167,6 +3170,12 @@
5EF3E64B203FBAFB006C6882 /* LoadCommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCommands.cpp; sourceTree = "<group>"; };
5EF3E64C203FBAFB006C6882 /* LoadCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadCommands.h; sourceTree = "<group>"; };
5EF3E652203FBBE0006C6882 /* CommandTargets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommandTargets.cpp; sourceTree = "<group>"; };
5EF3E654203FDACE006C6882 /* SetClipCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SetClipCommand.cpp; sourceTree = "<group>"; };
5EF3E655203FDACE006C6882 /* SetClipCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetClipCommand.h; sourceTree = "<group>"; };
5EF3E656203FDACE006C6882 /* SetLabelCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SetLabelCommand.cpp; sourceTree = "<group>"; };
5EF3E657203FDACE006C6882 /* SetLabelCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetLabelCommand.h; sourceTree = "<group>"; };
5EF3E658203FDACE006C6882 /* SetProjectCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SetProjectCommand.cpp; sourceTree = "<group>"; };
5EF3E659203FDACE006C6882 /* SetProjectCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetProjectCommand.h; sourceTree = "<group>"; };
5EF958831DEB121800191280 /* InconsistencyException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InconsistencyException.cpp; sourceTree = "<group>"; };
5EF958841DEB121800191280 /* InconsistencyException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InconsistencyException.h; sourceTree = "<group>"; };
82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = "<group>"; };
@ -3783,6 +3792,9 @@
181855950FFE916C0026D190 /* ScreenshotCommand.cpp */,
28D540030FD1912A00FA7C75 /* ScriptCommandRelay.cpp */,
28851FA91027F16400152EE1 /* SelectCommand.cpp */,
5EF3E654203FDACE006C6882 /* SetClipCommand.cpp */,
5EF3E656203FDACE006C6882 /* SetLabelCommand.cpp */,
5EF3E658203FDACE006C6882 /* SetProjectCommand.cpp */,
28DE72AC10388583007E18EC /* SetTrackInfoCommand.cpp */,
28D53FFB0FD1912A00FA7C75 /* AppCommandEvent.h */,
5EF3E644203FBAFB006C6882 /* AudacityCommand.h */,
@ -3814,6 +3826,9 @@
181855960FFE916C0026D190 /* ScreenshotCommand.h */,
28D540040FD1912A00FA7C75 /* ScriptCommandRelay.h */,
28851FAA1027F16400152EE1 /* SelectCommand.h */,
5EF3E655203FDACE006C6882 /* SetClipCommand.h */,
5EF3E657203FDACE006C6882 /* SetLabelCommand.h */,
5EF3E659203FDACE006C6882 /* SetProjectCommand.h */,
28DE72AD10388583007E18EC /* SetTrackInfoCommand.h */,
28BD8AB0101DF4C600686679 /* Validators.h */,
);
@ -7694,6 +7709,7 @@
1790B13509883BFD008A330A /* ChangeSpeed.cpp in Sources */,
5EF17C231D1F0A690090A642 /* ScrubbingToolBar.cpp in Sources */,
1790B13609883BFD008A330A /* ChangeTempo.cpp in Sources */,
5EF3E65A203FDACE006C6882 /* SetClipCommand.cpp in Sources */,
1790B13709883BFD008A330A /* ClickRemoval.cpp in Sources */,
1790B13809883BFD008A330A /* Compressor.cpp in Sources */,
1790B13909883BFD008A330A /* Echo.cpp in Sources */,
@ -8004,6 +8020,7 @@
28884967131B6CF600B59735 /* pt_BR.po in Sources */,
28884969131B6CF600B59735 /* ro.po in Sources */,
2888496A131B6CF600B59735 /* ru.po in Sources */,
5EF3E65B203FDACE006C6882 /* SetLabelCommand.cpp in Sources */,
2888496B131B6CF600B59735 /* sk.po in Sources */,
5EF3E64F203FBAFB006C6882 /* Demo.cpp in Sources */,
EDAD326B1544452E009C6220 /* sl.po in Sources */,
@ -8019,6 +8036,7 @@
28884971131B6CF600B59735 /* vi.po in Sources */,
289D127A1B44D57F00B5B6AA /* VSTControlOSX.mm in Sources */,
28884972131B6CF600B59735 /* zh_TW.po in Sources */,
5EF3E65C203FDACE006C6882 /* SetProjectCommand.cpp in Sources */,
EDF3B7B01588C0D50032D35F /* Paulstretch.cpp in Sources */,
ED920CAF15B19F61008CA12C /* ModulePrefs.cpp in Sources */,
EDD2431416934A6100D9DEC2 /* BassTreble.cpp in Sources */,

View File

@ -321,7 +321,8 @@ private:
protected:
std::shared_ptr<TrackControls> GetControls() override;
std::shared_ptr<TrackVRulerControls> GetVRulerControls() override;
friend class GetInfoCommand;
friend class GetInfoCommand; // to get labels.
friend class SetLabelCommand; // to set labels.
};
#endif

View File

@ -1600,6 +1600,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),
@ -1608,14 +1612,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();
@ -6350,7 +6354,7 @@ int AudacityProject::FindClips(double t0, double t1, bool next, std::vector<Foun
std::vector<FoundClip> results;
int nTracksSearched = 0;
int trackNumber = 1;
int trackNum = 1;
while (track) {
if (track->GetKind() == Track::Wave && (!anyWaveTracksSelected || track->GetSelected())) {
auto waveTrack = static_cast<const WaveTrack*>(track);
@ -6359,7 +6363,7 @@ int AudacityProject::FindClips(double t0, double t1, bool next, std::vector<Foun
auto result = next ? FindNextClip(waveTrack, t0, t1) :
FindPrevClip(waveTrack, t0, t1);
if (result.found) {
result.trackNumber = trackNumber;
result.trackNum = trackNum;
result.channel = stereoAndDiff;
results.push_back(result);
}
@ -6368,7 +6372,7 @@ int AudacityProject::FindClips(double t0, double t1, bool next, std::vector<Foun
auto result = next ? FindNextClip(waveTrack2, t0, t1) :
FindPrevClip(waveTrack2, t0, t1);
if (result.found) {
result.trackNumber = trackNumber;
result.trackNum = trackNum;
result.channel = stereoAndDiff;
results.push_back(result);
}
@ -6377,7 +6381,7 @@ int AudacityProject::FindClips(double t0, double t1, bool next, std::vector<Foun
nTracksSearched++;
}
trackNumber++;
trackNum++;
track = iter.Next(true);
}
@ -7436,7 +7440,7 @@ int AudacityProject::FindClipBoundaries(double time, bool next, std::vector<Foun
std::vector<FoundClipBoundary> results;
int nTracksSearched = 0;
int trackNumber = 1;
int trackNum = 1;
while (track) {
if (track->GetKind() == Track::Wave && (!anyWaveTracksSelected || track->GetSelected())) {
auto waveTrack = static_cast<const WaveTrack*>(track);
@ -7445,7 +7449,7 @@ int AudacityProject::FindClipBoundaries(double time, bool next, std::vector<Foun
auto result = next ? FindNextClipBoundary(waveTrack, time) :
FindPrevClipBoundary(waveTrack, time);
if (result.nFound > 0) {
result.trackNumber = trackNumber;
result.trackNum = trackNum;
result.channel = stereoAndDiff;
results.push_back(result);
}
@ -7454,7 +7458,7 @@ int AudacityProject::FindClipBoundaries(double time, bool next, std::vector<Foun
auto result = next ? FindNextClipBoundary(waveTrack2, time) :
FindPrevClipBoundary(waveTrack2, time);
if (result.nFound > 0) {
result.trackNumber = trackNumber;
result.trackNum = trackNum;
result.channel = stereoAndDiff;
results.push_back(result);
}
@ -7463,7 +7467,7 @@ int AudacityProject::FindClipBoundaries(double time, bool next, std::vector<Foun
nTracksSearched++;
}
trackNumber++;
trackNum++;
track = iter.Next(true);
}
@ -7520,7 +7524,7 @@ wxString AudacityProject::FoundTrack::ComposeTrackName() const
auto name = waveTrack->GetName();
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) {

View File

@ -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;

View File

@ -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,

View File

@ -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()
{

View File

@ -286,10 +286,13 @@ bool CommandImplementation::Apply(const CommandContext & WXUNUSED(context))
}
// Hackery so that we dont have to update the makefiles on linux (yet)
// When we do, these all can leave here.
#ifndef __WIN32__
#ifndef __WXMAC__
#include "CommandTargets.cpp"
#include "SetClipCommand.cpp"
#include "SetLabelCommand.cpp"
#include "SetProjectCommand.cpp"
#endif
#endif

View File

@ -39,10 +39,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"),
@ -51,16 +62,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"),
@ -68,11 +75,6 @@ static const wxString kFormats[nFormats] =
XO("Brief")
};
enum {
kJson ,
kLisp,
kBrief
};
bool GetInfoCommand::DefineParams( ShuttleParams & S ){
@ -126,12 +128,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" );
}
@ -168,7 +171,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();
@ -179,7 +182,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 );
}
@ -256,12 +259,13 @@ bool GetInfoCommand::SendClips(const CommandContext &context)
while (t) {
if (t->GetKind() == Track::Wave) {
WaveTrack *waveTrack = static_cast<WaveTrack*>(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();
}
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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, () ) \

View File

@ -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);

View File

@ -0,0 +1,124 @@
/**********************************************************************
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 "../Audacity.h"
#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<WaveTrack*>(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;
}

View File

@ -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__ */

View File

@ -0,0 +1,105 @@
/**********************************************************************
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 "../Audacity.h"
#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<LabelTrack*>(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;
}

View File

@ -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__ */

View File

@ -0,0 +1,73 @@
/**********************************************************************
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 "../Audacity.h"
#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;
}

View File

@ -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__ */

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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)
{

View File

@ -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]));
}

View File

@ -198,7 +198,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);
@ -209,7 +209,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.
@ -217,10 +218,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();
}

View File

@ -93,7 +93,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 */

View File

@ -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();

View File

@ -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]));
}

View File

@ -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]));
}

View File

@ -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);

View File

@ -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]));
}

View File

@ -26,7 +26,7 @@ updating the ODPCMAliasBlockFile and the GUI of the newly available data.
#include <wx/wx.h>
//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;

View File

@ -143,6 +143,9 @@
<ClCompile Include="..\..\..\src\commands\Demo.cpp" />
<ClCompile Include="..\..\..\src\commands\LoadCommands.cpp" />
<ClCompile Include="..\..\..\src\commands\OpenSaveCommands.cpp" />
<ClCompile Include="..\..\..\src\commands\SetClipCommand.cpp" />
<ClCompile Include="..\..\..\src\commands\SetLabelCommand.cpp" />
<ClCompile Include="..\..\..\src\commands\SetProjectCommand.cpp" />
<ClCompile Include="..\..\..\src\Dependencies.cpp" />
<ClCompile Include="..\..\..\src\DeviceChange.cpp" />
<ClCompile Include="..\..\..\src\DeviceManager.cpp" />
@ -481,6 +484,9 @@
<ClInclude Include="..\..\..\src\commands\Demo.h" />
<ClInclude Include="..\..\..\src\commands\LoadCommands.h" />
<ClInclude Include="..\..\..\src\commands\OpenSaveCommands.h" />
<ClInclude Include="..\..\..\src\commands\SetClipCommand.h" />
<ClInclude Include="..\..\..\src\commands\SetLabelCommand.h" />
<ClInclude Include="..\..\..\src\commands\SetProjectCommand.h" />
<ClInclude Include="..\..\..\src\DeviceChange.h" />
<ClInclude Include="..\..\..\src\Diags.h" />
<ClInclude Include="..\..\..\src\effects\Distortion.h" />

View File

@ -1064,6 +1064,15 @@
<ClCompile Include="..\..\..\src\commands\CommandTargets.cpp">
<Filter>src\commands</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\commands\SetClipCommand.cpp">
<Filter>src\commands</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\commands\SetLabelCommand.cpp">
<Filter>src\commands</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\commands\SetProjectCommand.cpp">
<Filter>src\commands</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\AboutDialog.h">
@ -2122,6 +2131,15 @@
<ClInclude Include="..\..\..\src\commands\SetTrackInfoCommand.h">
<Filter>src\commands</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\commands\SetClipCommand.h">
<Filter>src\commands</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\commands\SetLabelCommand.h">
<Filter>src\commands</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\commands\SetProjectCommand.h">
<Filter>src\commands</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\audacity.ico">