summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_line.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-04-26 00:51:09 +0200
committerRobin Gareus <robin@gareus.org>2015-04-26 00:51:09 +0200
commit12ece4852544241c1a4958f09cd386dabb250384 (patch)
tree6f648ddbbb8a7625c6922d0c1ac895af08597de6 /gtk2_ardour/automation_line.cc
parent1dc9848d614ed4cf19c1fa805b400a7269258ef4 (diff)
fix verbose cursor for db automation.
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r--gtk2_ardour/automation_line.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index db541933b9..069a823155 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -376,19 +376,16 @@ AutomationLine::fraction_to_string (double fraction) const
{
if (_uses_gain_mapping) {
char buf[32];
- if (_desc.type == GainAutomation) {
+ if (_desc.type == GainAutomation || _desc.type == EnvelopeAutomation || _desc.lower == 0) {
if (fraction == 0.0) {
snprintf (buf, sizeof (buf), "-inf");
} else {
snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (slider_position_to_gain_with_max (fraction, _desc.upper)));
}
} else {
- float coeff = _desc.lower + fraction * (_desc.upper - _desc.lower);
- if (coeff == 0.0) {
- snprintf (buf, sizeof (buf), "-inf");
- } else {
- snprintf (buf, sizeof (buf), "%.1f", accurate_coefficient_to_dB (coeff));
- }
+ const double lower_db = accurate_coefficient_to_dB (_desc.lower);
+ const double range_db = accurate_coefficient_to_dB (_desc.upper) - lower_db;
+ snprintf (buf, sizeof (buf), "%.1f", lower_db + fraction * range_db);
}
return buf;
} else {