Skip to content

Commit

Permalink
Avoid running early or late algorithm if level is set to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwillis committed Jun 9, 2020
1 parent 0050389 commit d2f68ce
Show file tree
Hide file tree
Showing 8 changed files with 26,192 additions and 65 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Dragonfly Reverb is a bundle of free audio effects for Linux, MacOS, and Windows

## Download

* **[Linux](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.0.0/DragonflyReverb-Linux-64bit-v3.0.0.tgz)**
* **[MacOS](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.0.0/DragonflyReverb-MacOS-64bit-v3.0.0.zip)**
* **[Windows (32 bit)](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.0.0/DragonflyReverb-Windows-32bit-v3.0.0.zip)**
* **[Windows (64 bit)](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.0.0/DragonflyReverb-Windows-64bit-v3.0.0.zip)**
* **[Linux](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.1.1/DragonflyReverb-Linux-64bit-v3.1.1.tgz)**
* **[MacOS](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.1.1/DragonflyReverb-MacOS-64bit-v3.1.1.zip)**
* **[Windows (32 bit)](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.1.1/DragonflyReverb-Windows-32bit-v3.1.1.zip)**
* **[Windows (64 bit)](https://github.com/michaelwillis/dragonfly-reverb/releases/download/3.1.1/DragonflyReverb-Windows-64bit-v3.1.1.zip)**

## Dependencies

Expand Down
2 changes: 1 addition & 1 deletion common/DragonflyVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@

#define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define PATCH_VERSION 0
#define PATCH_VERSION 1
#define VERSION_SUFFIX ""
26,099 changes: 26,099 additions & 0 deletions common/stuff

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/donations.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="header">
<a href="index.html"><img src="images/title.png" alt="Dragonfly Reverb" /></a>
<div class="navigation">
<a href="https://github.com/michaelwillis/dragonfly-reverb/releases/tag/3.0.0">
<a href="https://github.com/michaelwillis/dragonfly-reverb/releases/tag/3.1.1">
<svg viewBox="-6 -2 16 16" height="32" width="36" aria-hidden="true"><path fill-rule="evenodd" d="M7 7V3H3v4H0l5 6 5-6H7z"></path></svg>
Download
</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="header">
<a href="index.html"><img src="images/title.png" alt="Dragonfly Reverb" /></a>
<div class="navigation">
<a href="https://github.com/michaelwillis/dragonfly-reverb/releases/tag/3.0.0">
<a href="https://github.com/michaelwillis/dragonfly-reverb/releases/tag/3.1.1">
<svg viewBox="-6 -2 16 16" height="32" width="36" aria-hidden="true"><path fill-rule="evenodd" d="M7 7V3H3v4H0l5 6 5-6H7z"></path></svg>
Download
</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/manuals.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="header">
<a href="index.html"><img src="images/title.png" alt="Dragonfly Reverb" /></a>
<div class="navigation">
<a href="https://github.com/michaelwillis/dragonfly-reverb/releases/tag/3.0.0">
<a href="https://github.com/michaelwillis/dragonfly-reverb/releases/tag/3.1.1">
<svg viewBox="-6 -2 16 16" height="32" width="36" aria-hidden="true"><path fill-rule="evenodd" d="M7 7V3H3v4H0l5 6 5-6H7z"></path></svg>
Download
</a>
Expand Down
71 changes: 43 additions & 28 deletions plugins/dragonfly-hall-reverb/DSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,45 +109,60 @@ void DragonflyReverbDSP::run(const float** inputs, float** outputs, uint32_t fra
for (uint32_t offset = 0; offset < frames; offset += BUFFER_SIZE) {
long int buffer_frames = frames - offset < BUFFER_SIZE ? frames - offset : BUFFER_SIZE;

early.processreplace(
const_cast<float *>(inputs[0] + offset),
const_cast<float *>(inputs[1] + offset),
early_out_buffer[0],
early_out_buffer[1],
buffer_frames
);

for (uint32_t i = 0; i < buffer_frames; i++) {
late_in_buffer[0][i] = early_send * early_out_buffer[0][i] + inputs[0][offset + i];
late_in_buffer[1][i] = early_send * early_out_buffer[1][i] + inputs[1][offset + i];
if (early_level > 0.0 || early_send > 0.0){
early.processreplace(
const_cast<float *>(inputs[0] + offset),
const_cast<float *>(inputs[1] + offset),
early_out_buffer[0],
early_out_buffer[1],
buffer_frames);

for (uint32_t i = 0; i < buffer_frames; i++) {
late_in_buffer[0][i] = early_send * early_out_buffer[0][i] + inputs[0][offset + i];
late_in_buffer[1][i] = early_send * early_out_buffer[1][i] + inputs[1][offset + i];
}
} else if (late_level > 0.0) {
for (uint32_t i = 0; i < buffer_frames; i++) {
late_in_buffer[0][i] = inputs[0][offset + i];
late_in_buffer[1][i] = inputs[1][offset + i];
}
}

late.processreplace(
const_cast<float *>(late_in_buffer[0]),
const_cast<float *>(late_in_buffer[1]),
late_out_buffer[0],
late_out_buffer[1],
buffer_frames
);

if( late_level > 0.0 ) {
late.processreplace(
const_cast<float *>(late_in_buffer[0]),
const_cast<float *>(late_in_buffer[1]),
late_out_buffer[0],
late_out_buffer[1],
buffer_frames
);
}

for (uint32_t i = 0; i < buffer_frames; i++) {
outputs[0][offset + i] =
dry_level * inputs[0][offset + i] +
early_level * early_out_buffer[0][i] +
late_level * late_out_buffer[0][i];

outputs[1][offset + i] =
dry_level * inputs[1][offset + i] +
early_level * early_out_buffer[1][i] +
late_level * late_out_buffer[1][i];
outputs[0][offset + i] = 0.0;
outputs[1][offset + i] = 0.0;

if( dry_level > 0.0 ){
outputs[0][offset + i] += dry_level * inputs[0][offset + i] ;
outputs[1][offset + i] += dry_level * inputs[1][offset + i] ;
}
if( early_level > 0.0 ){
outputs[0][offset + i] += early_level * early_out_buffer[0][i] ;
outputs[1][offset + i] += early_level * early_out_buffer[1][i] ;
}
if( late_level > 0.0 ){
outputs[0][offset + i] += late_level * late_out_buffer[0][i] ;
outputs[1][offset + i] += late_level * late_out_buffer[1][i] ;
}

if (outputs[0][offset + i] != 0 || outputs[1][offset + i] != 0) {
outputIdle = false;
}
}
}
}

if (inputIdle && outputIdle) {
idle = true;
}
Expand Down
71 changes: 42 additions & 29 deletions plugins/dragonfly-room-reverb/DSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,37 +113,50 @@ void DragonflyReverbDSP::run(const float** inputs, float** outputs, uint32_t fra
filtered_input_buffer[1][i] = input_lpf_1.process(input_hpf_1.process(inputs[1][offset + i]));
}

early.processreplace(
const_cast<float *>(filtered_input_buffer[0]),
const_cast<float *>(filtered_input_buffer[1]),
early_out_buffer[0],
early_out_buffer[1],
buffer_frames
);

for (uint32_t i = 0; i < buffer_frames; i++) {
late_in_buffer[0][i] = early_send * early_out_buffer[0][i] + filtered_input_buffer[0][i];
late_in_buffer[1][i] = early_send * early_out_buffer[1][i] + filtered_input_buffer[1][i];
if( early_level > 0.0 || early_send > 0.0){
early.processreplace(
const_cast<float *>(filtered_input_buffer[0]),
const_cast<float *>(filtered_input_buffer[1]),
early_out_buffer[0],
early_out_buffer[1],
buffer_frames);

for (uint32_t i = 0; i < buffer_frames; i++) {
late_in_buffer[0][i] = early_send * early_out_buffer[0][i] + filtered_input_buffer[0][i];
late_in_buffer[1][i] = early_send * early_out_buffer[1][i] + filtered_input_buffer[1][i];
}
} else if (late_level > 0.0) {
for (uint32_t i = 0; i < buffer_frames; i++) {
late_in_buffer[0][i] = filtered_input_buffer[0][i];
late_in_buffer[1][i] = filtered_input_buffer[1][i];
}
}

late.processreplace(
const_cast<float *>(late_in_buffer[0]),
const_cast<float *>(late_in_buffer[1]),
late_out_buffer[0],
late_out_buffer[1],
buffer_frames
);


if (late_level > 0.0) {
late.processreplace(
const_cast<float *>(late_in_buffer[0]),
const_cast<float *>(late_in_buffer[1]),
late_out_buffer[0],
late_out_buffer[1],
buffer_frames);
}

for (uint32_t i = 0; i < buffer_frames; i++) {
outputs[0][offset + i] =
dry_level * inputs[0][offset + i] +
early_level * early_out_buffer[0][i] +
late_level * late_out_buffer[0][i] * LATE_GAIN;

outputs[1][offset + i] =
dry_level * inputs[1][offset + i] +
early_level * early_out_buffer[1][i] +
late_level * late_out_buffer[1][i] * LATE_GAIN;
outputs[0][offset + i] = 0.0 ;
outputs[1][offset + i] = 0.0 ;

if( dry_level > 0.0 ){
outputs[0][offset + i] += dry_level * inputs[0][offset + i] ;
outputs[1][offset + i] += dry_level * inputs[1][offset + i] ;
}
if( early_level > 0.0 ){
outputs[0][offset + i] += early_level * early_out_buffer[0][i] ;
outputs[1][offset + i] += early_level * early_out_buffer[1][i] ;
}
if( late_level > 0.0 ){
outputs[0][offset + i] += late_level * late_out_buffer[0][i] * LATE_GAIN ;
outputs[1][offset + i] += late_level * late_out_buffer[1][i] * LATE_GAIN ;
}
}
}
}
Expand Down

0 comments on commit d2f68ce

Please sign in to comment.