OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_dsp.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26
27/*******************************************************************************
28 The block below describes the properties of this module, and is read by
29 the Projucer to automatically generate project code that uses it.
30 For details about the syntax and how to create or use a module, see the
31 JUCE Module Format.md file.
32
33
34 BEGIN_JUCE_MODULE_DECLARATION
35
36 ID: juce_dsp
37 vendor: juce
38 version: 7.0.10
39 name: JUCE DSP classes
40 description: Classes for audio buffer manipulation, digital audio processing, filtering, oversampling, fast math functions etc.
41 website: http://www.juce.com/juce
42 license: GPL/Commercial
43 minimumCppStandard: 17
44
45 dependencies: juce_audio_formats
46 OSXFrameworks: Accelerate
47 iOSFrameworks: Accelerate
48
49 END_JUCE_MODULE_DECLARATION
50
51*******************************************************************************/
52
53
54#pragma once
55
56#define JUCE_DSP_H_INCLUDED
57
58#include <juce_audio_basics/juce_audio_basics.h>
59#include <juce_audio_formats/juce_audio_formats.h>
60
61#if defined (_M_X64) || defined (__amd64__) || defined (__SSE2__) || (defined (_M_IX86_FP) && _M_IX86_FP == 2)
62
63 #if defined (_M_X64) || defined (__amd64__)
64 #ifndef __SSE2__
65 #define __SSE2__
66 #endif
67 #endif
68
69 #ifndef JUCE_USE_SIMD
70 #define JUCE_USE_SIMD 1
71 #endif
72
73 #if JUCE_USE_SIMD
74 #include <immintrin.h>
75 #endif
76
77// it's ok to check for _M_ARM below as this is only defined on Windows for Arm 32-bit
78// which has a minimum requirement of armv7, which supports neon.
79#elif defined (__ARM_NEON__) || defined (__ARM_NEON) || defined (__arm64__) || defined (__aarch64__) || defined (_M_ARM) || defined (_M_ARM64)
80
81 #ifndef JUCE_USE_SIMD
82 #define JUCE_USE_SIMD 1
83 #endif
84
85 #include <arm_neon.h>
86
87#else
88
89 // No SIMD Support
90 #ifndef JUCE_USE_SIMD
91 #define JUCE_USE_SIMD 0
92 #endif
93
94#endif
95
96#ifndef JUCE_VECTOR_CALLTYPE
97 // __vectorcall does not work on 64-bit due to internal compiler error in
98 // release mode VS2017. Re-enable when Microsoft fixes this
99 #if _MSC_VER && JUCE_USE_SIMD && ! (defined (_M_X64) || defined (__amd64__))
100 #define JUCE_VECTOR_CALLTYPE __vectorcall
101 #else
102 #define JUCE_VECTOR_CALLTYPE
103 #endif
104#endif
105
106#include <complex>
107
108
109//==============================================================================
119#ifndef JUCE_ASSERTION_FIRFILTER
120 #define JUCE_ASSERTION_FIRFILTER 1
121#endif
122
134#ifndef JUCE_DSP_USE_INTEL_MKL
135 #define JUCE_DSP_USE_INTEL_MKL 0
136#endif
137
150 #ifndef JUCE_DSP_USE_SHARED_FFTW
151 #define JUCE_DSP_USE_SHARED_FFTW 0
152#endif
153
165#ifndef JUCE_DSP_USE_STATIC_FFTW
166 #define JUCE_DSP_USE_STATIC_FFTW 0
167#endif
168
181#ifndef JUCE_DSP_ENABLE_SNAP_TO_ZERO
182 #define JUCE_DSP_ENABLE_SNAP_TO_ZERO 1
183#endif
184
185
186//==============================================================================
187#undef Complex // apparently some C libraries actually define these symbols (!)
188#undef Factor
189#undef check
190
191 namespace juce::dsp
192{
193
194 template <typename Type>
195 using Complex = std::complex<Type>;
196
197 template <size_t len, typename T>
198 using FixedSizeFunction = juce::FixedSizeFunction<len, T>;
199
200//==============================================================================
201 namespace util
202{
206 #if JUCE_DSP_ENABLE_SNAP_TO_ZERO
207 inline void snapToZero (float& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
208 #ifndef DOXYGEN
209 inline void snapToZero (double& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
210 inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
211 #endif
212 #else
213 inline void snapToZero ([[maybe_unused]] float& x) noexcept {}
214 #ifndef DOXYGEN
215 inline void snapToZero ([[maybe_unused]] double& x) noexcept {}
216 inline void snapToZero ([[maybe_unused]] long double& x) noexcept {}
217 #endif
218 #endif
219}
220
221}
222
223//==============================================================================
224#if JUCE_USE_SIMD
225 #include "native/juce_SIMDNativeOps_fallback.h"
226
227 // include the correct native file for this build target CPU
228 #if defined (__i386__) || defined (__amd64__) || defined (_M_X64) || defined (_X86_) || defined (_M_IX86)
229 #ifdef __AVX2__
230 #include "native/juce_SIMDNativeOps_avx.h"
231 #else
232 #include "native/juce_SIMDNativeOps_sse.h"
233 #endif
234 #elif JUCE_ARM
235 #include "native/juce_SIMDNativeOps_neon.h"
236 #else
237 #error "SIMD register support not implemented for this platform"
238 #endif
239
240 #include "containers/juce_SIMDRegister.h"
241 #include "containers/juce_SIMDRegister_Impl.h"
242#endif
243
244#include "maths/juce_SpecialFunctions.h"
245#include "maths/juce_Matrix.h"
246#include "maths/juce_Phase.h"
247#include "maths/juce_Polynomial.h"
248#include "maths/juce_FastMathApproximations.h"
249#include "maths/juce_LookupTable.h"
250#include "maths/juce_LogRampedValue.h"
251#include "containers/juce_AudioBlock.h"
252#include "processors/juce_ProcessContext.h"
253#include "processors/juce_ProcessorWrapper.h"
254#include "processors/juce_ProcessorChain.h"
255#include "processors/juce_ProcessorDuplicator.h"
256#include "processors/juce_IIRFilter.h"
257#include "processors/juce_IIRFilter_Impl.h"
258#include "processors/juce_FIRFilter.h"
259#include "processors/juce_StateVariableFilter.h"
260#include "processors/juce_FirstOrderTPTFilter.h"
261#include "processors/juce_Panner.h"
262#include "processors/juce_DelayLine.h"
263#include "processors/juce_Oversampling.h"
264#include "processors/juce_BallisticsFilter.h"
265#include "processors/juce_LinkwitzRileyFilter.h"
266#include "processors/juce_DryWetMixer.h"
267#include "processors/juce_StateVariableTPTFilter.h"
268#include "frequency/juce_FFT.h"
269#include "frequency/juce_Convolution.h"
270#include "frequency/juce_Windowing.h"
271#include "filter_design/juce_FilterDesign.h"
272#include "widgets/juce_Reverb.h"
273#include "widgets/juce_Bias.h"
274#include "widgets/juce_Gain.h"
275#include "widgets/juce_WaveShaper.h"
276#include "widgets/juce_Oscillator.h"
277#include "widgets/juce_LadderFilter.h"
278#include "widgets/juce_Compressor.h"
279#include "widgets/juce_NoiseGate.h"
280#include "widgets/juce_Limiter.h"
281#include "widgets/juce_Phaser.h"
282#include "widgets/juce_Chorus.h"