From af4d23aa8241c726e5e5535cffba077231cd4d03 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 21 Apr 2018 22:13:02 +1000 Subject: [PATCH] Update mini_al. --- src/external/mini_al.h | 44 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/external/mini_al.h b/src/external/mini_al.h index 70ed67ea..627980b6 100644 --- a/src/external/mini_al.h +++ b/src/external/mini_al.h @@ -17343,6 +17343,10 @@ mal_uint64 mal_format_converter_read(mal_format_converter* pConverter, mal_uint6 totalFramesRead += framesJustRead; pNextFramesOut += framesJustRead * frameSizeOut; + + if (framesJustRead < framesToReadRightNow) { + break; + } } } else { // Conversion required. @@ -17367,6 +17371,10 @@ mal_uint64 mal_format_converter_read(mal_format_converter* pConverter, mal_uint6 totalFramesRead += framesJustRead; pNextFramesOut += framesJustRead * frameSizeOut; + + if (framesJustRead < framesToReadRightNow) { + break; + } } } } else { @@ -17421,6 +17429,10 @@ mal_uint64 mal_format_converter_read(mal_format_converter* pConverter, mal_uint6 totalFramesRead += framesJustRead; pNextFramesOut += framesJustRead * frameSizeOut; + + if (framesJustRead < framesToReadRightNow) { + break; + } } } @@ -17480,6 +17492,10 @@ mal_uint64 mal_format_converter_read_deinterleaved(mal_format_converter* pConver for (mal_uint32 iChannel = 0; iChannel < pConverter->config.channels; ++iChannel) { ppNextSamplesOut[iChannel] += framesJustRead * sampleSizeOut; } + + if (framesJustRead < framesToReadRightNow) { + break; + } } } else { // Input data is deinterleaved. @@ -17501,6 +17517,10 @@ mal_uint64 mal_format_converter_read_deinterleaved(mal_format_converter* pConver for (mal_uint32 iChannel = 0; iChannel < pConverter->config.channels; ++iChannel) { ppNextSamplesOut[iChannel] += framesJustRead * sampleSizeOut; } + + if (framesJustRead < framesToReadRightNow) { + break; + } } } else { // Conversion required. @@ -17531,6 +17551,10 @@ mal_uint64 mal_format_converter_read_deinterleaved(mal_format_converter* pConver } totalFramesRead += framesJustRead; + + if (framesJustRead < framesToReadRightNow) { + break; + } } } } @@ -18114,6 +18138,10 @@ mal_uint64 mal_channel_router_read_deinterleaved(mal_channel_router* pRouter, ma for (mal_uint32 iChannel = 0; iChannel < pRouter->config.channelsOut; ++iChannel) { ppNextSamplesOut[iChannel] += framesJustRead; } + + if (framesJustRead < framesToReadRightNow) { + break; + } } } } @@ -18152,6 +18180,10 @@ mal_uint64 mal_channel_router_read_deinterleaved(mal_channel_router* pRouter, ma ppNextSamplesOut[iChannel] += framesJustRead; } } + + if (framesJustRead < framesToReadRightNow) { + break; + } } return totalFramesRead; @@ -18303,14 +18335,18 @@ mal_uint64 mal_src_read_deinterleaved__passthrough(mal_src* pSRC, mal_uint64 fra framesToReadRightNow = 0xFFFFFFFF; } - mal_uint32 framesRead = (mal_uint32)pSRC->config.onReadDeinterleaved(pSRC, (mal_uint32)framesToReadRightNow, (void**)ppNextSamplesOut, pUserData); - if (framesRead == 0) { + mal_uint32 framesJustRead = (mal_uint32)pSRC->config.onReadDeinterleaved(pSRC, (mal_uint32)framesToReadRightNow, (void**)ppNextSamplesOut, pUserData); + if (framesJustRead == 0) { break; } - totalFramesRead += framesRead; + totalFramesRead += framesJustRead; for (mal_uint32 iChannel = 0; iChannel < pSRC->config.channels; ++iChannel) { - ppNextSamplesOut[iChannel] += framesRead; + ppNextSamplesOut[iChannel] += framesJustRead; + } + + if (framesJustRead < framesToReadRightNow) { + break; } }