Merge pull request #936 from Enelg52/midi-issues

fix midi issue on firefox and added quote error
This commit is contained in:
Felix Roos 2024-02-25 14:15:30 +01:00 committed by GitHub
commit 325152c782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,10 +167,16 @@ let listeners = {};
const refs = {};
export async function midin(input) {
if (isPattern(input)) {
throw new Error(
`.midi does not accept Pattern input. Make sure to pass device name with single quotes. Example: .midi('${
WebMidi.outputs?.[0]?.name || 'IAC Driver Bus 1'
}')`,
);
}
const initial = await enableWebMidi(); // only returns on first init
const device = getDevice(input, WebMidi.inputs);
if (initial) {
if (initial || WebMidi.enabled) {
const otherInputs = WebMidi.inputs.filter((o) => o.name !== device.name);
logger(
`Midi enabled! Using "${device.name}". ${