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