115 double sampleRate = 0;
134 bool useDefaultInputChannels =
true;
147 bool useDefaultOutputChannels =
true;
185 String initialise (
int numInputChannelsNeeded,
186 int numOutputChannelsNeeded,
188 bool selectDefaultDeviceOnFailure,
193 String initialiseWithDefaultDevices (
int numInputChannelsNeeded,
194 int numOutputChannelsNeeded);
204 std::unique_ptr<XmlElement> createStateXml()
const;
262 void setCurrentAudioDeviceType (
const String& type,
bool treatAsChosenDevice);
268 void closeAudioDevice();
278 void restartLastAudioDevice();
309 double getCpuUsage()
const;
331 void setMidiInputDeviceEnabled (
const String& deviceIdentifier,
bool enabled);
337 bool isMidiInputDeviceEnabled (
const String& deviceIdentifier)
const;
349 void addMidiInputDeviceCallback (
const String& deviceIdentifier,
353 void removeMidiInputDeviceCallback (
const String& deviceIdentifier,
369 void setDefaultMidiOutputDevice (
const String& deviceIdentifier);
399 void addAudioDeviceType (std::unique_ptr<AudioIODeviceType> newDeviceType);
410 void playTestSound();
425 double getCurrentLevel()
const noexcept;
433 void updateLevel (
const float*
const*,
int numChannels,
int numSamples)
noexcept;
470 int getXRunCount() const noexcept;
474 void setMidiInputEnabled (const
String&,
bool);
476 bool isMidiInputEnabled (const
String&) const;
482 void setDefaultMidiOutput (const
String&);
484 const
String& getDefaultMidiOutputName() const noexcept {
return defaultMidiOutputDeviceInfo.name; }
491 AudioDeviceSetup currentSetup;
492 std::unique_ptr<AudioIODevice> currentAudioDevice;
494 int numInputChansNeeded = 0, numOutputChansNeeded = 2;
495 String preferredDeviceName, currentDeviceType;
496 std::unique_ptr<XmlElement> lastExplicitSettings;
497 mutable bool listNeedsScanning =
true;
500 struct MidiCallbackInfo
506 Array<MidiDeviceInfo> midiDeviceInfosFromXml;
507 std::vector<std::unique_ptr<MidiInput>> enabledMidiInputs;
508 Array<MidiCallbackInfo> midiCallbacks;
510 MidiDeviceInfo defaultMidiOutputDeviceInfo;
511 std::unique_ptr<MidiOutput> defaultMidiOutput;
512 CriticalSection audioCallbackLock, midiCallbackLock;
514 std::unique_ptr<AudioBuffer<float>> testSound;
515 int testSoundPosition = 0;
517 AudioProcessLoadMeasurer loadMeasurer;
519 LevelMeter::Ptr inputLevelGetter {
new LevelMeter() },
520 outputLevelGetter {
new LevelMeter() };
523 class CallbackHandler;
524 std::unique_ptr<CallbackHandler> callbackHandler;
526 void audioDeviceIOCallbackInt (
const float** inputChannelData,
int totalNumInputChannels,
527 float** outputChannelData,
int totalNumOutputChannels,
int numSamples);
528 void audioDeviceAboutToStartInt (AudioIODevice*);
529 void audioDeviceStoppedInt();
530 void audioDeviceErrorInt (
const String&);
531 void handleIncomingMidiMessageInt (MidiInput*,
const MidiMessage&);
532 void audioDeviceListChanged();
534 String restartDevice (
int blockSizeToUse,
double sampleRateToUse,
535 const BigInteger& ins,
const BigInteger& outs);
540 void createDeviceTypesIfNeeded();
541 void scanDevicesIfNeeded();
542 void deleteCurrentDevice();
543 double chooseBestSampleRate (
double preferred)
const;
544 int chooseBestBufferSize (
int preferred)
const;
545 void insertDefaultDeviceNames (AudioDeviceSetup&)
const;
546 String initialiseDefault (
const String& preferredDefaultDeviceName,
const AudioDeviceSetup*);
547 String initialiseFromXML (
const XmlElement&,
bool selectDefaultDeviceOnFailure,
548 const String& preferredDefaultDeviceName,
const AudioDeviceSetup*);
550 AudioIODeviceType* findType (
const String& inputName,
const String& outputName);
551 AudioIODeviceType* findType (
const String& typeName);
553 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceManager)
Holds a resizable array of primitive or copy-by-value objects.
Manages the state of some audio and midi i/o devices.
MidiOutput * getDefaultMidiOutput() const noexcept
Returns the current default midi output device.
LevelMeter::Ptr getInputLevelGetter() noexcept
Returns a reference-counted object that can be used to get the current input level.
CriticalSection & getMidiCallbackLock() noexcept
Returns the a lock that can be used to synchronise access to the midi callback.
const String & getDefaultMidiOutputIdentifier() const noexcept
Returns the name of the default midi output.
LevelMeter::Ptr getOutputLevelGetter() noexcept
Returns a reference-counted object that can be used to get the current output level.
AudioIODevice * getCurrentAudioDevice() const noexcept
Returns the currently-active audio device.
String getCurrentAudioDeviceType() const
Returns the type of audio device currently in use.
CriticalSection & getAudioCallbackLock() noexcept
Returns the a lock that can be used to synchronise access to the audio callback.
One of these is passed to an AudioIODevice object to stream the audio data in and out.
Represents a type of audio driver, such as DirectSound, ASIO, CoreAudio, etc.
Base class for an audio device with synchronised input and output channels.
An arbitrarily large integer class.
Holds a list of ChangeListeners, and sends messages to them when instructed.
Represents a midi output device.
An array designed for holding objects.
A base class which provides methods for reference-counting.
Used to build a tree of elements representing an XML document.
#define JUCE_API
This macro is added to all JUCE public class declarations.
This structure holds a set of properties describing the current audio setup.
String outputDeviceName
The name of the audio device used for output.
String inputDeviceName
The name of the audio device used for input.
BigInteger outputChannels
The set of active output channels.
BigInteger inputChannels
The set of active input channels.
A simple reference-counted struct that holds a level-meter value that can be read using getCurrentLev...