LMMS
Loading...
Searching...
No Matches
juce::BelaAudioIODevice Class Reference
Inheritance diagram for juce::BelaAudioIODevice:
juce::AudioIODevice

Public Member Functions

 BelaAudioIODevice ()
 ~BelaAudioIODevice ()
StringArray getOutputChannelNames () override
StringArray getInputChannelNames () override
Array< double > getAvailableSampleRates () override
Array< intgetAvailableBufferSizes () override
int getDefaultBufferSize () override
String open (const BigInteger &inputChannels, const BigInteger &outputChannels, double sampleRate, int bufferSizeSamples) override
void close () override
bool isOpen () override
void start (AudioIODeviceCallback *newCallback) override
void stop () override
bool isPlaying () override
String getLastError () override
int getCurrentBufferSizeSamples () override
double getCurrentSampleRate () override
int getCurrentBitDepth () override
BigInteger getActiveOutputChannels () const override
BigInteger getActiveInputChannels () const override
int getOutputLatencyInSamples () override
int getInputLatencyInSamples () override
int getXRunCount () const noexcept override
Public Member Functions inherited from juce::AudioIODevice
virtual ~AudioIODevice ()
const StringgetName () const noexcept
const StringgetTypeName () const noexcept
virtual bool hasControlPanel () const
virtual bool showControlPanel ()
virtual bool setAudioPreprocessingEnabled (bool shouldBeEnabled)

Static Public Attributes

static const char *const belaTypeName = "Bela Analog"

Private Member Functions

bool setup (BelaContext &context)
void render (BelaContext &context)
void cleanup (BelaContext &)
void calculateXruns (uint64_t audioFramesElapsed, uint32_t numSamples)

Static Private Member Functions

static int getNumContiguousSetBits (const BigInteger &value) noexcept
static bool setupCallback (BelaContext *context, void *userData) noexcept
static void renderCallback (BelaContext *context, void *userData) noexcept
static void cleanupCallback (BelaContext *context, void *userData) noexcept

Private Attributes

const int analogChannelStart = 2
uint64_t expectedElapsedAudioSamples = 0
int underruns = 0
bool firstCallback = false
BelaInitSettings defaultSettings
BelaInitSettings settings
bool isBelaOpen = false
bool isRunning = false
CriticalSection callbackLock
AudioIODeviceCallbackcallback = nullptr
String lastError
uint32_t actualBufferSize = 0
int actualNumberOfInputs = 0
int actualNumberOfOutputs = 0
HeapBlock< const float * > channelInBuffer
HeapBlock< float * > channelOutBuffer
bool includeAnalogSupport

Additional Inherited Members

Protected Member Functions inherited from juce::AudioIODevice
 AudioIODevice (const String &deviceName, const String &typeName)
Protected Attributes inherited from juce::AudioIODevice
String name
String typeName

Constructor & Destructor Documentation

◆ BelaAudioIODevice()

juce::BelaAudioIODevice::BelaAudioIODevice ( )
inline

◆ ~BelaAudioIODevice()

juce::BelaAudioIODevice::~BelaAudioIODevice ( )
inline

Member Function Documentation

◆ calculateXruns()

void juce::BelaAudioIODevice::calculateXruns ( uint64_t audioFramesElapsed,
uint32_t numSamples )
inlineprivate

◆ cleanup()

void juce::BelaAudioIODevice::cleanup ( BelaContext & )
inlineprivate

◆ cleanupCallback()

void juce::BelaAudioIODevice::cleanupCallback ( BelaContext * context,
void * userData )
inlinestaticprivatenoexcept

◆ close()

void juce::BelaAudioIODevice::close ( )
inlineoverridevirtual

Closes and releases the device if it's open.

Implements juce::AudioIODevice.

◆ getActiveInputChannels()

BigInteger juce::BelaAudioIODevice::getActiveInputChannels ( ) const
inlineoverridevirtual

Returns a mask showing which of the available input channels are currently enabled.

See also
getInputChannelNames

Implements juce::AudioIODevice.

◆ getActiveOutputChannels()

