Skip to content

Commit

Permalink
Update miniaudio and dr_libs
Browse files Browse the repository at this point in the history
  • Loading branch information
Clownacy committed May 28, 2020
1 parent ad6493f commit b2e2add
Show file tree
Hide file tree
Showing 4 changed files with 6,694 additions and 5,559 deletions.
43 changes: 42 additions & 1 deletion src/decoding/decoders/libs/dr_flac.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_flac - v0.12.12 - 2020-04-30
dr_flac - v0.12.13 - 2020-05-16
David Reid - [email protected]
Expand Down Expand Up @@ -227,6 +227,14 @@ Notes
extern "C" {
#endif

#define DRFLAC_STRINGIFY(x) #x
#define DRFLAC_XSTRINGIFY(x) DRFLAC_STRINGIFY(x)

#define DRFLAC_VERSION_MAJOR 0
#define DRFLAC_VERSION_MINOR 12
#define DRFLAC_VERSION_REVISION 13
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)

#include <stddef.h> /* For size_t. */

/* Sized types. Prefer built-in types. Fall back to stdint. */
Expand Down Expand Up @@ -308,6 +316,9 @@ typedef drflac_uint32 drflac_bool32;
#define DRFLAC_DEPRECATED
#endif

DRFLAC_API void drflac_version(drflac_uint32* pMajor, drflac_uint32* pMinor, drflac_uint32* pRevision);
DRFLAC_API const char* drflac_version_string();

/*
As data is read from the client it is placed into an internal buffer for fast access. This controls the size of that buffer. Larger values means more speed,
but also more memory. In my testing there is diminishing returns after about 4KB, but you can fiddle with this to suit your own needs. Must be a multiple of 8.
Expand Down Expand Up @@ -1645,6 +1656,27 @@ typedef drflac_int32 drflac_result;
#define drflac_align(x, a) ((((x) + (a) - 1) / (a)) * (a))


DRFLAC_API void drflac_version(drflac_uint32* pMajor, drflac_uint32* pMinor, drflac_uint32* pRevision)
{
if (pMajor) {
*pMajor = DRFLAC_VERSION_MAJOR;
}

if (pMinor) {
*pMinor = DRFLAC_VERSION_MINOR;
}

if (pRevision) {
*pRevision = DRFLAC_VERSION_REVISION;
}
}

DRFLAC_API const char* drflac_version_string()
{
return DRFLAC_VERSION_STRING;
}


/* CPU caps. */
#if defined(__has_feature)
#if __has_feature(thread_sanitizer)
Expand Down Expand Up @@ -11705,6 +11737,15 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
/*
REVISION HISTORY
================
v0.12.13 - 2020-05-16
- Add compile-time and run-time version querying.
- DRFLAC_VERSION_MINOR
- DRFLAC_VERSION_MAJOR
- DRFLAC_VERSION_REVISION
- DRFLAC_VERSION_STRING
- drflac_version()
- drflac_version_string()
v0.12.12 - 2020-04-30
- Fix compilation errors with VC6.
Expand Down
58 changes: 52 additions & 6 deletions src/decoding/decoders/libs/dr_mp3.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_mp3 - v0.6.9 - 2020-04-30
dr_mp3 - v0.6.11 - 2020-05-26
David Reid - [email protected]
Expand Down Expand Up @@ -90,6 +90,14 @@ Build Options
extern "C" {
#endif

#define DRMP3_STRINGIFY(x) #x
#define DRMP3_XSTRINGIFY(x) DRMP3_STRINGIFY(x)

#define DRMP3_VERSION_MAJOR 0
#define DRMP3_VERSION_MINOR 6
#define DRMP3_VERSION_REVISION 11
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)

#include <stddef.h> /* For size_t. */

/* Sized types. Prefer built-in types. Fall back to stdint. */
Expand Down Expand Up @@ -236,6 +244,11 @@ typedef drmp3_int32 drmp3_result;
#define DRMP3_INLINE
#endif


DRMP3_API void drmp3_version(drmp3_uint32* pMajor, drmp3_uint32* pMinor, drmp3_uint32* pRevision);
DRMP3_API const char* drmp3_version_string();


/*
Low Level Push API
==================
Expand Down Expand Up @@ -514,6 +527,26 @@ DRMP3_API void drmp3_free(void* p, const drmp3_allocation_callbacks* pAllocation
#include <string.h>
#include <limits.h> /* For INT_MAX */

DRMP3_API void drmp3_version(drmp3_uint32* pMajor, drmp3_uint32* pMinor, drmp3_uint32* pRevision)
{
if (pMajor) {
*pMajor = DRMP3_VERSION_MAJOR;
}

if (pMinor) {
*pMinor = DRMP3_VERSION_MINOR;
}

if (pRevision) {
*pRevision = DRMP3_VERSION_REVISION;
}
}

DRMP3_API const char* drmp3_version_string()
{
return DRMP3_VERSION_STRING;
}

/* Disable SIMD when compiling with TCC for now. */
#if defined(__TINYC__)
#define DR_MP3_NO_SIMD
Expand Down Expand Up @@ -2718,11 +2751,12 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__memory(drmp3* pMP3, drmp3d_sampl
}

pcmFramesRead = drmp3dec_decode_frame(&pMP3->decoder, pMP3->memory.pData + pMP3->memory.currentReadPos, (int)(pMP3->memory.dataSize - pMP3->memory.currentReadPos), pPCMFrames, &info);

