Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Schoenleitner <dev.c0debabe@gmail.com>
To: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: ioplug plugin programming: HW_PERIOD_BYTES and HW_PERIODS constraints ?
Date: Thu, 01 Oct 2009 14:17:16 +0200	[thread overview]
Message-ID: <4AC49DCC.7060806@gmail.com> (raw)

Hi,

I'm currently developing an ALSA ioplug plugin that should transfer
audio samples to a DSP over UART.

In my plugin code I set up the hardware constrains (HW_PERIOD_BYTES and
HW_PERIODS being among them) and then I utilize the transfer callback to
send the audio chunk over UART.

The DSP application would like to have exactly 156 - 164 audio samples
at a time, where the sampling rate has to be 8 kHz and the format is S16_LE.
In between there has to be a delay of 20ms (which is equal to 164 audio
frames at a sampling rate of 8 kHz (i.e. 164 * 125us = 20,5 ms).

For this reason I configured HW_PERIOD_BYTES with these values.
The result is that each time the transfer callback gets called, exactly
312 bytes (thus 164 frames with each one having 2 bytes) are transfered.


However, what I do not understand is the setup of HW_PERIODS which is
AFAIK the number of periods being transfered at a time ?


* What is the influence of this constraint on my ioplug plugin ?

* How does it change the way data is being transfered with the transfer
callback ?

* What would be the correct setup for the mentioned application ?


cheers,
stefan

                 reply	other threads:[~2009-10-01 12:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4AC49DCC.7060806@gmail.com \
    --to=dev.c0debabe@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /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