diff --git a/.github/workflows/freebsd-ci.yml b/.github/workflows/freebsd-ci.yml index d066382..3d5f5fa 100644 --- a/.github/workflows/freebsd-ci.yml +++ b/.github/workflows/freebsd-ci.yml @@ -22,13 +22,13 @@ jobs: run: | mkdir -p ${{github.workspace}}/temp - # - name: Downloading a DLS file for testing - # uses: ethanjli/cached-download-action@v0.1.4 - # with: - # url: http://www.ronimusic.com/sf2/Airfont_340.dls - # destination: ${{env.TEMP}}/soundfont.dls - # cache-key: cached.soundfont.dls - # enable-cross-os-archive: true + - name: Downloading a DLS file for testing + uses: ethanjli/cached-download-action@v0.1.4 + with: + url: https://ftp.chasnah.com/soundfonts/Airfont_340.dls + destination: ${{env.TEMP}}/soundfont.dls + cache-key: cached.soundfont.dls + enable-cross-os-archive: true - name: FreeBSD test id: test @@ -44,7 +44,7 @@ jobs: googletest run: | set -e -x - cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} -DSOUNDFONT_TEST=ON cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} cd ${{github.workspace}}/build ctest -C ${{env.BUILD_TYPE}} --verbose diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 44cb788..b913215 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -40,16 +40,22 @@ jobs: run: | mkdir -p ${{github.workspace}}/temp - # - name: '${{ matrix.icon }} Downloading a DLS file for testing' - # uses: ethanjli/cached-download-action@v0.1.4 - # with: - # url: http://www.ronimusic.com/sf2/Airfont_340.dls - # destination: ${{env.TEMP}}/soundfont.dls - # cache-key: cached.soundfont.dls - # enable-cross-os-archive: true + - name: '${{ matrix.icon }} Downloading a DLS file for testing' + uses: ethanjli/cached-download-action@v0.1.4 + with: + url: https://ftp.chasnah.com/soundfonts/Airfont_340.dls + destination: ${{env.TEMP}}/soundfont.dls + cache-key: cached.soundfont.dls + enable-cross-os-archive: true - name: '${{ matrix.icon }} Configure CMake with USE_44KHZ=${{ matrix.USE_44KHZ }} and USE_16BITS_SAMPLES=${{ matrix.USE_16BITS_SAMPLES }}' - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} -DUSE_44KHZ=${{ matrix.USE_44KHZ }} -DUSE_16BITS_SAMPLES=${{ matrix.USE_16BITS_SAMPLES }} + run: > + cmake -B ${{github.workspace}}/build + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} + -DUSE_44KHZ=${{ matrix.USE_44KHZ }} + -DUSE_16BITS_SAMPLES=${{ matrix.USE_16BITS_SAMPLES }} + -DSOUNDFONT_TEST=ON - name: '${{ matrix.icon }} Build' run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/mac-ci.yml b/.github/workflows/mac-ci.yml index bceffc6..738b90e 100644 --- a/.github/workflows/mac-ci.yml +++ b/.github/workflows/mac-ci.yml @@ -24,16 +24,20 @@ jobs: run: | mkdir -p ${{github.workspace}}/temp - # - name: Downloading a DLS file for testing - # uses: ethanjli/cached-download-action@v0.1.4 - # with: - # url: http://www.ronimusic.com/sf2/Airfont_340.dls - # destination: ${{env.TEMP}}/soundfont.dls - # cache-key: cached.soundfont.dls - # enable-cross-os-archive: true + - name: Downloading a DLS file for testing + uses: ethanjli/cached-download-action@v0.1.4 + with: + url: https://ftp.chasnah.com/soundfonts/Airfont_340.dls + destination: ${{env.TEMP}}/soundfont.dls + cache-key: cached.soundfont.dls + enable-cross-os-archive: true - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} + run: > + cmake -B ${{github.workspace}}/build + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} + -DSOUNDFONT_TEST=ON - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/win-msvc.yml b/.github/workflows/win-msvc.yml index 33becae..ce9061c 100644 --- a/.github/workflows/win-msvc.yml +++ b/.github/workflows/win-msvc.yml @@ -48,13 +48,13 @@ jobs: - name: '${{ matrix.icon }} Temp Environment Variable' run: mkdir temp - # - name: '${{ matrix.icon }} Downloading a DLS file for testing' - # uses: ethanjli/cached-download-action@v0.1.4 - # with: - # url: http://www.ronimusic.com/sf2/Airfont_340.dls - # destination: ${{env.TEMP}}/soundfont.dls - # cache-key: cached.soundfont.dls - # enable-cross-os-archive: true + - name: '${{ matrix.icon }} Downloading a DLS file for testing' + uses: ethanjli/cached-download-action@v0.1.4 + with: + url: https://ftp.chasnah.com/soundfonts/Airfont_340.dls + destination: ${{env.TEMP}}/soundfont.dls + cache-key: cached.soundfont.dls + enable-cross-os-archive: true - name: '${{ matrix.icon }} Configure CMake' id: configuration @@ -66,6 +66,7 @@ jobs: -DCPACK_SYSTEM_NAME=${{matrix.arch}} -DDEPENDENCY_DIRS=${{github.workspace}}/vcpkg/installed/${{matrix.triplet}}/bin -DINSTALL_DEPENDENCIES=ON + -DSOUNDFONT_TEST=ON - name: '${{ matrix.icon }} Build' run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/win-msys2.yml b/.github/workflows/win-msys2.yml index 04eef6d..0a49466 100644 --- a/.github/workflows/win-msys2.yml +++ b/.github/workflows/win-msys2.yml @@ -57,13 +57,13 @@ jobs: echo "cache_path=$(cygpath -m $TEMP)" >> $GITHUB_OUTPUT echo "dependencies=$(cygpath -m $MSYSTEM_PREFIX/bin)" >> $GITHUB_OUTPUT - # - name: '${{ matrix.icon }} Downloading a DLS file for testing' - # uses: ethanjli/cached-download-action@v0.1.4 - # with: - # url: http://www.ronimusic.com/sf2/Airfont_340.dls - # destination: ${{steps.tmp.outputs.cache_path}}/soundfont.dls - # cache-key: cached.soundfont.dls - # enable-cross-os-archive: true + - name: '${{ matrix.icon }} Downloading a DLS file for testing' + uses: ethanjli/cached-download-action@v0.1.4 + with: + url: https://ftp.chasnah.com/soundfonts/Airfont_340.dls + destination: ${{steps.tmp.outputs.cache_path}}/soundfont.dls + cache-key: cached.soundfont.dls + enable-cross-os-archive: true - name: '${{ matrix.icon }} Configure CMake' id: configuration @@ -74,6 +74,7 @@ jobs: -DDEPENDENCY_DIRS=${{steps.tmp.outputs.dependencies}} -DCPACK_SYSTEM_NAME=${{matrix.sys}} -DINSTALL_DEPENDENCIES=ON + -DSOUNDFONT_TEST=ON - name: '${{ matrix.icon }} Build' run: cmake --build build --config ${{env.BUILD_TYPE}} diff --git a/CMakeLists.txt b/CMakeLists.txt index be7cafa..052b727 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ cmake_minimum_required(VERSION 3.21) project( sonivox LANGUAGES C CXX - VERSION 4.0.1.0 + VERSION 4.0.2.0 ) # GoogleTest requires at least C++14 @@ -93,6 +93,10 @@ if (SF2_SUPPORT) set(_FLOAT_DCF ON) endif() +set(DLS_URL "https://ftp.chasnah.com/soundfonts/Airfont_340.dls" CACHE STRING "DLS file URL for testing") +set(DLS_SIZE "81362584" CACHE STRING "DLS file size") +set(DLS_HASH "beb3e39e3c9fc51ef4dff36fdd8db0361471a91d244c3ee78af90f6d3c783b04" CACHE STRING "DLS file SHA256 hash") + if (DEFINED ENV{GITHUB_OUTPUT}) file(APPEND "$ENV{GITHUB_OUTPUT}" @@ -479,14 +483,14 @@ if (BUILD_TESTING) set(SOUNDFONT "${TEMPDIR}/soundfont.dls") target_compile_definitions(SonivoxTest PUBLIC SOUNDFONT_TEST) if (NOT EXISTS ${SOUNDFONT}) - message(STATUS "Downloading DLS file for testing to ${SOUNDFONT}") - file(DOWNLOAD "http://www.ronimusic.com/sf2/Airfont_340.dls" ${SOUNDFONT}) + message(STATUS "Downloading DLS file from ${DLS_URL} for testing to ${SOUNDFONT}") + file(DOWNLOAD ${DLS_URL} ${SOUNDFONT}) file(SIZE ${SOUNDFONT} SOUNDFONTSIZE) - file(MD5 ${SOUNDFONT} SOUNDFONTHASH) + file(SHA256 ${SOUNDFONT} SOUNDFONTHASH) message(STATUS "DLS file ${SOUNDFONT} size: ${SOUNDFONTSIZE}") - message(STATUS "DLS file ${SOUNDFONT} MD5 hash: ${SOUNDFONTHASH}") - if (NOT (SOUNDFONTSIZE EQUAL 81362584 AND SOUNDFONTHASH STREQUAL "40c0cd4ad29ae411a8fc3d6681002a2b")) + message(STATUS "DLS file ${SOUNDFONT} SHA256 hash: ${SOUNDFONTHASH}") + if (NOT (SOUNDFONTSIZE EQUAL ${DLS_SIZE} AND SOUNDFONTHASH STREQUAL ${DLS_HASH})) message(FATAL_ERROR "The downloaded DLS file is corrupted.") endif() endif() diff --git a/README.md b/README.md index c77cdd2..39021c8 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ The build system has the following options: * `USE_16BITS_SAMPLES`: Uses 16 bits samples (instead of 8 bit). ON by default. The rendered audio uses always 16 bits. * `BUILD_SHARED_LIBS`: to control the generation and install of both the static or shared libraries from the sources. (ON by default). * `BUILD_TESTING`: ON by default, to control if the unit tests are built, which require Google Test. +* `SOUNDFONT_TEST`: OFF by default, to unit test DLS processing. * `BUILD_APPLICATION`: ON by default, to build and install the CLI program. ON by default. * `NEW_HOST_WRAPPER`: Uses the new CRT-based host wrapper for faster file loading. ON by default. * `SF2_SUPPORT`: Enable SF2 support and float DCF. ON by default. @@ -50,6 +51,12 @@ The synthesizer types options (at least one must be enabled): * `MAX_VOICES`: Maximum number of voices. 64 by default. +Other CMake variables that you may want to override when SOUNDFONT_TEST is ON: + +* `DLS_URL`; https://ftp.chasnah.com/soundfonts/Airfont_340.dls +* `DLS_SIZE`: 81362584 (size of the DLS file in bytes) +* `DLS_HASH`: beb3e39e3c9fc51ef4dff36fdd8db0361471a91d244c3ee78af90f6d3c783b04 (SHA256 hash of the DLS file) + See also the [CMake documentation](https://cmake.org/cmake/help/latest/index.html) for common build options. ## Differences with upstream