Provides waveform data in 150 points/sec resolution. More...
#include "SuperpoweredAnalyzer.h"
Public Member Functions | |
Waveform (unsigned int samplerate, int lengthSeconds) | |
Constructor. More... | |
~Waveform () | |
void | makeResult () |
Makes the result from the collected data. This method should NOT be used in a real-time audio thread. More... | |
void | process (float *input, unsigned int numberOfFrames, int lengthSeconds=-1) |
Processes some audio. More... | |
Public Attributes | |
unsigned char * | peakWaveform |
150 points/sec waveform data displaying the peak volume. Each byte represents one "pixel". Available after calling makeResult(). More... | |
int | waveformSize |
The number of bytes in the peak waveform. More... | |
Private Member Functions | |
Waveform (const Waveform &) | |
Waveform & | operator= (const Waveform &) |
Private Attributes | |
waveformInternals * | internals |
Provides waveform data in 150 points/sec resolution.
To keep the array result after you destruct the analyzer without an expensive memory copy, do this: float *peakWaveform = waveform->peakWaveform; waveform->peakWaveform = NULL; In this case you take ownership on the data, so don't forget to free() the memory to prevent memory leaks. Use _aligned_free() on Windows.
Superpowered::Waveform::Waveform | ( | unsigned int | samplerate, |
int | lengthSeconds | ||
) |
Constructor.
samplerate | The sample rate of the audio input. |
lengthSeconds | The length in seconds of the audio input. It will not be able to process more audio than this. You can change this value in the process() method. |
Superpowered::Waveform::~Waveform | ( | ) |
|
private |
void Superpowered::Waveform::makeResult | ( | ) |
Makes the result from the collected data. This method should NOT be used in a real-time audio thread.
void Superpowered::Waveform::process | ( | float * | input, |
unsigned int | numberOfFrames, | ||
int | lengthSeconds = -1 |
||
) |
Processes some audio.
This method can be used in a real-time audio thread if lengthSeconds is -1.
input | Pointer to floating point numbers. 32-bit interleaved stereo input. |
numberOfFrames | Number of frames to process. |
lengthSeconds | If the audio input length may change, set this to the current length. Use -1 otherwise. If this value is not -1, this method can NOT be used in a real-time audio thread. |
|
private |
unsigned char* Superpowered::Waveform::peakWaveform |
150 points/sec waveform data displaying the peak volume. Each byte represents one "pixel". Available after calling makeResult().
int Superpowered::Waveform::waveformSize |
The number of bytes in the peak waveform.