13
0

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.
This commit is contained in:
Julien "_FrnchFrgg_" RIVAUD 2018-08-01 11:13:46 +02:00
parent b5218fa38b
commit 7a6daab642

View File

@ -1429,7 +1429,7 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out, Cha
continue; continue;
} }
/* now allow potentially "output-imprecise" matches */ /* now allow potentially "imprecise" matches */
if (possible_in == 0) { if (possible_in == 0) {
/* no inputs, generators & instruments */ /* no inputs, generators & instruments */
if (possible_out == -1 || possible_out == -2) { 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) { if (possible_in < -2 || possible_in > 0) {
/* specified number, exact or up to */ /* specified number, exact or up to */
if (possible_in < -2 && audio_in > -possible_in && !imprecise) { int32_t desired_in;
/* request is too large */ if (possible_in > 0) {
} else if (possible_in > 0 && audio_in != possible_in) { /* configuration can only match possible_in */
/* this configuration needed exacty possible_in inputs */ 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) { } else if (possible_out == -1 || possible_out == -2) {
/* any output configuration possible /* any output configuration possible
* out == -2 is invalid, interpreted as out == -1 */ * out == -2 is invalid, interpreted as out == -1
FOUNDCFG (preferred_out); * Really imprecise only if desired_in != audio_in */
FOUNDCFG_IMPRECISE (desired_in, preferred_out);
ANYTHINGGOES; ANYTHINGGOES;
} else if (possible_out < -2) { } else if (possible_out < -2) {
/* variable number of outputs up to -N /* variable number of outputs up to -N
* not specified if in > 0, but we accept it anyway */ * not specified if in > 0, but we accept it anyway
FOUNDCFG (min (-possible_out, preferred_out)); * Really imprecise only if desired_in != audio_in */
FOUNDCFG_IMPRECISE (desired_in, min (-possible_out, preferred_out));
UPTO (-possible_out) UPTO (-possible_out)
} else { } else {
/* exact number of outputs */ /* exact number of outputs
FOUNDCFG (possible_out); * Really imprecise only if desired_in != audio_in */
} FOUNDCFG_IMPRECISE (desired_in, 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);
} }
// ideally we'll also find the closest, best matching // ideally we'll also find the closest, best matching
// input configuration with minimal output penalty... // input configuration with minimal output penalty...
} }
} }
if (!found) { if (!found) {