1 unit sdl_mixer_nosmpeg;
2 {******************************************************************************}
3 { Copy of SDL_Mixer without smpeg dependency and mp3 support                    }
4 {******************************************************************************}
5 
6 {$I jedi-sdl.inc}
7 
8 interface
9 
10 uses
11 {$IFDEF __GPC__}
12   gpc,
13 {$ENDIF}
14 {$IFDEF MORPHOS}
15   exec,
16 {$ENDIF}
17   sdl;
18 
19 const
20 {$IFDEF WINDOWS}
21   SDL_MixerLibName = 'SDL_mixer.dll';
22 {$ENDIF}
23 
24 {$IFDEF UNIX}
25 {$IFDEF DARWIN}
26   SDL_MixerLibName = 'libSDL_mixer-1.2.0.dylib';
27 {$ELSE}
28   {$IFDEF FPC}
29     SDL_MixerLibName = 'libSDL_mixer.so';
30   {$ELSE}
31     SDL_MixerLibName = 'libSDL_mixer-1.2.so.0';
32   {$ENDIF}
33 {$ENDIF}
34 {$ENDIF}
35 
36 {$IFDEF MACOS}
37   SDL_MixerLibName = 'SDL_mixer';
38 {$ENDIF}
39 
40 {$IFDEF MORPHOS}
41   SDL_MixerLibName = 'powersdl_mixer.library';
42 {$ENDIF}
43 
44   {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *}
45   SDL_MIXER_MAJOR_VERSION = 1;
46 {$EXTERNALSYM MIX_MAJOR_VERSION}
47   SDL_MIXER_MINOR_VERSION = 2;
48 {$EXTERNALSYM MIX_MINOR_VERSION}
49   SDL_MIXER_PATCHLEVEL    = 7;
50 {$EXTERNALSYM MIX_PATCHLEVEL}
51 
52   // Backwards compatibility
53   MIX_MAJOR_VERSION = SDL_MIXER_MAJOR_VERSION;
54   MIX_MINOR_VERSION = SDL_MIXER_MINOR_VERSION;
55   MIX_PATCHLEVEL    = SDL_MIXER_PATCHLEVEL;
56 
57   // SDL_Mixer.h constants
58   { The default mixer has 8 simultaneous mixing channels }
59 {$IFNDEF MIX_CHANNELS}
60   MIX_CHANNELS = 8;
61 {$ENDIF}
62 {$EXTERNALSYM MIX_CHANNELS}
63   { Good default values for a PC soundcard }
64   MIX_DEFAULT_FREQUENCY = 22050;
65 {$EXTERNALSYM MIX_DEFAULT_FREQUENCY}
66 
67 {$IFDEF IA32}
68   MIX_DEFAULT_FORMAT = AUDIO_S16LSB;
69 {$ELSE}
70   MIX_DEFAULT_FORMAT = AUDIO_S16MSB;
71 {$ENDIF}
72 {$EXTERNALSYM MIX_DEFAULT_FORMAT}
73 
74   MIX_DEFAULT_CHANNELS = 2;
75 {$EXTERNALSYM MIX_DEFAULT_CHANNELS}
76   MIX_MAX_VOLUME = 128; { Volume of a chunk }
77 {$EXTERNALSYM MIX_MAX_VOLUME}
78 
79   PATH_MAX = 255;
80 
81   // mikmod.h constants
82   {*
83   * Library version
84   *}
85   LIBMIKMOD_VERSION_MAJOR = 3;
86   LIBMIKMOD_VERSION_MINOR = 1;
87   LIBMIKMOD_REVISION = 8;
88   LIBMIKMOD_VERSION = ( ( LIBMIKMOD_VERSION_MAJOR shl 16 ) or
89     ( LIBMIKMOD_VERSION_MINOR shl 8 ) or
90     ( LIBMIKMOD_REVISION ) );
91 
92 type
93   //music_cmd.h types
94   PMusicCMD = ^TMusicCMD;
95   TMusicCMD = record
96     filename : array[ 0..PATH_MAX - 1 ] of char;
97     cmd : array[ 0..PATH_MAX - 1 ] of char;
98     pid : TSYS_ThreadHandle;
99   end;
100 
101   //wavestream.h types
102   PWAVStream = ^TWAVStream;
103   TWAVStream = record
104     rw : PSDL_RWops;
105     freerw : TSDL_Bool;
106     start: longint;
107     stop : longint;
108     cvt : TSDL_AudioCVT;
109   end;
110 
111   //playmidi.h types
112   PMidiEvent = ^TMidiEvent;
113   TMidiEvent = record
114     time : Longint;
115     channel : uint8;
116     type_ : uint8;
117     a : uint8;
118     b : uint8;
119   end;
120 
121   PMidiSong = ^TMidiSong;
122   TMidiSong = record
123     samples : Longint;
124     events : PMidiEvent;
125   end;
126 
127   //music_ogg.h types
128   POGG_Music = ^TOGG_Music;
129   TOGG_Music = record
130     playing : integer;
131     volume : integer;
132     //vf: OggVorbis_File;
133     section : integer;
134     cvt : TSDL_AudioCVT;
135     len_available : integer;
136     snd_available : PUint8;
137   end;
138 
139   // mikmod.h types
140   {*
141   * Error codes
142   *}
143   TErrorEnum = (
144     MMERR_OPENING_FILE,
145     MMERR_OUT_OF_MEMORY,
146     MMERR_DYNAMIC_LINKING,
147     MMERR_SAMPLE_TOO_BIG,
148     MMERR_OUT_OF_HANDLES,
149     MMERR_UNKNOWN_WAVE_TYPE,
150     MMERR_LOADING_PATTERN,
151     MMERR_LOADING_TRACK,
152     MMERR_LOADING_HEADER,
153     MMERR_LOADING_SAMPLEINFO,
154     MMERR_NOT_A_MODULE,
155     MMERR_NOT_A_STREAM,
156     MMERR_MED_SYNTHSAMPLES,
157     MMERR_ITPACK_INVALID_DATA,
158     MMERR_DETECTING_DEVICE,
159     MMERR_INVALID_DEVICE,
160     MMERR_INITIALIZING_MIXER,
161     MMERR_OPENING_AUDIO,
162     MMERR_8BIT_ONLY,
163     MMERR_16BIT_ONLY,
164     MMERR_STEREO_ONLY,
165     MMERR_ULAW,
166     MMERR_NON_BLOCK,
167     MMERR_AF_AUDIO_PORT,
168     MMERR_AIX_CONFIG_INIT,
169     MMERR_AIX_CONFIG_CONTROL,
170     MMERR_AIX_CONFIG_START,
171     MMERR_GUS_SETTINGS,
172     MMERR_GUS_RESET,
173     MMERR_GUS_TIMER,
174     MMERR_HP_SETSAMPLESIZE,
175     MMERR_HP_SETSPEED,
176     MMERR_HP_CHANNELS,
177     MMERR_HP_AUDIO_OUTPUT,
178     MMERR_HP_AUDIO_DESC,
179     MMERR_HP_BUFFERSIZE,
180     MMERR_OSS_SETFRAGMENT,
181     MMERR_OSS_SETSAMPLESIZE,
182     MMERR_OSS_SETSTEREO,
183     MMERR_OSS_SETSPEED,
184     MMERR_SGI_SPEED,
185     MMERR_SGI_16BIT,
186     MMERR_SGI_8BIT,
187     MMERR_SGI_STEREO,
188     MMERR_SGI_MONO,
189     MMERR_SUN_INIT,
190     MMERR_OS2_MIXSETUP,
191     MMERR_OS2_SEMAPHORE,
192     MMERR_OS2_TIMER,
193     MMERR_OS2_THREAD,
194     MMERR_DS_PRIORITY,
195     MMERR_DS_BUFFER,
196     MMERR_DS_FORMAT,
197     MMERR_DS_NOTIFY,
198     MMERR_DS_EVENT,
199     MMERR_DS_THREAD,
200     MMERR_DS_UPDATE,
201     MMERR_WINMM_HANDLE,
202     MMERR_WINMM_ALLOCATED,
203     MMERR_WINMM_DEVICEID,
204     MMERR_WINMM_FORMAT,
205     MMERR_WINMM_UNKNOWN,
206     MMERR_MAC_SPEED,
207     MMERR_MAC_START,
208     MMERR_MAX
209     );
210 
211   PMODULE = ^TMODULE;
212   TMODULE = record
213     (* general module information *)
214     //CHAR*       songname;    (* name of the song *)
215     //CHAR*       modtype;     (* string type of module loaded *)
216     //CHAR*       comment;     (* module comments *)
217     //UWORD       flags;       (* See module flags above *)
218     //UBYTE       numchn;      (* number of module channels *)
219     //UBYTE       numvoices;   (* max # voices used for full NNA playback *)
220     //UWORD       numpos;      (* number of positions in this song *)
221     //UWORD       numpat;      (* number of patterns in this song *)
222     //UWORD       numins;      (* number of instruments *)
223     //UWORD       numsmp;      (* number of samples *)
224     //type = record  INSTRUMENT* instruments; (* all instruments *)
225     //type = record  SAMPLE*     samples;     (* all samples *)
226     //UBYTE       realchn;     (* real number of channels used *)
227     //UBYTE       totalchn;    (* total number of channels used (incl NNAs) *)
228     (* playback settings *)
229     //UWORD       reppos;      (* restart position *)
230     //UBYTE       initspeed;   (* initial song speed *)
231     //UWORD       inittempo;   (* initial song tempo *)
232     //UBYTE       initvolume;  (* initial global volume (0 - 128) *)
233     //UWORD       panning : array[ 0..64- 1 ] of ; (* 64 panning positions *)
234     //UBYTE       chanvol : array[ 0..64- 1 ] of ; (* 64 channel positions *)
235     //UWORD       bpm;         (* current beats-per-minute speed *)
236     //UWORD       sngspd;      (* current song speed *)
237     //SWORD       volume;      (* song volume (0-128) (or user volume) *)
238     //BOOL        extspd;      (* extended speed flag (default enabled) *)
239     //BOOL        panflag;     (* panning flag (default enabled) *)
240     //BOOL        wrap;        (* wrap module ? (default disabled) *)
241     //BOOL        loop;          (* allow module to loop ? (default enabled) *)
242     //BOOL        fadeout;       (* volume fade out during last pattern *)
243     //UWORD       patpos;      (* current row number *)
244     //SWORD       sngpos;      (* current song position *)
245     //ULONG       sngtime;     (* current song time in 2^-10 seconds *)
246     //SWORD       relspd;      (* relative speed factor *)
247     (* internal module representation *)
248     //UWORD       numtrk;      (* number of tracks *)
249     //UBYTE**     tracks;      (* array of numtrk pointers to tracks *)
250     //UWORD*      patterns;    (* array of Patterns *)
251     //UWORD*      pattrows;    (* array of number of rows for each pattern *)
252     //UWORD*      positions;   (* all positions *)
253     //BOOL        forbid;      (* if true, no player updatenot  *)
254     //UWORD       numrow;      (* number of rows on current pattern *)
255     //UWORD       vbtick;      (* tick counter (counts from 0 to sngspd) *)
256     //UWORD       sngremainder;(* used for song time computation *)
257     //type = record MP_CONTROL*  control;     (* Effects Channel info (size pf.numchn) *)
258     //type = record MP_VOICE*    voice;       (* Audio Voice information (size md_numchn) *)
259     //UBYTE       globalslide; (* global volume slide rate *)
260     //UBYTE       pat_repcrazy;(* module has just looped to position -1 *)
261     //UWORD       patbrk;      (* position where to start a new pattern *)
262     //UBYTE       patdly;      (* patterndelay counter (command memory) *)
263     //UBYTE       patdly2;     (* patterndelay counter (real one) *)
264     //SWORD       posjmp;      (* flag to indicate a jump is needed... *)
265   end;
266 
267   PUNIMOD = ^TUNIMOD;
268   TUNIMOD = TMODULE;
269 
270   //SDL_mixer.h types
271   { The internal format for an audio chunk }
272   PMix_Chunk = ^TMix_Chunk;
273   TMix_Chunk = record
274     allocated : integer;
275     abuf : PUint8;
276     alen : Uint32;
277     volume : Uint8; { Per-sample volume, 0-128 }
278   end;
279   Mix_Chunk = TMix_Chunk;
280 
281   { The different fading types supported }
282   TMix_Fading = (
283     MIX_NO_FADING,
284     MIX_FADING_OUT,
285     MIX_FADING_IN
286     );
287   Mix_Fading = TMix_Fading;
288 
289   TMix_MusicType = (
290     MUS_NONE,
291     MUS_CMD,
292     MUS_WAV,
293     MUS_MOD,
294     MUS_MID,
295     MUS_OGG
296     );
297   Mix_MusicType = TMix_MusicType;
298 
299   TMusicUnion = record
300     case Byte of
301       0 : ( cmd : PMusicCMD );
302       1 : ( wave : PWAVStream );
303       2 : ( module : PUNIMOD );
304       3 : ( midi : TMidiSong );
305       4 : ( ogg : POGG_music );
306   end;
307 
308   P_Mix_Music = ^T_Mix_Music;
309   T_Mix_Music = record
310     type_ : TMix_MusicType;
311     data : TMusicUnion;
312     fading : TMix_Fading;
313     fade_volume : integer;
314     fade_step : integer;
315     fade_steps : integer;
316     error : integer;
317   end;
318 
319   { The internal format for a music chunk interpreted via mikmod }
320   PMix_Music = ^TMix_Music;
321   TMix_Music = T_Mix_Music;
322 
323   {$IFNDEF __GPC__}
324   TMixFunction = function( udata : Pointer; stream : PUint8; len : integer ) : Pointer; cdecl;
325   {$ELSE}
326   TMixFunction = function( udata : Pointer; stream : PUint8; len : integer ) : Pointer;
327   {$ENDIF}
328 
329 { This macro can be used to fill a version structure with the compile-time
330   version of the SDL_mixer library. }
331 procedure SDL_MIXER_VERSION(var X: TSDL_Version);
332 {$EXTERNALSYM SDL_MIXER_VERSION}
333 
334 {$IFDEF MORPHOS}
335 {$INCLUDE powersdl_mixer.inc}
336 {$ELSE MORPHOS}
337 
338 { This function gets the version of the dynamically linked SDL_mixer library.
339      It should NOT be used to fill a version structure, instead you should use the
340      SDL_MIXER_VERSION() macro. }
Mix_Linked_Versionnull341 function Mix_Linked_Version : PSDL_version;
342 cdecl; external {$IFDEF __GPC__}name 'Mix_Linked_Version'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
343 {$EXTERNALSYM Mix_Linked_Version}
344 
345 { Open the mixer with a certain audio format }
Mix_OpenAudionull346 function Mix_OpenAudio( frequency : integer; format : Uint16; channels :
347   integer; chunksize : integer ) : integer;
348 cdecl; external {$IFDEF __GPC__}name 'Mix_OpenAudio'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
349 {$EXTERNALSYM Mix_OpenAudio}
350 
351 { Dynamically change the number of channels managed by the mixer.
352    If decreasing the number of channels, the upper channels are
353    stopped.
354    This function returns the new number of allocated channels.
355  }
Mix_AllocateChannelsnull356 function Mix_AllocateChannels( numchannels : integer ) : integer;
357 cdecl; external {$IFDEF __GPC__}name 'Mix_AllocateChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
358 {$EXTERNALSYM Mix_AllocateChannels}
359 
360 { Find out what the actual audio device parameters are.
361    This function returns 1 if the audio has been opened, 0 otherwise.
362  }
Mix_QuerySpecnull363 function Mix_QuerySpec( var frequency : integer; var format : Uint16; var channels : integer ) : integer;
364 cdecl; external {$IFDEF __GPC__}name 'Mix_QuerySpec'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
365 {$EXTERNALSYM Mix_QuerySpec}
366 
367 { Load a wave file or a music (.mod .s3m .it .xm) file }
Mix_LoadWAV_RWnull368 function Mix_LoadWAV_RW( src : PSDL_RWops; freesrc : integer ) : PMix_Chunk;
369 cdecl; external {$IFDEF __GPC__}name 'Mix_LoadWAV_RW'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
370 {$EXTERNALSYM Mix_LoadWAV_RW}
371 
Mix_LoadWAVnull372 function Mix_LoadWAV( filename : PChar ) : PMix_Chunk;
373 
Mix_LoadMUSnull374 function Mix_LoadMUS( const filename : PChar ) : PMix_Music;
375 cdecl; external {$IFDEF __GPC__}name 'Mix_LoadMUS'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
376 {$EXTERNALSYM Mix_LoadMUS}
377 
378 (*#if 0 { This hasn't been hooked into music.c yet }
379 { Load a music file from an SDL_RWop object (MikMod-specific currently)
380    Matt Campbell (matt@campbellhome.dhs.org) April 2000 }
381 function Mix_LoadMUS_RW(SDL_RWops *rw) : PMix_Music;  cdecl;
382 #endif*)
383 
384 { Load a wave file of the mixer format from a memory buffer }
Mix_QuickLoad_WAVnull385 function Mix_QuickLoad_WAV( mem : PUint8 ) : PMix_Chunk;
386 cdecl; external {$IFDEF __GPC__}name 'Mix_QuickLoad_WAV'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
387 {$EXTERNALSYM Mix_QuickLoad_WAV}
388 
389 { Free an audio chunk previously loaded }
390 procedure Mix_FreeChunk( chunk : PMix_Chunk );
391 cdecl; external {$IFDEF __GPC__}name 'Mix_FreeChunk'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
392 {$EXTERNALSYM Mix_FreeChunk}
393 
394 procedure Mix_FreeMusic( music : PMix_Music );
395 cdecl; external {$IFDEF __GPC__}name 'Mix_FreeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
396 {$EXTERNALSYM Mix_FreeMusic}
397 
398 { Find out the music format of a mixer music, or the currently playing
399    music, if 'music' is NULL.}
Mix_GetMusicTypenull400 function Mix_GetMusicType( music : PMix_Music ) : TMix_MusicType;
401 cdecl; external {$IFDEF __GPC__}name 'Mix_GetMusicType'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
402 {$EXTERNALSYM Mix_GetMusicType}
403 
404 { Set a function that is called after all mixing is performed.
405    This can be used to provide real-time visual display of the audio stream
406    or add a custom mixer filter for the stream data.
407 }
408 procedure Mix_SetPostMix( mix_func : TMixFunction; arg : Pointer );
409 cdecl; external {$IFDEF __GPC__}name 'Mix_SetPostMix'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
410 {$EXTERNALSYM Mix_SetPostMix}
411 
412 { Add your own music player or additional mixer function.
413    If 'mix_func' is NULL, the default music player is re-enabled.
414  }
415 procedure Mix_HookMusic( mix_func : TMixFunction; arg : Pointer );
416  cdecl; external {$IFDEF __GPC__}name 'Mix_HookMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
417 {$EXTERNALSYM Mix_HookMusic}
418 
419 { Add your own callback when the music has finished playing.
420  }
421 procedure Mix_HookMusicFinished( music_finished : Pointer );
422 cdecl; external {$IFDEF __GPC__}name 'Mix_HookMusicFinished'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
423 {$EXTERNALSYM Mix_HookMusicFinished}
424 
425 { Get a pointer to the user data for the current music hook }
Mix_GetMusicHookDatanull426 function Mix_GetMusicHookData : Pointer;
427 cdecl; external {$IFDEF __GPC__}name 'Mix_GetMusicHookData'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
428 {$EXTERNALSYM Mix_GetMusicHookData}
429 
430 {$ENDIF MORPHOS}
431 
432 {* Add your own callback when a channel has finished playing. NULL
433  * to disable callback.*}
434 type
435   {$IFNDEF __GPC__}
436   TChannel_finished = procedure( channel: Integer ); cdecl;
437   {$ELSE}
438   TChannel_finished = procedure( channel: Integer );
439   {$ENDIF}
440 
441 {$IFNDEF MORPHOS}
442 
443 procedure Mix_ChannelFinished( channel_finished : TChannel_finished );
444 cdecl; external {$IFDEF __GPC__}name 'Mix_ChannelFinished'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
445 {$EXTERNALSYM Mix_ChannelFinished}
446 
447 {$ENDIF MORPHOS}
448 
449 const
450   MIX_CHANNEL_POST = -2;
451 
452   {* This is the format of a special effect callback:
453    *
454    *   myeffect(int chan, void *stream, int len, void *udata);
455    *
456    * (chan) is the channel number that your effect is affecting. (stream) is
457    *  the buffer of data to work upon. (len) is the size of (stream), and
458    *  (udata) is a user-defined bit of data, which you pass as the last arg of
459    *  Mix_RegisterEffect(), and is passed back unmolested to your callback.
460    *  Your effect changes the contents of (stream) based on whatever parameters
461    *  are significant, or just leaves it be, if you prefer. You can do whatever
462    *  you like to the buffer, though, and it will continue in its changed state
463    *  down the mixing pipeline, through any other effect functions, then finally
464    *  to be mixed with the rest of the channels and music for the final output
465    *  stream.
466    *}
467 type
468   {$IFNDEF __GPC__}
channull469   TMix_EffectFunc = function( chan : integer; stream : Pointer; len : integer; udata : Pointer ) : Pointer; cdecl;
470   {$ELSE}
channull471   TMix_EffectFunc = function( chan : integer; stream : Pointer; len : integer; udata : Pointer ) : Pointer;
472   {$ENDIF}
473   {*
474    * This is a callback that signifies that a channel has finished all its
475    *  loops and has completed playback. This gets called if the buffer
476    *  plays out normally, or if you call Mix_HaltChannel(), implicitly stop
477    *  a channel via Mix_AllocateChannels(), or unregister a callback while
478    *  it's still playing.
479    *}
480   {$IFNDEF __GPC__}
channull481   TMix_EffectDone = function( chan : integer; udata : Pointer ) : Pointer; cdecl;
482   {$ELSE}
channull483   TMix_EffectDone = function( chan : integer; udata : Pointer ) : Pointer;
484   {$ENDIF}
485   {* Register a special effect function. At mixing time, the channel data is
486   *  copied into a buffer and passed through each registered effect function.
487   *  After it passes through all the functions, it is mixed into the final
488   *  output stream. The copy to buffer is performed once, then each effect
489   *  function performs on the output of the previous effect. Understand that
490   *  this extra copy to a buffer is not performed if there are no effects
491   *  registered for a given chunk, which saves CPU cycles, and any given
492   *  effect will be extra cycles, too, so it is crucial that your code run
493   *  fast. Also note that the data that your function is given is in the
494   *  format of the sound device, and not the format you gave to Mix_OpenAudio(),
495   *  although they may in reality be the same. This is an unfortunate but
496   *  necessary speed concern. Use Mix_QuerySpec() to determine if you can
497   *  handle the data before you register your effect, and take appropriate
498   *  actions.
499   * You may also specify a callback (Mix_EffectDone_t) that is called when
500   *  the channel finishes playing. This gives you a more fine-grained control
501   *  than Mix_ChannelFinished(), in case you need to free effect-specific
502   *  resources, etc. If you don't need this, you can specify NULL.
503   * You may set the callbacks before or after calling Mix_PlayChannel().
504   * Things like Mix_SetPanning() are just internal special effect functions,
505   *  so if you are using that, you've already incurred the overhead of a copy
506   *  to a separate buffer, and that these effects will be in the queue with
507   *  any functions you've registered. The list of registered effects for a
508   *  channel is reset when a chunk finishes playing, so you need to explicitly
509   *  set them with each call to Mix_PlayChannel*().
510   * You may also register a special effect function that is to be run after
511   *  final mixing occurs. The rules for these callbacks are identical to those
512   *  in Mix_RegisterEffect, but they are run after all the channels and the
513   *  music have been mixed into a single stream, whereas channel-specific
514   *  effects run on a given channel before any other mixing occurs. These
515   *  global effect callbacks are call "posteffects". Posteffects only have
516   *  their Mix_EffectDone_t function called when they are unregistered (since
517   *  the main output stream is never "done" in the same sense as a channel).
518   *  You must unregister them manually when you've had enough. Your callback
519   *  will be told that the channel being mixed is (MIX_CHANNEL_POST) if the
520   *  processing is considered a posteffect.
521   *
522   * After all these effects have finished processing, the callback registered
523   *  through Mix_SetPostMix() runs, and then the stream goes to the audio
524   *  device.
525   *
526   * returns zero if error (no such channel), nonzero if added.
527   *  Error messages can be retrieved from Mix_GetError().
528   *}
529 {$IFNDEF MORPHOS}
530 
Mix_RegisterEffectnull531 function Mix_RegisterEffect( chan : integer; f : TMix_EffectFunc; d : TMix_EffectDone; arg : Pointer ) : integer;
532 cdecl; external {$IFDEF __GPC__}name 'Mix_RegisterEffect'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
533 {$EXTERNALSYM Mix_RegisterEffect}
534 
535 {* You may not need to call this explicitly, unless you need to stop an
536  *  effect from processing in the middle of a chunk's playback.
537  * Posteffects are never implicitly unregistered as they are for channels,
538  *  but they may be explicitly unregistered through this function by
539  *  specifying MIX_CHANNEL_POST for a channel.
540  * returns zero if error (no such channel or effect), nonzero if removed.
541  *  Error messages can be retrieved from Mix_GetError().
542  *}
Mix_UnregisterEffectnull543 function Mix_UnregisterEffect( channel : integer; f : TMix_EffectFunc ) : integer;
544 cdecl; external {$IFDEF __GPC__}name 'Mix_UnregisterEffect'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
545 {$EXTERNALSYM Mix_UnregisterEffect}
546 
547  {* You may not need to call this explicitly, unless you need to stop all
548   * effects from processing in the middle of a chunk's playback. Note that
549   * this will also shut off some internal effect processing, since
550   * Mix_SetPanning( ) and others may use this API under the hood.This is
551   * called internally when a channel completes playback.
552   * Posteffects are never implicitly unregistered as they are for channels,
553   * but they may be explicitly unregistered through this function by
554   * specifying MIX_CHANNEL_POST for a channel.
555   * returns zero if error( no such channel ), nonzero if all effects removed.
556   * Error messages can be retrieved from Mix_GetError( ).
557   *}
Mix_UnregisterAllEffectsnull558 function Mix_UnregisterAllEffects( channel : integer ) : integer;
559 cdecl; external {$IFDEF __GPC__}name 'Mix_UnregisterAllEffects'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
560 {$EXTERNALSYM Mix_UnregisterAllEffects}
561 
562 {$ENDIF MORPHOS}
563 
564 const
565   MIX_EFFECTSMAXSPEED = 'MIX_EFFECTSMAXSPEED';
566 
567 {$IFNDEF MORPHOS}
568   {*
569   * These are the internally - defined mixing effects.They use the same API that
570   * effects defined in the application use, but are provided here as a
571   * convenience.Some effects can reduce their quality or use more memory in
572   * the name of speed; to enable this, make sure the environment variable
573   * MIX_EFFECTSMAXSPEED( see above ) is defined before you call
574   * Mix_OpenAudio( ).
575   * }
576 
577   {* set the panning of a channel.The left and right channels are specified
578   * as integers between 0 and 255, quietest to loudest, respectively.
579   *
580   * Technically, this is just individual volume control for a sample with
581   * two( stereo )channels, so it can be used for more than just panning.
582   * if you want real panning, call it like this :
583   *
584   * Mix_SetPanning( channel, left, 255 - left );
585   *
586   * ...which isn't so hard.
587   *
588   * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
589   * the panning will be done to the final mixed stream before passing it on
590   * to the audio device.
591   *
592   * This uses the Mix_RegisterEffect( )API internally, and returns without
593   * registering the effect function if the audio device is not configured
594   * for stereo output.Setting both( left ) and ( right ) to 255 causes this
595   * effect to be unregistered, since that is the data's normal state.
596   *
597   * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
598   * nonzero if panning effect enabled.Note that an audio device in mono
599   * mode is a no - op, but this call will return successful in that case .
600   * Error messages can be retrieved from Mix_GetError( ).
601   * }
Mix_SetPanningnull602   function Mix_SetPanning( channel : integer; left : Uint8; right : Uint8  ) : integer;
603   cdecl; external {$IFDEF __GPC__}name 'Mix_SetPanning'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
604   {$EXTERNALSYM Mix_SetPanning}
605 
606   { * set the position ofa channel.( angle ) is an integer from 0 to 360, that
607     * specifies the location of the sound in relation to the listener.( angle )
608     * will be reduced as neccesary( 540 becomes 180 degrees, -100 becomes 260 ).
609     * Angle 0 is due north, and rotates clockwise as the value increases.
610     * for efficiency, the precision of this effect may be limited( angles 1
611     * through 7 might all produce the same effect, 8 through 15 are equal, etc ).
612     * ( distance ) is an integer between 0 and 255 that specifies the space
613     * between the sound and the listener.The larger the number, the further
614     * away the sound is .Using 255 does not guarantee that the channel will be
615     * culled from the mixing process or be completely silent.For efficiency,
616     * the precision of this effect may be limited( distance 0 through 5 might
617     * all produce the same effect, 6 through 10 are equal, etc ).Setting( angle )
618     * and ( distance ) to 0 unregisters this effect, since the data would be
619     * unchanged.
620     *
621     * if you need more precise positional audio, consider using OpenAL for
622     * spatialized effects instead of SDL_mixer.This is only meant to be a
623     * basic effect for simple "3D" games.
624     *
625     * if the audio device is configured for mono output, then you won't get
626     * any effectiveness from the angle; however, distance attenuation on the
627   * channel will still occur.While this effect will function with stereo
628   * voices, it makes more sense to use voices with only one channel of sound,
629   * so when they are mixed through this effect, the positioning will sound
630   * correct.You can convert them to mono through SDL before giving them to
631   * the mixer in the first place if you like.
632   *
633   * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
634   * the positioning will be done to the final mixed stream before passing it
635   * on to the audio device.
636   *
637   * This is a convenience wrapper over Mix_SetDistance( ) and Mix_SetPanning( ).
638   *
639   * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
640   * nonzero if position effect is enabled.
641   * Error messages can be retrieved from Mix_GetError( ).
642   * }
Mix_SetPositionnull643   function Mix_SetPosition( channel :integer; angle : Sint16; distance : Uint8  ) : integer;
644   cdecl; external {$IFDEF __GPC__}name 'Mix_SetPosition'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
645   {$EXTERNALSYM Mix_SetPosition}
646 
647   {* set the "distance" of a channel.( distance ) is an integer from 0 to 255
648   * that specifies the location of the sound in relation to the listener.
649   * Distance 0 is overlapping the listener, and 255 is as far away as possible
650   * A distance of 255 does not guarantee silence; in such a case , you might
651   * want to try changing the chunk's volume, or just cull the sample from the
652   * mixing process with Mix_HaltChannel( ).
653     * for efficiency, the precision of this effect may be limited( distances 1
654     * through 7 might all produce the same effect, 8 through 15 are equal, etc ).
655     * ( distance ) is an integer between 0 and 255 that specifies the space
656     * between the sound and the listener.The larger the number, the further
657     * away the sound is .
658     * Setting( distance ) to 0 unregisters this effect, since the data would be
659     * unchanged.
660     * if you need more precise positional audio, consider using OpenAL for
661     * spatialized effects instead of SDL_mixer.This is only meant to be a
662     * basic effect for simple "3D" games.
663     *
664     * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
665     * the distance attenuation will be done to the final mixed stream before
666     * passing it on to the audio device.
667     *
668   * This uses the Mix_RegisterEffect( )API internally.
669   *
670   * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
671   * nonzero if position effect is enabled.
672     * Error messages can be retrieved from Mix_GetError( ).
673     * }
Mix_SetDistancenull674     function Mix_SetDistance( channel : integer; distance : Uint8 ) : integer;
675     cdecl; external {$IFDEF __GPC__}name 'Mix_SetDistance'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
676     {$EXTERNALSYM Mix_SetDistance}
677   { *
678     * !!! FIXME : Haven't implemented, since the effect goes past the
679   * end of the sound buffer.Will have to think about this.
680   * - -ryan.
681   * /
682   { if 0
683   { * Causes an echo effect to be mixed into a sound.( echo ) is the amount
684   * of echo to mix.0 is no echo, 255 is infinite( and probably not
685   * what you want ).
686   *
687   * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
688   * the reverbing will be done to the final mixed stream before passing it on
689   * to the audio device.
690   *
691   * This uses the Mix_RegisterEffect( )API internally.If you specify an echo
692   * of zero, the effect is unregistered, as the data is already in that state.
693   *
694   * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
695   * nonzero if reversing effect is enabled.
696     * Error messages can be retrieved from Mix_GetError( ).
697     *
698     extern no_parse_DECLSPEC int Mix_SetReverb( int channel, Uint8 echo );
699   #E ndif}
700   { * Causes a channel to reverse its stereo.This is handy if the user has his
701     * speakers hooked up backwards, or you would like to have a minor bit of
702   * psychedelia in your sound code. : )Calling this function with ( flip )
703   * set to non - zero reverses the chunks's usual channels. If (flip) is zero,
704   * the effect is unregistered.
705   *
706   * This uses the Mix_RegisterEffect( )API internally, and thus is probably
707   * more CPU intensive than having the user just plug in his speakers
708   * correctly.Mix_SetReverseStereo( )returns without registering the effect
709   * function if the audio device is not configured for stereo output.
710   *
711   * if you specify MIX_CHANNEL_POST for ( channel ), then this the effect is used
712   * on the final mixed stream before sending it on to the audio device( a
713   * posteffect ).
714   *
715   * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
716   * nonzero if reversing effect is enabled.Note that an audio device in mono
717   * mode is a no - op, but this call will return successful in that case .
718   * Error messages can be retrieved from Mix_GetError( ).
719   * }
Mix_SetReverseStereonull720   function Mix_SetReverseStereo( channel : integer; flip : integer ) : integer;
721   cdecl; external {$IFDEF __GPC__}name 'Mix_SetReverseStereo'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
722   {$EXTERNALSYM Mix_SetReverseStereo}
723   { end of effects API. - -ryan. *}
724 
725 { Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate
726    them dynamically to the next sample if requested with a -1 value below.
727    Returns the number of reserved channels.
728  }
Mix_ReserveChannelsnull729 function Mix_ReserveChannels( num : integer ) : integer;
730 cdecl; external {$IFDEF __GPC__}name 'Mix_ReserveChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
731 {$EXTERNALSYM Mix_ReserveChannels}
732 
733 { Channel grouping functions }
734 
735 { Attach a tag to a channel. A tag can be assigned to several mixer
736    channels, to form groups of channels.
737    If 'tag' is -1, the tag is removed (actually -1 is the tag used to
738    represent the group of all the channels).
739    Returns true if everything was OK.
740  }
Mix_GroupChannelnull741 function Mix_GroupChannel( which : integer; tag : integer ) : integer;
742 cdecl; external {$IFDEF __GPC__}name 'Mix_GroupChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
743 {$EXTERNALSYM Mix_GroupChannel}
744 
745 { Assign several consecutive channels to a group }
Mix_GroupChannelsnull746 function Mix_GroupChannels( from : integer; to_ : integer; tag : integer ) :
747 integer;
748 cdecl; external {$IFDEF __GPC__}name 'Mix_GroupChannels'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
749 {$EXTERNALSYM Mix_GroupChannels}
750 
751 { Finds the first available channel in a group of channels }
Mix_GroupAvailablenull752 function Mix_GroupAvailable( tag : integer ) : integer;
753 cdecl; external {$IFDEF __GPC__}name 'Mix_GroupAvailable'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
754 {$EXTERNALSYM Mix_GroupAvailable}
755 
756 { Returns the number of channels in a group. This is also a subtle
757    way to get the total number of channels when 'tag' is -1
758  }
Mix_GroupCountnull759 function Mix_GroupCount( tag : integer ) : integer;
760 cdecl; external {$IFDEF __GPC__}name 'Mix_GroupCount'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
761 {$EXTERNALSYM Mix_GroupCount}
762 
763 { Finds the "oldest" sample playing in a group of channels }
Mix_GroupOldestnull764 function Mix_GroupOldest( tag : integer ) : integer;
765 cdecl; external {$IFDEF __GPC__}name 'Mix_GroupOldest'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
766 {$EXTERNALSYM Mix_GroupOldest}
767 
768 { Finds the "most recent" (i.e. last) sample playing in a group of channels }
Mix_GroupNewernull769 function Mix_GroupNewer( tag : integer ) : integer;
770 cdecl; external {$IFDEF __GPC__}name 'Mix_GroupNewer'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
771 {$EXTERNALSYM Mix_GroupNewer}
772 
773 { The same as above, but the sound is played at most 'ticks' milliseconds }
Mix_PlayChannelTimednull774 function Mix_PlayChannelTimed( channel : integer; chunk : PMix_Chunk; loops : integer; ticks : integer ) : integer;
775 cdecl; external {$IFDEF __GPC__}name 'Mix_PlayChannelTimed'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
776 {$EXTERNALSYM Mix_PlayChannelTimed}
777 
778 { Play an audio chunk on a specific channel.
779    If the specified channel is -1, play on the first free channel.
780    If 'loops' is greater than zero, loop the sound that many times.
781    If 'loops' is -1, loop inifinitely (~65000 times).
782    Returns which channel was used to play the sound.
783 }
Mix_PlayChannelnull784 function Mix_PlayChannel( channel : integer; chunk : PMix_Chunk; loops : integer ) : integer;
785 
Mix_PlayMusicnull786 function Mix_PlayMusic( music : PMix_Music; loops : integer ) : integer;
787 cdecl; external {$IFDEF __GPC__}name 'Mix_PlayMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
788 {$EXTERNALSYM Mix_PlayMusic}
789 
790 { Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions }
Mix_FadeInMusicnull791 function Mix_FadeInMusic( music : PMix_Music; loops : integer; ms : integer ) : integer;
792 cdecl; external {$IFDEF __GPC__}name 'Mix_FadeInMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
793 {$EXTERNALSYM Mix_FadeInMusic}
794 
Mix_FadeInChannelTimednull795 function Mix_FadeInChannelTimed( channel : integer; chunk : PMix_Chunk; loops : integer; ms : integer; ticks : integer ) : integer;
796 cdecl; external {$IFDEF __GPC__}name 'Mix_FadeInChannelTimed'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
797 {$EXTERNALSYM Mix_FadeInChannelTimed}
798 
Mix_FadeInChannelnull799 function Mix_FadeInChannel( channel : integer; chunk : PMix_Chunk; loops : integer; ms : integer ) : integer;
800 
801 { Set the volume in the range of 0-128 of a specific channel or chunk.
802    If the specified channel is -1, set volume for all channels.
803    Returns the original volume.
804    If the specified volume is -1, just return the current volume.
805 }
Mix_Volumenull806 function Mix_Volume( channel : integer; volume : integer ) : integer;
807 cdecl; external {$IFDEF __GPC__}name 'Mix_Volume'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
808 {$EXTERNALSYM Mix_Volume}
809 
Mix_VolumeChunknull810 function Mix_VolumeChunk( chunk : PMix_Chunk; volume : integer ) : integer;
811 cdecl; external {$IFDEF __GPC__}name 'Mix_VolumeChunk'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
812 {$EXTERNALSYM Mix_VolumeChunk}
813 
Mix_VolumeMusicnull814 function Mix_VolumeMusic( volume : integer ) : integer;
815 cdecl; external {$IFDEF __GPC__}name 'Mix_VolumeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
816 {$EXTERNALSYM Mix_VolumeMusic}
817 
818 { Halt playing of a particular channel }
Mix_HaltChannelnull819 function Mix_HaltChannel( channel : integer ) : integer;
820 cdecl; external {$IFDEF __GPC__}name 'Mix_HaltChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
821 {$EXTERNALSYM Mix_HaltChannel}
822 
Mix_HaltGroupnull823 function Mix_HaltGroup( tag : integer ) : integer;
824 cdecl; external {$IFDEF __GPC__}name 'Mix_HaltGroup'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
825 {$EXTERNALSYM Mix_HaltGroup}
826 
Mix_HaltMusicnull827 function Mix_HaltMusic : integer;
828 cdecl; external {$IFDEF __GPC__}name 'Mix_HaltMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
829 {$EXTERNALSYM Mix_HaltMusic}
830 
831 { Change the expiration delay for a particular channel.
832    The sample will stop playing after the 'ticks' milliseconds have elapsed,
833    or remove the expiration if 'ticks' is -1
834 }
Mix_ExpireChannelnull835 function Mix_ExpireChannel( channel : integer; ticks : integer ) : integer;
836 cdecl; external {$IFDEF __GPC__}name 'Mix_ExpireChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
837 {$EXTERNALSYM Mix_ExpireChannel}
838 
839 { Halt a channel, fading it out progressively till it's silent
840    The ms parameter indicates the number of milliseconds the fading
841    will take.
842  }
Mix_FadeOutChannelnull843 function Mix_FadeOutChannel( which : integer; ms : integer ) : integer;
844 cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
845 {$EXTERNALSYM Mix_FadeOutChannel}
Mix_FadeOutGroupnull846 function Mix_FadeOutGroup( tag : integer; ms : integer ) : integer;
847 cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutGroup'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
848 {$EXTERNALSYM Mix_FadeOutGroup}
Mix_FadeOutMusicnull849 function Mix_FadeOutMusic( ms : integer ) : integer;
850 cdecl; external {$IFDEF __GPC__}name 'Mix_FadeOutMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
851 {$EXTERNALSYM Mix_FadeOutMusic}
852 
853 { Query the fading status of a channel }
Mix_FadingMusicnull854 function Mix_FadingMusic : TMix_Fading;
855 cdecl; external {$IFDEF __GPC__}name 'Mix_FadingMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
856 {$EXTERNALSYM Mix_FadingMusic}
857 
Mix_FadingChannelnull858 function Mix_FadingChannel( which : integer ) : TMix_Fading;
859 cdecl; external {$IFDEF __GPC__}name 'Mix_FadingChannel'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
860 {$EXTERNALSYM Mix_FadingChannel}
861 
862 { Pause/Resume a particular channel }
863 procedure Mix_Pause( channel : integer );
864 cdecl; external {$IFDEF __GPC__}name 'Mix_Pause'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
865 {$EXTERNALSYM Mix_Pause}
866 
867 procedure Mix_Resume( channel : integer );
868 cdecl; external {$IFDEF __GPC__}name 'Mix_Resume'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
869 {$EXTERNALSYM Mix_Resume}
870 
Mix_Pausednull871 function Mix_Paused( channel : integer ) : integer;
872 cdecl; external {$IFDEF __GPC__}name 'Mix_Paused'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
873 {$EXTERNALSYM Mix_Paused}
874 
875 { Pause/Resume the music stream }
876 procedure Mix_PauseMusic;
877 cdecl; external {$IFDEF __GPC__}name 'Mix_PauseMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
878 {$EXTERNALSYM Mix_PauseMusic}
879 
880 procedure Mix_ResumeMusic;
881 cdecl; external {$IFDEF __GPC__}name 'Mix_ResumeMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
882 {$EXTERNALSYM Mix_ResumeMusic}
883 
884 procedure Mix_RewindMusic;
885 cdecl; external {$IFDEF __GPC__}name 'Mix_RewindMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
886 {$EXTERNALSYM Mix_RewindMusic}
887 
Mix_PausedMusicnull888 function Mix_PausedMusic : integer;
889 cdecl; external {$IFDEF __GPC__}name 'Mix_PausedMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
890 {$EXTERNALSYM Mix_PausedMusic}
891 
892 { Set the current position in the music stream.
893   This returns 0 if successful, or -1 if it failed or isn't implemented.
894   This function is only implemented for MOD music formats (set pattern
895   order number) and for OGG music (set position in seconds), at the
896   moment.
897 }
Mix_SetMusicPositionnull898 function Mix_SetMusicPosition( position : double ) : integer;
899 cdecl; external {$IFDEF __GPC__}name 'Mix_SetMusicPosition'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
900 {$EXTERNALSYM Mix_SetMusicPosition}
901 
902 { Check the status of a specific channel.
903    If the specified channel is -1, check all channels.
904 }
Mix_Playingnull905 function Mix_Playing( channel : integer ) : integer;
906 cdecl; external {$IFDEF __GPC__}name 'Mix_Playing'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
907 {$EXTERNALSYM Mix_Playing}
908 
Mix_PlayingMusicnull909 function Mix_PlayingMusic : integer;
910 cdecl; external {$IFDEF __GPC__}name 'Mix_PlayingMusic'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
911 {$EXTERNALSYM Mix_PlayingMusic}
912 
913 { Stop music and set external music playback command }
Mix_SetMusicCMDnull914 function Mix_SetMusicCMD( const command : PChar ) : integer;
915 cdecl; external {$IFDEF __GPC__}name 'Mix_SetMusicCMD'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
916 {$EXTERNALSYM Mix_SetMusicCMD}
917 
918 { Synchro value is set by MikMod from modules while playing }
Mix_SetSynchroValuenull919 function Mix_SetSynchroValue( value : integer ) : integer; overload;
920 cdecl; external {$IFDEF __GPC__}name 'Mix_SetSynchroValue'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
921 {$EXTERNALSYM Mix_SetSynchroValue}
922 
Mix_GetSynchroValuenull923 function Mix_GetSynchroValue : integer; overload;
924 cdecl; external {$IFDEF __GPC__}name 'Mix_GetSynchroValue'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
925 {$EXTERNALSYM Mix_SetSynchroValue}
926 
927 {
928   Get the Mix_Chunk currently associated with a mixer channel
929     Returns nil if it's an invalid channel, or there's no chunk associated.
930 }
Mix_GetChunknull931 function Mix_GetChunk( channel : integer ) : PMix_Chunk;
932 cdecl; external {$IFDEF __GPC__}name 'Mix_GetChunk'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
933 {$EXTERNALSYM Mix_GetChunk}
934 
935 { Close the mixer, halting all playing audio }
936 procedure Mix_CloseAudio;
937 cdecl; external {$IFDEF __GPC__}name 'Mix_CloseAudio'{$ELSE} SDL_MixerLibName{$ENDIF __GPC__};
938 {$EXTERNALSYM Mix_CloseAudio}
939 
940 {$ENDIF MORPHOS}
941 
942 { We'll use SDL for reporting errors }
943 procedure Mix_SetError( fmt : PChar );
944 
Mix_GetErrornull945 function Mix_GetError : PChar;
946 
947 {------------------------------------------------------------------------------}
948 { initialization                                                               }
949 {------------------------------------------------------------------------------}
950 
951 {------------------------------------------------------------------------------}
952 
953 implementation
954 
955 {$IFDEF __GPC__}
956   {$L 'sdl_mixer'}  { link sdl_mixer.dll.a or libsdl_mixer.so or libsdl_mixer.a }
957 {$ENDIF}
958 
959 procedure SDL_MIXER_VERSION( var X : TSDL_version );
960 begin
961   X.major := SDL_MIXER_MAJOR_VERSION;
962   X.minor := SDL_MIXER_MINOR_VERSION;
963   X.patch := SDL_MIXER_PATCHLEVEL;
964 end;
965 
Mix_LoadWAVnull966 function Mix_LoadWAV( filename : PChar ) : PMix_Chunk;
967 begin
968   result := Mix_LoadWAV_RW( SDL_RWFromFile( filename, 'rb' ), 1 );
969 end;
970 
Mix_PlayChannelnull971 function Mix_PlayChannel( channel : integer; chunk : PMix_Chunk; loops : integer ) : integer;
972 begin
973   result := Mix_PlayChannelTimed( channel, chunk, loops, -1 );
974 end;
975 
Mix_FadeInChannelnull976 function Mix_FadeInChannel( channel : integer; chunk : PMix_Chunk; loops :
977   integer; ms : integer ) : integer;
978 begin
979   result := Mix_FadeInChannelTimed( channel, chunk, loops, ms, -1 );
980 end;
981 
982 procedure Mix_SetError( fmt : PChar );
983 begin
984   SDL_SetError( fmt );
985 end;
986 
Mix_GetErrornull987 function Mix_GetError : PChar;
988 begin
989   result := SDL_GetError;
990 end;
991 
992 end.
993