| @@ -125,5 +125,5 @@ | |||||
| <MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/> | <MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/> | ||||
| <MODULE id="juce_opengl" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/> | <MODULE id="juce_opengl" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/> | ||||
| </MODULES> | </MODULES> | ||||
| <JUCEOPTIONS JUCE_QUICKTIME="disabled"/> | |||||
| <JUCEOPTIONS JUCE_QUICKTIME="disabled" JUCE_DSP_ENABLE_SNAP_TO_ZERO="disabled"/> | |||||
| </JUCERPROJECT> | </JUCERPROJECT> | ||||
| @@ -130,6 +130,10 @@ | |||||
| //#define JUCE_FORCE_USE_LEGACY_PARAM_IDS 1 | //#define JUCE_FORCE_USE_LEGACY_PARAM_IDS 1 | ||||
| #endif | #endif | ||||
| #ifndef JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE | |||||
| //#define JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE 1 | |||||
| #endif | |||||
| #ifndef JUCE_USE_STUDIO_ONE_COMPATIBLE_PARAMETERS | #ifndef JUCE_USE_STUDIO_ONE_COMPATIBLE_PARAMETERS | ||||
| //#define JUCE_USE_STUDIO_ONE_COMPATIBLE_PARAMETERS 1 | //#define JUCE_USE_STUDIO_ONE_COMPATIBLE_PARAMETERS 1 | ||||
| #endif | #endif | ||||
| @@ -214,6 +218,10 @@ | |||||
| //#define JUCE_DSP_USE_STATIC_FFTW 1 | //#define JUCE_DSP_USE_STATIC_FFTW 1 | ||||
| #endif | #endif | ||||
| #ifndef JUCE_DSP_ENABLE_SNAP_TO_ZERO | |||||
| #define JUCE_DSP_ENABLE_SNAP_TO_ZERO 0 | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| // juce_events flags: | // juce_events flags: | ||||
| @@ -114,6 +114,8 @@ void DspModulePluginDemoAudioProcessor::releaseResources() | |||||
| void DspModulePluginDemoAudioProcessor::process (dsp::ProcessContextReplacing<float> context) noexcept | void DspModulePluginDemoAudioProcessor::process (dsp::ProcessContextReplacing<float> context) noexcept | ||||
| { | { | ||||
| ScopedNoDenormals noDenormals; | |||||
| // Input volume applied with a LinearSmoothedValue | // Input volume applied with a LinearSmoothedValue | ||||
| inputVolume.process (context); | inputVolume.process (context); | ||||
| @@ -1617,6 +1617,7 @@ static const unsigned char temp_binary_data_8[] = | |||||
| "\r\n" | "\r\n" | ||||
| "void FILTERCLASSNAME::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)\r\n" | "void FILTERCLASSNAME::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)\r\n" | ||||
| "{\r\n" | "{\r\n" | ||||
| " ScopedNoDenormals noDenormals;\r\n" | |||||
| " const int totalNumInputChannels = getTotalNumInputChannels();\r\n" | " const int totalNumInputChannels = getTotalNumInputChannels();\r\n" | ||||
| " const int totalNumOutputChannels = getTotalNumOutputChannels();\r\n" | " const int totalNumOutputChannels = getTotalNumOutputChannels();\r\n" | ||||
| "\r\n" | "\r\n" | ||||
| @@ -7028,7 +7029,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw | |||||
| case 0xafccbd3f: numBytes = 3141; return jucer_AudioComponentTemplate_cpp; | case 0xafccbd3f: numBytes = 3141; return jucer_AudioComponentTemplate_cpp; | ||||
| case 0x27c5a93a: numBytes = 1310; return jucer_AudioPluginEditorTemplate_cpp; | case 0x27c5a93a: numBytes = 1310; return jucer_AudioPluginEditorTemplate_cpp; | ||||
| case 0x4d0721bf: numBytes = 938; return jucer_AudioPluginEditorTemplate_h; | case 0x4d0721bf: numBytes = 938; return jucer_AudioPluginEditorTemplate_h; | ||||
| case 0x51b49ac5: numBytes = 5611; return jucer_AudioPluginFilterTemplate_cpp; | |||||
| case 0x51b49ac5: numBytes = 5647; return jucer_AudioPluginFilterTemplate_cpp; | |||||
| case 0x488afa0a: numBytes = 2245; return jucer_AudioPluginFilterTemplate_h; | case 0x488afa0a: numBytes = 2245; return jucer_AudioPluginFilterTemplate_h; | ||||
| case 0xabad7041: numBytes = 2151; return jucer_ComponentTemplate_cpp; | case 0xabad7041: numBytes = 2151; return jucer_ComponentTemplate_cpp; | ||||
| case 0xfc72fe86: numBytes = 2064; return jucer_ComponentTemplate_h; | case 0xfc72fe86: numBytes = 2064; return jucer_ComponentTemplate_h; | ||||
| @@ -33,7 +33,7 @@ namespace BinaryData | |||||
| const int jucer_AudioPluginEditorTemplate_hSize = 938; | const int jucer_AudioPluginEditorTemplate_hSize = 938; | ||||
| extern const char* jucer_AudioPluginFilterTemplate_cpp; | extern const char* jucer_AudioPluginFilterTemplate_cpp; | ||||
| const int jucer_AudioPluginFilterTemplate_cppSize = 5611; | |||||
| const int jucer_AudioPluginFilterTemplate_cppSize = 5647; | |||||
| extern const char* jucer_AudioPluginFilterTemplate_h; | extern const char* jucer_AudioPluginFilterTemplate_h; | ||||
| const int jucer_AudioPluginFilterTemplate_hSize = 2245; | const int jucer_AudioPluginFilterTemplate_hSize = 2245; | ||||
| @@ -131,6 +131,7 @@ bool FILTERCLASSNAME::isBusesLayoutSupported (const BusesLayout& layouts) const | |||||
| void FILTERCLASSNAME::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) | void FILTERCLASSNAME::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) | ||||
| { | { | ||||
| ScopedNoDenormals noDenormals; | |||||
| const int totalNumInputChannels = getTotalNumInputChannels(); | const int totalNumInputChannels = getTotalNumInputChannels(); | ||||
| const int totalNumOutputChannels = getTotalNumOutputChannels(); | const int totalNumOutputChannels = getTotalNumOutputChannels(); | ||||
| @@ -221,4 +221,34 @@ public: | |||||
| static void JUCE_CALLTYPE disableDenormalisedNumberSupport() noexcept; | static void JUCE_CALLTYPE disableDenormalisedNumberSupport() noexcept; | ||||
| }; | }; | ||||
| //============================================================================== | |||||
| /** | |||||
| Helper class providing an RAII-based mechanism for temporarily disabling | |||||
| denormals on your CPU. | |||||
| */ | |||||
| class ScopedNoDenormals | |||||
| { | |||||
| public: | |||||
| inline ScopedNoDenormals() noexcept | |||||
| { | |||||
| #if JUCE_USE_SSE_INTRINSICS | |||||
| mxcsr = _mm_getcsr(); | |||||
| _mm_setcsr (mxcsr | 0x8040); // add the DAZ and FZ bits | |||||
| #endif | |||||
| } | |||||
| inline ~ScopedNoDenormals() noexcept | |||||
| { | |||||
| #if JUCE_USE_SSE_INTRINSICS | |||||
| _mm_setcsr (mxcsr); | |||||
| #endif | |||||
| } | |||||
| private: | |||||
| #if JUCE_USE_SSE_INTRINSICS | |||||
| unsigned int mxcsr; | |||||
| #endif | |||||
| }; | |||||
| } // namespace juce | } // namespace juce | ||||
| @@ -51,6 +51,7 @@ | |||||
| #include <juce_core/juce_core.h> | #include <juce_core/juce_core.h> | ||||
| //============================================================================== | |||||
| #undef Complex // apparently some C libraries actually define these symbols (!) | #undef Complex // apparently some C libraries actually define these symbols (!) | ||||
| #undef Factor | #undef Factor | ||||
| @@ -166,6 +166,23 @@ | |||||
| #define JUCE_DSP_USE_STATIC_FFTW 0 | #define JUCE_DSP_USE_STATIC_FFTW 0 | ||||
| #endif | #endif | ||||
| /** Config: JUCE_DSP_ENABLE_SNAP_TO_ZERO | |||||
| Enables code in the dsp module to avoid floating point denormals during the | |||||
| processing of some of the dsp module's filters. | |||||
| Enabling this will add a slight performance overhead to the DSP module's | |||||
| filters and algorithms. If your audio app already disables denormals altogether | |||||
| (for exmaple, by using the ScopedNoDenormals class or the | |||||
| FloatVectorOperations::disableDenormalisedNumberSupport method), then you | |||||
| can safely disable this flag to shave off a few cpu cycles from the DSP module's | |||||
| filters and algorithms. | |||||
| */ | |||||
| #ifndef JUCE_DSP_ENABLE_SNAP_TO_ZERO | |||||
| #define JUCE_DSP_ENABLE_SNAP_TO_ZERO 1 | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| #undef Complex // apparently some C libraries actually define these symbols (!) | #undef Complex // apparently some C libraries actually define these symbols (!) | ||||
| #undef Factor | #undef Factor | ||||
| @@ -185,11 +202,19 @@ namespace juce | |||||
| This function will work with both primitives and simple containers. | This function will work with both primitives and simple containers. | ||||
| */ | */ | ||||
| #if JUCE_DSP_ENABLE_SNAP_TO_ZERO | |||||
| inline void snapToZero (float& x) noexcept { JUCE_SNAP_TO_ZERO (x); } | inline void snapToZero (float& x) noexcept { JUCE_SNAP_TO_ZERO (x); } | ||||
| #ifndef DOXYGEN | #ifndef DOXYGEN | ||||
| inline void snapToZero (double& x) noexcept { JUCE_SNAP_TO_ZERO (x); } | inline void snapToZero (double& x) noexcept { JUCE_SNAP_TO_ZERO (x); } | ||||
| inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); } | inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); } | ||||
| #endif | #endif | ||||
| #else | |||||
| inline void snapToZero (float& x) noexcept { ignoreUnused (x); } | |||||
| #ifndef DOXYGEN | |||||
| inline void snapToZero (double& x) noexcept { ignoreUnused (x); } | |||||
| inline void snapToZero (long double& x) noexcept { ignoreUnused (x); } | |||||
| #endif | |||||
| #endif | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -444,7 +444,7 @@ public: | |||||
| auto numStages = coefficientsUp.size(); | auto numStages = coefficientsUp.size(); | ||||
| for (auto n = 0; n < numStages; n++) | for (auto n = 0; n < numStages; n++) | ||||
| JUCE_SNAP_TO_ZERO (lv1[n]); | |||||
| util::snapToZero (lv1[n]); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -455,7 +455,7 @@ public: | |||||
| auto numStages = coefficientsDown.size(); | auto numStages = coefficientsDown.size(); | ||||
| for (auto n = 0; n < numStages; n++) | for (auto n = 0; n < numStages; n++) | ||||
| JUCE_SNAP_TO_ZERO (lv1[n]); | |||||
| util::snapToZero (lv1[n]); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||