|
AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
|
This is a container for raw audio data in a particular format, ready to be sent to a sound card, or of how such data would appear coming from the sound card using a microphone. More...
#include <AudioData.h>
Classes | |
| struct | Format |
| This structure contains all the information you need to decipher the data in a given stream of raw audio data. More... | |
| struct | MetaData |
Public Member Functions | |
| AudioData () | |
| virtual | ~AudioData () |
| virtual void | DumpInfo (FILE *fp) const override |
| virtual void | DumpCSV (FILE *fp) const override |
| virtual FileData * | Clone () const override |
| Format & | GetFormat () |
| const Format & | GetFormat () const |
| void | SetFormat (const Format &format) |
| uint8_t * | GetAudioBuffer () |
| const uint8_t * | GetAudioBuffer () const |
| uint64_t | GetAudioBufferSize () const |
| void | SetAudioBufferSize (uint64_t audioBufferSize) |
| uint64_t | GetNumSamples () const |
| uint64_t | GetNumSamplesPerChannel () const |
| uint64_t | GetNumFrames () const |
| double | GetTimeSeconds () const |
| const MetaData & | GetMetaData () const |
| void | SetMetaData (const MetaData &metaData) const |
| bool | CalcMetaData (Error &error) const |
Public Member Functions inherited from AudioDataLib::FileData | |
| FileData () | |
| virtual | ~FileData () |
Static Public Member Functions | |
| static AudioData * | Create () |
| static void | Destroy (AudioData *audioData) |
Protected Attributes | |
| Format | format |
| uint8_t * | audioBuffer |
| uint64_t | audioBufferSize |
| MetaData | metaData |
This is a container for raw audio data in a particular format, ready to be sent to a sound card, or of how such data would appear coming from the sound card using a microphone.
Note that this kind of data is not tied to any particular file format. As of this writing, the WaveFileFormat and AiffFileFormat classes both produce this kind of data from file. Indirectly, an AudioData class instances is also produced from a sound-font file using the SoundFontFormat class.
In contrast, the WaveForm class is used as a format-independent space where math calculations and transforms on audio data can more easily be performed. A typical use-case is that of resampling, or converting from one format to another. Format conversion proceeds by simply converting first, a given AudioData instance, into a WaveForm class instance, and then back to an AudioData instance of the desired audio format.
Note that audio data is not typically handed to a sound-card using this class directly. Rather, an instance of the AudioStream class in concert with the AudioSink class is used to do that.
| AudioData::AudioData | ( | ) |
|
virtual |
| bool AudioData::CalcMetaData | ( | Error & | error | ) | const |
|
overridevirtual |
The derived implimentation should return a new derived instance of the class in question with identical, but separate data.
Implements AudioDataLib::FileData.
Reimplemented in AudioDataLib::WaveTableData::AudioSampleData.
|
static |
Allocate an instance of the AudioData class using the default constructor and return it. The main purpose of this is to make sure that memory is allocated or freed in the proper heap. It can also be useful when writing template functions.
|
static |
Delete an instance of the AudioData class (or one of its derivatives.) The main purpose of this is to make sure that memory is allocated or freed in the proper heap. It can also be useful when writing template functions.
|
overridevirtual |
Derivative implimentations should produce a command-separated list of human-readable data which can also be loaded as a CVS in spreadsheet software.
| [in] | fp | A pointer to a FILE object to which the text should be written. |
Implements AudioDataLib::FileData.
|
overridevirtual |
Derivative implimentations should produce informative, human-readable text about the file data.
| [in] | fp | A pointer to a FILE object to which the text should be written. |
Implements AudioDataLib::FileData.
Reimplemented in AudioDataLib::WaveTableData::AudioSampleData.
|
inline |
|
inline |
|
inline |
Get the size in bytes of this audio data.
|
inline |
|
inline |
|
inline |
Return the cached meta-data for this audio data. See the CalcMetaData function.
| uint64_t AudioData::GetNumFrames | ( | ) | const |
This is really just the same thing as GetNumSamplesPerChannel, put another way. (Unless my brain is failing me right now.)
| uint64_t AudioData::GetNumSamples | ( | ) | const |
Return the number of samples in the audio stream across all channels.
| uint64_t AudioData::GetNumSamplesPerChannel | ( | ) | const |
Return the number of samples in a single channel of the audio stream.
| double AudioData::GetTimeSeconds | ( | ) | const |
Return the length of this audio data in seconds.
| void AudioData::SetAudioBufferSize | ( | uint64_t | audioBufferSize | ) |
Set the size in bytes of this audio data. Any present audio data is destroyed by this operation.
|
inline |
|
inline |
Set the cached meta-data for this audio data. See also the CalcMetaData function.
|
protected |
|
protected |
|
protected |
|
mutableprotected |