26 bool AudioDeviceManager::AudioDeviceSetup::operator== (
const AudioDeviceManager::AudioDeviceSetup& other)
const 38 bool AudioDeviceManager::AudioDeviceSetup::operator!= (
const AudioDeviceManager::AudioDeviceSetup& other)
const 40 return ! operator== (other);
52 void audioDeviceIOCallback (
const float** ins,
int numIns,
float** outs,
int numOuts,
int numSamples)
override 54 owner.audioDeviceIOCallbackInt (ins, numIns, outs, numOuts, numSamples);
59 owner.audioDeviceAboutToStartInt (device);
62 void audioDeviceStopped()
override 64 owner.audioDeviceStoppedInt();
67 void audioDeviceError (
const String& message)
override 69 owner.audioDeviceErrorInt (message);
74 owner.handleIncomingMidiMessageInt (source, message);
77 void audioDeviceListChanged()
override 79 owner.audioDeviceListChanged();
95 currentAudioDevice.reset();
96 defaultMidiOutput.reset();
100 void AudioDeviceManager::createDeviceTypesIfNeeded()
102 if (availableDeviceTypes.size() == 0)
107 for (
auto* t : types)
112 if (
auto* first = availableDeviceTypes.getFirst())
113 currentDeviceType = first->getTypeName();
119 scanDevicesIfNeeded();
120 return availableDeviceTypes;
123 void AudioDeviceManager::audioDeviceListChanged()
125 if (currentAudioDevice !=
nullptr)
127 auto isCurrentDeviceStillAvailable = [&]
129 for (
auto* dt : availableDeviceTypes)
130 if (currentAudioDevice->getTypeName() == dt->getTypeName())
131 for (
auto& dn : dt->getDeviceNames())
132 if (currentAudioDevice->getName() == dn)
138 if (! isCurrentDeviceStillAvailable())
145 initialiseDefault (preferredDeviceName, ¤tSetup);
147 initialiseFromXML (*e,
true, preferredDeviceName, ¤tSetup);
150 if (currentAudioDevice !=
nullptr)
152 currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate();
153 currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples();
154 currentSetup.inputChannels = currentAudioDevice->getActiveInputChannels();
155 currentSetup.outputChannels = currentAudioDevice->getActiveOutputChannels();
165 if (device !=
nullptr)
187 if (newDeviceType !=
nullptr)
189 jassert (lastDeviceTypeConfigs.size() == availableDeviceTypes.size());
190 availableDeviceTypes.add (newDeviceType);
193 newDeviceType->
addListener (callbackHandler.get());
200 if (deviceName.trim().equalsIgnoreCase (name.
trim()))
208 const int numOutputChannelsNeeded,
210 const bool selectDefaultDeviceOnFailure,
211 const String& preferredDefaultDeviceName,
214 scanDevicesIfNeeded();
216 numInputChansNeeded = numInputChannelsNeeded;
217 numOutputChansNeeded = numOutputChannelsNeeded;
218 preferredDeviceName = preferredDefaultDeviceName;
220 if (xml !=
nullptr && xml->
hasTagName (
"DEVICESETUP"))
221 return initialiseFromXML (*xml, selectDefaultDeviceOnFailure,
222 preferredDeviceName, preferredSetupOptions);
224 return initialiseDefault (preferredDeviceName, preferredSetupOptions);
227 String AudioDeviceManager::initialiseDefault (
const String& preferredDefaultDeviceName,
232 if (preferredSetupOptions !=
nullptr)
234 setup = *preferredSetupOptions;
236 else if (preferredDefaultDeviceName.
isNotEmpty())
238 for (
auto* type : availableDeviceTypes)
242 if (out.matchesWildcard (preferredDefaultDeviceName,
true))
251 if (in.matchesWildcard (preferredDefaultDeviceName,
true))
260 insertDefaultDeviceNames (setup);
265 bool selectDefaultDeviceOnFailure,
266 const String& preferredDefaultDeviceName,
269 lastExplicitSettings.reset (
new XmlElement (xml));
274 if (preferredSetupOptions !=
nullptr)
275 setup = *preferredSetupOptions;
290 if (findType (currentDeviceType) ==
nullptr)
294 else if (
auto* firstType = availableDeviceTypes.getFirst())
295 currentDeviceType = firstType->getTypeName();
309 midiInsFromXml.clear();
311 forEachXmlChildElementWithTagName (xml, c,
"MIDIINPUT")
312 midiInsFromXml.add (c->getStringAttribute (
"name"));
317 if (error.
isNotEmpty() && selectDefaultDeviceOnFailure)
318 error =
initialise (numInputChansNeeded, numOutputChansNeeded,
319 nullptr,
false, preferredDefaultDeviceName);
327 int numOutputChannelsNeeded)
329 lastExplicitSettings.reset();
331 return initialise (numInputChannelsNeeded, numOutputChannelsNeeded,
332 nullptr,
false, {},
nullptr);
335 void AudioDeviceManager::insertDefaultDeviceNames (
AudioDeviceSetup& setup)
const 349 return createCopyIfNotNull (lastExplicitSettings.get());
353 void AudioDeviceManager::scanDevicesIfNeeded()
355 if (listNeedsScanning)
357 listNeedsScanning =
false;
359 createDeviceTypesIfNeeded();
361 for (
auto* type : availableDeviceTypes)
368 scanDevicesIfNeeded();
370 for (
auto* type : availableDeviceTypes)
379 scanDevicesIfNeeded();
381 for (
auto* type : availableDeviceTypes)
382 if ((inputName.
isNotEmpty() && deviceListContains (type,
true, inputName))
383 || (outputName.
isNotEmpty() && deviceListContains (type,
false, outputName)))
396 setup = currentSetup;
399 void AudioDeviceManager::deleteCurrentDevice()
401 currentAudioDevice.reset();
403 currentSetup.outputDeviceName.clear();
408 for (
int i = 0; i < availableDeviceTypes.size(); ++i)
410 if (availableDeviceTypes.getUnchecked(i)->getTypeName() == type
411 && currentDeviceType != type)
413 if (currentAudioDevice !=
nullptr)
420 currentDeviceType = type;
423 insertDefaultDeviceNames (s);
435 for (
auto* type : availableDeviceTypes)
439 return availableDeviceTypes.getFirst();
443 bool treatAsChosenDevice)
445 jassert (&newSetup != ¤tSetup);
447 if (newSetup == currentSetup && currentAudioDevice !=
nullptr)
450 if (! (newSetup == currentSetup))
465 deleteCurrentDevice();
467 if (treatAsChosenDevice)
477 || currentAudioDevice ==
nullptr)
479 deleteCurrentDevice();
480 scanDevicesIfNeeded();
490 if (currentAudioDevice ==
nullptr)
491 error =
"Can't open the audio device!\n\n" 492 "This may be because another application is currently using the same device - " 493 "if so, you should close any other applications and try again!";
495 error = currentAudioDevice->getLastError();
499 deleteCurrentDevice();
525 currentSetup = newSetup;
529 if (treatAsChosenDevice)
535 currentSetup.sampleRate = chooseBestSampleRate (newSetup.
sampleRate);
536 currentSetup.bufferSize = chooseBestBufferSize (newSetup.
bufferSize);
540 currentSetup.sampleRate,
541 currentSetup.bufferSize);
545 currentDeviceType = currentAudioDevice->getTypeName();
547 currentAudioDevice->start (callbackHandler.get());
549 currentSetup.sampleRate = currentAudioDevice->getCurrentSampleRate();
550 currentSetup.bufferSize = currentAudioDevice->getCurrentBufferSizeSamples();
551 currentSetup.inputChannels = currentAudioDevice->getActiveInputChannels();
552 currentSetup.outputChannels = currentAudioDevice->getActiveOutputChannels();
554 for (
int i = 0; i < availableDeviceTypes.size(); ++i)
555 if (availableDeviceTypes.getUnchecked (i)->getTypeName() == currentDeviceType)
556 *(lastDeviceTypeConfigs.getUnchecked (i)) = currentSetup;
558 if (treatAsChosenDevice)
563 deleteCurrentDevice();
569 double AudioDeviceManager::chooseBestSampleRate (
double rate)
const 571 jassert (currentAudioDevice !=
nullptr);
573 auto rates = currentAudioDevice->getAvailableSampleRates();
575 if (rate > 0 && rates.contains (rate))
578 rate = currentAudioDevice->getCurrentSampleRate();
580 if (rate > 0 && rates.contains (rate))
583 double lowestAbove44 = 0.0;
585 for (
int i = rates.size(); --i >= 0;)
589 if (sr >= 44100.0 && (lowestAbove44 < 1.0 || sr < lowestAbove44))
593 if (lowestAbove44 > 0.0)
594 return lowestAbove44;
599 int AudioDeviceManager::chooseBestBufferSize (
int bufferSize)
const 601 jassert (currentAudioDevice !=
nullptr);
603 if (bufferSize > 0 && currentAudioDevice->getAvailableBufferSizes().contains (bufferSize))
606 return currentAudioDevice->getDefaultBufferSize();
609 void AudioDeviceManager::stopDevice()
611 if (currentAudioDevice !=
nullptr)
612 currentAudioDevice->stop();
620 currentAudioDevice.reset();
621 loadMeasurer.reset();
626 if (currentAudioDevice ==
nullptr)
628 if (currentSetup.inputDeviceName.isEmpty()
629 && currentSetup.outputDeviceName.isEmpty())
643 void AudioDeviceManager::updateXml()
645 lastExplicitSettings.reset (
new XmlElement (
"DEVICESETUP"));
647 lastExplicitSettings->setAttribute (
"deviceType", currentDeviceType);
648 lastExplicitSettings->setAttribute (
"audioOutputDeviceName", currentSetup.outputDeviceName);
649 lastExplicitSettings->setAttribute (
"audioInputDeviceName", currentSetup.inputDeviceName);
651 if (currentAudioDevice !=
nullptr)
653 lastExplicitSettings->setAttribute (
"audioDeviceRate", currentAudioDevice->getCurrentSampleRate());
655 if (currentAudioDevice->getDefaultBufferSize() != currentAudioDevice->getCurrentBufferSizeSamples())
656 lastExplicitSettings->setAttribute (
"audioDeviceBufferSize", currentAudioDevice->getCurrentBufferSizeSamples());
658 if (! currentSetup.useDefaultInputChannels)
659 lastExplicitSettings->setAttribute (
"audioDeviceInChans", currentSetup.inputChannels.toString (2));
661 if (! currentSetup.useDefaultOutputChannels)
662 lastExplicitSettings->setAttribute (
"audioDeviceOutChans", currentSetup.outputChannels.toString (2));
665 for (
int i = 0; i < enabledMidiInputs.size(); ++i)
666 lastExplicitSettings->createNewChildElement (
"MIDIINPUT")
667 ->setAttribute (
"name", enabledMidiInputs[i]->getName());
669 if (midiInsFromXml.size() > 0)
675 for (
int i = 0; i < midiInsFromXml.size(); ++i)
676 if (! availableMidiDevices.
contains (midiInsFromXml[i],
true))
677 lastExplicitSettings->createNewChildElement (
"MIDIINPUT")
678 ->setAttribute (
"name", midiInsFromXml[i]);
681 if (defaultMidiOutputName.isNotEmpty())
682 lastExplicitSettings->setAttribute (
"defaultMidiOutput", defaultMidiOutputName);
691 if (callbacks.contains (newCallback))
695 if (currentAudioDevice !=
nullptr && newCallback !=
nullptr)
699 callbacks.add (newCallback);
704 if (callbackToRemove !=
nullptr)
706 bool needsDeinitialising = currentAudioDevice !=
nullptr;
711 needsDeinitialising = needsDeinitialising && callbacks.contains (callbackToRemove);
712 callbacks.removeFirstMatchingValue (callbackToRemove);
715 if (needsDeinitialising)
720 void AudioDeviceManager::audioDeviceIOCallbackInt (
const float** inputChannelData,
721 int numInputChannels,
722 float** outputChannelData,
723 int numOutputChannels,
728 inputLevelGetter->updateLevel (inputChannelData, numInputChannels, numSamples);
729 outputLevelGetter->updateLevel (const_cast<const float**> (outputChannelData), numOutputChannels, numSamples);
731 if (callbacks.size() > 0)
735 tempBuffer.setSize (jmax (1, numOutputChannels), jmax (1, numSamples),
false,
false,
true);
737 callbacks.getUnchecked(0)->audioDeviceIOCallback (inputChannelData, numInputChannels,
738 outputChannelData, numOutputChannels, numSamples);
740 auto** tempChans = tempBuffer.getArrayOfWritePointers();
742 for (
int i = callbacks.size(); --i > 0;)
744 callbacks.getUnchecked(i)->audioDeviceIOCallback (inputChannelData, numInputChannels,
745 tempChans, numOutputChannels, numSamples);
747 for (
int chan = 0; chan < numOutputChannels; ++chan)
749 if (
auto* src = tempChans [chan])
750 if (
auto* dst = outputChannelData [chan])
751 for (
int j = 0; j < numSamples; ++j)
758 for (
int i = 0; i < numOutputChannels; ++i)
759 zeromem (outputChannelData[i],
sizeof (
float) * (
size_t) numSamples);
762 if (testSound !=
nullptr)
764 auto numSamps = jmin (numSamples, testSound->getNumSamples() - testSoundPosition);
765 auto* src = testSound->getReadPointer (0, testSoundPosition);
767 for (
int i = 0; i < numOutputChannels; ++i)
768 for (
int j = 0; j < numSamps; ++j)
769 outputChannelData [i][j] += src[j];
771 testSoundPosition += numSamps;
773 if (testSoundPosition >= testSound->getNumSamples())
778 void AudioDeviceManager::audioDeviceAboutToStartInt (
AudioIODevice*
const device)
786 for (
int i = callbacks.size(); --i >= 0;)
787 callbacks.getUnchecked(i)->audioDeviceAboutToStart (device);
793 void AudioDeviceManager::audioDeviceStoppedInt()
799 loadMeasurer.reset();
801 for (
int i = callbacks.size(); --i >= 0;)
802 callbacks.getUnchecked(i)->audioDeviceStopped();
805 void AudioDeviceManager::audioDeviceErrorInt (
const String& message)
809 for (
int i = callbacks.size(); --i >= 0;)
810 callbacks.getUnchecked(i)->audioDeviceError (message);
815 return loadMeasurer.getLoadAsProportion();
831 enabledMidiInputs.add (midiIn);
838 for (
int i = enabledMidiInputs.size(); --i >= 0;)
839 if (enabledMidiInputs[i]->getName() == name)
840 enabledMidiInputs.remove (i);
850 for (
auto* mi : enabledMidiInputs)
851 if (mi->getName() == name)
866 mc.deviceName = name;
867 mc.callback = callbackToAdd;
868 midiCallbacks.add (mc);
874 for (
int i = midiCallbacks.size(); --i >= 0;)
876 auto& mc = midiCallbacks.getReference(i);
878 if (mc.callback == callbackToRemove && mc.deviceName == name)
881 midiCallbacks.remove (i);
886 void AudioDeviceManager::handleIncomingMidiMessageInt (
MidiInput* source,
const MidiMessage& message)
892 for (
auto& mc : midiCallbacks)
893 if (mc.deviceName.isEmpty() || mc.deviceName == source->
getName())
894 mc.callback->handleIncomingMidiMessage (source, message);
901 if (defaultMidiOutputName != deviceName)
910 if (currentAudioDevice !=
nullptr)
911 for (
int i = oldCallbacks.
size(); --i >= 0;)
914 defaultMidiOutput.reset();
915 defaultMidiOutputName = deviceName;
920 if (currentAudioDevice !=
nullptr)
921 for (
auto* c : oldCallbacks)
922 c->audioDeviceAboutToStart (currentAudioDevice.get());
926 oldCallbacks.swapWith (callbacks);
935 AudioDeviceManager::LevelMeter::LevelMeter() noexcept : level() {}
937 void AudioDeviceManager::LevelMeter::updateLevel (
const float*
const* channelData,
int numChannels,
int numSamples) noexcept
939 if (getReferenceCount() <= 1)
942 auto localLevel = level.get();
946 for (
int j = 0; j < numSamples; ++j)
950 for (
int i = 0; i < numChannels; ++i)
951 s += std::abs (channelData[i][j]);
953 s /= (float) numChannels;
955 const float decayFactor = 0.99992f;
959 else if (localLevel > 0.001f)
960 localLevel *= decayFactor;
973 double AudioDeviceManager::LevelMeter::getCurrentLevel()
const noexcept
975 jassert (getReferenceCount() > 1);
982 std::unique_ptr<AudioBuffer<float>> oldSound;
986 std::swap (oldSound, testSound);
990 testSoundPosition = 0;
992 if (currentAudioDevice !=
nullptr)
994 auto sampleRate = currentAudioDevice->getCurrentSampleRate();
997 double frequency = 440.0;
998 float amplitude = 0.5f;
1002 std::unique_ptr<AudioBuffer<float>> newSound (
new AudioBuffer<float> (1, soundLength));
1004 for (
int i = 0; i < soundLength; ++i)
1005 newSound->setSample (0, i, amplitude * (
float) std::sin (i * phasePerSample));
1007 newSound->applyGainRamp (0, 0, soundLength / 10, 0.0f, 1.0f);
1008 newSound->applyGainRamp (0, soundLength - soundLength / 4, soundLength / 4, 1.0f, 0.0f);
1012 std::swap (testSound, newSound);
1019 auto deviceXRuns = (currentAudioDevice !=
nullptr ? currentAudioDevice->getXRunCount() : -1);
1020 return jmax (0, deviceXRuns) + loadMeasurer.getXRunCount();
void addAudioCallback(AudioIODeviceCallback *newCallback)
Registers an audio callback to be used.
String initialiseWithDefaultDevices(int numInputChannelsNeeded, int numOutputChannelsNeeded)
Resets everything to a default device setup, clearing any stored settings.
double sampleRate
The current sample rate.
One of these is passed to an AudioIODevice object to stream the audio data in and out...
BigInteger outputChannels
The set of active output channels.
bool hasTagName(StringRef possibleTagName) const noexcept
Tests whether this element has a particular tag name.
int bufferSize
The buffer size, in samples.
Encapsulates a MIDI message.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
void swapWith(OtherArrayType &otherArray) noexcept
This swaps the contents of this array with those of another array.
bool isMidiInputEnabled(const String &midiInputDeviceName) const
Returns true if a given midi input device is being used.
virtual void audioDeviceAboutToStart(AudioIODevice *device)=0
Called to indicate that the device is about to start calling back.
String outputDeviceName
The name of the audio device used for output.
Used to build a tree of elements representing an XML document.
static AudioIODeviceType * createAudioIODeviceType_CoreAudio()
Creates a CoreAudio device type if it's available on this platform, or returns null.
static MidiOutput * openDevice(int deviceIndex)
Tries to open one of the midi output devices.
void parseString(StringRef text, int base)
Reads the numeric value from a string.
String setAudioDeviceSetup(const AudioDeviceSetup &newSetup, bool treatAsChosenDevice)
Changes the current device or its settings.
static AudioIODeviceType * createAudioIODeviceType_iOSAudio()
Creates an iOS device type if it's available on this platform, or returns null.
static AudioIODeviceType * createAudioIODeviceType_Oboe()
Creates an Oboe device type if it's available on this platform, or returns null.
A special array for holding a list of strings.
~AudioDeviceManager() override
Destructor.
int getIntAttribute(StringRef attributeName, int defaultReturnValue=0) const
Returns the value of a named attribute as an integer.
void closeAudioDevice()
Closes the currently-open device.
static AudioIODeviceType * createAudioIODeviceType_OpenSLES()
Creates an Android OpenSLES device type if it's available on this platform, or returns null...
BigInteger inputChannels
The set of active input channels.
AudioDeviceManager()
Creates a default AudioDeviceManager.
bool hasAttribute(StringRef attributeName) const noexcept
Checks whether the element contains an attribute with a certain name.
ElementType getUnchecked(int index) const
Returns one of the elements in the array, without checking the index passed in.
String initialise(int numInputChannelsNeeded, int numOutputChannelsNeeded, const XmlElement *savedState, bool selectDefaultDeviceOnFailure, const String &preferredDefaultDeviceName=String(), const AudioDeviceSetup *preferredSetupOptions=nullptr)
Opens a set of audio devices ready for use.
void addAudioDeviceType(AudioIODeviceType *newDeviceType)
Adds a new device type to the list of types.
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
Searches for a string in the array.
void clear() noexcept
Resets the value to 0.
AudioDeviceSetup getAudioDeviceSetup() const
Returns the current device properties that are in use.
static AudioIODeviceType * createAudioIODeviceType_ASIO()
Creates an ASIO device type if it's available on this platform, or returns null.
void removeMidiInputCallback(const String &midiInputDeviceName, MidiInputCallback *callback)
Removes a listener that was previously registered with addMidiInputCallback().
static AudioIODeviceType * createAudioIODeviceType_Bela()
Creates a Bela device type if it's available on this platform, or returns null.
Represents a type of audio driver, such as DirectSound, ASIO, CoreAudio, etc.
virtual StringArray getDeviceNames(bool wantInputNames=false) const =0
Returns the list of available devices of this type.
AudioIODeviceType * getCurrentDeviceTypeObject() const
Returns the currently active audio device type object.
bool useDefaultOutputChannels
If this is true, it indicates that the outputChannels array should be ignored, and instead...
static StringArray getDevices()
Returns a list of the available midi output devices.
This class measures the time between its construction and destruction and adds it to an AudioProcessL...
A class for receiving events when audio devices are inserted or removed.
void setDefaultMidiOutput(const String &deviceName)
Sets a midi output device to use as the default.
int getXRunCount() const noexcept
Returns the number of under- or over runs reported.
bool useDefaultInputChannels
If this is true, it indicates that the inputChannels array should be ignored, and instead...
double getDoubleAttribute(StringRef attributeName, double defaultReturnValue=0.0) const
Returns the value of a named attribute as floating-point.
void setCurrentAudioDeviceType(const String &type, bool treatAsChosenDevice)
Changes the class of audio device being used.
static AudioIODeviceType * createAudioIODeviceType_JACK()
Creates a JACK device type if it's available on this platform, or returns null.
virtual double getCurrentSampleRate()=0
Returns the sample rate that the device is currently using.
static AudioIODeviceType * createAudioIODeviceType_DirectSound()
Creates a DirectSound device type if it's available on this platform, or returns null.
String inputDeviceName
The name of the audio device used for input.
static AudioIODeviceType * createAudioIODeviceType_WASAPI(bool exclusiveMode)
Creates a WASAPI device type if it's available on this platform, or returns null. ...
virtual int getCurrentBufferSizeSamples()=0
Returns the buffer size that the device is currently using.
virtual int getDefaultDeviceIndex(bool forInput) const =0
Returns the name of the default device.
void setMidiInputEnabled(const String &midiInputDeviceName, bool enabled)
Enables or disables a midi input device.
Holds a resizable array of primitive or copy-by-value objects.
void addListener(Listener *listener)
Adds a listener that will be called when this type of device is added or removed from the system...
void removeAudioCallback(AudioIODeviceCallback *callback)
Deregisters a previously added callback.
virtual AudioIODevice * createDevice(const String &outputDeviceName, const String &inputDeviceName)=0
Creates one of the devices of this type.
int size() const noexcept
Returns the current number of elements in the array.
bool isZero() const noexcept
Returns true if no bits are set.
void sendChangeMessage()
Causes an asynchronous change message to be sent to all the registered listeners. ...
void playTestSound()
Plays a beep through the current audio device.
virtual void audioDeviceStopped()=0
Called to indicate that the device has stopped.
static AudioIODeviceType * createAudioIODeviceType_Android()
Creates an Android device type if it's available on this platform, or returns null.
bool isEmpty() const noexcept
Returns true if the string contains no characters.
Base class for an audio device with synchronised input and output channels.
bool contains(StringRef stringToLookFor, bool ignoreCase=false) const
Searches for a string in the array.
This structure holds a set of properties describing the current audio setup.
void addMidiInputCallback(const String &midiInputDeviceName, MidiInputCallback *callback)
Registers a listener for callbacks when midi events arrive from a midi input.
const String & getStringAttribute(StringRef attributeName) const noexcept
Returns the value of a named attribute.
const OwnedArray< AudioIODeviceType > & getAvailableDeviceTypes()
Returns a list of the types of device supported.
void clear() noexcept
Resets this string to be empty.
bool isActiveSense() const noexcept
Returns true if this is an active-sense message.
ObjectClass * add(ObjectClass *newObject) noexcept
Appends a new object to the end of the array.
static void JUCE_CALLTYPE sleep(int milliseconds)
Suspends the execution of the current thread until the specified timeout period has elapsed (note tha...
An array designed for holding objects.
virtual void createAudioDeviceTypes(OwnedArray< AudioIODeviceType > &types)
Creates a list of available types.
Commonly used mathematical constants.
int countNumberOfSetBits() const noexcept
Returns the total number of set bits in the value.
const String & getTypeName() const noexcept
Returns the name of this type of driver that this object manages.
String trim() const
Returns a copy of this string with any whitespace characters removed from the start and end...
void restartLastAudioDevice()
Tries to reload the last audio device that was running.
Automatically locks and unlocks a mutex object.
XmlElement * createStateXml() const
Returns some XML representing the current state of the manager.
virtual void scanForDevices()=0
Refreshes the object's cached list of known devices.
double getCpuUsage() const
Returns the average proportion of available CPU being spent inside the audio callbacks.
Manages the state of some audio and midi i/o devices.
void setRange(int startBit, int numBits, bool shouldBeSet)
Sets a range of bits to be either on or off.
static AudioIODeviceType * createAudioIODeviceType_ALSA()
Creates an ALSA device type if it's available on this platform, or returns null.