You've already forked torvalds-GuitarPedal
mirror of
https://github.com/torvalds/GuitarPedal.git
synced 2026-08-18 21:26:54 +00:00
'Software' was the directory everything that was not KiCad ended up in, which stopped describing anything a while ago - Validation and the web app are software too. Worse, it put the shared parts inside the firmware, where they read as the firmware's own. They are not. Effects/ has three consumers built from it: the firmware, Validation's bench, and the web app's controls, all generated from the same POT: comments by gen_effects.py. Audio/ has two - the bench compiles the same biquads, the same envelope followers and the same single_sample(), which is the whole reason a measurement on a workstation says anything about the pedal. Neither belongs under Firmware/, so neither is under it any more: Effects/ one file per effect Audio/ the DSP they are built from, and the audio loop Firmware/ the rest of what runs on the pedal, and the submodules WebMIDI/ the web app scripts/ what the build runs Validation/ unchanged Hardware/, Documentation/, Images/ CMakeLists.txt and the wrapper Makefile move to the top with them, because the build now consumes four of those directories and generates into a fifth. board.local and build/ come along; MIDI_CC_MAP.md is generated into Documentation/ rather than into the old Software/ root. scripts/ goes with the build rather than staying under the firmware, because six of the ten had nothing to do with the firmware: gen_effects.py reads Effects/ and writes to three different places, pow2/log2/quarter_sine generate Audio/'s tables, check-readme.py compares Effects/ against the README, and server.py serves the web app. Four of them are invoked from Validation, which was reaching into Firmware/ for tooling - the same burying this commit is undoing. The four that really are about the firmware are ELF checks the top-level build drives anyway, and a second scripts directory would only be a second place to look. C includes say "Audio/foo.h" and the generated map says "Effects/bar.h", with the repository root on the include path for both the firmware and the bench. Spelling the directory out rather than relying on a bare name is what keeps Audio/cycles.h shimmable: a quoted include searches the including file's own directory first. The submodules are renamed as well as moved. git mv updates their paths but leaves the section names, and 'Software/pico-sdk' surviving in .gitmodules would be the word this commit removes, still load-bearing. That meant the nested modules under pico-sdk too - six .git files pointing into .git/modules/Software - which is why 'git submodule update --init --recursive' is worth running once after pulling this. Verified rather than assumed: a clean configure and build, make check (failing only on the missing-eeprom case it already failed on), check-effects, all four analysis pages reproducing every series and drawing every chart, and a flash to the board that still measures a routed reverb where it did before. One latent bug fell out of it. bench/coeff declared only quarter_sine.h of the three generated math tables, and Audio/util.h includes pow2.h and log2.h as well - so building that target with an empty gen/ could never have worked. 'make bench' builds bench/bench first, which generates all three, so it stayed hidden until this rebuilt everything from nothing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
82 lines
2.8 KiB
C
82 lines
2.8 KiB
C
// NAME: Settings [SETTINGS]
|
|
// PRIORITY: 130
|
|
// MIX: NONE // it isn't an effect, and there is nothing to mix
|
|
// POT: "USB L/R Out" ENUM(None Wet Dry Wet/Dry) = Dry
|
|
// POT: "USB L/R In" ENUM(Off Pre-FX Mix) = Off
|
|
// POT: "MIDI Ch" ENUM(Omni Ch1 Ch2 Ch3 Ch4 Ch5 Ch6 Ch7 Ch8 Ch9 Ch10 Ch11 Ch12 Ch13 Ch14 Ch15 Ch16) = Omni
|
|
// POT: "LED" LINEAR(0 100) = 10 %
|
|
// POT: " ATTN" LINEAR(0 100) = 50 %
|
|
// POT: "Tuning" ENUM(EADGBE DADGAD BEADGC EADG) = EADGBE
|
|
//
|
|
// Which pot the app has to be able to find rather than merely show. It
|
|
// filters Control Change and Program Change by this, so the app has to
|
|
// transmit on the same one or bypass, the tuner and scene changes stop
|
|
// arriving - and it used to find the pot by matching the label above,
|
|
// which made renaming that label a silent way to break it.
|
|
//
|
|
// ROLE: CHANNEL:MIDI_CH
|
|
//
|
|
// Settings "effect" - dummy effect to save various settings
|
|
//
|
|
enum usb_output {
|
|
LR_None, LR_Wet, LR_Dry, LR_WetDry,
|
|
};
|
|
|
|
enum usb_input {
|
|
USB_IN_OFF, USB_IN_PRE_FX, USB_IN_MIX
|
|
};
|
|
|
|
struct {
|
|
enum usb_output usb_output;
|
|
enum usb_input usb_input;
|
|
int midi_channel;
|
|
float led_pwm, led_intense;
|
|
int tuning;
|
|
} settings;
|
|
|
|
static void settings_init(unsigned char pot[10])
|
|
{
|
|
settings.usb_output = pot[SETTINGS_USB_L_R_OUT];
|
|
settings.usb_input = pot[SETTINGS_USB_L_R_IN];
|
|
settings.midi_channel = pot[SETTINGS_MIDI_CH];
|
|
|
|
settings.led_pwm = settings_led_pot(pot) / 100;
|
|
|
|
//
|
|
// The attention brightness is the one setting whose effect you
|
|
// cannot see while you are setting it, because the only thing
|
|
// that can show it is the LED going into that mode. So ask it
|
|
// to, for half a second, whenever the setting moves - or for as
|
|
// long as this is the pot being edited from the pedal itself,
|
|
// where you are looking at the LED and not at a browser.
|
|
//
|
|
// This is also what the second LED used to do, back when there
|
|
// was one to do it with.
|
|
//
|
|
float intense = settings_attn_pot(pot) / 100;
|
|
if (intense != settings.led_intense ||
|
|
settings_effect.active_pot == SETTINGS_ATTN)
|
|
attention_preview = ATTENTION_PREVIEW_TICKS;
|
|
settings.led_intense = intense;
|
|
|
|
settings.tuning = pot[SETTINGS_TUNING];
|
|
}
|
|
|
|
//
|
|
// There is no audio here, and that is the point.
|
|
//
|
|
// This exists to carry settings, and init() above is the whole of it.
|
|
// It cannot even be routed: ROUTABLE_EFFECTS in blink.c is the bits
|
|
// between the signal chain and this, so neither end can be put in a
|
|
// chain, and this function is unreachable by construction. Declaring
|
|
// it 'MIX: NONE' says so in the one place a reader will look, and means
|
|
// nothing generates a mixing wrapper for a thing that makes no sound.
|
|
//
|
|
// It also stops init() from having to lie about being enabled to keep
|
|
// itself scheduled. See make_one_noise().
|
|
//
|
|
static inline sample_t settings_step(sample_t in)
|
|
{
|
|
return in;
|
|
}
|