Sound.pkg 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. $#include "Sound.h"
  2. /// %Sound resource.
  3. class Sound : public Resource
  4. {
  5. public:
  6. /// Set uncompressed sound data format.
  7. void SetFormat(unsigned frequency, bool sixteenBit, bool stereo);
  8. /// Set loop on/off. If loop is enabled, sets the full sound as loop range.
  9. void SetLooped(bool enable);
  10. /// Define loop.
  11. void SetLoop(unsigned repeatOffset, unsigned endOffset);
  12. /// Fix interpolation by copying data from loop start to loop end (looped), or adding silence (oneshot.)
  13. void FixInterpolation();
  14. /// Return sound data start.
  15. signed char* GetStart() const { return data_.Get(); }
  16. /// Return loop start.
  17. signed char* GetRepeat() const { return repeat_; }
  18. /// Return sound data end.
  19. signed char* GetEnd() const { return end_; }
  20. /// Return length in seconds.
  21. float GetLength() const;
  22. /// Return total sound data size.
  23. unsigned GetDataSize() const { return dataSize_; }
  24. /// Return sample size.
  25. unsigned GetSampleSize() const;
  26. /// Return default frequency as a float.
  27. float GetFrequency() { return (float)frequency_; }
  28. /// Return default frequency as an integer.
  29. unsigned GetIntFrequency() { return frequency_; }
  30. /// Return whether is looped.
  31. bool IsLooped() const { return looped_; }
  32. /// Return whether data is sixteen bit.
  33. bool IsSixteenBit() const { return sixteenBit_; }
  34. /// Return whether data is stereo.
  35. bool IsStereo() const { return stereo_; }
  36. /// Return whether is compressed in Ogg Vorbis format.
  37. bool IsCompressed() const { return compressed_; }
  38. };