summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_unit.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2018-08-01 11:13:46 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2019-05-12 22:32:10 +0200
commit7a6daab64224ab091bc55c2f35a42e2d80ce3369 (patch)
tree60103069a86f12acad38c597a8c863601a0bcdab /libs/ardour/audio_unit.cc
parentb5218fa38b74a7cdb19bf0fd8c6bf7590445351d (diff)
Merge input-imprecise pass into the main pass
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/audio_unit.cc')
-rw-r--r--libs/ardour/audio_unit.cc63
1 files changed, 23 insertions, 40 deletions
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index af09bd82d6..697c5feb4c 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -1429,7 +1429,7 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out, Cha
continue;
}
- /* now allow potentially "output-imprecise" matches */
+ /* now allow potentially "imprecise" matches */
if (possible_in == 0) {
/* no inputs, generators & instruments */
if (possible_out == -1 || possible_out == -2) {
@@ -1471,56 +1471,39 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out, Cha
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 */
+ int32_t 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 (possible_in < -2 && audio_in > -possible_in && imprecise) {
- // hide inputs ports
- // XXX: this is really *input* imprecise and should have
- // been part of the second pass below. Also, this change
- // should only be applied when really selecting a corresponding
- // configuration.
- imprecise->set (DataType::AUDIO, -possible_in);
- }
- }
-
- }
-
- if (!found && imprecise) {
- /* try harder */
- for (vector<pair<int,int> >::iterator i = io_configs.begin(); i != io_configs.end(); ++i) {
- int32_t possible_in = i->first;
- int32_t possible_out = i->second;
-
- 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) {