A Qt widget to display the waveform of an audio file. More...
#include <WaveformWidget.h>
Public Types | |
enum | FileHandlingMode { FULL_CACHE, DISK_MODE } |
Public Member Functions | |
WaveformWidget (string filePath) | |
Constructs an instance of WaveformWidget. | |
void | resetFile (string fileName) |
Reset the audio file to be visualized by this instance of WaveformWidget. | |
void | setColor (QColor color) |
Mutator for waveform color. | |
void | setFileHandlingMode (FileHandlingMode mode) |
Mutator for the file-handling mode of a given instance of WaveformWidget. | |
FileHandlingMode | getFileHandlingMode () |
Accessor for the file-handling mode of a given instance of WaveformWidget. | |
Protected Member Functions | |
virtual void | resizeEvent (QResizeEvent *) |
virtual void | paintEvent (QPaintEvent *event) |
A Qt widget to display the waveform of an audio file.
Definition at line 35 of file WaveformWidget.h.
WaveformWidget::WaveformWidget | ( | string | filePath | ) |
Constructs an instance of WaveformWidget.
filePath | Valid path to a WAV file. |
Definition at line 32 of file WaveformWidget.cpp.
WaveformWidget::FileHandlingMode WaveformWidget::getFileHandlingMode | ( | ) |
Accessor for the file-handling mode of a given instance of WaveformWidget.
Definition at line 110 of file WaveformWidget.cpp.
void WaveformWidget::resetFile | ( | string | fileName | ) |
Reset the audio file to be visualized by this instance of WaveformWidget.
An important consideration when invoking this function is the file-handling mode that you have set for the current instance of WaveformWidget. If the instance of WaveformWidget is in FULL_CACHE mode, this function will take considerably longer to execute (posssibly as long as a few seconds for an audio file of several minutes' duration) as the entirety of the audio file to be visualized by the widget must be loaded into memory.
fileName | Valid path to a WAV file |
Definition at line 60 of file WaveformWidget.cpp.
void WaveformWidget::setColor | ( | QColor | color | ) |
Mutator for waveform color.
The | desired color for the waveform visualization. |
Definition at line 455 of file WaveformWidget.cpp.
void WaveformWidget::setFileHandlingMode | ( | FileHandlingMode | mode | ) |
Mutator for the file-handling mode of a given instance of WaveformWidget.
An instance of WaveformWidget relies on an AudioUtil object to do much of the analysis of the audio file that it visualizes. This AudioUtil object can function in one of two modes: DISK_MODE or FULL_CACHE. For a comprehensive outline of the benefits and drawbacks of each mode, see the documentation for AudioUtil::setFileHandlingMode(FileHandlingMode mode).
mode | The desired file-handling mode. Valid options: WaveformWidget::FULL_CACHE, WaveformWidget::DISK_MODE |
Definition at line 91 of file WaveformWidget.cpp.