MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / updateValuePopupForSlider

Method updateValuePopupForSlider

Source/PluginEditor.cpp:902–953  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900}
901
902void FireAudioProcessorEditor::updateValuePopupForSlider(ModulatableSlider* slider)
903{
904 if (! slider)
905 return;
906
907 auto paramID = slider->getParamID();
908 auto* param = processor.treeState.getParameter(paramID);
909 if (! param)
910 return;
911
912 // --- LOGIC FOR EXTREME VALUE DISPLAY ---
913 // 1. Get the parameter's base value in its real-world units (e.g., -6.0f for -6dB)
914 float baseValue = *processor.treeState.getRawParameterValue(paramID);
915
916 // 2. Get all modulation data from the processor
917 auto modInfo = processor.getModulationInfoForParameter(paramID);
918 float extremeValue = baseValue; // Start with the base value
919
920 // 3. If it's being modulated, calculate the extreme value in real-world units
921 if (modInfo.isModulated)
922 {
923 auto range = param->getNormalisableRange();
924 float parameterRange = range.end - range.start;
925 float maxOffset = 0.0f;
926
927 // We use 1.0f as the LFO value to calculate the maximum possible offset
928 if (modInfo.isBipolar)
929 maxOffset = 1.0f * modInfo.depth * parameterRange * 0.5f;
930 else
931 maxOffset = 1.0f * modInfo.depth * parameterRange;
932
933 extremeValue += maxOffset;
934 extremeValue = juce::jlimit(range.start, range.end, extremeValue);
935 }
936
937 // 4. Convert the final extreme value back to a normalized value [0, 1] that getText() expects
938 float finalNormalizedValue = param->convertTo0to1(extremeValue);
939 valuePopup.setText(param->getText(finalNormalizedValue, 0));
940
941 // --- FIX FOR VISIBILITY (remains the same) ---
942 // 5. Get slider's absolute screen bounds
943 auto sliderBounds = slider->getScreenBounds();
944
945 // 6. Convert the screen coordinates to be local to this editor component
946 auto localBounds = getLocalArea(nullptr, sliderBounds);
947
948 int popupWidth = 80;
949 int popupHeight = 20;
950
951 // 7. Set the popup's bounds using the converted local coordinates
952 valuePopup.setBounds(localBounds.getCentreX() - popupWidth / 2, localBounds.getY() - popupHeight, popupWidth, popupHeight);
953}
954
955void FireAudioProcessorEditor::hideValuePopup()
956{

Callers

nothing calls this directly

Calls 2

setTextMethod · 0.80

Tested by

no test coverage detected