您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

71 行
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. #include <lol/engine-internal.h>
  11. #if defined USE_SDL_MIXER
  12. # if defined HAVE_SDL_SDL_H
  13. # include <SDL/SDL.h>
  14. # else
  15. # include <SDL.h>
  16. # endif
  17. # if defined HAVE_SDL_SDL_MIXER_H
  18. # include <SDL/SDL_mixer.h>
  19. # else
  20. # include <SDL_mixer.h>
  21. # endif
  22. #endif
  23. namespace lol
  24. {
  25. /*
  26. * Public Audio class
  27. */
  28. void Audio::Setup(int channels)
  29. {
  30. #if defined USE_SDL_MIXER
  31. Mix_OpenAudio(22050, AUDIO_S16, channels, 1024);
  32. #else
  33. UNUSED(channels);
  34. #endif
  35. }
  36. void Audio::SetVolume(int channel, int volume)
  37. {
  38. #if defined USE_SDL_MIXER
  39. Mix_Volume(channel,volume);
  40. #else
  41. UNUSED(channel);
  42. #endif
  43. }
  44. void Audio::MuteAll()
  45. {
  46. #if defined USE_SDL_MIXER
  47. Mix_Volume(-1,0);
  48. #else
  49. UNUSED(false);
  50. #endif
  51. }
  52. void Audio::UnmuteAll()
  53. {
  54. #if defined USE_SDL_MIXER
  55. Mix_Volume(-1,MIX_MAX_VOLUME);
  56. #else
  57. UNUSED(false);
  58. #endif
  59. }
  60. } /* namespace lol */