From 34773ee5c0c48b4758a136ee66b2fb1f7ab48d45 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 29 Nov 2009 22:06:51 +0000 Subject: provide operator<< for Timecode::Time git-svn-id: svn://localhost/ardour2/branches/3.0@6208 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/control_protocol/control_protocol/timecode.h | 12 ++++++++++++ libs/surfaces/control_protocol/smpte.cc | 6 ++++++ 2 files changed, 18 insertions(+) (limited to 'libs/surfaces') 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); +} -- cgit v1.2.3