[AFV] Change output format and processing to 32 bit float

32 bit float is what is used in C# reference and has a much higher
dynamic range. 16 bit integer was clipping very often with all the VHF
simulation applied.
This commit is contained in:
Roland Rossgotterer
2019-10-01 11:58:02 +02:00
committed by Mat Sutcliffe
parent fbb126370c
commit 240df93406
29 changed files with 77 additions and 80 deletions

View File

@@ -13,25 +13,19 @@ namespace BlackSound
setupPreset(preset);
}
int CEqualizerSampleProvider::readSamples(QVector<qint16> &samples, qint64 count)
int CEqualizerSampleProvider::readSamples(QVector<float> &samples, qint64 count)
{
int samplesRead = m_sourceProvider->readSamples(samples, count);
if (m_bypass) return samplesRead;
QVector<double> doubleSamples = convertFromShortToDouble(samples);
for (int n = 0; n < samplesRead; n++)
{
// TODO stereo implementation
for (int band = 0; band < m_filters.size(); band++)
{
doubleSamples[n] = m_filters[band].transform(doubleSamples[n]);
samples[n] = m_filters[band].transform(samples[n]);
}
doubleSamples[n] *= m_outputGain;
samples[n] *= m_outputGain;
}
samples = convertFromDoubleToShort(doubleSamples);
return samplesRead;
}