mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 06:51:54 +00:00
Introduce enable-threads option to cmake (#463)
This commit is contained in:
parent
29c668683f
commit
fe92a0a655
5 changed files with 20 additions and 3 deletions
|
@ -72,6 +72,7 @@ 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 )
|
||||||
|
option ( enable-threads "enable threads support on multi-processor systems" on )
|
||||||
|
|
||||||
# Platform specific options
|
# Platform specific options
|
||||||
if ( CMAKE_SYSTEM MATCHES "Linux" )
|
if ( CMAKE_SYSTEM MATCHES "Linux" )
|
||||||
|
@ -576,6 +577,11 @@ else ( enable-readline )
|
||||||
unset ( READLINE_LIBS CACHE )
|
unset ( READLINE_LIBS CACHE )
|
||||||
endif ( enable-readline )
|
endif ( enable-readline )
|
||||||
|
|
||||||
|
unset ( ENABLE_MIXER_THREADS CACHE )
|
||||||
|
if ( enable-threads )
|
||||||
|
set ( ENABLE_MIXER_THREADS 1 )
|
||||||
|
endif ( enable-threads )
|
||||||
|
|
||||||
unset ( HAVE_OPENMP CACHE )
|
unset ( HAVE_OPENMP CACHE )
|
||||||
find_package ( OpenMP QUIET )
|
find_package ( OpenMP QUIET )
|
||||||
if ( OpenMP_FOUND OR OpenMP_C_FOUND )
|
if ( OpenMP_FOUND OR OpenMP_C_FOUND )
|
||||||
|
|
|
@ -146,6 +146,12 @@ else ( HAVE_OPENMP )
|
||||||
message ( "OpenMP 4.0: no" )
|
message ( "OpenMP 4.0: no" )
|
||||||
endif ( HAVE_OPENMP )
|
endif ( HAVE_OPENMP )
|
||||||
|
|
||||||
|
if ( ENABLE_MIXER_THREADS )
|
||||||
|
message ( "Multi-thread support yes" )
|
||||||
|
else ( ENABLE_MIXER_THREADS )
|
||||||
|
message ( "Multi-thread support no" )
|
||||||
|
endif ( ENABLE_MIXER_THREADS )
|
||||||
|
|
||||||
if ( ENABLE_DEBUG )
|
if ( ENABLE_DEBUG )
|
||||||
message ( "Debug: yes" )
|
message ( "Debug: yes" )
|
||||||
else ( ENABLE_DEBUG )
|
else ( ENABLE_DEBUG )
|
||||||
|
|
|
@ -76,6 +76,9 @@
|
||||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||||
#cmakedefine HAVE_NETINET_TCP_H @HAVE_NETINET_TCP_H@
|
#cmakedefine HAVE_NETINET_TCP_H @HAVE_NETINET_TCP_H@
|
||||||
|
|
||||||
|
/* Define if compiling the mixer with multi-thread support */
|
||||||
|
#cmakedefine ENABLE_MIXER_THREADS @ENABLE_MIXER_THREADS@
|
||||||
|
|
||||||
/* Define if compiling with openMP to enable parallel audio rendering */
|
/* Define if compiling with openMP to enable parallel audio rendering */
|
||||||
#cmakedefine HAVE_OPENMP @HAVE_OPENMP@
|
#cmakedefine HAVE_OPENMP @HAVE_OPENMP@
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include "fluid_synth.h"
|
#include "fluid_synth.h"
|
||||||
|
|
||||||
|
|
||||||
#define ENABLE_MIXER_THREADS 1
|
|
||||||
|
|
||||||
// If less than x voices, the thread overhead is larger than the gain,
|
// If less than x voices, the thread overhead is larger than the gain,
|
||||||
// so don't activate the thread(s).
|
// so don't activate the thread(s).
|
||||||
#define VOICES_PER_THREAD 8
|
#define VOICES_PER_THREAD 8
|
||||||
|
|
|
@ -222,8 +222,12 @@ void fluid_synth_settings(fluid_settings_t *settings)
|
||||||
fluid_settings_register_int(settings, "synth.effects-groups", 1, 1, 128, 0);
|
fluid_settings_register_int(settings, "synth.effects-groups", 1, 1, 128, 0);
|
||||||
fluid_settings_register_num(settings, "synth.sample-rate", 44100.0f, 8000.0f, 96000.0f, 0);
|
fluid_settings_register_num(settings, "synth.sample-rate", 44100.0f, 8000.0f, 96000.0f, 0);
|
||||||
fluid_settings_register_int(settings, "synth.device-id", 0, 0, 126, 0);
|
fluid_settings_register_int(settings, "synth.device-id", 0, 0, 126, 0);
|
||||||
|
#ifdef ENABLE_MIXER_THREADS
|
||||||
fluid_settings_register_int(settings, "synth.cpu-cores", 1, 1, 256, 0);
|
fluid_settings_register_int(settings, "synth.cpu-cores", 1, 1, 256, 0);
|
||||||
|
#else
|
||||||
|
fluid_settings_register_int(settings, "synth.cpu-cores", 1, 1, 1, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
fluid_settings_register_int(settings, "synth.min-note-length", 10, 0, 65535, 0);
|
fluid_settings_register_int(settings, "synth.min-note-length", 10, 0, 65535, 0);
|
||||||
|
|
||||||
fluid_settings_register_int(settings, "synth.threadsafe-api", 1, 0, 1, FLUID_HINT_TOGGLED);
|
fluid_settings_register_int(settings, "synth.threadsafe-api", 1, 0, 1, FLUID_HINT_TOGGLED);
|
||||||
|
|
Loading…
Reference in a new issue