|
Eric Oulashin's C++ Audio Mixer 1.0
|
#include <WAVFile.h>


Public Member Functions | |
| WAVFile (const std::string &pFilename) | |
| WAVFile (const std::string &pFilename, const WAVFileInfo &pWAVFileInfo) | |
| WAVFile (const std::string &pFilename, AudioFileModes pFileMode) | |
| WAVFile (const WAVFile &pWAVFile) | |
| ~WAVFile () | |
| void | setAudioFileInfo (const AudioFileInfo &pAudioFileInfo) override |
| AudioFileResultType | open (AudioFileModes pOpenMode) override |
| void | close () override |
| Closes the WAV file. | |
| const WAVFileInfo & | getFileInfo () const |
| Returns a WAVFileInfo object with information about the WAV file. | |
| AudioFileResultType | getNextSample_int64 (int64_t &pAudioSample) override |
| Gets the next sample from the file, cast to a 64-bit integer. | |
| AudioFileResultType | writeSample_int64 (int64_t pAudioSample) override |
| Writes an audio sample to the file. The parameter is a 64-bit integer but will be cast to the bitness of the audio samples in the file. | |
| AudioFileResultType | getHighestSampleValue_int64 (int64_t &pHighestAudioSample) override |
| Gets the highest audio sample value from the file, cast to a 64-bit integer. | |
| template<class SampleType > | |
| AudioFileResultType | getNextSample (SampleType &pAudioSample) |
| Gets the next audio sample from the file. This is templated so that the proper variable type can be used to store the audio sample value. | |
| template<class SampleType > | |
| AudioFileResultType | writeSample (SampleType pAudioSample) |
| Writes an audio sample to the file. This is templated so that the proper variable type can be used for the audio sample value. | |
| AudioFileResultType | goToAudioDataPos () override |
| Goes to the audio data position in the WAV file. | |
| size_t | numSamples () const override |
| Returns the number of audio samples in the WAV file. | |
| int64_t | maxValueForSampleSize () const override |
| Returns the maximum possible positive value of the audio file's sample size. | |
| void | seekOutputToSampleNum (size_t pSampleNum) override |
| template<class SampleType > | |
| AudioFileResultType | getHighestSampleValue (SampleType &pAudioSample) |
| Gets the highest audio sample value from the file. This is templated so that the proper variable type can be used to store the audio sample value. | |
| AudioFileInfo | getAudioFileInfo () const override |
| Returns an AudioFile object with information about the audio file. | |
Public Member Functions inherited from EOUtils::AudioFile | |
| AudioFile (const std::string &pFilename) | |
| Constructor. | |
| AudioFile (const std::string &pFilename, AudioFileModes pFileMode) | |
| AudioFile (const AudioFile &pAudioFile) | |
| virtual | ~AudioFile () |
| virtual bool | isOpen () const |
| Returns whether or not the audio file is open. | |
| virtual bool | hasReadMode () const |
| Returns whether or not read mode is enabled for the file. | |
| virtual bool | hasWriteMode () const |
| Returns whether or not write mode is enabled for the file. | |
| const std::string & | Filename () const |
| Gets the filename of the audio file. | |
| void | Filename (const std::string &pFilename) |
| Setter for the filename of the audio file. | |
| void | setMetadata (const std::string &pName, const std::string &pValue) |
| Adds a piece of metadata for the audio file. | |
| template<typename T > | |
| void | setMetadataFromVal (const std::string &pName, const T &pValue) |
| Adds a piece of metadata for the audio file. Templatized for any value type. The value will be converted to a string to store in the metadata. | |
| AudioFileResultType | getMetadata (const std::string &pName, std::string &pValue) const |
| Gets a metadata value as a string. | |
| template<typename T > | |
| AudioFileResultType | getMetadataAs (const std::string &pName, T &pValue) const |
| Gets a metadata value. Templatized to capture the value as any type. | |
| std::string | getMetadata (const std::string &pName) const |
| Gets a metadata value. | |
| template<typename T > | |
| T | getMetadataAs (const std::string &pName) const |
| template<typename T > | |
| T | getMetadataAs (const std::string &pName, const T &pDefaultVal) const |
| Gets a metadata value. Templatized to return it as any type. | |
| bool | hasMetadata (const std::string &pName) const |
| Returns whether or not a metadata item exists. | |
Static Public Member Functions | |
| template<class SampleType > | |
| static AudioFileResultType | getHighestSampleValue (const char *pFilename, SampleType &pAudioSample) |
Additional Inherited Members | |
Protected Member Functions inherited from EOUtils::AudioFile | |
| virtual std::streampos | fileSizeAccordingToStream () |
| virtual void | setFileMode (AudioFileModes pFileMode) |
Protected Attributes inherited from EOUtils::AudioFile | |
| std::string | mFilename |
| std::fstream | mFileStream |
| std::ios_base::openmode | mFileOpenMode |
| size_t | mDataSizeBytes |
| std::map< std::string, std::string > | mMetadata |
| EOUtils::WAVFile::WAVFile | ( | const std::string & | pFilename | ) |
| EOUtils::WAVFile::WAVFile | ( | const std::string & | pFilename, |
| const WAVFileInfo & | pWAVFileInfo | ||
| ) |
| EOUtils::WAVFile::WAVFile | ( | const std::string & | pFilename, |
| AudioFileModes | pFileMode | ||
| ) |
| EOUtils::WAVFile::WAVFile | ( | const WAVFile & | pWAVFile | ) |
| EOUtils::WAVFile::~WAVFile | ( | ) |
|
overridevirtual |
Closes the WAV file.
Reimplemented from EOUtils::AudioFile.
References EOUtils::AudioFile::fileSizeAccordingToStream(), EOUtils::AudioFile::hasWriteMode(), EOUtils::AudioFile::mFileStream, EOUtils::WAVFileInfo::updateDataSizeSizeInFile(), EOUtils::WAVFileInfo::updateFileSizeSizeInFile(), and EOUtils::WAVFileInfo::WAVFileHdrSize().
Referenced by getHighestSampleValue().
|
overridevirtual |
Returns an AudioFile object with information about the audio file.
Implements EOUtils::AudioFile.
| const WAVFileInfo & EOUtils::WAVFile::getFileInfo | ( | ) | const |
Returns a WAVFileInfo object with information about the WAV file.
|
inlinestatic |
References EOUtils::AUDIO_FILE_READ, close(), getHighestSampleValue(), open(), and result.
|
inline |
Gets the highest audio sample value from the file. This is templated so that the proper variable type can be used to store the audio sample value.
| [out] | pAudioSample | Templatized variable to store the highest audio sample read from the file |
References EOUtils::AudioFileResultType::addError(), getNextSample(), goToAudioDataPos(), EOUtils::AudioFile::mFileStream, numSamples(), and result.
Referenced by getHighestSampleValue(), and getHighestSampleValue_int64().
|
overridevirtual |
Gets the highest audio sample value from the file, cast to a 64-bit integer.
| [out] | pHighestAudioSample | The highest audio sample from the file, cast to a 64-bit integer |
Implements EOUtils::AudioFile.
References EOUtils::WAVFileInfo::BitsPerSample(), getHighestSampleValue(), and result.
|
inline |
Gets the next audio sample from the file. This is templated so that the proper variable type can be used to store the audio sample value.
| [out] | pAudioSample | Templatized variable to store the next audio sample read from the file |
References EOUtils::AudioFileResultType::addError(), BITS_PER_BYTE, EOUtils::WAVFileInfo::BitsPerSample(), EOUtils::AudioFileInfo::BytesPerSample(), EOUtils::AudioFile::hasReadMode(), EOUtils::machineIsBigEndian, EOUtils::AudioFile::mFileStream, result, and EOUtils::reverseBytes().
Referenced by getHighestSampleValue(), and getNextSample_int64().
|
overridevirtual |
Gets the next sample from the file, cast to a 64-bit integer.
| [out] | pAudioSample | The next audio sample from the file, cast to a 64-bit integer |
Implements EOUtils::AudioFile.
References EOUtils::WAVFileInfo::BitsPerSample(), getNextSample(), and result.
|
overridevirtual |
Goes to the audio data position in the WAV file.
Implements EOUtils::AudioFile.
References EOUtils::AudioFileResultType::addError(), EOUtils::AudioFile::mFileStream, result, and EOUtils::WAVFileInfo::WAVFileHdrSize().
Referenced by getHighestSampleValue().
|
overridevirtual |
Returns the maximum possible positive value of the audio file's sample size.
Implements EOUtils::AudioFile.
References EOUtils::WAVFileInfo::BitsPerSample().
|
overridevirtual |
Returns the number of audio samples in the WAV file.
Implements EOUtils::AudioFile.
References EOUtils::AudioFileInfo::BytesPerSample(), EOUtils::AudioFile::mDataSizeBytes, and EOUtils::AudioFile::mFilename.
Referenced by getHighestSampleValue().
|
overridevirtual |
Reimplemented from EOUtils::AudioFile.
References EOUtils::WAVFileInfo::BitsPerSample(), EOUtils::getFileSize(), EOUtils::AudioFile::hasReadMode(), EOUtils::AudioFile::hasWriteMode(), EOUtils::AudioFile::mDataSizeBytes, EOUtils::AudioFile::mFilename, EOUtils::AudioFile::mFileStream, EOUtils::AudioFile::open(), EOUtils::WAVFileInfo::read(), result, EOUtils::WAVFileInfo::WAVFileHdrSize(), and EOUtils::WAVFileInfo::write().
Referenced by getHighestSampleValue().
|
overridevirtual |
Implements EOUtils::AudioFile.
References EOUtils::AudioFileInfo::BytesPerSample(), EOUtils::AudioFile::mFileStream, and EOUtils::WAVFileInfo::WAVFileHdrSize().
|
overridevirtual |
|
inline |
Writes an audio sample to the file. This is templated so that the proper variable type can be used for the audio sample value.
| [in] | pAudioSample | Templatized variable containing the audio sample value to write to the file |
References EOUtils::AudioFileResultType::addError(), EOUtils::AudioFileInfo::BytesPerSample(), EOUtils::AudioFile::hasWriteMode(), EOUtils::machineIsBigEndian, EOUtils::AudioFile::mDataSizeBytes, EOUtils::AudioFile::mFileStream, result, and EOUtils::reverseBytes().
Referenced by writeSample_int64().
|
overridevirtual |
Writes an audio sample to the file. The parameter is a 64-bit integer but will be cast to the bitness of the audio samples in the file.
| [in] | pAudioSample | The audio sample to write to the file |
Implements EOUtils::AudioFile.
References EOUtils::WAVFileInfo::BitsPerSample(), result, and writeSample().