From 5a005553bc58fd3d462fc5b603b2a8a8f07ecfa2 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 1 Mar 2022 17:53:32 +0100 Subject: [PATCH] Fix block length semantics --- src/buffer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buffer.rs b/src/buffer.rs index be7a8464..cb65916b 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -342,9 +342,9 @@ impl<'slice, 'sample> Channels<'slice, 'sample> { } impl<'slice, 'sample> Block<'slice, 'sample> { - /// Get the number of channels in the block. + /// Get the number of samples (not channels) in the block. pub fn len(&self) -> usize { - unsafe { (*self.buffers).len() } + self.current_block_end - self.current_block_start } /// A resetting iterator. This lets you iterate over the same block multiple times. Otherwise