[DEV] update sharedPtr

This commit is contained in:
Edouard DUPIN 2016-07-19 21:43:58 +02:00
parent e83ac7620d
commit 9a37b437c6
35 changed files with 281 additions and 281 deletions

View File

@ -21,10 +21,10 @@ audio::river::Interface::Interface(void) :
}
bool audio::river::Interface::init(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<audio::river::io::Node>& _node,
const ejson::Object& _config) {
const std::vector<audio::channel>& _map,
audio::format _format,
ememory::SharedPtr<audio::river::io::Node> _node,
const ejson::Object& _config) {
std::vector<audio::channel> map(_map);
m_node = _node;
m_config = _config;
@ -40,7 +40,7 @@ bool audio::river::Interface::init(float _freq,
m_mode = audio::river::modeInterface_feedback;
}
// register interface to be notify from the volume change.
m_node->registerAsRemote(shared_from_this());
m_node->registerAsRemote(sharedFromThis());
if (map.size() == 0) {
RIVER_INFO("Select auto map system ...");
@ -53,10 +53,10 @@ bool audio::river::Interface::init(float _freq,
&& m_mode == audio::river::modeInterface_input) {
m_process.setInputConfig(m_node->getInterfaceFormat());
// Add volume only if the Low level has a volume (otherwise it will be added by the application)
std::shared_ptr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume();
ememory::SharedPtr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume();
if (tmpVolume != nullptr) {
// add all time the volume stage :
std::shared_ptr<audio::drain::Volume> algo = audio::drain::Volume::create();
ememory::SharedPtr<audio::drain::Volume> algo = audio::drain::Volume::create();
//algo->setInputFormat(m_node->getInterfaceFormat());
algo->setName("volume");
m_process.pushBack(algo);
@ -68,10 +68,10 @@ bool audio::river::Interface::init(float _freq,
&& m_mode == audio::river::modeInterface_output) {
m_process.setInputConfig(audio::drain::IOFormatInterface(map, _format, _freq));
// Add volume only if the Low level has a volume (otherwise it will be added by the application)
std::shared_ptr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume();
ememory::SharedPtr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume();
if (tmpVolume != nullptr) {
// add all time the volume stage :
std::shared_ptr<audio::drain::Volume> algo = audio::drain::Volume::create();
ememory::SharedPtr<audio::drain::Volume> algo = audio::drain::Volume::create();
//algo->setOutputFormat(m_node->getInterfaceFormat());
algo->setName("volume");
m_process.pushBack(algo);
@ -91,12 +91,12 @@ bool audio::river::Interface::init(float _freq,
return true;
}
std::shared_ptr<audio::river::Interface> audio::river::Interface::create(float _freq,
ememory::SharedPtr<audio::river::Interface> audio::river::Interface::create(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<audio::river::io::Node>& _node,
const ememory::SharedPtr<audio::river::io::Node>& _node,
const ejson::Object& _config) {
std::shared_ptr<audio::river::Interface> out = std::shared_ptr<audio::river::Interface>(new audio::river::Interface());
ememory::SharedPtr<audio::river::Interface> out = ememory::SharedPtr<audio::river::Interface>(new audio::river::Interface());
out->init(_freq, _map, _format, _node, _config);
return out;
}
@ -104,7 +104,7 @@ std::shared_ptr<audio::river::Interface> audio::river::Interface::create(float _
audio::river::Interface::~Interface() {
//stop(true, true);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
//m_node->interfaceRemove(shared_from_this());
//m_node->interfaceRemove(sharedFromThis());
}
/*
bool audio::river::Interface::hasEndPoint() {
@ -120,11 +120,11 @@ void audio::river::Interface::setReadwrite() {
}
if (m_node->isInput() == true) {
m_process.removeIfLast<audio::drain::EndPoint>();
std::shared_ptr<audio::drain::EndPointRead> algo = audio::drain::EndPointRead::create();
ememory::SharedPtr<audio::drain::EndPointRead> algo = audio::drain::EndPointRead::create();
m_process.pushBack(algo);
} else {
m_process.removeIfFirst<audio::drain::EndPoint>();
std::shared_ptr<audio::drain::EndPointWrite> algo = audio::drain::EndPointWrite::create();
ememory::SharedPtr<audio::drain::EndPointWrite> algo = audio::drain::EndPointWrite::create();
m_process.pushFront(algo);
}
}
@ -137,7 +137,7 @@ void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _
}
m_process.removeAlgoDynamic();
m_process.removeIfFirst<audio::drain::EndPoint>();
std::shared_ptr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
ememory::SharedPtr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
m_process.pushFront(algo);
}
@ -149,7 +149,7 @@ void audio::river::Interface::setInputCallback(audio::drain::recordFunction _fun
}
m_process.removeAlgoDynamic();
m_process.removeIfLast<audio::drain::EndPoint>();
std::shared_ptr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
ememory::SharedPtr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
m_process.pushBack(algo);
}
@ -160,7 +160,7 @@ void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWri
return;
}
m_process.removeAlgoDynamic();
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
return;
}
@ -171,14 +171,14 @@ void audio::river::Interface::start(const audio::Time& _time) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_DEBUG("start [BEGIN]");
m_process.updateInterAlgo();
m_node->interfaceAdd(shared_from_this());
m_node->interfaceAdd(sharedFromThis());
RIVER_DEBUG("start [ END ]");
}
void audio::river::Interface::stop(bool _fast, bool _abort) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_DEBUG("stop [BEGIN]");
m_node->interfaceRemove(shared_from_this());
m_node->interfaceRemove(sharedFromThis());
RIVER_DEBUG("stop [ END]");
}
@ -197,7 +197,7 @@ bool audio::river::Interface::setParameter(const std::string& _filter, const std
RIVER_ERROR("Interface is not allowed to modify '" << _parameter << "' Volume just allowed to modify 'FLOW' volume");
return false;
}
std::shared_ptr<audio::drain::Algo> algo = m_process.get<audio::drain::Algo>(_filter);
ememory::SharedPtr<audio::drain::Algo> algo = m_process.get<audio::drain::Algo>(_filter);
if (algo == nullptr) {
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return false;
@ -209,7 +209,7 @@ bool audio::river::Interface::setParameter(const std::string& _filter, const std
std::string audio::river::Interface::getParameter(const std::string& _filter, const std::string& _parameter) const {
RIVER_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'");
std::string out;
std::shared_ptr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
if (algo == nullptr) {
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return "[ERROR]";
@ -221,7 +221,7 @@ std::string audio::river::Interface::getParameter(const std::string& _filter, co
std::string audio::river::Interface::getParameterProperty(const std::string& _filter, const std::string& _parameter) const {
RIVER_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'");
std::string out;
std::shared_ptr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
if (algo == nullptr) {
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return "[ERROR]";
@ -234,7 +234,7 @@ std::string audio::river::Interface::getParameterProperty(const std::string& _fi
void audio::river::Interface::write(const void* _value, size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process.updateInterAlgo();
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
return;
}
@ -286,7 +286,7 @@ size_t audio::river::Interface::size() const {
void audio::river::Interface::setBufferSize(size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) {
std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return;
@ -294,7 +294,7 @@ void audio::river::Interface::setBufferSize(size_t _nbChunk) {
algo->setBufferSize(_nbChunk);
return;
}
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return;
@ -305,7 +305,7 @@ void audio::river::Interface::setBufferSize(size_t _nbChunk) {
void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _time) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) {
std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return;
@ -313,7 +313,7 @@ void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _ti
algo->setBufferSize(_time);
return;
}
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return;
@ -324,14 +324,14 @@ void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _ti
size_t audio::river::Interface::getBufferSize() {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) {
std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0;
}
return algo->getBufferSize();
}
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0;
@ -342,14 +342,14 @@ size_t audio::river::Interface::getBufferSize() {
std::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) {
std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std::chrono::microseconds(0);
}
return algo->getBufferSizeMicrosecond();
}
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std::chrono::microseconds(0);
@ -360,14 +360,14 @@ std::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() {
size_t audio::river::Interface::getBufferFillSize() {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) {
std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0;
}
return algo->getBufferFillSize();
}
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0;
@ -379,14 +379,14 @@ size_t audio::river::Interface::getBufferFillSize() {
std::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond() {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) {
std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std::chrono::microseconds(0);
}
return algo->getBufferFillSizeMicrosecond();
}
std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std::chrono::microseconds(0);
@ -413,7 +413,7 @@ audio::Time audio::river::Interface::getCurrentTime() const {
void audio::river::Interface::addVolumeGroup(const std::string& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_DEBUG("addVolumeGroup(" << _name << ")");
std::shared_ptr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
if (algo == nullptr) {
m_process.removeAlgoDynamic();
// add all time the volume stage :
@ -427,10 +427,10 @@ void audio::river::Interface::addVolumeGroup(const std::string& _name) {
}
if (_name == "FLOW") {
// Local volume name
algo->addVolumeStage(std::make_shared<audio::drain::VolumeElement>(_name));
algo->addVolumeStage(ememory::makeShared<audio::drain::VolumeElement>(_name));
} else {
// get manager unique instance:
std::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
algo->addVolumeStage(mng->getVolumeGroup(_name));
}
}
@ -449,7 +449,7 @@ void audio::river::Interface::systemNeedOutputData(audio::Time _time, void* _dat
void audio::river::Interface::systemVolumeChange() {
std::unique_lock<std::recursive_mutex> lockProcess(m_mutex);
std::shared_ptr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
if (algo == nullptr) {
return;
}

View File

@ -11,7 +11,7 @@
#include <mutex>
#include <chrono>
#include <functional>
#include <memory>
#include <ememory/memory.h>
#include <audio/format.h>
#include <audio/channel.h>
#include <audio/drain/Process.h>
@ -39,7 +39,7 @@ namespace audio {
* @brief Interface is the basic handle to manage the input output stream
* @note To create this class see @ref audio::river::Manager class
*/
class Interface : public std::enable_shared_from_this<Interface> {
class Interface : public ememory::EnableSharedFromThis<Interface> {
friend class io::Node;
friend class io::NodeAirTAudio;
friend class io::NodeAEC;
@ -65,7 +65,7 @@ namespace audio {
bool init(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<audio::river::io::Node>& _node,
ememory::SharedPtr<audio::river::io::Node> _node,
const ejson::Object& _config);
/**
* @brief Factory of this interface (called by class audio::river::Manager)
@ -77,10 +77,10 @@ namespace audio {
* @return nullptr The configuration does not work.
* @return pointer The interface has been corectly created.
*/
static std::shared_ptr<Interface> create(float _freq,
static ememory::SharedPtr<Interface> create(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::shared_ptr<audio::river::io::Node>& _node,
const ememory::SharedPtr<audio::river::io::Node>& _node,
const ejson::Object& _config);
public:
/**
@ -116,7 +116,7 @@ namespace audio {
}
}
protected:
std::shared_ptr<audio::river::io::Node> m_node; //!< Hardware interface to/from stream audio flow.
ememory::SharedPtr<audio::river::io::Node> m_node; //!< Hardware interface to/from stream audio flow.
protected:
std::string m_name; //!< Name of the interface.
public:

View File

@ -14,12 +14,12 @@
#include <ejson/ejson.h>
static std::mutex g_mutex;
static std::vector<std::weak_ptr<audio::river::Manager> > g_listOfAllManager;
static std::vector<ememory::WeakPtr<audio::river::Manager> > g_listOfAllManager;
std::shared_ptr<audio::river::Manager> audio::river::Manager::create(const std::string& _applicationUniqueId) {
ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const std::string& _applicationUniqueId) {
std::unique_lock<std::mutex> lock(g_mutex);
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
std::shared_ptr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock();
ememory::SharedPtr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock();
if (tmp == nullptr) {
continue;
}
@ -28,7 +28,7 @@ std::shared_ptr<audio::river::Manager> audio::river::Manager::create(const std::
}
}
// create a new one:
std::shared_ptr<audio::river::Manager> out = std::shared_ptr<audio::river::Manager>(new audio::river::Manager(_applicationUniqueId));
ememory::SharedPtr<audio::river::Manager> out = ememory::SharedPtr<audio::river::Manager>(new audio::river::Manager(_applicationUniqueId));
// add it at the list:
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
if (g_listOfAllManager[iii].expired() == true) {
@ -53,7 +53,7 @@ audio::river::Manager::~Manager() {
std::vector<std::string> audio::river::Manager::getListStreamInput() {
std::vector<std::string> output;
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
} else {
@ -64,7 +64,7 @@ std::vector<std::string> audio::river::Manager::getListStreamInput() {
std::vector<std::string> audio::river::Manager::getListStreamOutput() {
std::vector<std::string> output;
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
} else {
@ -75,7 +75,7 @@ std::vector<std::string> audio::river::Manager::getListStreamOutput() {
std::vector<std::string> audio::river::Manager::getListStreamVirtual() {
std::vector<std::string> output;
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
} else {
@ -86,7 +86,7 @@ std::vector<std::string> audio::river::Manager::getListStreamVirtual() {
std::vector<std::string> audio::river::Manager::getListStream() {
std::vector<std::string> output;
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
} else {
@ -96,7 +96,7 @@ std::vector<std::string> audio::river::Manager::getListStream() {
}
bool audio::river::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return false;
@ -105,7 +105,7 @@ bool audio::river::Manager::setVolume(const std::string& _volumeName, float _val
}
float audio::river::Manager::getVolume(const std::string& _volumeName) const {
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return false;
@ -114,7 +114,7 @@ float audio::river::Manager::getVolume(const std::string& _volumeName) const {
}
std::pair<float,float> audio::river::Manager::getVolumeRange(const std::string& _volumeName) const {
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return std::make_pair<float,float>(0.0f,0.0f);
@ -123,7 +123,7 @@ std::pair<float,float> audio::river::Manager::getVolumeRange(const std::string&
}
void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute) {
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return;
@ -132,7 +132,7 @@ void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute)
}
bool audio::river::Manager::getMute(const std::string& _volumeName) const {
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return false;
@ -140,29 +140,29 @@ bool audio::river::Manager::getMute(const std::string& _volumeName) const {
return manager->getMute(_volumeName);
}
std::shared_ptr<audio::river::Interface> audio::river::Manager::createOutput(float _freq,
ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createOutput(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName,
const std::string& _options) {
// get global hardware interface:
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// get the output or input channel :
std::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName);
ememory::SharedPtr<audio::river::io::Node> node = manager->getNode(_streamName);
if (node == nullptr) {
RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream());
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
if (node->isOutput() != true) {
RIVER_ERROR("Can not Connect output on other thing than output ... for stream '" << _streamName << "'");;
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// create user iterface:
std::shared_ptr<audio::river::Interface> interface;
ememory::SharedPtr<audio::river::Interface> interface;
ejson::Object tmpOption = ejson::Object(_options);
tmpOption.add("io", ejson::String("output"));
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
@ -171,29 +171,29 @@ std::shared_ptr<audio::river::Interface> audio::river::Manager::createOutput(flo
return interface;
}
std::shared_ptr<audio::river::Interface> audio::river::Manager::createInput(float _freq,
ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createInput(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName,
const std::string& _options) {
// get global hardware interface:
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// get the output or input channel :
std::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName);
ememory::SharedPtr<audio::river::io::Node> node = manager->getNode(_streamName);
if (node == nullptr) {
RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream());
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
if (node->isInput() != true) {
RIVER_ERROR("Can not Connect input on other thing than input ... for stream '" << _streamName << "'");;
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// create user iterface:
std::shared_ptr<audio::river::Interface> interface;
ememory::SharedPtr<audio::river::Interface> interface;
ejson::Object tmpOption = ejson::Object(_options);
tmpOption.add("io", ejson::String("input"));
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
@ -203,29 +203,29 @@ std::shared_ptr<audio::river::Interface> audio::river::Manager::createInput(floa
}
std::shared_ptr<audio::river::Interface> audio::river::Manager::createFeedback(float _freq,
ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createFeedback(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName,
const std::string& _options) {
// get global hardware interface:
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... ");
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// get the output or input channel :
std::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName);
ememory::SharedPtr<audio::river::io::Node> node = manager->getNode(_streamName);
if (node == nullptr) {
RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream());
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
if (node->isOutput() != true) {
RIVER_ERROR("Can not Connect feedback on other thing than output ... for stream '" << _streamName << "'");;
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// create user iterface:
std::shared_ptr<audio::river::Interface> interface;
ememory::SharedPtr<audio::river::Interface> interface;
ejson::Object tmpOption = ejson::Object(_options);
tmpOption.add("io", ejson::String("feedback"));
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
@ -236,7 +236,7 @@ std::shared_ptr<audio::river::Interface> audio::river::Manager::createFeedback(f
void audio::river::Manager::generateDotAll(const std::string& _filename) {
// get global hardware interface:
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) {
RIVER_ERROR("Can not get the harware manager");
return;

View File

@ -7,7 +7,7 @@
#include <string>
#include <stdint.h>
#include <memory>
#include <ememory/memory.h>
#include <audio/river/Interface.h>
#include <audio/format.h>
#include <audio/channel.h>
@ -18,10 +18,10 @@ namespace audio {
/**
* @brief Audio interface manager : Single interface for every application that want to access on the Audio input/output
*/
class Manager : public std::enable_shared_from_this<Manager> {
class Manager : public ememory::EnableSharedFromThis<Manager> {
private:
const std::string& m_applicationUniqueId; //!< name of the application that open the Audio Interface.
std::vector<std::weak_ptr<audio::river::Interface> > m_listOpenInterface; //!< List of all open Stream.
std::vector<ememory::WeakPtr<audio::river::Interface> > m_listOpenInterface; //!< List of all open Stream.
protected:
/**
* @brief Constructor
@ -33,7 +33,7 @@ namespace audio {
* @param[in] _applicationUniqueId Unique name of the application
* @return Pointer on the manager or nullptr if an error occured
*/
static std::shared_ptr<audio::river::Manager> create(const std::string& _applicationUniqueId);
static ememory::SharedPtr<audio::river::Manager> create(const std::string& _applicationUniqueId);
/**
* @brief Destructor
*/
@ -106,7 +106,7 @@ namespace audio {
* @param[in] _options Json option to configure default resampling and many other things.
* @return a pointer on the interface
*/
virtual std::shared_ptr<Interface> createOutput(float _freq = 48000,
virtual ememory::SharedPtr<Interface> createOutput(float _freq = 48000,
const std::vector<audio::channel>& _map = std::vector<audio::channel>(),
audio::format _format = audio::format_int16,
const std::string& _streamName = "",
@ -120,7 +120,7 @@ namespace audio {
* @param[in] _options Json option to configure default resampling and many other things.
* @return a pointer on the interface
*/
virtual std::shared_ptr<Interface> createInput(float _freq = 48000,
virtual ememory::SharedPtr<Interface> createInput(float _freq = 48000,
const std::vector<audio::channel>& _map = std::vector<audio::channel>(),
audio::format _format = audio::format_int16,
const std::string& _streamName = "",
@ -134,7 +134,7 @@ namespace audio {
* @param[in] _options Json option to configure default resampling and many other things.
* @return a pointer on the interface
*/
virtual std::shared_ptr<Interface> createFeedback(float _freq = 48000,
virtual ememory::SharedPtr<Interface> createFeedback(float _freq = 48000,
const std::vector<audio::channel>& _map = std::vector<audio::channel>(),
audio::format _format = audio::format_int16,
const std::string& _streamName = "",

View File

@ -27,16 +27,16 @@ void audio::river::io::Group::createFrom(const ejson::Document& _obj, const std:
#ifdef AUDIO_RIVER_BUILD_ORCHESTRA
if ( ioType == "input"
|| ioType == "output") {
std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_obj.getKey(iii), tmpObject);
tmp->setGroup(shared_from_this());
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_obj.getKey(iii), tmpObject);
tmp->setGroup(sharedFromThis());
m_list.push_back(tmp);
}
#endif
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
if ( ioType == "PAinput"
|| ioType == "PAoutput") {
std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_obj.getKey(iii), tmpObject);
tmp->setGroup(shared_from_this());
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_obj.getKey(iii), tmpObject);
tmp->setGroup(sharedFromThis());
m_list.push_back(tmp);
}
#endif
@ -46,10 +46,10 @@ void audio::river::io::Group::createFrom(const ejson::Document& _obj, const std:
// Note : The interlink work only for alsa (NOW) and with AirTAudio...
if(m_list.size() > 1) {
#ifdef AUDIO_RIVER_BUILD_ORCHESTRA
std::shared_ptr<audio::river::io::NodeOrchestra> linkRef = std::dynamic_pointer_cast<audio::river::io::NodeOrchestra>(m_list[0]);
ememory::SharedPtr<audio::river::io::NodeOrchestra> linkRef = ememory::dynamicPointerCast<audio::river::io::NodeOrchestra>(m_list[0]);
for (size_t iii=1; iii<m_list.size(); ++iii) {
if (m_list[iii] != nullptr) {
std::shared_ptr<audio::river::io::NodeOrchestra> link = std::dynamic_pointer_cast<audio::river::io::NodeOrchestra>(m_list[iii]);
ememory::SharedPtr<audio::river::io::NodeOrchestra> link = ememory::dynamicPointerCast<audio::river::io::NodeOrchestra>(m_list[iii]);
linkRef->m_interface.isMasterOf(link->m_interface);
}
}
@ -59,7 +59,7 @@ void audio::river::io::Group::createFrom(const ejson::Document& _obj, const std:
// manage Link Between Nodes :
if (m_link != nullptr) {
RIVER_INFO("******** START LINK ************");
std::shared_ptr<audio::river::io::NodeOrchestra> link = std::dynamic_pointer_cast<audio::river::io::NodeOrchestra>(m_link);
ememory::SharedPtr<audio::river::io::NodeOrchestra> link = ememory::dynamicPointerCast<audio::river::io::NodeOrchestra>(m_link);
if (link == nullptr) {
RIVER_ERROR("Can not link 2 Interface with not the same type (reserved for HW interface)");
return;
@ -79,7 +79,7 @@ void audio::river::io::Group::createFrom(const ejson::Document& _obj, const std:
}
std::shared_ptr<audio::river::io::Node> audio::river::io::Group::getNode(const std::string& _name) {
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Group::getNode(const std::string& _name) {
for (size_t iii=0; iii<m_list.size(); ++iii) {
if (m_list[iii] != nullptr) {
if (m_list[iii]->getName() == _name) {
@ -87,7 +87,7 @@ std::shared_ptr<audio::river::io::Node> audio::river::io::Group::getNode(const s
}
}
}
return std::shared_ptr<audio::river::io::Node>();
return ememory::SharedPtr<audio::river::io::Node>();
}
void audio::river::io::Group::start() {

View File

@ -23,7 +23,7 @@ namespace audio {
* is stopped.
* @note For the Alsa interface a low level link is availlable with AirTAudio for Alsa (One thread)
*/
class Group : public std::enable_shared_from_this<Group> {
class Group : public ememory::EnableSharedFromThis<Group> {
public:
/**
* @brief Contructor. No special thing to do.
@ -36,7 +36,7 @@ namespace audio {
// TODO : ...
}
private:
std::vector< std::shared_ptr<Node> > m_list; //!< List of all node in the group
std::vector< ememory::SharedPtr<Node> > m_list; //!< List of all node in the group
public:
/**
* @brief Create a group with all node needed to syncronize together
@ -50,7 +50,7 @@ namespace audio {
* @return nullptr The node named _name was not found.
* @return pointer The node was find in this group.
*/
std::shared_ptr<audio::river::io::Node> getNode(const std::string& _name);
ememory::SharedPtr<audio::river::io::Node> getNode(const std::string& _name);
/**
* @brief Start the group.
* @note all sub-node will be started.

View File

@ -13,7 +13,7 @@
#include <audio/river/io/NodeOrchestra.h>
#include <audio/river/io/NodePortAudio.h>
#include <etk/os/FSNode.h>
#include <memory>
#include <ememory/memory.h>
#include <etk/types.h>
#include <utility>
@ -92,11 +92,11 @@ audio::river::io::Manager::~Manager() {
#endif
};
std::shared_ptr<audio::river::io::Manager> audio::river::io::Manager::getInstance() {
ememory::SharedPtr<audio::river::io::Manager> audio::river::io::Manager::getInstance() {
if (audio::river::isInit() == false) {
return std::shared_ptr<audio::river::io::Manager>();
return ememory::SharedPtr<audio::river::io::Manager>();
}
static std::shared_ptr<audio::river::io::Manager> manager(new Manager());
static ememory::SharedPtr<audio::river::io::Manager> manager(new Manager());
return manager;
}
@ -171,12 +171,12 @@ std::vector<std::string> audio::river::io::Manager::getListStream() {
return output;
}
std::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const std::string& _name) {
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(const std::string& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_WARNING("Get node : " << _name);
// search in the standalone list :
for (size_t iii=0; iii<m_list.size(); ++iii) {
std::shared_ptr<audio::river::io::Node> tmppp = m_list[iii].lock();
ememory::SharedPtr<audio::river::io::Node> tmppp = m_list[iii].lock();
if ( tmppp != nullptr
&& _name == tmppp->getName()) {
RIVER_WARNING(" find it ... in standalone");
@ -185,11 +185,11 @@ std::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const
}
// search in the group list:
{
for (std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
for (std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
it != m_listGroup.end();
++it) {
if (it->second != nullptr) {
std::shared_ptr<audio::river::io::Node> node = it->second->getNode(_name);
ememory::SharedPtr<audio::river::io::Node> node = it->second->getNode(_name);
if (node != nullptr) {
RIVER_WARNING(" find it ... in group: " << it->first);
return node;
@ -210,10 +210,10 @@ std::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const
|| ioType == "output"
|| ioType == "PAinput"
|| ioType == "PAoutput") ) {
std::shared_ptr<audio::river::io::Group> tmpGroup = getGroup(groupName);
ememory::SharedPtr<audio::river::io::Group> tmpGroup = getGroup(groupName);
if (tmpGroup == nullptr) {
RIVER_WARNING("Can not get group ... '" << groupName << "'");
return std::shared_ptr<audio::river::io::Node>();
return ememory::SharedPtr<audio::river::io::Node>();
}
return tmpGroup->getNode(_name);
} else {
@ -225,7 +225,7 @@ std::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const
if ( ioType == "input"
|| ioType == "output") {
#ifdef AUDIO_RIVER_BUILD_ORCHESTRA
std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_name, tmpObject);
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_name, tmpObject);
m_list.push_back(tmp);
return tmp;
#else
@ -235,7 +235,7 @@ std::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const
if ( ioType == "PAinput"
|| ioType == "PAoutput") {
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_name, tmpObject);
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_name, tmpObject);
m_list.push_back(tmp);
return tmp;
#else
@ -243,26 +243,26 @@ std::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const
#endif
}
if (ioType == "aec") {
std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeAEC::create(_name, tmpObject);
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeAEC::create(_name, tmpObject);
m_list.push_back(tmp);
return tmp;
}
if (ioType == "muxer") {
std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeMuxer::create(_name, tmpObject);
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeMuxer::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 std::shared_ptr<audio::river::io::Node>();
return ememory::SharedPtr<audio::river::io::Node>();
}
std::shared_ptr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const std::string& _name) {
ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const std::string& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (_name == "") {
RIVER_ERROR("Try to create an audio group with no name ...");
return std::shared_ptr<audio::drain::VolumeElement>();
return ememory::SharedPtr<audio::drain::VolumeElement>();
}
for (size_t iii=0; iii<m_volumeGroup.size(); ++iii) {
if (m_volumeGroup[iii] == nullptr) {
@ -273,14 +273,14 @@ std::shared_ptr<audio::drain::VolumeElement> audio::river::io::Manager::getVolum
}
}
RIVER_DEBUG("Add a new volume group : '" << _name << "'");
std::shared_ptr<audio::drain::VolumeElement> tmpVolume = std::make_shared<audio::drain::VolumeElement>(_name);
ememory::SharedPtr<audio::drain::VolumeElement> tmpVolume = ememory::makeShared<audio::drain::VolumeElement>(_name);
m_volumeGroup.push_back(tmpVolume);
return tmpVolume;
}
bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
if (volume == nullptr) {
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
return false;
@ -292,7 +292,7 @@ bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float
}
volume->setVolume(_valuedB);
for (size_t iii=0; iii<m_list.size(); ++iii) {
std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) {
val->volumeChange();
}
@ -302,7 +302,7 @@ bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float
float audio::river::io::Manager::getVolume(const std::string& _volumeName) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
if (volume == nullptr) {
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
return 0.0f;
@ -316,14 +316,14 @@ std::pair<float,float> audio::river::io::Manager::getVolumeRange(const std::stri
void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mute) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
if (volume == nullptr) {
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
return;
}
volume->setMute(_mute);
for (size_t iii=0; iii<m_list.size(); ++iii) {
std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) {
val->volumeChange();
}
@ -332,7 +332,7 @@ void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mu
bool audio::river::io::Manager::getMute(const std::string& _volumeName) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
if (volume == nullptr) {
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
return false;
@ -354,14 +354,14 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
{
// standalone
for (size_t iii=0; iii<m_list.size(); ++iii) {
std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) {
if (val->isHarwareNode() == true) {
val->generateDot(node);
}
}
}
for (std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
for (std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
it != m_listGroup.end();
++it) {
if (it->second != nullptr) {
@ -373,14 +373,14 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
{
// standalone
for (size_t iii=0; iii<m_list.size(); ++iii) {
std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) {
if (val->isHarwareNode() == false) {
val->generateDot(node);
}
}
}
for (std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
for (std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
it != m_listGroup.end();
++it) {
if (it->second != nullptr) {
@ -394,16 +394,16 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
RIVER_INFO("Generate the DOT files: " << node << " (DONE)");
}
std::shared_ptr<audio::river::io::Group> audio::river::io::Manager::getGroup(const std::string& _name) {
ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const std::string& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::shared_ptr<audio::river::io::Group> out;
std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name);
ememory::SharedPtr<audio::river::io::Group> out;
std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name);
if (it == m_listGroup.end()) {
RIVER_INFO("Create a new group: " << _name << " (START)");
out = std::make_shared<audio::river::io::Group>();
out = ememory::makeShared<audio::river::io::Group>();
if (out != nullptr) {
out->createFrom(m_config, _name);
std::pair<std::string, std::shared_ptr<audio::river::io::Group> > plop(std::string(_name), out);
std::pair<std::string, ememory::SharedPtr<audio::river::io::Group> > plop(std::string(_name), out);
m_listGroup.insert(plop);
RIVER_INFO("Create a new group: " << _name << " ( END )");
} else {

View File

@ -13,7 +13,7 @@
#include <mutex>
#include <chrono>
#include <functional>
#include <memory>
#include <ememory/memory.h>
#include <audio/format.h>
#include <audio/channel.h>
#include <ejson/ejson.h>
@ -28,7 +28,7 @@ namespace audio {
* @brief Internal sigleton of all Flow hadware and virtuals.
* @note this class will be initialize by the audio::river::init() function at the start of the application.
*/
class Manager : public std::enable_shared_from_this<Manager> {
class Manager : public ememory::EnableSharedFromThis<Manager> {
private:
mutable std::recursive_mutex m_mutex; //!< prevent multiple access
private:
@ -37,7 +37,7 @@ namespace audio {
*/
Manager();
public:
static std::shared_ptr<Manager> getInstance();
static ememory::SharedPtr<Manager> getInstance();
/**
* @brief Destructor
*/
@ -58,24 +58,24 @@ namespace audio {
void unInit();
private:
ejson::Document m_config; //!< harware configuration
std::vector<std::shared_ptr<audio::river::io::Node> > m_listKeepAlive; //!< list of all Node that might be keep alive sone/all time
std::vector<std::weak_ptr<audio::river::io::Node> > m_list; //!< List of all IO node
std::vector<ememory::SharedPtr<audio::river::io::Node> > m_listKeepAlive; //!< list of all Node that might be keep alive sone/all time
std::vector<ememory::WeakPtr<audio::river::io::Node> > m_list; //!< List of all IO node
public:
/**
* @brief Get a node with his name (the name is set in the description file.
* @param[in] _name Name of the node
* @return Pointer on the noe or a nullptr if the node does not exist in the file or an error occured.
*/
std::shared_ptr<audio::river::io::Node> getNode(const std::string& _name);
ememory::SharedPtr<audio::river::io::Node> getNode(const std::string& _name);
private:
std::vector<std::shared_ptr<audio::drain::VolumeElement> > m_volumeGroup; //!< List of All global volume in the Low level interface.
std::vector<ememory::SharedPtr<audio::drain::VolumeElement> > m_volumeGroup; //!< List of All global volume in the Low level interface.
public:
/**
* @brief Get a volume in the global list of vilume
* @param[in] _name Name of the volume.
* @return pointer on the requested volume (create it if does not exist). nullptr if the name is empty.
*/
std::shared_ptr<audio::drain::VolumeElement> getVolumeGroup(const std::string& _name);
ememory::SharedPtr<audio::drain::VolumeElement> getVolumeGroup(const std::string& _name);
/**
* @brief Get all input audio stream.
* @return a list of all availlables input stream name
@ -138,13 +138,13 @@ namespace audio {
*/
void generateDot(const std::string& _filename);
private:
std::map<std::string, std::shared_ptr<audio::river::io::Group> > m_listGroup; //!< List of all groups
std::map<std::string, ememory::SharedPtr<audio::river::io::Group> > m_listGroup; //!< List of all groups
/**
* @brief get a low level interface group.
* @param[in] _name Name of the group.
* @return Pointer on the requested group or nullptr if the group does not existed.
*/
std::shared_ptr<audio::river::io::Group> getGroup(const std::string& _name);
ememory::SharedPtr<audio::river::io::Group> getGroup(const std::string& _name);
};
}

View File

@ -119,7 +119,7 @@ size_t audio::river::io::Node::getNumberOfInterface(enum audio::river::modeInter
size_t audio::river::io::Node::getNumberOfInterfaceAvaillable(enum audio::river::modeInterface _interfaceType) {
size_t out = 0;
for (size_t iii=0; iii<m_listAvaillable.size(); ++iii) {
std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
ememory::SharedPtr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) {
continue;
}
@ -130,8 +130,8 @@ size_t audio::river::io::Node::getNumberOfInterfaceAvaillable(enum audio::river:
return out;
}
void audio::river::io::Node::registerAsRemote(const std::shared_ptr<audio::river::Interface>& _interface) {
std::vector<std::weak_ptr<audio::river::Interface> >::iterator it = m_listAvaillable.begin();
void audio::river::io::Node::registerAsRemote(const ememory::SharedPtr<audio::river::Interface>& _interface) {
std::vector<ememory::WeakPtr<audio::river::Interface> >::iterator it = m_listAvaillable.begin();
while (it != m_listAvaillable.end()) {
if (it->expired() == true) {
it = m_listAvaillable.erase(it);
@ -142,7 +142,7 @@ void audio::river::io::Node::registerAsRemote(const std::shared_ptr<audio::river
m_listAvaillable.push_back(_interface);
}
void audio::river::io::Node::interfaceAdd(const std::shared_ptr<audio::river::Interface>& _interface) {
void audio::river::io::Node::interfaceAdd(const ememory::SharedPtr<audio::river::Interface>& _interface) {
{
std::unique_lock<std::mutex> lock(m_mutex);
for (size_t iii=0; iii<m_list.size(); ++iii) {
@ -158,7 +158,7 @@ void audio::river::io::Node::interfaceAdd(const std::shared_ptr<audio::river::In
}
}
void audio::river::io::Node::interfaceRemove(const std::shared_ptr<audio::river::Interface>& _interface) {
void audio::river::io::Node::interfaceRemove(const ememory::SharedPtr<audio::river::Interface>& _interface) {
{
std::unique_lock<std::mutex> lock(m_mutex);
for (size_t iii=0; iii< m_list.size(); ++iii) {
@ -178,7 +178,7 @@ void audio::river::io::Node::interfaceRemove(const std::shared_ptr<audio::river:
void audio::river::io::Node::volumeChange() {
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
std::shared_ptr<audio::river::Interface> node = m_listAvaillable[iii].lock();
ememory::SharedPtr<audio::river::Interface> node = m_listAvaillable[iii].lock();
if (node != nullptr) {
node->systemVolumeChange();
}
@ -320,7 +320,7 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
if (m_listAvaillable[iii].expired() == true) {
continue;
}
std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
ememory::SharedPtr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) {
continue;
}
@ -346,7 +346,7 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
void audio::river::io::Node::startInGroup() {
std::shared_ptr<audio::river::io::Group> group = m_group.lock();
ememory::SharedPtr<audio::river::io::Group> group = m_group.lock();
if (group != nullptr) {
group->start();
} else {
@ -355,7 +355,7 @@ void audio::river::io::Node::startInGroup() {
}
void audio::river::io::Node::stopInGroup() {
std::shared_ptr<audio::river::io::Group> group = m_group.lock();
ememory::SharedPtr<audio::river::io::Group> group = m_group.lock();
if (group != nullptr) {
group->stop();
} else {

View File

@ -11,7 +11,7 @@
#include <stdint.h>
#include <chrono>
#include <functional>
#include <memory>
#include <ememory/memory.h>
#include <audio/format.h>
#include <audio/channel.h>
#include "Manager.h"
@ -29,7 +29,7 @@ namespace audio {
* @brief A node is the base for input/output interface. When a output id declared, we automaticly have a feedback associated.
* this manage the muxing of data for output an the demuxing for input.
*/
class Node : public std::enable_shared_from_this<Node> {
class Node : public ememory::EnableSharedFromThis<Node> {
friend class audio::river::io::Group;
protected:
uint32_t m_uid; //!< uniqueNodeID use for debug an dot generation.
@ -82,10 +82,10 @@ namespace audio {
}
}
protected:
std::shared_ptr<audio::drain::VolumeElement> m_volume; //!< if a volume is set it is set here ... for hardware interface only.
ememory::SharedPtr<audio::drain::VolumeElement> m_volume; //!< if a volume is set it is set here ... for hardware interface only.
protected:
std::vector<std::weak_ptr<audio::river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node
std::vector<std::shared_ptr<audio::river::Interface> > m_list; //!< List of all connected interface at this node.
std::vector<ememory::WeakPtr<audio::river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node
std::vector<ememory::SharedPtr<audio::river::Interface> > m_list; //!< List of all connected interface at this node.
/**
* @brief Get the number of interface with a specific type.
* @param[in] _interfaceType Type of the interface.
@ -109,20 +109,20 @@ namespace audio {
public:
/**
* @brief Register an interface that can connect on it. (might be done in the Interface Init)
* @note We keep a std::weak_ptr. this is the reason why we do not have a remove.
* @note We keep a ememory::WeakPtr. this is the reason why we do not have a remove.
* @param[in] _interface Pointer on the interface to register.
*/
void registerAsRemote(const std::shared_ptr<audio::river::Interface>& _interface);
void registerAsRemote(const ememory::SharedPtr<audio::river::Interface>& _interface);
/**
* @brief Request this interface might receve/send dat on the flow. (start/resume)
* @param[in] _interface Pointer on the interface to register.
*/
void interfaceAdd(const std::shared_ptr<audio::river::Interface>& _interface);
void interfaceAdd(const ememory::SharedPtr<audio::river::Interface>& _interface);
/**
* @brief Un-register the interface as an availlable read/write interface. (suspend/stop)
* @param[in] _interface Pointer on the interface to register.
*/
void interfaceRemove(const std::shared_ptr<audio::river::Interface>& _interface);
void interfaceRemove(const ememory::SharedPtr<audio::river::Interface>& _interface);
protected:
std::string m_name; //!< Name of the interface
public:
@ -151,13 +151,13 @@ namespace audio {
return !m_isInput;
}
protected:
std::weak_ptr<audio::river::io::Group> m_group; //!< reference on the group. If available.
ememory::WeakPtr<audio::river::io::Group> m_group; //!< reference on the group. If available.
public:
/**
* @brief Set this node in a low level group.
* @param[in] _group Group reference.
*/
void setGroup(std::shared_ptr<audio::river::io::Group> _group) {
void setGroup(ememory::SharedPtr<audio::river::io::Group> _group) {
m_group = _group;
}
protected:
@ -182,7 +182,7 @@ namespace audio {
* @brief If this iss an hardware interface we can have a resuest of the volume stage:
* @return pointer on the requested volume.
*/
const std::shared_ptr<audio::drain::VolumeElement>& getVolume() {
const ememory::SharedPtr<audio::drain::VolumeElement>& getVolume() {
return m_volume;
}
public:

View File

@ -7,14 +7,14 @@
#include <audio/river/io/NodeAEC.h>
#include <audio/river/debug.h>
#include <etk/types.h>
#include <memory>
#include <ememory/memory.h>
#include <functional>
std::shared_ptr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const std::string& _name, const ejson::Object& _config) {
return std::shared_ptr<audio::river::io::NodeAEC>(new audio::river::io::NodeAEC(_name, _config));
ememory::SharedPtr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const std::string& _name, const ejson::Object& _config) {
return ememory::SharedPtr<audio::river::io::NodeAEC>(new audio::river::io::NodeAEC(_name, _config));
}
std::shared_ptr<audio::river::Interface> audio::river::io::NodeAEC::createInput(float _freq,
ememory::SharedPtr<audio::river::Interface> audio::river::io::NodeAEC::createInput(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _objectName,
@ -23,7 +23,7 @@ std::shared_ptr<audio::river::Interface> audio::river::io::NodeAEC::createInput(
const ejson::Object tmppp = m_config[_objectName].toObject();
if (tmppp.exist() == false) {
RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config.getKeys());
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
std::string streamName = tmppp["map-on"].toString().get("error");
@ -33,14 +33,14 @@ std::shared_ptr<audio::river::Interface> audio::river::io::NodeAEC::createInput(
if ( type != "input"
&& type != "feedback") {
RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type);
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// get global hardware interface:
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
// get the output or input channel :
std::shared_ptr<audio::river::io::Node> node = manager->getNode(streamName);
ememory::SharedPtr<audio::river::io::Node> node = manager->getNode(streamName);
// create user iterface:
std::shared_ptr<audio::river::Interface> interface;
ememory::SharedPtr<audio::river::Interface> interface;
interface = audio::river::Interface::create(_freq, _map, _format, node, tmppp);
if (interface != nullptr) {
interface->setName(_name);
@ -343,7 +343,7 @@ void audio::river::io::NodeAEC::generateDot(etk::FSNode& _node) {
if (m_listAvaillable[iii].expired() == true) {
continue;
}
std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
ememory::SharedPtr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) {
continue;
}

View File

@ -25,7 +25,7 @@ namespace audio {
* @param[in] _name Name of the node.
* @param[in] _config Configuration of the node.
*/
static std::shared_ptr<NodeAEC> create(const std::string& _name, const ejson::Object& _config);
static ememory::SharedPtr<NodeAEC> create(const std::string& _name, const ejson::Object& _config);
/**
* @brief Destructor
*/
@ -33,8 +33,8 @@ namespace audio {
protected:
virtual void start();
virtual void stop();
std::shared_ptr<audio::river::Interface> m_interfaceMicrophone; //!< Interface on the Microphone.
std::shared_ptr<audio::river::Interface> m_interfaceFeedBack; //!< Interface on the feedback of speaker.
ememory::SharedPtr<audio::river::Interface> m_interfaceMicrophone; //!< Interface on the Microphone.
ememory::SharedPtr<audio::river::Interface> m_interfaceFeedBack; //!< Interface on the feedback of speaker.
/**
* @brief Internal: create an input with the specific parameter:
* @param[in] _freq Frequency.
@ -44,7 +44,7 @@ namespace audio {
* @param[in] _name
* @return Interfae Pointer.
*/
std::shared_ptr<audio::river::Interface> createInput(float _freq,
ememory::SharedPtr<audio::river::Interface> createInput(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName,

View File

@ -8,7 +8,7 @@
#include <audio/river/io/NodeFile.h>
#include <audio/river/debug.h>
#include <memory>
#include <ememory/memory.h>
int32_t audio::river::io::NodeFile::recordCallback(const void* _inputBuffer,
const audio::Time& _timeInput,
@ -34,8 +34,8 @@ int32_t audio::river::io::NodeFile::playbackCallback(void* _outputBuffer,
std::shared_ptr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const std::string& _name, const ejson::Object& _config) {
return std::shared_ptr<audio::river::io::NodeFile>(new audio::river::io::NodeFile(_name, _config));
ememory::SharedPtr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const std::string& _name, const ejson::Object& _config) {
return ememory::SharedPtr<audio::river::io::NodeFile>(new audio::river::io::NodeFile(_name, _config));
}
audio::river::io::NodeFile::NodeFile(const std::string& _name, const ejson::Object& _config) :
@ -253,7 +253,7 @@ void audio::river::io::NodeFile::start() {
}
m_alive = true;
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") );
m_thread = std::make_shared<std::thread>(&audio::river::io::NodeFile::threadCallback2, this);
m_thread = ememory::makeShared<std::thread>(&audio::river::io::NodeFile::threadCallback2, this);
m_time = audio::Time::now();
}

View File

@ -26,7 +26,7 @@ namespace audio {
*/
NodeFile(const std::string& _name, const ejson::Object& _config);
public:
static std::shared_ptr<NodeFile> create(const std::string& _name, const ejson::Object& _config);
static ememory::SharedPtr<NodeFile> create(const std::string& _name, const ejson::Object& _config);
/**
* @brief Destructor
*/
@ -41,7 +41,7 @@ namespace audio {
uint32_t m_sampleRate; //!< Sample Rate of the Raw file
audio::format m_format; //!< Format of the file
std::vector<audio::channel> m_map; //!< Map of the file
std::shared_ptr<std::thread> m_thread; //!< playing thread of the flow
ememory::SharedPtr<std::thread> m_thread; //!< playing thread of the flow
std::atomic<bool> m_alive; //!< thread is active
protected:
virtual void start();

View File

@ -7,14 +7,14 @@
#include <audio/river/io/NodeMuxer.h>
#include <audio/river/debug.h>
#include <etk/types.h>
#include <memory>
#include <ememory/memory.h>
#include <functional>
std::shared_ptr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const std::string& _name, const ejson::Object& _config) {
return std::shared_ptr<audio::river::io::NodeMuxer>(new audio::river::io::NodeMuxer(_name, _config));
ememory::SharedPtr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const std::string& _name, const ejson::Object& _config) {
return ememory::SharedPtr<audio::river::io::NodeMuxer>(new audio::river::io::NodeMuxer(_name, _config));
}
std::shared_ptr<audio::river::Interface> audio::river::io::NodeMuxer::createInput(float _freq,
ememory::SharedPtr<audio::river::Interface> audio::river::io::NodeMuxer::createInput(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _objectName,
@ -23,7 +23,7 @@ std::shared_ptr<audio::river::Interface> audio::river::io::NodeMuxer::createInpu
const ejson::Object tmppp = m_config[_objectName].toObject();
if (tmppp.exist() == false) {
RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config.getKeys());
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
std::string streamName = tmppp["map-on"].toString().get("error");
@ -33,14 +33,14 @@ std::shared_ptr<audio::river::Interface> audio::river::io::NodeMuxer::createInpu
if ( type != "input"
&& type != "feedback") {
RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type);
return std::shared_ptr<audio::river::Interface>();
return ememory::SharedPtr<audio::river::Interface>();
}
// get global hardware interface:
std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
// get the output or input channel :
std::shared_ptr<audio::river::io::Node> node = manager->getNode(streamName);
ememory::SharedPtr<audio::river::io::Node> node = manager->getNode(streamName);
// create user iterface:
std::shared_ptr<audio::river::Interface> interface;
ememory::SharedPtr<audio::river::Interface> interface;
interface = audio::river::Interface::create(_freq, _map, _format, node, tmppp);
if (interface != nullptr) {
interface->setName(_name);
@ -457,7 +457,7 @@ void audio::river::io::NodeMuxer::generateDot(etk::FSNode& _node) {
if (m_listAvaillable[iii].expired() == true) {
continue;
}
std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
ememory::SharedPtr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) {
continue;
}

View File

@ -20,7 +20,7 @@ namespace audio {
*/
NodeMuxer(const std::string& _name, const ejson::Object& _config);
public:
static std::shared_ptr<NodeMuxer> create(const std::string& _name, const ejson::Object& _config);
static ememory::SharedPtr<NodeMuxer> create(const std::string& _name, const ejson::Object& _config);
/**
* @brief Destructor
*/
@ -28,9 +28,9 @@ namespace audio {
protected:
virtual void start();
virtual void stop();
std::shared_ptr<audio::river::Interface> m_interfaceInput1;
std::shared_ptr<audio::river::Interface> m_interfaceInput2;
std::shared_ptr<audio::river::Interface> createInput(float _freq,
ememory::SharedPtr<audio::river::Interface> m_interfaceInput1;
ememory::SharedPtr<audio::river::Interface> m_interfaceInput2;
ememory::SharedPtr<audio::river::Interface> createInput(float _freq,
const std::vector<audio::channel>& _map,
audio::format _format,
const std::string& _streamName,

View File

@ -8,7 +8,7 @@
#include <audio/river/io/NodeOrchestra.h>
#include <audio/river/debug.h>
#include <memory>
#include <ememory/memory.h>
int32_t audio::river::io::NodeOrchestra::recordCallback(const void* _inputBuffer,
const audio::Time& _timeInput,
@ -34,8 +34,8 @@ int32_t audio::river::io::NodeOrchestra::playbackCallback(void* _outputBuffer,
std::shared_ptr<audio::river::io::NodeOrchestra> audio::river::io::NodeOrchestra::create(const std::string& _name, const ejson::Object& _config) {
return std::shared_ptr<audio::river::io::NodeOrchestra>(new audio::river::io::NodeOrchestra(_name, _config));
ememory::SharedPtr<audio::river::io::NodeOrchestra> audio::river::io::NodeOrchestra::create(const std::string& _name, const ejson::Object& _config) {
return ememory::SharedPtr<audio::river::io::NodeOrchestra>(new audio::river::io::NodeOrchestra(_name, _config));
}
audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const ejson::Object& _config) :

View File

@ -26,7 +26,7 @@ namespace audio {
*/
NodeOrchestra(const std::string& _name, const ejson::Object& _config);
public:
static std::shared_ptr<NodeOrchestra> create(const std::string& _name, const ejson::Object& _config);
static ememory::SharedPtr<NodeOrchestra> create(const std::string& _name, const ejson::Object& _config);
/**
* @brief Destructor
*/

View File

@ -8,7 +8,7 @@
#include <audio/river/io/NodePortAudio.h>
#include <audio/river/debug.h>
#include <memory>
#include <ememory/memory.h>
#include <audio/Time.h>
#include <audio/Duration.h>
@ -53,8 +53,8 @@ int32_t audio::river::io::NodePortAudio::duplexCallback(const void* _inputBuffer
}
std::shared_ptr<audio::river::io::NodePortAudio> audio::river::io::NodePortAudio::create(const std::string& _name, const ejson::Object& _config) {
return std::shared_ptr<audio::river::io::NodePortAudio>(new audio::river::io::NodePortAudio(_name, _config));
ememory::SharedPtr<audio::river::io::NodePortAudio> audio::river::io::NodePortAudio::create(const std::string& _name, const ejson::Object& _config) {
return ememory::SharedPtr<audio::river::io::NodePortAudio>(new audio::river::io::NodePortAudio(_name, _config));
}
audio::river::io::NodePortAudio::NodePortAudio(const std::string& _name, const ejson::Object& _config) :

View File

@ -23,7 +23,7 @@ namespace audio {
*/
NodePortAudio(const std::string& _name, const ejson::Object& _config);
public:
static std::shared_ptr<NodePortAudio> create(const std::string& _name, const ejson::Object& _config);
static ememory::SharedPtr<NodePortAudio> create(const std::string& _name, const ejson::Object& _config);
/**
* @brief Destructor
*/

View File

@ -18,7 +18,7 @@ void audio::river::init(const std::string& _filename) {
river_isInit = true;
river_configFile = _filename;
RIVER_DEBUG("init RIVER :" << river_configFile);
std::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
if (mng != nullptr) {
mng->init(river_configFile);
}
@ -32,7 +32,7 @@ void audio::river::initString(const std::string& _config) {
river_isInit = true;
river_configFile = _config;
RIVER_DEBUG("init RIVER with config.");
std::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
if (mng != nullptr) {
mng->initString(river_configFile);
}
@ -45,7 +45,7 @@ void audio::river::unInit() {
if (river_isInit == true) {
river_isInit = false;
RIVER_DEBUG("un-init RIVER.");
std::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
ememory::SharedPtr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
if (mng != nullptr) {
RIVER_ERROR("Can not get on the RIVER hardware manager !!!");
mng->unInit();

View File

@ -44,19 +44,19 @@ void appl::Windows::init() {
}
m_composer->loadFromString(composition);
setSubWidget(m_composer);
subBind(ewol::widget::Button, "bt-record", signalPressed, shared_from_this(), &appl::Windows::onCallbackRecord);
subBind(ewol::widget::Button, "bt-generate", signalPressed, shared_from_this(), &appl::Windows::onCallbackGenerate);
subBind(ewol::widget::Button, "bt-record", signalPressed, sharedFromThis(), &appl::Windows::onCallbackRecord);
subBind(ewol::widget::Button, "bt-generate", signalPressed, sharedFromThis(), &appl::Windows::onCallbackGenerate);
}
void appl::Windows::onCallbackRecord() {
std::shared_ptr<audio::river::widget::TemporalViewer> tmpDisp = std::dynamic_pointer_cast<audio::river::widget::TemporalViewer>(getSubObjectNamed("displayer"));
ememory::SharedPtr<audio::river::widget::TemporalViewer> tmpDisp = ememory::dynamicPointerCast<audio::river::widget::TemporalViewer>(getSubObjectNamed("displayer"));
if (tmpDisp != nullptr) {
tmpDisp->recordToggle();
}
}
void appl::Windows::onCallbackGenerate() {
std::shared_ptr<audio::river::widget::TemporalViewer> tmpDisp = std::dynamic_pointer_cast<audio::river::widget::TemporalViewer>(getSubObjectNamed("displayer"));
ememory::SharedPtr<audio::river::widget::TemporalViewer> tmpDisp = ememory::dynamicPointerCast<audio::river::widget::TemporalViewer>(getSubObjectNamed("displayer"));
if (tmpDisp != nullptr) {
tmpDisp->generateToggle();
}

View File

@ -11,7 +11,7 @@
namespace appl {
class Windows : public ewol::widget::Windows {
private:
std::shared_ptr<ewol::widget::Composer> m_composer;
ememory::SharedPtr<ewol::widget::Composer> m_composer;
protected:
Windows();
void init();

View File

@ -47,7 +47,7 @@ class MainApplication : public ewol::context::Application {
audio::river::widget::TemporalViewer::createManagerWidget(_context.getWidgetManager());
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create();
ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> Init APPL (END)");

View File

@ -88,9 +88,9 @@ int main(int _argc, const char **_argv) {
audio::river::init(configFile);
}
// Create the River manager for tha application or part of the application.
std::shared_ptr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read");
ememory::SharedPtr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read");
// create interface:
std::shared_ptr<audio::river::Interface> interface;
ememory::SharedPtr<audio::river::Interface> interface;
//Get the generic input:
interface = manager->createInput(48000,
std::vector<audio::channel>(),

View File

@ -70,9 +70,9 @@ int main(int _argc, const char **_argv) {
// initialize river interface
audio::river::initString(configurationRiver);
// Create the River manager for tha application or part of the application.
std::shared_ptr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read");
ememory::SharedPtr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read");
// create interface:
std::shared_ptr<audio::river::Interface> interface;
ememory::SharedPtr<audio::river::Interface> interface;
//Get the generic input:
interface = manager->createOutput(48000,
std::vector<audio::channel>(),

View File

@ -9,12 +9,12 @@ namespace river_test_aec {
class Linker {
private:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interfaceOut;
std::shared_ptr<audio::river::Interface> m_interfaceIn;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interfaceOut;
ememory::SharedPtr<audio::river::Interface> m_interfaceIn;
audio::drain::CircularBuffer m_buffer;
public:
Linker(std::shared_ptr<audio::river::Manager> _manager, const std::string& _input, const std::string& _output) :
Linker(ememory::SharedPtr<audio::river::Manager> _manager, const std::string& _input, const std::string& _output) :
m_manager(_manager) {
//Set stereo output:
std::vector<audio::channel> channelMap;
@ -195,10 +195,10 @@ namespace river_test_aec {
TEST(TestUser, testAECManually) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
std::shared_ptr<Linker> processLink1 = std::make_shared<Linker>(manager, "microphone-clean", "speaker");
std::shared_ptr<Linker> processLink2 = std::make_shared<Linker>(manager, "microphone", "speaker-test");
ememory::SharedPtr<Linker> processLink1 = ememory::makeShared<Linker>(manager, "microphone-clean", "speaker");
ememory::SharedPtr<Linker> processLink2 = ememory::makeShared<Linker>(manager, "microphone", "speaker-test");
processLink1->start();
processLink2->start();
sleep(30);

View File

@ -10,10 +10,10 @@
namespace river_test_echo_delay {
class TestClass {
private:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interfaceOut;
std::shared_ptr<audio::river::Interface> m_interfaceIn;
std::shared_ptr<audio::river::Interface> m_interfaceFB;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interfaceOut;
ememory::SharedPtr<audio::river::Interface> m_interfaceIn;
ememory::SharedPtr<audio::river::Interface> m_interfaceFB;
double m_phase;
double m_freq;
int32_t m_nextSampleCount;
@ -28,7 +28,7 @@ namespace river_test_echo_delay {
int16_t m_volumeInputMin;
float m_gain;
public:
TestClass(std::shared_ptr<audio::river::Manager> _manager) :
TestClass(ememory::SharedPtr<audio::river::Manager> _manager) :
m_manager(_manager),
m_phase(0),
m_freq(400),
@ -413,9 +413,9 @@ namespace river_test_echo_delay {
TEST(TestTime, testDelay) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
std::shared_ptr<TestClass> process = std::make_shared<TestClass>(manager);
ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager);
process->run();
process.reset();
usleep(500000);

View File

@ -23,15 +23,15 @@ namespace river_test_format {
"}\n";
class testOutCallbackType {
private:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interface;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interface;
double m_phase;
float m_freq;
int32_t m_nbChannels;
float m_generateFreq;
public:
testOutCallbackType(const std::shared_ptr<audio::river::Manager>& _manager,
testOutCallbackType(const ememory::SharedPtr<audio::river::Manager>& _manager,
float _freq=48000.0f,
int32_t _nbChannels=2,
audio::format _format=audio::format_int16) :
@ -146,9 +146,9 @@ namespace river_test_format {
class testResampling : public ::testing::TestWithParam<float> {};
TEST_P(testResampling, base) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
process->run();
process.reset();
usleep(500000);
@ -163,9 +163,9 @@ namespace river_test_format {
class testFormat : public ::testing::TestWithParam<audio::format> {};
TEST_P(testFormat, base) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, 2, GetParam());
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, 2, GetParam());
process->run();
process.reset();
usleep(500000);
@ -179,9 +179,9 @@ namespace river_test_format {
class testChannels : public ::testing::TestWithParam<int32_t> {};
TEST_P(testChannels, base) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
process->run();
process.reset();
usleep(500000);
@ -194,7 +194,7 @@ namespace river_test_format {
TEST(TestALL, testChannelsFormatResampling) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test convert flaot to output (callback mode)");
std::vector<float> listFreq;
@ -223,7 +223,7 @@ namespace river_test_format {
for (size_t ccc=0; ccc<listChannel.size(); ++ccc) {
for (size_t iii=0; iii<listFormat.size(); ++iii) {
TEST_INFO("freq=" << listFreq[fff] << " channel=" << listChannel[ccc] << " format=" << getFormatString(listFormat[iii]));
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]);
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]);
process->run();
process.reset();
usleep(500000);

View File

@ -10,12 +10,12 @@
namespace river_test_muxer {
class TestClass {
private:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interfaceIn;
std::shared_ptr<audio::river::Interface> m_interfaceOut;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interfaceIn;
ememory::SharedPtr<audio::river::Interface> m_interfaceOut;
double m_phase;
public:
TestClass(std::shared_ptr<audio::river::Manager> _manager) :
TestClass(ememory::SharedPtr<audio::river::Manager> _manager) :
m_manager(_manager),
m_phase(0) {
std::vector<audio::channel> channelMap;
@ -163,9 +163,9 @@ namespace river_test_muxer {
TEST(TestMuxer, testMuxing) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
std::shared_ptr<TestClass> process = std::make_shared<TestClass>(manager);
ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager);
process->run();
process.reset();
usleep(500000);

View File

@ -9,11 +9,11 @@ namespace river_test_playback_callback {
class testOutCallback {
public:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interface;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interface;
double m_phase;
public:
testOutCallback(std::shared_ptr<audio::river::Manager> _manager, const std::string& _io="speaker") :
testOutCallback(ememory::SharedPtr<audio::river::Manager> _manager, const std::string& _io="speaker") :
m_manager(_manager),
m_phase(0) {
//Set stereo output:
@ -89,11 +89,11 @@ namespace river_test_playback_callback {
TEST(TestALL, testOutputCallBack) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (callback mode)");
std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker");
ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker");
ASSERT_NE(process, nullptr);
process->run();
process.reset();
@ -103,11 +103,11 @@ namespace river_test_playback_callback {
TEST(TestALL, testOutputCallBackPulse) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (callback mode)");
std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-pulse");
ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-pulse");
process->run();
process.reset();
usleep(500000);
@ -116,11 +116,11 @@ namespace river_test_playback_callback {
TEST(TestALL, testOutputCallBackJack) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (callback mode)");
std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-jack");
ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-jack");
process->run();
process.reset();
usleep(500000);

View File

@ -25,10 +25,10 @@ namespace river_test_playback_write {
class testOutWrite {
public:
std::vector<audio::channel> m_channelMap;
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interface;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interface;
public:
testOutWrite(std::shared_ptr<audio::river::Manager> _manager) :
testOutWrite(ememory::SharedPtr<audio::river::Manager> _manager) :
m_manager(_manager) {
//Set stereo output:
m_channelMap.push_back(audio::channel_frontLeft);
@ -86,11 +86,11 @@ namespace river_test_playback_write {
TEST(TestALL, testOutputWrite) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (write mode)");
std::shared_ptr<testOutWrite> process = std::make_shared<testOutWrite>(manager);
ememory::SharedPtr<testOutWrite> process = ememory::makeShared<testOutWrite>(manager);
process->run();
process.reset();
usleep(500000);
@ -99,11 +99,11 @@ namespace river_test_playback_write {
class testOutWriteCallback {
public:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interface;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interface;
double m_phase;
public:
testOutWriteCallback(std::shared_ptr<audio::river::Manager> _manager) :
testOutWriteCallback(ememory::SharedPtr<audio::river::Manager> _manager) :
m_manager(_manager),
m_phase(0) {
std::vector<audio::channel> channelMap;
@ -163,11 +163,11 @@ namespace river_test_playback_write {
TEST(TestALL, testOutputWriteWithCallback) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (write with callback event mode)");
std::shared_ptr<testOutWriteCallback> process = std::make_shared<testOutWriteCallback>(manager);
ememory::SharedPtr<testOutWriteCallback> process = ememory::makeShared<testOutWriteCallback>(manager);
process->run();
process.reset();
usleep(500000);

View File

@ -25,10 +25,10 @@ namespace river_test_record_callback {
class testInCallback {
public:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interface;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interface;
public:
testInCallback(std::shared_ptr<audio::river::Manager> _manager, const std::string& _input="microphone") :
testInCallback(ememory::SharedPtr<audio::river::Manager> _manager, const std::string& _input="microphone") :
m_manager(_manager) {
//Set stereo output:
std::vector<audio::channel> channelMap;
@ -82,10 +82,10 @@ namespace river_test_record_callback {
TEST(TestALL, testInputCallBack) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test input (callback mode)");
std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
ememory::SharedPtr<testInCallback> process = ememory::makeShared<testInCallback>(manager);
process->run();
process.reset();
usleep(500000);

View File

@ -24,11 +24,11 @@ namespace river_test_volume {
class testCallbackVolume {
private:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interface;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interface;
double m_phase;
public:
testCallbackVolume(std::shared_ptr<audio::river::Manager> _manager) :
testCallbackVolume(ememory::SharedPtr<audio::river::Manager> _manager) :
m_manager(_manager),
m_phase(0) {
//Set stereo output:
@ -119,9 +119,9 @@ namespace river_test_volume {
TEST(TestALL, testVolume) {
audio::river::initString(configurationRiver);
std::shared_ptr<audio::river::Manager> manager;
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
std::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager);
ememory::SharedPtr<testCallbackVolume> process = ememory::makeShared<testCallbackVolume>(manager);
process->run();
process.reset();
usleep(500000);

View File

@ -43,8 +43,8 @@ namespace audio {
virtual void onRegenerateDisplay();
virtual void periodicCall(const ewol::event::Time& _event);
private:
std::shared_ptr<audio::river::Manager> m_manager;
std::shared_ptr<audio::river::Interface> m_interface;
ememory::SharedPtr<audio::river::Manager> m_manager;
ememory::SharedPtr<audio::river::Interface> m_interface;
void onDataReceived(const void* _data,
const audio::Time& _time,
size_t _nbChunk,