[DEV] remove STL
This commit is contained in:
parent
0e175ad23c
commit
2ee24d5baa
@ -8,7 +8,7 @@
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <ethread/Mutex.hpp>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
#include <ememory/memory.hpp>
|
||||
|
@ -13,11 +13,11 @@
|
||||
#include "debug.hpp"
|
||||
#include <ejson/ejson.hpp>
|
||||
|
||||
static std::mutex g_mutex;
|
||||
static ethread::Mutex g_mutex;
|
||||
static etk::Vector<ememory::WeakPtr<audio::river::Manager> > g_listOfAllManager;
|
||||
|
||||
ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const etk::String& _applicationUniqueId) {
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
std::unique_lock<ethread::Mutex> lock(g_mutex);
|
||||
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
|
||||
ememory::SharedPtr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock();
|
||||
if (tmp == nullptr) {
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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 ...
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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 ) {
|
||||
|
@ -30,7 +30,7 @@ def configure(target, my_module):
|
||||
])
|
||||
my_module.add_depend([
|
||||
'audio-river',
|
||||
'gtest',
|
||||
'etest',
|
||||
'etk',
|
||||
'test-debug'
|
||||
])
|
||||
|
@ -12,7 +12,7 @@
|
||||
//! [audio_river_sample_include]
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <thread>
|
||||
#include <ethread/Thread.hpp>
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <audio/river/Manager.hpp>
|
||||
#include <audio/river/Interface.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <thread>
|
||||
#include <ethread/Thread.hpp>
|
||||
|
||||
|
||||
//! [audio_river_sample_write_config_file]
|
||||
|
@ -30,13 +30,13 @@
|
||||
#include <audio/river/river.hpp>
|
||||
#include <audio/river/Manager.hpp>
|
||||
#include <audio/river/Interface.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
|
||||
#include <thread>
|
||||
#include <ethread/Thread.hpp>
|
||||
#include "testAEC.hpp"
|
||||
#include "testEchoDelay.hpp"
|
||||
#include "testFormat.hpp"
|
||||
|
@ -38,7 +38,7 @@ void audio::river::widget::TemporalViewer::onDataReceived(const void* _data,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
if (_format != audio::format_float) {
|
||||
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() {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
if (m_interface == nullptr) {
|
||||
//Get the generic input:
|
||||
etk::Vector<audio::channel> channel;
|
||||
@ -104,7 +104,7 @@ void audio::river::widget::TemporalViewer::onRegenerateDisplay() {
|
||||
m_draw.setColor(etk::color::black);
|
||||
m_draw.setPos(vec2(0,0));
|
||||
m_draw.rectangleWidth(m_size);
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
if (m_data.size() == 0) {
|
||||
return;
|
||||
}
|
||||
@ -143,7 +143,7 @@ void audio::river::widget::TemporalViewer::onRegenerateDisplay() {
|
||||
|
||||
|
||||
void audio::river::widget::TemporalViewer::periodicCall(const ewol::event::Time& _event) {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
std::unique_lock<ethread::Mutex> lock(m_mutex);
|
||||
int32_t nbSampleDelta = _event.getDeltaCall() * float(m_sampleRate);
|
||||
if (m_data.size()>m_sampleRate*nbSecond) {
|
||||
if (nbSampleDelta < m_data.size()) {
|
||||
|
@ -10,14 +10,14 @@
|
||||
#include <audio/river/river.hpp>
|
||||
#include <audio/river/Manager.hpp>
|
||||
#include <audio/river/Interface.hpp>
|
||||
#include <mutex>
|
||||
#include <ethread/Mutex.hpp>
|
||||
|
||||
namespace audio {
|
||||
namespace river {
|
||||
namespace widget {
|
||||
class TemporalViewer : public ewol::Widget {
|
||||
private:
|
||||
mutable std::mutex m_mutex;
|
||||
mutable ethread::Mutex m_mutex;
|
||||
private:
|
||||
ewol::compositing::Drawing m_draw; //!< drawing instance
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user