[LAD] Finding ALSA sequencer client/port numbers

Fons Adriaensen fons at linuxaudio.org
Fri Apr 22 21:55:11 UTC 2011


On Fri, Apr 22, 2011 at 11:24:47PM +0200, Dominic Sacré wrote:
> On Friday 22 April 2011 22:45:34 Fons Adriaensen wrote:
> > after reading ASLA docs for some hours I've not found an
> > answer to the following:
> > 
> > Given the ALSA sequencer client and port _names_, find the
> > numbers required to set up a connection (a 'subscription'
> > in ALSA lingo).
> 
> ALSA client and port names are not required to be unique.
> 
> I think the best you can do is query all clients and their ports 
> (snd_seq_query_next_client() etc.) until you find one with the name 
> you're looking for, and then just hope you got the right one...
> 
> By the way, aconnect seems to do the same (badly).

Aconnect seems to use 'snd_seq_parse_address()' which
is probably what I need. I found the docs by googling
that function's name, none of the docs I was able to
find otherwise mentioned it.

Badly indeed, since many clients just repeat the client
name as the port name, and even use the _same_ names for
input and output. Even Ardour does the latter. In this
case the corresponding port numbers are the same as well,
but without that it would be impossible to find them.
There's also the strange spaces that seem to be part of
the names:

client 129: 'ardour' [type=user]
    0 'control         '
    1 'mcu             '
    2 'seq             '

I've not yet found out if those spaces are required as
input to snd_seq_parse_address(). If they are, that's
bad since tools displaying the names (e.g. qjackctl)
don't show the spaces and a user would not have any
indication they part of the name.

Ciao,

-- 
FA





More information about the Linux-audio-dev mailing list