music_modplug.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. SDL_mixer: An audio mixer library based on the SDL library
  3. Copyright (C) 1997-2013 Sam Lantinga <[email protected]>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #ifdef MODPLUG_MUSIC
  19. #ifdef MODPLUG_HEADER
  20. #include MODPLUG_HEADER
  21. #else
  22. #include <libmodplug/modplug.h>
  23. #endif
  24. #include "SDL_rwops.h"
  25. #include "SDL_audio.h"
  26. #include "SDL_mixer.h"
  27. typedef struct {
  28. ModPlugFile *file;
  29. int playing;
  30. } modplug_data;
  31. int modplug_init(SDL_AudioSpec *mixer);
  32. /* Uninitialize the music players */
  33. void modplug_exit(void);
  34. /* Set the volume for a modplug stream */
  35. void modplug_setvolume(modplug_data *music, int volume);
  36. /* Load a modplug stream from an SDL_RWops object */
  37. modplug_data *modplug_new_RW(SDL_RWops *rw, int freerw);
  38. /* Start playback of a given modplug stream */
  39. void modplug_play(modplug_data *music);
  40. /* Return non-zero if a stream is currently playing */
  41. int modplug_playing(modplug_data *music);
  42. /* Play some of a stream previously started with modplug_play() */
  43. int modplug_playAudio(modplug_data *music, Uint8 *stream, int len);
  44. /* Stop playback of a stream previously started with modplug_play() */
  45. void modplug_stop(modplug_data *music);
  46. /* Close the given modplug stream */
  47. void modplug_delete(modplug_data *music);
  48. /* Jump (seek) to a given position (time is in seconds) */
  49. void modplug_jump_to_time(modplug_data *music, double time);
  50. #endif /* MODPLUG_MUSIC */