Remove ad-hoc handling of possible_in == 0
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Wed, 3 Aug 2016 21:28:09 +0000 (23:28 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Sat, 6 Aug 2016 17:38:09 +0000 (19:38 +0200)
Just make the code responsible for possible_in > 0 also handle
possible_in == 0 since it nearly does the same thing.

The only difference is that the possible_in == 0 case didn't check at
all for audio_in, essentially acting as if possible_in was audio_in.
There is thus a small POLICY CHANGE, but the selected configuration will
stay the same unless a better matching configuration is available.

libs/ardour/luaproc.cc

index f2db7848c8946857131dd10158264c97b734b0d8..8f370ebfad57ace07ab49b83ca911914a0321b09 100644 (file)
@@ -462,23 +462,6 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
                        continue;
                }
 
-               if (possible_in == 0) {
-                       /* no inputs, generators & instruments */
-                       if (possible_out == -1 || possible_out == -2) {
-                               /* any output configuration possible
-                                * out == -2 is invalid, interpreted as out == -1 */
-                               FOUNDCFG (preferred_out);
-                               ANYTHINGGOES;
-                       } else if (possible_out < -2) {
-                               /* variable number of outputs up to -N, */
-                               FOUNDCFG (min (-possible_out, preferred_out));
-                               UPTO (-possible_out);
-                       } else {
-                               /* exact number of outputs */
-                               FOUNDCFG (possible_out);
-                       }
-               }
-
                if (possible_in == -1 || possible_in == -2) {
                        /* wildcard for input */
                        if (possible_out == possible_in) {
@@ -501,10 +484,10 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
                        }
                }
 
-               if (possible_in < -2 || possible_in > 0) {
+               if (possible_in < -2 || possible_in >= 0) {
                        /* specified number, exact or up to */
                        int desired_in;
-                       if (possible_in > 0) {
+                       if (possible_in >= 0) {
                                /* configuration can only match possible_in */
                                desired_in = possible_in;
                        } else {