SDL_Mixer.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. Copyright (C) 2011 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. #ifndef doomengine_SDL_Mixer_h
  16. #define doomengine_SDL_Mixer_h
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /*
  21. ===============================
  22. This is a minimal implemenation of SDL_Mixer for iOS, just to get MIDI files
  23. playing so that we can play the music directly from the WADs.
  24. ===============================
  25. */
  26. #include <stdint.h>
  27. typedef struct Mix_Music_tag {
  28. char unused;
  29. } Mix_Music;
  30. /* Open the mixer with a certain audio format */
  31. extern int Mix_OpenAudio(int frequency, uint16_t format, int channels,
  32. int chunksize);
  33. /* Close the mixer, halting all playing audio */
  34. extern void Mix_CloseAudio(void);
  35. /* Set a function that is called after all mixing is performed.
  36. This can be used to provide real-time visual display of the audio stream
  37. or add a custom mixer filter for the stream data.
  38. */
  39. extern void Mix_SetPostMix(void (*mix_func)
  40. (void *udata, uint8_t *stream, int len), void *arg);
  41. /* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */
  42. extern int Mix_FadeInMusic(Mix_Music *music, int loops, int ms);
  43. /* Pause/Resume the music stream */
  44. extern void Mix_PauseMusic(void);
  45. extern void Mix_ResumeMusic(void);
  46. /* Halt a channel, fading it out progressively till it's silent
  47. The ms parameter indicates the number of milliseconds the fading
  48. will take.
  49. */
  50. extern int Mix_FadeOutMusic(int ms);
  51. /* Free an audio chunk previously loaded */
  52. extern void Mix_FreeMusic(Mix_Music *music);
  53. /* Load a wave file or a music (.mod .s3m .it .xm) file */
  54. extern Mix_Music * Mix_LoadMUS(const char *file);
  55. extern const char * Mix_GetError(void);
  56. /* Set the volume in the range of 0-128 of a specific channel or chunk.
  57. If the specified channel is -1, set volume for all channels.
  58. Returns the original volume.
  59. If the specified volume is -1, just return the current volume.
  60. */
  61. extern int Mix_VolumeMusic(int volume);
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif