12 #ifndef ROC_AUDIO_RESAMPLER_H_
13 #define ROC_AUDIO_RESAMPLER_H_
77 typedef uint32_t fixedpoint_t;
78 typedef uint64_t long_fixedpoint_t;
79 typedef int32_t signed_fixedpoint_t;
80 typedef int64_t signed_long_fixedpoint_t;
83 const size_t channels_num_;
85 inline size_t channelize_index(
const size_t i,
const size_t ch_offset)
const {
86 return i * channels_num_ + ch_offset;
93 sample_t resample_(
size_t channel_offset);
95 bool check_config_()
const;
98 sample_t sinc_(fixedpoint_t x,
float fract_x);
104 size_t out_frame_pos_;
108 const size_t frame_size_;
109 const size_t frame_size_ch_;
111 const size_t window_size_;
112 const fixedpoint_t qt_half_sinc_window_size_;
114 const size_t window_interp_;
115 const size_t window_interp_bits_;
121 fixedpoint_t qt_half_window_size_;
122 const fixedpoint_t qt_epsilon_;
124 const fixedpoint_t qt_frame_size_;
128 fixedpoint_t qt_sample_;
134 fixedpoint_t qt_sinc_step_;
Resamples audio stream with non-integer dynamically changing factor.
bool resample_buff(Frame &out)
Resamples the whole output frame.
Resampler(core::IAllocator &allocator, const ResamplerConfig &config, packet::channel_mask_t channels, size_t frame_size)
Initialize.
bool set_scaling(float)
Set new resample factor.
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_.
bool valid() const
Check if object is successfully constructed.
Memory allocator interface.
Base class for non-copyable objects.
float sample_t
Audio sample.
uint32_t channel_mask_t
Bitmask of channels present in audio packet.
Various units used in audio processing.
Various units used in packets.
Commonly used types and functions.
size_t window_size
Resampler internal window length.
size_t window_interp
Sinc table precision.