[alsa-devel] How to stop playback on alsa synth?

Lukasz Pawelczyk havner at pld-linux.org
Sun Mar 16 22:48:25 CET 2008

I think I've done it, just don't know how correct my solution is

I've added snd_seq_drain_output() after snd_seq_event_output() in thread 
function so the events are processed more "real time" as I understand 
it. I've also moved queue creation to the beginning of thread function 
(because stop function deletes the queue).

Then the stop function calls:
sets a bool to break the thread loop.

This seems to work. Any comments?

One problem I got with it though is that sometimes when I stop one music 
and play another one some note(s) from the old one are played 
indefinitely during the new music. I suppose some 'clear' event should 
be sent to remove it. I've tried MIDI_CTL_ALL_SOUNDS_OFF control one (as 
pmidi does on exit) but no luck.

Regards    Havner                     {jid,mail}:havner(at)pld-linux.org
                    "Quis custodiet ipsos custodes?"

More information about the Alsa-devel mailing list