mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-05-07 04:00:09 +02:00
Add floating point denormal code
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <lv2/urid/urid.h>
|
||||
#include <lv2/worker/worker.h>
|
||||
|
||||
#include "architecture.hpp"
|
||||
|
||||
#include "nam_plugin.h"
|
||||
|
||||
// LV2 Functions
|
||||
@@ -41,7 +43,15 @@ static void activate(LV2_Handle) {}
|
||||
|
||||
static void run(LV2_Handle instance, uint32_t n_samples)
|
||||
{
|
||||
// Disable floating point denormals
|
||||
std::fenv_t fe_state;
|
||||
std::feholdexcept(&fe_state);
|
||||
disable_denormals();
|
||||
|
||||
static_cast<NAM::Plugin*>(instance)->process(n_samples);
|
||||
|
||||
// restore previous floating point state
|
||||
std::feupdateenv(&fe_state);
|
||||
}
|
||||
|
||||
static void deactivate(LV2_Handle) {}
|
||||
|
||||
+3
-3
@@ -155,8 +155,8 @@ namespace NAM {
|
||||
if (dblData.size() != n_samples)
|
||||
dblData.resize(n_samples);
|
||||
|
||||
float inputLevel = pow(10, *(ports.input_level) * 0.05);
|
||||
float outputLevel = pow(10, *(ports.output_level) * 0.05);
|
||||
float inputLevel = powf(10, *(ports.input_level) * 0.05f);
|
||||
float outputLevel = powf(10, *(ports.output_level) * 0.05f);
|
||||
|
||||
for (unsigned int i = 0; i < n_samples; i++)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ namespace NAM {
|
||||
|
||||
for (unsigned int i = 0; i < n_samples; i++)
|
||||
{
|
||||
ports.audio_out[i] = dblData[i] * outputLevel;
|
||||
ports.audio_out[i] = (float)(dblData[i] * outputLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user