diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..be006de9a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# Keep GitHub Actions up to date with GitHub's Dependabot... +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + groups: + github-actions: + patterns: + - "*" # Group all Actions updates into a single larger pull request + schedule: + interval: weekly diff --git a/.github/workflows/api_doc_build.yml b/.github/workflows/api_doc_build.yml index 40aabc6d9..5bafa38f3 100644 --- a/.github/workflows/api_doc_build.yml +++ b/.github/workflows/api_doc_build.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: persist-credentials: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4939b2b43..b7566752f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,11 +39,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -57,7 +57,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -71,4 +71,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index efd02e33f..0977c7a59 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -53,7 +53,7 @@ jobs: # clang11 is covered by openSUSE Leap 15.3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Add apt-get repositories run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index b2ae8868d..e73a02158 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -24,7 +24,7 @@ jobs: sonarcloud: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # Disabling shallow clone is recommended for improving relevancy of reporting fetch-depth: 0 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 000000000..84a051237 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,72 @@ +name: Fluidsynth Windows + +on: + pull_request: + push: + paths-ignore: + - '.azure/**' + - '.circleci/**' + - '.github/workflows/sonarcloud.yml' + - '.cirrus.yml' + - 'README.md' + +env: + BUILD_TYPE: RelWithDebInfo + INSTALL_LOCATION: fluidsynth_install + +jobs: + build: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - { icon: 'âŦ›', sys: mingw32 } + - { icon: 'đŸŸĻ', sys: mingw64 } + - { icon: '🟨', sys: ucrt64 } + - { icon: '🟧', sys: clang64 } + name: 🚧${{ matrix.icon }} ${{ matrix.sys }} + defaults: + run: + shell: msys2 {0} + + steps: + - uses: actions/checkout@v4 + + - name: '${{ matrix.icon }} Setup MSYS2' + uses: msys2/setup-msys2@v2 + with: + release: false + msystem: ${{matrix.sys}} + install: >- + make + libreadline + pacboy: >- + toolchain:p + cmake:p + ninja:p + glib2:p + libsndfile:p + + - name: '${{ matrix.icon }} Configure CMake' + run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_LOCATION}} + + - name: '${{ matrix.icon }} Build' + run: cmake --build build --config ${{env.BUILD_TYPE}} + + - name: '${{ matrix.icon }} Test' + run: cmake --build build --target check + + - name: '${{ matrix.icon }} Demo' + run: cmake --build build --target demo + + - name: '${{ matrix.icon }} Install' + run: cmake --install build && ls -la $INSTALL_LOCATION + + - name: '${{ matrix.icon }} Upload Artifacts' + uses: actions/upload-artifact@v4 + with: + name: ${{env.INSTALL_LOCATION}}-${{matrix.sys}} + path: ${{env.INSTALL_LOCATION}} + retention-days: 14 + overwrite: true diff --git a/AUTHORS b/AUTHORS index 8854b4bde..a130be0b3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -40,8 +40,11 @@ summary of contributions. changes and bug fixes and got the synthesizer to actually work. Most importantly, he used it on stage to make music. -* S. Christian Collins did much testing of FluidSynth in regards to - EMU10K1 compatibility and provided many synthesis fixes in that regard. +* S. Christian Collins provided many tests and fixes on EMU10K1 + compatibility. He also supplied reference chorus and reverb settings for + developing the default ones. + +* Alberto Salvia Novella developed the default chorus and reverb settings. * Stephane Letz from Grame wrote most of the MidiShare driver, all of the PortAudio driver, ported iiwusynth to MacOS X, and sent in many diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b002e47a..367f7361b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,6 @@ option ( enable-portaudio "compile PortAudio support" off ) option ( enable-profiling "profile the dsp code" off ) option ( enable-trap-on-fpe "enable SIGFPE trap on Floating Point Exceptions" off ) option ( enable-ubsan "compile and link against UBSan (for debugging fluidsynth internals)" off ) - # Options enabled by default option ( enable-aufile "compile support for sound file output" on ) option ( BUILD_SHARED_LIBS "Build a shared object or DLL" on ) @@ -85,8 +84,11 @@ option ( enable-ladspa "enable LADSPA effect units" off ) option ( enable-libinstpatch "use libinstpatch (if available) to load DLS and GIG files" on ) option ( enable-libsndfile "compile libsndfile support (if it is available)" on ) option ( enable-midishare "compile MidiShare support (if it is available)" on ) + + option ( enable-opensles "compile OpenSLES support (if it is available)" off ) option ( enable-oboe "compile Oboe support (requires OpenSLES and/or AAudio)" off ) + option ( enable-network "enable network support (requires BSD sockets)" on ) option ( enable-oss "compile OSS support (if it is available)" on ) option ( enable-dsound "compile DirectSound support (if it is available)" on ) @@ -102,7 +104,6 @@ option ( enable-openmp "enable OpenMP support (parallelization of soundfont deco # Platform specific options if ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly" ) - option ( enable-lash "compile LASH support (if it is available)" on ) option ( enable-alsa "compile ALSA support (if it is available)" on ) endif ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly" ) @@ -122,10 +123,18 @@ if ( CMAKE_SYSTEM MATCHES "OS2" ) endif ( CMAKE_SYSTEM MATCHES "OS2" ) # the default C standard to use for all targets -set(CMAKE_C_STANDARD 90) +if ( PS2 ) + set(CMAKE_C_STANDARD 99) +else () + set(CMAKE_C_STANDARD 90) +endif () # the default C++ standard to use for all targets -set(CMAKE_CXX_STANDARD 98) +if ( PS2 ) + set(CMAKE_CXX_STANDARD 11) +else () + set(CMAKE_CXX_STANDARD 98) +endif () # whether to use gnu extensions set(CMAKE_C_EXTENSIONS ON) @@ -213,13 +222,7 @@ if ( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_C endif ( HAVE_INCOMPATIBLE_POINTER_TYPES ) set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -W -Wpointer-arith -Wcast-qual -Wno-unused-parameter" ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) - set(CMAKE_C_STANDARD 11) - set(CMAKE_C_STANDARD_REQUIRED ON) - set(CMAKE_C_EXTENSIONS ON) + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpthread" ) # prepend to build type specific flags, to allow users to override set ( CMAKE_C_FLAGS_DEBUG "-g ${CMAKE_C_FLAGS_DEBUG}" ) @@ -595,16 +598,6 @@ if ( enable-pipewire ) endif() endif ( enable-pipewire ) -unset ( LASH_SUPPORT CACHE ) -if ( enable-lash ) - find_package ( LASH ${LASH_MINIMUM_VERSION} ) - if ( LASH_FOUND ) - set ( LASH_SUPPORT 1 ) - add_definitions ( -DHAVE_LASH ) - list( APPEND PC_REQUIRES_PRIV "lash-1.0") - endif ( LASH_FOUND ) -endif ( enable-lash ) - unset ( SYSTEMD_SUPPORT CACHE ) if ( enable-systemd ) find_package ( Systemd ) diff --git a/FluidSynthConfig.cmake.in b/FluidSynthConfig.cmake.in index 498846f10..0d251d957 100644 --- a/FluidSynthConfig.cmake.in +++ b/FluidSynthConfig.cmake.in @@ -28,7 +28,6 @@ set(FLUIDSYNTH_SUPPORT_DBUS @DBUS_SUPPORT@) set(FLUIDSYNTH_SUPPORT_GETOPT @HAVE_GETOPT_H@) set(FLUIDSYNTH_SUPPORT_IPV6 @IPV6_SUPPORT@) set(FLUIDSYNTH_SUPPORT_LADSPA @LADSPA_SUPPORT@) -set(FLUIDSYNTH_SUPPORT_LASH @LASH_SUPPORT@) set(FLUIDSYNTH_SUPPORT_NETWORK @NETWORK_SUPPORT@) set(FLUIDSYNTH_SUPPORT_READLINE @READLINE_SUPPORT@) set(FLUIDSYNTH_SUPPORT_SYSTEMD @SYSTEMD_SUPPORT@) @@ -92,10 +91,6 @@ if(NOT FLUIDSYNTH_IS_SHARED) message(WARN "LADSPA support was built in but gmodule could not be found.") endif() - if(FLUIDSYNTH_SUPPORT_LASH AND NOT TARGET LASH::LASH) - find_dependency(LASH @LASH_MINIMUM_VERSION@) - endif() - if(FLUIDSYNTH_SUPPORT_LIBINSTPATCH AND NOT TARGET InstPatch::libinstpatch) find_dependency(InstPatch @LIBINSTPATCH_MINIMUM_VERSION@) endif() diff --git a/README.md b/README.md index cd8c775ed..0d21784d4 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,7 @@ Original content of this file follows. | **Linux** (Packaging) | [![build result](https://build.opensuse.org/projects/home:derselbst:anmp/packages/fluidsynth/badge.svg?type=default)](https://build.opensuse.org/package/show/home:derselbst:anmp/fluidsynth) | **Alpine** (musl) | [![Fluidsynth Alpine](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status%2FFluidSynth.fluidsynth.alpine?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=12&branchName=alpine) | | **FreeBSD** | [![Build Status](https://api.cirrus-ci.com/github/FluidSynth/fluidsynth.svg?branch=master)](https://cirrus-ci.com/github/FluidSynth/fluidsynth) | -| **Windows** (CI) | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.Win?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=3&branchName=master) | -| **Windows** (vcpkg) | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.vcpkg?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=6&branchName=master) | +| **Windows** | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.Win?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=3&branchName=master) | | **MacOSX** | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.macOS?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=5&branchName=master) | | **Android** | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.Android?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=4&branchName=master) | diff --git a/cmake_admin/FindLASH.cmake b/cmake_admin/FindLASH.cmake deleted file mode 100644 index 7cbcbaa3d..000000000 --- a/cmake_admin/FindLASH.cmake +++ /dev/null @@ -1,84 +0,0 @@ -#[=======================================================================[.rst: -FindLASH -------- - -Finds the LASH library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``LASH::LASH`` - The LASH library - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``LASH_FOUND`` - True if the system has the LASH library. -``LASH_VERSION`` - The version of the LASH library which was found. - -#]=======================================================================] - -# Use pkg-config if available -find_package(PkgConfig QUIET) -pkg_check_modules(PC_LASH QUIET lash-1.0) - -# Find the headers and library -find_path( - LASH_INCLUDE_DIR - NAMES "lash/lash.h" - HINTS "${PC_LASH_INCLUDEDIR}" - PATH_SUFFIXES "lash-1.0") - -find_library( - LASH_LIBRARY - NAMES "lash" - HINTS "${PC_LASH_LIBDIR}") - -# Get version from pkg-config or read the config header -if(PC_LASH_VERSION) - set(LASH_VERSION "${PC_LASH_VERSION}") -else() - if(NOT LASH_FIND_VERSION) - set(_assumed_version "0.5.0") - else() - set(_assumed_version "${LASH_FIND_VERSION}") - endif() - message( - NOTICE - "LASH does not expose its version outside of pkg-config. Assuming version ${_assumed_version}, expect failure if your version is lower." - ) - set(LASH_VERSION ${_assumed_version}) -endif() - -# Handle transitive dependencies -if(PC_LASH_FOUND) - get_target_properties_from_pkg_config("${LASH_LIBRARY}" "PC_LASH" "_lash") -else() - set(_lash_link_libraries "Jack::Jack" "Threads::Threads" "ALSA::ALSA" "uuid") -endif() - -# Forward the result to CMake -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - LASH - REQUIRED_VARS "LASH_LIBRARY" "LASH_INCLUDE_DIR" - VERSION_VAR "LASH_VERSION") - -if(LASH_FOUND AND NOT TARGET LASH::LASH) - add_library(LASH::LASH UNKNOWN IMPORTED) - set_target_properties( - LASH::LASH - PROPERTIES IMPORTED_LOCATION "${LASH_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${_lash_compile_options}" - INTERFACE_INCLUDE_DIRECTORIES "${LASH_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_lash_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_lash_link_directories}") -endif() - -mark_as_advanced(LASH_INCLUDE_DIR LASH_LIBRARY) diff --git a/cmake_admin/report.cmake b/cmake_admin/report.cmake index 882b8d6d6..85b375454 100644 --- a/cmake_admin/report.cmake +++ b/cmake_admin/report.cmake @@ -153,12 +153,6 @@ else ( LADSPA_SUPPORT ) set ( MISC_REPORT "${MISC_REPORT} LADSPA support: no\n" ) endif ( LADSPA_SUPPORT ) -if ( LASH_SUPPORT ) - set ( MISC_REPORT "${MISC_REPORT} LASH support: yes (NOTE: GPL library)\n" ) -else ( LASH_SUPPORT ) - set ( MISC_REPORT "${MISC_REPORT} LASH support: no\n" ) -endif ( LASH_SUPPORT ) - if ( NETWORK_SUPPORT ) set ( MISC_REPORT "${MISC_REPORT} NETWORK Support: yes\n" ) else ( NETWORK_SUPPORT ) diff --git a/contrib/fluidsynth.spec b/contrib/fluidsynth.spec index e5fb75e04..b34da6742 100644 --- a/contrib/fluidsynth.spec +++ b/contrib/fluidsynth.spec @@ -79,8 +79,7 @@ This package contains the shared library for Fluidsynth. %build %cmake \ - -DFLUID_DAEMON_ENV_FILE=%{_fillupdir}/sysconfig.%{name} \ - -Denable-lash=0 + -DFLUID_DAEMON_ENV_FILE=%{_fillupdir}/sysconfig.%{name} %cmake_build %check diff --git a/doc/fluidsettings.xml b/doc/fluidsettings.xml index 69ddaf0c3..c805077e4 100644 --- a/doc/fluidsettings.xml +++ b/doc/fluidsettings.xml @@ -47,7 +47,7 @@ Developers: chorus.depth num - 8.0 + 4.25 (since version 2.4.0),
8.0 (2.3.x and older)
0.0 256.0 @@ -57,7 +57,8 @@ Developers: chorus.level num - 2.0 + 0.6 (since version 2.4.0),
2.0 (2.3.x and older)
+ 0.0 10.0 @@ -77,7 +78,7 @@ Developers: chorus.speed num - 0.3 + 0.2 (since version 2.4.0),
0.3 (2.3.x and older)
0.1 5.0 @@ -140,7 +141,7 @@ Developers: gain num - 0.2 + 0.6 (since version 2.4.0),
0.2 (2.3.x and older)
0.0 10.0 @@ -312,7 +313,7 @@ Developers: reverb.damp num - 0.0 + 0.3 (since version 2.4.0),
0.0 (2.3.x and older)
0.0 1.0 @@ -322,7 +323,7 @@ Developers: reverb.level num - 0.9 + 0.7 (since version 2.4.0),
0.9 (2.3.x and older)
0.0 1.0 @@ -332,7 +333,7 @@ Developers: reverb.room-size num - 0.2 + 0.5 (since version 2.4.0),
0.2 (2.3.x and older)
0.0 1.0 @@ -342,7 +343,7 @@ Developers: reverb.width num - 0.5 + 0.8 (since version 2.4.0),
0.5 (2.3.x and older)
0.0 100.0 diff --git a/doc/fluidsynth.1 b/doc/fluidsynth.1 index 5140312d1..9debe59db 100644 --- a/doc/fluidsynth.1 +++ b/doc/fluidsynth.1 @@ -98,9 +98,6 @@ Attempt to connect the jack outputs to the physical ports .B \-K, \-\-midi\-channels=[num] The number of midi channels [default = 16] .TP -.B \-l, \-\-disable\-lash -Don't connect to LASH server -.TP .B \-L, \-\-audio\-channels=[num] The number of stereo audio channels [default = 1] .TP diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c8d5ab3c2..07d59c4ae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,10 +77,6 @@ if ( OSS_SUPPORT ) set ( fluid_oss_SOURCES drivers/fluid_oss.c ) endif ( OSS_SUPPORT ) -if ( LASH_SUPPORT ) - set ( fluid_lash_SOURCES bindings/fluid_lash.c bindings/fluid_lash.h ) -endif ( LASH_SUPPORT ) - if ( DART_SUPPORT ) set ( fluid_dart_SOURCES drivers/fluid_dart.c ) endif ( DART_SUPPORT ) @@ -239,7 +235,6 @@ add_library ( libfluidsynth-OBJ OBJECT ${fluid_dbus_SOURCES} ${fluid_jack_SOURCES} ${fluid_pipewire_SOURCES} - ${fluid_lash_SOURCES} ${fluid_midishare_SOURCES} ${fluid_opensles_SOURCES} ${fluid_oboe_SOURCES} @@ -391,10 +386,6 @@ if ( TARGET PipeWire::PipeWire AND PIPEWIRE_SUPPORT ) target_link_libraries ( libfluidsynth-OBJ PUBLIC PipeWire::PipeWire ) endif() -if ( TARGET LASH::LASH AND LASH_SUPPORT ) - target_link_libraries ( libfluidsynth-OBJ PUBLIC LASH::LASH ) -endif() - if ( TARGET dbus-1 AND DBUS_SUPPORT ) target_link_libraries ( libfluidsynth-OBJ PUBLIC dbus-1 ) endif() @@ -495,10 +486,6 @@ if ( TARGET PipeWire::PipeWire AND PIPEWIRE_SUPPORT ) # because pw_init() etc. target_link_libraries ( fluidsynth PRIVATE PipeWire::PipeWire ) endif() -if ( TARGET LASH::LASH AND LASH_SUPPORT ) - target_link_libraries ( fluidsynth PRIVATE LASH::LASH ) -endif() - if ( MACOSX_FRAMEWORK ) install ( TARGETS fluidsynth libfluidsynth EXPORT FluidSynthTargets @@ -544,12 +531,19 @@ set (GENTAB_BDIR ${CMAKE_CURRENT_BINARY_DIR}/gentables) # To fix cross-compiling fluidsynth from Win32 to ARM (using vcpkg), we need to pass the current generator # on to the external project, otherwise (for some unknown reason) the target compiler will be used rather # than the host compiler. +# +# Some use-cases however cannot rely on this logic, therefore, FLUID_HOST_COMPILER can be specified to +# force using a particular host compiler, see https://github.com/FluidSynth/fluidsynth/issues/1301 +if ( FLUID_HOST_COMPILER ) + set ( EXPLICIT_HOST_COMPILER_STR "-DCMAKE_C_COMPILER=${FLUID_HOST_COMPILER}" ) +endif () + ExternalProject_Add(gentables DOWNLOAD_COMMAND "" SOURCE_DIR ${GENTAB_SDIR} BINARY_DIR ${GENTAB_BDIR} CONFIGURE_COMMAND - "${CMAKE_COMMAND}" -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} -G "${CMAKE_GENERATOR}" -B "${GENTAB_BDIR}" "${GENTAB_SDIR}" + "${CMAKE_COMMAND}" -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} ${EXPLICIT_HOST_COMPILER_STR} -G "${CMAKE_GENERATOR}" -B "${GENTAB_BDIR}" "${GENTAB_SDIR}" BUILD_COMMAND "${CMAKE_COMMAND}" --build "${GENTAB_BDIR}" INSTALL_COMMAND ${GENTAB_BDIR}/make_tables.exe "${FluidSynth_BINARY_DIR}/" diff --git a/src/bindings/fluid_lash.c b/src/bindings/fluid_lash.c deleted file mode 100644 index 652ccb268..000000000 --- a/src/bindings/fluid_lash.c +++ /dev/null @@ -1,170 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ -#include "fluid_lash.h" - -#ifdef HAVE_LASH - -static void fluid_lash_save(fluid_synth_t *synth); -static void fluid_lash_load(fluid_synth_t *synth, const char *filename); -static void *fluid_lash_run(void *data); - -/* - * lash client - this symbol needs to be in the library else - * all clients would need a fluid_lash_client symbol. - */ -lash_client_t *fluid_lash_client; - -static pthread_t fluid_lash_thread; - - -fluid_lash_args_t * -fluid_lash_extract_args(int *pargc, char ***pargv) -{ - return lash_extract_args(pargc, pargv); -} - -int -fluid_lash_connect(fluid_lash_args_t *args) -{ - fluid_lash_client = lash_init(args, PACKAGE, LASH_Config_Data_Set | LASH_Terminal, LASH_PROTOCOL(2, 0)); - return fluid_lash_client && lash_enabled(fluid_lash_client); -} - -void -fluid_lash_create_thread(fluid_synth_t *synth) -{ - pthread_create(&fluid_lash_thread, NULL, fluid_lash_run, synth); -} - -static void -fluid_lash_save(fluid_synth_t *synth) -{ - int i; - int sfcount; - fluid_sfont_t *sfont; - lash_config_t *config; - char num[32]; - - sfcount = fluid_synth_sfcount(synth); - - config = lash_config_new(); - lash_config_set_key(config, "soundfont count"); - lash_config_set_value_int(config, sfcount); - lash_send_config(fluid_lash_client, config); - - for(i = sfcount - 1; i >= 0; i--) - { - sfont = fluid_synth_get_sfont(synth, i); - config = lash_config_new(); - - sprintf(num, "%d", i); - - lash_config_set_key(config, num); - lash_config_set_value_string(config, sfont->get_name(sfont)); - - lash_send_config(fluid_lash_client, config); - } -} - -static void -fluid_lash_load(fluid_synth_t *synth, const char *filename) -{ - fluid_synth_sfload(synth, filename, 1); -} - -static void * -fluid_lash_run(void *data) -{ - lash_event_t *event; - lash_config_t *config; - fluid_synth_t *synth; - int done = 0; - int err; - int pending_restores = 0; - - synth = (fluid_synth_t *) data; - - while(!done) - { - while((event = lash_get_event(fluid_lash_client))) - { - switch(lash_event_get_type(event)) - { - case LASH_Save_Data_Set: - fluid_lash_save(synth); - lash_send_event(fluid_lash_client, event); - break; - - case LASH_Restore_Data_Set: - lash_event_destroy(event); - break; - - case LASH_Quit: - err = kill(getpid(), SIGQUIT); - - if(err) - { - fprintf(stderr, "%s: error sending signal: %s", __FUNCTION__, strerror(errno)); - } - - lash_event_destroy(event); - done = 1; - break; - - case LASH_Server_Lost: - lash_event_destroy(event); - done = 1; - break; - - default: - fprintf(stderr, "Received unknown LASH event of type %d\n", lash_event_get_type(event)); - lash_event_destroy(event); - break; - } - } - - while((config = lash_get_config(fluid_lash_client))) - { - if(FLUID_STRCMP(lash_config_get_key(config), "soundfont count") == 0) - { - pending_restores = lash_config_get_value_int(config); - } - else - { - fluid_lash_load(synth, lash_config_get_value_string(config)); - pending_restores--; - } - - lash_config_destroy(config); - - if(!pending_restores) - { - event = lash_event_new_with_type(LASH_Restore_Data_Set); - lash_send_event(fluid_lash_client, event); - } - } - - usleep(10000); - } - - return NULL; -} - -#endif /* #if HAVE_LASH #else */ diff --git a/src/bindings/fluid_lash.h b/src/bindings/fluid_lash.h deleted file mode 100644 index 787683906..000000000 --- a/src/bindings/fluid_lash.h +++ /dev/null @@ -1,41 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ -#ifndef _FLUID_LASH_H -#define _FLUID_LASH_H - -#include "config.h" - -#ifdef HAVE_LASH - -#include "fluid_synth.h" - -#include -extern lash_client_t *fluid_lash_client; -#define fluid_lash_args_t lash_args_t -#define fluid_lash_alsa_client_id lash_alsa_client_id -#define fluid_lash_jack_client_name lash_jack_client_name - - -FLUIDSYNTH_API fluid_lash_args_t *fluid_lash_extract_args(int *pargc, char ***pargv); -FLUIDSYNTH_API int fluid_lash_connect(fluid_lash_args_t *args); -FLUIDSYNTH_API void fluid_lash_create_thread(fluid_synth_t *synth); - -#endif /* defined(HAVE_LASH) */ -#endif /* _FLUID_LASH_H */ diff --git a/src/config.cmake b/src/config.cmake index 436add7f2..94324e815 100644 --- a/src/config.cmake +++ b/src/config.cmake @@ -43,9 +43,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_IO_H @HAVE_IO_H@ -/* whether or not we are supporting lash */ -#cmakedefine HAVE_LASH @HAVE_LASH@ - /* Define if systemd support is enabled */ #cmakedefine SYSTEMD_SUPPORT @SYSTEMD_SUPPORT@ diff --git a/src/drivers/fluid_alsa.c b/src/drivers/fluid_alsa.c index 98ae8f2c0..52d051fcd 100644 --- a/src/drivers/fluid_alsa.c +++ b/src/drivers/fluid_alsa.c @@ -37,8 +37,6 @@ #include #include -#include "fluid_lash.h" - #define FLUID_ALSA_DEFAULT_MIDI_DEVICE "default" #define FLUID_ALSA_DEFAULT_SEQ_DEVICE "default" @@ -1241,19 +1239,6 @@ new_fluid_alsa_seq_driver(fluid_settings_t *settings, fluid_alsa_seq_autoconnect(dev); } - /* tell the lash server our client id */ -#ifdef HAVE_LASH - { - int enable_lash = 0; - fluid_settings_getint(settings, "lash.enable", &enable_lash); - - if(enable_lash) - { - fluid_lash_alsa_client_id(fluid_lash_client, snd_seq_client_id(dev->seq_handle)); - } - } -#endif /* HAVE_LASH */ - fluid_atomic_int_set(&dev->should_quit, 0); /* create the MIDI thread */ diff --git a/src/drivers/fluid_jack.c b/src/drivers/fluid_jack.c index 755d5b364..877fd86c0 100644 --- a/src/drivers/fluid_jack.c +++ b/src/drivers/fluid_jack.c @@ -38,8 +38,6 @@ #include #include -#include "fluid_lash.h" - typedef struct _fluid_jack_audio_driver_t fluid_jack_audio_driver_t; typedef struct _fluid_jack_midi_driver_t fluid_jack_midi_driver_t; @@ -265,19 +263,6 @@ new_fluid_jack_client(fluid_settings_t *settings, int isaudio, void *driver) goto error_recovery; } - /* tell the lash server our client name */ -#ifdef HAVE_LASH - { - int enable_lash = 0; - fluid_settings_getint(settings, "lash.enable", &enable_lash); - - if(enable_lash) - { - fluid_lash_jack_client_name(fluid_lash_client, name); - } - } -#endif /* HAVE_LASH */ - client_ref->server = server; /* !! takes over allocation */ server = NULL; /* Set to NULL so it doesn't get freed below */ diff --git a/src/drivers/fluid_pipewire.c b/src/drivers/fluid_pipewire.c index b96019e87..70f47ac58 100644 --- a/src/drivers/fluid_pipewire.c +++ b/src/drivers/fluid_pipewire.c @@ -154,6 +154,7 @@ new_fluid_pipewire_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t char *media_category = NULL; float *buffer = NULL; const struct spa_pod *params[1]; + struct pw_properties *props; drv = FLUID_NEW(fluid_pipewire_audio_driver_t); @@ -196,7 +197,7 @@ new_fluid_pipewire_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t goto driver_cleanup; } - struct pw_properties *props = pw_properties_new(PW_KEY_MEDIA_TYPE, media_type, PW_KEY_MEDIA_CATEGORY, media_category, PW_KEY_MEDIA_ROLE, media_role, NULL); + props = pw_properties_new(PW_KEY_MEDIA_TYPE, media_type, PW_KEY_MEDIA_CATEGORY, media_category, PW_KEY_MEDIA_ROLE, media_role, NULL); pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%d/%d", period_size, (int) sample_rate); pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%d", (int) sample_rate); @@ -294,6 +295,11 @@ void delete_fluid_pipewire_audio_driver(fluid_audio_driver_t *p) fluid_pipewire_audio_driver_t *drv = (fluid_pipewire_audio_driver_t *)p; fluid_return_if_fail(drv); + if (drv->pw_loop) + { + pw_thread_loop_lock(drv->pw_loop); + } + if(drv->pw_stream) { pw_stream_destroy(drv->pw_stream); @@ -301,6 +307,7 @@ void delete_fluid_pipewire_audio_driver(fluid_audio_driver_t *p) if(drv->pw_loop) { + pw_thread_loop_unlock(drv->pw_loop); pw_thread_loop_destroy(drv->pw_loop); } diff --git a/src/fluidsynth.c b/src/fluidsynth.c index f4fedb582..6adfdeaf5 100644 --- a/src/fluidsynth.c +++ b/src/fluidsynth.c @@ -29,8 +29,6 @@ #define GETOPT_SUPPORT 1 #endif -#include "fluid_lash.h" - #ifdef SYSTEMD_SUPPORT #include #endif @@ -392,13 +390,6 @@ int main(int argc, char **argv) int dump = 0; int fast_render = 0; static const char optchars[] = "a:C:c:dE:f:F:G:g:hijK:L:lm:nO:o:p:QqR:r:sT:Vvz:"; -#ifdef HAVE_LASH - int connect_lash = 1; - int enabled_lash = 0; /* set to TRUE if lash gets enabled */ - fluid_lash_args_t *lash_args; - - lash_args = fluid_lash_extract_args(&argc, &argv); -#endif #if SDL2_SUPPORT // Tell SDL that it shouldn't intercept signals, otherwise SIGINT and SIGTERM won't quit fluidsynth @@ -653,9 +644,7 @@ int main(int argc, char **argv) break; case 'l': /* disable LASH */ -#ifdef HAVE_LASH - connect_lash = 0; -#endif + // lash support removed in 2.4.0, NOOP break; case 'm': @@ -853,17 +842,6 @@ int main(int argc, char **argv) SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); #endif -#ifdef HAVE_LASH - - /* connect to the lash server */ - if(connect_lash) - { - enabled_lash = fluid_lash_connect(lash_args); - fluid_settings_setint(settings, "lash.enable", enabled_lash ? 1 : 0); - } - -#endif - /* The 'groups' setting is relevant for LADSPA operation and channel mapping * in rvoice_mixer. * If not given, set number groups to number of audio channels, because @@ -1096,15 +1074,6 @@ int main(int argc, char **argv) #endif } -#endif - -#ifdef HAVE_LASH - - if(enabled_lash) - { - fluid_lash_create_thread(synth); - } - #endif /* fast rendering audio file, if requested */ @@ -1285,10 +1254,6 @@ print_help(fluid_settings_t *settings) " Attempt to connect the jack outputs to the physical ports\n"); printf(" -K, --midi-channels=[num]\n" " The number of midi channels [default = 16]\n"); -#ifdef HAVE_LASH - printf(" -l, --disable-lash\n" - " Don't connect to LASH server\n"); -#endif printf(" -L, --audio-channels=[num]\n" " The number of stereo audio channels [default = 1]\n"); printf(" -m, --midi-driver=[label]\n" diff --git a/src/midi/fluid_midi.c b/src/midi/fluid_midi.c index e35c87b60..a8925732e 100644 --- a/src/midi/fluid_midi.c +++ b/src/midi/fluid_midi.c @@ -1644,7 +1644,7 @@ fluid_player_handle_reset_synth(void *data, const char *name, int value) static int check_for_on_notes(fluid_synth_t *synth) { fluid_voice_t* v[1024]; - int i, res=FALSE; + unsigned int i, res=FALSE; fluid_synth_get_voicelist(synth, v, FLUID_N_ELEMENTS(v), -1); for(i=0; ichannel_type = (120 <= bankmsb) ? CHANNEL_TYPE_DRUM : CHANNEL_TYPE_MELODIC; + chan->channel_type = (120 == bankmsb || 126 == bankmsb || 127 == bankmsb) ? CHANNEL_TYPE_DRUM : CHANNEL_TYPE_MELODIC; return; } diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index 442e9e606..d33a02b3c 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -223,7 +223,7 @@ void fluid_synth_settings(fluid_settings_t *settings) fluid_settings_register_int(settings, "synth.polyphony", 256, 1, 65535, 0); fluid_settings_register_int(settings, "synth.midi-channels", 16, 16, 256, 0); - fluid_settings_register_num(settings, "synth.gain", 0.2, 0.0, 10.0, 0); + fluid_settings_register_num(settings, "synth.gain", 0.6, 0.0, 10.0, 0); fluid_settings_register_int(settings, "synth.audio-channels", 1, 1, 128, 0); fluid_settings_register_int(settings, "synth.audio-groups", 1, 1, 128, 0); fluid_settings_register_int(settings, "synth.effects-channels", 2, 2, 2, 0); @@ -6847,15 +6847,30 @@ fluid_synth_release_voice_on_same_note_LOCAL(fluid_synth_t *synth, int chan, && (fluid_voice_get_key(voice) == key) && (fluid_voice_get_id(voice) != synth->noteid)) { + enum fluid_midi_channel_type type = synth->channel[chan]->channel_type; + /* Id of voices that was sustained by sostenuto */ if(fluid_voice_is_sostenuto(voice)) { synth->storeid = fluid_voice_get_id(voice); } - /* Force the voice into release stage except if pedaling - (sostenuto or sustain) is active */ - fluid_voice_noteoff(voice); + switch(type) + { + case CHANNEL_TYPE_DRUM: + /* release the voice, this should make riding hi-hats or snares sound more + * realistic (Discussion #1196) */ + fluid_voice_off(voice); + break; + case CHANNEL_TYPE_MELODIC: + /* Force the voice into release stage except if pedaling (sostenuto or sustain) is active. + * This gives a more realistic sound to pianos and possibly other instruments (see PR #905). */ + fluid_voice_noteoff(voice); + break; + default: + FLUID_LOG(FLUID_ERR, "This should never happen: unknown channel type %d", (int)type); + break; + } } } } diff --git a/src/synth/fluid_synth.h b/src/synth/fluid_synth.h index cb838e924..7dbcdc556 100644 --- a/src/synth/fluid_synth.h +++ b/src/synth/fluid_synth.h @@ -41,21 +41,21 @@ * * DEFINES */ -#define FLUID_NUM_PROGRAMS 128 -#define DRUM_INST_BANK 128 +#define FLUID_NUM_PROGRAMS 128 +#define DRUM_INST_BANK 128 -#define FLUID_UNSET_PROGRAM 128 /* Program number used to unset a preset */ +#define FLUID_UNSET_PROGRAM 128 /* Program number used to unset a preset */ -#define FLUID_REVERB_DEFAULT_ROOMSIZE 0.2f /**< Default reverb room size */ -#define FLUID_REVERB_DEFAULT_DAMP 0.0f /**< Default reverb damping */ -#define FLUID_REVERB_DEFAULT_WIDTH 0.5f /**< Default reverb width */ -#define FLUID_REVERB_DEFAULT_LEVEL 0.9f /**< Default reverb level */ +#define FLUID_REVERB_DEFAULT_DAMP 0.3f /**< Default reverb damping */ +#define FLUID_REVERB_DEFAULT_LEVEL 0.7f /**< Default reverb level */ +#define FLUID_REVERB_DEFAULT_ROOMSIZE 0.5f /**< Default reverb room size */ +#define FLUID_REVERB_DEFAULT_WIDTH 0.8f /**< Default reverb width */ -#define FLUID_CHORUS_DEFAULT_N 3 /**< Default chorus voice count */ -#define FLUID_CHORUS_DEFAULT_LEVEL 2.0f /**< Default chorus level */ -#define FLUID_CHORUS_DEFAULT_SPEED 0.3f /**< Default chorus speed */ -#define FLUID_CHORUS_DEFAULT_DEPTH 8.0f /**< Default chorus depth */ -#define FLUID_CHORUS_DEFAULT_TYPE FLUID_CHORUS_MOD_SINE /**< Default chorus waveform type */ +#define FLUID_CHORUS_DEFAULT_DEPTH 4.25f /**< Default chorus depth */ +#define FLUID_CHORUS_DEFAULT_LEVEL 0.6f /**< Default chorus level */ +#define FLUID_CHORUS_DEFAULT_N 3 /**< Default chorus voice count */ +#define FLUID_CHORUS_DEFAULT_SPEED 0.2f /**< Default chorus speed */ +#define FLUID_CHORUS_DEFAULT_TYPE FLUID_CHORUS_MOD_SINE /**< Default chorus waveform type */ /*************************************************************** * diff --git a/src/utils/fluid_sys.c b/src/utils/fluid_sys.c index e1c0214c5..7a957dc95 100644 --- a/src/utils/fluid_sys.c +++ b/src/utils/fluid_sys.c @@ -34,6 +34,74 @@ // Do not include pthread on windows. It includes winsock.h, which collides with ws2tcpip.h from fluid_sys.h // It isn't need on Windows anyway. #include + +static pthread_mutex_t g_atomic_lock = PTHREAD_MUTEX_INITIALIZER; + +int pthread_atomic_int_get(const volatile int *atomic) +{ + int value; + + pthread_mutex_lock (&g_atomic_lock); + value = *atomic; + pthread_mutex_unlock (&g_atomic_lock); + + return value; +} + +void pthread_atomic_int_inc(volatile int *atomic) +{ + pthread_mutex_lock (&g_atomic_lock); + (*atomic)++; + pthread_mutex_unlock (&g_atomic_lock); +} + +void pthread_atomic_int_set(volatile int *atomic, + int value) +{ + pthread_mutex_lock (&g_atomic_lock); + *atomic = value; + pthread_mutex_unlock (&g_atomic_lock); +} + +bool pthread_atomic_int_dec_and_test (volatile int *atomic) +{ + bool is_zero; + + pthread_mutex_lock (&g_atomic_lock); + is_zero = --(*atomic) == 0; + pthread_mutex_unlock (&g_atomic_lock); + + return is_zero; +} + +bool pthread_atomic_int_compare_and_exchange(volatile int *atomic, + int oldval, + int newval) +{ + bool success; + + pthread_mutex_lock (&g_atomic_lock); + + if ((success = (*atomic == oldval))) + *atomic = newval; + + pthread_mutex_unlock (&g_atomic_lock); + + return success; +} + +int pthread_atomic_int_add(volatile int *atomic, + int val) +{ + int oldval; + + pthread_mutex_lock (&g_atomic_lock); + oldval = *atomic; + *atomic = oldval + val; + pthread_mutex_unlock (&g_atomic_lock); + + return oldval; +} #endif /* WIN32 HACK - Flag used to differentiate between a file descriptor and a socket. diff --git a/src/utils/fluid_sys.h b/src/utils/fluid_sys.h index c73905e9e..e67571617 100644 --- a/src/utils/fluid_sys.h +++ b/src/utils/fluid_sys.h @@ -328,6 +328,29 @@ typedef _private fluid_private_t; /* Atomic operations */ +#if HAVE_PTHREAD_H + +#include + +int pthread_atomic_int_get(const volatile int *atomic); +void pthread_atomic_int_inc(volatile int *atomic); +void pthread_atomic_int_set(volatile int *atomic, int value); +bool pthread_atomic_int_dec_and_test (volatile int *atomic); +bool pthread_atomic_int_compare_and_exchange(volatile int *atomic, int oldval, int newval); +int pthread_atomic_int_add(volatile int *atomic, int val); + +#define fluid_atomic_int_inc(_pi) pthread_atomic_int_inc(_pi) +#define fluid_atomic_int_get(_pi) pthread_atomic_int_get(_pi) +#define fluid_atomic_int_set(_pi, _val) pthread_atomic_int_set(_pi, _val) +#define fluid_atomic_int_dec_and_test(_pi) pthread_atomic_int_dec_and_test(_pi) +#define fluid_atomic_int_compare_and_exchange(_pi, _old, _new) \ + pthread_atomic_int_compare_and_exchange(_pi, (int)_old, _new) +#define fluid_atomic_int_add(_pi, _add) \ + pthread_atomic_int_add(_pi, _add) +#define fluid_atomic_int_exchange_and_add(_pi, _add) \ + pthread_atomic_int_add(_pi, _add) + +#else #define fluid_atomic_int_inc(_pi) atomic_fetch_add(_pi, 1) #define fluid_atomic_int_get(_pi) atomic_load(_pi) #define fluid_atomic_int_set(_pi, _val) atomic_store(_pi, _val) @@ -344,6 +367,8 @@ typedef _private fluid_private_t; #define fluid_atomic_pointer_compare_and_exchange(_pp, _old, _new) \ atomic_compare_exchange_weak(_pp, _old, _new) +#endif + static FLUID_INLINE void fluid_atomic_float_set(fluid_atomic_float_t *fptr, float val) { diff --git a/src/utils/fluidsynth_priv.h b/src/utils/fluidsynth_priv.h index ca908bbd0..8578ce3d0 100644 --- a/src/utils/fluidsynth_priv.h +++ b/src/utils/fluidsynth_priv.h @@ -80,10 +80,15 @@ typedef double fluid_real_t; /** Atomic types */ +#if defined(PS2) +typedef int fluid_atomic_int_t; +typedef unsigned int fluid_atomic_uint_t; +typedef float fluid_atomic_float_t; +#else typedef _Atomic int fluid_atomic_int_t; typedef _Atomic unsigned int fluid_atomic_uint_t; typedef _Atomic float fluid_atomic_float_t; - +#endif /***************************************************************