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