Paul Davis
7dbf2445f5
tempo map: NOOP: expand comment to explain more
2021-11-17 12:16:39 -07:00
Paul Davis
a5ccb521e6
tempo map: NOOP helpful comment, perhaps
2021-11-17 12:16:39 -07:00
Paul Davis
c7adea3ec0
tempo map: really no-op code change to provide another useless compiler const hint
2021-11-17 12:16:39 -07:00
Paul Davis
d9b1d2ccc8
temporal: NOOP add helpful comment about bar_mod argument
2021-11-17 12:16:39 -07:00
Paul Davis
b3451f4055
tempo map: fix computation of superclocks_per_note_type_at()
...
Code used position as an absolute, rather than offset from the point
that defines tempo. It worked if the point was at zero, but not
otherwise.
2021-11-17 12:16:39 -07:00
Paul Davis
a417cbae4b
tempo map: fix a potential bug (not seen in the wild) when generating the grid
...
the "p" variable could point to _points.end(), so we cannot indirect and use
p->sclock() value unconditionally.
2021-11-17 12:16:39 -07:00
Paul Davis
1ba2e28d6f
tempo map: fix grid generation with ramped tempos
...
The old code used the instantaneous tempo at T0 to compute where the next
quarter note would be. This is incorrect, since the tempo is
changing (continuously, for now) during the time represented by that quarter
note. Instead, we need to add a quarter note (or technically, whatever the
tempo note type is) to get a new position in beats, then compute the superclock
time at that location (which will use our equations for tempo, including the
use of omega, the ramp factor).
2021-11-17 12:16:39 -07:00
Paul Davis
7edcda4fc1
temporal: logic fixes for several tempo map modification methods
2021-11-17 12:16:39 -07:00
Paul Davis
7a12458244
temporal: improve implementation of TempoMap::meter_at() and more templating
...
Needed to move template defns around to ensure that required instances are defined
2021-11-17 12:16:38 -07:00
Paul Davis
4128088b70
temporal: TempoMap::tempo_at() ... templates FTW
2021-11-17 12:16:38 -07:00
Paul Davis
fb2281129a
temporal: add clarifying comments to TempoMap::remove_*()
...
These comments should correct an impression left in the commit message for
6e9e28343bc3695d that there may be some sort of problem with synchronization
of TempoMap changes. The actual problem is that TempoMap edits are done using
RCU, so the modifications are performaned using a copy of the map, but with
map elements taken from the pre-copy version.
2021-11-17 12:16:38 -07:00
Paul Davis
b67965f499
temporal: add the entire _points list to output of TempoMap::dump()
2021-11-17 12:16:38 -07:00
Paul Davis
8a59f3fe8e
temporal: fix issue with removal of tempo, meter and bartime points
...
The correct algorithm is to traverse the type-specific list of points,
find the point (if any) whose time matches that of the argument (because
we do not allow multiple points of the same type at the same time), and
then use that discovered point from the _points list.
This approach is required because the actual argument may no longer be
in the tempo map (due to a change made by another thread). The lack of
sync, however, needs investigation.
2021-11-17 12:16:38 -07:00
Paul Davis
5b5ca546e0
temporal: fix incorrect implementation of TempoMap::tempo_map()
...
std::lower_bound() is not appropriate here. We need to find the first
TempoPoint after the given time, then return the one before that.
2021-11-17 12:16:38 -07:00
Paul Davis
e7e44351cc
temporal: move implementation of quarters_per_minute_at() into .cc file
2021-11-17 12:16:38 -07:00
Paul Davis
4f3bf37680
temporal: implement a faster method to lookup TempoPoint
...
There is no reason to build a TempoMetric if you only need the Tempo
2021-11-17 12:16:38 -07:00
Paul Davis
4376185a6b
temporal: fix TempoPoint::superclock_at (Beats)
...
a negative beat position needs to be legal, so the assert was moved and modified. The only check
for a negative value is that the TempoPoint being used is at absolute zero.
This check might turn out to be wrong in the future, but for now we still require a tempo and
meter point at absolute zero
2021-10-29 12:55:14 -06:00
Paul Davis
89c17dfe7d
remove debug output
2021-10-05 14:00:34 -06:00
Paul Davis
dadf530243
temporal: change loading of session format 3x tempo maps
...
We were attempting to add the initial tempo and meter twice, which was unwise
2021-10-05 13:57:10 -06:00
Robin Gareus
ed3d374f47
Fix --no-nls compilation 1/2 -- #8802
...
pbd/i18n.h MUST NEVER be included from header files and always be
the last include. This is because `_` is declared other headers
notably boost and some apple headers.
leading to issues like
../libs/pbd/gettext.h:58:27: error: expected unqualified-id before ‘const’
58 | # define gettext(Msgid) ((const char *) (Msgid))
2021-09-27 16:28:44 +02:00
Paul Davis
fee4292bde
allow negative superclock -> negative beats computation
2021-08-23 11:36:54 -06:00
Paul Davis
38aa2560f3
libtemporal: remove unnecessary initialization
2021-08-13 12:51:35 -06:00
Paul Davis
f61adcd738
temporal: knarly template code to consolidate and rationalize duplicated methods
2021-08-13 12:51:35 -06:00
Paul Davis
585346ce56
libtemporal: fix many different issues with tempo ramps
...
API changes, ensuring omega is computed, saved, and restored, generic methods to get tempo/meter at a position, and lots more
2021-08-13 12:51:35 -06:00
Paul Davis
f721655916
libtemporal: to quote the matrix, there is no lock
2021-08-13 12:51:35 -06:00
Paul Davis
bccdc95f32
libtemporal: fix logic for ::get_tempo_and_meter() if starting point is the timeline start
2021-08-13 12:51:35 -06:00
Paul Davis
1f8290f154
generalize repeated code into a template method, add lots of const-ness to facilitate this
2021-08-13 12:51:35 -06:00
Paul Davis
c5ecd14622
temporal: fix logic errors in setting up TempoMetric objects
...
will likely revisit this to avoid code-duplication and "optimize" traversal of _points list
2021-08-13 12:51:35 -06:00
Paul Davis
8bada4b5e1
remove public ::bbt_at (INTEGER) methods, because of superclock_t/samplepos_t confusion
...
libtemporal still needs ::bbt_at (superclock_t) fairly often so retain it as a private method, but public
interfaces take either Beats or timepos_t
2021-08-13 12:51:35 -06:00
Paul Davis
53e411c011
fix logic error in conditional
2021-08-13 12:51:35 -06:00
Paul Davis
6f2fdc2695
functioning loading of older tempo map XML data
2021-08-13 12:51:35 -06:00
Paul Davis
b84402f4f8
intial steps for adding legacy (v0-5) tempo map deserialization support
2021-08-13 12:51:35 -06:00
Paul Davis
344dd26788
improved DEBUG_TRACE statements for tempo map
2021-08-13 12:51:35 -06:00
Paul Davis
cd34695944
fix TempoMap::quarters_at_superclock (superclock_t)
2021-08-13 12:51:35 -06:00
Paul Davis
74ff3b22b8
fix TempoPoint::superclock_at(Beats)
2021-08-13 12:51:35 -06:00
Paul Davis
216945a89c
move TempoMap::write_copy() into .cc file instead of .h
2021-08-13 12:51:35 -06:00
Paul Davis
ce3fb0507c
change return type of Tempo::set_{ramped,clamped} and fix call sites
2021-08-13 12:51:35 -06:00
Paul Davis
99c8c0b658
initial, tentative, untested implementation of TempoMap::remove_time()
2021-08-13 12:51:35 -06:00
Paul Davis
991a7bf8a7
add TempoMap::count_bars() to allow bar counting even with position (BBT) markers in the tempo map
...
This just reuses the algorithm in TempoMap::get_grid() by asking for just the bar grid, and counting the
size of the result
2021-08-13 12:51:35 -06:00
Paul Davis
0ab2308523
reimplement TempoMap::midi_clock_beat_at_or_after()
2021-08-13 12:51:35 -06:00
Paul Davis
daad7b74ae
libtemporal: rename TempoMap::full_duration_at() to ::convert_duration() and reorder parameters
2021-08-13 12:51:34 -06:00
Paul Davis
7773fc5b64
libtemporal: TempoMap::full_duration_at() returns correct value for unchanged time domain call
2021-08-13 12:51:34 -06:00
Paul Davis
b7bc3b1947
libtemporal: expand comment to explain more about what TempoMap::full_duration_at() does
2021-08-13 12:51:34 -06:00
Paul Davis
beaa1b3fcb
be sure to check the return from the RCU mgr ::update method() inside TempoMap::update()
2021-08-13 12:51:34 -06:00
Paul Davis
bbb3ca01fa
libtemporal: remove several BBT-related methods that are not used and problematic for BBT/position markers
2021-08-13 12:51:34 -06:00
Paul Davis
0667a50a11
libtemporal: improve TempoMap::get_grid()'s decision making about what bar points to include when bar_mod == 1
2021-08-13 12:51:34 -06:00
Paul Davis
a49ed5505e
libtemporal: no need for a default MusicTimePoint in the tempo map (default tempo+meter points serve same role)
2021-08-13 12:51:34 -06:00
Paul Davis
34a3db7eaa
use existing (inline) method for updating thread local tempo map after update (avoid code duplication)
2021-08-13 12:51:34 -06:00
Paul Davis
901f593af5
avoid unnecessary extra fetch of thread-local tempo map after undo/redo
2021-08-13 12:51:34 -06:00
Paul Davis
cffc25a11c
libtemporal: make TempoMap::metric_at() variants use all Points, to account for music time points as well as explicit tempo/meter points
2021-08-13 12:51:34 -06:00