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

Method shiftLfoModulationTargets

Source/PluginProcessor.cpp:2492–2529  ·  view source on GitHub ↗

* @brief Shifts the band index for any LFO modulation routing target within a specified range. * * This function iterates through all modulation routings. If a routing's target parameter * has a band index between startIndex and endIndex (inclusive), it adjusts that index * by shiftAmount. This is crucial for keeping modulation assignments correct when bands * are added or removed. * * @par

Source from the content-addressed store, hash-verified

2490 * @param shiftAmount The amount to add to the band index (can be positive or negative).
2491 */
2492void FireAudioProcessor::shiftLfoModulationTargets(int startIndex, int endIndex, int shiftAmount)
2493{
2494 auto& routings = lfoManager->getModulationRoutings();
2495 const auto& bandParamBases = ParameterIDAndName::getBandParameterInfo();
2496
2497 for (auto& routing : routings)
2498 {
2499 if (routing.targetParameterID.isEmpty())
2500 continue;
2501
2502 for (const auto& paramInfo : bandParamBases)
2503 {
2504 // Check if the target ID starts with a known band parameter ID base
2505 if (routing.targetParameterID.startsWith(paramInfo.idBase))
2506 {
2507 // Extract the number part of the ID
2508 juce::String indexStr = routing.targetParameterID.substring(paramInfo.idBase.length());
2509
2510 if (! indexStr.containsOnly("0123456789"))
2511 continue;
2512
2513 int currentBandIndex = indexStr.getIntValue() - 1; // Convert to 0-based
2514
2515 // Check if the current band is within the range we need to shift
2516 if (currentBandIndex >= startIndex && currentBandIndex <= endIndex)
2517 {
2518 int newBandIndex = currentBandIndex + shiftAmount;
2519 routing.targetParameterID = paramInfo.idBase + juce::String(newBandIndex + 1);
2520
2521 // Found a match and processed it, no need to check other bases for this routing
2522 goto next_routing;
2523 }
2524 }
2525 }
2526 next_routing:; // Label to jump to for the next iteration of the outer loop
2527 }
2528 lfoDataHasChanged();
2529}
2530
2531/**
2532 * @brief Clears (un-assigns) any LFO modulation that targets a specific band.

Callers 2

setStatesWhenAddMethod · 0.80
setStatesWhenDeleteMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected