[Ardour-Dev] sort_ports_by_name patch

Natanael Olaiz nolaiz at gmail.com
Mon Apr 20 13:07:06 PDT 2009


Using ardour with more than 10 in/out ports in a track, the ports order 
is done alphabetically, so the order is: 1,10,11,...,2,...,9 (and figure 
like that in the GUI). So, if you have in the XML (we are trying to do 
things from outside Ardour, like Pau comment some days ago...) a 15 
channels track connected to a bus like this:

    <IO name="Audio 1" id="1105" active="yes" inputs="{}" outputs="{Bus
    1/in 1}{Bus 1/in 2}{Bus 1/in 3}{Bus 1/in 4}{Bus 1/in 5}{Bus 1/in
    6}{Bus 1/in 7}{Bus 1/in 8}{Bus 1/in 9}{Bus 1/in 10}{Bus 1/in 11}{Bus
    1/in 12}{Bus 1/in 13}{Bus 1/in 14}{Bus 1/in 15}"
    gain="1.000000000000" iolimits="1,-1,-1,-1">


    <IO name="Bus 1" id="1125" active="yes" inputs="{Audio 1/out
    1}{Audio 1/out 2}{Audio 1/out 3}{Audio 1/out 4}{Audio 1/out 5}{Audio
    1/out 6}{Audio 1/out 7}{Audio 1/out 8}{Audio 1/out 9}{Audio 1/out
    10}{Audio 1/out 11}{Audio 1/out 12}{Audio 1/out 13}{Audio 1/out
    14}{Audio 1/out 15}" outputs="{master/in 1}{master/in 2}"
    gain="1.000000000000" iolimits="-1,-1,-1,-1">

You obtain in the GUI the order: 1,4,5,10,11,12,13,14,15,2,3 (like in 
the screenshot), because of a double alphabetically order... (2 became 
10, and 10 at their time is 4...).

So I made a patch to make the sort routine check for numbers to the end 
of the port name. Is attached, and a test session with those connections.

I have to change the cstdlib atoi for the PBD one, and try to use 
ustrings instead std::strings... but the reverse iterator doesn't work. 
Anyway, it works.

Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: order_ports.png
Type: image/png
Size: 50305 bytes
Desc: not available
URL: <http://lists.ardour.org/pipermail/ardour-dev-ardour.org/attachments/20090420/2853d9bc/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sortports.ardour
Type: text/xml
Size: 12676 bytes
Desc: not available
URL: <http://lists.ardour.org/pipermail/ardour-dev-ardour.org/attachments/20090420/2853d9bc/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sort_ports.patch
Type: text/x-diff
Size: 1811 bytes
Desc: not available
URL: <http://lists.ardour.org/pipermail/ardour-dev-ardour.org/attachments/20090420/2853d9bc/attachment-0002.patch>

More information about the Ardour-Dev mailing list