@@ -244,7 +244,6 @@ void EngineGlobal::setMTSEnabled(bool shouldBeEnabled)
244244void EngineGlobal::setUIScalingFactor (float f)
245245{
246246 _uiScalingFactor = jlimit (UI_SCALING_MIN, UI_SCALING_MAX, f);
247- DBG (" SCALE: " << _uiScalingFactor);
248247 _listeners.call ([&](Listener& listener){ listener.onUIScalingFactorChanged (_uiScalingFactor); });
249248}
250249
@@ -397,7 +396,7 @@ void EngineGlobal::loadIRs()
397396 std::unique_ptr<AudioFormatReader> reader{manager.createReaderFor (std::move (stream))};
398397 ir.waveform .setSize (reader->numChannels , (int )reader->lengthInSamples );
399398 const auto offset{ (juce::int64)ir.startOffset };
400- reader->read (&ir.waveform , 0 , ir.waveform .getNumSamples () - offset, offset, true , true );
399+ reader->read (&ir.waveform , 0 , ( int )( ir.waveform .getNumSamples () - offset) , offset, true , true );
401400
402401 ir.waveform .applyGain (ir.gain );
403402
@@ -473,8 +472,8 @@ void Engine::prepareToPlay(float sampleRate, int frameSize)
473472 auto * g = EngineGlobal::getInstance ();
474473 g->updateStops (SAMPLE_RATE_F);
475474
476- _limiterSpec.threshold = 0 .75f ;
477- _limiterSpec.attack = 10000 .0f / sampleRate;
475+ _limiterSpec.threshold = 0 .8f ;
476+ _limiterSpec.attack = 1000 .0f / sampleRate;
478477 _limiterSpec.release = 1 .0f / sampleRate;
479478 _limiterSpec.sustain = std::max (0 , int (sampleRate * 0 .5f ));
480479
@@ -533,6 +532,16 @@ void Engine::setVolume(float v)
533532 _params[VOLUME].setValue (v);
534533}
535534
535+ void Engine::enableLimiter (bool shouldBeEnabled)
536+ {
537+ _limiterEnabled = shouldBeEnabled;
538+ }
539+
540+ bool Engine::isLimiterEnabled () const
541+ {
542+ return _limiterEnabled;
543+ }
544+
536545void Engine::process (float * outL, float * outR, int numFrames, bool isNonRealtime)
537546{
538547 jassert (outL != nullptr );
@@ -592,8 +601,10 @@ void Engine::process(float* outL, float* outR, int numFrames, bool isNonRealtime
592601 applyVolume (origOutL, origOutR, origNumFrames);
593602
594603 // Apply limiter
595- dsp::Limiter::process (_limiterSpec, _limiterState[0 ], origOutL, origOutL, origNumFrames);
596- dsp::Limiter::process (_limiterSpec, _limiterState[1 ], origOutR, origOutR, origNumFrames);
604+ if (_limiterEnabled) {
605+ dsp::Limiter::process (_limiterSpec, _limiterState[0 ], origOutL, origOutL, origNumFrames);
606+ dsp::Limiter::process (_limiterSpec, _limiterState[1 ], origOutR, origOutR, origNumFrames);
607+ }
597608
598609 _volumeLevel.left .process (origOutL, origNumFrames);
599610 _volumeLevel.right .process (origOutR, origNumFrames);
0 commit comments