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

Classes

struct  ASIOCallbackFunctions
struct  ASIOCallbackFunctions< maxNumASIODevices >

Public Member Functions

 ASIOAudioIODevice (ASIOAudioIODeviceType *ownerType, const String &devName, CLSID clsID, int slotNumber)
 ~ASIOAudioIODevice ()
void updateSampleRates ()
StringArray getOutputChannelNames () override
StringArray getInputChannelNames () override
Array< double > getAvailableSampleRates () override
Array< intgetAvailableBufferSizes () override
int getDefaultBufferSize () override
int getXRunCount () const noexcept override
String open (const BigInteger &inputChannels, const BigInteger &outputChannels, double sr, int bufferSizeSamples) override
void close () override
bool isOpen () override
bool isPlaying () override
int getCurrentBufferSizeSamples () override
double getCurrentSampleRate () override
int getCurrentBitDepth () override
BigInteger getActiveOutputChannels () const override
BigInteger getActiveInputChannels () const override
int getOutputLatencyInSamples () override
int getInputLatencyInSamples () override
void start (AudioIODeviceCallback *callback) override
void stop () override
String getLastError () override
bool hasControlPanel () const override
bool showControlPanel () override
void resetRequest () noexcept
void timerCallback () override
Public Member Functions inherited from juce::AudioIODevice
virtual ~AudioIODevice ()
const StringgetName () const noexcept
const StringgetTypeName () const noexcept
virtual bool setAudioPreprocessingEnabled (bool shouldBeEnabled)

Private Member Functions

String getChannelName (int index, bool isInput) const
void reloadChannelNames ()
long refreshBufferSizes ()
int readBufferSizes (int bufferSizeSamples)
int resetBuffers (const BigInteger &inputChannels, const BigInteger &outputChannels)
void addBufferSizes (long minSize, long maxSize, long preferredSize, long granularity)
double getSampleRate () const
void setSampleRate (double newRate)
void updateClockSources ()
void readLatencies ()
void createDummyBuffers (long preferredSize)
bool removeCurrentDriver ()
bool loadDriver ()
bool tryCreatingDriver (bool &crashed)
String getLastDriverError () const
String initDriver ()
String openDevice ()
void disposeBuffers ()
void JUCE_ASIOCALLBACK callback (long index)
void processBuffer (long bufferIndex)
long asioMessagesCallback (long selector, long value)
void setCallbackFunctions () noexcept
Private Member Functions inherited from juce::Timer
virtual ~Timer ()
void startTimer (int intervalInMilliseconds) noexcept
void startTimerHz (int timerFrequencyHz) noexcept
void stopTimer () noexcept
bool isTimerRunning () const noexcept
int getTimerInterval () const noexcept
 Timer () noexcept
 Timer (const Timer &) noexcept

Static Private Member Functions

static String convertASIOString (char *text, int length)
Static Private Member Functions inherited from juce::Timer
static void JUCE_CALLTYPE callAfterDelay (int milliseconds, std::function< void()> functionToCall)
static void JUCE_CALLTYPE callPendingTimersSynchronously ()

Private Attributes

WeakReference< ASIOAudioIODeviceTypeowner
IASIOasioObject = {}
ASIOCallbacks callbacks
CLSID classId
String error
long totalNumInputChans = 0
long totalNumOutputChans = 0
StringArray inputChannelNames
StringArray outputChannelNames
Array< double > sampleRates
Array< intbufferSizes
long inputLatency = 0
long outputLatency = 0
long minBufferSize = 0
long maxBufferSize = 0
long preferredBufferSize = 0
long bufferGranularity = 0
ASIOClockSource clocks [32] = {}
int numClockSources = 0
int currentBlockSizeSamples = 0
int currentBitDepth = 16
double currentSampleRate = 0
BigInteger currentChansOut
BigInteger currentChansIn
AudioIODeviceCallbackcurrentCallback = {}
CriticalSection callbackLock
HeapBlock< ASIOBufferInfobufferInfos
HeapBlock< float * > inBuffers
HeapBlock< float * > outBuffers
HeapBlock< float > ioBufferSpace
HeapBlock< ASIOSampleFormatinputFormat
HeapBlock< ASIOSampleFormatoutputFormat
int numActiveInputChans = 0
int numActiveOutputChans = 0
bool deviceIsOpen = false
bool isStarted = false
bool buffersCreated = false
std::atomic< bool > calledback { false }
bool postOutput = true
bool needToReset = false
bool insideControlPanelModalLoop = false
bool shouldUsePreferredSize = false
int xruns = 0

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

◆ ASIOAudioIODevice()

juce::ASIOAudioIODevice::ASIOAudioIODevice ( ASIOAudioIODeviceType * ownerType,
const String & devName,
CLSID clsID,
int slotNumber )
inline

◆ ~ASIOAudioIODevice()

