Adding a WaveformGraph to a screen leads to huge fps drop
See original GitHub issueHello, I don’t know if it is an issue or if I’m doing something wrong, but I want to use a WaveformGraph on one of my screens, and as soon as it is added, my FPS drops from ~1000 to ~30/40.
Here is the full source code :
using System.IO;
using MDE.Game.UI;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Audio;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.Screens.Edit;
using osuTK;
using osuTK.Graphics;
namespace MDE.Game.Screens;
public partial class TestScreen : Screen
{
private EditorClock editorClock;
private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
private Track track;
private Stream stream;
[BackgroundDependencyLoader]
private void load(AudioManager audioManager, GameHost gameHost)
{
editorClock = new EditorClock();
dependencies.CacheAs(editorClock);
AddInternal(editorClock);
const string folder_path = @"D:\test";
var trackStore = audioManager.GetTrackStore(
new StorageBackedResourceStore(
new DesktopStorage(folder_path, gameHost as DesktopGameHost)
)
);
track = trackStore.Get("music.ogg");
stream = trackStore.GetStream("music.ogg");
Schedule(loadTrack);
}
private void loadTrack()
{
if (!track.IsLoaded)
{
Schedule(loadTrack);
return;
}
editorClock.ChangeSource(track);
var length = track.Length;
var sizeX = (float)(length / 10f);
var waveformComponent = new WaveformComponent() // this is just a ZoomableScrollContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2(sizeX, 200),
};
waveformComponent.Add(new WaveformGraph()
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2(1, 1),
RelativeSizeAxes = Axes.Both,
Position = new Vector2(sizeX / 2, 0),
Waveform = new Waveform(stream),
HighColour = Color4.Green,
LowColour = Color4.Red,
MidColour = Color4.Aqua,
BaseColour = Color4.Aquamarine
});
waveformComponent.SetupZoom(5, 1, 10);
AddInternal(waveformComponent);
}
}
Has anyone encountered this kind of issue or can explain what I am doing wrong? Thanks, Azn9
Issue Analytics
- State:
- Created 6 months ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Plotting multiple waveform graphs slows down the acquisition?
Solved: Hi all, I have been trying to use a producer-consumer architecture to read, log, and display data. We are getting 8 channels...
Read more >Massive FPS drops when memory required from GPU is ...
The fps drops you see are due to disk speeds being normally lower than RAM speeds. Data still needs to be transferred from...
Read more >Really bad performance - low FPS and stuttering
Really bad performance - low FPS and stuttering Hey folks, I've been experiencing very low performance lately altough my PC is quite good....
Read more >Huge stutters and FPS drops when playing : r/RocketLeague
Huge stutters and FPS drops when playing ... So as you can see below, my FPS drops to very low values (If I...
Read more >High end PC - low fps?
Hi all, Im running 12700k, 3080 suprim x and 32GB 15cl rams. Running wow in ultrawide, 3400p with everything on max, except raytrace....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome that’s working perfectly! I’m not really used to working with the framework for now 😅 . Thanks for helping me tackle the issue! ❤️
This change to your
BaseWaveformGraph
test fixes the issue (I think you were misusing the zoomable scroll container a bit which meant that the non-visible portion could not be optimised away).You can check this kinda thing by using the draw visualiser and looking for containers with sizes much larger than they actually require. In this case, it’s a scroll container with a horizontal size of 60,000, defeating its purpose of existing.
Please let me know if this resolves your issue.