At Fri, 13 Jun 2008 20:22:34 +0200, Lennart Poettering wrote:
On Fri, 13.06.08 17:55, Takashi Iwai (tiwai@suse.de) wrote:
What about just providing three pointers: curr_ptr, hw_ptr and appl_ptr? curr_ptr corresponds to the point being played, and hw_ptr is the point where the data was already sent to h/w, and appl_ptr is the point where the data is filled by user. The above definitions are all combinations of these pointers.
I could agree to that. However, to be useful it must be possible to query those three pointers atomically. i.e. in a single call:
typedef struct snd_ptr_info { snd_uframes_t curr_ptr; snd_uframes_t hw_ptr; snd_uframes_t appl_ptr; } snd_ptr_info_t;
int snd_pcm_get_ptr_info(snd_pcm_t *pcm, snd_ptr_info_t *i);
Yes, I thought of that, too.
OTOH, I agree that new addition to the current API should be avoided as much as possible. So, I'm not 100% happy but almost fine with the way Jaroslav suggested. In the end, you can retrieve the above three values from the return values of two API calls... (hmm, but abstract values are not given, though).
Takashi