Mercurial > hg > svcore
diff plugin/LADSPAPluginFactory.cpp @ 383:94fc0591ea43 1.2-stable
* merge from trunk (1.2 ended up being tracked from trunk, but we may want
this branch for fixes later)
author | Chris Cannam |
---|---|
date | Wed, 27 Feb 2008 10:32:45 +0000 |
parents | d4a33cdca86f |
children |
line wrap: on
line diff
--- a/plugin/LADSPAPluginFactory.cpp Fri Nov 30 17:36:14 2007 +0000 +++ b/plugin/LADSPAPluginFactory.cpp Wed Feb 27 10:32:45 2008 +0000 @@ -161,6 +161,10 @@ minimum *= m_sampleRate; } + if (LADSPA_IS_HINT_LOGARITHMIC(d)) { + if (minimum == 0.f) minimum = 1.f; + } + return minimum; } @@ -211,6 +215,17 @@ bool logarithmic = LADSPA_IS_HINT_LOGARITHMIC(d); + float logmin = 0, logmax = 0; + if (logarithmic) { + float thresh = powf(10, -10); + if (minimum < thresh) logmin = -10; + else logmin = log10f(minimum); + if (maximum < thresh) logmax = -10; + else logmax = log10f(maximum); + } + +// std::cerr << "LADSPAPluginFactory::getPortDefault: hint = " << d << std::endl; + if (!LADSPA_IS_HINT_HAS_DEFAULT(d)) { deft = minimum; @@ -222,8 +237,7 @@ } else if (LADSPA_IS_HINT_DEFAULT_LOW(d)) { if (logarithmic) { - deft = powf(10, log10(minimum) * 0.75 + - log10(maximum) * 0.25); + deft = powf(10, logmin * 0.75 + logmax * 0.25); } else { deft = minimum * 0.75 + maximum * 0.25; } @@ -231,8 +245,7 @@ } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(d)) { if (logarithmic) { - deft = powf(10, log10(minimum) * 0.5 + - log10(maximum) * 0.5); + deft = powf(10, logmin * 0.5 + logmax * 0.5); } else { deft = minimum * 0.5 + maximum * 0.5; } @@ -240,8 +253,7 @@ } else if (LADSPA_IS_HINT_DEFAULT_HIGH(d)) { if (logarithmic) { - deft = powf(10, log10(minimum) * 0.25 + - log10(maximum) * 0.75); + deft = powf(10, logmin * 0.25 + logmax * 0.75); } else { deft = minimum * 0.25 + maximum * 0.75; } @@ -271,10 +283,14 @@ deft = minimum; } + +//!!! No -- the min and max have already been multiplied by the rate, +//so it would happen twice if we did it here -- and e.g. DEFAULT_440 +//doesn't want to be multiplied by the rate either - if (LADSPA_IS_HINT_SAMPLE_RATE(d)) { - deft *= m_sampleRate; - } +// if (LADSPA_IS_HINT_SAMPLE_RATE(d)) { +// deft *= m_sampleRate; +// } return deft; }