static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as)

{

    ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;

    struct alsa_params_req req;

    struct alsa_params_obt obt;

    snd_pcm_t *handle;

    audsettings_t obt_as;



    req.fmt = aud_to_alsafmt (as->fmt);

    req.freq = as->freq;

    req.nchannels = as->nchannels;

    req.period_size = conf.period_size_in;

    req.buffer_size = conf.buffer_size_in;

    req.size_in_usec = conf.size_in_usec_in;

    req.override_mask = !!conf.period_size_in_overridden

        | (!!conf.buffer_size_in_overridden << 1);



    if (alsa_open (1, &req, &obt, &handle)) {

        return -1;

    }



    obt_as.freq = obt.freq;

    obt_as.nchannels = obt.nchannels;

    obt_as.fmt = obt.fmt;

    obt_as.endianness = obt.endianness;



    audio_pcm_init_info (&hw->info, &obt_as);

    hw->samples = obt.samples;



    alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);

    if (!alsa->pcm_buf) {

        dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",

               hw->samples, 1 << hw->info.shift);

        alsa_anal_close (&handle);

        return -1;

    }



    alsa->handle = handle;

    return 0;

}

static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as)

{

    ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;

    struct alsa_params_req req;

    struct alsa_params_obt obt;

    snd_pcm_t *handle;

    audsettings_t obt_as;



    req.fmt = aud_to_alsafmt (as->fmt);

    req.freq = as->freq;

    req.nchannels = as->nchannels;

    req.period_size = conf.period_size_in;

    req.buffer_size = conf.buffer_size_in;

    req.size_in_usec = conf.size_in_usec_in;

    req.override_mask = !!conf.period_size_in_overridden

        | (!!conf.buffer_size_in_overridden << 1);



    if (alsa_open (1, &req, &obt, &handle)) {

        return -1;

    }



    obt_as.freq = obt.freq;

    obt_as.nchannels = obt.nchannels;

    obt_as.fmt = obt.fmt;

    obt_as.endianness = obt.endianness;



    audio_pcm_init_info (&hw->info, &obt_as);

    hw->samples = obt.samples;



    alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);

    if (!alsa->pcm_buf) {

        dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",

               hw->samples, 1 << hw->info.shift);

        alsa_anal_close (&handle);

        return -1;

    }



    alsa->handle = handle;

    return 0;

}

static int FUNC_0 (HWVoiceIn *VAR_0, audsettings_t *VAR_1)

{

    ALSAVoiceIn *alsa = (ALSAVoiceIn *) VAR_0;

    struct alsa_params_req VAR_2;

    struct alsa_params_obt VAR_3;

    snd_pcm_t *handle;

    audsettings_t obt_as;



    VAR_2.fmt = aud_to_alsafmt (VAR_1->fmt);

    VAR_2.freq = VAR_1->freq;

    VAR_2.nchannels = VAR_1->nchannels;

    VAR_2.period_size = conf.period_size_in;

    VAR_2.buffer_size = conf.buffer_size_in;

    VAR_2.size_in_usec = conf.size_in_usec_in;

    VAR_2.override_mask = !!conf.period_size_in_overridden

        | (!!conf.buffer_size_in_overridden << 1);



    if (alsa_open (1, &VAR_2, &VAR_3, &handle)) {

        return -1;

    }



    obt_as.freq = VAR_3.freq;

    obt_as.nchannels = VAR_3.nchannels;

    obt_as.fmt = VAR_3.fmt;

    obt_as.endianness = VAR_3.endianness;



    audio_pcm_init_info (&VAR_0->info, &obt_as);

    VAR_0->samples = VAR_3.samples;



    alsa->pcm_buf = audio_calloc (AUDIO_FUNC, VAR_0->samples, 1 << VAR_0->info.shift);

    if (!alsa->pcm_buf) {

        dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",

               VAR_0->samples, 1 << VAR_0->info.shift);

        alsa_anal_close (&handle);

        return -1;

    }



    alsa->handle = handle;

    return 0;

}

static int FUNC_0 (HWVoiceIn *VAR_0, audsettings_t *VAR_1)
{ ALSAVoiceIn *alsa = (ALSAVoiceIn *) VAR_0; struct alsa_params_req VAR_2; struct alsa_params_obt VAR_3; snd_pcm_t *handle; audsettings_t obt_as; VAR_2.fmt = aud_to_alsafmt (VAR_1->fmt); VAR_2.freq = VAR_1->freq; VAR_2.nchannels = VAR_1->nchannels; VAR_2.period_size = conf.period_size_in; VAR_2.buffer_size = conf.buffer_size_in; VAR_2.size_in_usec = conf.size_in_usec_in; VAR_2.override_mask = !!conf.period_size_in_overridden
| (!!conf.buffer_size_in_overridden << 1); if (alsa_open (1, &VAR_2, &VAR_3, &handle)) { return -1; } obt_as.freq = VAR_3.freq; obt_as.nchannels = VAR_3.nchannels; obt_as.fmt = VAR_3.fmt; obt_as.endianness = VAR_3.endianness; audio_pcm_init_info (&VAR_0->info, &obt_as); VAR_0->samples = VAR_3.samples; alsa->pcm_buf = audio_calloc (AUDIO_FUNC, VAR_0->samples, 1 << VAR_0->info.shift); if (!alsa->pcm_buf) { dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
VAR_0->samples, 1 << VAR_0->info.shift); alsa_anal_close (&handle); return -1; } alsa->handle = handle; return 0; }