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