Add Web MIDI support

Co-authored-by: Adam Scott <ascott.ca@gmail.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
This commit is contained in:
Ryan Braganza
2024-08-27 20:22:09 +10:00
parent b9437c3938
commit a7505ee0bc
8 changed files with 317 additions and 3 deletions

View File

@ -23,7 +23,7 @@
<return type="void" />
<description>
Shuts down the system MIDI driver. Godot will no longer receive [InputEventMIDI]. See also [method open_midi_inputs] and [method get_connected_midi_inputs].
[b]Note:[/b] This method is implemented on Linux, macOS, and Windows.
[b]Note:[/b] This method is implemented on Linux, macOS, Windows, and Web.
</description>
</method>
<method name="crash">
@ -244,7 +244,9 @@
<return type="PackedStringArray" />
<description>
Returns an array of connected MIDI device names, if they exist. Returns an empty array if the system MIDI driver has not previously been initialized with [method open_midi_inputs]. See also [method close_midi_inputs].
[b]Note:[/b] This method is implemented on Linux, macOS, and Windows.
[b]Note:[/b] This method is implemented on Linux, macOS, Windows, and Web.
[b]Note:[/b] On the Web platform, Web MIDI needs to be supported by the browser. [url=https://caniuse.com/midi]For the time being[/url], it is currently supported by all major browsers, except Safari.
[b]Note:[/b] On the Web platform, using MIDI input requires a browser permission to be granted first. This permission request is performed when calling [method open_midi_inputs]. The browser will refrain from processing MIDI input until the user accepts the permission request.
</description>
</method>
<method name="get_data_dir" qualifiers="const">
@ -704,7 +706,9 @@
<return type="void" />
<description>
Initializes the singleton for the system MIDI driver, allowing Godot to receive [InputEventMIDI]. See also [method get_connected_midi_inputs] and [method close_midi_inputs].
[b]Note:[/b] This method is implemented on Linux, macOS, and Windows.
[b]Note:[/b] This method is implemented on Linux, macOS, Windows, and Web.
[b]Note:[/b] On the Web platform, Web MIDI needs to be supported by the browser. [url=https://caniuse.com/midi]For the time being[/url], it is currently supported by all major browsers, except Safari.
[b]Note:[/b] On the Web platform, using MIDI input requires a browser permission to be granted first. This permission request is performed when calling [method open_midi_inputs]. The browser will refrain from processing MIDI input until the user accepts the permission request.
</description>
</method>
<method name="read_buffer_from_stdin">