BsOAAudioSource.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsOAPrerequisites.h"
  5. #include "BsAudioSource.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup OpenAudio
  9. * @{
  10. */
  11. /** OpenAL implementation of an AudioSource. */
  12. class BS_OA_EXPORT OAAudioSource : public AudioSource
  13. {
  14. public:
  15. OAAudioSource();
  16. virtual ~OAAudioSource();
  17. /** @copydoc AudioSource::setClip */
  18. void setClip(const HAudioClip& clip) override;
  19. /** @copydoc AudioSource::setPosition */
  20. void setPosition(const Vector3& position) override;
  21. /** @copydoc AudioSource::setVelocity */
  22. void setVelocity(const Vector3& velocity) override;
  23. /** @copydoc AudioSource::setVolume */
  24. void setVolume(float volume) override;
  25. /** @copydoc AudioSource::setPitch */
  26. void setPitch(float pitch) override;
  27. /** @copydoc AudioSource::setIsLooping */
  28. void setIsLooping(bool loop) override;
  29. /** @copydoc AudioSource::setPriority */
  30. void setPriority(UINT32 priority) override;
  31. /** @copydoc AudioSource::setMinDistance */
  32. void setMinDistance(float distance) override;
  33. /** @copydoc AudioSource::setAttenuation */
  34. void setAttenuation(float attenuation) override;
  35. /** @copydoc AudioSource::play */
  36. void play() override;
  37. /** @copydoc AudioSource::pause */
  38. void pause() override;
  39. /** @copydoc AudioSource::stop */
  40. void stop() override;
  41. /** @copydoc AudioSource::seek */
  42. void seek(float position) override;
  43. private:
  44. friend class OAAudio;
  45. /** Destroys the internal representation of the audio source. */
  46. void clear();
  47. /** Rebuilds the internal representation of an audio source. */
  48. void rebuild();
  49. /**
  50. * Returns true if the sound source is three dimensional (volume and pitch varies based on listener distance
  51. * and velocity).
  52. */
  53. bool is3D() const;
  54. /**
  55. * Returns true if the audio source is receiving audio data from a separate thread (as opposed to loading it all
  56. * at once.
  57. */
  58. bool isStreaming() const;
  59. Vector<UINT32> mSourceIDs;
  60. UINT32 mSeekPosition;
  61. bool mRequiresStreaming;
  62. };
  63. /** @} */
  64. }