Skip to content
Snippets Groups Projects
Commit 3011fa44 authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Reverb is now stereo

parent dd157ce2
No related branches found
No related tags found
No related merge requests found
...@@ -91,7 +91,7 @@ float rand_pitch_mod = 0.0f; ...@@ -91,7 +91,7 @@ float rand_pitch_mod = 0.0f;
// Actual audio-processing is orchestrated here // Actual audio-processing is orchestrated here
void AudioCallback(float **in, float **out, size_t size) { void AudioCallback(float **in, float **out, size_t size) {
float output = 0.0f; float output1, output2 = 0.0f;
float out1, out2; float out1, out2;
reverb.SetFeedback(reverb_decay); reverb.SetFeedback(reverb_decay);
reverb.SetLpFreq(reverb_tone); reverb.SetLpFreq(reverb_tone);
...@@ -223,27 +223,30 @@ void AudioCallback(float **in, float **out, size_t size) { ...@@ -223,27 +223,30 @@ void AudioCallback(float **in, float **out, size_t size) {
looper_out = saturate(volume * looper_out); looper_out = saturate(volume * looper_out);
// Mix the dry/Wet of the looper // Mix the dry/Wet of the looper
output = drywetmix * looper_out + in[1][i] * (1.0f - drywetmix); output1 = output2 = drywetmix * looper_out + in[1][i] * (1.0f - drywetmix);
// Compress the signal // Compress the signal
compressor.Process(output); compressor.Process(output1);
// Process reverb // Process reverb
reverb.Process(output, output, &out1, &out2); reverb.Process(output1, output1, &out1, &out2);
// Short decays are silent, so increase level here // Short decays are silent, so increase level here
float dec_fac = 1.0f + (1.0f - reverb_decay) * 2.0f; float dec_fac = 1.0f + (1.0f - reverb_decay) * 2.0f;
out1 = out1 * dec_fac; out1 = out1 * dec_fac;
out2 = out2 * dec_fac;
// Mix reverb with the dry signal depending on the amount dialed // Mix reverb with the dry signal depending on the amount dialed
output = output * (1.0f - reverbmix) + out1 * reverbmix; output1 = output1 * (1.0f - reverbmix) + out1 * reverbmix;
output2 = output1 * (1.0f - reverbmix) + out2 * reverbmix;
// Record the output if needed // Record the output if needed
if (ui.rec_source == REC_SOURCE_OUT) { if (ui.rec_source == REC_SOURCE_OUT) {
ui.activeLooper()->Record(output); ui.activeLooper()->Record(output1);
} }
out[0][i] = out[1][i] = output; out[0][i] = output1;
out[1][i] = output2;
} }
} }
......
...@@ -3,17 +3,12 @@ ...@@ -3,17 +3,12 @@
#include <MultiMap.h> #include <MultiMap.h>
// Lookup Table for Bipolar Curve with deadband
float bip_lookup[] = {0.0, 0.08060869565217388, 0.1597391304347826, 0.23886956521739133, 0.318, 0.3971304347826087, 0.47626086956521746, 0.5, 0.5, 0.5237391304347826, 0.6028695652173913, 0.6819999999999999, 0.7611304347826088, 0.8402608695652175, 0.9193913043478261, 1.0};
size_t bip_lookup_length = 16;
// Lookup Table for Pitch Knob // Lookup Table for Pitch Knob
float pitch_knob_lookup_x[] = {0.0, 0.0025, 0.0175, 0.0225, 0.0375, 0.0425, 0.057499999999999996, 0.0625, 0.0775, 0.0825, 0.0975, 0.10250000000000001, 0.1175, 0.1225, 0.1375, 0.14250000000000002, 0.1575, 0.1625, 0.1975, 0.2025, 0.2475, 0.2525, 0.2975, 0.3025, 0.3775, 0.3825, 0.4175, 0.4225, 0.4575, 0.4625, 0.4975, 0.5025, 0.5375000000000001, 0.5425, 0.5775000000000001, 0.5825, 0.6175, 0.6224999999999999, 0.6975, 0.7024999999999999, 0.7475, 0.7525, 0.7975000000000001, 0.8025, 0.8375, 0.8424999999999999, 0.8575, 0.8624999999999999, 0.8775000000000001, 0.8825, 0.8975000000000001, 0.9025, 0.9175000000000001, 0.9225, 0.9375, 0.9424999999999999, 0.9575, 0.9624999999999999, 0.9775, 0.9824999999999999, 0.9975, 1.0}; float pitch_knob_lookup_x[] = {0.0, 0.0025, 0.0175, 0.0225, 0.0375, 0.0425, 0.057499999999999996, 0.0625, 0.0775, 0.0825, 0.0975, 0.10250000000000001, 0.1175, 0.1225, 0.1375, 0.14250000000000002, 0.1575, 0.1625, 0.1975, 0.2025, 0.2475, 0.2525, 0.2975, 0.3025, 0.3775, 0.3825, 0.4175, 0.4225, 0.4575, 0.4625, 0.4975, 0.5025, 0.5375000000000001, 0.5425, 0.5775000000000001, 0.5825, 0.6175, 0.6224999999999999, 0.6975, 0.7024999999999999, 0.7475, 0.7525, 0.7975000000000001, 0.8025, 0.8375, 0.8424999999999999, 0.8575, 0.8624999999999999, 0.8775000000000001, 0.8825, 0.8975000000000001, 0.9025, 0.9175000000000001, 0.9225, 0.9375, 0.9424999999999999, 0.9575, 0.9624999999999999, 0.9775, 0.9824999999999999, 0.9975, 1.0};
float pitch_knob_lookup_y[] = {-1.0, -1.0, -0.9, -0.9, -0.8, -0.8, -0.7, -0.7, -0.6, -0.6, -0.5, -0.5, -0.4, -0.4, -0.3, -0.3, -0.2, -0.2, -0.1, -0.1, -0.05, -0.05, -0.025, -0.025, -0.0125, -0.0125, -0.00625, -0.00625, -0.003125, -0.003125, 0.0, 0.0, 0.003125, 0.003125, 0.00625, 0.00625, 0.0125, 0.0125, 0.025, 0.025, 0.05, 0.05, 0.1, 0.1, 0.2, 0.2, 0.3, 0.3, 0.4, 0.4, 0.5, 0.5, 0.6, 0.6, 0.7, 0.7, 0.8, 0.8, 0.9, 0.9, 1.0, 1.0}; float pitch_knob_lookup_y[] = {-1.0, -1.0, -0.9, -0.9, -0.8, -0.8, -0.7, -0.7, -0.6, -0.6, -0.5, -0.5, -0.4, -0.4, -0.3, -0.3, -0.2, -0.2, -0.1, -0.1, -0.05, -0.05, -0.025, -0.025, -0.0125, -0.0125, -0.00625, -0.00625, -0.003125, -0.003125, 0.0, 0.0, 0.003125, 0.003125, 0.00625, 0.00625, 0.0125, 0.0125, 0.025, 0.025, 0.05, 0.05, 0.1, 0.1, 0.2, 0.2, 0.3, 0.3, 0.4, 0.4, 0.5, 0.5, 0.6, 0.6, 0.7, 0.7, 0.8, 0.8, 0.9, 0.9, 1.0, 1.0};
size_t pitch_knob_lookup_length = 62; size_t pitch_knob_lookup_length = 62;
class Easer { class Easer {
float output = 0.0f; float output = 0.0f;
float delta = 0.0f; float delta = 0.0f;
...@@ -36,7 +31,6 @@ Easer::Easer() { ...@@ -36,7 +31,6 @@ Easer::Easer() {
}; };
float lerp(float a, float b, float f) { float lerp(float a, float b, float f) {
f = min(1.0f, max(0.0f, f)); f = min(1.0f, max(0.0f, f));
...@@ -45,19 +39,6 @@ float lerp(float a, float b, float f) { ...@@ -45,19 +39,6 @@ float lerp(float a, float b, float f) {
else { return a * (1.0f-f) + b * f; } else { return a * (1.0f-f) + b * f; }
} }
float get_from_table(float* table, float f, size_t length) {
f = min(1.0f, max(0.0f, f));
float pos = (length-1) * f;
float pos_frac = fmod(pos, 1.0f);
if (pos_frac == 0.0f) {
return table[int(pos)];
}
float a = table[int(floor(pos))];
float b = table[int(ceil(pos))];
if (a == b) { return a; }
return lerp(a, b, pos_frac);
}
float get_from_xy_table(float* xtable, float* ytable, float f, size_t length) { float get_from_xy_table(float* xtable, float* ytable, float f, size_t length) {
return multiMap<float>(f, xtable, ytable, length); return multiMap<float>(f, xtable, ytable, length);
} }
......
...@@ -55,7 +55,6 @@ class Potentiometer { ...@@ -55,7 +55,6 @@ class Potentiometer {
Potentiometer(int pin); Potentiometer(int pin);
void init(); void init();
void setLinear(); void setLinear();
void setBipolar();
void setPitch(); void setPitch();
void setSwitch(); void setSwitch();
float read(); float read();
...@@ -85,10 +84,6 @@ void Potentiometer::setLinear() { ...@@ -85,10 +84,6 @@ void Potentiometer::setLinear() {
this->mode = POT_MODE_LIN; this->mode = POT_MODE_LIN;
} }
void Potentiometer::setBipolar() {
this->mode = POT_MODE_BIP;
}
void Potentiometer::setPitch() { void Potentiometer::setPitch() {
this->mode = POT_MODE_PITCH; this->mode = POT_MODE_PITCH;
} }
...@@ -122,10 +117,6 @@ float Potentiometer::read() { ...@@ -122,10 +117,6 @@ float Potentiometer::read() {
// Depending on the Mode // Depending on the Mode
switch (this->mode) { switch (this->mode) {
case POT_MODE_BIP:
current_reading = get_from_table(bip_lookup, current_reading, bip_lookup_length);
current_reading = (current_reading - 0.5f) * 2.0f;
break;
case POT_MODE_PITCH: case POT_MODE_PITCH:
current_reading = get_from_xy_table(pitch_knob_lookup_x, pitch_knob_lookup_y, current_reading, pitch_knob_lookup_length); current_reading = get_from_xy_table(pitch_knob_lookup_x, pitch_knob_lookup_y, current_reading, pitch_knob_lookup_length);
break; break;
......
...@@ -92,7 +92,7 @@ enum FXMode { ...@@ -92,7 +92,7 @@ enum FXMode {
FX_MODE_NONE, FX_MODE_NONE,
FX_MODE_LFO, FX_MODE_LFO,
FX_MODE_GRAIN, FX_MODE_GRAIN,
FX_MODE_EMPTY, FX_MODE_FILTER,
FX_MODE_LAST, FX_MODE_LAST,
}; };
...@@ -464,6 +464,14 @@ class Ui { ...@@ -464,6 +464,14 @@ class Ui {
pot_7.setDisplayMode("Grain Var.", 100.0f, POT_DISPLAY_MODE_PERCENT); pot_7.setDisplayMode("Grain Var.", 100.0f, POT_DISPLAY_MODE_PERCENT);
}); });
// Select the active Effect (FILTER)
button_5.onPress([this, n](){
fx_mode = FX_MODE_FILTER;
pot_5.setDisplayMode("Lowpass", 100.0f, POT_DISPLAY_MODE_PERCENT);
pot_6.setDisplayMode("Highpass", 100.0f, POT_DISPLAY_MODE_PERCENT);
pot_7.setDisplayMode("Resonance", 100.0f, POT_DISPLAY_MODE_PERCENT);
});
// Store the last ui mode, for the check on top // Store the last ui mode, for the check on top
last_ui_mode = ui_mode; last_ui_mode = ui_mode;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment