pub struct LtcEncoder { /* private fields */ }Expand description
LTC encoder
Implementations§
Source§impl LtcEncoder
impl LtcEncoder
Sourcepub fn new(sample_rate: u32, frame_rate: FrameRate, amplitude: f32) -> Self
pub fn new(sample_rate: u32, frame_rate: FrameRate, amplitude: f32) -> Self
Create a new LTC encoder
Sourcepub fn encode_frame(
&mut self,
timecode: &Timecode,
) -> Result<Vec<f32>, TimecodeError>
pub fn encode_frame( &mut self, timecode: &Timecode, ) -> Result<Vec<f32>, TimecodeError>
Encode a timecode frame to audio samples
Sourcepub fn encode_batch(timecodes: &[Timecode], sample_rate: u32) -> Vec<Vec<i16>>
pub fn encode_batch(timecodes: &[Timecode], sample_rate: u32) -> Vec<Vec<i16>>
Encode multiple timecodes in a single batch call.
Returns one inner Vec<i16> per timecode, each holding one LTC frame
worth of PCM samples at the given sample_rate. The i16 samples
are scaled from amplitude (0.0 – 1.0): +amplitude → i16::MAX,
−amplitude → i16::MIN.
A fresh encoder polarity state is used for each timecode, matching the per-frame reset semantics that many LTC editors expect.
Sourcepub fn encode_batch_interleaved(
timecodes: &[Timecode],
sample_rate: u32,
) -> Vec<i16>
pub fn encode_batch_interleaved( timecodes: &[Timecode], sample_rate: u32, ) -> Vec<i16>
Encode multiple timecodes and interleave all resulting PCM samples into
a single flat Vec<i16>.
Equivalent to calling encode_batch and
flattening the result, but avoids an intermediate allocation per frame.
Sourcepub fn set_amplitude(&mut self, amplitude: f32)
pub fn set_amplitude(&mut self, amplitude: f32)
Set output amplitude
Auto Trait Implementations§
impl Freeze for LtcEncoder
impl RefUnwindSafe for LtcEncoder
impl Send for LtcEncoder
impl Sync for LtcEncoder
impl Unpin for LtcEncoder
impl UnsafeUnpin for LtcEncoder
impl UnwindSafe for LtcEncoder
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