From 39ad0158942358e5cbd6dac56a591ba172d81235 Mon Sep 17 00:00:00 2001 From: Mahyar Koshkouei Date: Fri, 7 Jul 2023 23:22:39 +0100 Subject: [PATCH] flac: update dr_libs and buildtools This required changes to the flac plugin due to changes in the dr_flac API. Signed-off-by: Mahyar Koshkouei --- buildtools | 2 +- include/dr_libs | 2 +- source/flac.c | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/buildtools b/buildtools index ae4c1af..b7043ff 160000 --- a/buildtools +++ b/buildtools @@ -1 +1 @@ -Subproject commit ae4c1affff0e15bd2ff15a6896764daca8756d40 +Subproject commit b7043ff1854be48ef0d055bba81b0a69a5bc892f diff --git a/include/dr_libs b/include/dr_libs index eefedc6..056b6f5 160000 --- a/include/dr_libs +++ b/include/dr_libs @@ -1 +1 @@ -Subproject commit eefedc66de1c89ccb4ec0d83af1d07cd3ee17651 +Subproject commit 056b6f5e1f7cc5046aac33e6331551b6b2813292 diff --git a/source/flac.c b/source/flac.c index f36eb2e..6dcd759 100644 --- a/source/flac.c +++ b/source/flac.c @@ -30,7 +30,7 @@ void setFlac(struct decoder_fn* decoder) */ int initFlac(const char* file) { - pFlac = drflac_open_file(file); + pFlac = drflac_open_file(file, NULL); return pFlac == NULL ? -1 : 0; } @@ -63,7 +63,13 @@ uint8_t channelFlac(void) */ uint64_t decodeFlac(void* buffer) { - return drflac_read_s16(pFlac, buffSize, buffer); + size_t buffSizeFrames; + uint64_t samplesRead; + + buffSizeFrames = buffSize / (size_t)pFlac->channels; + samplesRead = drflac_read_pcm_frames_s16(pFlac, buffSizeFrames, buffer); + samplesRead *= (uint64_t)pFlac->channels; + return samplesRead; } /** @@ -83,7 +89,7 @@ void exitFlac(void) int isFlac(const char* in) { int err = -1; - drflac* pFlac = drflac_open_file(in); + drflac* pFlac = drflac_open_file(in, NULL); if(pFlac != NULL) err = 0;