| 302 | } |
| 303 | |
| 304 | void 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 | |
| 344 | void FilterControl::updateResponseCurve() |
| 345 | { |
nothing calls this directly
no test coverage detected