111 double sampleRate = 0;
130 bool useDefaultInputChannels =
true;
143 bool useDefaultOutputChannels =
true;
181 String initialise (
int numInputChannelsNeeded,
182 int numOutputChannelsNeeded,
184 bool selectDefaultDeviceOnFailure,
189 String initialiseWithDefaultDevices (
int numInputChannelsNeeded,
190 int numOutputChannelsNeeded);
200 std::unique_ptr<XmlElement> createStateXml()
const;
258 void setCurrentAudioDeviceType (
const String& type,
bool treatAsChosenDevice);
264 void closeAudioDevice();
274 void restartLastAudioDevice();
305 double getCpuUsage()
const;
327 void setMidiInputDeviceEnabled (
const String& deviceIdentifier,
bool enabled);
333 bool isMidiInputDeviceEnabled (
const String& deviceIdentifier)
const;
345 void addMidiInputDeviceCallback (
const String& deviceIdentifier,
349 void removeMidiInputDeviceCallback (
const String& deviceIdentifier,
365 void setDefaultMidiOutputDevice (
const String& deviceIdentifier);
395 void addAudioDeviceType (std::unique_ptr<AudioIODeviceType> newDeviceType);
406 void playTestSound();
421 double getCurrentLevel()
const noexcept;
429 void updateLevel (
const float*
const*,
int numChannels,
int numSamples) noexcept;
466 int getXRunCount() const noexcept;
470 void setMidiInputEnabled (const
String&,
bool);
472 bool isMidiInputEnabled (const
String&) const;
478 void setDefaultMidiOutput (const
String&);
480 const
String& getDefaultMidiOutputName() const noexcept {
return defaultMidiOutputDeviceInfo.name; }
487 AudioDeviceSetup currentSetup;
488 std::unique_ptr<AudioIODevice> currentAudioDevice;
490 int numInputChansNeeded = 0, numOutputChansNeeded = 2;
491 String preferredDeviceName, currentDeviceType;
492 std::unique_ptr<XmlElement> lastExplicitSettings;
493 mutable bool listNeedsScanning =
true;
496 struct MidiCallbackInfo
502 Array<MidiDeviceInfo> midiDeviceInfosFromXml;
503 std::vector<std::unique_ptr<MidiInput>> enabledMidiInputs;
504 Array<MidiCallbackInfo> midiCallbacks;
506 MidiDeviceInfo defaultMidiOutputDeviceInfo;
507 std::unique_ptr<MidiOutput> defaultMidiOutput;
508 CriticalSection audioCallbackLock, midiCallbackLock;
510 std::unique_ptr<AudioBuffer<float>> testSound;
511 int testSoundPosition = 0;
513 AudioProcessLoadMeasurer loadMeasurer;
515 LevelMeter::Ptr inputLevelGetter {
new LevelMeter() },
516 outputLevelGetter {
new LevelMeter() };
519 class CallbackHandler;
520 std::unique_ptr<CallbackHandler> callbackHandler;
522 void audioDeviceIOCallbackInt (
const float** inputChannelData,
int totalNumInputChannels,
523 float** outputChannelData,
int totalNumOutputChannels,
int numSamples);
524 void audioDeviceAboutToStartInt (AudioIODevice*);
525 void audioDeviceStoppedInt();
526 void audioDeviceErrorInt (
const String&);
527 void handleIncomingMidiMessageInt (MidiInput*,
const MidiMessage&);
528 void audioDeviceListChanged();
530 String restartDevice (
int blockSizeToUse,
double sampleRateToUse,
531 const BigInteger& ins,
const BigInteger& outs);
536 void createDeviceTypesIfNeeded();
537 void scanDevicesIfNeeded();
538 void deleteCurrentDevice();
539 double chooseBestSampleRate (
double preferred)
const;
540 int chooseBestBufferSize (
int preferred)
const;
541 void insertDefaultDeviceNames (AudioDeviceSetup&)
const;
542 String initialiseDefault (
const String& preferredDefaultDeviceName,
const AudioDeviceSetup*);
543 String initialiseFromXML (
const XmlElement&,
bool selectDefaultDeviceOnFailure,
544 const String& preferredDefaultDeviceName,
const AudioDeviceSetup*);
546 AudioIODeviceType* findType (
const String& inputName,
const String& outputName);
547 AudioIODeviceType* findType (
const String& typeName);
549 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceManager)
LevelMeter::Ptr getInputLevelGetter() noexcept
AudioIODevice * getCurrentAudioDevice() const noexcept
LevelMeter::Ptr getOutputLevelGetter() noexcept
String getCurrentAudioDeviceType() const
MidiOutput * getDefaultMidiOutput() const noexcept
const String & getDefaultMidiOutputIdentifier() const noexcept
CriticalSection & getAudioCallbackLock() noexcept
CriticalSection & getMidiCallbackLock() noexcept
BigInteger outputChannels