Table of Contents

Class WdlResampler

Namespace
NAudio.Dsp
Assembly
NAudio.Core.dll

Fully managed resampler, based on Cockos WDL Resampler

public class WdlResampler
Inheritance
WdlResampler
Inherited Members

Constructors

WdlResampler()

Creates a new Resampler

public WdlResampler()

Methods

GetCurrentLatency()

amount of input that has been received but not yet converted to output, in seconds

public double GetCurrentLatency()

Returns

double

ResampleOut(Span<float>, int, int, int)

if numsamples_in < the value return by ResamplePrepare(), then it will be flushed to produce all remaining valid samples do NOT call with nsamples_in greater than the value returned from resamplerprpare()! the extra samples will be ignored. returns number of samples successfully outputted to out

public int ResampleOut(Span<float> outBuffer, int nsamples_in, int nsamples_out, int nch)

Parameters

outBuffer Span<float>
nsamples_in int
nsamples_out int
nch int

Returns

int

ResamplePrepare(int, int, out Span<float>)

Prepare note that it is safe to call ResamplePrepare without calling ResampleOut (the next call of ResamplePrepare will function as normal)

public int ResamplePrepare(int out_samples, int nch, out Span<float> inbuffer)

Parameters

out_samples int

req_samples is output samples desired if !wantInputDriven, or if wantInputDriven is input samples that we have

nch int

number of channels

inbuffer Span<float>

a span into the internal buffer where input samples should be written

Returns

int

returns number of samples desired (put these into inbuffer)

Reset(double)

Reset

public void Reset(double fracpos = 0)

Parameters

fracpos double

SetFeedMode(bool)

Set feed mode

public void SetFeedMode(bool wantInputDriven)

Parameters

wantInputDriven bool

if true, that means the first parameter to ResamplePrepare will specify however much input you have, not how much you want

SetFilterParms(float, float)

Sets the filter parameters used for filtercnt>0 but not sinc

public void SetFilterParms(float filterpos = 0.693, float filterq = 0.707)

Parameters

filterpos float
filterq float

SetMode(bool, int, bool, int, int)

sets the mode if sinc set, it overrides interp or filtercnt

public void SetMode(bool interp, int filtercnt, bool sinc, int sinc_size = 64, int sinc_interpsize = 32)

Parameters

interp bool
filtercnt int
sinc bool
sinc_size int
sinc_interpsize int

SetRates(double, double)

Set input and output rates

public void SetRates(double rate_in, double rate_out)

Parameters

rate_in double
rate_out double