Skip to content

Commit

Permalink
Merge branch 'develop' into onpolyaft
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfd authored Dec 26, 2023
2 parents 9259a1d + 85832f2 commit 682457b
Show file tree
Hide file tree
Showing 25 changed files with 789 additions and 267 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ set(PROJECT_REPOSITORY https://github.com/sfztools/sfizz)

# External configuration CMake scripts
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Ensure presence of Git submodules (when not using the source tarball)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
include(GitSubmoduleCheck)
git_submodule_check(external/abseil-cpp)
git_submodule_check(external/filesystem)
git_submodule_check(external/simde)
git_submodule_check(external/st_audiofile/thirdparty/dr_libs)
git_submodule_check(external/st_audiofile/thirdparty/libaiff)
git_submodule_check(external/st_audiofile/thirdparty/wavpack)
endif()

include(BuildType)

# Build Options
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

[![build actions]](https://github.com/sfztools/sfizz/actions)
[![build obs]](https://build.opensuse.org/package/show/home:sfztools:sfizz:develop/sfizz)

[![Discord Badge Image]](https://discord.gg/3ArE9Mw)

[![SFZv1 Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=1)
[![SFZv2 Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=2)
[![ARIA Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=aria)
[![Cakewalk Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=cakewalk)

SFZ parser and synth c++ library and JACK standalone client,
please check [our website] for more details, or [our wiki] for further information.
Expand Down Expand Up @@ -120,10 +119,9 @@ The sfizz library also uses in some subprojects:
[build actions]: https://github.com/sfztools/sfizz/actions/workflows/build.yml/badge.svg?branch=develop
[build obs]: https://build.opensuse.org/projects/home:sfztools:sfizz:develop/packages/sfizz/badge.svg
[OBS]: https://software.opensuse.org//download.html?project=home%3Asfztools%3Asfizz&package=sfizz
[SFZv1 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfz1.svg
[SFZv2 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfz2.svg
[SFZv1 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfzv1.svg
[SFZv2 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfzv2.svg
[ARIA Status Image]: https://sfz.tools/assets/img/sfizz/badge_aria.svg
[Cakewalk Status Image]: https://sfz.tools/assets/img/sfizz/badge_cakewalk.svg

[AppVeyor Build Status]: https://img.shields.io/appveyor/ci/sfztools/sfizz.svg?label=Windows&style=popout&logo=appveyor
[Travis Build Status]: https://img.shields.io/travis/com/sfztools/sfizz.svg?label=Linux&style=popout&logo=travis
13 changes: 13 additions & 0 deletions cmake/GitSubmoduleCheck.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
find_package(Git REQUIRED)

# https://gist.github.com/scivision/bb1d47a9529e153617414e91ff5390af

function(git_submodule_check dir)
if(NOT EXISTS "${dir}/CMakeLists.txt")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY)
endif()
# Add a Git submodule directory to CMake, assuming the Git submodule directory is a CMake project.
# add_subdirectory(${dir} EXCLUDE_FROM_ALL)
endfunction()
4 changes: 3 additions & 1 deletion external/st_audiofile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ set(WAVPACK_ENABLE_LIBCRYPTO OFF)
set(WAVPACK_INSTALL_CMAKE_MODULE OFF)
set(WAVPACK_INSTALL_DOCS OFF)
set(WAVPACK_INSTALL_PKGCONFIG_MODULE OFF)
if(PROJECT_SYSTEM_PROCESSOR MATCHES "(arm.*)")
# FIXME: remove when WavPack updates their build script
# see https://github.com/dbry/WavPack/issues/93
if(APPLE AND PROJECT_SYSTEM_PROCESSOR MATCHES "(arm.*)")
SET(WAVPACK_ENABLE_ASM OFF)
endif()

Expand Down
16 changes: 9 additions & 7 deletions external/st_audiofile/src/st_audiofile.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,13 @@ uint64_t st_read_s16(st_audio_file* af, int16_t* buffer, uint64_t count)
if (!buf_i32) {
return 0;
}
count = channels * WavpackUnpackSamples(af->wv, buf_i32, (uint32_t)count);
count = WavpackUnpackSamples(af->wv, buf_i32, (uint32_t)count);
uint64_t buf_size = channels * count;
if (af->cache.wv.mode & MODE_FLOAT) {
drwav_f32_to_s16((drwav_int16*)buffer, (float*)buf_i32, (size_t)count);
drwav_f32_to_s16((drwav_int16*)buffer, (float*)buf_i32, (size_t)buf_size);
} else {
int d = af->cache.wv.bitrate - 16;
for (uint64_t i = 0; i < count; i++) {
for (uint64_t i = 0; i < buf_size; i++) {
buffer[i] = (int16_t)(buf_i32[i] >> d);
}
}
Expand Down Expand Up @@ -566,15 +567,16 @@ uint64_t st_read_f32(st_audio_file* af, float* buffer, uint64_t count)
if (!buf_i32) {
return 0;
}
count = channels * WavpackUnpackSamples(af->wv, buf_i32, (uint32_t)count);
if (!(af->cache.wv.mode & MODE_FLOAT)) {
count = WavpackUnpackSamples(af->wv, buf_i32, (uint32_t)count);
{
uint64_t buf_size = count * channels;
if (af->cache.wv.bitrate < 32) {
int d = 32 - af->cache.wv.bitrate;
for (uint64_t i = 0; i < count; i++) {
for (uint64_t i = 0; i < buf_size; i++) {
buf_i32[i] <<= d;
}
}
drwav_s32_to_f32(buffer, (drwav_int32*)buf_i32, (size_t)count);
drwav_s32_to_f32(buffer, (drwav_int32*)buf_i32, (size_t)buf_size);
}
free(buf_i32);
}
Expand Down
Loading

0 comments on commit 682457b

Please sign in to comment.