Example #1
0
void init_timer()
{
#if 0
	static int init = 1;
	if (init)
	{
		timer_init_save_state();
		init = 0;
	}

	if (conf.pal) {
			inc = ((AudioTime) (0.02) / nb_interlace);/* *(1<<TIMER_SH);*/
				  //(conf.sound ? (double) nb_interlace : 1.0);
		} else {
			inc = ((AudioTime) (1./(60./1.001)) / nb_interlace); /* *(1<<TIMER_SH); */
			//(conf.sound ? (double) nb_interlace : 1.0);
		}
#endif
	logMsg("init timer");
	timer_count = 0;
	for (int i = 0; i < MAX_TIMER; i++)
	  timers[i].del_it = 1;
}
Example #2
0
void my_timer()
{
    static int init = 1;
    int i;

    if (init)
		{
			timer_init_save_state();
			init = 0;


			if (conf.pal) 
			{
					inc = ((double) (0.02) / nb_interlace);/* *(1<<TIMER_SH);*/
					//(conf.sound ? (double) nb_interlace : 1.0);
			} 
			else
			{
				inc = ((double) (0.01666) / nb_interlace); /* *(1<<TIMER_SH); */
				//(conf.sound ? (double) nb_interlace : 1.0);
			}
			free_all_timer();
    }

    timer_count += inc;		/* 16ms par frame */

    for (i = 0; i < MAX_TIMER; i++)
		 {
			if ( (timer_count >= timers[i].time) && (timers[i].del_it == 0) )
			{
	    //printf("Timer_expire %d duration=%f param=%d\n",i,timers[i].time,timers[i].param); fflush(NULL);
	    if (timers[i].func) timers[i].func(timers[i].param);
	    timers[i].del_it = 1;
			}
    }

}