pub struct Narration { /* private fields */ }Expand description
Recordings of what films say, each found by its text. It shares the bytes, so
cloning it is cheap. Give it to MoviePlayer::narration.
Implementations§
Source§impl Narration
impl Narration
Sourcepub fn new(bytes: &'static [u8]) -> Self
pub fn new(bytes: &'static [u8]) -> Self
Reads what Narration::pack wrote. Bytes it does not understand hold no
recordings, and the films use the system’s voice.
Sourcepub fn seconds(&self, text: &str) -> Option<f64>
pub fn seconds(&self, text: &str) -> Option<f64>
How long the recording of text lasts, in seconds, without decoding it.
Sourcepub fn pack(recordings: &[(String, Vec<f32>)], rate: u32) -> Vec<u8> ⓘ
pub fn pack(recordings: &[(String, Vec<f32>)], rate: u32) -> Vec<u8> ⓘ
Packs recordings: each text with its samples, at rate a second.
Sourcepub fn pack_onto(
bytes: &[u8],
recordings: &[(String, Vec<f32>)],
rate: u32,
) -> Vec<u8> ⓘ
pub fn pack_onto( bytes: &[u8], recordings: &[(String, Vec<f32>)], rate: u32, ) -> Vec<u8> ⓘ
What Narration::pack wrote in bytes, with recordings added. What is in
bytes stays exactly as it was, so that adding a few texts after a film changed
keeps the takes chosen before; a text in both is the new recording. Bytes it does
not understand count as no recordings.
Trait Implementations§
Auto Trait Implementations§
impl !Send for Narration
impl !Sync for Narration
impl Freeze for Narration
impl RefUnwindSafe for Narration
impl Unpin for Narration
impl UnsafeUnpin for Narration
impl UnwindSafe for Narration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more