2015-09-17 19:47:58 +00:00
|
|
|
#ifndef LIPSYNC_WAVFILEREADER_H
|
|
|
|
#define LIPSYNC_WAVFILEREADER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <fstream>
|
2015-11-19 20:17:35 +00:00
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
#include <boost/filesystem/fstream.hpp>
|
2015-09-17 19:47:58 +00:00
|
|
|
#include "AudioStream.h"
|
|
|
|
|
|
|
|
enum class SampleFormat {
|
|
|
|
UInt8,
|
|
|
|
Int16,
|
|
|
|
Int24,
|
|
|
|
Float32
|
|
|
|
};
|
|
|
|
|
|
|
|
class WaveFileReader : public AudioStream {
|
|
|
|
public:
|
2015-11-19 20:17:35 +00:00
|
|
|
WaveFileReader(boost::filesystem::path filePath);
|
2015-09-17 19:47:58 +00:00
|
|
|
virtual int getFrameRate() override ;
|
|
|
|
virtual int getFrameCount() override;
|
|
|
|
virtual int getChannelCount() override;
|
|
|
|
virtual bool getNextSample(float &sample) override;
|
|
|
|
|
|
|
|
private:
|
2015-11-19 20:17:35 +00:00
|
|
|
boost::filesystem::ifstream file;
|
2015-09-17 19:47:58 +00:00
|
|
|
SampleFormat sampleFormat;
|
|
|
|
int frameRate;
|
|
|
|
int frameCount;
|
|
|
|
int channelCount;
|
|
|
|
int remainingSamples;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //LIPSYNC_WAVFILEREADER_H
|