Mercurial > hg > svcore
comparison base/test/TestRealTime.h @ 1028:abe13fe10ed6
RealTime frame-conversion test
author | Chris Cannam |
---|---|
date | Wed, 14 Jan 2015 14:58:38 +0000 |
parents | 30afdc7c7b89 |
children | a1cd5abcb38b |
comparison
equal
deleted
inserted
replaced
1025:88b54a185a0a | 1028:abe13fe10ed6 |
---|---|
267 prev = curr; | 267 prev = curr; |
268 } | 268 } |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 | 272 void frame() |
273 | 273 { |
274 int frames[] = { | |
275 0, 1, 2047, 2048, 6656, 32767, 32768, 44100, 44101, 999999999 | |
276 }; | |
277 int n = sizeof(frames)/sizeof(frames[0]); | |
278 | |
279 int rates[] = { | |
280 1, 2, 8000, 22050, 44100, 44101, 192000 | |
281 }; | |
282 int m = sizeof(rates)/sizeof(rates[0]); | |
283 | |
284 for (int i = 0; i < n; ++i) { | |
285 int frame = frames[i]; | |
286 for (int j = 0; j < m; ++j) { | |
287 int rate = rates[j]; | |
288 | |
289 RealTime rt = RealTime::frame2RealTime(frame, rate); | |
290 int conv = RealTime::realTime2Frame(rt, rate); | |
291 QCOMPARE(frame, conv); | |
292 | |
293 rt = RealTime::frame2RealTime(-frame, rate); | |
294 conv = RealTime::realTime2Frame(rt, rate); | |
295 QCOMPARE(-frame, conv); | |
296 } | |
297 } | |
298 } | |
274 }; | 299 }; |
275 | 300 |
276 #endif | 301 #endif |