1 /* FluidSynth - A Software Synthesizer
3 * Copyright (C) 2003 Peter Hanappe and others.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public License
7 * as published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #ifndef _FLUIDSYNTH_PRIV_H
23 #define _FLUIDSYNTH_PRIV_H
68 #include <sys/types.h>
80 #include <sys/socket.h>
84 #include <netinet/in.h>
87 #if HAVE_NETINET_TCP_H
88 #include <netinet/tcp.h>
92 #include <arpa/inet.h>
111 /* MinGW32 special defines */
115 #define snprintf _snprintf
116 #define vsnprintf _vsnprintf
118 #define DSOUND_SUPPORT 1
119 #define WINMIDI_SUPPORT 1
120 #define STDIN_FILENO 0
121 #define STDOUT_FILENO 1
122 #define STDERR_FILENO 2
124 #elif defined _MSC_VER
126 #define STDIN_FILENO _fileno(stdin)
127 #define STDOUT_FILENO _fileno(stdout)
128 #define STDERR_FILENO _fileno(stderr)
132 /* Darwin special defines (taken from config_macosx.h) */
136 #define WITHOUT_SERVER 1
140 #include "fluidsynth.h"
143 /***************************************************************
148 #if defined(WITH_FLOAT)
149 typedef float fluid_real_t;
151 typedef double fluid_real_t;
156 typedef SOCKET fluid_socket_t;
158 typedef int fluid_socket_t;
159 #define INVALID_SOCKET -1
162 #if defined(SUPPORTS_VLA)
163 # define FLUID_DECLARE_VLA(_type, _name, _len) \
166 # define FLUID_DECLARE_VLA(_type, _name, _len) \
167 _type* _name = g_newa(_type, (_len))
172 //typedef gint8 sint8;
173 typedef guint8 uint8;
174 //typedef gint16 sint16;
175 //typedef guint16 uint16;
176 typedef gint32 sint32;
177 typedef guint32 uint32;
178 //typedef gint64 sint64;
179 //typedef guint64 uint64;
182 /***************************************************************
184 * FORWARD DECLARATIONS
186 typedef struct _fluid_env_data_t fluid_env_data_t;
187 typedef struct _fluid_adriver_definition_t fluid_adriver_definition_t;
188 typedef struct _fluid_channel_t fluid_channel_t;
189 typedef struct _fluid_tuning_t fluid_tuning_t;
190 typedef struct _fluid_hashtable_t fluid_hashtable_t;
191 typedef struct _fluid_client_t fluid_client_t;
192 typedef struct _fluid_server_socket_t fluid_server_socket_t;
193 typedef struct _fluid_sample_timer_t fluid_sample_timer_t;
195 /***************************************************************
200 #define FLUID_BUFSIZE 64 /**< FluidSynth internal buffer size (in samples) */
201 #define FLUID_MAX_EVENTS_PER_BUFSIZE 1024 /**< Maximum queued MIDI events per #FLUID_BUFSIZE */
202 #define FLUID_MAX_RETURN_EVENTS 1024 /**< Maximum queued synthesis thread return events */
203 #define FLUID_MAX_EVENT_QUEUES 16 /**< Maximum number of unique threads queuing events */
204 #define FLUID_DEFAULT_AUDIO_RT_PRIO 60 /**< Default setting for audio.realtime-prio */
205 #define FLUID_DEFAULT_MIDI_RT_PRIO 50 /**< Default setting for midi.realtime-prio */
208 #define PI 3.141592654
211 /***************************************************************
215 typedef FILE* fluid_file;
217 #define FLUID_MALLOC(_n) malloc(_n)
218 #define FLUID_REALLOC(_p,_n) realloc(_p,_n)
219 #define FLUID_NEW(_t) (_t*)malloc(sizeof(_t))
220 #define FLUID_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t))
221 #define FLUID_FREE(_p) free(_p)
222 #define FLUID_FOPEN(_f,_m) fopen(_f,_m)
223 #define FLUID_FCLOSE(_f) fclose(_f)
224 #define FLUID_FREAD(_p,_s,_n,_f) fread(_p,_s,_n,_f)
225 #define FLUID_FSEEK(_f,_n,_set) fseek(_f,_n,_set)
226 #define FLUID_MEMCPY(_dst,_src,_n) memcpy(_dst,_src,_n)
227 #define FLUID_MEMSET(_s,_c,_n) memset(_s,_c,_n)
228 #define FLUID_STRLEN(_s) strlen(_s)
229 #define FLUID_STRCMP(_s,_t) strcmp(_s,_t)
230 #define FLUID_STRNCMP(_s,_t,_n) strncmp(_s,_t,_n)
231 #define FLUID_STRCPY(_dst,_src) strcpy(_dst,_src)
232 #define FLUID_STRNCPY(_dst,_src,_n) strncpy(_dst,_src,_n)
233 #define FLUID_STRCHR(_s,_c) strchr(_s,_c)
234 #define FLUID_STRRCHR(_s,_c) strrchr(_s,_c)
236 #define FLUID_STRDUP(s) strdup(s)
238 #define FLUID_STRDUP(s) FLUID_STRCPY(FLUID_MALLOC(FLUID_STRLEN(s) + 1), s)
240 #define FLUID_SPRINTF sprintf
241 #define FLUID_FPRINTF fprintf
243 #define fluid_clip(_val, _min, _max) \
244 { (_val) = ((_val) < (_min))? (_min) : (((_val) > (_max))? (_max) : (_val)); }
247 #define FLUID_PRINTF post
248 #define FLUID_FLUSH()
250 #define FLUID_PRINTF printf
251 #define FLUID_FLUSH() fflush(stdout)
254 #define FLUID_LOG fluid_log
257 #define M_PI 3.1415926535897932384626433832795
261 #define FLUID_ASSERT(a,b)
262 #define FLUID_ASSERT_P(a,b)
264 char* fluid_error(void);
267 /* Internationalization */
271 #endif /* _FLUIDSYNTH_PRIV_H */