Audacity  3.0.3
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 
16 
17 #include "Silence.h"
18 #include "LoadEffects.h"
19 
20 #include <wx/intl.h>
21 
22 #include "../ShuttleGui.h"
23 #include "../WaveTrack.h"
24 #include "../widgets/NumericTextCtrl.h"
25 
27 /* i18n-hint: noun */
28 { XC("Silence", "generator") };
29 
31 
33 {
34  SetLinearEffectFlag(true);
35 }
36 
38 {
39 }
40 
41 // ComponentInterface implementation
42 
44 {
45  return Symbol;
46 }
47 
49 {
50  return XO("Creates audio of zero amplitude");
51 }
52 
54 {
55  return L"Silence";
56 }
57 
58 
59 // EffectDefinitionInterface implementation
60 
62 {
63  return EffectTypeGenerate;
64 }
65 
66 // Effect implementation
67 
69 {
70  S.StartVerticalLay();
71  {
73  {
74  S.AddPrompt(XXO("&Duration:"));
76  NumericTextCtrl(S.GetParent(), wxID_ANY,
79  GetDuration(),
82  .AutoPos(true));
83  S.Name(XO("Duration"))
84  .Position(wxALIGN_CENTER | wxALL)
86  }
87  S.EndHorizontalLay();
88  }
89  S.EndVerticalLay();
90 
91  return;
92 }
93 
95 {
97 
98  return true;
99 }
100 
102 {
104 
105  return true;
106 }
107 
109  const WaveTrack & WXUNUSED(track),
110  int WXUNUSED(ntrack))
111 {
112  tmp->InsertSilence(0.0, GetDuration());
113  return true;
114 }
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
Effect::GetDuration
double GetDuration() override
Definition: Effect.cpp:815
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:2000
NumericTextCtrl::Options::AutoPos
Options & AutoPos(bool enable)
Definition: NumericTextCtrl.h:190
EffectSilence::EffectSilence
EffectSilence()
Definition: Silence.cpp:32
EffectTypeGenerate
@ EffectTypeGenerate
Definition: EffectInterface.h:58
XO
#define XO(s)
Definition: Internat.h:31
XC
#define XC(s, c)
Definition: Internat.h:37
EffectSilence::mDurationT
NumericTextCtrl * mDurationT
Definition: Silence.h:50
NumericTextCtrl
Definition: NumericTextCtrl.h:172
NumericTextCtrl::SetValue
void SetValue(double newValue)
Definition: NumericTextCtrl.cpp:1472
Silence.h
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectSilence::TransferDataToWindow
bool TransferDataToWindow() override
Definition: Silence.cpp:94
NumericTextCtrl::Options
Definition: NumericTextCtrl.h:178
Effect::mProjectRate
double mProjectRate
Definition: Effect.h:458
XXO
#define XXO(s)
Definition: Internat.h:44
WaveTrack::InsertSilence
void InsertSilence(double t, double len) override
Definition: WaveTrack.cpp:1370
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
EffectSilence::ManualPage
ManualPageID ManualPage() override
Definition: Silence.cpp:53
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
NumericConverter::TIME
@ TIME
Definition: NumericTextCtrl.h:52
EffectSilence::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: Silence.cpp:43
anonymous_namespace{Silence.cpp}::reg
BuiltinEffectsModule::Registration< EffectSilence > reg
Definition: Silence.cpp:30
ShuttleGuiBase::GetParent
wxWindow * GetParent()
Definition: ShuttleGui.h:496
ShuttleGuiBase::AddWindow
wxWindow * AddWindow(wxWindow *pWindow, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:299
EffectSilence::~EffectSilence
virtual ~EffectSilence()
Definition: Silence.cpp:37
LoadEffects.h
EffectSilence::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: Silence.h:23
EffectSilence::GetType
EffectType GetType() override
Definition: Silence.cpp:61
EffectSilence::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: Silence.cpp:68
Effect::SetDuration
void SetDuration(double duration) override
Definition: Effect.cpp:837
ShuttleGui::Name
ShuttleGui & Name(const TranslatableString &name)
Definition: ShuttleGui.h:663
BuiltinEffectsModule::Registration
Definition: LoadEffects.h:40
ShuttleGui::Position
ShuttleGui & Position(int flags)
Definition: ShuttleGui.h:712
TaggedIdentifier< ManualPageIDTag >
EffectSilence::GenerateTrack
bool GenerateTrack(WaveTrack *tmp, const WaveTrack &track, int ntrack) override
Definition: Silence.cpp:108
Effect::GetDurationFormat
NumericFormatSymbol GetDurationFormat() override
Definition: Effect.cpp:825
ShuttleGuiBase::AddPrompt
void AddPrompt(const TranslatableString &Prompt, int wrapWidth=0)
Right aligned text string.
Definition: ShuttleGui.cpp:238
EffectSilence::GetDescription
TranslatableString GetDescription() override
Definition: Silence.cpp:48
EffectType
EffectType
Definition: EffectInterface.h:55
safenew
#define safenew
Definition: MemoryX.h:10
NumericConverter::GetValue
double GetValue()
Definition: NumericTextCtrl.cpp:1172
EffectSilence::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: Silence.cpp:101
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631