Update dr_wav, dr_flac and dr_mp3.

This commit is contained in:
David Reid
2020-01-29 18:00:12 +10:00
parent 68b960215f
commit 02df9b2e9a
3 changed files with 34 additions and 19 deletions
+19 -12
View File
@@ -1,6 +1,6 @@
/*
WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_wav - v0.11.3 - 2020-01-12
dr_wav - v0.11.4 - 2020-01-29
David Reid - mackron@gmail.com
*/
@@ -1100,14 +1100,14 @@ static const drwav_uint8 drwavGUID_W64_SMPL[16] = {0x73,0x6D,0x70,0x6C, 0xF3,0xA
static DRWAV_INLINE drwav_bool32 drwav__guid_equal(const drwav_uint8 a[16], const drwav_uint8 b[16])
{
const drwav_uint32* a32 = (const drwav_uint32*)a;
const drwav_uint32* b32 = (const drwav_uint32*)b;
int i;
for (i = 0; i < 16; i += 1) {
if (a[i] != b[i]) {
return DRWAV_FALSE;
}
}
return
a32[0] == b32[0] &&
a32[1] == b32[1] &&
a32[2] == b32[2] &&
a32[3] == b32[3];
return DRWAV_TRUE;
}
static DRWAV_INLINE drwav_bool32 drwav__fourcc_equal(const unsigned char* a, const char* b)
@@ -3579,7 +3579,8 @@ static void drwav__pcm_to_s16(drwav_int16* pOut, const unsigned char* pIn, size_
unsigned int shift = (8 - bytesPerSample) * 8;
unsigned int j;
for (j = 0; j < bytesPerSample && j < 8; j += 1) {
for (j = 0; j < bytesPerSample; j += 1) {
DRWAV_ASSERT(j < 8);
sample |= (drwav_uint64)(pIn[j]) << shift;
shift += 8;
}
@@ -3901,7 +3902,8 @@ static void drwav__pcm_to_f32(float* pOut, const unsigned char* pIn, size_t samp
unsigned int shift = (8 - bytesPerSample) * 8;
unsigned int j;
for (j = 0; j < bytesPerSample && j < 8; j += 1) {
for (j = 0; j < bytesPerSample; j += 1) {
DRWAV_ASSERT(j < 8);
sample |= (drwav_uint64)(pIn[j]) << shift;
shift += 8;
}
@@ -4051,7 +4053,7 @@ drwav_uint64 drwav_read_pcm_frames_f32__alaw(drwav* pWav, drwav_uint64 framesToR
totalFramesRead = 0;
while (bytesPerFrame > 0) {
while (framesToRead > 0) {
drwav_uint64 framesRead = drwav_read_pcm_frames(pWav, drwav_min(framesToRead, sizeof(sampleData)/bytesPerFrame), sampleData);
if (framesRead == 0) {
break;
@@ -4303,7 +4305,8 @@ static void drwav__pcm_to_s32(drwav_int32* pOut, const unsigned char* pIn, size_
unsigned int shift = (8 - bytesPerSample) * 8;
unsigned int j;
for (j = 0; j < bytesPerSample && j < 8; j += 1) {
for (j = 0; j < bytesPerSample; j += 1) {
DRWAV_ASSERT(j < 8);
sample |= (drwav_uint64)(pIn[j]) << shift;
shift += 8;
}
@@ -5052,6 +5055,10 @@ void drwav_free(void* p, const drwav_allocation_callbacks* pAllocationCallbacks)
/*
REVISION HISTORY
================
v0.11.4 - 2020-01-29
- Fix some static analysis warnings.
- Fix a bug when reading f32 samples from an A-law encoded stream.
v0.11.3 - 2020-01-12
- Minor changes to some f32 format conversion routines.
- Minor bug fix for ADPCM conversion when end of file is reached.