BigInteger juce::BelaAudioIODevice::getActiveOutputChannels ( ) const
inlineoverridevirtual

Returns a mask showing which of the available output channels are currently enabled.

See also
getOutputChannelNames

Implements juce::AudioIODevice.

◆ getAvailableBufferSizes()

Array< int > juce::BelaAudioIODevice::getAvailableBufferSizes ( )
inlineoverridevirtual

Returns the set of buffer sizes that are available.

See also
getCurrentBufferSizeSamples, getDefaultBufferSize

Implements juce::AudioIODevice.

◆ getAvailableSampleRates()

Array< double > juce::BelaAudioIODevice::getAvailableSampleRates ( )
inlineoverridevirtual

Returns the set of sample-rates this device supports.

See also
getCurrentSampleRate

Implements juce::AudioIODevice.

◆ getCurrentBitDepth()

int juce::BelaAudioIODevice::getCurrentBitDepth ( )
inlineoverridevirtual

Returns the device's current physical bit-depth.

If the device isn't actually open, this value doesn't really mean much.

Implements juce::AudioIODevice.

◆ getCurrentBufferSizeSamples()

int juce::BelaAudioIODevice::getCurrentBufferSizeSamples ( )
inlineoverridevirtual

Returns the buffer size that the device is currently using.

If the device isn't actually open, this value doesn't really mean much.

Implements juce::AudioIODevice.

◆ getCurrentSampleRate()

double juce::BelaAudioIODevice::getCurrentSampleRate ( )
inlineoverridevirtual

Returns the sample rate that the device is currently using.

If the device isn't actually open, this value doesn't really mean much.

Implements juce::AudioIODevice.

◆ getDefaultBufferSize()

int juce::BelaAudioIODevice::getDefaultBufferSize ( )
inlineoverridevirtual

Returns the default buffer-size to use.

Returns
a number of samples
See also
getAvailableBufferSizes

Implements juce::AudioIODevice.

◆ getInputChannelNames()

StringArray juce::BelaAudioIODevice::getInputChannelNames ( )
inlineoverridevirtual

Returns the names of all the available input channels on this device. To find out which of these are currently in use, call getActiveInputChannels().

Implements juce::AudioIODevice.

◆ getInputLatencyInSamples()

int juce::BelaAudioIODevice::getInputLatencyInSamples ( )
inlineoverridevirtual

Returns the device's input latency.

This is the delay in samples between some audio actually arriving at the soundcard, and the callback getting passed this block of data.

Implements juce::AudioIODevice.

◆ getLastError()

String juce::BelaAudioIODevice::getLastError ( )
inlineoverridevirtual

Returns the last error that happened if anything went wrong.

Implements juce::AudioIODevice.

◆ getNumContiguousSetBits()

int juce::BelaAudioIODevice::getNumContiguousSetBits ( const BigInteger & value)
inlinestaticprivatenoexcept

◆ getOutputChannelNames()

StringArray juce::BelaAudioIODevice::getOutputChannelNames ( )
inlineoverridevirtual

Returns the names of all the available output channels on this device. To find out which of these are currently in use, call getActiveOutputChannels().

Implements juce::AudioIODevice.

◆ getOutputLatencyInSamples()

int juce::BelaAudioIODevice::getOutputLatencyInSamples ( )
inlineoverridevirtual

Returns the device's output latency.

This is the delay in samples between a callback getting a block of data, and that data actually getting played.

Implements juce::AudioIODevice.

◆ getXRunCount()

int juce::BelaAudioIODevice::getXRunCount ( ) const
inlineoverridevirtualnoexcept

Returns the number of under- or over runs reported by the OS since playback/recording has started.

This number may be different than determining the Xrun count manually (by measuring the time spent in the audio callback) as the OS may be doing some buffering internally - especially on mobile devices.

Returns -1 if playback/recording has not started yet or if getting the underrun count is not supported for this device (Android SDK 23 and lower).

Reimplemented from juce::AudioIODevice.

◆ isOpen()

bool juce::BelaAudioIODevice::isOpen ( )
inlineoverridevirtual

Returns true if the device is still open.

A device might spontaneously close itself if something goes wrong, so this checks if it's still open.

