summaryrefslogtreecommitdiff
path: root/src/audio/ring_buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/ring_buffer.h')
-rw-r--r--src/audio/ring_buffer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/audio/ring_buffer.h b/src/audio/ring_buffer.h
index 1a21542..ba8cb49 100644
--- a/src/audio/ring_buffer.h
+++ b/src/audio/ring_buffer.h
@@ -19,6 +19,11 @@
RING_BUFFER_CHANNELS) / \
1000)
+// Convert sample count to seconds (accounting for stereo channels)
+inline float samples_to_seconds(int64_t samples) {
+ return (float)samples / (RING_BUFFER_SAMPLE_RATE * RING_BUFFER_CHANNELS);
+}
+
class AudioRingBuffer {
public:
AudioRingBuffer();