summaryrefslogtreecommitdiff
path: root/libs/ardour/luaproc.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-03 16:28:08 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-06 19:38:09 +0200
commit2dc7b5189c0412c773a2c76ed7be1a64ab67de13 (patch)
treee261560ef5231ebd54fa84b705971f73ee060824 /libs/ardour/luaproc.cc
parentb90baf217632b203e66c296217eb357637a18430 (diff)
Merge pass 2 (imprecise) into pass 1
Still no policy change, since when a configuration is chosen that would have belonged to the second pass, then its penalty will be increased by 1000 and it will be selected only as last recourse.
Diffstat (limited to 'libs/ardour/luaproc.cc')
-rw-r--r--libs/ardour/luaproc.cc60
1 files changed, 22 insertions, 38 deletions
diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc
index 9b9b7fa46d..8030b92f7d 100644
--- a/libs/ardour/luaproc.cc
+++ b/libs/ardour/luaproc.cc
@@ -502,55 +502,39 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
if (possible_in < -2 || possible_in > 0) {
/* specified number, exact or up to */
- if (possible_in < -2 && audio_in > -possible_in && !imprecise) {
- /* request is too large */
- } else if (possible_in > 0 && audio_in != possible_in) {
- /* this configuration needed exacty possible_in inputs */
+ int desired_in;
+ if (possible_in > 0) {
+ /* configuration can only match possible_in */
+ desired_in = possible_in;
+ } else {
+ /* configuration can match up to -possible_in */
+ desired_in = min (-possible_in, audio_in);
+ }
+ if (!imprecise && audio_in != desired_in) {
+ /* skip that configuration, it cannot match
+ * the required audio input count, and we
+ * cannot ask for change via \imprecise */
} else if (possible_out == -1 || possible_out == -2) {
/* any output configuration possible
- * out == -2 is invalid, interpreted as out == -1 */
- FOUNDCFG (preferred_out);
+ * out == -2 is invalid, interpreted as out == -1.
+ * Really imprecise only if desired_in != audio_in */
+ FOUNDCFG_IMPRECISE (desired_in, preferred_out);
ANYTHINGGOES;
} else if (possible_out < -2) {
/* variable number of outputs up to -N
- * not specified if in > 0, but we accept it anyway */
- FOUNDCFG (min (-possible_out, preferred_out));
+ * not specified if in > 0, but we accept it anyway.
+ * Really imprecise only if desired_in != audio_in */
+ FOUNDCFG_IMPRECISE (desired_in, min (-possible_out, preferred_out));
UPTO (-possible_out)
} else {
- /* exact number of outputs */
- FOUNDCFG (possible_out);
- }
- }
-
- }
-
- if (!found && imprecise) {
- /* try harder */
- for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
- luabridge::LuaRef io (i.value ());
- if (!io.isTable()) {
- continue;
- }
-
- int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
- int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
- int possible_midiin = _has_midi_input ? 1 : 0;
-
-
- assert (possible_in > 0); // all other cases will have been matched above
-
- if (possible_out == -1 || possible_out == -2) {
- FOUNDCFG_IMPRECISE (possible_in, 2);
- } else if (possible_out < -2) {
- /* explicitly variable number of outputs, pick maximum */
- FOUNDCFG_IMPRECISE (possible_in, min (-possible_out, preferred_out));
- } else {
- /* exact number of outputs */
- FOUNDCFG_IMPRECISE (possible_in, possible_out);
+ /* exact number of outputs
+ * Really imprecise only if desired_in != audio_in */
+ FOUNDCFG_IMPRECISE (desired_in, possible_out);
}
// ideally we'll also find the closest, best matching
// input configuration with minimal output penalty...
}
+
}
if (!found) {