alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Louise Hoffman <louise.hoffman@gmail.com>
To: Raymond Yau <superquad.vortex2@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Warning/error from ALSA’s pcm_min.c example. Possible problem?
Date: Sun, 31 Jan 2010 21:53:33 +0100	[thread overview]
Message-ID: <30c82f5f1001311253q265c7634g1f5a6070db284922@mail.gmail.com> (raw)
In-Reply-To: <4f3252891001302043n3a404f1awdd8a7bef9769eb5a@mail.gmail.com>

>> The correct way is to use snd_pcm_get_params() to get buffer_size and
> period_size
>
> *snd_pcm_set_params() has limitation
>
> The most common sound card (e.g. HDA ) has the following constraints
> on period bytes and buffer bytes
>
>     snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
>                                    128);
>     snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
>                                   128);

I am probably not good enough to understand these changes =( Pretty
hard core stuff =)


> you cannot get exactly 0.5 second period time when rate is multiple of 3 (
> e.g. 48000 Hz )

Does this mean, that I shouldn't give snd_pcm_writei() the number of
all the frames in the buffer, but only

sample_rate * latency = frames

?

So if I e.g. have:
sample_rate = 44100
latency = 0.5 [s]
all_frames = 100000

The number of frames that I should give to snd_pcm_writei() would be

sample_rate * latency = frames
44100*0.5 = 22050

and the number of iterations the for-loop should be?:

(int) 100000/22050 = 4; with frames=22050

and one extra, but only with

100000 mod 22050 = 11800

frames?

  reply	other threads:[~2010-01-31 20:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-30 19:51 Warning/error from ALSA’s pcm_min.c example. Possible problem? Louise Hoffman
2010-01-31  4:43 ` Raymond Yau
2010-01-31 20:53   ` Louise Hoffman [this message]
2010-01-31  8:46 ` Jaroslav Kysela
2010-01-31 20:41   ` Louise Hoffman
  -- strict thread matches above, loose matches on Subject: below --
2010-10-29  3:49 Raymond Yau
2010-10-29  7:19 ` Jaroslav Kysela

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=30c82f5f1001311253q265c7634g1f5a6070db284922@mail.gmail.com \
    --to=louise.hoffman@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=superquad.vortex2@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).