static void *qpa_thread_in (void *arg)

{

    PAVoiceIn *pa = arg;

    HWVoiceIn *hw = &pa->hw;



    if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {

        return NULL;

    }



    for (;;) {

        int incr, to_grab, wpos;



        for (;;) {

            if (pa->done) {

                goto exit;

            }



            if (pa->dead > 0) {

                break;

            }



            if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) {

                goto exit;

            }

        }



        incr = to_grab = audio_MIN (pa->dead, conf.samples >> 2);

        wpos = pa->wpos;



        if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) {

            return NULL;

        }



        while (to_grab) {

            int error;

            int chunk = audio_MIN (to_grab, hw->samples - wpos);

            void *buf = advance (pa->pcm_buf, wpos);



            if (pa_simple_read (pa->s, buf,

                                chunk << hw->info.shift, &error) < 0) {

                qpa_logerr (error, "pa_simple_read failed\n");

                return NULL;

            }



            hw->conv (hw->conv_buf + wpos, buf, chunk);

            wpos = (wpos + chunk) % hw->samples;

            to_grab -= chunk;

        }



        if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {

            return NULL;

        }



        pa->wpos = wpos;

        pa->dead -= incr;

        pa->incr += incr;

    }



 exit:

    audio_pt_unlock (&pa->pt, AUDIO_FUNC);

    return NULL;

}

static void *qpa_thread_in (void *arg)

{

    PAVoiceIn *pa = arg;

    HWVoiceIn *hw = &pa->hw;



    if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {

        return NULL;

    }



    for (;;) {

        int incr, to_grab, wpos;



        for (;;) {

            if (pa->done) {

                goto exit;

            }



            if (pa->dead > 0) {

                break;

            }



            if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) {

                goto exit;

            }

        }



        incr = to_grab = audio_MIN (pa->dead, conf.samples >> 2);

        wpos = pa->wpos;



        if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) {

            return NULL;

        }



        while (to_grab) {

            int error;

            int chunk = audio_MIN (to_grab, hw->samples - wpos);

            void *buf = advance (pa->pcm_buf, wpos);



            if (pa_simple_read (pa->s, buf,

                                chunk << hw->info.shift, &error) < 0) {

                qpa_logerr (error, "pa_simple_read failed\n");

                return NULL;

            }



            hw->conv (hw->conv_buf + wpos, buf, chunk);

            wpos = (wpos + chunk) % hw->samples;

            to_grab -= chunk;

        }



        if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {

            return NULL;

        }



        pa->wpos = wpos;

        pa->dead -= incr;

        pa->incr += incr;

    }



 exit:

    audio_pt_unlock (&pa->pt, AUDIO_FUNC);

    return NULL;

}

        incr = to_grab = audio_MIN (pa->dead, conf.samples >> 2);             if (pa_simple_read (pa->s, buf,                                 chunk << hw->info.shift, &error) < 0) {
static void *FUNC_0 (void *VAR_0)

{

    PAVoiceIn *pa = VAR_0;

    HWVoiceIn *hw = &pa->hw;



    if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {

        return NULL;

    }



    for (;;) {

        int VAR_1, VAR_2, VAR_3;



        for (;;) {

            if (pa->done) {

                goto exit;

            }



            if (pa->dead > 0) {

                break;

            }



            if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) {

                goto exit;

            }

        }



        VAR_1 = VAR_2 = audio_MIN (pa->dead, conf.samples >> 2);

        VAR_3 = pa->VAR_3;



        if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) {

            return NULL;

        }



        while (VAR_2) {

            int VAR_4;

            int VAR_5 = audio_MIN (VAR_2, hw->samples - VAR_3);

            void *VAR_6 = advance (pa->pcm_buf, VAR_3);



            if (pa_simple_read (pa->s, VAR_6,

                                VAR_5 << hw->info.shift, &VAR_4) < 0) {

                qpa_logerr (VAR_4, "pa_simple_read failed\n");

                return NULL;

            }



            hw->conv (hw->conv_buf + VAR_3, VAR_6, VAR_5);

            VAR_3 = (VAR_3 + VAR_5) % hw->samples;

            VAR_2 -= VAR_5;

        }



        if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {

            return NULL;

        }



        pa->VAR_3 = VAR_3;

        pa->dead -= VAR_1;

        pa->VAR_1 += VAR_1;

    }



 exit:

    audio_pt_unlock (&pa->pt, AUDIO_FUNC);

    return NULL;

}

static void *FUNC_0 (void *VAR_0)
{ PAVoiceIn *pa = VAR_0; HWVoiceIn *hw = &pa->hw; if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } for (;;) { int VAR_1, VAR_2, VAR_3; for (;;) { if (pa->done) { goto exit; } if (pa->dead > 0) { break; } if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { goto exit; } } VAR_1 = VAR_2 = audio_MIN (pa->dead, conf.samples >> 2); VAR_3 = pa->VAR_3; if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { return NULL; } while (VAR_2) { int VAR_4; int VAR_5 = audio_MIN (VAR_2, hw->samples - VAR_3); void *VAR_6 = advance (pa->pcm_buf, VAR_3); if (pa_simple_read (pa->s, VAR_6,
VAR_5 << hw->info.shift, &VAR_4) < 0) { qpa_logerr (VAR_4, "pa_simple_read failed\n"); return NULL; } hw->conv (hw->conv_buf + VAR_3, VAR_6, VAR_5); VAR_3 = (VAR_3 + VAR_5) % hw->samples; VAR_2 -= VAR_5; } if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } pa->VAR_3 = VAR_3; pa->dead -= VAR_1; pa->VAR_1 += VAR_1; } exit:
audio_pt_unlock (&pa->pt, AUDIO_FUNC); return NULL; }