pub struct Sample { pub sample_rate: u32, pub data: Vec, pub loop_start: Option, pub loop_end: Option, } impl Sample { pub fn new(sample_rate: u32, data: Vec) -> Self { Self { sample_rate, data, loop_start: None, loop_end: None, } } pub fn with_loop(mut self, start: u32, end: u32) -> Self { self.loop_start = Some(start); self.loop_end = Some(end); self } pub fn frames_len(&self) -> usize { self.data.len() } }