Open Source Tomb Raider Engine
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*!
  2. * \file include/Sound.h
  3. * \brief This is the audio manager Header
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _SOUND_H_
  9. #define _SOUND_H_
  10. /*!
  11. * \brief This is the audio manager for OpenRaider
  12. */
  13. class Sound {
  14. public:
  15. typedef enum {
  16. SoundFlagsNone = 0, //!< No FX
  17. SoundFlagsLoop = 1 //!< Enable looping during playback
  18. } SoundFlags;
  19. /*!
  20. * \brief Constructs an object of Sound
  21. */
  22. Sound();
  23. /*!
  24. * \brief Deconstructs an object of Sound
  25. */
  26. ~Sound();
  27. /*!
  28. * \brief Initialize sound system
  29. * \returns 0 on success or < 0 error flags
  30. */
  31. int init();
  32. /*!
  33. * \brief Move listener and repositions them
  34. * \param pos New position for listener
  35. * \param angle New orientation for listener
  36. */
  37. void listenAt(float pos[3], float angle[3]);
  38. /*!
  39. * \brief Move sound source to position
  40. * \param source valid source id
  41. * \param pos new position for source
  42. */
  43. void sourceAt(int source, float pos[3]);
  44. /*!
  45. * \brief Load wav file from disk
  46. * \param filename not NULL!
  47. * \param source not NULL! Returns new source ID or -1 on error.
  48. * \param flags (un)set options. Use SoundFlags enum
  49. * \returns 0 for no error or < 0 error flag
  50. */
  51. int addFile(const char *filename, int *source, unsigned int flags);
  52. /*!
  53. * \brief Load wav file from buffer
  54. * \param wav not NULL! Is a valid waveform buffer!
  55. * \param length length of wav buffer
  56. * \param source not NULL! Returns new source ID or -1 on error.
  57. * \param flags (un)set options. Use SoundFlags enum
  58. * \returns 0 for no error or < 0 error flag
  59. */
  60. int addWave(unsigned char *wav, unsigned int length, int *source, unsigned int flags);
  61. /*!
  62. * \brief Play sound source
  63. * \param source sound source to play
  64. */
  65. void play(int source);
  66. /*!
  67. * \brief Stop playing sound source
  68. * \param source sound source to stop
  69. */
  70. void stop(int source);
  71. private:
  72. bool mInit; //!< Guard to ensure ausio system is active
  73. unsigned int mBuffer[256]; //!< Audio buffer id list
  74. unsigned int mSource[256]; //!< Audio source id list
  75. unsigned int mNextBuffer; //!< Audio buffer id cursor
  76. unsigned int mNextSource; //!< Audio source id cursor
  77. };
  78. #endif