Exemple #1
0
DttSP_EXP void
CWtoneExchange (float *bufl, float *bufr, int nframes)
{
	size_t numsamps, bytesize = sizeof (float) * nframes;

	if (cw_ring_reset)
	{
		size_t reset_size = (unsigned)nframes;
		cw_ring_reset = FALSE;
		EnterCriticalSection (cs_cw);
		ringb_float_restart (lring, reset_size);
		ringb_float_restart (rring, reset_size);
		//ringb_float_reset(lring);
		//ringb_float_reset(rring);
		memset (bufl, 0, bytesize);
		memset (bufr, 0, bytesize);
		LeaveCriticalSection (cs_cw);
		return;
	}
	if ((numsamps = ringb_float_read_space (lring)) < (size_t) nframes)
	{
		memset (bufl, 0, bytesize);
		memset (bufr, 0, bytesize);
		cw_ring_reset = TRUE;
	}
	else
	{
		EnterCriticalSection (cs_cw);
		ringb_float_read (lring, bufl, nframes);
		ringb_float_read (rring, bufr, nframes);
		LeaveCriticalSection (cs_cw);
	}	
}
Exemple #2
0
static void reset_system_audio(size_t nframes)
{
	size_t reset_size;
	unsigned int thread;
	const float zero = 0.;
	int i;

	reset_em = FALSE;
	for(thread = 0; thread < threadno; thread++) 
	{
		reset_size = max (top[thread].jack.reset_size, nframes);
		ringb_float_reset (top[thread].jack.ring.i.l);
		ringb_float_reset (top[thread].jack.ring.i.r);
		ringb_float_reset (top[thread].jack.auxr.i.l);
		ringb_float_reset (top[thread].jack.auxr.i.r);
		ringb_float_clear (top[thread].jack.ring.i.l, top[thread].jack.size * loc[thread].mult.ring-1);
		ringb_float_clear (top[thread].jack.ring.i.l, top[thread].jack.size * loc[thread].mult.ring-1);
		ringb_float_reset (top[thread].jack.ring.i.l);
		ringb_float_reset (top[thread].jack.ring.i.r);
//		ringb_float_reset (top[thread].jack.auxr.i.l);
//		ringb_float_reset (top[thread].jack.auxr.i.r);
	
		if (top[thread].offset < 0)
		{
			for(i=top[thread].offset;i<0;i++)
			{
				ringb_float_write(top[thread].jack.ring.i.l,&zero,1);
				ringb_float_write(top[thread].jack.auxr.i.l,&zero,1);
				//ringb_float_write(top[thread].jack.auxr.i.l,&zero,1);
			}
		}
		else
		{
			for(i=0;i<top[thread].offset;i++)
			{
				ringb_float_write(top[thread].jack.ring.i.r,&zero,1);
				ringb_float_write(top[thread].jack.auxr.i.r,&zero,1);
				//ringb_float_write(top[thread].jack.auxr.i.r,&zero,1);
			}
		}

		ringb_float_restart (top[thread].jack.ring.o.r, reset_size);
		ringb_float_restart (top[thread].jack.ring.o.l, reset_size);
		ringb_float_restart (top[thread].jack.auxr.o.r, reset_size);
		ringb_float_restart (top[thread].jack.auxr.o.l, reset_size);
		//ringb_float_restart (top[thread].jack.auxr.o.r, reset_size);
		//ringb_float_restart (top[thread].jack.auxr.o.l, reset_size);
	}
}
Exemple #3
0
DttSP_EXP void
SetKeyerPerf (BOOLEAN hiperf)
{
        int rc;
	pthread_t tmp_timer;
//fprintf(stderr,"SetKeyerPerf\n");
	tmp_timer = timerid;
	if (timerid != 0)
	{
		EnterCriticalSection(update_ok);
		timeKillEvent ((UINT) timerid);
		timerid = 0;
		sleep (11);
		LeaveCriticalSection(update_ok);
	}
	delCWToneGen (gen);
	if (hiperf)
	{
		HiPerformance = TRUE;
		key_poll_period = 1;
		TONE_SIZE = 48;
	}
	else
	{
		HiPerformance = FALSE;
		key_poll_period = 5;
		TONE_SIZE = 240;
	}
	gen = newCWToneGen (gain, freq, ramp, ramp, TONE_SIZE, SAMP_RATE);
	if (tmp_timer != 0)
	{
#ifndef INTERLEAVED
		EnterCriticalSection(cs_cw);
		ringb_float_restart (lring, SIZEBUF);
		ringb_float_restart (rring, SIZEBUF);
		LeaveCriticalSection(cs_cw);
#else
		ringb_float_restart (lring, SIZEBUF);
#endif
                rc=pthread_create(&timerid,NULL,timer_thread,NULL);
		//if ((timerid =
		//	timeSetEvent (key_poll_period, 1,
		//	(LPTIMECALLBACK) timer_callback,
		//	(DWORD_PTR) NULL, TIME_PERIODIC)) == (MMRESULT) NULL)
                if(rc!=0)
		    fprintf (stderr, "Timer failed\n"), fflush (stderr);      
    }
}