Loading...
Searching...
No Matches
juce_AudioIODevice.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
class AudioIODevice;
struct AudioIODeviceCallbackContext
{
const uint64_t* hostTimeNs = nullptr;
};
//==============================================================================
class JUCE_API AudioIODeviceCallback
{
public:
virtual ~AudioIODeviceCallback() = default;
virtual void audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
int numInputChannels,
float* const* outputChannelData,
int numOutputChannels,
int numSamples,
const AudioIODeviceCallbackContext& context);
virtual void audioDeviceAboutToStart (AudioIODevice* device) = 0;
virtual void audioDeviceStopped() = 0;
virtual void audioDeviceError (const String& errorMessage);
};
//==============================================================================
class JUCE_API AudioIODevice
{
public:
virtual ~AudioIODevice();
//==============================================================================
const String& getName() const noexcept { return name; }
const String& getTypeName() const noexcept { return typeName; }
//==============================================================================
virtual StringArray getOutputChannelNames() = 0;
virtual StringArray getInputChannelNames() = 0;
//==============================================================================
virtual std::optional<BigInteger> getDefaultOutputChannels() const { return {}; }
virtual std::optional<BigInteger> getDefaultInputChannels() const { return {}; }
//==============================================================================
virtual Array<double> getAvailableSampleRates() = 0;
virtual Array<int> getAvailableBufferSizes() = 0;
virtual int getDefaultBufferSize() = 0;
//==============================================================================
virtual String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate,
int bufferSizeSamples) = 0;
virtual void close() = 0;
virtual bool isOpen() = 0;
virtual void start (AudioIODeviceCallback* callback) = 0;
virtual void stop() = 0;
virtual bool isPlaying() = 0;
virtual String getLastError() = 0;
//==============================================================================
virtual int getCurrentBufferSizeSamples() = 0;
virtual double getCurrentSampleRate() = 0;
virtual int getCurrentBitDepth() = 0;
virtual BigInteger getActiveOutputChannels() const = 0;
virtual BigInteger getActiveInputChannels() const = 0;
virtual int getOutputLatencyInSamples() = 0;
virtual int getInputLatencyInSamples() = 0;
virtual AudioWorkgroup getWorkgroup() const { return {}; }
//==============================================================================
virtual bool hasControlPanel() const;
virtual bool showControlPanel();
virtual bool setAudioPreprocessingEnabled (bool shouldBeEnabled);
//==============================================================================
virtual int getXRunCount() const noexcept;
//==============================================================================
protected:
AudioIODevice (const String& deviceName,
const String& typeName);
String name, typeName;
};
} // namespace juce
juce::Array
Definition juce_Array.h:56
juce::AudioIODeviceCallback
Definition juce_AudioIODevice.h:55
juce::AudioIODeviceCallback::audioDeviceIOCallbackWithContext
virtual void audioDeviceIOCallbackWithContext(const float *const *inputChannelData, int numInputChannels, float *const *outputChannelData, int numOutputChannels, int numSamples, const AudioIODeviceCallbackContext &context)
Definition juce_AudioIODevice.cpp:26
juce::AudioIODeviceCallback::~AudioIODeviceCallback
virtual ~AudioIODeviceCallback()=default
juce::AudioIODeviceCallback::audioDeviceAboutToStart
virtual void audioDeviceAboutToStart(AudioIODevice *device)=0
juce::AudioIODeviceCallback::audioDeviceError
virtual void audioDeviceError(const String &errorMessage)
Definition juce_AudioIODevice.cpp:41
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::name
String name
Definition juce_AudioIODevice.h:353
juce::AudioIODevice::getActiveInputChannels
virtual BigInteger getActiveInputChannels() const =0
juce::AudioIODevice::stop
virtual void stop()=0
juce::AudioIODevice::AudioIODevice
AudioIODevice(const String &deviceName, const String &typeName)
Definition juce_AudioIODevice.cpp:34
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