You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
/**
|
|
* @file
|
|
* @brief Utility methods for identifying audio devices
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
* @author FeRD (Frank Dana) <ferdnyc@gmail.com>
|
|
*
|
|
* @ref License
|
|
*/
|
|
|
|
// Copyright (c) 2008-2019 OpenShot Studios, LLC
|
|
//
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
#include "AudioDevices.h"
|
|
|
|
#include <OpenShotAudio.h>
|
|
|
|
using namespace openshot;
|
|
|
|
using AudioDeviceList = std::vector<std::pair<std::string, std::string>>;
|
|
|
|
// Build a list of devices found, and return
|
|
AudioDeviceList AudioDevices::getNames() {
|
|
// A temporary device manager, used to scan device names.
|
|
// Its initialize() is never called, and devices are not opened.
|
|
std::unique_ptr<juce::AudioDeviceManager>
|
|
manager(new juce::AudioDeviceManager());
|
|
|
|
m_devices.clear();
|
|
|
|
auto &types = manager->getAvailableDeviceTypes();
|
|
for (auto* t : types) {
|
|
t->scanForDevices();
|
|
const auto names = t->getDeviceNames();
|
|
for (const auto& name : names) {
|
|
m_devices.emplace_back(
|
|
name.toStdString(), t->getTypeName().toStdString());
|
|
}
|
|
}
|
|
return m_devices;
|
|
}
|