All of lore.kernel.org
 help / color / mirror / Atom feed
From: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
To: alsa-devel@alsa-project.org
Cc: pl bossart <bossart.nospam@gmail.com>
Subject: Re: capturing data from the microphone
Date: Mon, 11 Jan 2010 14:59:03 +0100	[thread overview]
Message-ID: <4B4B2EA7.2080504@gmail.com> (raw)
In-Reply-To: <4B46293A.3040600@gmail.com>

Riccardo Magliocchetti ha scritto:
> Raymond Yau ha scritto:
>> 2010/1/6 Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
>>
>>> 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
>>>> <riccardo.magliocchetti@gmail.com> 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

  reply	other threads:[~2010-01-11 13:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 17:39 capturing data from the microphone Riccardo Magliocchetti
2010-01-05 15:24 ` Marc Garnier
2010-01-06  1:07   ` Raymond Yau
2010-01-06  7:58     ` Marc Garnier
2010-01-06  8:46       ` Raymond Yau
2010-01-06  9:09         ` Marc Garnier
2010-01-05 16:48 ` pl bossart
2010-01-05 22:12   ` Riccardo Magliocchetti
2010-01-06 23:59     ` Raymond Yau
2010-01-07 18:34       ` Riccardo Magliocchetti
2010-01-11 13:59         ` Riccardo Magliocchetti [this message]
2010-01-11 14:03           ` Jaroslav Kysela
2010-01-14  7:49             ` Raymond Yau
  -- strict thread matches above, loose matches on Subject: below --
2009-12-08 14:46 How to use soc API without codec driver Marc Garnier
2009-12-08 14:51 ` Mark Brown
2009-12-09  6:39   ` Marc Garnier
2009-12-09 10:45     ` Mark Brown
     [not found]       ` <4B44617B.2030002@heig-vd.ch>
     [not found]         ` <20100106103937.GA25344@rakim.wolfsonmicro.main>
     [not found]           ` <4B446974.1090205@heig-vd.ch>
2010-01-06 11:39             ` capturing data from the microphone Mark Brown
2010-01-06 13:34               ` Riccardo Magliocchetti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B4B2EA7.2080504@gmail.com \
    --to=riccardo.magliocchetti@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bossart.nospam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.