30 using boost::lexical_cast;
45 const FrameCnt MAX_FRAME = 265*24*60*60*25;
48 generateRandomFrameNr()
52 frameNr =
rani(2*MAX_FRAME) - MAX_FRAME;
54 return toString(frameNr)+
"#";
98 string srcCode = generateRandomFrameNr();
122 CHECK (5 == frames2 - frames1);
127 CHECK (srcCode ==
string(frames1));
128 CHECK (srcCode !=
string(frames2));
130 showTimeCode (frames1);
131 showTimeCode (frames2);
138 showTimeCode (TC timecode)
140 cout << timecode.describe()<<
"=\""<<timecode<<
"\" time = "<< timecode.getTime() << endl;
146 UNIMPLEMENTED (
"verify frame count time format");
153 UNIMPLEMENTED (
"verify fractional seconds as timecode format");
160 UNIMPLEMENTED (
"verify hour-minutes-seconds-millis timecode");
177 Time raw(555,23,42,5);
181 cout <<
"----SMPTE-----" << endl;
183 CHECK (
" 5:42:23:13" ==
string(smpte));
184 CHECK (raw -
Time(35,0) == smpte.getTime());
185 CHECK (13 == smpte.frames);
186 CHECK (23 == smpte.secs);
187 CHECK (42 == smpte.mins);
188 CHECK ( 5 == smpte.hours);
189 CHECK ( 1 == smpte.sgn);
190 CHECK (
"SMPTE" == smpte.describe());
193 CHECK (
" 5:42:23:14" ==
string(smpte));
195 CHECK (
" 5:42:24:01" ==
string(smpte));
197 CHECK (
" 5:40:00:01" ==
string(smpte));
198 CHECK (smpte.mins-- == 40);
199 CHECK (--smpte.mins == 38);
200 CHECK (
" 5:38:00:01" ==
string(smpte));
207 CHECK (
"- 0:21:59:24"==
string(smpte));
208 CHECK (tx -
Time(0,0,0,6) == smpte.getTime());
210 CHECK (-1 == smpte.sgn);
211 CHECK (smpte.mins > 0);
212 CHECK (smpte.secs > 0);
213 CHECK (smpte.frames > 0);
214 tx = smpte.getTime();
216 CHECK (
"- 0:22:00:00"==
string(smpte));
217 CHECK (smpte.getTime() == tx -
Time(1000/25,0,0,0));
219 CHECK (
"- 0:21:59:24"==
string(smpte));
220 CHECK (tx == smpte.getTime());
224 CHECK (
" 1:38:00:01"==
string(smpte));
225 CHECK (+1 == smpte.sgn);
226 CHECK (smpte.getTime() > 0);
227 CHECK (tx +
Time(0,0,0,2) == smpte.getTime());
228 smpte.secs -= 2*60*60;
229 CHECK (tx == smpte.getTime());
230 CHECK (
"- 0:21:59:24"==
string(smpte));
233 CHECK (
" 0:21:59:24"==
string(smpte));
234 CHECK (tx == -smpte.getTime());
235 CHECK (+1 == smpte.sgn);
237 smpte.secs.setValueRaw(61);
238 CHECK (smpte.secs == 61);
239 CHECK (smpte.getTime() ==
Time(1000*24/25, 01, 22));
240 CHECK (smpte.secs == 61);
241 CHECK (
" 0:21:61:24"==
string(smpte));
243 CHECK (smpte.secs == 1);
244 CHECK (smpte.mins == 22);
245 CHECK (
" 0:22:01:24"==
string(smpte));
247 smpte.frames.setValueRaw (25);
248 CHECK (
" 0:22:01:25"==
string(smpte));
250 CHECK (
"- 0:37:58:00"==
string(smpte));
252 smpte.mins.setValueRaw (59);
253 smpte.secs.setValueRaw (61);
254 smpte.frames.setValueRaw(-26);
255 smpte.hours.setValueRaw (-2);
256 CHECK (
"--2:59:61:-26"==
string(smpte));
257 tx = smpte.getTime();
259 smpte.invertOrientation();
260 CHECK (
" 1:00:00:01"==
string(smpte));
261 CHECK (tx == smpte.getTime());
263 smpte.frames.setValueRaw(-1);
265 CHECK (tx == smpte.getTime());
266 CHECK (
" 1:00:00:-1"==
string(smpte));
267 smpte.invertOrientation();
268 CHECK (
"--1:00:00:01"==
string(smpte));
269 CHECK (tx == smpte.getTime());
276 UNIMPLEMENTED (
"verify especially SMPTE-drop-frame timecode");
281 checkCopyAssignments ()
283 UNIMPLEMENTED (
"verify Timecode values can be copied and assigned properly");
a mutable time value, behaving like a plain number, allowing copy and re-accessing ...
Classical Timecode value reminiscent to SMPTE format.
Modifying time and timecode values.
static PQuant retrieve(Symbol gridID)
Access an existing grid definition or quantiser, known by the given symbolic ID.
static EncapsulatedMutation changeTime(Time)
Convenience factory to yield a simple Mutation changing the absolute start time.
int rani(uint bound=_iBOUND())
void accept(Mutation const &)
receive change message, which might cause re-quantisation
Implementation namespace for support and library code.
Lumiera's internal time value datatype.
format::Traits< FMT >::TimeCode formatAs() const
create new time code instance, then castInto
Timecode handling library This header defines the foundation interface TCode to represent a grid alig...
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Support library to represent grid-aligned time specifications This is part of Lumiera's time and time...
To establish a reference scale for quantised time values.
static EncapsulatedMutation nudge(int adjustment)
build a time mutation to nudge the target time value by an offset, defined as number of steps on an i...
int64_t FrameCnt
relative framecount or frame number.
A frame counting timecode value.
basic constant internal time value.
static const FrameRate PAL
predefined constant for PAL framerate
grid aligned time specification, referring to a specific scale.