[DEV] continue removing STL

This commit is contained in:
Edouard DUPIN 2017-09-14 00:59:21 +02:00
parent 2ee24d5baa
commit c3d78cf387
23 changed files with 122 additions and 122 deletions

View File

@ -103,7 +103,7 @@ ememory::SharedPtr<audio::river::Interface> audio::river::Interface::create(floa
audio::river::Interface::~Interface() { audio::river::Interface::~Interface() {
//stop(true, true); //stop(true, true);
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
//m_node->interfaceRemove(sharedFromThis()); //m_node->interfaceRemove(sharedFromThis());
} }
/* /*
@ -112,7 +112,7 @@ bool audio::river::Interface::hasEndPoint() {
} }
*/ */
void audio::river::Interface::setReadwrite() { void audio::river::Interface::setReadwrite() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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");
@ -130,7 +130,7 @@ void audio::river::Interface::setReadwrite() {
} }
void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _function) { void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _function) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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;
@ -142,7 +142,7 @@ void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _
} }
void audio::river::Interface::setInputCallback(audio::drain::recordFunction _function) { void audio::river::Interface::setInputCallback(audio::drain::recordFunction _function) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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;
@ -154,7 +154,7 @@ void audio::river::Interface::setInputCallback(audio::drain::recordFunction _fun
} }
void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWrite _function) { void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWrite _function) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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;
@ -168,7 +168,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) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
RIVER_DEBUG("start [BEGIN]"); RIVER_DEBUG("start [BEGIN]");
m_process.updateInterAlgo(); m_process.updateInterAlgo();
m_node->interfaceAdd(sharedFromThis()); m_node->interfaceAdd(sharedFromThis());
@ -176,20 +176,20 @@ 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) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
RIVER_DEBUG("stop [BEGIN]"); RIVER_DEBUG("stop [BEGIN]");
m_node->interfaceRemove(sharedFromThis()); m_node->interfaceRemove(sharedFromThis());
RIVER_DEBUG("stop [ END]"); RIVER_DEBUG("stop [ END]");
} }
void audio::river::Interface::abort() { void audio::river::Interface::abort() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
RIVER_DEBUG("abort [BEGIN]"); RIVER_DEBUG("abort [BEGIN]");
// TODO :... // TODO :...
RIVER_DEBUG("abort [ END ]"); RIVER_DEBUG("abort [ END ]");
} }
bool audio::river::Interface::setParameter(const etk::String& _filter, const etk::String& _parameter, const std::string& _value) { bool audio::river::Interface::setParameter(const etk::String& _filter, const etk::String& _parameter, const etk::String& _value) {
RIVER_DEBUG("setParameter [BEGIN] : '" << _filter << "':'" << _parameter << "':'" << _value << "'"); RIVER_DEBUG("setParameter [BEGIN] : '" << _filter << "':'" << _parameter << "':'" << _value << "'");
bool out = false; bool out = false;
if ( _filter == "volume" if ( _filter == "volume"
@ -206,7 +206,7 @@ bool audio::river::Interface::setParameter(const etk::String& _filter, const etk
RIVER_DEBUG("setParameter [ END ] : '" << out << "'"); RIVER_DEBUG("setParameter [ END ] : '" << out << "'");
return out; return out;
} }
etk::String audio::river::Interface::getParameter(const etk::String& _filter, const std::string& _parameter) const { etk::String audio::river::Interface::getParameter(const etk::String& _filter, const etk::String& _parameter) const {
RIVER_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'"); RIVER_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'");
etk::String out; etk::String out;
ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter); ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
@ -218,7 +218,7 @@ etk::String audio::river::Interface::getParameter(const etk::String& _filter, co
RIVER_DEBUG("getParameter [ END ] : '" << out << "'"); RIVER_DEBUG("getParameter [ END ] : '" << out << "'");
return out; return out;
} }
etk::String audio::river::Interface::getParameterProperty(const etk::String& _filter, const std::string& _parameter) const { etk::String audio::river::Interface::getParameterProperty(const etk::String& _filter, const etk::String& _parameter) const {
RIVER_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'"); RIVER_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'");
etk::String out; etk::String out;
ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter); ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
@ -232,7 +232,7 @@ etk::String audio::river::Interface::getParameterProperty(const etk::String& _fi
} }
void audio::river::Interface::write(const void* _value, size_t _nbChunk) { void audio::river::Interface::write(const void* _value, size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
m_process.updateInterAlgo(); m_process.updateInterAlgo();
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0); ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
if (algo == nullptr) { if (algo == nullptr) {
@ -252,7 +252,7 @@ etk::Vector<int16_t> audio::river::Interface::read(size_t _nbChunk) {
int32_t nbChunkBuffer = m_circularBuffer.size() / m_map.size(); int32_t nbChunkBuffer = m_circularBuffer.size() / m_map.size();
m_mutex.unlock(); m_mutex.unlock();
while (nbChunkBuffer < _nbChunk) { while (nbChunkBuffer < _nbChunk) {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); ethread::sleepMilliSeconds((1));
nbChunkBuffer = m_circularBuffer.size() / m_map.size(); nbChunkBuffer = m_circularBuffer.size() / m_map.size();
} }
m_mutex.lock(); m_mutex.lock();
@ -267,14 +267,14 @@ etk::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) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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 {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
// TODO :... // TODO :...
return 0; return 0;
} }
@ -284,7 +284,7 @@ size_t audio::river::Interface::size() const {
void audio::river::Interface::setBufferSize(size_t _nbChunk) { void audio::river::Interface::setBufferSize(size_t _nbChunk) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
@ -303,7 +303,7 @@ void audio::river::Interface::setBufferSize(size_t _nbChunk) {
} }
void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _time) { void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _time) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
@ -322,7 +322,7 @@ void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _ti
} }
size_t audio::river::Interface::getBufferSize() { size_t audio::river::Interface::getBufferSize() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
@ -340,7 +340,7 @@ size_t audio::river::Interface::getBufferSize() {
} }
std::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() { std::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
@ -358,7 +358,7 @@ std::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() {
} }
size_t audio::river::Interface::getBufferFillSize() { size_t audio::river::Interface::getBufferFillSize() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
@ -377,7 +377,7 @@ size_t audio::river::Interface::getBufferFillSize() {
} }
std::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond() { std::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
if (m_node->isInput() == true) { if (m_node->isInput() == true) {
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1); ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
if (algo == nullptr) { if (algo == nullptr) {
@ -397,21 +397,21 @@ std::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond(
void audio::river::Interface::clearInternalBuffer() { void audio::river::Interface::clearInternalBuffer() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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 {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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 etk::String& _name) { void audio::river::Interface::addVolumeGroup(const etk::String& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
RIVER_DEBUG("addVolumeGroup(" << _name << ")"); RIVER_DEBUG("addVolumeGroup(" << _name << ")");
ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume"); ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
if (algo == nullptr) { if (algo == nullptr) {
@ -436,19 +436,19 @@ void audio::river::Interface::addVolumeGroup(const etk::String& _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) {
std::unique_lock<std::recursive_mutex> lockProcess(m_mutex); Ethread::RecursiveLock 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) {
std::unique_lock<std::recursive_mutex> lockProcess(m_mutex); Ethread::RecursiveLock 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() {
std::unique_lock<std::recursive_mutex> lockProcess(m_mutex); Ethread::RecursiveLock lockProcess(m_mutex);
ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume"); ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
if (algo == nullptr) { if (algo == nullptr) {
return; return;
@ -456,7 +456,7 @@ void audio::river::Interface::systemVolumeChange() {
algo->volumeChange(); algo->volumeChange();
} }
static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const std::string& _second, bool _isLink=true) { static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const etk::String& _second, bool _isLink=true) {
if (_op == "->") { if (_op == "->") {
if (_isLink) { if (_isLink) {
_node << " " << _first << " -> " << _second << ";\n"; _node << " " << _first << " -> " << _second << ";\n";

View File

@ -10,7 +10,7 @@
#include <cstdint> #include <cstdint>
#include <ethread/Mutex.hpp> #include <ethread/Mutex.hpp>
#include <chrono> #include <chrono>
#include <functional> #include <etk/Function.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <audio/format.hpp> #include <audio/format.hpp>
#include <audio/channel.hpp> #include <audio/channel.hpp>
@ -198,7 +198,7 @@ namespace audio {
* @example : setParameter("volume", "FLOW", "-3dB"); * @example : setParameter("volume", "FLOW", "-3dB");
* @example : setParameter("LowPassFilter", "cutFrequency", "1000Hz"); * @example : setParameter("LowPassFilter", "cutFrequency", "1000Hz");
*/ */
virtual bool setParameter(const etk::String& _filter, const etk::String& _parameter, const std::string& _value); virtual bool setParameter(const etk::String& _filter, const etk::String& _parameter, const etk::String& _value);
/** /**
* @brief Get a parameter value * @brief Get a parameter value
* @param[in] _filter name of the filter (if you added some personels) * @param[in] _filter name of the filter (if you added some personels)
@ -207,7 +207,7 @@ namespace audio {
* @example : getParameter("volume", "FLOW"); can return something like "-3dB" * @example : getParameter("volume", "FLOW"); can return something like "-3dB"
* @example : getParameter("LowPassFilter", "cutFrequency"); can return something like "[-120..0]dB" * @example : getParameter("LowPassFilter", "cutFrequency"); can return something like "[-120..0]dB"
*/ */
virtual etk::String getParameter(const etk::String& _filter, const std::string& _parameter) const; virtual etk::String getParameter(const etk::String& _filter, const etk::String& _parameter) const;
/** /**
* @brief Get a parameter value * @brief Get a parameter value
* @param[in] _filter name of the filter (if you added some personels) * @param[in] _filter name of the filter (if you added some personels)
@ -216,7 +216,7 @@ namespace audio {
* @example : getParameter("volume", "FLOW"); can return something like "[-120..0]dB" * @example : getParameter("volume", "FLOW"); can return something like "[-120..0]dB"
* @example : getParameter("LowPassFilter", "cutFreqiency"); can return something like "]100..10000]Hz" * @example : getParameter("LowPassFilter", "cutFreqiency"); can return something like "]100..10000]Hz"
*/ */
virtual etk::String getParameterProperty(const etk::String& _filter, const std::string& _parameter) const; virtual etk::String getParameterProperty(const etk::String& _filter, const etk::String& _parameter) const;
/** /**
* @brief write some audio sample in the speakers * @brief write some audio sample in the speakers
* @param[in] _value Data To write on output * @param[in] _value Data To write on output

View File

@ -17,7 +17,7 @@ static ethread::Mutex g_mutex;
static etk::Vector<ememory::WeakPtr<audio::river::Manager> > g_listOfAllManager; static etk::Vector<ememory::WeakPtr<audio::river::Manager> > g_listOfAllManager;
ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const etk::String& _applicationUniqueId) { ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const etk::String& _applicationUniqueId) {
std::unique_lock<ethread::Mutex> lock(g_mutex); ethread::UniqueLock lock(g_mutex);
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) { for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
ememory::SharedPtr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock(); ememory::SharedPtr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock();
if (tmp == nullptr) { if (tmp == nullptr) {

View File

@ -68,7 +68,7 @@ audio::river::io::Manager::Manager() {
void audio::river::io::Manager::init(const etk::String& _filename) { void audio::river::io::Manager::init(const etk::String& _filename) {
RIVER_ERROR("kjqsdhfkjqshdfkjqhsdskjdfhfkqjshqhskdjfhqsdfqsdqsdfqsdqsdfqsdfqsdfqsdfqsdfqsd"); RIVER_ERROR("kjqsdhfkjqshdfkjqhsdskjdfhfkqjshqhskdjfhqsdfqsdqsdfqsdqsdfqsdfqsdfqsdfqsdfqsd");
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
if (_filename == "") { if (_filename == "") {
if (m_config.load(pathToTheRiverConfigInHome) == false) { if (m_config.load(pathToTheRiverConfigInHome) == false) {
RIVER_INFO("Load default config"); RIVER_INFO("Load default config");
@ -82,12 +82,12 @@ void audio::river::io::Manager::init(const etk::String& _filename) {
} }
void audio::river::io::Manager::initString(const etk::String& _data) { void audio::river::io::Manager::initString(const etk::String& _data) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
m_config.parse(_data); m_config.parse(_data);
} }
void audio::river::io::Manager::unInit() { void audio::river::io::Manager::unInit() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
// TODO : ... // TODO : ...
} }
@ -110,7 +110,7 @@ ememory::SharedPtr<audio::river::io::Manager> audio::river::io::Manager::getInst
etk::Vector<etk::String> audio::river::io::Manager::getListStreamInput() { etk::Vector<etk::String> audio::river::io::Manager::getListStreamInput() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
etk::Vector<etk::String> output; etk::Vector<etk::String> output;
etk::Vector<etk::String> keys = m_config.getKeys(); etk::Vector<etk::String> keys = m_config.getKeys();
for (auto &it : keys) { for (auto &it : keys) {
@ -127,7 +127,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStreamInput() {
} }
etk::Vector<etk::String> audio::river::io::Manager::getListStreamOutput() { etk::Vector<etk::String> audio::river::io::Manager::getListStreamOutput() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
etk::Vector<etk::String> output; etk::Vector<etk::String> output;
etk::Vector<etk::String> keys = m_config.getKeys(); etk::Vector<etk::String> keys = m_config.getKeys();
for (auto &it : keys) { for (auto &it : keys) {
@ -144,7 +144,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStreamOutput() {
} }
etk::Vector<etk::String> audio::river::io::Manager::getListStreamVirtual() { etk::Vector<etk::String> audio::river::io::Manager::getListStreamVirtual() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
etk::Vector<etk::String> output; etk::Vector<etk::String> output;
etk::Vector<etk::String> keys = m_config.getKeys(); etk::Vector<etk::String> keys = m_config.getKeys();
for (auto &it : keys) { for (auto &it : keys) {
@ -164,7 +164,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStreamVirtual() {
} }
etk::Vector<etk::String> audio::river::io::Manager::getListStream() { etk::Vector<etk::String> audio::river::io::Manager::getListStream() {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
etk::Vector<etk::String> output; etk::Vector<etk::String> output;
etk::Vector<etk::String> keys = m_config.getKeys(); etk::Vector<etk::String> keys = m_config.getKeys();
for (auto &it : keys) { for (auto &it : keys) {
@ -180,7 +180,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStream() {
} }
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(const etk::String& _name) { ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(const etk::String& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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) {
@ -267,7 +267,7 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
} }
ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const etk::String& _name) { ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const etk::String& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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 ememory::SharedPtr<audio::drain::VolumeElement>(); return ememory::SharedPtr<audio::drain::VolumeElement>();
@ -287,7 +287,7 @@ ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVo
} }
bool audio::river::io::Manager::setVolume(const etk::String& _volumeName, float _valuedB) { bool audio::river::io::Manager::setVolume(const etk::String& _volumeName, float _valuedB) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); ememory::SharedPtr<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 << "'");
@ -309,7 +309,7 @@ bool audio::river::io::Manager::setVolume(const etk::String& _volumeName, float
} }
float audio::river::io::Manager::getVolume(const etk::String& _volumeName) { float audio::river::io::Manager::getVolume(const etk::String& _volumeName) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); ememory::SharedPtr<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 << "'");
@ -323,7 +323,7 @@ etk::Pair<float,float> audio::river::io::Manager::getVolumeRange(const etk::Stri
} }
void audio::river::io::Manager::setMute(const etk::String& _volumeName, bool _mute) { void audio::river::io::Manager::setMute(const etk::String& _volumeName, bool _mute) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); ememory::SharedPtr<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 << "'");
@ -339,7 +339,7 @@ void audio::river::io::Manager::setMute(const etk::String& _volumeName, bool _mu
} }
bool audio::river::io::Manager::getMute(const etk::String& _volumeName) { bool audio::river::io::Manager::getMute(const etk::String& _volumeName) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName); ememory::SharedPtr<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 << "'");
@ -349,7 +349,7 @@ bool audio::river::io::Manager::getMute(const etk::String& _volumeName) {
} }
void audio::river::io::Manager::generateDot(const etk::String& _filename) { void audio::river::io::Manager::generateDot(const etk::String& _filename) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock 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) {
@ -403,7 +403,7 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
} }
ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const etk::String& _name) { ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const etk::String& _name) {
std::unique_lock<std::recursive_mutex> lock(m_mutex); Ethread::RecursiveLock lock(m_mutex);
ememory::SharedPtr<audio::river::io::Group> out; ememory::SharedPtr<audio::river::io::Group> out;
etk::Map<etk::String, ememory::SharedPtr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name); etk::Map<etk::String, ememory::SharedPtr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name);
if (it == m_listGroup.end()) { if (it == m_listGroup.end()) {

View File

@ -12,7 +12,7 @@
#include <cstdint> #include <cstdint>
#include <ethread/Mutex.hpp> #include <ethread/Mutex.hpp>
#include <chrono> #include <chrono>
#include <functional> #include <etk/Function.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <audio/format.hpp> #include <audio/format.hpp>
#include <audio/channel.hpp> #include <audio/channel.hpp>

View File

@ -147,7 +147,7 @@ void audio::river::io::Node::registerAsRemote(const ememory::SharedPtr<audio::ri
void audio::river::io::Node::interfaceAdd(const ememory::SharedPtr<audio::river::Interface>& _interface) { void audio::river::io::Node::interfaceAdd(const ememory::SharedPtr<audio::river::Interface>& _interface) {
{ {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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;
@ -163,7 +163,7 @@ void audio::river::io::Node::interfaceAdd(const ememory::SharedPtr<audio::river:
void audio::river::io::Node::interfaceRemove(const ememory::SharedPtr<audio::river::Interface>& _interface) { void audio::river::io::Node::interfaceRemove(const ememory::SharedPtr<audio::river::Interface>& _interface) {
{ {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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);
@ -392,7 +392,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
return; return;
} }
static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const std::string& _second) { static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const etk::String& _second) {
if (_op == "->") { if (_op == "->") {
_node << " " << _first << " -> " << _second << ";\n"; _node << " " << _first << " -> " << _second << ";\n";
} else if (_op == "<-") { } else if (_op == "<-") {

View File

@ -10,7 +10,7 @@
#include <list> #include <list>
#include <cstdint> #include <cstdint>
#include <chrono> #include <chrono>
#include <functional> #include <etk/Function.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <audio/format.hpp> #include <audio/format.hpp>
#include <audio/channel.hpp> #include <audio/channel.hpp>

View File

@ -8,7 +8,7 @@
#include <audio/river/debug.hpp> #include <audio/river/debug.hpp>
#include <etk/types.hpp> #include <etk/types.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <functional> #include <etk/Function.hpp>
ememory::SharedPtr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const etk::String& _name, const ejson::Object& _config) { ememory::SharedPtr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const etk::String& _name, const ejson::Object& _config) {
return ememory::SharedPtr<audio::river::io::NodeAEC>(new audio::river::io::NodeAEC(_name, _config)); return ememory::SharedPtr<audio::river::io::NodeAEC>(new audio::river::io::NodeAEC(_name, _config));
@ -139,7 +139,7 @@ audio::river::io::NodeAEC::~NodeAEC() {
}; };
void audio::river::io::NodeAEC::start() { void audio::river::io::NodeAEC::start() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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 : ");
@ -152,7 +152,7 @@ void audio::river::io::NodeAEC::start() {
} }
void audio::river::io::NodeAEC::stop() { void audio::river::io::NodeAEC::stop() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock lock(m_mutex);
if (m_interfaceFeedBack != nullptr) { if (m_interfaceFeedBack != nullptr) {
m_interfaceFeedBack->stop(); m_interfaceFeedBack->stop();
} }
@ -174,7 +174,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
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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();
@ -192,7 +192,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
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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();

View File

@ -14,7 +14,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 etk::Vector<audio::orchestra::status>& _status) { const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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);
@ -25,7 +25,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 etk::Vector<audio::orchestra::status>& _status) { const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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);
@ -228,7 +228,7 @@ audio::river::io::NodeFile::NodeFile(const etk::String& _name, const ejson::Obje
} }
audio::river::io::NodeFile::~NodeFile() { audio::river::io::NodeFile::~NodeFile() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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();
@ -240,13 +240,13 @@ void audio::river::io::NodeFile::threadCallback() {
// open the file // open the file
while (m_alive == true) { while (m_alive == true) {
std::this_thread::sleep_for(std::chrono::milliseconds(100)); ethread::sleepMilliSeconds((100));
} }
} }
void audio::river::io::NodeFile::start() { void audio::river::io::NodeFile::start() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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;
@ -258,7 +258,7 @@ void audio::river::io::NodeFile::start() {
} }
void audio::river::io::NodeFile::stop() { void audio::river::io::NodeFile::stop() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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

@ -8,7 +8,7 @@
#include <audio/river/debug.hpp> #include <audio/river/debug.hpp>
#include <etk/types.hpp> #include <etk/types.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <functional> #include <etk/Function.hpp>
ememory::SharedPtr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const etk::String& _name, const ejson::Object& _config) { ememory::SharedPtr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const etk::String& _name, const ejson::Object& _config) {
return ememory::SharedPtr<audio::river::io::NodeMuxer>(new audio::river::io::NodeMuxer(_name, _config)); return ememory::SharedPtr<audio::river::io::NodeMuxer>(new audio::river::io::NodeMuxer(_name, _config));
@ -164,7 +164,7 @@ audio::river::io::NodeMuxer::~NodeMuxer() {
}; };
void audio::river::io::NodeMuxer::start() { void audio::river::io::NodeMuxer::start() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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 : ");
@ -177,7 +177,7 @@ void audio::river::io::NodeMuxer::start() {
} }
void audio::river::io::NodeMuxer::stop() { void audio::river::io::NodeMuxer::stop() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock lock(m_mutex);
if (m_interfaceInput1 != nullptr) { if (m_interfaceInput1 != nullptr) {
m_interfaceInput1->stop(); m_interfaceInput1->stop();
} }
@ -201,7 +201,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput1(const void* _data,
} }
*/ */
// push data synchronize // push data synchronize
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock lock(m_mutex);
m_bufferInput1.write(_data, _nbChunk, _time); m_bufferInput1.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_muxer_input_1.raw", _data, _nbChunk*_map.size()); //RIVER_SAVE_FILE_MACRO(int16_t, "REC_muxer_input_1.raw", _data, _nbChunk*_map.size());
process(); process();
@ -221,7 +221,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput2(const void* _data,
} }
*/ */
// push data synchronize // push data synchronize
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock lock(m_mutex);
m_bufferInput2.write(_data, _nbChunk, _time); m_bufferInput2.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_muxer_input_2.raw", _data, _nbChunk*_map.size()); //RIVER_SAVE_FILE_MACRO(int16_t, "REC_muxer_input_2.raw", _data, _nbChunk*_map.size());
process(); process();

View File

@ -14,7 +14,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 etk::Vector<audio::orchestra::status>& _status) { const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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);
@ -25,7 +25,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 etk::Vector<audio::orchestra::status>& _status) { const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock lock(m_mutex);
// TODO : Manage status ... // TODO : Manage status ...
RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size() << " data=" << uint64_t(_outputBuffer)); RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size() << " data=" << uint64_t(_outputBuffer));
newOutput(_outputBuffer, _nbChunk, _timeOutput); newOutput(_outputBuffer, _nbChunk, _timeOutput);
@ -229,7 +229,7 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const etk::String& _name, const e
} }
audio::river::io::NodeOrchestra::~NodeOrchestra() { audio::river::io::NodeOrchestra::~NodeOrchestra() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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();
@ -237,7 +237,7 @@ audio::river::io::NodeOrchestra::~NodeOrchestra() {
}; };
void audio::river::io::NodeOrchestra::start() { void audio::river::io::NodeOrchestra::start() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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) {
@ -246,7 +246,7 @@ void audio::river::io::NodeOrchestra::start() {
} }
void audio::river::io::NodeOrchestra::stop() { void audio::river::io::NodeOrchestra::stop() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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

@ -39,7 +39,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) {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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());
@ -105,7 +105,7 @@ audio::river::io::NodePortAudio::NodePortAudio(const etk::String& _name, const e
} }
audio::river::io::NodePortAudio::~NodePortAudio() { audio::river::io::NodePortAudio::~NodePortAudio() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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 ) {
@ -114,7 +114,7 @@ audio::river::io::NodePortAudio::~NodePortAudio() {
}; };
void audio::river::io::NodePortAudio::start() { void audio::river::io::NodePortAudio::start() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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 ) {
@ -123,7 +123,7 @@ void audio::river::io::NodePortAudio::start() {
} }
void audio::river::io::NodePortAudio::stop() { void audio::river::io::NodePortAudio::stop() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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

@ -55,7 +55,7 @@ void onDataReceived(const void* _data,
const int16_t* data = static_cast<const int16_t*>(_data); const int16_t* data = static_cast<const int16_t*>(_data);
int64_t value = 0; int64_t value = 0;
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) { for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
value += std::abs(data[iii]); value += etk::abs(data[iii]);
} }
value /= (_nbChunk*_map.size()); value /= (_nbChunk*_map.size());
std::cout << "Get data ... average=" << int32_t(value) << std::endl; std::cout << "Get data ... average=" << int32_t(value) << std::endl;
@ -64,7 +64,7 @@ void onDataReceived(const void* _data,
const float* data = static_cast<const float*>(_data); const float* data = static_cast<const float*>(_data);
float value = 0; float value = 0;
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) { for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
value += std::abs(data[iii]); value += etk::abs(data[iii]);
} }
value /= (_nbChunk*_map.size()); value /= (_nbChunk*_map.size());
std::cout << "Get data ... average=" << float(value) << std::endl; std::cout << "Get data ... average=" << float(value) << std::endl;
@ -149,7 +149,7 @@ int main(int _argc, const char **_argv) {
// start the stream // start the stream
interface->start(); interface->start();
// wait 10 second ... // wait 10 second ...
std::this_thread::sleep_for(std::chrono::seconds(10)); ethread::sleepMilliSeconds(std::chrono::seconds(10));
// stop the stream // stop the stream
interface->stop(); interface->stop();
//! [audio_river_sample_read_start_stop] //! [audio_river_sample_read_start_stop]

View File

@ -103,7 +103,7 @@ int main(int _argc, const char **_argv) {
// start the stream // start the stream
interface->start(); interface->start();
// wait 10 second ... // wait 10 second ...
std::this_thread::sleep_for(std::chrono::seconds(10)); ethread::sleepMilliSeconds(std::chrono::seconds(10));
// stop the stream // stop the stream
interface->stop(); interface->stop();
// remove interface and manager. // remove interface and manager.

View File

@ -203,7 +203,7 @@ namespace river_test_aec {
ememory::SharedPtr<Linker> processLink2 = ememory::makeShared<Linker>(manager, "microphone", "speaker-test"); ememory::SharedPtr<Linker> processLink2 = ememory::makeShared<Linker>(manager, "microphone", "speaker-test");
processLink1->start(); processLink1->start();
processLink2->start(); processLink2->start();
std::this_thread::sleep_for(std::chrono::seconds(20)); ethread::sleepMilliSeconds(std::chrono::seconds(20));
processLink1->stop(); processLink1->stop();
processLink2->stop(); processLink2->stop();

View File

@ -360,9 +360,9 @@ namespace river_test_echo_delay {
m_interfaceIn->start(); m_interfaceIn->start();
//m_interfaceFB->start(); //m_interfaceFB->start();
while (m_estimateVolumeInput == true) { while (m_estimateVolumeInput == true) {
std::this_thread::sleep_for(std::chrono::milliseconds(10)); ethread::sleepMilliSeconds((10));
} }
std::this_thread::sleep_for(std::chrono::seconds(10)); ethread::sleepMilliSeconds(std::chrono::seconds(10));
//m_interfaceFB->stop(); //m_interfaceFB->stop();
m_interfaceIn->stop(); m_interfaceIn->stop();
m_interfaceOut->stop(); m_interfaceOut->stop();
@ -418,7 +418,7 @@ namespace river_test_echo_delay {
ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager); ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
}; };

View File

@ -136,9 +136,9 @@ namespace river_test_format {
} }
m_interface->start(); m_interface->start();
// wait 2 second ... // wait 2 second ...
std::this_thread::sleep_for(std::chrono::seconds(1)); ethread::sleepMilliSeconds(std::chrono::seconds(1));
m_interface->stop(); m_interface->stop();
std::this_thread::sleep_for(std::chrono::milliseconds(100)); ethread::sleepMilliSeconds((100));
} }
}; };
@ -151,7 +151,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16); ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
@ -168,7 +168,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, 2, GetParam()); ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, 2, GetParam());
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
INSTANTIATE_TEST_CASE_P(InstantiationName, INSTANTIATE_TEST_CASE_P(InstantiationName,
@ -184,7 +184,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16); ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
INSTANTIATE_TEST_CASE_P(InstantiationName, INSTANTIATE_TEST_CASE_P(InstantiationName,
@ -226,7 +226,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]); ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
} }
} }
} }

View File

@ -103,7 +103,7 @@ namespace river_test_muxer {
} }
m_interfaceOut->start(); m_interfaceOut->start();
m_interfaceIn->start(); m_interfaceIn->start();
std::this_thread::sleep_for(std::chrono::seconds(10)); ethread::sleepMilliSeconds(std::chrono::seconds(10));
m_interfaceIn->stop(); m_interfaceIn->stop();
m_interfaceOut->stop(); m_interfaceOut->stop();
} }
@ -168,7 +168,7 @@ namespace river_test_muxer {
ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager); ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
}; };

