JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | List of all members
juce::AudioThumbnailCache Class Reference

An instance of this class is used to manage multiple AudioThumbnail objects. More...

#include "juce_AudioThumbnailCache.h"

Classes

class  ThumbnailCacheEntry
 

Public Member Functions

 AudioThumbnailCache (int maxNumThumbsToStore)
 Creates a cache object.
 
virtual ~AudioThumbnailCache ()
 Destructor.
 
void clear ()
 Clears out any stored thumbnails.
 
bool loadThumb (AudioThumbnailBase &thumb, int64 hashCode)
 Reloads the specified thumb if this cache contains the appropriate stored data.
 
void storeThumb (const AudioThumbnailBase &thumb, int64 hashCode)
 Stores the cacheable data from the specified thumb in this cache.
 
void removeThumb (int64 hashCode)
 Tells the cache to forget about the thumb with the given hashcode.
 
bool readFromStream (InputStream &source)
 Attempts to re-load a saved cache of thumbnails from a stream.
 
void writeToStream (OutputStream &stream)
 Writes all currently-loaded cache data to a stream.
 
TimeSliceThreadgetTimeSliceThread () noexcept
 Returns the thread that client thumbnails can use.
 

Protected Member Functions

virtual void saveNewlyFinishedThumbnail (const AudioThumbnailBase &, int64 hashCode)
 This can be overridden to provide a custom callback for saving thumbnails once they have finished being loaded.
 
virtual bool loadNewThumb (AudioThumbnailBase &, int64 hashCode)
 This can be overridden to provide a custom callback for loading thumbnails from pre-saved files to save the cache the trouble of having to create them.
 

Detailed Description

An instance of this class is used to manage multiple AudioThumbnail objects.

The cache runs a single background thread that is shared by all the thumbnails that need it, and it maintains a set of low-res previews in memory, to avoid having to re-scan audio files too often.

See also
AudioThumbnail

@tags{Audio}

Definition at line 41 of file juce_AudioThumbnailCache.h.

Constructor & Destructor Documentation

◆ AudioThumbnailCache()

juce::AudioThumbnailCache::AudioThumbnailCache ( int  maxNumThumbsToStore)
explicit

Creates a cache object.

The maxNumThumbsToStore parameter lets you specify how many previews should be kept in memory at once.

Definition at line 62 of file juce_AudioThumbnailCache.cpp.

◆ ~AudioThumbnailCache()

juce::AudioThumbnailCache::~AudioThumbnailCache ( )
virtual

Destructor.

Definition at line 70 of file juce_AudioThumbnailCache.cpp.

Member Function Documentation

◆ clear()

void juce::AudioThumbnailCache::clear ( )

Clears out any stored thumbnails.

Definition at line 142 of file juce_AudioThumbnailCache.cpp.

◆ getTimeSliceThread()

TimeSliceThread & juce::AudioThumbnailCache::getTimeSliceThread ( )
noexcept

Returns the thread that client thumbnails can use.

Definition at line 90 of file juce_AudioThumbnailCache.h.

◆ loadNewThumb()

bool juce::AudioThumbnailCache::loadNewThumb ( AudioThumbnailBase ,
int64  hashCode 
)
protectedvirtual

This can be overridden to provide a custom callback for loading thumbnails from pre-saved files to save the cache the trouble of having to create them.

Definition at line 192 of file juce_AudioThumbnailCache.cpp.

◆ loadThumb()

bool juce::AudioThumbnailCache::loadThumb ( AudioThumbnailBase thumb,
int64  hashCode 
)

Reloads the specified thumb if this cache contains the appropriate stored data.

This is called automatically by the AudioThumbnail class, so you shouldn't normally need to call it directly.

Definition at line 102 of file juce_AudioThumbnailCache.cpp.

◆ readFromStream()

bool juce::AudioThumbnailCache::readFromStream ( InputStream source)

Attempts to re-load a saved cache of thumbnails from a stream.

The cache data must have been written by the writeToStream() method. This will replace all currently-loaded thumbnails with the new data.

Definition at line 162 of file juce_AudioThumbnailCache.cpp.

◆ removeThumb()

void juce::AudioThumbnailCache::removeThumb ( int64  hashCode)

Tells the cache to forget about the thumb with the given hashcode.

Definition at line 148 of file juce_AudioThumbnailCache.cpp.

◆ saveNewlyFinishedThumbnail()

void juce::AudioThumbnailCache::saveNewlyFinishedThumbnail ( const AudioThumbnailBase ,
int64  hashCode 
)
protectedvirtual

This can be overridden to provide a custom callback for saving thumbnails once they have finished being loaded.

Definition at line 188 of file juce_AudioThumbnailCache.cpp.

◆ storeThumb()

void juce::AudioThumbnailCache::storeThumb ( const AudioThumbnailBase thumb,
int64  hashCode 
)

Stores the cacheable data from the specified thumb in this cache.

This is called automatically by the AudioThumbnail class, so you shouldn't normally need to call it directly.

Definition at line 118 of file juce_AudioThumbnailCache.cpp.

◆ writeToStream()

void juce::AudioThumbnailCache::writeToStream ( OutputStream stream)

Writes all currently-loaded cache data to a stream.

The resulting data can be re-loaded with readFromStream().

Definition at line 177 of file juce_AudioThumbnailCache.cpp.


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