OpenShot Library | libopenshot  0.3.3
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 
16 using namespace openshot;
17 
18 using 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 }
openshot::AudioDeviceList
std::vector< std::pair< std::string, std::string > > AudioDeviceList
Definition: AudioDevices.h:42
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
AudioDeviceList
std::vector< std::pair< std::string, std::string > > AudioDeviceList
Definition: AudioDevices.cpp:18
openshot::AudioDevices::getNames
AudioDeviceList getNames()
Definition: AudioDevices.cpp:21
AudioDevices.h
Header file for Audio Device Info struct.