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

SoundManager.h 1.2KB

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. 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. 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