Audacity 3.2.0
Functions
anonymous_namespace{GraphicsDataCache.cpp} Namespace Reference

Functions

bool IsSameSample (double sampleRate, double t0, double t1) noexcept
 
bool IsSamePPS (double sampleRate, double lhs, double rhs)
 
bool IsSameKey (double sampleRate, GraphicsDataCacheKey lhs, GraphicsDataCacheKey rhs)
 
bool IsKeyLess (double sampleRate, GraphicsDataCacheKey lhs, GraphicsDataCacheKey rhs)
 
template<typename Container >
auto GetPPSMatchRange (const Container &container, double pixelsPerSecond, double sampleRate)
 

Detailed Description


Audacity: A Digital Audio Editor

GraphicsDataCache.cpp

Dmitry Vedenko

Function Documentation

◆ GetPPSMatchRange()

template<typename Container >
auto anonymous_namespace{GraphicsDataCache.cpp}::GetPPSMatchRange ( const Container &  container,
double  pixelsPerSecond,
double  sampleRate 
)

Definition at line 57 of file GraphicsDataCache.cpp.

59{
60 return std::equal_range(
61 container.begin(), container.end(), pixelsPerSecond,
62 [sampleRate](auto lhs, auto rhs)
63 {
64 if constexpr (std::is_arithmetic_v<std::decay_t<decltype(lhs)>>)
65 return !IsSamePPS(sampleRate, lhs, rhs.Key.PixelsPerSecond) &&
66 lhs < rhs.Key.PixelsPerSecond;
67 else
68 return !IsSamePPS(sampleRate, lhs.Key.PixelsPerSecond, rhs) &&
69 lhs.Key.PixelsPerSecond < rhs;
70 });
71}

References anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.

Referenced by GraphicsDataCacheBase::PerformBaseLookup().

Here is the caller graph for this function:

◆ IsKeyLess()

bool anonymous_namespace{GraphicsDataCache.cpp}::IsKeyLess ( double  sampleRate,
GraphicsDataCacheKey  lhs,
GraphicsDataCacheKey  rhs 
)

Definition at line 47 of file GraphicsDataCache.cpp.

49{
51 return lhs.FirstSample < rhs.FirstSample;
52 else
53 return lhs.PixelsPerSecond < rhs.PixelsPerSecond;
54}
bool IsSamePPS(double sampleRate, double lhs, double rhs)
int64_t FirstSample
Level 2 key: first cached sample in the "global" scale.
double PixelsPerSecond
Level 1 key: zoom level.

References GraphicsDataCacheKey::FirstSample, IsSamePPS(), GraphicsDataCacheKey::PixelsPerSecond, and anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.

Here is the call graph for this function:

◆ IsSameKey()

bool anonymous_namespace{GraphicsDataCache.cpp}::IsSameKey ( double  sampleRate,
GraphicsDataCacheKey  lhs,
GraphicsDataCacheKey  rhs 
)

Definition at line 40 of file GraphicsDataCache.cpp.

42{
43 return lhs.FirstSample == rhs.FirstSample &&
45}

References GraphicsDataCacheKey::FirstSample, IsSamePPS(), GraphicsDataCacheKey::PixelsPerSecond, and anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.

Here is the call graph for this function:

◆ IsSamePPS()

bool anonymous_namespace{GraphicsDataCache.cpp}::IsSamePPS ( double  sampleRate,
double  lhs,
double  rhs 
)

Definition at line 33 of file GraphicsDataCache.cpp.

34{
35 return std::abs(1.0 / lhs - 1.0 / rhs) *
37 (1.0 / sampleRate);
38}
static constexpr uint32_t CacheElementWidth

References GraphicsDataCacheBase::CacheElementWidth, and anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.

Referenced by IsKeyLess(), and IsSameKey().

Here is the caller graph for this function:

◆ IsSameSample()

bool anonymous_namespace{GraphicsDataCache.cpp}::IsSameSample ( double  sampleRate,
double  t0,
double  t1 
)
noexcept

Definition at line 25 of file GraphicsDataCache.cpp.

26{
27 const auto firstSample = llrint(t0 * sampleRate);
28 const auto secondSample = llrint(t1 * sampleRate);
29
30 return firstSample == secondSample;
31}

References anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.

Referenced by GraphicsDataCacheBase::PerformBaseLookup().

Here is the caller graph for this function: