Resampler: force even buffer sizes in resize

This commit is contained in:
OV2 2023-03-29 12:27:22 +02:00
parent 59c48e35a7
commit afe8dd9f01
1 changed files with 5 additions and 6 deletions

View File

@ -65,13 +65,9 @@ class Resampler
Resampler(int num_samples)
{
// Only allow even buffer sizes
if (num_samples & 1)
num_samples++;
this->buffer_size = num_samples;
buffer = new int16_t[this->buffer_size];
buffer = NULL;
resize(num_samples);
r_step = 1.0;
clear();
}
~Resampler()
@ -223,6 +219,9 @@ class Resampler
{
if (buffer)
delete[] buffer;
// Only allow even buffer sizes
if (num_samples & 1)
num_samples++;
buffer_size = num_samples;
buffer = new int16_t[buffer_size];
clear();