Audacity  3.0.3
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
SetEnvelopeCommand Class Reference

Command that sets envelope information. More...

#include <SetEnvelopeCommand.h>

Inheritance diagram for SetEnvelopeCommand:
[legend]
Collaboration diagram for SetEnvelopeCommand:
[legend]

Public Member Functions

 SetEnvelopeCommand ()
 
ComponentInterfaceSymbol GetSymbol () override
 
TranslatableString GetDescription () override
 
bool DefineParams (ShuttleParams &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
ManualPageID ManualPage () override
 
bool ApplyInner (const CommandContext &context, Track *t) override
 
- Public Member Functions inherited from SetTrackBase
 SetTrackBase ()
 
bool Apply (const CommandContext &context) override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
PluginPath GetPath () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
virtual void SetHostUI (EffectUIHostInterface *WXUNUSED(host))
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipAudacityCommand ()
 
virtual void End ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 

Public Attributes

double mT
 
double mV
 
bool mbDelete
 
bool bHasT
 
bool bHasV
 
bool bHasDelete
 
- Public Attributes inherited from SetTrackBase
int mTrackIndex
 
int mChannelIndex
 
bool bHasTrackIndex
 
bool bHasChannelIndex
 
bool bIsSecondChannel
 
bool mbPromptForTracks
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Set Envelope") }
 

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Static Public Member Functions inherited from AudacityCommand
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 

Detailed Description

Command that sets envelope information.

Definition at line 21 of file SetEnvelopeCommand.h.

Constructor & Destructor Documentation

◆ SetEnvelopeCommand()

SetEnvelopeCommand::SetEnvelopeCommand ( )

Definition at line 38 of file SetEnvelopeCommand.cpp.

39 {
40 }

Member Function Documentation

◆ ApplyInner()

bool SetEnvelopeCommand::ApplyInner ( const CommandContext context,
Track t 
)
overridevirtual

Reimplemented from SetTrackBase.

Definition at line 63 of file SetEnvelopeCommand.cpp.

64 {
65  // if no time is specified, then
66  // - delete deletes any envelope in selected tracks.
67  // - value is not set for any clip
68  t->TypeSwitch([&](WaveTrack *waveTrack) {
69  WaveClipPointers ptrs( waveTrack->SortedClipArray());
70  for(auto it = ptrs.begin(); (it != ptrs.end()); it++ ){
71  WaveClip * pClip = *it;
72  bool bFound =
73  !bHasT || (
74  ( pClip->GetStartTime() <= mT) &&
75  ( pClip->GetEndTime() >= mT )
76  );
77  if( bFound )
78  {
79  // Inside this IF is where we actually apply the command
80  Envelope* pEnv = pClip->GetEnvelope();
81  bool didSomething = false;
82  if( bHasDelete && mbDelete )
83  pEnv->Clear(), didSomething = true;
84  if( bHasT && bHasV )
85  pEnv->InsertOrReplace( mT, pEnv->ClampValue( mV ) ),
86  didSomething = true;
87 
88  if (didSomething)
89  // Consolidate, because this ApplyInner() function may be
90  // visited multiple times in one command invocation
92  XO("Edited Envelope"), XO("Envelope"),
94  }
95  }
96  } );
97 
98  return true;
99 }

References bHasDelete, bHasT, bHasV, Envelope::ClampValue(), Envelope::Clear(), CONSOLIDATE, ProjectHistory::Get(), WaveClip::GetEndTime(), WaveClip::GetEnvelope(), WaveClip::GetStartTime(), Envelope::InsertOrReplace(), mbDelete, mT, mV, CommandContext::project, ProjectHistory::PushState(), WaveTrack::SortedClipArray(), Track::TypeSwitch(), and XO.

Here is the call graph for this function:

◆ DefineParams()

bool SetEnvelopeCommand::DefineParams ( ShuttleParams S)
overridevirtual

Reimplemented from SetTrackBase.

Definition at line 43 of file SetEnvelopeCommand.cpp.

43  {
44  S.OptionalY( bHasT ).Define( mT, wxT("Time"), 0.0, 0.0, 100000.0);
45  S.OptionalY( bHasV ).Define( mV, wxT("Value"), 1.0, 0.0, 2.0);
46  S.OptionalN( bHasDelete ).Define( mbDelete, wxT("Delete"), false );
47  return true;
48 };

References bHasDelete, bHasT, bHasV, ShuttleParams::Define(), mbDelete, mT, mV, ShuttleParams::OptionalN(), and ShuttleParams::OptionalY().

Here is the call graph for this function:

◆ GetDescription()

TranslatableString SetEnvelopeCommand::GetDescription ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 29 of file SetEnvelopeCommand.h.

29 {return XO("Sets an envelope point position.");};

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol SetEnvelopeCommand::GetSymbol ( )
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 28 of file SetEnvelopeCommand.h.

28 {return Symbol;};

References Symbol.

◆ ManualPage()

ManualPageID SetEnvelopeCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 34 of file SetEnvelopeCommand.h.

34 {return L"Extra_Menu:_Scriptables_I#set_envelope";}

◆ PopulateOrExchange()

void SetEnvelopeCommand::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from SetTrackBase.

Definition at line 50 of file SetEnvelopeCommand.cpp.

51 {
52  S.AddSpace(0, 5);
53 
54  S.StartMultiColumn(3, wxALIGN_CENTER);
55  {
56  S.Optional( bHasT ).TieNumericTextBox( XXO("Time:"), mT );
57  S.Optional( bHasV ).TieNumericTextBox( XXO("Value:"), mV );
58  S.Optional( bHasDelete ).TieCheckBox( XXO("Delete"), mbDelete );
59  }
60  S.EndMultiColumn();
61 }

References ShuttleGui::AddSpace(), bHasDelete, bHasT, bHasV, ShuttleGuiBase::EndMultiColumn(), mbDelete, mT, mV, ShuttleGui::Optional(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::TieCheckBox(), ShuttleGuiBase::TieNumericTextBox(), and XXO.

Here is the call graph for this function:

Member Data Documentation

◆ bHasDelete

bool SetEnvelopeCommand::bHasDelete

Definition at line 44 of file SetEnvelopeCommand.h.

Referenced by ApplyInner(), DefineParams(), and PopulateOrExchange().

◆ bHasT

bool SetEnvelopeCommand::bHasT

Definition at line 42 of file SetEnvelopeCommand.h.

Referenced by ApplyInner(), DefineParams(), and PopulateOrExchange().

◆ bHasV

bool SetEnvelopeCommand::bHasV

Definition at line 43 of file SetEnvelopeCommand.h.

Referenced by ApplyInner(), DefineParams(), and PopulateOrExchange().

◆ mbDelete

bool SetEnvelopeCommand::mbDelete

Definition at line 40 of file SetEnvelopeCommand.h.

Referenced by ApplyInner(), DefineParams(), and PopulateOrExchange().

◆ mT

double SetEnvelopeCommand::mT

Definition at line 38 of file SetEnvelopeCommand.h.

Referenced by ApplyInner(), DefineParams(), and PopulateOrExchange().

◆ mV

double SetEnvelopeCommand::mV

Definition at line 39 of file SetEnvelopeCommand.h.

Referenced by ApplyInner(), DefineParams(), and PopulateOrExchange().

◆ Symbol

const ComponentInterfaceSymbol SetEnvelopeCommand::Symbol { XO("Set Envelope") }
static

Definition at line 24 of file SetEnvelopeCommand.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
SetEnvelopeCommand::bHasDelete
bool bHasDelete
Definition: SetEnvelopeCommand.h:44
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
SetEnvelopeCommand::mV
double mV
Definition: SetEnvelopeCommand.h:39
SetEnvelopeCommand::mbDelete
bool mbDelete
Definition: SetEnvelopeCommand.h:40
WaveClip::GetEnvelope
Envelope * GetEnvelope()
Definition: WaveClip.h:243
ShuttleGuiBase::TieCheckBox
wxCheckBox * TieCheckBox(const TranslatableString &Prompt, bool &Var)
Definition: ShuttleGui.cpp:1629
Envelope
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:71
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
WaveClip::GetEndTime
double GetEndTime() const
Definition: WaveClip.cpp:255
XO
#define XO(s)
Definition: Internat.h:31
Envelope::ClampValue
double ClampValue(double value)
Definition: Envelope.h:110
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
WaveClipPointers
std::vector< WaveClip * > WaveClipPointers
Definition: WaveTrack.h:41
ShuttleParams::OptionalN
virtual ShuttleParams & OptionalN(bool &var)
Definition: Shuttle.h:72
WaveTrack::SortedClipArray
WaveClipPointers SortedClipArray()
Definition: WaveTrack.cpp:2606
WaveClip::GetStartTime
double GetStartTime() const
Definition: WaveClip.cpp:249
SetEnvelopeCommand::bHasT
bool bHasT
Definition: SetEnvelopeCommand.h:42
WaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:173
XXO
#define XXO(s)
Definition: Internat.h:44
SetEnvelopeCommand::mT
double mT
Definition: SetEnvelopeCommand.h:38
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
ShuttleParams::OptionalY
virtual ShuttleParams & OptionalY(bool &var)
Definition: Shuttle.h:71
Envelope::InsertOrReplace
int InsertOrReplace(double when, double value)
Add a point at a particular absolute time coordinate.
Definition: Envelope.h:181
Envelope::Clear
void Clear()
Definition: Envelope.h:178
ShuttleGuiBase::TieNumericTextBox
wxTextCtrl * TieNumericTextBox(const TranslatableString &Prompt, int &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1673
ProjectHistory::PushState
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
Definition: ProjectHistory.cpp:90
Track::TypeSwitch
R TypeSwitch(const Functions &...functions)
Use this function rather than testing track type explicitly and making down-casts.
Definition: Track.h:709
UndoPush::CONSOLIDATE
@ CONSOLIDATE
SetEnvelopeCommand::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: SetEnvelopeCommand.h:24
ShuttleParams::Define
virtual void Define(bool &var, const wxChar *key, const bool vdefault, const bool vmin=false, const bool vmax=false, const bool vscl=false)
Definition: Shuttle.cpp:332
ShuttleGui::Optional
ShuttleGui & Optional(bool &bVar)
Definition: ShuttleGui.cpp:2280
CommandContext::project
AudacityProject & project
Definition: CommandContext.h:64
ProjectHistory::Get
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26
SetEnvelopeCommand::bHasV
bool bHasV
Definition: SetEnvelopeCommand.h:43