Slow Scope by MV, now modded by tulamide
Posted: Wed Apr 01, 2020 6:31 am
Dangit, I so wanted to test the new envelope generator! But I was distracted by the terrible display of the slow scope. So much, that I spent 8 hours straight on optimizing it.
Please understand the following:
While I replaced inefficient code with more efficient one in several places, the goal was not to reduce CPU load! The goal instead was to produce a steady view (some here would refer to it as "smoother animations")
Therefore I put everything I saved on CPU into stabilizing the view - which increased CPU load again. And then I added some things that make it even higher. And higher.
You get the point.
If least CPU usage possible is your goal, stay away from my mod. If smoother animations are your goal, it might be of interest for you.
The biggest impact (I'm talking of 3%+ increase on Flowstone's blue stream CPU use meter) was a replacement of the unreliable Tick25 in the logger module. By providing data in unpredictable timespans, the graphics get jerky. Therefore I replaced it by an event-based(!) Ruby ticker (the stock one is method based), that runs 100 times per second. This was needed, because we have no possibility to hook into vertical sync from the monitor, so the frame rate should be higher than that (most business model monitors run at 60 Hz). However, there still is a bit tearing, and I can't prevent that (google for "screen tearing in games" to understand what the issue is), unless we get access to monitor sync'ing (aka, another graphics library like OpenGL, DirectX, Vulcan or WebGL)
Still, I think I did a pretty good job at stabilizing the graphics. The schematic shows both scopes (original and my mod) at the same time, so you can judge for yourself.
I can't do wonders though. If you increase the size of the scope's view, at one point, tearing will become really ugly. Best to use this as a small display of an LFO or something, rather than a full size oscilloscope.
You can always reduce the ticker in the logger module by setting it to higher times (for example 0.04s = 25 fps), to reduce CPU load drastically. But that comes at the price of jerkier graphics (even with the optimizations in Ruby, because blue to green conversion is the bottleneck here in terms of CPU load).
It would be so nice to hear what you think about it. Good, bad? Useful, waste of time? Don't hold back, but keep it civil!
Please understand the following:
While I replaced inefficient code with more efficient one in several places, the goal was not to reduce CPU load! The goal instead was to produce a steady view (some here would refer to it as "smoother animations")
Therefore I put everything I saved on CPU into stabilizing the view - which increased CPU load again. And then I added some things that make it even higher. And higher.
You get the point.
If least CPU usage possible is your goal, stay away from my mod. If smoother animations are your goal, it might be of interest for you.
The biggest impact (I'm talking of 3%+ increase on Flowstone's blue stream CPU use meter) was a replacement of the unreliable Tick25 in the logger module. By providing data in unpredictable timespans, the graphics get jerky. Therefore I replaced it by an event-based(!) Ruby ticker (the stock one is method based), that runs 100 times per second. This was needed, because we have no possibility to hook into vertical sync from the monitor, so the frame rate should be higher than that (most business model monitors run at 60 Hz). However, there still is a bit tearing, and I can't prevent that (google for "screen tearing in games" to understand what the issue is), unless we get access to monitor sync'ing (aka, another graphics library like OpenGL, DirectX, Vulcan or WebGL)
Still, I think I did a pretty good job at stabilizing the graphics. The schematic shows both scopes (original and my mod) at the same time, so you can judge for yourself.
I can't do wonders though. If you increase the size of the scope's view, at one point, tearing will become really ugly. Best to use this as a small display of an LFO or something, rather than a full size oscilloscope.
You can always reduce the ticker in the logger module by setting it to higher times (for example 0.04s = 25 fps), to reduce CPU load drastically. But that comes at the price of jerkier graphics (even with the optimizations in Ruby, because blue to green conversion is the bottleneck here in terms of CPU load).
It would be so nice to hear what you think about it. Good, bad? Useful, waste of time? Don't hold back, but keep it civil!