#ifndef __ardour_bbt_time_h__
#define __ardour_bbt_time_h__
+#include <ostream>
#include <stdint.h>
+#include <iomanip>
namespace ARDOUR {
-class TempoMetric;
-
struct BBT_Time {
- uint32_t bars;
- uint32_t beats;
- uint32_t ticks;
-
- BBT_Time() {
- bars = 1;
- beats = 1;
- ticks = 0;
- }
-
- BBT_Time (uint32_t ba, uint32_t be, uint32_t t)
- : bars (ba), beats (be), ticks (t) {}
-
- bool operator< (const BBT_Time& other) const {
- return bars < other.bars ||
- (bars == other.bars && beats < other.beats) ||
- (bars == other.bars && beats == other.beats && ticks < other.ticks);
- }
-
- bool operator== (const BBT_Time& other) const {
- return bars == other.bars && beats == other.beats && ticks == other.ticks;
- }
-
- static bool add (BBT_Time& target, const BBT_Time& other, const TempoMetric& metric);
- static bool subtract (BBT_Time& target, const BBT_Time& other, const TempoMetric& metric);
+ uint32_t bars;
+ uint32_t beats;
+ uint32_t ticks;
+
+ BBT_Time() {
+ bars = 1;
+ beats = 1;
+ ticks = 0;
+ }
+
+ BBT_Time (uint32_t ba, uint32_t be, uint32_t t)
+ : bars (ba), beats (be), ticks (t) {}
+
+ bool operator< (const BBT_Time& other) const {
+ return bars < other.bars ||
+ (bars == other.bars && beats < other.beats) ||
+ (bars == other.bars && beats == other.beats && ticks < other.ticks);
+ }
+
+ bool operator== (const BBT_Time& other) const {
+ return bars == other.bars && beats == other.beats && ticks == other.ticks;
+ }
};
+
+}
+
+inline std::ostream&
+operator<< (std::ostream& o, const ARDOUR::BBT_Time& bbt)
+{
+ o << bbt.bars << '|' << bbt.beats << '|' << bbt.ticks;
+ return o;
+}
+
+inline std::ostream&
+print_padded (std::ostream& o, const ARDOUR::BBT_Time& bbt)
+{
+ o << std::setfill ('0') << std::right
+ << std::setw (3) << bbt.bars << "|"
+ << std::setw (2) << bbt.beats << "|"
+ << std::setw (4) << bbt.ticks;
+ return o;
}
#endif /* __ardour_bbt_time_h__ */