From: Jaroslav Kysela Date: Sat, 12 Oct 2002 12:04:08 +0000 (+0000) Subject: Added ommited clear() functions X-Git-Tag: v1.0.3~361 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=170a5d0d7b29524c96844bad1e2ab4980f1a86a6;p=alsa-lib.git Added ommited clear() functions --- diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index aff878b4..c6e9c7c8 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -382,14 +382,14 @@ Using standalone, it is a light method to obtain current stream position, because it does not require the user <-> kernel context switch, but the value is less accurate, because ring buffer pointers are updated in kernel drivers only when an interrupt occurs. If you want to get accurate stream state, -use functions \link ::snd_pcm_avail \endlink or \link ::snd_pcm_delay \endlink. +use functions \link ::snd_pcm_hwsync \endlink or \link ::snd_pcm_delay \endlink. Note that both of these functions do not update the current r/w pointer for applications, so the function \link ::snd_pcm_avail_update \endlink must be called afterwards before any read/write begin+commit operations.

-The function \link ::snd_pcm_avail \endlink returns current available space -in the ring buffer. Note that this function does not update the current r/w -pointer for applications, so the function \link ::snd_pcm_avail_update \endlink +The function \link ::snd_pcm_hwsync \endlink reads the current hardware pointer +in the ring buffer from hardware. Note that this function does not update the current +r/w pointer for applications, so the function \link ::snd_pcm_avail_update \endlink must be called afterwards before any read/write/begin+commit operations.

The function \link ::snd_pcm_delay \endlink returns the delay in samples. @@ -2777,6 +2777,16 @@ void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj) free(obj); } +/** + * \brief clear snd_pcm_hw_params_t structure + * \param obj pointer to structure + */ +void snd_pcm_hw_params_clear(snd_pcm_hw_params_t *obj) +{ + assert(obj); + memset(obj, 0, snd_pcm_hw_params_sizeof()); +} + /** * \brief copy one #snd_pcm_hw_params_t to another * \param dst pointer to destination @@ -4911,6 +4921,16 @@ void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj) free(obj); } +/** + * \brief clear snd_pcm_sw_params_t structure + * \param obj pointer to structure + */ +void snd_pcm_sw_params_clear(snd_pcm_sw_params_t *obj) +{ + assert(obj); + memset(obj, 0, snd_pcm_sw_params_sizeof()); +} + /** * \brief copy one #snd_pcm_sw_params_t to another * \param dst pointer to destination @@ -5331,6 +5351,16 @@ void snd_pcm_status_free(snd_pcm_status_t *obj) free(obj); } +/** + * \brief clear snd_pcm_status_t structure + * \param obj pointer to structure + */ +void snd_pcm_status_clear(snd_pcm_status_t *obj) +{ + assert(obj); + memset(obj, 0, snd_pcm_status_sizeof()); +} + /** * \brief copy one #snd_pcm_status_t to another * \param dst pointer to destination @@ -5450,6 +5480,16 @@ void snd_pcm_info_free(snd_pcm_info_t *obj) free(obj); } +/** + * \brief clear snd_pcm_info_t structure + * \param obj pointer to structure + */ +void snd_pcm_info_clear(snd_pcm_info_t *obj) +{ + assert(obj); + memset(obj, 0, snd_pcm_info_sizeof()); +} + /** * \brief copy one #snd_pcm_info_t to another * \param dst pointer to destination