-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #719 from OpenShot/audio-devices
New audio device [type] switching + Audio sync improvements
- Loading branch information
Showing
18 changed files
with
255 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @file | ||
* @brief Header file for Audio Device Info struct | ||
* @author Jonathan Thomas <jonathan@openshot.org> | ||
* | ||
* @ref License | ||
*/ | ||
|
||
// Copyright (c) 2008-2019 OpenShot Studios, LLC | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
#ifndef OPENSHOT_AUDIODEVICEINFO_H | ||
#define OPENSHOT_AUDIODEVICEINFO_H | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
namespace openshot { | ||
/** | ||
* @brief This struct hold information about Audio Devices | ||
* | ||
* The type and name of the audio device. | ||
*/ | ||
struct | ||
AudioDeviceInfo { | ||
std::string name; | ||
std::string type; | ||
}; | ||
|
||
using AudioDeviceList = std::vector<std::pair<std::string, std::string>>; | ||
|
||
/// A class which probes the available audio devices | ||
class AudioDevices | ||
{ | ||
public: | ||
AudioDevices() = default; | ||
|
||
/// Return a vector of std::pair<> objects holding the | ||
/// device name and type for each audio device detected | ||
AudioDeviceList getNames(); | ||
private: | ||
AudioDeviceList m_devices; | ||
}; | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.