示例#1
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);
	}
}
示例#2
0
/* ---------------------------------------------------------------------------- */
void
ringb_float_clear(ringb_float_t *rb, size_t nfloats) {
  size_t i;
  float zero = 0;
  for (i = 0; i < nfloats; i++)
    ringb_float_write(rb, &zero, 1);
}
示例#3
0
// silence -> output ringbuffer
void
send_silence (void)
{
	if (ringb_float_write_space (lring) < TONE_SIZE)
	{
		cw_ring_reset = TRUE;
	}
	else
	{
		int i;
		EnterCriticalSection (cs_cw);
		for (i = 0; i < gen->size; i++)
		{
			float zero = 0.0;
			ringb_float_write (lring, &zero, 1);
			ringb_float_write (rring, &zero, 1);
		}
		LeaveCriticalSection (cs_cw);
    }
}
示例#4
0
// generated tone -> output ringbuffer
void
send_tone (void)
{  
	if (ringb_float_write_space (lring) < TONE_SIZE)
	{
		cw_ring_reset = TRUE;
	}
	else
	{
		int i;
		EnterCriticalSection (cs_cw);
		correctIQ(gen->buf, tx[1].iqfix);
		for (i = 0; i < gen->size; i++)
		{
			float r = (float) CXBreal (gen->buf, i),
				l = (float) CXBimag (gen->buf, i);
			ringb_float_write (lring, (float *) &l, 1);
			ringb_float_write (rring, (float *) &r, 1);
		}
		LeaveCriticalSection (cs_cw);
	}
}
示例#5
0
PRIVATE void
gethold (unsigned int proc_thread)
{
    if (ringb_float_write_space (top[proc_thread].jack.ring.o.l) < top[proc_thread].hold.size.frames)
		{
			// pathology
			reset_em = TRUE;
		}
		else
		{
			ringb_float_write (top[proc_thread].jack.ring.o.l, top[proc_thread].hold.buf.l,
				top[proc_thread].hold.size.frames);
			ringb_float_write (top[proc_thread].jack.ring.o.r, top[proc_thread].hold.buf.r,
				top[proc_thread].hold.size.frames);
	#ifdef USE_AUXILIARY
			ringb_float_write (top[proc_thread].jack.auxr.o.l, top[proc_thread].hold.aux.l,
				top[proc_thread].hold.size.frames);
			ringb_float_write (top[proc_thread].jack.auxr.o.r, top[proc_thread].hold.aux.r,
				top[proc_thread].hold.size.frames);
	#else
			ringb_float_write (top[proc_thread].jack.auxr.o.l, top[proc_thread].hold.buf.l,
				top[proc_thread].hold.size.frames);
			ringb_float_write (top[proc_thread].jack.auxr.o.r, top[proc_thread].hold.buf.r,
				top[proc_thread].hold.size.frames);
		}
	#endif
		if (ringb_float_read_space (top[proc_thread].jack.ring.i.l) < top[proc_thread].hold.size.frames)
		{
			// pathology
			memset ((char *) top[proc_thread].hold.buf.l, 0, top[proc_thread].hold.size.bytes);
			memset ((char *) top[proc_thread].hold.buf.r, 0, top[proc_thread].hold.size.bytes);
			memset ((char *) top[proc_thread].hold.aux.l, 0, top[proc_thread].hold.size.bytes);
			memset ((char *) top[proc_thread].hold.aux.r, 0, top[proc_thread].hold.size.bytes);
			reset_em = TRUE;
		} else {
			ringb_float_read (top[proc_thread].jack.ring.i.l,
				top[proc_thread].hold.buf.l, top[proc_thread].hold.size.frames);
			ringb_float_read (top[proc_thread].jack.ring.i.r,
				top[proc_thread].hold.buf.r, top[proc_thread].hold.size.frames);
	#ifdef USE_AUXILIARY
			ringb_float_read (top[proc_thread].jack.auxr.i.l,
				top[proc_thread].hold.aux.l, top[proc_thread].hold.size.frames);
			ringb_float_read (top[thread].jack.auxr.i.r,
				top[proc_thread].hold.aux.r, top[proc_thread].hold.size.frames);
	#else
			ringb_float_read (top[proc_thread].jack.auxr.i.l,
				top[proc_thread].hold.buf.l, top[proc_thread].hold.size.frames);
			ringb_float_read (top[proc_thread].jack.auxr.i.r,
				top[proc_thread].hold.buf.r, top[proc_thread].hold.size.frames);
	#endif
		}
}
示例#6
0
PRIVATE void
puthold(unsigned int proc_thread)
{
	   if (ringb_float_write_space (top[proc_thread].jack.ring.o.l) >= top[proc_thread].hold.size.frames)
		{
			ringb_float_write (top[proc_thread].jack.ring.o.l, top[proc_thread].hold.buf.l,
				top[proc_thread].hold.size.frames);
			ringb_float_write (top[proc_thread].jack.ring.o.r, top[proc_thread].hold.buf.r,
				top[proc_thread].hold.size.frames);
	#ifdef USE_AUXILIARY
			ringb_float_write (top[proc_thread].jack.auxr.o.l, top[proc_thread].hold.aux.l,
				top[proc_thread].hold.size.frames);
			ringb_float_write (top[proc_thread].jack.auxr.o.r, top[proc_thread].hold.aux.r,
				top[proc_thread].hold.size.frames);
	#else
			ringb_float_write (top[proc_thread].jack.auxr.o.l, top[proc_thread].hold.buf.l,
				top[proc_thread].hold.size.frames);
			ringb_float_write (top[proc_thread].jack.auxr.o.r, top[proc_thread].hold.buf.r,
				top[proc_thread].hold.size.frames);
		}
	#endif

}
示例#7
0
DttSP_EXP void
Audio_Callback2 (float **input, float **output, unsigned int nframes)
{
	unsigned int thread;
	BOOLEAN b = reset_em;
	BOOLEAN return_empty=FALSE;
	for(thread=0;thread<threadno;thread++) {
		if (top[thread].susp) return_empty = TRUE;
	}
	if (return_empty)
	{
			for(thread=0;thread<threadno;thread++)  {
				memset (output[2*thread], 0, nframes * sizeof (float));
				memset (output[2*thread+1], 0, nframes * sizeof (float));
			}
			return;
	}
	if (b)
	{
		reset_system_audio(nframes);
		for(thread=0;thread<threadno;thread++) {
			memset (output[2*thread], 0, nframes * sizeof (float));
			memset (output[2*thread+1], 0, nframes * sizeof (float));
		}
		return;
    }
	for(thread=0;thread<threadno;thread++) {
		int l=2*thread,r = 2*thread+1;
		if ((ringb_float_read_space (top[thread].jack.ring.o.l) >= nframes)
			&& (ringb_float_read_space (top[thread].jack.ring.o.r) >= nframes))
		{
			ringb_float_read (top[thread].jack.auxr.o.l, output[l], nframes);
			ringb_float_read (top[thread].jack.auxr.o.r, output[r], nframes);
			ringb_float_read (top[thread].jack.ring.o.l, output[l], nframes);
			ringb_float_read (top[thread].jack.ring.o.r, output[r], nframes);
		}
		else
		{	// rb pathology
			reset_em=TRUE;//reset_system_audio(nframes);
			memset (output[2*thread  ], 0, nframes * sizeof (float));
			memset (output[2*thread+1], 0, nframes * sizeof (float));
		}

		// input: copy from port to ring
		if ((ringb_float_write_space (top[thread].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[thread].jack.ring.i.r) >= nframes))
		{
			ringb_float_write (top[thread].jack.ring.i.l, input[l], nframes);
			ringb_float_write (top[thread].jack.ring.i.r, input[r], nframes);
			ringb_float_write (top[thread].jack.auxr.i.l, input[l], nframes);
			ringb_float_write (top[thread].jack.auxr.i.r, input[r], nframes);
		}
		else
		{	// rb pathology
			reset_em=TRUE;
			memset (output[2*thread  ], 0, nframes * sizeof (float));
			memset (output[2*thread+1], 0, nframes * sizeof (float));
		}
			// if enough accumulated in ring, fire dsp
		if (ringb_float_read_space (top[thread].jack.ring.i.l) >= top[thread].hold.size.frames)
			sem_post (&top[thread].sync.buf.sem);

	}

}
示例#8
0
DttSP_EXP void
Audio_Callback (float *input_l, float *input_r, float *output_l,
	float *output_r, unsigned int nframes)
{
	BOOLEAN b = reset_em;
	int i;
	if (top[0].susp)
	{
		memset (output_l, 0, nframes * sizeof (float));
		memset (output_r, 0, nframes * sizeof (float));
		return;
	}

	if (b)
	{
		reset_system_audio(nframes);
		memset (output_l, 0, nframes * sizeof (float));
		memset (output_r, 0, nframes * sizeof (float));
		return;
    }

	for (i=0;i<2;i++) {
		if ((ringb_float_read_space (top[i].jack.ring.o.l) >= nframes)
			&& (ringb_float_read_space (top[i].jack.ring.o.r) >= nframes))
		{
			if (top[i].state == RUN_PLAY) {
				ringb_float_read (top[i].jack.auxr.o.l, output_l, nframes);
				ringb_float_read (top[i].jack.auxr.o.r, output_r, nframes);
				ringb_float_read (top[i].jack.ring.o.l, output_l, nframes);
				ringb_float_read (top[i].jack.ring.o.r, output_r, nframes);
			} else {
				ringb_float_read_advance (top[i].jack.auxr.o.l, nframes);
				ringb_float_read_advance (top[i].jack.auxr.o.r, nframes);
				ringb_float_read_advance (top[i].jack.ring.o.l, nframes);
				ringb_float_read_advance (top[i].jack.ring.o.r, nframes);

			}
		}
		else
		{	// rb pathology
			reset_em=TRUE;
			memset (output_l, 0, nframes * sizeof (float));
			memset (output_r, 0, nframes * sizeof (float));
		}

		// input: copy from port to ring
		if ((ringb_float_write_space (top[i].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[i].jack.ring.i.r) >= nframes))
		{
			ringb_float_write (top[i].jack.ring.i.l, (float *) input_l, nframes);
			ringb_float_write (top[i].jack.ring.i.r, (float *) input_r, nframes);
			ringb_float_write (top[i].jack.auxr.i.l, (float *) input_l, nframes);
			ringb_float_write (top[i].jack.auxr.i.r, (float *) input_r, nframes);
		}
		else
		{	// rb pathology
			reset_em=TRUE;
			memset (output_l, 0, nframes * sizeof (float));
			memset (output_r, 0, nframes * sizeof (float));
		}

		// if enough accumulated in ring, fire dsp
		if (ringb_float_read_space (top[i].jack.ring.i.l) >= top[i].hold.size.frames)
			sem_post (&top[i].sync.buf.sem);
	}
}
示例#9
0
DttSP_EXP void
Audio_Callback2 (float **input, float **output, unsigned int nframes)
{
	unsigned int thread;
	BOOLEAN b = reset_em;
	BOOLEAN return_empty=FALSE;
	unsigned int i;
	for(thread=0;thread<threadno;thread++)
	{
		if (top[thread].susp) return_empty = TRUE;
	}

	if (return_empty)
	{
		for(thread=0;thread<threadno;thread++) 
		{
			memset (output[2*thread], 0, nframes * sizeof (float));
			memset (output[2*thread+1], 0, nframes * sizeof (float));
		}
		return;
	}

	if (b)
	{
		//fprintf(stderr, "reset_em!\n"); fflush(stderr);
		//fprintf(stdout,"Audio_Callback2: reset_em = TRUE\n"), fflush(stdout);
		reset_system_audio(nframes);
		for(thread=0;thread<threadno;thread++) {
			memset (output[2*thread], 0, nframes * sizeof (float));
			memset (output[2*thread+1], 0, nframes * sizeof (float));
		}
		return;
    }
#if 0
	if (diversity.flag) {
		// Deal with the transmitter first
		if ((ringb_float_read_space (top[1].jack.ring.o.l) >= nframes)
			&& (ringb_float_read_space (top[1].jack.ring.o.r) >= nframes))
		{
			ringb_float_read (top[1].jack.ring.o.l, output[2], nframes);
			ringb_float_read (top[1].jack.ring.o.r, output[3], nframes);
		}
		else
		{	
			// rb pathology
			//reset_system_audio(nframes);
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[thread], 0, nframes * sizeof (float));
				memset (output[thread], 0, nframes * sizeof (float));
			}
			return;
		}

		// input: copy from port to ring
		if ((ringb_float_write_space (top[1].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[1].jack.ring.i.r) >= nframes))
		{
			ringb_float_write (top[1].jack.ring.i.l, input[2], nframes);
			ringb_float_write (top[1].jack.ring.i.r, input[3], nframes);
		}
		else
		{	
			// rb pathology
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[thread], 0, nframes * sizeof (float));
				memset (output[thread], 0, nframes * sizeof (float));
			}
			return;
		}
		
		// if enough accumulated in ring, fire dsp
		if ((ringb_float_read_space (top[1].jack.ring.i.l) >= top[1].hold.size.frames) &&
			(ringb_float_read_space (top[1].jack.ring.i.r) >= top[1].hold.size.frames))
			sem_post (&top[1].sync.buf.sem);

		//		
		// Deal with the diversity channel next
		//
		if ((ringb_float_read_space (top[0].jack.ring.o.l) >= nframes)
			&& (ringb_float_read_space (top[0].jack.ring.o.r) >= nframes))
		{
			/*ringb_float_read (top[thread].jack.auxr.o.l, output[l], nframes);
			ringb_float_read (top[thread].jack.auxr.o.r, output[r], nframes);*/
			ringb_float_read (top[0].jack.ring.o.l, output[2], nframes);
			ringb_float_read (top[0].jack.ring.o.r, output[3], nframes);
		}
		else
		{	
			// rb pathology
			//reset_system_audio(nframes);
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[thread], 0, nframes * sizeof (float));
				memset (output[thread], 0, nframes * sizeof (float));
			}
			return;
		}

		// Deal with the diversity/phased array channel next

		// input: copy from port to ring
		if ((ringb_float_write_space (top[0].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[0].jack.ring.i.r) >= nframes) &&
			(ringb_float_write_space (top[2].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[2].jack.ring.i.r) >= nframes))
		{
			REAL *l0 = input[0];
			REAL *r0 = input[1];
			REAL *l2 = input[4];
			REAL *r2 = input[5];
			for (i=0;i<nframes;i++) {
				COMPLEX A = Cmplx(l0[i],r0[i]);
				COMPLEX B = Cmplx(l2[i],r2[i]);
				A = Cscl(Cadd(A,Cmul(B,diversity.scalar)),diversity.gain);
				ringb_float_write (top[0].jack.ring.i.l, &A.re, 1);
				ringb_float_write (top[0].jack.ring.i.r, &A.im, 1);
			}
			/*ringb_float_write (top[thread].jack.auxr.i.l, input[l], nframes);
			ringb_float_write (top[thread].jack.auxr.i.r, input[r], nframes);*/
		}
		else
		{	
			// rb pathology
			//reset_system_audio(nframes);
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[thread], 0, nframes * sizeof (float));
				memset (output[thread], 0, nframes * sizeof (float));
			}
			return;
		}
		
		// if enough accumulated in ring, fire dsp
		if ((ringb_float_read_space (top[0].jack.ring.i.l) >= top[0].hold.size.frames) &&
			(ringb_float_read_space (top[0].jack.ring.i.r) >= top[0].hold.size.frames))
			sem_post (&top[0].sync.buf.sem);


		//
		//  Deal with 2nd receiver channel now
		//

		if ((ringb_float_read_space (top[2].jack.ring.o.l) >= nframes)
			&& (ringb_float_read_space (top[2].jack.ring.o.r) >= nframes))
		{
			/*ringb_float_read (top[thread].jack.auxr.o.l, output[l], nframes);
			ringb_float_read (top[thread].jack.auxr.o.r, output[r], nframes);*/
			ringb_float_read (top[2].jack.ring.o.l, output[4], nframes);
			ringb_float_read (top[2].jack.ring.o.r, output[5], nframes);
		}
		else
		{	
			// rb pathology
			//reset_system_audio(nframes);
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[thread], 0, nframes * sizeof (float));
				memset (output[thread], 0, nframes * sizeof (float));
			}
			return;
		}

		// input: copy from port to ring
		if ((ringb_float_write_space (top[2].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[2].jack.ring.i.r) >= nframes))
		{
			ringb_float_write (top[2].jack.ring.i.l, input[4], nframes);
			ringb_float_write (top[2].jack.ring.i.r, input[5], nframes);
		}
		else
		{	
			// rb pathology
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[thread], 0, nframes * sizeof (float));
				memset (output[thread], 0, nframes * sizeof (float));
			}
			return;
		}
		
		// if enough accumulated in ring, fire dsp
		if ((ringb_float_read_space (top[2].jack.ring.i.l) >= top[2].hold.size.frames) &&
			(ringb_float_read_space (top[2].jack.ring.i.r) >= top[2].hold.size.frames))
			sem_post (&top[2].sync.buf.sem);

	} else
