From ef7a1969d3bbc79ff4415e6ba1244e7295c8be10 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 31 Oct 2020 11:59:45 +0100 Subject: [PATCH 1/5] Support loading AIFF files --- .gitmodules | 3 + benchmarks/BM_audioReaders.cpp | 26 +++++++++ external/st_audiofile/CMakeLists.txt | 5 +- external/st_audiofile/src/st_audiofile.c | 55 +++++++++++++++++++ external/st_audiofile/src/st_audiofile.h | 1 + .../st_audiofile/src/st_audiofile_common.c | 3 + external/st_audiofile/src/st_audiofile_libs.h | 1 + .../st_audiofile/src/st_audiofile_sndfile.c | 3 + external/st_audiofile/thirdparty/libaiff | 1 + 9 files changed, 97 insertions(+), 1 deletion(-) create mode 160000 external/st_audiofile/thirdparty/libaiff diff --git a/.gitmodules b/.gitmodules index c47fa23b..d97f8bae 100644 --- a/.gitmodules +++ b/.gitmodules @@ -27,3 +27,6 @@ path = external/st_audiofile/thirdparty/stb_vorbis url = https://github.com/sfztools/stb_vorbis.git shallow = true +[submodule "external/st_audiofile/thirdparty/libaiff"] + path = external/st_audiofile/thirdparty/libaiff + url = https://github.com/sfztools/libaiff.git diff --git a/benchmarks/BM_audioReaders.cpp b/benchmarks/BM_audioReaders.cpp index 98483a8d..3a4b23e7 100644 --- a/benchmarks/BM_audioReaders.cpp +++ b/benchmarks/BM_audioReaders.cpp @@ -94,6 +94,7 @@ public: static TemporaryFile fileWav; static TemporaryFile fileFlac; + static TemporaryFile fileAiff; static TemporaryFile fileOgg; std::vector workBuffer; @@ -101,6 +102,7 @@ public: TemporaryFile AudioReaderFixture::fileWav = createAudioFile(SF_FORMAT_WAV|SF_FORMAT_PCM_16); TemporaryFile AudioReaderFixture::fileFlac = createAudioFile(SF_FORMAT_FLAC|SF_FORMAT_PCM_16); +TemporaryFile AudioReaderFixture::fileAiff = createAudioFile(SF_FORMAT_AIFF|SF_FORMAT_PCM_16); TemporaryFile AudioReaderFixture::fileOgg = createAudioFile(SF_FORMAT_OGG|SF_FORMAT_VORBIS); TemporaryFile AudioReaderFixture::createAudioFile(int format) @@ -196,6 +198,27 @@ BENCHMARK_DEFINE_F(AudioReaderFixture, ReverseFlac)(benchmark::State& state) } } +BENCHMARK_DEFINE_F(AudioReaderFixture, EntireAiff)(benchmark::State& state) +{ + for (auto _ : state) { + doEntireRead(fileAiff.path()); + } +} + +BENCHMARK_DEFINE_F(AudioReaderFixture, ForwardAiff)(benchmark::State& state) +{ + for (auto _ : state) { + doReaderBenchmark(fileAiff.path(), workBuffer, sfz::AudioReaderType::Forward); + } +} + +BENCHMARK_DEFINE_F(AudioReaderFixture, ReverseAiff)(benchmark::State& state) +{ + for (auto _ : state) { + doReaderBenchmark(fileAiff.path(), workBuffer, sfz::AudioReaderType::Reverse); + } +} + BENCHMARK_DEFINE_F(AudioReaderFixture, EntireOgg)(benchmark::State& state) { for (auto _ : state) { @@ -225,6 +248,9 @@ BENCHMARK_REGISTER_F(AudioReaderFixture, EntireWav)->Range(1, 1); BENCHMARK_REGISTER_F(AudioReaderFixture, ForwardFlac)->RangeMultiplier(2)->Range((1 << 6), (1 << 10)); BENCHMARK_REGISTER_F(AudioReaderFixture, ReverseFlac)->RangeMultiplier(2)->Range((1 << 6), (1 << 10)); BENCHMARK_REGISTER_F(AudioReaderFixture, EntireFlac)->Range(1, 1); +BENCHMARK_REGISTER_F(AudioReaderFixture, ForwardAiff)->RangeMultiplier(2)->Range((1 << 6), (1 << 10)); +BENCHMARK_REGISTER_F(AudioReaderFixture, ReverseAiff)->RangeMultiplier(2)->Range((1 << 6), (1 << 10)); +BENCHMARK_REGISTER_F(AudioReaderFixture, EntireAiff)->Range(1, 1); BENCHMARK_REGISTER_F(AudioReaderFixture, ForwardOgg)->RangeMultiplier(2)->Range((1 << 6), (1 << 10)); #if !defined(ST_AUDIO_FILE_USE_SNDFILE) BENCHMARK_REGISTER_F(AudioReaderFixture, ReverseOgg)->RangeMultiplier(2)->Range((1 << 6), (1 << 10)); diff --git a/external/st_audiofile/CMakeLists.txt b/external/st_audiofile/CMakeLists.txt index e0fb1e4e..643c0992 100644 --- a/external/st_audiofile/CMakeLists.txt +++ b/external/st_audiofile/CMakeLists.txt @@ -19,7 +19,10 @@ add_executable(st_info target_link_libraries(st_info PRIVATE st_audiofile) -if(ST_AUDIO_FILE_USE_SNDFILE) +if(NOT ST_AUDIO_FILE_USE_SNDFILE) + add_subdirectory("thirdparty/libaiff" EXCLUDE_FROM_ALL) + target_link_libraries(st_audiofile PRIVATE aiff::aiff) +else() target_compile_definitions(st_audiofile PUBLIC "ST_AUDIO_FILE_USE_SNDFILE=1") if(ST_AUDIO_FILE_EXTERNAL_SNDFILE) diff --git a/external/st_audiofile/src/st_audiofile.c b/external/st_audiofile/src/st_audiofile.c index 64f1cccf..f9d1e869 100644 --- a/external/st_audiofile/src/st_audiofile.c +++ b/external/st_audiofile/src/st_audiofile.c @@ -14,11 +14,13 @@ struct st_audio_file { union { drwav *wav; drflac *flac; + AIFF_Ref aiff; drmp3 *mp3; stb_vorbis* ogg; }; union { + struct { uint32_t channels; float sample_rate; uint64_t frames; } aiff; struct { uint64_t frames; } mp3; struct { uint32_t channels; float sample_rate; uint64_t frames; } ogg; } cache; @@ -68,6 +70,30 @@ static st_audio_file* st_generic_open_file(const void* filename, int widepath) } } + // Try AIFF + { + af->aiff = +#if defined(_WIN32) + widepath ? AIFF_OpenFileW((const wchar_t*)filename, F_RDONLY) : +#endif + AIFF_OpenFile((const char*)filename, F_RDONLY); + if (af->aiff) { + int channels; + double sample_rate; + uint64_t frames; + if (AIFF_GetAudioFormat(af->aiff, &frames, &channels, &sample_rate, NULL, NULL) == -1) { + AIFF_CloseFile(af->aiff); + free(af); + return NULL; + } + af->cache.aiff.channels = (uint32_t)channels; + af->cache.aiff.sample_rate = (float)sample_rate; + af->cache.aiff.frames = frames; + af->type = st_audio_file_aiff; + return af; + } + } + // Try OGG { af->ogg = @@ -142,6 +168,9 @@ void st_close(st_audio_file* af) case st_audio_file_flac: drflac_close(af->flac); break; + case st_audio_file_aiff: + AIFF_CloseFile(af->aiff); + break; case st_audio_file_ogg: stb_vorbis_close(af->ogg); break; @@ -170,6 +199,9 @@ uint32_t st_get_channels(st_audio_file* af) case st_audio_file_flac: channels = af->flac->channels; break; + case st_audio_file_aiff: + channels = af->cache.aiff.channels; + break; case st_audio_file_ogg: channels = af->cache.ogg.channels; break; @@ -192,6 +224,9 @@ float st_get_sample_rate(st_audio_file* af) case st_audio_file_flac: sample_rate = af->flac->sampleRate; break; + case st_audio_file_aiff: + sample_rate = af->cache.aiff.sample_rate; + break; case st_audio_file_ogg: sample_rate = af->cache.ogg.sample_rate; break; @@ -214,6 +249,9 @@ uint64_t st_get_frame_count(st_audio_file* af) case st_audio_file_flac: frames = af->flac->totalPCMFrameCount; break; + case st_audio_file_aiff: + frames = af->cache.aiff.frames; + break; case st_audio_file_ogg: frames = af->cache.ogg.frames; break; @@ -236,6 +274,9 @@ bool st_seek(st_audio_file* af, uint64_t frame) case st_audio_file_flac: success = drflac_seek_to_pcm_frame(af->flac, frame); break; + case st_audio_file_aiff: + success = AIFF_Seek(af->aiff, frame) != -1; + break; case st_audio_file_ogg: success = stb_vorbis_seek(af->ogg, (unsigned)frame) != 0; break; @@ -256,6 +297,13 @@ uint64_t st_read_s16(st_audio_file* af, int16_t* buffer, uint64_t count) case st_audio_file_flac: count = drflac_read_pcm_frames_s16(af->flac, count, buffer); break; + case st_audio_file_aiff: + { + uint32_t channels = af->cache.aiff.channels; + unsigned samples = AIFF_ReadSamples16Bit(af->aiff, buffer, (unsigned)(channels * count)); + count = ((int)samples != -1) ? (samples / channels) : 0; + } + break; case st_audio_file_ogg: count = stb_vorbis_get_samples_short_interleaved( af->ogg, af->cache.ogg.channels, buffer, @@ -278,6 +326,13 @@ uint64_t st_read_f32(st_audio_file* af, float* buffer, uint64_t count) case st_audio_file_flac: count = drflac_read_pcm_frames_f32(af->flac, count, buffer); break; + case st_audio_file_aiff: + { + uint32_t channels = af->cache.aiff.channels; + unsigned samples = AIFF_ReadSamplesFloat(af->aiff, buffer, (unsigned)(channels * count)); + count = ((int)samples != -1) ? (samples / channels) : 0; + } + break; case st_audio_file_ogg: count = stb_vorbis_get_samples_float_interleaved( af->ogg, af->cache.ogg.channels, buffer, diff --git a/external/st_audiofile/src/st_audiofile.h b/external/st_audiofile/src/st_audiofile.h index fd62c77f..3fbcbfd8 100644 --- a/external/st_audiofile/src/st_audiofile.h +++ b/external/st_audiofile/src/st_audiofile.h @@ -23,6 +23,7 @@ typedef struct st_audio_file st_audio_file; typedef enum st_audio_file_type { st_audio_file_wav, st_audio_file_flac, + st_audio_file_aiff, st_audio_file_ogg, st_audio_file_mp3, st_audio_file_other, diff --git a/external/st_audiofile/src/st_audiofile_common.c b/external/st_audiofile/src/st_audiofile_common.c index d8e2ac6e..c3e14297 100644 --- a/external/st_audiofile/src/st_audiofile_common.c +++ b/external/st_audiofile/src/st_audiofile_common.c @@ -23,6 +23,9 @@ const char* st_type_string(int type) case st_audio_file_flac: type_string = "FLAC"; break; + case st_audio_file_aiff: + type_string = "AIFF"; + break; case st_audio_file_ogg: type_string = "OGG"; break; diff --git a/external/st_audiofile/src/st_audiofile_libs.h b/external/st_audiofile/src/st_audiofile_libs.h index 21727c6b..67aacaba 100644 --- a/external/st_audiofile/src/st_audiofile_libs.h +++ b/external/st_audiofile/src/st_audiofile_libs.h @@ -14,6 +14,7 @@ # undef STB_VORBIS_HEADER_ONLY #endif #include "stb_vorbis.c" +#include "libaiff/libaiff.h" #if defined(_WIN32) #include diff --git a/external/st_audiofile/src/st_audiofile_sndfile.c b/external/st_audiofile/src/st_audiofile_sndfile.c index 480daa34..c1b8fed8 100644 --- a/external/st_audiofile/src/st_audiofile_sndfile.c +++ b/external/st_audiofile/src/st_audiofile_sndfile.c @@ -69,6 +69,9 @@ int st_get_type(st_audio_file* af) case SF_FORMAT_FLAC: type = st_audio_file_flac; break; + case SF_FORMAT_AIFF: + type = st_audio_file_aiff; + break; case SF_FORMAT_OGG: type = st_audio_file_ogg; break; diff --git a/external/st_audiofile/thirdparty/libaiff b/external/st_audiofile/thirdparty/libaiff new file mode 160000 index 00000000..f18eefcd --- /dev/null +++ b/external/st_audiofile/thirdparty/libaiff @@ -0,0 +1 @@ +Subproject commit f18eefcd27108fdfdd0b6620426b404f132e39c4 From 0825f034c2ff37dc29bb5d980947baf8f7dfeb91 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 31 Oct 2020 15:30:13 +0100 Subject: [PATCH 2/5] Support the AIFF instrument --- src/sfizz/FileMetadata.cpp | 202 +++++++++++++++++++++++++++++++++++++ src/sfizz/FileMetadata.h | 10 ++ src/sfizz/FilePool.cpp | 2 +- tests/FileInstrument.cpp | 2 +- 4 files changed, 214 insertions(+), 2 deletions(-) diff --git a/src/sfizz/FileMetadata.cpp b/src/sfizz/FileMetadata.cpp index bb1d3d0c..8c684d37 100644 --- a/src/sfizz/FileMetadata.cpp +++ b/src/sfizz/FileMetadata.cpp @@ -39,6 +39,18 @@ static uint32_t u32be(const uint8_t *bytes) return (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]; } +#if 0 +static uint16_t u16le(const uint8_t *bytes) +{ + return bytes[0] | (bytes[1] << 8); +} +#endif + +static uint16_t u16be(const uint8_t *bytes) +{ + return (bytes[0] << 8) | bytes[1]; +} + static bool fread_u32le(FILE* stream, uint32_t& value) { uint8_t bytes[4]; @@ -57,14 +69,38 @@ static bool fread_u32be(FILE* stream, uint32_t& value) return true; } +#if 0 +static bool fread_u16le(FILE* stream, uint16_t& value) +{ + uint8_t bytes[2]; + if (fread(bytes, 2, 1, stream) != 1) + return false; + value = u16le(bytes); + return true; +} +#endif + +static bool fread_u16be(FILE* stream, uint16_t& value) +{ + uint8_t bytes[2]; + if (fread(bytes, 2, 1, stream) != 1) + return false; + value = u16be(bytes); + return true; +} + //------------------------------------------------------------------------------ struct FileMetadataReader::Impl { FILE_u stream_; std::vector riffChunks_; + enum class ChunkType { None, Riff, Aiff }; + ChunkType chunkType_ = ChunkType::None; + bool openFlac(); bool openRiff(); + bool openAiff(); bool extractClmWavetable(WavetableInfo &wt); bool extractSurgeWavetable(WavetableInfo &wt); @@ -108,12 +144,21 @@ bool FileMetadataReader::open(const fs::path& path) close(); return false; } + impl_->chunkType_ = Impl::ChunkType::Riff; } else if (count >= 4 && !memcmp(magic, "RIFF", 4)) { if (!impl_->openRiff()) { close(); return false; } + impl_->chunkType_ = Impl::ChunkType::Riff; + } + else if (count >= 4 && !memcmp(magic, "FORM", 4)) { + if (!impl_->openAiff()) { + close(); + return false; + } + impl_->chunkType_ = Impl::ChunkType::Aiff; } return true; @@ -193,6 +238,46 @@ bool FileMetadataReader::Impl::openRiff() return true; } +bool FileMetadataReader::Impl::openAiff() +{ + FILE* stream = stream_.get(); + + rewind(stream); + + char formId[4]; + uint32_t formSize; + if (fread(formId, 4, 1, stream) != 1 || memcmp(formId, "FORM", 4) || + !fread_u32be(stream, formSize)) + { + return false; + } + + char aiffId[4]; + if (fread(aiffId, 4, 1, stream) != 1 || + (memcmp(aiffId, "AIFF", 4) && memcmp(aiffId, "AIFC", 4))) + { + return false; + } + + std::vector& riffChunks = riffChunks_; + + char riffId[4]; + uint32_t riffChunkSize; + while (fread(riffId, 4, 1, stream) == 1 && fread_u32be(stream, riffChunkSize)) { + RiffChunkInfo info; + info.index = riffChunks.size(); + info.fileOffset = ftell(stream); + memcpy(info.id.data(), riffId, 4); + info.length = riffChunkSize; + riffChunks.push_back(info); + + if (fseek(stream, riffChunkSize + (riffChunkSize & 1), SEEK_CUR) != 0) + return false; + } + + return true; +} + size_t FileMetadataReader::riffChunkCount() const { return impl_->riffChunks_.size(); @@ -242,8 +327,22 @@ size_t FileMetadataReader::Impl::readRiffData(size_t index, void* buffer, size_t return fread(buffer, 1, count, stream); } +bool FileMetadataReader::extractInstrument(InstrumentInfo& ins) +{ + if (extractRiffInstrument(ins)) + return true; + + if (extractAiffInstrument(ins)) + return true; + + return false; +} + bool FileMetadataReader::extractRiffInstrument(InstrumentInfo& ins) { + if (impl_->chunkType_ != Impl::ChunkType::Riff) + return false; + const RiffChunkInfo* riff = riffChunkById(RiffChunkId{'s', 'm', 'p', 'l'}); if (!riff) return false; @@ -299,6 +398,109 @@ bool FileMetadataReader::extractRiffInstrument(InstrumentInfo& ins) return true; } +bool FileMetadataReader::extractAiffInstrument(InstrumentInfo& ins) +{ + if (impl_->chunkType_ != Impl::ChunkType::Aiff) + return false; + + const RiffChunkInfo* instChunk = riffChunkById(RiffChunkId{'I', 'N', 'S', 'T'}); + if (!instChunk) + return false; + + const RiffChunkInfo* markChunk = riffChunkById(RiffChunkId{'M', 'A', 'R', 'K'}); + + uint8_t insData[20]; + uint32_t length = readRiffData(instChunk->index, insData, sizeof(insData)); + if (length != 20) + return false; + + // + std::map markers; + if (markChunk) { + FILE* stream = impl_->stream_.get(); + if (fseek(stream, markChunk->fileOffset, SEEK_SET) != 0) + return false; + + uint16_t numMarkers; + if (!fread_u16be(stream, numMarkers)) + return false; + + for (uint32_t i = 0; i < numMarkers; ++i) { + uint16_t id; + uint32_t position; + uint8_t size; + char name[256]; + + if (!fread_u16be(stream, id) || !fread_u32be(stream, position) || fread(&size, 1, 1, stream) != 1 || fread(name, size, 1, stream) != 1) + return false; + name[size] = '\0'; + + if (i + 1 < numMarkers && ((~size) & 1)) { + if (fseek(stream, 1, SEEK_CUR) != 0) + return false; + } + + markers[id] = position; + } + } + + // + ins.basenote = insData[0]; + ins.detune = insData[1]; + ins.key_lo = insData[2]; + ins.key_hi = insData[3]; + ins.velocity_lo = insData[4]; + ins.velocity_hi = insData[5]; + ins.gain = (insData[6] << 8) | insData[7]; + + uint32_t loopCount = 0; + for (uint32_t loopIndex = 0; loopIndex < 2; ++loopIndex) { + const uint32_t loopOffset = 8 + loopIndex * 6; + + int mode; + switch ((insData[loopOffset] << 8) | insData[loopOffset + 1]) { + default: + mode = LoopNone; + break; + case 1: + mode = LoopForward; + break; + case 2: + mode = LoopBackward; + break; + } + + if (mode == LoopNone) + break; + + const uint16_t startId = (insData[loopOffset + 2] << 8) | insData[loopOffset + 3]; + const uint16_t endId = (insData[loopOffset + 4] << 8) | insData[loopOffset + 5]; + + // + uint32_t startPos = 0; + uint32_t endPos = 0; + + auto startIt = markers.find(startId); + auto endIt = markers.find(endId); + if (startIt != markers.end()) + startPos = startIt->second; + if (endIt != markers.end()) + endPos = endIt->second; + + // + ins.loops[loopIndex].mode = mode; + ins.loops[loopIndex].start = startPos; + ins.loops[loopIndex].end = endPos; + ins.loops[loopIndex].count = 0; + + ++loopCount; + } + + ins.loop_count = loopCount; + + return true; +} + bool FileMetadataReader::extractWavetableInfo(WavetableInfo& wt) { if (impl_->extractClmWavetable(wt)) diff --git a/src/sfizz/FileMetadata.h b/src/sfizz/FileMetadata.h index 74c6d9ad..b4094381 100644 --- a/src/sfizz/FileMetadata.h +++ b/src/sfizz/FileMetadata.h @@ -112,11 +112,21 @@ public: */ size_t readRiffData(size_t index, void* buffer, size_t count); + /** + * @brief Extract the instrument data and convert it to sndfile instrument + */ + bool extractInstrument(InstrumentInfo& ins); + /** * @brief Extract the RIFF 'smpl' data and convert it to sndfile instrument */ bool extractRiffInstrument(InstrumentInfo& ins); + /** + * @brief Extract the AIFF 'INST' data and convert it to sndfile instrument + */ + bool extractAiffInstrument(InstrumentInfo& ins); + /** * @brief Extract the wavetable information from various relevant RIFF chunks */ diff --git a/src/sfizz/FilePool.cpp b/src/sfizz/FilePool.cpp index 5bea534c..6b39bbf7 100644 --- a/src/sfizz/FilePool.cpp +++ b/src/sfizz/FilePool.cpp @@ -243,7 +243,7 @@ absl::optional sfz::FilePool::getFileInformation(const Fil if (!haveInstrumentInfo) { // if no instrument, then try extracting from embedded RIFF chunks (flac) if (mdReaderOpened) - haveInstrumentInfo = mdReader.extractRiffInstrument(instrumentInfo); + haveInstrumentInfo = mdReader.extractInstrument(instrumentInfo); } if (mdReaderOpened) { diff --git a/tests/FileInstrument.cpp b/tests/FileInstrument.cpp index e759f481..0d553ac2 100644 --- a/tests/FileInstrument.cpp +++ b/tests/FileInstrument.cpp @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) return 1; } sfz::InstrumentInfo ins {}; - if (!reader.extractRiffInstrument(ins)) { + if (!reader.extractInstrument(ins)) { fprintf(stderr, "Cannot get instrument\n"); return 1; } From 03fb748fc1f7342b384dd7a0029ab87fc75493a2 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 31 Oct 2020 16:04:39 +0100 Subject: [PATCH 3/5] Update libaiff for PCM->float speedup --- external/st_audiofile/thirdparty/libaiff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/st_audiofile/thirdparty/libaiff b/external/st_audiofile/thirdparty/libaiff index f18eefcd..015f884a 160000 --- a/external/st_audiofile/thirdparty/libaiff +++ b/external/st_audiofile/thirdparty/libaiff @@ -1 +1 @@ -Subproject commit f18eefcd27108fdfdd0b6620426b404f132e39c4 +Subproject commit 015f884a0458240a9b5f1f0d945a6084243def46 From b40f93afba3aeeb9b4feb738de78f3b6baf2f427 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 31 Oct 2020 16:12:02 +0100 Subject: [PATCH 4/5] Skip building audiofile libs if using sndfile --- external/st_audiofile/src/st_audiofile_libs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/external/st_audiofile/src/st_audiofile_libs.c b/external/st_audiofile/src/st_audiofile_libs.c index 0bbcccca..635c19d4 100644 --- a/external/st_audiofile/src/st_audiofile_libs.c +++ b/external/st_audiofile/src/st_audiofile_libs.c @@ -4,6 +4,7 @@ // license. You should have receive a LICENSE.md file along with the code. // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz +#if !defined(ST_AUDIO_FILE_USE_SNDFILE) #define DR_WAV_IMPLEMENTATION #define DR_FLAC_IMPLEMENTATION #define DR_MP3_IMPLEMENTATION @@ -27,3 +28,5 @@ stb_vorbis* stb_vorbis_open_filename_w(const wchar_t* filename, int* error, cons return NULL; } #endif + +#endif // !defined(ST_AUDIO_FILE_USE_SNDFILE) From b39fa44c98cb738d346d5a6bb32d52ee20ebfdae Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 31 Oct 2020 16:15:35 +0100 Subject: [PATCH 5/5] Add libaiff to makefiles [ci skip] --- common.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common.mk b/common.mk index e7ada2c1..27acfbc2 100644 --- a/common.mk +++ b/common.mk @@ -156,6 +156,17 @@ SFIZZ_CXX_FLAGS += $(SFIZZ_SNDFILE_CXX_FLAGS) -DST_AUDIO_FILE_USE_SNDFILE=1 SFIZZ_LINK_FLAGS += $(SFIZZ_SNDFILE_LINK_FLAGS) endif +# libaiff dependency + +ifneq ($(SFIZZ_USE_SNDFILE),1) +SFIZZ_SOURCES += \ + $(SFIZZ_DIR)/external/st_audiofile/thirdparty/libaiff/libaiff.all.c +SFIZZ_C_FLAGS += \ + -I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/libaiff +SFIZZ_CXX_FLAGS += \ + -I$(SFIZZ_DIR)/external/st_audiofile/thirdparty/libaiff +endif + ### Abseil dependency SFIZZ_C_FLAGS += -I$(SFIZZ_DIR)/external/abseil-cpp