(&self, frames: u32)
| 87 | pub const fn sample_rate(&self) -> u32 { |
| 88 | self.sample_rate |
| 89 | } |
| 90 | |
| 91 | pub const fn channels(&self) -> u16 { |
| 92 | self.channels |
| 93 | } |
| 94 | |
| 95 | pub fn duration(&self) -> Duration { |
| 96 | let frames = self.samples.len() as f64 / self.channels.max(1) as f64; |
| 97 | Duration::from_secs_f64(frames / self.sample_rate.max(1) as f64) |
| 98 | } |
| 99 | |
| 100 | pub fn seconds(&self) -> f32 { |
| 101 | self.duration().as_secs_f32() |
| 102 | } |
| 103 |