TracktionEngine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
tracktion::engine::SmartThumbnail Class Reference

SmartThumnail automatically tracks changes to an AudioFile and will update its cache if the file changes. More...

Inherits juce::AudioThumbnailBase, and juce::Timer.

Public Member Functions

 SmartThumbnail (Engine &, const AudioFile &, juce::Component &componentToRepaint, Edit *)
 Creates a SmartThumbnail for an AudioFile which will automatically repaint a Component as it it loaded. More...
 
 SmartThumbnail (Engine &, const AudioFile &, juce::Component &componentToRepaint, Edit *, std::unique_ptr< juce::AudioThumbnailBase > thumbnailToUse)
 Creates a SmartThumbnail for an AudioFile which will automatically repaint a Component as it it loaded. More...
 
 ~SmartThumbnail () override
 Destructor. More...
 
void setNewFile (const AudioFile &)
 Sets a new file to display. More...
 
bool isGeneratingProxy () const noexcept
 Returns true if this is a proxy file being generated by the AudioProxyGenerator. More...
 
float getProxyProgress () const noexcept
 Returns the progress of the current proxy file creation. More...
 
bool isOutOfDate () const noexcept
 Returns true if the file has been changed and a new thumbnail has not yet been generated. More...
 
void drawChannel (juce::Graphics &, juce::Rectangle< int >, TimeRange, int channelNum, float verticalZoomFactor)
 Draws one of the channels, optionally using a hi-res algorithm. More...
 
void drawChannels (juce::Graphics &, juce::Rectangle< int >, TimeRange, float verticalZoomFactor)
 Draws all of the channels, optionally using a hi-res algorithm. More...
 
double getProportionComplete () const noexcept
 Returns the proportion of the thumbnail that has been generated. More...
 
void clear () override
 
bool setSource (juce::InputSource *) override
 
void setReader (juce::AudioFormatReader *, juce::int64 hashCode) override
 
bool loadFrom (juce::InputStream &) override
 
void saveTo (juce::OutputStream &) const override
 
int getNumChannels () const noexcept override
 
double getTotalLength () const noexcept override
 
bool isFullyLoaded () const noexcept override
 
juce::int64 getNumSamplesFinished () const noexcept override
 
float getApproximatePeak () const override
 
void getApproximateMinMax (double startTime, double endTime, int channelIndex, float &minValue, float &maxValue) const noexcept override
 
juce::int64 getHashCode () const override
 
void reset (int numChannels, double sampleRate, juce::int64 totalSamplesInSource) override
 
void addBlock (juce::int64 sampleNumberInSource, const juce::AudioBuffer< float > &, int startOffsetInBuffer, int numSamples) override
 
void audioFileChanged ()
 
void releaseFile ()
 

Static Public Member Functions

static void setEnabled (bool e)
 Enable/disable all smart thumbnail generation. More...
 
static bool areThumbnailsFullyLoaded (Engine &)
 Returns true if any thumbnails are currently being generated for the given Edit. More...
 

Public Attributes

AudioFile file
 
Engineengine
 
Edit *const edit = nullptr
 

Detailed Description

SmartThumnail automatically tracks changes to an AudioFile and will update its cache if the file changes.

Additionally, if this file is a wav proxy file that's being generated, you can use this to find out about its progress.

Constructor & Destructor Documentation

◆ SmartThumbnail() [1/2]

tracktion::engine::SmartThumbnail::SmartThumbnail ( Engine ,
const AudioFile ,
juce::Component &  componentToRepaint,
Edit  
)

Creates a SmartThumbnail for an AudioFile which will automatically repaint a Component as it it loaded.

You can optionally supply an Edit to use its temporary directory for the thumbnail file storage.

◆ SmartThumbnail() [2/2]

tracktion::engine::SmartThumbnail::SmartThumbnail ( Engine ,
const AudioFile ,
juce::Component &  componentToRepaint,
Edit ,
std::unique_ptr< juce::AudioThumbnailBase >  thumbnailToUse 
)

Creates a SmartThumbnail for an AudioFile which will automatically repaint a Component as it it loaded.

You can optionally supply an Edit to use its temporary directory for the thumbnail file storage.

Parameters
thumbnailToUseThe thumbnail instance to use if you want custom thumbs

◆ ~SmartThumbnail()

tracktion::engine::SmartThumbnail::~SmartThumbnail ( )
override

Destructor.

