Audacity  2.2.0
Distortion.cpp File Reference
#include "../Audacity.h"
#include "Distortion.h"
#include <cmath>
#include <algorithm>
#include <wx/choice.h>
#include <wx/intl.h>
#include <wx/valgen.h>
#include <wx/log.h>
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
#include "../TranslatableStringArray.h"
#include <wx/arrimpl.cpp>

Macros

#define _USE_MATH_DEFINES
 
#define M_PI   3.1415926535897932384626433832795
 
#define M_PI_2   1.57079632679489661923132169163975
 
#define skipsamples   1000
 

Enumerations

enum  kTableType {
  kHardClip, kSoftClip, kHalfSinCurve, kExpCurve,
  kLogCurve, kCubic, kEvenHarmonics, kSinCurve,
  kLeveller, kRectifier, kHardLimiter, kNumTableTypes
}
 

Functions

 Param (TableTypeIndx, int, XO("Type"), 0, 0, kNumTableTypes-1, 1)
 
 Param (DCBlock, bool, XO("DC Block"), false, false, true, 1)
 
 Param (Threshold_dB, double, XO("Threshold dB"),-6.0,-100.0, 0.0, 1000.0f)
 
 Param (NoiseFloor, double, XO("Noise Floor"),-70.0,-80.0,-20.0, 1)
 
 Param (Param1, double, XO("Parameter 1"), 50.0, 0.0, 100.0, 1)
 
 Param (Param2, double, XO("Parameter 2"), 50.0, 0.0, 100.0, 1)
 
 Param (Repeats, int, XO("Repeats"), 1, 0, 5, 1)
 
const double MIN_Threshold_Linear DB_TO_LINEAR (MIN_Threshold_dB)
 
wxString defaultLabel (int index)
 
 WX_DEFINE_OBJARRAY (EffectDistortionStateArray)
 

Variables

static const wxString kTableTypeStrings [kNumTableTypes]
 
struct {
   const wxChar *   name
 