#endif
	for(thread=0; thread<threadno; thread++) 
	{
		int l=2*thread, r = 2*thread+1;
		if ((ringb_float_read_space (top[thread].jack.ring.o.l) >= nframes)
			&& (ringb_float_read_space (top[thread].jack.ring.o.r) >= nframes))
		{
			/*ringb_float_read (top[thread].jack.auxr.o.l, output[l], nframes);
			ringb_float_read (top[thread].jack.auxr.o.r, output[r], nframes);*/
			ringb_float_read (top[thread].jack.ring.o.l, output[l], nframes);
			ringb_float_read (top[thread].jack.ring.o.r, output[r], nframes);
		}
		else
		{	
			// rb pathology
			//reset_system_audio(nframes);
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[2*thread  ], 0, nframes * sizeof (float));
				memset (output[2*thread+1], 0, nframes * sizeof (float));
			}
			return;
		}

		// input: copy from port to ring
		if ((ringb_float_write_space (top[thread].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[thread].jack.ring.i.r) >= nframes))
		{
			if (diversity.flag && (thread == 0)) {
				if ((ringb_float_write_space (top[2].jack.ring.i.l) >= nframes)
					&& (ringb_float_write_space (top[2].jack.ring.i.r) >= nframes))
				{
					REAL *l0 = input[0];
					REAL *r0 = input[1];
					REAL *l2 = input[4];
					REAL *r2 = input[5];
					for (i=0;i<nframes;i++) {
						COMPLEX A = Cmplx(l0[i],r0[i]);
						COMPLEX B = Cmplx(l2[i],r2[i]);
						A = Cscl(Cadd(A,Cmul(B,diversity.scalar)),diversity.gain);
						ringb_float_write (top[0].jack.ring.i.l, &A.re, 1);
						ringb_float_write (top[0].jack.ring.i.r, &A.im, 1);
					}
					/*ringb_float_write (top[thread].jack.auxr.i.l, input[l], nframes);
					ringb_float_write (top[thread].jack.auxr.i.r, input[r], nframes);*/
				} else {
					// rb pathology
					//reset_system_audio(nframes);
					for(thread=0;thread<threadno;thread++) 
					{
						memset (output[2*thread  ], 0, nframes * sizeof (float));
						memset (output[2*thread+1], 0, nframes * sizeof (float));
					}
					return;
				}
			} else {
				ringb_float_write (top[thread].jack.ring.i.l, input[l], nframes);
				ringb_float_write (top[thread].jack.ring.i.r, input[r], nframes);
				/*ringb_float_write (top[thread].jack.auxr.i.l, input[l], nframes);
				ringb_float_write (top[thread].jack.auxr.i.r, input[r], nframes);*/
			}
		}
		else
		{	
			// rb pathology
			//reset_system_audio(nframes);
			for(thread=0;thread<threadno;thread++) 
			{
				memset (output[2*thread  ], 0, nframes * sizeof (float));
				memset (output[2*thread+1], 0, nframes * sizeof (float));
			}
			return;
		}
		
		// if enough accumulated in ring, fire dsp
		if ((ringb_float_read_space (top[thread].jack.ring.i.l) >= top[thread].hold.size.frames) &&
			(ringb_float_read_space (top[thread].jack.ring.i.r) >= top[thread].hold.size.frames))
			sem_post (&top[thread].sync.buf.sem);
	}
}
示例#10
0
DttSP_EXP void
Audio_Callback (float *input_l, float *input_r, float *output_l,
	float *output_r, unsigned int nframes, int thread)
{
	BOOLEAN b = reset_em;
	int i;

        i=thread;
	if (top[i].susp)
	{
		memset (output_l, 0, nframes * sizeof (float));
		memset (output_r, 0, nframes * sizeof (float));
		return;
	}

	if (b)
	{
		//fprintf(stdout,"Audio_Callback: call reset_system_audio\n"), fflush(stdout);
		reset_system_audio(nframes);
		memset (output_l, 0, nframes * sizeof (float));
		memset (output_r, 0, nframes * sizeof (float));
		return;
    }

	//for (i=0; i<2; i++) 
	//{
		if ((ringb_float_read_space (top[i].jack.ring.o.l) >= nframes)
			&& (ringb_float_read_space (top[i].jack.ring.o.r) >= nframes))
		{
			if (top[i].state == RUN_PLAY)
			{
				ringb_float_read (top[i].jack.auxr.o.l, output_l, nframes);
				ringb_float_read (top[i].jack.auxr.o.r, output_r, nframes);
				ringb_float_read (top[i].jack.ring.o.l, output_l, nframes);
				ringb_float_read (top[i].jack.ring.o.r, output_r, nframes);
			}
			else
			{
				ringb_float_read_advance (top[i].jack.auxr.o.l, nframes);
				ringb_float_read_advance (top[i].jack.auxr.o.r, nframes);
				ringb_float_read_advance (top[i].jack.ring.o.l, nframes);
				ringb_float_read_advance (top[i].jack.ring.o.r, nframes);

			}
		}
		else
		{	// rb pathology
			//fprintf(stdout,"Audio_Callback-2: rb out pathology\n"), fflush(stdout);
//			reset_system_audio(nframes);
//			memset (output_l, 0, nframes * sizeof (float));
//			memset (output_r, 0, nframes * sizeof (float));
		}

		// input: copy from port to ring
		if ((ringb_float_write_space (top[i].jack.ring.i.l) >= nframes)
			&& (ringb_float_write_space (top[i].jack.ring.i.r) >= nframes))
		{
			ringb_float_write (top[i].jack.ring.i.l, (float *) input_l, nframes);
			ringb_float_write (top[i].jack.ring.i.r, (float *) input_r, nframes);
			ringb_float_write (top[i].jack.auxr.i.l, (float *) input_l, nframes);
			ringb_float_write (top[i].jack.auxr.i.r, (float *) input_r, nframes);
		}
		else
		{	// rb pathology
			//fprintf(stdout,"Audio_Callback-3: rb in pathology\n"), fflush(stdout);
//			reset_system_audio(nframes);
//			memset (output_l, 0, nframes * sizeof (float));
//			memset (output_r, 0, nframes * sizeof (float));
		}

		// if enough accumulated in ring, fire dsp
		if (ringb_float_read_space (top[i].jack.ring.i.l) >= top[i].hold.size.frames)
			sem_post (&top[i].sync.buf.sem);
	//}
}