1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:52:57 +08:00

Remove all non-transform LogoVisualisation per-frame allocations (#5200)

Remove all non-transform LogoVisualisation per-frame allocations

Co-authored-by: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com>
This commit is contained in:
Dean Herbert 2019-07-02 22:42:18 +09:00 committed by GitHub
commit 7caa6eaed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,13 +96,13 @@ namespace osu.Game.Screens.Menu
var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null;
var effect = beatmap.Value.BeatmapLoaded ? beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current) : null;
float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];
float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes;
for (int i = 0; i < bars_per_visualiser; i++)
{
if (track?.IsRunning ?? false)
{
float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f);
float targetAmplitude = (temporalAmplitudes?[(i + indexOffset) % bars_per_visualiser] ?? 0) * (effect?.KiaiMode == true ? 1 : 0.5f);
if (targetAmplitude > frequencyAmplitudes[i])
frequencyAmplitudes[i] = targetAmplitude;
}
@ -115,7 +115,6 @@ namespace osu.Game.Screens.Menu
}
indexOffset = (indexOffset + index_change) % bars_per_visualiser;
Scheduler.AddDelayed(updateAmplitudes, time_between_updates);
}
private void updateColour()
@ -131,7 +130,8 @@ namespace osu.Game.Screens.Menu
protected override void LoadComplete()
{
base.LoadComplete();
updateAmplitudes();
Scheduler.AddDelayed(updateAmplitudes, time_between_updates, true);
}
protected override void Update()