temporal: always use Temporal::reset() for superclock and TempoMap default values

Make sure all code paths that use Temporal will initialize and reset it
properly. Some code paths (in tet runners) doesn't use Sessions, so
Temporal::reset() has to be invoked directly.

Just set the static superclock variable to 0 as initial value.
TempoMap will still be initialized early as a singleton, but we
introduce a new constructor so it is created empty (and thus not really
usable until Temporal::reset() or similar has populated it).

We can thus drop the static initialization of superclock. The default
superclock rate of 282240000 will now only live in Temporal::reset().

With this change there should no longer be any uninitialized use of
superclock_ticks_per_second(), and there should not be any problems for
DEBUG_EARLY_SCTS_USE to catch. (It is however broken in other ways -
that will be fixed next.)
This commit is contained in:
Mads Kiilerich 2022-06-18 21:09:14 +02:00 committed by Paul Davis
parent 622876c8ab
commit 91314b68a5
6 changed files with 8 additions and 6 deletions

View file

@ -32,7 +32,7 @@ typedef int64_t superclock_t;
#ifndef COMPILER_MSVC
extern superclock_t _superclock_ticks_per_second;
#else
static superclock_t _superclock_ticks_per_second = 282240000; /* 2^10 * 3^2 * 5^4 * 7^2 */
static superclock_t _superclock_ticks_per_second = 0;
#endif
extern bool scts_set;