[DEV] add mitex of low level interface
This commit is contained in:
parent
d431f9d790
commit
39424279ef
@ -86,6 +86,7 @@ std11::shared_ptr<river::io::Manager> river::io::Manager::getInstance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std11::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) {
|
||||||
|
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||||
RIVER_WARNING("Get node : " << _name);
|
RIVER_WARNING("Get node : " << _name);
|
||||||
// search in the standalone list :
|
// search in the standalone list :
|
||||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||||
@ -162,6 +163,7 @@ std11::shared_ptr<river::io::Node> river::io::Manager::getNode(const std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
std11::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) {
|
||||||
|
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||||
if (_name == "") {
|
if (_name == "") {
|
||||||
RIVER_ERROR("Try to create an audio group with no name ...");
|
RIVER_ERROR("Try to create an audio group with no name ...");
|
||||||
return std11::shared_ptr<drain::VolumeElement>();
|
return std11::shared_ptr<drain::VolumeElement>();
|
||||||
@ -181,6 +183,7 @@ std11::shared_ptr<drain::VolumeElement> river::io::Manager::getVolumeGroup(const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
|
bool river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
|
||||||
|
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||||
std11::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
std11::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||||
if (volume == nullptr) {
|
if (volume == nullptr) {
|
||||||
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
|
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
|
||||||
@ -202,6 +205,7 @@ bool river::io::Manager::setVolume(const std::string& _volumeName, float _valued
|
|||||||
}
|
}
|
||||||
|
|
||||||
float river::io::Manager::getVolume(const std::string& _volumeName) {
|
float river::io::Manager::getVolume(const std::string& _volumeName) {
|
||||||
|
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||||
std11::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
std11::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||||
if (volume == nullptr) {
|
if (volume == nullptr) {
|
||||||
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
|
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
|
||||||
@ -215,6 +219,7 @@ std::pair<float,float> river::io::Manager::getVolumeRange(const std::string& _vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
void river::io::Manager::generateDot(const std::string& _filename) {
|
void river::io::Manager::generateDot(const std::string& _filename) {
|
||||||
|
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||||
etk::FSNode node(_filename);
|
etk::FSNode node(_filename);
|
||||||
RIVER_INFO("Generate the DOT files: " << node);
|
RIVER_INFO("Generate the DOT files: " << node);
|
||||||
if (node.fileOpenWrite() == false) {
|
if (node.fileOpenWrite() == false) {
|
||||||
@ -235,6 +240,7 @@ void river::io::Manager::generateDot(const std::string& _filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<river::io::Group> river::io::Manager::getGroup(const std::string& _name) {
|
std11::shared_ptr<river::io::Group> river::io::Manager::getGroup(const std::string& _name) {
|
||||||
|
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||||
std11::shared_ptr<river::io::Group> out;
|
std11::shared_ptr<river::io::Group> out;
|
||||||
std::map<std::string, std11::shared_ptr<river::io::Group> >::iterator it = m_listGroup.find(_name);
|
std::map<std::string, std11::shared_ptr<river::io::Group> >::iterator it = m_listGroup.find(_name);
|
||||||
if (it == m_listGroup.end()) {
|
if (it == m_listGroup.end()) {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <etk/mutex.h>
|
||||||
#include <etk/chrono.h>
|
#include <etk/chrono.h>
|
||||||
#include <etk/functional.h>
|
#include <etk/functional.h>
|
||||||
#include <etk/memory.h>
|
#include <etk/memory.h>
|
||||||
@ -25,6 +26,8 @@ namespace river {
|
|||||||
namespace io {
|
namespace io {
|
||||||
class Node;
|
class Node;
|
||||||
class Manager {
|
class Manager {
|
||||||
|
private:
|
||||||
|
mutable std11::recursive_mutex m_mutex;
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
|
@ -28,7 +28,7 @@ namespace river {
|
|||||||
class Manager;
|
class Manager;
|
||||||
class Group;
|
class Group;
|
||||||
class Node : public std11::enable_shared_from_this<Node> {
|
class Node : public std11::enable_shared_from_this<Node> {
|
||||||
friend river::io::Group;
|
friend class river::io::Group;
|
||||||
protected:
|
protected:
|
||||||
uint32_t m_uid; // uniqueNodeID
|
uint32_t m_uid; // uniqueNodeID
|
||||||
protected:
|
protected:
|
||||||
|
@ -16,7 +16,7 @@ namespace river {
|
|||||||
class Manager;
|
class Manager;
|
||||||
class Group;
|
class Group;
|
||||||
class NodeAirTAudio : public Node {
|
class NodeAirTAudio : public Node {
|
||||||
friend river::io::Group;
|
friend class river::io::Group;
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user