Skip to content

Commit

Permalink
show actual attack and release in ms
Browse files Browse the repository at this point in the history
  • Loading branch information
m-m-adams committed Nov 9, 2023
1 parent bde447d commit fdbac73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/deluge/dsp/master_compressor/master_compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class MasterCompressor {
//attack/release in ms
int32_t getAttack() { return attackms; }
void setAttack(int32_t attack) {
a_ = (-1000.0 / 44100) / (float(attack));
a_ = (-1000.0 / 44100) / (5 + float(attack) / 2);
attackms = attack;
};
int32_t getRelease() { return releasems; }
void setRelease(int32_t release) {
r_ = (-1000.0 / 44100) / (float(10 * release));
r_ = (-1000.0 / 44100) / (50 + 4 * float(release));
releasems = release;
};
q31_t getThreshold() { return rawThreshold; }
Expand Down
9 changes: 5 additions & 4 deletions src/deluge/model/global_effectable/global_effectable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,19 +358,20 @@ ActionResult GlobalEffectable::modEncoderActionForNonExistentParam(int32_t offse
case CompParam::ATTACK:
current = AudioEngine::mastercompressor.getAttack() - 64;
current += offset;
current = std::clamp(current, -63, 64);
current = std::clamp(current, -64, 64);
ledLevel = (64 + current);
displayLevel = ((ledLevel)*kMaxMenuValue) / 128;
//in ms
displayLevel = 5 + (ledLevel >> 1);

AudioEngine::mastercompressor.setAttack(current + 64);
break;

case CompParam::RELEASE:
current = AudioEngine::mastercompressor.getRelease() - 64;
current += offset;
current = std::clamp(current, -63, 64);
current = std::clamp(current, -64, 64);
ledLevel = (64 + current);
displayLevel = ((ledLevel)*kMaxMenuValue) / 128;
displayLevel = 50 + 4 * ledLevel;

AudioEngine::mastercompressor.setRelease(current + 64);
break;
Expand Down

0 comments on commit fdbac73

Please sign in to comment.