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.
This commit is contained in:
Paul Davis 2022-03-17 14:14:41 -06:00
parent 641589c56a
commit a803dd0df8
7 changed files with 40 additions and 30 deletions

View file

@ -19,13 +19,22 @@
#include "temporal/superclock.h"
#ifndef COMPILER_MSVC
Temporal::superclock_t Temporal::superclock_ticks_per_second = 508032000; // 2^10 * 3^4 * 5^3 * 7^2
Temporal::superclock_t Temporal::_superclock_ticks_per_second = 56448000; /* 2^10 * 3^2 * 5^3 * 7^2 */
#endif
int Temporal::most_recent_engine_sample_rate = 48000; /* have to pick something as a default */
bool Temporal::scts_set = false;
void
Temporal::set_sample_rate (int sr)
{
most_recent_engine_sample_rate = sr;
}
void
Temporal::set_superclock_ticks_per_second (Temporal::superclock_t sc)
{
_superclock_ticks_per_second = sc;
scts_set = true;
}