OpenShot Library | libopenshot  0.3.0
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 #include <OpenShotAudio.h>
17 
18 using namespace openshot;
19 
20 using AudioDeviceList = std::vector<std::pair<std::string, std::string>>;
21 
22 // Build a list of devices found, and return
24  // A temporary device manager, used to scan device names.
25  // Its initialize() is never called, and devices are not opened.
26  std::unique_ptr<juce::AudioDeviceManager>
27  manager(new juce::AudioDeviceManager());
28 
29  m_devices.clear();
30 
31  auto &types = manager->getAvailableDeviceTypes();
32  for (auto* t : types) {
33  t->scanForDevices();
34  const auto names = t->getDeviceNames();
35  for (const auto& name : names) {
36  m_devices.emplace_back(
37  name.toStdString(), t->getTypeName().toStdString());
38  }
39  }
40  return m_devices;
41 }
std::vector< std::pair< std::string, std::string > > AudioDeviceList
Header file for Audio Device Info struct.
AudioDeviceList getNames()
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:29
std::vector< std::pair< std::string, std::string > > AudioDeviceList
Definition: AudioDevices.h:31