[DEV] WORK on a port for BOOST
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "Manager.h"
|
||||
#include <memory>
|
||||
#include <river/debug.h>
|
||||
#include "Node.h"
|
||||
#include "NodeAEC.h"
|
||||
@@ -78,15 +77,15 @@ river::io::Manager::~Manager() {
|
||||
};
|
||||
|
||||
|
||||
std::shared_ptr<river::io::Manager> river::io::Manager::getInstance() {
|
||||
static std::shared_ptr<river::io::Manager> manager(new Manager());
|
||||
std11::shared_ptr<river::io::Manager> river::io::Manager::getInstance() {
|
||||
static std11::shared_ptr<river::io::Manager> manager(new Manager());
|
||||
return manager;
|
||||
}
|
||||
|
||||
std::shared_ptr<river::io::Node> river::io::Manager::getNode(const std::string& _name) {
|
||||
std11::shared_ptr<river::io::Node> river::io::Manager::getNode(const std::string& _name) {
|
||||
RIVER_WARNING("Get node : " << _name);
|
||||
for (auto &it : m_list) {
|
||||
std::shared_ptr<river::io::Node> tmppp = it.lock();
|
||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||
std11::shared_ptr<river::io::Node> tmppp = m_list[iii].lock();
|
||||
if ( tmppp != nullptr
|
||||
&& _name == tmppp->getName()) {
|
||||
RIVER_WARNING(" find it ... ");
|
||||
@@ -95,14 +94,14 @@ std::shared_ptr<river::io::Node> river::io::Manager::getNode(const std::string&
|
||||
}
|
||||
RIVER_WARNING("Create a new one : " << _name);
|
||||
// check if the node can be open :
|
||||
const std::shared_ptr<const ejson::Object> tmpObject = m_config.getObject(_name);
|
||||
const std11::shared_ptr<const ejson::Object> tmpObject = m_config.getObject(_name);
|
||||
if (tmpObject != nullptr) {
|
||||
// get type : io
|
||||
std::string ioType = tmpObject->getStringValue("io", "error");
|
||||
#ifdef __AIRTAUDIO_INFERFACE__
|
||||
if ( ioType == "input"
|
||||
|| ioType == "output") {
|
||||
std::shared_ptr<river::io::Node> tmp = river::io::NodeAirTAudio::create(_name, tmpObject);
|
||||
std11::shared_ptr<river::io::Node> tmp = river::io::NodeAirTAudio::create(_name, tmpObject);
|
||||
m_list.push_back(tmp);
|
||||
return tmp;
|
||||
} else
|
||||
@@ -110,42 +109,42 @@ std::shared_ptr<river::io::Node> river::io::Manager::getNode(const std::string&
|
||||
#ifdef __PORTAUDIO_INFERFACE__
|
||||
if ( ioType == "PAinput"
|
||||
|| ioType == "PAoutput") {
|
||||
std::shared_ptr<river::io::Node> tmp = river::io::NodePortAudio::create(_name, tmpObject);
|
||||
std11::shared_ptr<river::io::Node> tmp = river::io::NodePortAudio::create(_name, tmpObject);
|
||||
m_list.push_back(tmp);
|
||||
return tmp;
|
||||
} else
|
||||
#endif
|
||||
if (ioType == "aec") {
|
||||
std::shared_ptr<river::io::Node> tmp = river::io::NodeAEC::create(_name, tmpObject);
|
||||
std11::shared_ptr<river::io::Node> tmp = river::io::NodeAEC::create(_name, tmpObject);
|
||||
m_list.push_back(tmp);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
RIVER_ERROR("Can not create the interface : '" << _name << "' the node is not DEFINED in the configuration file availlable : " << m_config.getKeys());
|
||||
return nullptr;
|
||||
return std11::shared_ptr<river::io::Node>();
|
||||
}
|
||||
|
||||
std::shared_ptr<drain::VolumeElement> river::io::Manager::getVolumeGroup(const std::string& _name) {
|
||||
std11::shared_ptr<drain::VolumeElement> river::io::Manager::getVolumeGroup(const std::string& _name) {
|
||||
if (_name == "") {
|
||||
RIVER_ERROR("Try to create an audio group with no name ...");
|
||||
return nullptr;
|
||||
return std11::shared_ptr<drain::VolumeElement>();
|
||||
}
|
||||
for (auto &it : m_volumeGroup) {
|
||||
if (it == nullptr) {
|
||||
for (size_t iii=0; iii<m_volumeGroup.size(); ++iii) {
|
||||
if (m_volumeGroup[iii] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->getName() == _name) {
|
||||
return it;
|
||||
if (m_volumeGroup[iii]->getName() == _name) {
|
||||
return m_volumeGroup[iii];
|
||||
}
|
||||
}
|
||||
RIVER_DEBUG("Add a new volume group : '" << _name << "'");
|
||||
std::shared_ptr<drain::VolumeElement> tmpVolume = std::make_shared<drain::VolumeElement>(_name);
|
||||
std11::shared_ptr<drain::VolumeElement> tmpVolume = std11::make_shared<drain::VolumeElement>(_name);
|
||||
m_volumeGroup.push_back(tmpVolume);
|
||||
return tmpVolume;
|
||||
}
|
||||
|
||||
bool river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
|
||||
std::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
std11::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
|
||||
return false;
|
||||
@@ -156,8 +155,8 @@ bool river::io::Manager::setVolume(const std::string& _volumeName, float _valued
|
||||
return false;
|
||||
}
|
||||
volume->setVolume(_valuedB);
|
||||
for (auto &it2 : m_list) {
|
||||
std::shared_ptr<river::io::Node> val = it2.lock();
|
||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||
std11::shared_ptr<river::io::Node> val = m_list[iii].lock();
|
||||
if (val != nullptr) {
|
||||
val->volumeChange();
|
||||
}
|
||||
@@ -166,7 +165,7 @@ bool river::io::Manager::setVolume(const std::string& _volumeName, float _valued
|
||||
}
|
||||
|
||||
float river::io::Manager::getVolume(const std::string& _volumeName) {
|
||||
std::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
std11::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
|
||||
return 0.0f;
|
||||
@@ -187,12 +186,10 @@ void river::io::Manager::generateDot(const std::string& _filename) {
|
||||
}
|
||||
node << "digraph G {" << "\n";
|
||||
node << " rankdir=\"LR\";\n";
|
||||
int32_t id = 0;
|
||||
for (auto &it2 : m_list) {
|
||||
std::shared_ptr<river::io::Node> val = it2.lock();
|
||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||
std11::shared_ptr<river::io::Node> val = m_list[iii].lock();
|
||||
if (val != nullptr) {
|
||||
val->generateDot(node);
|
||||
id++;
|
||||
}
|
||||
}
|
||||
node << "}" << "\n";
|
||||
|
Reference in New Issue
Block a user