Provides a base for classes that can store and draw scaled views of an audio waveform.
More...
|
| AudioThumbnailBase ()=default |
|
| ~AudioThumbnailBase () override=default |
|
virtual void | addBlock (int64 sampleNumberInSource, const AudioBuffer< float > &newData, int startOffsetInBuffer, int numSamples)=0 |
|
void | addChangeListener (ChangeListener *listener) |
| Registers a listener to receive change callbacks from this broadcaster. More...
|
|
virtual void | clear ()=0 |
| Clears and resets the thumbnail. More...
|
|
void | dispatchPendingMessages () |
| If a change message has been sent but not yet dispatched, this will call sendSynchronousChangeMessage() to make the callback immediately. More...
|
|
virtual void | drawChannel (Graphics &g, const Rectangle< int > &area, double startTimeSeconds, double endTimeSeconds, int channelNum, float verticalZoomFactor)=0 |
| Draws the waveform for a channel. More...
|
|
virtual void | drawChannels (Graphics &g, const Rectangle< int > &area, double startTimeSeconds, double endTimeSeconds, float verticalZoomFactor)=0 |
| Draws the waveforms for all channels in the thumbnail. More...
|
|
virtual void | getApproximateMinMax (double startTime, double endTime, int channelIndex, float &minValue, float &maxValue) const noexcept=0 |
| Reads the approximate min and max levels from a section of the thumbnail. More...
|
|
virtual float | getApproximatePeak () const =0 |
| Returns the highest level in the thumbnail. More...
|
|
virtual int64 | getHashCode () const =0 |
| Returns the hash code that was set by setSource() or setReader(). More...
|
|
virtual int | getNumChannels () const noexcept=0 |
| Returns the number of channels in the file. More...
|
|
virtual int64 | getNumSamplesFinished () const noexcept=0 |
| Returns the number of samples that have been set in the thumbnail. More...
|
|
virtual double | getTotalLength () const noexcept=0 |
| Returns the length of the audio file, in seconds. More...
|
|
virtual bool | isFullyLoaded () const noexcept=0 |
| Returns true if the low res preview is fully generated. More...
|
|
virtual bool | loadFrom (InputStream &input)=0 |
| Reloads the low res thumbnail data from an input stream. More...
|
|
void | removeAllChangeListeners () |
| Removes all listeners from the list. More...
|
|
void | removeChangeListener (ChangeListener *listener) |
| Unregisters a listener from the list. More...
|
|
virtual void | reset (int numChannels, double sampleRate, int64 totalSamplesInSource)=0 |
|
virtual void | saveTo (OutputStream &output) const =0 |
| Saves the low res thumbnail data to an output stream. More...
|
|
void | sendChangeMessage () |
| Causes an asynchronous change message to be sent to all the registered listeners. More...
|
|
void | sendSynchronousChangeMessage () |
| Sends a synchronous change message to all the registered listeners. More...
|
|
virtual void | setReader (AudioFormatReader *newReader, int64 hashCode)=0 |
| Gives the thumbnail an AudioFormatReader to use directly. More...
|
|
virtual bool | setSource (InputSource *newSource)=0 |
| Specifies the file or stream that contains the audio file. More...
|
|
Provides a base for classes that can store and draw scaled views of an audio waveform.
Typically, you'll want to use the derived class AudioThumbnail, which provides a concrete implementation.
- See also
- AudioThumbnail, AudioThumbnailCache
@tags{Audio}
virtual void juce::AudioThumbnailBase::drawChannel |
( |
Graphics & |
g, |
|
|
const Rectangle< int > & |
area, |
|
|
double |
startTimeSeconds, |
|
|
double |
endTimeSeconds, |
|
|
int |
channelNum, |
|
|
float |
verticalZoomFactor |
|
) |
| |
|
pure virtual |
Draws the waveform for a channel.
The waveform will be drawn within the specified rectangle, where startTime and endTime specify the times within the audio file that should be positioned at the left and right edges of the rectangle.
The waveform will be scaled vertically so that a full-volume sample will fill the rectangle vertically, but you can also specify an extra vertical scale factor with the verticalZoomFactor parameter.
Implemented in juce::AudioThumbnail.
Gives the thumbnail an AudioFormatReader to use directly.
This will start parsing the audio in a background thread (unless the hash code can be looked-up successfully in the thumbnail cache). Note that the reader object will be held by the thumbnail and deleted later when no longer needed. The thumbnail will actually keep hold of this reader until you clear the thumbnail or change the input source, so the file will be held open for all this time. If you don't want the thumbnail to keep a file handle open continuously, you should use the setSource() method instead, which will only open the file when it needs to.
Implemented in juce::AudioThumbnail.