e7e44351cc
temporal: move implementation of quarters_per_minute_at() into .cc file
2021-11-17 12:16:38 -07:00
a0e134e1b3
temporal: update comment on a method that suggest not using it; provide TempoMap::quarters_per_minute_at ()
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
8c632c8446
temporal: allow negative timecnt_t to be used when constructing a timepos_t
...
Negative positions are legal and should be handled by higher level logic
2021-11-14 15:22:53 -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
480907d613
add sstream header file, since the header file requires the defn
2021-10-14 13:12:31 -06:00
bb87ba49d9
remove unnecessary boost header (we have our own ratio_t)
2021-10-14 13:12:31 -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
0acc1a3fec
temporal: use correct implementation of timepos_t::operator+ (timecnt_t) (and +=)
...
If time domains differ, it is necessary to first convert the argument duration into a duration
at the position of "this", in the correct time domain. Then we recursively call the operator
again, but this time we will use the fast path that just adds two timepos_t values.
2021-10-04 17:45:02 -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
30a00c5e9f
Fix implementation of timecnt_t::operator==() to compare both duration and position
2021-09-25 16:49:51 -06:00
John Emmas
666e62076c
Part 2: Complete the changes needed to make 'boost::intrusive::list' work with MSVC
...
It turned out that 'boost::intrusive::list_base_hook<>' won't compile if its parent class is declared using '__declspec(dllexport)' - so rather than exporting each entire class, let's use the alternative approach and export the various class members individually.
2021-09-18 13:40:22 +01:00
cb81b06a5d
Revert "Fix div/zero, allow switching backends"
...
This reverts commit 1288262ca7
.
2021-09-15 17:52:53 +02:00
John Emmas
840e63e6b2
Prefer tags for 'boost::intrusive::list' rather than list_member_hook<>
...
list_member_hook<> is very troublesome in MSVC and is known to cause problems in other compilers when used inside a class which has a virtual base class.
2021-09-15 09:28:54 +01:00
1288262ca7
Fix div/zero, allow switching backends
...
When switching backends, the effective sample-rate is zero.
This only affects the butler thread (the only active thread when
stopped). The actual issue here is the butler calling
"non-realtime-stop" without a backend. However fixing 0/0
generally seems appropriate.
```
#0 in int_div_round<long>(long, long) (x=0, y=0) at ../libs/pbd/pbd/integer_division.h:36
#1 in Temporal::samples_to_superclock(int64_t, int) (samples=0, sr=0) at ../libs/temporal/temporal/superclock.h:39
#2 in Temporal::timepos_t::timepos_t(long) (this=0x7f94bc0a5890, s=0) at ../libs/temporal/temporal/timeline.h:55
#3 in ARDOUR::Automatable::non_realtime_locate(long) (this=0x55a12a980cc8, now=0) at ../libs/ardour/automatable.cc:421
#4 in ARDOUR::Route::non_realtime_locate(long) (this=0x55a12a980ae0, pos=0) at ../libs/ardour/route.cc:5462
#5 in ARDOUR::Session::non_realtime_stop(bool, int, bool&) (this=0x55a12e0cd000, abort=false, on_entry=1, finished=@0x7f94bc0a5e0f: true) at ../libs/ardour/session_transport.cc:1487
#6 in ARDOUR::Session::butler_transport_work(bool) (this=0x55a12e0cd000, have_process_lock=false) at ../libs/ardour/session_transport.cc:1153
#7 in ARDOUR::Butler::thread_work() (this=0x55a12f3b7000) at ../libs/ardour/butler.cc:222
#8 in ARDOUR::Butler::_thread_work(void*) (arg=0x55a12f3b7000) at ../libs/ardour/butler.cc:16
```
2021-09-11 04:54:40 +02:00
1904c4aa29
temporal: fix operator>> for Beats when handling pre-nutempo formats (double)
2021-09-10 12:15:24 -06:00
John Emmas
f6ed73986b
A few visibility changes needed for linking to libtemporal (when building with MSVC)
2021-09-04 12:28:15 +01:00
John Emmas
d7d966e02b
Adapt 'Temporal::TempoMap::tempo_map_p' to be buildable with MSVC
...
Whenever a variable gets declared using 'thread_local' MSVC requires that it should not be compiled with DLL linkage (i.e. it mustn't be exportable). So for Temporal::TempoMap we'll need to export the required members individually, rather than exporting the entire class.
2021-09-03 10:02:41 +01:00
7dba843cb4
temporal: fix error in operator>> for BBT_offset
2021-08-31 22:33:33 -06:00
4eda53c8c9
temporal: add to_string() converters for BBT_Offset
2021-08-31 16:45:44 -06:00
Nil Geisweiller
21c94b23f3
Make BBT_Time::print_padded const
...
As this method does not modify BBT_Time it can be const. This allows such
method to be called over a const BBT_Time instance.
2021-08-30 02:24:38 +03:00
John Emmas
d3cd621f7a
Initial changes needed for building libtemporal with MSVC
...
Later I'll need to push some extra changes (to support 'tempo_map_p' and 'boost::intrusive::list' etc) but these initial ones (hopefully!) won't cause any issues for the other builds.
2021-08-29 11:03:58 +01:00
fee4292bde
allow negative superclock -> negative beats computation
2021-08-23 11:36:54 -06:00
2f4a623c56
remove unnecessary headers
2021-08-13 15:31:43 -06:00
9c2e4ec6d2
libtemporal: fix timepos_t::set_time_domain()
...
For legacy reasons, this was going via a sample intermediate representation
2021-08-13 12:51:36 -06:00
1927e4673b
remove StepSequencer, BeatBox and BeatBoxGUI from wscripts and #ifdef code occurences. Files remain
2021-08-13 12:51:36 -06:00
e7cdca1ea2
remove some debug output
2021-08-13 12:51:36 -06:00
caba355012
Add required copy constructor for Temporal::Meter
2021-08-13 12:51:35 -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
3256350ef8
libtemporal: needs "OSX" pseudo-lib to pick up required macOS flags
2021-08-13 12:51:35 -06:00
5895909188
libtemporal: remove unnecessary inclusion of pbd/compose.h from beats.h
...
this causes breakage in clangs ADL lookup of various operator<<() overloads
2021-08-13 12:51:35 -06:00
3170f880c2
stop clang from complaining about a missing return after a guaranteed assert() failure
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
092a454648
fix timepos_t::string_to (wrong argument to samples_to_superclock()
2021-08-13 12:51:35 -06:00
445ad2e383
rearrange if/else logic to avoid NOTREACHED condition
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
0b1d44f422
temporal: fix timepos_t::decrement() to not switch domains
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
c0c3fd07c9
libtemporal: add timecnt_t::end() and timecnt_t::set_time_domain()
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
0877500437
libtemporal: don't compile file removed (too early) in a55df1ad6
2021-08-13 12:51:34 -06:00
5b3c5d3782
libtemporal: fix implementation of timepos_t::max() to avoid overflow for Beats time
2021-08-13 12:51:34 -06:00
b2510c0da2
libardour: use appropriate method to set AutomationList time domain from ::set_state()
2021-08-13 12:51:34 -06:00
2049cc44b2
libtemporal: tweak: don't both with local tempo map ptr
2021-08-13 12:51:34 -06:00
433a9ebe48
libtemporal: catch attempts to convert max audio time values into beats, early
2021-08-13 12:51:34 -06:00
d576fc8ca9
libtemporal: when computing Beats from a ticks value, do not try to pass potentially overflowing ticks value
2021-08-13 12:51:34 -06:00
1af74f7398
libtemporal: correct the definition of std::numeric_limits<Beats>::max(). Comment in code contains details.
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
877e896caf
libtemporal: TempoMap::apply_with_metrics() needs to use *all* metrics (inc. MusicTimePoints)
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
cc0d065443
libtemporal: preparations to solve upcoming diamond inheritance problem
2021-08-13 12:51:34 -06:00
4e6c06bc95
libtemporal: add maybe-not-required operator>> for timeline types
2021-08-13 12:51:34 -06:00
ce82efafcf
libtemporal: slightly improve output from conversion statistics
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
c8175b7c49
libtemporal: add new constructors for MusicTimePoint and MeterPoint
2021-08-13 12:51:33 -06:00
f86395688e
libtemporal: Beats::round_to_subdivision() was incorectly folding the "beats" part of the value back into the answer.
...
The "beats" value is already implicit in the "ticks" we actually do the math with
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
b8a7de43b6
libtemporal: change Tempo API to ensure that the correct construtor is called
...
This could be probably be improved with an even more distinct ramped/non-ramped API
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
25375ee6f4
add timepos_t::set_time_domain() to potentially change time domains
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
8f147f273a
add new debug bit for Temporal grid stuff
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
8737603d93
libtemporal: add abort_update() API to header
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
6a9330b2b0
libtemporal: fix TempoMap::fetch_writable() so that it actually does what its name describes
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
016aada4df
libtemporal: fix/improve/correct parsing of timecnt_t from string
2021-08-13 12:51:32 -06:00
d165c492af
temporal: fix/simplify/improve parsing of time values from strings
2021-08-13 12:51:32 -06:00
e590598dcf
libtemporal: move DEBUG::Beats into correct location
2021-08-13 12:51:32 -06:00
f015c08dd9
libtemporal: move Beats operator<< and operator>> to .cc and add exceptions for input
2021-08-13 12:51:32 -06:00
78233b343f
libtemporal: add operator<<() for ratio_t
2021-08-13 12:51:32 -06:00
209908f700
libtemporal: improve/fix implementation of timepos_t::operator+=(timepos_t)
2021-08-13 12:51:32 -06:00
9438295607
libtemporal: fix implementation of timecnt_t::operator+ (timecnt_t)
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
3eac6ac7dc
Temporal: remove last (?) double-based method
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
80986b9445
libtemporal: add (commented) debug output for timepos_t::distance() methods
2021-08-13 12:51:31 -06:00
6fe4394c54
fix parameter name in comment
2021-08-13 12:51:31 -06:00
8c22ade428
libtemporal: fix Beats::round_to_subdivision()
2021-08-13 12:51:31 -06:00
0fa56402be
move DEBUG::SnapBBT into libtemporal
2021-08-13 12:51:31 -06:00
df0ac42f54
Temporal: cleanup for explicit Beats::operator bool()
2021-08-13 12:51:31 -06:00
05740e7069
Temporal: mark Beats::operator bool() as explicit, to avoid unintended/accidental use when implicitly casting to int/float types
2021-08-13 12:51:31 -06:00
5e0cf747bb
Temporal: removed unused std::numeric_limits<> definitions for timeline types
...
There can be no single ::max() or ::min() value for these types because the time domain matters. With a given
tempo map, a certain beat value represent a time before or after the maximum possible audio domain value
2021-08-13 12:51:31 -06:00
de3eb54958
Temporal: in an update to the previous commit, actually remove timepos_t::compute_ticks() rather than claim to implement it
2021-08-13 12:51:31 -06:00
400018e121
Temporal: implement timepos_t::compute_ticks()
2021-08-13 12:51:31 -06:00
0ce40fc648
Temporal: fix timepos_t (Beats) constructor
...
flag bit was set incorrectly
2021-08-13 12:51:31 -06:00
747281a244
Temporal: fix implementation of timecnt_t::operator= (timecnt_t const &)
...
It is OK now to have inconsistent time domains inside a timecnt_t
2021-08-13 12:51:31 -06:00
3900537fcf
split Beats::round_to_subdivision() into source module
...
Rounding to bar requires access to the tempo map, and we don't want this in
the beats.h header
2021-08-13 12:51:31 -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
bed76798f3
manual fixups after rebase against master (general libs edition)
2021-08-13 12:51:31 -06:00
afea443419
remove API from Temporal:timecnt_t that used superclock_t
...
Not possible for a compiler to differentiate superclock_t and sample(pos|cnt)_t, which can lead to
subtle but major errors
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