This fixes a deadlock, because tempo-map write copy
was not released. A later call to TempoMap::write_copy
will deadlock and in this case also hold the process lock.
This can happen if there is more than one tempo on the
timeline or if the tempo-difference is too large.
Removing the shadow makes toolbar and editor-tool buttons align
when the editor-mixer is hidden. It also improves consistency
with all other tabs that have no shadow on the left.
Increasing the table border width to 1, makes aligns the
editor-mixer button with the main toolbar.
I'm not good with a mouse, so I found it hard to edit animation lines.
The mouse position has to be quite precise, with only a small threshold.
Looking at the code, AutomationLine sets the threshold for the PolyLine
to 4.0 . That seems to be a distance, and better for me than what I
experience.
The actual code in PolyLine is however comparing it directly to the
squared distance, making it more sensitive than expected.
Fixed by computing the squared threshold - also including the line
width.
This fixes the following problem:
When automation lines with significant change are zoomed in time, the
slope gets smaller (towards horizontal) as the control points moves
further away from the visible area. That was rendered correctly, but the
corresponding mouse events happened as if the line had a steeper slope.
The problem was caused by the X value being clamped to the visible area,
without scaling the Y value correspondingly. It has apparently been like
that for a decode, since introduced in c4f0063a68.
The problem is fixed by introducing a clamp2 function that scales the Y
value if clamping the X value.
Note: An old comment says that math goes wrong unless clamping below
COORD_MAX. It is not clear to me what math it refers to, and especially
why we don't need similar clamping on the lower bounds.
And while rarely a real problem, I guess it would be more correct and a
slight optimization to skip all lines where both ends are outside the
same bound. In theory, as it is now, the mouse could catch an invisible
line close to the border.
This addressee a bug where ardour 6 was able to write negative
duration `length="-1"` `length-beats="-3.3650500597559585e-05"`
Ideally timecnt_t::string_to should check for invalid,
negative, duration. But this also catches a more generic case.
```
exception at str.substr (1)
#3 Temporal::timepos_t::string_to (this=0x7fffffff7bb0, str="") at libs/temporal/timeline.cc:904
#4 Temporal::timecnt_t::string_to (this=0x7fffffff7ba0, str="-2") at libs/temporal/timeline.cc:294
#5 PBD::string_to<Temporal::timecnt_t> (str="-2") at libs/ardour/ardour/types_convert.h:131
```
The default clock-limit is 99:59:59:00, just under 360000 seconds
(see ARDOUR_UI::parameter_changed, clock-display-limit).
AudioClock calculates this limit pos as
`timepos_t (limit_sec * _session->sample_rate())`
This caused an overflow leading to a negative value:
```
timepos_t (359999 * 96000)
samples_to_superclock (359999 * 96000, 96000)
int_div_round (359999 * 96000 * 282240000, 96000)
```
Ideally this will be optimized, here the sample-rate cancels out,
so we could use a c'tor usin seconds.
In other cases we could cache the pre-calculated sc_per_sample:
`superclock_ticks_per_second() / superclock_t (sr)` which is an
integer for all commonly used sample-rates.
Before, the X-axis labels would be placed in nice even positions, but
with whatever odd time corresponded to that. That made it harder than
necessary to read the graph and approximate when things happened.
Instead, round the interval down to nearest power of ten ... and if
suitable, scale that up with a factor of 2 or 5. That will (with the
necessary handling of how seconds/minutes/hours relate) make sure that
the time labels are nice with a minimal amount of non-zero digits. That
makes it easy to do math and interpolate when reading the graph.
The number of labels will change between something like 4 and 10 -
before it was always something like 7. That is fine, as long as it helps
the readability.
The total length is no longer the right-most label, but the length can
be found in the top-right corner.
This moves the _amp from send to delivery (which already
applies gain for the master-bus normalization). This generalizes
the use of a gain stage for use in port-inserts.