VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / modules / juce_dsp / processors / juce_ProcessorWrapper.h
blob3ebe2a0c5066b463bd43d3895f86aed032cf5db7
1 /*
2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
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.
23 ==============================================================================
26 namespace juce
28 namespace dsp
31 /**
32 Acts as a polymorphic base class for processors.
33 This exposes the same set of methods that a processor must implement as virtual
34 methods, so that you can use the ProcessorWrapper class to wrap an instance of
35 a subclass, and then pass that around using ProcessorBase as a base class.
36 @see ProcessorWrapper
38 @tags{DSP}
40 struct ProcessorBase
42 ProcessorBase() = default;
43 virtual ~ProcessorBase() = default;
45 virtual void prepare (const ProcessSpec&) = 0;
46 virtual void process (const ProcessContextReplacing<float>&) = 0;
47 virtual void reset() = 0;
51 //==============================================================================
52 /**
53 Wraps an instance of a given processor class, and exposes it through the
54 ProcessorBase interface.
55 @see ProcessorBase
57 @tags{DSP}
59 template <typename ProcessorType>
60 struct ProcessorWrapper : public ProcessorBase
62 void prepare (const ProcessSpec& spec) override
64 processor.prepare (spec);
67 void process (const ProcessContextReplacing<float>& context) override
69 processor.process (context);
72 void reset() override
74 processor.reset();
77 ProcessorType processor;
80 } // namespace dsp
81 } // namespace juce