In a default Projucer Audio Plugin Project, there is a ScopedNoDenormals declared at the head of processBlock(). This would seem to imply that this is standard procedure.
Should this be in every processBlock of every AudioProcessor you create? Or are there times to use this and times not to?
If you are processing incoming audio, do you always need this? What about a synth?
I’m a little unclear on what exactly this does - a really dumbed-down simple explanation of denormals would help. I understand they are extremely tiny floating point values close to zero, but most of the explanations on the net baffle me…
That’s what they are essentially. You want to avoid them in your audio code because you may end up with anomalies like a plugin that outputs just silence will start using a crazy amount of CPU time. (Making calculations when the CPU is in the denormals mode is expensive.)
In case there are one or two here who were did not already realize it, but you can add “ScopedNoDenormals noDenormals;” to plot (graph), or other calculation PluginEditor functions, to speed up the code.
For example I did just that to my signal output graph plot, and the plotting speed increased by 3%.
Hi. I’ve just noticed that in juce_Compressor.h the processBlock hasnt got ScopedNoDenormals - doesn’t this go again what has been said above? Or are these components assuming that it will have been provided at a previous point in the processing?
Typically you’d do it just once at the top of your main processBlock. The flags stay in effect until the end of that function. There’s no need to do it again in any of the functions that are called by this main processBlock.