Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::audio::PcmMapper Class Reference

PCM format mapper. Convert between PCM formats. More...

#include <pcm_mapper.h>

Inheritance diagram for roc::audio::PcmMapper:
Collaboration diagram for roc::audio::PcmMapper:

Public Member Functions

 PcmMapper (PcmFormat input_fmt, PcmFormat output_fmt)
 Initialize. More...
 
PcmFormat input_format () const
 Get input format. More...
 
PcmFormat output_format () const
 Get output format. More...
 
size_t input_sample_count (size_t input_bytes) const
 Get number of input samples per channel for given number of bytes. More...
 
size_t output_sample_count (size_t output_bytes) const
 Get number of input samples per channel for given number of bytes. More...
 
size_t input_byte_count (size_t input_samples) const
 Get number of input bytes for given number of samples per channel. More...
 
size_t output_byte_count (size_t output_samples) const
 Get number of output bytes for given number of samples per channel. More...
 
size_t input_bit_count (size_t input_samples) const
 Get number of input bits for given number of samples per channel. More...
 
size_t output_bit_count (size_t output_samples) const
 Get number of output bits for given number of samples per channel. More...
 
size_t map (const void *in_data, size_t in_byte_size, size_t &in_bit_off, void *out_data, size_t out_byte_size, size_t &out_bit_off, size_t n_samples)
 Map samples from input to output format. More...
 

Detailed Description

PCM format mapper. Convert between PCM formats.

Definition at line 24 of file pcm_mapper.h.

Constructor & Destructor Documentation

◆ PcmMapper()

roc::audio::PcmMapper::PcmMapper ( PcmFormat  input_fmt,
PcmFormat  output_fmt 
)

Initialize.

Precondition
input_fmt and output_fmt should be PCM formats.

Member Function Documentation

◆ input_bit_count()

size_t roc::audio::PcmMapper::input_bit_count ( size_t  input_samples) const

Get number of input bits for given number of samples per channel.

◆ input_byte_count()

size_t roc::audio::PcmMapper::input_byte_count ( size_t  input_samples) const

Get number of input bytes for given number of samples per channel.

◆ input_format()

PcmFormat roc::audio::PcmMapper::input_format ( ) const

Get input format.

◆ input_sample_count()

size_t roc::audio::PcmMapper::input_sample_count ( size_t  input_bytes) const

Get number of input samples per channel for given number of bytes.

◆ map()

size_t roc::audio::PcmMapper::map ( const void *  in_data,
size_t  in_byte_size,
size_t &  in_bit_off,
void *  out_data,
size_t  out_byte_size,
size_t &  out_bit_off,
size_t  n_samples 
)

Map samples from input to output format.

Remarks
in_data is a pointer to input buffer in_byte_size is size of input buffer in bytes in_bit_off is an offset in input buffer in bits out_data is a pointer to output buffer out_byte_size is size of output buffer in bytes out_bit_off is an offset in output buffer in bits n_samples is number of input and output samples for all channels
Returns
number of samples actually mapped, which may be truncated if input or output buffer is smaller than requested
Note
updates in_bit_off and out_bit_off

◆ output_bit_count()

size_t roc::audio::PcmMapper::output_bit_count ( size_t  output_samples) const

Get number of output bits for given number of samples per channel.

◆ output_byte_count()

size_t roc::audio::PcmMapper::output_byte_count ( size_t  output_samples) const

Get number of output bytes for given number of samples per channel.

◆ output_format()

PcmFormat roc::audio::PcmMapper::output_format ( ) const

Get output format.

◆ output_sample_count()

size_t roc::audio::PcmMapper::output_sample_count ( size_t  output_bytes) const

Get number of input samples per channel for given number of bytes.


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