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

Set ringout for Reverb2 #1690

Merged
merged 1 commit into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions src/common/dsp/effect/Reverb2Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,22 @@ void Reverb2Effect::setvars(bool init)
calc_size(1.f);
}

void Reverb2Effect::update_rtime()
{
float t = BLOCK_SIZE_INV * ( samplerate * powf(2.f, *f[r2p_decay_time]) * 2.f); // *2 is to get the db120 time
ringout_time = (int)t;
}

void Reverb2Effect::process(float* dataL, float* dataR)
{
float scale = powf(2.f, 1.f * *f[r2p_room_size]);
calc_size(scale);

if (fabs(*f[r2p_decay_time] - last_decay_time) > 0.001f)
update_rtime();

last_decay_time = *f[r2p_decay_time];

float wetL alignas(16)[BLOCK_SIZE],
wetR alignas(16)[BLOCK_SIZE];

Expand Down
3 changes: 3 additions & 0 deletions src/common/dsp/effect/effect_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,9 @@ class Reverb2Effect : public Effect
return ringout_time;
}


private:
void update_rtime();
int ringout_time;
allpass _input_allpass[NUM_INPUT_ALLPASSES];
allpass _allpass[NUM_BLOCKS][NUM_ALLPASSES_PER_BLOCK];
Expand All @@ -556,4 +558,5 @@ class Reverb2Effect : public Effect
lipol<float, true> _lf_damp_coefficent;
lipol<float, true> _modulation;
quadr_osc _lfo;
float last_decay_time = -1.0;
};