Commit graph

315 commits

Author SHA1 Message Date
Mads Kiilerich
06f8936a73 wscript: remove trailing whitespace 2022-04-09 12:16:37 +02:00
Paul Davis
7fd8544e31 temporal: fix copy-n-paste error in TempoCommand cosntructor 2022-04-08 11:58:04 -06:00
Paul Davis
e466736e2d temporal: remove MementoBinder API for tempo map undo/redo 2022-04-08 11:58:04 -06:00
Paul Davis
a806ede94d temporal: add TempoCommand, a Command-derived structure for managing undo/redo w.r.t TempoMap 2022-04-08 11:58:04 -06:00
Paul Davis
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
Paul Davis
7bf89ce109 Constification: make Stateful::get_state() const, with all other required const-ness added (libs) 2022-04-06 21:56:59 -06:00
Paul Davis
1d10408bd1 temporal: add some relatively useless code to one of the timeline test functions 2022-04-05 20:52:10 -06:00
Paul Davis
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
Paul Davis
dae649d79c temporal: add namespace to macro definition to make it usable everywhere 2022-04-05 20:52:09 -06:00
Paul Davis
bf2618e97b temporal: fix crash during reset_starting_at() 2022-03-23 18:03:42 -06:00
Paul Davis
857856431e temporal: remove debug output and stacktrace 2022-03-23 17:42:52 -06:00
Paul Davis
74a4678c04 temporal: NOOP add explanatory comment 2022-03-23 17:42:52 -06:00
Paul Davis
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
Paul Davis
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
Paul Davis
d29c70a2a2 temporal: add new variant of TempoMap::bbtwalk_to_quarters() 2022-03-19 15:25:14 -06:00
Paul Davis
8ebd097df9 move #includes so that they are only used if needed 2022-03-17 17:43:43 -06:00
Paul Davis
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
Robin Gareus
e603b2e12d
Remove debug messages (1/2) 2022-03-16 17:08:14 +01:00
Paul Davis
10dc09fcd4 temporal: extend TempoMap thread local ptr API a little
This allows checking to see if the map has changed compared with the thread's
current local pointer.
2022-03-14 14:03:07 -06:00
Paul Davis
da95a0a0ee replace sample rate callback used for superclock<=>sample conversion
Now using a globally-scoped static variable which is updated by the
AudioEngine whenever an SR change occurs. Defaults to 48kHz and can
be used even before there is a backend.
2022-03-14 14:03:07 -06:00
Robin Gareus
2c769e9f23
Fix Beats::rount_to.. Bar rounding 2022-03-04 19:41:25 +01:00
Robin Gareus
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
Paul Davis
92d82866e0 temporal: add some basic BBT time tests
Some of the subtraction tests may need revising because it is not immediately clear that the
current answers are correct.
2022-02-21 11:55:44 -07:00
Paul Davis
c5d7883538 temporal: add skeleton for Timeline (timepos_t/timecnt_t) tests 2022-02-12 22:25:17 -07:00
Paul Davis
baaf332a94 temporal: add skeleton for TempoMap tests 2022-02-12 22:25:17 -07:00
Paul Davis
14ac8fd36b skeleton for temporal/BBT testing (empty for now) 2022-02-12 17:51:30 -07:00
Paul Davis
f641a0559f temporal: missing test source 2022-02-12 15:18:19 -07:00
Paul Davis
04bd9187e4 temporal: add (back) first set of unit tests
This just uses the old Evoral BeatTest. Some of the tests needed amending
because temporal uses rint() to convert between float and int, not just
a cast.
2022-02-12 15:12:35 -07:00
Paul Davis
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
Paul Davis
c6a31250ba alter Source::_length from timecnt_t to timepos_t
THe length of a Source(File) is always measured from its start. In this sense,
the length is like a position on the timeline, which is a duration with an
implicit origin, or a Region start, also a duration with an implicit origin (in
that case the start of the Source). There is no good reason for using
a timecnt_t for this value, because the position component of a timecnt_t
(the origin for the duration) is implicit and always zero. So we make
this property into a timepos_t, and include a number of asserts() to check
for common possible coding errors related to the time domain
2022-01-28 15:52:27 -07:00
Paul Davis
b7769a8f4b possible fix for a valgrind reported illegal read 2022-01-24 16:42:12 -07:00
Mads Kiilerich
8bb91099c5 wscript: drop configure statements already present in the top level wscript
Avoid repeated pointless configure messages like:
Checking for 'g++' (C++ compiler!)                   : /usr/lib64/ccache/g++
Checking for 'gcc' (C compiler)                      : /usr/lib64/ccache/gcc
2022-01-22 22:19:03 +01:00
Paul Davis
dbefba9904 temporal: have tempo map expose it's separate (intrusive) lists of tempo, meter and bbt points 2022-01-18 19:47:20 -07:00
Paul Davis
d8c90decf3 triggerbox: use follow length when quantizing re-start of Again-selected trigger
This also changes the virtual method from ::startup() to ::_startup() so that we can
safely have a default argument in ::startup().
2022-01-13 12:09:23 -07:00
Paul Davis
9b5e910717 temporal: add additional required string_to/to_string functions for BBT_Offset & BBT_Time 2021-12-18 14:11:25 -07:00
Robin Gareus
506bc3a6f6
Disambiguate zero(bool) constructor and is_zero() comparison
This is mainly for the benefit of Lua bindings, but also increases
overall API naming consistency with functions and methods
`is_XYZ()` being used elsewhere.

This API change breaks builds!
2021-12-11 14:33:45 +01:00
Paul Davis
940d8844e3 temporal: fix implementation of Beats::snap_to(), and add variants
::snap_to() was intended to round a Beats value to the nearest multiple
of another Beats value. It did not do that, but instead rounded down.
Worse, it used Beats::operator/ which in turn uses int_div_round(),
which is incorrect for a situation where we need integer truncation.

The changes fix the actual arithmetic and add 2 variant functions so that the
API includes round down, round up and round to nearest.
2021-11-29 21:50:29 -07:00
Paul Davis
878393e68b temporal: fix construction of timepos_t and timecnt_t with max_sample{pos,cnt}
max_samplepos and max_samplecnt and both INT64_MAX which is (a) too large to fit into a signed 62 bit
integer and (b) definitely too large to be represented in a signed 62 bit superclock value.

Move the constructors that use samplepos_t into the .cc file, and treat these two values as special
cases that mean "as large/late/huge/long as possible".
2021-11-22 10:35:52 -07:00
Paul Davis
d71b3100d8 temporal: handle negative positional values that somehow appear in older sessions 2021-11-22 10:28:13 -07:00
Paul Davis
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
Paul Davis
b1b5553d1d tempomap: allow access to TempoMap::bbt_at () variant 2021-11-17 15:58:33 -07:00
Paul Davis
2aefb472e2 temporal: change API of TempoMap::sample_at() to not require an explicit sample rate
We have a mechanism to get the engine sample rate and use that widely. We
should use it here also.
2021-11-17 15:56:06 -07:00
Paul Davis
3c9bebda00 remove debug output 2021-11-17 12:16:39 -07:00
Paul Davis
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
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
73c87064a5 tempo map: NOOP correct comment text 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