juce::ASIOAudioIODevice::~ASIOAudioIODevice ( )
inline

Member Function Documentation

◆ addBufferSizes()

void juce::ASIOAudioIODevice::addBufferSizes ( long minSize,
long maxSize,
long preferredSize,
long granularity )
inlineprivate

◆ asioMessagesCallback()

long juce::ASIOAudioIODevice::asioMessagesCallback ( long selector,
long value )
inlineprivate

◆ callback()

void JUCE_ASIOCALLBACK juce::ASIOAudioIODevice::callback ( long index)
inlineprivate

◆ close()

void juce::ASIOAudioIODevice::close ( )
inlineoverridevirtual

Closes and releases the device if it's open.

Implements juce::AudioIODevice.

◆ convertASIOString()

String juce::ASIOAudioIODevice::convertASIOString ( char * text,
int length )
inlinestaticprivate

◆ createDummyBuffers()

void juce::ASIOAudioIODevice::createDummyBuffers ( long preferredSize)
inlineprivate

◆ disposeBuffers()

void juce::ASIOAudioIODevice::disposeBuffers ( )
inlineprivate

◆ getActiveInputChannels()

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

Returns the set of buffer sizes that are available.

See also
getCurrentBufferSizeSamples, getDefaultBufferSize

Implements juce::AudioIODevice.

◆ getAvailableSampleRates()

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

Returns the set of sample-rates this device supports.

See also
getCurrentSampleRate

Implements juce::AudioIODevice.

◆ getChannelName()

String juce::ASIOAudioIODevice::getChannelName ( int index,
bool isInput ) const
inlineprivate

◆ getCurrentBitDepth()

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

Returns the default buffer-size to use.

Returns
a number of samples
See also
getAvailableBufferSizes

Implements juce::AudioIODevice.

◆ getInputChannelNames()

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

◆ getLastDriverError()

String juce::ASIOAudioIODevice::getLastDriverError ( ) const
inlineprivate

◆ getLastError()

String juce::ASIOAudioIODevice::getLastError ( )
inlineoverridevirtual

Returns the last error that happened if anything went wrong.

Implements juce::AudioIODevice.

◆ getOutputChannelNames()

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

◆ getSampleRate()

double juce::ASIOAudioIODevice::getSampleRate ( ) const
inlineprivate

◆ getXRunCount()

int juce::ASIOAudioIODevice::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.

◆ hasControlPanel()

bool juce::ASIOAudioIODevice::hasControlPanel ( ) const
inlineoverridevirtual

True if this device can show a pop-up control panel for editing its settings.

This is generally just true of ASIO devices. If true, you can call showControlPanel() to display it.

Reimplemented from juce::AudioIODevice.

◆ initDriver()

String juce::ASIOAudioIODevice::initDriver ( )
inlineprivate

◆ isOpen()

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

◆ loadDriver()

bool juce::ASIOAudioIODevice::loadDriver ( )
inlineprivate

◆ open()

String juce::ASIOAudioIODevice::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.

◆ openDevice()

String juce::ASIOAudioIODevice::openDevice ( )
inlineprivate

◆ processBuffer()

void juce::ASIOAudioIODevice::processBuffer ( long bufferIndex)
inlineprivate

◆ readBufferSizes()

int juce::ASIOAudioIODevice::readBufferSizes ( int bufferSizeSamples)
inlineprivate

◆ readLatencies()

void juce::ASIOAudioIODevice::readLatencies ( )
inlineprivate

◆ refreshBufferSizes()

long juce::ASIOAudioIODevice::refreshBufferSizes ( )
inlineprivate

◆ reloadChannelNames()

void juce::ASIOAudioIODevice::reloadChannelNames ( )
inlineprivate

◆ removeCurrentDriver()

bool juce::ASIOAudioIODevice::removeCurrentDriver ( )
inlineprivate

◆ resetBuffers()

int juce::ASIOAudioIODevice::resetBuffers ( const BigInteger & inputChannels,
const BigInteger & outputChannels )
inlineprivate

◆ resetRequest()

void juce::ASIOAudioIODevice::resetRequest ( )
inlinenoexcept

◆ setCallbackFunctions()

void juce::ASIOAudioIODevice::setCallbackFunctions ( )
inlineprivatenoexcept

◆ setSampleRate()

void juce::ASIOAudioIODevice::setSampleRate ( double newRate)
inlineprivate

◆ showControlPanel()

bool juce::ASIOAudioIODevice::showControlPanel ( )
inlineoverridevirtual

Shows a device-specific control panel if there is one.

This should only be called for devices which return true from hasControlPanel().

Reimplemented from juce::AudioIODevice.

◆ start()

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

◆ timerCallback()

void juce::ASIOAudioIODevice::timerCallback ( )
inlineoverridevirtual

The user-defined callback routine that actually gets called periodically.

