MCPcopy Create free account
hub / github.com/audacity/audacity / UpdateControl

Method UpdateControl

src/effects/Distortion.cpp:685–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683
684
685void EffectDistortion::Editor::UpdateControl(
686 control id, bool enabled, TranslatableString name)
687{
688 auto& ms = mSettings;
689
690 auto suffix = XO("(Not Used):");
691 switch (id)
692 {
693 case ID_Threshold: {
694 /* i18n-hint: Control range. */
695 if (enabled) suffix = XO("(-100 to 0 dB):");
696 name.Join( suffix, wxT(" ") );
697
698 // Logarithmic slider is set indirectly
699 const double threshold = DB_TO_LINEAR(ms.mThreshold_dB);
700 mThresholdS->SetValue((int) (threshold * Threshold_dB.scale + 0.5));
701
702 auto translated = name.Translation();
703 mThresholdTxt->SetLabel(translated);
704 mThresholdS->SetName(translated);
705 mThresholdT->SetName(translated);
706 mThresholdS->Enable(enabled);
707 mThresholdT->Enable(enabled);
708 break;
709 }
710 case ID_NoiseFloor: {
711 /* i18n-hint: Control range. */
712 if (enabled) suffix = XO("(-80 to -20 dB):");
713 name.Join( suffix, wxT(" ") );
714
715 auto translated = name.Translation();
716 mNoiseFloorTxt->SetLabel(translated);
717 mNoiseFloorS->SetName(translated);
718 mNoiseFloorT->SetName(translated);
719 mNoiseFloorS->Enable(enabled);
720 mNoiseFloorT->Enable(enabled);
721 break;
722 }
723 case ID_Param1: {
724 /* i18n-hint: Control range. */
725 if (enabled) suffix = XO("(0 to 100):");
726 name.Join( suffix, wxT(" ") );
727
728 auto translated = name.Translation();
729 mParam1Txt->SetLabel(translated);
730 mParam1S->SetName(translated);
731 mParam1T->SetName(translated);
732 mParam1S->Enable(enabled);
733 mParam1T->Enable(enabled);
734 break;
735 }
736 case ID_Param2: {
737 /* i18n-hint: Control range. */
738 if (enabled) suffix = XO("(0 to 100):");
739 name.Join( suffix, wxT(" ") );
740
741 auto translated = name.Translation();
742 mParam2Txt->SetLabel(translated);

Callers

nothing calls this directly

Calls 6

TranslationMethod · 0.80
JoinMethod · 0.45
SetValueMethod · 0.45
SetLabelMethod · 0.45
SetNameMethod · 0.45
EnableMethod · 0.45

Tested by

no test coverage detected