| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsOAPrerequisites.h"
- #include "BsOAFileReader.h"
- #include "FLAC\stream_decoder.h"
- namespace BansheeEngine
- {
- /** @addtogroup OpenAudio
- * @{
- */
- /** Data used by the FLAC decoder. */
- struct FLACDecoderData
- {
- SPtr<DataStream> stream;
- AudioFileInfo info;
- UINT8* output = nullptr;
- Vector<UINT8> overflow;
- UINT32 samplesToRead = 0;
- bool error = false;
- };
- /** Used for reading FLAC audio data. */
- class OAFLACReader : public OAFileReader
- {
- public:
- OAFLACReader();
- ~OAFLACReader();
- /** @copydoc OAFileReader::open */
- bool open(const SPtr<DataStream>& stream, AudioFileInfo& info) override;
- /** @copydoc OAFileReader::seek */
- void seek(UINT32 offset) override;
- /** @copydoc OAFileReader::read */
- UINT32 read(UINT8* samples, UINT32 numSamples) override;
- /** @copydoc OAFileReader::isValid */
- bool isValid(const SPtr<DataStream>& stream) override;
- private:
- /** Cleans up the FLAC decoder. */
- void close();
- FLAC__StreamDecoder* mDecoder;
- FLACDecoderData mData;
- };
- /** @} */
- }
|