sync start / stop automatically too

This commit is contained in:
Felix Roos 2023-09-27 22:28:52 +02:00
parent dea1c31701
commit f11462bf41

View File

@ -78,6 +78,20 @@ function getDevice(output, outputs) {
return IACOutput ?? outputs[0];
}
// send start/stop messages to outputs when repl starts/stops
if (typeof window !== 'undefined') {
window.addEventListener('message', (e) => {
if (!WebMidi?.enabled) {
return;
}
if (e.data === 'strudel-stop') {
WebMidi.outputs.forEach((output) => output.sendStop());
} else if (e.data === 'strudel-start') {
WebMidi.outputs.forEach((output) => output.sendStart());
}
});
}
Pattern.prototype.midi = function (output) {
if (isPattern(output)) {
throw new Error(