Fix midi cc input and add examples

This commit is contained in:
2023-10-07 13:29:46 +03:00
parent 15e47ec4cb
commit 9fb253ef65
3 changed files with 37 additions and 64 deletions

View File

@ -301,8 +301,6 @@ export class MidiConnection {
this.lastNoteInChannel[channel] = {note, velocity, channel, timestamp: event.timeStamp};
if(this.settings.midi_channels_scripts) this.api.script(channel);
//console.log(`NOTE: ${note} VELOCITY: ${velocity} CHANNEL: ${channel}`);
this.pushToMidiInputBuffer({note, velocity, channel, timestamp: event.timeStamp});
this.activeNotes.push({note, velocity, channel, timestamp: event.timeStamp});
@ -320,13 +318,18 @@ export class MidiConnection {
// If message is one of CCs
if(message.data[0]>=0xB0 && message.data[0]<=0xBF) {
const channel = message.data[0] - 0xB0 + 1;
const control = message.data[1];
const value = message.data[2];
this.lastCC[control] = value;
this.lastCCInChannel[channel][control] = value;
if(this.lastCCInChannel[channel]) {
this.lastCCInChannel[channel][control] = value;
} else {
this.lastCCInChannel[channel] = {};
this.lastCCInChannel[channel][control] = value;
}
//console.log(`CC: ${control} VALUE: ${value} CHANNEL: ${channel}`);