Implements juce::AudioIODevice.

◆ isPlaying()

bool juce::BelaAudioIODevice::isPlaying ( )
inlineoverridevirtual

Returns true if the device is still calling back.

The device might mysteriously stop, so this checks whether it's still playing.

Implements juce::AudioIODevice.

◆ open()

String juce::BelaAudioIODevice::open ( const BigInteger & inputChannels,
const BigInteger & outputChannels,
double sampleRate,
int bufferSizeSamples )
inlineoverridevirtual

Tries to open the device ready to play.

Parameters
inputChannelsa BigInteger in which a set bit indicates that the corresponding input channel should be enabled
outputChannelsa BigInteger in which a set bit indicates that the corresponding output channel should be enabled
sampleRatethe sample rate to try to use - to find out which rates are available, see getAvailableSampleRates()
bufferSizeSamplesthe size of i/o buffer to use - to find out the available buffer sizes, see getAvailableBufferSizes()
Returns
an error description if there's a problem, or an empty string if it succeeds in opening the device
See also
close

Implements juce::AudioIODevice.

◆ render()

void juce::BelaAudioIODevice::render ( BelaContext & context)
inlineprivate

◆ renderCallback()

void juce::BelaAudioIODevice::renderCallback ( BelaContext * context,
void * userData )
inlinestaticprivatenoexcept

◆ setup()

bool juce::BelaAudioIODevice::setup ( BelaContext & context)
inlineprivate

◆ setupCallback()

bool juce::BelaAudioIODevice::setupCallback ( BelaContext * context,
void * userData )
inlinestaticprivatenoexcept

◆ start()

void juce::BelaAudioIODevice::start ( AudioIODeviceCallback * callback)
inlineoverridevirtual

Starts the device actually playing.

This must be called after the device has been opened.

Parameters
callbackthe callback to use for streaming the data.
See also
AudioIODeviceCallback, open

Implements juce::AudioIODevice.

◆ stop()

void juce::BelaAudioIODevice::stop ( )
inlineoverridevirtual

Stops the device playing.

Once a device has been started, this will stop it. Any pending calls to the callback class will be flushed before this method returns.

Implements juce::AudioIODevice.

Member Data Documentation

◆ actualBufferSize

uint32_t juce::BelaAudioIODevice::actualBufferSize = 0
private

◆ actualNumberOfInputs

int juce::BelaAudioIODevice::actualNumberOfInputs = 0
private

◆ actualNumberOfOutputs

int juce::BelaAudioIODevice::actualNumberOfOutputs = 0
private

◆ analogChannelStart

const int juce::BelaAudioIODevice::analogChannelStart = 2
private

◆ belaTypeName

const char *const juce::BelaAudioIODevice::belaTypeName = "Bela Analog"
static

◆ callback

AudioIODeviceCallback* juce::BelaAudioIODevice::callback = nullptr
private

◆ callbackLock

CriticalSection juce::BelaAudioIODevice::callbackLock
private

◆ channelInBuffer

HeapBlock<const float*> juce::BelaAudioIODevice::channelInBuffer
private

◆ channelOutBuffer

HeapBlock<float*> juce::BelaAudioIODevice::channelOutBuffer
private

◆ defaultSettings

BelaInitSettings juce::BelaAudioIODevice::defaultSettings
private

◆ expectedElapsedAudioSamples

uint64_t juce::BelaAudioIODevice::expectedElapsedAudioSamples = 0
private

◆ firstCallback

bool juce::BelaAudioIODevice::firstCallback = false
private

◆ includeAnalogSupport

bool juce::BelaAudioIODevice::includeAnalogSupport
private

◆ isBelaOpen

bool juce::BelaAudioIODevice::isBelaOpen = false
private

◆ isRunning

bool juce::BelaAudioIODevice::isRunning = false
private

◆ lastError

String juce::BelaAudioIODevice::lastError
private

◆ settings

BelaInitSettings juce::BelaAudioIODevice::settings
private

◆ underruns

int juce::BelaAudioIODevice::underruns = 0
private

The documentation for this class was generated from the following file: