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