Audacity  3.0.3
Namespaces | Macros | Enumerations | Functions | Variables
Distortion.cpp File Reference
#include "Distortion.h"
#include "LoadEffects.h"
#include <cmath>
#include <algorithm>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/intl.h>
#include <wx/valgen.h>
#include <wx/log.h>
#include <wx/slider.h>
#include <wx/stattext.h>
#include "Prefs.h"
#include "../Shuttle.h"
#include "../ShuttleGui.h"
#include "../widgets/valnum.h"
Include dependency graph for Distortion.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{Distortion.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, 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)
 
TranslatableString defaultLabel (int index)
 

Variables

static const EnumValueSymbol kTableTypeStrings [nTableTypes]
 
struct {
   OSType   componentManufacturer
 
   OSType   componentType
 
   OSType   componentSubType
 
   const TranslatableString   name
 
   EffectDistortion::Params   params
 
   bool   do_exhaustive_model_search
 
   bool   do_escape_coding
 
   bool   do_mid_side_stereo
 
   bool   loose_mid_side_stereo
 
   unsigned   qlp_coeff_precision
 
   unsigned   min_residual_partition_order
 
   unsigned   max_residual_partition_order
 
   unsigned   rice_parameter_search_dist
 
   unsigned   max_lpc_order
 
   int   format
 
   const wxChar *   name
 
   const TranslatableString   desc
 
   TranslatableString   label
 
   wxString   name
 
FactoryPresets []
 
BuiltinEffectsModule::Registration< EffectDistortionanonymous_namespace{Distortion.cpp}::reg
 

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Definition at line 25 of file Distortion.cpp.

◆ M_PI

#define M_PI   3.1415926535897932384626433832795

Definition at line 29 of file Distortion.cpp.

◆ M_PI_2

#define M_PI_2   1.57079632679489661923132169163975

Definition at line 32 of file Distortion.cpp.

◆ skipsamples

#define skipsamples   1000

Definition at line 92 of file Distortion.cpp.

Enumeration Type Documentation

◆ kTableType

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

Definition at line 48 of file Distortion.cpp.

49 {
50  kHardClip,
51  kSoftClip,
53  kExpCurve,
54  kLogCurve,
55  kCubic,
57  kSinCurve,
58  kLeveller,
59  kRectifier,
62 };

Function Documentation

◆ DB_TO_LINEAR()

const double MIN_Threshold_Linear DB_TO_LINEAR ( MIN_Threshold_dB  )

◆ defaultLabel()

TranslatableString defaultLabel ( int  index)

Definition at line 130 of file Distortion.cpp.

131 {
132  static const TranslatableString names[] = {
133  XO("Upper Threshold"),
134  XO("Noise Floor"),
135  XO("Parameter 1"),
136  XO("Parameter 2"),
137  XO("Number of repeats"),
138  };
139 
140  return names[ index ];
141 }

References names, and XO.

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

Here is the caller graph for this function:

◆ Param() [1/7]

Param ( DCBlock  ,
bool  ,
wxT("DC Block")  ,
false  ,
false  ,
true  ,
 
)

◆ Param() [2/7]

Param ( NoiseFloor  ,
double  ,
wxT("Noise Floor")  ,
-70.  0,
-80.  0,
-20.  0,
 
)

◆ Param() [3/7]

Param ( Param1  ,
double  ,
wxT("Parameter 1")  ,
50.  0,
0.  0,
100.  0,
 
)

◆ Param() [4/7]

Param ( Param2  ,
double  ,
wxT("Parameter 2")  ,
50.  0,
0.  0,
100.  0,
 
)

◆ Param() [5/7]

Param ( Repeats  ,
int  ,
wxT("Repeats")  ,
,
,
,
 
)

◆ Param() [6/7]

Param ( TableTypeIndx  ,
int  ,
wxT("Type")  ,
,
,
nTableTypes 1,
 
)

◆ Param() [7/7]

Param ( Threshold_dB  ,
double  ,
wxT("Threshold dB")  ,
-6.  0,
-100.  0,
0.  0,
1000.  0f 
)

Variable Documentation

◆ FactoryPresets

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

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

◆ kTableTypeStrings

const EnumValueSymbol kTableTypeStrings[nTableTypes]
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") },
{ XO("Hard Limiter 1413") }
}

Definition at line 64 of file Distortion.cpp.

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

◆ name

const TranslatableString name

Definition at line 98 of file Distortion.cpp.

