Rename Block::len() to Block::samples()
For the same reason mentioned in the last commit.
This commit is contained in:
parent
cb2824021b
commit
300e112ede
|
@ -10,6 +10,7 @@ code then it will not be listed here.
|
||||||
|
|
||||||
- `Buffer::len()` has been renamed to `Buffer::samples()` to make this less
|
- `Buffer::len()` has been renamed to `Buffer::samples()` to make this less
|
||||||
ambiguous.
|
ambiguous.
|
||||||
|
- `Block::len()` has been renamed to `Block::samples()`.
|
||||||
|
|
||||||
## [2022-11-17]
|
## [2022-11-17]
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,8 @@ impl ExactSizeIterator for BlockChannelsIter<'_, '_> {}
|
||||||
|
|
||||||
impl<'slice, 'sample> Block<'slice, 'sample> {
|
impl<'slice, 'sample> Block<'slice, 'sample> {
|
||||||
/// Get the number of samples per channel in the block.
|
/// Get the number of samples per channel in the block.
|
||||||
#[allow(clippy::len_without_is_empty)]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn len(&self) -> usize {
|
pub fn samples(&self) -> usize {
|
||||||
self.current_block_end - self.current_block_start
|
self.current_block_end - self.current_block_start
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,11 +230,11 @@ impl<'slice, 'sample> Block<'slice, 'sample> {
|
||||||
where
|
where
|
||||||
LaneCount<LANES>: SupportedLaneCount,
|
LaneCount<LANES>: SupportedLaneCount,
|
||||||
{
|
{
|
||||||
if sample_index > self.len() {
|
if sample_index > self.samples() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let used_lanes = self.len().max(LANES);
|
let used_lanes = self.samples().max(LANES);
|
||||||
let mut values = [0.0; LANES];
|
let mut values = [0.0; LANES];
|
||||||
for (channel_idx, value) in values.iter_mut().enumerate().take(used_lanes) {
|
for (channel_idx, value) in values.iter_mut().enumerate().take(used_lanes) {
|
||||||
*value = unsafe {
|
*value = unsafe {
|
||||||
|
@ -289,11 +288,11 @@ impl<'slice, 'sample> Block<'slice, 'sample> {
|
||||||
where
|
where
|
||||||
LaneCount<LANES>: SupportedLaneCount,
|
LaneCount<LANES>: SupportedLaneCount,
|
||||||
{
|
{
|
||||||
if sample_index > self.len() {
|
if sample_index > self.samples() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let used_lanes = self.len().max(LANES);
|
let used_lanes = self.samples().max(LANES);
|
||||||
let values = vector.to_array();
|
let values = vector.to_array();
|
||||||
for (channel_idx, value) in values.into_iter().enumerate().take(used_lanes) {
|
for (channel_idx, value) in values.into_iter().enumerate().take(used_lanes) {
|
||||||
*unsafe {
|
*unsafe {
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl StftInputMut for Buffer<'_> {
|
||||||
impl StftInput for Block<'_, '_> {
|
impl StftInput for Block<'_, '_> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn num_samples(&self) -> usize {
|
fn num_samples(&self) -> usize {
|
||||||
self.len()
|
self.samples()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in a new issue