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


Public Member Functions | |
| AudioFile (const std::string &pFilename) | |
| Constructor. | |
| AudioFile (const std::string &pFilename, AudioFileModes pFileMode) | |
| AudioFile (const AudioFile &pAudioFile) | |
| virtual | ~AudioFile () |
| virtual void | setAudioFileInfo (const AudioFileInfo &pAudioFileInfo)=0 |
| virtual AudioFileResultType | open (AudioFileModes pOpenMode) |
| 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. | |
| virtual void | close () |
| Closes the audio file. | |
| virtual AudioFileResultType | getNextSample_int64 (int64_t &pAudioSample)=0 |
| Gets the next sample from the file, cast to a 64-bit integer. | |
| virtual AudioFileResultType | writeSample_int64 (int64_t pAudioSample)=0 |
| 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. | |
| virtual AudioFileResultType | getHighestSampleValue_int64 (int64_t &pHighestAudioSample)=0 |
| Gets the highest audio sample value from the file, cast to a 64-bit integer. | |
| virtual AudioFileResultType | goToAudioDataPos ()=0 |
| Goes to the audio data position in the audio file. | |
| virtual size_t | numSamples () const =0 |
| Returns the number of audio samples in the audio file. | |
| virtual int64_t | maxValueForSampleSize () const =0 |
| Returns the maximum possible positive value of the audio file's sample size. | |
| 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. | |
| virtual AudioFileInfo | getAudioFileInfo () const =0 |
| Returns an AudioFile object with information about the audio file. | |
| virtual void | seekOutputToSampleNum (size_t pSampleNum)=0 |
Protected Member Functions | |
| virtual std::streampos | fileSizeAccordingToStream () |
| virtual void | setFileMode (AudioFileModes pFileMode) |
Protected Attributes | |
| std::string | mFilename |
| std::fstream | mFileStream |
| std::ios_base::openmode | mFileOpenMode |
| size_t | mDataSizeBytes |
| std::map< std::string, std::string > | mMetadata |
|
explicit |
Constructor.
| [in] | pFilename | The name of the audio file |
|
explicit |
| EOUtils::AudioFile::AudioFile | ( | const AudioFile & | pAudioFile | ) |
|
virtual |
References close().
|
virtual |
Closes the audio file.
Reimplemented in EOUtils::FLACFile, and EOUtils::WAVFile.
References mFileStream.
Referenced by EOUtils::FLACFile::FLACFile(), EOUtils::mixAudioFiles(), and ~AudioFile().
| const string & EOUtils::AudioFile::Filename | ( | ) | const |
| void EOUtils::AudioFile::Filename | ( | const std::string & | pFilename | ) |
Setter for the filename of the audio file.
| [in] | pFilename | The new filename |
|
protectedvirtual |
References mFileStream.
Referenced by EOUtils::WAVFile::close().
|
pure virtual |
Returns an AudioFile object with information about the audio file.
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
|
pure virtual |
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 |
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
| std::string EOUtils::AudioFile::getMetadata | ( | const std::string & | pName | ) | const |
Gets a metadata value.
| [in] | pName | The name of the metadata item (string) |
| AudioFileResultType EOUtils::AudioFile::getMetadata | ( | const std::string & | pName, |
| std::string & | pValue | ||
| ) | const |
Gets a metadata value as a string.
| [in] | pName | The name of the metadata item (string) |
| [out] | pValue | This variable will store the value of the metadata item as a string |
|
inline |
References mMetadata.
|
inline |
Gets a metadata value. Templatized to return it as any type.
| [in] | pName | The name of the metadata item (string) |
References mMetadata.
|
inline |
Gets a metadata value. Templatized to capture the value as any type.
| [in] | pName | The name of the metadata item (string) |
| [out] | pValue | This variable will store the value of the metadata item. Templatized to store the value as any type. |
|
pure virtual |
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 |
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
|
pure virtual |
Goes to the audio data position in the audio file.
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
| bool EOUtils::AudioFile::hasMetadata | ( | const std::string & | pName | ) | const |
Returns whether or not a metadata item exists.
| [in] | pName | The name of the metadata item to check |
References mMetadata.
Referenced by EOUtils::FLACFile::open().
|
virtual |
Returns whether or not read mode is enabled for the file.
References mFileOpenMode.
Referenced by EOUtils::WAVFile::getNextSample(), EOUtils::FLACFile::getNextSample_int64(), open(), EOUtils::FLACFile::open(), and EOUtils::WAVFile::open().
|
virtual |
Returns whether or not write mode is enabled for the file.
References mFileOpenMode.
Referenced by EOUtils::WAVFile::close(), open(), EOUtils::FLACFile::open(), EOUtils::WAVFile::open(), EOUtils::WAVFile::writeSample(), and EOUtils::FLACFile::writeSample_int64().
|
virtual |
Returns whether or not the audio file is open.
Reimplemented in EOUtils::FLACFile.
References mFileStream.
Referenced by EOUtils::mixAudioFiles().
|
pure virtual |
Returns the maximum possible positive value of the audio file's sample size.
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
|
pure virtual |
Returns the number of audio samples in the audio file.
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
|
virtual |
Reimplemented in EOUtils::FLACFile, and EOUtils::WAVFile.
References hasReadMode(), hasWriteMode(), mFilename, mFileOpenMode, mFileStream, result, and setFileMode().
Referenced by EOUtils::mixAudioFiles(), EOUtils::FLACFile::open(), and EOUtils::WAVFile::open().
|
pure virtual |
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
|
pure virtual |
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
Referenced by EOUtils::mixAudioFiles().
|
protectedvirtual |
References EOUtils::AUDIO_FILE_READ, EOUtils::AUDIO_FILE_READ_WRITE, EOUtils::AUDIO_FILE_WRITE, and mFileOpenMode.
Referenced by open().
| void EOUtils::AudioFile::setMetadata | ( | const std::string & | pName, |
| const std::string & | pValue | ||
| ) |
Adds a piece of metadata for the audio file.
| [in] | pName | The name of the metadata item (string) |
| [in] | pValue | The value of the metadata item (string) |
References mMetadata.
|
inline |
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.
| [in] | pName | The name of the metadata item (string) |
| [in] | pValue | The value of the metadata item (templatized for any type) |
References mMetadata.
|
pure virtual |
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 |
Implemented in EOUtils::FLACFile, and EOUtils::WAVFile.
Referenced by EOUtils::mixAudioFiles().
|
protected |
|
protected |
|
protected |
Referenced by hasReadMode(), hasWriteMode(), open(), and setFileMode().
|
protected |
Referenced by close(), EOUtils::FLACFile::close(), EOUtils::WAVFile::close(), fileSizeAccordingToStream(), EOUtils::WAVFile::getHighestSampleValue(), EOUtils::WAVFile::getNextSample(), EOUtils::WAVFile::goToAudioDataPos(), isOpen(), EOUtils::FLACFile::isOpen(), open(), EOUtils::FLACFile::open(), EOUtils::WAVFile::open(), EOUtils::WAVFile::seekOutputToSampleNum(), and EOUtils::WAVFile::writeSample().
|
protected |
Referenced by getMetadataAs(), getMetadataAs(), getMetadataAs(), hasMetadata(), setMetadata(), and setMetadataFromVal().