Skip to content

Commit

Permalink
Account for vram spike in quality check
Browse files Browse the repository at this point in the history
  • Loading branch information
XAce1337manX committed Jul 1, 2024
1 parent d9dbcfb commit 26a5a0b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Assets/__Scripts/MapEditor/Audio/AudioManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void GenerateFFT(AudioClip clip, int sampleSize, int quality)
// Reduce spectrogram quality if it would exceed half of total VRAM capacity
// (Video memory should still be available for ChroMapper and other programs)
var videoMemoryBytes = SystemInfo.graphicsMemorySize * 1024L * 1024L;
while ((long)sampleCount * quality * sizeof(float) > videoMemoryBytes / 2L)
const int fftCountBuffers = 3;
while ((long)sampleCount * quality * sizeof(float) * fftCountBuffers > videoMemoryBytes / 2L)
{
quality /= 2;
Debug.Log($"Video Memory exceeded. Reduced spectrogram quality to: {quality}");
Expand Down

0 comments on commit 26a5a0b

Please sign in to comment.