Audacity 3.2.0
Silence.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Silence.cpp
6
7 Dominic Mazzoni
8
9*******************************************************************//*******************************************************************/
15#include "Silence.h"
16#include "EffectEditor.h"
17#include "LoadEffects.h"
18
19#include "ShuttleGui.h"
20#include "WaveTrack.h"
21#include "../widgets/NumericTextCtrl.h"
22
24/* i18n-hint: noun */
25{ XC("Silence", "generator") };
26
28
30{
32}
33
35{
36}
37
38// ComponentInterface implementation
39
41{
42 return Symbol;
43}
44
46{
47 return XO("Creates audio of zero amplitude");
48}
49
51{
52 return L"Silence";
53}
54
55
56// EffectDefinitionInterface implementation
57
59{
60 return EffectTypeGenerate;
61}
62
63// Effect implementation
64
65std::unique_ptr<EffectEditor> EffectSilence::PopulateOrExchange(
67 const EffectOutputs *)
68{
69 S.StartVerticalLay();
70 {
71 S.StartHorizontalLay();
72 {
73 S.AddPrompt(XXO("&Duration:"));
74 auto &extra = access.Get().extra;
77 S.GetParent(), wxID_ANY,
79 extra.GetDurationFormat(),
80 extra.GetDuration(),
82 .AutoPos(true));
83 S.Name(XO("Duration"))
84 .Position(wxALIGN_CENTER | wxALL)
85 .AddWindow(mDurationT);
86 }
87 S.EndHorizontalLay();
88 }
89 S.EndVerticalLay();
90
91 return nullptr;
92}
93
95{
96 mDurationT->SetValue(settings.extra.GetDuration());
97
98 return true;
99}
100
102{
103 settings.extra.SetDuration(mDurationT->GetValue());
104
105 return true;
106}
107
109 const EffectSettings &settings, WaveTrack &tmp)
110{
111 tmp.InsertSilence(0.0, settings.extra.GetDuration());
112 return true;
113}
EffectType
@ EffectTypeGenerate
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define XC(s, c)
Definition: Internat.h:37
#define safenew
Definition: MemoryX.h:9
const NumericConverterType & NumericConverterType_TIME()
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:69
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: EffectBase.cpp:210
double mProjectRate
Definition: EffectBase.h:110
Performs effect computation.
Hold values to send to effect output meters.
virtual const EffectSettings & Get()=0
std::unique_ptr< EffectEditor > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
Definition: Silence.cpp:65
ComponentInterfaceSymbol GetSymbol() const override
Definition: Silence.cpp:40
virtual ~EffectSilence()
Definition: Silence.cpp:34
bool TransferDataFromWindow(EffectSettings &settings) override
Definition: Silence.cpp:101
EffectType GetType() const override
Type determines how it behaves.
Definition: Silence.cpp:58
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
Definition: Silence.cpp:50
NumericTextCtrl * mDurationT
Definition: Silence.h:52
static const ComponentInterfaceSymbol Symbol
Definition: Silence.h:23
bool GenerateTrack(const EffectSettings &settings, WaveTrack &tmp) override
GenerateTrack() must be overridden by the actual generator class.
Definition: Silence.cpp:108
TranslatableString GetDescription() const override
Definition: Silence.cpp:45
bool TransferDataToWindow(const EffectSettings &settings) override
Definition: Silence.cpp:94
static FormatterContext SampleRateContext(double sampleRate)
void SetValue(double newValue)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
void InsertSilence(double t, double len) override
Definition: WaveTrack.cpp:2002
BuiltinEffectsModule::Registration< EffectSilence > reg
Definition: Silence.cpp:27
Externalized state of a plug-in.
EffectSettingsExtra extra
Options & AutoPos(bool enable)