View Issue Details

IDProjectCategoryView StatusLast Update
0002833ardourbugspublic2020-04-19 20:14
Reporterrobsch Assigned Topaul  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.8.2 
Summary0002833: manual gain adjustments in the mixer not working properly
DescriptionSteps to reproduce:
1. New session, add 1 track
2. Go to the mixer
3. click in the field above the fader and type a positive value (for example 3.0), hit enter.
4. the fader moves to the correct position, the input field sais 3.0 - Correct
5. now enter a negative value (-4.0), hit enter.
6. the input field sais -4.1 now. - Wrong

i think it's about rounding the values typed in the input field above the fader.
Additional Informationuname -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

ardour 2.8.2 (built from revision 5494)
TagsNo tags attached.

Activities

peppot

2009-08-21 11:19

reporter   ~0006583

Yes, I see this

cth103

2009-08-22 10:22

administrator   ~0006585

Thanks for the report. This is fixed in 3.0.

cth103

2009-08-22 14:51

administrator   ~0006587

Assigned to paul to see if this should be applied to 2.0-ongoing.

2009-10-02 15:23

 

db.patch (4,840 bytes)   
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index a15c113..9427362 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -765,7 +765,7 @@ AutomationLine::get_verbose_cursor_string (float fraction)
 		if (fraction == 0.0) {
 			snprintf (buf, sizeof (buf), "-inf dB");
 		} else {
-			snprintf (buf, sizeof (buf), "%.1fdB", coefficient_to_dB (slider_position_to_gain (fraction)));
+			snprintf (buf, sizeof (buf), "%.1fdB", accurate_coefficient_to_dB (slider_position_to_gain (fraction)));
 		}
 	} else {
 		snprintf (buf, sizeof (buf), "%.2f", fraction);
diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c
index f929b31..29cc850 100644
--- a/gtk2_ardour/canvas-waveview.c
+++ b/gtk2_ardour/canvas-waveview.c
@@ -645,15 +645,15 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_
 		for (n = 0; n < cache->data_size; ++n) {
 
 			if (buf[n].max > 0.0f) {
-				buf[n].max = alt_log_meter(coefficient_to_dB(buf[n].max));
+				buf[n].max = alt_log_meter(fast_coefficient_to_dB(buf[n].max));
 			} else if (buf[n].max < 0.0f) {
-				buf[n].max = -alt_log_meter(coefficient_to_dB(-buf[n].max));
+				buf[n].max = -alt_log_meter(fast_coefficient_to_dB(-buf[n].max));
 			}
 			
 			if (buf[n].min > 0.0f) {
-				buf[n].min = alt_log_meter(coefficient_to_dB(buf[n].min));
+				buf[n].min = alt_log_meter(fast_coefficient_to_dB(buf[n].min));
 			} else if (buf[n].min < 0.0f) {
-				buf[n].min = -alt_log_meter(coefficient_to_dB(-buf[n].min));
+				buf[n].min = -alt_log_meter(fast_coefficient_to_dB(-buf[n].min));
 			}
 		}
 	}
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 31a083a..d4953ed 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -4449,8 +4449,6 @@ Editor::adjust_region_scale_amplitude (bool up)
 		}
 
 		fraction = slider_position_to_gain (fraction);
