diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2016-05-31 17:28:11 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2016-05-31 17:28:11 +0000 |
commit | a985495a4ecc78af69c7d98a56c985ecbd01cea5 (patch) | |
tree | ae51946fb960666a6fa4a46ee20f1be8c771ba86 /usr.bin/aucat/aucat.c | |
parent | 733409e466c16a6664f6335d8c42f3dd46282923 (diff) |
Pass hr:min:sec:frame.cent to dev_mmcloc() directly and remove the
useless intermediate conversion from and to 2400-th of seconds.
Diffstat (limited to 'usr.bin/aucat/aucat.c')
-rw-r--r-- | usr.bin/aucat/aucat.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index 65c444fed2e..0333ed66a55 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -795,25 +795,35 @@ dev_mmcstop(void) * relocate all slots simultaneously */ static void -dev_mmcloc(unsigned int mmc) +dev_mmcloc(int hr, int min, int sec, int fr, int cent, int fps) { long long pos; - pos = mmc * dev_rate / MTC_SEC; + pos = dev_rate * hr * 3600 + + dev_rate * min * 60 + + dev_rate * sec + + dev_rate * fr / fps + + dev_rate * cent / (100 * fps); if (dev_pos == pos) return; dev_pos = pos; if (log_level >= 2) { log_puts("relocated to "); - log_putu((mmc / (MTC_SEC * 3600)) % 24); + log_putu(hr); log_puts(":"); - log_putu((mmc / (MTC_SEC * 60)) % 60); + log_putu(min); log_puts(":"); - log_putu((mmc / (MTC_SEC)) % 60); + log_putu(sec); log_puts("."); - log_putu((mmc / (MTC_SEC / 100)) % 100); + log_putu(fr); log_puts("."); - log_putu((mmc / (MTC_SEC / 100)) % 100); + log_putu(cent); + log_puts(" at "); + log_putu(fps); + log_puts("fps\n"); + + log_puts("pos: "); + log_putu(pos); log_puts("\n"); } if (dev_pstate == DEV_START) { @@ -877,11 +887,12 @@ dev_imsg(unsigned char *msg, unsigned int len) dev_mmcstop(); return; } - dev_mmcloc((x->u.loc.hr & 0x1f) * 3600 * MTC_SEC + - x->u.loc.min * 60 * MTC_SEC + - x->u.loc.sec * MTC_SEC + - x->u.loc.fr * (MTC_SEC / fps) + - x->u.loc.cent * (MTC_SEC / 100 / fps)); + dev_mmcloc(x->u.loc.hr & 0x1f, + x->u.loc.min, + x->u.loc.sec, + x->u.loc.fr, + x->u.loc.cent, + fps); break; } } |