add sysex message support
This commit is contained in:
@ -222,6 +222,15 @@ export class UserAPI {
|
||||
this.MidiConnection.sendMidiNote(note, channel, velocity, duration)
|
||||
}
|
||||
|
||||
public sysex(data: Array<number>): void {
|
||||
/**
|
||||
* Sends a MIDI sysex message to the current MIDI output.
|
||||
*
|
||||
* @param data - The sysex data to send
|
||||
*/
|
||||
this.MidiConnection.sendSysExMessage(data)
|
||||
}
|
||||
|
||||
public midi_clock(): void {
|
||||
/**
|
||||
* Sends a MIDI clock to the current MIDI output.
|
||||
|
||||
@ -50,7 +50,6 @@ export class MidiConnection{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public sendMidiClock(): void {
|
||||
/**
|
||||
* Sends a single MIDI clock message to the currently selected MIDI output.
|
||||
@ -62,7 +61,6 @@ export class MidiConnection{
|
||||
console.error('MIDI output not available.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public switchMidiOutput(outputName: string): boolean {
|
||||
/**
|
||||
@ -91,7 +89,6 @@ export class MidiConnection{
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public sendMidiNote(noteNumber: number, channel: number, velocity: number, duration: number): void {
|
||||
/**
|
||||
* Sending a MIDI Note on/off message with the same note number and channel. Automatically manages
|
||||
@ -122,6 +119,24 @@ export class MidiConnection{
|
||||
console.error('MIDI output not available.');
|
||||
}
|
||||
}
|
||||
|
||||
public sendSysExMessage(message: number[]): void {
|
||||
/**
|
||||
* Sends a SysEx message to the currently selected MIDI output.
|
||||
*
|
||||
* @param message Array of SysEx message bytes
|
||||
*
|
||||
* @example
|
||||
* // Send a SysEx message to set the pitch bend range to 12 semitones
|
||||
* sendSysExMessage([0xF0, 0x43, 0x10, 0x4C, 0x08, 0x00, 0x01, 0x00, 0x02, 0xF7]);
|
||||
*/
|
||||
const output = this.midiOutputs[this.currentOutputIndex];
|
||||
if (output) {
|
||||
output.send(message);
|
||||
} else {
|
||||
console.error('MIDI output not available.');
|
||||
}
|
||||
}
|
||||
|
||||
public sendMidiControlChange(controlNumber: number, value: number): void {
|
||||
/**
|
||||
@ -154,5 +169,4 @@ export class MidiConnection{
|
||||
console.error('MIDI output not available.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user