mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Add Uint8Array to MIDIOutput send
The spec for Web MIDI API MIDIOutput.send at: https://webaudio.github.io/web-midi-api/#dom-midioutput-send suggests that both number[] and Uint8Array are acceptable types for sending data on a MIDI output port. The relevant text that allows for Uint8Array states: "... while still enabling use of Uint8Arrays for efficiency in large ..." An obvious use case is to forward MIDI events received on MIDIInputs as these are already in the form of a Uint8Array types. Tested with Chrome 60.0.3112.113 on Mac OS 10.12.6.
This commit is contained in:
Vendored
+1
-1
@@ -145,7 +145,7 @@ declare namespace WebMidi {
|
||||
* to zero (or another time in the past), the data is to be sent as soon as
|
||||
* possible.
|
||||
*/
|
||||
send(data: number[], timestamp?: number): void;
|
||||
send(data: number[] | Uint8Array, timestamp?: number): void;
|
||||
|
||||
/**
|
||||
* Clears any pending send data that has not yet been sent from the MIDIOutput 's
|
||||
|
||||
@@ -20,6 +20,7 @@ const onFulfilled = (item: WebMidi.MIDIAccess) => {
|
||||
for (const op of outputs) {
|
||||
this._outputs.push(op);
|
||||
op.send([ 0x90, 0x45, 0x7f ]);
|
||||
op.send(new Uint8Array([ 0x90, 0x45, 0x7f ]));
|
||||
}
|
||||
|
||||
for (const input of this._inputs) {
|
||||
|
||||
Reference in New Issue
Block a user