libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
LtcEncoder Class Reference

Encodes timecode values into LTC (Linear Timecode) audio samples. More...

#include <ltcencoder.h>

Public Member Functions

 LtcEncoder (int sampleRate, float level=0.5f)
 Constructs an LTC encoder.
 
 ~LtcEncoder ()=default
 Destructor.
 
 LtcEncoder (const LtcEncoder &)=delete
 
LtcEncoderoperator= (const LtcEncoder &)=delete
 
 LtcEncoder (LtcEncoder &&)=default
 
LtcEncoderoperator= (LtcEncoder &&)=default
 
int sampleRate () const
 Returns the configured sample rate.
 
float level () const
 Returns the output amplitude level.
 
void setLevel (float level)
 Sets the output amplitude.
 
Audio encode (const Timecode &tc)
 Encodes one timecode frame into mono int8_t audio.
 
size_t frameSizeApprox (const VtcFormat *format) const
 Returns the approximate number of samples per LTC frame.
 

Detailed Description

Encodes timecode values into LTC (Linear Timecode) audio samples.

Wraps libvtc's VtcLTCEncoder to produce biphase-mark-encoded audio representing SMPTE timecode. The output is mono int8_t audio suitable for mixing into an audio stream or output on a dedicated channel.

Not copyable (owns encoder state). Movable.

Example
LtcEncoder enc(48000, 0.5f);
Audio audio = enc.encode(tc);
// audio contains ~2000 int8_t samples of LTC for this frame
Object to hold some number of audio samples.
Definition audio.h:35
Dynamic array container wrapping std::vector.
Definition list.h:40
Encodes timecode values into LTC (Linear Timecode) audio samples.
Definition ltcencoder.h:35
Class for holding and manipulating timecode.
Definition timecode.h:45
@ NDF24
24 fps non-drop-frame (maps to VTC_FORMAT_24)
Definition timecode.h:53

Constructor & Destructor Documentation

◆ LtcEncoder()

LtcEncoder::LtcEncoder ( int  sampleRate,
float  level = 0.5f 
)

Constructs an LTC encoder.

Parameters
sampleRateAudio sample rate (e.g. 48000).
levelOutput amplitude 0.0-1.0 (default: 0.5).

Member Function Documentation

◆ encode()

Audio LtcEncoder::encode ( const Timecode tc)

Encodes one timecode frame into mono int8_t audio.

Parameters
tcThe timecode value to encode.
Returns
An Audio object containing the LTC samples (mono, PCMI_S8).

◆ frameSizeApprox()

size_t LtcEncoder::frameSizeApprox ( const VtcFormat format) const

Returns the approximate number of samples per LTC frame.

Useful for buffer pre-allocation. Actual encoded size may vary slightly.

Parameters
formatThe timecode format to estimate for.
Returns
Approximate sample count.

◆ level()

float LtcEncoder::level ( ) const
inline

Returns the output amplitude level.

Returns
The level 0.0-1.0.

◆ sampleRate()

int LtcEncoder::sampleRate ( ) const
inline

Returns the configured sample rate.

Returns
The sample rate in Hz.

◆ setLevel()

void LtcEncoder::setLevel ( float  level)

Sets the output amplitude.

Parameters
levelOutput amplitude 0.0-1.0.

The documentation for this class was generated from the following file: