-
Notifications
You must be signed in to change notification settings - Fork 147
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
Linux/ALSA Native MIDI backend #637
base: SDL2
Are you sure you want to change the base?
Commits on Sep 20, 2024
-
native_midi: Initial stubs for ALSA module
This does not do anything yet, but does set up the necessary build changes so that we will link against the libasound library.
Configuration menu - View commit details
-
Copy full SHA for 2418042 - Browse repository at this point
Copy the full SHA 2418042View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd39fbe - Browse repository at this point
Copy the full SHA cd39fbeView commit details
Commits on Sep 24, 2024
-
native_midi: Open ALSA device, start thread
We don't write any MIDI data to the sequencer yet but this sets up the basic foundations. For now, the playback thread just exits immediately, so `playmus` completes successfully.
Configuration menu - View commit details
-
Copy full SHA for 7840957 - Browse repository at this point
Copy the full SHA 7840957View commit details -
native_midi: Connect to ALSA destination port
We try various different ports that are usually the "default"; we need to provide a mechanism to specify it explicitly but for now this will do. These are the same "default" ports that DOSbox's ALSA code tries.
Configuration menu - View commit details
-
Copy full SHA for 0aaa89d - Browse repository at this point
Copy the full SHA 0aaa89dView commit details -
native_midi: Initial conversion of MIDI events
This converts all the common MIDI events to the ALSA event types. The converted events are not yet sent to ALSA.
Configuration menu - View commit details
-
Copy full SHA for 1d627cd - Browse repository at this point
Copy the full SHA 1d627cdView commit details -
native_midi: Send events to destination
With this change in place the module actually works! There's more still to finish but this is actually usable.
Configuration menu - View commit details
-
Copy full SHA for 85bc9bd - Browse repository at this point
Copy the full SHA 85bc9bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5c10308 - Browse repository at this point
Copy the full SHA 5c10308View commit details -
native_midi: Send reset messages on track stop
The ALSA device we're sending messages to will continue playing them even if the program quits, and we don't want to leave notes hanging. So when stopping the current track, send the "notes all off" and "reset all controllers" messages to every channel, and also send an ALSA reset event as well for good measure (the Timidity++ daemon seems to respond to it)
Configuration menu - View commit details
-
Copy full SHA for fe25166 - Browse repository at this point
Copy the full SHA fe25166View commit details -
native_midi: Use non-blocking mode and polling
When stopping a song we must wait for the playback thread to terminate. However, the thread may currently be doing a blocking write of some MIDI events and we don't actually know how long this may take to complete. Instead, we can use non-blocking mode and the poll() system call. This allows us to sleep when the output event buffer is full, but also allows us to wake it back up when it's time for the song to stop. We accomplish this by creating a pipe that we close on shutdown.
Configuration menu - View commit details
-
Copy full SHA for 274d4f6 - Browse repository at this point
Copy the full SHA 274d4f6View commit details