Make the configuration penalty subtler about inputs
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Thu, 4 Aug 2016 07:45:33 +0000 (09:45 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Sat, 6 Aug 2016 17:38:09 +0000 (19:38 +0200)
Instead of uniformly demote configurations with a non-matching audio
input count (using a penalty offset of 1000), also grade the
impreciseness of the configuration so that those with the nearest input
count are preferred. As for outputs, give a slightly higher handicap to
configuration with too many inputs with regard to the actual audio
inputs that can be fed to the plugin.

POLICY CHANGE: when only imprecise configurations are found the actually
selected one can be different (better) than before this commit.

libs/ardour/luaproc.cc

index 8f370ebfad57ace07ab49b83ca911914a0321b09..09be770b0a9bd2b4719acfdfffe68d58832d124e 100644 (file)
@@ -400,11 +400,10 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
 }
 
 #define FOUNDCFG_IMPRECISE(in, out) {                               \
 }
 
 #define FOUNDCFG_IMPRECISE(in, out) {                               \
-  float p = fabsf ((float)(out) - preferred_out) ;                  \
-  if (in != audio_in) {                                             \
-    p += 1000;                                                      \
-  }                                                                 \
-  if ((out) > preferred_out) { p *= 1.1; }                          \
+  const float p = fabsf ((float)(out) - preferred_out) *            \
+                      (((out) > preferred_out) ? 1.1 : 1)           \
+                + fabsf ((float)(in) - audio_in) *                  \
+                      (((in) > audio_in) ? 275 : 250);              \
   FOUNDCFG_PENALTY(in, out, p);                                     \
 }
 
   FOUNDCFG_PENALTY(in, out, p);                                     \
 }