Skip to content

Midi support for preset switching - #109

Merged
xconverge merged 9 commits into
bkshepherd:mainfrom
optilude:midi-preset
Oct 10, 2026
Merged

xconverge merged 9 commits into
bkshepherd:mainfrom
optilude:midi-preset

Conversation

@optilude

@optilude optilude commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

This adds support for using MIDI bank select (CC0, CC32) to control the preset number.

I'm using it to switch both effects and presets from my loop switcher (https://github.com/optilude/LoopSwitcher).

There is one backwards-incompatible change: CC32 in MIDI is reserved for bank select, but was being used by two effects as part of standard parameter mappings. I've remapped these to a higher number.

@xconverge

Copy link
Copy Markdown
Collaborator

I can't come up with a completely foolproof way to do his, but we should probably add an assert or compile time check on the CC values. We could also just make a github CI action step to handle it, but there has to be a clean way hmmm

Something like:

consteval int midiCC(int cc) {
    if (cc < -1 || cc > 127 || cc == 0 || cc == 32) {
        throw "Invalid MIDI CC mapping";
    }
    return cc;
}

Then tweak all parameters in all modules to use it:

ParameterMetaData param {
    // ...
    .midiCCMapping = midiCC(10),  // OK
};

Any ideas? This could be out of scope for this MR, but just tossing it out there. I don't use midi but that loop switcher IS mighty tempting...

@optilude

Copy link
Copy Markdown
Contributor Author

You know you want one…

I originally didn’t include MIDI in it (I’d also never used it) and then ended up grafting it on at the end because of the use case of toggling different reverbs in this pedal from the stomp switches on the looper. The switcher is mono and before the amp; I run the multi fx in stereo and after the amp so it had to be this way.

I agree a check like that would be useful but on some level MIDI is always quite context specific. Even if I hadn’t remapped those two fx parameters, it would only be an issue if someone had that particular effect active and sent that particular bank select command because they were switching presets.

I reckon let’s solve that problem if someone has it. I’d never have noticed (and maybe no one ever would have) unless the implementation agent did a scan of the other midi mappings. MIDI has various reserved parameters I think but it’s all just convention, so who knows if the person implementing a new effect takes care to consider those and test…

@xconverge
xconverge merged commit 8e9f468 into bkshepherd:main Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants