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>
108 #include <winsock2.h>
109 #include <ws2tcpip.h>
113 /* MinGW32 special defines */
117 #define snprintf _snprintf
118 #define vsnprintf _vsnprintf
120 #define DSOUND_SUPPORT 1
121 #define WINMIDI_SUPPORT 1
122 #define STDIN_FILENO 0
123 #define STDOUT_FILENO 1
124 #define STDERR_FILENO 2
128 /* Darwin special defines (taken from config_macosx.h) */
132 #define WITHOUT_SERVER 1
136 #include "fluidsynth.h"
139 /***************************************************************
144 #if defined(WITH_FLOAT)
145 typedef float fluid_real_t;
147 typedef double fluid_real_t;
152 typedef SOCKET fluid_socket_t;
154 typedef int fluid_socket_t;
155 #define INVALID_SOCKET -1
158 #if defined(SUPPORTS_VLA)
159 # define FLUID_DECLARE_VLA(_type, _name, _len) \
162 # define FLUID_DECLARE_VLA(_type, _name, _len) \
163 _type* _name = g_newa(_type, (_len))
168 //typedef gint8 sint8;
169 typedef guint8 uint8;
170 //typedef gint16 sint16;
171 //typedef guint16 uint16;
172 typedef gint32 sint32;
173 typedef guint32 uint32;
174 //typedef gint64 sint64;
175 //typedef guint64 uint64;
178 /***************************************************************
180 * FORWARD DECLARATIONS
182 typedef struct _fluid_env_data_t fluid_env_data_t;
183 typedef struct _fluid_adriver_definition_t fluid_adriver_definition_t;
184 typedef struct _fluid_channel_t fluid_channel_t;
185 typedef struct _fluid_tuning_t fluid_tuning_t;
186 typedef struct _fluid_hashtable_t fluid_hashtable_t;
187 typedef struct _fluid_client_t fluid_client_t;
188 typedef struct _fluid_server_socket_t fluid_server_socket_t;
189 typedef struct _fluid_sample_timer_t fluid_sample_timer_t;
191 /***************************************************************
196 #define FLUID_BUFSIZE 64 /**< FluidSynth internal buffer size (in samples) */
197 #define FLUID_MAX_EVENTS_PER_BUFSIZE 1024 /**< Maximum queued MIDI events per #FLUID_BUFSIZE */
198 #define FLUID_MAX_RETURN_EVENTS 1024 /**< Maximum queued synthesis thread return events */
199 #define FLUID_MAX_EVENT_QUEUES 16 /**< Maximum number of unique threads queuing events */
200 #define FLUID_DEFAULT_AUDIO_RT_PRIO 60 /**< Default setting for audio.realtime-prio */
201 #define FLUID_DEFAULT_MIDI_RT_PRIO 50 /**< Default setting for midi.realtime-prio */
204 #define PI 3.141592654
207 /***************************************************************
211 typedef FILE* fluid_file;
213 #define FLUID_MALLOC(_n) malloc(_n)
214 #define FLUID_REALLOC(_p,_n) realloc(_p,_n)
215 #define FLUID_NEW(_t) (_t*)malloc(sizeof(_t))
216 #define FLUID_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t))
217 #define FLUID_FREE(_p) free(_p)
218 #define FLUID_FOPEN(_f,_m) fopen(_f,_m)
219 #define FLUID_FCLOSE(_f) fclose(_f)
220 #define FLUID_FREAD(_p,_s,_n,_f) fread(_p,_s,_n,_f)
221 #define FLUID_FSEEK(_f,_n,_set) fseek(_f,_n,_set)
222 #define FLUID_MEMCPY(_dst,_src,_n) memcpy(_dst,_src,_n)
223 #define FLUID_MEMSET(_s,_c,_n) memset(_s,_c,_n)
224 #define FLUID_STRLEN(_s) strlen(_s)
225 #define FLUID_STRCMP(_s,_t) strcmp(_s,_t)
226 #define FLUID_STRNCMP(_s,_t,_n) strncmp(_s,_t,_n)
227 #define FLUID_STRCPY(_dst,_src) strcpy(_dst,_src)
228 #define FLUID_STRNCPY(_dst,_src,_n) strncpy(_dst,_src,_n)
229 #define FLUID_STRCHR(_s,_c) strchr(_s,_c)
230 #define FLUID_STRRCHR(_s,_c) strrchr(_s,_c)
232 #define FLUID_STRDUP(s) strdup(s)
234 #define FLUID_STRDUP(s) FLUID_STRCPY(FLUID_MALLOC(FLUID_STRLEN(s) + 1), s)
236 #define FLUID_SPRINTF sprintf
237 #define FLUID_FPRINTF fprintf
239 #define fluid_clip(_val, _min, _max) \
240 { (_val) = ((_val) < (_min))? (_min) : (((_val) > (_max))? (_max) : (_val)); }
243 #define FLUID_PRINTF post
244 #define FLUID_FLUSH()
246 #define FLUID_PRINTF printf
247 #define FLUID_FLUSH() fflush(stdout)
250 #define FLUID_LOG fluid_log
253 #define M_PI 3.1415926535897932384626433832795
257 #define FLUID_ASSERT(a,b)
258 #define FLUID_ASSERT_P(a,b)
260 char* fluid_error(void);
263 /* Internationalization */
267 #endif /* _FLUIDSYNTH_PRIV_H */