Skip to content

Fixed typo in _event_output_direct - #26

Merged
Jajcus merged 1 commit into
Jajcus:mainfrom
thanks4opensource:thanks4opensource_event_output_direct
Sep 27, 2026
Merged

Jajcus merged 1 commit into
Jajcus:mainfrom
thanks4opensource:thanks4opensource_event_output_direct

Conversation

@thanks4opensource

Copy link
Copy Markdown
Contributor

_event_output_direct() in alsa_midi/client.py was mistakenly calling alsa.snd_seq_event_output() instead of alsa.snd_seq_event_output_direct().

Please don't ask me how long it took to find this. ;) I struggled to determine why event_output_direct worked in C using the native libasound API, as did the https://github.com/alsa-project/alsa-python and https://github.com/ppaez/alsaseq Python bindings, but this repo's generally superior API still required doing drain_output before anything actually got sent. I don't know the ALSA internals very well, and it was a semi-fascinating adventure trying to find what was different in the snd_seq_t and snd_seq_event_t queue members across the versions, or why explicitly setting them to NULL and/or SND_SEQ_QUEUE_DIRECT didn't help. I was trying to add some debug output to _event_output_direct() when I opened my eyes, saw the typo, and realized all my efforts were for naught.

Sorry, I guess you didn't ask. ;) Please apply this pull request anyway. :)

@Jajcus

Jajcus commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Thank you for your change. Seems very reasonable. I am sorry my copy&past mistake caused so much trouble.

@Jajcus
Jajcus merged commit 3889904 into Jajcus:main Sep 27, 2026
@thanks4opensource

Copy link
Copy Markdown
Contributor Author

Thanks for merging this PR. Typos happen. ;) My problems were largely due to my unfamiliarity with the ALSA sequencer API ("I must be doing something wrong" instead of "There has to be a bug in the Python bindings, let me go look for it".) Analogous to what you wrote at https://github.com/Jajcus/vulkanplay, this probably wasn't the best way to learn the API. ;)

I spent a lot of time evaluating the various Python ALSA bindings, and you've done an excellent job of hiding some of the complexities behind a clean Pythonic interface. BTW, Google A.I. says the same thing when asked to compare the bindings projects. I'm not very happy with the ALSA sequencer design in general -- it's overkill (and overhead) for my real-time MIDI needs. (All the layers required to merely send and receive a 3 byte MIDI "note on" message.) I'm going to look into the RawMidi interface, but since the other components I use (e.g. fluidsynth) use sequencer ports I'll need to convert to that eventually anyway.

I have another patch which adds some minor functionality to python-alsa-midi. It needs more testing, but when finished I'll submit a pull request. I hope you'll find the time to evaluate, possibly improve, and if you approve, merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants