7c3268d12f
temporal: TempoMap::use() returns a const ptr to enforce semantics (library version)
...
This commit leaves two issues outstanding:
1. unclear/ugly semantics for drag operations that reset the GUI thread's tempo map to the writable copy
2. undo/redo for the tempo map
These will be addressed in future commits
2022-04-08 11:58:04 -06:00
7bf89ce109
Constification: make Stateful::get_state() const, with all other required const-ness added (libs)
2022-04-06 21:56:59 -06:00
ae3548c1da
temporal: fix location of enum conversion decls
...
Without these changes, minor changes in include file
ordering or extent elsewhere can cause compiler errors.
2022-04-05 20:52:09 -06:00
bf2618e97b
temporal: fix crash during reset_starting_at()
2022-03-23 18:03:42 -06:00
857856431e
temporal: remove debug output and stacktrace
2022-03-23 17:42:52 -06:00
74a4678c04
temporal: NOOP add explanatory comment
2022-03-23 17:42:52 -06:00
214c291e55
temporal: fix ::set_state() for old sessions where initial meter was moved to non-zero location
2022-03-23 17:42:52 -06:00
b4cf61304c
fix meter point removal
...
std::upper_bound() was not the correct tool to find the existing point,
it should have been std::lower_bound(). For code consistency, this
change doesn't use either but like ::remove_tempo() and similar methods,
just iterates over the whole list
2022-03-21 11:35:34 -06:00
d29c70a2a2
temporal: add new variant of TempoMap::bbtwalk_to_quarters()
2022-03-19 15:25:14 -06:00
a803dd0df8
superclock_ticks_per_second: use an (inline) accessor, change value
...
We do not want a value as large as the previous one, which limits the time
range that can be represented in 62 bits unnecessarily. The new value is
9 times smaller than the previous value, and loses only 384000 as a significant
factor.
This commit also switches to using an (inline) accessor for superclock_ticks_per_second,
making it possible in debug/testing phases to spot early/illegal uses of the value.
2022-03-17 14:15:59 -06:00
e603b2e12d
Remove debug messages (1/2)
2022-03-16 17:08:14 +01:00
ab3a7dc721
Fix bbt_subtract math
...
When r.ticks is already negative, add the negative value
(not subtract), likewise handle negative beat offset correctly.
2022-03-04 19:40:30 +01:00
3553d56f05
tempo map: fix loading 6000-version or earlier tempo maps
...
Probably a copy-n-paste error meant the reversed logic was used
to decide if we had found an inital tempo and meter
2022-02-11 08:46:49 -07:00
b7769a8f4b
possible fix for a valgrind reported illegal read
2022-01-24 16:42:12 -07:00
6e404ea7bf
tempomap: reimplement TempoMap::bbt_walk()
...
This still needs work to deal correctly with negative (backwards/earlier)
walks.
2021-11-17 15:59:03 -07:00
3c9bebda00
remove debug output
2021-11-17 12:16:39 -07:00
180c1d7759
tempo map: slight reorganization of ::get_grid
...
This avoids resetting beats based on superclocks in case where we
already do the opposite.
2021-11-17 12:16:39 -07:00
7dbf2445f5
tempo map: NOOP: expand comment to explain more
2021-11-17 12:16:39 -07:00
a5ccb521e6
tempo map: NOOP helpful comment, perhaps
2021-11-17 12:16:39 -07:00
c7adea3ec0
tempo map: really no-op code change to provide another useless compiler const hint
2021-11-17 12:16:39 -07:00
d9b1d2ccc8
temporal: NOOP add helpful comment about bar_mod argument
2021-11-17 12:16:39 -07:00
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
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
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
7edcda4fc1
temporal: logic fixes for several tempo map modification methods
2021-11-17 12:16:39 -07:00
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
4128088b70
temporal: TempoMap::tempo_at() ... templates FTW
2021-11-17 12:16:38 -07:00
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
b67965f499
temporal: add the entire _points list to output of TempoMap::dump()
2021-11-17 12:16:38 -07:00
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
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
e7e44351cc
temporal: move implementation of quarters_per_minute_at() into .cc file
2021-11-17 12:16:38 -07:00
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
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
89c17dfe7d
remove debug output
2021-10-05 14:00:34 -06:00
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
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
fee4292bde
allow negative superclock -> negative beats computation
2021-08-23 11:36:54 -06:00
38aa2560f3
libtemporal: remove unnecessary initialization
2021-08-13 12:51:35 -06:00
f61adcd738
temporal: knarly template code to consolidate and rationalize duplicated methods
2021-08-13 12:51:35 -06:00
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
f721655916
libtemporal: to quote the matrix, there is no lock
2021-08-13 12:51:35 -06:00
bccdc95f32
libtemporal: fix logic for ::get_tempo_and_meter() if starting point is the timeline start
2021-08-13 12:51:35 -06:00
1f8290f154
generalize repeated code into a template method, add lots of const-ness to facilitate this
2021-08-13 12:51:35 -06:00
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
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
53e411c011
fix logic error in conditional
2021-08-13 12:51:35 -06:00
6f2fdc2695
functioning loading of older tempo map XML data
2021-08-13 12:51:35 -06:00
b84402f4f8
intial steps for adding legacy (v0-5) tempo map deserialization support
2021-08-13 12:51:35 -06:00
344dd26788
improved DEBUG_TRACE statements for tempo map
2021-08-13 12:51:35 -06:00
cd34695944
fix TempoMap::quarters_at_superclock (superclock_t)
2021-08-13 12:51:35 -06:00
74ff3b22b8
fix TempoPoint::superclock_at(Beats)
2021-08-13 12:51:35 -06:00
216945a89c
move TempoMap::write_copy() into .cc file instead of .h
2021-08-13 12:51:35 -06:00
ce3fb0507c
change return type of Tempo::set_{ramped,clamped} and fix call sites
2021-08-13 12:51:35 -06:00
99c8c0b658
initial, tentative, untested implementation of TempoMap::remove_time()
2021-08-13 12:51:35 -06:00
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
0ab2308523
reimplement TempoMap::midi_clock_beat_at_or_after()
2021-08-13 12:51:35 -06:00
daad7b74ae
libtemporal: rename TempoMap::full_duration_at() to ::convert_duration() and reorder parameters
2021-08-13 12:51:34 -06:00
7773fc5b64
libtemporal: TempoMap::full_duration_at() returns correct value for unchanged time domain call
2021-08-13 12:51:34 -06:00
b7bc3b1947
libtemporal: expand comment to explain more about what TempoMap::full_duration_at() does
2021-08-13 12:51:34 -06:00
beaa1b3fcb
be sure to check the return from the RCU mgr ::update method() inside TempoMap::update()
2021-08-13 12:51:34 -06:00
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
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
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
34a3db7eaa
use existing (inline) method for updating thread local tempo map after update (avoid code duplication)
2021-08-13 12:51:34 -06:00
901f593af5
avoid unnecessary extra fetch of thread-local tempo map after undo/redo
2021-08-13 12:51:34 -06:00
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
c2401c3097
libtemporal: redesign TempoMap::get_grid() to iterate over _points rather than separated _tempos and _meters
2021-08-13 12:51:34 -06:00
8124bec5a1
libtemporal: fix XML node structure for MusicTimePoint
2021-08-13 12:51:34 -06:00
1035f9bd62
libtemporal: fix crash caused by thinko
2021-08-13 12:51:34 -06:00
388fa1b894
libtemporal: when removing tempos/meters/musictime points, remove them from TempoMap::_points also
2021-08-13 12:51:34 -06:00
982ccec7ab
libtemporal: when adding tempos/meters/musictime points, add them to TempoMap::_points also
2021-08-13 12:51:34 -06:00
b43eca15b0
Revert "libtemporal: the TempoMap::_points list serves no purpose, so remove it"
...
This reverts commit edc93fc62b6a36949b3cc37aee333904bc6b97f0.
2021-08-13 12:51:34 -06:00
d6d0eb0d9e
libtemporal: MusicTimePoint now IS-A Point,Tempo and Meter, all at once
2021-08-13 12:51:34 -06:00
ffc9ab66b5
libtemporal: remove TempoMap::metric_at_locked() methods
...
There is no lock anymore, all modifications are done via RCU
2021-08-13 12:51:33 -06:00
c9d3381935
libtemporal: increase DEBUG_TRACE utility for ::get_grid() and related matters
2021-08-13 12:51:33 -06:00
bd1b6dcda3
libtemporal: start making tempo map work with non-monotonic BBT "bar times" present
2021-08-13 12:51:33 -06:00
97a3469972
use new Tempo API in two places where Tempo is explicitly constructed
2021-08-13 12:51:33 -06:00
c32de2355e
extra DEBUG_TRACE statement in tempo map grid computation
2021-08-13 12:51:33 -06:00
eccfc1db10
libtemporal: fix grid generation if we pass additional markers before reaching the end
2021-08-13 12:51:32 -06:00
3017cd0c1f
libtemporal: remove unnecessary debug output
2021-08-13 12:51:32 -06:00
a9bf1cff81
libtemporal: add and use TempoMap::superclocks_per_grid_at() to return superclock duration of a measure/bar division. This corrects the results of ::get_grid()
2021-08-13 12:51:32 -06:00
7f19f13ea9
libtemporal: superclocks_per_bar/grid() do not need a sample rate argument, so remove it
2021-08-13 12:51:32 -06:00
e187752771
libtemporal: use DEBUG::Grid inside TempoMap::get_grid() for slightly easier debugging
2021-08-13 12:51:32 -06:00
7ec5af0b60
libtemporal: fix/improve TempoMap::move_meter() for audio-time case
2021-08-13 12:51:32 -06:00
84f53e3dc9
libtemporal: return value from function
2021-08-13 12:51:32 -06:00
fbb8a562fd
libtemporal: fix implementation of TempoMetric::bbt_at() to deal with cases where the beats value is not in quarter notes e.g. 7/8 time
2021-08-13 12:51:32 -06:00
68f6bff258
libtemporal: improve implementation/accuracy of Meter::round_to_bar()
2021-08-13 12:51:32 -06:00
be0a68c610
libtemporal: the TempoMap::_points list serves no purpose, so remove it
2021-08-13 12:51:32 -06:00
261c46e0f7
libtemporal: fix meter/tempo API so that we always put a heap-allocated object in the tempos/meters lists
2021-08-13 12:51:32 -06:00
9a2ec93a74
libtemporal: fix bug with placement of new MeterPoint
2021-08-13 12:51:32 -06:00
d5bfbe1cf4
libtemporal: provide API to abort TempoMap RCU update step
2021-08-13 12:51:32 -06:00
2c80aab912
libtemporal: do not emit MapChanged from methods that change TempoMap, only when we use RCU to switch ptrs
2021-08-13 12:51:32 -06:00
37399f7d50
libtemporal: move TempoMap::update() into .cc, add debug output and emit relevant signal at end
2021-08-13 12:51:32 -06:00
364fffd458
temporal: TempoMap::Changed is now a static member named TempoMap::MapChanged
2021-08-13 12:51:32 -06:00
657350455e
temporal: implement copy operator and operator= for TempoMap
2021-08-13 12:51:32 -06:00
146b432c51
temporal: extend debug output
2021-08-13 12:51:32 -06:00
4b52e1bf23
temporal: slightly reduce overflow risk (see comment)
2021-08-13 12:51:32 -06:00
279d1aa5dc
temporal: catch a special case when converting between superclock and beats
2021-08-13 12:51:32 -06:00
13f4ee2c1e
temporal: remove unnecessary TempoMap::dump_locked() method
2021-08-13 12:51:32 -06:00
47aa232f60
temporal: fix up creating/resetting tempo map state via XML
2021-08-13 12:51:32 -06:00
fa67e07d87
temporal: remove debug output
2021-08-13 12:51:32 -06:00
1e9e02e42f
temporal: fix setting tempos and meters from XML state
2021-08-13 12:51:32 -06:00
3e8f4d80fb
remove (almost) all floating point operations from Beats, add DoubleableBeats
...
The latter is a "wrapper" around Beats that provides ::to_double() for those times when we
absolutely need a floating point representation
2021-08-13 12:51:32 -06:00
5bef968069
Temporal: replace thread_local sample rate with callback to get sample rate
2021-08-13 12:51:31 -06:00
6e9f57d2ad
Temporal: remove scope braces left over from when we used a lock to protect the tempo map
2021-08-13 12:51:31 -06:00
b6f2e39ed4
Temporal: remove BarTime
2021-08-13 12:51:31 -06:00
5987376afc
Temporal: avoid recursive descent in TempoMap::quarters_at (timepos_t)
2021-08-13 12:51:31 -06:00
43d84620e0
Temporal: clean up API to remove ambiguity about ::quarter*_at_*
...
superclock_t and samplepos_t have the same underlying C++ type, so methods that accept one or the
other as an argument need to be named to make it clear which type they accept. We do not need
the superclock_t variant publically, but it turns out to be useful within TempoMap.
2021-08-13 12:51:31 -06:00
9402548677
Temporal: add lots more DEBUG::TemporalMap output to tempo.cc
2021-08-13 12:51:31 -06:00
793579cf3f
Temporal: expand displayed info for Tempo's operator<<
2021-08-13 12:51:31 -06:00
a0b9030e3c
Temporal: fix logic during ::get_grid that ignored if rounding did nothing
2021-08-13 12:51:31 -06:00
f1bb135013
Temporal: fix computation of ::quarters_at()
2021-08-13 12:51:31 -06:00
c3d325b56a
Temporal: clean up API for timepos_t to remove unneeded duplicates and remove ambiguity
2021-08-13 12:51:31 -06:00
f8a0ba246c
move superclock_ticks_per_second declaration
2021-08-13 12:51:30 -06:00
02b98290c5
set uninitialized _time_domain member of TempoMap in constructor
2021-08-13 12:51:30 -06:00
8dbbc1df54
library changes to get libtemporal setup at application startup
2021-08-13 12:51:30 -06:00
49781e3b80
nominally fix up TempoMarkerDrag implementation for new TempoMap
2021-08-13 12:51:30 -06:00
cfac6ad254
comment code added in previous commit
2021-08-13 12:51:30 -06:00
44ff395ec8
move tempo map memento binder into .cc and actuall implement the RCU version
2021-08-13 12:51:30 -06:00
60d1c5f722
remove tempo map from Session
2021-08-13 12:51:30 -06:00
9f866a6bbe
consolidate some TempoMap modifier methods
2021-08-13 12:51:30 -06:00
c434289973
remove lock, _dirty and _generation nonsense from TempoMap (pre-RCU management)
2021-08-13 12:51:30 -06:00
1098b27b35
new tempo map API for almost all of the GUI now
2021-08-13 12:51:30 -06:00
e7d84a7c47
get further at runtime
2021-08-13 12:51:29 -06:00
534c08074d
changes to get program to actually run (missing symbols)
...
Still crashes at startup due to static initialization of initial tempo map.
2021-08-13 12:51:29 -06:00
f67029bd02
random commit to facilitate trivial move of work from laptop back to main system
2021-08-13 12:51:29 -06:00
bca8e2e8cc
libtemporal: changes derived from converting libardour
2021-08-13 12:51:28 -06:00
f06e2dd6d1
Temporal: remove constructors accepting scalar values from timepos_t/timecnt_t and force use of factory methods
...
This allows us to differentiate between superclock_t and samplepos_t (and related types) which are all typedef'ed to the
same underlying primitive C++ type. Without this, it would be impossible for the compiler or someone reading the code
to know whether a scalar passed to a constructor for a timeline type is in units of samples or superclocks
2021-08-13 12:51:28 -06:00
f5fad809fb
Temporal: add decl for thread-local tempo map pointer
2021-08-13 12:51:28 -06:00
4c6d6b14e5
Temporal: add new TempoMap implementation source
2021-08-13 12:51:28 -06:00