[LAD] How to save and restore MIDI connexion (ALSA sequencer)

From: Stéphane Brunner <stephane.brunner@email-addr-hidden>
Date: Fri Dec 14 2007 - 22:16:04 EET

Hello !

Thanks for your response but I don't succeed to have something working :(

my code :
init:
    if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) >= 0) {
        m_iClient = snd_seq_set_client_name(seq, "LiveMix");
        m_iPort = snd_seq_create_simple_port(seq, "control", 0,
                SND_SEQ_PORT_TYPE_MIDI_GENERIC | SND_SEQ_PORT_TYPE_SOFTWARE
| SND_SEQ_PORT_TYPE_APPLICATION);
        m_iMidi = snd_seq_create_simple_port(seq, "control",
                SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ |
SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE,
                SND_SEQ_PORT_TYPE_APPLICATION);
    } else {
        qDebug() << "The ALSA MIDI system is not available. No ports based
on it will be created";
    }

get (to save) :
    snd_seq_client_info_t *cinfo;
    snd_seq_port_info_t *pinfo;
    snd_seq_client_info_alloca(&cinfo);
    snd_seq_port_info_alloca(&pinfo);
    snd_seq_client_info_set_client(cinfo, -1);
    snd_seq_port_info_set_client(pinfo,
snd_seq_client_info_get_client(cinfo));
    snd_seq_port_info_set_port(pinfo, m_iMidi);
    snd_seq_query_subscribe_set_client(subs, m_iClient);
    snd_seq_query_subscribe_set_port(subs, m_iMidi);
    snd_seq_query_subscribe_set_type(subs, SND_SEQ_QUERY_SUBS_READ);
    snd_seq_query_subscribe_set_index(subs, 0);
    while (snd_seq_query_port_subscribers(seq, subs) >= 0) {
        const snd_seq_addr_t *addr;
        addr = snd_seq_query_subscribe_get_addr(subs);
        qDebug()<<222<<addr->client<<addr->port;
        snd_seq_query_subscribe_set_index(subs,
snd_seq_query_subscribe_get_index(subs) + 1);
    }

    snd_seq_query_subscribe_alloca(&subs);
    snd_seq_query_subscribe_set_client(subs, m_iClient);
    snd_seq_query_subscribe_set_port(subs, m_iMidi);
    snd_seq_query_subscribe_set_type(subs, SND_SEQ_QUERY_SUBS_WRITE);
    snd_seq_query_subscribe_set_index(subs, 0);
    while (snd_seq_query_port_subscribers(seq, subs) >= 0) {
        const snd_seq_addr_t *addr;
        addr = snd_seq_query_subscribe_get_addr(subs);
        qDebug()<<333<<addr->client<<addr->port;
    }

The first block seem to return all the client-port, the second return
nothing. :(

Does anybody have an idea ?

Thanks in advance
Stéphane

On Dec 10, 2007 9:02 AM, Clemens Ladisch < cladisch@fastmail.net> wrote:

> Stéphane Brunner wrote:
> > Than I want to know with port will be connected on witch other to
> reconnect
> > it on other LiveMix run.
>
> Try snd_seq_query_port_subscribers().
>
>
> HTH
> Clemens
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev@lists.linuxaudio.org
> http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
>

-- 
Stéphane Brunner
mail : stephane.brunner@gmail.com
messageries instantanées : stephane.brunner@gmail.com (
http://talk.google.com)
--------------------------------------
http://www.ubuntu-fr.org - Distribution Linux
http://fr.wikipedia.org - Encyclopédie communautaire
http://mozilla-europe.org - Navigateur internet / Client de messagerie
http://framasoft.net - Annuaire de logiciel libre (gratuit)
http://jeuxlibres.net - Jeux Libres (gratuit)
--------------------------------------
Il existe 10 sortes de personnes : celles qui connaissent le binaire, et les
autres.
Si Microsoft inventait un truc qui plante pas, ce serait un clou.
Si un jour on te reproche que ton travail n'est pas un travail de
professionnel, dis toi que :
Des amateurs ont construit l'arche de Noé, et des professionnels le Titanic.

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Sat Dec 15 00:15:01 2007

This archive was generated by hypermail 2.1.8 : Sat Dec 15 2007 - 00:15:02 EET