選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

75 行
1.2 KiB

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