pub struct VoidMP3 {
pub duration: f64,
}
impl Default for VoidMP3 {
fn default() -> Self {
Self { duration: 5.0 }
}
}
impl VoidMP3 {
pub fn data(&self) -> Vec<u8> {
let mut ret = Vec::new();
ret.extend(T_0);
ret.resize(ret.len() + 23, 0);
let block_count = (self.duration * 1000.0 / 72.0).round() as usize;
for _ in 0..block_count {
ret.extend(T_1);
ret.resize(ret.len() + 59, 0x55);
}
ret
}
}
#[rustfmt::skip]
const T_0: &[u8] = &[
0x49, 0x44, 0x33, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x54, 0x53, 0x53, 0x45, 0x00, 0x00,
0x00, 0x0F, 0x00, 0x00, 0x03, 0x4C,
];
#[rustfmt::skip]
const T_1: &[u8] = &[
0xFF, 0xE3, 0x18, 0xC4, 0xC4, 0x00, 0x00, 0x03, 0x48, 0x00, 0x00, 0x00, 0x00,
];