Adding MIDI Program Change
This commit is contained in:
10
src/API.ts
10
src/API.ts
@ -231,6 +231,16 @@ export class UserAPI {
|
|||||||
this.MidiConnection.sendSysExMessage(data)
|
this.MidiConnection.sendSysExMessage(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public program_change(program: number, channel: number): void {
|
||||||
|
/**
|
||||||
|
* Sends a MIDI program change to the current MIDI output.
|
||||||
|
*
|
||||||
|
* @param program - The MIDI program to send
|
||||||
|
* @param channel - The MIDI channel to send the program change on
|
||||||
|
*/
|
||||||
|
this.MidiConnection.sendProgramChange(program, channel)
|
||||||
|
}
|
||||||
|
|
||||||
public midi_clock(): void {
|
public midi_clock(): void {
|
||||||
/**
|
/**
|
||||||
* Sends a MIDI clock to the current MIDI output.
|
* Sends a MIDI clock to the current MIDI output.
|
||||||
|
|||||||
@ -138,6 +138,27 @@ export class MidiConnection{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sendProgramChange(programNumber: number, channel: number): void {
|
||||||
|
/**
|
||||||
|
* Sends a MIDI Program Change message to the currently selected MIDI output.
|
||||||
|
*
|
||||||
|
* @param programNumber MIDI program number (0-127)
|
||||||
|
* @param channel MIDI channel (0-15)
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Send a Program Change message to select program 1 on channel 1
|
||||||
|
* sendProgramChange(0, 0);
|
||||||
|
*/
|
||||||
|
const output = this.midiOutputs[this.currentOutputIndex];
|
||||||
|
if (output) {
|
||||||
|
output.send([0xC0 + channel, programNumber]); // Program Change
|
||||||
|
} else {
|
||||||
|
console.error('MIDI output not available.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public sendMidiControlChange(controlNumber: number, value: number): void {
|
public sendMidiControlChange(controlNumber: number, value: number): void {
|
||||||
/**
|
/**
|
||||||
* Sends a MIDI Control Change message to the currently selected MIDI output.
|
* Sends a MIDI Control Change message to the currently selected MIDI output.
|
||||||
|
|||||||
Reference in New Issue
Block a user