This is tricky to explain, so rather than explain what was wrong, I'll describe
how it works now.
Whenever a ScopedTempoMapOwner::in() call occurs, we check the current thread-local
tempo map ptr. If it is not owned by us (and we have a local tempo map that we
want to use), set it so that it is.
We continue to fetch() the global tempo map ptr back into the thread-local ptr
when the local scope depth drops to zero.
> 'TempoMapScope' defined as a struct here but previously declared
> as a class; this is valid, but may result in linker errors under
> the Microsoft C++ ABI [clang-diagnostic-mismatched-tags]
This was implemented to try to fix paste() but was not needed. It might be
useful in the future, or just as an expression of the logic of this. Note that
the BBT_Offset it returns only has the beats field set, which is ... odd. So
this is likely not quite finished.
the BBT times of the newly inserted points during paste() are meaningless until
we recompute them using ::reset_starting_at(). So don't try to compute some
sort of likely value, just use the value from the cut buffer, and call
reset_starting_at() after every point inserted.
A meter (time signature) is required to do the math correctly for any operation that may
cross or reach the next bar boundary, which round_to_*() and round_up_to_*() may do.
This reverts commit d3a15b11ba.
This arrived at an awkward time as ScopedTempoMapOwner was being rearranged at
the source level. It will be reapplied in a subsequent commit.
Quantizing superclocks to samples in libtemporal negates the whole purpose of superclocks,
and breaks a variety of things, not limited to moving forward to markers and the grid
There can never be fractional audio time, and since superclock_t is used to represent audio time, when we
convert from Beat time, we should never, ever return a superclock value that does not correspond to
an integer number of samples.
This fixes a number of bugs, including any use of ARDOUR::Filter which writes a new (audio) file
to disk that must be an integer number of samples long, but may be derived from and later used
by a region that had an audio-time duration that is slightly longer (less than one sample)
than the audio file