BsOAWaveReader.h 878 B

1234567891011121314151617181920212223242526272829303132333435
  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. namespace BansheeEngine
  6. {
  7. /** @addtogroup OpenAudio
  8. * @{
  9. */
  10. /** Used for reading .WAV audio files. */
  11. class OAWaveReader
  12. {
  13. public:
  14. OAWaveReader();
  15. bool open(const SPtr<DataStream>& stream, AudioFileInfo& info);
  16. void seek(UINT32 offset); // Offset in number of samples
  17. UINT32 read(UINT8* samples, UINT32 numSamples);
  18. static bool isValid(const SPtr<DataStream>& stream);
  19. private:
  20. bool parseHeader(AudioFileInfo& info);
  21. SPtr<DataStream> mStream;
  22. UINT32 mDataOffset;
  23. UINT32 mBytesPerSample;
  24. static const UINT32 MAIN_CHUNK_SIZE = 12;
  25. };
  26. /** @} */
  27. }