示例#1
0
//========================================================================
void
setup ()
{
	unsigned int thread;
	//fprintf(stderr,"I am inside setup\n"),fflush(stderr);
	for (thread=0;thread<3;thread++) {
		top[thread].pid = GetCurrentThreadId ();
		top[thread].uid = 0L;
		top[thread].start_tv = now_tv ();
		top[thread].running = TRUE;
		top[thread].verbose = FALSE;
		if (thread != 1) top[thread].state = RUN_PLAY;
		else top[thread].state = RUN_PASS;
		top[thread].offset = 0;
		top[thread].jack.reset_size = 2048;
		reset_em =TRUE;
		setup_defaults (thread);
		
		//fprintf(stderr,"setup: defaults done thread %u\n", thread),fflush(stderr);
		uni[thread].meter.flag = TRUE;
		uni[thread].spec.flag = TRUE;
		top[thread].swch.env.fall.size = (int)(loc[thread].def.rate * 0.005);
		top[thread].swch.env.stdy.size = (int)(loc[thread].def.rate * 0.050);
		top[thread].swch.env.rise.size = (int)(loc[thread].def.rate * 0.005);


		top[thread].swch.env.curr.val = 0.0;
		top[thread].swch.env.curr.cnt = 0;
		top[thread].swch.env.rise.incr = 1.0f/(float)top[thread].swch.env.rise.size;
		top[thread].swch.env.fall.incr = 1.0f/(float)top[thread].swch.env.fall.size;
		//fprintf(stderr,"setup: switch done\n"),fflush(stderr);
		//fprintf(stderr,"setup: Entering workspace setup, thread %u\n", thread),fflush(stderr);
		setup_workspace (loc[thread].def.rate,
				loc[thread].def.size,
				loc[thread].def.mode,
				loc[thread].path.wisdom, loc[thread].def.spec, loc[thread].def.nrx, loc[thread].def.comp, thread);
		//fprintf(stderr,"setup: workspace done thread %u\n", thread),fflush(stderr);

		setup_local_audio (thread);
		//fprintf(stderr,"setup: setup_local_audio done\n"),fflush(stderr);
		setup_system_audio (thread);
		//fprintf(stderr,"setup: setup_system_audio done\n"),fflush(stderr);

		setup_threading (thread);
		//fprintf(stderr,"setup: threading done\n"),fflush(stderr);

		// setup_switching ();
		uni[thread].spec.flag = TRUE;
		uni[thread].spec.type = SPEC_POST_FILT;
		uni[thread].spec.scale = SPEC_PWR;
		uni[thread].spec.rxk = 0;
		reset_meters (thread);
		reset_spectrum (thread);
		reset_counters (thread);
		//fprintf(stderr,"setup sdr thread %0u: done\n",thread),fflush(stderr);
	}
}
示例#2
0
static struct tm
now_tm(void)
{
/* singleton, gives a consistent `now' throughout the whole run */
	static struct tm tm;
	struct timeval tv;

	if (LIKELY(tm.tm_year)) {
		/* sit back and relax */
		;
	} else if ((tv = now_tv()).tv_sec == 0U) {
		/* big cinema :( */
#if defined HAVE_SLOPPY_STRUCTS_INIT
		return (struct tm){};
#else  /* !HAVE_SLOPPY_STRUCTS_INIT */
		memset(&tm, 0, sizeof(tm));
#endif	/* HAVE_SLOPPY_STRUCTS_INIT */
	} else {