OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_dsp.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
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 5 End-User License
11 Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
12 27th April 2017).
13
14 End User License Agreement: www.juce.com/juce-5-licence
15 Privacy Policy: www.juce.com/juce-5-privacy-policy
16
17 Or: You may also use this code under the terms of the GPL v3 (see
18 www.gnu.org/licenses).
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27
28/*******************************************************************************
29 The block below describes the properties of this module, and is read by
30 the Projucer to automatically generate project code that uses it.
31 For details about the syntax and how to create or use a module, see the
32 JUCE Module Format.txt file.
33
34
35 BEGIN_JUCE_MODULE_DECLARATION
36
37 ID: juce_dsp
38 vendor: juce
39 version: 5.4.7
40 name: JUCE DSP classes
41 description: Classes for audio buffer manipulation, digital audio processing, filtering, oversampling, fast math functions etc.
42 website: http://www.juce.com/juce
43 license: GPL/Commercial
44 minimumCppStandard: 14
45
46 dependencies: juce_audio_basics, juce_audio_formats
47 OSXFrameworks: Accelerate
48 iOSFrameworks: Accelerate
49
50 END_JUCE_MODULE_DECLARATION
51
52*******************************************************************************/
53
54
55#pragma once
56
57#define JUCE_DSP_H_INCLUDED
58
59#include <juce_audio_basics/juce_audio_basics.h>
60#include <juce_audio_formats/juce_audio_formats.h>
61
62#if ! JUCE_HAS_CONSTEXPR
63 #ifndef JUCE_DEMO_RUNNER
64 #error "The juce_dsp module requires a compiler that supports constexpr"
65 #endif
66#else
67
68#if defined(_M_X64) || defined(__amd64__) || defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP == 2)
69
70 #if defined(_M_X64) || defined(__amd64__)
71 #ifndef __SSE2__
72 #define __SSE2__
73 #endif
74 #endif
75
76 #ifndef JUCE_USE_SIMD
77 #define JUCE_USE_SIMD 1
78 #endif
79
80 #if JUCE_USE_SIMD
81 #include <immintrin.h>
82 #endif
83
84#elif defined (__ARM_NEON__) || defined (__ARM_NEON) || defined (__arm64__) || defined (__aarch64__)
85
86 #ifndef JUCE_USE_SIMD
87 #define JUCE_USE_SIMD 1
88 #endif
89
90 #include <arm_neon.h>
91
92#else
93
94 // No SIMD Support
95 #ifndef JUCE_USE_SIMD
96 #define JUCE_USE_SIMD 0
97 #endif
98
99#endif
100
101#ifndef JUCE_VECTOR_CALLTYPE
102 // __vectorcall does not work on 64-bit due to internal compiler error in
103 // release mode in both VS2015 and VS2017. Re-enable when Microsoft fixes this
104 #if _MSC_VER && JUCE_USE_SIMD && ! (defined(_M_X64) || defined(__amd64__))
105 #define JUCE_VECTOR_CALLTYPE __vectorcall
106 #else
107 #define JUCE_VECTOR_CALLTYPE
108 #endif
109#endif
110
111#include <atomic>
112#include <complex>
113#include <cmath>
114#include <array>
115
116
117//==============================================================================
127#ifndef JUCE_ASSERTION_FIRFILTER
128 #define JUCE_ASSERTION_FIRFILTER 1
129#endif
130
141#ifndef JUCE_DSP_USE_INTEL_MKL
142 #define JUCE_DSP_USE_INTEL_MKL 0
143#endif
144
157 #ifndef JUCE_DSP_USE_SHARED_FFTW
158 #define JUCE_DSP_USE_SHARED_FFTW 0
159#endif
160
172#ifndef JUCE_DSP_USE_STATIC_FFTW
173 #define JUCE_DSP_USE_STATIC_FFTW 0
174#endif
175
188#ifndef JUCE_DSP_ENABLE_SNAP_TO_ZERO
189 #define JUCE_DSP_ENABLE_SNAP_TO_ZERO 1
190#endif
191
192
193//==============================================================================
194#undef Complex // apparently some C libraries actually define these symbols (!)
195#undef Factor
196#undef check
197
198 namespace juce
199{
200 namespace dsp
201 {
202 template <typename Type>
203 using Complex = std::complex<Type>;
204
205 //==============================================================================
206 namespace util
207 {
211 #if JUCE_DSP_ENABLE_SNAP_TO_ZERO
212 inline void snapToZero (float& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
213 #ifndef DOXYGEN
214 inline void snapToZero (double& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
215 inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
216 #endif
217 #else
218 inline void snapToZero (float& x) noexcept { ignoreUnused (x); }
219 #ifndef DOXYGEN
220 inline void snapToZero (double& x) noexcept { ignoreUnused (x); }
221 inline void snapToZero (long double& x) noexcept { ignoreUnused (x); }
222 #endif
223 #endif
224 }
225 }
226}
227
228//==============================================================================
229#if JUCE_USE_SIMD
230 #include "native/juce_fallback_SIMDNativeOps.h"
231
232 // include the correct native file for this build target CPU
233 #if defined(__i386__) || defined(__amd64__) || defined(_M_X64) || defined(_X86_) || defined(_M_IX86)
234 #ifdef __AVX2__
235 #include "native/juce_avx_SIMDNativeOps.h"
236 #else
237 #include "native/juce_sse_SIMDNativeOps.h"
238 #endif
239 #elif defined(__arm__) || defined(_M_ARM) || defined (__arm64__) || defined (__aarch64__)
240 #include "native/juce_neon_SIMDNativeOps.h"
241 #else
242 #error "SIMD register support not implemented for this platform"
243 #endif
244
245 #include "containers/juce_SIMDRegister.h"
246#endif
247
248#include "maths/juce_SpecialFunctions.h"
249#include "maths/juce_Matrix.h"
250#include "maths/juce_Phase.h"
251#include "maths/juce_Polynomial.h"
252#include "maths/juce_FastMathApproximations.h"
253#include "maths/juce_LookupTable.h"
254#include "maths/juce_LogRampedValue.h"
255#include "containers/juce_AudioBlock.h"
256#include "processors/juce_ProcessContext.h"
257#include "processors/juce_ProcessorWrapper.h"
258#include "processors/juce_ProcessorChain.h"
259#include "processors/juce_ProcessorDuplicator.h"
260#include "processors/juce_Bias.h"
261#include "processors/juce_Gain.h"
262#include "processors/juce_WaveShaper.h"
263#include "processors/juce_IIRFilter.h"
264#include "processors/juce_FIRFilter.h"
265#include "processors/juce_Oscillator.h"
266#include "processors/juce_LadderFilter.h"
267#include "processors/juce_StateVariableFilter.h"
268#include "processors/juce_Oversampling.h"
269#include "processors/juce_Reverb.h"
270#include "frequency/juce_FFT.h"
271#include "frequency/juce_Convolution.h"
272#include "frequency/juce_Windowing.h"
273#include "filter_design/juce_FilterDesign.h"
274
275#endif