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

Method updateChain

Source/Panels/SpectrogramPanel/FilterControl.cpp:304–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void FilterControl::updateChain()
305{
306 auto chainSettings = getChainSettings(processor.treeState);
307 const auto sampleRate = processor.getSampleRate();
308
309 if (sampleRate <= 0)
310 return;
311
312 const float minFreq = 20.0f;
313 float maxFreq = sampleRate / 2.0f;
314
315 if (maxFreq < minFreq)
316 {
317 maxFreq = minFreq;
318 }
319
320 chainSettings.lowCutFreq = juce::jlimit(minFreq, maxFreq, chainSettings.lowCutFreq);
321 chainSettings.peakFreq = juce::jlimit(minFreq, maxFreq, chainSettings.peakFreq);
322 chainSettings.highCutFreq = juce::jlimit(minFreq, maxFreq, chainSettings.highCutFreq);
323
324 monoChain.setBypassed<ChainPositions::LowCut>(chainSettings.lowCutBypassed);
325 monoChain.setBypassed<ChainPositions::Peak>(chainSettings.peakBypassed);
326 monoChain.setBypassed<ChainPositions::HighCut>(chainSettings.highCutBypassed);
327 monoChain.setBypassed<ChainPositions::LowCutQ>(chainSettings.lowCutBypassed);
328 monoChain.setBypassed<ChainPositions::HighCutQ>(chainSettings.highCutBypassed);
329
330 auto peakCoefficients = makePeakFilter(chainSettings, processor.getSampleRate());
331 updateCoefficients(monoChain.get<ChainPositions::Peak>().coefficients, peakCoefficients);
332
333 auto lowCutCoefficients = makeLowCutFilter(chainSettings, processor.getSampleRate());
334 auto highCutCoefficients = makeHighCutFilter(chainSettings, processor.getSampleRate());
335
336 auto lowCutQCoefficients = makeLowcutQFilter(chainSettings, processor.getSampleRate());
337 updateCoefficients(monoChain.get<ChainPositions::LowCutQ>().coefficients, lowCutQCoefficients);
338 auto highCutQCoefficients = makeHighcutQFilter(chainSettings, processor.getSampleRate());
339 updateCoefficients(monoChain.get<ChainPositions::HighCutQ>().coefficients, highCutQCoefficients);
340 updateCutFilter(monoChain.get<ChainPositions::LowCut>(), lowCutCoefficients, chainSettings.lowCutSlope);
341 updateCutFilter(monoChain.get<ChainPositions::HighCut>(), highCutCoefficients, chainSettings.highCutSlope);
342}
343
344void FilterControl::updateResponseCurve()
345{

Callers

nothing calls this directly

Calls 8

getChainSettingsFunction · 0.85
makePeakFilterFunction · 0.85
updateCoefficientsFunction · 0.85
makeLowCutFilterFunction · 0.85
makeHighCutFilterFunction · 0.85
makeLowcutQFilterFunction · 0.85
makeHighcutQFilterFunction · 0.85
updateCutFilterFunction · 0.85

Tested by

no test coverage detected