mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-06-04 02:51:03 +00:00
commit
241c82a4b0
17 changed files with 197 additions and 326 deletions
|
@ -1,5 +1,4 @@
|
||||||
image:
|
image:
|
||||||
- Visual Studio 2015
|
|
||||||
- Visual Studio 2017
|
- Visual Studio 2017
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
image:
|
image:
|
||||||
- Visual Studio 2015
|
- Visual Studio 2015
|
||||||
- Visual Studio 2017
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cert-*,clang-analyzer-*,performance-*,readability-avoid-const-params-in-decls,readability-braces-around-statements,readability-delete-null-pointer,readability-implicit-bool-conversion,readability-inconsistent-declaration-parameter-name,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-simplify-boolean-expr'
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cert-*,clang-analyzer-*,performance-*,readability-avoid-const-params-in-decls,readability-braces-around-statements,readability-delete-null-pointer,readability-implicit-bool-conversion,readability-misleading-indentation,readability-misplaced-array-index,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-simplify-boolean-expr'
|
||||||
WarningsAsErrors: ''
|
WarningsAsErrors: ''
|
||||||
HeaderFilterRegex: ''
|
HeaderFilterRegex: ''
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
|
|
239
.travis.yml
239
.travis.yml
|
@ -1,221 +1,64 @@
|
||||||
language: c
|
language: c
|
||||||
#sudo: required
|
sudo: false
|
||||||
|
os: linux
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-6.0
|
||||||
|
- llvm-toolchain-trusty-7
|
||||||
|
packages:
|
||||||
|
- cmake-data
|
||||||
|
- cmake
|
||||||
|
- libglib2.0-0
|
||||||
|
- libsndfile-dev
|
||||||
|
- libasound2-dev
|
||||||
|
- libjack-dev
|
||||||
|
- portaudio19-dev
|
||||||
|
- libpulse-dev
|
||||||
|
- libdbus-glib-1-dev
|
||||||
|
- ladspa-sdk
|
||||||
env:
|
env:
|
||||||
- CMAKE_FLAGS="-Denable-profiling=1"
|
- CMAKE_FLAGS="-Denable-profiling=1"
|
||||||
- CMAKE_FLAGS="-Denable-floats=1 -Denable-profiling=1"
|
- CMAKE_FLAGS="-Denable-floats=1 -Denable-profiling=1"
|
||||||
|
- CMAKE_FLAGS="-Denable-floats=0"
|
||||||
- CMAKE_FLAGS="-Denable-trap-on-fpe=1"
|
- CMAKE_FLAGS="-Denable-trap-on-fpe=1"
|
||||||
- CMAKE_FLAGS="-Denable-fpe-check=1"
|
- CMAKE_FLAGS="-Denable-fpe-check=1"
|
||||||
- CMAKE_FLAGS="-Denable-ipv6=0"
|
- CMAKE_FLAGS="-Denable-ipv6=0"
|
||||||
- CMAKE_FLAGS="-Denable-network=0"
|
- CMAKE_FLAGS="-Denable-network=0"
|
||||||
- CMAKE_FLAGS="-Denable-aufile=0"
|
- CMAKE_FLAGS="-Denable-aufile=0"
|
||||||
- CMAKE_FLAGS="-DBUILD_SHARED_LIBS=0"
|
- CMAKE_FLAGS="-DBUILD_SHARED_LIBS=0"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.8
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- libsndfile-dev
|
|
||||||
- libasound2-dev
|
|
||||||
- libjack-dev
|
|
||||||
- portaudio19-dev
|
|
||||||
- libpulse-dev
|
|
||||||
- libdbus-glib-1-dev
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
|
||||||
- CMAKE_FLAGS="-Denable-floats=1"
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-4.8
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- libsndfile-dev
|
|
||||||
- libasound2-dev
|
|
||||||
- libjack-dev
|
|
||||||
- portaudio19-dev
|
|
||||||
- libpulse-dev
|
|
||||||
- libdbus-glib-1-dev
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
|
||||||
- CMAKE_FLAGS="-Denable-floats=0"
|
|
||||||
|
|
||||||
# works on Precise and Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-5
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
|
||||||
- CMAKE_FLAGS="-Denable-debug=1 -DCMAKE_C_FLAGS_DEBUG=-fuse-ld=gold"
|
|
||||||
|
|
||||||
# works on Precise and Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
|
||||||
|
|
||||||
# works on Precise and Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
|
||||||
|
|
||||||
# works on Precise and Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-8
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
|
||||||
|
|
||||||
# works on Precise and Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.8
|
|
||||||
packages:
|
|
||||||
- clang-3.8
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- libsndfile-dev
|
|
||||||
- libasound2-dev
|
|
||||||
- libjack-dev
|
|
||||||
- portaudio19-dev
|
|
||||||
- libpulse-dev
|
|
||||||
- libdbus-glib-1-dev
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
|
|
||||||
|
|
||||||
# works on Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-4.0
|
|
||||||
packages:
|
|
||||||
- clang-4.0
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
|
|
||||||
|
|
||||||
# works on Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-5.0
|
|
||||||
packages:
|
|
||||||
- clang-5.0
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
|
|
||||||
|
|
||||||
# works on Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty-6.0
|
|
||||||
packages:
|
|
||||||
- clang-6.0
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
|
|
||||||
|
|
||||||
# works on Trusty
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty-7
|
|
||||||
packages:
|
|
||||||
- clang-7
|
|
||||||
- cmake-data
|
|
||||||
- cmake
|
|
||||||
- libglib2.0-0
|
|
||||||
- ladspa-sdk
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8
|
osx_image: xcode10
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="brew install gcc5 glib gettext && brew link gettext && CC=gcc-5 && CXX=g++-5" # gettext should provide libintl, but doesnt work
|
|
||||||
|
|
||||||
- os: osx
|
- os: linux
|
||||||
osx_image: xcode8
|
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="brew install gcc6 glib gettext && brew link gettext && CC=gcc-6 && CXX=g++-6"
|
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && sudo apt-get install gcc-7"
|
||||||
|
|
||||||
- os: osx
|
- os: linux
|
||||||
osx_image: xcode8
|
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="brew install gcc glib gettext libsndfile jack dbus-glib pulseaudio portaudio && brew link gettext && CC=gcc-8 && CXX=g++-8"
|
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8 && sudo apt-get install gcc-8"
|
||||||
|
- CMAKE_FLAGS="-Denable-debug=1 -DCMAKE_C_FLAGS_DEBUG=-fuse-ld=gold"
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env:
|
||||||
|
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8 && sudo apt-get install clang-3.8"
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env:
|
||||||
|
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0 && sudo apt-get install clang-6.0"
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env:
|
||||||
|
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7 && sudo apt-get install clang-7"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get update; else brew update; fi
|
- if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get update; else brew update; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install glib gettext libsndfile jack dbus-glib pulseaudio portaudio; fi # && brew link gettext
|
||||||
- eval "${MATRIX_EVAL}"
|
- eval "${MATRIX_EVAL}"
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -223,7 +66,7 @@ before_script:
|
||||||
- mkdir build && cd build
|
- mkdir build && cd build
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install ${CMAKE_FLAGS} "-Denable-portaudio=1" "-Denable-ladspa=1" "-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=1" ..
|
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install ${CMAKE_FLAGS} -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=0 ..
|
||||||
- make -j4
|
- make -j4
|
||||||
- make check
|
- make check
|
||||||
- if [ $TRAVIS_OS_NAME = linux ]; then make install; fi # install only on linux, as CMAKE_INSTALL_PREFIX is ignored for frameworks on macosx and I cant tell whether that's correct or a bug.
|
- if [ $TRAVIS_OS_NAME = linux ]; then make install; fi # install only on linux, as CMAKE_INSTALL_PREFIX is ignored for frameworks on macosx and I cant tell whether that's correct or a bug.
|
||||||
|
|
|
@ -67,6 +67,8 @@ option ( enable-libsndfile "compile libsndfile support (if it is available)" on
|
||||||
option ( enable-midishare "compile MidiShare support (if it is available)" on )
|
option ( enable-midishare "compile MidiShare support (if it is available)" on )
|
||||||
option ( enable-network "enable network support (requires BSD sockets)" on )
|
option ( enable-network "enable network support (requires BSD sockets)" on )
|
||||||
option ( enable-oss "compile OSS support (if it is available)" on )
|
option ( enable-oss "compile OSS support (if it is available)" on )
|
||||||
|
option ( enable-dsound "compile DirectSound support (if it is available)" on )
|
||||||
|
option ( enable-winmidi "compile Windows MIDI support (if it is available)" on )
|
||||||
option ( enable-pkgconfig "use pkg-config to locate fluidsynth's (mostly optional) dependencies" on )
|
option ( enable-pkgconfig "use pkg-config to locate fluidsynth's (mostly optional) dependencies" on )
|
||||||
option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
|
option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
|
||||||
option ( enable-readline "compile readline lib line editing (if it is available)" on )
|
option ( enable-readline "compile readline lib line editing (if it is available)" on )
|
||||||
|
@ -190,15 +192,34 @@ endif ( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE
|
||||||
# Windows
|
# Windows
|
||||||
unset ( WINDOWS_SUPPORT CACHE )
|
unset ( WINDOWS_SUPPORT CACHE )
|
||||||
unset ( WINDOWS_LIBS CACHE )
|
unset ( WINDOWS_LIBS CACHE )
|
||||||
|
unset ( DSOUND_SUPPORT CACHE )
|
||||||
|
unset ( WINMIDI_SUPPORT CACHE )
|
||||||
unset ( MINGW32 CACHE )
|
unset ( MINGW32 CACHE )
|
||||||
if ( WIN32 )
|
if ( WIN32 )
|
||||||
include ( CheckIncludeFiles )
|
include ( CheckIncludeFiles )
|
||||||
|
|
||||||
|
# Check presence of MS include files
|
||||||
check_include_file ( windows.h HAVE_WINDOWS_H )
|
check_include_file ( windows.h HAVE_WINDOWS_H )
|
||||||
check_include_file ( io.h HAVE_IO_H )
|
check_include_file ( io.h HAVE_IO_H )
|
||||||
check_include_file ( dsound.h HAVE_DSOUND_H )
|
check_include_file ( dsound.h HAVE_DSOUND_H )
|
||||||
check_include_files ( "windows.h;mmsystem.h" HAVE_MMSYSTEM_H )
|
check_include_files ( "windows.h;mmsystem.h" HAVE_MMSYSTEM_H )
|
||||||
|
|
||||||
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
|
set ( WINDOWS_SUPPORT ${HAVE_WINDOWS_H} )
|
||||||
set ( WINDOWS_LIBS "dsound;winmm;ws2_32" )
|
|
||||||
|
if ( enable-network )
|
||||||
|
set ( WINDOWS_LIBS "${WINDOWS_LIBS};ws2_32" )
|
||||||
|
endif ( enable-network )
|
||||||
|
|
||||||
|
if ( enable-dsound AND HAVE_DSOUND_H )
|
||||||
|
set ( WINDOWS_LIBS "${WINDOWS_LIBS};dsound" )
|
||||||
|
set ( DSOUND_SUPPORT 1 )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if ( enable-winmidi AND HAVE_MMSYSTEM_H )
|
||||||
|
set ( WINDOWS_LIBS "${WINDOWS_LIBS};winmm" )
|
||||||
|
set ( WINMIDI_SUPPORT 1 )
|
||||||
|
endif ()
|
||||||
|
|
||||||
set ( LIBFLUID_CPPFLAGS "-DFLUIDSYNTH_DLL_EXPORTS" )
|
set ( LIBFLUID_CPPFLAGS "-DFLUIDSYNTH_DLL_EXPORTS" )
|
||||||
set ( FLUID_CPPFLAGS "-DFLUIDSYNTH_NOT_A_DLL" )
|
set ( FLUID_CPPFLAGS "-DFLUIDSYNTH_NOT_A_DLL" )
|
||||||
if ( MSVC )
|
if ( MSVC )
|
||||||
|
@ -229,7 +250,7 @@ if ( WIN32 )
|
||||||
# MinGW compiler (a Windows GCC port)
|
# MinGW compiler (a Windows GCC port)
|
||||||
if ( MINGW )
|
if ( MINGW )
|
||||||
set ( MINGW32 1 )
|
set ( MINGW32 1 )
|
||||||
add_definitions ( -mms-bitfields )
|
add_compile_options ( -mms-bitfields )
|
||||||
endif ( MINGW )
|
endif ( MINGW )
|
||||||
else ( WIN32 )
|
else ( WIN32 )
|
||||||
# Check PThreads, but not in Windows
|
# Check PThreads, but not in Windows
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "VersionInfo.h"
|
#include "VersionInfo.h"
|
||||||
#include "winres.h"
|
#include "winver.h"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION FILE_VERSION_RESOURCE
|
FILEVERSION FILE_VERSION_RESOURCE
|
||||||
|
|
|
@ -74,6 +74,18 @@ else ( WINDOWS_SUPPORT )
|
||||||
message ( "Windows: no" )
|
message ( "Windows: no" )
|
||||||
endif ( WINDOWS_SUPPORT )
|
endif ( WINDOWS_SUPPORT )
|
||||||
|
|
||||||
|
if ( DSOUND_SUPPORT )
|
||||||
|
message ( "DSound: yes" )
|
||||||
|
else ( DSOUND_SUPPORT )
|
||||||
|
message ( "DSound: no" )
|
||||||
|
endif ( DSOUND_SUPPORT )
|
||||||
|
|
||||||
|
if ( WINMIDI_SUPPORT )
|
||||||
|
message ( "WinMidi support: yes" )
|
||||||
|
else ( WINMIDI_SUPPORT )
|
||||||
|
message ( "WinMidi support: no" )
|
||||||
|
endif ( WINMIDI_SUPPORT )
|
||||||
|
|
||||||
if ( LADSPA_SUPPORT )
|
if ( LADSPA_SUPPORT )
|
||||||
message ( "LADSPA support: yes" )
|
message ( "LADSPA support: yes" )
|
||||||
else ( LADSPA_SUPPORT )
|
else ( LADSPA_SUPPORT )
|
||||||
|
|
|
@ -78,9 +78,13 @@ if ( PORTAUDIO_SUPPORT )
|
||||||
include_directories ( ${PORTAUDIO_INCLUDE_DIRS} )
|
include_directories ( ${PORTAUDIO_INCLUDE_DIRS} )
|
||||||
endif ( PORTAUDIO_SUPPORT )
|
endif ( PORTAUDIO_SUPPORT )
|
||||||
|
|
||||||
if ( WINDOWS_SUPPORT )
|
if ( DSOUND_SUPPORT )
|
||||||
set ( fluid_windows_SOURCES drivers/fluid_dsound.c drivers/fluid_winmidi.c )
|
set ( fluid_dsound_SOURCES drivers/fluid_dsound.c )
|
||||||
endif ( WINDOWS_SUPPORT )
|
endif ( DSOUND_SUPPORT )
|
||||||
|
|
||||||
|
if ( WINMIDI_SUPPORT )
|
||||||
|
set ( fluid_winmidi_SOURCES drivers/fluid_winmidi.c )
|
||||||
|
endif ( WINMIDI_SUPPORT )
|
||||||
|
|
||||||
if ( OSS_SUPPORT )
|
if ( OSS_SUPPORT )
|
||||||
set ( fluid_oss_SOURCES drivers/fluid_oss.c )
|
set ( fluid_oss_SOURCES drivers/fluid_oss.c )
|
||||||
|
@ -212,7 +216,7 @@ configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth/version.h.in
|
||||||
configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth.cmake
|
configure_file ( ${CMAKE_SOURCE_DIR}/include/fluidsynth.cmake
|
||||||
${public_main_HEADER} )
|
${public_main_HEADER} )
|
||||||
|
|
||||||
if ( WIN32 AND NOT MINGW )
|
if ( WIN32 )
|
||||||
include(generate_product_version)
|
include(generate_product_version)
|
||||||
generate_product_version(
|
generate_product_version(
|
||||||
VersionFilesOutputVariable
|
VersionFilesOutputVariable
|
||||||
|
@ -227,7 +231,7 @@ generate_product_version(
|
||||||
ORIGINAL_FILENAME "libfluidsynth.dll"
|
ORIGINAL_FILENAME "libfluidsynth.dll"
|
||||||
FILE_DESCRIPTION "Fluidsynth"
|
FILE_DESCRIPTION "Fluidsynth"
|
||||||
)
|
)
|
||||||
endif ( WIN32 AND NOT MINGW )
|
endif ( WIN32 )
|
||||||
|
|
||||||
add_library ( libfluidsynth-OBJ OBJECT
|
add_library ( libfluidsynth-OBJ OBJECT
|
||||||
${config_SOURCES}
|
${config_SOURCES}
|
||||||
|
@ -243,7 +247,8 @@ add_library ( libfluidsynth-OBJ OBJECT
|
||||||
${fluid_oss_SOURCES}
|
${fluid_oss_SOURCES}
|
||||||
${fluid_portaudio_SOURCES}
|
${fluid_portaudio_SOURCES}
|
||||||
${fluid_pulse_SOURCES}
|
${fluid_pulse_SOURCES}
|
||||||
${fluid_windows_SOURCES}
|
${fluid_dsound_SOURCES}
|
||||||
|
${fluid_winmidi_SOURCES}
|
||||||
${libfluidsynth_SOURCES}
|
${libfluidsynth_SOURCES}
|
||||||
${public_HEADERS}
|
${public_HEADERS}
|
||||||
${public_main_HEADER}
|
${public_main_HEADER}
|
||||||
|
|
|
@ -190,6 +190,12 @@
|
||||||
/* Define to enable PulseAudio driver */
|
/* Define to enable PulseAudio driver */
|
||||||
#cmakedefine PULSE_SUPPORT @PULSE_SUPPORT@
|
#cmakedefine PULSE_SUPPORT @PULSE_SUPPORT@
|
||||||
|
|
||||||
|
/* Define to enable DirectSound driver */
|
||||||
|
#cmakedefine DSOUND_SUPPORT @DSOUND_SUPPORT@
|
||||||
|
|
||||||
|
/* Define to enable Windows MIDI driver */
|
||||||
|
#cmakedefine WINMIDI_SUPPORT @WINMIDI_SUPPORT@
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#cmakedefine STDC_HEADERS @STDC_HEADERS@
|
#cmakedefine STDC_HEADERS @STDC_HEADERS@
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* fluid_adriver_definition_t
|
* fluid_adriver_definition_t
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _fluid_audriver_definition_t
|
struct _fluid_audriver_definition_t
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
fluid_audio_driver_t *(*new)(fluid_settings_t *settings, fluid_synth_t *synth);
|
fluid_audio_driver_t *(*new)(fluid_settings_t *settings, fluid_synth_t *synth);
|
||||||
|
@ -34,7 +34,7 @@ typedef struct _fluid_audriver_definition_t
|
||||||
void *data);
|
void *data);
|
||||||
void (*free)(fluid_audio_driver_t *driver);
|
void (*free)(fluid_audio_driver_t *driver);
|
||||||
void (*settings)(fluid_settings_t *settings);
|
void (*settings)(fluid_settings_t *settings);
|
||||||
} fluid_audriver_definition_t;
|
};
|
||||||
|
|
||||||
/* Available audio drivers, listed in order of preference */
|
/* Available audio drivers, listed in order of preference */
|
||||||
static const fluid_audriver_definition_t fluid_audio_drivers[] =
|
static const fluid_audriver_definition_t fluid_audio_drivers[] =
|
||||||
|
@ -236,10 +236,11 @@ find_fluid_audio_driver(fluid_settings_t *settings)
|
||||||
{
|
{
|
||||||
FLUID_LOG(FLUID_INFO, "No audio drivers available.");
|
FLUID_LOG(FLUID_INFO, "No audio drivers available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FLUID_FREE(allnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUID_FREE(name);
|
FLUID_FREE(name);
|
||||||
FLUID_FREE(allnames);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +266,7 @@ new_fluid_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
|
||||||
|
|
||||||
if(driver)
|
if(driver)
|
||||||
{
|
{
|
||||||
driver->name = def->name;
|
driver->define = def;
|
||||||
}
|
}
|
||||||
|
|
||||||
return driver;
|
return driver;
|
||||||
|
@ -307,7 +308,7 @@ new_fluid_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func, voi
|
||||||
|
|
||||||
if(driver)
|
if(driver)
|
||||||
{
|
{
|
||||||
driver->name = def->name;
|
driver->define = def;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,18 +327,8 @@ new_fluid_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func, voi
|
||||||
void
|
void
|
||||||
delete_fluid_audio_driver(fluid_audio_driver_t *driver)
|
delete_fluid_audio_driver(fluid_audio_driver_t *driver)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
fluid_return_if_fail(driver != NULL);
|
fluid_return_if_fail(driver != NULL);
|
||||||
|
driver->define->free(driver);
|
||||||
/* iterate over fluid_audio_drivers_template to ensure deleting even drivers currently not registered */
|
|
||||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_audio_drivers) - 1; i++)
|
|
||||||
{
|
|
||||||
if(fluid_audio_drivers[i].name == driver->name)
|
|
||||||
{
|
|
||||||
fluid_audio_drivers[i].free(driver);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,11 @@
|
||||||
* fluid_audio_driver_t
|
* fluid_audio_driver_t
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef struct _fluid_audriver_definition_t fluid_audriver_definition_t;
|
||||||
|
|
||||||
struct _fluid_audio_driver_t
|
struct _fluid_audio_driver_t
|
||||||
{
|
{
|
||||||
const char *name;
|
const fluid_audriver_definition_t *define;
|
||||||
};
|
};
|
||||||
|
|
||||||
void fluid_audio_driver_settings(fluid_settings_t *settings);
|
void fluid_audio_driver_settings(fluid_settings_t *settings);
|
||||||
|
|
|
@ -82,6 +82,8 @@ struct _fluid_jack_midi_driver_t
|
||||||
int midi_port_count;
|
int midi_port_count;
|
||||||
jack_port_t **midi_port; // array of midi port handles
|
jack_port_t **midi_port; // array of midi port handles
|
||||||
fluid_midi_parser_t *parser;
|
fluid_midi_parser_t *parser;
|
||||||
|
int autoconnect_inputs;
|
||||||
|
int autoconnect_is_outdated;
|
||||||
};
|
};
|
||||||
|
|
||||||
static fluid_jack_client_t *new_fluid_jack_client(fluid_settings_t *settings,
|
static fluid_jack_client_t *new_fluid_jack_client(fluid_settings_t *settings,
|
||||||
|
@ -94,7 +96,7 @@ void fluid_jack_driver_shutdown(void *arg);
|
||||||
int fluid_jack_driver_srate(jack_nframes_t nframes, void *arg);
|
int fluid_jack_driver_srate(jack_nframes_t nframes, void *arg);
|
||||||
int fluid_jack_driver_bufsize(jack_nframes_t nframes, void *arg);
|
int fluid_jack_driver_bufsize(jack_nframes_t nframes, void *arg);
|
||||||
int fluid_jack_driver_process(jack_nframes_t nframes, void *arg);
|
int fluid_jack_driver_process(jack_nframes_t nframes, void *arg);
|
||||||
|
void fluid_jack_port_registration(jack_port_id_t port, int is_registering, void *arg);
|
||||||
|
|
||||||
static fluid_mutex_t last_client_mutex = FLUID_MUTEX_INIT; /* Probably not necessary, but just in case drivers are created by multiple threads */
|
static fluid_mutex_t last_client_mutex = FLUID_MUTEX_INIT; /* Probably not necessary, but just in case drivers are created by multiple threads */
|
||||||
static fluid_jack_client_t *last_client = NULL; /* Last unpaired client. For audio/MIDI driver pairing. */
|
static fluid_jack_client_t *last_client = NULL; /* Last unpaired client. For audio/MIDI driver pairing. */
|
||||||
|
@ -109,6 +111,31 @@ fluid_jack_audio_driver_settings(fluid_settings_t *settings)
|
||||||
fluid_settings_register_str(settings, "audio.jack.server", "", 0);
|
fluid_settings_register_str(settings, "audio.jack.server", "", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Connect all midi input ports to all terminal midi output ports
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
fluid_jack_midi_autoconnect(jack_client_t *client, fluid_jack_midi_driver_t *midi_driver) {
|
||||||
|
int i, j;
|
||||||
|
const char ** midi_source_ports;
|
||||||
|
|
||||||
|
midi_source_ports = jack_get_ports(client, NULL, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput | JackPortIsTerminal);
|
||||||
|
if(midi_source_ports != NULL)
|
||||||
|
{
|
||||||
|
for(j = 0; midi_source_ports[j] != NULL; j++)
|
||||||
|
{
|
||||||
|
for(i = 0; i < midi_driver->midi_port_count; i++)
|
||||||
|
{
|
||||||
|
FLUID_LOG(FLUID_INFO, "jack midi autoconnect \"%s\" to \"%s\"", midi_source_ports[j], jack_port_name(midi_driver->midi_port[i]));
|
||||||
|
jack_connect(client, midi_source_ports[j], jack_port_name(midi_driver->midi_port[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jack_free(midi_source_ports);
|
||||||
|
}
|
||||||
|
|
||||||
|
midi_driver->autoconnect_is_outdated = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create Jack client as necessary, share clients of the same server.
|
* Create Jack client as necessary, share clients of the same server.
|
||||||
* @param settings Settings object
|
* @param settings Settings object
|
||||||
|
@ -213,6 +240,7 @@ new_fluid_jack_client(fluid_settings_t *settings, int isaudio, void *driver)
|
||||||
goto error_recovery;
|
goto error_recovery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jack_set_port_registration_callback(client_ref->client, fluid_jack_port_registration, client_ref);
|
||||||
jack_set_process_callback(client_ref->client, fluid_jack_driver_process, client_ref);
|
jack_set_process_callback(client_ref->client, fluid_jack_driver_process, client_ref);
|
||||||
jack_set_buffer_size_callback(client_ref->client, fluid_jack_driver_bufsize, client_ref);
|
jack_set_buffer_size_callback(client_ref->client, fluid_jack_driver_bufsize, client_ref);
|
||||||
jack_set_sample_rate_callback(client_ref->client, fluid_jack_driver_srate, client_ref);
|
jack_set_sample_rate_callback(client_ref->client, fluid_jack_driver_srate, client_ref);
|
||||||
|
@ -629,6 +657,11 @@ fluid_jack_driver_process(jack_nframes_t nframes, void *arg)
|
||||||
|
|
||||||
if(midi_driver)
|
if(midi_driver)
|
||||||
{
|
{
|
||||||
|
if(midi_driver->autoconnect_is_outdated)
|
||||||
|
{
|
||||||
|
fluid_jack_midi_autoconnect(client->client, midi_driver);
|
||||||
|
}
|
||||||
|
|
||||||
for(i = 0; i < midi_driver->midi_port_count; i++)
|
for(i = 0; i < midi_driver->midi_port_count; i++)
|
||||||
{
|
{
|
||||||
midi_buffer = jack_port_get_buffer(midi_driver->midi_port[i], 0);
|
midi_buffer = jack_port_get_buffer(midi_driver->midi_port[i], 0);
|
||||||
|
@ -728,6 +761,15 @@ fluid_jack_driver_shutdown(void *arg)
|
||||||
/* exit (1); */
|
/* exit (1); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fluid_jack_port_registration(jack_port_id_t port, int is_registering, void *arg)
|
||||||
|
{
|
||||||
|
fluid_jack_client_t *client_ref = (fluid_jack_client_t *)arg;
|
||||||
|
if(client_ref->midi_driver != NULL)
|
||||||
|
{
|
||||||
|
client_ref->midi_driver->autoconnect_is_outdated = client_ref->midi_driver->autoconnect_inputs && is_registering != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void fluid_jack_midi_driver_settings(fluid_settings_t *settings)
|
void fluid_jack_midi_driver_settings(fluid_settings_t *settings)
|
||||||
{
|
{
|
||||||
|
@ -770,6 +812,9 @@ new_fluid_jack_midi_driver(fluid_settings_t *settings,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fluid_settings_getint(settings, "midi.autoconnect", &dev->autoconnect_inputs);
|
||||||
|
dev->autoconnect_is_outdated = dev->autoconnect_inputs;
|
||||||
|
|
||||||
dev->client_ref = new_fluid_jack_client(settings, FALSE, dev);
|
dev->client_ref = new_fluid_jack_client(settings, FALSE, dev);
|
||||||
|
|
||||||
if(!dev->client_ref)
|
if(!dev->client_ref)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
/*
|
/*
|
||||||
* fluid_mdriver_definition
|
* fluid_mdriver_definition
|
||||||
*/
|
*/
|
||||||
struct fluid_mdriver_definition_t
|
struct _fluid_mdriver_definition_t
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
fluid_midi_driver_t *(*new)(fluid_settings_t *settings,
|
fluid_midi_driver_t *(*new)(fluid_settings_t *settings,
|
||||||
|
@ -36,7 +36,7 @@ struct fluid_mdriver_definition_t
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const struct fluid_mdriver_definition_t fluid_midi_drivers[] =
|
static const fluid_mdriver_definition_t fluid_midi_drivers[] =
|
||||||
{
|
{
|
||||||
#if ALSA_SUPPORT
|
#if ALSA_SUPPORT
|
||||||
{
|
{
|
||||||
|
@ -145,19 +145,18 @@ fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings, handle_mi
|
||||||
{
|
{
|
||||||
fluid_midi_driver_t *driver = NULL;
|
fluid_midi_driver_t *driver = NULL;
|
||||||
char *allnames;
|
char *allnames;
|
||||||
unsigned int i;
|
const fluid_mdriver_definition_t *def;
|
||||||
|
|
||||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers) - 1; i++)
|
for(def = fluid_midi_drivers; def->name != NULL; def++)
|
||||||
{
|
{
|
||||||
const char* name = fluid_midi_drivers[i].name;
|
if(fluid_settings_str_equal(settings, "midi.driver", def->name))
|
||||||
if(fluid_settings_str_equal(settings, "midi.driver", name))
|
|
||||||
{
|
{
|
||||||
FLUID_LOG(FLUID_DBG, "Using '%s' midi driver", name);
|
FLUID_LOG(FLUID_DBG, "Using '%s' midi driver", def->name);
|
||||||
driver = fluid_midi_drivers[i].new(settings, handler, event_handler_data);
|
driver = def->new(settings, handler, event_handler_data);
|
||||||
|
|
||||||
if(driver)
|
if(driver)
|
||||||
{
|
{
|
||||||
driver->name = name;
|
driver->define = def;
|
||||||
}
|
}
|
||||||
|
|
||||||
return driver;
|
return driver;
|
||||||
|
@ -176,9 +175,9 @@ fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings, handle_mi
|
||||||
{
|
{
|
||||||
FLUID_LOG(FLUID_INFO, "No MIDI drivers available.");
|
FLUID_LOG(FLUID_INFO, "No MIDI drivers available.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FLUID_FREE(allnames);
|
FLUID_FREE(allnames);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -189,15 +188,6 @@ fluid_midi_driver_t *new_fluid_midi_driver(fluid_settings_t *settings, handle_mi
|
||||||
*/
|
*/
|
||||||
void delete_fluid_midi_driver(fluid_midi_driver_t *driver)
|
void delete_fluid_midi_driver(fluid_midi_driver_t *driver)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
fluid_return_if_fail(driver != NULL);
|
fluid_return_if_fail(driver != NULL);
|
||||||
|
driver->define->free(driver);
|
||||||
for(i = 0; i < FLUID_N_ELEMENTS(fluid_midi_drivers) - 1; i++)
|
|
||||||
{
|
|
||||||
if(fluid_midi_drivers[i].name == driver->name)
|
|
||||||
{
|
|
||||||
fluid_midi_drivers[i].free(driver);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,11 @@
|
||||||
* fluid_midi_driver_t
|
* fluid_midi_driver_t
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef struct _fluid_mdriver_definition_t fluid_mdriver_definition_t;
|
||||||
|
|
||||||
struct _fluid_midi_driver_t
|
struct _fluid_midi_driver_t
|
||||||
{
|
{
|
||||||
const char *name;
|
const fluid_mdriver_definition_t *define;
|
||||||
handle_midi_event_func_t handler;
|
handle_midi_event_func_t handler;
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -88,7 +88,7 @@ static void fluid_synth_update_presets(fluid_synth_t *synth);
|
||||||
static void fluid_synth_update_gain_LOCAL(fluid_synth_t *synth);
|
static void fluid_synth_update_gain_LOCAL(fluid_synth_t *synth);
|
||||||
static int fluid_synth_update_polyphony_LOCAL(fluid_synth_t *synth, int new_polyphony);
|
static int fluid_synth_update_polyphony_LOCAL(fluid_synth_t *synth, int new_polyphony);
|
||||||
static void init_dither(void);
|
static void init_dither(void);
|
||||||
static FLUID_INLINE int roundi(float x);
|
static FLUID_INLINE int16_t round_clip_to_i16(float x);
|
||||||
static int fluid_synth_render_blocks(fluid_synth_t *synth, int blockcount);
|
static int fluid_synth_render_blocks(fluid_synth_t *synth, int blockcount);
|
||||||
|
|
||||||
static fluid_voice_t *fluid_synth_free_voice_by_kill_LOCAL(fluid_synth_t *synth);
|
static fluid_voice_t *fluid_synth_free_voice_by_kill_LOCAL(fluid_synth_t *synth);
|
||||||
|
@ -3807,17 +3807,28 @@ init_dither(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A portable replacement for roundf(), seems it may actually be faster too! */
|
/* A portable replacement for roundf(), seems it may actually be faster too! */
|
||||||
static FLUID_INLINE int
|
static FLUID_INLINE int16_t
|
||||||
roundi(float x)
|
round_clip_to_i16(float x)
|
||||||
{
|
{
|
||||||
|
long i;
|
||||||
if(x >= 0.0f)
|
if(x >= 0.0f)
|
||||||
{
|
{
|
||||||
return (int)(x + 0.5f);
|
i = (long)(x + 0.5f);
|
||||||
|
if (FLUID_UNLIKELY(i > 32767))
|
||||||
|
{
|
||||||
|
i = 32767;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (int)(x - 0.5f);
|
i = (long)(x - 0.5f);
|
||||||
|
if (FLUID_UNLIKELY(i < -32768))
|
||||||
|
{
|
||||||
|
i = -32768;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (int16_t)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3846,12 +3857,10 @@ fluid_synth_write_s16(fluid_synth_t *synth, int len,
|
||||||
void *rout, int roff, int rincr)
|
void *rout, int roff, int rincr)
|
||||||
{
|
{
|
||||||
int i, j, k, cur;
|
int i, j, k, cur;
|
||||||
signed short *left_out = (signed short *) lout;
|
int16_t *left_out = lout;
|
||||||
signed short *right_out = (signed short *) rout;
|
int16_t *right_out = rout;
|
||||||
fluid_real_t *left_in;
|
fluid_real_t *left_in;
|
||||||
fluid_real_t *right_in;
|
fluid_real_t *right_in;
|
||||||
fluid_real_t left_sample;
|
|
||||||
fluid_real_t right_sample;
|
|
||||||
double time = fluid_utime();
|
double time = fluid_utime();
|
||||||
int di;
|
int di;
|
||||||
float cpu_load;
|
float cpu_load;
|
||||||
|
@ -3876,39 +3885,13 @@ fluid_synth_write_s16(fluid_synth_t *synth, int len,
|
||||||
cur = 0;
|
cur = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
left_sample = roundi(left_in[0 * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + cur] * 32766.0f + rand_table[0][di]);
|
left_out[j] = round_clip_to_i16(left_in[0 * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + cur] * 32766.0f + rand_table[0][di]);
|
||||||
right_sample = roundi(right_in[0 * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + cur] * 32766.0f + rand_table[1][di]);
|
right_out[k] = round_clip_to_i16(right_in[0 * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + cur] * 32766.0f + rand_table[1][di]);
|
||||||
|
|
||||||
di++;
|
if(++di >= DITHER_SIZE)
|
||||||
|
|
||||||
if(di >= DITHER_SIZE)
|
|
||||||
{
|
{
|
||||||
di = 0;
|
di = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* digital clipping */
|
|
||||||
if(left_sample > 32767.0f)
|
|
||||||
{
|
|
||||||
left_sample = 32767.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(left_sample < -32768.0f)
|
|
||||||
{
|
|
||||||
left_sample = -32768.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(right_sample > 32767.0f)
|
|
||||||
{
|
|
||||||
right_sample = 32767.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(right_sample < -32768.0f)
|
|
||||||
{
|
|
||||||
right_sample = -32768.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
left_out[j] = (signed short) left_sample;
|
|
||||||
right_out[k] = (signed short) right_sample;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synth->cur = cur;
|
synth->cur = cur;
|
||||||
|
@ -3947,49 +3930,20 @@ fluid_synth_dither_s16(int *dither_index, int len, float *lin, float *rin,
|
||||||
void *rout, int roff, int rincr)
|
void *rout, int roff, int rincr)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
signed short *left_out = (signed short *) lout;
|
int16_t *left_out = lout;
|
||||||
signed short *right_out = (signed short *) rout;
|
int16_t *right_out = rout;
|
||||||
fluid_real_t left_sample;
|
|
||||||
fluid_real_t right_sample;
|
|
||||||
int di = *dither_index;
|
int di = *dither_index;
|
||||||
fluid_profile_ref_var(prof_ref);
|
fluid_profile_ref_var(prof_ref);
|
||||||
|
|
||||||
for(i = 0, j = loff, k = roff; i < len; i++, j += lincr, k += rincr)
|
for(i = 0, j = loff, k = roff; i < len; i++, j += lincr, k += rincr)
|
||||||
{
|
{
|
||||||
|
left_out[j] = round_clip_to_i16(lin[i] * 32766.0f + rand_table[0][di]);
|
||||||
|
right_out[k] = round_clip_to_i16(rin[i] * 32766.0f + rand_table[1][di]);
|
||||||
|
|
||||||
left_sample = roundi(lin[i] * 32766.0f + rand_table[0][di]);
|
if(++di >= DITHER_SIZE)
|
||||||
right_sample = roundi(rin[i] * 32766.0f + rand_table[1][di]);
|
|
||||||
|
|
||||||
di++;
|
|
||||||
|
|
||||||
if(di >= DITHER_SIZE)
|
|
||||||
{
|
{
|
||||||
di = 0;
|
di = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* digital clipping */
|
|
||||||
if(left_sample > 32767.0f)
|
|
||||||
{
|
|
||||||
left_sample = 32767.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(left_sample < -32768.0f)
|
|
||||||
{
|
|
||||||
left_sample = -32768.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(right_sample > 32767.0f)
|
|
||||||
{
|
|
||||||
right_sample = 32767.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(right_sample < -32768.0f)
|
|
||||||
{
|
|
||||||
right_sample = -32768.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
left_out[j] = (signed short) left_sample;
|
|
||||||
right_out[k] = (signed short) right_sample;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*dither_index = di; /* keep dither buffer continous */
|
*dither_index = di; /* keep dither buffer continous */
|
||||||
|
|
|
@ -1330,9 +1330,10 @@ fluid_istream_gets(fluid_istream_t in, char *buf, int len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef NETWORK_SUPPORT
|
||||||
n = recv(in & ~FLUID_SOCKET_FLAG, &c, 1, 0);
|
n = recv(in & ~FLUID_SOCKET_FLAG, &c, 1, 0);
|
||||||
|
|
||||||
if(n == SOCKET_ERROR)
|
if(n == SOCKET_ERROR)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1405,10 +1406,13 @@ fluid_ostream_printf(fluid_ostream_t out, const char *format, ...)
|
||||||
return write(out, buf, FLUID_STRLEN(buf));
|
return write(out, buf, FLUID_STRLEN(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NETWORK_SUPPORT
|
||||||
/* Socket */
|
/* Socket */
|
||||||
retval = send(out & ~FLUID_SOCKET_FLAG, buf, FLUID_STRLEN(buf), 0);
|
retval = send(out & ~FLUID_SOCKET_FLAG, buf, FLUID_STRLEN(buf), 0);
|
||||||
|
|
||||||
return retval != SOCKET_ERROR ? retval : -1;
|
return retval != SOCKET_ERROR ? retval : -1;
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,8 +137,6 @@ typedef guint64 uint64_t;
|
||||||
#include <ws2tcpip.h> /* Provides also socklen_t */
|
#include <ws2tcpip.h> /* Provides also socklen_t */
|
||||||
|
|
||||||
/* WIN32 special defines */
|
/* WIN32 special defines */
|
||||||
#define DSOUND_SUPPORT 1
|
|
||||||
#define WINMIDI_SUPPORT 1
|
|
||||||
#define STDIN_FILENO 0
|
#define STDIN_FILENO 0
|
||||||
#define STDOUT_FILENO 1
|
#define STDOUT_FILENO 1
|
||||||
#define STDERR_FILENO 2
|
#define STDERR_FILENO 2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue