selectPreset method
void
selectPreset(
{ - required int channel,
- required int preset,
})
Implementation
void selectPreset({required int channel, required int preset}) {
if (preset >= this.soundFont.presets.length) {
throw 'selectInstrumentPreset: invalid preset $preset >= ${this.soundFont.presets.length}';
}
this.processMidiMessage(
channel: channel,
command: 0xC0, // program change
data1: this.soundFont.presets[preset].patchNumber,
data2: 0);
this.processMidiMessage(
channel: channel,
command: 0xB0, // control change
data1: 0x00, // bank select
data2: this.soundFont.presets[preset].bankNumber,
);
}