   EffectDistortion::Params   params
 
FactoryPresets []
 

Macro Definition Documentation

#define _USE_MATH_DEFINES
#define M_PI_2   1.57079632679489661923132169163975
#define skipsamples   1000

Enumeration Type Documentation

enum kTableType
Enumerator
kHardClip 
kSoftClip 
kHalfSinCurve 
kExpCurve 
kLogCurve 
kCubic 
kEvenHarmonics 
kSinCurve 
kLeveller 
kRectifier 
kHardLimiter 
kNumTableTypes 

Function Documentation

wxString defaultLabel ( int  index)
Param ( TableTypeIndx  ,
int  ,
XO("Type")  ,
,
,
kNumTableTypes 1,
 
)
Param ( DCBlock  ,
bool  ,
XO("DC Block")  ,
false  ,
false  ,
true  ,
 
)
Param ( Threshold_dB  ,
double  ,
XO("Threshold dB")  ,
-6.  0,
-100.  0,
0.  0,
1000.  0f 
)
Param ( NoiseFloor  ,
double  ,
XO("Noise Floor")  ,
-70.  0,
-80.  0,
-20.  0,
 
)
Param ( Param1  ,
double  ,
XO("Parameter 1")  ,
50.  0,
0.  0,
100.  0,
 
)
Param ( Param2  ,
double  ,
XO("Parameter 2")  ,
50.  0,
0.  0,
100.  0,
 
)
Param ( Repeats  ,
int  ,
XO("Repeats")  ,
,
,
,
 
)
WX_DEFINE_OBJARRAY ( EffectDistortionStateArray  )

Variable Documentation

const { ... } FactoryPresets[]
Initial value:
=
{
{ XO("Hard clip -12dB, 80% make-up gain"), { 0, 0, -12.0, -70.0, 0.0, 80.0, 0 } },
{ XO("Soft clip -12dB, 80% make-up gain"), { 1, 0, -12.0, -70.0, 50.0, 80.0, 0 } },
{ XO("Fuzz Box"), { 1, 0, -30.0, -70.0, 80.0, 80.0, 0 } },
{ XO("Walkie-talkie"), { 1, 0, -50.0, -70.0, 60.0, 80.0, 0 } },
{ XO("Blues drive sustain"), { 2, 0, -6.0, -70.0, 30.0, 80.0, 0 } },
{ XO("Light Crunch Overdrive"), { 3, 0, -6.0, -70.0, 20.0, 80.0, 0 } },
{ XO("Heavy Overdrive"), { 4, 0, -6.0, -70.0, 90.0, 80.0, 0 } },
{ XO("3rd Harmonic (Perfect Fifth)"), { 5, 0, -6.0, -70.0, 100.0, 60.0, 0 } },
{ XO("Valve Overdrive"), { 6, 1, -6.0, -70.0, 30.0, 40.0, 0 } },
{ XO("2nd Harmonic (Octave)"), { 6, 1, -6.0, -70.0, 50.0, 0.0, 0 } },
{ XO("Gated Expansion Distortion"), { 7, 0, -6.0, -70.0, 30.0, 80.0, 0 } },
{ XO("Leveller, Light, -70dB noise floor"), { 8, 0, -6.0, -70.0, 0.0, 50.0, 1 } },
{ XO("Leveller, Moderate, -70dB noise floor"), { 8, 0, -6.0, -70.0, 0.0, 50.0, 2 } },
{ XO("Leveller, Heavy, -70dB noise floor"), { 8, 0, -6.0, -70.0, 0.0, 50.0, 3 } },
{ XO("Leveller, Heavier, -70dB noise floor"), { 8, 0, -6.0, -70.0, 0.0, 50.0, 4 } },
{ XO("Leveller, Heaviest, -70dB noise floor"), { 8, 0, -6.0, -70.0, 0.0, 50.0, 5 } },
{ XO("Half-wave Rectifier"), { 9, 0, -6.0, -70.0, 50.0, 50.0, 0 } },
{ XO("Full-wave Rectifier"), { 9, 0, -6.0, -70.0, 100.0, 50.0, 0 } },
{ XO("Full-wave Rectifier (DC blocked)"), { 9, 1, -6.0, -70.0, 100.0, 50.0, 0 } },
{ XO("Percussion Limiter"), {10, 0, -12.0, -70.0, 100.0, 30.0, 0 } },
}
#define XO(s)
Definition: Audacity.h:225

Referenced by EffectDistortion::GetFactoryPresets(), and EffectDistortion::LoadFactoryPreset().

const wxString kTableTypeStrings[kNumTableTypes]
static
Initial value:
=
{
XO("Hard Clipping"),
XO("Soft Clipping"),
XO("Soft Overdrive"),
XO("Medium Overdrive"),
XO("Hard Overdrive"),
XO("Cubic Curve (odd harmonics)"),
XO("Even Harmonics"),
XO("Expand and Compress"),
XO("Leveller"),
XO("Rectifier Distortion"),
}
#define XO(s)
Definition: Audacity.h:225

Referenced by EffectDistortion::EffectDistortion(), EffectDistortion::GetAutomationParameters(), EffectDistortion::PopulateOrExchange(), and EffectDistortion::SetAutomationParameters().

const wxChar* name

Referenced by Effect::AddAnalysisTrack(), BatchCommands::AddChain(), AudacityProject::AddEffectMenuItemGroup(), AudacityProject::AddEffectMenuItems(), ExportMP3::AddTags(), SelectCommand::Apply(), SetTrackInfoCommand::Apply(), GetAllMenuCommands::Apply(), BatchCommands::ApplyChain(), ExportMP3::AskResample(), ASlider::ASlider(), ProgressDialog::Beep(), Scrubber::CanScrub(), DeviceToolBar::ChangeDevice(), CommandManager::Check(), KeyConfigPrefs::Commit(), ConvertLegacyProjectFile(), ConvertLegacyTrack(), AudacityApp::CreateSingleInstanceChecker(), AutoSaveFile::Decode(), defaultLabel(), BatchCommands::DeleteChain(), Effect::DoEffect(), ExportMultiple::DoExport(), CommandManager::Enable(), EQCurve::EQCurve(), ExportMultiple::ExportMultipleByLabel(), ExportMultiple::ExportMultipleByTrack(), DeviceToolBar::FillInputChannels(), FindDialog::FindDialog(), MP3Exporter::FindLibrary(), DirManager::GetBalanceInfo(), CommandManager::GetCategories(), CommandManager::GetCategoryFromName(), TracksPrefs::GetDefaultAudioTrackNamePreference(), CommandManager::GetDefaultKeyFromName(), EffectManager::GetEffectIdentifier(), CommandManager::GetEnabled(), EffectDistortion::GetFactoryPresets(), CommandManager::GetLabelFromName(), GetLanguages(), Resample::GetMethodName(), AudacityProject::GetName(), ExportMP3Options::GetNames(), DevicePrefs::GetNamesAndLabels(), CommandManager::GetPrefixedLabelFromName(), Effect::GetUserPresetsGroup(), DirManager::HandleXMLTag(), CommandManager::HandleXMLTag(), LWSlider::Init(), NyquistEffectsModule::Initialize(), InitMP3_Statics(), MixerBoard::LoadMusicalInstruments(), ExportMP3Options::LoadNames(), CommandManager::Modify(), Module::Module(), CommandManager::NewIdentifier(), EditChainsDialog::OnAdd(), BatchProcessDialog::OnApplyToFiles(), BatchProcessDialog::OnApplyToProject(), DevicePrefs::OnDevice(), DevicePrefs::OnHost(), EditChainsDialog::OnRemove(), EditCurvesDialog::OnRename(), EffectUIHost::OnSaveAs(), AudacityApp::OnTimer(), FileNames::PathFromAddr(), BatchProcessDialog::PopulateOrExchange(), ExportMultiple::PopulateOrExchange(), EffectEqualization::PopulateOrExchange(), EffectFindClipping::Process(), BatchCommands::ReadChain(), RecursivelyCountSubdirs(), RecursivelyEnumerate(), RecursivelyRemove(), RecursivelyRemoveEmptyDirs(), KeyView::RefreshBindings(), CommandManager::SetCommandFlags(), BlockFile::SetFileName(), ODPCMAliasBlockFile::SetFileName(), ODDecodeBlockFile::SetFileName(), KeyConfigPrefs::SetKeyForSelected(), CommandManager::SetKeyFromName(), PluginDescriptor::SetName(), SetToExtantDirectory(), MuteButtonHandle::Tip(), CloseButtonHandle::Tip(), SoloButtonHandle::Tip(), MenuButtonHandle::Tip(), LabelDialog::TransferDataFromWindow(), BatchCommands::WriteChain(), Importer::WriteImportItems(), and AutoSaveFile::WriteName().