godot icon indicating copy to clipboard operation
godot copied to clipboard

Add Web MIDI support

Open ryanbraganza opened this issue 1 year ago • 9 comments

This PR adds support for web exports by using webmidi.

Demo: (code)

Note: webmidi is not supported on all browsers

image

ryanbraganza avatar Aug 22 '24 01:08 ryanbraganza

PS: It seems OS.get_connected_midi_inputs() will not work on the Web platform if I'm reading the code right. It might be worth documenting this explicitly in its description as well.

Kind of. OS.get_connected_midi_inputs() will be populated asynchronously. https://github.com/godotengine/godot/pull/95928/files#r1726105863

ryanbraganza avatar Aug 22 '24 01:08 ryanbraganza

Happy to rename any variables, or make any other changes. Just let me know!

ryanbraganza avatar Aug 31 '24 23:08 ryanbraganza

It's been a while, but I am still interested in getting this merged! Just rebased to fix merge conflicts.

ryanbraganza avatar Nov 22 '24 09:11 ryanbraganza

@ryanbraganza Sorry for the delay! I'm reviewing this PR right now!

adamscott avatar Nov 22 '24 14:11 adamscott

I'm currently investigating why it fails on the proxy_to_thread=yes build.

adamscott avatar Nov 22 '24 15:11 adamscott

PROXY_TO_PTHREAD_ENABLED is essentially telling emscripten to put most of the logic not on the main thread. But as Godot expects some events to happen on the main thread, we essentially use callable_mp_static() to call deferred on the main thread if the event isn't received on it.

adamscott avatar Nov 22 '24 16:11 adamscott

applied the changes and rebased

ryanbraganza avatar Nov 23 '24 00:11 ryanbraganza

cc. @AThousandShips and @Mickeon for my suggested doc changes.

adamscott avatar Dec 02 '24 17:12 adamscott

Applied all suggested changes, squashed, & rebased

ryanbraganza avatar Dec 15 '24 11:12 ryanbraganza

Thanks!

Repiteo avatar Dec 16 '24 18:12 Repiteo