0
mirror of https://github.com/torvalds/GuitarPedal.git synced 2026-06-07 04:55:36 +00:00
Files
Linus Torvalds c88f369fd3 Fix up lots more default pot settings
Bah.  It wasn't just the echo that had gotten messed up in the
conversion to the new and more legible pot metadata.

The *new* metadata defaults are pretty clear and obvious, but the old
ones were not, and I clearly should have been a whole lot more careful
in converting them, because half the effects had various messed up
default values.  Lots of "zero meant pot at noon - so float value 0.5"
turned into just plain "zero means zero".

So I do think the new model is a lot better, but "Mistakes were made".

I tried to go through every effect and double-check it against what it
used to be.  Not that all the old defaults were sane (I'm looking at
you, boost effect), but the metadata conversion wasn't meant to change
them.

Fixes: 9c208692f7 ("Convert effects to metadata-driven boiler plate generation")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-06-01 08:34:11 -07:00

37 lines
1.2 KiB
C

// NAME: Vibrato [VIB]
// PRIORITY: 70
// POT: "Rate" FREQUENCY(0.1 8.0) = 2.0 Hz
// POT: "Depth" LINEAR(0.0 5.0) = 0.875 ms
// POT: "Mix" LINEAR(0.0 1.0) = 1.0
// Vibrato: LFO-modulated delay line for a classic Doppler shift.
// Blending dry signal with the wet signal produces a rich chorus-like effect.
// At 100% wet only the pitch-shifted signal is audible; fun for rotary speaker emulation.
#define VIBRATO_CENTER_SAMPLES (6.0f * SAMPLES_PER_MSEC)
static struct {
struct lfo_state lfo;
float depth; // delay amplitude in samples
float dry, wet; // equal-power gain coefficients
unsigned int idx;
float samples[1024]; // ~21ms at 48kHz; max read = center(6ms) + depth(5ms) = 528 samples
} vibrato;
static void vibrato_init(unsigned char pot[10])
{
set_lfo_freq(&vibrato.lfo, vibrato_pot0(pot[0]));
vibrato.depth = vibrato_pot1(pot[1]) * SAMPLES_PER_MSEC;
struct sincos w = fastsincos(0.25f * vibrato_pot2(pot[2]));
vibrato.dry = w.cos;
vibrato.wet = w.sin;
}
static float vibrato_step(float in)
{
float d = VIBRATO_CENTER_SAMPLES + vibrato.depth * lfo_step(&vibrato.lfo, lfo_sinewave);
sample_array_write(in, &vibrato.idx, vibrato.samples);
float wet = sample_array_read(d, &vibrato.idx, vibrato.samples);
return vibrato.dry * in + vibrato.wet * wet;
}