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

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

#include <ltcdecoder.h>

Classes

struct  DecodedTimecode
 Result of decoding a single LTC frame. More...
 

Public Types

using DecodedList = List< DecodedTimecode >
 List of decoded timecode results.
 

Public Member Functions

 LtcDecoder (int sampleRate)
 Constructs an LTC decoder.
 
 ~LtcDecoder ()=default
 Destructor.
 
 LtcDecoder (const LtcDecoder &)=delete
 
LtcDecoderoperator= (const LtcDecoder &)=delete
 
 LtcDecoder (LtcDecoder &&)=default
 
LtcDecoderoperator= (LtcDecoder &&)=default
 
int sampleRate () const
 Returns the configured sample rate.
 
void setThresholds (int8_t lower, int8_t upper)
 Sets the hysteresis thresholds for edge detection.
 
void setFuzz (int fuzz)
 Sets the timing tolerance in samples.
 
DecodedList decode (const int8_t *samples, size_t count)
 Feeds raw int8_t audio samples to the decoder.
 
DecodedList decode (const Audio &audio)
 Feeds an Audio object to the decoder.
 
void reset ()
 Clears the decoder state.
 

Detailed Description

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

Wraps libvtc's VtcLTCDecoder to extract SMPTE timecode from biphase-mark-encoded audio. Supports incremental decoding (audio can be fed in chunks) and detects forward/reverse playback direction.

Not copyable (owns decoder state). Movable.

Example
LtcDecoder dec(48000);
auto results = dec.decode(audioSamples, sampleCount);
for(auto &r : results) {
// r.timecode is the decoded value
}
Dynamic array container wrapping std::vector.
Definition list.h:40
Decodes LTC (Linear Timecode) audio samples into timecode values.
Definition ltcdecoder.h:37
TextStream & dec(TextStream &s)
Sets integer base to 10 (decimal).
Definition textstream.h:415

Constructor & Destructor Documentation

◆ LtcDecoder()

LtcDecoder::LtcDecoder ( int  sampleRate)

Constructs an LTC decoder.

Parameters
sampleRateAudio sample rate (e.g. 48000).

Member Function Documentation

◆ decode() [1/2]

DecodedList LtcDecoder::decode ( const Audio audio)

Feeds an Audio object to the decoder.

The Audio must be mono PCMI_S8. Other formats are not supported.

Parameters
audioThe audio to decode.
Returns
List of decoded timecodes found in this chunk.

◆ decode() [2/2]

DecodedList LtcDecoder::decode ( const int8_t samples,
size_t  count 
)

Feeds raw int8_t audio samples to the decoder.

Parameters
samplesPointer to int8_t audio data.
countNumber of samples.
Returns
List of decoded timecodes found in this chunk.

◆ reset()

void LtcDecoder::reset ( )

Clears the decoder state.

Use after seeking or switching sources.

◆ sampleRate()

int LtcDecoder::sampleRate ( ) const
inline

Returns the configured sample rate.

Returns
The sample rate in Hz.

◆ setFuzz()

void LtcDecoder::setFuzz ( int  fuzz)

Sets the timing tolerance in samples.

Parameters
fuzzFuzz tolerance (default: 3).

◆ setThresholds()

void LtcDecoder::setThresholds ( int8_t  lower,
int8_t  upper 
)

Sets the hysteresis thresholds for edge detection.

Parameters
lowerLower threshold (typically negative, e.g. -3).
upperUpper threshold (typically positive, e.g. 3).

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