diff --git a/libs/surfaces/control_protocol/control_protocol/timecode.h b/libs/surfaces/control_protocol/control_protocol/timecode.h index f30234b248..6b04b70cc3 100644 --- a/libs/surfaces/control_protocol/control_protocol/timecode.h +++ b/libs/surfaces/control_protocol/control_protocol/timecode.h @@ -19,6 +19,7 @@ #ifndef __ardour_timecode_h__ #define __ardour_timecode_h__ +#include #include namespace Timecode { @@ -51,6 +52,15 @@ struct Time { subframes = 0; rate = a_rate; } + + std::ostream& print (std::ostream& ostr) const { + if (negative) { + ostr << '-'; + } + ostr << hours << ':' << minutes << ':' << seconds << ':' << frames << '.' << subframes << " @" << rate << (drop ? " drop" : " nondrop"); + return ostr; + } + }; Wrap increment( Time& timecode, uint32_t ); @@ -67,4 +77,6 @@ void hours_floor( Time& timecode ); } // namespace Timecode +std::ostream& operator<<(std::ostream& ostr, const Timecode::Time& t); + #endif // __ardour_timecode_h__ diff --git a/libs/surfaces/control_protocol/smpte.cc b/libs/surfaces/control_protocol/smpte.cc index 555dc86d38..10edd62542 100644 --- a/libs/surfaces/control_protocol/smpte.cc +++ b/libs/surfaces/control_protocol/smpte.cc @@ -426,3 +426,9 @@ hours_floor( Time& timecode ) } // namespace Timecode + +std::ostream& +operator<<(std::ostream& ostr, const Timecode::Time& t) +{ + return t.print (ostr); +}