Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*!
  2. * \file include/SoundAL.h
  3. * \brief This is the OpenAL audio manager Header
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _SOUND_AL_H_
  9. #define _SOUND_AL_H_
  10. #include <vector>
  11. #include "Sound.h"
  12. /*!
  13. * \brief This is the OpenAL audio manager
  14. */
  15. class SoundAL : public Sound {
  16. public:
  17. /*!
  18. * \brief Constructs an object of SoundAL
  19. */
  20. SoundAL();
  21. /*!
  22. * \brief Deconstructs an object of SoundAL
  23. */
  24. virtual ~SoundAL();
  25. /*!
  26. * \brief Initialize sound system
  27. * \returns 0 on success or < 0 error flags
  28. */
  29. virtual int initialize();
  30. virtual void setEnabled(bool on);
  31. /*!
  32. * \brief Set the volume
  33. * \param vol new source gain
  34. */
  35. virtual void setVolume(float vol);
  36. /*!
  37. * \brief Get number of registered sources
  38. * \returns number of registered sources
  39. */
  40. virtual unsigned long registeredSources();
  41. /*!
  42. * \brief Remove all loaded sounds
  43. */
  44. virtual void clear();
  45. /*!
  46. * \brief Move listener and repositions them
  47. * \param pos New position for listener
  48. * \param angle New orientation for listener
  49. */
  50. virtual void listenAt(float pos[3], float angle[3]);
  51. /*!
  52. * \brief Move sound source to position
  53. * \param source valid source id
  54. * \param pos new position for source
  55. */
  56. virtual void sourceAt(unsigned long source, float pos[3]);
  57. /*!
  58. * \brief Load wav file from disk
  59. * \param filename not NULL!
  60. * \param source not NULL! Returns new source ID or -1 on error.
  61. * \param flags set options. Use SoundFlags enum bitwise OR-ed
  62. * \returns 0 for no error or < 0 error flag
  63. */
  64. virtual int addFile(const char* filename, unsigned long* source, unsigned int flags);
  65. /*!
  66. * \brief Load wav file from buffer
  67. * \param wav not NULL! Is a valid waveform buffer!
  68. * \param length length of wav buffer
  69. * \param source not NULL! Returns new source ID or -1 on error.
  70. * \param flags set options. Use SoundFlags enum bitwise OR-ed
  71. * \returns 0 for no error or < 0 error flag
  72. */
  73. virtual int addWave(unsigned char* wav, unsigned int length, unsigned long* source,
  74. unsigned int flags);
  75. /*!
  76. * \brief Play sound source
  77. * \param source sound source to play
  78. */
  79. virtual void play(unsigned long source);
  80. /*!
  81. * \brief Stop playing sound source
  82. * \param source sound source to stop
  83. */
  84. virtual void stop(unsigned long source);
  85. private:
  86. bool mEnabled;
  87. bool mInit; //!< Guard to ensure ausio system is active
  88. float mVolume; //!< Listener gain
  89. std::vector<unsigned int> mBuffer; //!< Audio buffer id list
  90. std::vector<unsigned int> mSource; //!< Audio source id list
  91. };
  92. #endif