mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 06:51:54 +00:00
Merge branch '2.0.x' into master
This commit is contained in:
commit
aa65624f8c
9 changed files with 75 additions and 21 deletions
|
@ -77,10 +77,10 @@ option ( enable-readline "compile readline lib line editing (if it is available)
|
||||||
option ( enable-threads "enable multi-threading support (such as parallel voice synthesis)" on )
|
option ( enable-threads "enable multi-threading support (such as parallel voice synthesis)" on )
|
||||||
|
|
||||||
# Platform specific options
|
# Platform specific options
|
||||||
if ( CMAKE_SYSTEM MATCHES "Linux" )
|
if ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly" )
|
||||||
option ( enable-lash "compile LASH support (if it is available)" on )
|
option ( enable-lash "compile LASH support (if it is available)" on )
|
||||||
option ( enable-alsa "compile ALSA support (if it is available)" on )
|
option ( enable-alsa "compile ALSA support (if it is available)" on )
|
||||||
endif ( CMAKE_SYSTEM MATCHES "Linux" )
|
endif ( CMAKE_SYSTEM MATCHES "Linux|FreeBSD|DragonFly" )
|
||||||
|
|
||||||
if ( CMAKE_SYSTEM MATCHES "Darwin" )
|
if ( CMAKE_SYSTEM MATCHES "Darwin" )
|
||||||
option ( enable-coreaudio "compile CoreAudio support (if it is available)" on )
|
option ( enable-coreaudio "compile CoreAudio support (if it is available)" on )
|
||||||
|
@ -95,7 +95,7 @@ if ( CMAKE_SYSTEM MATCHES "OS2" )
|
||||||
endif ( CMAKE_SYSTEM MATCHES "OS2" )
|
endif ( CMAKE_SYSTEM MATCHES "OS2" )
|
||||||
|
|
||||||
# Initialize the library directory name suffix.
|
# Initialize the library directory name suffix.
|
||||||
if (NOT MINGW AND NOT MSVC)
|
if (NOT MINGW AND NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD|DragonFly")
|
||||||
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||||
set ( _init_lib_suffix "64" )
|
set ( _init_lib_suffix "64" )
|
||||||
else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||||
|
@ -465,6 +465,10 @@ else(NOT enable-pkgconfig)
|
||||||
# Mandatory libraries: glib and gthread
|
# Mandatory libraries: glib and gthread
|
||||||
pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 )
|
pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 )
|
||||||
|
|
||||||
|
if ( GLIB_VERSION VERSION_LESS "2.26" )
|
||||||
|
message ( WARNING "Your version of glib is very old. This may cause problems with fluidsynth's sample cache on Windows. Consider updating to glib 2.26 or newer!" )
|
||||||
|
endif ( GLIB_VERSION VERSION_LESS "2.26" )
|
||||||
|
|
||||||
include ( UnsetPkgConfig )
|
include ( UnsetPkgConfig )
|
||||||
|
|
||||||
# Optional features
|
# Optional features
|
||||||
|
|
|
@ -53,7 +53,11 @@ set (INFO_INSTALL_DIR "share/info" CACHE STRING "The info install dir")
|
||||||
mark_as_advanced (INFO_INSTALL_DIR)
|
mark_as_advanced (INFO_INSTALL_DIR)
|
||||||
|
|
||||||
# MAN_INSTALL_DIR - the man pages install dir
|
# MAN_INSTALL_DIR - the man pages install dir
|
||||||
set (MAN_INSTALL_DIR "share/man/man1" CACHE STRING "The man pages install dir")
|
if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD|DragonFly")
|
||||||
|
set (MAN_INSTALL_DIR "man/man1" CACHE STRING "The man pages install dir")
|
||||||
|
else()
|
||||||
|
set (MAN_INSTALL_DIR "share/man/man1" CACHE STRING "The man pages install dir")
|
||||||
|
endif()
|
||||||
mark_as_advanced (MAN_INSTALL_DIR)
|
mark_as_advanced (MAN_INSTALL_DIR)
|
||||||
|
|
||||||
# SYSCONF_INSTALL_DIR - the config file install dir
|
# SYSCONF_INSTALL_DIR - the config file install dir
|
||||||
|
|
|
@ -298,7 +298,7 @@ new_fluid_file_renderer(fluid_synth_t *synth)
|
||||||
sf_command(dev->sndfile, SFC_SET_NORM_FLOAT, NULL, SF_TRUE);
|
sf_command(dev->sndfile, SFC_SET_NORM_FLOAT, NULL, SF_TRUE);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
dev->file = fopen(filename, "wb");
|
dev->file = FLUID_FOPEN(filename, "wb");
|
||||||
|
|
||||||
if(dev->file == NULL)
|
if(dev->file == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "fluid_rtkit.h"
|
#include "fluid_rtkit.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
@ -42,10 +42,17 @@
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static pid_t _gettid(void)
|
static pid_t _gettid(void)
|
||||||
{
|
{
|
||||||
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
return pthread_getthreadid_np();
|
||||||
|
#else
|
||||||
return (pid_t) syscall(SYS_gettid);
|
return (pid_t) syscall(SYS_gettid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int translate_error(const char *name)
|
static int translate_error(const char *name)
|
||||||
|
|
|
@ -4,6 +4,12 @@ cmake_minimum_required(VERSION 3.1)
|
||||||
# which hopefully will be the host compiler
|
# which hopefully will be the host compiler
|
||||||
unset(ENV{CC})
|
unset(ENV{CC})
|
||||||
|
|
||||||
|
# also unset $CFLAGS to avoid passing any cross compilation flags to the host compiler
|
||||||
|
unset(ENV{CFLAGS})
|
||||||
|
|
||||||
|
# linker flags as well
|
||||||
|
unset(ENV{LDFLAGS})
|
||||||
|
|
||||||
project (gentables C)
|
project (gentables C)
|
||||||
|
|
||||||
set ( CMAKE_BUILD_TYPE Debug )
|
set ( CMAKE_BUILD_TYPE Debug )
|
||||||
|
|
|
@ -92,17 +92,23 @@ static int fluid_midi_file_get_division(fluid_midi_file *midifile);
|
||||||
*/
|
*/
|
||||||
int fluid_is_midifile(const char *filename)
|
int fluid_is_midifile(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *fp = FLUID_FOPEN(filename, "rb");
|
FILE *fp;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
int retcode = FALSE;
|
int retcode = FALSE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(fp == NULL)
|
if(!fluid_file_test(filename, G_FILE_TEST_IS_REGULAR))
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// file seems to exist and is a regular file or a symlink to such
|
||||||
|
if((fp = FLUID_FOPEN(filename, "rb")) == NULL)
|
||||||
|
{
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
if(FLUID_FREAD(&id, sizeof(id), 1, fp) != 1)
|
if(FLUID_FREAD(&id, sizeof(id), 1, fp) != 1)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -334,17 +334,23 @@ static int fluid_sffile_read_wav(SFData *sf, unsigned int start, unsigned int en
|
||||||
*/
|
*/
|
||||||
int fluid_is_soundfont(const char *filename)
|
int fluid_is_soundfont(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *fp = FLUID_FOPEN(filename, "rb");
|
FILE *fp;
|
||||||
uint32_t fcc;
|
uint32_t fcc;
|
||||||
int retcode = FALSE;
|
int retcode = FALSE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(fp == NULL)
|
if(!fluid_file_test(filename, G_FILE_TEST_IS_REGULAR))
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// file seems to exist and is a regular file or a symlink to such
|
||||||
|
if((fp = FLUID_FOPEN(filename, "rb")) == NULL)
|
||||||
|
{
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
if(FLUID_FREAD(&fcc, sizeof(fcc), 1, fp) != 1)
|
if(FLUID_FREAD(&fcc, sizeof(fcc), 1, fp) != 1)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,7 +24,27 @@
|
||||||
|
|
||||||
void *default_fopen(const char *path)
|
void *default_fopen(const char *path)
|
||||||
{
|
{
|
||||||
return FLUID_FOPEN(path, "rb");
|
FILE* handle;
|
||||||
|
|
||||||
|
if(!fluid_file_test(path, G_FILE_TEST_EXISTS))
|
||||||
|
{
|
||||||
|
FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Unable to load non-existent file. ('%s')", path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!fluid_file_test(path, G_FILE_TEST_IS_REGULAR))
|
||||||
|
{
|
||||||
|
FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Refusing to load non-regular file! ('%s')", path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((handle = FLUID_FOPEN(path, "rb")) == NULL)
|
||||||
|
{
|
||||||
|
FLUID_LOG(FLUID_ERR, "fluid_sfloader_load(): Specified file does not exists or insufficient permissions to open it! ('%s')", path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
int default_fclose(void *handle)
|
int default_fclose(void *handle)
|
||||||
|
|
|
@ -374,25 +374,26 @@ fluid_istream_t fluid_socket_get_istream(fluid_socket_t sock);
|
||||||
fluid_ostream_t fluid_socket_get_ostream(fluid_socket_t sock);
|
fluid_ostream_t fluid_socket_get_ostream(fluid_socket_t sock);
|
||||||
|
|
||||||
/* File access */
|
/* File access */
|
||||||
|
#define fluid_stat(_filename, _statbuf) g_stat((_filename), (_statbuf))
|
||||||
#if !GLIB_CHECK_VERSION(2, 26, 0)
|
#if !GLIB_CHECK_VERSION(2, 26, 0)
|
||||||
/* GStatBuf has not been introduced yet, manually typedef to what they had at that time:
|
/* GStatBuf has not been introduced yet, manually typedef to what they had at that time:
|
||||||
* https://github.com/GNOME/glib/blob/e7763678b56e3be073cc55d707a6e92fc2055ee0/glib/gstdio.h#L98-L115
|
* https://github.com/GNOME/glib/blob/e7763678b56e3be073cc55d707a6e92fc2055ee0/glib/gstdio.h#L98-L115
|
||||||
*/
|
*/
|
||||||
#if defined(WIN32) || HAVE_WINDOWS_H // somehow reliably mock G_OS_WIN32??
|
#if defined(WIN32) || HAVE_WINDOWS_H // somehow reliably mock G_OS_WIN32??
|
||||||
#if defined (_MSC_VER) && !defined(_WIN64)
|
// Any effort from our side to reliably mock GStatBuf on Windows is in vain. E.g. glib-2.16 is broken as it uses struct stat rather than struct _stat32 on Win x86.
|
||||||
typedef struct _stat32 fluid_stat_buf_t;
|
// Disable it (the user has been warned by cmake).
|
||||||
#else
|
#undef fluid_stat
|
||||||
typedef struct _stat fluid_stat_buf_t;
|
#define fluid_stat(_filename, _statbuf) (-1)
|
||||||
#endif
|
typedef struct _fluid_stat_buf_t{int st_mtime;} fluid_stat_buf_t;
|
||||||
#else
|
#else
|
||||||
/* posix, OS/2, etc. */
|
/* posix, OS/2, etc. */
|
||||||
typedef struct stat fluid_stat_buf_t;
|
typedef struct stat fluid_stat_buf_t;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
typedef GStatBuf fluid_stat_buf_t;
|
typedef GStatBuf fluid_stat_buf_t;
|
||||||
#endif
|
#endif
|
||||||
#define fluid_stat(_filename, _statbuf) g_stat((_filename), (_statbuf))
|
|
||||||
|
|
||||||
|
#define fluid_file_test g_file_test
|
||||||
|
|
||||||
/* Profiling */
|
/* Profiling */
|
||||||
#if WITH_PROFILING
|
#if WITH_PROFILING
|
||||||
|
|
Loading…
Reference in a new issue