Use C++ memory allocation. (#849)

This commit is contained in:
bladeoner 2019-05-16 02:55:12 +02:00 committed by dborth
parent 8447bdf94c
commit 4a5a027e61

View File

@ -56,6 +56,13 @@ class Resampler
return (a0 * b) + (a1 * m0) + (a2 * m1) + (a3 * c); return (a0 * b) + (a1 * m0) + (a2 * m1) + (a3 * c);
} }
Resampler()
{
this->buffer_size = 0;
buffer = NULL;
r_step = 1.0;
}
Resampler(int num_samples) Resampler(int num_samples)
{ {
this->buffer_size = num_samples; this->buffer_size = num_samples;
@ -77,6 +84,9 @@ class Resampler
inline void clear(void) inline void clear(void)
{ {
if (!buffer)
return;
start = 0; start = 0;
size = 0; size = 0;
memset(buffer, 0, buffer_size * 2); memset(buffer, 0, buffer_size * 2);