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

Public Member Functions

 DSoundAudioIODevice (const String &deviceName, const int outputDeviceIndex_, const int inputDeviceIndex_)
 ~DSoundAudioIODevice () override
String open (const BigInteger &inputChannels, const BigInteger &outputChannels, double newSampleRate, int newBufferSize) override
void close () override
bool isOpen () override
int getCurrentBufferSizeSamples () override
double getCurrentSampleRate () override
BigInteger getActiveOutputChannels () const override
BigInteger getActiveInputChannels () const override
int getOutputLatencyInSamples () override
int getInputLatencyInSamples () override
StringArray getOutputChannelNames () override
StringArray getInputChannelNames () override
Array< double > getAvailableSampleRates () override
Array< intgetAvailableBufferSizes () override
int getDefaultBufferSize () override
int getCurrentBitDepth () override
void start (AudioIODeviceCallback *call) override
void stop () override
bool isPlaying () override
String getLastError () override
int getXRunCount () const noexcept override
void run () 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 Member Functions inherited from juce::Thread
 Thread (const String &threadName, size_t threadStackSize=0)
virtual ~Thread ()
void startThread ()
void startThread (int priority)
bool stopThread (int timeOutMilliseconds)
bool isThreadRunning () const
void signalThreadShouldExit ()
bool threadShouldExit () const
bool waitForThreadToExit (int timeOutMilliseconds) const
void addListener (Listener *)
void removeListener (Listener *)
bool setPriority (int priority)
void setAffinityMask (uint32 affinityMask)
bool wait (int timeOutMilliseconds) const
void notify () const
ThreadID getThreadId () const noexcept
const StringgetThreadName () const noexcept

Public Attributes

StringArray inChannels
StringArray outChannels
int outputDeviceIndex
int inputDeviceIndex

Private Member Functions

String openDevice (const BigInteger &inputChannels, const BigInteger &outputChannels, double sampleRate_, int bufferSizeSamples_)
void closeDevice ()
void resync ()

Private Attributes

bool isOpen_ = false
bool isStarted = false
String lastError
OwnedArray< DSoundInternalInChannelinChans
OwnedArray< DSoundInternalOutChanneloutChans
WaitableEvent startEvent
int bufferSizeSamples = 0
double sampleRate = 0
BigInteger enabledInputs
BigInteger enabledOutputs
AudioBuffer< float > inputBuffers
AudioBuffer< float > outputBuffers
AudioIODeviceCallbackcallback = nullptr
CriticalSection startStopLock

Additional Inherited Members

Public Types inherited from juce::Thread
enum  { realtimeAudioPriority = -1 }
using ThreadID = void*
Static Public Member Functions inherited from juce::Thread
static void launch (std::function< void()> functionToRun)
static bool currentThreadShouldExit ()
static bool setCurrentThreadPriority (int priority)
static void JUCE_CALLTYPE setCurrentThreadAffinityMask (uint32 affinityMask)
static void JUCE_CALLTYPE sleep (int milliseconds)
static void JUCE_CALLTYPE yield ()
static ThreadID JUCE_CALLTYPE getCurrentThreadId ()
static Thread *JUCE_CALLTYPE getCurrentThread ()
static void JUCE_CALLTYPE setCurrentThreadName (const String &newThreadName)
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

◆ DSoundAudioIODevice()

juce::DSoundAudioIODevice::DSoundAudioIODevice ( const String & deviceName,
const int outputDeviceIndex_,
const int inputDeviceIndex_ )
inline

◆ ~DSoundAudioIODevice()

juce::DSoundAudioIODevice::~DSoundAudioIODevice ( )
inlineoverride

Member Function Documentation

◆ close()

void juce::DSoundAudioIODevice::close ( )
inlineoverridevirtual

Closes and releases the device if it's open.

Implements juce::AudioIODevice.

◆ closeDevice()

void juce::DSoundAudioIODevice::closeDevice ( )
inlineprivate

◆ getActiveInputChannels()

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

Returns the set of buffer sizes that are available.

See also
getCurrentBufferSizeSamples, getDefaultBufferSize

Implements juce::AudioIODevice.

◆ getAvailableSampleRates()

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

Returns the set of sample-rates this device supports.

See also
getCurrentSampleRate

Implements juce::AudioIODevice.

◆ getCurrentBitDepth()

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

Returns the default buffer-size to use.

Returns
a number of samples
See also
getAvailableBufferSizes

Implements juce::AudioIODevice.

◆ getInputChannelNames()

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

Returns the last error that happened if anything went wrong.

Implements juce::AudioIODevice.

◆ getOutputChannelNames()

StringArray juce::DSoundAudioIODevice::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::DSoundAudioIODevice::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::DSoundAudioIODevice::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::DSoundAudioIODevice::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::DSoundAudioIODevice::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::DSoundAudioIODevice::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::DSoundAudioIODevice::openDevice ( const BigInteger & inputChannels,
const BigInteger & outputChannels,
double sampleRate_,
int bufferSizeSamples_ )
private

◆ resync()

void juce::DSoundAudioIODevice::resync ( )
inlineprivate

◆ run()

void juce::DSoundAudioIODevice::run ( )
inlineoverridevirtual

Must be implemented to perform the thread's actual code.

Remember that the thread must regularly check the threadShouldExit() method whilst running, and if this returns true it should return from the run() method as soon as possible to avoid being forcibly killed.

See also
threadShouldExit, startThread

Implements juce::Thread.

◆ start()

void juce::DSoundAudioIODevice::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::DSoundAudioIODevice::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

◆ bufferSizeSamples

int juce::DSoundAudioIODevice::bufferSizeSamples = 0
private

◆ callback

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

◆ enabledInputs

BigInteger juce::DSoundAudioIODevice::enabledInputs
private

◆ enabledOutputs

BigInteger juce::DSoundAudioIODevice::enabledOutputs
private

◆ inChannels

StringArray juce::DSoundAudioIODevice::inChannels

◆ inChans

OwnedArray<DSoundInternalInChannel> juce::DSoundAudioIODevice::inChans
private

◆ inputBuffers

AudioBuffer<float> juce::DSoundAudioIODevice::inputBuffers
private

◆ inputDeviceIndex

int juce::DSoundAudioIODevice::inputDeviceIndex

◆ isOpen_

bool juce::DSoundAudioIODevice::isOpen_ = false
private

◆ isStarted

bool juce::DSoundAudioIODevice::isStarted = false
private

◆ lastError

String juce::DSoundAudioIODevice::lastError
private

◆ outChannels

StringArray juce::DSoundAudioIODevice::outChannels

◆ outChans

OwnedArray<DSoundInternalOutChannel> juce::DSoundAudioIODevice::outChans
private

◆ outputBuffers

AudioBuffer<float> juce::DSoundAudioIODevice::outputBuffers
private

◆ outputDeviceIndex

int juce::DSoundAudioIODevice::outputDeviceIndex

◆ sampleRate

double juce::DSoundAudioIODevice::sampleRate = 0
private

◆ startEvent

WaitableEvent juce::DSoundAudioIODevice::startEvent
private

◆ startStopLock

CriticalSection juce::DSoundAudioIODevice::startStopLock
private

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