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.

SoundManager.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. float x, y, z;
  12. int id, flags;
  13. SoundSource(float _x, float _y, float _z, int i, int f)
  14. : x(_x), y(_y), z(_z), 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(float x, float y, float z, 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 sizeSoundMap();
  30. static int getIndex(int index, float* volume = nullptr);
  31. // index --> SoundMap --> SoundDetails --> SampleIndices --> play
  32. static int playSound(int index);
  33. static void display();
  34. private:
  35. static std::vector<SoundSource> soundSources;
  36. static std::vector<int> soundMap;
  37. static std::vector<SoundDetail> soundDetails;
  38. static std::vector<int> sampleIndices;
  39. };
  40. #endif