44 template <
typename SampleType,
size_t CacheSize>
70 template <
typename PopulatorType>
71 void Populate(
size_t startIndex, PopulatorType&& populator)
77 if (difference > CacheSize)
82 PopulateRange({startIndex, CacheSize}, std::forward<PopulatorType>(populator));
92 PopulateRange({startIndex, difference}, std::forward<PopulatorType>(populator));
98 if (difference > CacheSize)
102 mRangeStartIndex = startIndex;
103 PopulateRange({startIndex, CacheSize}, std::forward<PopulatorType>(populator));
110 mRangeStartIndex = startIndex;
111 PopulateRange({startIndex + CacheSize - difference, difference}, std::forward<PopulatorType>(populator));
118 template <
typename PopulatorType>
126 SampleType sample =
static_cast<SampleType
>(populator(index));
void PopulateRange(SampleRange range, PopulatorType &&populator)
Definition: samplecache.h:119
SampleType operator[](size_t index)
Definition: samplecache.h:60
Definition: cpp11transition.h:22
size_t sampleCount
Definition: dsputilities.h:80
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
size_t mRangeStartIndex
Definition: samplecache.h:133
#define assert(expr)
Definition: assertion.h:47
Definition: dsputilities.h:60
size_t startIndex
Definition: dsputilities.h:75
Definition: samplecache.h:45
SampleCache()
Definition: samplecache.h:48
void Populate(size_t startIndex, PopulatorType &&populator)
Definition: samplecache.h:71
size_t mRingBufferStartIndex
Definition: samplecache.h:134
std::array< SampleType, CacheSize *2 > mDoubleRingBuffer
Definition: samplecache.h:132
SampleRange GetRange() const
Definition: samplecache.h:54