ant-phone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ant-phone-devel] Latency, fragments and their sizes.


From: Roland Stigge
Subject: Re: [Ant-phone-devel] Latency, fragments and their sizes.
Date: Sat, 14 Feb 2004 10:25:58 +0100

Hi Bruno,

On Fri, 2004-02-13 at 18:05, Bruno Hertz wrote:
> As I gather from this Alsa list posting
> http://www.geocrawler.com/archives/3/251/1998/6/0/1357864/
> fragment number and sizes are set via
>   ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &param)
> where param is e.g.( 0x0200 << 16) + 0x0008 for 8 fragments
> of size 512 bytes.
> 
> In ant-phone src/sound.c on the other hand I find in function
> init_audio_device the lines
>   /* set fragment size */
>   fragment_arg = 0x7FFF0000 + logb(*fragment_size);
> where fragment_size amounts to a default of 1024 and fragment_arg
> is later used as parameter to the aforementioned ioctl.
> 
> Now, compared to the calculation in that Alsa list posting, the
> way ant-phone sets fragment number and sizes looks pretty obscure
> to me. Could somebody please shed some light on this?

The above mentioned posting by Jarolav seems to be the obscuring point
here. He writes: "[lower 16 bits] 0x0008 means that ring buffer for
playback will be separated to 8 fragments[...]".

But look at the official OSS documentation[1]: "0xMMMMSSSS [...] The 16
least significant bits determine the fragment size. The size is 2^SSSS.
For example SSSS=0008 gives fragment size of 256 bytes (2^8). [...]".
Therefore my logb().

(I think this should resolve the confusion here.)

IMHO, at least some latency problems with ANT result from different
handling/initialization of input/output data of the respective OSS
implementations (OSS, Kernel, ALSA, ...). The number of fragments
shouldn't be an issue since the latency is determined by the fragment
size.

Unfortunately, I still don't have the time (and maybe enough different
hardware) at the moment to fiddle around with that. :( Feel free to
contribute your results/code.

Thanks.

bye,
  Roland

[1] http://www.opensound.com/pguide/oss.pdf

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]