Merge pull request #690 from vasilymilovidov/main

fix MIDI CC messages
This commit is contained in:
Felix Roos 2023-09-03 22:19:22 +02:00 committed by GitHub
commit abaeb52b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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) {