summaryrefslogtreecommitdiffstats
path: root/src/polyp/sample.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/polyp/sample.c')
-rw-r--r--src/polyp/sample.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/polyp/sample.c b/src/polyp/sample.c
index 668a485e..320e31a0 100644
--- a/src/polyp/sample.c
+++ b/src/polyp/sample.c
@@ -66,6 +66,12 @@ pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) {
return (pa_usec_t) (((double) length/pa_frame_size(spec)*1000000)/spec->rate);
}
+size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) {
+ assert(spec);
+
+ return ((double) t * spec->rate / 1000000)*pa_frame_size(spec);
+}
+
int pa_sample_spec_valid(const pa_sample_spec *spec) {
assert(spec);