Commit graph

353 commits

Author SHA1 Message Date
Paul Davis
77bc293aee add a variation on the EC_LOCAL_TEMPO_SCOPE macro 2025-09-11 15:14:14 -06:00
Robin Gareus
060462a9f1
Fix struct/class tag mismatch
> '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]
2025-08-29 17:22:41 +02:00
Paul Davis
7dadddb3dc temporal: provide TempoMap::global_fetch()
This always returns a shared ptr to the global tempo map, without setting the
thread-local pointer
2025-08-23 22:35:16 -06:00
Paul Davis
a8168f826d remove incorrect bbt_delta() in BBT_Time, provide Meter::bbt_delta
There are two implementations here, the more efficient one (commented out) does
not work correctly yet.
2025-08-20 17:43:05 -06:00
Paul Davis
1312e8f992 temporal: implement TempoMap::bbt_distance() but do not use it
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.
2025-08-19 10:53:06 -06:00
Paul Davis
f0111bcea5 temporal: BBT_Time cannot have any round_to_*() or round_up_to_*() methods
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.
2025-08-19 10:53:06 -06:00
John Emmas
ca820d6380 Remove some unneeded DLL export specifiers (and repo some that were in the wrong place) 2025-08-13 11:22:06 +01:00
Paul Davis
b95c29770c initialize scope owner in default TempoMap constructor
This constructor should not really exist, but it does.
2025-08-12 21:44:50 -06:00
Paul Davis
b205c0bc4b scoped tempo maps: logic fixes and some comment-documentation 2025-08-12 07:53:30 -06:00
Paul Davis
2fc669964e Revert "A new class ('ScopedTempoMapOwner') exposes functions which need to be visible outside of libtemporal"
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.
2025-08-12 07:15:17 -06:00
John Emmas
d3a15b11ba A new class ('ScopedTempoMapOwner') exposes functions which need to be visible outside of libtemporal
(and since there's no 'scope.cc', libtemporal itself needs to #include scope.h for those symbols to get exported)
2025-08-12 13:19:24 +01:00
Paul Davis
ec61deaa8a macro to stop local tempo map code from doing anything 2025-08-11 18:05:24 -06:00
Paul Davis
dd41fddcad temporal: fix up some logic relating to scoped tempo maps 2025-08-11 15:41:34 -06:00
Paul Davis
023290b99d temporal: add sanity check to TempoMap::fetch()
Threads should never call ::fetch() if they have a local tempo map in
use.
2025-08-11 15:41:34 -06:00
Paul Davis
1ecbdf164d moved scoped tempo map from GUI to libtemporal 2025-08-11 15:41:34 -06:00
Paul Davis
0f1c5a9d7d temporal: add new smf_*() API for building a tempo map from SMF info 2025-08-05 11:37:35 -06:00
Paul Davis
ba00dc0920 temporal: add TempoMap::duration() method 2025-08-05 11:37:35 -06:00
Paul Davis
debef6ab25 lighter, simpler math for sample-aligned superclocks 2025-01-30 11:26:41 -07:00
Paul Davis
fa376b709d add new sample_aligned_superclock() method and use it when converting Beats to superclock
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
2025-01-29 17:40:57 -07:00
Paul Davis
baef68b1e6 clean up/improve API used in 5ebf8152e 2025-01-10 09:25:03 -07:00
Paul Davis
364598e94f temporal: add round_up_to_bar() methods to Meter, Metric and TempoMap 2024-10-31 12:22:35 -06:00
Paul Davis
f8ddc827c7 NO-OP: tweak comemnt that still referenced frames instead of samples 2024-10-31 12:22:35 -06:00
Mads Kiilerich
955e634371 Make header files more self-contained - add missing std includes 2024-10-20 03:11:53 +02:00
Robin Gareus
74c4ca3e52
Reduce reliance on boost - the hard part
the rest from `tools/convert_boost.sh`.

* replace boost::function, boost::bind with std::function and std::bind.

This required some manual fixes, notably std::placeholders,
some static_casts<>, and boost::function::clear -> = {}.
2024-10-19 03:47:21 +02:00
Robin Gareus
2d7cce44f1
Replace PBD::Signals (1/2) 2024-10-18 20:41:08 +02:00
Paul Davis
75f56cd3e1 the great onceification (libs)
Replace use of #ifndef header guards with #pragma once

Modern C++, baby!
2024-10-17 07:44:31 -06:00
Paul Davis
e3e014bfe6 NO-OP: comment work 2024-10-02 11:03:08 -06:00
Paul Davis
da175cc2e8 temporal: remove TempoMap::insert_time() and use shift() instead
The former was incorrectly implemented, and the latter has already been tested more
in real life.

We should likely remove ::remove_time also and use shift() there too, but that
requires testing negative shifts more broadly.
2023-11-19 12:14:10 -07:00
Paul Davis
fbc578fdb6 temporal: use "pulses" info from old tempo maps
Note: pulses are whole notes
2023-11-13 22:32:15 -07:00
Paul Davis
f8d86c8d19 temporal: add a new ::set_tempo() method for use when loading older tempo maps 2023-11-13 22:32:15 -07:00
Paul Davis
4228fce86b temporal: minor optimization for TempoMap::{tempo,meter}_at() to cover common case 2023-10-22 17:15:20 -06:00
Paul Davis
afe74bb460 use Meter::round_to_bar() rather than BBT_Time::round_(up|down)_to_bar
this gives slightly better behavior when dragging a meter marker
2023-10-07 11:11:31 -06:00
John Emmas
14973bd894 Simplify the MSVC / superclock change which should now be compatible with all compilers 2023-10-05 14:01:32 +01:00
Robin Gareus
c3b881327c
Possible fix for MSVC build 2023-10-05 01:50:37 +02:00
Robin Gareus
49cb4a1f33
Revert "Fix superclock init on Windows"
This reverts commit febc345414.
2023-10-05 01:50:36 +02:00
Robin Gareus
febc345414
Fix superclock init on Windows
Static global symbols on windows (even identical symbols) are
not mapped to the same address when mixing .dll + .exe.

see also d3cd621f7a
2023-10-04 23:34:40 +02:00
Paul Davis
1c2cd78f41 Revert "temporal: fix superclock time used to find relevant tempo & meter"
This reverts commit b192eea65a.
2023-09-22 15:35:40 -06:00
Paul Davis
e2f6241dd6 temporal: NOOP whitespace 2023-09-22 15:35:39 -06:00
Paul Davis
1cdfe2aa2f temporal: actually iterate 2023-09-22 15:30:31 -06:00
Paul Davis
b192eea65a temporal: fix superclock time used to find relevant tempo & meter 2023-09-22 15:30:20 -06:00
Paul Davis
d6565cce77 temporal: NOOP whitespace 2023-09-22 15:18:27 -06:00
Paul Davis
374283cc3f temporal: provide a new variant of ::get_tempo_and_meter() for BBT time
This one is more complex than the Beats or superclock variants, because
we cannot just start from the front of the map. Instead, we have to
first iterate through the map so that we start the code in
_get_tempo_and_meter<...> from the TempoPoint and MeterPoint
in effect at the BBT_Argument's reference time.
2023-09-22 15:18:27 -06:00
Paul Davis
3aacbc453e temporal::remove version of get_tempo_and_meter() that was never used 2023-09-22 15:18:27 -06:00
Paul Davis
8e3e78c116 temporal: optimize common case for ::get_tempo_and_meter() 2023-09-22 15:18:27 -06:00
Mads Kiilerich
3478acfcf9 temporal: clarify timepos_t and timecnt_t comments
It tooke me a while to get an understanding of this. It might also be
helpful to others to make the description more explicit.
2023-09-20 12:51:52 -06:00
Mads Kiilerich
d2c48debd1 temporal: drop timecnt_t "origin" as alias for "position"
The alias was only used when it was exposed in lua. It was without any
indication that it was a deprecated alias, but let's just bite the
bullet and get rid of it.
2023-09-20 12:51:52 -06:00
Mads Kiilerich
cbcb7b1ce2 temporal: refactor to expose superbeat tech debt
A group of functionality was only used once, in
TempoPoint::quarters_at_superclock . Keep things simple and enable
further refactoring and cleanup by inlining everything and dropping
superbeat, big_numerator and super_note_type_per_second from Tempo.

The use of big_numerator right next to superclock_ticks_per_second
seems error prone. It should perhaps just be refactored to work in
superclock domain all the time.

It seems weird that the ramped case is much simpler than the non-ramped.

This (pretty much) removes the last references to "superbeat", which
I thus doesn't have to understand ;-)
2023-09-20 12:51:52 -06:00
Mads Kiilerich
e5ec516611 temporal: drop unused superclocks_per_ppqn
superclocks-per-pulses-per-quarter-note is too meta to have any actual
use.
2023-09-20 12:51:52 -06:00
Mads Kiilerich
40bf4ce82d temporal: drop nused note_type_as_beats
The note_type_as_beats was the only temporal thing using hardcoded value
of 1920. It seems like it just should use the usual Ardour PPQN (aka
ticks_per_beat) ... which also has the value 1920.

It is however not used after d77db816de.
2023-09-20 12:51:52 -06:00
Mads Kiilerich
368f0aec44 temporal: minor comment fixes
Some typos and copy editing to remove a (pretty much) duplicated chunk.
2023-09-20 12:51:52 -06:00