View Issue Details

IDProjectCategoryView StatusLast Update
0002772ardourbugspublic2020-04-19 20:14
Reporterrobsch Assigned Topaul  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.8.1 
Summary0002772: Initial values for some LADSPA plugins wrong, strange behaviour when modifying it manually
Descriptiondefault values of certain ladspa plugins are not calculated correctly. i tried Steve Harris' triple band parametric: in jack rack "Band 1 frequency" is set to 40Hz, but ardour defaults to 0.123.

The value can be changed to something meaningful, but double-clicking the fader changes the value again:

step 1: change Band 1 Frequency to 200Hz by clicking and dragging the fader.
step 2: double-click on the fader. The input field says 5.291 now..
step 3: set the value in the input field to 6.291, press Enter.
step 4: the fader says 539 Hz now.

probably this is related to http://tracker.ardour.org/view.php?id=2437
Additional Informationardour 2.8.1 (built from revision 5338)
uname -a: Linux jupiter 2.6.27-gentoo-r8 0000016 SMP PREEMPT Fri Jun 12 15:25:50 CEST 2009 x86_64 Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz GenuineIntel GNU/Linux
TagsNo tags attached.

Relationships

related to 0002608 closedpaul [PATCH] fix BarController to display logarithmically scaled values correctly 
related to 0002493 closednettings Illegal default parameters for LADSPA plugins 

Activities

robsch

2009-08-11 07:07

reporter   ~0006499

I noticed from the sources that logarithmic default values were not correctly implemented yet (there was a FIXME), so I wrote a patch to do it the same way as jack-rack does.
Furtheron, nickm's patch for a related bug caused some trouble for non-english locales (double-clicking the fader of a logarithmic parameter did not show a value in the gtk.Entry due to different characters for "." and "," for some languages in floating point numbers); this should be fixed by the patch, too.

2009-08-11 07:07

 

log3.patch (3,372 bytes)   
Index: libs/gtkmm2ext/barcontroller.cc
===================================================================
--- libs/gtkmm2ext/barcontroller.cc	(Revision 5508)
+++ libs/gtkmm2ext/barcontroller.cc	(Arbeitskopie)
@@ -109,6 +109,7 @@
 	// extract a double from the string and take its log
 	Entry *entry = dynamic_cast<Entry *>(&spinner);
 	stringstream stream(entry->get_text());
+	stream.imbue(std::locale(""));
 
 	double value;
 	stream >> value;
@@ -134,12 +135,33 @@
 	}
 
 	// generate the exponential and turn it into a string
+	// convert to correct locale. 
+	
 	stringstream stream;
+	string str;
+	size_t found;
+
+	// Gtk.Entry does not like the thousands separator, so we have to  
+	// remove it after conversion from float to string.
+
+	stream.imbue(std::locale(""));
 	stream.precision(spinner.get_digits());
+
 	stream << fixed << exp(spinner.get_adjustment()->get_value());
 	
+	str=stream.str();
+
+	// find thousands separators, remove them
+	found = str.find(use_facet<numpunct<char> >(std::locale("")).thousands_sep());
+	while(found != str.npos) {
+		str.erase(found,1);
+
+		//find next
+		found = str.find(use_facet<numpunct<char> >(std::locale("")).thousands_sep());
+	}
+
 	Entry *entry = dynamic_cast<Entry *>(&spinner);
-	entry->set_text(stream.str());
+	entry->set_text(str);
 	
 	return true;
 }
Index: libs/ardour/ladspa_plugin.cc
===================================================================
--- libs/ardour/ladspa_plugin.cc	(Revision 5509)
+++ libs/ardour/ladspa_plugin.cc	(Arbeitskopie)
@@ -182,34 +182,44 @@
 			ret = prh[port].LowerBound;
 			bounds_given = true;
 			sr_scaling = true;
-			earlier_hint = true;
 		}
 		
 		/* FIXME: add support for logarithmic defaults */
 		
 		else if (LADSPA_IS_HINT_DEFAULT_LOW(prh[port].HintDescriptor)) {
-			ret = prh[port].LowerBound * 0.75f + prh[port].UpperBound * 0.25f;
+			if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
+				ret = exp(log(prh[port].LowerBound) * 0.75f + log(prh[port].UpperBound) * 0.25f);
+			}
+			else {
+				ret = prh[port].LowerBound * 0.75f + prh[port].UpperBound * 0.25f;
+			}
 			bounds_given = true;
 			sr_scaling = true;
-			earlier_hint = true;
 		}
 		else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(prh[port].HintDescriptor)) {
-			ret = prh[port].LowerBound * 0.50f + prh[port].UpperBound * 0.50f;
+			if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
+				ret = exp(log(prh[port].LowerBound) * 0.5f + log(prh[port].UpperBound) * 0.5f);
+			}
+			else {
+				ret = prh[port].LowerBound * 0.5f + prh[port].UpperBound * 0.5f;
+			}
 			bounds_given = true;
 			sr_scaling = true;
-			earlier_hint = true;
 		}
 		else if (LADSPA_IS_HINT_DEFAULT_HIGH(prh[port].HintDescriptor)) {
-			ret = prh[port].LowerBound * 0.25f + prh[port].UpperBound * 0.75f;
+			if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
+				ret = exp(log(prh[port].LowerBound) * 0.25f + log(prh[port].UpperBound) * 0.75f);
+			}
+			else {
+				ret = prh[port].LowerBound * 0.25f + prh[port].UpperBound * 0.75f;
+			}
 			bounds_given = true;
 			sr_scaling = true;
-			earlier_hint = true;
 		}
 		else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(prh[port].HintDescriptor)) {
 			ret = prh[port].UpperBound;
 			bounds_given = true;
 			sr_scaling = true;
-			earlier_hint = true;
 		}
 		else if (LADSPA_IS_HINT_DEFAULT_0(prh[port].HintDescriptor)) {
 			ret = 0.0f;
log3.patch (3,372 bytes)   

seablade

2009-08-11 07:09

manager   ~0006500

Assigned to Paul to take a look at the patch.

     Seablade

paul

2009-10-01 16:43

administrator   ~0006669

committed for both 2.0-ongoing and 3.0 (which required an earlier patch from nickm that had not been applied)

system

2020-04-19 20:14

developer   ~0021949

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2009-07-08 16:52 robsch New Issue
2009-07-08 17:00 seablade Relationship added related to 0002608
2009-07-08 17:01 seablade Relationship added related to 0002493
2009-08-11 07:07 robsch Note Added: 0006499
2009-08-11 07:07 robsch File Added: log3.patch
2009-08-11 07:09 seablade Status new => assigned
2009-08-11 07:09 seablade Assigned To => paul
2009-08-11 07:09 seablade Note Added: 0006500
2009-10-01 16:43 paul cost => 0.00
2009-10-01 16:43 paul Note Added: 0006669
2009-10-01 16:43 paul Status assigned => resolved
2009-10-01 16:43 paul Resolution open => fixed
2010-04-24 10:28 cth103 Category bugs => bugs2
2010-04-24 10:31 cth103 Category bugs2 => bugs
2020-04-19 20:14 system Note Added: 0021949
2020-04-19 20:14 system Status resolved => closed