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

Classes

class  MainThreadDispatcher

Public Member Functions

 JackAudioIODevice (const String &inName, const String &outName, std::function< void()> notifyIn)
 ~JackAudioIODevice () override
StringArray getChannelNames (const String &clientName, bool forInput) const
StringArray getOutputChannelNames () override
StringArray getInputChannelNames () override
Array< double > getAvailableSampleRates () override
Array< intgetAvailableBufferSizes () override
int getDefaultBufferSize () override
int getCurrentBufferSizeSamples () override
double getCurrentSampleRate () override
template<typename Fn>
void forEachClientChannel (const String &clientName, bool isInput, Fn &&fn)
String open (const BigInteger &inputChannels, const BigInteger &outputChannels, double, int) override
void close () override
void start (AudioIODeviceCallback *newCallback) override
void stop () override
bool isOpen () override
bool isPlaying () override
int getCurrentBitDepth () override
String getLastError () override
int getXRunCount () const noexcept override
BigInteger getActiveOutputChannels () const override
BigInteger getActiveInputChannels () const override
int getOutputLatencyInSamples () override
int getInputLatencyInSamples () 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)

Public Attributes

String inputName
String outputName

Private Member Functions

void process (const int numSamples)
void updateActivePorts ()

Static Private Member Functions

static int processCallback (jack_nframes_t nframes, void *callbackArgument)
static int xrunCallback (void *callbackArgument)
static void portConnectCallback (jack_port_id_t, jack_port_id_t, int, void *arg)
static void threadInitCallback (void *)
static void shutdownCallback (void *callbackArgument)
static void infoShutdownCallback (jack_status_t code, const char *reason, void *arg)
static void errorCallback (const char *msg)

Private Attributes

bool deviceIsOpen = false
jack_client_tclient = nullptr
String lastError
AudioIODeviceCallbackcallback = nullptr
CriticalSection callbackLock
HeapBlock< float * > inChans
HeapBlock< float * > outChans
int totalNumberOfInputChannels = 0
int totalNumberOfOutputChannels = 0
Array< jack_port_t * > inputPorts
Array< jack_port_t * > outputPorts
BigInteger activeInputChannels
BigInteger activeOutputChannels
std::atomic< intxruns { 0 }
std::function< void()> notifyChannelsChanged
MainThreadDispatcher mainThreadDispatcher { *this }

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

◆ JackAudioIODevice()

juce::JackAudioIODevice::JackAudioIODevice ( const String & inName,
const String & outName,
std::function< void()> notifyIn )
inline

◆ ~JackAudioIODevice()

juce::JackAudioIODevice::~JackAudioIODevice ( )
inlineoverride

Member Function Documentation

◆ close()

void juce::JackAudioIODevice::close ( )
inlineoverridevirtual

Closes and releases the device if it's open.

Implements juce::AudioIODevice.

◆ errorCallback()

void juce::JackAudioIODevice::errorCallback ( const char * msg)
inlinestaticprivate

◆ forEachClientChannel()

template<typename Fn>
void juce::JackAudioIODevice::forEachClientChannel ( const String & clientName,
bool isInput,
Fn && fn )
inline

◆ getActiveInputChannels()

BigInteger juce::JackAudioIODevice::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::JackAudioIODevice::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::JackAudioIODevice::getAvailableBufferSizes ( )
inlineoverridevirtual

Returns the set of buffer sizes that are available.

See also
getCurrentBufferSizeSamples, getDefaultBufferSize

Implements juce::AudioIODevice.

◆ getAvailableSampleRates()

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

Returns the set of sample-rates this device supports.

See also
getCurrentSampleRate

Implements juce::AudioIODevice.

◆ getChannelNames()

StringArray juce::JackAudioIODevice::getChannelNames ( const String & clientName,
bool forInput ) const
inline

◆ getCurrentBitDepth()

int juce::JackAudioIODevice::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::JackAudioIODevice::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::JackAudioIODevice::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::JackAudioIODevice::getDefaultBufferSize ( )
inlineoverridevirtual

Returns the default buffer-size to use.

Returns
a number of samples
See also
getAvailableBufferSizes

Implements juce::AudioIODevice.

◆ getInputChannelNames()

StringArray juce::JackAudioIODevice::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::JackAudioIODevice::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::JackAudioIODevice::getLastError ( )
inlineoverridevirtual

Returns the last error that happened if anything went wrong.

Implements juce::AudioIODevice.

◆ getOutputChannelNames()

StringArray juce::JackAudioIODevice::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::JackAudioIODevice::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::JackAudioIODevice::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.

◆ infoShutdownCallback()

void juce::JackAudioIODevice::infoShutdownCallback ( jack_status_t code,
const char * reason,
void * arg )
inlinestaticprivate

◆ isOpen()

bool juce::JackAudioIODevice::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::JackAudioIODevice::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::JackAudioIODevice::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.

◆ portConnectCallback()

void juce::JackAudioIODevice::portConnectCallback ( jack_port_id_t ,
jack_port_id_t ,
int ,
void * arg )
inlinestaticprivate

◆ process()

void juce::JackAudioIODevice::process ( const int numSamples)
inlineprivate

◆ processCallback()

int juce::JackAudioIODevice::processCallback ( jack_nframes_t nframes,
void * callbackArgument )
inlinestaticprivate

◆ shutdownCallback()

void juce::JackAudioIODevice::shutdownCallback ( void * callbackArgument)
inlinestaticprivate

◆ start()

void juce::JackAudioIODevice::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::JackAudioIODevice::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.

◆ threadInitCallback()

void juce::JackAudioIODevice::threadInitCallback ( void * )
inlinestaticprivate

◆ updateActivePorts()

void juce::JackAudioIODevice::updateActivePorts ( )
inlineprivate

◆ xrunCallback()

int juce::JackAudioIODevice::xrunCallback ( void * callbackArgument)
inlinestaticprivate

Member Data Documentation

◆ activeInputChannels

BigInteger juce::JackAudioIODevice::activeInputChannels
private

◆ activeOutputChannels

BigInteger juce::JackAudioIODevice::activeOutputChannels
private

◆ callback

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

◆ callbackLock

CriticalSection juce::JackAudioIODevice::callbackLock
private

◆ client

jack_client_t* juce::JackAudioIODevice::client = nullptr
private

◆ deviceIsOpen

bool juce::JackAudioIODevice::deviceIsOpen = false
private

◆ inChans

HeapBlock<float*> juce::JackAudioIODevice::inChans
private

◆ inputName

String juce::JackAudioIODevice::inputName

◆ inputPorts

Array<jack_port_t*> juce::JackAudioIODevice::inputPorts
private

◆ lastError

String juce::JackAudioIODevice::lastError
private

◆ mainThreadDispatcher

MainThreadDispatcher juce::JackAudioIODevice::mainThreadDispatcher { *this }
private

◆ notifyChannelsChanged

std::function<void()> juce::JackAudioIODevice::notifyChannelsChanged
private

◆ outChans

HeapBlock<float*> juce::JackAudioIODevice::outChans
private

◆ outputName

String juce::JackAudioIODevice::outputName

◆ outputPorts

Array<jack_port_t*> juce::JackAudioIODevice::outputPorts
private

◆ totalNumberOfInputChannels

int juce::JackAudioIODevice::totalNumberOfInputChannels = 0
private

◆ totalNumberOfOutputChannels

int juce::JackAudioIODevice::totalNumberOfOutputChannels = 0
private

◆ xruns

std::atomic<int> juce::JackAudioIODevice::xruns { 0 }
private

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