# Name of INPUT-Device from AudioIODevice

**URL:** <https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148>\
**Category:** General JUCE discussion\
**Created:** [February 12, 2022, 1:51pm UTC](https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148 "2022-02-12T13:51:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SynthSeba](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SynthSeba](https://forum.juce.com/u/SynthSeba)\
**Post date:** [February 12, 2022, 1:51pm UTC](https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148/1 "2022-02-12T13:51:21Z")

</div>

Hi,

I have created a subclass of AudioAppComponent and instanciated an AudioDeviceManager with my audio devices like so:

```auto
ProcessorHost() : AudioAppComponent(adm) {
    AudioDeviceManager::AudioDeviceSetup deviceSetup = Config::getInstance()->getDeviceSetup();
    std::cout << deviceSetup.inputDeviceName << " | " << deviceSetup.outputDeviceName << std::endl;
	//returns "MacBook Air Mikrofon | MacBook Air-Lautsprecher" as these are the configured devices in deviceSetup.
    adm.initialise(2, 2, nullptr, false, "", &deviceSetup);
    setAudioChannels(adm.getCurrentAudioDevice()->getActiveInputChannels().countNumberOfSetBits(), adm.getCurrentAudioDevice()->getActiveOutputChannels().countNumberOfSetBits());
}

```

I know, that I can list all available INPUT and OUTPUT devices like this, where the bool-value in “getDeviceNames(bool)” indicates which type gets returned:

```auto
void ProcessorHost::listAvailableDevices() {
    for (auto devicetype : adm.getAvailableDeviceTypes()) {
		//INPUT devices
        for (const auto& devicename : devicetype->getDeviceNames(true)) {
            std::cout << devicename.toStdString() << std::endl;
        }
		//OUTPUT devices
        for (const auto& devicename : devicetype->getDeviceNames(false)) {
            std::cout << devicename.toStdString() << std::endl;
        }
    }
}

```

Great so far. I also know, that I can get the current selected OUTPUT-devicename from the AudioDeviceManager (in my case adm) like so:

```auto
adm.getCurrentAudioDevice()->getName(); // returns "MacBook Air-Lautsprecher"

```

But how do I get the current INPUT-devicename from the AudioDeviceManager? Maybe I am missing a bit from the docs, could someone please help?

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [April 21, 2022, 4:10pm UTC](https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148/2 "2022-04-21T16:10:06Z")

</div>

I too cannot figure this out!

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [April 21, 2022, 4:13pm UTC](https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148/3 "2022-04-21T16:13:39Z")

</div>

In fact this code in juce\_Mac\_CoreAudio.cpp has a variable optimistically called **combinedName** … which seems to be the source of the confusion 🙂

```
    auto combinedName = outputDeviceName.isEmpty() ? inputDeviceName
                                                   : outputDeviceName;

    if (inputDeviceID == outputDeviceID)
        return new CoreAudioIODevice (this, combinedName, inputDeviceID, inputIndex, outputDeviceID, outputIndex);

    std::unique_ptr<CoreAudioIODevice> in, out;

    if (inputDeviceID != 0)
        in.reset (new CoreAudioIODevice (this, inputDeviceName, inputDeviceID, inputIndex, 0, -1));

    if (outputDeviceID != 0)
        out.reset (new CoreAudioIODevice (this, outputDeviceName, 0, -1, outputDeviceID, outputIndex));

    if (in == nullptr) return out.release();
    if (out == nullptr) return in.release();

    std::unique_ptr<AudioIODeviceCombiner> combo (new AudioIODeviceCombiner (combinedName, this));
```

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [April 21, 2022, 4:32pm UTC](https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148/4 "2022-04-21T16:32:54Z")

</div>

Ah - I think you might be able to:

`deviceManager.getCurrentDeviceTypeObject()`

Then on the AudioDeviceType object

`virtual int getIndexOfDevice (AudioIODevice* device, bool asInput) const = 0;`

And then look it up in:

`virtual StringArray getDeviceNames (bool wantInputNames = false) const = 0;`

I’m going to give it a go!

---

<div class="post-metadata">

**Author:** ![JackM](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jackm/32/15975_2.png) [@JackM](https://forum.juce.com/u/JackM)\
**Post date:** [July 21, 2023, 8:08am UTC](https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148/5 "2023-07-21T08:08:22Z")

</div>

Sorry to bump into this, did you succeed by doing so?

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [July 21, 2023, 10:07am UTC](https://forum.juce.com/t/name-of-input-device-from-audioiodevice/50148/6 "2023-07-21T10:07:13Z")

</div>

Sorry it’s so long ago I can’t even remember which project this was for now ☹
