13
0

temporal: truncate ::to_string() method for timeline types to ::str() for easier use in debugger

This commit is contained in:
Paul Davis 2021-11-13 14:39:20 -07:00
parent 4fe1fec54e
commit 1532ebb38f
4 changed files with 17 additions and 12 deletions

View File

@ -81,7 +81,7 @@ DEFINE_ENUM_CONVERT(MusicalMode::Type)
template <>
inline std::string to_string (ARDOUR::timepos_t val)
{
return val.to_string ();
return val.str ();
}
template <>
@ -95,7 +95,7 @@ inline ARDOUR::timepos_t string_to (std::string const & str)
template <>
inline bool to_string (ARDOUR::timepos_t val, std::string & str)
{
str = val.to_string ();
str = val.str ();
return true;
}
@ -109,7 +109,7 @@ inline bool string_to (std::string const & str, ARDOUR::timepos_t & val)
template <>
inline std::string to_string (ARDOUR::timecnt_t val)
{
return val.to_string ();
return val.str ();
}
template <>
@ -123,7 +123,7 @@ inline ARDOUR::timecnt_t string_to (std::string const & str)
template <>
inline bool to_string (ARDOUR::timecnt_t val, std::string & str)
{
str = val.to_string ();
str = val.str ();
return true;
}

View File

@ -678,6 +678,7 @@ AudioTrigger::determine_tempo ()
mbpm.setBPMRange (metric.tempo().quarter_notes_per_minute () * 0.75, metric.tempo().quarter_notes_per_minute() * 1.5);
_apparent_tempo = mbpm.estimateTempoOfSamples (data[0], data_length);
_apparent_tempo = 120.0;
if (_apparent_tempo == 0.0) {
/* no apparent tempo, just return since we'll use it as-is */
@ -812,6 +813,8 @@ AudioTrigger::run (BufferSet& bufs, pframes_t nframes, pframes_t dest_offset, bo
pframes_t this_read;
#if 1
if (read_index < last_sample) {
/* still have data to push into the stretcher */
@ -855,6 +858,7 @@ AudioTrigger::run (BufferSet& bufs, pframes_t nframes, pframes_t dest_offset, bo
/* fetch the stretch */
_stretcher->retrieve (out, this_read);
#endif
/* deliver to buffers */
@ -862,7 +866,8 @@ AudioTrigger::run (BufferSet& bufs, pframes_t nframes, pframes_t dest_offset, bo
uint64_t channel = chn % data.size();
AudioBuffer& buf (bufs.get_audio (chn));
Sample* src = out[channel];
//Sample* src = out[channel];
Sample* src = data[channel] + read_index;
if (first) {
buf.read_from (src, this_read, dest_offset);

View File

@ -209,7 +209,7 @@ class LIBTEMPORAL_API timepos_t : public int62_t {
bool operator!= (Temporal::Beats const & b) { return beats() != b; }
bool string_to (std::string const & str);
std::string to_string () const;
std::string str () const;
/* note that the value returned if the time domain is audio is larger
than can be represented in musical time (for any realistic tempos).
@ -414,7 +414,7 @@ class LIBTEMPORAL_API timecnt_t {
timecnt_t & operator%=(timecnt_t const &);
bool string_to (std::string const & str);
std::string to_string () const;
std::string str () const;
private:
int62_t _distance; /* aka "duration" */

View File

@ -266,7 +266,7 @@ timecnt_t::string_to (std::string const & str)
}
std::string
timecnt_t::to_string () const
timecnt_t::str () const
{
std::stringstream ss;
@ -284,7 +284,7 @@ timecnt_t::to_string () const
*/
ss << '@';
ss << _position.to_string();
ss << _position.str();
return ss.str();
}
@ -429,7 +429,7 @@ timecnt_t::expensive_gte (timecnt_t const & other) const
std::ostream&
std::operator<< (std::ostream & o, timecnt_t const & tc)
{
return o << tc.to_string();
return o << tc.str();
}
std::istream&
@ -839,7 +839,7 @@ timepos_t::operator+=(timepos_t const & d)
std::ostream&
std::operator<< (std::ostream & o, timepos_t const & tp)
{
return o << tp.to_string();
return o << tp.str();
}
std::istream&
@ -852,7 +852,7 @@ std::operator>> (std::istream & o, timepos_t & tp)
}
std::string
timepos_t::to_string () const
timepos_t::str () const
{
if (is_beats()) {
return string_compose ("b%1", val());