Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master comp UI improvements #655

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prep for move to param manager
m-m-adams committed Oct 29, 2023
commit 2d076a4f59e8a77e5b02cc28d2441bdea0fb7dd8
4 changes: 3 additions & 1 deletion src/deluge/dsp/master_compressor/master_compressor.cpp
Original file line number Diff line number Diff line change
@@ -64,6 +64,8 @@ void MasterCompressor::updateER() {
}

void MasterCompressor::render(StereoSample* buffer, uint16_t numSamples, q31_t volAdjustL, q31_t volAdjustR) {
ratio = (rawRatio >> 1) + (48 << 24);
threshold = ONE_Q31 - rawThreshold;
updateER();

q31_t over = std::max<float>(0, (meanVolume - threshdb) / 21) * ONE_Q31;
@@ -109,7 +111,7 @@ void MasterCompressor::render(StereoSample* buffer, uint16_t numSamples, q31_t v
} while (++thisSample != bufferEnd);
//for LEDs
//9 converts to dB, quadrupled for display range since a 30db reduction is basically killing the signal
gainReduction = std::clamp<int32_t>(-(reduction)*9 * 4, 0, 127);
gainReduction = std::clamp<int32_t>(-(reduction) * 9 * 4, 0, 127);
//calc compression for next round (feedback compressor)
meanVolume = calc_rms(buffer, numSamples);
}
2 changes: 2 additions & 0 deletions src/deluge/dsp/master_compressor/master_compressor.h
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ class MasterCompressor : public Compressor {
float calc_rms(StereoSample* buffer, uint16_t numSamples);
uint8_t gainReduction;
bool dither;
q31_t rawRatio;
q31_t rawThreshold;
q31_t threshold;
q31_t shape;
q31_t ratio;
20 changes: 10 additions & 10 deletions src/deluge/model/global_effectable/global_effectable.cpp
Original file line number Diff line number Diff line change
@@ -334,24 +334,24 @@ ActionResult GlobalEffectable::modEncoderActionForNonExistentParam(int32_t offse
int displayLevel;
//this is only reachable in comp editing mode, otherwise it's an existent param
if (whichModEncoder == 1) { //sidechain (threshold)
current = AudioEngine::mastercompressor.threshold >> 24;
current -= offset;
current = std::clamp(current, 1, 128);
displayLevel = 128 - current;
AudioEngine::mastercompressor.threshold = lshiftAndSaturate<24>(current);
current = (AudioEngine::mastercompressor.rawThreshold >> 24) - 64;
current += offset;
current = std::clamp(current, -64, 64);
displayLevel = 64 + current;
AudioEngine::mastercompressor.rawThreshold = lshiftAndSaturate<24>(current + 64);
indicator_leds::setKnobIndicatorLevel(1, displayLevel);
}
else if (whichModEncoder == 0) {
switch (currentCompParam) {

case CompParam::RATIO:
current = AudioEngine::mastercompressor.ratio >> 24;
current = (AudioEngine::mastercompressor.rawRatio >> 24) - 64;
current += offset;
//this range is ratio of 2 to 20
current = std::clamp(current, 48, 112);
displayLevel = (current - 48) * 2;
current = std::clamp(current, -64, 64);
displayLevel = current + 64;

AudioEngine::mastercompressor.ratio = lshiftAndSaturate<24>(current);
AudioEngine::mastercompressor.rawRatio = lshiftAndSaturate<24>(current + 64);
break;

case CompParam::ATTACK:
@@ -367,7 +367,7 @@ ActionResult GlobalEffectable::modEncoderActionForNonExistentParam(int32_t offse

current = getLookupIndexFromValue(AudioEngine::mastercompressor.release >> 1, releaseRateTable, 50);
current += offset;
current = std::clamp(current, 2, 50);
current = std::clamp(current, 1, 50);
displayLevel = (current * 128) / 50;

AudioEngine::mastercompressor.release = releaseRateTable[current] << 1;