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

Method timerCallback

Source/PluginEditor.cpp:581–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581void FireAudioProcessorEditor::timerCallback()
582{
583 if (isLfoAssignMode)
584 {
585 // Increment the angle for the sine wave animation
586 assignModePulseAngle += 0.05f;
587 if (assignModePulseAngle > juce::MathConstants<float>::twoPi)
588 assignModePulseAngle -= juce::MathConstants<float>::twoPi;
589
590 // Calculate a smooth alpha value using a sine wave, mapped to a pleasant range (e.g., 0.1 to 0.4)
591 float minAlpha = 0.1f;
592 float maxAlpha = 0.4f;
593 assignModePulseAlpha = minAlpha + (maxAlpha - minAlpha) * ((std::sin(assignModePulseAngle) + 1.0f) / 2.0f);
594
595 // Pass the new alpha value to all modulatable sliders
596 for (auto* slider : bandPanel.getModulatableSliders())
597 slider->assignModeGlowAlpha = assignModePulseAlpha;
598 for (auto* slider : globalPanel.getModulatableSliders())
599 slider->assignModeGlowAlpha = assignModePulseAlpha;
600
601 // Repaint the panels on every frame to ensure smooth animation
602 bandPanel.repaint();
603 globalPanel.repaint();
604 }
605
606 auto updateSliderState = [&](ModulatableSlider& slider)
607 {
608 if (slider.parameterID.isEmpty())
609 return;
610
611 auto modInfo = processor.getModulationInfoForParameter(slider.parameterID);
612 slider.isModulated = modInfo.isModulated;
613
614 // Always update the values. If not modulated, depth will be 0 from getModulationInfoForParameter.
615 slider.lfoSource = modInfo.sourceLfoIndex;
616 slider.lfoAmount = modInfo.depth;
617 slider.lfoValue = modInfo.currentValue;
618 slider.isBipolar = modInfo.isBipolar;
619 };
620
621 // Loop through the public list of modulatable sliders from the bandPanel.
622 // This is much cleaner and automatically adapts to any new sliders you add.
623 for (auto* slider : bandPanel.getModulatableSliders())
624 {
625 if (slider != nullptr) // A good safety check
626 {
627 updateSliderState(*slider);
628 }
629 }
630 // Repaint the entire panel once, which is more efficient than repainting individual sliders.
631 bandPanel.repaint();
632
633 for (auto* slider : globalPanel.getModulatableSliders())
634 {
635 if (slider != nullptr)
636 {
637 updateSliderState(*slider);
638 }

Callers

nothing calls this directly

Calls 15

getFocusBandNumMethod · 0.80
getBypassedStateMethod · 0.80
isFFTBlockReadyMethod · 0.80
getFFTDataMethod · 0.80
processFFTMethod · 0.80
setSpecAlphaMethod · 0.80
updateSpectrumMethod · 0.80
getNumBinsMethod · 0.80
getFFTSizeMethod · 0.80
updateDriveMeterMethod · 0.80

Tested by

no test coverage detected