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

Method processMultiBand

Source/PluginProcessor.cpp:1915–1994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1913}
1914
1915void FireAudioProcessor::processMultiBand(juce::AudioBuffer<float>& wetBuffer, const juce::AudioBuffer<float>& lfoOutputs, double sampleRate)
1916{
1917 splitBands(wetBuffer, sampleRate);
1918
1919 delayMatchedDryBuffer.clear();
1920
1921 std::array<juce::AudioBuffer<float>*, 4> dryBandBuffers = { &mBuffer1, &mBuffer2, &mBuffer3, &mBuffer4 };
1922 std::array<juce::AudioBuffer<float>*, 4> wetBandBuffers = { &mBuffer1, &mBuffer2, &mBuffer3, &mBuffer4 };
1923
1924 sumBands(delayMatchedDryBuffer, dryBandBuffers, true);
1925
1926 for (int i = 0; i < numBands; ++i)
1927 {
1928 if (auto* band = bands[i].get())
1929 {
1930 calculateAndStoreLevels(*dryBandBuffers[i], band->mInputLeftRMS, band->mInputRightRMS, band->mInputLeftPeak, band->mInputRightPeak);
1931
1932 if (*treeState.getRawParameterValue(ParameterIDAndName::getIDString(BAND_ENABLE_ID, i)))
1933 {
1934 BandProcessingParameters params;
1935
1936 // 1. Fill General Settings
1937 params.isOutputModulated = getModulationInfoForParameter(ParameterIDAndName::getIDString(OUTPUT_ID, i)).isModulated;
1938 params.mode = *treeState.getRawParameterValue(ParameterIDAndName::getIDString(MODE_ID, i));
1939 params.isHQ = *treeState.getRawParameterValue(HQ_ID);
1940 params.isDriveEnabled = *treeState.getRawParameterValue(ParameterIDAndName::getIDString(DRIVE_BYPASS_ID, i)) > 0.5f;
1941 params.isShapeEnabled = *treeState.getRawParameterValue(ParameterIDAndName::getIDString(SHAPE_BYPASS_ID, i)) > 0.5f;
1942 params.isCompEnabled = *treeState.getRawParameterValue(ParameterIDAndName::getIDString(COMP_BYPASS_ID, i)) > 0.5f;
1943 params.isWidthEnabled = *treeState.getRawParameterValue(ParameterIDAndName::getIDString(WIDTH_BYPASS_ID, i)) > 0.5f;
1944 params.isSafeModeOn = *treeState.getRawParameterValue(ParameterIDAndName::getIDString(SAFE_ID, i)) > 0.5f;
1945 params.isExtremeModeOn = *treeState.getRawParameterValue(ParameterIDAndName::getIDString(EXTREME_ID, i)) > 0.5f;
1946 params.isDcFilterEnabled = params.isShapeEnabled && (*treeState.getRawParameterValue(ParameterIDAndName::getIDString(DC_FILTER_ID, i)) > 0.5f);
1947
1948 // 2. Setup ModulatedValueProviders AND their LFO source indices
1949 auto setupProvider = [&](ModulatedValueProvider& provider, int& lfoIndex, const juce::String& paramID)
1950 {
1951 auto* param = treeState.getParameter(paramID);
1952 if (! param)
1953 return;
1954
1955 provider.baseValue = *treeState.getRawParameterValue(paramID);
1956 provider.range = param->getNormalisableRange();
1957
1958 auto modInfo = getModulationInfoForParameter(paramID);
1959 if (modInfo.isModulated && ! modInfo.isBypassed)
1960 {
1961 provider.modulationDepth = modInfo.depth;
1962 provider.isBipolar = modInfo.isBipolar;
1963 lfoIndex = modInfo.sourceLfoIndex - 1; // Store the 0-based index
1964 }
1965 };
1966
1967 setupProvider(params.driveVal, params.driveLfoSourceIndex, ParameterIDAndName::getIDString(DRIVE_ID, i));
1968 setupProvider(params.biasVal, params.biasLfoSourceIndex, ParameterIDAndName::getIDString(BIAS_ID, i));
1969 setupProvider(params.recVal, params.recLfoSourceIndex, ParameterIDAndName::getIDString(REC_ID, i));
1970 setupProvider(params.outputVal, params.outputLfoSourceIndex, ParameterIDAndName::getIDString(OUTPUT_ID, i));
1971
1972 // 3. Get final values for Block-wise parameters

Callers 1

Benchmarks.cppFile · 0.80

Calls 4

getIDStringFunction · 0.85
getMethod · 0.80
getModulatedValueMethod · 0.80
processMethod · 0.45

Tested by

no test coverage detected