Build a list of devices found, and return
| 19 | |
| 20 | // Build a list of devices found, and return |
| 21 | AudioDeviceList AudioDevices::getNames() { |
| 22 | // A temporary device manager, used to scan device names. |
| 23 | // Its initialize() is never called, and devices are not opened. |
| 24 | std::unique_ptr<juce::AudioDeviceManager> |
| 25 | manager(new juce::AudioDeviceManager()); |
| 26 | |
| 27 | m_devices.clear(); |
| 28 | |
| 29 | auto &types = manager->getAvailableDeviceTypes(); |
| 30 | for (auto* t : types) { |
| 31 | t->scanForDevices(); |
| 32 | const auto names = t->getDeviceNames(); |
| 33 | for (const auto& name : names) { |
| 34 | m_devices.emplace_back( |
| 35 | name.toStdString(), t->getTypeName().toStdString()); |
| 36 | } |
| 37 | } |
| 38 | return m_devices; |
| 39 | } |
no test coverage detected