processMidiMessage method
void
processMidiMessage({})
Implementation
void processMidiMessage({required int channel, required int command, required int data1, required int data2}) {
if (!(0 <= channel && channel < channels.length)) {
return;
}
var channelInfo = channels[channel];
switch (command) {
case 0x80: // Note Off
noteOff(channel: channel, key: data1);
break;
case 0x90: // Note On
noteOn(channel: channel, key: data1, velocity: data2);
break;
case 0xB0: // Controller
switch (data1) {
case 0x00: // Bank Selection
channelInfo.setBank(data2);
break;
case 0x01: // Modulation Coarse
channelInfo.setModulationCoarse(data2);
break;
case 0x21: // Modulation Fine
channelInfo.setModulationFine(data2);
break;
case 0x06: // Data Entry Coarse
channelInfo.dataEntryCoarse(data2);
break;
case 0x26: // Data Entry Fine
channelInfo.dataEntryFine(data2);
break;
case 0x07: // Channel Volume Coarse
channelInfo.setVolumeCoarse(data2);
break;
case 0x27: // Channel Volume Fine
channelInfo.setVolumeFine(data2);
break;
case 0x0A: // Pan Coarse
channelInfo.setPanCoarse(data2);
break;
case 0x2A: // Pan Fine
channelInfo.setPanFine(data2);
break;
case 0x0B: // Expression Coarse
channelInfo.setExpressionCoarse(data2);
break;
case 0x2B: // Expression Fine
channelInfo.setExpressionFine(data2);
break;
case 0x40: // Hold Pedal
channelInfo.setHoldPedal(data2);
break;
case 0x5B: // Reverb Send
channelInfo.setReverbSend(data2);
break;
case 0x5D: // Chorus Send
channelInfo.setChorusSend(data2);
break;
case 0x65: // RPN Coarse
channelInfo.setRpnCoarse(data2);
break;
case 0x64: // RPN Fine
channelInfo.setRpnFine(data2);
break;
case 0x78: // All Sound Off
noteOffAll(channel: channel, immediate: true);
break;
case 0x79: // Reset All Controllers
resetAllControllers(channel: channel);
break;
case 0x7B: // All Note Off
noteOffAll(channel: channel, immediate: false);
break;
}
break;
case 0xC0: // Program Change
channelInfo.setPatch(data1);
break;
case 0xE0: // Pitch Bend
channelInfo.setPitchBend(data1, data2);
break;
}
}