LMMS
Loading...
Searching...
No Matches
juce_Oversampling.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
26namespace juce
27{
28namespace dsp
29{
30
31//===============================================================================
54template <typename SampleType>
56{
57public:
65
66 //===============================================================================
76 explicit Oversampling (size_t numChannels = 1);
77
91 Oversampling (size_t numChannels,
92 size_t factor,
93 FilterType type,
94 bool isMaxQuality = true,
95 bool useIntegerLatency = false);
96
99
100 //===============================================================================
101 /* Sets if this processor should add some fractional delay at the end of the signal
102 path to ensure that the overall latency of the oversampling is an integer.
103 */
104 void setUsingIntegerLatency (bool shouldUseIntegerLatency) noexcept;
105
116 SampleType getLatencyInSamples() const noexcept;
117
119 size_t getOversamplingFactor() const noexcept;
120
121 //===============================================================================
125 void initProcessing (size_t maximumNumberOfSamplesBeforeOversampling);
126
128 void reset() noexcept;
129
137 AudioBlock<SampleType> processSamplesUp (const AudioBlock<const SampleType>& inputBlock) noexcept;
138
144 void processSamplesDown (AudioBlock<SampleType>& outputBlock) noexcept;
145
146 //===============================================================================
170 void addOversamplingStage (FilterType,
171 float normalisedTransitionWidthUp, float stopbandAmplitudedBUp,
172 float normalisedTransitionWidthDown, float stopbandAmplitudedBDown);
173
181 void addDummyOversamplingStage();
182
188 void clearOversamplingStages();
189
190 //===============================================================================
192 size_t numChannels = 1;
193
194 #ifndef DOXYGEN
195 struct OversamplingStage;
196 #endif
197
198private:
199 //===============================================================================
200 void updateDelayLine();
202
203 //===============================================================================
206 DelayLine<SampleType, DelayLineInterpolationTypes::Thiran> delay { 8 };
207 SampleType fractionalDelay = 0;
208
209 //===============================================================================
211};
212
213} // namespace dsp
214} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
Definition juce_OwnedArray.h:51
Definition juce_AudioBlock.h:70
Definition juce_DelayLine.h:95
Definition juce_Oversampling.h:56
SampleType getUncompensatedLatency() const noexcept
Definition juce_Oversampling.cpp:647
FilterType
Definition juce_Oversampling.h:60
@ filterHalfBandFIREquiripple
Definition juce_Oversampling.h:61
@ filterHalfBandPolyphaseIIR
Definition juce_Oversampling.h:62
@ numFilterTypes
Definition juce_Oversampling.h:63
bool isReady
Definition juce_Oversampling.h:205
bool shouldUseIntegerLatency
Definition juce_Oversampling.h:205
void updateDelayLine()
Definition juce_Oversampling.cpp:753
DelayLine< SampleType, DelayLineInterpolationTypes::Thiran > delay
Definition juce_Oversampling.h:206
size_t factorOversampling
Definition juce_Oversampling.h:191
Oversampling(size_t numChannels=1)
Definition juce_Oversampling.cpp:533
SampleType fractionalDelay
Definition juce_Oversampling.h:207
size_t numChannels
Definition juce_Oversampling.h:192
OwnedArray< OversamplingStage > stages
Definition juce_Oversampling.h:204
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition juce_DelayLine.h:37
Definition juce_AudioBlock.h:29
Definition carla_juce.cpp:31
#define false
Definition ordinals.h:83
Definition juce_Oversampling.cpp:36
#define const
Definition zconf.h:137