Skip to content

Commit a3d95a2

Browse files
committed
Fix tests
1 parent 0276515 commit a3d95a2

File tree

4 files changed

+321
-111
lines changed

4 files changed

+321
-111
lines changed

modules/yup_audio_gui/waveform/yup_AudioPeakProfileCache.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,17 @@ String AudioPeakProfileCache::generateCacheKey (const File& audioFile)
253253

254254
String AudioPeakProfileCache::generateCacheKey (const AudioBuffer<float>& buffer, double sampleRate)
255255
{
256-
int64 hash = buffer.getNumSamples();
257-
hash = hash * 31 + buffer.getNumChannels();
258-
hash = hash * 31 + static_cast<int64> (sampleRate * 1000.0);
256+
uint64 hash = static_cast<uint64> (buffer.getNumSamples());
257+
hash = hash * 31 + static_cast<uint64> (buffer.getNumChannels());
258+
hash = hash * 31 + static_cast<uint64> (std::abs (sampleRate) * 1000.0);
259259

260-
// Sample buffer content at intervals for unique identification
261260
for (int channel = 0; channel < buffer.getNumChannels(); ++channel)
262261
{
263262
const float* data = buffer.getReadPointer (channel);
264263
const int numSamples = buffer.getNumSamples();
265264

266265
for (int i = 0; i < jmin (1000, numSamples); i += 100)
267-
{
268-
hash = hash * 31 + static_cast<int64> (data[i] * 1000000.0f);
269-
}
266+
hash = hash * 31 + static_cast<uint64> (std::abs (data[i]) * 1000000.0f);
270267
}
271268

272269
return String::toHexString (hash);
@@ -279,9 +276,7 @@ int64 AudioPeakProfileCache::getDiskCacheSize() const
279276

280277
int64 totalSize = 0;
281278
for (const auto& entry : RangedDirectoryIterator (cacheDirectory, false, "*.yuppeaks"))
282-
{
283279
totalSize += entry.getFile().getSize();
284-
}
285280

286281
return totalSize;
287282
}
@@ -341,7 +336,6 @@ void AudioPeakProfileCache::notifyProfileReady (const String& cacheKey, std::sha
341336
});
342337
};
343338

344-
#if YUP_MODAL_LOOPS_PERMITTED
345339
if (auto* mm = MessageManager::getInstanceWithoutCreating())
346340
{
347341
if (mm->isThisTheMessageThread())
@@ -350,13 +344,10 @@ void AudioPeakProfileCache::notifyProfileReady (const String& cacheKey, std::sha
350344
return;
351345
}
352346

353-
// Always use callAsync when not on message thread - don't fall back to synchronous call
354347
MessageManager::callAsync (notify);
355348
return;
356349
}
357-
#endif
358350

359-
// Fallback for when message manager is not available
360351
notify();
361352
}
362353

@@ -370,7 +361,6 @@ void AudioPeakProfileCache::notifyProfileProgress (const String& cacheKey, doubl
370361
});
371362
};
372363

373-
#if YUP_MODAL_LOOPS_PERMITTED
374364
if (auto* mm = MessageManager::getInstanceWithoutCreating())
375365
{
376366
if (mm->isThisTheMessageThread())
@@ -379,13 +369,10 @@ void AudioPeakProfileCache::notifyProfileProgress (const String& cacheKey, doubl
379369
return;
380370
}
381371

382-
// Always use callAsync when not on message thread - don't fall back to synchronous call
383372
MessageManager::callAsync (notify);
384373
return;
385374
}
386-
#endif
387375

388-
// Fallback for when message manager is not available
389376
notify();
390377
}
391378

modules/yup_audio_gui/waveform/yup_AudioThumbnail.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ Color AudioThumbnail::getChannelColor (int channelIndex) const
288288
0xFF2ECC71, // Green
289289
};
290290

291-
return Color (colors[channelIndex % 6]);
291+
return Color (colors[std::abs (channelIndex) % 6]);
292292
}
293293

294294
//==============================================================================

modules/yup_graphics/native/yup_GraphicsContext_headless.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ class NoOpRenderBuffer : public rive::RenderBuffer
3939

4040
//==============================================================================
4141

42-
class NoOpRenderShader : public rive::RenderShader
43-
{
44-
public:
45-
};
46-
47-
//==============================================================================
48-
4942
class NoOpRenderImage : public rive::RenderImage
5043
{
5144
public:
@@ -123,7 +116,7 @@ class NoOpFactory : public rive::Factory
123116
const float stops[],
124117
size_t count) override
125118
{
126-
return rive::make_rcp<NoOpRenderShader>();
119+
return nullptr;
127120
}
128121

129122
rive::rcp<rive::RenderShader> makeRadialGradient (
@@ -134,7 +127,7 @@ class NoOpFactory : public rive::Factory
134127
const float stops[],
135128
size_t count) override
136129
{
137-
return rive::make_rcp<NoOpRenderShader>();
130+
return nullptr;
138131
}
139132

140133
rive::rcp<rive::RenderPath> makeRenderPath (rive::RawPath&, rive::FillRule) override

0 commit comments

Comments
 (0)