misc/winutils/include/SDL_mixer.h
changeset 6560 ca07e6be08d0
child 7809 7d4fb2f35f4f
equal deleted inserted replaced
6559:4590dca73904 6560:ca07e6be08d0
       
     1 /*
       
     2     SDL_mixer:  An audio mixer library based on the SDL library
       
     3     Copyright (C) 1997-2004 Sam Lantinga
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public
       
    16     License along with this library; if not, write to the Free
       
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18 
       
    19     Sam Lantinga
       
    20     slouken@libsdl.org
       
    21 */
       
    22 
       
    23 /* $Id: SDL_mixer.h,v 1.30 2004/01/04 17:37:04 slouken Exp $ */
       
    24 
       
    25 #ifndef _SDL_MIXER_H
       
    26 #define _SDL_MIXER_H
       
    27 
       
    28 #include "SDL_types.h"
       
    29 #include "SDL_rwops.h"
       
    30 #include "SDL_audio.h"
       
    31 #include "SDL_byteorder.h"
       
    32 #include "SDL_version.h"
       
    33 #include "begin_code.h"
       
    34 
       
    35 /* Set up for C function definitions, even when using C++ */
       
    36 #ifdef __cplusplus
       
    37 extern "C" {
       
    38 #endif
       
    39 
       
    40 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
       
    41 */
       
    42 #define SDL_MIXER_MAJOR_VERSION	1
       
    43 #define SDL_MIXER_MINOR_VERSION	2
       
    44 #define SDL_MIXER_PATCHLEVEL	6
       
    45 
       
    46 /* This macro can be used to fill a version structure with the compile-time
       
    47  * version of the SDL_mixer library.
       
    48  */
       
    49 #define SDL_MIXER_VERSION(X)						\
       
    50 {									\
       
    51 	(X)->major = SDL_MIXER_MAJOR_VERSION;				\
       
    52 	(X)->minor = SDL_MIXER_MINOR_VERSION;				\
       
    53 	(X)->patch = SDL_MIXER_PATCHLEVEL;				\
       
    54 }
       
    55 
       
    56 /* Backwards compatibility */
       
    57 #define MIX_MAJOR_VERSION	SDL_MIXER_MAJOR_VERSION
       
    58 #define MIX_MINOR_VERSION	SDL_MIXER_MINOR_VERSION
       
    59 #define MIX_PATCHLEVEL		SDL_MIXER_PATCHLEVEL
       
    60 #define MIX_VERSION(X)		SDL_MIXER_VERSION(X)
       
    61 
       
    62 /* This function gets the version of the dynamically linked SDL_mixer library.
       
    63    it should NOT be used to fill a version structure, instead you should
       
    64    use the SDL_MIXER_VERSION() macro.
       
    65  */
       
    66 extern DECLSPEC const SDL_version * SDLCALL Mix_Linked_Version(void);
       
    67 
       
    68 
       
    69 /* The default mixer has 8 simultaneous mixing channels */
       
    70 #ifndef MIX_CHANNELS
       
    71 #define MIX_CHANNELS	8
       
    72 #endif
       
    73 
       
    74 /* Good default values for a PC soundcard */
       
    75 #define MIX_DEFAULT_FREQUENCY	22050
       
    76 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
       
    77 #define MIX_DEFAULT_FORMAT	AUDIO_S16LSB
       
    78 #else
       
    79 #define MIX_DEFAULT_FORMAT	AUDIO_S16MSB
       
    80 #endif
       
    81 #define MIX_DEFAULT_CHANNELS	2
       
    82 #define MIX_MAX_VOLUME		128	/* Volume of a chunk */
       
    83 
       
    84 /* The internal format for an audio chunk */
       
    85 typedef struct {
       
    86 	int allocated;
       
    87 	Uint8 *abuf;
       
    88 	Uint32 alen;
       
    89 	Uint8 volume;		/* Per-sample volume, 0-128 */
       
    90 } Mix_Chunk;
       
    91 
       
    92 /* The different fading types supported */
       
    93 typedef enum {
       
    94 	MIX_NO_FADING,
       
    95 	MIX_FADING_OUT,
       
    96 	MIX_FADING_IN
       
    97 } Mix_Fading;
       
    98 
       
    99 typedef enum {
       
   100 	MUS_NONE,
       
   101 	MUS_CMD,
       
   102 	MUS_WAV,
       
   103 	MUS_MOD,
       
   104 	MUS_MID,
       
   105 	MUS_OGG,
       
   106 	MUS_MP3
       
   107 } Mix_MusicType;
       
   108 
       
   109 /* The internal format for a music chunk interpreted via mikmod */
       
   110 typedef struct _Mix_Music Mix_Music;
       
   111 
       
   112 /* Open the mixer with a certain audio format */
       
   113 extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels,
       
   114 							int chunksize);
       
   115 
       
   116 /* Dynamically change the number of channels managed by the mixer.
       
   117    If decreasing the number of channels, the upper channels are
       
   118    stopped.
       
   119    This function returns the new number of allocated channels.
       
   120  */
       
   121 extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans);
       
   122 
       
   123 /* Find out what the actual audio device parameters are.
       
   124    This function returns 1 if the audio has been opened, 0 otherwise.
       
   125  */
       
   126 extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels);
       
   127 
       
   128 /* Load a wave file or a music (.mod .s3m .it .xm) file */
       
   129 extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc);
       
   130 #define Mix_LoadWAV(file)	Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
       
   131 extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file);
       
   132 
       
   133 #ifdef USE_RWOPS /* This hasn't been hooked into music.c yet */
       
   134 /* Load a music file from an SDL_RWop object (MikMod-specific currently)
       
   135    Matt Campbell (matt@campbellhome.dhs.org) April 2000 */
       
   136 extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *rw);
       
   137 #endif
       
   138 
       
   139 /* Load a wave file of the mixer format from a memory buffer */
       
   140 extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_WAV(Uint8 *mem);
       
   141 
       
   142 /* Load raw audio data of the mixer format from a memory buffer */
       
   143 extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len);
       
   144 
       
   145 /* Free an audio chunk previously loaded */
       
   146 extern DECLSPEC void SDLCALL Mix_FreeChunk(Mix_Chunk *chunk);
       
   147 extern DECLSPEC void SDLCALL Mix_FreeMusic(Mix_Music *music);
       
   148 
       
   149 /* Find out the music format of a mixer music, or the currently playing
       
   150    music, if 'music' is NULL.
       
   151 */
       
   152 extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music);
       
   153 
       
   154 /* Set a function that is called after all mixing is performed.
       
   155    This can be used to provide real-time visual display of the audio stream
       
   156    or add a custom mixer filter for the stream data.
       
   157 */
       
   158 extern DECLSPEC void SDLCALL Mix_SetPostMix(void (*mix_func)
       
   159                              (void *udata, Uint8 *stream, int len), void *arg);
       
   160 
       
   161 /* Add your own music player or additional mixer function.
       
   162    If 'mix_func' is NULL, the default music player is re-enabled.
       
   163  */
       
   164 extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func)
       
   165                           (void *udata, Uint8 *stream, int len), void *arg);
       
   166 
       
   167 /* Add your own callback when the music has finished playing.
       
   168    This callback is only called if the music finishes naturally.
       
   169  */
       
   170 extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (*music_finished)(void));
       
   171 
       
   172 /* Get a pointer to the user data for the current music hook */
       
   173 extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void);
       
   174 
       
   175 /*
       
   176  * Add your own callback when a channel has finished playing. NULL
       
   177  *  to disable callback. The callback may be called from the mixer's audio 
       
   178  *  callback or it could be called as a result of Mix_HaltChannel(), etc.
       
   179  *  do not call SDL_LockAudio() from this callback; you will either be 
       
   180  *  inside the audio callback, or SDL_mixer will explicitly lock the audio
       
   181  *  before calling your callback.
       
   182  */
       
   183 extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel));
       
   184 
       
   185 
       
   186 /* Special Effects API by ryan c. gordon. (icculus@linuxgames.com) */
       
   187 
       
   188 #define MIX_CHANNEL_POST  -2
       
   189 
       
   190 /* This is the format of a special effect callback:
       
   191  *
       
   192  *   myeffect(int chan, void *stream, int len, void *udata);
       
   193  *
       
   194  * (chan) is the channel number that your effect is affecting. (stream) is
       
   195  *  the buffer of data to work upon. (len) is the size of (stream), and
       
   196  *  (udata) is a user-defined bit of data, which you pass as the last arg of
       
   197  *  Mix_RegisterEffect(), and is passed back unmolested to your callback.
       
   198  *  Your effect changes the contents of (stream) based on whatever parameters
       
   199  *  are significant, or just leaves it be, if you prefer. You can do whatever
       
   200  *  you like to the buffer, though, and it will continue in its changed state
       
   201  *  down the mixing pipeline, through any other effect functions, then finally
       
   202  *  to be mixed with the rest of the channels and music for the final output
       
   203  *  stream.
       
   204  *
       
   205  * DO NOT EVER call SDL_LockAudio() from your callback function!
       
   206  */
       
   207 typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata);
       
   208 
       
   209 /*
       
   210  * This is a callback that signifies that a channel has finished all its
       
   211  *  loops and has completed playback. This gets called if the buffer
       
   212  *  plays out normally, or if you call Mix_HaltChannel(), implicitly stop
       
   213  *  a channel via Mix_AllocateChannels(), or unregister a callback while
       
   214  *  it's still playing.
       
   215  *
       
   216  * DO NOT EVER call SDL_LockAudio() from your callback function!
       
   217  */
       
   218 typedef void (*Mix_EffectDone_t)(int chan, void *udata);
       
   219 
       
   220 
       
   221 /* Register a special effect function. At mixing time, the channel data is
       
   222  *  copied into a buffer and passed through each registered effect function.
       
   223  *  After it passes through all the functions, it is mixed into the final
       
   224  *  output stream. The copy to buffer is performed once, then each effect
       
   225  *  function performs on the output of the previous effect. Understand that
       
   226  *  this extra copy to a buffer is not performed if there are no effects
       
   227  *  registered for a given chunk, which saves CPU cycles, and any given
       
   228  *  effect will be extra cycles, too, so it is crucial that your code run
       
   229  *  fast. Also note that the data that your function is given is in the
       
   230  *  format of the sound device, and not the format you gave to Mix_OpenAudio(),
       
   231  *  although they may in reality be the same. This is an unfortunate but
       
   232  *  necessary speed concern. Use Mix_QuerySpec() to determine if you can
       
   233  *  handle the data before you register your effect, and take appropriate
       
   234  *  actions.
       
   235  * You may also specify a callback (Mix_EffectDone_t) that is called when
       
   236  *  the channel finishes playing. This gives you a more fine-grained control
       
   237  *  than Mix_ChannelFinished(), in case you need to free effect-specific
       
   238  *  resources, etc. If you don't need this, you can specify NULL.
       
   239  * You may set the callbacks before or after calling Mix_PlayChannel().
       
   240  * Things like Mix_SetPanning() are just internal special effect functions,
       
   241  *  so if you are using that, you've already incurred the overhead of a copy
       
   242  *  to a separate buffer, and that these effects will be in the queue with
       
   243  *  any functions you've registered. The list of registered effects for a
       
   244  *  channel is reset when a chunk finishes playing, so you need to explicitly
       
   245  *  set them with each call to Mix_PlayChannel*().
       
   246  * You may also register a special effect function that is to be run after
       
   247  *  final mixing occurs. The rules for these callbacks are identical to those
       
   248  *  in Mix_RegisterEffect, but they are run after all the channels and the
       
   249  *  music have been mixed into a single stream, whereas channel-specific
       
   250  *  effects run on a given channel before any other mixing occurs. These
       
   251  *  global effect callbacks are call "posteffects". Posteffects only have
       
   252  *  their Mix_EffectDone_t function called when they are unregistered (since
       
   253  *  the main output stream is never "done" in the same sense as a channel).
       
   254  *  You must unregister them manually when you've had enough. Your callback
       
   255  *  will be told that the channel being mixed is (MIX_CHANNEL_POST) if the
       
   256  *  processing is considered a posteffect.
       
   257  *
       
   258  * After all these effects have finished processing, the callback registered
       
   259  *  through Mix_SetPostMix() runs, and then the stream goes to the audio
       
   260  *  device. 
       
   261  *
       
   262  * DO NOT EVER call SDL_LockAudio() from your callback function!
       
   263  *
       
   264  * returns zero if error (no such channel), nonzero if added.
       
   265  *  Error messages can be retrieved from Mix_GetError().
       
   266  */
       
   267 extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f,
       
   268 					Mix_EffectDone_t d, void *arg);
       
   269 
       
   270 
       
   271 /* You may not need to call this explicitly, unless you need to stop an
       
   272  *  effect from processing in the middle of a chunk's playback.
       
   273  * Posteffects are never implicitly unregistered as they are for channels,
       
   274  *  but they may be explicitly unregistered through this function by
       
   275  *  specifying MIX_CHANNEL_POST for a channel.
       
   276  * returns zero if error (no such channel or effect), nonzero if removed.
       
   277  *  Error messages can be retrieved from Mix_GetError().
       
   278  */
       
   279 extern DECLSPEC int SDLCALL Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f);
       
   280 
       
   281 
       
   282 /* You may not need to call this explicitly, unless you need to stop all
       
   283  *  effects from processing in the middle of a chunk's playback. Note that
       
   284  *  this will also shut off some internal effect processing, since
       
   285  *  Mix_SetPanning() and others may use this API under the hood. This is
       
   286  *  called internally when a channel completes playback.
       
   287  * Posteffects are never implicitly unregistered as they are for channels,
       
   288  *  but they may be explicitly unregistered through this function by
       
   289  *  specifying MIX_CHANNEL_POST for a channel.
       
   290  * returns zero if error (no such channel), nonzero if all effects removed.
       
   291  *  Error messages can be retrieved from Mix_GetError().
       
   292  */
       
   293 extern DECLSPEC int SDLCALL Mix_UnregisterAllEffects(int channel);
       
   294 
       
   295 
       
   296 #define MIX_EFFECTSMAXSPEED  "MIX_EFFECTSMAXSPEED"
       
   297 
       
   298 /*
       
   299  * These are the internally-defined mixing effects. They use the same API that
       
   300  *  effects defined in the application use, but are provided here as a
       
   301  *  convenience. Some effects can reduce their quality or use more memory in
       
   302  *  the name of speed; to enable this, make sure the environment variable
       
   303  *  MIX_EFFECTSMAXSPEED (see above) is defined before you call
       
   304  *  Mix_OpenAudio().
       
   305  */
       
   306 
       
   307 
       
   308 /* Set the panning of a channel. The left and right channels are specified
       
   309  *  as integers between 0 and 255, quietest to loudest, respectively.
       
   310  *
       
   311  * Technically, this is just individual volume control for a sample with
       
   312  *  two (stereo) channels, so it can be used for more than just panning.
       
   313  *  If you want real panning, call it like this:
       
   314  *
       
   315  *   Mix_SetPanning(channel, left, 255 - left);
       
   316  *
       
   317  * ...which isn't so hard.
       
   318  *
       
   319  * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and
       
   320  *  the panning will be done to the final mixed stream before passing it on
       
   321  *  to the audio device.
       
   322  *
       
   323  * This uses the Mix_RegisterEffect() API internally, and returns without
       
   324  *  registering the effect function if the audio device is not configured
       
   325  *  for stereo output. Setting both (left) and (right) to 255 causes this
       
   326  *  effect to be unregistered, since that is the data's normal state.
       
   327  *
       
   328  * returns zero if error (no such channel or Mix_RegisterEffect() fails),
       
   329  *  nonzero if panning effect enabled. Note that an audio device in mono
       
   330  *  mode is a no-op, but this call will return successful in that case.
       
   331  *  Error messages can be retrieved from Mix_GetError().
       
   332  */
       
   333 extern DECLSPEC int SDLCALL Mix_SetPanning(int channel, Uint8 left, Uint8 right);
       
   334 
       
   335 
       
   336 /* Set the position of a channel. (angle) is an integer from 0 to 360, that
       
   337  *  specifies the location of the sound in relation to the listener. (angle)
       
   338  *  will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260).
       
   339  *  Angle 0 is due north, and rotates clockwise as the value increases.
       
   340  *  For efficiency, the precision of this effect may be limited (angles 1
       
   341  *  through 7 might all produce the same effect, 8 through 15 are equal, etc).
       
   342  *  (distance) is an integer between 0 and 255 that specifies the space
       
   343  *  between the sound and the listener. The larger the number, the further
       
   344  *  away the sound is. Using 255 does not guarantee that the channel will be
       
   345  *  culled from the mixing process or be completely silent. For efficiency,
       
   346  *  the precision of this effect may be limited (distance 0 through 5 might
       
   347  *  all produce the same effect, 6 through 10 are equal, etc). Setting (angle)
       
   348  *  and (distance) to 0 unregisters this effect, since the data would be
       
   349  *  unchanged.
       
   350  *
       
   351  * If you need more precise positional audio, consider using OpenAL for
       
   352  *  spatialized effects instead of SDL_mixer. This is only meant to be a
       
   353  *  basic effect for simple "3D" games.
       
   354  *
       
   355  * If the audio device is configured for mono output, then you won't get
       
   356  *  any effectiveness from the angle; however, distance attenuation on the
       
   357  *  channel will still occur. While this effect will function with stereo
       
   358  *  voices, it makes more sense to use voices with only one channel of sound,
       
   359  *  so when they are mixed through this effect, the positioning will sound
       
   360  *  correct. You can convert them to mono through SDL before giving them to
       
   361  *  the mixer in the first place if you like.
       
   362  *
       
   363  * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and
       
   364  *  the positioning will be done to the final mixed stream before passing it
       
   365  *  on to the audio device.
       
   366  *
       
   367  * This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning().
       
   368  *
       
   369  * returns zero if error (no such channel or Mix_RegisterEffect() fails),
       
   370  *  nonzero if position effect is enabled.
       
   371  *  Error messages can be retrieved from Mix_GetError().
       
   372  */
       
   373 extern DECLSPEC int SDLCALL Mix_SetPosition(int channel, Sint16 angle, Uint8 distance);
       
   374 
       
   375 
       
   376 /* Set the "distance" of a channel. (distance) is an integer from 0 to 255
       
   377  *  that specifies the location of the sound in relation to the listener.
       
   378  *  Distance 0 is overlapping the listener, and 255 is as far away as possible
       
   379  *  A distance of 255 does not guarantee silence; in such a case, you might
       
   380  *  want to try changing the chunk's volume, or just cull the sample from the
       
   381  *  mixing process with Mix_HaltChannel().
       
   382  * For efficiency, the precision of this effect may be limited (distances 1
       
   383  *  through 7 might all produce the same effect, 8 through 15 are equal, etc).
       
   384  *  (distance) is an integer between 0 and 255 that specifies the space
       
   385  *  between the sound and the listener. The larger the number, the further
       
   386  *  away the sound is.
       
   387  * Setting (distance) to 0 unregisters this effect, since the data would be
       
   388  *  unchanged.
       
   389  * If you need more precise positional audio, consider using OpenAL for
       
   390  *  spatialized effects instead of SDL_mixer. This is only meant to be a
       
   391  *  basic effect for simple "3D" games.
       
   392  *
       
   393  * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and
       
   394  *  the distance attenuation will be done to the final mixed stream before
       
   395  *  passing it on to the audio device.
       
   396  *
       
   397  * This uses the Mix_RegisterEffect() API internally.
       
   398  *
       
   399  * returns zero if error (no such channel or Mix_RegisterEffect() fails),
       
   400  *  nonzero if position effect is enabled.
       
   401  *  Error messages can be retrieved from Mix_GetError().
       
   402  */
       
   403 extern DECLSPEC int SDLCALL Mix_SetDistance(int channel, Uint8 distance);
       
   404 
       
   405 
       
   406 /*
       
   407  * !!! FIXME : Haven't implemented, since the effect goes past the
       
   408  *              end of the sound buffer. Will have to think about this.
       
   409  *               --ryan.
       
   410  */
       
   411 #if 0
       
   412 /* Causes an echo effect to be mixed into a sound. (echo) is the amount
       
   413  *  of echo to mix. 0 is no echo, 255 is infinite (and probably not
       
   414  *  what you want).
       
   415  *
       
   416  * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and
       
   417  *  the reverbing will be done to the final mixed stream before passing it on
       
   418  *  to the audio device.
       
   419  *
       
   420  * This uses the Mix_RegisterEffect() API internally. If you specify an echo
       
   421  *  of zero, the effect is unregistered, as the data is already in that state.
       
   422  *
       
   423  * returns zero if error (no such channel or Mix_RegisterEffect() fails),
       
   424  *  nonzero if reversing effect is enabled.
       
   425  *  Error messages can be retrieved from Mix_GetError().
       
   426  */
       
   427 extern no_parse_DECLSPEC int SDLCALL Mix_SetReverb(int channel, Uint8 echo);
       
   428 #endif
       
   429 
       
   430 /* Causes a channel to reverse its stereo. This is handy if the user has his
       
   431  *  speakers hooked up backwards, or you would like to have a minor bit of
       
   432  *  psychedelia in your sound code.  :)  Calling this function with (flip)
       
   433  *  set to non-zero reverses the chunks's usual channels. If (flip) is zero,
       
   434  *  the effect is unregistered.
       
   435  *
       
   436  * This uses the Mix_RegisterEffect() API internally, and thus is probably
       
   437  *  more CPU intensive than having the user just plug in his speakers
       
   438  *  correctly. Mix_SetReverseStereo() returns without registering the effect
       
   439  *  function if the audio device is not configured for stereo output.
       
   440  *
       
   441  * If you specify MIX_CHANNEL_POST for (channel), then this the effect is used
       
   442  *  on the final mixed stream before sending it on to the audio device (a
       
   443  *  posteffect).
       
   444  *
       
   445  * returns zero if error (no such channel or Mix_RegisterEffect() fails),
       
   446  *  nonzero if reversing effect is enabled. Note that an audio device in mono
       
   447  *  mode is a no-op, but this call will return successful in that case.
       
   448  *  Error messages can be retrieved from Mix_GetError().
       
   449  */
       
   450 extern DECLSPEC int SDLCALL Mix_SetReverseStereo(int channel, int flip);
       
   451 
       
   452 /* end of effects API. --ryan. */
       
   453 
       
   454 
       
   455 /* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate
       
   456    them dynamically to the next sample if requested with a -1 value below.
       
   457    Returns the number of reserved channels.
       
   458  */
       
   459 extern DECLSPEC int SDLCALL Mix_ReserveChannels(int num);
       
   460 
       
   461 /* Channel grouping functions */
       
   462 
       
   463 /* Attach a tag to a channel. A tag can be assigned to several mixer
       
   464    channels, to form groups of channels.
       
   465    If 'tag' is -1, the tag is removed (actually -1 is the tag used to
       
   466    represent the group of all the channels).
       
   467    Returns true if everything was OK.
       
   468  */
       
   469 extern DECLSPEC int SDLCALL Mix_GroupChannel(int which, int tag);
       
   470 /* Assign several consecutive channels to a group */
       
   471 extern DECLSPEC int SDLCALL Mix_GroupChannels(int from, int to, int tag);
       
   472 /* Finds the first available channel in a group of channels,
       
   473    returning -1 if none are available.
       
   474  */
       
   475 extern DECLSPEC int SDLCALL Mix_GroupAvailable(int tag);
       
   476 /* Returns the number of channels in a group. This is also a subtle
       
   477    way to get the total number of channels when 'tag' is -1
       
   478  */
       
   479 extern DECLSPEC int SDLCALL Mix_GroupCount(int tag);
       
   480 /* Finds the "oldest" sample playing in a group of channels */
       
   481 extern DECLSPEC int SDLCALL Mix_GroupOldest(int tag);
       
   482 /* Finds the "most recent" (i.e. last) sample playing in a group of channels */
       
   483 extern DECLSPEC int SDLCALL Mix_GroupNewer(int tag);
       
   484 
       
   485 /* Play an audio chunk on a specific channel.
       
   486    If the specified channel is -1, play on the first free channel.
       
   487    If 'loops' is greater than zero, loop the sound that many times.
       
   488    If 'loops' is -1, loop inifinitely (~65000 times).
       
   489    Returns which channel was used to play the sound.
       
   490 */
       
   491 #define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1)
       
   492 /* The same as above, but the sound is played at most 'ticks' milliseconds */
       
   493 extern DECLSPEC int SDLCALL Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks);
       
   494 extern DECLSPEC int SDLCALL Mix_PlayMusic(Mix_Music *music, int loops);
       
   495 
       
   496 /* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */
       
   497 extern DECLSPEC int SDLCALL Mix_FadeInMusic(Mix_Music *music, int loops, int ms);
       
   498 extern DECLSPEC int SDLCALL Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position);
       
   499 #define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1)
       
   500 extern DECLSPEC int SDLCALL Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks);
       
   501 
       
   502 /* Set the volume in the range of 0-128 of a specific channel or chunk.
       
   503    If the specified channel is -1, set volume for all channels.
       
   504    Returns the original volume.
       
   505    If the specified volume is -1, just return the current volume.
       
   506 */
       
   507 extern DECLSPEC int SDLCALL Mix_Volume(int channel, int volume);
       
   508 extern DECLSPEC int SDLCALL Mix_VolumeChunk(Mix_Chunk *chunk, int volume);
       
   509 extern DECLSPEC int SDLCALL Mix_VolumeMusic(int volume);
       
   510 
       
   511 /* Halt playing of a particular channel */
       
   512 extern DECLSPEC int SDLCALL Mix_HaltChannel(int channel);
       
   513 extern DECLSPEC int SDLCALL Mix_HaltGroup(int tag);
       
   514 extern DECLSPEC int SDLCALL Mix_HaltMusic(void);
       
   515 
       
   516 /* Change the expiration delay for a particular channel.
       
   517    The sample will stop playing after the 'ticks' milliseconds have elapsed,
       
   518    or remove the expiration if 'ticks' is -1
       
   519 */
       
   520 extern DECLSPEC int SDLCALL Mix_ExpireChannel(int channel, int ticks);
       
   521 
       
   522 /* Halt a channel, fading it out progressively till it's silent
       
   523    The ms parameter indicates the number of milliseconds the fading
       
   524    will take.
       
   525  */
       
   526 extern DECLSPEC int SDLCALL Mix_FadeOutChannel(int which, int ms);
       
   527 extern DECLSPEC int SDLCALL Mix_FadeOutGroup(int tag, int ms);
       
   528 extern DECLSPEC int SDLCALL Mix_FadeOutMusic(int ms);
       
   529 
       
   530 /* Query the fading status of a channel */
       
   531 extern DECLSPEC Mix_Fading SDLCALL Mix_FadingMusic(void);
       
   532 extern DECLSPEC Mix_Fading SDLCALL Mix_FadingChannel(int which);
       
   533 
       
   534 /* Pause/Resume a particular channel */
       
   535 extern DECLSPEC void SDLCALL Mix_Pause(int channel);
       
   536 extern DECLSPEC void SDLCALL Mix_Resume(int channel);
       
   537 extern DECLSPEC int SDLCALL Mix_Paused(int channel);
       
   538 
       
   539 /* Pause/Resume the music stream */
       
   540 extern DECLSPEC void SDLCALL Mix_PauseMusic(void);
       
   541 extern DECLSPEC void SDLCALL Mix_ResumeMusic(void);
       
   542 extern DECLSPEC void SDLCALL Mix_RewindMusic(void);
       
   543 extern DECLSPEC int SDLCALL Mix_PausedMusic(void);
       
   544 
       
   545 /* Set the current position in the music stream.
       
   546    This returns 0 if successful, or -1 if it failed or isn't implemented.
       
   547    This function is only implemented for MOD music formats (set pattern
       
   548    order number) and for OGG music (set position in seconds), at the
       
   549    moment.
       
   550 */
       
   551 extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position);
       
   552 
       
   553 /* Check the status of a specific channel.
       
   554    If the specified channel is -1, check all channels.
       
   555 */
       
   556 extern DECLSPEC int SDLCALL Mix_Playing(int channel);
       
   557 extern DECLSPEC int SDLCALL Mix_PlayingMusic(void);
       
   558 
       
   559 /* Stop music and set external music playback command */
       
   560 extern DECLSPEC int SDLCALL Mix_SetMusicCMD(const char *command);
       
   561 
       
   562 /* Synchro value is set by MikMod from modules while playing */
       
   563 extern DECLSPEC int SDLCALL Mix_SetSynchroValue(int value);
       
   564 extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void);
       
   565 
       
   566 /* Get the Mix_Chunk currently associated with a mixer channel
       
   567     Returns NULL if it's an invalid channel, or there's no chunk associated.
       
   568 */
       
   569 extern DECLSPEC Mix_Chunk * SDLCALL Mix_GetChunk(int channel);
       
   570 
       
   571 /* Close the mixer, halting all playing audio */
       
   572 extern DECLSPEC void SDLCALL Mix_CloseAudio(void);
       
   573 
       
   574 /* We'll use SDL for reporting errors */
       
   575 #define Mix_SetError	SDL_SetError
       
   576 #define Mix_GetError	SDL_GetError
       
   577 
       
   578 /* Ends C function definitions when using C++ */
       
   579 #ifdef __cplusplus
       
   580 }
       
   581 #endif
       
   582 #include "close_code.h"
       
   583 
       
   584 #endif /* _SDL_MIXER_H */