Audacity 3.2.0
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 () const override
 
TranslatableString GetDescription () const override
 
template<bool Const>
bool VisitSettings (SettingsVisitorBase< Const > &S)
 
bool VisitSettings (SettingsVisitor &S) override
 
bool VisitSettings (ConstSettingsVisitor &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
ManualPageID ManualPage () override
 
bool ApplyInner (const CommandContext &context, Track &t) override
 
- Public Member Functions inherited from SetTrackBase
bool Apply (const CommandContext &context) final
 
virtual bool ApplyInner (const CommandContext &context, Track &t)=0
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
PluginPath GetPath () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
ComponentInterfaceSymbol GetSymbol () const override=0
 
virtual TranslatableString GetDescription () const override
 
virtual ManualPageID ManualPage ()
 
virtual bool IsBatchProcessing () const
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
bool SaveSettingsAsString (wxString &parms)
 
bool LoadSettingsFromString (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 ()
 
virtual bool VisitSettings (SettingsVisitor &)
 
virtual bool VisitSettings (ConstSettingsVisitor &)
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Public Attributes

double mT
 
double mV
 
bool mbDelete
 
bool bHasT
 
bool bHasV
 
bool bHasDelete
 

Static Public Attributes

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

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 

Detailed Description

Command that sets envelope information.

Definition at line 21 of file SetEnvelopeCommand.h.

Constructor & Destructor Documentation

◆ SetEnvelopeCommand()

SetEnvelopeCommand::SetEnvelopeCommand ( )

Definition at line 41 of file SetEnvelopeCommand.cpp.

42{
43}

Member Function Documentation

◆ ApplyInner()

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

Implements SetTrackBase.

Definition at line 72 of file SetEnvelopeCommand.cpp.

73{
74 // if no time is specified, then
75 // - delete deletes any envelope in selected tracks.
76 // - value is not set for any clip
77 t.TypeSwitch([&](WaveTrack &waveTrack) {
78 for (const auto pClip : waveTrack.SortedIntervalArray()) {
79 bool bFound =
80 !bHasT || (
81 (pClip->GetPlayStartTime() <= mT) &&
82 (pClip->GetPlayEndTime() >= mT)
83 );
84 if (bFound) {
85 // Inside this IF is where we actually apply the command
86 auto &env = pClip->GetEnvelope();
87 bool didSomething = false;
88 if (bHasDelete && mbDelete)
89 env.Clear(), didSomething = true;
90 if (bHasT && bHasV)
91 env.InsertOrReplace(mT, env.ClampValue(mV)),
92 didSomething = true;
93
94 if (didSomething)
95 // Consolidate, because this ApplyInner() function may be
96 // visited multiple times in one command invocation
97 ProjectHistory::Get(context.project).PushState(
98 XO("Edited Envelope"), XO("Envelope"),
99 UndoPush::CONSOLIDATE);
100 }
101 }
102 } );
103
104
105 return true;
106}
R TypeSwitch(const Functions &...functions)
Definition: Track.h:381
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
IntervalHolders SortedIntervalArray()
Return all WaveClips sorted by clip play start time.
Definition: WaveTrack.cpp:3270

References WaveTrack::SortedIntervalArray(), and Track::TypeSwitch().

Here is the call graph for this function:

◆ GetDescription()

TranslatableString SetEnvelopeCommand::GetDescription ( ) const
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 29 of file SetEnvelopeCommand.h.

29{return XO("Sets an envelope point position.");};
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol SetEnvelopeCommand::GetSymbol ( ) const
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 28 of file SetEnvelopeCommand.h.

28{return Symbol;};
static const ComponentInterfaceSymbol Symbol

References Symbol.

◆ ManualPage()

ManualPageID SetEnvelopeCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 36 of file SetEnvelopeCommand.h.

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

◆ PopulateOrExchange()

void SetEnvelopeCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 59 of file SetEnvelopeCommand.cpp.

60{
61 S.AddSpace(0, 5);
62
63 S.StartMultiColumn(3, wxALIGN_CENTER);
64 {
65 S.Optional( bHasT ).TieNumericTextBox( XXO("Time:"), mT );
66 S.Optional( bHasV ).TieNumericTextBox( XXO("Value:"), mV );
67 S.Optional( bHasDelete ).TieCheckBox( XXO("Delete"), mbDelete );
68 }
69 S.EndMultiColumn();
70}
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64

References bHasDelete, bHasT, bHasV, mbDelete, mT, mV, S, and XXO().

Here is the call graph for this function:

◆ VisitSettings() [1/3]

bool SetEnvelopeCommand::VisitSettings ( ConstSettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 56 of file SetEnvelopeCommand.cpp.

57 { return VisitSettings<true>(S); }

References S.

◆ VisitSettings() [2/3]

bool SetEnvelopeCommand::VisitSettings ( SettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 53 of file SetEnvelopeCommand.cpp.

54 { return VisitSettings<false>(S); }

References S.

◆ VisitSettings() [3/3]

template<bool Const>
bool SetEnvelopeCommand::VisitSettings ( SettingsVisitorBase< Const > &  S)

Definition at line 46 of file SetEnvelopeCommand.cpp.

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

References bHasDelete, bHasT, bHasV, mbDelete, mT, mV, S, and wxT().

Here is the call graph for this function:

Member Data Documentation

◆ bHasDelete

bool SetEnvelopeCommand::bHasDelete

Definition at line 46 of file SetEnvelopeCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ bHasT

bool SetEnvelopeCommand::bHasT

Definition at line 44 of file SetEnvelopeCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ bHasV

bool SetEnvelopeCommand::bHasV

Definition at line 45 of file SetEnvelopeCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ mbDelete

bool SetEnvelopeCommand::mbDelete

Definition at line 42 of file SetEnvelopeCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ mT

double SetEnvelopeCommand::mT

Definition at line 40 of file SetEnvelopeCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ mV

double SetEnvelopeCommand::mV

Definition at line 41 of file SetEnvelopeCommand.h.

Referenced by PopulateOrExchange(), and VisitSettings().

◆ 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: