[alsa-devel] Detecting new alsa sequencer clients (with some event loop) so that i can subscribe them

Clemens Ladisch clemens at ladisch.de
Tue Apr 1 09:01:50 CEST 2008


R. Dresens wrote:
> I'm currently writing an application that will be able to 'auto
> subscribe' itself to a certain sequencer client when that client
> becomes available to the system. I want (for example) to be able to
> plug in a USB MIDI interface, and when I do that then my application
> detects this and does a subscription on it, just like aconnect would
> do.
>
> A possible solution is polling; every second or so, i could generate a
> list of clients with snd_seq_query_next_client and look for a certain
> client name (libpcre comes to mind here;), but I was wondering if there
> is a better solution? ..in other words, is it possible to get such
> events from the system in a similar way like one would receive regular
> MIDI events?

Subscribe to SND_SEQ_CLIENT_SYSTEM:SND_SEQ_PORT_SYSTEM_ANNOUNCE.
Try "aseqdump -p 0:1" to see what events you get.


HTH
Clemens


More information about the Alsa-devel mailing list