OpenShot Audio Library | OpenShotAudio 0.3.2
Loading...
Searching...
No Matches
juce_Convolution.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
27namespace juce
28{
29namespace dsp
30{
31
50class JUCE_API Convolution
51{
52public:
53 //==============================================================================
56
59
60 //==============================================================================
65 void prepare (const ProcessSpec&);
66
68 void reset() noexcept;
69
73 template <typename ProcessContext>
74 void process (const ProcessContext& context) noexcept
75 {
76 static_assert (std::is_same<typename ProcessContext::SampleType, float>::value,
77 "Convolution engine only supports single precision floating point data");
78
79 processSamples (context.getInputBlock(), context.getOutputBlock(), context.isBypassed);
80 }
81
82 //==============================================================================
101 void loadImpulseResponse (const void* sourceData, size_t sourceDataSize,
102 bool wantsStereo, bool wantsTrimming, size_t size,
103 bool wantsNormalisation = true);
104
116 void loadImpulseResponse (const File& fileImpulseResponse,
117 bool wantsStereo, bool wantsTrimming, size_t size,
118 bool wantsNormalisation = true);
119
132 void copyAndLoadImpulseResponseFromBuffer (AudioBuffer<float>& buffer, double bufferSampleRate,
133 bool wantsStereo, bool wantsTrimming, bool wantsNormalisation,
134 size_t size);
135
148 void copyAndLoadImpulseResponseFromBlock (AudioBlock<float> block, double bufferSampleRate,
149 bool wantsStereo, bool wantsTrimming, bool wantsNormalisation,
150 size_t size);
151
152
153private:
154 //==============================================================================
155 struct Pimpl;
156 std::unique_ptr<Pimpl> pimpl;
157
158 //==============================================================================
159 void processSamples (const AudioBlock<const float>&, AudioBlock<float>&, bool isBypassed) noexcept;
160
161 //==============================================================================
162 double sampleRate;
163 bool currentIsBypassed = false;
164 bool isActive = false;
165 SmoothedValue<float> volumeDry[2], volumeWet[2];
166 AudioBlock<float> dryBuffer;
167 HeapBlock<char> dryBufferStorage;
168
169 //==============================================================================
170 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Convolution)
171};
172
173} // namespace dsp
174} // namespace juce
void process(const ProcessContext &context) noexcept