mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixes for negativeAwareModulo() and audio thumbnail.
This commit is contained in:
parent
a99b309d3c
commit
1e7ea748ca
2 changed files with 9 additions and 8 deletions
|
|
@ -376,10 +376,9 @@ public:
|
|||
const double rate, const int numChans, const int sampsPerThumbSample,
|
||||
LevelDataSource* levelData, const OwnedArray<ThumbData>& chans)
|
||||
{
|
||||
refillCache (area.getWidth(), startTime, endTime, rate,
|
||||
numChans, sampsPerThumbSample, levelData, chans);
|
||||
|
||||
if (isPositiveAndBelow (channelNum, numChannelsCached))
|
||||
if (refillCache (area.getWidth(), startTime, endTime, rate,
|
||||
numChans, sampsPerThumbSample, levelData, chans)
|
||||
&& isPositiveAndBelow (channelNum, numChannelsCached))
|
||||
{
|
||||
const Rectangle<int> clip (g.getClipBounds().getIntersection (area.withWidth (jmin (numSamplesCached, area.getWidth()))));
|
||||
|
||||
|
|
@ -412,7 +411,7 @@ private:
|
|||
int numChannelsCached, numSamplesCached;
|
||||
bool cacheNeedsRefilling;
|
||||
|
||||
void refillCache (const int numSamples, double startTime, const double endTime,
|
||||
bool refillCache (const int numSamples, double startTime, const double endTime,
|
||||
const double rate, const int numChans, const int sampsPerThumbSample,
|
||||
LevelDataSource* levelData, const OwnedArray<ThumbData>& chans)
|
||||
{
|
||||
|
|
@ -421,7 +420,7 @@ private:
|
|||
if (numSamples <= 0 || timePerPixel <= 0.0 || rate <= 0)
|
||||
{
|
||||
invalidate();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (numSamples == numSamplesCached
|
||||
|
|
@ -430,7 +429,7 @@ private:
|
|||
&& timePerPixel == cachedTimePerPixel
|
||||
&& ! cacheNeedsRefilling)
|
||||
{
|
||||
return;
|
||||
return ! cacheNeedsRefilling;
|
||||
}
|
||||
|
||||
numSamplesCached = numSamples;
|
||||
|
|
@ -497,6 +496,8 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MinMaxValue* getData (const int channelNum, const int cacheIndex) noexcept
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ inline int nextPowerOfTwo (int n) noexcept
|
|||
The divisor must be greater than zero.
|
||||
*/
|
||||
template <typename IntegerType>
|
||||
int negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept
|
||||
IntegerType negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept
|
||||
{
|
||||
jassert (divisor > 0);
|
||||
dividend %= divisor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue