From: Stefan Schoenleitner <dev.c0debabe@gmail.com>
To: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: start threshold in alsa plugin
Date: Thu, 01 Apr 2010 10:35:54 +0200 [thread overview]
Message-ID: <4BB45AEA.3030204@gmail.com> (raw)
Hi,
in my io-plugin code I would like to know the start threshold value.
AFAIK the start threshold is set to a default value that depends on the
configured buffer size SND_PCM_IOPLUG_HW_BUFFER_BYTES.
In my case the buffer size is 160*2*1 .. 160*2*2 bytes which is 1..2
periods as one period has 160 samples and each sample has 16 bit (2 bytes).
* How exactly is the default threshold value derived from the buffer size ?
I also tried to get the start threshold value from the PCM:
------------------------------------------------------------------------------
if (snd_pcm_sw_params_malloc(&sw_params)<0)
return -1;
if ((err=snd_pcm_sw_params_current(plug_info->io.pcm, sw_params))<0)
{
printf("Unable to determine current swparams: %s\n",
snd_strerror(err));
return -err;
}
if (snd_pcm_sw_params_get_start_threshold(sw_params, ¶m)<0)
return -1;
DBG("start threshold: %lu", param);
------------------------------------------------------------------------------
Unfortunately the call to snd_pcm_sw_params_current() fails (i/o error).
* Do you know why that call fails ?
* Is this the right way to get the start threshold value from a pcm ?
I'm calling the above code at the end of the plugin entry function
SND_PCM_PLUGIN_DEFINE_FUNC() after all hw constraints (including the
buffer size) have been set.
Maybe the plugin entry function is just not the right place to retrieve
the sw configuration from the PCM as it is too early and the sw config
of the pcm has not yet been set up ?
* Should I use a callback like sw_params to retrieve the default config ?
cheers,
Stefan
reply other threads:[~2010-04-01 8:35 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=4BB45AEA.3030204@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;
as well as URLs for NNTP newsgroup(s).