[DEV] update of external of elog and ethread

This commit is contained in:
Edouard DUPIN 2016-03-08 21:29:34 +01:00
parent dd2e5240e3
commit e7d5b421c3
39 changed files with 536 additions and 536 deletions

View File

@ -27,8 +27,8 @@ audio::river::Interface::Interface(void) :
bool audio::river::Interface::init(float _freq, bool audio::river::Interface::init(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std11::shared_ptr<audio::river::io::Node>& _node, const std::shared_ptr<audio::river::io::Node>& _node,
const std11::shared_ptr<const ejson::Object>& _config) { const std::shared_ptr<const ejson::Object>& _config) {
std::vector<audio::channel> map(_map); std::vector<audio::channel> map(_map);
m_node = _node; m_node = _node;
m_config = _config; m_config = _config;
@ -57,10 +57,10 @@ bool audio::river::Interface::init(float _freq,
&& m_mode == audio::river::modeInterface_input) { && m_mode == audio::river::modeInterface_input) {
m_process.setInputConfig(m_node->getInterfaceFormat()); m_process.setInputConfig(m_node->getInterfaceFormat());
// Add volume only if the Low level has a volume (otherwise it will be added by the application) // Add volume only if the Low level has a volume (otherwise it will be added by the application)
std11::shared_ptr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume(); std::shared_ptr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume();
if (tmpVolume != nullptr) { if (tmpVolume != nullptr) {
// add all time the volume stage : // add all time the volume stage :
std11::shared_ptr<audio::drain::Volume> algo = audio::drain::Volume::create(); std::shared_ptr<audio::drain::Volume> algo = audio::drain::Volume::create();
//algo->setInputFormat(m_node->getInterfaceFormat()); //algo->setInputFormat(m_node->getInterfaceFormat());
algo->setName("volume"); algo->setName("volume");
m_process.pushBack(algo); m_process.pushBack(algo);
@ -72,10 +72,10 @@ bool audio::river::Interface::init(float _freq,
&& m_mode == audio::river::modeInterface_output) { && m_mode == audio::river::modeInterface_output) {
m_process.setInputConfig(audio::drain::IOFormatInterface(map, _format, _freq)); 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) // Add volume only if the Low level has a volume (otherwise it will be added by the application)
std11::shared_ptr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume(); std::shared_ptr<audio::drain::VolumeElement> tmpVolume = m_node->getVolume();
if (tmpVolume != nullptr) { if (tmpVolume != nullptr) {
// add all time the volume stage : // add all time the volume stage :
std11::shared_ptr<audio::drain::Volume> algo = audio::drain::Volume::create(); std::shared_ptr<audio::drain::Volume> algo = audio::drain::Volume::create();
//algo->setOutputFormat(m_node->getInterfaceFormat()); //algo->setOutputFormat(m_node->getInterfaceFormat());
algo->setName("volume"); algo->setName("volume");
m_process.pushBack(algo); m_process.pushBack(algo);
@ -95,19 +95,19 @@ bool audio::river::Interface::init(float _freq,
return true; return true;
} }
std11::shared_ptr<audio::river::Interface> audio::river::Interface::create(float _freq, std::shared_ptr<audio::river::Interface> audio::river::Interface::create(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std11::shared_ptr<audio::river::io::Node>& _node, const std::shared_ptr<audio::river::io::Node>& _node,
const std11::shared_ptr<const ejson::Object>& _config) { const std::shared_ptr<const ejson::Object>& _config) {
std11::shared_ptr<audio::river::Interface> out = std11::shared_ptr<audio::river::Interface>(new audio::river::Interface()); std::shared_ptr<audio::river::Interface> out = std::shared_ptr<audio::river::Interface>(new audio::river::Interface());
out->init(_freq, _map, _format, _node, _config); out->init(_freq, _map, _format, _node, _config);
return out; return out;
} }
audio::river::Interface::~Interface() { audio::river::Interface::~Interface() {
//stop(true, true); //stop(true, true);
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
//m_node->interfaceRemove(shared_from_this()); //m_node->interfaceRemove(shared_from_this());
} }
/* /*
@ -116,7 +116,7 @@ bool audio::river::Interface::hasEndPoint() {
} }
*/ */
void audio::river::Interface::setReadwrite() { void audio::river::Interface::setReadwrite() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process.removeAlgoDynamic(); m_process.removeAlgoDynamic();
if (m_process.hasType<audio::drain::EndPoint>() ) { if (m_process.hasType<audio::drain::EndPoint>() ) {
RIVER_ERROR("Endpoint is already present ==> can not change"); RIVER_ERROR("Endpoint is already present ==> can not change");
@ -124,47 +124,47 @@ void audio::river::Interface::setReadwrite() {
} }
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
m_process.removeIfLast<audio::drain::EndPoint>(); m_process.removeIfLast<audio::drain::EndPoint>();
std11::shared_ptr<audio::drain::EndPointRead> algo = audio::drain::EndPointRead::create(); std::shared_ptr<audio::drain::EndPointRead> algo = audio::drain::EndPointRead::create();
m_process.pushBack(algo); m_process.pushBack(algo);
} else { } else {
m_process.removeIfFirst<audio::drain::EndPoint>(); m_process.removeIfFirst<audio::drain::EndPoint>();
std11::shared_ptr<audio::drain::EndPointWrite> algo = audio::drain::EndPointWrite::create(); std::shared_ptr<audio::drain::EndPointWrite> algo = audio::drain::EndPointWrite::create();
m_process.pushFront(algo); m_process.pushFront(algo);
} }
} }
void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _function) { void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _function) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_mode != audio::river::modeInterface_output) { if (m_mode != audio::river::modeInterface_output) {
RIVER_ERROR("Can not set output endpoint on other than a output IO"); RIVER_ERROR("Can not set output endpoint on other than a output IO");
return; return;
} }
m_process.removeAlgoDynamic(); m_process.removeAlgoDynamic();
m_process.removeIfFirst<audio::drain::EndPoint>(); m_process.removeIfFirst<audio::drain::EndPoint>();
std11::shared_ptr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function); std::shared_ptr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
m_process.pushFront(algo); m_process.pushFront(algo);
} }
void audio::river::Interface::setInputCallback(audio::drain::recordFunction _function) { void audio::river::Interface::setInputCallback(audio::drain::recordFunction _function) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_mode == audio::river::modeInterface_output) { if (m_mode == audio::river::modeInterface_output) {
RIVER_ERROR("Can not set output endpoint on other than a input or feedback IO"); RIVER_ERROR("Can not set output endpoint on other than a input or feedback IO");
return; return;
} }
m_process.removeAlgoDynamic(); m_process.removeAlgoDynamic();
m_process.removeIfLast<audio::drain::EndPoint>(); m_process.removeIfLast<audio::drain::EndPoint>();
std11::shared_ptr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function); std::shared_ptr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
m_process.pushBack(algo); m_process.pushBack(algo);
} }
void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWrite _function) { void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWrite _function) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_mode != audio::river::modeInterface_output) { if (m_mode != audio::river::modeInterface_output) {
RIVER_ERROR("Can not set output endpoint on other than a output IO"); RIVER_ERROR("Can not set output endpoint on other than a output IO");
return; return;
} }
m_process.removeAlgoDynamic(); m_process.removeAlgoDynamic();
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
return; return;
} }
@ -172,7 +172,7 @@ void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWri
} }
void audio::river::Interface::start(const audio::Time& _time) { void audio::river::Interface::start(const audio::Time& _time) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_DEBUG("start [BEGIN]"); RIVER_DEBUG("start [BEGIN]");
m_process.updateInterAlgo(); m_process.updateInterAlgo();
m_node->interfaceAdd(shared_from_this()); m_node->interfaceAdd(shared_from_this());
@ -180,14 +180,14 @@ void audio::river::Interface::start(const audio::Time& _time) {
} }
void audio::river::Interface::stop(bool _fast, bool _abort) { void audio::river::Interface::stop(bool _fast, bool _abort) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_DEBUG("stop [BEGIN]"); RIVER_DEBUG("stop [BEGIN]");
m_node->interfaceRemove(shared_from_this()); m_node->interfaceRemove(shared_from_this());
RIVER_DEBUG("stop [ END]"); RIVER_DEBUG("stop [ END]");
} }
void audio::river::Interface::abort() { void audio::river::Interface::abort() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_DEBUG("abort [BEGIN]"); RIVER_DEBUG("abort [BEGIN]");
// TODO :... // TODO :...
RIVER_DEBUG("abort [ END ]"); RIVER_DEBUG("abort [ END ]");
@ -201,7 +201,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"); RIVER_ERROR("Interface is not allowed to modify '" << _parameter << "' Volume just allowed to modify 'FLOW' volume");
return false; return false;
} }
std11::shared_ptr<audio::drain::Algo> algo = m_process.get<audio::drain::Algo>(_filter); std::shared_ptr<audio::drain::Algo> algo = m_process.get<audio::drain::Algo>(_filter);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ..."); RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return false; return false;
@ -213,7 +213,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 { std::string audio::river::Interface::getParameter(const std::string& _filter, const std::string& _parameter) const {
RIVER_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'"); RIVER_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'");
std::string out; std::string out;
std11::shared_ptr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter); std::shared_ptr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ..."); RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return "[ERROR]"; return "[ERROR]";
@ -225,7 +225,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 { std::string audio::river::Interface::getParameterProperty(const std::string& _filter, const std::string& _parameter) const {
RIVER_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'"); RIVER_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'");
std::string out; std::string out;
std11::shared_ptr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter); std::shared_ptr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ..."); RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return "[ERROR]"; return "[ERROR]";
@ -236,9 +236,9 @@ std::string audio::river::Interface::getParameterProperty(const std::string& _fi
} }
void audio::river::Interface::write(const void* _value, size_t _nbChunk) { void audio::river::Interface::write(const void* _value, size_t _nbChunk) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process.updateInterAlgo(); m_process.updateInterAlgo();
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
return; return;
} }
@ -271,14 +271,14 @@ std::vector<int16_t> audio::river::Interface::read(size_t _nbChunk) {
#endif #endif
void audio::river::Interface::read(void* _value, size_t _nbChunk) { void audio::river::Interface::read(void* _value, size_t _nbChunk) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process.updateInterAlgo(); m_process.updateInterAlgo();
// TODO :... // TODO :...
} }
size_t audio::river::Interface::size() const { size_t audio::river::Interface::size() const {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
// TODO :... // TODO :...
return 0; return 0;
} }
@ -288,9 +288,9 @@ size_t audio::river::Interface::size() const {
void audio::river::Interface::setBufferSize(size_t _nbChunk) { void audio::river::Interface::setBufferSize(size_t _nbChunk) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
std11::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return; return;
@ -298,7 +298,7 @@ void audio::river::Interface::setBufferSize(size_t _nbChunk) {
algo->setBufferSize(_nbChunk); algo->setBufferSize(_nbChunk);
return; return;
} }
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return; return;
@ -306,10 +306,10 @@ void audio::river::Interface::setBufferSize(size_t _nbChunk) {
algo->setBufferSize(_nbChunk); algo->setBufferSize(_nbChunk);
} }
void audio::river::Interface::setBufferSize(const std11::chrono::microseconds& _time) { void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _time) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
std11::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return; return;
@ -317,7 +317,7 @@ void audio::river::Interface::setBufferSize(const std11::chrono::microseconds& _
algo->setBufferSize(_time); algo->setBufferSize(_time);
return; return;
} }
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request set buffer size for Interface that is not READ or WRITE mode ...");
return; return;
@ -326,16 +326,16 @@ void audio::river::Interface::setBufferSize(const std11::chrono::microseconds& _
} }
size_t audio::river::Interface::getBufferSize() { size_t audio::river::Interface::getBufferSize() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
std11::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0; return 0;
} }
return algo->getBufferSize(); return algo->getBufferSize();
} }
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0; return 0;
@ -343,35 +343,35 @@ size_t audio::river::Interface::getBufferSize() {
return algo->getBufferSize(); return algo->getBufferSize();
} }
std11::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() { std::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
std11::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std11::chrono::microseconds(0); return std::chrono::microseconds(0);
} }
return algo->getBufferSizeMicrosecond(); return algo->getBufferSizeMicrosecond();
} }
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std11::chrono::microseconds(0); return std::chrono::microseconds(0);
} }
return algo->getBufferSizeMicrosecond(); return algo->getBufferSizeMicrosecond();
} }
size_t audio::river::Interface::getBufferFillSize() { size_t audio::river::Interface::getBufferFillSize() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
std11::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0; return 0;
} }
return algo->getBufferFillSize(); return algo->getBufferFillSize();
} }
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return 0; return 0;
@ -380,20 +380,20 @@ size_t audio::river::Interface::getBufferFillSize() {
} }
std11::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond() { std::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
std11::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); std::shared_ptr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std11::chrono::microseconds(0); return std::chrono::microseconds(0);
} }
return algo->getBufferFillSizeMicrosecond(); return algo->getBufferFillSizeMicrosecond();
} }
std11::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); std::shared_ptr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ..."); RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
return std11::chrono::microseconds(0); return std::chrono::microseconds(0);
} }
return algo->getBufferFillSizeMicrosecond(); return algo->getBufferFillSizeMicrosecond();
} }
@ -401,23 +401,23 @@ std11::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecon
void audio::river::Interface::clearInternalBuffer() { void audio::river::Interface::clearInternalBuffer() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process.updateInterAlgo(); m_process.updateInterAlgo();
// TODO :... // TODO :...
} }
audio::Time audio::river::Interface::getCurrentTime() const { audio::Time audio::river::Interface::getCurrentTime() const {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
// TODO :... // TODO :...
return audio::Time(); return audio::Time();
return audio::Time::now(); return audio::Time::now();
} }
void audio::river::Interface::addVolumeGroup(const std::string& _name) { void audio::river::Interface::addVolumeGroup(const std::string& _name) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
RIVER_DEBUG("addVolumeGroup(" << _name << ")"); RIVER_DEBUG("addVolumeGroup(" << _name << ")");
std11::shared_ptr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume"); std::shared_ptr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
if (algo == nullptr) { if (algo == nullptr) {
m_process.removeAlgoDynamic(); m_process.removeAlgoDynamic();
// add all time the volume stage : // add all time the volume stage :
@ -431,29 +431,29 @@ void audio::river::Interface::addVolumeGroup(const std::string& _name) {
} }
if (_name == "FLOW") { if (_name == "FLOW") {
// Local volume name // Local volume name
algo->addVolumeStage(std11::make_shared<audio::drain::VolumeElement>(_name)); algo->addVolumeStage(std::make_shared<audio::drain::VolumeElement>(_name));
} else { } else {
// get manager unique instance: // get manager unique instance:
std11::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> mng = audio::river::io::Manager::getInstance();
algo->addVolumeStage(mng->getVolumeGroup(_name)); algo->addVolumeStage(mng->getVolumeGroup(_name));
} }
} }
void audio::river::Interface::systemNewInputData(audio::Time _time, const void* _data, size_t _nbChunk) { void audio::river::Interface::systemNewInputData(audio::Time _time, const void* _data, size_t _nbChunk) {
std11::unique_lock<std11::recursive_mutex> lockProcess(m_mutex); std::unique_lock<std::recursive_mutex> lockProcess(m_mutex);
void * tmpData = const_cast<void*>(_data); void * tmpData = const_cast<void*>(_data);
m_process.push(_time, tmpData, _nbChunk); m_process.push(_time, tmpData, _nbChunk);
} }
void audio::river::Interface::systemNeedOutputData(audio::Time _time, void* _data, size_t _nbChunk, size_t _chunkSize) { void audio::river::Interface::systemNeedOutputData(audio::Time _time, void* _data, size_t _nbChunk, size_t _chunkSize) {
std11::unique_lock<std11::recursive_mutex> lockProcess(m_mutex); std::unique_lock<std::recursive_mutex> lockProcess(m_mutex);
//RIVER_INFO("time : " << _time); //RIVER_INFO("time : " << _time);
m_process.pull(_time, _data, _nbChunk, _chunkSize); m_process.pull(_time, _data, _nbChunk, _chunkSize);
} }
void audio::river::Interface::systemVolumeChange() { void audio::river::Interface::systemVolumeChange() {
std11::unique_lock<std11::recursive_mutex> lockProcess(m_mutex); std::unique_lock<std::recursive_mutex> lockProcess(m_mutex);
std11::shared_ptr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume"); std::shared_ptr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
if (algo == nullptr) { if (algo == nullptr) {
return; return;
} }

View File

@ -39,7 +39,7 @@ namespace audio {
* @brief Interface is the basic handle to manage the input output stream * @brief Interface is the basic handle to manage the input output stream
* @note To create this class see @ref audio::river::Manager class * @note To create this class see @ref audio::river::Manager class
*/ */
class Interface : public std11::enable_shared_from_this<Interface> { class Interface : public std::enable_shared_from_this<Interface> {
friend class io::Node; friend class io::Node;
friend class io::NodeAirTAudio; friend class io::NodeAirTAudio;
friend class io::NodeAEC; friend class io::NodeAEC;
@ -65,8 +65,8 @@ namespace audio {
bool init(float _freq, bool init(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std11::shared_ptr<audio::river::io::Node>& _node, const std::shared_ptr<audio::river::io::Node>& _node,
const std11::shared_ptr<const ejson::Object>& _config); const std::shared_ptr<const ejson::Object>& _config);
/** /**
* @brief Factory of this interface (called by class audio::river::Manager) * @brief Factory of this interface (called by class audio::river::Manager)
* @param[in] _freq Frequency. * @param[in] _freq Frequency.
@ -77,19 +77,19 @@ namespace audio {
* @return nullptr The configuration does not work. * @return nullptr The configuration does not work.
* @return pointer The interface has been corectly created. * @return pointer The interface has been corectly created.
*/ */
static std11::shared_ptr<Interface> create(float _freq, static std::shared_ptr<Interface> create(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std11::shared_ptr<audio::river::io::Node>& _node, const std::shared_ptr<audio::river::io::Node>& _node,
const std11::shared_ptr<const ejson::Object>& _config); const std::shared_ptr<const ejson::Object>& _config);
public: public:
/** /**
* @brief Destructor * @brief Destructor
*/ */
virtual ~Interface(); virtual ~Interface();
protected: protected:
mutable std11::recursive_mutex m_mutex; //!< Local mutex to protect data mutable std::recursive_mutex m_mutex; //!< Local mutex to protect data
std11::shared_ptr<const ejson::Object> m_config; //!< configuration set by the user. std::shared_ptr<const ejson::Object> m_config; //!< configuration set by the user.
protected: protected:
enum modeInterface m_mode; //!< interface type (input/output/feedback) enum modeInterface m_mode; //!< interface type (input/output/feedback)
public: public:
@ -116,7 +116,7 @@ namespace audio {
} }
} }
protected: protected:
std11::shared_ptr<audio::river::io::Node> m_node; //!< Hardware interface to/from stream audio flow. std::shared_ptr<audio::river::io::Node> m_node; //!< Hardware interface to/from stream audio flow.
protected: protected:
std::string m_name; //!< Name of the interface. std::string m_name; //!< Name of the interface.
public: public:
@ -245,7 +245,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs * @brief Set buffer size size of the buffer with the stored time in µs
* @param[in] _time Time in microsecond of the buffer * @param[in] _time Time in microsecond of the buffer
*/ */
virtual void setBufferSize(const std11::chrono::microseconds& _time); virtual void setBufferSize(const std::chrono::microseconds& _time);
/** /**
* @brief get buffer size in chunk number * @brief get buffer size in chunk number
* @return Number of chunk that can be written in the buffer * @return Number of chunk that can be written in the buffer
@ -255,7 +255,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs * @brief Set buffer size size of the buffer with the stored time in µs
* @return Time in microsecond that can be written in the buffer * @return Time in microsecond that can be written in the buffer
*/ */
virtual std11::chrono::microseconds getBufferSizeMicrosecond(); virtual std::chrono::microseconds getBufferSizeMicrosecond();
/** /**
* @brief Get buffer size filled in chunk number * @brief Get buffer size filled in chunk number
* @return Number of chunk in the buffer (that might be read/write) * @return Number of chunk in the buffer (that might be read/write)
@ -265,7 +265,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs * @brief Set buffer size size of the buffer with the stored time in µs
* @return Time in microsecond of the buffer (that might be read/write) * @return Time in microsecond of the buffer (that might be read/write)
*/ */
virtual std11::chrono::microseconds getBufferFillSizeMicrosecond(); virtual std::chrono::microseconds getBufferFillSizeMicrosecond();
/** /**
* @brief Remove internal Buffer * @brief Remove internal Buffer
*/ */

View File

@ -15,13 +15,13 @@
#undef __class__ #undef __class__
#define __class__ "Manager" #define __class__ "Manager"
static std11::mutex g_mutex; static std::mutex g_mutex;
static std::vector<std11::weak_ptr<audio::river::Manager> > g_listOfAllManager; static std::vector<std::weak_ptr<audio::river::Manager> > g_listOfAllManager;
std11::shared_ptr<audio::river::Manager> audio::river::Manager::create(const std::string& _applicationUniqueId) { std::shared_ptr<audio::river::Manager> audio::river::Manager::create(const std::string& _applicationUniqueId) {
std11::unique_lock<std11::mutex> lock(g_mutex); std::unique_lock<std::mutex> lock(g_mutex);
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) { for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
std11::shared_ptr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock(); std::shared_ptr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock();
if (tmp == nullptr) { if (tmp == nullptr) {
continue; continue;
} }
@ -30,7 +30,7 @@ std11::shared_ptr<audio::river::Manager> audio::river::Manager::create(const std
} }
} }
// create a new one: // create a new one:
std11::shared_ptr<audio::river::Manager> out = std11::shared_ptr<audio::river::Manager>(new audio::river::Manager(_applicationUniqueId)); std::shared_ptr<audio::river::Manager> out = std::shared_ptr<audio::river::Manager>(new audio::river::Manager(_applicationUniqueId));
// add it at the list: // add it at the list:
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) { for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
if (g_listOfAllManager[iii].expired() == true) { if (g_listOfAllManager[iii].expired() == true) {
@ -55,7 +55,7 @@ audio::river::Manager::~Manager() {
std::vector<std::string> audio::river::Manager::getListStreamInput() { std::vector<std::string> audio::river::Manager::getListStreamInput() {
std::vector<std::string> output; std::vector<std::string> output;
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
} else { } else {
@ -66,7 +66,7 @@ std::vector<std::string> audio::river::Manager::getListStreamInput() {
std::vector<std::string> audio::river::Manager::getListStreamOutput() { std::vector<std::string> audio::river::Manager::getListStreamOutput() {
std::vector<std::string> output; std::vector<std::string> output;
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
} else { } else {
@ -77,7 +77,7 @@ std::vector<std::string> audio::river::Manager::getListStreamOutput() {
std::vector<std::string> audio::river::Manager::getListStreamVirtual() { std::vector<std::string> audio::river::Manager::getListStreamVirtual() {
std::vector<std::string> output; std::vector<std::string> output;
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
} else { } else {
@ -88,7 +88,7 @@ std::vector<std::string> audio::river::Manager::getListStreamVirtual() {
std::vector<std::string> audio::river::Manager::getListStream() { std::vector<std::string> audio::river::Manager::getListStream() {
std::vector<std::string> output; std::vector<std::string> output;
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
} else { } else {
@ -98,7 +98,7 @@ std::vector<std::string> audio::river::Manager::getListStream() {
} }
bool audio::river::Manager::setVolume(const std::string& _volumeName, float _valuedB) { bool audio::river::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return false; return false;
@ -107,7 +107,7 @@ bool audio::river::Manager::setVolume(const std::string& _volumeName, float _val
} }
float audio::river::Manager::getVolume(const std::string& _volumeName) const { float audio::river::Manager::getVolume(const std::string& _volumeName) const {
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return false; return false;
@ -116,7 +116,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::pair<float,float> audio::river::Manager::getVolumeRange(const std::string& _volumeName) const {
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return std::make_pair<float,float>(0.0f,0.0f); return std::make_pair<float,float>(0.0f,0.0f);
@ -125,7 +125,7 @@ std::pair<float,float> audio::river::Manager::getVolumeRange(const std::string&
} }
void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute) { void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute) {
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return; return;
@ -134,7 +134,7 @@ void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute)
} }
bool audio::river::Manager::getMute(const std::string& _volumeName) const { bool audio::river::Manager::getMute(const std::string& _volumeName) const {
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return false; return false;
@ -142,30 +142,30 @@ bool audio::river::Manager::getMute(const std::string& _volumeName) const {
return manager->getMute(_volumeName); return manager->getMute(_volumeName);
} }
std11::shared_ptr<audio::river::Interface> audio::river::Manager::createOutput(float _freq, std::shared_ptr<audio::river::Interface> audio::river::Manager::createOutput(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::string& _streamName, const std::string& _streamName,
const std::string& _options) { const std::string& _options) {
// get global hardware interface: // get global hardware interface:
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// get the output or input channel : // get the output or input channel :
std11::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName); std::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName);
if (node == nullptr) { if (node == nullptr) {
RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream()); RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream());
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
if (node->isOutput() != true) { if (node->isOutput() != true) {
RIVER_ERROR("Can not Connect output on other thing than output ... for stream '" << _streamName << "'");; RIVER_ERROR("Can not Connect output on other thing than output ... for stream '" << _streamName << "'");;
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// create user iterface: // create user iterface:
std11::shared_ptr<audio::river::Interface> interface; std::shared_ptr<audio::river::Interface> interface;
std11::shared_ptr<ejson::Object> tmpOption = ejson::Object::create(_options); std::shared_ptr<ejson::Object> tmpOption = ejson::Object::create(_options);
tmpOption->addString("io", "output"); tmpOption->addString("io", "output");
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption); interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
// store it in a list (needed to apply some parameters). // store it in a list (needed to apply some parameters).
@ -173,30 +173,30 @@ std11::shared_ptr<audio::river::Interface> audio::river::Manager::createOutput(f
return interface; return interface;
} }
std11::shared_ptr<audio::river::Interface> audio::river::Manager::createInput(float _freq, std::shared_ptr<audio::river::Interface> audio::river::Manager::createInput(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::string& _streamName, const std::string& _streamName,
const std::string& _options) { const std::string& _options) {
// get global hardware interface: // get global hardware interface:
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// get the output or input channel : // get the output or input channel :
std11::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName); std::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName);
if (node == nullptr) { if (node == nullptr) {
RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream()); RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream());
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
if (node->isInput() != true) { if (node->isInput() != true) {
RIVER_ERROR("Can not Connect input on other thing than input ... for stream '" << _streamName << "'");; RIVER_ERROR("Can not Connect input on other thing than input ... for stream '" << _streamName << "'");;
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// create user iterface: // create user iterface:
std11::shared_ptr<audio::river::Interface> interface; std::shared_ptr<audio::river::Interface> interface;
std11::shared_ptr<ejson::Object> tmpOption = ejson::Object::create(_options); std::shared_ptr<ejson::Object> tmpOption = ejson::Object::create(_options);
tmpOption->addString("io", "input"); tmpOption->addString("io", "input");
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption); interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
// store it in a list (needed to apply some parameters). // store it in a list (needed to apply some parameters).
@ -205,30 +205,30 @@ std11::shared_ptr<audio::river::Interface> audio::river::Manager::createInput(fl
} }
std11::shared_ptr<audio::river::Interface> audio::river::Manager::createFeedback(float _freq, std::shared_ptr<audio::river::Interface> audio::river::Manager::createFeedback(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::string& _streamName, const std::string& _streamName,
const std::string& _options) { const std::string& _options) {
// get global hardware interface: // get global hardware interface:
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Unable to load harware IO manager ... "); RIVER_ERROR("Unable to load harware IO manager ... ");
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// get the output or input channel : // get the output or input channel :
std11::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName); std::shared_ptr<audio::river::io::Node> node = manager->getNode(_streamName);
if (node == nullptr) { if (node == nullptr) {
RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream()); RIVER_ERROR("Can not get the Requested stream '" << _streamName << "' ==> not listed in : " << manager->getListStream());
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
if (node->isOutput() != true) { if (node->isOutput() != true) {
RIVER_ERROR("Can not Connect feedback on other thing than output ... for stream '" << _streamName << "'");; RIVER_ERROR("Can not Connect feedback on other thing than output ... for stream '" << _streamName << "'");;
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// create user iterface: // create user iterface:
std11::shared_ptr<audio::river::Interface> interface; std::shared_ptr<audio::river::Interface> interface;
std11::shared_ptr<ejson::Object> tmpOption = ejson::Object::create(_options); std::shared_ptr<ejson::Object> tmpOption = ejson::Object::create(_options);
tmpOption->addString("io", "feedback"); tmpOption->addString("io", "feedback");
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption); interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
// store it in a list (needed to apply some parameters). // store it in a list (needed to apply some parameters).
@ -238,7 +238,7 @@ std11::shared_ptr<audio::river::Interface> audio::river::Manager::createFeedback
void audio::river::Manager::generateDotAll(const std::string& _filename) { void audio::river::Manager::generateDotAll(const std::string& _filename) {
// get global hardware interface: // get global hardware interface:
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
if (manager == nullptr) { if (manager == nullptr) {
RIVER_ERROR("Can not get the harware manager"); RIVER_ERROR("Can not get the harware manager");
return; return;

View File

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

View File

@ -8,6 +8,6 @@
int32_t audio::river::getLogId() { int32_t audio::river::getLogId() {
static int32_t g_val = etk::log::registerInstance("river"); static int32_t g_val = elog::registerInstance("river");
return g_val; return g_val;
} }

View File

@ -5,14 +5,14 @@
*/ */
#pragma once #pragma once
#include <etk/log.h> #include <elog/log.h>
namespace audio { namespace audio {
namespace river { namespace river {
int32_t getLogId(); int32_t getLogId();
} }
} }
#define RIVER_BASE(info,data) TK_LOG_BASE(audio::river::getLogId(),info,data) #define RIVER_BASE(info,data) ELOG_BASE(audio::river::getLogId(),info,data)
#define RIVER_CRITICAL(data) RIVER_BASE(1, data) #define RIVER_CRITICAL(data) RIVER_BASE(1, data)
#define RIVER_ERROR(data) RIVER_BASE(2, data) #define RIVER_ERROR(data) RIVER_BASE(2, data)

View File

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

View File

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

View File

@ -67,7 +67,7 @@ audio::river::io::Manager::Manager() {
} }
void audio::river::io::Manager::init(const std::string& _filename) { void audio::river::io::Manager::init(const std::string& _filename) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
if (_filename == "") { if (_filename == "") {
RIVER_INFO("Load default config"); RIVER_INFO("Load default config");
m_config.parse(basicAutoConfig); m_config.parse(basicAutoConfig);
@ -77,12 +77,12 @@ void audio::river::io::Manager::init(const std::string& _filename) {
} }
void audio::river::io::Manager::initString(const std::string& _data) { void audio::river::io::Manager::initString(const std::string& _data) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_config.parse(_data); m_config.parse(_data);
} }
void audio::river::io::Manager::unInit() { void audio::river::io::Manager::unInit() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
// TODO : ... // TODO : ...
} }
@ -95,21 +95,21 @@ audio::river::io::Manager::~Manager() {
#endif #endif
}; };
std11::shared_ptr<audio::river::io::Manager> audio::river::io::Manager::getInstance() { std::shared_ptr<audio::river::io::Manager> audio::river::io::Manager::getInstance() {
if (audio::river::isInit() == false) { if (audio::river::isInit() == false) {
return std11::shared_ptr<audio::river::io::Manager>(); return std::shared_ptr<audio::river::io::Manager>();
} }
static std11::shared_ptr<audio::river::io::Manager> manager(new Manager()); static std::shared_ptr<audio::river::io::Manager> manager(new Manager());
return manager; return manager;
} }
std::vector<std::string> audio::river::io::Manager::getListStreamInput() { std::vector<std::string> audio::river::io::Manager::getListStreamInput() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::vector<std::string> output; std::vector<std::string> output;
std::vector<std::string> keys = m_config.getKeys(); std::vector<std::string> keys = m_config.getKeys();
for (size_t iii=0; iii<keys.size(); ++iii) { for (size_t iii=0; iii<keys.size(); ++iii) {
const std11::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]); const std::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]);
if (tmppp != nullptr) { if (tmppp != nullptr) {
std::string type = tmppp->getStringValue("io", "error"); std::string type = tmppp->getStringValue("io", "error");
if ( type == "input" if ( type == "input"
@ -122,11 +122,11 @@ std::vector<std::string> audio::river::io::Manager::getListStreamInput() {
} }
std::vector<std::string> audio::river::io::Manager::getListStreamOutput() { std::vector<std::string> audio::river::io::Manager::getListStreamOutput() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::vector<std::string> output; std::vector<std::string> output;
std::vector<std::string> keys = m_config.getKeys(); std::vector<std::string> keys = m_config.getKeys();
for (size_t iii=0; iii<keys.size(); ++iii) { for (size_t iii=0; iii<keys.size(); ++iii) {
const std11::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]); const std::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]);
if (tmppp != nullptr) { if (tmppp != nullptr) {
std::string type = tmppp->getStringValue("io", "error"); std::string type = tmppp->getStringValue("io", "error");
if ( type == "output" if ( type == "output"
@ -139,11 +139,11 @@ std::vector<std::string> audio::river::io::Manager::getListStreamOutput() {
} }
std::vector<std::string> audio::river::io::Manager::getListStreamVirtual() { std::vector<std::string> audio::river::io::Manager::getListStreamVirtual() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::vector<std::string> output; std::vector<std::string> output;
std::vector<std::string> keys = m_config.getKeys(); std::vector<std::string> keys = m_config.getKeys();
for (size_t iii=0; iii<keys.size(); ++iii) { for (size_t iii=0; iii<keys.size(); ++iii) {
const std11::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]); const std::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]);
if (tmppp != nullptr) { if (tmppp != nullptr) {
std::string type = tmppp->getStringValue("io", "error"); std::string type = tmppp->getStringValue("io", "error");
if ( type != "input" if ( type != "input"
@ -159,11 +159,11 @@ std::vector<std::string> audio::river::io::Manager::getListStreamVirtual() {
} }
std::vector<std::string> audio::river::io::Manager::getListStream() { std::vector<std::string> audio::river::io::Manager::getListStream() {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std::vector<std::string> output; std::vector<std::string> output;
std::vector<std::string> keys = m_config.getKeys(); std::vector<std::string> keys = m_config.getKeys();
for (size_t iii=0; iii<keys.size(); ++iii) { for (size_t iii=0; iii<keys.size(); ++iii) {
const std11::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]); const std::shared_ptr<const ejson::Object> tmppp = m_config.getObject(keys[iii]);
if (tmppp != nullptr) { if (tmppp != nullptr) {
std::string type = tmppp->getStringValue("io", "error"); std::string type = tmppp->getStringValue("io", "error");
if (type != "error") { if (type != "error") {
@ -174,12 +174,12 @@ std::vector<std::string> audio::river::io::Manager::getListStream() {
return output; return output;
} }
std11::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const std::string& _name) { std::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(const std::string& _name) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::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) {
std11::shared_ptr<audio::river::io::Node> tmppp = m_list[iii].lock(); std::shared_ptr<audio::river::io::Node> tmppp = m_list[iii].lock();
if ( tmppp != nullptr if ( tmppp != nullptr
&& _name == tmppp->getName()) { && _name == tmppp->getName()) {
RIVER_WARNING(" find it ... in standalone"); RIVER_WARNING(" find it ... in standalone");
@ -188,11 +188,11 @@ std11::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(con
} }
// search in the group list: // search in the group list:
{ {
for (std::map<std::string, std11::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin()); for (std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
it != m_listGroup.end(); it != m_listGroup.end();
++it) { ++it) {
if (it->second != nullptr) { if (it->second != nullptr) {
std11::shared_ptr<audio::river::io::Node> node = it->second->getNode(_name); std::shared_ptr<audio::river::io::Node> node = it->second->getNode(_name);
if (node != nullptr) { if (node != nullptr) {
RIVER_WARNING(" find it ... in group: " << it->first); RIVER_WARNING(" find it ... in group: " << it->first);
return node; return node;
@ -202,7 +202,7 @@ std11::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(con
} }
RIVER_WARNING("Try create a new one : " << _name); RIVER_WARNING("Try create a new one : " << _name);
// check if the node can be open : // check if the node can be open :
const std11::shared_ptr<const ejson::Object> tmpObject = m_config.getObject(_name); const std::shared_ptr<const ejson::Object> tmpObject = m_config.getObject(_name);
if (tmpObject != nullptr) { if (tmpObject != nullptr) {
//Check if it is in a group: //Check if it is in a group:
std::string groupName = tmpObject->getStringValue("group", ""); std::string groupName = tmpObject->getStringValue("group", "");
@ -213,10 +213,10 @@ std11::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(con
|| ioType == "output" || ioType == "output"
|| ioType == "PAinput" || ioType == "PAinput"
|| ioType == "PAoutput") ) { || ioType == "PAoutput") ) {
std11::shared_ptr<audio::river::io::Group> tmpGroup = getGroup(groupName); std::shared_ptr<audio::river::io::Group> tmpGroup = getGroup(groupName);
if (tmpGroup == nullptr) { if (tmpGroup == nullptr) {
RIVER_WARNING("Can not get group ... '" << groupName << "'"); RIVER_WARNING("Can not get group ... '" << groupName << "'");
return std11::shared_ptr<audio::river::io::Node>(); return std::shared_ptr<audio::river::io::Node>();
} }
return tmpGroup->getNode(_name); return tmpGroup->getNode(_name);
} else { } else {
@ -228,7 +228,7 @@ std11::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(con
if ( ioType == "input" if ( ioType == "input"
|| ioType == "output") { || ioType == "output") {
#ifdef AUDIO_RIVER_BUILD_ORCHESTRA #ifdef AUDIO_RIVER_BUILD_ORCHESTRA
std11::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_name, tmpObject); std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;
#else #else
@ -238,7 +238,7 @@ std11::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(con
if ( ioType == "PAinput" if ( ioType == "PAinput"
|| ioType == "PAoutput") { || ioType == "PAoutput") {
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO #ifdef AUDIO_RIVER_BUILD_PORTAUDIO
std11::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_name, tmpObject); std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;
#else #else
@ -246,26 +246,26 @@ std11::shared_ptr<audio::river::io::Node> audio::river::io::Manager::getNode(con
#endif #endif
} }
if (ioType == "aec") { if (ioType == "aec") {
std11::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeAEC::create(_name, tmpObject); std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeAEC::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;
} }
if (ioType == "muxer") { if (ioType == "muxer") {
std11::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeMuxer::create(_name, tmpObject); std::shared_ptr<audio::river::io::Node> tmp = audio::river::io::NodeMuxer::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;
} }
} }
} }
RIVER_ERROR("Can not create the interface : '" << _name << "' the node is not DEFINED in the configuration file availlable : " << m_config.getKeys()); RIVER_ERROR("Can not create the interface : '" << _name << "' the node is not DEFINED in the configuration file availlable : " << m_config.getKeys());
return std11::shared_ptr<audio::river::io::Node>(); return std::shared_ptr<audio::river::io::Node>();
} }
std11::shared_ptr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const std::string& _name) { std::shared_ptr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const std::string& _name) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::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<audio::drain::VolumeElement>(); return std::shared_ptr<audio::drain::VolumeElement>();
} }
for (size_t iii=0; iii<m_volumeGroup.size(); ++iii) { for (size_t iii=0; iii<m_volumeGroup.size(); ++iii) {
if (m_volumeGroup[iii] == nullptr) { if (m_volumeGroup[iii] == nullptr) {
@ -276,14 +276,14 @@ std11::shared_ptr<audio::drain::VolumeElement> audio::river::io::Manager::getVol
} }
} }
RIVER_DEBUG("Add a new volume group : '" << _name << "'"); RIVER_DEBUG("Add a new volume group : '" << _name << "'");
std11::shared_ptr<audio::drain::VolumeElement> tmpVolume = std11::make_shared<audio::drain::VolumeElement>(_name); std::shared_ptr<audio::drain::VolumeElement> tmpVolume = std::make_shared<audio::drain::VolumeElement>(_name);
m_volumeGroup.push_back(tmpVolume); m_volumeGroup.push_back(tmpVolume);
return tmpVolume; return tmpVolume;
} }
bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) { bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std11::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); std::shared_ptr<audio::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 << "'");
return false; return false;
@ -295,7 +295,7 @@ bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float
} }
volume->setVolume(_valuedB); volume->setVolume(_valuedB);
for (size_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
std11::shared_ptr<audio::river::io::Node> val = m_list[iii].lock(); std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) { if (val != nullptr) {
val->volumeChange(); val->volumeChange();
} }
@ -304,8 +304,8 @@ bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float
} }
float audio::river::io::Manager::getVolume(const std::string& _volumeName) { float audio::river::io::Manager::getVolume(const std::string& _volumeName) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std11::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); std::shared_ptr<audio::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 << "'");
return 0.0f; return 0.0f;
@ -318,15 +318,15 @@ std::pair<float,float> audio::river::io::Manager::getVolumeRange(const std::stri
} }
void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mute) { void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mute) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std11::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); std::shared_ptr<audio::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 << "'");
return; return;
} }
volume->setMute(_mute); volume->setMute(_mute);
for (size_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
std11::shared_ptr<audio::river::io::Node> val = m_list[iii].lock(); std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) { if (val != nullptr) {
val->volumeChange(); val->volumeChange();
} }
@ -334,8 +334,8 @@ void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mu
} }
bool audio::river::io::Manager::getMute(const std::string& _volumeName) { bool audio::river::io::Manager::getMute(const std::string& _volumeName) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std11::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); std::shared_ptr<audio::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 << "'");
return false; return false;
@ -344,7 +344,7 @@ bool audio::river::io::Manager::getMute(const std::string& _volumeName) {
} }
void audio::river::io::Manager::generateDot(const std::string& _filename) { void audio::river::io::Manager::generateDot(const std::string& _filename) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::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) {
@ -357,14 +357,14 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
{ {
// standalone // standalone
for (size_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
std11::shared_ptr<audio::river::io::Node> val = m_list[iii].lock(); std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) { if (val != nullptr) {
if (val->isHarwareNode() == true) { if (val->isHarwareNode() == true) {
val->generateDot(node); val->generateDot(node);
} }
} }
} }
for (std::map<std::string, std11::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin()); for (std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
it != m_listGroup.end(); it != m_listGroup.end();
++it) { ++it) {
if (it->second != nullptr) { if (it->second != nullptr) {
@ -376,14 +376,14 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
{ {
// standalone // standalone
for (size_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
std11::shared_ptr<audio::river::io::Node> val = m_list[iii].lock(); std::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
if (val != nullptr) { if (val != nullptr) {
if (val->isHarwareNode() == false) { if (val->isHarwareNode() == false) {
val->generateDot(node); val->generateDot(node);
} }
} }
} }
for (std::map<std::string, std11::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin()); for (std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
it != m_listGroup.end(); it != m_listGroup.end();
++it) { ++it) {
if (it->second != nullptr) { if (it->second != nullptr) {
@ -397,16 +397,16 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
RIVER_INFO("Generate the DOT files: " << node << " (DONE)"); RIVER_INFO("Generate the DOT files: " << node << " (DONE)");
} }
std11::shared_ptr<audio::river::io::Group> audio::river::io::Manager::getGroup(const std::string& _name) { std::shared_ptr<audio::river::io::Group> audio::river::io::Manager::getGroup(const std::string& _name) {
std11::unique_lock<std11::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
std11::shared_ptr<audio::river::io::Group> out; std::shared_ptr<audio::river::io::Group> out;
std::map<std::string, std11::shared_ptr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name); std::map<std::string, std::shared_ptr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name);
if (it == m_listGroup.end()) { if (it == m_listGroup.end()) {
RIVER_INFO("Create a new group: " << _name << " (START)"); RIVER_INFO("Create a new group: " << _name << " (START)");
out = std11::make_shared<audio::river::io::Group>(); out = std::make_shared<audio::river::io::Group>();
if (out != nullptr) { if (out != nullptr) {
out->createFrom(m_config, _name); out->createFrom(m_config, _name);
std::pair<std::string, std11::shared_ptr<audio::river::io::Group> > plop(std::string(_name), out); std::pair<std::string, std::shared_ptr<audio::river::io::Group> > plop(std::string(_name), out);
m_listGroup.insert(plop); m_listGroup.insert(plop);
RIVER_INFO("Create a new group: " << _name << " ( END )"); RIVER_INFO("Create a new group: " << _name << " ( END )");
} else { } else {

View File

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

View File

@ -11,7 +11,7 @@
#define __class__ "io::Node" #define __class__ "io::Node"
audio::river::io::Node::Node(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) : audio::river::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) :
m_config(_config), m_config(_config),
m_name(_name), m_name(_name),
m_isInput(false) { m_isInput(false) {
@ -58,7 +58,7 @@ audio::river::io::Node::Node(const std::string& _name, const std11::shared_ptr<c
} }
// Get map type : // Get map type :
std::vector<audio::channel> map; std::vector<audio::channel> map;
const std11::shared_ptr<const ejson::Array> listChannelMap = m_config->getArray("channel-map"); const std::shared_ptr<const ejson::Array> listChannelMap = m_config->getArray("channel-map");
if ( listChannelMap == nullptr if ( listChannelMap == nullptr
|| listChannelMap->size() == 0) { || listChannelMap->size() == 0) {
// set default channel property: // set default channel property:
@ -123,7 +123,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 audio::river::io::Node::getNumberOfInterfaceAvaillable(enum audio::river::modeInterface _interfaceType) {
size_t out = 0; size_t out = 0;
for (size_t iii=0; iii<m_listAvaillable.size(); ++iii) { for (size_t iii=0; iii<m_listAvaillable.size(); ++iii) {
std11::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock(); std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) { if (element == nullptr) {
continue; continue;
} }
@ -134,8 +134,8 @@ size_t audio::river::io::Node::getNumberOfInterfaceAvaillable(enum audio::river:
return out; return out;
} }
void audio::river::io::Node::registerAsRemote(const std11::shared_ptr<audio::river::Interface>& _interface) { void audio::river::io::Node::registerAsRemote(const std::shared_ptr<audio::river::Interface>& _interface) {
std::vector<std11::weak_ptr<audio::river::Interface> >::iterator it = m_listAvaillable.begin(); std::vector<std::weak_ptr<audio::river::Interface> >::iterator it = m_listAvaillable.begin();
while (it != m_listAvaillable.end()) { while (it != m_listAvaillable.end()) {
if (it->expired() == true) { if (it->expired() == true) {
it = m_listAvaillable.erase(it); it = m_listAvaillable.erase(it);
@ -146,9 +146,9 @@ void audio::river::io::Node::registerAsRemote(const std11::shared_ptr<audio::riv
m_listAvaillable.push_back(_interface); m_listAvaillable.push_back(_interface);
} }
void audio::river::io::Node::interfaceAdd(const std11::shared_ptr<audio::river::Interface>& _interface) { void audio::river::io::Node::interfaceAdd(const std::shared_ptr<audio::river::Interface>& _interface) {
{ {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
for (size_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
if (_interface == m_list[iii]) { if (_interface == m_list[iii]) {
return; return;
@ -162,9 +162,9 @@ void audio::river::io::Node::interfaceAdd(const std11::shared_ptr<audio::river::
} }
} }
void audio::river::io::Node::interfaceRemove(const std11::shared_ptr<audio::river::Interface>& _interface) { void audio::river::io::Node::interfaceRemove(const std::shared_ptr<audio::river::Interface>& _interface) {
{ {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
for (size_t iii=0; iii< m_list.size(); ++iii) { for (size_t iii=0; iii< m_list.size(); ++iii) {
if (_interface == m_list[iii]) { if (_interface == m_list[iii]) {
m_list.erase(m_list.begin()+iii); m_list.erase(m_list.begin()+iii);
@ -182,7 +182,7 @@ void audio::river::io::Node::interfaceRemove(const std11::shared_ptr<audio::rive
void audio::river::io::Node::volumeChange() { void audio::river::io::Node::volumeChange() {
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) { for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
std11::shared_ptr<audio::river::Interface> node = m_listAvaillable[iii].lock(); std::shared_ptr<audio::river::Interface> node = m_listAvaillable[iii].lock();
if (node != nullptr) { if (node != nullptr) {
node->systemVolumeChange(); node->systemVolumeChange();
} }
@ -324,7 +324,7 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
if (m_listAvaillable[iii].expired() == true) { if (m_listAvaillable[iii].expired() == true) {
continue; continue;
} }
std11::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock(); std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) { if (element == nullptr) {
continue; continue;
} }
@ -350,7 +350,7 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
void audio::river::io::Node::startInGroup() { void audio::river::io::Node::startInGroup() {
std11::shared_ptr<audio::river::io::Group> group = m_group.lock(); std::shared_ptr<audio::river::io::Group> group = m_group.lock();
if (group != nullptr) { if (group != nullptr) {
group->start(); group->start();
} else { } else {
@ -359,7 +359,7 @@ void audio::river::io::Node::startInGroup() {
} }
void audio::river::io::Node::stopInGroup() { void audio::river::io::Node::stopInGroup() {
std11::shared_ptr<audio::river::io::Group> group = m_group.lock(); std::shared_ptr<audio::river::io::Group> group = m_group.lock();
if (group != nullptr) { if (group != nullptr) {
group->stop(); group->stop();
} else { } else {

View File

@ -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. * @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. * this manage the muxing of data for output an the demuxing for input.
*/ */
class Node : public std11::enable_shared_from_this<Node> { class Node : public std::enable_shared_from_this<Node> {
friend class audio::river::io::Group; friend class audio::river::io::Group;
protected: protected:
uint32_t m_uid; //!< uniqueNodeID use for debug an dot generation. uint32_t m_uid; //!< uniqueNodeID use for debug an dot generation.
@ -39,7 +39,7 @@ namespace audio {
* @param[in] _name Name of the node. * @param[in] _name Name of the node.
* @param[in] _config Configuration of the node. * @param[in] _config Configuration of the node.
*/ */
Node(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config); Node(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
public: public:
/** /**
* @brief Destructor * @brief Destructor
@ -54,8 +54,8 @@ namespace audio {
return false; return false;
}; };
protected: protected:
mutable std11::mutex m_mutex; //!< prevent open/close/write/read access that is multi-threaded. mutable std::mutex m_mutex; //!< prevent open/close/write/read access that is multi-threaded.
std11::shared_ptr<const ejson::Object> m_config; //!< configuration description. std::shared_ptr<const ejson::Object> m_config; //!< configuration description.
protected: protected:
audio::drain::Process m_process; //!< Low level algorithms audio::drain::Process m_process; //!< Low level algorithms
public: public:
@ -82,10 +82,10 @@ namespace audio {
} }
} }
protected: protected:
std11::shared_ptr<audio::drain::VolumeElement> m_volume; //!< if a volume is set it is set here ... for hardware interface only. std::shared_ptr<audio::drain::VolumeElement> m_volume; //!< if a volume is set it is set here ... for hardware interface only.
protected: protected:
std::vector<std11::weak_ptr<audio::river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node std::vector<std::weak_ptr<audio::river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node
std::vector<std11::shared_ptr<audio::river::Interface> > m_list; //!< List of all connected interface at this node. std::vector<std::shared_ptr<audio::river::Interface> > m_list; //!< List of all connected interface at this node.
/** /**
* @brief Get the number of interface with a specific type. * @brief Get the number of interface with a specific type.
* @param[in] _interfaceType Type of the interface. * @param[in] _interfaceType Type of the interface.
@ -112,17 +112,17 @@ namespace audio {
* @note We keep a std::weak_ptr. this is the reason why we do not have a remove. * @note We keep a std::weak_ptr. this is the reason why we do not have a remove.
* @param[in] _interface Pointer on the interface to register. * @param[in] _interface Pointer on the interface to register.
*/ */
void registerAsRemote(const std11::shared_ptr<audio::river::Interface>& _interface); void registerAsRemote(const std::shared_ptr<audio::river::Interface>& _interface);
/** /**
* @brief Request this interface might receve/send dat on the flow. (start/resume) * @brief Request this interface might receve/send dat on the flow. (start/resume)
* @param[in] _interface Pointer on the interface to register. * @param[in] _interface Pointer on the interface to register.
*/ */
void interfaceAdd(const std11::shared_ptr<audio::river::Interface>& _interface); void interfaceAdd(const std::shared_ptr<audio::river::Interface>& _interface);
/** /**
* @brief Un-register the interface as an availlable read/write interface. (suspend/stop) * @brief Un-register the interface as an availlable read/write interface. (suspend/stop)
* @param[in] _interface Pointer on the interface to register. * @param[in] _interface Pointer on the interface to register.
*/ */
void interfaceRemove(const std11::shared_ptr<audio::river::Interface>& _interface); void interfaceRemove(const std::shared_ptr<audio::river::Interface>& _interface);
protected: protected:
std::string m_name; //!< Name of the interface std::string m_name; //!< Name of the interface
public: public:
@ -151,13 +151,13 @@ namespace audio {
return !m_isInput; return !m_isInput;
} }
protected: protected:
std11::weak_ptr<audio::river::io::Group> m_group; //!< reference on the group. If available. std::weak_ptr<audio::river::io::Group> m_group; //!< reference on the group. If available.
public: public:
/** /**
* @brief Set this node in a low level group. * @brief Set this node in a low level group.
* @param[in] _group Group reference. * @param[in] _group Group reference.
*/ */
void setGroup(std11::shared_ptr<audio::river::io::Group> _group) { void setGroup(std::shared_ptr<audio::river::io::Group> _group) {
m_group = _group; m_group = _group;
} }
protected: protected:
@ -182,7 +182,7 @@ namespace audio {
* @brief If this iss an hardware interface we can have a resuest of the volume stage: * @brief If this iss an hardware interface we can have a resuest of the volume stage:
* @return pointer on the requested volume. * @return pointer on the requested volume.
*/ */
const std11::shared_ptr<audio::drain::VolumeElement>& getVolume() { const std::shared_ptr<audio::drain::VolumeElement>& getVolume() {
return m_volume; return m_volume;
} }
public: public:

View File

@ -13,20 +13,20 @@
#undef __class__ #undef __class__
#define __class__ "io::NodeAEC" #define __class__ "io::NodeAEC"
std11::shared_ptr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) { std::shared_ptr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) {
return std11::shared_ptr<audio::river::io::NodeAEC>(new audio::river::io::NodeAEC(_name, _config)); return std::shared_ptr<audio::river::io::NodeAEC>(new audio::river::io::NodeAEC(_name, _config));
} }
std11::shared_ptr<audio::river::Interface> audio::river::io::NodeAEC::createInput(float _freq, std::shared_ptr<audio::river::Interface> audio::river::io::NodeAEC::createInput(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::string& _objectName, const std::string& _objectName,
const std::string& _name) { const std::string& _name) {
// check if the output exist // check if the output exist
const std11::shared_ptr<const ejson::Object> tmppp = m_config->getObject(_objectName); const std::shared_ptr<const ejson::Object> tmppp = m_config->getObject(_objectName);
if (tmppp == nullptr) { if (tmppp == nullptr) {
RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config->getKeys()); RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config->getKeys());
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
std::string streamName = tmppp->getStringValue("map-on", "error"); std::string streamName = tmppp->getStringValue("map-on", "error");
@ -36,14 +36,14 @@ std11::shared_ptr<audio::river::Interface> audio::river::io::NodeAEC::createInpu
if ( type != "input" if ( type != "input"
&& type != "feedback") { && type != "feedback") {
RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type); RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type);
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// get global hardware interface: // get global hardware interface:
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
// get the output or input channel : // get the output or input channel :
std11::shared_ptr<audio::river::io::Node> node = manager->getNode(streamName); std::shared_ptr<audio::river::io::Node> node = manager->getNode(streamName);
// create user iterface: // create user iterface:
std11::shared_ptr<audio::river::Interface> interface; std::shared_ptr<audio::river::Interface> interface;
interface = audio::river::Interface::create(_freq, _map, _format, node, tmppp); interface = audio::river::Interface::create(_freq, _map, _format, node, tmppp);
if (interface != nullptr) { if (interface != nullptr) {
interface->setName(_name); interface->setName(_name);
@ -52,7 +52,7 @@ std11::shared_ptr<audio::river::Interface> audio::river::io::NodeAEC::createInpu
} }
audio::river::io::NodeAEC::NodeAEC(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) : audio::river::io::NodeAEC::NodeAEC(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) :
Node(_name, _config), Node(_name, _config),
m_P_attaqueTime(1), m_P_attaqueTime(1),
m_P_releaseTime(100), m_P_releaseTime(100),
@ -106,28 +106,28 @@ audio::river::io::NodeAEC::NodeAEC(const std::string& _name, const std11::shared
} }
// set callback mode ... // set callback mode ...
m_interfaceFeedBack->setInputCallback(std11::bind(&audio::river::io::NodeAEC::onDataReceivedFeedBack, m_interfaceFeedBack->setInputCallback(std::bind(&audio::river::io::NodeAEC::onDataReceivedFeedBack,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
// set callback mode ... // set callback mode ...
m_interfaceMicrophone->setInputCallback(std11::bind(&audio::river::io::NodeAEC::onDataReceivedMicrophone, m_interfaceMicrophone->setInputCallback(std::bind(&audio::river::io::NodeAEC::onDataReceivedMicrophone,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_bufferMicrophone.setCapacity(std11::chrono::milliseconds(1000), m_bufferMicrophone.setCapacity(std::chrono::milliseconds(1000),
audio::getFormatBytes(hardwareFormat.getFormat())*hardwareFormat.getMap().size(), audio::getFormatBytes(hardwareFormat.getFormat())*hardwareFormat.getMap().size(),
hardwareFormat.getFrequency()); hardwareFormat.getFrequency());
m_bufferFeedBack.setCapacity(std11::chrono::milliseconds(1000), m_bufferFeedBack.setCapacity(std::chrono::milliseconds(1000),
audio::getFormatBytes(hardwareFormat.getFormat()), // only one channel ... audio::getFormatBytes(hardwareFormat.getFormat()), // only one channel ...
hardwareFormat.getFrequency()); hardwareFormat.getFrequency());
@ -142,7 +142,7 @@ audio::river::io::NodeAEC::~NodeAEC() {
}; };
void audio::river::io::NodeAEC::start() { void audio::river::io::NodeAEC::start() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
if (m_interfaceFeedBack != nullptr) { if (m_interfaceFeedBack != nullptr) {
RIVER_INFO("Start FEEDBACK : "); RIVER_INFO("Start FEEDBACK : ");
@ -155,7 +155,7 @@ void audio::river::io::NodeAEC::start() {
} }
void audio::river::io::NodeAEC::stop() { void audio::river::io::NodeAEC::stop() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
if (m_interfaceFeedBack != nullptr) { if (m_interfaceFeedBack != nullptr) {
m_interfaceFeedBack->stop(); m_interfaceFeedBack->stop();
} }
@ -177,7 +177,7 @@ void audio::river::io::NodeAEC::onDataReceivedMicrophone(const void* _data,
RIVER_ERROR("call wrong type ... (need int16_t)"); RIVER_ERROR("call wrong type ... (need int16_t)");
} }
// push data synchronize // push data synchronize
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
m_bufferMicrophone.write(_data, _nbChunk, _time); m_bufferMicrophone.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_Microphone.raw", _data, _nbChunk*_map.size()); //RIVER_SAVE_FILE_MACRO(int16_t, "REC_Microphone.raw", _data, _nbChunk*_map.size());
process(); process();
@ -195,7 +195,7 @@ void audio::river::io::NodeAEC::onDataReceivedFeedBack(const void* _data,
RIVER_ERROR("call wrong type ... (need int16_t)"); RIVER_ERROR("call wrong type ... (need int16_t)");
} }
// push data synchronize // push data synchronize
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
m_bufferFeedBack.write(_data, _nbChunk, _time); m_bufferFeedBack.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_FeedBack.raw", _data, _nbChunk*_map.size()); //RIVER_SAVE_FILE_MACRO(int16_t, "REC_FeedBack.raw", _data, _nbChunk*_map.size());
process(); process();
@ -346,7 +346,7 @@ void audio::river::io::NodeAEC::generateDot(etk::FSNode& _node) {
if (m_listAvaillable[iii].expired() == true) { if (m_listAvaillable[iii].expired() == true) {
continue; continue;
} }
std11::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock(); std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) { if (element == nullptr) {
continue; continue;
} }

View File

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

View File

@ -17,7 +17,7 @@ int32_t audio::river::io::NodeFile::recordCallback(const void* _inputBuffer,
const audio::Time& _timeInput, const audio::Time& _timeInput,
uint32_t _nbChunk, uint32_t _nbChunk,
const std::vector<audio::orchestra::status>& _status) { const std::vector<audio::orchestra::status>& _status) {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
// TODO : Manage status ... // TODO : Manage status ...
RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size()); RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
newInput(_inputBuffer, _nbChunk, _timeInput); newInput(_inputBuffer, _nbChunk, _timeInput);
@ -28,7 +28,7 @@ int32_t audio::river::io::NodeFile::playbackCallback(void* _outputBuffer,
const audio::Time& _timeOutput, const audio::Time& _timeOutput,
uint32_t _nbChunk, uint32_t _nbChunk,
const std::vector<audio::orchestra::status>& _status) { const std::vector<audio::orchestra::status>& _status) {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
// TODO : Manage status ... // TODO : Manage status ...
RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size()); RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
newOutput(_outputBuffer, _nbChunk, _timeOutput); newOutput(_outputBuffer, _nbChunk, _timeOutput);
@ -37,11 +37,11 @@ int32_t audio::river::io::NodeFile::playbackCallback(void* _outputBuffer,
std11::shared_ptr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) { std::shared_ptr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) {
return std11::shared_ptr<audio::river::io::NodeFile>(new audio::river::io::NodeFile(_name, _config)); return std::shared_ptr<audio::river::io::NodeFile>(new audio::river::io::NodeFile(_name, _config));
} }
audio::river::io::NodeFile::NodeFile(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) : audio::river::io::NodeFile::NodeFile(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) :
Node(_name, _config) { Node(_name, _config) {
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat(); audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat(); audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
@ -54,7 +54,7 @@ audio::river::io::NodeFile::NodeFile(const std::string& _name, const std11::shar
*/ */
std::string typeInterface = audio::orchestra::type_undefined; std::string typeInterface = audio::orchestra::type_undefined;
std::string streamName = "default"; std::string streamName = "default";
const std11::shared_ptr<const ejson::Object> tmpObject = m_config->getObject("map-on"); const std::shared_ptr<const ejson::Object> tmpObject = m_config->getObject("map-on");
if (tmpObject == nullptr) { if (tmpObject == nullptr) {
RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'"); RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'");
} else { } else {
@ -202,12 +202,12 @@ audio::river::io::NodeFile::NodeFile(const std::string& _name, const std11::shar
m_process.setOutputConfig(interfaceFormat); m_process.setOutputConfig(interfaceFormat);
err = m_interface.openStream(nullptr, &params, err = m_interface.openStream(nullptr, &params,
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std11::bind(&audio::river::io::NodeFile::recordCallback, std::bind(&audio::river::io::NodeFile::recordCallback,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6), std::placeholders::_6),
option option
); );
} else { } else {
@ -215,12 +215,12 @@ audio::river::io::NodeFile::NodeFile(const std::string& _name, const std11::shar
m_process.setOutputConfig(hardwareFormat); m_process.setOutputConfig(hardwareFormat);
err = m_interface.openStream(&params, nullptr, err = m_interface.openStream(&params, nullptr,
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std11::bind(&audio::river::io::NodeFile::playbackCallback, std::bind(&audio::river::io::NodeFile::playbackCallback,
this, this,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6), std::placeholders::_6),
option option
); );
} }
@ -231,7 +231,7 @@ audio::river::io::NodeFile::NodeFile(const std::string& _name, const std11::shar
} }
audio::river::io::NodeFile::~NodeFile() { audio::river::io::NodeFile::~NodeFile() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("close input stream"); RIVER_INFO("close input stream");
if (m_interface.isStreamOpen() ) { if (m_interface.isStreamOpen() ) {
m_interface.closeStream(); m_interface.closeStream();
@ -249,7 +249,7 @@ void audio::river::io::NodeFile::threadCallback() {
} }
void audio::river::io::NodeFile::start() { void audio::river::io::NodeFile::start() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
if (m_thread != nullptr) { if (m_thread != nullptr) {
RIVER_ERROR("Start stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") << " ==> already started ..." ); RIVER_ERROR("Start stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") << " ==> already started ..." );
return; return;
@ -261,7 +261,7 @@ void audio::river::io::NodeFile::start() {
} }
void audio::river::io::NodeFile::stop() { void audio::river::io::NodeFile::stop() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
m_alive = false; m_alive = false;
RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") ); RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") );
// TODO : Need join ... // TODO : Need join ...

View File

@ -24,9 +24,9 @@ namespace audio {
/** /**
* @brief Constructor * @brief Constructor
*/ */
NodeFile(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config); NodeFile(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
public: public:
static std11::shared_ptr<NodeFile> create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config); static std::shared_ptr<NodeFile> create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -13,20 +13,20 @@
#undef __class__ #undef __class__
#define __class__ "io::NodeMuxer" #define __class__ "io::NodeMuxer"
std11::shared_ptr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) { std::shared_ptr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) {
return std11::shared_ptr<audio::river::io::NodeMuxer>(new audio::river::io::NodeMuxer(_name, _config)); return std::shared_ptr<audio::river::io::NodeMuxer>(new audio::river::io::NodeMuxer(_name, _config));
} }
std11::shared_ptr<audio::river::Interface> audio::river::io::NodeMuxer::createInput(float _freq, std::shared_ptr<audio::river::Interface> audio::river::io::NodeMuxer::createInput(float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::string& _objectName, const std::string& _objectName,
const std::string& _name) { const std::string& _name) {
// check if the output exist // check if the output exist
const std11::shared_ptr<const ejson::Object> tmppp = m_config->getObject(_objectName); const std::shared_ptr<const ejson::Object> tmppp = m_config->getObject(_objectName);
if (tmppp == nullptr) { if (tmppp == nullptr) {
RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config->getKeys()); RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config->getKeys());
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
std::string streamName = tmppp->getStringValue("map-on", "error"); std::string streamName = tmppp->getStringValue("map-on", "error");
@ -36,14 +36,14 @@ std11::shared_ptr<audio::river::Interface> audio::river::io::NodeMuxer::createIn
if ( type != "input" if ( type != "input"
&& type != "feedback") { && type != "feedback") {
RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type); RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type);
return std11::shared_ptr<audio::river::Interface>(); return std::shared_ptr<audio::river::Interface>();
} }
// get global hardware interface: // get global hardware interface:
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance(); std::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
// get the output or input channel : // get the output or input channel :
std11::shared_ptr<audio::river::io::Node> node = manager->getNode(streamName); std::shared_ptr<audio::river::io::Node> node = manager->getNode(streamName);
// create user iterface: // create user iterface:
std11::shared_ptr<audio::river::Interface> interface; std::shared_ptr<audio::river::Interface> interface;
interface = audio::river::Interface::create(_freq, _map, _format, node, tmppp); interface = audio::river::Interface::create(_freq, _map, _format, node, tmppp);
if (interface != nullptr) { if (interface != nullptr) {
interface->setName(_name); interface->setName(_name);
@ -52,7 +52,7 @@ std11::shared_ptr<audio::river::Interface> audio::river::io::NodeMuxer::createIn
} }
audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) : audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) :
Node(_name, _config) { Node(_name, _config) {
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat(); audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat(); audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
@ -88,7 +88,7 @@ audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const std11::sh
RIVER_ERROR("Can not opne virtual device ... map-on-input-1 in " << _name); RIVER_ERROR("Can not opne virtual device ... map-on-input-1 in " << _name);
return; return;
} }
std11::shared_ptr<const ejson::Array> listChannelMap = m_config->getArray("input-1-remap"); std::shared_ptr<const ejson::Array> listChannelMap = m_config->getArray("input-1-remap");
if ( listChannelMap == nullptr if ( listChannelMap == nullptr
|| listChannelMap->size() == 0) { || listChannelMap->size() == 0) {
m_mapInput1 = m_interfaceInput1->getInterfaceFormat().getMap(); m_mapInput1 = m_interfaceInput1->getInterfaceFormat().getMap();
@ -131,28 +131,28 @@ audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const std11::sh
} }
// set callback mode ... // set callback mode ...
m_interfaceInput1->setInputCallback(std11::bind(&audio::river::io::NodeMuxer::onDataReceivedInput1, m_interfaceInput1->setInputCallback(std::bind(&audio::river::io::NodeMuxer::onDataReceivedInput1,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
// set callback mode ... // set callback mode ...
m_interfaceInput2->setInputCallback(std11::bind(&audio::river::io::NodeMuxer::onDataReceivedInput2, m_interfaceInput2->setInputCallback(std::bind(&audio::river::io::NodeMuxer::onDataReceivedInput2,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_bufferInput1.setCapacity(std11::chrono::milliseconds(1000), m_bufferInput1.setCapacity(std::chrono::milliseconds(1000),
audio::getFormatBytes(hardwareFormat.getFormat())*m_mapInput1.size(), audio::getFormatBytes(hardwareFormat.getFormat())*m_mapInput1.size(),
hardwareFormat.getFrequency()); hardwareFormat.getFrequency());
m_bufferInput2.setCapacity(std11::chrono::milliseconds(1000), m_bufferInput2.setCapacity(std::chrono::milliseconds(1000),
audio::getFormatBytes(hardwareFormat.getFormat())*m_mapInput2.size(), audio::getFormatBytes(hardwareFormat.getFormat())*m_mapInput2.size(),
hardwareFormat.getFrequency()); hardwareFormat.getFrequency());
@ -167,7 +167,7 @@ audio::river::io::NodeMuxer::~NodeMuxer() {
}; };
void audio::river::io::NodeMuxer::start() { void audio::river::io::NodeMuxer::start() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
if (m_interfaceInput1 != nullptr) { if (m_interfaceInput1 != nullptr) {
RIVER_INFO("Start FEEDBACK : "); RIVER_INFO("Start FEEDBACK : ");
@ -180,7 +180,7 @@ void audio::river::io::NodeMuxer::start() {
} }
void audio::river::io::NodeMuxer::stop() { void audio::river::io::NodeMuxer::stop() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
if (m_interfaceInput1 != nullptr) { if (m_interfaceInput1 != nullptr) {
m_interfaceInput1->stop(); m_interfaceInput1->stop();
} }
@ -202,7 +202,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput1(const void* _data,
RIVER_ERROR("call wrong type ... (need int16_t)"); RIVER_ERROR("call wrong type ... (need int16_t)");
} }
// push data synchronize // push data synchronize
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
m_bufferInput1.write(_data, _nbChunk, _time); m_bufferInput1.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_Microphone.raw", _data, _nbChunk*_map.size()); //RIVER_SAVE_FILE_MACRO(int16_t, "REC_Microphone.raw", _data, _nbChunk*_map.size());
process(); process();
@ -220,7 +220,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput2(const void* _data,
RIVER_ERROR("call wrong type ... (need int16_t)"); RIVER_ERROR("call wrong type ... (need int16_t)");
} }
// push data synchronize // push data synchronize
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
m_bufferInput2.write(_data, _nbChunk, _time); m_bufferInput2.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_FeedBack.raw", _data, _nbChunk*_map.size()); //RIVER_SAVE_FILE_MACRO(int16_t, "REC_FeedBack.raw", _data, _nbChunk*_map.size());
process(); process();
@ -460,7 +460,7 @@ void audio::river::io::NodeMuxer::generateDot(etk::FSNode& _node) {
if (m_listAvaillable[iii].expired() == true) { if (m_listAvaillable[iii].expired() == true) {
continue; continue;
} }
std11::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock(); std::shared_ptr<audio::river::Interface> element = m_listAvaillable[iii].lock();
if (element == nullptr) { if (element == nullptr) {
continue; continue;
} }

View File

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

View File

@ -17,7 +17,7 @@ int32_t audio::river::io::NodeOrchestra::recordCallback(const void* _inputBuffer
const audio::Time& _timeInput, const audio::Time& _timeInput,
uint32_t _nbChunk, uint32_t _nbChunk,
const std::vector<audio::orchestra::status>& _status) { const std::vector<audio::orchestra::status>& _status) {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
// TODO : Manage status ... // TODO : Manage status ...
RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size()); RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
newInput(_inputBuffer, _nbChunk, _timeInput); newInput(_inputBuffer, _nbChunk, _timeInput);
@ -28,7 +28,7 @@ int32_t audio::river::io::NodeOrchestra::playbackCallback(void* _outputBuffer,
const audio::Time& _timeOutput, const audio::Time& _timeOutput,
uint32_t _nbChunk, uint32_t _nbChunk,
const std::vector<audio::orchestra::status>& _status) { const std::vector<audio::orchestra::status>& _status) {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
// TODO : Manage status ... // TODO : Manage status ...
RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size()); RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
newOutput(_outputBuffer, _nbChunk, _timeOutput); newOutput(_outputBuffer, _nbChunk, _timeOutput);
@ -37,11 +37,11 @@ int32_t audio::river::io::NodeOrchestra::playbackCallback(void* _outputBuffer,
std11::shared_ptr<audio::river::io::NodeOrchestra> audio::river::io::NodeOrchestra::create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) { std::shared_ptr<audio::river::io::NodeOrchestra> audio::river::io::NodeOrchestra::create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) {
return std11::shared_ptr<audio::river::io::NodeOrchestra>(new audio::river::io::NodeOrchestra(_name, _config)); return std::shared_ptr<audio::river::io::NodeOrchestra>(new audio::river::io::NodeOrchestra(_name, _config));
} }
audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) : audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) :
Node(_name, _config) { Node(_name, _config) {
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat(); audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat(); audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
@ -54,7 +54,7 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
*/ */
std::string typeInterface = audio::orchestra::type_undefined; std::string typeInterface = audio::orchestra::type_undefined;
std::string streamName = "default"; std::string streamName = "default";
const std11::shared_ptr<const ejson::Object> tmpObject = m_config->getObject("map-on"); const std::shared_ptr<const ejson::Object> tmpObject = m_config->getObject("map-on");
if (tmpObject == nullptr) { if (tmpObject == nullptr) {
RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'"); RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'");
} else { } else {
@ -202,12 +202,12 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
m_process.setOutputConfig(interfaceFormat); m_process.setOutputConfig(interfaceFormat);
err = m_interface.openStream(nullptr, &params, err = m_interface.openStream(nullptr, &params,
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std11::bind(&audio::river::io::NodeOrchestra::recordCallback, std::bind(&audio::river::io::NodeOrchestra::recordCallback,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6), std::placeholders::_6),
option option
); );
} else { } else {
@ -215,12 +215,12 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
m_process.setOutputConfig(hardwareFormat); m_process.setOutputConfig(hardwareFormat);
err = m_interface.openStream(&params, nullptr, err = m_interface.openStream(&params, nullptr,
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std11::bind(&audio::river::io::NodeOrchestra::playbackCallback, std::bind(&audio::river::io::NodeOrchestra::playbackCallback,
this, this,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6), std::placeholders::_6),
option option
); );
} }
@ -231,7 +231,7 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
} }
audio::river::io::NodeOrchestra::~NodeOrchestra() { audio::river::io::NodeOrchestra::~NodeOrchestra() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("close input stream"); RIVER_INFO("close input stream");
if (m_interface.isStreamOpen() ) { if (m_interface.isStreamOpen() ) {
m_interface.closeStream(); m_interface.closeStream();
@ -239,7 +239,7 @@ audio::river::io::NodeOrchestra::~NodeOrchestra() {
}; };
void audio::river::io::NodeOrchestra::start() { void audio::river::io::NodeOrchestra::start() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum audio::orchestra::error err = m_interface.startStream(); enum audio::orchestra::error err = m_interface.startStream();
if (err != audio::orchestra::error_none) { if (err != audio::orchestra::error_none) {
@ -248,7 +248,7 @@ void audio::river::io::NodeOrchestra::start() {
} }
void audio::river::io::NodeOrchestra::stop() { void audio::river::io::NodeOrchestra::stop() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum audio::orchestra::error err = m_interface.stopStream(); enum audio::orchestra::error err = m_interface.stopStream();
if (err != audio::orchestra::error_none) { if (err != audio::orchestra::error_none) {

View File

@ -24,9 +24,9 @@ namespace audio {
/** /**
* @brief Constructor * @brief Constructor
*/ */
NodeOrchestra(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config); NodeOrchestra(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
public: public:
static std11::shared_ptr<NodeOrchestra> create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config); static std::shared_ptr<NodeOrchestra> create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -42,7 +42,7 @@ int32_t audio::river::io::NodePortAudio::duplexCallback(const void* _inputBuffer
const audio::Time& _timeOutput, const audio::Time& _timeOutput,
uint32_t _nbChunk, uint32_t _nbChunk,
PaStreamCallbackFlags _status) { PaStreamCallbackFlags _status) {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
// TODO : Manage status ... // TODO : Manage status ...
if (_inputBuffer != nullptr) { if (_inputBuffer != nullptr) {
RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size()); RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
@ -56,11 +56,11 @@ int32_t audio::river::io::NodePortAudio::duplexCallback(const void* _inputBuffer
} }
std11::shared_ptr<audio::river::io::NodePortAudio> audio::river::io::NodePortAudio::create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) { std::shared_ptr<audio::river::io::NodePortAudio> audio::river::io::NodePortAudio::create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) {
return std11::shared_ptr<audio::river::io::NodePortAudio>(new audio::river::io::NodePortAudio(_name, _config)); return std::shared_ptr<audio::river::io::NodePortAudio>(new audio::river::io::NodePortAudio(_name, _config));
} }
audio::river::io::NodePortAudio::NodePortAudio(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config) : audio::river::io::NodePortAudio::NodePortAudio(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) :
Node(_name, _config) { Node(_name, _config) {
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat(); audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat(); audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
@ -72,7 +72,7 @@ audio::river::io::NodePortAudio::NodePortAudio(const std::string& _name, const s
nb-chunk:1024 # number of chunk to open device (create the latency anf the frequency to call user) nb-chunk:1024 # number of chunk to open device (create the latency anf the frequency to call user)
*/ */
std::string streamName = "default"; std::string streamName = "default";
const std11::shared_ptr<const ejson::Object> tmpObject = m_config->getObject("map-on"); const std::shared_ptr<const ejson::Object> tmpObject = m_config->getObject("map-on");
if (tmpObject == nullptr) { if (tmpObject == nullptr) {
RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'"); RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'");
} else { } else {
@ -108,7 +108,7 @@ audio::river::io::NodePortAudio::NodePortAudio(const std::string& _name, const s
} }
audio::river::io::NodePortAudio::~NodePortAudio() { audio::river::io::NodePortAudio::~NodePortAudio() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("close input stream"); RIVER_INFO("close input stream");
PaError err = Pa_CloseStream( m_stream ); PaError err = Pa_CloseStream( m_stream );
if( err != paNoError ) { if( err != paNoError ) {
@ -117,7 +117,7 @@ audio::river::io::NodePortAudio::~NodePortAudio() {
}; };
void audio::river::io::NodePortAudio::start() { void audio::river::io::NodePortAudio::start() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
PaError err = Pa_StartStream(m_stream); PaError err = Pa_StartStream(m_stream);
if( err != paNoError ) { if( err != paNoError ) {
@ -126,7 +126,7 @@ void audio::river::io::NodePortAudio::start() {
} }
void audio::river::io::NodePortAudio::stop() { void audio::river::io::NodePortAudio::stop() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
PaError err = Pa_StopStream(m_stream); PaError err = Pa_StopStream(m_stream);
if( err != paNoError ) { if( err != paNoError ) {

View File

@ -21,9 +21,9 @@ namespace audio {
/** /**
* @brief Constructor * @brief Constructor
*/ */
NodePortAudio(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config); NodePortAudio(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
public: public:
static std11::shared_ptr<NodePortAudio> create(const std::string& _name, const std11::shared_ptr<const ejson::Object>& _config); static std::shared_ptr<NodePortAudio> create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config);
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

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

View File

@ -8,6 +8,6 @@
int32_t appl::getLogId() { int32_t appl::getLogId() {
static int32_t g_val = etk::log::registerInstance("ioViewer"); static int32_t g_val = elog::registerInstance("ioViewer");
return g_val; return g_val;
} }

View File

@ -5,13 +5,13 @@
*/ */
#pragma once #pragma once
#include <etk/log.h> #include <elog/log.h>
namespace appl { namespace appl {
int32_t getLogId(); int32_t getLogId();
} }
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data) #define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_PRINT(data) APPL_BASE(-1, data) #define APPL_PRINT(data) APPL_BASE(-1, data)
#define APPL_CRITICAL(data) APPL_BASE(1, data) #define APPL_CRITICAL(data) APPL_BASE(1, data)

View File

@ -88,9 +88,9 @@ int main(int _argc, const char **_argv) {
audio::river::init(configFile); audio::river::init(configFile);
} }
// Create the River manager for tha application or part of the application. // Create the River manager for tha application or part of the application.
std11::shared_ptr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read"); std::shared_ptr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read");
// create interface: // create interface:
std11::shared_ptr<audio::river::Interface> interface; std::shared_ptr<audio::river::Interface> interface;
//Get the generic input: //Get the generic input:
interface = manager->createInput(48000, interface = manager->createInput(48000,
std::vector<audio::channel>(), std::vector<audio::channel>(),
@ -107,13 +107,13 @@ int main(int _argc, const char **_argv) {
outputNode.fileOpenWrite(); outputNode.fileOpenWrite();
} }
// set callback mode ... // set callback mode ...
interface->setInputCallback(std11::bind(&onDataReceived, interface->setInputCallback(std::bind(&onDataReceived,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6, std::placeholders::_6,
&outputNode)); &outputNode));
// start the stream // start the stream
interface->start(); interface->start();

View File

@ -65,9 +65,9 @@ int main(int _argc, const char **_argv) {
// initialize river interface // initialize river interface
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
// Create the River manager for tha application or part of the application. // Create the River manager for tha application or part of the application.
std11::shared_ptr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read"); std::shared_ptr<audio::river::Manager> manager = audio::river::Manager::create("river_sample_read");
// create interface: // create interface:
std11::shared_ptr<audio::river::Interface> interface; std::shared_ptr<audio::river::Interface> interface;
//Get the generic input: //Get the generic input:
interface = manager->createOutput(48000, interface = manager->createOutput(48000,
std::vector<audio::channel>(), std::vector<audio::channel>(),
@ -78,13 +78,13 @@ int main(int _argc, const char **_argv) {
return -1; return -1;
} }
// set callback mode ... // set callback mode ...
interface->setOutputCallback(std11::bind(&onDataNeeded, interface->setOutputCallback(std::bind(&onDataNeeded,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
// start the stream // start the stream
interface->start(); interface->start();
// wait 10 second ... // wait 10 second ...

View File

@ -12,12 +12,12 @@ namespace river_test_aec {
class Linker { class Linker {
private: private:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interfaceOut; std::shared_ptr<audio::river::Interface> m_interfaceOut;
std11::shared_ptr<audio::river::Interface> m_interfaceIn; std::shared_ptr<audio::river::Interface> m_interfaceIn;
audio::drain::CircularBuffer m_buffer; audio::drain::CircularBuffer m_buffer;
public: public:
Linker(std11::shared_ptr<audio::river::Manager> _manager, const std::string& _input, const std::string& _output) : Linker(std::shared_ptr<audio::river::Manager> _manager, const std::string& _input, const std::string& _output) :
m_manager(_manager) { m_manager(_manager) {
//Set stereo output: //Set stereo output:
std::vector<audio::channel> channelMap; std::vector<audio::channel> channelMap;
@ -27,7 +27,7 @@ namespace river_test_aec {
channelMap.push_back(audio::channel_frontLeft); channelMap.push_back(audio::channel_frontLeft);
channelMap.push_back(audio::channel_frontRight); channelMap.push_back(audio::channel_frontRight);
} }
m_buffer.setCapacity(std11::chrono::milliseconds(2000), sizeof(int16_t)*channelMap.size(), 48000); m_buffer.setCapacity(std::chrono::milliseconds(2000), sizeof(int16_t)*channelMap.size(), 48000);
m_interfaceOut = m_manager->createOutput(48000, m_interfaceOut = m_manager->createOutput(48000,
channelMap, channelMap,
@ -38,14 +38,14 @@ namespace river_test_aec {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interfaceOut->setOutputCallback(std11::bind(&Linker::onDataNeeded, m_interfaceOut->setOutputCallback(std::bind(&Linker::onDataNeeded,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_interfaceOut->addVolumeGroup("FLOW"); m_interfaceOut->addVolumeGroup("FLOW");
if ("speaker" == _output) { if ("speaker" == _output) {
m_interfaceOut->setParameter("volume", "FLOW", "0dB"); m_interfaceOut->setParameter("volume", "FLOW", "0dB");
@ -60,14 +60,14 @@ namespace river_test_aec {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interfaceIn->setInputCallback(std11::bind(&Linker::onDataReceived, m_interfaceIn->setInputCallback(std::bind(&Linker::onDataReceived,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
} }
void onDataNeeded(void* _data, void onDataNeeded(void* _data,
@ -198,10 +198,10 @@ namespace river_test_aec {
TEST(TestUser, testAECManually) { TEST(TestUser, testAECManually) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
std11::shared_ptr<Linker> processLink1 = std11::make_shared<Linker>(manager, "microphone-clean", "speaker"); std::shared_ptr<Linker> processLink1 = std::make_shared<Linker>(manager, "microphone-clean", "speaker");
std11::shared_ptr<Linker> processLink2 = std11::make_shared<Linker>(manager, "microphone", "speaker-test"); std::shared_ptr<Linker> processLink2 = std::make_shared<Linker>(manager, "microphone", "speaker-test");
processLink1->start(); processLink1->start();
processLink2->start(); processLink2->start();
sleep(30); sleep(30);

View File

@ -13,14 +13,14 @@
namespace river_test_echo_delay { namespace river_test_echo_delay {
class TestClass { class TestClass {
private: private:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interfaceOut; std::shared_ptr<audio::river::Interface> m_interfaceOut;
std11::shared_ptr<audio::river::Interface> m_interfaceIn; std::shared_ptr<audio::river::Interface> m_interfaceIn;
std11::shared_ptr<audio::river::Interface> m_interfaceFB; std::shared_ptr<audio::river::Interface> m_interfaceFB;
double m_phase; double m_phase;
double m_freq; double m_freq;
int32_t m_nextSampleCount; int32_t m_nextSampleCount;
std11::chrono::milliseconds m_delayBetweenEvent; std::chrono::milliseconds m_delayBetweenEvent;
audio::Time m_nextTick; audio::Time m_nextTick;
audio::Time m_currentTick; audio::Time m_currentTick;
int32_t m_stateFB; int32_t m_stateFB;
@ -31,7 +31,7 @@ namespace river_test_echo_delay {
int16_t m_volumeInputMin; int16_t m_volumeInputMin;
float m_gain; float m_gain;
public: public:
TestClass(std11::shared_ptr<audio::river::Manager> _manager) : TestClass(std::shared_ptr<audio::river::Manager> _manager) :
m_manager(_manager), m_manager(_manager),
m_phase(0), m_phase(0),
m_freq(400), m_freq(400),
@ -52,14 +52,14 @@ namespace river_test_echo_delay {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interfaceOut->setOutputCallback(std11::bind(&TestClass::onDataNeeded, m_interfaceOut->setOutputCallback(std::bind(&TestClass::onDataNeeded,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_interfaceOut->addVolumeGroup("FLOW"); m_interfaceOut->addVolumeGroup("FLOW");
m_interfaceOut->setParameter("volume", "FLOW", etk::to_string(m_gain) + "dB"); m_interfaceOut->setParameter("volume", "FLOW", etk::to_string(m_gain) + "dB");
@ -72,14 +72,14 @@ namespace river_test_echo_delay {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interfaceIn->setInputCallback(std11::bind(&TestClass::onDataReceived, m_interfaceIn->setInputCallback(std::bind(&TestClass::onDataReceived,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_interfaceFB = m_manager->createFeedback(48000, m_interfaceFB = m_manager->createFeedback(48000,
channelMap, channelMap,
@ -90,14 +90,14 @@ namespace river_test_echo_delay {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interfaceFB->setInputCallback(std11::bind(&TestClass::onDataReceivedFeedBack, m_interfaceFB->setInputCallback(std::bind(&TestClass::onDataReceivedFeedBack,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_manager->generateDotAll("activeProcess.dot"); m_manager->generateDotAll("activeProcess.dot");
} }
@ -416,9 +416,9 @@ namespace river_test_echo_delay {
TEST(TestTime, testDelay) { TEST(TestTime, testDelay) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
std11::shared_ptr<TestClass> process = std11::make_shared<TestClass>(manager); std::shared_ptr<TestClass> process = std::make_shared<TestClass>(manager);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);

View File

@ -26,15 +26,15 @@ namespace river_test_format {
"}\n"; "}\n";
class testOutCallbackType { class testOutCallbackType {
private: private:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interface; std::shared_ptr<audio::river::Interface> m_interface;
double m_phase; double m_phase;
float m_freq; float m_freq;
int32_t m_nbChannels; int32_t m_nbChannels;
float m_generateFreq; float m_generateFreq;
public: public:
testOutCallbackType(const std11::shared_ptr<audio::river::Manager>& _manager, testOutCallbackType(const std::shared_ptr<audio::river::Manager>& _manager,
float _freq=48000.0f, float _freq=48000.0f,
int32_t _nbChannels=2, int32_t _nbChannels=2,
audio::format _format=audio::format_int16) : audio::format _format=audio::format_int16) :
@ -69,14 +69,14 @@ namespace river_test_format {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interface->setOutputCallback(std11::bind(&testOutCallbackType::onDataNeeded, m_interface->setOutputCallback(std::bind(&testOutCallbackType::onDataNeeded,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
} }
void onDataNeeded(void* _data, void onDataNeeded(void* _data,
const audio::Time& _time, const audio::Time& _time,
@ -149,9 +149,9 @@ namespace river_test_format {
class testResampling : public ::testing::TestWithParam<float> {}; class testResampling : public ::testing::TestWithParam<float> {};
TEST_P(testResampling, base) { TEST_P(testResampling, base) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
std11::shared_ptr<testOutCallbackType> process = std11::make_shared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16); std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);
@ -166,9 +166,9 @@ namespace river_test_format {
class testFormat : public ::testing::TestWithParam<audio::format> {}; class testFormat : public ::testing::TestWithParam<audio::format> {};
TEST_P(testFormat, base) { TEST_P(testFormat, base) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
std11::shared_ptr<testOutCallbackType> process = std11::make_shared<testOutCallbackType>(manager, 48000, 2, GetParam()); std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, 2, GetParam());
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);
@ -182,9 +182,9 @@ namespace river_test_format {
class testChannels : public ::testing::TestWithParam<int32_t> {}; class testChannels : public ::testing::TestWithParam<int32_t> {};
TEST_P(testChannels, base) { TEST_P(testChannels, base) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
std11::shared_ptr<testOutCallbackType> process = std11::make_shared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16); std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);
@ -197,7 +197,7 @@ namespace river_test_format {
TEST(TestALL, testChannelsFormatResampling) { TEST(TestALL, testChannelsFormatResampling) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
TEST_INFO("test convert flaot to output (callback mode)"); TEST_INFO("test convert flaot to output (callback mode)");
std::vector<float> listFreq; std::vector<float> listFreq;
@ -226,7 +226,7 @@ namespace river_test_format {
for (size_t ccc=0; ccc<listChannel.size(); ++ccc) { for (size_t ccc=0; ccc<listChannel.size(); ++ccc) {
for (size_t iii=0; iii<listFormat.size(); ++iii) { for (size_t iii=0; iii<listFormat.size(); ++iii) {
TEST_INFO("freq=" << listFreq[fff] << " channel=" << listChannel[ccc] << " format=" << getFormatString(listFormat[iii])); TEST_INFO("freq=" << listFreq[fff] << " channel=" << listChannel[ccc] << " format=" << getFormatString(listFormat[iii]));
std11::shared_ptr<testOutCallbackType> process = std11::make_shared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]); std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);

View File

@ -13,12 +13,12 @@
namespace river_test_muxer { namespace river_test_muxer {
class TestClass { class TestClass {
private: private:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interfaceIn; std::shared_ptr<audio::river::Interface> m_interfaceIn;
std11::shared_ptr<audio::river::Interface> m_interfaceOut; std::shared_ptr<audio::river::Interface> m_interfaceOut;
double m_phase; double m_phase;
public: public:
TestClass(std11::shared_ptr<audio::river::Manager> _manager) : TestClass(std::shared_ptr<audio::river::Manager> _manager) :
m_manager(_manager), m_manager(_manager),
m_phase(0) { m_phase(0) {
std::vector<audio::channel> channelMap; std::vector<audio::channel> channelMap;
@ -33,14 +33,14 @@ namespace river_test_muxer {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interfaceOut->setOutputCallback(std11::bind(&TestClass::onDataNeeded, m_interfaceOut->setOutputCallback(std::bind(&TestClass::onDataNeeded,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_interfaceOut->addVolumeGroup("FLOW"); m_interfaceOut->addVolumeGroup("FLOW");
//m_interfaceOut->setParameter("volume", "FLOW", "-6dB"); //m_interfaceOut->setParameter("volume", "FLOW", "-6dB");
@ -54,14 +54,14 @@ namespace river_test_muxer {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interfaceIn->setInputCallback(std11::bind(&TestClass::onDataReceived, m_interfaceIn->setInputCallback(std::bind(&TestClass::onDataReceived,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_manager->generateDotAll("activeProcess.dot"); m_manager->generateDotAll("activeProcess.dot");
} }
@ -166,9 +166,9 @@ namespace river_test_muxer {
TEST(TestMuxer, testMuxing) { TEST(TestMuxer, testMuxing) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
std11::shared_ptr<TestClass> process = std11::make_shared<TestClass>(manager); std::shared_ptr<TestClass> process = std::make_shared<TestClass>(manager);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);

View File

@ -12,11 +12,11 @@ namespace river_test_playback_callback {
class testOutCallback { class testOutCallback {
public: public:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interface; std::shared_ptr<audio::river::Interface> m_interface;
double m_phase; double m_phase;
public: public:
testOutCallback(std11::shared_ptr<audio::river::Manager> _manager, const std::string& _io="speaker") : testOutCallback(std::shared_ptr<audio::river::Manager> _manager, const std::string& _io="speaker") :
m_manager(_manager), m_manager(_manager),
m_phase(0) { m_phase(0) {
//Set stereo output: //Set stereo output:
@ -32,14 +32,14 @@ namespace river_test_playback_callback {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interface->setOutputCallback(std11::bind(&testOutCallback::onDataNeeded, m_interface->setOutputCallback(std::bind(&testOutCallback::onDataNeeded,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
} }
void onDataNeeded(void* _data, void onDataNeeded(void* _data,
const audio::Time& _time, const audio::Time& _time,
@ -92,11 +92,11 @@ namespace river_test_playback_callback {
TEST(TestALL, testOutputCallBack) { TEST(TestALL, testOutputCallBack) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (callback mode)"); TEST_INFO("test output (callback mode)");
std11::shared_ptr<testOutCallback> process = std11::make_shared<testOutCallback>(manager, "speaker"); std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker");
ASSERT_NE(process, nullptr); ASSERT_NE(process, nullptr);
process->run(); process->run();
process.reset(); process.reset();
@ -106,11 +106,11 @@ namespace river_test_playback_callback {
TEST(TestALL, testOutputCallBackPulse) { TEST(TestALL, testOutputCallBackPulse) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (callback mode)"); TEST_INFO("test output (callback mode)");
std11::shared_ptr<testOutCallback> process = std11::make_shared<testOutCallback>(manager, "speaker-pulse"); std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-pulse");
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);
@ -119,11 +119,11 @@ namespace river_test_playback_callback {
TEST(TestALL, testOutputCallBackJack) { TEST(TestALL, testOutputCallBackJack) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (callback mode)"); TEST_INFO("test output (callback mode)");
std11::shared_ptr<testOutCallback> process = std11::make_shared<testOutCallback>(manager, "speaker-jack"); std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-jack");
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);

View File

@ -28,10 +28,10 @@ namespace river_test_playback_write {
class testOutWrite { class testOutWrite {
public: public:
std::vector<audio::channel> m_channelMap; std::vector<audio::channel> m_channelMap;
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interface; std::shared_ptr<audio::river::Interface> m_interface;
public: public:
testOutWrite(std11::shared_ptr<audio::river::Manager> _manager) : testOutWrite(std::shared_ptr<audio::river::Manager> _manager) :
m_manager(_manager) { m_manager(_manager) {
//Set stereo output: //Set stereo output:
m_channelMap.push_back(audio::channel_frontLeft); m_channelMap.push_back(audio::channel_frontLeft);
@ -89,11 +89,11 @@ namespace river_test_playback_write {
TEST(TestALL, testOutputWrite) { TEST(TestALL, testOutputWrite) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (write mode)"); TEST_INFO("test output (write mode)");
std11::shared_ptr<testOutWrite> process = std11::make_shared<testOutWrite>(manager); std::shared_ptr<testOutWrite> process = std::make_shared<testOutWrite>(manager);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);
@ -102,11 +102,11 @@ namespace river_test_playback_write {
class testOutWriteCallback { class testOutWriteCallback {
public: public:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interface; std::shared_ptr<audio::river::Interface> m_interface;
double m_phase; double m_phase;
public: public:
testOutWriteCallback(std11::shared_ptr<audio::river::Manager> _manager) : testOutWriteCallback(std::shared_ptr<audio::river::Manager> _manager) :
m_manager(_manager), m_manager(_manager),
m_phase(0) { m_phase(0) {
std::vector<audio::channel> channelMap; std::vector<audio::channel> channelMap;
@ -122,13 +122,13 @@ namespace river_test_playback_write {
return; return;
} }
m_interface->setReadwrite(); m_interface->setReadwrite();
m_interface->setWriteCallback(std11::bind(&testOutWriteCallback::onDataNeeded, m_interface->setWriteCallback(std::bind(&testOutWriteCallback::onDataNeeded,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5)); std::placeholders::_5));
} }
void onDataNeeded(const audio::Time& _time, void onDataNeeded(const audio::Time& _time,
size_t _nbChunk, size_t _nbChunk,
@ -166,11 +166,11 @@ namespace river_test_playback_write {
TEST(TestALL, testOutputWriteWithCallback) { TEST(TestALL, testOutputWriteWithCallback) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
TEST_INFO("test output (write with callback event mode)"); TEST_INFO("test output (write with callback event mode)");
std11::shared_ptr<testOutWriteCallback> process = std11::make_shared<testOutWriteCallback>(manager); std::shared_ptr<testOutWriteCallback> process = std::make_shared<testOutWriteCallback>(manager);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);

View File

@ -28,10 +28,10 @@ namespace river_test_record_callback {
class testInCallback { class testInCallback {
public: public:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interface; std::shared_ptr<audio::river::Interface> m_interface;
public: public:
testInCallback(std11::shared_ptr<audio::river::Manager> _manager, const std::string& _input="microphone") : testInCallback(std::shared_ptr<audio::river::Manager> _manager, const std::string& _input="microphone") :
m_manager(_manager) { m_manager(_manager) {
//Set stereo output: //Set stereo output:
std::vector<audio::channel> channelMap; std::vector<audio::channel> channelMap;
@ -44,14 +44,14 @@ namespace river_test_record_callback {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interface->setInputCallback(std11::bind(&testInCallback::onDataReceived, m_interface->setInputCallback(std::bind(&testInCallback::onDataReceived,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
} }
void onDataReceived(const void* _data, void onDataReceived(const void* _data,
const audio::Time& _time, const audio::Time& _time,
@ -85,10 +85,10 @@ namespace river_test_record_callback {
TEST(TestALL, testInputCallBack) { TEST(TestALL, testInputCallBack) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
TEST_INFO("test input (callback mode)"); TEST_INFO("test input (callback mode)");
std11::shared_ptr<testInCallback> process = std11::make_shared<testInCallback>(manager); std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);

View File

@ -27,11 +27,11 @@ namespace river_test_volume {
class testCallbackVolume { class testCallbackVolume {
private: private:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interface; std::shared_ptr<audio::river::Interface> m_interface;
double m_phase; double m_phase;
public: public:
testCallbackVolume(std11::shared_ptr<audio::river::Manager> _manager) : testCallbackVolume(std::shared_ptr<audio::river::Manager> _manager) :
m_manager(_manager), m_manager(_manager),
m_phase(0) { m_phase(0) {
//Set stereo output: //Set stereo output:
@ -47,14 +47,14 @@ namespace river_test_volume {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interface->setOutputCallback(std11::bind(&testCallbackVolume::onDataNeeded, m_interface->setOutputCallback(std::bind(&testCallbackVolume::onDataNeeded,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
m_interface->addVolumeGroup("MEDIA"); m_interface->addVolumeGroup("MEDIA");
m_interface->addVolumeGroup("FLOW"); m_interface->addVolumeGroup("FLOW");
} }
@ -122,9 +122,9 @@ namespace river_test_volume {
TEST(TestALL, testVolume) { TEST(TestALL, testVolume) {
audio::river::initString(configurationRiver); audio::river::initString(configurationRiver);
std11::shared_ptr<audio::river::Manager> manager; std::shared_ptr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication"); manager = audio::river::Manager::create("testApplication");
std11::shared_ptr<testCallbackVolume> process = std11::make_shared<testCallbackVolume>(manager); std::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager);
process->run(); process->run();
process.reset(); process.reset();
usleep(500000); usleep(500000);

View File

@ -41,7 +41,7 @@ void audio::river::widget::TemporalViewer::onDataReceived(const void* _data,
enum audio::format _format, enum audio::format _format,
uint32_t _frequency, uint32_t _frequency,
const std::vector<audio::channel>& _map) { const std::vector<audio::channel>& _map) {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
if (_format != audio::format_float) { if (_format != audio::format_float) {
std::cout << "[ERROR] call wrong type ... (need int16_t)" << std::endl; std::cout << "[ERROR] call wrong type ... (need int16_t)" << std::endl;
} }
@ -59,7 +59,7 @@ void audio::river::widget::TemporalViewer::onDataReceived(const void* _data,
} }
void audio::river::widget::TemporalViewer::recordToggle() { void audio::river::widget::TemporalViewer::recordToggle() {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
if (m_interface == nullptr) { if (m_interface == nullptr) {
//Get the generic input: //Get the generic input:
std::vector<audio::channel> channel; std::vector<audio::channel> channel;
@ -73,14 +73,14 @@ void audio::river::widget::TemporalViewer::recordToggle() {
return; return;
} }
// set callback mode ... // set callback mode ...
m_interface->setInputCallback(std11::bind(&audio::river::widget::TemporalViewer::onDataReceived, m_interface->setInputCallback(std::bind(&audio::river::widget::TemporalViewer::onDataReceived,
this, this,
std11::placeholders::_1, std::placeholders::_1,
std11::placeholders::_2, std::placeholders::_2,
std11::placeholders::_3, std::placeholders::_3,
std11::placeholders::_4, std::placeholders::_4,
std11::placeholders::_5, std::placeholders::_5,
std11::placeholders::_6)); std::placeholders::_6));
// start the stream // start the stream
m_interface->start(); m_interface->start();
periodicCallEnable(); periodicCallEnable();
@ -107,7 +107,7 @@ void audio::river::widget::TemporalViewer::onRegenerateDisplay() {
m_draw.setColor(etk::color::black); m_draw.setColor(etk::color::black);
m_draw.setPos(vec2(0,0)); m_draw.setPos(vec2(0,0));
m_draw.rectangleWidth(m_size); m_draw.rectangleWidth(m_size);
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
if (m_data.size() == 0) { if (m_data.size() == 0) {
return; return;
} }
@ -146,7 +146,7 @@ void audio::river::widget::TemporalViewer::onRegenerateDisplay() {
void audio::river::widget::TemporalViewer::periodicCall(const ewol::event::Time& _event) { void audio::river::widget::TemporalViewer::periodicCall(const ewol::event::Time& _event) {
std11::unique_lock<std11::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
int32_t nbSampleDelta = _event.getDeltaCall() * float(m_sampleRate); int32_t nbSampleDelta = _event.getDeltaCall() * float(m_sampleRate);
if (m_data.size()>m_sampleRate*nbSecond) { if (m_data.size()>m_sampleRate*nbSecond) {
if (nbSampleDelta < m_data.size()) { if (nbSampleDelta < m_data.size()) {

View File

@ -17,7 +17,7 @@ namespace audio {
namespace widget { namespace widget {
class TemporalViewer : public ewol::Widget { class TemporalViewer : public ewol::Widget {
private: private:
mutable std11::mutex m_mutex; mutable std::mutex m_mutex;
private: private:
ewol::compositing::Drawing m_draw; //!< drawing instance ewol::compositing::Drawing m_draw; //!< drawing instance
protected: protected:
@ -43,8 +43,8 @@ namespace audio {
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void periodicCall(const ewol::event::Time& _event); virtual void periodicCall(const ewol::event::Time& _event);
private: private:
std11::shared_ptr<audio::river::Manager> m_manager; std::shared_ptr<audio::river::Manager> m_manager;
std11::shared_ptr<audio::river::Interface> m_interface; std::shared_ptr<audio::river::Interface> m_interface;
void onDataReceived(const void* _data, void onDataReceived(const void* _data,
const audio::Time& _time, const audio::Time& _time,
size_t _nbChunk, size_t _nbChunk,

View File

@ -8,6 +8,6 @@
int32_t audio::river::widget::getLogId() { int32_t audio::river::widget::getLogId() {
static int32_t g_val = etk::log::registerInstance("audio-river-widget"); static int32_t g_val = elog::registerInstance("audio-river-widget");
return g_val; return g_val;
} }

View File

@ -5,7 +5,7 @@
*/ */
#pragma once #pragma once
#include <etk/log.h> #include <elog/log.h>
namespace audio { namespace audio {
namespace river { namespace river {
@ -15,7 +15,7 @@ namespace audio {
} }
} }
#define ARW_BASE(info,data) TK_LOG_BASE(audio::river::widget::getLogId(),info,data) #define ARW_BASE(info,data) ELOG_BASE(audio::river::widget::getLogId(),info,data)
#define ARW_PRINT(data) ARW_BASE(-1, data) #define ARW_PRINT(data) ARW_BASE(-1, data)
#define ARW_CRITICAL(data) ARW_BASE(1, data) #define ARW_CRITICAL(data) ARW_BASE(1, data)