Make WDL resampler initial buffer size optional

This commit is contained in:
xenakios 2018-10-26 20:38:28 +03:00
parent 1b9256ede0
commit bdcb268508
3 changed files with 5 additions and 4 deletions

View File

@ -30,7 +30,7 @@ StretchAudioSource::StretchAudioSource(int initialnumoutchans,
AudioFormatManager* afm,
std::array<AudioParameterBool*,9>& enab_pars) : m_afm(afm)
{
m_resampler = std::make_unique<WDL_Resampler>();
m_resampler = std::make_unique<WDL_Resampler>(4*65536);
m_resampler_outbuf.resize(1024*1024);
m_inputfile = std::make_unique<AInputS>(m_afm);
for (int i = 0; i < enab_pars.size(); ++i)

View File

@ -185,7 +185,7 @@ void inline WDL_Resampler::SincSample2(WDL_ResampleSample *outptr, const WDL_Res
WDL_Resampler::WDL_Resampler()
WDL_Resampler::WDL_Resampler(int initialinputbuffersize)
{
m_filterq=0.707f;
m_filterpos=0.693f; // .792 ?
@ -203,7 +203,8 @@ WDL_Resampler::WDL_Resampler()
m_ratio=1.0;
m_filter_ratio=-1.0;
m_iirfilter=0;
m_rsinbuf.Resize(4 * 65536);
if (initialinputbuffersize>0)
m_rsinbuf.Resize(initialinputbuffersize);
Reset();
}

View File

@ -57,7 +57,7 @@ typedef double WDL_ResampleSample;
class WDL_Resampler
{
public:
WDL_Resampler();
WDL_Resampler(int initialinputbuffersize=0);
~WDL_Resampler();
// if sinc set, it overrides interp or filtercnt
void SetMode(bool interp, int filtercnt, bool sinc, int sinc_size=64, int sinc_interpsize=32);