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__
|
|
|
|
|
|
|
|
#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
|
|
|
|
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:
|
2019-01-17 22:33:49 +00:00
|
|
|
static const ComponentInterfaceSymbol Symbol;
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
EffectTruncSilence();
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual ~EffectTruncSilence();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-11-02 15:31:44 +00:00
|
|
|
// ComponentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-11-02 15:31:44 +00:00
|
|
|
ComponentInterfaceSymbol GetSymbol() override;
|
2019-12-08 18:53:48 +00:00
|
|
|
TranslatableString GetDescription() override;
|
2021-06-06 16:18:35 +00:00
|
|
|
ManualPageID ManualPage() override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
// EffectDefinitionInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
EffectType GetType() override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
|
|
|
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
bool DefineParams( ShuttleParams & S ) override;
|
2018-02-21 14:24:25 +00:00
|
|
|
bool GetAutomationParameters(CommandParameters & parms) override;
|
|
|
|
bool SetAutomationParameters(CommandParameters & parms) override;
|
2015-04-17 03:53:42 +00:00
|
|
|
|
|
|
|
// Effect implementation
|
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
double CalcPreviewInputLength(double previewLength) override;
|
|
|
|
bool Startup() override;
|
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.
|
2016-02-24 06:06:47 +00:00
|
|
|
bool Analyze(RegionList &silenceList,
|
2016-01-02 09:00:40 +00:00
|
|
|
RegionList &trackSilences,
|
2017-02-22 19:23:35 +00:00
|
|
|
const WaveTrack *wt,
|
2016-01-02 09:00:40 +00:00
|
|
|
sampleCount* silentFrame,
|
|
|
|
sampleCount* index,
|
|
|
|
int whichTrack,
|
|
|
|
double* inputLength = NULL,
|
|
|
|
double* minInputLength = NULL);
|
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
bool Process() override;
|
|
|
|
void PopulateOrExchange(ShuttleGui & S) override;
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2015-04-17 03:53:42 +00:00
|
|
|
|
|
|
|
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
|
2016-12-31 09:33:35 +00:00
|
|
|
(RegionList &silences, const TrackList *list,
|
|
|
|
const Track *firstTrack, const Track *lastTrack);
|
2016-01-22 01:06:40 +00:00
|
|
|
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
|
|
|
|
2018-05-10 03:09:01 +00:00
|
|
|
double mThresholdDB {} ;
|
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
|
|
|
|
2016-09-06 13:19:27 +00:00
|
|
|
size_t mBlendFrameCount;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-05-10 03:09:01 +00:00
|
|
|
wxTextCtrl *mThresholdText;
|
2015-04-17 03:53:42 +00:00
|
|
|
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
|
|
|
|
2016-09-18 14:26:29 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|