fix MIDI CC messages

This commit is contained in:
Vasilii Milovidov 2023-09-03 15:54:34 +04:00
parent c5738aeed9
commit 97f84ee87f

View File

@ -3,6 +3,7 @@ import { Pattern, noteToMidi } from '@strudel.cycles/core';
const ON_MESSAGE = 0x90;
const OFF_MESSAGE = 0x80;
const CC_MESSAGE = 0xb0;
Pattern.prototype.midi = function (output) {
return this.onTrigger((time, hap, currentTime) => {
@ -37,14 +38,9 @@ Pattern.prototype.midi = function (output) {
const scaled = Math.round(ccv * 127);
messagesfromjs.push({
requestedport,
message: [ON_MESSAGE + midichan, ccn, scaled],
message: [CC_MESSAGE + midichan, ccn, scaled],
offset: roundedOffset,
});
messagesfromjs.push({
requestedport,
message: [OFF_MESSAGE + midichan, ccn, scaled],
offset: roundedOffset + duration,
});
}
// invoke is temporarily blocking, run in an async process
if (messagesfromjs.length) {