1 #ifndef foopulsetimesmoother2hfoo 2 #define foopulsetimesmoother2hfoo 3 4 /*** 5 This file is part of PulseAudio. 6 7 PulseAudio is free software; you can redistribute it and/or modify 8 it under the terms of the GNU Lesser General Public License as 9 published by the Free Software Foundation; either version 2.1 of the 10 License, or (at your option) any later version. 11 12 PulseAudio is distributed in the hope that it will be useful, but 13 WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 19 ***/ 20 21 #include <pulse/sample.h> 22 23 typedef struct pa_smoother_2 pa_smoother_2; 24 25 /* Create new smoother */ 26 pa_smoother_2* pa_smoother_2_new(pa_usec_t window, pa_usec_t time_stamp, uint32_t frame_size, uint32_t rate); 27 /* Free the smoother */ 28 void pa_smoother_2_free(pa_smoother_2* s); 29 /* Reset the smoother */ 30 void pa_smoother_2_reset(pa_smoother_2 *s, pa_usec_t time_stamp); 31 /* Pause the smoother */ 32 void pa_smoother_2_pause(pa_smoother_2 *s, pa_usec_t time_stamp); 33 /* Resume the smoother */ 34 void pa_smoother_2_resume(pa_smoother_2 *s, pa_usec_t time_stamp); 35 36 /* Add a new data point and re-calculate time conversion factor */ 37 void pa_smoother_2_put(pa_smoother_2 *s, pa_usec_t time_stamp, int64_t byte_count); 38 39 /* Calculate the current latency. For a source, the sign of the result must be inverted */ 40 int64_t pa_smoother_2_get_delay(pa_smoother_2 *s, pa_usec_t time_stamp, uint64_t byte_count); 41 /* Convert system time since start to sound card time */ 42 pa_usec_t pa_smoother_2_get(pa_smoother_2 *s, pa_usec_t time_stamp); 43 /* Convert a time interval from sound card time to system time */ 44 pa_usec_t pa_smoother_2_translate(pa_smoother_2 *s, pa_usec_t time_difference); 45 46 /* Enable USB hack, only used for alsa sinks */ 47 void pa_smoother_2_usb_hack_enable(pa_smoother_2 *s, bool enable, pa_usec_t offset); 48 /* Set sample rate */ 49 void pa_smoother_2_set_rate(pa_smoother_2 *s, pa_usec_t time_stamp, uint32_t rate); 50 /* Set rate and frame size */ 51 void pa_smoother_2_set_sample_spec(pa_smoother_2 *s, pa_usec_t time_stamp, pa_sample_spec *spec); 52 53 #endif 54