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

MidiOutAlsa last events don't get sent, when the RtMidiOut is closed #161

Closed
jpcima opened this issue Apr 9, 2018 · 3 comments
Closed

Comments

@jpcima
Copy link
Contributor

jpcima commented Apr 9, 2018

When I call sendMessage on ALSA, there is a delay before it actually gets sent.
If RtMidiOut is destroyed too soon after the sendMessage(), the message never transmits.
In a MIDI player program, I want to send final events to restore the state of the instrument after playing, but they don't happen.

Minimal test program: miditest.cc

If you run this and connect it to gmidimonitor, you may be able to reproduce the problem.

  • Steps
  1. Run the program, and press enter at each step when prompted.
    In the monitor, you see a NoteOn event happen, but not NoteOff.
  2. Compile and run again, but uncommenting a 1 second temporization before the end.
    You should see the two events.
  • Notes

The ALSA api returned 0 on snd_seq_drain_output(), which suggests the event was sent, but in reality it wasn't (yet).
A relevant API may be snd_seq_sync_output_queue() but I couldn't get anything of it in all I tried.

@chronopoulos
Copy link
Contributor

i was not able to reproduce this - i see the Note Off event in both cases. using Linux 4.8.0-53-generic #56~16.04.1-Ubuntu SMP, with libasound2 version 1.1.0 and RtMidi version 3.0.0 (latest release).

what version of RtMidi are you using?

@radarsat1
Copy link
Contributor

I'm afraid I also see both events in both cases.
image

@jpcima
Copy link
Contributor Author

jpcima commented Apr 9, 2018

Just now I find myself unable to reproduce the bug too.
And I realize it's because I was connecting through a2j before. And it was a2j the culprit of the bug all along... Under ordinary conditions it works. So I'm closing this.

@jpcima jpcima closed this as completed Apr 9, 2018
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

No branches or pull requests

3 participants