diff --git a/src/deluge/dsp/master_compressor/master_compressor.cpp b/src/deluge/dsp/master_compressor/master_compressor.cpp index c585415c89..7c12046c40 100644 --- a/src/deluge/dsp/master_compressor/master_compressor.cpp +++ b/src/deluge/dsp/master_compressor/master_compressor.cpp @@ -27,10 +27,10 @@ MasterCompressor::MasterCompressor() { //compressor.setRatio(1.0 / ((float)ratio / 100.0)); shape = getParamFromUserValue(Param::Unpatched::COMPRESSOR_SHAPE, 1); //an appropriate range is 0-50*one q 15 - threshold = 15 * ONE_Q15; + threshold = ONE_Q31; follower = true; //this is about a 1:1 ratio - ratio = ONE_Q31 >> 3; + ratio = ONE_Q31 >> 1; syncLevel = SyncLevel::SYNC_LEVEL_NONE; currentVolume = 0; //auto make up gain @@ -40,10 +40,9 @@ MasterCompressor::MasterCompressor() { void MasterCompressor::updateER() { threshdb = 16 * (threshold / ONE_Q31f); //14 is about the level of a single synth voice - er = std::clamp((16 - threshdb) * (float(ratio) / ONE_Q31f), 0, 4); + er = std::clamp((16 - threshdb) * (float(ratio) / ONE_Q31f), 0, 15); } -//with floats baseline is 60-90us void MasterCompressor::render(StereoSample* buffer, uint16_t numSamples) { meanVolume = calc_rms(buffer, numSamples); @@ -79,7 +78,7 @@ void MasterCompressor::render(StereoSample* buffer, uint16_t numSamples) { } while (++thisSample != bufferEnd); //for LEDs //9 converts to dB, quadrupled for display range since a 30db reduction is basically killing the signal - gr = -reduction * 9 * 4; + gr = std::clamp(-reduction * 9 * 4, 0, 127); } //output range is 0-21 (2^31) diff --git a/src/deluge/model/global_effectable/global_effectable.cpp b/src/deluge/model/global_effectable/global_effectable.cpp index 2481f2c9c7..9b102d96be 100644 --- a/src/deluge/model/global_effectable/global_effectable.cpp +++ b/src/deluge/model/global_effectable/global_effectable.cpp @@ -289,7 +289,7 @@ ActionResult GlobalEffectable::modEncoderActionForNonExistentParam(int32_t offse int current = AudioEngine::mastercompressor.threshold >> 24; current -= offset; current = std::clamp(current, 1, 128); - indicator_leds::setKnobIndicatorLevel(1, std::max(0, 128 - 3 * (current - 2))); + indicator_leds::setKnobIndicatorLevel(1, std::max(0, 128 - current)); AudioEngine::mastercompressor.threshold = lshiftAndSaturate<24>(current); AudioEngine::mastercompressor.updateER(); return ActionResult::DEALT_WITH; diff --git a/src/deluge/model/song/song.cpp b/src/deluge/model/song/song.cpp index 7d838f78ff..75ef604df9 100644 --- a/src/deluge/model/song/song.cpp +++ b/src/deluge/model/song/song.cpp @@ -136,12 +136,10 @@ Song::Song() : backedUpParamManagers(sizeof(BackedUpParamManager)) { reverbCompressorShape = -601295438; reverbCompressorSync = SYNC_LEVEL_8TH; - masterCompressorAttack = 7; - masterCompressorRelease = 10; - masterCompressorThresh = 10; - masterCompressorRatio = 10; - masterCompressorMakeup = 0; - masterCompressorWet = 50; + masterCompressorAttack = attackRateTable[2] << 2; + masterCompressorRelease = releaseRateTable[5] << 2; + masterCompressorThresh = ONE_Q31; + masterCompressorRatio = ONE_Q31 >> 1; AudioEngine::mastercompressor.gr = 0.0; dirPath.set("SONGS"); @@ -2672,7 +2670,7 @@ int32_t Song::getCurrentPresetScale() { // If we're here, must be this one! return p; -notThisOne : {} +notThisOne: {} } return 255; @@ -4561,7 +4559,7 @@ Instrument* Song::changeInstrumentType(Instrument* oldInstrument, InstrumentType return NULL; } -gotAnInstrument : {} +gotAnInstrument: {} } // Synth or Kit diff --git a/src/deluge/model/song/song.h b/src/deluge/model/song/song.h index 681ed88af9..5b6e312bfd 100644 --- a/src/deluge/model/song/song.h +++ b/src/deluge/model/song/song.h @@ -330,8 +330,6 @@ class Song final : public TimelineCounter { int32_t masterCompressorRelease; int32_t masterCompressorThresh; int32_t masterCompressorRatio; - int32_t masterCompressorMakeup; - int32_t masterCompressorWet; private: bool fillModeActive; diff --git a/src/deluge/processing/engines/audio_engine.cpp b/src/deluge/processing/engines/audio_engine.cpp index 5837205170..3c1c4193f6 100644 --- a/src/deluge/processing/engines/audio_engine.cpp +++ b/src/deluge/processing/engines/audio_engine.cpp @@ -760,8 +760,8 @@ void routine() { } logAction("mastercomp start"); mastercompressor.render(renderingBuffer, numSamples); - masterVolumeAdjustmentL <<= 3; - masterVolumeAdjustmentR <<= 3; + masterVolumeAdjustmentL <<= 2; + masterVolumeAdjustmentR <<= 2; logAction("mastercomp end"); metronome.render(renderingBuffer, numSamples);