[DSD] Reduce volume level of decimator output

As the decimator has shown to be twice as loud as it should be, the
volume should be reduced by half when converting DSD to PCM with it.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-10 02:14:04 -07:00
parent 4537a72275
commit fe82b5ed65
1 changed files with 9 additions and 1 deletions

View File

@ -783,6 +783,10 @@ tryagain:
} }
if(inpOffset != inpSize && floatOffset == floatSize) { if(inpOffset != inpSize && floatOffset == floatSize) {
#if DSD_DECIMATE
const float scaleModifier = (inputFormat.mBitsPerChannel == 1) ? 0.5f : 1.0f;
#endif
size_t inputSamples = (inpSize - inpOffset) / floatFormat.mBytesPerPacket; size_t inputSamples = (inpSize - inpOffset) / floatFormat.mBytesPerPacket;
ioNumberPackets = (UInt32)inputSamples; ioNumberPackets = (UInt32)inputSamples;
@ -864,7 +868,11 @@ tryagain:
amountReadFromFC = (int)(outputDone * floatFormat.mBytesPerPacket); amountReadFromFC = (int)(outputDone * floatFormat.mBytesPerPacket);
scale_by_volume((float *)floatBuffer, amountReadFromFC / sizeof(float), volumeScale); scale_by_volume((float *)floatBuffer, amountReadFromFC / sizeof(float), volumeScale
#if DSD_DECIMATE
* scaleModifier
#endif
);
floatSize = amountReadFromFC; floatSize = amountReadFromFC;
floatOffset = 0; floatOffset = 0;