pMP3->pcmFramesConsumedInMP3Frame = 0;
pMP3->pcmFramesRemainingInMP3Frame = pcmFramesRead;
pMP3->mp3FrameChannels = info.channels;
pMP3->mp3FrameSampleRate = info.hz;
if (pcmFramesRead > 0) {
pMP3->pcmFramesConsumedInMP3Frame = 0;
pMP3->pcmFramesRemainingInMP3Frame = pcmFramesRead;
pMP3->mp3FrameChannels = info.channels;
pMP3->mp3FrameSampleRate = info.hz;
}

/* Consume the data. */
pMP3->memory.currentReadPos += (size_t)info.frame_bytes;
Expand Down Expand Up @@ -4390,6 +4424,18 @@ counts rather than sample counts.
/*
REVISION HISTORY
================
v0.6.11 - 2020-05-26
- Fix use of uninitialized variable error.
v0.6.10 - 2020-05-16
- Add compile-time and run-time version querying.
- DRMP3_VERSION_MINOR
- DRMP3_VERSION_MAJOR
- DRMP3_VERSION_REVISION
- DRMP3_VERSION_STRING
- drmp3_version()
- drmp3_version_string()
v0.6.9 - 2020-04-30
- Change the `pcm` parameter of drmp3dec_decode_frame() to a `const drmp3_uint8*` for consistency with internal APIs.
Expand Down
50 changes: 47 additions & 3 deletions src/decoding/decoders/libs/dr_wav.h
Original file line number Diff line number Diff line change
@@ -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.12.3 - 2020-04-30
dr_wav - v0.12.5 - 2020-05-27
David Reid - [email protected]
Expand All @@ -15,7 +15,7 @@ Version 0.12 includes breaking changes to custom chunk handling.
Changes to Chunk Callback
-------------------------
dr_wav supports the ability to fire a callback when a chunk is encounted (except for WAVE and FMT chunks). The callback has been update to include both the
dr_wav supports the ability to fire a callback when a chunk is encounted (except for WAVE and FMT chunks). The callback has been updated to include both the
container (RIFF or Wave64) and the FMT chunk which contains information about the format of the data in the wave file.
Previously, there was no direct way to determine the container, and therefore no way discriminate against the different IDs in the chunk header (RIFF and
Expand Down Expand Up @@ -139,6 +139,14 @@ Notes
extern "C" {
#endif

#define DRWAV_STRINGIFY(x) #x
#define DRWAV_XSTRINGIFY(x) DRWAV_STRINGIFY(x)

#define DRWAV_VERSION_MAJOR 0
#define DRWAV_VERSION_MINOR 12
#define DRWAV_VERSION_REVISION 5
#define DRWAV_VERSION_STRING DRWAV_XSTRINGIFY(DRWAV_VERSION_MAJOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_MINOR) "." DRWAV_XSTRINGIFY(DRWAV_VERSION_REVISION)

#include <stddef.h> /* For size_t. */

/* Sized types. Prefer built-in types. Fall back to stdint. */
Expand Down Expand Up @@ -279,6 +287,9 @@ typedef drwav_int32 drwav_result;
/* Flags to pass into drwav_init_ex(), etc. */
#define DRWAV_SEQUENTIAL 0x00000001

DRWAV_API void drwav_version(drwav_uint32* pMajor, drwav_uint32* pMinor, drwav_uint32* pRevision);
DRWAV_API const char* drwav_version_string();

typedef enum
{
drwav_seek_origin_start,
Expand Down Expand Up @@ -1037,6 +1048,26 @@ DRWAV_API drwav_bool32 drwav_fourcc_equal(const drwav_uint8* a, const char* b);
#endif
#endif

DRWAV_API void drwav_version(drwav_uint32* pMajor, drwav_uint32* pMinor, drwav_uint32* pRevision)
{
if (pMajor) {
*pMajor = DRWAV_VERSION_MAJOR;
}

if (pMinor) {
*pMinor = DRWAV_VERSION_MINOR;
}

if (pRevision) {
*pRevision = DRWAV_VERSION_REVISION;
}
}

DRWAV_API const char* drwav_version_string()
{
return DRWAV_VERSION_STRING;
}

/*
These limits are used for basic validation when initializing the decoder. If you exceed these limits, first of all: what on Earth are
you doing?! (Let me know, I'd be curious!) Second, you can adjust these by #define-ing them before the dr_wav implementation.
Expand Down Expand Up @@ -3469,7 +3500,7 @@ DRWAV_API drwav_bool32 drwav_seek_to_pcm_frame(drwav* pWav, drwav_uint64 targetF
} else if (pWav->translatedFormatTag == DR_WAVE_FORMAT_DVI_ADPCM) {
framesRead = drwav_read_pcm_frames_s16__ima(pWav, framesToRead, devnull);
} else {
assert(DRWAV_FALSE); /* If this assertion is triggered it means I've implemented a new compressed format but forgot to add a branch for it here. */
DRWAV_ASSERT(DRWAV_FALSE); /* If this assertion is triggered it means I've implemented a new compressed format but forgot to add a branch for it here. */
}

if (framesRead != framesToRead) {
Expand Down Expand Up @@ -5753,6 +5784,19 @@ two different ways to initialize a drwav object.
/*
REVISION HISTORY
================
v0.12.5 - 2020-05-27
- Minor documentation fix.
v0.12.4 - 2020-05-16
- Replace assert() with DRWAV_ASSERT().
- Add compile-time and run-time version querying.
- DRWAV_VERSION_MINOR
- DRWAV_VERSION_MAJOR
- DRWAV_VERSION_REVISION
- DRWAV_VERSION_STRING
- drwav_version()
- drwav_version_string()
v0.12.3 - 2020-04-30
- Fix compilation errors with VC6.
Expand Down
Loading

0 comments on commit b2e2add

Please sign in to comment.