* Problems with snd_pcm_status_get_delay()
@ 2002-10-08 16:25 James Courtier-Dutton
2002-10-08 16:44 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: James Courtier-Dutton @ 2002-10-08 16:25 UTC (permalink / raw)
To: alsa-devel
Hello
Can someone please explain to me the use of snd_pcm_status_get_delay()
If a buffer size is 16384, and avail=6384, should delay therefore equil
10000 ? In all cases ?
I have found that in SND_PCM_STATE_RUNNING, delay = buffer_size - avail.
I have found that in SND_PCM_STATE_PREPARED, delay = 0
This causes problems. As one fills the buffer in SND_PCM_STATE_PREPARED
, delay stays at 0, but when the buffer fills enough and moves to state
SND_PCM_STATE_RUNNING, the delay value suddenly jumps to delay =
buffer_size - avail.
This causes problems with applications that need "delay" to be as
accurate as possible at all times.
Is this a bug in alsa09, or should I ignore "delay" and just use the
"buffer_size - avail" value.
Obviously, in SND_PCM_STATE_XRUN, delay is invalid.with avail values
sometimes becoming > buffer_size!
so should not be used.
Cheers
James
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problems with snd_pcm_status_get_delay()
2002-10-08 16:25 Problems with snd_pcm_status_get_delay() James Courtier-Dutton
@ 2002-10-08 16:44 ` Takashi Iwai
2002-10-09 6:45 ` Jaroslav Kysela
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2002-10-08 16:44 UTC (permalink / raw)
To: James Courtier-Dutton; +Cc: alsa-devel
At Wed, 09 Oct 2002 02:25:40 +1000,
James Courtier-Dutton wrote:
>
> Hello
>
> Can someone please explain to me the use of snd_pcm_status_get_delay()
>
> If a buffer size is 16384, and avail=6384, should delay therefore equil
> 10000 ? In all cases ?
no, the current implementation is the state-sensitive, as you
mentioned below :
> I have found that in SND_PCM_STATE_RUNNING, delay = buffer_size - avail.
> I have found that in SND_PCM_STATE_PREPARED, delay = 0
delay=0 gets back at all states except RUNNING (and DRAINING on
playback).
> This causes problems. As one fills the buffer in SND_PCM_STATE_PREPARED
> , delay stays at 0, but when the buffer fills enough and moves to state
> SND_PCM_STATE_RUNNING, the delay value suddenly jumps to delay =
> buffer_size - avail.
>
> This causes problems with applications that need "delay" to be as
> accurate as possible at all times.
> Is this a bug in alsa09, or should I ignore "delay" and just use the
> "buffer_size - avail" value.
snd_pcm_status_get_avail() returns the available space at any state.
so you can use this and calcuate "buffer_size - avail" manually
instead of get_delay().
ciao,
Takashi
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problems with snd_pcm_status_get_delay()
2002-10-08 16:44 ` Takashi Iwai
@ 2002-10-09 6:45 ` Jaroslav Kysela
0 siblings, 0 replies; 3+ messages in thread
From: Jaroslav Kysela @ 2002-10-09 6:45 UTC (permalink / raw)
To: Takashi Iwai; +Cc: James Courtier-Dutton, alsa-devel@lists.sourceforge.net
On Tue, 8 Oct 2002, Takashi Iwai wrote:
> At Wed, 09 Oct 2002 02:25:40 +1000,
> James Courtier-Dutton wrote:
> >
> > Hello
> >
> > Can someone please explain to me the use of snd_pcm_status_get_delay()
> >
> > If a buffer size is 16384, and avail=6384, should delay therefore equil
> > 10000 ? In all cases ?
>
> no, the current implementation is the state-sensitive, as you
> mentioned below :
>
> > I have found that in SND_PCM_STATE_RUNNING, delay = buffer_size - avail.
> > I have found that in SND_PCM_STATE_PREPARED, delay = 0
>
> delay=0 gets back at all states except RUNNING (and DRAINING on
> playback).
Delay functions should return error when the state is not correct. Fixed
now.
Jaroslav
-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-10-09 6:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-08 16:25 Problems with snd_pcm_status_get_delay() James Courtier-Dutton
2002-10-08 16:44 ` Takashi Iwai
2002-10-09 6:45 ` Jaroslav Kysela
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.