Audacity 3.2.0
|
Cache that contains the waveform data. More...
#include <WaveDataCache.h>
Public Types | |
using | DataProvider = std::function< bool(int64_t requiredSample, WaveCacheSampleBlock::Type dataType, WaveCacheSampleBlock &block)> |
Public Types inherited from GraphicsDataCache< WaveCacheElement > | |
using | ElementFactory = std::function< std::unique_ptr< WaveCacheElement >()> |
using | Initializer = std::function< bool(const GraphicsDataCacheKey &Key, WaveCacheElement &element)> |
Public Member Functions | |
WaveDataCache (const WaveClip &waveClip, int channelIndex) | |
Public Member Functions inherited from GraphicsDataCache< WaveCacheElement > | |
GraphicsDataCache (const GraphicsDataCache &)=delete | |
GraphicsDataCache (double scaledSampleRate, ElementFactory elementFactory) | |
GraphicsDataCache & | operator= (const GraphicsDataCache &)=delete |
~GraphicsDataCache () override | |
IteratorRange< GraphicsDataCacheIterator< WaveCacheElement > > | PerformLookup (const ZoomInfo &zoomInfo, double t0, double t1) |
const WaveCacheElement * | PerformLookup (GraphicsDataCacheKey key) |
void | setInitializer (Initializer initializer) |
Public Member Functions inherited from GraphicsDataCacheBase | |
virtual | ~GraphicsDataCacheBase ()=default |
void | Invalidate () |
Invalidate the cache content. More... | |
double | GetScaledSampleRate () const noexcept |
Returns the sample rate associated with cache. More... | |
void | UpdateViewportWidth (int64_t width) noexcept |
int64_t | GetMaxViewportWidth () const noexcept |
Private Member Functions | |
bool | InitializeElement (const GraphicsDataCacheKey &key, WaveCacheElement &element) override |
Private Attributes | |
DataProvider | mProvider |
WaveCacheSampleBlock | mCachedBlock |
const WaveClip & | mWaveClip |
Observer::Subscription | mStretchChangedSubscription |
Additional Inherited Members | |
Static Public Attributes inherited from GraphicsDataCacheBase | |
static constexpr uint32_t | CacheElementWidth = 256 |
Protected Types inherited from GraphicsDataCacheBase | |
using | Lookup = std::vector< LookupElement > |
Cache lookup is a vector, with items sorted using Key. More... | |
Protected Member Functions inherited from GraphicsDataCache< WaveCacheElement > | |
virtual void | CheckCache (const ZoomInfo &, double, double) |
virtual bool | InitializeElement (const GraphicsDataCacheKey &key, WaveCacheElement &element) |
Protected Member Functions inherited from GraphicsDataCacheBase | |
GraphicsDataCacheBase (double scaledSampleRate) | |
void | SetScaledSampleRate (double scaledSampleRate) |
virtual GraphicsDataCacheElementBase * | CreateElement (const GraphicsDataCacheKey &key)=0 |
Create a new Cache element. Implementation is responsible of the lifetime control. More... | |
virtual void | DisposeElement (GraphicsDataCacheElementBase *element)=0 |
This method is called, when the cache element should be evicted. Implementation may not deallocate the object. More... | |
virtual bool | UpdateElement (const GraphicsDataCacheKey &key, GraphicsDataCacheElementBase &element)=0 |
This method is called on all elements matching the request that are not complete (i. e. IsComplete if false). More... | |
BaseLookupResult | PerformBaseLookup (const ZoomInfo &zoomInfo, double t0, double t1) |
Perform a lookup inside the cache. This method modifies mLookup and invalidates any previous result. More... | |
const GraphicsDataCacheElementBase * | PerformBaseLookup (GraphicsDataCacheKey key) |
Perform a lookup for the given key. This method modifies mLookup and invalidates any previous result. More... | |
Cache that contains the waveform data.
Definition at line 92 of file WaveDataCache.h.
using WaveDataCache::DataProvider = std::function<bool (int64_t requiredSample, WaveCacheSampleBlock::Type dataType, WaveCacheSampleBlock& block)> |
Definition at line 96 of file WaveDataCache.h.
WaveDataCache::WaveDataCache | ( | const WaveClip & | waveClip, |
int | channelIndex | ||
) |
Definition at line 274 of file WaveDataCache.cpp.
|
overrideprivatevirtual |
Reimplemented from GraphicsDataCache< WaveCacheElement >.
Definition at line 291 of file WaveDataCache.cpp.
References WaveCacheElement::AvailableColumns, GraphicsDataCacheBase::CacheElementWidth, WaveCacheSampleBlock::ContainsSample(), FrameStatistics::CreateStopwatch(), WaveCacheElement::Data, WaveCacheSampleBlock::DataType, GraphicsDataCacheBase::GetScaledSampleRate(), WaveCacheSampleBlock::GetSummary(), GraphicsDataCacheElementBase::IsComplete, key, WaveCacheSampleBlock::Summary::Max, mCachedBlock, WaveCacheSampleBlock::Summary::Min, WaveCacheSampleBlock::MinMaxRMS256, WaveCacheSampleBlock::MinMaxRMS64k, mProvider, WaveCacheSampleBlock::Reset(), fast_float::round(), WaveCacheSampleBlock::Samples, WaveCacheSampleBlock::Summary::SamplesCount, staffpad::audio::simd::sqrt(), WaveCacheSampleBlock::Summary::SquaresSum, WaveCacheSampleBlock::Summary::SumItemsCount, and FrameStatistics::WaveDataCache.
|
private |
Definition at line 106 of file WaveDataCache.h.
Referenced by InitializeElement().
|
private |
Definition at line 104 of file WaveDataCache.h.
Referenced by InitializeElement().
|
private |
Definition at line 109 of file WaveDataCache.h.
|
private |
Definition at line 108 of file WaveDataCache.h.