Fix a bug where the end of a sound is cutoff.

Public issue https://github.com/mackron/miniaudio/issues/1125
This commit is contained in:
David Reid
2026-07-13 07:45:59 +10:00
parent dd644e9269
commit 5bf32c47e5
+9
View File
@@ -77123,6 +77123,15 @@ static void ma_engine_node_process_pcm_frames__sound(ma_node* pNode, const float
}
framesJustRead = totalFramesConverted;
/*
When the last iteration of the loop above returns MA_AT_END, we can be in a situation where `result` is MA_AT_END and
framesJustRead is >0. This is never valid in miniaudio so we need to normalize this (MA_AT_END should only be used
when the number of frames read is exactly 0, everywhere in miniaudio).
*/
if (result == MA_AT_END && framesJustRead > 0) {
result = MA_SUCCESS;
}
}
MA_ASSERT(framesJustRead <= pSound->processingCacheCap);