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

Resamples audio stream with non-integer dynamically changing factor. More...

#include <resampler.h>

Inheritance diagram for roc::audio::Resampler:
Collaboration diagram for roc::audio::Resampler:

Public Member Functions

 Resampler (core::IAllocator &allocator, const ResamplerConfig &config, packet::channel_mask_t channels, size_t frame_size)
 Initialize. More...
 
bool valid () const
 Check if object is successfully constructed. More...
 
bool set_scaling (float)
 Set new resample factor. More...
 
bool resample_buff (Frame &out)
 Resamples the whole output frame. More...
 
void renew_buffers (core::Slice< sample_t > &prev, core::Slice< sample_t > &cur, core::Slice< sample_t > &next)
 Push new buffer on the front of the internal FIFO, which comprisesthree window_. More...
 

Detailed Description

Resamples audio stream with non-integer dynamically changing factor.

Definition at line 48 of file resampler.h.

Constructor & Destructor Documentation

roc::audio::Resampler::Resampler ( core::IAllocator allocator,
const ResamplerConfig config,
packet::channel_mask_t  channels,
size_t  frame_size 
)

Initialize.

Member Function Documentation

void roc::audio::Resampler::renew_buffers ( core::Slice< sample_t > &  prev,
core::Slice< sample_t > &  cur,
core::Slice< sample_t > &  next 
)

Push new buffer on the front of the internal FIFO, which comprisesthree window_.

bool roc::audio::Resampler::resample_buff ( Frame out)

Resamples the whole output frame.

bool roc::audio::Resampler::set_scaling ( float  )

Set new resample factor.

Remarks
Resampling algorithm needs some window of input samples. The length of the window (length of sinc impulse response) is a compromise between SNR and speed. It depends on current resampling factor. So we choose length of input buffers to let it handle maximum length of input. If new scaling factor breaks equation this function returns false.
bool roc::audio::Resampler::valid ( ) const

Check if object is successfully constructed.


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