2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity - A Digital Audio Editor
|
2018-02-16 20:34:30 +00:00
|
|
|
Copyright 1999-2018 Audacity Team
|
2010-01-23 19:44:49 +00:00
|
|
|
License: wxwidgets
|
|
|
|
|
|
|
|
Dan Horgan
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
James Crook
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
******************************************************************//**
|
|
|
|
|
2018-02-09 19:12:25 +00:00
|
|
|
\file SetTrackCommand.cpp
|
2018-03-18 11:00:38 +00:00
|
|
|
\brief Definitions for SetTrackCommand built up from
|
|
|
|
SetTrackBase, SetTrackStatusCommand, SetTrackAudioCommand and
|
|
|
|
SetTrackVisualsCommand
|
|
|
|
|
|
|
|
\class SetTrackBase
|
|
|
|
\brief Base class for the various SetTrackCommand classes.
|
|
|
|
Sbclasses provide the settings that are relevant to them.
|
|
|
|
|
|
|
|
\class SetTrackStatusCommand
|
|
|
|
\brief A SetTrackBase that sets name, selected and focus.
|
|
|
|
|
|
|
|
\class SetTrackAudioCommand
|
|
|
|
\brief A SetTrackBase that sets pan, gain, mute and solo.
|
|
|
|
|
|
|
|
\class SetTrackVisualsCommand
|
|
|
|
\brief A SetTrackBase that sets appearance of a track.
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-02-09 19:12:25 +00:00
|
|
|
\class SetTrackCommand
|
2018-03-18 11:00:38 +00:00
|
|
|
\brief A SetTrackBase that combines SetTrackStatusCommand,
|
|
|
|
SetTrackAudioCommand and SetTrackVisualsCommand.
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
*//*******************************************************************/
|
|
|
|
|
2021-05-09 15:16:56 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#include "SetTrackInfoCommand.h"
|
2018-11-11 02:40:37 +00:00
|
|
|
|
2019-01-17 16:45:51 +00:00
|
|
|
#include "LoadCommands.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
#include "../Project.h"
|
2019-07-01 22:32:18 +00:00
|
|
|
#include "../TrackPanelAx.h"
|
2018-01-13 20:30:52 +00:00
|
|
|
#include "../TrackPanel.h"
|
|
|
|
#include "../WaveTrack.h"
|
2018-02-15 15:20:04 +00:00
|
|
|
#include "../prefs/WaveformSettings.h"
|
|
|
|
#include "../prefs/SpectrogramSettings.h"
|
2019-02-06 18:44:52 +00:00
|
|
|
#include "../Shuttle.h"
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
#include "../ShuttleGui.h"
|
2019-07-09 14:29:29 +00:00
|
|
|
#include "../tracks/playabletrack/wavetrack/ui/WaveTrackView.h"
|
|
|
|
#include "../tracks/playabletrack/wavetrack/ui/WaveTrackViewConstants.h"
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
#include "CommandContext.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
SetTrackBase::SetTrackBase(){
|
|
|
|
mbPromptForTracks = true;
|
2019-04-11 20:18:51 +00:00
|
|
|
bIsSecondChannel = false;
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
|
|
|
|
2018-03-19 11:59:33 +00:00
|
|
|
//Define for the old scheme, where SetTrack defines its own track selection.
|
|
|
|
//rather than using the current selection.
|
|
|
|
//#define USE_OWN_TRACK_SELECTION
|
|
|
|
|
2018-03-23 22:20:59 +00:00
|
|
|
|
|
|
|
bool SetTrackBase::ApplyInner( const CommandContext &context, Track *t )
|
|
|
|
{
|
|
|
|
static_cast<void>(&context);
|
|
|
|
static_cast<void>(&t);
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
bool SetTrackBase::DefineParams( ShuttleParams & S)
|
2018-02-10 19:50:30 +00:00
|
|
|
{
|
2018-03-23 22:20:59 +00:00
|
|
|
static_cast<void>(S);
|
2018-03-19 11:59:33 +00:00
|
|
|
#ifdef USE_OWN_TRACK_SELECTION
|
2018-03-18 11:00:38 +00:00
|
|
|
S.OptionalY( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 );
|
|
|
|
S.OptionalN( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 );
|
2018-03-19 11:59:33 +00:00
|
|
|
#endif
|
2018-03-18 11:00:38 +00:00
|
|
|
return true;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
void SetTrackBase::PopulateOrExchange(ShuttleGui & S)
|
|
|
|
{
|
2018-03-23 22:20:59 +00:00
|
|
|
static_cast<void>(S);
|
2018-03-19 11:59:33 +00:00
|
|
|
#ifdef USE_OWN_TRACK_SELECTION
|
2018-03-18 11:00:38 +00:00
|
|
|
if( !mbPromptForTracks )
|
|
|
|
return;
|
|
|
|
S.AddSpace(0, 5);
|
2018-03-18 19:53:37 +00:00
|
|
|
S.StartMultiColumn(3, wxEXPAND);
|
2018-03-18 11:00:38 +00:00
|
|
|
{
|
2018-03-18 19:53:37 +00:00
|
|
|
S.SetStretchyCol( 2 );
|
2019-12-22 21:26:56 +00:00
|
|
|
S.Optional( bHasTrackIndex ).TieNumericTextBox( XO("Track Index:"), mTrackIndex );
|
|
|
|
S.Optional( bHasChannelIndex).TieNumericTextBox( XO("Channel Index:"), mChannelIndex );
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
2018-03-19 11:59:33 +00:00
|
|
|
#endif
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SetTrackBase::Apply(const CommandContext & context )
|
|
|
|
{
|
|
|
|
long i = 0;// track counter
|
|
|
|
long j = 0;// channel counter
|
2019-05-06 23:00:10 +00:00
|
|
|
auto &tracks = TrackList::Get( context.project );
|
|
|
|
for ( auto t : tracks.Leaders() )
|
2018-03-18 11:00:38 +00:00
|
|
|
{
|
2018-09-18 15:58:44 +00:00
|
|
|
auto channels = TrackList::Channels(t);
|
|
|
|
for ( auto channel : channels ) {
|
|
|
|
bool bThisTrack =
|
2018-03-19 11:59:33 +00:00
|
|
|
#ifdef USE_OWN_TRACK_SELECTION
|
2018-03-18 11:00:38 +00:00
|
|
|
(bHasTrackIndex && (i==mTrackIndex)) ||
|
|
|
|
(bHasChannelIndex && (j==mChannelIndex ) ) ||
|
|
|
|
(!bHasTrackIndex && !bHasChannelIndex) ;
|
2018-03-19 11:59:33 +00:00
|
|
|
#else
|
2018-09-18 15:58:44 +00:00
|
|
|
channel->GetSelected();
|
2018-03-19 11:59:33 +00:00
|
|
|
#endif
|
2018-03-18 11:00:38 +00:00
|
|
|
|
2018-09-18 15:58:44 +00:00
|
|
|
if( bThisTrack ){
|
2018-10-12 01:40:38 +00:00
|
|
|
ApplyInner( context, channel );
|
2018-09-18 15:58:44 +00:00
|
|
|
}
|
|
|
|
++j; // count all channels
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
2018-09-18 15:58:44 +00:00
|
|
|
++i; // count groups of channels
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-06-24 14:40:45 +00:00
|
|
|
const ComponentInterfaceSymbol SetTrackStatusCommand::Symbol
|
|
|
|
{ XO("Set Track Status") };
|
|
|
|
|
2019-01-17 16:45:51 +00:00
|
|
|
namespace{ BuiltinCommandsModule::Registration< SetTrackStatusCommand > reg; }
|
|
|
|
|
2019-06-24 14:40:45 +00:00
|
|
|
bool SetTrackStatusCommand::DefineParams( ShuttleParams & S ){
|
2018-03-18 11:00:38 +00:00
|
|
|
SetTrackBase::DefineParams( S );
|
2018-03-22 19:19:59 +00:00
|
|
|
S.OptionalN( bHasTrackName ).Define( mTrackName, wxT("Name"), _("Unnamed") );
|
2018-03-18 11:00:38 +00:00
|
|
|
// There is also a select command. This is an alternative.
|
|
|
|
S.OptionalN( bHasSelected ).Define( bSelected, wxT("Selected"), false );
|
|
|
|
S.OptionalN( bHasFocused ).Define( bFocused, wxT("Focused"), false );
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
void SetTrackStatusCommand::PopulateOrExchange(ShuttleGui & S)
|
|
|
|
{
|
|
|
|
SetTrackBase::PopulateOrExchange( S );
|
2018-03-18 19:53:37 +00:00
|
|
|
S.StartMultiColumn(3, wxEXPAND);
|
2018-03-18 11:00:38 +00:00
|
|
|
{
|
2018-03-18 19:53:37 +00:00
|
|
|
S.SetStretchyCol( 2 );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasTrackName ).TieTextBox( XXO("Name:"), mTrackName );
|
2018-03-18 19:53:37 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
S.StartMultiColumn(2, wxEXPAND);
|
|
|
|
{
|
|
|
|
S.SetStretchyCol( 1 );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasSelected ).TieCheckBox( XXO("Selected"), bSelected );
|
|
|
|
S.Optional( bHasFocused ).TieCheckBox( XXO("Focused"), bFocused);
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SetTrackStatusCommand::ApplyInner(const CommandContext & context, Track * t )
|
|
|
|
{
|
2018-03-23 22:20:59 +00:00
|
|
|
//auto wt = dynamic_cast<WaveTrack *>(t);
|
|
|
|
//auto pt = dynamic_cast<PlayableTrack *>(t);
|
2018-03-18 11:00:38 +00:00
|
|
|
|
|
|
|
// You can get some intriguing effects by setting R and L channels to
|
|
|
|
// different values.
|
|
|
|
if( bHasTrackName )
|
|
|
|
t->SetName(mTrackName);
|
|
|
|
|
|
|
|
// In stereo tracks, both channels need selecting/deselecting.
|
|
|
|
if( bHasSelected )
|
|
|
|
t->SetSelected(bSelected);
|
|
|
|
|
|
|
|
// These ones don't make sense on the second channel of a stereo track.
|
|
|
|
if( !bIsSecondChannel ){
|
|
|
|
if( bHasFocused )
|
|
|
|
{
|
2019-07-01 22:32:18 +00:00
|
|
|
auto &trackFocus = TrackFocus::Get( context.project );
|
2018-03-18 11:00:38 +00:00
|
|
|
if( bFocused)
|
2019-07-01 22:32:18 +00:00
|
|
|
trackFocus.Set( t );
|
|
|
|
else if( t == trackFocus.Get() )
|
|
|
|
trackFocus.Set( nullptr );
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-24 14:40:45 +00:00
|
|
|
const ComponentInterfaceSymbol SetTrackAudioCommand::Symbol
|
|
|
|
{ XO("Set Track Audio") };
|
|
|
|
|
2019-01-17 16:45:51 +00:00
|
|
|
namespace{ BuiltinCommandsModule::Registration< SetTrackAudioCommand > reg2; }
|
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
bool SetTrackAudioCommand::DefineParams( ShuttleParams & S ){
|
|
|
|
SetTrackBase::DefineParams( S );
|
2018-03-18 19:53:37 +00:00
|
|
|
S.OptionalN( bHasMute ).Define( bMute, wxT("Mute"), false );
|
|
|
|
S.OptionalN( bHasSolo ).Define( bSolo, wxT("Solo"), false );
|
|
|
|
|
2018-03-23 22:20:59 +00:00
|
|
|
S.OptionalN( bHasGain ).Define( mGain, wxT("Gain"), 0.0, -36.0, 36.0);
|
|
|
|
S.OptionalN( bHasPan ).Define( mPan, wxT("Pan"), 0.0, -100.0, 100.0);
|
2018-03-18 11:00:38 +00:00
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
void SetTrackAudioCommand::PopulateOrExchange(ShuttleGui & S)
|
|
|
|
{
|
|
|
|
SetTrackBase::PopulateOrExchange( S );
|
2018-03-18 19:53:37 +00:00
|
|
|
S.StartMultiColumn(2, wxEXPAND);
|
|
|
|
{
|
|
|
|
S.SetStretchyCol( 1 );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasMute ).TieCheckBox( XXO("Mute"), bMute);
|
|
|
|
S.Optional( bHasSolo ).TieCheckBox( XXO("Solo"), bSolo);
|
2018-03-18 19:53:37 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
S.StartMultiColumn(3, wxEXPAND);
|
2018-03-18 11:00:38 +00:00
|
|
|
{
|
2018-03-18 19:53:37 +00:00
|
|
|
S.SetStretchyCol( 2 );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasGain ).TieSlider( XXO("Gain:"), mGain, 36.0,-36.0);
|
|
|
|
S.Optional( bHasPan ).TieSlider( XXO("Pan:"), mPan, 100.0, -100.0);
|
2018-03-18 11:00:38 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SetTrackAudioCommand::ApplyInner(const CommandContext & context, Track * t )
|
|
|
|
{
|
2018-03-23 22:20:59 +00:00
|
|
|
static_cast<void>(context);
|
2018-03-18 11:00:38 +00:00
|
|
|
auto wt = dynamic_cast<WaveTrack *>(t);
|
|
|
|
auto pt = dynamic_cast<PlayableTrack *>(t);
|
|
|
|
|
|
|
|
if( wt && bHasGain )
|
2018-03-23 22:20:59 +00:00
|
|
|
wt->SetGain(DB_TO_LINEAR(mGain));
|
|
|
|
if( wt && bHasPan )
|
|
|
|
wt->SetPan(mPan/100.0);
|
2018-03-18 11:00:38 +00:00
|
|
|
|
|
|
|
// These ones don't make sense on the second channel of a stereo track.
|
|
|
|
if( !bIsSecondChannel ){
|
|
|
|
if( pt && bHasSolo )
|
|
|
|
pt->SetSolo(bSolo);
|
|
|
|
if( pt && bHasMute )
|
|
|
|
pt->SetMute(bMute);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-24 14:40:45 +00:00
|
|
|
const ComponentInterfaceSymbol SetTrackVisualsCommand::Symbol
|
|
|
|
{ XO("Set Track Visuals") };
|
|
|
|
|
2019-01-17 16:45:51 +00:00
|
|
|
namespace{ BuiltinCommandsModule::Registration< SetTrackVisualsCommand > reg3; }
|
|
|
|
|
2018-02-09 19:12:25 +00:00
|
|
|
enum kColours
|
|
|
|
{
|
|
|
|
kColour0,
|
|
|
|
kColour1,
|
|
|
|
kColour2,
|
|
|
|
kColour3,
|
|
|
|
nColours
|
|
|
|
};
|
|
|
|
|
2019-02-28 18:16:09 +00:00
|
|
|
static const EnumValueSymbol kColourStrings[nColours] =
|
2018-02-09 19:12:25 +00:00
|
|
|
{
|
2018-03-27 18:17:23 +00:00
|
|
|
{ wxT("Color0"), XO("Color 0") },
|
|
|
|
{ wxT("Color1"), XO("Color 1") },
|
|
|
|
{ wxT("Color2"), XO("Color 2") },
|
|
|
|
{ wxT("Color3"), XO("Color 3") },
|
2018-02-09 19:12:25 +00:00
|
|
|
};
|
|
|
|
|
2018-02-15 15:20:04 +00:00
|
|
|
|
|
|
|
enum kScaleTypes
|
|
|
|
{
|
|
|
|
kLinear,
|
|
|
|
kDb,
|
|
|
|
nScaleTypes
|
|
|
|
};
|
|
|
|
|
2019-02-28 18:16:09 +00:00
|
|
|
static const EnumValueSymbol kScaleTypeStrings[nScaleTypes] =
|
2018-02-15 15:20:04 +00:00
|
|
|
{
|
2018-03-27 18:17:23 +00:00
|
|
|
// These are acceptable dual purpose internal/visible names
|
2018-03-27 02:03:45 +00:00
|
|
|
{ XO("Linear") },
|
2018-03-27 18:17:23 +00:00
|
|
|
/* i18n-hint: abbreviates decibels */
|
2018-03-27 02:03:45 +00:00
|
|
|
{ XO("dB") },
|
2018-02-15 15:20:04 +00:00
|
|
|
};
|
|
|
|
|
2018-02-17 16:08:38 +00:00
|
|
|
enum kZoomTypes
|
|
|
|
{
|
|
|
|
kReset,
|
|
|
|
kTimes2,
|
|
|
|
kHalfWave,
|
|
|
|
nZoomTypes
|
|
|
|
};
|
|
|
|
|
2019-02-28 18:16:09 +00:00
|
|
|
static const EnumValueSymbol kZoomTypeStrings[nZoomTypes] =
|
2018-02-17 16:08:38 +00:00
|
|
|
{
|
2018-03-27 02:03:45 +00:00
|
|
|
{ XO("Reset") },
|
2018-03-27 18:17:23 +00:00
|
|
|
{ wxT("Times2"), XO("Times 2") },
|
2018-03-27 02:03:45 +00:00
|
|
|
{ XO("HalfWave") },
|
2018-02-17 16:08:38 +00:00
|
|
|
};
|
|
|
|
|
2020-01-18 19:37:49 +00:00
|
|
|
static EnumValueSymbols DiscoverSubViewTypes()
|
|
|
|
{
|
2020-01-19 19:20:44 +00:00
|
|
|
const auto &types = WaveTrackSubViewType::All();
|
2020-09-10 18:59:17 +00:00
|
|
|
auto result = transform_container< EnumValueSymbols >(
|
2020-01-18 19:37:49 +00:00
|
|
|
types, std::mem_fn( &WaveTrackSubView::Type::name ) );
|
2020-09-10 18:59:17 +00:00
|
|
|
result.push_back( WaveTrackViewConstants::MultiViewSymbol );
|
|
|
|
return result;
|
2020-01-18 19:37:49 +00:00
|
|
|
}
|
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
bool SetTrackVisualsCommand::DefineParams( ShuttleParams & S ){
|
|
|
|
SetTrackBase::DefineParams( S );
|
2019-07-22 18:36:35 +00:00
|
|
|
S.OptionalN( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 2000 );
|
2020-01-18 19:37:49 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
auto symbols = DiscoverSubViewTypes();
|
|
|
|
S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), 0, symbols.data(), symbols.size() );
|
|
|
|
}
|
|
|
|
|
2018-03-27 01:06:35 +00:00
|
|
|
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, kScaleTypeStrings, nScaleTypes );
|
|
|
|
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, kColourStrings, nColours );
|
|
|
|
S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, kZoomTypeStrings, nZoomTypes );
|
2018-11-11 16:22:21 +00:00
|
|
|
S.OptionalN( bHasVZoomTop ).Define( mVZoomTop, wxT("VZoomHigh"), 1.0, -2.0, 2.0 );
|
|
|
|
S.OptionalN( bHasVZoomBottom ).Define( mVZoomBottom, wxT("VZoomLow"), -1.0, -2.0, 2.0 );
|
2018-02-18 16:55:26 +00:00
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
S.OptionalN( bHasUseSpecPrefs ).Define( bUseSpecPrefs, wxT("SpecPrefs"), false );
|
2018-02-17 13:29:46 +00:00
|
|
|
S.OptionalN( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true );
|
2021-06-11 07:30:41 +00:00
|
|
|
|
|
|
|
auto schemes = SpectrogramSettings::GetColorSchemeNames();
|
|
|
|
S.OptionalN( bHasSpecColorScheme).DefineEnum( mSpecColorScheme,wxT("SpecColor"), SpectrogramSettings::csColorNew, schemes.data(), schemes.size());
|
2018-03-18 11:00:38 +00:00
|
|
|
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
return true;
|
|
|
|
};
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
void SetTrackVisualsCommand::PopulateOrExchange(ShuttleGui & S)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2018-03-18 11:00:38 +00:00
|
|
|
SetTrackBase::PopulateOrExchange( S );
|
2018-03-18 19:53:37 +00:00
|
|
|
S.StartMultiColumn(3, wxEXPAND);
|
2018-02-09 12:58:43 +00:00
|
|
|
{
|
2018-03-18 19:53:37 +00:00
|
|
|
S.SetStretchyCol( 2 );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasHeight ).TieNumericTextBox( XXO("Height:"), mHeight );
|
|
|
|
S.Optional( bHasColour ).TieChoice( XXO("Color:"), mColour,
|
2019-12-18 03:52:42 +00:00
|
|
|
Msgids( kColourStrings, nColours ) );
|
2020-01-18 19:37:49 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
auto symbols = DiscoverSubViewTypes();
|
|
|
|
auto typeNames = transform_container<TranslatableStrings>(
|
|
|
|
symbols, std::mem_fn( &EnumValueSymbol::Stripped ) );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasDisplayType ).TieChoice( XXO("Display:"), mDisplayType,
|
2020-01-18 19:37:49 +00:00
|
|
|
typeNames );
|
|
|
|
}
|
|
|
|
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasScaleType ).TieChoice( XXO("Scale:"), mScaleType,
|
2019-12-18 03:52:42 +00:00
|
|
|
Msgids( kScaleTypeStrings, nScaleTypes ) );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasVZoom ).TieChoice( XXO("VZoom:"), mVZoom,
|
2019-12-18 03:52:42 +00:00
|
|
|
Msgids( kZoomTypeStrings, nZoomTypes ) );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasVZoomTop ).TieTextBox( XXO("VZoom Top:"), mVZoomTop );
|
|
|
|
S.Optional( bHasVZoomBottom ).TieTextBox( XXO("VZoom Bottom:"), mVZoomBottom );
|
2018-03-18 19:53:37 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
S.StartMultiColumn(2, wxEXPAND);
|
|
|
|
{
|
|
|
|
S.SetStretchyCol( 1 );
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Optional( bHasUseSpecPrefs ).TieCheckBox( XXO("Use Spectral Prefs"), bUseSpecPrefs );
|
|
|
|
S.Optional( bHasSpectralSelect ).TieCheckBox( XXO("Spectral Select"), bSpectralSelect);
|
2021-06-11 07:30:41 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
S.StartMultiColumn(3, wxEXPAND);
|
|
|
|
{
|
|
|
|
S.SetStretchyCol( 2 );
|
|
|
|
auto schemes = SpectrogramSettings::GetColorSchemeNames();
|
2021-06-11 02:59:50 +00:00
|
|
|
S.Optional( bHasSpecColorScheme).TieChoice( XC("Sche&me", "spectrum prefs"), mSpecColorScheme,
|
2021-06-11 07:30:41 +00:00
|
|
|
Msgids( schemes.data(), schemes.size() ) );
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
bool SetTrackVisualsCommand::ApplyInner(const CommandContext & context, Track * t )
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2018-03-23 22:20:59 +00:00
|
|
|
static_cast<void>(context);
|
2018-03-18 11:00:38 +00:00
|
|
|
auto wt = dynamic_cast<WaveTrack *>(t);
|
2018-03-23 22:20:59 +00:00
|
|
|
//auto pt = dynamic_cast<PlayableTrack *>(t);
|
2018-11-11 16:22:21 +00:00
|
|
|
static const double ZOOMLIMIT = 0.001f;
|
2018-03-18 11:00:38 +00:00
|
|
|
|
|
|
|
// You can get some intriguing effects by setting R and L channels to
|
|
|
|
// different values.
|
|
|
|
if( wt && bHasColour )
|
|
|
|
wt->SetWaveColorIndex( mColour );
|
2018-11-11 16:22:21 +00:00
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
if( t && bHasHeight )
|
2019-06-18 15:32:26 +00:00
|
|
|
TrackView::Get( *t ).SetHeight( mHeight );
|
2018-03-18 11:00:38 +00:00
|
|
|
|
2020-09-10 18:59:17 +00:00
|
|
|
if( wt && bHasDisplayType ) {
|
|
|
|
auto &view = WaveTrackView::Get( *wt );
|
|
|
|
auto &all = WaveTrackSubViewType::All();
|
|
|
|
if (mDisplayType < all.size())
|
|
|
|
view.SetDisplay( all[ mDisplayType ].id );
|
|
|
|
else {
|
|
|
|
view.SetMultiView( true );
|
|
|
|
view.SetDisplay( WaveTrackSubViewType::Default(), false );
|
|
|
|
}
|
|
|
|
}
|
2018-03-18 11:00:38 +00:00
|
|
|
if( wt && bHasScaleType )
|
2020-10-10 15:14:20 +00:00
|
|
|
wt->GetWaveformSettings().scaleType =
|
2018-03-18 11:00:38 +00:00
|
|
|
(mScaleType==kLinear) ?
|
|
|
|
WaveformSettings::stLinear
|
|
|
|
: WaveformSettings::stLogarithmic;
|
|
|
|
|
|
|
|
if( wt && bHasVZoom ){
|
|
|
|
switch( mVZoom ){
|
|
|
|
default:
|
|
|
|
case kReset: wt->SetDisplayBounds(-1,1); break;
|
|
|
|
case kTimes2: wt->SetDisplayBounds(-2,2); break;
|
|
|
|
case kHalfWave: wt->SetDisplayBounds(0,1); break;
|
2018-02-16 20:34:30 +00:00
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2018-03-18 11:00:38 +00:00
|
|
|
|
2018-11-11 16:22:21 +00:00
|
|
|
if ( wt && (bHasVZoomTop || bHasVZoomBottom) && !bHasVZoom){
|
|
|
|
float vzmin, vzmax;
|
|
|
|
wt->GetDisplayBounds(&vzmin, &vzmax);
|
|
|
|
|
|
|
|
if ( !bHasVZoomTop ){
|
|
|
|
mVZoomTop = vzmax;
|
|
|
|
}
|
|
|
|
if ( !bHasVZoomBottom ){
|
|
|
|
mVZoomBottom = vzmin;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Can't use std::clamp until C++17
|
|
|
|
mVZoomTop = std::max(-2.0, std::min(mVZoomTop, 2.0));
|
|
|
|
mVZoomBottom = std::max(-2.0, std::min(mVZoomBottom, 2.0));
|
|
|
|
|
|
|
|
if (mVZoomBottom > mVZoomTop){
|
|
|
|
std::swap(mVZoomTop, mVZoomBottom);
|
|
|
|
}
|
|
|
|
if ( mVZoomTop - mVZoomBottom < ZOOMLIMIT ){
|
|
|
|
double c = (mVZoomBottom + mVZoomTop) / 2;
|
|
|
|
mVZoomBottom = c - ZOOMLIMIT / 2.0;
|
|
|
|
mVZoomTop = c + ZOOMLIMIT / 2.0;
|
|
|
|
}
|
|
|
|
wt->SetDisplayBounds(mVZoomBottom, mVZoomTop);
|
2019-05-21 14:53:09 +00:00
|
|
|
auto &tp = TrackPanel::Get( context.project );
|
2019-04-21 21:01:31 +00:00
|
|
|
tp.UpdateVRulers();
|
2018-11-11 16:22:21 +00:00
|
|
|
}
|
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
if( wt && bHasUseSpecPrefs ){
|
|
|
|
wt->UseSpectralPrefs( bUseSpecPrefs );
|
|
|
|
}
|
2018-11-11 16:22:21 +00:00
|
|
|
if( wt && bHasSpectralSelect ){
|
2018-03-18 11:00:38 +00:00
|
|
|
wt->GetSpectrogramSettings().spectralSelection = bSpectralSelect;
|
2018-11-11 16:22:21 +00:00
|
|
|
}
|
2021-06-11 07:30:41 +00:00
|
|
|
if (wt && bHasSpecColorScheme) {
|
2021-06-04 15:10:18 +00:00
|
|
|
wt->GetSpectrogramSettings().colorScheme = (SpectrogramSettings::ColorScheme)mSpecColorScheme;
|
2018-11-11 16:22:21 +00:00
|
|
|
}
|
2018-03-18 11:00:38 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
2018-02-09 19:12:25 +00:00
|
|
|
|
|
|
|
|
2019-06-24 14:40:45 +00:00
|
|
|
const ComponentInterfaceSymbol SetTrackCommand::Symbol
|
|
|
|
{ XO("Set Track") };
|
|
|
|
|
2019-01-17 16:45:51 +00:00
|
|
|
namespace{ BuiltinCommandsModule::Registration< SetTrackCommand > reg4; }
|
|
|
|
|
2018-03-18 11:00:38 +00:00
|
|
|
SetTrackCommand::SetTrackCommand()
|
|
|
|
{
|
|
|
|
mSetStatus.mbPromptForTracks = false;
|
|
|
|
mSetAudio.mbPromptForTracks = false;
|
|
|
|
mSetVisuals.mbPromptForTracks = false;
|
|
|
|
}
|
|
|
|
|