Commit graph

345 commits

Author SHA1 Message Date
Paul Davis
b80b4b7869 remove debugging output 2025-08-05 11:42:23 -06:00
Paul Davis
b65adb59cd temporal: fix some subtle misbehavior in TempoMap::cut_copy() 2025-08-05 11:37:35 -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
b6f1ff336e when adding a tempo/meter at end of map, no reset necessary
Also, the reset would malfunction which really ought to be fixed
2025-07-30 22:18:12 -06:00
Paul Davis
0e42868d35 fix arithmetic error in Meter::to_quarters 2025-04-11 11:23:36 -06:00
Paul Davis
9f3a41b96b manually revert fa376b709d and debef6ab
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
2025-02-28 13:39:45 -07: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
5ebf8152ec temporal: tempo changes must be on meter-provided grid, not quarter notes 2025-01-09 22:30:17 -07:00
Paul Davis
5f943295fc copying a tempo map should not bail out just because there is only 1 tempo & meter 2024-12-18 16:46:07 -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
Robin Gareus
2d7cce44f1
Replace PBD::Signals (1/2) 2024-10-18 20:41:08 +02:00
Robin Gareus
e75ad3399e
Fix BBT marker calculation when removing time 2024-05-14 03:20:04 +02: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
5723c9bf9c temporal: slightly more debug info when computing quarters from superclock 2023-11-13 22:32:15 -07:00
Paul Davis
04523dee97 temporal: NOOP reindent #ifdef'ed out code 2023-11-13 22:32:15 -07:00
Paul Davis
ce4d1ffe51 temporal: after loading an old tempo map, reset it to compute omega etc. 2023-11-13 22:32:15 -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
ea02c49856 a better solution for the problem being addressed in b40513ff7 2023-10-22 17:31:29 -06:00
Paul Davis
b40513ff7d temporal: workaround (perhaps temporary) for rounding issues in ::midi_clock_beat_at_or_after() 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
Paul Davis
64458c2430 prevent meter changes being dragged "through" a BBT marker
might want to do this for tempo drags too
2023-10-07 11:11:31 -06:00
Paul Davis
ec34c2137d avoid a crash when dragging a meter change near a BBT marker 2023-10-07 11:11:31 -06:00
Paul Davis
bdd0fda188 remove debug output 2023-10-06 17:08:28 -06:00
Paul Davis
cd1d83f366 reintroduce a fake XML "active" property for Tempo to allow 7.x to load 8.x sessions 2023-10-05 11:22:38 -06:00
Paul Davis
0c3791117c remove much debug output associated with tempo map copy/pasta, et al. 2023-10-04 08:37:26 -06:00
Paul Davis
364c892c68 remove debug output 2023-10-03 11:13:57 -06:00
Paul Davis
616273cfab temporal: slightly tweak DEBUG_TRACE output 2023-09-22 22:54:53 -06:00
Paul Davis
d282c317d0 temporal: use new BBT variant of get_tempo_and_meter() 2023-09-22 15:18:27 -06:00
Paul Davis
a89108c9af temporal: removed #if 0'ed old code 2023-09-22 15:18:27 -06:00
Paul Davis
ad7bcd2ebe temporal: add clarification on why the non-ramped ::quarters@superclock is so complex 2023-09-20 13:38:15 -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
91314b68a5 temporal: always use Temporal::reset() for superclock and TempoMap default values
Make sure all code paths that use Temporal will initialize and reset it
properly. Some code paths (in tet runners) doesn't use Sessions, so
Temporal::reset() has to be invoked directly.

Just set the static superclock variable to 0 as initial value.
TempoMap will still be initialized early as a singleton, but we
introduce a new constructor so it is created empty (and thus not really
usable until Temporal::reset() or similar has populated it).

We can thus drop the static initialization of superclock. The default
superclock rate of 282240000 will now only live in Temporal::reset().

With this change there should no longer be any uninitialized use of
superclock_ticks_per_second(), and there should not be any problems for
DEBUG_EARLY_SCTS_USE to catch. (It is however broken in other ways -
that will be fixed next.)
2023-09-20 12:30:53 -06:00
Paul Davis
2f502b28c7 temporal: fix weird typo in tempo map cut/copy code 2023-09-19 14:16:18 -06:00
Paul Davis
6a8946a746 NOOP: whitespace fix 2023-09-17 20:38:34 -06:00
Paul Davis
75e12993c6 temporal: fix grid generation in trivial case (1 tempo, 1 meter at zero)
We need to do the same "round up to bar/beat" trick that we do when we reach a BBT
marker
2023-09-17 20:38:23 -06:00
Paul Davis
eca4c83b7b temporal: remove concept of inactive tempos 2023-09-11 10:26:54 -06:00
Paul Davis
58b667c6c0 temporal: fix crash caused by unsafe use of tempo map iterators 2023-09-06 14:46:24 -06:00
Paul Davis
269699c340 temporal: fix get_grid() to work in the presence of "weird" BBT markers 2023-09-04 19:41:25 -06:00
Paul Davis
13bdfda81a temporal: add Meter::round_up_to_beat_div()
reimplement round_up_to_beat() in terms of round_up_to_beat_div()
2023-09-04 19:41:25 -06:00
Paul Davis
7c5e7ddf59 temporal: improve operator<<() for MusicTimePoint (BBT markers) 2023-09-04 19:41:25 -06:00
Paul Davis
0266d98a3b temporal: add TempoMap::{max,min}_notes_per_minute() API 2023-08-31 18:23:40 -06:00
Paul Davis
cda0d6ce9f temporal: fix totally broken implementation of TempoMap::shift (timepos...) 2023-08-31 18:22:59 -06:00
Paul Davis
c778a6df67 ripple backwards when cutting a section 2023-08-31 18:22:25 -06:00
Paul Davis
c4cb8dbda9 arithmetic simplification 2023-08-30 16:07:48 -06:00
Paul Davis
6c44dbf9d6 temporal: a guess at how to use BBT markers from within TempoMap::paste()
Basically, if the paste position is not zero and not on a bar line, we will a BBT marker there,
using the existing tempo & meter at that position before the paste.

If the end of the paste is not on a bar line, we will place a BBT marker there,
using the tempo & meter that existed before the paste.

TempoMap::paste() now also accepts an optional final argument that if provided is
used to name the BBT markers, if they are created
2023-08-30 15:21:55 -06:00
Paul Davis
7aa1863c0f somewhat working tempo map cut/copy/paste 2023-08-30 14:16:21 -06:00