[RENAME] change airtaudio => river

This commit is contained in:
Edouard DUPIN 2015-02-05 19:10:53 +01:00
parent e0e9b1670d
commit e7a23e6b8d
14 changed files with 214 additions and 214 deletions

View File

@ -4,21 +4,21 @@ import lutinTools as tools
import lutinDebug as debug import lutinDebug as debug
def get_desc(): def get_desc():
return "airtio : Multi-nodal audio interface" return "river : Multi-nodal audio interface"
def create(target): def create(target):
myModule = module.Module(__file__, 'airtio', 'LIBRARY') myModule = module.Module(__file__, 'river', 'LIBRARY')
myModule.add_src_file([ myModule.add_src_file([
'airtio/debug.cpp', 'river/debug.cpp',
'airtio/Manager.cpp', 'river/Manager.cpp',
'airtio/Interface.cpp', 'river/Interface.cpp',
'airtio/io/Node.cpp', 'river/io/Node.cpp',
'airtio/io/Manager.cpp' 'river/io/Manager.cpp'
]) ])
myModule.add_module_depend(['airtaudio', 'airtalgo', 'ejson']) myModule.add_module_depend(['audio', 'airtaudio', 'drain', 'ejson'])
myModule.add_export_path(tools.get_current_path(__file__)) myModule.add_export_path(tools.get_current_path(__file__))
# add the currrent module at the # add the currrent module at the

View File

@ -4,11 +4,11 @@ import lutinTools as tools
import lutinDebug as debug import lutinDebug as debug
def get_desc(): def get_desc():
return "airtio_test : Multi-nodal audio interface test" return "river_test : Multi-nodal audio interface test"
def create(target): def create(target):
myModule = module.Module(__file__, 'airtio_test', 'BINARY') myModule = module.Module(__file__, 'river_test', 'BINARY')
myModule.add_src_file([ myModule.add_src_file([
'test/main.cpp', 'test/main.cpp',
@ -16,7 +16,7 @@ def create(target):
]) ])
myModule.copy_folder('data/*') myModule.copy_folder('data/*')
myModule.add_module_depend(['airtio', 'gtest', 'etk']) myModule.add_module_depend(['river', 'gtest', 'etk'])
# add the currrent module at the # add the currrent module at the
return myModule return myModule

View File

