Open Source Tomb Raider Engine
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.

Sound.cpp 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*!
  2. * \file src/system/Sound.cpp
  3. * \brief This is the audio manager Implementation
  4. *
  5. * \author xythobuz
  6. */
  7. #include "global.h"
  8. #include "system/Sound.h"
  9. #ifdef USING_AL
  10. #include "system/SoundAL.h"
  11. #endif
  12. int Sound::initialize() {
  13. #ifdef USING_AL
  14. return SoundAL::initialize();
  15. #else
  16. return 0;
  17. #endif
  18. }
  19. void Sound::shutdown() {
  20. #ifdef USING_AL
  21. SoundAL::shutdown();
  22. #endif
  23. }
  24. void Sound::clear() {
  25. #ifdef USING_AL
  26. SoundAL::clear();
  27. #endif
  28. }
  29. int Sound::numBuffers() {
  30. #ifdef USING_AL
  31. return SoundAL::numBuffers();
  32. #else
  33. return 0;
  34. #endif
  35. }
  36. int Sound::loadBuffer(unsigned char* buffer, unsigned int length) {
  37. #ifdef USING_AL
  38. return SoundAL::loadBuffer(buffer, length);
  39. #else
  40. return 0;
  41. #endif
  42. }
  43. int Sound::numSources(bool atListener) {
  44. #ifdef USING_AL
  45. return SoundAL::numSources(atListener);
  46. #else
  47. return 0;
  48. #endif
  49. }
  50. int Sound::addSource(int buffer, float volume, bool atListener, bool loop) {
  51. #ifdef USING_AL
  52. return SoundAL::addSource(buffer, volume, atListener, loop);
  53. #else
  54. return 0;
  55. #endif
  56. }
  57. int Sound::sourceAt(int source, glm::vec3 pos) {
  58. #ifdef USING_AL
  59. return SoundAL::sourceAt(source, pos);
  60. #else
  61. return 0;
  62. #endif
  63. }
  64. void Sound::listenAt(glm::vec3 pos, glm::vec3 at, glm::vec3 up) {
  65. #ifdef USING_AL
  66. SoundAL::listenAt(pos, at, up);
  67. #endif
  68. }
  69. void Sound::play(int source, bool atListener) {
  70. #ifdef USING_AL
  71. SoundAL::play(source, atListener);
  72. #endif
  73. }
  74. void Sound::stop(int source) {
  75. #ifdef USING_AL
  76. SoundAL::stop(source);
  77. #endif
  78. }
  79. void Sound::stopAll() {
  80. #ifdef USING_AL
  81. SoundAL::stopAll();
  82. #endif
  83. }
  84. void Sound::setEnabled(bool on) {
  85. #ifdef USING_AL
  86. SoundAL::setEnabled(on);
  87. #endif
  88. }
  89. bool Sound::getEnabled() {
  90. #ifdef USING_AL
  91. return SoundAL::getEnabled();
  92. #else
  93. return false;
  94. #endif
  95. }
  96. void Sound::setVolume(float vol) {
  97. #ifdef USING_AL
  98. SoundAL::setVolume(vol);
  99. #endif
  100. }
  101. float Sound::getVolume() {
  102. #ifdef USING_AL
  103. return SoundAL::getVolume();
  104. #else
  105. return 0.0f;
  106. #endif
  107. }