Commit 855628f1 authored by David Reid's avatar David Reid

Update dr_wav.

parent 9091cbd0
......@@ -18463,7 +18463,6 @@ typedef LONG (WINAPI * MA_PFN_RegCloseKey)(HKEY hKey);
typedef LONG (WINAPI * MA_PFN_RegQueryValueExA)(HKEY hKey, const char* lpValueName, DWORD* lpReserved, DWORD* lpType, BYTE* lpData, DWORD* lpcbData);
#endif /* MA_WIN32_DESKTOP */
MA_API size_t ma_strlen_WCHAR(const WCHAR* str)
{
size_t len = 0;
......@@ -59885,7 +59884,7 @@ extern "C" {
#define MA_DR_WAV_XSTRINGIFY(x) MA_DR_WAV_STRINGIFY(x)
#define MA_DR_WAV_VERSION_MAJOR 0
#define MA_DR_WAV_VERSION_MINOR 13
#define MA_DR_WAV_VERSION_REVISION 16
#define MA_DR_WAV_VERSION_REVISION 17
#define MA_DR_WAV_VERSION_STRING MA_DR_WAV_XSTRINGIFY(MA_DR_WAV_VERSION_MAJOR) "." MA_DR_WAV_XSTRINGIFY(MA_DR_WAV_VERSION_MINOR) "." MA_DR_WAV_XSTRINGIFY(MA_DR_WAV_VERSION_REVISION)
#include <stddef.h>
#define MA_DR_WAVE_FORMAT_PCM 0x1
......@@ -80663,6 +80662,12 @@ MA_API ma_uint64 ma_dr_wav_write_pcm_frames(ma_dr_wav* pWav, ma_uint64 framesToW
MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__msadpcm(ma_dr_wav* pWav, ma_uint64 framesToRead, ma_int16* pBufferOut)
{
ma_uint64 totalFramesRead = 0;
static ma_int32 adaptationTable[] = {
230, 230, 230, 230, 307, 409, 512, 614,
768, 614, 512, 409, 307, 230, 230, 230
};
static ma_int32 coeff1Table[] = { 256, 512, 0, 192, 240, 460, 392 };
static ma_int32 coeff2Table[] = { 0, -256, 0, 64, 0, -208, -232 };
MA_DR_WAV_ASSERT(pWav != NULL);
MA_DR_WAV_ASSERT(framesToRead > 0);
while (pWav->readCursorInPCMFrames < pWav->totalPCMFrameCount) {
......@@ -80681,6 +80686,9 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__msadpcm(ma_dr_wav* pWav, ma_
pWav->msadpcm.cachedFrames[2] = pWav->msadpcm.prevFrames[0][0];
pWav->msadpcm.cachedFrames[3] = pWav->msadpcm.prevFrames[0][1];
pWav->msadpcm.cachedFrameCount = 2;
if (pWav->msadpcm.predictor[0] >= ma_dr_wav_countof(coeff1Table)) {
return totalFramesRead;
}
} else {
ma_uint8 header[14];
if (pWav->onRead(pWav->pUserData, header, sizeof(header)) != sizeof(header)) {
......@@ -80700,6 +80708,9 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__msadpcm(ma_dr_wav* pWav, ma_
pWav->msadpcm.cachedFrames[2] = pWav->msadpcm.prevFrames[0][1];
pWav->msadpcm.cachedFrames[3] = pWav->msadpcm.prevFrames[1][1];
pWav->msadpcm.cachedFrameCount = 2;
if (pWav->msadpcm.predictor[0] >= ma_dr_wav_countof(coeff1Table) || pWav->msadpcm.predictor[1] >= ma_dr_wav_countof(coeff2Table)) {
return totalFramesRead;
}
}
}
while (framesToRead > 0 && pWav->msadpcm.cachedFrameCount > 0 && pWav->readCursorInPCMFrames < pWav->totalPCMFrameCount) {
......@@ -80722,12 +80733,6 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__msadpcm(ma_dr_wav* pWav, ma_
if (pWav->msadpcm.bytesRemainingInBlock == 0) {
continue;
} else {
static ma_int32 adaptationTable[] = {
230, 230, 230, 230, 307, 409, 512, 614,
768, 614, 512, 409, 307, 230, 230, 230
};
static ma_int32 coeff1Table[] = { 256, 512, 0, 192, 240, 460, 392 };
static ma_int32 coeff2Table[] = { 0, -256, 0, 64, 0, -208, -232 };
ma_uint8 nibbles;
ma_int32 nibble0;
ma_int32 nibble1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment