static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as)

{

    ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;

    struct alsa_params_req req;

    struct alsa_params_obt obt;

    snd_pcm_t *handle;

    struct audsettings obt_as;



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

    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 ? 1 : 0) |

        (conf.buffer_size_in_overridden ? 2 : 0);



    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_close1 (&handle);

        return -1;

    }



    alsa->handle = handle;

    return 0;

}

static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as)

{

    ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;

    struct alsa_params_req req;

    struct alsa_params_obt obt;

    snd_pcm_t *handle;

    struct audsettings obt_as;



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

    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 ? 1 : 0) |

        (conf.buffer_size_in_overridden ? 2 : 0);



    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_close1 (&handle);

        return -1;

    }



    alsa->handle = handle;

    return 0;

}

static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as)
static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1)

{

    ALSAVoiceIn *alsa = (ALSAVoiceIn *) VAR_0;

    struct alsa_params_req VAR_2;

    struct alsa_params_obt VAR_3;

    snd_pcm_t *handle;

    struct audsettings VAR_4;



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

    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 ? 1 : 0) |

        (conf.buffer_size_in_overridden ? 2 : 0);



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

        return -1;

    }



    VAR_4.freq = VAR_3.freq;

    VAR_4.nchannels = VAR_3.nchannels;

    VAR_4.fmt = VAR_3.fmt;

    VAR_4.endianness = VAR_3.endianness;



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

    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_close1 (&handle);

        return -1;

    }



    alsa->handle = handle;

    return 0;

}

static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1)
{ ALSAVoiceIn *alsa = (ALSAVoiceIn *) VAR_0; struct alsa_params_req VAR_2; struct alsa_params_obt VAR_3; snd_pcm_t *handle; struct audsettings VAR_4; VAR_2.fmt = aud_to_alsafmt (VAR_1->fmt, VAR_1->endianness); 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 ? 1 : 0) |
(conf.buffer_size_in_overridden ? 2 : 0); if (alsa_open (1, &VAR_2, &VAR_3, &handle)) { return -1; } VAR_4.freq = VAR_3.freq; VAR_4.nchannels = VAR_3.nchannels; VAR_4.fmt = VAR_3.fmt; VAR_4.endianness = VAR_3.endianness; audio_pcm_init_info (&VAR_0->info, &VAR_4); 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_close1 (&handle); return -1; } alsa->handle = handle; return 0; }