fix building CoreAudio on OSX 10.4

by cleaning up fluidsynth's private includes
This commit is contained in:
derselbst 2019-02-15 12:28:22 +01:00
parent 5c4ff485c2
commit 9ef169cb00
25 changed files with 201 additions and 200 deletions

View File

@ -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"

View File

@ -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);

View File

@ -25,7 +25,7 @@
SOFTWARE.
***/
#include "fluidsynth_priv.h"
#include "fluid_sys.h"
#ifdef DBUS_SUPPORT

View File

@ -19,6 +19,7 @@
*/
#include "fluid_adriver.h"
#include "fluid_sys.h"
#include "fluid_settings.h"
/*

View File

@ -21,7 +21,7 @@
#ifndef _FLUID_AUDRIVER_H
#define _FLUID_AUDRIVER_H
#include "fluid_sys.h"
#include "fluidsynth_priv.h"
/*
* fluid_audio_driver_t

View File

@ -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>

View File

@ -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"

View File

@ -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);

View File

@ -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:

View File

@ -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"

View File

@ -29,7 +29,6 @@
#include "fluid_samplecache.h"
#include "fluid_sys.h"
#include "fluidsynth.h"
#include "fluid_list.h"

View File

@ -20,7 +20,6 @@
#include "fluid_tuning.h"
#include "fluidsynth_priv.h"
#include "fluid_sys.h"

View File

@ -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"

View File

@ -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

View File

@ -19,6 +19,7 @@
*/
#include "fluid_conv.h"
#include "fluid_sys.h"
#include "fluid_conv_tables.c"
/*

View File

@ -31,7 +31,7 @@
* MT safe
*/
#include "fluidsynth_priv.h"
#include "fluid_sys.h"
#include "fluid_hash.h"
#include "fluid_list.h"

View File

@ -24,7 +24,7 @@
*/
#include "fluid_ringbuffer.h"
#include "fluidsynth_priv.h"
#include "fluid_sys.h"
/**

View File

@ -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,124 @@
#include "fluidsynth_priv.h"
#if defined(__POWERPC__) && !(defined(__APPLE__) && defined(__MACH__))
#include "config_maxmsp43.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
#ifdef LADSPA
#include <gmodule.h>
#endif
@ -52,26 +173,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 +192,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 +457,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. */

View File

@ -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)
@ -354,4 +235,30 @@ do { strncpy(_dst,_src,_n); \
char *fluid_error(void);
/* 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 */

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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)

View File

@ -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.

View File

@ -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