[DEV] remove STL

This commit is contained in:
2017-09-07 23:38:26 +02:00
parent 0e175ad23c
commit 2ee24d5baa
17 changed files with 42 additions and 42 deletions

View File

@@ -10,7 +10,7 @@
#include <etk/Map.hpp>
#include <list>
#include <cstdint>
#include <mutex>
#include <ethread/Mutex.hpp>
#include <chrono>
#include <functional>
#include <ememory/memory.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) {
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
for (size_t iii=0; iii<m_list.size(); ++iii) {
if (_interface == m_list[iii]) {
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) {
{
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
for (size_t iii=0; iii< m_list.size(); ++iii) {
if (_interface == m_list[iii]) {
m_list.erase(m_list.begin()+iii);

View File

@@ -54,7 +54,7 @@ namespace audio {
return false;
};
protected:
mutable std::mutex m_mutex; //!< prevent open/close/write/read access that is multi-threaded.
mutable ethread::Mutex m_mutex; //!< prevent open/close/write/read access that is multi-threaded.
const ejson::Object m_config; //!< configuration description.
protected:
audio::drain::Process m_process; //!< Low level algorithms

View File

@@ -139,7 +139,7 @@ audio::river::io::NodeAEC::~NodeAEC() {
};
void audio::river::io::NodeAEC::start() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
if (m_interfaceFeedBack != nullptr) {
RIVER_INFO("Start FEEDBACK : ");
@@ -152,7 +152,7 @@ void audio::river::io::NodeAEC::start() {
}
void audio::river::io::NodeAEC::stop() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_interfaceFeedBack != nullptr) {
m_interfaceFeedBack->stop();
}
@@ -174,7 +174,7 @@ void audio::river::io::NodeAEC::onDataReceivedMicrophone(const void* _data,
RIVER_ERROR("call wrong type ... (need int16_t)");
}
// push data synchronize
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_bufferMicrophone.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_Microphone.raw", _data, _nbChunk*_map.size());
process();
@@ -192,7 +192,7 @@ void audio::river::io::NodeAEC::onDataReceivedFeedBack(const void* _data,
RIVER_ERROR("call wrong type ... (need int16_t)");
}
// push data synchronize
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_bufferFeedBack.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_FeedBack.raw", _data, _nbChunk*_map.size());
process();

View File

@@ -14,7 +14,7 @@ int32_t audio::river::io::NodeFile::recordCallback(const void* _inputBuffer,
const audio::Time& _timeInput,
uint32_t _nbChunk,
const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
// TODO : Manage status ...
RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
newInput(_inputBuffer, _nbChunk, _timeInput);
@@ -25,7 +25,7 @@ int32_t audio::river::io::NodeFile::playbackCallback(void* _outputBuffer,
const audio::Time& _timeOutput,
uint32_t _nbChunk,
const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
// TODO : Manage status ...
RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
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() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("close input stream");
if (m_interface.isStreamOpen() ) {
m_interface.closeStream();
@@ -246,19 +246,19 @@ void audio::river::io::NodeFile::threadCallback() {
}
void audio::river::io::NodeFile::start() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_thread != nullptr) {
RIVER_ERROR("Start stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") << " ==> already started ..." );
return;
}
m_alive = true;
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") );
m_thread = ememory::makeShared<std::thread>(&audio::river::io::NodeFile::threadCallback2, this);
m_thread = ememory::makeShared<ethread::Thread>(&audio::river::io::NodeFile::threadCallback2, this);
m_time = audio::Time::now();
}
void audio::river::io::NodeFile::stop() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_alive = false;
RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"read":"write") );
// TODO : Need join ...

View File

@@ -41,7 +41,7 @@ namespace audio {
uint32_t m_sampleRate; //!< Sample Rate of the Raw file
audio::format m_format; //!< Format of the file
etk::Vector<audio::channel> m_map; //!< Map of the file
ememory::SharedPtr<std::thread> m_thread; //!< playing thread of the flow
ememory::SharedPtr<ethread::Thread> m_thread; //!< playing thread of the flow
std::atomic<bool> m_alive; //!< thread is active
protected:
virtual void start();

View File

@@ -164,7 +164,7 @@ audio::river::io::NodeMuxer::~NodeMuxer() {
};
void audio::river::io::NodeMuxer::start() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
if (m_interfaceInput1 != nullptr) {
RIVER_INFO("Start FEEDBACK : ");
@@ -177,7 +177,7 @@ void audio::river::io::NodeMuxer::start() {
}
void audio::river::io::NodeMuxer::stop() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
if (m_interfaceInput1 != nullptr) {
m_interfaceInput1->stop();
}
@@ -201,7 +201,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput1(const void* _data,
}
*/
// push data synchronize
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_bufferInput1.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_muxer_input_1.raw", _data, _nbChunk*_map.size());
process();
@@ -221,7 +221,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput2(const void* _data,
}
*/
// push data synchronize
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
m_bufferInput2.write(_data, _nbChunk, _time);
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_muxer_input_2.raw", _data, _nbChunk*_map.size());
process();

View File

@@ -14,7 +14,7 @@ int32_t audio::river::io::NodeOrchestra::recordCallback(const void* _inputBuffer
const audio::Time& _timeInput,
uint32_t _nbChunk,
const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
// TODO : Manage status ...
RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
newInput(_inputBuffer, _nbChunk, _timeInput);
@@ -25,7 +25,7 @@ int32_t audio::river::io::NodeOrchestra::playbackCallback(void* _outputBuffer,
const audio::Time& _timeOutput,
uint32_t _nbChunk,
const etk::Vector<audio::orchestra::status>& _status) {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
// TODO : Manage status ...
RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size() << " data=" << uint64_t(_outputBuffer));
newOutput(_outputBuffer, _nbChunk, _timeOutput);
@@ -229,7 +229,7 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const etk::String& _name, const e
}
audio::river::io::NodeOrchestra::~NodeOrchestra() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("close input stream");
if (m_interface.isStreamOpen() ) {
m_interface.closeStream();
@@ -237,7 +237,7 @@ audio::river::io::NodeOrchestra::~NodeOrchestra() {
};
void audio::river::io::NodeOrchestra::start() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum audio::orchestra::error err = m_interface.startStream();
if (err != audio::orchestra::error_none) {
@@ -246,7 +246,7 @@ void audio::river::io::NodeOrchestra::start() {
}
void audio::river::io::NodeOrchestra::stop() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum audio::orchestra::error err = m_interface.stopStream();
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,
uint32_t _nbChunk,
PaStreamCallbackFlags _status) {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
// TODO : Manage status ...
if (_inputBuffer != nullptr) {
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() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("close input stream");
PaError err = Pa_CloseStream( m_stream );
if( err != paNoError ) {
@@ -114,7 +114,7 @@ audio::river::io::NodePortAudio::~NodePortAudio() {
};
void audio::river::io::NodePortAudio::start() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
PaError err = Pa_StartStream(m_stream);
if( err != paNoError ) {
@@ -123,7 +123,7 @@ void audio::river::io::NodePortAudio::start() {
}
void audio::river::io::NodePortAudio::stop() {
std::unique_lock<std::mutex> lock(m_mutex);
std::unique_lock<ethread::Mutex> lock(m_mutex);
RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
PaError err = Pa_StopStream(m_stream);
if( err != paNoError ) {