Member Function Documentation

◆ setEnabled()

static void tracktion::engine::SmartThumbnail::setEnabled ( bool  e)
static

Enable/disable all smart thumbnail generation.

◆ areThumbnailsFullyLoaded()

static bool tracktion::engine::SmartThumbnail::areThumbnailsFullyLoaded ( Engine )
static

Returns true if any thumbnails are currently being generated for the given Edit.

◆ setNewFile()

void tracktion::engine::SmartThumbnail::setNewFile ( const AudioFile )

Sets a new file to display.

◆ isGeneratingProxy()

bool tracktion::engine::SmartThumbnail::isGeneratingProxy ( ) const
noexcept

Returns true if this is a proxy file being generated by the AudioProxyGenerator.

◆ getProxyProgress()

float tracktion::engine::SmartThumbnail::getProxyProgress ( ) const
noexcept

Returns the progress of the current proxy file creation.

◆ isOutOfDate()

bool tracktion::engine::SmartThumbnail::isOutOfDate ( ) const
noexcept

Returns true if the file has been changed and a new thumbnail has not yet been generated.

◆ drawChannel()

void tracktion::engine::SmartThumbnail::drawChannel ( juce::Graphics &  ,
juce::Rectangle< int >  ,
TimeRange  ,
int  channelNum,
float  verticalZoomFactor 
)

Draws one of the channels, optionally using a hi-res algorithm.

◆ drawChannels()

void tracktion::engine::SmartThumbnail::drawChannels ( juce::Graphics &  ,
juce::Rectangle< int >  ,
TimeRange  ,
float  verticalZoomFactor 
)

Draws all of the channels, optionally using a hi-res algorithm.

◆ getProportionComplete()

double tracktion::engine::SmartThumbnail::getProportionComplete ( ) const
noexcept

Returns the proportion of the thumbnail that has been generated.

◆ clear()

void tracktion::engine::SmartThumbnail::clear ( )
override

.

◆ setSource()

bool tracktion::engine::SmartThumbnail::setSource ( juce::InputSource *  )
override

.

◆ setReader()

void tracktion::engine::SmartThumbnail::setReader ( juce::AudioFormatReader *  ,
juce::int64  hashCode 
)
override

.

◆ loadFrom()

bool tracktion::engine::SmartThumbnail::loadFrom ( juce::InputStream &  )
override

.

◆ saveTo()

void tracktion::engine::SmartThumbnail::saveTo ( juce::OutputStream &  ) const
override

.

◆ getNumChannels()

int tracktion::engine::SmartThumbnail::getNumChannels ( ) const
overridenoexcept

.

◆ getTotalLength()

double tracktion::engine::SmartThumbnail::getTotalLength ( ) const
overridenoexcept

.

◆ isFullyLoaded()

bool tracktion::engine::SmartThumbnail::isFullyLoaded ( ) const
overridenoexcept

.

◆ getNumSamplesFinished()

juce::int64 tracktion::engine::SmartThumbnail::getNumSamplesFinished ( ) const
overridenoexcept

.

◆ getApproximatePeak()

float tracktion::engine::SmartThumbnail::getApproximatePeak ( ) const
override

.

◆ getApproximateMinMax()

void tracktion::engine::SmartThumbnail::getApproximateMinMax ( double  startTime,
double  endTime,
int  channelIndex,
float &  minValue,
float &  maxValue 
) const
overridenoexcept

.

◆ getHashCode()

juce::int64 tracktion::engine::SmartThumbnail::getHashCode ( ) const
override

.

◆ reset()

void tracktion::engine::SmartThumbnail::reset ( int  numChannels,
double  sampleRate,
juce::int64  totalSamplesInSource 
)
override

.

◆ addBlock()

void tracktion::engine::SmartThumbnail::addBlock ( juce::int64  sampleNumberInSource,
const juce::AudioBuffer< float > &  ,
int  startOffsetInBuffer,
int  numSamples 
)
override

.

◆ audioFileChanged()

void tracktion::engine::SmartThumbnail::audioFileChanged ( )

◆ releaseFile()

void tracktion::engine::SmartThumbnail::releaseFile ( )

Member Data Documentation

◆ file

AudioFile tracktion::engine::SmartThumbnail::file

◆ engine

Engine& tracktion::engine::SmartThumbnail::engine

◆ edit

Edit* const tracktion::engine::SmartThumbnail::edit = nullptr

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