Referenced by Effect::AddAnalysisTrack(), CommandMessageTarget::AddBool(), CommandContext::AddBool(), LispyCommandMessageTarget::AddBool(), Effect::AddedAnalysisTrack::AddedAnalysisTrack(), anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItemGroup(), anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItems(), CommandManager::AddGlobalCommand(), CommandManager::AddItem(), CommandMessageTarget::AddItem(), CommandContext::AddItem(), LispyCommandMessageTarget::AddItem(), CommandManager::AddItemList(), MacroCommands::AddMacro(), CommandSignature::AddParameter(), ExportMP3::AddTags(), MacroCommands::ApplyMacro(), ApplyMacroDialog::ApplyMacroToProject(), ExportFFmpeg::AskResample(), ASlider::ASlider(), AudioUnitEffect::AudioUnitEffect(), NyquistEffectsModule::AutoRegisterPlugins(), anonymous_namespace{Registry.cpp}::BadPath(), ProgressDialog::Beep(), PopupMenuTable::BeginSection(), ScreenshotCommand::CaptureToolbar(), DeviceToolBar::ChangeDevice(), CommandManager::Check(), DBConnection::CheckpointThread(), MenuTable::CommandGroup(), KeyConfigPrefs::Commit(), anonymous_namespace{ClipMenus.cpp}::FoundTrack::ComposeTrackName(), ConvertLegacyProjectFile(), ConvertLegacyTrack(), FileDialogWrapper::Create(), FileDialog::Create(), wxDialogWrapper::Create(), wxPanelWrapper::Create(), AudioUnitEffectsModule::CreateInstance(), MacroCommands::DeleteMacro(), FFmpegPresets::DeletePreset(), CommandManager::DescribeCommandsAndShortcuts(), AudioUnitEffectsModule::DiscoverPluginsAtPath(), AudacityCommand::DoAudacityCommand(), Effect::DoEffect(), ExportMultipleDialog::DoExport(), BuiltinCommandsModule::DoRegistration(), BuiltinEffectsModule::DoRegistration(), TrackUtilities::DoRemoveTrack(), anonymous_namespace{NoteTrackView.cpp}::DrawNoteTrack(), anonymous_namespace{TrackPanel.cpp}::DrawTrackName(), PluginManager::DropFile(), CommandManager::Enable(), XMLFileReader::endElement(), CommandManager::EndSubMenu(), XMLWriter::EndTag(), ProjectSerializer::EndTag(), EQCurve::EQCurve(), ExportFFmpeg::ExportFFmpeg(), ExportMultipleDialog::ExportMultipleByLabel(), ExportMultipleDialog::ExportMultipleByTrack(), FFmpegImportFileHandle::FFmpegImportFileHandle(), FileDialog::FileDialog(), FileIO::FileIO(), DeviceToolBar::FillInputChannels(), anonymous_namespace{Registry.cpp}::CollectedItems::Find(), find_widget(), AudioUnitEffectsModule::FindAudioUnit(), FindDialog::FindDialog(), FindFFmpegDialog::FindFFmpegDialog(), MP3Exporter::FindLibrary(), FFmpegLibs::FindLibs(), VampEffectsModule::FindPlugin(), LV2EffectsModule::FindPluginPaths(), VampEffectsModule::FindPluginPaths(), FFmpegPresets::FindPreset(), ExportFFmpegOptions::FindSelectedCodec(), ExportFFmpegOptions::FindSelectedFormat(), VSTEffect::GetAutomationParameters(), NumericConverter::GetBuiltinFormat(), CommandManager::GetCategories(), CommandManager::GetCategoryFromName(), EffectManager::GetCommandIdentifier(), audacity::network_manager::Request::getCookie(), audacity::network_manager::CookiesList::getCookie(), TracksPrefs::GetDefaultAudioTrackNamePreference(), CommandManager::GetDefaultKeyFromName(), AudioIOBase::GetDeviceInfo(), VSTEffect::GetEffectIDs(), CommandManager::GetEnabled(), EffectDistortion::GetFactoryPresets(), audacity::network_manager::Request::getHeader(), audacity::network_manager::HeadersList::getHeader(), KeyView::GetIndexByName(), CommandManager::GetKeyFromName(), CommandManager::GetLabelFromName(), Languages::GetLanguages(), ExportCL::GetMetaChunk(), FFmpegImportFileHandle::GetMetadata(), DevicePrefs::GetNamesAndLabels(), CommandManager::GetPrefixedLabelFromName(), Effect::GetSquashedName(), PluginManager::GetSubgroups(), Module::GetSymbol(), Effect::GetUserPresetsGroup(), AUPImportFileHandle::HandlePCMAliasBlockFile(), HandlePrint(), CommandManager::HandleXMLTag(), audacity::network_manager::Header::hasSameName(), AudioUnitEffectImportDialog::Import(), FLACImportFileHandle::Import(), OggImportFileHandle::Import(), LWSlider::Init(), FFmpegImportFileHandle::InitCodecs(), NyquistEffectsModule::Initialize(), FFmpegLibs::InitLibs(), MacroCommands::IsFixed(), AudioUnitEffectsModule::IsPluginValid(), KeyConfigPrefsFactory(), MixerBoard::LoadMusicalInstruments(), ExportMP3Options::LoadNames(), FFmpegPresets::LoadPreset(), AudioUnitEffect::LoadUserPreset(), Effect::LoadUserPreset(), LadspaEffect::LoadUserPreset(), LV2Effect::LoadUserPreset(), VSTEffect::LoadUserPreset(), LOFImportFileHandle::LOFImportFileHandle(), LWSlider::LWSlider(), anonymous_namespace{Registry.cpp}::CollectedItems::MergeLater(), anonymous_namespace{Registry.cpp}::CollectedItems::MergeWithExistingItem(), KeyConfigPrefs::MergeWithExistingKeys(), MacroCommands::MigrateLegacyChains(), Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack(), CommandManager::Modify(), Effect::ModifyAnalysisTrack(), Module::Module(), ShuttleGui::Name(), DialogDefinition::Item::Name(), CommandManager::NewIdentifier(), CommandParameters::NormalizeName(), MacrosWindow::OnAdd(), ApplyMacroDialog::OnApplyToFiles(), DevicePrefs::OnDevice(), DevicePrefs::OnHost(), MacrosWindow::OnImport(), AudioUnitEffectImportDialog::OnOk(), GStreamerImportFileHandle::OnPadAdded(), FileActions::Handler::OnPrint(), MacrosWindow::OnRemove(), EffectUIHost::OnSaveAs(), GStreamerImportFileHandle::OnTag(), AudacityApp::OnTimer(), DBConnection::OpenStepByStep(), FFmpegPresets::OverwriteIsOk(), audacity::network_manager::Cookie::Parse(), NyquistEffect::Parse(), ExportMultipleDialog::PopulateOrExchange(), VampEffect::PopulateOrExchange(), anonymous_namespace{PrefsPanel.cpp}::PrefsItem::PrefsItem(), EffectFindClipping::Process(), MacroCommands::ReadMacro(), KeyView::RefreshBindings(), KeyConfigPrefs::RefreshKeyInfo(), VSTEffect::RefreshParameters(), ControlToolBar::RegenerateTooltips(), PrefsPanel::Registration::Registration(), CommandManager::RemoveDuplicateShortcuts(), anonymous_namespace{Registry.cpp}::ReportConflictingPlacements(), anonymous_namespace{Registry.cpp}::ReportGroupGroupCollision(), anonymous_namespace{Registry.cpp}::ReportItemItemCollision(), MacroCommands::RestoreMacro(), ProjectFileIO::SafetyFileName(), Internat::SanitiseFilename(), ExportFFmpegOptions::SavePreset(), FFmpegPresets::SavePreset(), AudioUnitEffect::SaveUserPreset(), Effect::SaveUserPreset(), LadspaEffect::SaveUserPreset(), LV2Effect::SaveUserPreset(), VSTEffect::SaveUserPreset(), VSTEffect::SetAutomationParameters(), CommandManager::SetCommandFlags(), audacity::network_manager::Request::setCookie(), FileDialog::SetFilename(), ODDecodeBlockFile::SetFileName(), ODPCMAliasBlockFile::SetFileName(), audacity::network_manager::Request::setHeader(), LV2Effect::SetHost(), KeyView::SetKeyByName(), KeyConfigPrefs::SetKeyForSelected(), CommandManager::SetKeyFromName(), ExportFFmpeg::SetMetadata(), NumericTextCtrl::SetName(), wxPanelWrapper::SetName(), wxDialogWrapper::SetName(), AudacityProject::SetProjectName(), ProjectFileIO::SetProjectTitle(), SetToExtantDirectory(), NyqBench::SetWindowTitle(), LyricsWindow::SetWindowTitle(), MixerBoardFrame::SetWindowTitle(), sf_normalize_name(), MenuTable::Special(), XMLFileReader::startElement(), CommandOutputTargets::StartField(), CommandContext::StartField(), CommandMessageTarget::StartField(), LispyCommandMessageTarget::StartField(), XMLWriter::StartTag(), ProjectSerializer::StartTag(), MuteButtonHandle::Tip(), SoloButtonHandle::Tip(), MenuButtonHandle::Tip(), CloseButtonHandle::Tip(), TransactionScope::TransactionCommit(), TransactionScope::TransactionRollback(), TransactionScope::TransactionStart(), LabelDialog::TransferDataFromWindow(), ufile_fopen(), ufile_fopen_input(), EffectDistortion::UpdateControl(), anonymous_namespace{Registry.cpp}::VisitItems(), ProjectSerializer::WriteAttr(), XMLWriter::WriteAttr(), Importer::WriteImportItems(), MacroCommands::WriteMacro(), and ProjectSerializer::WriteName().

◆ params

TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
kRectifier
@ kRectifier
Definition: Distortion.cpp:59
kCubic
@ kCubic
Definition: Distortion.cpp:55
XO
#define XO(s)
Definition: Internat.h:31
kSinCurve
@ kSinCurve
Definition: Distortion.cpp:57
kHalfSinCurve
@ kHalfSinCurve
Definition: Distortion.cpp:52
kHardClip
@ kHardClip
Definition: Distortion.cpp:50
nTableTypes
@ nTableTypes
Definition: Distortion.cpp:61
kLeveller
@ kLeveller
Definition: Distortion.cpp:58
kEvenHarmonics
@ kEvenHarmonics
Definition: Distortion.cpp:56
kSoftClip
@ kSoftClip
Definition: Distortion.cpp:51
kExpCurve
@ kExpCurve
Definition: Distortion.cpp:53
kHardLimiter
@ kHardLimiter
Definition: Distortion.cpp:60
names
static TranslatableStrings names
Definition: Tags.cpp:744
kLogCurve
@ kLogCurve
Definition: Distortion.cpp:54