It's perfectly ok to call startTimer() or stopTimer() from within this callback to change the subsequent intervals.

Implements juce::Timer.

◆ tryCreatingDriver()

bool juce::ASIOAudioIODevice::tryCreatingDriver ( bool & crashed)
inlineprivate

◆ updateClockSources()

void juce::ASIOAudioIODevice::updateClockSources ( )
inlineprivate

◆ updateSampleRates()

void juce::ASIOAudioIODevice::updateSampleRates ( )
inline

Member Data Documentation

◆ asioObject

IASIO* juce::ASIOAudioIODevice::asioObject = {}
private

◆ bufferGranularity

long juce::ASIOAudioIODevice::bufferGranularity = 0
private

◆ bufferInfos

HeapBlock<ASIOBufferInfo> juce::ASIOAudioIODevice::bufferInfos
private

◆ buffersCreated

bool juce::ASIOAudioIODevice::buffersCreated = false
private

◆ bufferSizes

Array<int> juce::ASIOAudioIODevice::bufferSizes
private

◆ callbackLock

CriticalSection juce::ASIOAudioIODevice::callbackLock
private

◆ callbacks

ASIOCallbacks juce::ASIOAudioIODevice::callbacks
private

◆ calledback

std::atomic<bool> juce::ASIOAudioIODevice::calledback { false }
private

◆ classId

CLSID juce::ASIOAudioIODevice::classId
private

◆ clocks

ASIOClockSource juce::ASIOAudioIODevice::clocks[32] = {}
private

◆ currentBitDepth

int juce::ASIOAudioIODevice::currentBitDepth = 16
private

◆ currentBlockSizeSamples

int juce::ASIOAudioIODevice::currentBlockSizeSamples = 0
private

◆ currentCallback

AudioIODeviceCallback* juce::ASIOAudioIODevice::currentCallback = {}
private

◆ currentChansIn

BigInteger juce::ASIOAudioIODevice::currentChansIn
private

◆ currentChansOut

BigInteger juce::ASIOAudioIODevice::currentChansOut
private

◆ currentSampleRate

double juce::ASIOAudioIODevice::currentSampleRate = 0
private

◆ deviceIsOpen

bool juce::ASIOAudioIODevice::deviceIsOpen = false
private

◆ error

String juce::ASIOAudioIODevice::error
private

◆ inBuffers

HeapBlock<float*> juce::ASIOAudioIODevice::inBuffers
private

◆ inputChannelNames

StringArray juce::ASIOAudioIODevice::inputChannelNames
private

◆ inputFormat

HeapBlock<ASIOSampleFormat> juce::ASIOAudioIODevice::inputFormat
private

◆ inputLatency

long juce::ASIOAudioIODevice::inputLatency = 0
private

◆ insideControlPanelModalLoop

bool juce::ASIOAudioIODevice::insideControlPanelModalLoop = false
private

◆ ioBufferSpace

HeapBlock<float> juce::ASIOAudioIODevice::ioBufferSpace
private

◆ isStarted

bool juce::ASIOAudioIODevice::isStarted = false
private

◆ maxBufferSize

long juce::ASIOAudioIODevice::maxBufferSize = 0
private

◆ minBufferSize

long juce::ASIOAudioIODevice::minBufferSize = 0
private

◆ needToReset

bool juce::ASIOAudioIODevice::needToReset = false
private

◆ numActiveInputChans

int juce::ASIOAudioIODevice::numActiveInputChans = 0
private

◆ numActiveOutputChans

int juce::ASIOAudioIODevice::numActiveOutputChans = 0
private

◆ numClockSources

int juce::ASIOAudioIODevice::numClockSources = 0
private

◆ outBuffers

HeapBlock<float*> juce::ASIOAudioIODevice::outBuffers
private

◆ outputChannelNames

StringArray juce::ASIOAudioIODevice::outputChannelNames
private

◆ outputFormat

HeapBlock<ASIOSampleFormat> juce::ASIOAudioIODevice::outputFormat
private

◆ outputLatency

long juce::ASIOAudioIODevice::outputLatency = 0
private

◆ owner

WeakReference<ASIOAudioIODeviceType> juce::ASIOAudioIODevice::owner
private

◆ postOutput

bool juce::ASIOAudioIODevice::postOutput = true
private

◆ preferredBufferSize

long juce::ASIOAudioIODevice::preferredBufferSize = 0
private

◆ sampleRates

Array<double> juce::ASIOAudioIODevice::sampleRates
private

◆ shouldUsePreferredSize

bool juce::ASIOAudioIODevice::shouldUsePreferredSize = false
private

◆ totalNumInputChans

long juce::ASIOAudioIODevice::totalNumInputChans = 0
private

◆ totalNumOutputChans

long juce::ASIOAudioIODevice::totalNumOutputChans = 0
private

◆ xruns

int juce::ASIOAudioIODevice::xruns = 0
private

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