153a5a1b3Sopenharmony_ci#ifndef foopulsetimesmoother2hfoo 253a5a1b3Sopenharmony_ci#define foopulsetimesmoother2hfoo 353a5a1b3Sopenharmony_ci 453a5a1b3Sopenharmony_ci/*** 553a5a1b3Sopenharmony_ci This file is part of PulseAudio. 653a5a1b3Sopenharmony_ci 753a5a1b3Sopenharmony_ci PulseAudio is free software; you can redistribute it and/or modify 853a5a1b3Sopenharmony_ci it under the terms of the GNU Lesser General Public License as 953a5a1b3Sopenharmony_ci published by the Free Software Foundation; either version 2.1 of the 1053a5a1b3Sopenharmony_ci License, or (at your option) any later version. 1153a5a1b3Sopenharmony_ci 1253a5a1b3Sopenharmony_ci PulseAudio is distributed in the hope that it will be useful, but 1353a5a1b3Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 1453a5a1b3Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1553a5a1b3Sopenharmony_ci Lesser General Public License for more details. 1653a5a1b3Sopenharmony_ci 1753a5a1b3Sopenharmony_ci You should have received a copy of the GNU Lesser General Public 1853a5a1b3Sopenharmony_ci License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 1953a5a1b3Sopenharmony_ci***/ 2053a5a1b3Sopenharmony_ci 2153a5a1b3Sopenharmony_ci#include <pulse/sample.h> 2253a5a1b3Sopenharmony_ci 2353a5a1b3Sopenharmony_citypedef struct pa_smoother_2 pa_smoother_2; 2453a5a1b3Sopenharmony_ci 2553a5a1b3Sopenharmony_ci/* Create new smoother */ 2653a5a1b3Sopenharmony_cipa_smoother_2* pa_smoother_2_new(pa_usec_t window, pa_usec_t time_stamp, uint32_t frame_size, uint32_t rate); 2753a5a1b3Sopenharmony_ci/* Free the smoother */ 2853a5a1b3Sopenharmony_civoid pa_smoother_2_free(pa_smoother_2* s); 2953a5a1b3Sopenharmony_ci/* Reset the smoother */ 3053a5a1b3Sopenharmony_civoid pa_smoother_2_reset(pa_smoother_2 *s, pa_usec_t time_stamp); 3153a5a1b3Sopenharmony_ci/* Pause the smoother */ 3253a5a1b3Sopenharmony_civoid pa_smoother_2_pause(pa_smoother_2 *s, pa_usec_t time_stamp); 3353a5a1b3Sopenharmony_ci/* Resume the smoother */ 3453a5a1b3Sopenharmony_civoid pa_smoother_2_resume(pa_smoother_2 *s, pa_usec_t time_stamp); 3553a5a1b3Sopenharmony_ci 3653a5a1b3Sopenharmony_ci/* Add a new data point and re-calculate time conversion factor */ 3753a5a1b3Sopenharmony_civoid pa_smoother_2_put(pa_smoother_2 *s, pa_usec_t time_stamp, int64_t byte_count); 3853a5a1b3Sopenharmony_ci 3953a5a1b3Sopenharmony_ci/* Calculate the current latency. For a source, the sign of the result must be inverted */ 4053a5a1b3Sopenharmony_ciint64_t pa_smoother_2_get_delay(pa_smoother_2 *s, pa_usec_t time_stamp, uint64_t byte_count); 4153a5a1b3Sopenharmony_ci/* Convert system time since start to sound card time */ 4253a5a1b3Sopenharmony_cipa_usec_t pa_smoother_2_get(pa_smoother_2 *s, pa_usec_t time_stamp); 4353a5a1b3Sopenharmony_ci/* Convert a time interval from sound card time to system time */ 4453a5a1b3Sopenharmony_cipa_usec_t pa_smoother_2_translate(pa_smoother_2 *s, pa_usec_t time_difference); 4553a5a1b3Sopenharmony_ci 4653a5a1b3Sopenharmony_ci/* Enable USB hack, only used for alsa sinks */ 4753a5a1b3Sopenharmony_civoid pa_smoother_2_usb_hack_enable(pa_smoother_2 *s, bool enable, pa_usec_t offset); 4853a5a1b3Sopenharmony_ci/* Set sample rate */ 4953a5a1b3Sopenharmony_civoid pa_smoother_2_set_rate(pa_smoother_2 *s, pa_usec_t time_stamp, uint32_t rate); 5053a5a1b3Sopenharmony_ci/* Set rate and frame size */ 5153a5a1b3Sopenharmony_civoid pa_smoother_2_set_sample_spec(pa_smoother_2 *s, pa_usec_t time_stamp, pa_sample_spec *spec); 5253a5a1b3Sopenharmony_ci 5353a5a1b3Sopenharmony_ci#endif 54