-		fraction = coefficient_to_dB (fraction);
-		fraction = dB_to_coefficient (fraction);
 
 		if (up && fraction >= 2.0) {
 			continue;
diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc
index 3e60b39..3d0d9be 100644
--- a/gtk2_ardour/gain_meter.cc
+++ b/gtk2_ardour/gain_meter.cc
@@ -361,7 +361,7 @@ GainMeterBase::show_gain ()
 	if (v == 0.0) {
 		strcpy (buf, _("-inf"));
 	} else {
-		snprintf (buf, 32, "%.1f", coefficient_to_dB (slider_position_to_gain (v)));
+		snprintf (buf, 32, "%.1f", accurate_coefficient_to_dB (slider_position_to_gain (v)));
 	}
 	
 	gain_display.set_text (buf);
diff --git a/libs/ardour/ardour/dB.h b/libs/ardour/ardour/dB.h
index b67e581..b4a9688 100644
--- a/libs/ardour/ardour/dB.h
+++ b/libs/ardour/ardour/dB.h
@@ -26,8 +26,12 @@ static inline float dB_to_coefficient (float dB) {
 	return dB > -318.8f ? pow (10.0f, dB * 0.05f) : 0.0f;
 }
 
-static inline float coefficient_to_dB (float coeff) {
+static inline float fast_coefficient_to_dB (float coeff) {
 	return 20.0f * fast_log10 (coeff);
 }
 
+static inline float accurate_coefficient_to_dB (float coeff) {
+	return 20.f * log10 (coeff);
+}
+
 #endif /* __ardour_dB_h__ */
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index ef9c6f6..a43ccca 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -2545,7 +2545,7 @@ IO::meter ()
 		/* compute new visible value using falloff */
 
 		if (new_peak > 0.0f) {
-			new_peak = coefficient_to_dB (new_peak);
+			new_peak = fast_coefficient_to_dB (new_peak);
 		} else {
 			new_peak = -INFINITY;
 		}
diff --git a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc
index 5b41327..8693c0c 100644
--- a/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc
+++ b/libs/surfaces/frontier/tranzport/tranzport_control_protocol.cc
@@ -361,7 +361,7 @@ TranzportControlProtocol::show_track_gain ()
 		gain_t g = route_get_gain (0);
 		if ((g != last_track_gain) || lcd_isdamaged(0,9,8)) {
 			char buf[16]; 
-			snprintf (buf, sizeof (buf), "%6.1fdB", coefficient_to_dB (route_get_effective_gain (0)));
+			snprintf (buf, sizeof (buf), "%6.1fdB", accurate_coefficient_to_dB (route_get_effective_gain (0)));
 			print (0, 9, buf); 
 			last_track_gain = g;
 		}
diff --git a/libs/surfaces/tranzport/show.cc b/libs/surfaces/tranzport/show.cc
index 30f4de3..04e641e 100644
--- a/libs/surfaces/tranzport/show.cc
+++ b/libs/surfaces/tranzport/show.cc
@@ -390,7 +390,7 @@ TranzportControlProtocol::show_track_gain ()
 		gain_t g = route_get_gain (0);
 		if ((g != last_track_gain) || lcd_isdamaged(0,12,8)) {
 			char buf[16]; 
-			snprintf (buf, sizeof (buf), "%6.1fdB", coefficient_to_dB (route_get_effective_gain (0)));
+			snprintf (buf, sizeof (buf), "%6.1fdB", accurate_coefficient_to_dB (route_get_effective_gain (0)));
 			print (0, 12, buf); 
 			last_track_gain = g;
 		}
db.patch (4,840 bytes)   

cth103

2009-10-02 15:24

administrator   ~0006681

Attached a patch against 2.0 which compiles but is not tested.

paul

2009-10-08 14:44

administrator   ~0006693

tested with 2.8, confirmed fixed, committed. thanks again!

system

2020-04-19 20:14

developer   ~0021979

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-08-21 10:55 robsch New Issue
2009-08-21 11:19 peppot Note Added: 0006583
2009-08-22 10:22 cth103 Note Added: 0006585
2009-08-22 14:51 cth103 Status new => assigned
2009-08-22 14:51 cth103 Assigned To => paul
2009-08-22 14:51 cth103 Note Added: 0006587
2009-10-02 15:23 cth103 File Added: db.patch
2009-10-02 15:24 cth103 Note Added: 0006681
2009-10-08 14:44 paul cost => 0.00
2009-10-08 14:44 paul Note Added: 0006693
2009-10-08 14:44 paul Status assigned => resolved
2009-10-08 14:44 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: 0021979
2020-04-19 20:14 system Status resolved => closed