JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_AudioProcessorPlayer.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{
28
29//==============================================================================
46{
47public:
48 //==============================================================================
49 AudioProcessorPlayer (bool doDoublePrecisionProcessing = false);
50
52 ~AudioProcessorPlayer() override;
53
54 //==============================================================================
60 void setProcessor (AudioProcessor* processorToPlay);
61
63 AudioProcessor* getCurrentProcessor() const noexcept { return processor; }
64
69 MidiMessageCollector& getMidiMessageCollector() noexcept { return messageCollector; }
70
76 void setMidiOutput (MidiOutput* midiOutputToUse);
77
86 void setDoublePrecisionProcessing (bool doublePrecision);
87
91 inline bool getDoublePrecisionProcessing() { return isDoublePrecision; }
92
93 //==============================================================================
95 void audioDeviceIOCallbackWithContext (const float* const*, int, float* const*, int, int, const AudioIODeviceCallbackContext&) override;
97 void audioDeviceAboutToStart (AudioIODevice*) override;
99 void audioDeviceStopped() override;
101 void handleIncomingMidiMessage (MidiInput*, const MidiMessage&) override;
102
103private:
104 struct NumChannels
105 {
106 NumChannels() = default;
107 NumChannels (int numIns, int numOuts) : ins (numIns), outs (numOuts) {}
108
109 explicit NumChannels (const AudioProcessor::BusesLayout& layout)
110 : ins (layout.getNumChannels (true, 0)), outs (layout.getNumChannels (false, 0)) {}
111
112 AudioProcessor::BusesLayout toLayout() const
113 {
114 return { { AudioChannelSet::canonicalChannelSet (ins) },
115 { AudioChannelSet::canonicalChannelSet (outs) } };
116 }
117
118 int ins = 0, outs = 0;
119 };
120
121 //==============================================================================
122 NumChannels findMostSuitableLayout (const AudioProcessor&) const;
123 void resizeChannels();
124
125 //==============================================================================
126 AudioProcessor* processor = nullptr;
127 CriticalSection lock;
128 double sampleRate = 0;
129 int blockSize = 0;
130 bool isPrepared = false, isDoublePrecision = false;
131
132 NumChannels deviceChannels, defaultProcessorChannels, actualProcessorChannels;
133 std::vector<float*> channels;
134 AudioBuffer<float> tempBuffer;
135 AudioBuffer<double> conversionBuffer;
136
137 MidiBuffer incomingMidi;
138 MidiMessageCollector messageCollector;
139 MidiOutput* midiOutput = nullptr;
140 uint64_t sampleCount = 0;
141
142 AudioIODevice* currentDevice = nullptr;
143 AudioWorkgroup currentWorkgroup;
144
146};
147
148} // namespace juce
One of these is passed to an AudioIODevice object to stream the audio data in and out.
Base class for an audio device with synchronised input and output channels.
An AudioIODeviceCallback object which streams audio through an AudioProcessor.
AudioProcessor * getCurrentProcessor() const noexcept
Returns the current audio processor that is being played.
bool getDoublePrecisionProcessing()
Returns true if this player processes internally processes the samples with double floating point pre...
MidiMessageCollector & getMidiMessageCollector() noexcept
Returns a midi message collector that you can pass midi messages to if you want them to be injected i...
Base class for audio processing classes or plugins.
Receives incoming messages from a physical MIDI input device.
Represents a midi input device.
Collects incoming realtime MIDI messages and turns them into blocks suitable for processing by a bloc...
Encapsulates a MIDI message.
Represents a midi output device.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
T lock(T... args)
JUCE Namespace.
Additional information that may be passed to the AudioIODeviceCallback.
typedef uint64_t