View File

@ -66,7 +66,7 @@ namespace river_test_playback_callback {
} }
m_interface->start(); m_interface->start();
// wait 2 second ... // wait 2 second ...
std::this_thread::sleep_for(std::chrono::seconds(2)); ethread::sleepMilliSeconds(std::chrono::seconds(2));
m_interface->stop(); m_interface->stop();
} }
}; };
@ -97,7 +97,7 @@ namespace river_test_playback_callback {
ASSERT_NE(process, nullptr); ASSERT_NE(process, nullptr);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
@ -110,7 +110,7 @@ namespace river_test_playback_callback {
ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-pulse"); ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-pulse");
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
@ -123,7 +123,7 @@ namespace river_test_playback_callback {
ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-jack"); ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-jack");
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
}; };

View File

@ -78,7 +78,7 @@ namespace river_test_playback_write {
} }
m_interface->write(&data[0], data.size()/m_channelMap.size()); m_interface->write(&data[0], data.size()/m_channelMap.size());
// TODO : Add a function to get number of time we need to wait enought time ... // TODO : Add a function to get number of time we need to wait enought time ...
std::this_thread::sleep_for(std::chrono::milliseconds(15)); ethread::sleepMilliSeconds((15));
} }
m_interface->stop(); m_interface->stop();
} }
@ -93,7 +93,7 @@ namespace river_test_playback_write {
ememory::SharedPtr<testOutWrite> process = ememory::makeShared<testOutWrite>(manager); ememory::SharedPtr<testOutWrite> process = ememory::makeShared<testOutWrite>(manager);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }
@ -156,7 +156,7 @@ namespace river_test_playback_write {
return; return;
} }
m_interface->start(); m_interface->start();
std::this_thread::sleep_for(std::chrono::seconds(1)); ethread::sleepMilliSeconds(std::chrono::seconds(1));
m_interface->stop(); m_interface->stop();
} }
}; };
@ -170,7 +170,7 @@ namespace river_test_playback_write {
ememory::SharedPtr<testOutWriteCallback> process = ememory::makeShared<testOutWriteCallback>(manager); ememory::SharedPtr<testOutWriteCallback> process = ememory::makeShared<testOutWriteCallback>(manager);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }

