You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 lines
1.3 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // Lol Engine is free software. It comes without any warranty, to
  7. // the extent permitted by applicable law. You can redistribute it
  8. // and/or modify it under the terms of the Do What the Fuck You Want
  9. // to Public License, Version 2, as published by the WTFPL Task Force.
  10. // See http://www.wtfpl.net/ for more details.
  11. //
  12. #include <lol/engine-internal.h>
  13. #if LOL_USE_SDL_MIXER
  14. # if HAVE_SDL_SDL_H
  15. # include <SDL/SDL.h>
  16. # include <SDL/SDL_mixer.h>
  17. # elif HAVE_SDL2_SDL_H
  18. # include <SDL2/SDL.h>
  19. # include <SDL2/SDL_mixer.h>
  20. # else
  21. # include <SDL.h>
  22. # include <SDL_mixer.h>
  23. # endif
  24. #endif
  25. namespace lol
  26. {
  27. /*
  28. * Public Audio class
  29. */
  30. void Audio::Setup(int channels)
  31. {
  32. #if defined LOL_USE_SDL_MIXER
  33. Mix_OpenAudio(22050, AUDIO_S16, channels, 1024);
  34. #else
  35. UNUSED(channels);
  36. #endif
  37. }
  38. void Audio::SetVolume(int channel, int volume)
  39. {
  40. #if defined LOL_USE_SDL_MIXER
  41. Mix_Volume(channel,volume);
  42. #else
  43. UNUSED(channel);
  44. #endif
  45. }
  46. void Audio::MuteAll()
  47. {
  48. #if defined LOL_USE_SDL_MIXER
  49. Mix_Volume(-1,0);
  50. #else
  51. UNUSED(false);
  52. #endif
  53. }
  54. void Audio::UnmuteAll()
  55. {
  56. #if defined LOL_USE_SDL_MIXER
  57. Mix_Volume(-1,MIX_MAX_VOLUME);
  58. #else
  59. UNUSED(false);
  60. #endif
  61. }
  62. } /* namespace lol */