Re: [LAD] ALSA autoconnect

From: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@email-addr-hidden>
Date: Wed Dec 23 2009 - 19:30:40 EET

On Wednesday, December 23, 2009, Jens M Andreasen wrote:
> Suppose you wanted a soft-synth to be instantly playable at startup
> (given the option: '--autoconnect') then what would be the ALSA
> functions for:
>
> 1) Saving the current "live" connection at exit (if any.)
> 2) Restoring the above (saved information.)
>
> /j

I suppose that you mean the functions used by an alsa sequencer client program
of any kind. I think that saving/restoring connections has more sense for
players/recorders than softsynths.

Using plain libasound API, the functions:
snd_seq_connect_from() and snd_seq_connect_to() to make the conenctions,
snd_seq_disconnect_to() and snd_seq_disconnect_from() to disconnect,
you will need also snd_seq_parse_address() to transform the address in string
form into a pair of client:port numbers.

It is practical to save the address as a string "name:port_number", instead of
saving the client number, because the numbers are likely going to change the
next time you start your programs, and the function snd_seq_parse_address()
is able to translate the client names into the corresponding client numbers.
For instance, this is taken from my VMPK current .config file:

[Connections]
InPort=KMidimon:0
OutPort=MidiSport 2x2:0

Regards,
Pedro
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Wed Dec 23 20:15:06 2009

This archive was generated by hypermail 2.1.8 : Wed Dec 23 2009 - 20:15:07 EET