mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-18 23:41:36 +00:00
Merge branch 'master' into cleanup21
This commit is contained in:
commit
46c2857fb0
37 changed files with 294 additions and 231 deletions
10
.cirrus.yml
Normal file
10
.cirrus.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
freebsd_instance:
|
||||
image: freebsd-12-0-release-amd64
|
||||
|
||||
task:
|
||||
install_script: pwd && ls -la && pkg install -y cmake glib alsa-lib ladspa portaudio pulseaudio pkgconf
|
||||
|
||||
compile_script: pwd && ls -la && mkdir $HOME/fluidsynth_install/ && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=0 .. && make -j4 && make check && make install
|
||||
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ set ( PACKAGE "fluidsynth" )
|
|||
# FluidSynth package version
|
||||
set ( FLUIDSYNTH_VERSION_MAJOR 2 )
|
||||
set ( FLUIDSYNTH_VERSION_MINOR 0 )
|
||||
set ( FLUIDSYNTH_VERSION_MICRO 3 )
|
||||
set ( FLUIDSYNTH_VERSION_MICRO 4 )
|
||||
set ( VERSION "${FLUIDSYNTH_VERSION_MAJOR}.${FLUIDSYNTH_VERSION_MINOR}.${FLUIDSYNTH_VERSION_MICRO}" )
|
||||
set ( FLUIDSYNTH_VERSION "\"${VERSION}\"" )
|
||||
|
||||
|
@ -44,7 +44,7 @@ set ( FLUIDSYNTH_VERSION "\"${VERSION}\"" )
|
|||
# This is not exactly the same algorithm as the libtool one, but the results are the same.
|
||||
set ( LIB_VERSION_CURRENT 2 )
|
||||
set ( LIB_VERSION_AGE 1 )
|
||||
set ( LIB_VERSION_REVISION 0 )
|
||||
set ( LIB_VERSION_REVISION 1 )
|
||||
set ( LIB_VERSION_INFO
|
||||
"${LIB_VERSION_CURRENT}.${LIB_VERSION_AGE}.${LIB_VERSION_REVISION}" )
|
||||
|
||||
|
@ -77,16 +77,15 @@ 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 )
|
||||
|
||||
# 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-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" )
|
||||
option ( enable-coreaudio "compile CoreAudio support (if it is available)" on )
|
||||
option ( enable-coremidi "compile CoreMIDI support (if it is available)" on )
|
||||
option ( enable-framework "create a Mac OSX style FluidSynth.framework" on )
|
||||
set ( enable-network off )
|
||||
endif ( CMAKE_SYSTEM MATCHES "Darwin" )
|
||||
|
||||
if ( CMAKE_SYSTEM MATCHES "OS2" )
|
||||
|
@ -95,7 +94,7 @@ if ( CMAKE_SYSTEM MATCHES "OS2" )
|
|||
endif ( CMAKE_SYSTEM MATCHES "OS2" )
|
||||
|
||||
# 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 )
|
||||
set ( _init_lib_suffix "64" )
|
||||
else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
||||
|
@ -465,6 +464,10 @@ else(NOT enable-pkgconfig)
|
|||
# Mandatory libraries: glib and gthread
|
||||
pkg_check_modules ( GLIB REQUIRED glib-2.0>=2.6.5 gthread-2.0>=2.6.5 )
|
||||
|
||||
if ( GLIB_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
|
||||
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_glib-2.0_VERSION AND GLIB_glib-2.0_VERSION VERSION_LESS "2.26.0" )
|
||||
|
||||
include ( UnsetPkgConfig )
|
||||
|
||||
# Optional features
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
| Build Status | glib < 2.30 | glib >= 2.30 |
|
||||
|---|---|---|
|
||||
| Linux/MacOSX| n.a. | [![Build Status Travis](https://travis-ci.org/FluidSynth/fluidsynth.svg?branch=master)](https://travis-ci.org/FluidSynth/fluidsynth/branches) |
|
||||
| FreeBSD | n.a. | [![Build Status](https://api.cirrus-ci.com/github/FluidSynth/fluidsynth.svg?branch=master)](https://cirrus-ci.com/github/FluidSynth/fluidsynth) |
|
||||
| Windows | [![Build status Appveyor](https://ci.appveyor.com/api/projects/status/n24ybk0dmttjwdk2/branch/master?svg=true)](https://ci.appveyor.com/project/derselbst/fluidsynth/branch/master) | [![Build status](https://ci.appveyor.com/api/projects/status/anbmtebt5uk4q1it/branch/master?svg=true)](https://ci.appveyor.com/project/derselbst/fluidsynth-g2ouw/branch/master) |
|
||||
|
||||
### FluidSynth is a software real-time synthesizer based on the Soundfont 2 specifications.
|
||||
|
|
|
@ -53,7 +53,11 @@ set (INFO_INSTALL_DIR "share/info" CACHE STRING "The info install dir")
|
|||
mark_as_advanced (INFO_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)
|
||||
|
||||
# SYSCONF_INSTALL_DIR - the config file install dir
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = libfluidsynth
|
||||
PROJECT_NUMBER = 2.0.3
|
||||
PROJECT_NUMBER = 2.0.4
|
||||
OUTPUT_DIRECTORY = api
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
\author David Henningsson
|
||||
\author Tom Moebert
|
||||
\author Copyright © 2003-2019 Peter Hanappe, Conrad Berhörster, Antoine Schmitt, Pedro López-Cabanillas, Josh Green, David Henningsson, Tom Moebert
|
||||
\version Revision 2.0.3
|
||||
\date 2019-01-01
|
||||
\version Revision 2.0.4
|
||||
\date 2019-02-09
|
||||
|
||||
All the source code examples in this document are in the public domain; you can use them as you please. This document is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ . The FluidSynth library is distributed under the GNU Lesser General Public License. A copy of the GNU Lesser General Public License is contained in the FluidSynth package; if not, visit http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
|
|
|
@ -18,12 +18,10 @@
|
|||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_cmd.h"
|
||||
#include "fluid_synth.h"
|
||||
#include "fluid_settings.h"
|
||||
#include "fluid_hash.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_midi_router.h"
|
||||
#include "fluid_sfont.h"
|
||||
#include "fluid_chan.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef _FLUID_CMD_H
|
||||
#define _FLUID_CMD_H
|
||||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
|
||||
|
||||
void fluid_shell_settings(fluid_settings_t *settings);
|
||||
|
|
|
@ -298,7 +298,7 @@ new_fluid_file_renderer(fluid_synth_t *synth)
|
|||
sf_command(dev->sndfile, SFC_SET_NORM_FLOAT, NULL, SF_TRUE);
|
||||
|
||||
#else
|
||||
dev->file = fopen(filename, "wb");
|
||||
dev->file = FLUID_FOPEN(filename, "wb");
|
||||
|
||||
if(dev->file == NULL)
|
||||
{
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
SOFTWARE.
|
||||
***/
|
||||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
|
||||
#ifdef DBUS_SUPPORT
|
||||
|
||||
#include "fluid_rtkit.h"
|
||||
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
@ -42,10 +42,17 @@
|
|||
#include <sys/syscall.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
static pid_t _gettid(void)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
return pthread_getthreadid_np();
|
||||
#else
|
||||
return (pid_t) syscall(SYS_gettid);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int translate_error(const char *name)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "fluid_adriver.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_settings.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef _FLUID_AUDRIVER_H
|
||||
#define _FLUID_AUDRIVER_H
|
||||
|
||||
#include "fluid_sys.h"
|
||||
#include "fluidsynth_priv.h"
|
||||
|
||||
/*
|
||||
* fluid_audio_driver_t
|
||||
|
|
|
@ -24,12 +24,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "fluid_synth.h"
|
||||
#include "fluid_midi.h"
|
||||
#include "fluid_adriver.h"
|
||||
#include "fluid_mdriver.h"
|
||||
#include "fluid_settings.h"
|
||||
|
||||
/*
|
||||
* !!! Make sure that no include above includes <netinet/tcp.h> !!!
|
||||
* It #defines some macros that collide with enum definitions of OpenTransportProviders.h, which is included from OSServices.h, included from CoreServices.h
|
||||
*
|
||||
* https://trac.macports.org/ticket/36962
|
||||
*/
|
||||
|
||||
#if COREAUDIO_SUPPORT
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <CoreAudio/CoreAudioTypes.h>
|
||||
|
|
|
@ -18,13 +18,7 @@
|
|||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
|
||||
#if !defined(WIN32) && !defined(MACINTOSH)
|
||||
#define _GNU_SOURCE
|
||||
|
@ -35,8 +29,6 @@
|
|||
#define GETOPT_SUPPORT 1
|
||||
#endif
|
||||
|
||||
#include "fluidsynth.h"
|
||||
|
||||
#include "fluid_lash.h"
|
||||
|
||||
|
||||
|
@ -629,6 +621,8 @@ int main(int argc, char **argv)
|
|||
case 's':
|
||||
#ifdef NETWORK_SUPPORT
|
||||
with_server = 1;
|
||||
#else
|
||||
printf("\nNOTE: FluidSynth compiled without network support, unable to start server!\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
|
@ -4,6 +4,12 @@ cmake_minimum_required(VERSION 3.1)
|
|||
# which hopefully will be the host compiler
|
||||
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)
|
||||
|
||||
set ( CMAKE_BUILD_TYPE Debug )
|
||||
|
|
|
@ -22,7 +22,7 @@ static void fluid_conversion_config(void)
|
|||
|
||||
for(i = 0; i < FLUID_CENTS_HZ_SIZE; i++)
|
||||
{
|
||||
fluid_ct2hz_tab[i] = pow(2.0, (double) i / 1200.0);
|
||||
fluid_ct2hz_tab[i] = powl(2.0, (double) i / 1200.0);
|
||||
}
|
||||
|
||||
/* centibels to amplitude conversion
|
||||
|
@ -32,7 +32,7 @@ static void fluid_conversion_config(void)
|
|||
*/
|
||||
for(i = 0; i < FLUID_CB_AMP_SIZE; i++)
|
||||
{
|
||||
fluid_cb2amp_tab[i] = pow(10.0, (double) i / -200.0);
|
||||
fluid_cb2amp_tab[i] = powl(10.0, (double) i / -200.0);
|
||||
}
|
||||
|
||||
/* initialize the conversion tables (see fluid_mod.c
|
||||
|
|
|
@ -34,6 +34,7 @@ static long fluid_getlength(unsigned char *s);
|
|||
* Note: This rewinds the file to the start before reading.
|
||||
* Returns NULL if there was an error reading or allocating memory.
|
||||
*/
|
||||
typedef FILE *fluid_file;
|
||||
static char *fluid_file_read_full(fluid_file fp, size_t *length);
|
||||
static void fluid_midi_event_set_sysex_LOCAL(fluid_midi_event_t *evt, int type, void *data, int size, int dynamic);
|
||||
static void fluid_midi_event_get_sysex_LOCAL(fluid_midi_event_t *evt, void **data, int *size);
|
||||
|
@ -92,17 +93,23 @@ static int fluid_midi_file_get_division(fluid_midi_file *midifile);
|
|||
*/
|
||||
int fluid_is_midifile(const char *filename)
|
||||
{
|
||||
FILE *fp = FLUID_FOPEN(filename, "rb");
|
||||
FILE *fp;
|
||||
uint32_t id;
|
||||
int retcode = FALSE;
|
||||
|
||||
do
|
||||
{
|
||||
if(fp == NULL)
|
||||
if(!fluid_file_test(filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
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)
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -18,10 +18,9 @@
|
|||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_phase.h"
|
||||
#include "fluid_rvoice.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_rvoice_dsp_tables.c"
|
||||
|
||||
/* Purpose:
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "fluid_sys.h"
|
||||
#include "fluid_rev.h"
|
||||
#include "fluid_chorus.h"
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_ladspa.h"
|
||||
#include "fluid_synth.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "fluid_samplecache.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluidsynth.h"
|
||||
#include "fluid_list.h"
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
FILE *fp = FLUID_FOPEN(filename, "rb");
|
||||
FILE *fp;
|
||||
uint32_t fcc;
|
||||
int retcode = FALSE;
|
||||
|
||||
do
|
||||
{
|
||||
if(fp == NULL)
|
||||
if(!fluid_file_test(filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
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)
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -24,7 +24,27 @@
|
|||
|
||||
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)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
|
||||
#include "fluid_tuning.h"
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_voice.h"
|
||||
#include "fluid_mod.h"
|
||||
#include "fluid_chan.h"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "fluid_lfo.h"
|
||||
#include "fluid_rvoice.h"
|
||||
#include "fluid_rvoice_event.h"
|
||||
#include "fluid_sys.h"
|
||||
|
||||
#define NO_CHANNEL 0xff
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "fluid_conv.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_conv_tables.c"
|
||||
|
||||
/*
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
* MT safe
|
||||
*/
|
||||
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
#include "fluid_hash.h"
|
||||
#include "fluid_list.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "fluid_ringbuffer.h"
|
||||
#include "fluidsynth_priv.h"
|
||||
#include "fluid_sys.h"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1331,12 +1331,12 @@ fluid_ostream_printf(fluid_ostream_t out, const char *format, ...)
|
|||
/* Handle write differently depending on if its a socket or file descriptor */
|
||||
if(!(out & FLUID_SOCKET_FLAG))
|
||||
{
|
||||
return write(out, buf, FLUID_STRLEN(buf));
|
||||
return write(out, buf, (unsigned int)FLUID_STRLEN(buf));
|
||||
}
|
||||
|
||||
#ifdef NETWORK_SUPPORT
|
||||
/* Socket */
|
||||
retval = send(out & ~FLUID_SOCKET_FLAG, buf, FLUID_STRLEN(buf), 0);
|
||||
retval = send(out & ~FLUID_SOCKET_FLAG, buf, (int)FLUID_STRLEN(buf), 0);
|
||||
return retval != SOCKET_ERROR ? retval : -1;
|
||||
#else
|
||||
return -1;
|
||||
|
|
|
@ -20,17 +20,20 @@
|
|||
|
||||
|
||||
/**
|
||||
|
||||
This header contains a bunch of (mostly) system and machine
|
||||
dependent functions:
|
||||
|
||||
- timers
|
||||
- current time in milliseconds and microseconds
|
||||
- debug logging
|
||||
- profiling
|
||||
- memory locking
|
||||
- checking for floating point exceptions
|
||||
|
||||
* @file fluid_sys.h
|
||||
*
|
||||
* This header contains a bunch of (mostly) system and machine
|
||||
* dependent functions:
|
||||
*
|
||||
* - timers
|
||||
* - current time in milliseconds and microseconds
|
||||
* - debug logging
|
||||
* - profiling
|
||||
* - memory locking
|
||||
* - checking for floating point exceptions
|
||||
*
|
||||
* fluidsynth's wrapper OSAL so to say; include it in .c files, be careful to include
|
||||
* it in fluidsynth's private header files (see comment in fluid_coreaudio.c)
|
||||
*/
|
||||
|
||||
#ifndef _FLUID_SYS_H
|
||||
|
@ -38,6 +41,120 @@
|
|||
|
||||
#include "fluidsynth_priv.h"
|
||||
|
||||
#if HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_IO_H
|
||||
#include <io.h> // _open(), _close(), read(), write() on windows
|
||||
#endif
|
||||
|
||||
#if HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
/** Integer types */
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
|
||||
#else
|
||||
|
||||
/* Assume GLIB types */
|
||||
typedef gint8 int8_t;
|
||||
typedef guint8 uint8_t;
|
||||
typedef gint16 int16_t;
|
||||
typedef guint16 uint16_t;
|
||||
typedef gint32 int32_t;
|
||||
typedef guint32 uint32_t;
|
||||
typedef gint64 int64_t;
|
||||
typedef guint64 uint64_t;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && HAVE_WINDOWS_H
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h> /* Provides also socklen_t */
|
||||
|
||||
/* WIN32 special defines */
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4244)
|
||||
#pragma warning(disable : 4101)
|
||||
#pragma warning(disable : 4305)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Darwin special defines (taken from config_macosx.h) */
|
||||
#ifdef DARWIN
|
||||
# define MACINTOSH
|
||||
# define __Types__
|
||||
#endif
|
||||
|
||||
#ifdef LADSPA
|
||||
#include <gmodule.h>
|
||||
#endif
|
||||
|
@ -52,26 +169,12 @@
|
|||
*/
|
||||
#define fluid_gerror_message(err) ((err) ? err->message : "No error details")
|
||||
|
||||
/* Misc */
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define FLUID_RESTRICT restrict
|
||||
#elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
|
||||
#define FLUID_RESTRICT __restrict__
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#define FLUID_RESTRICT __restrict
|
||||
#else
|
||||
#warning "Dont know how this compiler handles restrict pointers, refuse to use them."
|
||||
#define FLUID_RESTRICT
|
||||
#endif
|
||||
|
||||
#define FLUID_INLINE inline
|
||||
#define FLUID_POINTER_TO_UINT GPOINTER_TO_UINT
|
||||
#define FLUID_UINT_TO_POINTER GUINT_TO_POINTER
|
||||
#define FLUID_POINTER_TO_INT GPOINTER_TO_INT
|
||||
#define FLUID_INT_TO_POINTER GINT_TO_POINTER
|
||||
#define FLUID_N_ELEMENTS(struct) (sizeof (struct) / sizeof (struct[0]))
|
||||
#define FLUID_MEMBER_SIZE(struct, member) ( sizeof (((struct *)0)->member) )
|
||||
|
||||
#define FLUID_IS_BIG_ENDIAN (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
|
||||
#define FLUID_LE32TOH(x) GINT32_FROM_LE(x)
|
||||
|
@ -85,17 +188,6 @@
|
|||
(uint32_t)(((uint32_t)(_d) << 24) | ((uint32_t)(_c) << 16) | ((uint32_t)(_b) << 8) | (uint32_t)(_a))
|
||||
#endif
|
||||
|
||||
|
||||
#define fluid_return_if_fail(cond) \
|
||||
if(cond) \
|
||||
; \
|
||||
else \
|
||||
return
|
||||
|
||||
#define fluid_return_val_if_fail(cond, val) \
|
||||
fluid_return_if_fail(cond) (val)
|
||||
|
||||
|
||||
/*
|
||||
* Utility functions
|
||||
*/
|
||||
|
@ -361,6 +453,12 @@ fluid_ostream_t fluid_get_stdout(void);
|
|||
int fluid_istream_readline(fluid_istream_t in, fluid_ostream_t out, char *prompt, char *buf, int len);
|
||||
int fluid_ostream_printf(fluid_ostream_t out, const char *format, ...);
|
||||
|
||||
#if defined(WIN32)
|
||||
typedef SOCKET fluid_socket_t;
|
||||
#else
|
||||
typedef int fluid_socket_t;
|
||||
#endif
|
||||
|
||||
/* The function should return 0 if no error occured, non-zero
|
||||
otherwise. If the function return non-zero, the socket will be
|
||||
closed by the server. */
|
||||
|
@ -374,25 +472,26 @@ fluid_istream_t fluid_socket_get_istream(fluid_socket_t sock);
|
|||
fluid_ostream_t fluid_socket_get_ostream(fluid_socket_t sock);
|
||||
|
||||
/* File access */
|
||||
#define fluid_stat(_filename, _statbuf) g_stat((_filename), (_statbuf))
|
||||
#if !GLIB_CHECK_VERSION(2, 26, 0)
|
||||
/* 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
|
||||
*/
|
||||
#if defined(WIN32) || HAVE_WINDOWS_H // somehow reliably mock G_OS_WIN32??
|
||||
#if defined (_MSC_VER) && !defined(_WIN64)
|
||||
typedef struct _stat32 fluid_stat_buf_t;
|
||||
#else
|
||||
typedef struct _stat fluid_stat_buf_t;
|
||||
#endif
|
||||
// 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.
|
||||
// Disable it (the user has been warned by cmake).
|
||||
#undef fluid_stat
|
||||
#define fluid_stat(_filename, _statbuf) (-1)
|
||||
typedef struct _fluid_stat_buf_t{int st_mtime;} fluid_stat_buf_t;
|
||||
#else
|
||||
/* posix, OS/2, etc. */
|
||||
typedef struct stat fluid_stat_buf_t;
|
||||
/* posix, OS/2, etc. */
|
||||
typedef struct stat fluid_stat_buf_t;
|
||||
#endif
|
||||
#else
|
||||
typedef GStatBuf fluid_stat_buf_t;
|
||||
#endif
|
||||
#define fluid_stat(_filename, _statbuf) g_stat((_filename), (_statbuf))
|
||||
|
||||
#define fluid_file_test g_file_test
|
||||
|
||||
/* Profiling */
|
||||
#if WITH_PROFILING
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
* 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file fluidsynth_priv.h
|
||||
*
|
||||
* lightweight part of fluid_sys.h, containing forward declarations of fluidsynth's private types and private macros
|
||||
*
|
||||
* include this one file in fluidsynth's private header files
|
||||
*/
|
||||
|
||||
#ifndef _FLUIDSYNTH_PRIV_H
|
||||
#define _FLUIDSYNTH_PRIV_H
|
||||
|
@ -26,136 +33,18 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(__POWERPC__) && !(defined(__APPLE__) && defined(__MACH__))
|
||||
#include "config_maxmsp43.h"
|
||||
#if HAVE_STDLIB_H
|
||||
#include <stdlib.h> // malloc, free
|
||||
#endif
|
||||
|
||||
#if HAVE_STDIO_H
|
||||
#include <stdio.h> // printf
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_IO_H
|
||||
#include <io.h> // _open(), _close(), read(), write() on windows
|
||||
#endif
|
||||
|
||||
#if HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
/** Integer types */
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
|
||||
#else
|
||||
|
||||
/* Assume GLIB types */
|
||||
typedef gint8 int8_t;
|
||||
typedef guint8 uint8_t;
|
||||
typedef gint16 int16_t;
|
||||
typedef guint16 uint16_t;
|
||||
typedef gint32 int32_t;
|
||||
typedef guint32 uint32_t;
|
||||
typedef gint64 int64_t;
|
||||
typedef guint64 uint64_t;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && HAVE_WINDOWS_H
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h> /* Provides also socklen_t */
|
||||
|
||||
/* WIN32 special defines */
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4244)
|
||||
#pragma warning(disable : 4101)
|
||||
#pragma warning(disable : 4305)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Darwin special defines (taken from config_macosx.h) */
|
||||
#ifdef DARWIN
|
||||
# define MACINTOSH
|
||||
# define __Types__
|
||||
#endif
|
||||
|
||||
|
||||
#include "fluidsynth.h"
|
||||
|
||||
|
@ -171,13 +60,6 @@ typedef float fluid_real_t;
|
|||
typedef double fluid_real_t;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(WIN32)
|
||||
typedef SOCKET fluid_socket_t;
|
||||
#else
|
||||
typedef int fluid_socket_t;
|
||||
#endif
|
||||
|
||||
#if defined(SUPPORTS_VLA)
|
||||
# define FLUID_DECLARE_VLA(_type, _name, _len) \
|
||||
_type _name[_len]
|
||||
|
@ -243,7 +125,6 @@ typedef void (*fluid_rvoice_function_t)(void *obj, const fluid_rvoice_param_t pa
|
|||
*
|
||||
* SYSTEM INTERFACE
|
||||
*/
|
||||
typedef FILE *fluid_file;
|
||||
|
||||
#define FLUID_MALLOC(_n) malloc(_n)
|
||||
#define FLUID_REALLOC(_p,_n) realloc(_p,_n)
|
||||
|
@ -352,4 +233,30 @@ do { strncpy(_dst,_src,_n); \
|
|||
#define FLUID_LIKELY G_LIKELY
|
||||
#define FLUID_UNLIKELY G_UNLIKELY
|
||||
|
||||
/* Misc */
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define FLUID_RESTRICT restrict
|
||||
#elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
|
||||
#define FLUID_RESTRICT __restrict__
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#define FLUID_RESTRICT __restrict
|
||||
#else
|
||||
#warning "Dont know how this compiler handles restrict pointers, refuse to use them."
|
||||
#define FLUID_RESTRICT
|
||||
#endif
|
||||
|
||||
#define FLUID_N_ELEMENTS(struct) (sizeof (struct) / sizeof (struct[0]))
|
||||
#define FLUID_MEMBER_SIZE(struct, member) ( sizeof (((struct *)0)->member) )
|
||||
|
||||
|
||||
#define fluid_return_if_fail(cond) \
|
||||
if(cond) \
|
||||
; \
|
||||
else \
|
||||
return
|
||||
|
||||
#define fluid_return_val_if_fail(cond, val) \
|
||||
fluid_return_if_fail(cond) (val)
|
||||
|
||||
|
||||
#endif /* _FLUIDSYNTH_PRIV_H */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "fluidsynth.h"
|
||||
#include "sfloader/fluid_sfont.h"
|
||||
#include "sfloader/fluid_defsfont.h"
|
||||
#include "utils/fluidsynth_priv.h"
|
||||
#include "utils/fluid_sys.h"
|
||||
#include "utils/fluid_list.h"
|
||||
|
||||
// load our sf2 and sf3 test soundfonts, with and without dynamic sample loading
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "test.h"
|
||||
#include "fluidsynth.h" // use local fluidsynth header
|
||||
#include "utils/fluidsynth_priv.h"
|
||||
#include "utils/fluid_sys.h"
|
||||
|
||||
|
||||
// this test aims to make sure that sample data used by multiple synths is not freed
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "synth/fluid_synth.h"
|
||||
#include "synth/fluid_voice.h"
|
||||
#include "rvoice/fluid_rvoice.h"
|
||||
#include "utils/fluidsynth_priv.h"
|
||||
#include "utils/fluid_sys.h"
|
||||
|
||||
static void verify_sample_rate(fluid_synth_t *synth, int expected_srate)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "test.h"
|
||||
#include "fluidsynth.h"
|
||||
#include "sfloader/fluid_sfont.h"
|
||||
#include "utils/fluidsynth_priv.h"
|
||||
#include "utils/fluid_sys.h"
|
||||
|
||||
|
||||
int main(void)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "test.h"
|
||||
#include "fluidsynth.h"
|
||||
#include "sfloader/fluid_sfont.h"
|
||||
#include "utils/fluidsynth_priv.h"
|
||||
#include "utils/fluid_sys.h"
|
||||
|
||||
|
||||
// this tests the soundfont loading API of the synth.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "test.h"
|
||||
#include "utils/fluidsynth_priv.h"
|
||||
#include "utils/fluid_sys.h"
|
||||
|
||||
// this test makes sure FLUID_SNPRINTF uses a proper C99 compliant implementation
|
||||
|
||||
|
|
Loading…
Reference in a new issue