OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_AudioIODevice.h
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
23 namespace juce
24{
25
26 class AudioIODevice;
27
33 struct AudioIODeviceCallbackContext
34{
38 const uint64_t* hostTimeNs = nullptr;
39};
40
41//==============================================================================
54 class JUCE_API AudioIODeviceCallback
55{
56 public:
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//==============================================================================
150 class JUCE_API AudioIODevice
151{
152 public:
154 virtual ~AudioIODevice();
155
156 //==============================================================================
158 const String& getName() const noexcept { return name; }
159
164 const String& getTypeName() const noexcept { return typeName; }
165
166 //==============================================================================
170 virtual StringArray getOutputChannelNames() = 0;
171
175 virtual StringArray getInputChannelNames() = 0;
176
177 //==============================================================================
183 virtual std::optional<BigInteger> getDefaultOutputChannels() const { return {}; }
184
190 virtual std::optional<BigInteger> getDefaultInputChannels() const { return {}; }
191
192 //==============================================================================
196 virtual Array<double> getAvailableSampleRates() = 0;
197
201 virtual Array<int> getAvailableBufferSizes() = 0;
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 //==============================================================================
270 virtual int getCurrentBufferSizeSamples() = 0;
271
276 virtual double getCurrentSampleRate() = 0;
277
282 virtual int getCurrentBitDepth() = 0;
283
288 virtual BigInteger getActiveOutputChannels() const = 0;
289
294 virtual BigInteger getActiveInputChannels() const = 0;
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
juce::Array
Definition juce_Array.h:56
juce::AudioIODeviceCallback
Definition juce_AudioIODevice.h:55
juce::AudioIODeviceCallback::~AudioIODeviceCallback
virtual ~AudioIODeviceCallback()=default
juce::AudioIODeviceCallback::audioDeviceAboutToStart
virtual void audioDeviceAboutToStart(AudioIODevice *device)=0
juce::AudioIODeviceCallback::audioDeviceStopped
virtual void audioDeviceStopped()=0
juce::AudioIODevice
Definition juce_AudioIODevice.h:151
juce::AudioIODevice::getCurrentSampleRate
virtual double getCurrentSampleRate()=0
juce::AudioIODevice::getCurrentBitDepth
virtual int getCurrentBitDepth()=0
juce::AudioIODevice::close
virtual void close()=0
juce::AudioIODevice::isPlaying
virtual bool isPlaying()=0
juce::AudioIODevice::getTypeName
const String & getTypeName() const noexcept
Definition juce_AudioIODevice.h:164
juce::AudioIODevice::getOutputChannelNames
virtual StringArray getOutputChannelNames()=0
juce::AudioIODevice::getInputChannelNames
virtual StringArray getInputChannelNames()=0
juce::AudioIODevice::getDefaultInputChannels
virtual std::optional< BigInteger > getDefaultInputChannels() const
Definition juce_AudioIODevice.h:190
juce::AudioIODevice::getAvailableBufferSizes
virtual Array< int > getAvailableBufferSizes()=0
juce::AudioIODevice::getWorkgroup
virtual AudioWorkgroup getWorkgroup() const
Definition juce_AudioIODevice.h:311
juce::AudioIODevice::getDefaultOutputChannels
virtual std::optional< BigInteger > getDefaultOutputChannels() const
Definition juce_AudioIODevice.h:183
juce::AudioIODevice::getActiveInputChannels
virtual BigInteger getActiveInputChannels() const =0
juce::AudioIODevice::stop
virtual void stop()=0
juce::AudioIODevice::getActiveOutputChannels
virtual BigInteger getActiveOutputChannels() const =0
juce::AudioIODevice::getAvailableSampleRates
virtual Array< double > getAvailableSampleRates()=0
juce::AudioIODevice::getInputLatencyInSamples
virtual int getInputLatencyInSamples()=0
juce::AudioIODevice::getCurrentBufferSizeSamples
virtual int getCurrentBufferSizeSamples()=0
juce::AudioIODevice::getName
const String & getName() const noexcept
Definition juce_AudioIODevice.h:158
juce::AudioIODevice::getDefaultBufferSize
virtual int getDefaultBufferSize()=0
juce::AudioIODevice::start
virtual void start(AudioIODeviceCallback *callback)=0
juce::AudioIODevice::getLastError
virtual String getLastError()=0
juce::AudioIODevice::open
virtual String open(const BigInteger &inputChannels, const BigInteger &outputChannels, double sampleRate, int bufferSizeSamples)=0
juce::AudioIODevice::getOutputLatencyInSamples
virtual int getOutputLatencyInSamples()=0
juce::AudioIODevice::isOpen
virtual bool isOpen()=0
juce::AudioWorkgroup
Definition juce_AudioWorkgroup.h:142
juce::BigInteger
Definition juce_BigInteger.h:39
juce::StringArray
Definition juce_StringArray.h:35
juce::String
Definition juce_String.h:53
juce::AudioIODeviceCallbackContext
Definition juce_AudioIODevice.h:34
juce::AudioIODeviceCallbackContext::hostTimeNs
const uint64_t * hostTimeNs
Definition juce_AudioIODevice.h:38