mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-05-06 19:50:11 +02:00
Add CMake option for denormal disabling
This commit is contained in:
@@ -22,6 +22,12 @@ add_library(neural_amp_modeler MODULE ${SOURCES} ${NAM_SOURCES})
|
|||||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
|
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
|
||||||
source_group(NAM ${CMAKE_CURRENT_SOURCE_DIR} FILES ${NAM_SOURCES})
|
source_group(NAM ${CMAKE_CURRENT_SOURCE_DIR} FILES ${NAM_SOURCES})
|
||||||
|
|
||||||
|
option(DISABLE_DENORMALS "Disable floating point denormals" ON)
|
||||||
|
|
||||||
|
if(DISABLE_DENORMALS)
|
||||||
|
add_definitions(-DDISABLE_DENORMALS)
|
||||||
|
endif(DISABLE_DENORMALS)
|
||||||
|
|
||||||
target_compile_features(neural_amp_modeler PUBLIC cxx_std_17)
|
target_compile_features(neural_amp_modeler PUBLIC cxx_std_17)
|
||||||
|
|
||||||
set_target_properties(neural_amp_modeler
|
set_target_properties(neural_amp_modeler
|
||||||
|
|||||||
+4
-2
@@ -43,15 +43,17 @@ static void activate(LV2_Handle) {}
|
|||||||
|
|
||||||
static void run(LV2_Handle instance, uint32_t n_samples)
|
static void run(LV2_Handle instance, uint32_t n_samples)
|
||||||
{
|
{
|
||||||
// Disable floating point denormals
|
#ifdef DISABLE_DENORMALS // Disable floating point denormals
|
||||||
std::fenv_t fe_state;
|
std::fenv_t fe_state;
|
||||||
std::feholdexcept(&fe_state);
|
std::feholdexcept(&fe_state);
|
||||||
disable_denormals();
|
disable_denormals();
|
||||||
|
#endif
|
||||||
|
|
||||||
static_cast<NAM::Plugin*>(instance)->process(n_samples);
|
static_cast<NAM::Plugin*>(instance)->process(n_samples);
|
||||||
|
|
||||||
// restore previous floating point state
|
#ifdef DISABLE_DENORMALS // restore previous floating point state
|
||||||
std::feupdateenv(&fe_state);
|
std::feupdateenv(&fe_state);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deactivate(LV2_Handle) {}
|
static void deactivate(LV2_Handle) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user