Menu

#8 -x should respect -i (ignore) options

v0.9.9
open
nobody
None
5
2021-03-06
2021-03-01
No

Hi Lieven,

First, thanks a lot for this utility, it's very useful!

I also like that you can specify a set of clients to ignore when restoring connections, this makes the program much more versatile.

However, I'd really like it to be able to ignore clients also (and especially) when removing connections. E.g., as a use case consider that you're running Ardour as DAW and Pd as modular system alongside each other, and you've taken some snapshots of various different sets of connections for Pd (hooking it up to different sets of audio and MIDI devices, for instance). Then you'd like to be able to recall those (and remove any existing connections) for Pd only, while keeping all connections involving Ardour intact. Currently this isn't possible, since -x will just remove any and all connections whatsoever. Which is especially frustrating if you're running Ardour, because its connections keep changing all the time depending on which session you're working on.

This behavior isn't too hard to implement, in fact I quickly cobbled together the behavior I need for Jack by just adding the same kind of is_ignored_client() checks to the jack_remove_connections() function in aj-remove.c that you already have in aj-alsa.c and aj-jack.c. To these ends, I simply added checks on both the input and output ports to the for loop in jack_remove_connections(), as follows:

    for (i = 0; jack_output_ports[i] != NULL; ++i) {
      char tmp_str[jack_port_name_size()];
      char* client_name;
      strcpy(tmp_str, jack_output_ports[i]);
      client_name = strtok(tmp_str, ":");
      if(is_ignored_client(client_name)) continue;
      for (j = 0; jack_input_ports[j] != NULL; ++j) {
        strcpy(tmp_str, jack_input_ports[j]);
        client_name = strtok(tmp_str, ":");
        if(is_ignored_client(client_name)) continue;
        jack_disconnect(jackc, jack_output_ports[i], jack_input_ports[j]);
      }
    }

Something similar could surely be added to alsa_remove_connections().

Does that make any sense to you? It would really be nice if this behavior could be implemented, and even made the default. But if backward compatibility is a consideration, then one might just add another option to enable that behavior.

Discussion

  • lieven

    lieven - 2021-03-06

    Hi Albert,
    That certainly makes sense to me.
    As soon as I find the time, I will implement this functionality.
    Your input is really appreciated.
    Thanks!
    lieven

     
  • lieven

    lieven - 2021-03-06

    Hi Albert,
    Latest git adds the option -X that doesn't remove connections to or from ignored clients.
    I think the old -x option has its use-case as well, so I wanted to stay backwards compatible.
    I've tested a little bit with the simplest setup, and things seem to work as expected. If you
    feel like it, you could give it a spin. I will release when it has been tested a little more.
    What do you think?

     

Anonymous
Anonymous

Add attachments
Cancel