OpenShot Audio Library | OpenShotAudio 0.4.0
Loading...
Searching...
No Matches
juce_ProcessContext.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
26namespace juce::dsp
27{
28
36{
38 double sampleRate;
39
42
45};
46
47constexpr bool operator== (const ProcessSpec& a, const ProcessSpec& b)
48{
49 const auto tie = [] (const ProcessSpec& p)
50 {
51 return std::tie (p.sampleRate, p.maximumBlockSize, p.numChannels);
52 };
53
54 return tie (a) == tie (b);
55}
56
57constexpr bool operator!= (const ProcessSpec& a, const ProcessSpec& b) { return ! (a == b); }
58
59//==============================================================================
74
75//==============================================================================
87template <typename ContextSampleType>
89{
90public:
92 using SampleType = ContextSampleType;
95 using ConstAudioBlockType = AudioBlock<const SampleType>;
96
100 ProcessContextReplacing (AudioBlockType& block) noexcept : ioBlock (block) {}
101
104
106 const ConstAudioBlockType& getInputBlock() const noexcept { return constBlock; }
107
109 AudioBlockType& getOutputBlock() const noexcept { return ioBlock; }
110
115 static constexpr bool usesSeparateInputAndOutputBlocks() { return false; }
116
120 bool isBypassed = false;
121
122private:
123 AudioBlockType& ioBlock;
124 ConstAudioBlockType constBlock { ioBlock };
125};
126
127//==============================================================================
140template <typename ContextSampleType>
142{
143public:
145 using SampleType = ContextSampleType;
148 using ConstAudioBlockType = AudioBlock<const SampleType>;
149
153 ProcessContextNonReplacing (const ConstAudioBlockType& input, AudioBlockType& output) noexcept
154 : inputBlock (input), outputBlock (output)
155 {
156 // If the input and output blocks are the same then you should use
157 // ProcessContextReplacing instead.
158 jassert (input != output);
159 }
160
163
165 const ConstAudioBlockType& getInputBlock() const noexcept { return inputBlock; }
166
168 AudioBlockType& getOutputBlock() const noexcept { return outputBlock; }
169
174 static constexpr bool usesSeparateInputAndOutputBlocks() { return true; }
175
179 bool isBypassed = false;
180
181private:
182 ConstAudioBlockType inputBlock;
183 AudioBlockType& outputBlock;
184};
185
186} // namespace juce::dsp
static constexpr bool usesSeparateInputAndOutputBlocks()
AudioBlockType & getOutputBlock() const noexcept
const ConstAudioBlockType & getInputBlock() const noexcept
ProcessContextNonReplacing(const ConstAudioBlockType &input, AudioBlockType &output) noexcept
ProcessContextReplacing(AudioBlockType &block) noexcept
static constexpr bool usesSeparateInputAndOutputBlocks()
const ConstAudioBlockType & getInputBlock() const noexcept
AudioBlockType & getOutputBlock() const noexcept
AudioBlock< SampleType > AudioBlockType
ReferenceCountedObjectPtr< ProcessorState > Ptr