Resampler constructor
Resampler({})
Creates and owns a reusable resampling context for repeated calls.
The context is initialized once and kept alive until close is called.
Implementation
factory Resampler({
required int origFreq,
required int newFreq,
int lowpassFilterWidth = 6,
double rolloff = 0.99,
ResamplingMethod method = ResamplingMethod.sincHann,
double? beta,
}) {
final ctx = yl_resample_ctx_create(
origFreq,
newFreq,
lowpassFilterWidth,
rolloff,
method.value,
beta ?? 0,
);
if (ctx == ffi.nullptr) {
throw StateError('Failed to create resampling context');
}
return Resampler._(
_ResamplerResource(ctx),
origFreq: origFreq,
newFreq: newFreq,
lowpassFilterWidth: lowpassFilterWidth,
rolloff: rolloff,
method: method,
beta: beta,
);
}