add a fixed priority to panner modules

This commit is contained in:
Robin Gareus 2014-01-10 12:13:22 +01:00
parent 99ed84c429
commit 8d64665ce1
6 changed files with 26 additions and 8 deletions

View file

@ -178,6 +178,7 @@ struct PanPluginDescriptor {
std::string gui_uri;
int32_t in;
int32_t out;
uint32_t priority;
ARDOUR::Panner* (*factory)(boost::shared_ptr<ARDOUR::Pannable>, boost::shared_ptr<ARDOUR::Speakers>);
};
}

View file

@ -146,9 +146,11 @@ PannerManager::get_descriptor (string path)
PannerInfo*
PannerManager::select_panner (ChanCount in, ChanCount out, std::string const uri)
{
PannerInfo* rv = NULL;
PanPluginDescriptor* d;
int32_t nin = in.n_audio();
int32_t nout = out.n_audio();
uint32_t priority = 0;
/* look for user-preference -- check if channels match */
for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
@ -164,40 +166,51 @@ PannerManager::select_panner (ChanCount in, ChanCount out, std::string const uri
for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
d = &(*p)->descriptor;
if (d->in == nin && d->out == nout) {
return *p;
if (d->in == nin && d->out == nout && d->priority > priority) {
priority = d->priority;
rv = *p;
}
}
if (rv) { return rv; }
/* no exact match, look for good fit on inputs and variable on outputs */
priority = 0;
for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
d = &(*p)->descriptor;
if (d->in == nin && d->out == -1) {
return *p;
if (d->in == nin && d->out == -1 && d->priority > priority) {
priority = d->priority;
rv = *p;
}
}
if (rv) { return rv; }
/* no exact match, look for good fit on outputs and variable on inputs */
priority = 0;
for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
d = &(*p)->descriptor;
if (d->in == -1 && d->out == nout) {
return *p;
if (d->in == -1 && d->out == nout && d->priority > priority) {
priority = d->priority;
rv = *p;
}
}
if (rv) { return rv; }
/* no exact match, look for variable fit on inputs and outputs */
priority = 0;
for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
d = &(*p)->descriptor;
if (d->in == -1 && d->out == -1) {
return *p;
if (d->in == -1 && d->out == -1 && d->priority > priority) {
priority = d->priority;
rv = *p;
}
}
if (rv) { return rv; }
warning << string_compose (_("no panner discovered for in/out = %1/%2"), nin, nout) << endmsg;

View file

@ -66,6 +66,7 @@ static PanPluginDescriptor _descriptor = {
"http://ardour.org/plugin/panner_1in2out",
"http://ardour.org/plugin/panner_1in2out#ui",
1, 2,
10000,
Panner1in2out::factory
};

View file

@ -66,6 +66,7 @@ static PanPluginDescriptor _descriptor = {
"http://ardour.org/plugin/panner_2in2out",
"http://ardour.org/plugin/panner_2in2out#ui",
2, 2,
10000,
Panner2in2out::factory
};

View file

@ -67,6 +67,7 @@ static PanPluginDescriptor _descriptor = {
"http://ardour.org/plugin/panner_balance",
"http://ardour.org/plugin/panner_balance#ui",
2, 2,
2000,
Pannerbalance::factory
};

View file

@ -49,6 +49,7 @@ static PanPluginDescriptor _descriptor = {
"http://ardour.org/plugin/panner_vbap",
"http://ardour.org/plugin/panner_vbap#ui",
-1, -1,
1000,
VBAPanner::factory
};