@ -7,16 +7,16 @@
#include "debug.h" #include "debug.h"
#include "Interface.h" #include "Interface.h"
#include "io/Node.h" #include "io/Node.h"
#include <airtalgo/EndPointCallback.h> #include <drain/EndPointCallback.h>
#include <airtalgo/EndPointWrite.h> #include <drain/EndPointWrite.h>
#include <airtalgo/EndPointRead.h> #include <drain/EndPointRead.h>
#include <airtalgo/Volume.h> #include <drain/Volume.h>
#undef __class__ #undef __class__
#define __class__ "Interface" #define __class__ "Interface"
airtio::Interface::Interface(void) : river::Interface::Interface(void) :
m_node(nullptr), m_node(nullptr),
m_freq(8000), m_freq(8000),
m_map(), m_map(),
@ -26,41 +26,41 @@ airtio::Interface::Interface(void) :
} }
bool airtio::Interface::init(const std::string& _name, bool river::Interface::init(const std::string& _name,
float _freq, float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node) { const std::shared_ptr<river::io::Node>& _node) {
m_name = _name; m_name = _name;
m_node = _node; m_node = _node;
m_freq = _freq; m_freq = _freq;
m_map = _map; m_map = _map;
m_format = _format; m_format = _format;
m_process = std::make_shared<airtalgo::Process>(); m_process = std::make_shared<drain::Process>();
m_volume = 0.0f; m_volume = 0.0f;
// register interface to be notify from the volume change. // register interface to be notify from the volume change.
m_node->registerAsRemote(shared_from_this()); m_node->registerAsRemote(shared_from_this());
// Create convertion interface // Create convertion interface
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
// add all time the volume stage : // add all time the volume stage :
std::shared_ptr<airtalgo::Volume> algo = airtalgo::Volume::create(); std::shared_ptr<drain::Volume> algo = 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);
AIRTIO_INFO("add basic volume stage (1)"); AIRTIO_INFO("add basic volume stage (1)");
std::shared_ptr<airtalgo::VolumeElement> tmpVolume = m_node->getVolume(); std::shared_ptr<drain::VolumeElement> tmpVolume = m_node->getVolume();
if (tmpVolume != nullptr) { if (tmpVolume != nullptr) {
AIRTIO_INFO(" add volume for node"); AIRTIO_INFO(" add volume for node");
algo->addVolumeStage(tmpVolume); algo->addVolumeStage(tmpVolume);
} }
} else { } else {
// add all time the volume stage : // add all time the volume stage :
std::shared_ptr<airtalgo::Volume> algo = airtalgo::Volume::create(); std::shared_ptr<drain::Volume> algo = 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);
AIRTIO_INFO("add basic volume stage (2)"); AIRTIO_INFO("add basic volume stage (2)");
std::shared_ptr<airtalgo::VolumeElement> tmpVolume = m_node->getVolume(); std::shared_ptr<drain::VolumeElement> tmpVolume = m_node->getVolume();
if (tmpVolume != nullptr) { if (tmpVolume != nullptr) {
AIRTIO_INFO(" add volume for node"); AIRTIO_INFO(" add volume for node");
algo->addVolumeStage(tmpVolume); algo->addVolumeStage(tmpVolume);
@ -69,81 +69,81 @@ bool airtio::Interface::init(const std::string& _name,
return true; return true;
} }
std::shared_ptr<airtio::Interface> airtio::Interface::create(const std::string& _name, std::shared_ptr<river::Interface> river::Interface::create(const std::string& _name,
float _freq, float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node) { const std::shared_ptr<river::io::Node>& _node) {
std::shared_ptr<airtio::Interface> out = std::shared_ptr<airtio::Interface>(new airtio::Interface()); std::shared_ptr<river::Interface> out = std::shared_ptr<river::Interface>(new river::Interface());
out->init(_name, _freq, _map, _format, _node); out->init(_name, _freq, _map, _format, _node);
return out; return out;
} }
airtio::Interface::~Interface() { river::Interface::~Interface() {
//stop(true, true); //stop(true, true);
std::unique_lock<std::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());
m_process.reset(); m_process.reset();
} }
/* /*
bool airtio::Interface::hasEndPoint() { bool river::Interface::hasEndPoint() {
} }
*/ */
void airtio::Interface::setReadwrite() { void river::Interface::setReadwrite() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->removeAlgoDynamic(); m_process->removeAlgoDynamic();
if (m_process->hasType<airtalgo::EndPoint>() ) { if (m_process->hasType<drain::EndPoint>() ) {
AIRTIO_ERROR("Endpoint is already present ==> can not change"); AIRTIO_ERROR("Endpoint is already present ==> can not change");
return; return;
} }
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
m_process->removeIfLast<airtalgo::EndPoint>(); m_process->removeIfLast<drain::EndPoint>();
std::shared_ptr<airtalgo::EndPointRead> algo = airtalgo::EndPointRead::create(); std::shared_ptr<drain::EndPointRead> algo = drain::EndPointRead::create();
///algo->setInputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); ///algo->setInputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
algo->setOutputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); algo->setOutputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
m_process->pushBack(algo); m_process->pushBack(algo);
} else { } else {
m_process->removeIfFirst<airtalgo::EndPoint>(); m_process->removeIfFirst<drain::EndPoint>();
std::shared_ptr<airtalgo::EndPointWrite> algo = airtalgo::EndPointWrite::create(); std::shared_ptr<drain::EndPointWrite> algo = drain::EndPointWrite::create();
algo->setInputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); algo->setInputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
//algo->setOutputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); //algo->setOutputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
m_process->pushFront(algo); m_process->pushFront(algo);
} }
} }
void airtio::Interface::setOutputCallback(size_t _chunkSize, airtalgo::needDataFunction _function) { void river::Interface::setOutputCallback(size_t _chunkSize, drain::needDataFunction _function) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->removeAlgoDynamic(); m_process->removeAlgoDynamic();
m_process->removeIfFirst<airtalgo::EndPoint>(); m_process->removeIfFirst<drain::EndPoint>();
std::shared_ptr<airtalgo::Algo> algo = airtalgo::EndPointCallback::create(_function); std::shared_ptr<drain::Algo> algo = drain::EndPointCallback::create(_function);
AIRTIO_INFO("set property: " << m_map << " " << m_format << " " << m_freq); AIRTIO_INFO("set property: " << m_map << " " << m_format << " " << m_freq);
algo->setInputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); algo->setInputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
//algo->setOutputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); //algo->setOutputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
m_process->pushFront(algo); m_process->pushFront(algo);
} }
void airtio::Interface::setInputCallback(size_t _chunkSize, airtalgo::haveNewDataFunction _function) { void river::Interface::setInputCallback(size_t _chunkSize, drain::haveNewDataFunction _function) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->removeAlgoDynamic(); m_process->removeAlgoDynamic();
m_process->removeIfLast<airtalgo::EndPoint>(); m_process->removeIfLast<drain::EndPoint>();
std::shared_ptr<airtalgo::Algo> algo = airtalgo::EndPointCallback::create(_function); std::shared_ptr<drain::Algo> algo = drain::EndPointCallback::create(_function);
//algo->setInputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); //algo->setInputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
algo->setOutputFormat(airtalgo::IOFormatInterface(m_map, m_format, m_freq)); algo->setOutputFormat(drain::IOFormatInterface(m_map, m_format, m_freq));
m_process->pushBack(algo); m_process->pushBack(algo);
} }
void airtio::Interface::setWriteCallback(airtalgo::needDataFunctionWrite _function) { void river::Interface::setWriteCallback(drain::needDataFunctionWrite _function) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->removeAlgoDynamic(); m_process->removeAlgoDynamic();
std::shared_ptr<airtalgo::EndPointWrite> algo = m_process->get<airtalgo::EndPointWrite>(0); std::shared_ptr<drain::EndPointWrite> algo = m_process->get<drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
return; return;
} }
algo->setCallback(_function); algo->setCallback(_function);
} }
void airtio::Interface::start(const std::chrono::system_clock::time_point& _time) { void river::Interface::start(const std::chrono::system_clock::time_point& _time) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
AIRTIO_DEBUG("start [BEGIN]"); AIRTIO_DEBUG("start [BEGIN]");
m_process->updateInterAlgo(); m_process->updateInterAlgo();
@ -151,21 +151,21 @@ void airtio::Interface::start(const std::chrono::system_clock::time_point& _time
AIRTIO_DEBUG("start [ END ]"); AIRTIO_DEBUG("start [ END ]");
} }
void airtio::Interface::stop(bool _fast, bool _abort) { void river::Interface::stop(bool _fast, bool _abort) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
AIRTIO_DEBUG("stop [BEGIN]"); AIRTIO_DEBUG("stop [BEGIN]");
m_node->interfaceRemove(shared_from_this()); m_node->interfaceRemove(shared_from_this());
AIRTIO_DEBUG("stop [ END]"); AIRTIO_DEBUG("stop [ END]");
} }
void airtio::Interface::abort() { void river::Interface::abort() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
AIRTIO_DEBUG("abort [BEGIN]"); AIRTIO_DEBUG("abort [BEGIN]");
// TODO :... // TODO :...
AIRTIO_DEBUG("abort [ END ]"); AIRTIO_DEBUG("abort [ END ]");
} }
bool airtio::Interface::setParameter(const std::string& _filter, const std::string& _parameter, const std::string& _value) { bool river::Interface::setParameter(const std::string& _filter, const std::string& _parameter, const std::string& _value) {
AIRTIO_DEBUG("setParameter [BEGIN] : '" << _filter << "':'" << _parameter << "':'" << _value << "'"); AIRTIO_DEBUG("setParameter [BEGIN] : '" << _filter << "':'" << _parameter << "':'" << _value << "'");
bool out = false; bool out = false;
if ( _filter == "volume" if ( _filter == "volume"
@ -173,7 +173,7 @@ bool airtio::Interface::setParameter(const std::string& _filter, const std::stri
AIRTIO_ERROR("Interface is not allowed to modify '" << _parameter << "' Volume just allowed to modify 'FLOW' volume"); AIRTIO_ERROR("Interface is not allowed to modify '" << _parameter << "' Volume just allowed to modify 'FLOW' volume");
return false; return false;
} }
std::shared_ptr<airtalgo::Algo> algo = m_process->get<airtalgo::Algo>(_filter); std::shared_ptr<drain::Algo> algo = m_process->get<drain::Algo>(_filter);
if (algo == nullptr) { if (algo == nullptr) {
AIRTIO_ERROR("setParameter(" << _filter << ") ==> no filter named like this ..."); AIRTIO_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return false; return false;
@ -182,10 +182,10 @@ bool airtio::Interface::setParameter(const std::string& _filter, const std::stri
AIRTIO_DEBUG("setParameter [ END ] : '" << out << "'"); AIRTIO_DEBUG("setParameter [ END ] : '" << out << "'");
return out; return out;
} }
std::string airtio::Interface::getParameter(const std::string& _filter, const std::string& _parameter) const { std::string river::Interface::getParameter(const std::string& _filter, const std::string& _parameter) const {
AIRTIO_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'"); AIRTIO_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'");
std::string out; std::string out;
std::shared_ptr<airtalgo::Algo> algo = m_process->get<airtalgo::Algo>(_filter); std::shared_ptr<drain::Algo> algo = m_process->get<drain::Algo>(_filter);
if (algo == nullptr) { if (algo == nullptr) {
AIRTIO_ERROR("setParameter(" << _filter << ") ==> no filter named like this ..."); AIRTIO_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return "[ERROR]"; return "[ERROR]";
@ -194,10 +194,10 @@ std::string airtio::Interface::getParameter(const std::string& _filter, const st
AIRTIO_DEBUG("getParameter [ END ] : '" << out << "'"); AIRTIO_DEBUG("getParameter [ END ] : '" << out << "'");
return out; return out;
} }
std::string airtio::Interface::getParameterProperty(const std::string& _filter, const std::string& _parameter) const { std::string river::Interface::getParameterProperty(const std::string& _filter, const std::string& _parameter) const {
AIRTIO_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'"); AIRTIO_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'");
std::string out; std::string out;
std::shared_ptr<airtalgo::Algo> algo = m_process->get<airtalgo::Algo>(_filter); std::shared_ptr<drain::Algo> algo = m_process->get<drain::Algo>(_filter);
if (algo == nullptr) { if (algo == nullptr) {
AIRTIO_ERROR("setParameter(" << _filter << ") ==> no filter named like this ..."); AIRTIO_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
return "[ERROR]"; return "[ERROR]";
@ -207,10 +207,10 @@ std::string airtio::Interface::getParameterProperty(const std::string& _filter,
return out; return out;
} }
void airtio::Interface::write(const void* _value, size_t _nbChunk) { void river::Interface::write(const void* _value, size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->updateInterAlgo(); m_process->updateInterAlgo();
std::shared_ptr<airtalgo::EndPointWrite> algo = m_process->get<airtalgo::EndPointWrite>(0); std::shared_ptr<drain::EndPointWrite> algo = m_process->get<drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
return; return;
} }
@ -219,7 +219,7 @@ void airtio::Interface::write(const void* _value, size_t _nbChunk) {
#if 0 #if 0
// TODO : add API aCCess mutex for Read and write... // TODO : add API aCCess mutex for Read and write...
std::vector<int16_t> airtio::Interface::read(size_t _nbChunk) { std::vector<int16_t> river::Interface::read(size_t _nbChunk) {
// TODO :... // TODO :...
std::vector<int16_t> data; std::vector<int16_t> data;
/* /*
@ -242,78 +242,78 @@ std::vector<int16_t> airtio::Interface::read(size_t _nbChunk) {
} }
#endif #endif
void airtio::Interface::read(void* _value, size_t _nbChunk) { void river::Interface::read(void* _value, size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->updateInterAlgo(); m_process->updateInterAlgo();
// TODO :... // TODO :...
} }
size_t airtio::Interface::size() const { size_t river::Interface::size() const {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
// TODO :... // TODO :...
return 0; return 0;
} }
void airtio::Interface::setBufferSize(size_t _nbChunk) { void river::Interface::setBufferSize(size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->updateInterAlgo(); m_process->updateInterAlgo();
// TODO :... // TODO :...
} }
void airtio::Interface::setBufferSize(const std::chrono::duration<int64_t, std::micro>& _time) { void river::Interface::setBufferSize(const std::chrono::duration<int64_t, std::micro>& _time) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->updateInterAlgo(); m_process->updateInterAlgo();
// TODO :... // TODO :...
} }
void airtio::Interface::clearInternalBuffer() { void river::Interface::clearInternalBuffer() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_process->updateInterAlgo(); m_process->updateInterAlgo();
// TODO :... // TODO :...
} }
std::chrono::system_clock::time_point airtio::Interface::getCurrentTime() const { std::chrono::system_clock::time_point river::Interface::getCurrentTime() const {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
// TODO :... // TODO :...
return std::chrono::system_clock::time_point(); return std::chrono::system_clock::time_point();
return std::chrono::system_clock::now(); return std::chrono::system_clock::now();
} }
void airtio::Interface::addVolumeGroup(const std::string& _name) { void river::Interface::addVolumeGroup(const std::string& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); std::unique_lock<std::recursive_mutex> lock(m_mutex);
AIRTIO_DEBUG("addVolumeGroup(" << _name << ")"); AIRTIO_DEBUG("addVolumeGroup(" << _name << ")");
std::shared_ptr<airtalgo::Volume> algo = m_process->get<airtalgo::Volume>("volume"); std::shared_ptr<drain::Volume> algo = m_process->get<drain::Volume>("volume");
if (algo == nullptr) { if (algo == nullptr) {
AIRTIO_ERROR("addVolumeGroup(" << _name << ") ==> no volume stage ... can not add it ..."); AIRTIO_ERROR("addVolumeGroup(" << _name << ") ==> no volume stage ... can not add it ...");
return; return;
} }
if (_name == "FLOW") { if (_name == "FLOW") {
// Local volume name // Local volume name
algo->addVolumeStage(std::make_shared<airtalgo::VolumeElement>(_name)); algo->addVolumeStage(std::make_shared<drain::VolumeElement>(_name));
} else { } else {
// get manager unique instance: // get manager unique instance:
std::shared_ptr<airtio::io::Manager> mng = airtio::io::Manager::getInstance(); std::shared_ptr<river::io::Manager> mng = river::io::Manager::getInstance();
algo->addVolumeStage(mng->getVolumeGroup(_name)); algo->addVolumeStage(mng->getVolumeGroup(_name));
} }
} }
void airtio::Interface::systemNewInputData(std::chrono::system_clock::time_point _time, void* _data, size_t _nbChunk) { void river::Interface::systemNewInputData(std::chrono::system_clock::time_point _time, void* _data, size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lockProcess(m_mutex); std::unique_lock<std::recursive_mutex> lockProcess(m_mutex);
m_process->push(_time, _data, _nbChunk); m_process->push(_time, _data, _nbChunk);
} }
void airtio::Interface::systemNeedOutputData(std::chrono::system_clock::time_point _time, void* _data, size_t _nbChunk, size_t _chunkSize) { void river::Interface::systemNeedOutputData(std::chrono::system_clock::time_point _time, void* _data, size_t _nbChunk, size_t _chunkSize) {
std::unique_lock<std::recursive_mutex> lockProcess(m_mutex); std::unique_lock<std::recursive_mutex> lockProcess(m_mutex);
m_process->pull(_time, _data, _nbChunk, _chunkSize); m_process->pull(_time, _data, _nbChunk, _chunkSize);
} }
void airtio::Interface::systemVolumeChange() { void river::Interface::systemVolumeChange() {
std::unique_lock<std::recursive_mutex> lockProcess(m_mutex); std::unique_lock<std::recursive_mutex> lockProcess(m_mutex);
std::shared_ptr<airtalgo::Volume> algo = m_process->get<airtalgo::Volume>("volume"); std::shared_ptr<drain::Volume> algo = m_process->get<drain::Volume>("volume");
if (algo == nullptr) { if (algo == nullptr) {
return; return;
} }

View File

@ -15,12 +15,12 @@
#include <mutex> #include <mutex>
#include <audio/format.h> #include <audio/format.h>
#include <audio/channel.h> #include <audio/channel.h>
#include <airtalgo/Process.h> #include <drain/Process.h>
#include <airtalgo/EndPointCallback.h> #include <drain/EndPointCallback.h>
#include <airtalgo/EndPointWrite.h> #include <drain/EndPointWrite.h>
#include <memory> #include <memory>
namespace airtio { namespace river {
namespace io { namespace io {
class Node; class Node;
} }
@ -30,11 +30,11 @@ namespace airtio {
protected: protected:
mutable std::recursive_mutex m_mutex; mutable std::recursive_mutex m_mutex;
protected: protected:
std::shared_ptr<airtio::io::Node> m_node; std::shared_ptr<river::io::Node> m_node;
float m_freq; float m_freq;
std::vector<audio::channel> m_map; std::vector<audio::channel> m_map;
audio::format m_format; audio::format m_format;
std::shared_ptr<airtalgo::Process> m_process; std::shared_ptr<drain::Process> m_process;
protected: protected:
std::string m_name; std::string m_name;
public: public:
@ -50,7 +50,7 @@ namespace airtio {
float _freq, float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node); const std::shared_ptr<river::io::Node>& _node);
public: public:
/** /**
* @brief Destructor * @brief Destructor
@ -60,7 +60,7 @@ namespace airtio {
float _freq, float _freq,
const std::vector<audio::channel>& _map, const std::vector<audio::channel>& _map,
audio::format _format, audio::format _format,
const std::shared_ptr<airtio::io::Node>& _node); const std::shared_ptr<river::io::Node>& _node);
/** /**
* @brief set the read/write mode enable. * @brief set the read/write mode enable.
*/ */
@ -68,9 +68,9 @@ namespace airtio {
/** /**
* @brief When we want to implement a Callback Mode: * @brief When we want to implement a Callback Mode:
*/ */
virtual void setWriteCallback(airtalgo::needDataFunctionWrite _function); virtual void setWriteCallback(drain::needDataFunctionWrite _function);
virtual void setOutputCallback(size_t _chunkSize, airtalgo::needDataFunction _function); virtual void setOutputCallback(size_t _chunkSize, drain::needDataFunction _function);
virtual void setInputCallback(size_t _chunkSize, airtalgo::haveNewDataFunction _function); virtual void setInputCallback(size_t _chunkSize, drain::haveNewDataFunction _function);
/** /**
* @brief Add a volume group of the current channel. * @brief Add a volume group of the current channel.
* @note If you do not call this function with the group "FLOW" you chan not have a channel volume. * @note If you do not call this function with the group "FLOW" you chan not have a channel volume.

View File

@ -16,75 +16,75 @@
#undef __class__ #undef __class__
#define __class__ "Manager" #define __class__ "Manager"
std::shared_ptr<airtio::Manager> airtio::Manager::create(const std::string& _applicationUniqueId) { std::shared_ptr<river::Manager> river::Manager::create(const std::string& _applicationUniqueId) {
return std::shared_ptr<airtio::Manager>(new airtio::Manager(_applicationUniqueId)); return std::shared_ptr<river::Manager>(new river::Manager(_applicationUniqueId));
} }
airtio::Manager::Manager(const std::string& _applicationUniqueId) : river::Manager::Manager(const std::string& _applicationUniqueId) :
m_applicationUniqueId(_applicationUniqueId), m_applicationUniqueId(_applicationUniqueId),
m_listOpenInterface() { m_listOpenInterface() {
} }
airtio::Manager::~Manager() { river::Manager::~Manager() {
// TODO : Stop all interfaces... // TODO : Stop all interfaces...
} }
std::vector<std::pair<std::string,std::string> > airtio::Manager::getListStreamInput() { std::vector<std::pair<std::string,std::string> > river::Manager::getListStreamInput() {
std::vector<std::pair<std::string,std::string> > output; std::vector<std::pair<std::string,std::string> > output;
//output.push_back(std::make_pair<std::string,std::string>("default", "48000 Hz, 16 bits, 2 channels: Default input ")); //output.push_back(std::make_pair<std::string,std::string>("default", "48000 Hz, 16 bits, 2 channels: Default input "));
return output; return output;
} }
std::vector<std::pair<std::string,std::string> > airtio::Manager::getListStreamOutput() { std::vector<std::pair<std::string,std::string> > river::Manager::getListStreamOutput() {
std::vector<std::pair<std::string,std::string> > output; std::vector<std::pair<std::string,std::string> > output;
//output.push_back(std::make_pair<std::string,std::string>("default", "48000 Hz, 16 bits, 2 channels: Default output ")); //output.push_back(std::make_pair<std::string,std::string>("default", "48000 Hz, 16 bits, 2 channels: Default output "));
return output; return output;
} }
bool airtio::Manager::setVolume(const std::string& _volumeName, float _valuedB) { bool river::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
return airtio::io::Manager::getInstance()->setVolume(_volumeName, _valuedB); return river::io::Manager::getInstance()->setVolume(_volumeName, _valuedB);
} }
float airtio::Manager::getVolume(const std::string& _volumeName) const { float river::Manager::getVolume(const std::string& _volumeName) const {
return airtio::io::Manager::getInstance()->getVolume(_volumeName); return river::io::Manager::getInstance()->getVolume(_volumeName);
} }
std::pair<float,float> airtio::Manager::getVolumeRange(const std::string& _volumeName) const { std::pair<float,float> river::Manager::getVolumeRange(const std::string& _volumeName) const {
return airtio::io::Manager::getInstance()->getVolumeRange(_volumeName); return river::io::Manager::getInstance()->getVolumeRange(_volumeName);
} }
std::shared_ptr<airtio::Interface> airtio::Manager::createOutput(float _freq, std::shared_ptr<river::Interface> 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& _name) { const std::string& _name) {
// get global hardware interface: // get global hardware interface:
std::shared_ptr<airtio::io::Manager> manager = airtio::io::Manager::getInstance(); std::shared_ptr<river::io::Manager> manager = river::io::Manager::getInstance();
// get the output or input channel : // get the output or input channel :
std::shared_ptr<airtio::io::Node> node = manager->getNode(_streamName);//, false); std::shared_ptr<river::io::Node> node = manager->getNode(_streamName);//, false);
// create user iterface: // create user iterface:
std::shared_ptr<airtio::Interface> interface; std::shared_ptr<river::Interface> interface;
interface = airtio::Interface::create(_name, _freq, _map, _format, node); interface = river::Interface::create(_name, _freq, _map, _format, node);
// store it in a list (needed to apply some parameters). // store it in a list (needed to apply some parameters).
m_listOpenInterface.push_back(interface); m_listOpenInterface.push_back(interface);
return interface; return interface;
} }
std::shared_ptr<airtio::Interface> airtio::Manager::createInput(float _freq, std::shared_ptr<river::Interface> 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& _name) { const std::string& _name) {
// get global hardware interface: // get global hardware interface:
std::shared_ptr<airtio::io::Manager> manager = airtio::io::Manager::getInstance(); std::shared_ptr<river::io::Manager> manager = river::io::Manager::getInstance();
// get the output or input channel : // get the output or input channel :
std::shared_ptr<airtio::io::Node> node = manager->getNode(_streamName);//, true); std::shared_ptr<river::io::Node> node = manager->getNode(_streamName);//, true);
// create user iterface: // create user iterface:
std::shared_ptr<airtio::Interface> interface; std::shared_ptr<river::Interface> interface;
interface = airtio::Interface::create(_name, _freq, _map, _format, node); interface = river::Interface::create(_name, _freq, _map, _format, node);
// store it in a list (needed to apply some parameters). // store it in a list (needed to apply some parameters).
m_listOpenInterface.push_back(interface); m_listOpenInterface.push_back(interface);
return interface; return interface;

View File

@ -10,25 +10,25 @@
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
#include <memory> #include <memory>
#include <airtio/Interface.h> #include <river/Interface.h>
#include <audio/format.h> #include <audio/format.h>
#include <audio/channel.h> #include <audio/channel.h>
namespace airtio { namespace river {
/** /**
* @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 { class 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<std::weak_ptr<airtio::Interface> > m_listOpenInterface; //!< List of all open Stream. std::vector<std::weak_ptr<river::Interface> > m_listOpenInterface; //!< List of all open Stream.
protected: protected:
/** /**
* @brief Constructor * @brief Constructor
*/ */
Manager(const std::string& _applicationUniqueId); Manager(const std::string& _applicationUniqueId);
public: public:
static std::shared_ptr<airtio::Manager> create(const std::string& _applicationUniqueId); static std::shared_ptr<river::Manager> create(const std::string& _applicationUniqueId);
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -4,10 +4,10 @@
* @license APACHE v2.0 (see license file) * @license APACHE v2.0 (see license file)
*/ */
#include <airtio/debug.h> #include <river/debug.h>
int32_t airtio::getLogId() { int32_t river::getLogId() {
static int32_t g_val = etk::log::registerInstance("airtio"); static int32_t g_val = etk::log::registerInstance("river");
return g_val; return g_val;
} }

View File

@ -10,17 +10,17 @@
#include <etk/log.h> #include <etk/log.h>
namespace airtio { namespace river {
int32_t getLogId(); int32_t getLogId();
}; };
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" // TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
#define AIRTIO_BASE(info,data) \ #define AIRTIO_BASE(info,data) \
do { \ do { \
if (info <= etk::log::getLevel(airtio::getLogId())) { \ if (info <= etk::log::getLevel(river::getLogId())) { \
std::stringbuf sb; \ std::stringbuf sb; \
std::ostream tmpStream(&sb); \ std::ostream tmpStream(&sb); \
tmpStream << data; \ tmpStream << data; \
etk::log::logStream(airtio::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ etk::log::logStream(river::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
} \ } \
} while(0) } while(0)

View File

@ -6,27 +6,27 @@
#include "Manager.h" #include "Manager.h"
#include <memory> #include <memory>
#include <airtio/debug.h> #include <river/debug.h>
#include "Node.h" #include "Node.h"
#undef __class__ #undef __class__
#define __class__ "io::Manager" #define __class__ "io::Manager"
airtio::io::Manager::Manager() { river::io::Manager::Manager() {
if (m_config.load("DATA:hardware.json") == false) { if (m_config.load("DATA:hardware.json") == false) {
AIRTIO_ERROR("you must set a basic configuration file for harware configuration: DATA:hardware.json"); AIRTIO_ERROR("you must set a basic configuration file for harware configuration: DATA:hardware.json");
} }
}; };
std::shared_ptr<airtio::io::Manager> airtio::io::Manager::getInstance() { std::shared_ptr<river::io::Manager> river::io::Manager::getInstance() {
static std::shared_ptr<airtio::io::Manager> manager(new Manager()); static std::shared_ptr<river::io::Manager> manager(new Manager());
return manager; return manager;
} }
std::shared_ptr<airtio::io::Node> airtio::io::Manager::getNode(const std::string& _name) { std::shared_ptr<river::io::Node> river::io::Manager::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) {
std::shared_ptr<airtio::io::Node> tmppp = m_list[iii].lock(); std::shared_ptr<river::io::Node> tmppp = m_list[iii].lock();
if ( tmppp != nullptr if ( tmppp != nullptr
&& _name == tmppp->getName()) { && _name == tmppp->getName()) {
return tmppp; return tmppp;
@ -35,7 +35,7 @@ std::shared_ptr<airtio::io::Node> airtio::io::Manager::getNode(const std::string
// check if the node can be open : // check if the node can be open :
const std::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) {
std::shared_ptr<airtio::io::Node> tmp = airtio::io::Node::create(_name, tmpObject); std::shared_ptr<river::io::Node> tmp = river::io::Node::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;
} }
@ -43,7 +43,7 @@ std::shared_ptr<airtio::io::Node> airtio::io::Manager::getNode(const std::string
return nullptr; return nullptr;
} }
std::shared_ptr<airtalgo::VolumeElement> airtio::io::Manager::getVolumeGroup(const std::string& _name) { std::shared_ptr<drain::VolumeElement> river::io::Manager::getVolumeGroup(const std::string& _name) {
if (_name == "") { if (_name == "") {
AIRTIO_ERROR("Try to create an audio group with no name ..."); AIRTIO_ERROR("Try to create an audio group with no name ...");
return nullptr; return nullptr;
@ -57,13 +57,13 @@ std::shared_ptr<airtalgo::VolumeElement> airtio::io::Manager::getVolumeGroup(con
} }
} }
AIRTIO_DEBUG("Add a new volume group : '" << _name << "'"); AIRTIO_DEBUG("Add a new volume group : '" << _name << "'");
std::shared_ptr<airtalgo::VolumeElement> tmpVolume = std::make_shared<airtalgo::VolumeElement>(_name); std::shared_ptr<drain::VolumeElement> tmpVolume = std::make_shared<drain::VolumeElement>(_name);
m_volumeGroup.push_back(tmpVolume); m_volumeGroup.push_back(tmpVolume);
return tmpVolume; return tmpVolume;
} }
bool airtio::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) { bool river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
std::shared_ptr<airtalgo::VolumeElement> volume = getVolumeGroup(_volumeName); std::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
if (volume == nullptr) { if (volume == nullptr) {
AIRTIO_ERROR("Can not set volume ... : '" << _volumeName << "'"); AIRTIO_ERROR("Can not set volume ... : '" << _volumeName << "'");
return false; return false;
@ -75,7 +75,7 @@ bool airtio::io::Manager::setVolume(const std::string& _volumeName, float _value
} }
volume->setVolume(_valuedB); volume->setVolume(_valuedB);
for (auto &it2 : m_list) { for (auto &it2 : m_list) {
std::shared_ptr<airtio::io::Node> val = it2.lock(); std::shared_ptr<river::io::Node> val = it2.lock();
if (val != nullptr) { if (val != nullptr) {
val->volumeChange(); val->volumeChange();
} }
@ -83,8 +83,8 @@ bool airtio::io::Manager::setVolume(const std::string& _volumeName, float _value
return true; return true;
} }
float airtio::io::Manager::getVolume(const std::string& _volumeName) { float river::io::Manager::getVolume(const std::string& _volumeName) {
std::shared_ptr<airtalgo::VolumeElement> volume = getVolumeGroup(_volumeName); std::shared_ptr<drain::VolumeElement> volume = getVolumeGroup(_volumeName);
if (volume == nullptr) { if (volume == nullptr) {
AIRTIO_ERROR("Can not get volume ... : '" << _volumeName << "'"); AIRTIO_ERROR("Can not get volume ... : '" << _volumeName << "'");
return 0.0f; return 0.0f;
@ -92,6 +92,6 @@ float airtio::io::Manager::getVolume(const std::string& _volumeName) {
return volume->getVolume(); return volume->getVolume();
} }
std::pair<float,float> airtio::io::Manager::getVolumeRange(const std::string& _volumeName) const { std::pair<float,float> river::io::Manager::getVolumeRange(const std::string& _volumeName) const {
return std::make_pair<float,float>(-300, 300); return std::make_pair<float,float>(-300, 300);
} }

View File

@ -17,9 +17,9 @@
#include <audio/channel.h> #include <audio/channel.h>
#include <ejson/ejson.h> #include <ejson/ejson.h>
#include <memory> #include <memory>
#include <airtalgo/Volume.h> #include <drain/Volume.h>
namespace airtio { namespace river {
namespace io { namespace io {
class Node; class Node;
class Manager { class Manager {
@ -36,14 +36,14 @@ namespace airtio {
virtual ~Manager() {}; virtual ~Manager() {};
private: private:
ejson::Document m_config; // harware configuration ejson::Document m_config; // harware configuration
std::vector<std::shared_ptr<airtio::io::Node> > m_listKeepAlive; //!< list of all Node that might be keep alive sone time std::vector<std::shared_ptr<river::io::Node> > m_listKeepAlive; //!< list of all Node that might be keep alive sone time
std::vector<std::weak_ptr<airtio::io::Node> > m_list; //!< List of all IO node std::vector<std::weak_ptr<river::io::Node> > m_list; //!< List of all IO node
public: public:
std::shared_ptr<airtio::io::Node> getNode(const std::string& _name); std::shared_ptr<river::io::Node> getNode(const std::string& _name);
private: private:
std::vector<std::shared_ptr<airtalgo::VolumeElement>> m_volumeGroup; std::vector<std::shared_ptr<drain::VolumeElement>> m_volumeGroup;
public: public:
std::shared_ptr<airtalgo::VolumeElement> getVolumeGroup(const std::string& _name); std::shared_ptr<drain::VolumeElement> getVolumeGroup(const std::string& _name);
/** /**
* @brief Set a volume for a specific group * @brief Set a volume for a specific group

View File

@ -5,7 +5,7 @@
*/ */
#include "Node.h" #include "Node.h"
#include <airtio/debug.h> #include <river/debug.h>
#include <memory> #include <memory>
@ -25,7 +25,7 @@
#define INT32_MIN (-INT32_MAX - 1L) #define INT32_MIN (-INT32_MAX - 1L)
#endif #endif
int32_t airtio::io::Node::rtAudioCallback(void* _outputBuffer, int32_t river::io::Node::rtAudioCallback(void* _outputBuffer,
void* _inputBuffer, void* _inputBuffer,
unsigned int _nBufferFrames, unsigned int _nBufferFrames,
double _streamTime, double _streamTime,
@ -74,11 +74,11 @@ int32_t airtio::io::Node::rtAudioCallback(void* _outputBuffer,
} }
std::shared_ptr<airtio::io::Node> airtio::io::Node::create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) { std::shared_ptr<river::io::Node> river::io::Node::create(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) {
return std::shared_ptr<airtio::io::Node>(new airtio::io::Node(_name, _config)); return std::shared_ptr<river::io::Node>(new river::io::Node(_name, _config));
} }
airtio::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejson::Object>& _config) : 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) {
@ -147,7 +147,7 @@ airtio::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejs
if (volumeName != "") { if (volumeName != "") {
AIRTIO_INFO("add node volume stage : '" << volumeName << "'"); AIRTIO_INFO("add node volume stage : '" << volumeName << "'");
// use global manager for volume ... // use global manager for volume ...
m_volume = airtio::io::Manager::getInstance()->getVolumeGroup(volumeName); m_volume = river::io::Manager::getInstance()->getVolumeGroup(volumeName);
} }
enum audio::format formatType = audio::format_int16; enum audio::format formatType = audio::format_int16;
@ -257,7 +257,7 @@ airtio::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejs
if (m_isInput == true) { if (m_isInput == true) {
err = m_adac.openStream(nullptr, &params, err = m_adac.openStream(nullptr, &params,
airtaudio::SINT16, m_hardwareFormat.getFrequency(), &m_rtaudioFrameSize, airtaudio::SINT16, m_hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std::bind(&airtio::io::Node::rtAudioCallback, std::bind(&river::io::Node::rtAudioCallback,
this, this,
std::placeholders::_1, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_2,
@ -268,7 +268,7 @@ airtio::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejs
} else { } else {
err = m_adac.openStream(&params, nullptr, err = m_adac.openStream(&params, nullptr,
airtaudio::SINT16, m_hardwareFormat.getFrequency(), &m_rtaudioFrameSize, airtaudio::SINT16, m_hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std::bind(&airtio::io::Node::rtAudioCallback, std::bind(&river::io::Node::rtAudioCallback,
this, this,
std::placeholders::_1, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_2,
@ -282,7 +282,7 @@ airtio::io::Node::Node(const std::string& _name, const std::shared_ptr<const ejs
} }
} }
airtio::io::Node::~Node() { river::io::Node::~Node() {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
AIRTIO_INFO("-----------------------------------------------------------------"); AIRTIO_INFO("-----------------------------------------------------------------");
AIRTIO_INFO("-- DESTROY NODE --"); AIRTIO_INFO("-- DESTROY NODE --");
@ -293,7 +293,7 @@ airtio::io::Node::~Node() {
} }
}; };
void airtio::io::Node::start() { void river::io::Node::start() {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
AIRTIO_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); AIRTIO_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum airtaudio::errorType err = m_adac.startStream(); enum airtaudio::errorType err = m_adac.startStream();
@ -302,7 +302,7 @@ void airtio::io::Node::start() {
} }
} }
void airtio::io::Node::stop() { void river::io::Node::stop() {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
AIRTIO_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); AIRTIO_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum airtaudio::errorType err = m_adac.stopStream(); enum airtaudio::errorType err = m_adac.stopStream();
@ -311,7 +311,7 @@ void airtio::io::Node::stop() {
} }
} }
void airtio::io::Node::registerAsRemote(const std::shared_ptr<airtio::Interface>& _interface) { void river::io::Node::registerAsRemote(const std::shared_ptr<river::Interface>& _interface) {
auto it = m_listAvaillable.begin(); auto it = m_listAvaillable.begin();
while (it != m_listAvaillable.end()) { while (it != m_listAvaillable.end()) {
if (it->expired() == true) { if (it->expired() == true) {
@ -322,7 +322,7 @@ void airtio::io::Node::registerAsRemote(const std::shared_ptr<airtio::Interface>
m_listAvaillable.push_back(_interface); m_listAvaillable.push_back(_interface);
} }
void airtio::io::Node::interfaceAdd(const std::shared_ptr<airtio::Interface>& _interface) { void river::io::Node::interfaceAdd(const std::shared_ptr<river::Interface>& _interface) {
{ {
std::unique_lock<std::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) {
@ -338,7 +338,7 @@ void airtio::io::Node::interfaceAdd(const std::shared_ptr<airtio::Interface>& _i
} }
} }
void airtio::io::Node::interfaceRemove(const std::shared_ptr<airtio::Interface>& _interface) { void river::io::Node::interfaceRemove(const std::shared_ptr<river::Interface>& _interface) {
{ {
std::unique_lock<std::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) {
@ -356,9 +356,9 @@ void airtio::io::Node::interfaceRemove(const std::shared_ptr<airtio::Interface>&
} }
void airtio::io::Node::volumeChange() { void river::io::Node::volumeChange() {
for (auto &it : m_listAvaillable) { for (auto &it : m_listAvaillable) {
std::shared_ptr<airtio::Interface> node = it.lock(); std::shared_ptr<river::Interface> node = it.lock();
if (node != nullptr) { if (node != nullptr) {
node->systemVolumeChange(); node->systemVolumeChange();
} }

View File

@ -17,19 +17,19 @@
#include <audio/channel.h> #include <audio/channel.h>
#include "Manager.h" #include "Manager.h"
#include <memory> #include <memory>
#include <airtio/Interface.h> #include <river/Interface.h>
#include <airtaudio/Interface.h> #include <airtaudio/Interface.h>
#include <airtalgo/IOFormatInterface.h> #include <drain/IOFormatInterface.h>
#include <airtalgo/Volume.h> #include <drain/Volume.h>
namespace airtio { namespace river {
namespace io { namespace io {
class Manager; class Manager;
class Node { class Node {
private: private:
mutable std::mutex m_mutex; mutable std::mutex m_mutex;
std::shared_ptr<const ejson::Object> m_config; std::shared_ptr<const ejson::Object> m_config;
std::shared_ptr<airtalgo::VolumeElement> m_volume; //!< if a volume is set it is set here ... std::shared_ptr<drain::VolumeElement> m_volume; //!< if a volume is set it is set here ...
private: private:
/** /**
* @brief Constructor * @brief Constructor
@ -42,12 +42,12 @@ namespace airtio {
*/ */
virtual ~Node(); virtual ~Node();
private: private:
std::vector<std::weak_ptr<airtio::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node std::vector<std::weak_ptr<river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node
std::vector<std::shared_ptr<airtio::Interface> > m_list; std::vector<std::shared_ptr<river::Interface> > m_list;
public: public:
void registerAsRemote(const std::shared_ptr<airtio::Interface>& _interface); void registerAsRemote(const std::shared_ptr<river::Interface>& _interface);
void interfaceAdd(const std::shared_ptr<airtio::Interface>& _interface); void interfaceAdd(const std::shared_ptr<river::Interface>& _interface);
void interfaceRemove(const std::shared_ptr<airtio::Interface>& _interface); void interfaceRemove(const std::shared_ptr<river::Interface>& _interface);
private: private:
airtaudio::Interface m_adac; //!< Real audio interface airtaudio::Interface m_adac; //!< Real audio interface
airtaudio::DeviceInfo m_info; airtaudio::DeviceInfo m_info;
@ -65,13 +65,13 @@ namespace airtio {
return m_name; return m_name;
} }
private: private:
airtalgo::IOFormatInterface m_interfaceFormat; drain::IOFormatInterface m_interfaceFormat;
public: public:
const airtalgo::IOFormatInterface& getInterfaceFormat() { const drain::IOFormatInterface& getInterfaceFormat() {
return m_interfaceFormat; return m_interfaceFormat;
} }
private: private:
airtalgo::IOFormatInterface m_hardwareFormat; drain::IOFormatInterface m_hardwareFormat;
private: private:
bool m_isInput; bool m_isInput;
public: public:
@ -85,7 +85,7 @@ namespace airtio {
void start(); void start();
void stop(); void stop();
public: public:
const std::shared_ptr<airtalgo::VolumeElement>& getVolume() { const std::shared_ptr<drain::VolumeElement>& getVolume() {
return m_volume; return m_volume;
} }
public: public:

View File

@ -5,8 +5,8 @@
*/ */
#include "debug.h" #include "debug.h"
#include <airtio/Manager.h> #include <river/Manager.h>
#include <airtio/Interface.h> #include <river/Interface.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
@ -19,10 +19,10 @@
class testOutWrite { class testOutWrite {
private: private:
std::vector<audio::channel> m_channelMap; std::vector<audio::channel> m_channelMap;
std::shared_ptr<airtio::Manager> m_manager; std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<airtio::Interface> m_interface; std::shared_ptr<river::Interface> m_interface;
public: public:
testOutWrite(std::shared_ptr<airtio::Manager> _manager) : testOutWrite(std::shared_ptr<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);
@ -72,8 +72,8 @@ class testOutWrite {
}; };
TEST(TestALL, testOutputWrite) { TEST(TestALL, testOutputWrite) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
APPL_INFO("test output (write mode)"); APPL_INFO("test output (write mode)");
std::shared_ptr<testOutWrite> process = std::make_shared<testOutWrite>(manager); std::shared_ptr<testOutWrite> process = std::make_shared<testOutWrite>(manager);
@ -85,11 +85,11 @@ TEST(TestALL, testOutputWrite) {
class testOutWriteCallback { class testOutWriteCallback {
private: private:
std::shared_ptr<airtio::Manager> m_manager; std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<airtio::Interface> m_interface; std::shared_ptr<river::Interface> m_interface;
double m_phase; double m_phase;
public: public:
testOutWriteCallback(std::shared_ptr<airtio::Manager> _manager) : testOutWriteCallback(std::shared_ptr<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;
@ -139,8 +139,8 @@ class testOutWriteCallback {
}; };
TEST(TestALL, testOutputWriteWithCallback) { TEST(TestALL, testOutputWriteWithCallback) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
APPL_INFO("test output (write with callback event mode)"); APPL_INFO("test output (write with callback event mode)");
std::shared_ptr<testOutWriteCallback> process = std::make_shared<testOutWriteCallback>(manager); std::shared_ptr<testOutWriteCallback> process = std::make_shared<testOutWriteCallback>(manager);
@ -152,11 +152,11 @@ TEST(TestALL, testOutputWriteWithCallback) {
class testOutCallback { class testOutCallback {
private: private:
std::shared_ptr<airtio::Manager> m_manager; std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<airtio::Interface> m_interface; std::shared_ptr<river::Interface> m_interface;
double m_phase; double m_phase;
public: public:
testOutCallback(std::shared_ptr<airtio::Manager> _manager) : testOutCallback(std::shared_ptr<river::Manager> _manager) :
m_manager(_manager), m_manager(_manager),
m_phase(0) { m_phase(0) {
//Set stereo output: //Set stereo output:
@ -207,8 +207,8 @@ class testOutCallback {
}; };
TEST(TestALL, testOutputCallBack) { TEST(TestALL, testOutputCallBack) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
APPL_INFO("test output (callback mode)"); APPL_INFO("test output (callback mode)");
std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager); std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager);
@ -221,10 +221,10 @@ TEST(TestALL, testOutputCallBack) {
class testInRead { class testInRead {
private: private:
std::vector<audio::channel> m_channelMap; std::vector<audio::channel> m_channelMap;
std::shared_ptr<airtio::Manager> m_manager; std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<airtio::Interface> m_interface; std::shared_ptr<river::Interface> m_interface;
public: public:
testInRead(std::shared_ptr<airtio::Manager> _manager) : testInRead(std::shared_ptr<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);
@ -253,8 +253,8 @@ class testInRead {
}; };
TEST(TestALL, testInputCallBack) { TEST(TestALL, testInputCallBack) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
APPL_INFO("test input (callback mode)"); APPL_INFO("test input (callback mode)");
std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager); std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
process->run(); process->run();
@ -265,11 +265,11 @@ TEST(TestALL, testInputCallBack) {
class testInCallback { class testInCallback {
private: private:
std::shared_ptr<airtio::Manager> m_manager; std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<airtio::Interface> m_interface; std::shared_ptr<river::Interface> m_interface;
double m_phase; double m_phase;
public: public:
testInCallback(std::shared_ptr<airtio::Manager> _manager) : testInCallback(std::shared_ptr<river::Manager> _manager) :
m_manager(_manager), m_manager(_manager),
m_phase(0) { m_phase(0) {
//Set stereo output: //Set stereo output:
@ -316,8 +316,8 @@ class testInCallback {
}; };
TEST(TestALL, testInputCallBack) { TEST(TestALL, testInputCallBack) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
APPL_INFO("test input (callback mode)"); APPL_INFO("test input (callback mode)");
std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager); std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
process->run(); process->run();
@ -328,15 +328,15 @@ TEST(TestALL, testInputCallBack) {
class testOutCallbackType { class testOutCallbackType {
private: private:
std::shared_ptr<airtio::Manager> m_manager; std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<airtio::Interface> m_interface; std::shared_ptr<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 std::shared_ptr<airtio::Manager>& _manager, testOutCallbackType(const std::shared_ptr<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) :
@ -445,8 +445,8 @@ class testOutCallbackType {
class testResampling : public ::testing::TestWithParam<float> {}; class testResampling : public ::testing::TestWithParam<float> {};
TEST_P(testResampling, base) { TEST_P(testResampling, base) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::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();
@ -460,8 +460,8 @@ INSTANTIATE_TEST_CASE_P(InstantiationName,
class testFormat : public ::testing::TestWithParam<audio::format> {}; class testFormat : public ::testing::TestWithParam<audio::format> {};
TEST_P(testFormat, base) { TEST_P(testFormat, base) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::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();
@ -474,8 +474,8 @@ INSTANTIATE_TEST_CASE_P(InstantiationName,
class testChannels : public ::testing::TestWithParam<int32_t> {}; class testChannels : public ::testing::TestWithParam<int32_t> {};
TEST_P(testChannels, base) { TEST_P(testChannels, base) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::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();
@ -489,11 +489,11 @@ INSTANTIATE_TEST_CASE_P(InstantiationName,
class testCallbackVolume { class testCallbackVolume {
private: private:
std::shared_ptr<airtio::Manager> m_manager; std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<airtio::Interface> m_interface; std::shared_ptr<river::Interface> m_interface;
double m_phase; double m_phase;
public: public:
testCallbackVolume(std::shared_ptr<airtio::Manager> _manager) : testCallbackVolume(std::shared_ptr<river::Manager> _manager) :
m_manager(_manager), m_manager(_manager),
m_phase(0) { m_phase(0) {
//Set stereo output: //Set stereo output:
@ -579,8 +579,8 @@ class testCallbackVolume {
TEST(TestALL, testVolume) { TEST(TestALL, testVolume) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
std::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager); std::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager);
process->run(); process->run();
process.reset(); process.reset();
@ -588,8 +588,8 @@ TEST(TestALL, testVolume) {
} }
TEST(TestALL, testChannelsFormatResampling) { TEST(TestALL, testChannelsFormatResampling) {
std::shared_ptr<airtio::Manager> manager; std::shared_ptr<river::Manager> manager;
manager = airtio::Manager::create("testApplication"); manager = river::Manager::create("testApplication");
APPL_INFO("test convert flaot to output (callback mode)"); APPL_INFO("test convert flaot to output (callback mode)");
std::vector<float> listFreq; std::vector<float> listFreq;
listFreq.push_back(4000); listFreq.push_back(4000);