MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ Resampler() [1/3]

MayaFlux::Kinesis::Discrete::Resampler::Resampler ( uint32_t from_rate,
uint32_t to_rate,
const ResampleConfig & config = {} )

Construct a resampler.

Parameters
from_rateRate of the input in Hz
to_rateRate of the output in Hz
configAnti-aliasing filter design, as for resample
Exceptions
std::invalid_argumentWhen either rate is 0

Definition at line 208 of file Resample.cpp.

209 : m_impl(std::make_unique<Impl>())
210{
211 if (from_rate == 0 || to_rate == 0) {
212 error<std::invalid_argument>(Journal::Component::Kinesis, Journal::Context::Runtime,
213 std::source_location::current(), "Resampler rates must be greater than 0");
214 }
215 auto& impl = *m_impl;
216 impl.from_rate = from_rate;
217 impl.to_rate = to_rate;
218 impl.passthrough = from_rate == to_rate;
219 if (impl.passthrough) {
220 return;
221 }
222 const uint32_t divisor = std::gcd(from_rate, to_rate);
223 impl.up = to_rate / divisor;
224 impl.down = from_rate / divisor;
225 const auto filter = design_filter(impl.up, impl.down, config);
226 impl.table = build_polyphase(filter, impl.up);
227 impl.max_taps = (filter.size() + impl.up - 1) / impl.up;
228}
@ Runtime
General runtime operations (default fallback).
@ Kinesis
General mathematical and physics algorithns.

References MayaFlux::Journal::Kinesis, m_impl, Resampler(), and MayaFlux::Journal::Runtime.

Referenced by operator=(), operator=(), push(), Resampler(), Resampler(), and Resampler().

Here is the call graph for this function:
Here is the caller graph for this function: