File: timer.c

package info (click to toggle)
wavtools 1.3.2-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 196 kB
  • ctags: 92
  • sloc: ansic: 416; makefile: 103; tcl: 72; sh: 20
file content (19 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <sys/ioctl.h>
#include <stdio.h>
#include "wav_lib.h"


int update_timer(wav_sig *info){
	int hr, mn, sc;
#ifdef PLAY
	ioctl(dsp_fd, SNDCTL_DSP_GETOPTR, &cinfo);
#else
	ioctl(dsp_fd, SNDCTL_DSP_GETIPTR, &cinfo);
#endif

	hr = cinfo.bytes / 3600 / info->srate / info->blkalign;
	mn = (cinfo.bytes / 60 / info->srate / info->blkalign) % 60 + 1;
	sc = (cinfo.bytes / info->srate / info->blkalign) % 60 + 1;
	fprintf(stderr,"\r[TIME: %.2d:%.2d:%.2d]",hr, mn - 1, sc - 1);
	return 0;
}