Bug 2676 - Export: Incorrect handling over 0 dB

This bug was caused by dither being applied to all float output,
and dither clips to +1/-1 to avoid high values, especially NaNs,
polluting audio downstream.

Dither was applied because of an incorrect fix for Bug 1572.
The 1572 fix assumed SF_FORMAT_PCM_24 was a  (1 << N)
value, rather than from an enumeration.  Hence a check
involving it requires a mask, which it now has.
This commit is contained in:
James Crook 2021-04-03 13:45:11 +01:00
parent f5317775a0
commit cca372fb92
1 changed files with 2 additions and 2 deletions

View File

@ -611,7 +611,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
{
std::vector<char> dither;
if (info.format & SF_FORMAT_PCM_24) {
if ((info.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_24) {
dither.reserve(maxBlockLen * info.channels * SAMPLE_SIZE(int24Sample));
}
@ -638,7 +638,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
samplePtr mixed = mixer->GetBuffer();
// Bug 1572: Not ideal, but it does add the desired dither
if (info.format & SF_FORMAT_PCM_24) {
if ((info.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_24) {
for (int c = 0; c < info.channels; ++c) {
CopySamples(
mixed + (c * SAMPLE_SIZE(format)), format,