Open mickmister opened 1 year ago
I created a gist containing the types for the config and an example config https://gist.github.com/mickmister/197aa87f8e4331769dc917713dc26f7f
Here are the types from there as of posting:
export type MusicalKeyboardConfig = {
channel: number;
}
export type MidiTriggerConfig = {
channel: number;
note: number;
}
export enum ControlButtonName {
A1 = 'A1',
A2 = 'A2',
A3 = 'A3',
A4 = 'A4',
B1 = 'B1',
B2 = 'B2',
B3 = 'B3',
B4 = 'B4',
}
export type ControlButtonMap = Partial<Record<ControlButtonName, MidiTriggerConfig>>;
export type MidiInputConfig = {
name: string;
alias?: string;
musicalKeyboard?: MusicalKeyboardConfig;
sustainPedal?: MidiTriggerConfig;
mainTrigger?: MidiTriggerConfig;
controlButtons?: ControlButtonMap;
}
export type MidiOutputConfig = {
name: string;
alias?: string;
musicalKeyboard?: MusicalKeyboardConfig;
}
export type Config = {
midi: {
inputs: MidiInputConfig[];
outputs: MidiOutputConfig[];
};
}
The UI should:
To edit the configuration of a MIDI input, we need to have a UI to edit this type:
For the visual aspect of the feature, I think the bare minimum would be to have a UI that literally looks like this:
You would click the word "musicalKeyboard" to:
noteon
event, from the specific MIDI input device you're configuringchannel
from the eventchannel
to configure the "musicalKeyboard" structurechannel
andnote
from the midi event and use them to construct theMidiTriggerConfig
Then the user can click save to have the config saved to localStorage. Would be cool to show the raw JSON at the bottom of the screen in a
<pre>
tag, to make it portable and also show that its persisted structure.For the
ControlButtonMap
, I think we can:We'd also want a way to "clear" a choice. Like if I accidentally assigned something to A1 and I actually don't want anything assigned to A1, I should be able to remove that assignment. I'm thinking we should disallow mapping a trigger to multiple actions for now. This will result in less room for human error.