mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Show NewSensitivity rather than old, attack .02, release 0.1, choose between reduce and residue.
To be reviewed by Paul Licameli.
This commit is contained in:
parent
807689b9b8
commit
51c6bf0d90
@ -61,8 +61,9 @@
|
|||||||
|
|
||||||
typedef std::vector<float> FloatVector;
|
typedef std::vector<float> FloatVector;
|
||||||
|
|
||||||
// Define to make the radio button three-way
|
// Define both of these to make the radio button three-way
|
||||||
//#define RESIDUE_CHOICE
|
#define RESIDUE_CHOICE
|
||||||
|
//#define ISOLATE_CHOICE
|
||||||
|
|
||||||
// Define for Attack and release controls.
|
// Define for Attack and release controls.
|
||||||
//#define ATTACK_AND_RELEASE
|
//#define ATTACK_AND_RELEASE
|
||||||
@ -204,7 +205,7 @@ public:
|
|||||||
// Stored in preferences:
|
// Stored in preferences:
|
||||||
|
|
||||||
// Basic:
|
// Basic:
|
||||||
double mSensitivity; // in dB, plus or minus
|
double mOldSensitivity; // in dB, plus or minus
|
||||||
double mFreqSmoothingHz;
|
double mFreqSmoothingHz;
|
||||||
double mNoiseGain; // in dB, positive
|
double mNoiseGain; // in dB, positive
|
||||||
double mAttackTime; // in secs
|
double mAttackTime; // in secs
|
||||||
@ -392,7 +393,9 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
wxRadioButton *mKeepSignal;
|
wxRadioButton *mKeepSignal;
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
wxRadioButton *mKeepNoise;
|
wxRadioButton *mKeepNoise;
|
||||||
|
#endif
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
wxRadioButton *mResidue;
|
wxRadioButton *mResidue;
|
||||||
#endif
|
#endif
|
||||||
@ -513,14 +516,14 @@ bool EffectNoiseReduction::Settings::PrefsIO(bool read)
|
|||||||
static const double DEFAULT_SENSITIVITY = 6.0;
|
static const double DEFAULT_SENSITIVITY = 6.0;
|
||||||
|
|
||||||
static const PrefsTableEntry<Settings, double> doubleTable[] = {
|
static const PrefsTableEntry<Settings, double> doubleTable[] = {
|
||||||
{ &Settings::mSensitivity, wxT("Sensitivity"), 0.0 },
|
{ &Settings::mNewSensitivity, wxT("Sensitivity"), 0.0 },
|
||||||
{ &Settings::mFreqSmoothingHz, wxT("FreqSmoothing"), 150.0 },
|
{ &Settings::mFreqSmoothingHz, wxT("FreqSmoothing"), 150.0 },
|
||||||
{ &Settings::mNoiseGain, wxT("Gain"), 24.0 },
|
{ &Settings::mNoiseGain, wxT("Gain"), 24.0 },
|
||||||
{ &Settings::mAttackTime, wxT("AttackTime"), 0.15 },
|
{ &Settings::mAttackTime, wxT("AttackTime"), 0.02 },
|
||||||
{ &Settings::mReleaseTime, wxT("ReleaseTime"), 0.15 },
|
{ &Settings::mReleaseTime, wxT("ReleaseTime"), 0.10 },
|
||||||
|
|
||||||
// Advanced settings
|
// Advanced settings
|
||||||
{ &Settings::mNewSensitivity, wxT("NewSensitivity"), DEFAULT_SENSITIVITY },
|
{ &Settings::mOldSensitivity, wxT("NewSensitivity"), DEFAULT_SENSITIVITY },
|
||||||
};
|
};
|
||||||
static int doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]);
|
static int doubleTableSize = sizeof(doubleTable) / sizeof(doubleTable[0]);
|
||||||
|
|
||||||
@ -775,7 +778,7 @@ EffectNoiseReduction::Worker::Worker
|
|||||||
mOneBlockAttack = pow(10.0, (noiseGain / (20.0 * nAttackBlocks)));
|
mOneBlockAttack = pow(10.0, (noiseGain / (20.0 * nAttackBlocks)));
|
||||||
mOneBlockRelease = pow(10.0, (noiseGain / (20.0 * nReleaseBlocks)));
|
mOneBlockRelease = pow(10.0, (noiseGain / (20.0 * nReleaseBlocks)));
|
||||||
// Applies to power, divide by 10:
|
// Applies to power, divide by 10:
|
||||||
mSensitivityFactor = pow(10.0, settings.mSensitivity / 10.0);
|
mSensitivityFactor = pow(10.0, settings.mOldSensitivity / 10.0);
|
||||||
|
|
||||||
mNWindowsToExamine = (mMethod == DM_OLD_METHOD)
|
mNWindowsToExamine = (mMethod == DM_OLD_METHOD)
|
||||||
? std::max(2, (int)(minSignalTime * sampleRate / mStepSize))
|
? std::max(2, (int)(minSignalTime * sampleRate / mStepSize))
|
||||||
@ -1350,7 +1353,9 @@ bool EffectNoiseReduction::Worker::ProcessOne
|
|||||||
enum {
|
enum {
|
||||||
ID_BUTTON_GETPROFILE = 10001,
|
ID_BUTTON_GETPROFILE = 10001,
|
||||||
ID_RADIOBUTTON_KEEPSIGNAL,
|
ID_RADIOBUTTON_KEEPSIGNAL,
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
ID_RADIOBUTTON_KEEPNOISE,
|
ID_RADIOBUTTON_KEEPNOISE,
|
||||||
|
#endif
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
ID_RADIOBUTTON_RESIDUE,
|
ID_RADIOBUTTON_RESIDUE,
|
||||||
#endif
|
#endif
|
||||||
@ -1445,9 +1450,10 @@ const struct ControlInfo {
|
|||||||
{ &EffectNoiseReduction::Settings::mNoiseGain,
|
{ &EffectNoiseReduction::Settings::mNoiseGain,
|
||||||
0.0, 48.0, 48, wxT("%d"), true,
|
0.0, 48.0, 48, wxT("%d"), true,
|
||||||
_("Noise re&duction (dB):"), _("Noise reduction") },
|
_("Noise re&duction (dB):"), _("Noise reduction") },
|
||||||
{ &EffectNoiseReduction::Settings::mSensitivity,
|
{ &EffectNoiseReduction::Settings::mNewSensitivity,
|
||||||
-20.0, 20.0, 4000, wxT("%.2f"), false,
|
1.0, 24.0, 92, wxT("%.2f"), false,
|
||||||
_("&Sensitivity (dB):"), _("Sensitivity") },
|
// wxT("New method sensiti&vity:\n(units? you want units?)"), _("New sensitivity") },
|
||||||
|
_("&Sensitivity:"), _("Sensitivity") },
|
||||||
{ &EffectNoiseReduction::Settings::mFreqSmoothingHz,
|
{ &EffectNoiseReduction::Settings::mFreqSmoothingHz,
|
||||||
0, 1000, 100, wxT("%d"), true,
|
0, 1000, 100, wxT("%d"), true,
|
||||||
_("Fr&equency smoothing (Hz):"), _("Frequency smoothing") },
|
_("Fr&equency smoothing (Hz):"), _("Frequency smoothing") },
|
||||||
@ -1461,9 +1467,9 @@ const struct ControlInfo {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ADVANCED_SETTINGS
|
#ifdef ADVANCED_SETTINGS
|
||||||
{ &EffectNoiseReduction::Settings::mNewSensitivity,
|
{ &EffectNoiseReduction::Settings::mOldSensitivity,
|
||||||
1.0, 24.0, 92, wxT("%.2f"), false,
|
-20.0, 20.0, 4000, wxT("%.2f"), false,
|
||||||
_("New method sensiti&vity:\n(units? you want units?)"), _("New sensitivity") },
|
wxT("&Sensitivity (dB):"), _("Old Sensitivity") },
|
||||||
// add here
|
// add here
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -1477,8 +1483,10 @@ BEGIN_EVENT_TABLE(EffectNoiseReduction::Dialog, wxDialog)
|
|||||||
EVT_BUTTON(ID_EFFECT_PREVIEW, EffectNoiseReduction::Dialog::OnPreview)
|
EVT_BUTTON(ID_EFFECT_PREVIEW, EffectNoiseReduction::Dialog::OnPreview)
|
||||||
EVT_BUTTON(ID_BUTTON_GETPROFILE, EffectNoiseReduction::Dialog::OnGetProfile)
|
EVT_BUTTON(ID_BUTTON_GETPROFILE, EffectNoiseReduction::Dialog::OnGetProfile)
|
||||||
|
|
||||||
EVT_RADIOBUTTON(ID_RADIOBUTTON_KEEPNOISE, EffectNoiseReduction::Dialog::OnNoiseReductionChoice)
|
|
||||||
EVT_RADIOBUTTON(ID_RADIOBUTTON_KEEPSIGNAL, EffectNoiseReduction::Dialog::OnNoiseReductionChoice)
|
EVT_RADIOBUTTON(ID_RADIOBUTTON_KEEPSIGNAL, EffectNoiseReduction::Dialog::OnNoiseReductionChoice)
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
|
EVT_RADIOBUTTON(ID_RADIOBUTTON_KEEPNOISE, EffectNoiseReduction::Dialog::OnNoiseReductionChoice)
|
||||||
|
#endif
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
EVT_RADIOBUTTON(ID_RADIOBUTTON_RESIDUE, EffectNoiseReduction::Dialog::OnNoiseReductionChoice)
|
EVT_RADIOBUTTON(ID_RADIOBUTTON_RESIDUE, EffectNoiseReduction::Dialog::OnNoiseReductionChoice)
|
||||||
#endif
|
#endif
|
||||||
@ -1523,7 +1531,9 @@ EffectNoiseReduction::Dialog::Dialog
|
|||||||
, mbAllowTwiddleSettings(bAllowTwiddleSettings)
|
, mbAllowTwiddleSettings(bAllowTwiddleSettings)
|
||||||
// NULL out the control members until the controls are created.
|
// NULL out the control members until the controls are created.
|
||||||
, mKeepSignal(NULL)
|
, mKeepSignal(NULL)
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
, mKeepNoise(NULL)
|
, mKeepNoise(NULL)
|
||||||
|
#endif
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
, mResidue(NULL)
|
, mResidue(NULL)
|
||||||
#endif
|
#endif
|
||||||
@ -1573,7 +1583,12 @@ void EffectNoiseReduction::Dialog::DisableControlsIfIsolating()
|
|||||||
};
|
};
|
||||||
static const int nToDisable = sizeof(toDisable) / sizeof(toDisable[0]);
|
static const int nToDisable = sizeof(toDisable) / sizeof(toDisable[0]);
|
||||||
|
|
||||||
bool bIsolating = mKeepNoise->GetValue();
|
bool bIsolating =
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
|
mKeepNoise->GetValue();
|
||||||
|
#else
|
||||||
|
false;
|
||||||
|
#endif
|
||||||
for (int ii = nToDisable; ii--;)
|
for (int ii = nToDisable; ii--;)
|
||||||
wxWindow::FindWindowById(toDisable[ii], this)->Enable(!bIsolating);
|
wxWindow::FindWindowById(toDisable[ii], this)->Enable(!bIsolating);
|
||||||
}
|
}
|
||||||
@ -1606,8 +1621,10 @@ void EffectNoiseReduction::Dialog::OnNoiseReductionChoice( wxCommandEvent & WXUN
|
|||||||
{
|
{
|
||||||
if (mKeepSignal->GetValue())
|
if (mKeepSignal->GetValue())
|
||||||
mTempSettings.mNoiseReductionChoice = NRC_REDUCE_NOISE;
|
mTempSettings.mNoiseReductionChoice = NRC_REDUCE_NOISE;
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
else if (mKeepNoise->GetValue())
|
else if (mKeepNoise->GetValue())
|
||||||
mTempSettings.mNoiseReductionChoice = NRC_ISOLATE_NOISE;
|
mTempSettings.mNoiseReductionChoice = NRC_ISOLATE_NOISE;
|
||||||
|
#endif
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
else
|
else
|
||||||
mTempSettings.mNoiseReductionChoice = NRC_LEAVE_RESIDUE;
|
mTempSettings.mNoiseReductionChoice = NRC_LEAVE_RESIDUE;
|
||||||
@ -1679,18 +1696,23 @@ void EffectNoiseReduction::Dialog::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.EndMultiColumn();
|
S.EndMultiColumn();
|
||||||
|
|
||||||
S.StartMultiColumn(
|
S.StartMultiColumn(
|
||||||
|
2
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
4,
|
+1
|
||||||
#else
|
|
||||||
3,
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
|
+1
|
||||||
|
#endif
|
||||||
|
,
|
||||||
wxALIGN_CENTER_HORIZONTAL);
|
wxALIGN_CENTER_HORIZONTAL);
|
||||||
{
|
{
|
||||||
S.AddPrompt(_("Noise:"));
|
S.AddPrompt(_("Noise:"));
|
||||||
mKeepSignal = S.Id(ID_RADIOBUTTON_KEEPSIGNAL)
|
mKeepSignal = S.Id(ID_RADIOBUTTON_KEEPSIGNAL)
|
||||||
.AddRadioButton(_("Re&duce"));
|
.AddRadioButton(_("Re&duce"));
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
mKeepNoise = S.Id(ID_RADIOBUTTON_KEEPNOISE)
|
mKeepNoise = S.Id(ID_RADIOBUTTON_KEEPNOISE)
|
||||||
.AddRadioButtonToGroup(_("&Isolate"));
|
.AddRadioButtonToGroup(_("&Isolate"));
|
||||||
|
#endif
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
mResidue = S.Id(ID_RADIOBUTTON_RESIDUE)
|
mResidue = S.Id(ID_RADIOBUTTON_RESIDUE)
|
||||||
.AddRadioButtonToGroup(_("Resid&ue"));
|
.AddRadioButtonToGroup(_("Resid&ue"));
|
||||||
@ -1796,7 +1818,9 @@ bool EffectNoiseReduction::Dialog::TransferDataToWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mKeepSignal->SetValue(mTempSettings.mNoiseReductionChoice == NRC_REDUCE_NOISE);
|
mKeepSignal->SetValue(mTempSettings.mNoiseReductionChoice == NRC_REDUCE_NOISE);
|
||||||
|
#ifdef ISOLATE_CHOICE
|
||||||
mKeepNoise->SetValue(mTempSettings.mNoiseReductionChoice == NRC_ISOLATE_NOISE);
|
mKeepNoise->SetValue(mTempSettings.mNoiseReductionChoice == NRC_ISOLATE_NOISE);
|
||||||
|
#endif
|
||||||
#ifdef RESIDUE_CHOICE
|
#ifdef RESIDUE_CHOICE
|
||||||
mResidue->SetValue(mTempSettings.mNoiseReductionChoice == NRC_LEAVE_RESIDUE);
|
mResidue->SetValue(mTempSettings.mNoiseReductionChoice == NRC_LEAVE_RESIDUE);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user