Audacity  3.0.3
TruncSilence.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  TruncSilence.h
6 
7  Lynn Allan (from DM's Normalize)
8  //ToDo ... put BlendFrames in Effects, Project, or other class
9  //ToDo ... Use ZeroCrossing logic to improve blend
10  //ToDo ... BlendFrames on "fade-out"
11  //ToDo ... BlendFrameCount is a user-selectable parameter
12  //ToDo ... Detect transient signals that are too short to interrupt the TruncatableSilence
13  Philip Van Baren (more options and boundary fixes)
14 
15 **********************************************************************/
16 
17 #ifndef __AUDACITY_EFFECT_TRUNC_SILENCE__
18 #define __AUDACITY_EFFECT_TRUNC_SILENCE__
19 
20 #include "Effect.h"
21 
22 class ShuttleGui;
23 class wxChoice;
24 class wxTextCtrl;
25 class wxCheckBox;
26 
27 class RegionList;
28 
29 class EffectTruncSilence final : public Effect
30 {
31 public:
33 
35  virtual ~EffectTruncSilence();
36 
37  // ComponentInterface implementation
38 
41  ManualPageID ManualPage() override;
42 
43  // EffectDefinitionInterface implementation
44 
45  EffectType GetType() override;
46 
47  // EffectClientInterface implementation
48 
49  bool DefineParams( ShuttleParams & S ) override;
50  bool GetAutomationParameters(CommandParameters & parms) override;
51  bool SetAutomationParameters(CommandParameters & parms) override;
52 
53  // Effect implementation
54 
55  double CalcPreviewInputLength(double previewLength) override;
56  bool Startup() override;
57 
58  // Analyze a single track to find silences
59  // If inputLength is not NULL we are calculating the minimum
60  // amount of input for previewing.
61  bool Analyze(RegionList &silenceList,
62  RegionList &trackSilences,
63  const WaveTrack *wt,
64  sampleCount* silentFrame,
65  sampleCount* index,
66  int whichTrack,
67  double* inputLength = NULL,
68  double* minInputLength = NULL);
69 
70  bool Process() override;
71  void PopulateOrExchange(ShuttleGui & S) override;
72  bool TransferDataToWindow() override;
73  bool TransferDataFromWindow() override;
74 
75 private:
76  // EffectTruncSilence implementation
77 
78  //ToDo ... put BlendFrames in Effects, Project, or other class
79  // void BlendFrames(float* buffer, int leftIndex, int rightIndex, int blendFrameCount);
80  void Intersect(RegionList &dest, const RegionList & src);
81 
82  void OnControlChange(wxCommandEvent & evt);
83  void UpdateUI();
84 
85  bool ProcessIndependently();
86  bool ProcessAll();
87  bool FindSilences
88  (RegionList &silences, const TrackList *list,
89  const Track *firstTrack, const Track *lastTrack);
90  bool DoRemoval
91  (const RegionList &silences, unsigned iGroup, unsigned nGroups, Track *firstTrack, Track *lastTrack,
92  double &totalCutLen);
93 
94 private:
95 
96  double mThresholdDB {} ;
102 
104 
105  wxTextCtrl *mThresholdText;
106  wxChoice *mActionChoice;
110  wxCheckBox *mIndependent;
111 
112  DECLARE_EVENT_TABLE()
113 };
114 
115 #endif
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
EffectTruncSilence::mTruncLongestAllowedSilence
double mTruncLongestAllowedSilence
Definition: TruncSilence.h:99
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
EffectTruncSilence::mThresholdText
wxTextCtrl * mThresholdText
Definition: TruncSilence.h:105
Effect.h
EffectTruncSilence::mTruncLongestAllowedSilenceT
wxTextCtrl * mTruncLongestAllowedSilenceT
Definition: TruncSilence.h:108
EffectTruncSilence::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: TruncSilence.cpp:845
EffectTruncSilence::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: TruncSilence.cpp:185
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:72
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
EffectTruncSilence::mInitialAllowedSilenceT
wxTextCtrl * mInitialAllowedSilenceT
Definition: TruncSilence.h:107
EffectTruncSilence::mSilenceCompressPercent
double mSilenceCompressPercent
Definition: TruncSilence.h:100
EffectTruncSilence::mbIndependent
bool mbIndependent
Definition: TruncSilence.h:101
EffectTruncSilence::TransferDataToWindow
bool TransferDataToWindow() override
Definition: TruncSilence.cpp:835
EffectTruncSilence::~EffectTruncSilence
virtual ~EffectTruncSilence()
Definition: TruncSilence.cpp:155
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
RegionList
Definition: TruncSilence.cpp:71
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectTruncSilence::Analyze
bool Analyze(RegionList &silenceList, RegionList &trackSilences, const WaveTrack *wt, sampleCount *silentFrame, sampleCount *index, int whichTrack, double *inputLength=NULL, double *minInputLength=NULL)
Definition: TruncSilence.cpp:597
EffectTruncSilence::ManualPage
ManualPageID ManualPage() override
Definition: TruncSilence.cpp:171
EffectTruncSilence::ProcessIndependently
bool ProcessIndependently()
Definition: TruncSilence.cpp:334
EffectTruncSilence::ProcessAll
bool ProcessAll()
Definition: TruncSilence.cpp:407
EffectTruncSilence::mActionIndex
int mActionIndex
Definition: TruncSilence.h:97
EffectTruncSilence::Process
bool Process() override
Definition: TruncSilence.cpp:321
EffectTruncSilence::Intersect
void Intersect(RegionList &dest, const RegionList &src)
Definition: TruncSilence.cpp:860
EffectTruncSilence::CalcPreviewInputLength
double CalcPreviewInputLength(double previewLength) override
Definition: TruncSilence.cpp:243
EffectTruncSilence::mActionChoice
wxChoice * mActionChoice
Definition: TruncSilence.h:106
EffectTruncSilence
Truncate Silence automatically reduces the length of passages where the volume is below a set thresho...
Definition: TruncSilence.h:30
EffectTruncSilence::mInitialAllowedSilence
double mInitialAllowedSilence
Definition: TruncSilence.h:98
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
TaggedIdentifier< ManualPageIDTag >
EffectTruncSilence::UpdateUI
void UpdateUI()
Definition: TruncSilence.cpp:1007
EffectTruncSilence::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: TruncSilence.cpp:161
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
EffectTruncSilence::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: TruncSilence.cpp:207
EffectTruncSilence::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: TruncSilence.cpp:754
EffectTruncSilence::FindSilences
bool FindSilences(RegionList &silences, const TrackList *list, const Track *firstTrack, const Track *lastTrack)
Definition: TruncSilence.cpp:432
EffectTruncSilence::EffectTruncSilence
EffectTruncSilence()
Definition: TruncSilence.cpp:133
EffectTruncSilence::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: TruncSilence.h:32
EffectTruncSilence::GetDescription
TranslatableString GetDescription() override
Definition: TruncSilence.cpp:166
EffectTruncSilence::Startup
bool Startup() override
Definition: TruncSilence.cpp:270
EffectTruncSilence::DoRemoval
bool DoRemoval(const RegionList &silences, unsigned iGroup, unsigned nGroups, Track *firstTrack, Track *lastTrack, double &totalCutLen)
Definition: TruncSilence.cpp:484
EffectTruncSilence::mThresholdDB
double mThresholdDB
Definition: TruncSilence.h:96
EffectType
EffectType
Definition: EffectInterface.h:55
EffectTruncSilence::mIndependent
wxCheckBox * mIndependent
Definition: TruncSilence.h:110
EffectTruncSilence::GetType
EffectType GetType() override
Definition: TruncSilence.cpp:178
EffectTruncSilence::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: TruncSilence.cpp:195
EffectTruncSilence::OnControlChange
void OnControlChange(wxCommandEvent &evt)
Definition: TruncSilence.cpp:1021
EffectTruncSilence::mSilenceCompressPercentT
wxTextCtrl * mSilenceCompressPercentT
Definition: TruncSilence.h:109
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
EffectTruncSilence::mBlendFrameCount
size_t mBlendFrameCount
Definition: TruncSilence.h:103