summaryrefslogtreecommitdiff
path: root/libs/ardour/luaproc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/luaproc.cc')
-rw-r--r--libs/ardour/luaproc.cc29
1 files changed, 19 insertions, 10 deletions
diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc
index 27746d29cb..52b567711d 100644
--- a/libs/ardour/luaproc.cc
+++ b/libs/ardour/luaproc.cc
@@ -385,14 +385,17 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
float penalty = 9999;
bool found = false;
-#define FOUNDCFG(nch) { \
- float p = fabsf ((float)(nch) - preferred_out); \
- _output_configs.insert (nch); \
- if ((nch) > preferred_out) { p *= 1.1; } \
+#define FOUNDCFG_IMPRECISE(in, out) { \
+ float p = fabsf ((float)(out) - preferred_out); \
+ if (in != audio_in) { \
+ p += 1000; \
+ } \
+ _output_configs.insert (out); \
+ if ((out) > preferred_out) { p *= 1.1; } \
if (p < penalty) { \
- audio_out = (nch); \
+ audio_out = (out); \
if (imprecise) { \
- *imprecise = in; \
+ imprecise->set (DataType::AUDIO, (in)); \
imprecise->set (DataType::MIDI, \
possible_midiin); \
} \
@@ -401,6 +404,9 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
} \
}
+#define FOUNDCFG(out) \
+ FOUNDCFG_IMPRECISE(audio_in, out)
+
#define ANYTHINGGOES \
_output_configs.insert (0);
@@ -410,6 +416,10 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
} \
}
+ if (imprecise) {
+ *imprecise = in;
+ }
+
for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
luabridge::LuaRef io (i.value ());
if (!io.isTable()) {
@@ -534,15 +544,14 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
assert (possible_in > 0); // all other cases will have been matched above
if (possible_out == -1 || possible_out == -2) {
- FOUNDCFG (2);
+ FOUNDCFG_IMPRECISE (possible_in, 2);
} else if (possible_out < -2) {
/* explicitly variable number of outputs, pick maximum */
- FOUNDCFG (min (-possible_out, preferred_out));
+ FOUNDCFG_IMPRECISE (possible_in, min (-possible_out, preferred_out));
} else {
/* exact number of outputs */
- FOUNDCFG (possible_out);
+ FOUNDCFG_IMPRECISE (possible_in, possible_out);
}
- imprecise->set (DataType::AUDIO, possible_in);
// ideally we'll also find the closest, best matching
// input configuration with minimal output penalty...
}