From 82f9239cd131dad94d6dc27c0337ac5d649fc53d Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Wed, 27 May 2020 18:33:54 +0200 Subject: [PATCH] 24 bit FLAC export. Clip negative side of wave (#5501) 24 bit FLAC export. Clip negative side of wave to counteract a bug in libsndfile < 1.0.29 Co-authored-by: Spekular Co-authored-by: Hyunjin Song --- src/core/audio/AudioFileFlac.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/audio/AudioFileFlac.cpp b/src/core/audio/AudioFileFlac.cpp index d9d91f54b..cb159e46d 100644 --- a/src/core/audio/AudioFileFlac.cpp +++ b/src/core/audio/AudioFileFlac.cpp @@ -22,6 +22,9 @@ * */ +#include + +#include #include #include "AudioFileFlac.h" @@ -86,6 +89,7 @@ bool AudioFileFlac::startEncoding() void AudioFileFlac::writeBuffer(surroundSampleFrame const* _ab, fpp_t const frames, float master_gain) { OutputSettings::BitDepth depth = getOutputSettings().getBitDepth(); + float clipvalue = std::nextafterf( -1.0f, 0.0f ); if (depth == OutputSettings::Depth_24Bit || depth == OutputSettings::Depth_32Bit) // Float encoding { @@ -94,7 +98,10 @@ void AudioFileFlac::writeBuffer(surroundSampleFrame const* _ab, fpp_t const fram { for(ch_cnt_t channel=0; channel(buf.get()),frames);