mirror of
https://github.com/haileys/bark
synced 2025-03-17 07:07:00 +00:00
remove unused as/from buffer_offset methods
This commit is contained in:
parent
87444230dd
commit
fb6191f309
1 changed files with 1 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::packet;
|
||||
use crate::types::TimestampMicros;
|
||||
use crate::{SAMPLE_RATE, FRAMES_PER_PACKET, CHANNELS};
|
||||
use crate::{SAMPLE_RATE, FRAMES_PER_PACKET};
|
||||
|
||||
/// A timestamp with implicit denominator SAMPLE_RATE
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
|
@ -81,18 +81,6 @@ impl SampleDuration {
|
|||
core::time::Duration::from_micros(usecs)
|
||||
}
|
||||
|
||||
pub fn as_buffer_offset(&self) -> usize {
|
||||
let offset = self.0 * u64::from(CHANNELS);
|
||||
usize::try_from(offset).unwrap()
|
||||
}
|
||||
|
||||
pub fn from_buffer_offset(offset: usize) -> Self {
|
||||
let channels = usize::from(CHANNELS);
|
||||
assert!(offset % channels == 0);
|
||||
|
||||
SampleDuration(u64::try_from(offset / channels).unwrap())
|
||||
}
|
||||
|
||||
pub fn add(&self, other: SampleDuration) -> Self {
|
||||
SampleDuration(self.0.checked_add(other.0).unwrap())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue