Re: [Jack-Devel] RFC: jackd portnames

PrevNext  Index
DateThu, 03 Nov 2011 18:27:08 +0100
From Adrian Knoth <[hidden] at drcomp dot erfurt dot thur dot de>
To[hidden] at lists dot jackaudio dot org
Follow-UpAdrian Knoth Re: [Jack-Devel] RFC: jackd portnames
On Thu, Nov 03, 2011 at 10:31:26AM -0400, Paul Davis wrote:

Hi!

> The general feature is to add port meta-data to JACK. Then we define
> some "well known" meta data keys, such as this one:
> 
>           http://jackaudio.org/keyvalue/pretty-name
> 
> Applications that display port names should then either (1)
> acknowledge that they do not use pretty-name or (2) look up the value
> for a given port before displaying anything.

Definitely a nice idea, especially together with another page I've just
found:

   http://wiki.linuxproaudio.org/index.php/jack:Semantic_Port_Names

So instead of relying on a naming convention, channel groups can be
explicitly specified with a dedicated key.

I think we'll probably see more meta-data in the future, so I'm all in
favour of a flexible meta-data system.

> Florian's port could then be made to tie into this without actually
> stomping on the actual port name.

I appreciate the idea of having an orthogonal tool that can set
pretty-names. This way, firewire and basically everything could benefit
from it.


And now that you mention it, I came up with the following quick-n-dirty
hack. Proof of concept, almost no checks:

#include <stdio.h>
#include <stdlib.h>
#include <jack/jack.h>

int main(int argc, char **argv) {
    jack_client_t *client;

    if (3 != argc) {
        fprintf(stderr, "usage: %s oldportname newportname\n"
                "Example: %s \"system:playback1\" \"guitar\"",
                argv[0], argv[0]);
    }
    client = jack_client_open("renamer", JackNoStartServer, NULL);

    if (NULL == client) {
        printf("couldn't connect to jack server.\n");
        exit(1);
    }

    jack_port_t *oldport = jack_port_by_name(client, argv[1]);

    if (NULL == oldport) {
        printf("Old portname not found\n");
        exit(2);
    }

    jack_port_set_name(oldport, argv[2]);

    jack_client_close(client);

    return 0;
}


Works like this:

adi@chopin:~$ jack_lsp 
system:capture_1
system:capture_2
system:playback_1
system:playback_2
adi@chopin:~$ ./a.out "system:capture_1" "guitar"
adi@chopin:~$ jack_lsp 
system:guitar
system:capture_2
system:playback_1
system:playback_2

Some polish, some scripting or file-IO, and we have decent channel names
on all backends. WDYT?



Cheers

-- 
mail: [hidden]  	http://adi.thur.de	PGP/GPG: key via keyserver
PrevNext  Index

1320341259.22626_0.ltw:2,Sa <20111103172708.GV12362 at ltw dot loris dot tv>