fix desktop midi
This commit is contained in:
parent
8e4549d6d3
commit
183d3ea4a1
2 changed files with 5 additions and 3 deletions
|
|
@ -6,9 +6,11 @@ const OFF_MESSAGE = 0x80;
|
|||
const CC_MESSAGE = 0xb0;
|
||||
|
||||
Pattern.prototype.midi = function (output) {
|
||||
return this.onTrigger((time, hap, currentTime, cps) => {
|
||||
return this.onTrigger((time, hap, currentTime, cps, targetTime) => {
|
||||
let { note, nrpnn, nrpv, ccn, ccv, velocity = 0.9, gain = 1 } = hap.value;
|
||||
const offset = (time - currentTime) * 1000;
|
||||
//magic number to get audio engine to line up, can probably be calculated somehow
|
||||
const latency = 0.03;
|
||||
const offset = (targetTime - currentTime + latency) * 1000;
|
||||
velocity = Math.floor(gain * velocity * 100);
|
||||
const duration = Math.floor((hap.duration.valueOf() / cps) * 1000 - 10);
|
||||
const roundedOffset = Math.round(offset);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ Pattern.prototype.midi = function (output) {
|
|||
logger(`Midi device disconnected! Available: ${getMidiDeviceNamesString(outputs)}`),
|
||||
});
|
||||
|
||||
return this.onTrigger((time, hap, currentTime, cps, targetTime) => {
|
||||
return this.onTrigger((time_deprecate, hap, currentTime, cps, targetTime) => {
|
||||
if (!WebMidi.enabled) {
|
||||
console.log('not enabled');
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue