OpenShot Library | OpenShotAudio 0.2.2
juce_ProcessorWrapper.h
1
2/** @weakgroup juce_dsp-processors
3 * @{
4 */
5/*
6 ==============================================================================
7
8 This file is part of the JUCE library.
9 Copyright (c) 2017 - ROLI Ltd.
10
11 JUCE is an open source library subject to commercial or open-source
12 licensing.
13
14 By using JUCE, you agree to the terms of both the JUCE 5 End-User License
15 Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
16 27th April 2017).
17
18 End User License Agreement: www.juce.com/juce-5-licence
19 Privacy Policy: www.juce.com/juce-5-privacy-policy
20
21 Or: You may also use this code under the terms of the GPL v3 (see
22 www.gnu.org/licenses).
23
24 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
25 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
26 DISCLAIMED.
27
28 ==============================================================================
29*/
30
31namespace juce
32{
33namespace dsp
34{
35
36/**
37 Acts as a polymorphic base class for processors.
38 This exposes the same set of methods that a processor must implement as virtual
39 methods, so that you can use the ProcessorWrapper class to wrap an instance of
40 a subclass, and then pass that around using ProcessorBase as a base class.
41 @see ProcessorWrapper
42
43 @tags{DSP}
44*/
46{
47 ProcessorBase() = default;
48 virtual ~ProcessorBase() = default;
49
50 virtual void prepare (const ProcessSpec&) = 0;
51 virtual void process (const ProcessContextReplacing<float>&) = 0;
52 virtual void reset() = 0;
53};
54
55
56//==============================================================================
57/**
58 Wraps an instance of a given processor class, and exposes it through the
59 ProcessorBase interface.
60 @see ProcessorBase
61
62 @tags{DSP}
63*/
64template <typename ProcessorType>
66{
67 void prepare (const ProcessSpec& spec) override
68 {
69 processor.prepare (spec);
70 }
71
72 void process (const ProcessContextReplacing<float>& context) override
73 {
74 processor.process (context);
75 }
76
77 void reset() override
78 {
79 processor.reset();
80 }
81
82 ProcessorType processor;
83};
84
85} // namespace dsp
86} // namespace juce
87
88/** @}*/
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...
Contains context information that is passed into an algorithm's process method.
Acts as a polymorphic base class for processors.
Wraps an instance of a given processor class, and exposes it through the ProcessorBase interface.