ardour/libs/temporal
Robin Gareus 14da117bc8 Add explicit round/floor integer multiply/divide
This fixes various rounding issues. Notably superclock to sample
conversion must always round down when playing forward.

`::process (start, end, speed = 1)` uses exclusive end.
Processing begins at `start` and end ends just before `end`.
Next cycle will begin with the current end.

One example where this failed:
 - New session at 48kHz
 - Change tempo to 130 BPM
 - Enable snap to 1/8 note
 - Snap playhead to 1|3|0
 - Enable Metronome
 - Play

`assert (superclock_to_samples ((*i).sclock(), sample_rate()) < end);`

end = 177231 samples == superclock 1042118280
A grid point is found at superclock 1042116920 (that is < 1042118280).
However converting it back to samples rounded it to sample 177231 == end,
while actual location is 1360 super-clock ticks before end.

The metronome click has to be started this cycle, since the same
position will not be found at the beginning of the next cycle, with
start = 177232.

Similarly a samplecnt_t t, converted to music-time and back must not be
later than the given sample.

```
timepos_t tsc (t);
assert (timepos_t::from_ticks (tsc.ticks ()).samples () <= t);
```

IOW. When playing forward, all super-clock time between 1|1|0 and 1|1|1
should round down to 1|1|0. "We have not yet reached the first tick".
2022-10-22 02:10:05 +02:00
..
MSVCtemporal Further change needed for 'libtemporal' 2020-05-29 12:28:13 +01:00
temporal Add explicit round/floor integer multiply/divide 2022-10-22 02:10:05 +02:00
test fix RangeTest to account for Range now using exclusive ends, not inclusive 2022-10-05 17:30:45 -06:00
bbt_time.cc temporal: fix a bug in BBT_Time::round_up_to_bar() 2022-08-03 10:59:29 -06:00
beats.cc temporal: fix a bug in BBT_Time::round_up_to_bar() 2022-08-03 10:59:29 -06:00
debug.cc temporal: add new debug bit for debug tracing just TempoMap::reset_starting_at() 2022-05-13 19:05:13 -06:00
enums.cc libtemporal: add operator<<() for ratio_t 2021-08-13 12:51:32 -06:00
range.cc Remove Range::squish debug information, used fixed modulo operation 2022-06-30 01:07:32 +02:00
superclock.cc increase superclock_ticks_per_second to provide integer handling for NTSC (following Facebook "flicks") 2022-10-13 18:05:49 -06:00
tempo.cc remove some debug output 2022-09-21 09:13:26 -06:00
test.cc basic work on a Tempo object that avoids (almost) all floating point arithmetic 2021-08-13 12:51:28 -06:00
test2.cc tweak test code to check int62_t::min and flag bit 2021-08-13 12:51:30 -06:00
time.cc Fix remaining doxygen warnings (!) 2019-09-30 21:03:29 +02:00
timeline.cc Add explicit round/floor integer multiply/divide 2022-10-22 02:10:05 +02:00
wscript More unit-tests updates 2022-10-01 16:57:12 +02:00