Add learnable MIDI pedal controls with hot-plug support
This commit is contained in:
4
frontend/midi.test.js
Normal file
4
frontend/midi.test.js
Normal file
@@ -0,0 +1,4 @@
|
||||
const { test } = require('node:test'), assert = require('node:assert/strict');
|
||||
const { decode, createGate } = require('./midi');
|
||||
test('MIDI note-off and zero velocity release notes; CC uses switch threshold', () => { assert.deepEqual(decode([0x92, 60, 80]), { key: 'note:2:60', down: true }); assert.equal(decode([0x82, 60, 64]).down, false); assert.equal(decode([0x92, 60, 0]).down, false); assert.equal(decode([0xb0, 64, 63]).down, false); assert.equal(decode([0xb0, 64, 64]).down, true); assert.equal(decode([0xf8]), null); });
|
||||
test('held pedals trigger once, releases re-arm, different devices remain independent', () => { const gate = createGate(), down = decode([0xb0, 64, 127]), up = decode([0xb0, 64, 0]); assert.equal(gate.accept('one', down), true); assert.equal(gate.accept('one', down), false); assert.equal(gate.accept('two', down), true); gate.accept('one', up); assert.equal(gate.accept('one', down), true); gate.reset(); assert.equal(gate.accept('two', down), true); });
|
||||
Reference in New Issue
Block a user