summaryrefslogtreecommitdiff
path: root/libs/ardour/panner_manager.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-03-15 21:39:53 +0100
committerRobin Gareus <robin@gareus.org>2020-03-15 21:39:53 +0100
commita7a781971e146a6a98c0c55543b849c6adcd41f0 (patch)
tree5ed69ef3961418fd0236bb938955924b16614dc0 /libs/ardour/panner_manager.cc
parentdbd4b9d07d776c891099c5d0706aa15648292266 (diff)
Change default stereo panner to equal power balance
The stereo-width panner is not generally useful. In order to change the azimuth, width has to be reduced, which usually leads to comb-filter artifacts. Equal power stereo, also matches the default mono to stereo panner better than the stereo-width panner. Last but not least, control surfaces only have an azimuth control knob, without an easy way to reduce width, this leaves the panner insensitive.
Diffstat (limited to 'libs/ardour/panner_manager.cc')
-rw-r--r--libs/ardour/panner_manager.cc77
1 files changed, 46 insertions, 31 deletions
diff --git a/libs/ardour/panner_manager.cc b/libs/ardour/panner_manager.cc
index 79fbc2c094..17b4c50f85 100644
--- a/libs/ardour/panner_manager.cc
+++ b/libs/ardour/panner_manager.cc
@@ -29,6 +29,7 @@
#include "pbd/error.h"
#include "pbd/compose.h"
#include "pbd/file_utils.h"
+#include "pbd/stateful.h"
#include "pbd/stl_delete.h"
#include "ardour/debug.h"
@@ -68,13 +69,13 @@ PannerManager::instance ()
static bool panner_filter (const string& str, void */*arg*/)
{
#ifdef COMPILER_MSVC
- /**
- * Different build targets (Debug / Release etc) use different versions
- * of the 'C' runtime (which can't be 'mixed & matched'). Therefore, in
- * case the supplied search path contains multiple version(s) of a given
- * panner module, only select the one(s) which match the current build
- * target (otherwise, all hell will break loose !!)
- */
+ /**
+ * Different build targets (Debug / Release etc) use different versions
+ * of the 'C' runtime (which can't be 'mixed & matched'). Therefore, in
+ * case the supplied search path contains multiple version(s) of a given
+ * panner module, only select the one(s) which match the current build
+ * target (otherwise, all hell will break loose !!)
+ */
#if defined (_DEBUG)
return str.length() > 12 && (str.find ("panner_") == 0) && (str.find ("D.dll") == (str.length() - 5));
#elif defined (RDC_BUILD)
@@ -170,27 +171,34 @@ 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) {
- d = &(*p)->descriptor;
- if (d->panner_uri != uri) continue;
- if (d->in != nin && d->in != -1) continue;
- if (d->out != nout && d->out != -1) continue;
+ PanPluginDescriptor const& d ((*p)->descriptor);
+ if (d.panner_uri != uri) continue;
+ if (d.in != nin && d.in != -1) continue;
+ if (d.out != nout && d.out != -1) continue;
return *p;
}
/* look for exact match first */
for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
- d = &(*p)->descriptor;
+ PanPluginDescriptor const& d ((*p)->descriptor);
- if (d->in == nin && d->out == nout && d->priority > priority) {
- priority = d->priority;
+ /* backward compat */
+ if (Stateful::loading_state_version < 6000 && d.panner_uri == "http://ardour.org/plugin/panner_2in2out") {
+ if (d.in == nin && d.out == nout) {
+ priority = 9999;
+ rv = *p;
+ }
+ }
+
+ if (d.in == nin && d.out == nout && d.priority > priority) {
+ priority = d.priority;
rv = *p;
}
}
@@ -198,38 +206,45 @@ PannerManager::select_panner (ChanCount in, ChanCount out, std::string const uri
/* no exact match, look for good fit on inputs and variable on outputs */
+#if 0
priority = 0;
+ /* unused, so far Ardour only features 4 panners:
+ * in = 1 ; out = 2 // Mono to Stereo
+ * in = 2 ; out = 2 // Equal Power Stereo
+ * in = 2 ; out = 2 // Stereo Balance
+ * in = -1 ; out = -1 // VBAP
+ */
+
for (list<PannerInfo*>::iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
- d = &(*p)->descriptor;
+ PanPluginDescriptor const& d ((*p)->descriptor);
- if (d->in == nin && d->out == -1 && d->priority > priority) {
- priority = d->priority;
+ 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;
+ PanPluginDescriptor const& d ((*p)->descriptor);
- if (d->in == -1 && d->out == nout && d->priority > priority) {
- priority = d->priority;
+ if (d.in == -1 && d.out == nout && d.priority > priority) {
+ priority = d.priority;
rv = *p;
}
}
if (rv) { return rv; }
+#endif
/* 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;
+ PanPluginDescriptor const& d ((*p)->descriptor);
- if (d->in == -1 && d->out == -1 && d->priority > priority) {
- priority = d->priority;
+ if (d.in == -1 && d.out == -1 && d.priority > priority) {
+ priority = d.priority;
rv = *p;
}
}
@@ -265,11 +280,11 @@ PannerManager::get_available_panners(uint32_t const a_in, uint32_t const a_out)
/* get available panners for current configuration. */
for (list<PannerInfo*>::const_iterator p = panner_info.begin(); p != panner_info.end(); ++p) {
- PanPluginDescriptor* d = &(*p)->descriptor;
- if (d->in != -1 && d->in != in) continue;
- if (d->out != -1 && d->out != out) continue;
- if (d->in == -1 && d->out == -1 && out <= 2) continue;
- panner_list.insert(std::pair<std::string,std::string>(d->panner_uri,d->name));
+ PanPluginDescriptor const& d ((*p)->descriptor);
+ if (d.in != -1 && d.in != in) continue;
+ if (d.out != -1 && d.out != out) continue;
+ if (d.in == -1 && d.out == -1 && out <= 2) continue;
+ panner_list.insert(std::pair<std::string,std::string>(d.panner_uri,d.name));
}
return panner_list;
}