LMMS
Loading...
Searching...
No Matches
juce_dsp.h
Go to the documentation of this file.
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.1
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: 14
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
60
61#if defined(_M_X64) || defined(__amd64__) || defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP == 2) || defined(__riscv) || defined(__EMSCRIPTEN__)
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#elif defined (__ARM_NEON__) || defined (__ARM_NEON) || defined (__arm64__) || defined (__aarch64__)
78
79 #ifndef JUCE_USE_SIMD
80 #define JUCE_USE_SIMD 1
81 #endif
82
83 #include <arm_neon.h>
84
85#else
86
87 // No SIMD Support
88 #ifndef JUCE_USE_SIMD
89 #define JUCE_USE_SIMD 0
90 #endif
91
92#endif
93
94#ifndef JUCE_VECTOR_CALLTYPE
95 // __vectorcall does not work on 64-bit due to internal compiler error in
96 // release mode VS2017. Re-enable when Microsoft fixes this
97 #if _MSC_VER && JUCE_USE_SIMD && ! (defined(_M_X64) || defined(__amd64__))
98 #define JUCE_VECTOR_CALLTYPE __vectorcall
99 #else
100 #define JUCE_VECTOR_CALLTYPE
101 #endif
102#endif
103
104#include <complex>
105
106
107//==============================================================================
117#ifndef JUCE_ASSERTION_FIRFILTER
118 #define JUCE_ASSERTION_FIRFILTER 1
119#endif
120
132#ifndef JUCE_DSP_USE_INTEL_MKL
133 #define JUCE_DSP_USE_INTEL_MKL 0
134#endif
135
148 #ifndef JUCE_DSP_USE_SHARED_FFTW
149 #define JUCE_DSP_USE_SHARED_FFTW 0
150#endif
151
163#ifndef JUCE_DSP_USE_STATIC_FFTW
164 #define JUCE_DSP_USE_STATIC_FFTW 0
165#endif
166
179#ifndef JUCE_DSP_ENABLE_SNAP_TO_ZERO
180 #define JUCE_DSP_ENABLE_SNAP_TO_ZERO 1
181#endif
182
183
184//==============================================================================
185#undef Complex // apparently some C libraries actually define these symbols (!)
186#undef Factor
187#undef check
188
189namespace juce
190{
191 namespace dsp
192 {
193 template <typename Type>
195
196 //==============================================================================
197 namespace util
198 {
202 #if JUCE_DSP_ENABLE_SNAP_TO_ZERO
203 inline void snapToZero (float& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
204 #ifndef DOXYGEN
205 inline void snapToZero (double& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
206 inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); }
207 #endif
208 #else
209 inline void snapToZero (float& x) noexcept { ignoreUnused (x); }
210 #ifndef DOXYGEN
211 inline void snapToZero (double& x) noexcept { ignoreUnused (x); }
212 inline void snapToZero (long double& x) noexcept { ignoreUnused (x); }
213 #endif
214 #endif
215 }
216 }
217}
218
219//==============================================================================
220#if JUCE_USE_SIMD
222
223 // include the correct native file for this build target CPU
224 #if defined(__i386__) || defined(__amd64__) || defined(_M_X64) || defined(_X86_) || defined(_M_IX86) || defined(__riscv) || defined(__EMSCRIPTEN__)
225 #ifdef __AVX2__
227 #else
229 #endif
230 #elif defined(__arm__) || defined(_M_ARM) || defined (__arm64__) || defined (__aarch64__)
232 #else
233 #error "SIMD register support not implemented for this platform"
234 #endif
235
237#endif
238
240#include "maths/juce_Matrix.h"
241#include "maths/juce_Phase.h"
263#include "frequency/juce_FFT.h"
267#include "widgets/juce_Reverb.h"
268#include "widgets/juce_Bias.h"
269#include "widgets/juce_Gain.h"
275#include "widgets/juce_Limiter.h"
276#include "widgets/juce_Phaser.h"
277#include "widgets/juce_Chorus.h"
unsigned x[BMAX+1]
Definition inflate.c:1586
#define JUCE_SNAP_TO_ZERO(n)
Definition juce_FloatVectorOperations.h:30
Definition audio_fx.h:36
Definition juce_SIMDRegister_Impl.h:165
void snapToZero(SIMDRegister< Type > &) noexcept
Definition juce_SIMDRegister_Impl.h:167
std::complex< Type > Complex
Definition juce_dsp.h:194
Definition carla_juce.cpp:31
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
Definition globals.h:33