comparison base/RealTime.h @ 350:d7c41483af8f

* Merge from transforms branch -- switch over to using Transform object properly
author Chris Cannam
date Fri, 07 Dec 2007 16:47:31 +0000
parents 21b9b25bff48
children a38cd7823cb2
comparison
equal deleted inserted replaced
348:edda24bb85fc 350:d7c41483af8f
93 } 93 }
94 94
95 RealTime operator*(int m) const; 95 RealTime operator*(int m) const;
96 RealTime operator/(int d) const; 96 RealTime operator/(int d) const;
97 97
98 // Find the fractional difference between times 98 /**
99 // 99 * Return the ratio of two times.
100 */
100 double operator/(const RealTime &r) const; 101 double operator/(const RealTime &r) const;
101 102
102 // Return a human-readable debug-type string to full precision 103 /**
103 // (probably not a format to show to a user directly). If align 104 * Return a human-readable debug-type string to full precision
104 // is true, prepend " " to the start of positive values so that 105 * (probably not a format to show to a user directly). If align
105 // they line up with negative ones (which start with "-"). 106 * is true, prepend " " to the start of positive values so that
106 // 107 * they line up with negative ones (which start with "-").
108 */
107 std::string toString(bool align = false) const; 109 std::string toString(bool align = false) const;
108 110
109 // Return a user-readable string to the nearest millisecond 111 /**
110 // in a form like HH:MM:SS.mmm 112 * Convert a string as obtained from toString back to a RealTime
111 // 113 * object.
114 */
115 static RealTime fromString(std::string);
116
117 /**
118 * Return a user-readable string to the nearest millisecond, in a
119 * form like HH:MM:SS.mmm
120 */
112 std::string toText(bool fixedDp = false) const; 121 std::string toText(bool fixedDp = false) const;
113 122
114 // Return a user-readable string to the nearest second in a form 123 /**
115 // like "6s" (for less than a minute) or "2:21" (for more). 124 * Return a user-readable string to the nearest second, in a form
116 // 125 * like "6s" (for less than a minute) or "2:21" (for more).
126 */
117 std::string toSecText() const; 127 std::string toSecText() const;
118 128
119 // Convenience functions for handling sample frames 129 /**
120 // 130 * Convert a RealTime into a sample frame at the given sample rate.
131 */
121 static long realTime2Frame(const RealTime &r, unsigned int sampleRate); 132 static long realTime2Frame(const RealTime &r, unsigned int sampleRate);
133
134 /**
135 * Convert a sample frame at the given sample rate into a RealTime.
136 */
122 static RealTime frame2RealTime(long frame, unsigned int sampleRate); 137 static RealTime frame2RealTime(long frame, unsigned int sampleRate);
123 138
124 static const RealTime zeroTime; 139 static const RealTime zeroTime;
125 }; 140 };
126 141