OpenShot Library | libopenshot 1.1.1
Loading...
Searching...
No Matches
AudioDevices.cpp
Go to the documentation of this file.
1
10// Copyright (c) 2008-2019 OpenShot Studios, LLC
11//
12// SPDX-License-Identifier: LGPL-3.0-or-later
13
14#include "AudioDevices.h"
15
16using namespace openshot;
17
18using AudioDeviceList = std::vector<std::pair<std::string, std::string>>;
19
20// Build a list of devices found, and return
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}
40
41// Build a list of audio input devices found, and return
43 // A temporary device manager, used to scan device names.
44 // Its initialize() is never called, and devices are not opened.
45 std::unique_ptr<juce::AudioDeviceManager>
46 manager(new juce::AudioDeviceManager());
47
48 m_devices.clear();
49
50 auto &types = manager->getAvailableDeviceTypes();
51 for (auto* t : types) {
52 t->scanForDevices();
53 const auto names = t->getDeviceNames(true);
54 for (const auto& name : names) {
55 m_devices.emplace_back(
56 name.toStdString(), t->getTypeName().toStdString());
57 }
58 }
59 return m_devices;
60}
std::vector< std::pair< std::string, std::string > > AudioDeviceList
Header file for Audio Device Info struct.
AudioDeviceList getInputNames()
Return only audio input devices, for recording workflows.
AudioDeviceList getNames()
This namespace is the default namespace for all code in the openshot library.
std::vector< std::pair< std::string, std::string > > AudioDeviceList