]> git.jsancho.org Git - lugaru.git/blob - Source/fmoddyn.h
8416fedd0069de10513bda93bfde92e2287a83cc
[lugaru.git] / Source / fmoddyn.h
1 /* =========================================================================================== */
2 /* FMOD Dynamic DLL loading header. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */
3 /* =========================================================================================== */
4
5 #ifndef _FMODDYN_H_
6 #define _FMODDYN_H_
7
8 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
9   #include <windows.h>
10 #else
11   #include <dlfcn.h>
12   #include <string.h>
13 #endif
14 #include <stdlib.h>
15
16 #include "fmod.h"
17
18 typedef struct
19 {
20     void *module;
21
22     signed char       (F_API *FSOUND_SetOutput)(int outputtype);
23     signed char       (F_API *FSOUND_SetDriver)(int driver);
24     signed char       (F_API *FSOUND_SetMixer)(int mixer);
25     signed char       (F_API *FSOUND_SetBufferSize)(int len_ms);
26     signed char       (F_API *FSOUND_SetHWND)(void *hwnd);
27     signed char       (F_API *FSOUND_SetMinHardwareChannels)(int min);
28     signed char       (F_API *FSOUND_SetMaxHardwareChannels)(int max);
29     signed char       (F_API *FSOUND_SetMemorySystem)(void *pool, int poollen, FSOUND_ALLOCCALLBACK useralloc, FSOUND_REALLOCCALLBACK userrealloc, FSOUND_FREECALLBACK userfree);
30     signed char       (F_API *FSOUND_Init)(int mixrate, int maxsoftwarechannels, unsigned int flags);
31     void              (F_API *FSOUND_Close)();
32     void              (F_API *FSOUND_Update)();   /* you must call this once a frame */
33     void              (F_API *FSOUND_SetSpeakerMode)(unsigned int speakermode);
34     void              (F_API *FSOUND_SetSFXMasterVolume)(int volume);
35     void              (F_API *FSOUND_SetPanSeperation)(float pansep);
36     void              (F_API *FSOUND_File_SetCallbacks)(FSOUND_OPENCALLBACK  useropen, FSOUND_CLOSECALLBACK userclose, FSOUND_READCALLBACK userread, FSOUND_SEEKCALLBACK  userseek, FSOUND_TELLCALLBACK  usertell);
37     int               (F_API *FSOUND_GetError)();
38     float             (F_API *FSOUND_GetVersion)();
39     int               (F_API *FSOUND_GetOutput)();
40     void *            (F_API *FSOUND_GetOutputHandle)();
41     int               (F_API *FSOUND_GetDriver)();
42     int               (F_API *FSOUND_GetMixer)();
43     int               (F_API *FSOUND_GetNumDrivers)();
44     signed char *     (F_API *FSOUND_GetDriverName)(int id);
45     signed char       (F_API *FSOUND_GetDriverCaps)(int id, unsigned int *caps);
46     int               (F_API *FSOUND_GetOutputRate)();
47     int               (F_API *FSOUND_GetMaxChannels)();
48     int               (F_API *FSOUND_GetMaxSamples)();
49     int               (F_API *FSOUND_GetSFXMasterVolume)();
50     signed char       (F_API *FSOUND_GetNumHWChannels)(int *num2d, int *num3d, int *total);
51     int               (F_API *FSOUND_GetChannelsPlaying)();
52     float             (F_API *FSOUND_GetCPUUsage)();
53     void              (F_API *FSOUND_GetMemoryStats)(unsigned int *currentalloced, unsigned int *maxalloced);
54     FSOUND_SAMPLE *   (F_API *FSOUND_Sample_Load)(int index, const char *name_or_data, unsigned int mode, int offset, int length);
55     FSOUND_SAMPLE *   (F_API *FSOUND_Sample_Alloc)(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri);
56     void              (F_API *FSOUND_Sample_Free)(FSOUND_SAMPLE *sptr);
57     signed char       (F_API *FSOUND_Sample_Upload)(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode);
58     signed char       (F_API *FSOUND_Sample_Lock)(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2);
59     signed char       (F_API *FSOUND_Sample_Unlock)(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2);
60     signed char       (F_API *FSOUND_Sample_SetMode)(FSOUND_SAMPLE *sptr, unsigned int mode);
61     signed char       (F_API *FSOUND_Sample_SetLoopPoints)(FSOUND_SAMPLE *sptr, int loopstart, int loopend);
62     signed char       (F_API *FSOUND_Sample_SetDefaults)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri);
63     signed char       (F_API *FSOUND_Sample_SetDefaultsEx)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan);
64     signed char       (F_API *FSOUND_Sample_SetMinMaxDistance)(FSOUND_SAMPLE *sptr, float min, float max);
65     signed char       (F_API *FSOUND_Sample_SetMaxPlaybacks)(FSOUND_SAMPLE *sptr, int max);
66     FSOUND_SAMPLE *   (F_API *FSOUND_Sample_Get)(int sampno);
67     char *            (F_API *FSOUND_Sample_GetName)(FSOUND_SAMPLE *sptr);
68     unsigned int      (F_API *FSOUND_Sample_GetLength)(FSOUND_SAMPLE *sptr);
69     signed char       (F_API *FSOUND_Sample_GetLoopPoints)(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend);
70     signed char       (F_API *FSOUND_Sample_GetDefaults)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri);
71     signed char       (F_API *FSOUND_Sample_GetDefaultsEx)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan);
72     unsigned int      (F_API *FSOUND_Sample_GetMode)(FSOUND_SAMPLE *sptr);
73     signed char       (F_API *FSOUND_Sample_GetMinMaxDistance)(FSOUND_SAMPLE *sptr, float *min, float *max);
74     int               (F_API *FSOUND_PlaySound)(int channel, FSOUND_SAMPLE *sptr);
75     int               (F_API *FSOUND_PlaySoundEx)(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
76     signed char       (F_API *FSOUND_StopSound)(int channel);
77     signed char       (F_API *FSOUND_SetFrequency)(int channel, int freq);
78     signed char       (F_API *FSOUND_SetVolume)(int channel, int vol);
79     signed char       (F_API *FSOUND_SetVolumeAbsolute)(int channel, int vol);
80     signed char       (F_API *FSOUND_SetPan)(int channel, int pan);
81     signed char       (F_API *FSOUND_SetSurround)(int channel, signed char surround);
82     signed char       (F_API *FSOUND_SetMute)(int channel, signed char mute);
83     signed char       (F_API *FSOUND_SetPriority)(int channel, int priority);
84     signed char       (F_API *FSOUND_SetReserved)(int channel, signed char reserved);
85     signed char       (F_API *FSOUND_SetPaused)(int channel, signed char paused);
86     signed char       (F_API *FSOUND_SetLoopMode)(int channel, unsigned int loopmode);
87     signed char       (F_API *FSOUND_SetCurrentPosition)(int channel, unsigned int offset);
88     signed char       (F_API *FSOUND_3D_SetAttributes)(int channel, float *pos, float *vel);
89     signed char       (F_API *FSOUND_3D_SetMinMaxDistance)(int channel, float min, float max);
90     signed char       (F_API *FSOUND_IsPlaying)(int channel);
91     int               (F_API *FSOUND_GetFrequency)(int channel);
92     int               (F_API *FSOUND_GetVolume)(int channel);
93     int               (F_API *FSOUND_GetAmplitude)(int channel);
94     int               (F_API *FSOUND_GetPan)(int channel);
95     signed char       (F_API *FSOUND_GetSurround)(int channel);
96     signed char       (F_API *FSOUND_GetMute)(int channel);
97     int               (F_API *FSOUND_GetPriority)(int channel);
98     signed char       (F_API *FSOUND_GetReserved)(int channel);
99     signed char       (F_API *FSOUND_GetPaused)(int channel);
100     unsigned int      (F_API *FSOUND_GetLoopMode)(int channel);
101     unsigned int      (F_API *FSOUND_GetCurrentPosition)(int channel);
102     FSOUND_SAMPLE *   (F_API *FSOUND_GetCurrentSample)(int channel);
103     signed char       (F_API *FSOUND_GetCurrentLevels)(int channel, float *l, float *r);
104     int               (F_API *FSOUND_GetNumSubChannels)(int channel);
105     int               (F_API *FSOUND_GetSubChannel)(int channel, int subchannel);
106     signed char       (F_API *FSOUND_3D_GetAttributes)(int channel, float *pos, float *vel);
107     signed char       (F_API *FSOUND_3D_GetMinMaxDistance)(int channel, float *min, float *max);
108     void              (F_API *FSOUND_3D_SetDopplerFactor)(float scale);
109     void              (F_API *FSOUND_3D_SetDistanceFactor)(float scale);
110     void              (F_API *FSOUND_3D_SetRolloffFactor)(float scale);
111     void              (F_API *FSOUND_3D_Listener_SetCurrent)(int current, int numlisteners);  /* use this if you use multiple listeners / splitscreen */
112     void              (F_API *FSOUND_3D_Listener_SetAttributes)(float *pos, float *vel, float fx, float fy, float fz, float tx, float ty, float tz);
113     void              (F_API *FSOUND_3D_Listener_GetAttributes)(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz);
114     int               (F_API *FSOUND_FX_Enable)(int channel, unsigned int fx);    /* See FSOUND_FX_MODES */
115     signed char       (F_API *FSOUND_FX_Disable)(int channel);
116     signed char       (F_API *FSOUND_FX_SetChorus)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
117     signed char       (F_API *FSOUND_FX_SetCompressor)(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay);
118     signed char       (F_API *FSOUND_FX_SetDistortion)(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff);
119     signed char       (F_API *FSOUND_FX_SetEcho)(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay);
120     signed char       (F_API *FSOUND_FX_SetFlanger)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
121     signed char       (F_API *FSOUND_FX_SetGargle)(int fxid, int RateHz, int WaveShape);
122     signed char       (F_API *FSOUND_FX_SetI3DL2Reverb)(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference);
123     signed char       (F_API *FSOUND_FX_SetParamEQ)(int fxid, float Center, float Bandwidth, float Gain);
124     signed char       (F_API *FSOUND_FX_SetWavesReverb)(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio);  
125     signed char       (F_API *FSOUND_Stream_SetBufferSize)(int ms);      /* call this before opening streams, not after */
126     FSOUND_STREAM *   (F_API *FSOUND_Stream_Open)(const char *name_or_data, unsigned int mode, int offset, int length);
127     FSOUND_STREAM *   (F_API *FSOUND_Stream_Create)(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata);
128     signed char       (F_API *FSOUND_Stream_Close)(FSOUND_STREAM *stream);
129     int               (F_API *FSOUND_Stream_Play)(int channel, FSOUND_STREAM *stream);
130     int               (F_API *FSOUND_Stream_PlayEx)(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused);
131     signed char       (F_API *FSOUND_Stream_Stop)(FSOUND_STREAM *stream);
132     signed char       (F_API *FSOUND_Stream_SetPosition)(FSOUND_STREAM *stream, unsigned int position);
133     unsigned int      (F_API *FSOUND_Stream_GetPosition)(FSOUND_STREAM *stream);
134     signed char       (F_API *FSOUND_Stream_SetTime)(FSOUND_STREAM *stream, int ms);
135     int               (F_API *FSOUND_Stream_GetTime)(FSOUND_STREAM *stream);
136     int               (F_API *FSOUND_Stream_GetLength)(FSOUND_STREAM *stream);
137     int               (F_API *FSOUND_Stream_GetLengthMs)(FSOUND_STREAM *stream);
138     signed char       (F_API *FSOUND_Stream_SetMode)(FSOUND_STREAM *stream, unsigned int mode);
139     unsigned int      (F_API *FSOUND_Stream_GetMode)(FSOUND_STREAM *stream);
140     signed char       (F_API *FSOUND_Stream_SetLoopPoints)(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm);
141     signed char       (F_API *FSOUND_Stream_SetLoopCount)(FSOUND_STREAM *stream, int count);
142     int               (F_API *FSOUND_Stream_GetOpenState)(FSOUND_STREAM *stream);
143     FSOUND_SAMPLE *   (F_API *FSOUND_Stream_GetSample)(FSOUND_STREAM *stream);   /* every stream contains a sample to playback on */
144     FSOUND_DSPUNIT *  (F_API *FSOUND_Stream_CreateDSP)(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata);
145     signed char       (F_API *FSOUND_Stream_SetEndCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata);
146     signed char       (F_API *FSOUND_Stream_SetSyncCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata);
147     FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_AddSyncPoint)(FSOUND_STREAM *stream, unsigned int pcmoffset, void *userdata);
148     signed char       (F_API *FSOUND_Stream_DeleteSyncPoint)(FSOUND_SYNCPOINT *point);
149     int               (F_API *FSOUND_Stream_GetNumSyncPoints)(FSOUND_STREAM *stream);
150     FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_GetSyncPoint)(FSOUND_STREAM *stream, int index);
151     char *            (F_API *FSOUND_Stream_GetSyncPointInfo)(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset);
152     signed char       (F_API *FSOUND_Stream_SetSubStream)(FSOUND_STREAM *stream, int index);
153     int               (F_API *FSOUND_Stream_GetNumSubStreams)(FSOUND_STREAM *stream);
154     signed char       (F_API *FSOUND_Stream_SetSubStreamSentence)(FSOUND_STREAM *stream, int *sentencelist, int numitems);
155     signed char       (F_API *FSOUND_Stream_GetNumTagFields)(FSOUND_STREAM *stream, int *num);
156     signed char       (F_API *FSOUND_Stream_GetTagField)(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length);
157     signed char       (F_API *FSOUND_Stream_FindTagField)(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length);
158     signed char       (F_API *FSOUND_Stream_Net_SetProxy)(const char *proxy);
159     char *            (F_API *FSOUND_Stream_Net_GetLastServerStatus)();
160     signed char       (F_API *FSOUND_Stream_Net_SetBufferProperties)(int buffersize, int prebuffer_percent, int rebuffer_percent);
161     signed char       (F_API *FSOUND_Stream_Net_GetBufferProperties)(int *buffersize, int *prebuffer_percent, int *rebuffer_percent);
162     signed char       (F_API *FSOUND_Stream_Net_SetMetadataCallback)(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata);
163     signed char       (F_API *FSOUND_Stream_Net_GetStatus)(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags);
164     signed char       (F_API *FSOUND_CD_Play)(char drive, int track);
165     void              (F_API *FSOUND_CD_SetPlayMode)(char drive, signed char mode);
166     signed char       (F_API *FSOUND_CD_Stop)(char drive);
167     signed char       (F_API *FSOUND_CD_SetPaused)(char drive, signed char paused);
168     signed char       (F_API *FSOUND_CD_SetVolume)(char drive, int volume);
169     signed char       (F_API *FSOUND_CD_SetTrackTime)(char drive, unsigned int ms);
170     signed char       (F_API *FSOUND_CD_OpenTray)(char drive, signed char open);
171     signed char       (F_API *FSOUND_CD_GetPaused)(char drive);
172     int               (F_API *FSOUND_CD_GetTrack)(char drive);
173     int               (F_API *FSOUND_CD_GetNumTracks)(char drive);
174     int               (F_API *FSOUND_CD_GetVolume)(char drive);
175     int               (F_API *FSOUND_CD_GetTrackLength)(char drive, int track); 
176     int               (F_API *FSOUND_CD_GetTrackTime)(char drive);
177     FSOUND_DSPUNIT *  (F_API *FSOUND_DSP_Create)(FSOUND_DSPCALLBACK callback, int priority, void *userdata);
178     void              (F_API *FSOUND_DSP_Free)(FSOUND_DSPUNIT *unit);
179     void              (F_API *FSOUND_DSP_SetPriority)(FSOUND_DSPUNIT *unit, int priority);
180     int               (F_API *FSOUND_DSP_GetPriority)(FSOUND_DSPUNIT *unit);
181     void              (F_API *FSOUND_DSP_SetActive)(FSOUND_DSPUNIT *unit, signed char active);
182     signed char       (F_API *FSOUND_DSP_GetActive)(FSOUND_DSPUNIT *unit);
183     FSOUND_DSPUNIT *  (F_API *FSOUND_DSP_GetClearUnit)();
184     FSOUND_DSPUNIT *  (F_API *FSOUND_DSP_GetSFXUnit)();
185     FSOUND_DSPUNIT *  (F_API *FSOUND_DSP_GetMusicUnit)();
186     FSOUND_DSPUNIT *  (F_API *FSOUND_DSP_GetFFTUnit)();
187     FSOUND_DSPUNIT *  (F_API *FSOUND_DSP_GetClipAndCopyUnit)();
188     signed char       (F_API *FSOUND_DSP_MixBuffers)(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode);
189     void              (F_API *FSOUND_DSP_ClearMixBuffer)();
190     int               (F_API *FSOUND_DSP_GetBufferLength)();      /* Length of each DSP update */
191     int               (F_API *FSOUND_DSP_GetBufferLengthTotal)(); /* Total buffer length due to FSOUND_SetBufferSize */
192     float *           (F_API *FSOUND_DSP_GetSpectrum)();          /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */
193     signed char       (F_API *FSOUND_Reverb_SetProperties)(FSOUND_REVERB_PROPERTIES *prop);
194     signed char       (F_API *FSOUND_Reverb_GetProperties)(FSOUND_REVERB_PROPERTIES *prop);
195     signed char       (F_API *FSOUND_Reverb_SetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop);
196     signed char       (F_API *FSOUND_Reverb_GetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop);
197     signed char       (F_API *FSOUND_Record_SetDriver)(int outputtype);
198     int               (F_API *FSOUND_Record_GetNumDrivers)();
199     signed char *     (F_API *FSOUND_Record_GetDriverName)(int id);
200     int               (F_API *FSOUND_Record_GetDriver)();
201     signed char       (F_API *FSOUND_Record_StartSample)(FSOUND_SAMPLE *sptr, signed char loop);
202     signed char       (F_API *FSOUND_Record_Stop)();
203     int               (F_API *FSOUND_Record_GetPosition)();  
204     FMUSIC_MODULE *   (F_API *FMUSIC_LoadSong)(const char *name);
205     FMUSIC_MODULE *   (F_API *FMUSIC_LoadSongEx)(const char *name_or_data, int offset, int length, unsigned int mode, int *samplelist, int samplelistnum);
206     int               (F_API *FMUSIC_GetOpenState)(FMUSIC_MODULE *mod);
207     signed char       (F_API *FMUSIC_FreeSong)(FMUSIC_MODULE *mod);
208     signed char       (F_API *FMUSIC_PlaySong)(FMUSIC_MODULE *mod);
209     signed char       (F_API *FMUSIC_StopSong)(FMUSIC_MODULE *mod);
210     void              (F_API *FMUSIC_StopAllSongs)();
211     signed char       (F_API *FMUSIC_SetZxxCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback);
212     signed char       (F_API *FMUSIC_SetRowCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep);
213     signed char       (F_API *FMUSIC_SetOrderCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep);
214     signed char       (F_API *FMUSIC_SetInstCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument);
215     signed char       (F_API *FMUSIC_SetSample)(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr);
216     signed char       (F_API *FMUSIC_SetUserData)(FMUSIC_MODULE *mod, void *userdata);
217     signed char       (F_API *FMUSIC_OptimizeChannels)(FMUSIC_MODULE *mod, int maxchannels, int minvolume);
218     signed char       (F_API *FMUSIC_SetReverb)(signed char reverb);             /* MIDI only */
219     signed char       (F_API *FMUSIC_SetLooping)(FMUSIC_MODULE *mod, signed char looping);
220     signed char       (F_API *FMUSIC_SetOrder)(FMUSIC_MODULE *mod, int order);
221     signed char       (F_API *FMUSIC_SetPaused)(FMUSIC_MODULE *mod, signed char pause);
222     signed char       (F_API *FMUSIC_SetMasterVolume)(FMUSIC_MODULE *mod, int volume);
223     signed char       (F_API *FMUSIC_SetMasterSpeed)(FMUSIC_MODULE *mode, float speed);
224     signed char       (F_API *FMUSIC_SetPanSeperation)(FMUSIC_MODULE *mod, float pansep);
225     char *            (F_API *FMUSIC_GetName)(FMUSIC_MODULE *mod);
226     int               (F_API *FMUSIC_GetType)(FMUSIC_MODULE *mod);
227     int               (F_API *FMUSIC_GetNumOrders)(FMUSIC_MODULE *mod);
228     int               (F_API *FMUSIC_GetNumPatterns)(FMUSIC_MODULE *mod);
229     int               (F_API *FMUSIC_GetNumInstruments)(FMUSIC_MODULE *mod);
230     int               (F_API *FMUSIC_GetNumSamples)(FMUSIC_MODULE *mod);
231     int               (F_API *FMUSIC_GetNumChannels)(FMUSIC_MODULE *mod);
232     FSOUND_SAMPLE *   (F_API *FMUSIC_GetSample)(FMUSIC_MODULE *mod, int sampno);
233     int               (F_API *FMUSIC_GetPatternLength)(FMUSIC_MODULE *mod, int orderno);
234     signed char       (F_API *FMUSIC_IsFinished)(FMUSIC_MODULE *mod);
235     signed char       (F_API *FMUSIC_IsPlaying)(FMUSIC_MODULE *mod);
236     int               (F_API *FMUSIC_GetMasterVolume)(FMUSIC_MODULE *mod);
237     int               (F_API *FMUSIC_GetGlobalVolume)(FMUSIC_MODULE *mod);
238     int               (F_API *FMUSIC_GetOrder)(FMUSIC_MODULE *mod);
239     int               (F_API *FMUSIC_GetPattern)(FMUSIC_MODULE *mod);
240     int               (F_API *FMUSIC_GetSpeed)(FMUSIC_MODULE *mod);
241     int               (F_API *FMUSIC_GetBPM)(FMUSIC_MODULE *mod);
242     int               (F_API *FMUSIC_GetRow)(FMUSIC_MODULE *mod);
243     signed char       (F_API *FMUSIC_GetPaused)(FMUSIC_MODULE *mod);
244     int               (F_API *FMUSIC_GetTime)(FMUSIC_MODULE *mod);
245     int               (F_API *FMUSIC_GetRealChannel)(FMUSIC_MODULE *mod, int modchannel);
246     unsigned int      (F_API *FMUSIC_GetUserData)(FMUSIC_MODULE *mod);
247 } FMOD_INSTANCE;
248
249
250 static FMOD_INSTANCE *FMOD_CreateInstance(char *dllName)
251 {
252     FMOD_INSTANCE *instance;
253
254     instance = (FMOD_INSTANCE *)calloc(sizeof(FMOD_INSTANCE), 1);
255     if (!instance)
256     {
257         return NULL;
258     }
259
260 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
261     instance->module = LoadLibrary(dllName);
262 #else
263     instance->module = dlopen(dllName, RTLD_LAZY);
264 #endif
265     if (!instance->module)
266     {
267         free(instance);
268         return NULL;
269     }
270
271 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
272     #define F_GETPROC(_x, _y)                                                                       \
273     {                                                                                             \
274         *((unsigned int *)&instance->_x) = (unsigned int)GetProcAddress((HMODULE)instance->module, _y);    \
275         if (!instance->_x)                                                                        \
276         {                                                                                         \
277             FreeLibrary((HMODULE)instance->module);                                                        \
278             free(instance);                                                                       \
279             return NULL;                                                                          \
280         }                                                                                         \
281     }
282 #else
283     #define F_GETPROC(_x, _y)                                                                       \
284     {                                                                                             \
285         char tmp[] = _y;                                                                          \
286         *(strchr(tmp, '@')) = 0;                                                                  \
287         *((unsigned int *)&instance->_x) = (unsigned int)dlsym(instance->module, &tmp[1]);        \
288         if (!instance->_x)                                                                        \
289         {                                                                                         \
290             dlclose(instance->module);                                                            \
291             free(instance);                                                                       \
292             return NULL;                                                                          \
293         }                                                                                         \
294     }
295 #endif
296
297     F_GETPROC(FSOUND_SetOutput, "_FSOUND_SetOutput@4");
298     F_GETPROC(FSOUND_SetDriver, "_FSOUND_SetDriver@4");
299     F_GETPROC(FSOUND_SetMixer, "_FSOUND_SetMixer@4");
300     F_GETPROC(FSOUND_SetBufferSize, "_FSOUND_SetBufferSize@4");
301     F_GETPROC(FSOUND_SetHWND, "_FSOUND_SetHWND@4");
302     F_GETPROC(FSOUND_SetMinHardwareChannels, "_FSOUND_SetMinHardwareChannels@4");
303     F_GETPROC(FSOUND_SetMaxHardwareChannels, "_FSOUND_SetMaxHardwareChannels@4");
304     F_GETPROC(FSOUND_SetMemorySystem, "_FSOUND_SetMemorySystem@20");
305     F_GETPROC(FSOUND_Init, "_FSOUND_Init@12");
306     F_GETPROC(FSOUND_Close, "_FSOUND_Close@0");
307     F_GETPROC(FSOUND_Update, "_FSOUND_Update@0");
308     F_GETPROC(FSOUND_SetSFXMasterVolume, "_FSOUND_SetSFXMasterVolume@4");
309     F_GETPROC(FSOUND_SetPanSeperation, "_FSOUND_SetPanSeperation@4");
310     F_GETPROC(FSOUND_SetSpeakerMode, "_FSOUND_SetSpeakerMode@4");
311     F_GETPROC(FSOUND_GetError, "_FSOUND_GetError@0");
312     F_GETPROC(FSOUND_GetVersion, "_FSOUND_GetVersion@0");
313     F_GETPROC(FSOUND_GetOutput, "_FSOUND_GetOutput@0");
314     F_GETPROC(FSOUND_GetOutputHandle, "_FSOUND_GetOutputHandle@0");
315     F_GETPROC(FSOUND_GetDriver, "_FSOUND_GetDriver@0");
316     F_GETPROC(FSOUND_GetMixer, "_FSOUND_GetMixer@0");
317     F_GETPROC(FSOUND_GetNumDrivers, "_FSOUND_GetNumDrivers@0");
318     F_GETPROC(FSOUND_GetDriverName, "_FSOUND_GetDriverName@4");
319     F_GETPROC(FSOUND_GetDriverCaps, "_FSOUND_GetDriverCaps@8");
320     F_GETPROC(FSOUND_GetOutputRate, "_FSOUND_GetOutputRate@0");
321     F_GETPROC(FSOUND_GetMaxChannels, "_FSOUND_GetMaxChannels@0");
322     F_GETPROC(FSOUND_GetMaxSamples, "_FSOUND_GetMaxSamples@0");
323     F_GETPROC(FSOUND_GetSFXMasterVolume, "_FSOUND_GetSFXMasterVolume@0");
324     F_GETPROC(FSOUND_GetNumHWChannels, "_FSOUND_GetNumHWChannels@12");
325     F_GETPROC(FSOUND_GetChannelsPlaying, "_FSOUND_GetChannelsPlaying@0");
326     F_GETPROC(FSOUND_GetCPUUsage, "_FSOUND_GetCPUUsage@0");
327     F_GETPROC(FSOUND_GetMemoryStats, "_FSOUND_GetMemoryStats@8");
328     F_GETPROC(FSOUND_Sample_Load, "_FSOUND_Sample_Load@20");
329     F_GETPROC(FSOUND_Sample_Alloc, "_FSOUND_Sample_Alloc@28");
330     F_GETPROC(FSOUND_Sample_Free, "_FSOUND_Sample_Free@4");
331     F_GETPROC(FSOUND_Sample_Upload, "_FSOUND_Sample_Upload@12");
332     F_GETPROC(FSOUND_Sample_Lock, "_FSOUND_Sample_Lock@28");
333     F_GETPROC(FSOUND_Sample_Unlock, "_FSOUND_Sample_Unlock@20");
334     F_GETPROC(FSOUND_Sample_SetMode, "_FSOUND_Sample_SetMode@8");
335     F_GETPROC(FSOUND_Sample_SetLoopPoints, "_FSOUND_Sample_SetLoopPoints@12");
336     F_GETPROC(FSOUND_Sample_SetDefaults, "_FSOUND_Sample_SetDefaults@20");
337     F_GETPROC(FSOUND_Sample_SetDefaultsEx, "_FSOUND_Sample_SetDefaultsEx@32");
338     F_GETPROC(FSOUND_Sample_SetMinMaxDistance, "_FSOUND_Sample_SetMinMaxDistance@12");
339     F_GETPROC(FSOUND_Sample_SetMaxPlaybacks, "_FSOUND_Sample_SetMaxPlaybacks@8");
340     F_GETPROC(FSOUND_Sample_Get, "_FSOUND_Sample_Get@4");
341     F_GETPROC(FSOUND_Sample_GetName, "_FSOUND_Sample_GetName@4");
342     F_GETPROC(FSOUND_Sample_GetLength, "_FSOUND_Sample_GetLength@4");
343     F_GETPROC(FSOUND_Sample_GetLoopPoints, "_FSOUND_Sample_GetLoopPoints@12");
344     F_GETPROC(FSOUND_Sample_GetDefaults, "_FSOUND_Sample_GetDefaults@20");
345     F_GETPROC(FSOUND_Sample_GetDefaultsEx, "_FSOUND_Sample_GetDefaultsEx@32");
346     F_GETPROC(FSOUND_Sample_GetMode, "_FSOUND_Sample_GetMode@4");
347     F_GETPROC(FSOUND_Sample_GetMinMaxDistance, "_FSOUND_Sample_GetMinMaxDistance@12");
348     F_GETPROC(FSOUND_PlaySound, "_FSOUND_PlaySound@8");
349     F_GETPROC(FSOUND_PlaySoundEx, "_FSOUND_PlaySoundEx@16");
350     F_GETPROC(FSOUND_StopSound, "_FSOUND_StopSound@4");
351     F_GETPROC(FSOUND_SetFrequency, "_FSOUND_SetFrequency@8");
352     F_GETPROC(FSOUND_SetVolume, "_FSOUND_SetVolume@8");
353     F_GETPROC(FSOUND_SetVolumeAbsolute, "_FSOUND_SetVolumeAbsolute@8");
354     F_GETPROC(FSOUND_SetPan, "_FSOUND_SetPan@8");
355     F_GETPROC(FSOUND_SetSurround, "_FSOUND_SetSurround@8");
356     F_GETPROC(FSOUND_SetMute, "_FSOUND_SetMute@8");
357     F_GETPROC(FSOUND_SetPriority, "_FSOUND_SetPriority@8");
358     F_GETPROC(FSOUND_SetReserved, "_FSOUND_SetReserved@8");
359     F_GETPROC(FSOUND_SetPaused, "_FSOUND_SetPaused@8");
360     F_GETPROC(FSOUND_SetLoopMode, "_FSOUND_SetLoopMode@8");
361     F_GETPROC(FSOUND_SetCurrentPosition, "_FSOUND_SetCurrentPosition@8");
362     F_GETPROC(FSOUND_3D_SetAttributes, "_FSOUND_3D_SetAttributes@12");
363     F_GETPROC(FSOUND_3D_SetMinMaxDistance, "_FSOUND_3D_SetMinMaxDistance@12");
364     F_GETPROC(FSOUND_IsPlaying, "_FSOUND_IsPlaying@4");
365     F_GETPROC(FSOUND_GetFrequency, "_FSOUND_GetFrequency@4");
366     F_GETPROC(FSOUND_GetVolume, "_FSOUND_GetVolume@4");
367     F_GETPROC(FSOUND_GetAmplitude, "_FSOUND_GetAmplitude@4");
368     F_GETPROC(FSOUND_GetPan, "_FSOUND_GetPan@4");
369     F_GETPROC(FSOUND_GetSurround, "_FSOUND_GetSurround@4");
370     F_GETPROC(FSOUND_GetMute, "_FSOUND_GetMute@4");
371     F_GETPROC(FSOUND_GetPriority, "_FSOUND_GetPriority@4");
372     F_GETPROC(FSOUND_GetReserved, "_FSOUND_GetReserved@4");
373     F_GETPROC(FSOUND_GetPaused, "_FSOUND_GetPaused@4");
374     F_GETPROC(FSOUND_GetLoopMode, "_FSOUND_GetLoopMode@4");
375     F_GETPROC(FSOUND_GetCurrentPosition, "_FSOUND_GetCurrentPosition@4");
376     F_GETPROC(FSOUND_GetCurrentSample, "_FSOUND_GetCurrentSample@4");
377     F_GETPROC(FSOUND_GetCurrentLevels, "_FSOUND_GetCurrentLevels@12");
378     F_GETPROC(FSOUND_GetNumSubChannels, "_FSOUND_GetNumSubChannels@4");
379     F_GETPROC(FSOUND_GetSubChannel, "_FSOUND_GetSubChannel@8");
380     F_GETPROC(FSOUND_3D_GetAttributes, "_FSOUND_3D_GetAttributes@12");
381     F_GETPROC(FSOUND_3D_GetMinMaxDistance, "_FSOUND_3D_GetMinMaxDistance@12");
382     F_GETPROC(FSOUND_3D_Listener_SetCurrent, "_FSOUND_3D_Listener_SetCurrent@8");
383     F_GETPROC(FSOUND_3D_Listener_SetAttributes, "_FSOUND_3D_Listener_SetAttributes@32");
384     F_GETPROC(FSOUND_3D_Listener_GetAttributes, "_FSOUND_3D_Listener_GetAttributes@32");
385     F_GETPROC(FSOUND_3D_SetDopplerFactor, "_FSOUND_3D_SetDopplerFactor@4");
386     F_GETPROC(FSOUND_3D_SetDistanceFactor, "_FSOUND_3D_SetDistanceFactor@4");
387     F_GETPROC(FSOUND_3D_SetRolloffFactor, "_FSOUND_3D_SetRolloffFactor@4");
388     F_GETPROC(FSOUND_FX_Enable, "_FSOUND_FX_Enable@8");
389     F_GETPROC(FSOUND_FX_Disable, "_FSOUND_FX_Disable@4");
390     F_GETPROC(FSOUND_FX_SetChorus, "_FSOUND_FX_SetChorus@32");
391     F_GETPROC(FSOUND_FX_SetCompressor, "_FSOUND_FX_SetCompressor@28");
392     F_GETPROC(FSOUND_FX_SetDistortion, "_FSOUND_FX_SetDistortion@24");
393     F_GETPROC(FSOUND_FX_SetEcho, "_FSOUND_FX_SetEcho@24");
394     F_GETPROC(FSOUND_FX_SetFlanger, "_FSOUND_FX_SetFlanger@32");
395     F_GETPROC(FSOUND_FX_SetGargle, "_FSOUND_FX_SetGargle@12");
396     F_GETPROC(FSOUND_FX_SetI3DL2Reverb, "_FSOUND_FX_SetI3DL2Reverb@52");
397     F_GETPROC(FSOUND_FX_SetParamEQ, "_FSOUND_FX_SetParamEQ@16");
398     F_GETPROC(FSOUND_FX_SetWavesReverb, "_FSOUND_FX_SetWavesReverb@20");
399     F_GETPROC(FSOUND_Stream_Open, "_FSOUND_Stream_Open@16");
400     F_GETPROC(FSOUND_Stream_Create, "_FSOUND_Stream_Create@20");
401     F_GETPROC(FSOUND_Stream_Play, "_FSOUND_Stream_Play@8");
402     F_GETPROC(FSOUND_Stream_PlayEx, "_FSOUND_Stream_PlayEx@16");
403     F_GETPROC(FSOUND_Stream_Stop, "_FSOUND_Stream_Stop@4");
404     F_GETPROC(FSOUND_Stream_Close, "_FSOUND_Stream_Close@4");
405     F_GETPROC(FSOUND_Stream_SetEndCallback, "_FSOUND_Stream_SetEndCallback@12");
406     F_GETPROC(FSOUND_Stream_SetSyncCallback, "_FSOUND_Stream_SetSyncCallback@12");
407     F_GETPROC(FSOUND_Stream_GetSample, "_FSOUND_Stream_GetSample@4");
408     F_GETPROC(FSOUND_Stream_CreateDSP, "_FSOUND_Stream_CreateDSP@16");
409     F_GETPROC(FSOUND_Stream_SetBufferSize, "_FSOUND_Stream_SetBufferSize@4");
410     F_GETPROC(FSOUND_Stream_SetPosition, "_FSOUND_Stream_SetPosition@8");
411     F_GETPROC(FSOUND_Stream_GetPosition, "_FSOUND_Stream_GetPosition@4");
412     F_GETPROC(FSOUND_Stream_SetTime, "_FSOUND_Stream_SetTime@8");
413     F_GETPROC(FSOUND_Stream_GetTime, "_FSOUND_Stream_GetTime@4");
414     F_GETPROC(FSOUND_Stream_GetLength, "_FSOUND_Stream_GetLength@4");
415     F_GETPROC(FSOUND_Stream_GetLengthMs, "_FSOUND_Stream_GetLengthMs@4");
416     F_GETPROC(FSOUND_Stream_SetMode, "_FSOUND_Stream_SetMode@8");
417     F_GETPROC(FSOUND_Stream_GetMode, "_FSOUND_Stream_GetMode@4");
418     F_GETPROC(FSOUND_Stream_SetSubStream, "_FSOUND_Stream_SetSubStream@8");
419     F_GETPROC(FSOUND_Stream_GetNumSubStreams, "_FSOUND_Stream_GetNumSubStreams@4");
420     F_GETPROC(FSOUND_Stream_SetSubStreamSentence, "_FSOUND_Stream_SetSubStreamSentence@12");
421     F_GETPROC(FSOUND_Stream_SetLoopPoints, "_FSOUND_Stream_SetLoopPoints@12");
422     F_GETPROC(FSOUND_Stream_SetLoopCount, "_FSOUND_Stream_SetLoopCount@8");
423     F_GETPROC(FSOUND_Stream_AddSyncPoint, "_FSOUND_Stream_AddSyncPoint@12");
424     F_GETPROC(FSOUND_Stream_DeleteSyncPoint, "_FSOUND_Stream_DeleteSyncPoint@4");
425     F_GETPROC(FSOUND_Stream_GetNumSyncPoints, "_FSOUND_Stream_GetNumSyncPoints@4");
426     F_GETPROC(FSOUND_Stream_GetSyncPoint, "_FSOUND_Stream_GetSyncPoint@8");
427     F_GETPROC(FSOUND_Stream_GetSyncPointInfo, "_FSOUND_Stream_GetSyncPointInfo@8");
428     F_GETPROC(FSOUND_Stream_GetOpenState, "_FSOUND_Stream_GetOpenState@4");
429     F_GETPROC(FSOUND_Stream_GetNumTagFields, "_FSOUND_Stream_GetNumTagFields@8");
430     F_GETPROC(FSOUND_Stream_GetTagField, "_FSOUND_Stream_GetTagField@24");
431     F_GETPROC(FSOUND_Stream_FindTagField, "_FSOUND_Stream_FindTagField@20");
432     F_GETPROC(FSOUND_Stream_Net_SetProxy, "_FSOUND_Stream_Net_SetProxy@4");
433     F_GETPROC(FSOUND_Stream_Net_GetLastServerStatus, "_FSOUND_Stream_Net_GetLastServerStatus@0");
434     F_GETPROC(FSOUND_Stream_Net_SetBufferProperties, "_FSOUND_Stream_Net_SetBufferProperties@12");
435     F_GETPROC(FSOUND_Stream_Net_GetBufferProperties, "_FSOUND_Stream_Net_GetBufferProperties@12");
436     F_GETPROC(FSOUND_Stream_Net_SetMetadataCallback, "_FSOUND_Stream_Net_SetMetadataCallback@12");
437     F_GETPROC(FSOUND_Stream_Net_GetStatus, "_FSOUND_Stream_Net_GetStatus@20");
438     F_GETPROC(FSOUND_CD_Play, "_FSOUND_CD_Play@8");
439     F_GETPROC(FSOUND_CD_SetPlayMode, "_FSOUND_CD_SetPlayMode@8");
440     F_GETPROC(FSOUND_CD_Stop, "_FSOUND_CD_Stop@4");
441     F_GETPROC(FSOUND_CD_SetPaused, "_FSOUND_CD_SetPaused@8");
442     F_GETPROC(FSOUND_CD_SetVolume, "_FSOUND_CD_SetVolume@8");
443     F_GETPROC(FSOUND_CD_SetTrackTime, "_FSOUND_CD_SetTrackTime@8");
444     F_GETPROC(FSOUND_CD_OpenTray, "_FSOUND_CD_OpenTray@8");
445     F_GETPROC(FSOUND_CD_GetPaused, "_FSOUND_CD_GetPaused@4");
446     F_GETPROC(FSOUND_CD_GetTrack, "_FSOUND_CD_GetTrack@4");
447     F_GETPROC(FSOUND_CD_GetNumTracks, "_FSOUND_CD_GetNumTracks@4");
448     F_GETPROC(FSOUND_CD_GetVolume, "_FSOUND_CD_GetVolume@4");
449     F_GETPROC(FSOUND_CD_GetTrackLength, "_FSOUND_CD_GetTrackLength@8");
450     F_GETPROC(FSOUND_CD_GetTrackTime, "_FSOUND_CD_GetTrackTime@4");
451     F_GETPROC(FSOUND_DSP_Create, "_FSOUND_DSP_Create@12");
452     F_GETPROC(FSOUND_DSP_Free, "_FSOUND_DSP_Free@4");
453     F_GETPROC(FSOUND_DSP_SetPriority, "_FSOUND_DSP_SetPriority@8");
454     F_GETPROC(FSOUND_DSP_GetPriority, "_FSOUND_DSP_GetPriority@4");
455     F_GETPROC(FSOUND_DSP_SetActive, "_FSOUND_DSP_SetActive@8");
456     F_GETPROC(FSOUND_DSP_GetActive, "_FSOUND_DSP_GetActive@4");
457     F_GETPROC(FSOUND_DSP_GetClearUnit, "_FSOUND_DSP_GetClearUnit@0");
458     F_GETPROC(FSOUND_DSP_GetSFXUnit, "_FSOUND_DSP_GetSFXUnit@0");
459     F_GETPROC(FSOUND_DSP_GetMusicUnit, "_FSOUND_DSP_GetMusicUnit@0");
460     F_GETPROC(FSOUND_DSP_GetClipAndCopyUnit, "_FSOUND_DSP_GetClipAndCopyUnit@0");
461     F_GETPROC(FSOUND_DSP_GetFFTUnit, "_FSOUND_DSP_GetFFTUnit@0");
462     F_GETPROC(FSOUND_DSP_MixBuffers, "_FSOUND_DSP_MixBuffers@28");
463     F_GETPROC(FSOUND_DSP_ClearMixBuffer, "_FSOUND_DSP_ClearMixBuffer@0");
464     F_GETPROC(FSOUND_DSP_GetBufferLength, "_FSOUND_DSP_GetBufferLength@0");
465     F_GETPROC(FSOUND_DSP_GetBufferLengthTotal, "_FSOUND_DSP_GetBufferLengthTotal@0");
466     F_GETPROC(FSOUND_DSP_GetSpectrum, "_FSOUND_DSP_GetSpectrum@0");
467     F_GETPROC(FSOUND_Reverb_SetProperties, "_FSOUND_Reverb_SetProperties@4");
468     F_GETPROC(FSOUND_Reverb_GetProperties, "_FSOUND_Reverb_GetProperties@4");
469     F_GETPROC(FSOUND_Reverb_SetChannelProperties, "_FSOUND_Reverb_SetChannelProperties@8");
470     F_GETPROC(FSOUND_Reverb_GetChannelProperties, "_FSOUND_Reverb_GetChannelProperties@8");
471     F_GETPROC(FSOUND_Record_SetDriver, "_FSOUND_Record_SetDriver@4");
472     F_GETPROC(FSOUND_Record_GetNumDrivers, "_FSOUND_Record_GetNumDrivers@0");
473     F_GETPROC(FSOUND_Record_GetDriverName, "_FSOUND_Record_GetDriverName@4");
474     F_GETPROC(FSOUND_Record_GetDriver, "_FSOUND_Record_GetDriver@0");
475     F_GETPROC(FSOUND_Record_StartSample, "_FSOUND_Record_StartSample@8");
476     F_GETPROC(FSOUND_Record_Stop, "_FSOUND_Record_Stop@0");
477     F_GETPROC(FSOUND_Record_GetPosition, "_FSOUND_Record_GetPosition@0");
478     F_GETPROC(FSOUND_File_SetCallbacks, "_FSOUND_File_SetCallbacks@20");
479     F_GETPROC(FMUSIC_LoadSong, "_FMUSIC_LoadSong@4");
480     F_GETPROC(FMUSIC_LoadSongEx, "_FMUSIC_LoadSongEx@24");
481     F_GETPROC(FMUSIC_GetOpenState, "_FMUSIC_GetOpenState@4");
482     F_GETPROC(FMUSIC_FreeSong, "_FMUSIC_FreeSong@4");
483     F_GETPROC(FMUSIC_PlaySong, "_FMUSIC_PlaySong@4");
484     F_GETPROC(FMUSIC_StopSong, "_FMUSIC_StopSong@4");
485     F_GETPROC(FMUSIC_StopAllSongs, "_FMUSIC_StopAllSongs@0");
486     F_GETPROC(FMUSIC_SetZxxCallback, "_FMUSIC_SetZxxCallback@8");
487     F_GETPROC(FMUSIC_SetRowCallback, "_FMUSIC_SetRowCallback@12");
488     F_GETPROC(FMUSIC_SetOrderCallback, "_FMUSIC_SetOrderCallback@12");
489     F_GETPROC(FMUSIC_SetInstCallback, "_FMUSIC_SetInstCallback@12");
490     F_GETPROC(FMUSIC_SetSample, "_FMUSIC_SetSample@12");
491     F_GETPROC(FMUSIC_SetUserData, "_FMUSIC_SetUserData@8");
492     F_GETPROC(FMUSIC_OptimizeChannels, "_FMUSIC_OptimizeChannels@12");
493     F_GETPROC(FMUSIC_SetReverb, "_FMUSIC_SetReverb@4");
494     F_GETPROC(FMUSIC_SetLooping, "_FMUSIC_SetLooping@8");
495     F_GETPROC(FMUSIC_SetOrder, "_FMUSIC_SetOrder@8");
496     F_GETPROC(FMUSIC_SetPaused, "_FMUSIC_SetPaused@8");
497     F_GETPROC(FMUSIC_SetMasterVolume, "_FMUSIC_SetMasterVolume@8");
498     F_GETPROC(FMUSIC_SetMasterSpeed, "_FMUSIC_SetMasterSpeed@8");
499     F_GETPROC(FMUSIC_SetPanSeperation, "_FMUSIC_SetPanSeperation@8");
500     F_GETPROC(FMUSIC_GetName, "_FMUSIC_GetName@4");
501     F_GETPROC(FMUSIC_GetType, "_FMUSIC_GetType@4");
502     F_GETPROC(FMUSIC_GetNumOrders, "_FMUSIC_GetNumOrders@4");
503     F_GETPROC(FMUSIC_GetNumPatterns, "_FMUSIC_GetNumPatterns@4");
504     F_GETPROC(FMUSIC_GetNumInstruments, "_FMUSIC_GetNumInstruments@4");
505     F_GETPROC(FMUSIC_GetNumSamples, "_FMUSIC_GetNumSamples@4");
506     F_GETPROC(FMUSIC_GetNumChannels, "_FMUSIC_GetNumChannels@4");
507     F_GETPROC(FMUSIC_GetSample, "_FMUSIC_GetSample@8");
508     F_GETPROC(FMUSIC_GetPatternLength, "_FMUSIC_GetPatternLength@8");
509     F_GETPROC(FMUSIC_IsFinished, "_FMUSIC_IsFinished@4");
510     F_GETPROC(FMUSIC_IsPlaying, "_FMUSIC_IsPlaying@4");
511     F_GETPROC(FMUSIC_GetMasterVolume, "_FMUSIC_GetMasterVolume@4");
512     F_GETPROC(FMUSIC_GetGlobalVolume, "_FMUSIC_GetGlobalVolume@4");
513     F_GETPROC(FMUSIC_GetOrder, "_FMUSIC_GetOrder@4");
514     F_GETPROC(FMUSIC_GetPattern, "_FMUSIC_GetPattern@4");
515     F_GETPROC(FMUSIC_GetSpeed, "_FMUSIC_GetSpeed@4");
516     F_GETPROC(FMUSIC_GetBPM, "_FMUSIC_GetBPM@4");
517     F_GETPROC(FMUSIC_GetRow, "_FMUSIC_GetRow@4");
518     F_GETPROC(FMUSIC_GetPaused, "_FMUSIC_GetPaused@4");
519     F_GETPROC(FMUSIC_GetTime, "_FMUSIC_GetTime@4");
520     F_GETPROC(FMUSIC_GetRealChannel, "_FMUSIC_GetRealChannel@8");
521     F_GETPROC(FMUSIC_GetUserData, "_FMUSIC_GetUserData@4");
522
523     return instance;
524 }
525
526 static void FMOD_FreeInstance(FMOD_INSTANCE *instance)
527 {
528     if (instance)
529     {
530         if (instance->module)
531         {
532 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
533             FreeLibrary((HMODULE)instance->module);
534 #else
535             dlclose(instance->module);
536 #endif
537         }
538         free(instance);
539     }
540 }
541
542 #endif
543
544