From mboxrd@z Thu Jan 1 00:00:00 1970 From: Riccardo Magliocchetti Subject: Re: capturing data from the microphone Date: Mon, 11 Jan 2010 14:59:03 +0100 Message-ID: <4B4B2EA7.2080504@gmail.com> References: <4B4227BC.70705@gmail.com> <6160a5131001050848r48f9c6ecw4db2e56bb6fd7533@mail.gmail.com> <4B43B949.5010702@gmail.com> <4f3252891001061559p71933643wcbb59ede24ac29aa@mail.gmail.com> <4B46293A.3040600@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-fx0-f211.google.com (mail-fx0-f211.google.com [209.85.220.211]) by alsa0.perex.cz (Postfix) with ESMTP id 6C2431037FF for ; Mon, 11 Jan 2010 14:59:06 +0100 (CET) Received: by fxm3 with SMTP id 3so11935751fxm.4 for ; Mon, 11 Jan 2010 05:59:06 -0800 (PST) In-Reply-To: <4B46293A.3040600@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: alsa-devel@alsa-project.org Cc: pl bossart List-Id: alsa-devel@alsa-project.org Riccardo Magliocchetti ha scritto: > Raymond Yau ha scritto: >> 2010/1/6 Riccardo Magliocchetti >> >>> Hi Pierre, >>> >>> pl bossart ha scritto: >>>> You haven't specified the buffer/period size in the hw params. See >>>> alsa-lib/test/pcm.c >>>> - Pierre >>> They fail when opening default device so I had to remove them, work fine >>> when opening >>> plughw:0,0 though. >>> >>>> On Mon, Jan 4, 2010 at 11:39 AM, Riccardo Magliocchetti >>>> wrote: >>>>> [the same message is waiting in moderator queue, sorry if you >>>>> receive it >>> two times] >>>>> Hello, >>>>> >>>>> i'm trying to capture audio data from the microphone, but i'm not able >>> to >>>>> read any frames. >>>>> The frames are always 0 and delay is fixed to 2730. I've tried calling >>>>> snd_pcm_avail_delay, snd_pcm_avail_update but does not make a >>> difference. >>>>> The soundcard is driven by snd_hda_intel. The code is more or less >>>>> the >>>>> same as Paul Davis' tutorial on using the alsa api. > >> >> Even 4096 bytes is x86 DMA page size , seem to be a good choice for those >> PCI sound cards, however you cannot assume all sound cards/plugins >> support >> this buffer size >> >> If you did not set period_size, buffer_size or periods (period_time, >> buffer_time or periods) , you should call >> snd_pcm_hw_params_get_buffer_size() and >> snd_pcm_hw_params_get_period_size() >> after snd_pcm_hw_params() > > Thank you both Pierre and Raymond, using the get functions after > snd_pcm_hw_params() is working, now i have some concurrency issues to > resolve before i can say everything is working properly. The init works fine but snd_pcm_avail() always returns 0, full code is here http://pastebin.com/f687bf37a thanks, riccardo