View File

@ -63,7 +63,7 @@ namespace river_test_record_callback {
const int16_t* data = static_cast<const int16_t*>(_data); const int16_t* data = static_cast<const int16_t*>(_data);
int64_t value = 0; int64_t value = 0;
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) { for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
value += std::abs(data[iii]); value += etk::abs(data[iii]);
} }
value /= (_nbChunk*_map.size()); value /= (_nbChunk*_map.size());
TEST_INFO("Get data ... average=" << int32_t(value)); TEST_INFO("Get data ... average=" << int32_t(value));
@ -75,7 +75,7 @@ namespace river_test_record_callback {
} }
m_interface->start(); m_interface->start();
// wait 2 second ... // wait 2 second ...
std::this_thread::sleep_for(std::chrono::seconds(20)); ethread::sleepMilliSeconds(std::chrono::seconds(20));
m_interface->stop(); m_interface->stop();
} }
}; };
@ -88,7 +88,7 @@ namespace river_test_record_callback {
ememory::SharedPtr<testInCallback> process = ememory::makeShared<testInCallback>(manager); ememory::SharedPtr<testInCallback> process = ememory::makeShared<testInCallback>(manager);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }

View File

@ -79,40 +79,40 @@ namespace river_test_volume {
return; return;
} }
m_interface->start(); m_interface->start();
std::this_thread::sleep_for(std::chrono::seconds(1)); ethread::sleepMilliSeconds(std::chrono::seconds(1));
m_interface->setParameter("volume", "FLOW", "-3dB"); m_interface->setParameter("volume", "FLOW", "-3dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "-6dB"); m_interface->setParameter("volume", "FLOW", "-6dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "-9dB"); m_interface->setParameter("volume", "FLOW", "-9dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "-12dB"); m_interface->setParameter("volume", "FLOW", "-12dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "-3dB"); m_interface->setParameter("volume", "FLOW", "-3dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "3dB"); m_interface->setParameter("volume", "FLOW", "3dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "6dB"); m_interface->setParameter("volume", "FLOW", "6dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "9dB"); m_interface->setParameter("volume", "FLOW", "9dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_interface->setParameter("volume", "FLOW", "0dB"); m_interface->setParameter("volume", "FLOW", "0dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") ); TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_manager->setVolume("MASTER", -3.0f); m_manager->setVolume("MASTER", -3.0f);
TEST_INFO("get volume MASTER: " << m_manager->getVolume("MASTER") ); TEST_INFO("get volume MASTER: " << m_manager->getVolume("MASTER") );
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
m_manager->setVolume("MEDIA", -3.0f); m_manager->setVolume("MEDIA", -3.0f);
TEST_INFO("get volume MEDIA: " << m_manager->getVolume("MEDIA") ); TEST_INFO("get volume MEDIA: " << m_manager->getVolume("MEDIA") );
std::this_thread::sleep_for(std::chrono::seconds(1)); ethread::sleepMilliSeconds(std::chrono::seconds(1));
m_interface->stop(); m_interface->stop();
} }
}; };
@ -124,7 +124,7 @@ namespace river_test_volume {
ememory::SharedPtr<testCallbackVolume> process = ememory::makeShared<testCallbackVolume>(manager); ememory::SharedPtr<testCallbackVolume> process = ememory::makeShared<testCallbackVolume>(manager);
process->run(); process->run();
process.reset(); process.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); ethread::sleepMilliSeconds((500));
audio::river::unInit(); audio::river::unInit();
} }

View File

@ -38,7 +38,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 etk::Vector<audio::channel>& _map) { const etk::Vector<audio::channel>& _map) {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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;
} }
@ -56,7 +56,7 @@ void audio::river::widget::TemporalViewer::onDataReceived(const void* _data,
} }
void audio::river::widget::TemporalViewer::recordToggle() { void audio::river::widget::TemporalViewer::recordToggle() {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock lock(m_mutex);
if (m_interface == nullptr) { if (m_interface == nullptr) {
//Get the generic input: //Get the generic input:
etk::Vector<audio::channel> channel; etk::Vector<audio::channel> channel;
@ -104,7 +104,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);
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock lock(m_mutex);
if (m_data.size() == 0) { if (m_data.size() == 0) {
return; return;
} }
@ -143,7 +143,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) {
std::unique_lock<ethread::Mutex> lock(m_mutex); ethread::UniqueLock 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()) {