From 4561f0e2f0bb1b30fba089efc0ffbdd6558ceb2e Mon Sep 17 00:00:00 2001 From: jthedering <51533355+jthedering@users.noreply.github.com> Date: Thu, 26 Nov 2015 20:58:29 +0000 Subject: [PATCH] Fix for problem caused by silence processing that happens with Creative Audigy 2 driver. --- EqualizerAPO.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/EqualizerAPO.cpp b/EqualizerAPO.cpp index 1e28597..28ea8c7 100644 --- a/EqualizerAPO.cpp +++ b/EqualizerAPO.cpp @@ -422,7 +422,26 @@ void EqualizerAPO::APOProcess(UINT32 u32NumInputConnections, engine.process(outputFrames, inputFrames, ppInputConnections[0]->u32ValidFrameCount); ppOutputConnections[0]->u32ValidFrameCount = ppInputConnections[0]->u32ValidFrameCount; - ppOutputConnections[0]->u32BufferFlags = BUFFER_VALID; + + if (ppInputConnections[0]->u32BufferFlags == BUFFER_SILENT) + { + unsigned outputFrameCount = ppOutputConnections[0]->u32ValidFrameCount * engine.getOutputChannelCount(); + boolean silent = true; + for (unsigned i = 0; i < outputFrameCount; i++) + { + if (outputFrames[i] != 0.0) + { + silent = false; + break; + } + } + // BUFFER_SILENT seems to be important for some sound card drivers, so only use BUFFER_VALID if there really is audio + ppOutputConnections[0]->u32BufferFlags = silent ? BUFFER_SILENT : BUFFER_VALID; + } + else + { + ppOutputConnections[0]->u32BufferFlags = BUFFER_VALID; + } break; }