66 WavFile(
const std::string& sFileName);
81 virtual void newFile()
override;
178 virtual std::vector<Sample>
readSome(
size_t len)
const override;
179 virtual void writeSome(
const std::vector<Sample> vSamples)
override;
This class extends the generic audio file with seeking functionalities as well as possibilities for r...
This class implements the wave file type using PCM encoding (the simplest encoding)....
virtual std::vector< Sample > readSome(size_t len) const override
Read a block of samples from the audio stream.
virtual size_t getLength() const override
Get the length in samples of the current file.
virtual void setSampleRate(size_t freq) override
Set the sample rate, which shall be used in the new file.
virtual bool isValid() const
Returns, whether the currently opened file is actually open and readable.
virtual void setChannels(size_t channels) override
Set the channels, which shall be used in the new file.
bool readHeader()
Private member function to read the wave file header to memory. It will ensure that the current file ...
virtual void write(const Sample &sample) override
Write a sample to the audio stream.
virtual ~WavFile()
Destructor. Will close the file stream and update the header.
virtual void writeSome(const std::vector< Sample > vSamples) override
Write a block of samples to the audio stream.
void closeFile()
Updates the wave file header, which is currently open, and closes the file afterwards.
virtual size_t getChannels() const override
Get the number of channels of the current file.
virtual Sample read() const override
Read a sample from the audio stream.
virtual void newFile() override
Prepares the wave file header for a new file, opens the stream and writes the header to the file....
virtual void setPosition(size_t pos) override
Set the current position in Samples in the current file.
std::fstream m_WavFileStream
WavFile(const std::string &sFileName)
Constructor. Tries to open the wave file, if it exists.
virtual size_t getPosition() const override
Get the current position in samples of the current file.
uint32_t m_DataBlockLength
const long long int m_StreamOffset
virtual size_t getSampleRate() const override
Get the sample rate of the current file.
Defines a sample in the audio stream, i.e. a single value per channel.