40 virtual const char*
what()
const throw() {
return "illegal BBT time (bars or beats were zero, or ticks was too large)"; }
59 bool is_bar()
const {
return beats == 1 && ticks == 0; }
60 bool is_beat()
const {
return ticks == 0; }
62 BBT_Time () : bars (1), beats (1), ticks (0) {}
63 BBT_Time (int32_t ba, uint32_t be, uint32_t t) : bars (ba), beats (be), ticks (t) {
64 if (!bars || !beats) {
70 return bars < other.
bars ||
71 (bars == other.
bars && beats < other.
beats) ||
72 (bars == other.
bars && beats == other.
beats && ticks < other.
ticks);
75 bool operator<= (
const BBT_Time& other)
const {
76 return bars < other.
bars ||
77 (bars <= other.
bars && beats < other.
beats) ||
78 (bars <= other.
bars && beats <= other.
beats && ticks <= other.
ticks);
82 return bars > other.
bars ||
83 (bars == other.
bars && beats > other.
beats) ||
84 (bars == other.
bars && beats == other.
beats && ticks > other.
ticks);
87 bool operator>= (
const BBT_Time& other)
const {
88 return bars > other.
bars ||
89 (bars >= other.
bars && beats > other.
beats) ||
90 (bars >= other.
bars && beats >= other.
beats && ticks >= other.
ticks);
94 return bars == other.
bars && beats == other.
beats && ticks == other.
ticks;
97 bool operator!= (
const BBT_Time& other)
const {
98 return bars != other.
bars || beats != other.
beats || ticks != other.
ticks;
101 bool operator< (
const BBT_Offset& other)
const;
102 bool operator<= (
const BBT_Offset& other)
const;
103 bool operator> (
const BBT_Offset& other)
const;
104 bool operator>= (
const BBT_Offset& other)
const;
106 bool operator!= (
const BBT_Offset& other)
const;
131 o << std::setfill (
'0') << std::right
132 << std::setw (3) << bars <<
"|"
133 << std::setw (2) << beats <<
"|"
134 << std::setw (4) << ticks;
137 std::string
str ()
const {
138 std::ostringstream os;
139 os << bars <<
'|' << beats <<
'|' << ticks;
157 BBT_Offset (int32_t ba, uint32_t be, uint32_t t) : bars (ba), beats (be), ticks (t) {}
181 beats += other.
beats;
182 ticks += other.
ticks;
188 beats -= other.
beats;
189 ticks -= other.
ticks;
201 bars = (int32_t) lrint (bars * factor);
202 beats = (int32_t) lrint (beats * factor);
203 ticks = (int32_t) lrint (ticks * factor);
215 bars = (int32_t) lrint (bars / factor);
216 beats = (int32_t) lrint (beats / factor);
217 ticks = (int32_t) lrint (ticks / factor);
222 return bars < other.
bars ||
223 (bars == other.
bars && beats < other.
beats) ||
224 (bars == other.
bars && beats == other.
beats && ticks < other.
ticks);
228 return bars < other.
bars ||
229 (bars <= other.
bars && beats <= other.
beats) ||
230 (bars <= other.
bars && beats <= other.
beats && ticks <= other.
ticks);
234 return bars > other.
bars ||
235 (bars == other.
bars && beats > other.
beats) ||
236 (bars == other.
bars && beats == other.
beats && ticks > other.
ticks);
240 return bars > other.
bars ||
241 (bars >= other.
bars && beats >= other.
beats) ||
242 (bars >= other.
bars && beats >= other.
beats && ticks >= other.
ticks);
246 return bars == other.
bars && beats == other.
beats && ticks == other.
ticks;
250 return bars != other.
bars || beats != other.
beats || ticks != other.
ticks;
253 operator bool()
const {
254 return bars == 0 && beats == 0 && ticks == 0;
257 std::string
str ()
const {
258 std::ostringstream os;
259 os << bars <<
'|' << beats <<
'|' << ticks;
336 std::numeric_limits<int32_t>::max(),
337 std::numeric_limits<int32_t>::max());
353 std::numeric_limits<int32_t>::max(),
354 std::numeric_limits<int32_t>::max());
366 std::ostringstream ostr;
375 std::ostringstream ostr;
383 std::istringstream istr (str);
399 std::ostringstream ostr;
408 std::ostringstream ostr;
416 std::istringstream istr (str);
bool to_string(ARDOUR::AnyTime const &at, std::string &str)
bool string_to(std::string const &str, ARDOUR::AnyTime &at)
BBT_Offset bbt_delta(Temporal::BBT_Time const &a, Temporal::BBT_Time const &b)
static const int32_t ticks_per_beat
bool operator==(const ProcessorSelection &a, const ProcessorSelection &b)
BBT_Offset operator+(const BBT_Offset &other) const
BBT_Offset & operator/=(double factor)
BBT_Offset & operator*=(double factor)
BBT_Offset & operator/=(int factor)
BBT_Offset(int32_t ba, uint32_t be, uint32_t t)
BBT_Offset & operator+=(const BBT_Offset &other)
BBT_Offset operator-(const BBT_Offset &other) const
BBT_Offset operator-() const
BBT_Offset & operator*=(int factor)
BBT_Offset(BBT_Time const &bbt)
BBT_Offset & operator-=(const BBT_Offset &other)
BBT_Time round_up_to_beat() const
void print_padded(std::ostream &o) const
int64_t as_integer() const
BBT_Time(int32_t ba, uint32_t be, uint32_t t)
BBT_Time round_down_to_beat() const
BBT_Time round_up_to_beat_div(int beat_div) const
bool operator<(const BBT_Time &other) const
BBT_Time round_down_to_bar() const
static BBT_Time from_integer(int64_t)
bool operator<=(const BBT_Time &other) const
BBT_Time round_to_beat() const
BBT_Time round_up_to_bar() const
BBT_Time prev_bar() const
bool operator==(const BBT_Time &other) const
bool operator>(const BBT_Time &other) const
bool operator>=(const BBT_Time &other) const
bool operator!=(const BBT_Time &other) const
BBT_Time next_bar() const
virtual const char * what() const
static Temporal::BBT_Offset min()
static Temporal::BBT_Time max()
static Temporal::BBT_Offset lowest()
static Temporal::BBT_Time min()
static Temporal::BBT_Time max()
static Temporal::BBT_Time lowest()