From 016aada4df1c5071336bce716470635a68a23da5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 28 Dec 2020 18:11:25 -0700 Subject: [PATCH] libtemporal: fix/improve/correct parsing of timecnt_t from string --- libs/temporal/timeline.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/temporal/timeline.cc b/libs/temporal/timeline.cc index 3a5dc9b151..285fb2b518 100644 --- a/libs/temporal/timeline.cc +++ b/libs/temporal/timeline.cc @@ -154,14 +154,17 @@ bool timecnt_t::string_to (std::string const & str) { superclock_t s; + samplecnt_t sm; + int64_t ticks; Beats beats; char sep; if (isdigit (str[0])) { /* old school position format: we assume samples */ std::stringstream ss (str); - ss >> s; - _distance = s; + ss >> sm; + _distance = int62_t (false, samples_to_superclock (sm, TEMPORAL_SAMPLE_RATE)); + _position = timepos_t (AudioTime); std::cerr << "deserialized timecnt from older " << str << " as " << *this << std::endl; return true; } @@ -174,8 +177,8 @@ timecnt_t::string_to (std::string const & str) _distance = int62_t (false, s); break; case 'b': - ss >> beats; - _distance = int62_t (true, beats.to_ticks()); + ss >> ticks; + _distance = int62_t (true, ticks); break; }