Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move MIDI parsing up from ALSA driver to platform independent driver. #90485

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

ibrahn
Copy link
Contributor

@ibrahn ibrahn commented Apr 10, 2024

Aims for more consistent MIDI support across Windows, MacOS, Linux and to provide a base for adding MIDI drivers for other platforms. Reworks the MIDIDriverALSAMidi MIDI parsing implementation as a platform independent version in MIDIDriver::Parser.
Uses MIDIDriver::Parser to provide running status support in MacOS MIDIDriverCoreMidi.
Collects connected input names at open, ensuring devices indices reported in events match names in array returned from get_connected_inputs.

Fixes #77035.
Fixes #79811.

@ibrahn
Copy link
Contributor Author

ibrahn commented Apr 10, 2024

Sorry for the noisy diff. This one moves a few things around, but hopefully the result is clearer.

@Sauermann Sauermann added this to the 4.x milestone Apr 10, 2024
@ibrahn ibrahn force-pushed the midi-driver-rework branch from fa1ed95 to c5daf42 Compare April 10, 2024 14:27
@ibrahn ibrahn marked this pull request as ready for review April 11, 2024 20:57
@ibrahn ibrahn requested review from a team as code owners April 11, 2024 20:57
@ibrahn
Copy link
Contributor Author

ibrahn commented Apr 11, 2024

I've not managed to get hold of a Mac test machine, so very grateful if anyone could give this branch a test on that.

A small MIDI test project if needed:
https://github.com/ibrahn/midi-test-synth-godot

@markofjohnson
Copy link

I tested this PR with chord playing on Mac as per defect #77035 . This fixes the bug :-) . I logged data going in and confirmed that packets with more than one MIDI message work correctly. (I noticed that I was not seeing MIDI running status, but packets with multiple messages including repeated status bytes. So the previous diagnosis of the problem may not have been due to running status, but due to Mac Core MIDI allowing more than 1 MIDI message in 1 packet.)

@ibrahn
Copy link
Contributor Author

ibrahn commented Apr 14, 2024

@markofjohnson great to hear :) Thanks for that

@akien-mga akien-mga requested review from reduz and bruvzg May 28, 2024 15:23
core/os/midi_driver.cpp Outdated Show resolved Hide resolved
core/os/midi_driver.h Outdated Show resolved Hide resolved
core/os/midi_driver.h Outdated Show resolved Hide resolved
drivers/coremidi/midi_driver_coremidi.cpp Outdated Show resolved Hide resolved
drivers/coremidi/midi_driver_coremidi.cpp Outdated Show resolved Hide resolved
drivers/alsamidi/midi_driver_alsamidi.cpp Outdated Show resolved Hide resolved
drivers/alsamidi/midi_driver_alsamidi.cpp Outdated Show resolved Hide resolved
drivers/coremidi/midi_driver_coremidi.cpp Outdated Show resolved Hide resolved
drivers/coremidi/midi_driver_coremidi.cpp Outdated Show resolved Hide resolved
drivers/coremidi/midi_driver_coremidi.cpp Outdated Show resolved Hide resolved
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Jun 24, 2024
@ibrahn ibrahn force-pushed the midi-driver-rework branch from b04cc0b to 8d921c0 Compare June 25, 2024 15:37
Aims for more consistent MIDI support across Windows, MacOS, Linux and
to provide a base for adding MIDI drivers for other platforms.
Reworks the MIDIDriverALSAMidi MIDI parsing implementation as a platform
independent version in MIDIDriver::Parser.
Uses MIDIDriver::Parser to provide running status support in MacOS
MIDIDriverCoreMidi.
Collects connected input names at open, ensuring devices indices reported
in events match names in array returned from get_connected_inputs.

Fixes godotengine#77035.
Fixes godotengine#79811.

With code review changes by: A Thousand Ships (she/her)
<96648715+AThousandShips@users.noreply.github.com>
@ibrahn ibrahn force-pushed the midi-driver-rework branch from 8d921c0 to 607c5ec Compare June 25, 2024 15:46
@ibrahn
Copy link
Contributor Author

ibrahn commented Jun 25, 2024

Thanks @AThousandShips :)
All requests applied, squashed and rebased.

Is there a full list of the current style rules?

@AThousandShips
Copy link
Member

See this it covers most

@ibrahn
Copy link
Contributor Author

ibrahn commented Jun 25, 2024

Ah, I missed the Comment Style Guide at the bottom there, sorry about that.
Thanks again :)

@akien-mga akien-mga merged commit 2cd46de into godotengine:master Jun 26, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@franciscod
Copy link

Thanks for this. On 4.3.dev6 I was seeing corrupt (pointer?) values for the device on midi events. Now on 4.3.rc3 it's consistently the device index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants