Skip to content

Commit

Permalink
Merge pull request #4056 from QiuFeng54321/waveform-spectrogram-lazyload
Browse files Browse the repository at this point in the history
Lazy load waveform and spectrogram
  • Loading branch information
AiAe committed Apr 14, 2024
2 parents 90e1741 + f64ee97 commit ef56e99
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Quaver.Shared/Screens/Edit/UI/Playfield/EditorPlayfield.cs
Expand Up @@ -376,8 +376,6 @@ public int ColumnSize
CreateDividerLines();
CreateHitPositionLine();
CreateTimeline();
CreateWaveform();
CreateSpectrogram();
CreateLineContainer();
CreateHitObjects();
CreateButton();
Expand Down Expand Up @@ -429,6 +427,28 @@ public override void Update(GameTime gameTime)
Button.Position = new ScalableVector2(X + BorderLeft.Width / 2f, Y);
Button.Update(gameTime);

if (ShowSpectrogram.Value && Spectrogram == null && SpectrogramLoadTask == null)
{
CreateSpectrogram();
}
else if (!ShowSpectrogram.Value && Spectrogram != null)
{
Spectrogram?.Dispose();
Spectrogram = null;
SpectrogramLoadTask = null;
}

if (ShowWaveform.Value && Waveform == null && WaveformLoadTask == null)
{
CreateWaveform();
}
else if (!ShowWaveform.Value && Waveform != null)
{
Waveform?.Dispose();
Waveform = null;
WaveformLoadTask = null;
}

if (LoadingWaveform != null)
{
LoadingWaveform.Alignment = Alignment;
Expand Down

0 comments on commit ef56e99

Please sign in to comment.