1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-14 16:46:28 +01:00

Eliminate uses of macro _ in Distortion

This commit is contained in:
Paul Licameli
2019-12-25 13:28:21 -05:00
parent 8b532546c9
commit d6cd48cde1
2 changed files with 120 additions and 112 deletions

View File

@@ -142,11 +142,6 @@ TranslatableString defaultLabelUntranslated(int index)
return names[ index ]; return names[ index ];
} }
wxString defaultLabel(int index)
{
return defaultLabelUntranslated(index).Translation();
}
// //
// EffectDistortion // EffectDistortion
// //
@@ -717,12 +712,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, true, _("Clipping level")); UpdateControl(ID_Threshold, true, XO("Clipping level"));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Drive")); UpdateControl(ID_Param1, true, XO("Drive"));
UpdateControl(ID_Param2, true, _("Make-up Gain")); UpdateControl(ID_Param2, true, XO("Make-up Gain"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kSoftClip: case kSoftClip:
UpdateControlText(mThresholdT, mOldThresholdTxt, true); UpdateControlText(mThresholdT, mOldThresholdTxt, true);
@@ -731,12 +726,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, true, _("Clipping threshold")); UpdateControl(ID_Threshold, true, XO("Clipping threshold"));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Hardness")); UpdateControl(ID_Param1, true, XO("Hardness"));
UpdateControl(ID_Param2, true, _("Make-up Gain")); UpdateControl(ID_Param2, true, XO("Make-up Gain"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kHalfSinCurve: case kHalfSinCurve:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -745,12 +740,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Distortion amount")); UpdateControl(ID_Param1, true, XO("Distortion amount"));
UpdateControl(ID_Param2, true, _("Output level")); UpdateControl(ID_Param2, true, XO("Output level"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kExpCurve: case kExpCurve:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -759,12 +754,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Distortion amount")); UpdateControl(ID_Param1, true, XO("Distortion amount"));
UpdateControl(ID_Param2, true, _("Output level")); UpdateControl(ID_Param2, true, XO("Output level"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kLogCurve: case kLogCurve:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -773,12 +768,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Distortion amount")); UpdateControl(ID_Param1, true, XO("Distortion amount"));
UpdateControl(ID_Param2, true, _("Output level")); UpdateControl(ID_Param2, true, XO("Output level"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kCubic: case kCubic:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -787,12 +782,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, true); UpdateControlText(mRepeatsT, mOldRepeatsTxt, true);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Distortion amount")); UpdateControl(ID_Param1, true, XO("Distortion amount"));
UpdateControl(ID_Param2, true, _("Output level")); UpdateControl(ID_Param2, true, XO("Output level"));
UpdateControl(ID_Repeats, true, _("Repeat processing")); UpdateControl(ID_Repeats, true, XO("Repeat processing"));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kEvenHarmonics: case kEvenHarmonics:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -801,12 +796,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Distortion amount")); UpdateControl(ID_Param1, true, XO("Distortion amount"));
UpdateControl(ID_Param2, true, _("Harmonic brightness")); UpdateControl(ID_Param2, true, XO("Harmonic brightness"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, true, wxEmptyString); UpdateControl(ID_DCBlock, true, {});
break; break;
case kSinCurve: case kSinCurve:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -815,12 +810,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Distortion amount")); UpdateControl(ID_Param1, true, XO("Distortion amount"));
UpdateControl(ID_Param2, true, _("Output level")); UpdateControl(ID_Param2, true, XO("Output level"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kLeveller: case kLeveller:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -829,12 +824,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, false); UpdateControlText(mParam2T, mOldParam2Txt, false);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, true); UpdateControlText(mRepeatsT, mOldRepeatsTxt, true);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, true, defaultLabel(1)); UpdateControl(ID_NoiseFloor, true, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Levelling fine adjustment")); UpdateControl(ID_Param1, true, XO("Levelling fine adjustment"));
UpdateControl(ID_Param2, false, defaultLabel(3)); UpdateControl(ID_Param2, false, defaultLabelUntranslated(3));
UpdateControl(ID_Repeats, true, _("Degree of Levelling")); UpdateControl(ID_Repeats, true, XO("Degree of Levelling"));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
case kRectifier: case kRectifier:
UpdateControlText(mThresholdT, mOldThresholdTxt, false); UpdateControlText(mThresholdT, mOldThresholdTxt, false);
@@ -843,12 +838,12 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, false); UpdateControlText(mParam2T, mOldParam2Txt, false);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, false, defaultLabel(0)); UpdateControl(ID_Threshold, false, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Distortion amount")); UpdateControl(ID_Param1, true, XO("Distortion amount"));
UpdateControl(ID_Param2, false, defaultLabel(3)); UpdateControl(ID_Param2, false, defaultLabelUntranslated(3));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, true, wxEmptyString); UpdateControl(ID_DCBlock, true, {});
break; break;
case kHardLimiter: case kHardLimiter:
UpdateControlText(mThresholdT, mOldThresholdTxt, true); UpdateControlText(mThresholdT, mOldThresholdTxt, true);
@@ -857,88 +852,99 @@ void EffectDistortion::UpdateUI()
UpdateControlText(mParam2T, mOldParam2Txt, true); UpdateControlText(mParam2T, mOldParam2Txt, true);
UpdateControlText(mRepeatsT, mOldRepeatsTxt, false); UpdateControlText(mRepeatsT, mOldRepeatsTxt, false);
UpdateControl(ID_Threshold, true, _("dB Limit")); UpdateControl(ID_Threshold, true, XO("dB Limit"));
UpdateControl(ID_NoiseFloor, false, defaultLabel(1)); UpdateControl(ID_NoiseFloor, false, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, _("Wet level")); UpdateControl(ID_Param1, true, XO("Wet level"));
UpdateControl(ID_Param2, true, _("Residual level")); UpdateControl(ID_Param2, true, XO("Residual level"));
UpdateControl(ID_Repeats, false, defaultLabel(4)); UpdateControl(ID_Repeats, false, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
break; break;
default: default:
UpdateControl(ID_Threshold, true, defaultLabel(0)); UpdateControl(ID_Threshold, true, defaultLabelUntranslated(0));
UpdateControl(ID_NoiseFloor, true, defaultLabel(1)); UpdateControl(ID_NoiseFloor, true, defaultLabelUntranslated(1));
UpdateControl(ID_Param1, true, defaultLabel(2)); UpdateControl(ID_Param1, true, defaultLabelUntranslated(2));
UpdateControl(ID_Param2, true, defaultLabel(3)); UpdateControl(ID_Param2, true, defaultLabelUntranslated(3));
UpdateControl(ID_Repeats, true, defaultLabel(4)); UpdateControl(ID_Repeats, true, defaultLabelUntranslated(4));
UpdateControl(ID_DCBlock, false, wxEmptyString); UpdateControl(ID_DCBlock, false, {});
} }
} }
void EffectDistortion::UpdateControl(control id, bool enabled, wxString name) void EffectDistortion::UpdateControl(
control id, bool enabled, TranslatableString name)
{ {
wxString suffix = _(" (Not Used):"); auto suffix = XO("(Not Used):");
switch (id) switch (id)
{ {
case ID_Threshold: case ID_Threshold: {
/* i18n-hint: Control range. */ /* i18n-hint: Control range. */
if (enabled) suffix = _(" (-100 to 0 dB):"); if (enabled) suffix = XO("(-100 to 0 dB):");
name += suffix; name.Join( suffix, wxT(" ") );
// Logarithmic slider is set indirectly // Logarithmic slider is set indirectly
mThreshold = DB_TO_LINEAR(mParams.mThreshold_dB); mThreshold = DB_TO_LINEAR(mParams.mThreshold_dB);
mThresholdS->SetValue((int) (mThreshold * SCL_Threshold_dB + 0.5)); mThresholdS->SetValue((int) (mThreshold * SCL_Threshold_dB + 0.5));
mThresholdTxt->SetLabel(name); auto translated = name.Translation();
mThresholdS->SetName(name); mThresholdTxt->SetLabel(translated);
mThresholdT->SetName(name); mThresholdS->SetName(translated);
mThresholdT->SetName(translated);
mThresholdS->Enable(enabled); mThresholdS->Enable(enabled);
mThresholdT->Enable(enabled); mThresholdT->Enable(enabled);
break; break;
case ID_NoiseFloor: }
case ID_NoiseFloor: {
/* i18n-hint: Control range. */ /* i18n-hint: Control range. */
if (enabled) suffix = _(" (-80 to -20 dB):"); if (enabled) suffix = XO("(-80 to -20 dB):");
name += suffix; name.Join( suffix, wxT(" ") );
mNoiseFloorTxt->SetLabel(name); auto translated = name.Translation();
mNoiseFloorS->SetName(name); mNoiseFloorTxt->SetLabel(translated);
mNoiseFloorT->SetName(name); mNoiseFloorS->SetName(translated);
mNoiseFloorT->SetName(translated);
mNoiseFloorS->Enable(enabled); mNoiseFloorS->Enable(enabled);
mNoiseFloorT->Enable(enabled); mNoiseFloorT->Enable(enabled);
break; break;
case ID_Param1: }
case ID_Param1: {
/* i18n-hint: Control range. */ /* i18n-hint: Control range. */
if (enabled) suffix = _(" (0 to 100):"); if (enabled) suffix = XO("(0 to 100):");
name += suffix; name.Join( suffix, wxT(" ") );
mParam1Txt->SetLabel(name); auto translated = name.Translation();
mParam1S->SetName(name); mParam1Txt->SetLabel(translated);
mParam1T->SetName(name); mParam1S->SetName(translated);
mParam1T->SetName(translated);
mParam1S->Enable(enabled); mParam1S->Enable(enabled);
mParam1T->Enable(enabled); mParam1T->Enable(enabled);
break; break;
case ID_Param2: }
case ID_Param2: {
/* i18n-hint: Control range. */ /* i18n-hint: Control range. */
if (enabled) suffix = _(" (0 to 100):"); if (enabled) suffix = XO("(0 to 100):");
name += suffix; name.Join( suffix, wxT(" ") );
mParam2Txt->SetLabel(name); auto translated = name.Translation();
mParam2S->SetName(name); mParam2Txt->SetLabel(translated);
mParam2T->SetName(name); mParam2S->SetName(translated);
mParam2T->SetName(translated);
mParam2S->Enable(enabled); mParam2S->Enable(enabled);
mParam2T->Enable(enabled); mParam2T->Enable(enabled);
break; break;
case ID_Repeats: }
case ID_Repeats: {
/* i18n-hint: Control range. */ /* i18n-hint: Control range. */
if (enabled) suffix = _(" (0 to 5):"); if (enabled) suffix = XO("(0 to 5):");
name += suffix; name.Join( suffix, wxT(" ") );
mRepeatsTxt->SetLabel(name); auto translated = name.Translation();
mRepeatsS->SetName(name); mRepeatsTxt->SetLabel(translated);
mRepeatsT->SetName(name); mRepeatsS->SetName(translated);
mRepeatsT->SetName(translated);
mRepeatsS->Enable(enabled); mRepeatsS->Enable(enabled);
mRepeatsT->Enable(enabled); mRepeatsT->Enable(enabled);
break; break;
case ID_DCBlock: }
case ID_DCBlock: {
if (enabled) { if (enabled) {
mDCBlockCheckBox->SetValue(mbSavedFilterState); mDCBlockCheckBox->SetValue(mbSavedFilterState);
mParams.mDCBlock = mbSavedFilterState; mParams.mDCBlock = mbSavedFilterState;
@@ -950,7 +956,9 @@ void EffectDistortion::UpdateControl(control id, bool enabled, wxString name)
mDCBlockCheckBox->Enable(enabled); mDCBlockCheckBox->Enable(enabled);
break; break;
default: break; }
default:
break;
} }
} }

View File

@@ -131,7 +131,7 @@ private:
void OnRepeatsText(wxCommandEvent & evt); void OnRepeatsText(wxCommandEvent & evt);
void OnRepeatsSlider(wxCommandEvent & evt); void OnRepeatsSlider(wxCommandEvent & evt);
void UpdateUI(); void UpdateUI();
void UpdateControl(control id, bool enable, wxString name); void UpdateControl(control id, bool enable, TranslatableString name);
void UpdateControlText(wxTextCtrl *textCtrl, wxString &string, bool enabled); void UpdateControlText(wxTextCtrl *textCtrl, wxString &string, bool enabled);
void MakeTable(); void MakeTable();