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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*!
  2. * \file include/SoundManager.h
  3. * \brief This is the audio manager Header
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _SOUNDMANAGER_H_
  8. #define _SOUNDMANAGER_H_
  9. #include <vector>
  10. struct SoundSource {
  11. glm::vec3 pos;
  12. int id, flags;
  13. SoundSource(glm::vec3 p, int i, int f)
  14. : pos(p), id(i), flags(f) { }
  15. };
  16. struct SoundDetail {
  17. int sample;
  18. float volume;
  19. SoundDetail(int s, float v) : sample(s), volume(v) { }
  20. };
  21. class SoundManager {
  22. public:
  23. static void clear();
  24. static int prepareSources();
  25. static void addSoundSource(glm::vec3 p, int id, int flags);
  26. static void addSoundMapEntry(int id);
  27. static void addSoundDetail(int sample, float volume);
  28. static void addSampleIndex(int index);
  29. static int getIndex(int index, float* volume = nullptr);
  30. // index --> SoundMap --> SoundDetails --> SampleIndices --> play
  31. static int playSound(int index);
  32. static void display();
  33. private:
  34. static std::vector<SoundSource> soundSources;
  35. static std::vector<int> soundMap;
  36. static std::vector<SoundDetail> soundDetails;
  37. static std::vector<int> sampleIndices;
  38. };
  39. #endif