2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
TruncSilence.h
|
|
|
|
|
|
|
|
Lynn Allan (from DM's Normalize)
|
|
|
|
//ToDo ... put BlendFrames in Effects, Project, or other class
|
|
|
|
//ToDo ... Use ZeroCrossing logic to improve blend
|
|
|
|
//ToDo ... BlendFrames on "fade-out"
|
|
|
|
//ToDo ... BlendFrameCount is a user-selectable parameter
|
|
|
|
//ToDo ... Detect transient signals that are too short to interrupt the TruncatableSilence
|
|
|
|
Philip Van Baren (more options and boundary fixes)
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_TRUNC_SILENCE__
|
|
|
|
#define __AUDACITY_EFFECT_TRUNC_SILENCE__
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/arrstr.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/list.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#include "Effect.h"
|
2010-03-13 15:21:38 +00:00
|
|
|
|
2015-06-18 14:24:36 +00:00
|
|
|
class ShuttleGui;
|
2016-01-22 01:06:40 +00:00
|
|
|
class wxChoice;
|
|
|
|
class wxTextCtrl;
|
|
|
|
class wxCheckBox;
|
2015-06-18 14:24:36 +00:00
|
|
|
|
2015-04-19 03:49:05 +00:00
|
|
|
#define TRUNCATESILENCE_PLUGIN_SYMBOL XO("Truncate Silence")
|
2010-03-13 15:21:38 +00:00
|
|
|
|
2016-02-01 21:01:14 +00:00
|
|
|
class RegionList;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class EffectTruncSilence final : public Effect
|
2015-04-17 03:53:42 +00:00
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
public:
|
|
|
|
EffectTruncSilence();
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual ~EffectTruncSilence();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// IdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual wxString GetSymbol();
|
|
|
|
virtual wxString GetDescription();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectIdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual EffectType GetType();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
|
|
|
|
|
|
|
virtual bool GetAutomationParameters(EffectAutomationParameters & parms);
|
|
|
|
virtual bool SetAutomationParameters(EffectAutomationParameters & parms);
|
|
|
|
|
|
|
|
// Effect implementation
|
|
|
|
|
2016-01-02 09:00:40 +00:00
|
|
|
virtual double CalcPreviewInputLength(double previewLength);
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual bool Startup();
|
2016-01-02 09:00:40 +00:00
|
|
|
|
|
|
|
// Analyze a single track to find silences
|
|
|
|
// If inputLength is not NULL we are calculating the minimum
|
|
|
|
// amount of input for previewing.
|
|
|
|
virtual bool Analyze(RegionList &silenceList,
|
|
|
|
RegionList &trackSilences,
|
|
|
|
WaveTrack* wt,
|
|
|
|
sampleCount* silentFrame,
|
|
|
|
sampleCount* index,
|
|
|
|
int whichTrack,
|
|
|
|
double* inputLength = NULL,
|
|
|
|
double* minInputLength = NULL);
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
virtual bool Process();
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual void PopulateOrExchange(ShuttleGui & S);
|
|
|
|
virtual bool TransferDataToWindow();
|
|
|
|
virtual bool TransferDataFromWindow();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// EffectTruncSilence implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
//ToDo ... put BlendFrames in Effects, Project, or other class
|
2016-01-22 01:06:40 +00:00
|
|
|
// void BlendFrames(float* buffer, int leftIndex, int rightIndex, int blendFrameCount);
|
2016-01-02 09:00:40 +00:00
|
|
|
void Intersect(RegionList &dest, const RegionList & src);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
void OnControlChange(wxCommandEvent & evt);
|
|
|
|
void UpdateUI();
|
|
|
|
|
2016-01-22 01:06:40 +00:00
|
|
|
bool ProcessIndependently();
|
|
|
|
bool ProcessAll();
|
|
|
|
bool FindSilences
|
|
|
|
(RegionList &silences, Track *firstTrack, Track *lastTrack);
|
|
|
|
bool DoRemoval
|
|
|
|
(const RegionList &silences, unsigned iGroup, unsigned nGroups, Track *firstTrack, Track *lastTrack,
|
|
|
|
double &totalCutLen);
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
private:
|
2016-01-22 01:06:40 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
int mTruncDbChoiceIndex;
|
2015-04-17 03:53:42 +00:00
|
|
|
int mActionIndex;
|
2014-03-19 00:50:24 +00:00
|
|
|
double mInitialAllowedSilence;
|
|
|
|
double mTruncLongestAllowedSilence;
|
|
|
|
double mSilenceCompressPercent;
|
2016-01-22 01:06:40 +00:00
|
|
|
bool mbIndependent;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
wxArrayString mDbChoices;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
sampleCount mBlendFrameCount;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
wxChoice *mTruncDbChoice;
|
|
|
|
wxChoice *mActionChoice;
|
|
|
|
wxTextCtrl *mInitialAllowedSilenceT;
|
|
|
|
wxTextCtrl *mTruncLongestAllowedSilenceT;
|
|
|
|
wxTextCtrl *mSilenceCompressPercentT;
|
2016-01-22 01:06:40 +00:00
|
|
|
wxCheckBox *mIndependent;
|
2014-03-19 00:50:24 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|