Re: Using snd_pcm_set_params() on a capture handle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clemens Ladisch wrote:

> Erik de Castro Lopo wrote:
> >     RATE: [44100 96000]
> 
> snd_pcm_set_params() should have chosen a single rate.
> Did you dump this after that call?

Yep, the code is:

    snd_pcm_format_t format = SND_PCM_FORMAT_S32_LE;
    snd_pcm_hw_params_t *hw_params;
    snd_output_t *output ;
    unsigned int rate = 48000 ;

    if ((err = snd_pcm_set_params (capture_handle, format, SND_PCM_ACCESS_RW_INTERLEAVED, 2, rate, 0, 25000)) < 0) {   /* 0.5sec */
        printf ("Capture open error: %s\n", snd_strerror (err));exit(1);
    }

    if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
        printf ("Cannot allocate hardware parameter structure (%s)\n", snd_strerror (err));exit(1);
    }

    if ((err = snd_pcm_hw_params_any (capture_handle, hw_params)) < 0) {
        printf ("Cannot initialize hardware parameter structure (%s)\n", snd_strerror (err));exit(1);
    }

    snd_output_stdio_attach (&output, stderr, 0) ;
    snd_pcm_hw_params_dump (hw_params, output) ;
    snd_output_close (output) ;

    snd_pcm_hw_params_free (hw_params);


Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux