![]() |
Audacity 3.2.0
|
A short-lived object, during whose lifetime, the contents of the WaveTrack are assumed not to change. More...
#include <SampleTrackCache.h>
Classes | |
| struct | Buffer |
Public Member Functions | |
| SampleTrackCache () | |
| SampleTrackCache (const std::shared_ptr< const WideSampleSequence > &pSequence) | |
| ~SampleTrackCache () | |
| const std::shared_ptr< const WideSampleSequence > & | GetSequence () const |
| void | SetSequence (const std::shared_ptr< const WideSampleSequence > &pSequence) |
| std::pair< const float *, const float * > | GetFloatsWide (size_t nChannels, sampleCount start, size_t len, bool mayThrow) |
| Retrieve samples as floats from the track or from the memory cache. More... | |
| const float * | GetFloats (sampleCount start, size_t len, bool mayThrow) |
| fetch first channel only More... | |
Private Member Functions | |
| void | Free () |
Private Attributes | |
| std::shared_ptr< const WideSampleSequence > | mpSequence |
| size_t | mBufferSize |
| Buffer | mBuffers [2] |
| GrowableSampleBuffer | mOverlapBuffers [2] |
| int | mNValidBuffers |
A short-lived object, during whose lifetime, the contents of the WaveTrack are assumed not to change.
It can replace repeated calls to WaveTrack::Get() (each of which opens and closes at least one block).
Definition at line 24 of file SampleTrackCache.h.
|
inline |
Definition at line 26 of file SampleTrackCache.h.
|
inlineexplicit |
Definition at line 32 of file SampleTrackCache.h.
| SampleTrackCache::~SampleTrackCache | ( | ) |
Definition at line 15 of file SampleTrackCache.cpp.
|
private |
Definition at line 238 of file SampleTrackCache.cpp.
References GrowableSampleBuffer::Free(), SampleTrackCache::Buffer::Free(), mBuffers, mNValidBuffers, and mOverlapBuffers.
Referenced by SetSequence().
|
inline |
fetch first channel only
Definition at line 60 of file SampleTrackCache.h.
Referenced by SpecCache::CalculateOneSpectrum().
| std::pair< const float *, const float * > SampleTrackCache::GetFloatsWide | ( | size_t | nChannels, |
| sampleCount | start, | ||
| size_t | len, | ||
| bool | mayThrow | ||
| ) |
Retrieve samples as floats from the track or from the memory cache.
Uses fillZero always
nChannels <= GetSequence()->NChannels() nChannels <= 2 Definition at line 44 of file SampleTrackCache.cpp.
References SampleTrackCache::Buffer::end(), PackedArray::end(), fillZero, floatSample, format, SampleTrackCache::Buffer::GetBuffers(), SampleTrackCache::Buffer::GetResults(), GetSequence(), SampleTrackCache::Buffer::len, mBuffers, mBufferSize, min(), mNValidBuffers, mOverlapBuffers, mpSequence, GrowableSampleBuffer::Resize(), size, SampleTrackCache::Buffer::start, and SampleTrackCache::Buffer::swap().
|
inline |
Definition at line 41 of file SampleTrackCache.h.
Referenced by anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), GetFloatsWide(), and WaveClipSpectrumCache::GetSpectrogram().
| void SampleTrackCache::SetSequence | ( | const std::shared_ptr< const WideSampleSequence > & | pSequence | ) |
Definition at line 19 of file SampleTrackCache.cpp.
References SampleTrackCache::Buffer::areas, Free(), mBuffers, mBufferSize, mNValidBuffers, mpSequence, and ArraysOf< X >::reinit().
|
private |
Definition at line 101 of file SampleTrackCache.h.
Referenced by Free(), GetFloatsWide(), and SetSequence().
|
private |
Definition at line 100 of file SampleTrackCache.h.
Referenced by GetFloatsWide(), and SetSequence().
|
private |
Definition at line 103 of file SampleTrackCache.h.
Referenced by Free(), GetFloatsWide(), and SetSequence().
|
private |
Definition at line 102 of file SampleTrackCache.h.
Referenced by Free(), and GetFloatsWide().
|
private |
Definition at line 99 of file SampleTrackCache.h.
Referenced by GetFloatsWide(), and SetSequence().