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
 SetTrackBase ()
 
bool Apply (const CommandContext &context) override
 
virtual bool ApplyInner (const CommandContext &context, Track *t)
 
template<bool Const>
bool VisitSettings (SettingsVisitorBase< Const > &S)
 
bool VisitSettings (SettingsVisitor &S) override
 
bool VisitSettings (ConstSettingsVisitor &S) override
 
virtual void PopulateOrExchange (ShuttleGui &S) override
 
- 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
 
- 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 }
 
- 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

Reimplemented from 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 WaveClipPointers ptrs( waveTrack->SortedClipArray());
79 for(auto it = ptrs.begin(); (it != ptrs.end()); it++ ){
80 WaveClip * pClip = *it;
81 bool bFound =
82 !bHasT || (
83 ( pClip->GetPlayStartTime() <= mT) &&
84 ( pClip->GetPlayEndTime() >= mT )
85 );
86 if( bFound )
87 {
88 // Inside this IF is where we actually apply the command
89 Envelope* pEnv = pClip->GetEnvelope();
90 bool didSomething = false;
91 if( bHasDelete && mbDelete )
92 pEnv->Clear(), didSomething = true;
93 if( bHasT && bHasV )
94 pEnv->InsertOrReplace( mT, pEnv->ClampValue( mV ) ),
95 didSomething = true;
96
97 if (didSomething)
98 // Consolidate, because this ApplyInner() function may be
99 // visited multiple times in one command invocation
101 XO("Edited Envelope"), XO("Envelope"),
103 }
104 }
105 } );
106
107 return true;
108}
XO("Cut/Copy/Paste")
std::vector< WaveClip * > WaveClipPointers
Definition: WaveTrack.h:40
AudacityProject & project
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72
void Clear()
Definition: Envelope.h:172
int InsertOrReplace(double when, double value)
Add a point at a particular absolute time coordinate.
Definition: Envelope.h:175
double ClampValue(double value)
Definition: Envelope.h:104
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
R TypeSwitch(const Functions &...functions)
Use this function rather than testing track type explicitly and making down-casts.
Definition: Track.h:833
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:101
double GetPlayStartTime() const noexcept
Definition: WaveClip.cpp:878
double GetPlayEndTime() const
Definition: WaveClip.cpp:888
Envelope * GetEnvelope()
Definition: WaveClip.h:219
A Track that contains audio waveform data.
Definition: WaveTrack.h:51
WaveClipPointers SortedClipArray()
Definition: WaveTrack.cpp:2459

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

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.");};

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)
overridevirtual

Reimplemented from SetTrackBase.

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 ApplyInner(), PopulateOrExchange(), and VisitSettings().

◆ bHasT

bool SetEnvelopeCommand::bHasT

Definition at line 44 of file SetEnvelopeCommand.h.

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

◆ bHasV

bool SetEnvelopeCommand::bHasV

Definition at line 45 of file SetEnvelopeCommand.h.

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

◆ mbDelete

bool SetEnvelopeCommand::mbDelete

Definition at line 42 of file SetEnvelopeCommand.h.

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

◆ mT

double SetEnvelopeCommand::mT

Definition at line 40 of file SetEnvelopeCommand.h.

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

◆ mV

double SetEnvelopeCommand::mV

Definition at line 41 of file SetEnvelopeCommand.h.

Referenced by ApplyInner(), 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: