OpenShot Audio Library | OpenShotAudio: juce_ProcessContext.h Source File

OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_ProcessContext.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
38 struct ProcessSpec
39{
41 double sampleRate;
42
44 uint32 maximumBlockSize;
45
47 uint32 numChannels;
48};
49
50//==============================================================================
58 struct ProcessorState : public ReferenceCountedObject
59{
63 using Ptr = ReferenceCountedObjectPtr<ProcessorState>;
64};
65
66//==============================================================================
78template <typename ContextSampleType>
79 struct ProcessContextReplacing
80{
81public:
83 using SampleType = ContextSampleType;
85 using AudioBlockType = AudioBlock<SampleType>;
86 using ConstAudioBlockType = AudioBlock<const SampleType>;
87
91 ProcessContextReplacing (AudioBlockType& block) noexcept : ioBlock (block) {}
92
93 ProcessContextReplacing (const ProcessContextReplacing&) = default;
94 ProcessContextReplacing (ProcessContextReplacing&&) = default;
95
97 const ConstAudioBlockType& getInputBlock() const noexcept { return constBlock; }
98
100 AudioBlockType& getOutputBlock() const noexcept { return ioBlock; }
101
106 static constexpr bool usesSeparateInputAndOutputBlocks() { return false; }
107
111 bool isBypassed = false;
112
113private:
114 AudioBlockType& ioBlock;
115 ConstAudioBlockType constBlock { ioBlock };
116};
117
118//==============================================================================
131template <typename ContextSampleType>
132 struct ProcessContextNonReplacing
133{
134public:
136 using SampleType = ContextSampleType;
138 using AudioBlockType = AudioBlock<SampleType>;
139 using ConstAudioBlockType = AudioBlock<const SampleType>;
140
144 ProcessContextNonReplacing (const ConstAudioBlockType& input, AudioBlockType& output) noexcept
145 : inputBlock (input), outputBlock (output)
146 {
147 // If the input and output blocks are the same then you should use
148 // ProcessContextReplacing instead.
149 jassert (input != output);
150 }
151
152 ProcessContextNonReplacing (const ProcessContextNonReplacing&) = default;
153 ProcessContextNonReplacing (ProcessContextNonReplacing&&) = default;
154
156 const ConstAudioBlockType& getInputBlock() const noexcept { return inputBlock; }
157
159 AudioBlockType& getOutputBlock() const noexcept { return outputBlock; }
160
165 static constexpr bool usesSeparateInputAndOutputBlocks() { return true; }
166
170 bool isBypassed = false;
171
172private:
173 ConstAudioBlockType inputBlock;
174 AudioBlockType& outputBlock;
175};
176
177} // namespace dsp
178} // namespace juce
juce::ReferenceCountedObjectPtr
Definition: juce_ReferenceCountedObject.h:247
juce::ReferenceCountedObject
Definition: juce_ReferenceCountedObject.h:66
juce::dsp::AudioBlock
Definition: juce_AudioBlock.h:65
juce::dsp::ProcessContextNonReplacing
Definition: juce_ProcessContext.h:133
juce::dsp::ProcessContextNonReplacing::usesSeparateInputAndOutputBlocks
static constexpr bool usesSeparateInputAndOutputBlocks()
Definition: juce_ProcessContext.h:165
juce::dsp::ProcessContextNonReplacing::getOutputBlock
AudioBlockType & getOutputBlock() const noexcept
Definition: juce_ProcessContext.h:159
juce::dsp::ProcessContextNonReplacing::getInputBlock
const ConstAudioBlockType & getInputBlock() const noexcept
Definition: juce_ProcessContext.h:156
juce::dsp::ProcessContextNonReplacing::ProcessContextNonReplacing
ProcessContextNonReplacing(const ConstAudioBlockType &input, AudioBlockType &output) noexcept
Definition: juce_ProcessContext.h:144
juce::dsp::ProcessContextNonReplacing::isBypassed
bool isBypassed
Definition: juce_ProcessContext.h:170
juce::dsp::ProcessContextNonReplacing::SampleType
ContextSampleType SampleType
Definition: juce_ProcessContext.h:136
juce::dsp::ProcessContextReplacing
Definition: juce_ProcessContext.h:80
juce::dsp::ProcessContextReplacing::ProcessContextReplacing
ProcessContextReplacing(AudioBlockType &block) noexcept
Definition: juce_ProcessContext.h:91
juce::dsp::ProcessContextReplacing::SampleType
ContextSampleType SampleType
Definition: juce_ProcessContext.h:83
juce::dsp::ProcessContextReplacing::usesSeparateInputAndOutputBlocks
static constexpr bool usesSeparateInputAndOutputBlocks()
Definition: juce_ProcessContext.h:106
juce::dsp::ProcessContextReplacing::getInputBlock
const ConstAudioBlockType & getInputBlock() const noexcept
Definition: juce_ProcessContext.h:97
juce::dsp::ProcessContextReplacing::getOutputBlock
AudioBlockType & getOutputBlock() const noexcept
Definition: juce_ProcessContext.h:100
juce::dsp::ProcessContextReplacing::isBypassed
bool isBypassed
Definition: juce_ProcessContext.h:111
juce::dsp::ProcessSpec
Definition: juce_ProcessContext.h:39
juce::dsp::ProcessSpec::numChannels
uint32 numChannels
Definition: juce_ProcessContext.h:47
juce::dsp::ProcessSpec::sampleRate
double sampleRate
Definition: juce_ProcessContext.h:41
juce::dsp::ProcessSpec::maximumBlockSize
uint32 maximumBlockSize
Definition: juce_ProcessContext.h:44
juce::dsp::ProcessorState
Definition: juce_ProcessContext.h:59