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_AudioIODevice.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 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26class AudioIODevice;
27
34{
38 const uint64_t* hostTimeNs = nullptr;
39};
40
41//==============================================================================
55{
56public:
58 virtual ~AudioIODeviceCallback() = default;
59
100 virtual void audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
101 int numInputChannels,
102 float* const* outputChannelData,
103 int numOutputChannels,
104 int numSamples,
105 const AudioIODeviceCallbackContext& context);
106
121 virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
122
124 virtual void audioDeviceStopped() = 0;
125
130 virtual void audioDeviceError (const String& errorMessage);
131};
132
133//==============================================================================
150class JUCE_API AudioIODevice
151{
152public:
154 virtual ~AudioIODevice();
155
156 //==============================================================================
158 const String& getName() const noexcept { return name; }
159
164 const String& getTypeName() const noexcept { return typeName; }
165
166 //==============================================================================
171
176
177 //==============================================================================
184
191
192 //==============================================================================
197
202
207 virtual int getDefaultBufferSize() = 0;
208
209 //==============================================================================
224 virtual String open (const BigInteger& inputChannels,
225 const BigInteger& outputChannels,
226 double sampleRate,
227 int bufferSizeSamples) = 0;
228
230 virtual void close() = 0;
231
237 virtual bool isOpen() = 0;
238
246 virtual void start (AudioIODeviceCallback* callback) = 0;
247
253 virtual void stop() = 0;
254
260 virtual bool isPlaying() = 0;
261
263 virtual String getLastError() = 0;
264
265 //==============================================================================
271
276 virtual double getCurrentSampleRate() = 0;
277
282 virtual int getCurrentBitDepth() = 0;
283
289
295
301 virtual int getOutputLatencyInSamples() = 0;
302
308 virtual int getInputLatencyInSamples() = 0;
309
311 virtual AudioWorkgroup getWorkgroup() const { return {}; }
312
313 //==============================================================================
319 virtual bool hasControlPanel() const;
320
325 virtual bool showControlPanel();
326
331 virtual bool setAudioPreprocessingEnabled (bool shouldBeEnabled);
332
333 //==============================================================================
344 virtual int getXRunCount() const noexcept;
345
346 //==============================================================================
347protected:
349 AudioIODevice (const String& deviceName,
350 const String& typeName);
351
353 String name, typeName;
354};
355
356} // namespace juce
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
One of these is passed to an AudioIODevice object to stream the audio data in and out.
virtual ~AudioIODeviceCallback()=default
Destructor.
virtual void audioDeviceAboutToStart(AudioIODevice *device)=0
Called to indicate that the device is about to start calling back.
virtual void audioDeviceStopped()=0
Called to indicate that the device has stopped.
Base class for an audio device with synchronised input and output channels.
virtual double getCurrentSampleRate()=0
Returns the sample rate that the device is currently using.
virtual int getCurrentBitDepth()=0
Returns the device's current physical bit-depth.
virtual void close()=0
Closes and releases the device if it's open.
virtual bool isPlaying()=0
Returns true if the device is still calling back.
const String & getTypeName() const noexcept
Returns the type of the device.
virtual StringArray getOutputChannelNames()=0
Returns the names of all the available output channels on this device.
virtual StringArray getInputChannelNames()=0
Returns the names of all the available input channels on this device.
virtual std::optional< BigInteger > getDefaultInputChannels() const
For devices that support a default layout, returns the channels that are enabled in the default layou...
virtual Array< int > getAvailableBufferSizes()=0
Returns the set of buffer sizes that are available.
virtual AudioWorkgroup getWorkgroup() const
Returns the workgroup for this device.
virtual std::optional< BigInteger > getDefaultOutputChannels() const
For devices that support a default layout, returns the channels that are enabled in the default layou...
virtual BigInteger getActiveInputChannels() const =0
Returns a mask showing which of the available input channels are currently enabled.
virtual void stop()=0
Stops the device playing.
virtual BigInteger getActiveOutputChannels() const =0
Returns a mask showing which of the available output channels are currently enabled.
virtual Array< double > getAvailableSampleRates()=0
Returns the set of sample-rates this device supports.
virtual int getInputLatencyInSamples()=0
Returns the device's input latency.
virtual int getCurrentBufferSizeSamples()=0
Returns the buffer size that the device is currently using.
const String & getName() const noexcept
Returns the device's name, (as set in the constructor).
virtual int getDefaultBufferSize()=0
Returns the default buffer-size to use.
virtual void start(AudioIODeviceCallback *callback)=0
Starts the device actually playing.
virtual String getLastError()=0
Returns the last error that happened if anything went wrong.
virtual String open(const BigInteger &inputChannels, const BigInteger &outputChannels, double sampleRate, int bufferSizeSamples)=0
Tries to open the device ready to play.
virtual int getOutputLatencyInSamples()=0
Returns the device's output latency.
virtual bool isOpen()=0
Returns true if the device is still open.
A handle to an audio workgroup, which is a collection of realtime threads working together to produce...
An arbitrarily large integer class.
A special array for holding a list of strings.
The JUCE String class!
Definition juce_String.h:53
JUCE Namespace.
const uint64_t * hostTimeNs
If the host provides this information, this field will be set to point to an integer holding the curr...
Additional information that may be passed to the AudioIODeviceCallback.
typedef uint64_t