From b2eccfa6d4e9c0f67257dce325a82b1f7864fcba Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 17 Jan 2022 19:31:29 +1000 Subject: [PATCH] Fix a bug with engine nodes. This bug results in an audio glitch when mixing nodes in the node graph. It specifically happens when resampling is not being performed, in which case it was specifying an output frame count greater than the number of frames that are actually being output. Public issue https://github.com/mackron/miniaudio/issues/408 --- miniaudio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index 6c557ee9..2968b9fa 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -70679,8 +70679,8 @@ static void ma_engine_node_process_pcm_frames__general(ma_engine_node* pEngineNo framesJustProcessedIn = (ma_uint32)resampleFrameCountIn; framesJustProcessedOut = (ma_uint32)resampleFrameCountOut; } else { - framesJustProcessedIn = framesAvailableIn; - framesJustProcessedOut = framesAvailableOut; + framesJustProcessedIn = ma_min(framesAvailableIn, framesAvailableOut); + framesJustProcessedOut = framesJustProcessedIn; /* When no resampling is being performed, the number of output frames is the same as input frames. */ } /* Fading. */