Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Audio frames and audio processing. More...
Classes | |
class | BuiltinResampler |
Built-in resampler. More... | |
class | ChannelMapper |
Channel mapper. More... | |
class | ChannelMapperMatrix |
Channel mapping matrix. More... | |
class | ChannelMapperReader |
Channel mapper reader. Reads frames from nested reader and maps them to another channel mask. More... | |
class | ChannelMapperWriter |
Channel mapper writer. Reads frames from nested writer and maps them to another channel mask. More... | |
class | ChannelSet |
Channel set. Multi-word bitmask with bits corresponding to enabled channels. Meaning of each channel is defined by ChannelLayout. Order of serialized channels is defined by ChannelOrder. More... | |
class | channel_set_to_str |
Format ChannelSet to string. More... | |
struct | ChannelPositionName |
Defines string name for channel position. More... | |
struct | ChannelMaskName |
Defines string name for pre-defined channel mask. More... | |
struct | ChannelMapRule |
Defines multiplication coefficient for a pair of channels. More... | |
struct | ChannelMapTable |
Defines multiplication matrix for two channel masks. More... | |
struct | ChannelOrderTable |
Defines ordered list of channels. More... | |
class | DecimationResampler |
Decimating resampler. More... | |
class | Depacketizer |
Depacketizer. More... | |
class | Fanout |
Fanout. Duplicates audio stream to multiple output writers. More... | |
struct | FeedbackConfig |
Feedback monitor configuration. More... | |
class | FeedbackMonitor |
Feedback monitor. More... | |
class | Frame |
Audio frame. More... | |
class | FrameFactory |
Frame factory. More... | |
struct | FreqEstimatorConfig |
FreqEstimator tunable parameters. More... | |
class | FreqEstimator |
Evaluates sender's frequency to receivers's frequency ratio. More... | |
class | IFrameDecoder |
Audio frame decoder interface. More... | |
class | IFrameEncoder |
Audio frame encoder interface. More... | |
class | IFrameReader |
Frame reader interface. More... | |
class | IFrameWriter |
Frame writer interface. More... | |
class | IResampler |
Audio writer interface. More... | |
class | LatencyMonitor |
Latency monitor. More... | |
struct | LatencyConfig |
Latency settings. More... | |
struct | LatencyMetrics |
Latency-related metrics. More... | |
class | LatencyTuner |
Latency tuner. More... | |
class | Mixer |
Mixer. Mixes multiple input streams into one output stream. More... | |
class | NullWriter |
Null writer. More... | |
struct | PacketizerMetrics |
Metrics of packetizer. More... | |
class | Packetizer |
Packetizer. More... | |
class | PcmDecoder |
PCM decoder. More... | |
class | PcmEncoder |
PCM encoder. More... | |
struct | PcmTraits |
PCM format meta-information. More... | |
class | PcmMapper |
PCM format mapper. Convert between PCM formats. More... | |
class | PcmMapperReader |
Pcm mapper reader. Reads frames from nested reader and maps them to another pcm mask. More... | |
class | PcmMapperWriter |
Pcm mapper writer. Reads frames from nested writer and maps them to another pcm mask. More... | |
struct | ProfilerConfig |
Profiler Configuration Parameters. Controls profiling interval and duration of each circular buffer chunk. More... | |
class | Profiler |
Profiler The role of the profiler is to report the average processing speed (# of samples processed per time unit) during the last N seconds. We want to calculate the average processing speed efficiently (with O(1) complexity, without allocations, and as lightweight as possible). The problems with this are that we have variable-sized frames and SMA requires fixed-size chunks. To efficiently perform this calculation a ring buffer is employed. The idea behind the ring buffer is that each chunk of the buffer is the average speed of 10ms worth of samples. The ring buffer is initialized with fixed size (N * 1000)ms / (10ms) chunks. Within each chunk a weighted mean is used to calculate the average speed during those 10ms. Each frame will contribute a different number of samples to each chunk, the chunk speed is then weighted based on how many samples are contributed at what frame speed. As the chunks get populated the moving average is calculated. When the buffer is not entirely full the cumulative moving average algorithm is used and once the buffer is full the simple moving average algorithm is used. More... | |
class | ProfilingReader |
Profiling reader. More... | |
class | ProfilingWriter |
Profiling writer. More... | |
struct | ResamplerConfig |
Resampler config. More... | |
class | ResamplerMap |
Factory class for IResampler objects, according to the ResamplerBackend input. More... | |
class | ResamplerReader |
Resampler element for reading pipeline. More... | |
class | ResamplerWriter |
Resampler element for writing pipeline. More... | |
class | SampleSpec |
Sample specification. Describes sample rate and channels. More... | |
class | sample_spec_to_str |
Format SampleSpec to string. More... | |
class | SpeexResampler |
Speex resampler. More... | |
struct | WatchdogConfig |
Watchdog parameters. More... | |
class | Watchdog |
Watchdog. More... | |
Typedefs | |
typedef uint32_t | ChannelMask |
Channel mask. More... | |
typedef void(* | PcmMapFn) (const uint8_t *in_data, size_t &in_bit_off, uint8_t *out_data, size_t &out_bit_off, size_t n_samples) |
PCM mapping function. More... | |
typedef float | sample_t |
Raw audio sample. More... | |
Functions | |
const char * | channel_layout_to_str (ChannelLayout) |
Get string name of channel layout. More... | |
const char * | channel_order_to_str (ChannelOrder) |
Get string name of channel order. More... | |
const char * | channel_pos_to_str (ChannelPosition) |
Get string name from channel position. More... | |
const char * | channel_mask_to_str (ChannelMask) |
Get string name from channel mask. More... | |
void | format_channel_set (const ChannelSet &ch_set, core::StringBuilder &bld) |
Format ChannelSet to string. More... | |
const char * | latency_tuner_backend_to_str (LatencyTunerBackend backend) |
Get string name of latency backend. More... | |
const char * | latency_tuner_profile_to_str (LatencyTunerProfile tuner) |
Get string name of latency tuner. More... | |
PcmMapFn | pcm_format_mapfn (PcmFormat in_format, PcmFormat out_format) |
Get mapping function for given PCM format pair. More... | |
PcmTraits | pcm_format_traits (PcmFormat format) |
Get format traits for given PCM format. More... | |
const char * | pcm_format_to_str (PcmFormat format) |
Get string name of PCM format. More... | |
PcmFormat | pcm_format_from_str (const char *str) |
Get PCM format from string name. More... | |
ROC_ATTR_NODISCARD bool | print_supported () |
Print supported encodings. More... | |
const char * | resampler_backend_to_str (ResamplerBackend backend) |
Get string name of resampler backend. More... | |
const char * | resampler_profile_to_str (ResamplerProfile profile) |
Get string name of resampler profile. More... | |
const char * | sample_format_to_str (SampleFormat format) |
Get string name of sample format. More... | |
ROC_ATTR_NODISCARD bool | parse_sample_spec (const char *str, SampleSpec &result) |
Parse sample spec from string. More... | |
void | format_sample_spec (const SampleSpec &sample_spec, core::StringBuilder &bld) |
Format sample spec to string. More... | |
Variables | |
const ChannelPositionName | ChanPositionNames [ChanPos_Max] |
Defines mapping between channel position and its name. More... | |
const ChannelMaskName | ChanMaskNames [17] |
Defines mapping between channel mask and its name. More... | |
const ChannelOrderTable | ChanOrderTables [ChanOrder_Max] |
Defines mapping of channel order identifier to list of channel positions in corresponding order. More... | |
const ChannelMapTable | ChanMapTables [71] |
Defines list of mappings between all supported surround channel mask pairs. More... | |
const double | fe_decim_h [fe_decim_len] |
Impulse response of decimation filter with factor of 10. More... | |
const double | fe_decim_h_gain |
Filters gain, sum(fe_decim_h). More... | |
const PcmFormat | Sample_RawFormat |
Format description for raw audio samples. More... | |
const sample_t | Sample_Min |
Minimum possible value of a raw sample. More... | |
const sample_t | Sample_Max |
Maximum possible value of a raw sample. More... | |
Audio frames and audio processing.
typedef uint32_t roc::audio::ChannelMask |
Channel mask.
Definition at line 148 of file channel_defs.h.
typedef void(* roc::audio::PcmMapFn) (const uint8_t *in_data, size_t &in_bit_off, uint8_t *out_data, size_t &out_bit_off, size_t n_samples) |
PCM mapping function.
Definition at line 235 of file pcm_format.h.
typedef float roc::audio::sample_t |
Channel layout. Defines meaning of channels in ChannelSet. ChannelMapper uses channel layout to decide how to perform mapping.
Enumerator | |
---|---|
ChanLayout_None | Channel layout is not set.
|
ChanLayout_Surround | Multi-channel mono / stereo / surround sound.
|
ChanLayout_Multitrack | Multi-channel multi-track sound.
|
Definition at line 23 of file channel_defs.h.
Surround channel order.
Enumerator | |
---|---|
ChanOrder_None | Channel order is not set.
|
ChanOrder_Smpte | ITU/SMPTE channel order. Order: FL, FR, FC, LFE, BL, BR, BC, SL, SR, TFL, TFR, TBL, TBR, TML, TMR.
|
ChanOrder_Alsa | ALSA channel order. Order: FL, FR, BL, BR, FC, LFE, SL, SR, BC.
|
ChanOrder_Max | Maximum value of enum. |
Definition at line 49 of file channel_defs.h.
Surround channel position.
Definition at line 86 of file channel_defs.h.
FreqEstimator paremeter preset.
Definition at line 24 of file freq_estimator.h.
Latency tuner backend. Defines which latency we monitor and tune to achieve target.
Definition at line 29 of file latency_tuner.h.
Latency tuner profile. Defines whether and how we tune latency on fly to compensate clock drift and jitter.
Definition at line 47 of file latency_tuner.h.
PCM format. Defines PCM sample coding and endian.
Definition at line 22 of file pcm_format.h.
Resampler backends.
Definition at line 21 of file resampler_config.h.
Resampler parameters presets.
Enumerator | |
---|---|
ResamplerProfile_Low | Low quality, fast speed. |
ResamplerProfile_Medium | Medium quality, medium speed. |
ResamplerProfile_High | High quality, low speed. |
Definition at line 43 of file resampler_config.h.
Sample format. Defines representation of samples in memory. Does not define sample rate and channel set.
Enumerator | |
---|---|
SampleFormat_Invalid | Invalid format. |
SampleFormat_Pcm | Interleaved PCM format. What specific PCM coding and endian is used is defined by PcmFormat enum. |
Definition at line 23 of file sample_format.h.
const char* roc::audio::channel_layout_to_str | ( | ChannelLayout | ) |
Get string name of channel layout.
const char* roc::audio::channel_mask_to_str | ( | ChannelMask | ) |
Get string name from channel mask.
const char* roc::audio::channel_order_to_str | ( | ChannelOrder | ) |
Get string name of channel order.
const char* roc::audio::channel_pos_to_str | ( | ChannelPosition | ) |
Get string name from channel position.
void roc::audio::format_channel_set | ( | const ChannelSet & | ch_set, |
core::StringBuilder & | bld | ||
) |
Format ChannelSet to string.
void roc::audio::format_sample_spec | ( | const SampleSpec & | sample_spec, |
core::StringBuilder & | bld | ||
) |
Format sample spec to string.
const char* roc::audio::latency_tuner_backend_to_str | ( | LatencyTunerBackend | backend | ) |
Get string name of latency backend.
const char* roc::audio::latency_tuner_profile_to_str | ( | LatencyTunerProfile | tuner | ) |
Get string name of latency tuner.
ROC_ATTR_NODISCARD bool roc::audio::parse_sample_spec | ( | const char * | str, |
SampleSpec & | result | ||
) |
Parse sample spec from string.
Where:
Each of the three components ("<format>", "<rate>", "<channels>") may be set to "-", which means "keep unset".
All four forms of "<channels>" component are alternative ways to represent a bitmask of enabled channels or tracks. The order of channels does no matter.
Examples:
PcmFormat roc::audio::pcm_format_from_str | ( | const char * | str | ) |
Get PCM format from string name.
Get mapping function for given PCM format pair.
const char* roc::audio::pcm_format_to_str | ( | PcmFormat | format | ) |
Get string name of PCM format.
ROC_ATTR_NODISCARD bool roc::audio::print_supported | ( | ) |
Print supported encodings.
const char* roc::audio::resampler_backend_to_str | ( | ResamplerBackend | backend | ) |
Get string name of resampler backend.
const char* roc::audio::resampler_profile_to_str | ( | ResamplerProfile | profile | ) |
Get string name of resampler profile.
const char* roc::audio::sample_format_to_str | ( | SampleFormat | format | ) |
Get string name of sample format.
|
extern |
Defines list of mappings between all supported surround channel mask pairs.
Channel mapper will search for appropriate mapping in this list, based on input and output channel masks.
These tables define downmixing coefficients for mapping between different surround channel sets. They are used for both downmixing and upmixing.
Mappings should be ordered from smaller to larger masks, because channel mapper will use the very first pair that covers both output and input masks.
Only downmixing mappings are defined. Upmixing mappings are derived automatically from them.
Technically, some of the mappings are actually partially downmixing, and partially upmixing, for example mapping from 6.x to 5.1.x downmixes some channels and upmixes others. However, for convenience, we still call it "downmixing" because we consider 6.x to be a "larger" channel set than 5.x.
For groups of similar layouts, when possible, mappings are defined only for the most complete layout, and are automatically reused for the rest. For example, mappings for 5.1.2 may be automatically used for 5.1 and 5.0.
These tables were originally based on the following documents (and then extended to cover more combinations):
Useful links: https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.775-1-199407-S!!PDF-E.pdf https://prdatsc.wpenginepowered.com/wp-content/uploads/2021/04/A52-2018.pdf https://www.audiokinetic.com/en/library/edge/?source=Help&id=downmix_tables https://trac.ffmpeg.org/wiki/AudioChannelManipulation https://superuser.com/questions/852400
|
extern |
Defines mapping between channel mask and its name.
|
extern |
Defines mapping of channel order identifier to list of channel positions in corresponding order.
When channel order is applied, the list of channels is filtered, and only channels present in channel mask are kept. The resulting filtered list defines how channels are placed in memory.
This allows us to define single list that for multiple channel masks. For example, ITU/SMPTE defines order for each channel mask (5.x, 7.x), but we define only one list ChanOrder_Smpte, and after filtering it becomes suitable for each of the masks.
The opposite is also true: if some channel is missing from the order's list, it is considered unsupported by the order and is zeroized.
Links: https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.2102-0-201701-I!!PDF-E.pdf
|
extern |
Defines mapping between channel position and its name.
|
extern |
Impulse response of decimation filter with factor of 10.
|
extern |
Filters gain, sum(fe_decim_h).
|
extern |
Maximum possible value of a raw sample.
|
extern |
Minimum possible value of a raw sample.
|
extern |
Format description for raw audio samples.