Audacity  2.2.2
Macros | Enumerations | Functions | Variables
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"

Go to the source code of this file.

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, nTableTypes
}
 

Functions

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

Variables

static const IdentInterfaceSymbol kTableTypeStrings [nTableTypes]
 
struct {
   const wxChar *   name
 
   EffectDistortion::Params   params
 
FactoryPresets []
 

Macro Definition Documentation

#define _USE_MATH_DEFINES

Definition at line 24 of file Distortion.cpp.

#define M_PI   3.1415926535897932384626433832795
#define M_PI_2   1.57079632679489661923132169163975

Definition at line 31 of file Distortion.cpp.

Referenced by EffectDistortion::HalfSinTable(), and EffectDistortion::SineTable().

#define skipsamples   1000

Definition at line 88 of file Distortion.cpp.

Referenced by EffectDistortion::InstanceProcess().

Enumeration Type Documentation

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

Definition at line 44 of file Distortion.cpp.

Function Documentation

const double MIN_Threshold_Linear DB_TO_LINEAR ( MIN_Threshold_dB  )
wxString defaultLabel ( int  index)

Definition at line 126 of file Distortion.cpp.

References name, names(), TranslatableArray< ArrayType >::Populate(), and XO.

Referenced by EffectDistortion::PopulateOrExchange(), and EffectDistortion::UpdateUI().

127 {
128  static const wxString names[] = {
129  XO("Upper Threshold"),
130  XO("Noise Floor"),
131  XO("Parameter 1"),
132  XO("Parameter 2"),
133  XO("Number of repeats"),
134  };
135 
136  class NamesArray final : public TranslatableStringArray
137  {
138  void Populate() override
139  {
140  for (auto &name : names)
141  mContents.push_back( wxGetTranslation( name ) );
142  }
143  };
144 
145  static NamesArray theArray;
146 
147  return theArray.Get()[ index ];
148 }
static wxArrayString names()
Definition: Tags.cpp:697
#define XO(s)
Definition: Internat.h:33
const wxChar * name
Definition: Distortion.cpp:94
virtual void Populate()=0
Param ( TableTypeIndx  ,
int  ,
wxT("Type")  ,
,
,
nTableTypes 1,
 
)
Param ( DCBlock  ,
bool  ,
wxT("DC Block")  ,
false  ,
false  ,
true  ,
 
)
Param ( Threshold_dB  ,
double  ,
wxT("Threshold dB")  ,
-6.  0,
-100.  0,
0.  0,
1000.  0f 
)
Param ( NoiseFloor  ,
double  ,
wxT("Noise Floor")  ,
-70.  0,
-80.  0,
-20.  0,
 
)
Param ( Param1  ,
double  ,
wxT("Parameter 1")  ,
50.  0,
0.  0,
100.  0,
 
)
Param ( Param2  ,
double  ,
wxT("Parameter 2")  ,
50.  0,
0.  0,
100.  0,
 
)
Param ( Repeats  ,
int  ,
wxT("Repeats")  ,
,
,
,
 
)

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: Internat.h:33

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

const IdentInterfaceSymbol kTableTypeStrings[nTableTypes]
static
Initial value:
=
{
{ wxT("HardClipping"), XO("Hard Clipping") },
{ wxT("SoftClipping"), XO("Soft Clipping") },
{ wxT("SoftOverdrive"), XO("Soft Overdrive") },
{ wxT("MediumOverdrive"), XO("Medium Overdrive") },
{ wxT("HardOverdrive"), XO("Hard Overdrive") },
{ wxT("CubicCurveOddHarmonics"), XO("Cubic Curve (odd harmonics)") },
{ wxT("EvenHarmonics"), XO("Even Harmonics") },
{ wxT("ExpandCompress"), XO("Expand and Compress") },
{ XO("Leveller") },
{ wxT("RectifierDistortion"), XO("Rectifier Distortion") },
{ wxT("HardLimiter1413"), XO("Hard Limiter 1413") }
}
#define XO(s)
Definition: Internat.h:33

Definition at line 60 of file Distortion.cpp.

const wxChar* name

Definition at line 94 of file Distortion.cpp.

Referenced by Effect::AddAnalysisTrack(), CommandMessageTargetDecorator::AddBool(), CommandOutputTargets::AddBool(), AudacityProject::AddEffectMenuItemGroup(), AudacityProject::AddEffectMenuItems(), CommandMessageTargetDecorator::AddItem(), CommandManager::AddItem(), CommandOutputTargets::AddItem(), MacroCommands::AddMacro(), ExportMP3::AddTags(), MacroCommands::ApplyMacro(), ApplyMacroDialog::ApplyMacroToProject(), ExportMP3::AskResample(), ASlider::ASlider(), BuiltinEffectsModule::AutoRegisterPlugins(), BuiltinCommandsModule::AutoRegisterPlugins(), ProgressDialog::Beep(), Scrubber::CanScrub(), DeviceToolBar::ChangeDevice(), CommandManager::Check(), KeyConfigPrefs::Commit(), AudacityProject::FoundTrack::ComposeTrackName(), ConvertLegacyProjectFile(), ConvertLegacyTrack(), wxPanelWrapper::Create(), wxDialogWrapper::Create(), wxDirDialogWrapper::Create(), FileDialogWrapper::Create(), AudacityApp::CreateSingleInstanceChecker(), AutoSaveFile::Decode(), defaultLabel(), MacroCommands::DeleteMacro(), AudacityCommand::DoAudacityCommand(), Effect::DoEffect(), ExportMultiple::DoExport(), CommandManager::Enable(), EQCurve::EQCurve(), ExportMultiple::ExportMultipleByLabel(), ExportMultiple::ExportMultipleByTrack(), FileDialog::FileDialog(), DeviceToolBar::FillInputChannels(), FindDialog::FindDialog(), MP3Exporter::FindLibrary(), DirManager::GetBalanceInfo(), NumericConverter::GetBuiltinFormat(), CommandManager::GetCategoryFromName(), EffectManager::GetCommandIdentifier(), TracksPrefs::GetDefaultAudioTrackNamePreference(), CommandManager::GetDefaultKeyFromName(), CommandManager::GetEnabled(), EffectDistortion::GetFactoryPresets(), CommandManager::GetLabelFromName(), GetLanguages(), AudacityProject::GetName(), ExportMP3Options::GetNames(), DevicePrefs::GetNamesAndLabels(), CommandManager::GetPrefixedLabelFromName(), Effect::GetUserPresetsGroup(), DirManager::HandleXMLTag(), CommandManager::HandleXMLTag(), LWSlider::Init(), NyquistEffectsModule::Initialize(), BuiltinEffectsModule::Initialize(), BuiltinCommandsModule::Initialize(), InitMP3_Statics(), KeyConfigPrefs::KeyConfigPrefs(), MixerBoard::LoadMusicalInstruments(), ExportMP3Options::LoadNames(), MacroCommands::MacroCommands(), MacroCommands::MigrateLegacyChains(), CommandManager::Modify(), Module::Module(), CommandManager::NewIdentifier(), CommandParameters::NormalizeName(), MacrosWindow::OnAdd(), ApplyMacroDialog::OnApplyToFiles(), DevicePrefs::OnDevice(), DevicePrefs::OnHost(), MacrosWindow::OnRemove(), EditCurvesDialog::OnRename(), EffectUIHost::OnSaveAs(), AudacityApp::OnTimer(), FileNames::PathFromAddr(), ExportMultiple::PopulateOrExchange(), EffectEqualization::PopulateOrExchange(), EffectFindClipping::Process(), MacroCommands::ReadMacro(), RecursivelyCountSubdirs(), RecursivelyEnumerate(), RecursivelyRemove(), RecursivelyRemoveEmptyDirs(), KeyView::RefreshBindings(), ControlToolBar::RegenerateTooltips(), CommandManager::SetCommandFlags(), BlockFile::SetFileName(), ODPCMAliasBlockFile::SetFileName(), ODDecodeBlockFile::SetFileName(), KeyConfigPrefs::SetKeyForSelected(), CommandManager::SetKeyFromName(), CommandManager::SetLongName(), SetToExtantDirectory(), CommandMessageTargetDecorator::StartField(), MuteButtonHandle::Tip(), CloseButtonHandle::Tip(), SoloButtonHandle::Tip(), MenuButtonHandle::Tip(), LabelDialog::TransferDataFromWindow(), Importer::WriteImportItems(), MacroCommands::WriteMacro(), and AutoSaveFile::WriteName().