File: timer.c

package info (click to toggle)
lletters 0.1.95-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,152 kB
  • ctags: 502
  • sloc: sh: 9,985; ansic: 3,225; makefile: 230; sed: 93; perl: 50
file content (17 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include "wav_lib.h"


int update_timer(wav_sig *info, int mode){
	int hr, mn, sc;
	if (mode == 1) {
	  ioctl(dsp_fd, SNDCTL_DSP_GETOPTR, &cinfo);
	} else {
	  ioctl(dsp_fd, SNDCTL_DSP_GETIPTR, &cinfo);
	}

	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);
}