AudibleT 0.0.1
A real-time A/B/X audio testing tool for subjective assessment of various audio parameters, compatible for general purpose computer as well as embedded systems.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
AudioFile< T > Class Template Reference

Public Types

typedef std::vector< std::vector< T > > AudioBuffer
 

Public Member Functions

 AudioFile ()
 
 AudioFile (std::string filePath)
 
bool load (std::string filePath)
 
bool save (std::string filePath, AudioFileFormat format=AudioFileFormat::Wave)
 
bool loadFromMemory (std::vector< uint8_t > &fileData)
 
uint32_t getSampleRate () const
 
int getNumChannels () const
 
bool isMono () const
 
bool isStereo () const
 
int getBitDepth () const
 
int getNumSamplesPerChannel () const
 
double getLengthInSeconds () const
 
void printSummary () const
 
bool setAudioBuffer (AudioBuffer &newBuffer)
 
void setAudioBufferSize (int numChannels, int numSamples)
 
void setNumSamplesPerChannel (int numSamples)
 
void setNumChannels (int numChannels)
 
void setBitDepth (int numBitsPerSample)
 
void setSampleRate (uint32_t newSampleRate)
 
void shouldLogErrorsToConsole (bool logErrors)
 

Public Attributes

AudioBuffer samples
 
std::string iXMLChunk
 

Constructor & Destructor Documentation

◆ AudioFile() [1/2]

template<class T >
AudioFile< T >::AudioFile

Constructor

◆ AudioFile() [2/2]

template<class T >
AudioFile< T >::AudioFile ( std::string  filePath)

Constructor, using a given file path to load a file

Member Function Documentation

◆ getBitDepth()

template<class T >
int AudioFile< T >::getBitDepth

@Returns the bit depth of each sample

◆ getLengthInSeconds()

template<class T >
double AudioFile< T >::getLengthInSeconds

@Returns the length in seconds of the audio file based on the number of samples and sample rate

◆ getNumChannels()

template<class T >
int AudioFile< T >::getNumChannels

@Returns the number of audio channels in the buffer

◆ getNumSamplesPerChannel()

template<class T >
int AudioFile< T >::getNumSamplesPerChannel

@Returns the number of samples per channel

◆ getSampleRate()

template<class T >
uint32_t AudioFile< T >::getSampleRate

@Returns the sample rate

◆ isMono()

template<class T >
bool AudioFile< T >::isMono

@Returns true if the audio file is mono

◆ isStereo()

template<class T >
bool AudioFile< T >::isStereo

@Returns true if the audio file is stereo

◆ load()

template<class T >
bool AudioFile< T >::load ( std::string  filePath)

Loads an audio file from a given file path. @Returns true if the file was successfully loaded

◆ loadFromMemory()

template<class T >
bool AudioFile< T >::loadFromMemory ( std::vector< uint8_t > &  fileData)

Loads an audio file from data in memory

◆ printSummary()

template<class T >
void AudioFile< T >::printSummary

Prints a summary of the audio file to the console

◆ save()

template<class T >
bool AudioFile< T >::save ( std::string  filePath,
AudioFileFormat  format = AudioFileFormat::Wave 
)

Saves an audio file to a given file path. @Returns true if the file was successfully saved

◆ setAudioBuffer()

template<class T >
bool AudioFile< T >::setAudioBuffer ( AudioBuffer &  newBuffer)

Set the audio buffer for this AudioFile by copying samples from another buffer. @Returns true if the buffer was copied successfully.

◆ setAudioBufferSize()

template<class T >
void AudioFile< T >::setAudioBufferSize ( int  numChannels,
int  numSamples 
)

Sets the audio buffer to a given number of channels and number of samples per channel. This will try to preserve the existing audio, adding zeros to any new channels or new samples in a given channel.

◆ setBitDepth()

template<class T >
void AudioFile< T >::setBitDepth ( int  numBitsPerSample)

Sets the bit depth for the audio file. If you use the save() function, this bit depth rate will be used

◆ setNumChannels()

template<class T >
void AudioFile< T >::setNumChannels ( int  numChannels)

Sets the number of channels. New channels will have the correct number of samples and be initialised to zero

◆ setNumSamplesPerChannel()

template<class T >
void AudioFile< T >::setNumSamplesPerChannel ( int  numSamples)

Sets the number of samples per channel in the audio buffer. This will try to preserve the existing audio, adding zeros to new samples in a given channel if the number of samples is increased.

◆ setSampleRate()

template<class T >
void AudioFile< T >::setSampleRate ( uint32_t  newSampleRate)

Sets the sample rate for the audio file. If you use the save() function, this sample rate will be used

◆ shouldLogErrorsToConsole()

template<class T >
void AudioFile< T >::shouldLogErrorsToConsole ( bool  logErrors)

Sets whether the library should log error messages to the console. By default this is true

Member Data Documentation

◆ iXMLChunk

template<class T >
std::string AudioFile< T >::iXMLChunk

An optional iXML chunk that can be added to the AudioFile.

◆ samples

template<class T >
AudioBuffer AudioFile< T >::samples

A vector of vectors holding the audio samples for the AudioFile. You can access the samples by channel and then by sample index, i.e:

 samples[channel][sampleIndex]

The documentation for this class was generated from the following file: