[DEV] update new ETK
This commit is contained in:
parent
40da422a38
commit
e1d4a8c7ea
@ -42,7 +42,7 @@ static const char* threadGetCharState(enum audio::blockEngine::status state) {
|
||||
*/
|
||||
void audio::blockEngine::Thread::threadChangeState(enum audio::blockEngine::status _newState) {
|
||||
int ret;
|
||||
std::unique_lock<std::mutex> lock(m_interfaceMutex);
|
||||
ethread::UniqueLock lock(m_interfaceMutex);
|
||||
// debug display :
|
||||
ABE_DEBUG("[" << m_id << "] '" << m_name << "' Change state : " << threadGetCharState(m_state) << " ==> " << threadGetCharState(_newState));
|
||||
// set the New state
|
||||
@ -51,7 +51,7 @@ void audio::blockEngine::Thread::threadChangeState(enum audio::blockEngine::stat
|
||||
}
|
||||
|
||||
|
||||
audio::blockEngine::Thread::Thread(const std::string& _chainName) {
|
||||
audio::blockEngine::Thread::Thread(const etk::String& _chainName) {
|
||||
if (_chainName != "") {
|
||||
m_name = _chainName;
|
||||
} else {
|
||||
@ -84,7 +84,7 @@ int32_t audio::blockEngine::Thread::start() {
|
||||
return audio::blockEngine::ERR_FAIL;
|
||||
}
|
||||
m_state = audio::blockEngine::statusCreating;
|
||||
m_thread = std::make_shared<std::thread>(audio::blockEngine::Thread::genericThreadCall, reinterpret_cast<void*>(this));
|
||||
m_thread = std::make_shared<ethread::Thread>(audio::blockEngine::Thread::genericThreadCall, reinterpret_cast<void*>(this));
|
||||
// no else ==> the thread is started corectly... (we think)
|
||||
return audio::blockEngine::ERR_NONE;
|
||||
}
|
||||
@ -92,7 +92,7 @@ int32_t audio::blockEngine::Thread::start() {
|
||||
int32_t audio::blockEngine::Thread::stop() {
|
||||
ABE_INFO(" Stop [" << m_id << "] name='" << m_name << "'");
|
||||
// Set the stop flag for the thread :
|
||||
std::unique_lock<std::mutex> lock(m_interfaceMutex);
|
||||
ethread::UniqueLock lock(m_interfaceMutex);
|
||||
m_flags |= 1;
|
||||
return audio::blockEngine::ERR_NONE;
|
||||
}
|
||||
@ -113,7 +113,7 @@ int32_t audio::blockEngine::Thread::stopAtEnd() {
|
||||
if (audio::blockEngine::statusNotStarted != m_state) {
|
||||
m_thread.reset();
|
||||
}
|
||||
std::unique_lock<std::mutex> lock(m_interfaceMutex);
|
||||
ethread::UniqueLock lock(m_interfaceMutex);
|
||||
m_flags = 0;
|
||||
|
||||
m_state = audio::blockEngine::statusNotStarted;
|
||||
@ -157,7 +157,7 @@ void audio::blockEngine::Thread::threadCall() {
|
||||
while(audio::blockEngine::statusDie != m_state) {
|
||||
int32_t flags = 0;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_interfaceMutex);
|
||||
ethread::UniqueLock lock(m_interfaceMutex);
|
||||
flags = m_flags;
|
||||
m_flags = 0;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <ethread/Thread.hpp>
|
||||
#include <ethread/Mutex.hpp>
|
||||
#include <etk/os/Fifo.hpp>
|
||||
#include <audio/blockEngine/core/audio.hpp>
|
||||
|
||||
@ -27,11 +27,11 @@ namespace audio {
|
||||
private:
|
||||
static void genericThreadCall(void * data);
|
||||
protected:
|
||||
std::shared_ptr<std::thread> m_thread;
|
||||
std::mutex m_interfaceMutex;
|
||||
std::shared_ptr<ethread::Thread> m_thread;
|
||||
ethread::Mutex m_interfaceMutex;
|
||||
int32_t m_flags;
|
||||
public:
|
||||
Thread(const std::string& _name="not-set-name");
|
||||
Thread(const etk::String& _name="not-set-name");
|
||||
~Thread();
|
||||
int32_t start(); //!< start the thread
|
||||
int32_t stop(); //!< stop this current thread (request the stop of the process) ==> a-synchronous request
|
||||
@ -43,7 +43,7 @@ namespace audio {
|
||||
private:
|
||||
void threadChangeState(enum status _newState); //!< information about state change
|
||||
protected:
|
||||
std::string m_name; //!< curent thread name
|
||||
etk::String m_name; //!< curent thread name
|
||||
private:
|
||||
uint32_t m_id; //!< Thread Id it will be Unique
|
||||
enum status m_state; //!< Thread current state
|
||||
|
@ -15,7 +15,7 @@ audio::blockEngine::GeneratorFile::GeneratorFile() :
|
||||
m_file(nullptr) {
|
||||
// set output :
|
||||
m_io.insert(
|
||||
std::pair<std::string, audio::blockEngine::Block::IOProperty>(
|
||||
etk::Pair<etk::String, audio::blockEngine::Block::IOProperty>(
|
||||
"out",
|
||||
audio::blockEngine::Block::IOProperty(
|
||||
audio::blockEngine::Block::ioOutput,
|
||||
|
@ -12,7 +12,7 @@ audio::blockEngine::GeneratorRiver::GeneratorRiver() {
|
||||
setLive(true);
|
||||
// set output :
|
||||
m_io.insert(
|
||||
std::pair<std::string, audio::blockEngine::Block::IOProperty>(
|
||||
etk::Pair<etk::String, audio::blockEngine::Block::IOProperty>(
|
||||
"out",
|
||||
audio::blockEngine::Block::IOProperty(
|
||||
audio::blockEngine::Block::ioOutput,
|
||||
|
@ -15,7 +15,7 @@ audio::blockEngine::ReceiverFile::ReceiverFile() :
|
||||
m_processStarted(false) {
|
||||
// set input :
|
||||
m_io.insert(
|
||||
std::pair<std::string, audio::blockEngine::Block::IOProperty>(
|
||||
etk::Pair<etk::String, audio::blockEngine::Block::IOProperty>(
|
||||
"in",
|
||||
audio::blockEngine::Block::IOProperty(
|
||||
audio::blockEngine::Block::ioInput,
|
||||
|
@ -32,13 +32,13 @@ void audio::blockEngine::ReceiverRiver::onDataNeeded(void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
ABE_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
int16_t* data = static_cast<int16_t*>(_data);
|
||||
|
||||
int32_t nbData = std::min(m_buffer.size()/2, _nbChunk*2);
|
||||
int32_t nbData = etk::min(m_buffer.size()/2, _nbChunk*2);
|
||||
for (int32_t iii=0; iii<nbData*2; ++iii) {
|
||||
((int8_t*)_data)[iii] = m_buffer[iii];
|
||||
//ABE_ERROR("write : " << data[iii]);
|
||||
@ -53,9 +53,9 @@ int32_t audio::blockEngine::ReceiverRiver::algoInit() {
|
||||
return audio::blockEngine::ERR_FAIL;
|
||||
}
|
||||
//Set stereo output:
|
||||
std::vector<audio::channel> channelMap;
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
m_interface = m_manager->createOutput(48000,
|
||||
channelMap,
|
||||
audio::format_int16,
|
||||
|
@ -19,7 +19,7 @@ namespace audio {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map);
|
||||
const etk::Vector<audio::channel>& _map);
|
||||
protected:
|
||||
ReceiverRiver();
|
||||
void init();
|
||||
@ -37,7 +37,7 @@ namespace audio {
|
||||
protected:
|
||||
ememory::SharedPtr<audio::river::Manager> m_manager;
|
||||
ememory::SharedPtr<audio::river::Interface> m_interface;
|
||||
std::vector<int8_t> m_buffer;
|
||||
etk::Vector<int8_t> m_buffer;
|
||||
public:
|
||||
int32_t algoProcess(int64_t _currentTime, int64_t _processTimeSlot);
|
||||
protected:
|
||||
|
@ -19,7 +19,7 @@ audio::blockEngine::Block::~Block() {
|
||||
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::Block::getBlockNamed(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::Block::getBlockNamed(const etk::String& _name) {
|
||||
ememory::SharedPtr<audio::blockEngine::Block> out;
|
||||
ABE_INFO(" get block : " << _name);
|
||||
ewol::ObjectShared parrent = m_parent.lock();
|
||||
|
@ -5,9 +5,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <etk/String.hpp>
|
||||
#include <ethread/Mutex.hpp>
|
||||
#include <etk/Map.hpp>
|
||||
#include <ewol/object/Object.hpp>
|
||||
#include <audio/blockEngine/core/audio.hpp>
|
||||
#include <audio/blockEngine/flow/Interface.hpp>
|
||||
@ -30,7 +30,7 @@ namespace audio {
|
||||
DECLARE_FACTORY(Block);
|
||||
virtual ~Block();
|
||||
protected:
|
||||
std::mutex m_mutex; //!< Block mutex access
|
||||
ethread::Mutex m_mutex; //!< Block mutex access
|
||||
|
||||
|
||||
public:
|
||||
@ -87,7 +87,7 @@ namespace audio {
|
||||
int32_t algoProcess(int64_t _currentTime, int64_t _processTimeSlot) {
|
||||
return audio::blockEngine::ERR_NONE;
|
||||
}
|
||||
virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const std::string& _name);
|
||||
virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const etk::String& _name);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ audio::blockEngine::BlockMeta::~BlockMeta() {
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::BlockMeta::getBlock(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::BlockMeta::getBlock(const etk::String& _name) {
|
||||
if (_name.size() == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -56,26 +56,26 @@ int32_t audio::blockEngine::BlockMeta::addBlock(ememory::SharedPtr<audio::blockE
|
||||
}
|
||||
}
|
||||
}
|
||||
m_list.push_back(_block);
|
||||
m_list.pushBack(_block);
|
||||
_block->setParent(sharedFromThis());
|
||||
return audio::blockEngine::ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t audio::blockEngine::BlockMeta::addBlock(const std::string& _blockType, const std::string& _name) {
|
||||
int32_t audio::blockEngine::BlockMeta::addBlock(const etk::String& _blockType, const etk::String& _name) {
|
||||
ABE_ERROR("NOT IMPLEMENTED");
|
||||
return audio::blockEngine::ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int32_t audio::blockEngine::BlockMeta::removeBlock(const std::string& _name) {
|
||||
int32_t audio::blockEngine::BlockMeta::removeBlock(const etk::String& _name) {
|
||||
ABE_ERROR("NOT IMPLEMENTED");
|
||||
return audio::blockEngine::ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
int32_t audio::blockEngine::BlockMeta::linkBlock(const std::string& _generatorBlockName,
|
||||
const std::string& _generatorIoName,
|
||||
const std::string& _receiverBlockName,
|
||||
const std::string& _receiverIoName) {
|
||||
int32_t audio::blockEngine::BlockMeta::linkBlock(const etk::String& _generatorBlockName,
|
||||
const etk::String& _generatorIoName,
|
||||
const etk::String& _receiverBlockName,
|
||||
const etk::String& _receiverIoName) {
|
||||
// TODO : proxy IOs
|
||||
ememory::SharedPtr<audio::blockEngine::Block> receive = getBlock(_receiverBlockName);
|
||||
if (receive == nullptr) {
|
||||
@ -86,12 +86,12 @@ int32_t audio::blockEngine::BlockMeta::linkBlock(const std::string& _generatorBl
|
||||
return audio::blockEngine::ERR_NONE;
|
||||
}
|
||||
|
||||
int32_t audio::blockEngine::BlockMeta::openFile(const std::string& _fileName) {
|
||||
int32_t audio::blockEngine::BlockMeta::openFile(const etk::String& _fileName) {
|
||||
ABE_ERROR("NOT IMPLEMENTED");
|
||||
return audio::blockEngine::ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int32_t audio::blockEngine::BlockMeta::openStream(const std::string& _stream) {
|
||||
int32_t audio::blockEngine::BlockMeta::openStream(const etk::String& _stream) {
|
||||
ABE_ERROR("NOT IMPLEMENTED");
|
||||
return audio::blockEngine::ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -166,7 +166,7 @@ int32_t audio::blockEngine::BlockMeta::algoStop() {
|
||||
};
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::BlockMeta::getBlockNamed(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::BlockMeta::getBlockNamed(const etk::String& _name) {
|
||||
ememory::SharedPtr<audio::blockEngine::Block> out;
|
||||
ABE_DEBUG("[" << propertyName << "] try get Block : " << _name);
|
||||
// Special case for proxy flow ...
|
||||
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <audio/blockEngine/core/Block.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
|
||||
namespace audio {
|
||||
namespace blockEngine {
|
||||
@ -20,14 +20,14 @@ namespace audio {
|
||||
DECLARE_FACTORY(BlockMeta);
|
||||
virtual ~BlockMeta();
|
||||
private:
|
||||
std::vector<ememory::SharedPtr<audio::blockEngine::Block>> m_list; //!< list of all block to process.
|
||||
etk::Vector<ememory::SharedPtr<audio::blockEngine::Block>> m_list; //!< list of all block to process.
|
||||
protected:
|
||||
/**
|
||||
* @brief Get a pointer on a specific block.
|
||||
* @param[in] _name Name of the block.
|
||||
* @return generic error
|
||||
*/
|
||||
ememory::SharedPtr<audio::blockEngine::Block> getBlock(const std::string& _name);
|
||||
ememory::SharedPtr<audio::blockEngine::Block> getBlock(const etk::String& _name);
|
||||
public:
|
||||
/**
|
||||
* @brief Add a block in the Meta-block
|
||||
@ -41,14 +41,14 @@ namespace audio {
|
||||
* @param[in] _name Name of the block to add.
|
||||
* @return generic error
|
||||
*/
|
||||
int32_t addBlock(const std::string& _blockType, const std::string& _name = "");
|
||||
int32_t addBlock(const etk::String& _blockType, const etk::String& _name = "");
|
||||
/**
|
||||
* @brief Remove a block from the Meta-block
|
||||
* @param[in] _name Name of the block to remove
|
||||
* @note This free the block pointer
|
||||
* @return generic error
|
||||
*/
|
||||
int32_t removeBlock(const std::string& _name);
|
||||
int32_t removeBlock(const etk::String& _name);
|
||||
/**
|
||||
* @brief Link 2 IO.
|
||||
* @param[in] _generatorBlockName Name ot the generator Block
|
||||
@ -57,29 +57,29 @@ namespace audio {
|
||||
* @param[in] _receiverIoName Name of the input
|
||||
* @return generic error
|
||||
*/
|
||||
int32_t linkBlock(const std::string& _generatorBlockName,
|
||||
const std::string& _generatorIoName,
|
||||
const std::string& _receiverBlockName,
|
||||
const std::string& _receiverIoName);
|
||||
int32_t linkBlock(const etk::String& _generatorBlockName,
|
||||
const etk::String& _generatorIoName,
|
||||
const etk::String& _receiverBlockName,
|
||||
const etk::String& _receiverIoName);
|
||||
/**
|
||||
* @brief Open file property
|
||||
* @param[in] _fileName Name of the file to open
|
||||
* @return generic error
|
||||
*/
|
||||
int32_t openFile(const std::string& _fileName);
|
||||
int32_t openFile(const etk::String& _fileName);
|
||||
/**
|
||||
* @brief Open stream property
|
||||
* @param[in] _stream data stream to open
|
||||
* @return generic error
|
||||
*/
|
||||
int32_t openStream(const std::string& _stream);
|
||||
int32_t openStream(const etk::String& _stream);
|
||||
public: // herited function
|
||||
virtual int32_t algoInit();
|
||||
virtual int32_t algoUnInit();
|
||||
virtual int32_t algoStart();
|
||||
virtual int32_t algoStop();
|
||||
|
||||
virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const std::string& _name);
|
||||
virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const etk::String& _name);
|
||||
virtual void flowLinkInput();
|
||||
virtual void flowCheckAllCompatibility();
|
||||
virtual void flowAllocateOutput();
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <audio/blockEngine/debug.hpp>
|
||||
|
||||
|
||||
audio::blockEngine::BufferAudio::BufferAudio(audio::blockEngine::Block& _parent, const std::string& _description) :
|
||||
audio::blockEngine::BufferAudio::BufferAudio(audio::blockEngine::Block& _parent, const etk::String& _description) :
|
||||
audio::blockEngine::Buffer(_parent),
|
||||
m_frequency(48000),
|
||||
m_channelMap({audioChannelFrontLeft,audioChannelFrontRight}),
|
||||
@ -21,7 +21,7 @@ audio::blockEngine::BufferAudio::BufferAudio(audio::blockEngine::Block& _parent,
|
||||
|
||||
audio::blockEngine::BufferAudio::BufferAudio(audio::blockEngine::Block& _parent,
|
||||
int32_t _frequency,
|
||||
const std::vector<enum audioChannel>& _map,
|
||||
const etk::Vector<enum audioChannel>& _map,
|
||||
enum audioFormat _format) :
|
||||
audio::blockEngine::Buffer(_parent),
|
||||
m_frequency(_frequency),
|
||||
|
@ -33,17 +33,17 @@ namespace audio {
|
||||
public:
|
||||
BufferAudio(audio::blockEngine::Block& _parent,
|
||||
int32_t _frequency=48000,
|
||||
const std::vector<enum audioChannel>& _map={audioChannelFrontLeft,audioChannelFrontRight},
|
||||
const etk::Vector<enum audioChannel>& _map={audioChannelFrontLeft,audioChannelFrontRight},
|
||||
enum audioFormat _format=audioFormatInt16);
|
||||
BufferAudio(audio::blockEngine::Block& _parent,
|
||||
const std::string& _description);
|
||||
const etk::String& _description);
|
||||
virtual ~BufferAudio();
|
||||
protected:
|
||||
int32_t m_frequency;
|
||||
std::vector<enum audioChannel> m_channelMap;
|
||||
etk::Vector<enum audioChannel> m_channelMap;
|
||||
enum audioFormat m_format;
|
||||
protected:
|
||||
std::vector<int8_t> m_data; //!< pointer on the data.
|
||||
etk::Vector<int8_t> m_data; //!< pointer on the data.
|
||||
int8_t m_sampleSize; //!< Size of one sample
|
||||
int8_t m_chunkSize; //!< Size of one chunk Size
|
||||
public:
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <audio/blockEngine/core/Block.hpp>
|
||||
#include <audio/blockEngine/core/BlockMeta.hpp>
|
||||
#include <audio/blockEngine/Thread.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
|
||||
namespace audio {
|
||||
namespace blockEngine {
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
audio::blockEngine::flow::Base::Base(audio::blockEngine::flow::Interface& _flowInterfaceLink,
|
||||
bool _input,
|
||||
const std::string& _name,
|
||||
const std::string& _description,
|
||||
const std::string& _formatAvaillable) :
|
||||
const etk::String& _name,
|
||||
const etk::String& _description,
|
||||
const etk::String& _formatAvaillable) :
|
||||
m_flowInterfaceLink(_flowInterfaceLink),
|
||||
m_name(_name),
|
||||
m_description(_description),
|
||||
@ -31,7 +31,7 @@ audio::blockEngine::flow::Base::~Base() {
|
||||
ABE_INFO("Remove flow : '" << m_name << "' mode:'" << (m_input==true?"input":"output") << "'");
|
||||
};
|
||||
|
||||
std::ostream& audio::blockEngine::flow::operator <<(std::ostream& _os, const audio::blockEngine::flow::Base& _obj) {
|
||||
etk::Stream& audio::blockEngine::flow::operator <<(etk::Stream& _os, const audio::blockEngine::flow::Base& _obj) {
|
||||
_os << _obj.getName();
|
||||
return _os;
|
||||
}
|
||||
@ -50,8 +50,8 @@ void audio::blockEngine::flow::Base::getInputBuffer() {
|
||||
}
|
||||
|
||||
// due to the fact it acces at the block interface, we need to write it here ...
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::flow::Base::getFlowReference(const std::string& _blockName,
|
||||
const std::string& _flowLinkName) {
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::flow::Base::getFlowReference(const etk::String& _blockName,
|
||||
const etk::String& _flowLinkName) {
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> out;
|
||||
if (_flowLinkName == "") {
|
||||
ABE_INFO(" Get flow : " << _blockName << ":" << _flowLinkName << " nothing to do ==> no connection ...");
|
||||
@ -71,7 +71,7 @@ ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::
|
||||
}
|
||||
|
||||
/*
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::flow::Base::getBlockNamed(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::blockEngine::Block> audio::blockEngine::flow::Base::getBlockNamed(const etk::String& _name) {
|
||||
ABE_ERROR("NEED to call Parrent ...");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ namespace audio {
|
||||
class Base {
|
||||
protected:
|
||||
audio::blockEngine::flow::Interface& m_flowInterfaceLink;
|
||||
std::string m_name;
|
||||
std::string m_description;
|
||||
etk::String m_name;
|
||||
etk::String m_description;
|
||||
bool m_input;
|
||||
ejson::Document m_formatAvaillable;
|
||||
public:
|
||||
@ -33,18 +33,18 @@ namespace audio {
|
||||
*/
|
||||
Base(audio::blockEngine::flow::Interface& _flowInterfaceLink,
|
||||
bool _input,
|
||||
const std::string& _name,
|
||||
const std::string& _description = "",
|
||||
const std::string& _formatAvaillable="{}");
|
||||
const etk::String& _name,
|
||||
const etk::String& _description = "",
|
||||
const etk::String& _formatAvaillable="{}");
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
virtual ~Base();
|
||||
|
||||
const std::string& getName() const {
|
||||
const etk::String& getName() const {
|
||||
return m_name;
|
||||
}
|
||||
const std::string& getDescription() const {
|
||||
const etk::String& getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
bool isInput() {
|
||||
@ -61,8 +61,8 @@ namespace audio {
|
||||
* @param[in] _blockName Extern block name (if "" ==> upper block)
|
||||
* @param[in] _flowLinkName Name of the link
|
||||
*/
|
||||
virtual void setLink(const std::string& _blockName,
|
||||
const std::string& _flowLinkName) {
|
||||
virtual void setLink(const etk::String& _blockName,
|
||||
const etk::String& _flowLinkName) {
|
||||
ABE_ERROR("[" << m_name << "] Can not create a link on an Output (only manage with input ...)");
|
||||
}
|
||||
protected:
|
||||
@ -75,15 +75,15 @@ namespace audio {
|
||||
ABE_ERROR("[" << m_name << "] Can not add reference ...");
|
||||
}
|
||||
protected:
|
||||
ememory::SharedPtr<BaseReference> getFlowReference(const std::string& _blockName,
|
||||
const std::string& _flowLinkName);
|
||||
ememory::SharedPtr<BaseReference> getFlowReference(const etk::String& _blockName,
|
||||
const etk::String& _flowLinkName);
|
||||
public:
|
||||
virtual void link();
|
||||
virtual int32_t checkCompatibility();
|
||||
virtual void getInputBuffer();
|
||||
//virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const std::string& _name);
|
||||
//virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const etk::String& _name);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::blockEngine::flow::Base& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::blockEngine::flow::Base& _obj);
|
||||
// we use a reference to simplify code of every blocks...
|
||||
//! @not-in-doc
|
||||
class BaseReference : public ememory::EnableSharedFromThis<BaseReference> {
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <etk/Function.hpp>
|
||||
#include <audio/blockEngine/flow/Base.hpp>
|
||||
#include <audio/blockEngine/core/Buffer.hpp>
|
||||
#include <audio/blockEngine/debug.hpp>
|
||||
@ -27,9 +27,9 @@ namespace audio {
|
||||
*/
|
||||
Flow(audio::blockEngine::flow::Interface& _flowInterfaceLink,
|
||||
bool _input,
|
||||
const std::string& _name,
|
||||
const std::string& _description = "",
|
||||
const std::string& _formatAvaillable="{}") :
|
||||
const etk::String& _name,
|
||||
const etk::String& _description = "",
|
||||
const etk::String& _formatAvaillable="{}") :
|
||||
flow::Base(_flowInterfaceLink, _input, _name, _description, _formatAvaillable) {
|
||||
|
||||
};
|
||||
@ -53,8 +53,8 @@ namespace audio {
|
||||
namespace flow {
|
||||
template<typename T> class Input : public Flow<T> {
|
||||
private:
|
||||
std::string m_blockName; //!< Temporary value of flow link (when not linked & distant block can be created after) : Block name
|
||||
std::string m_flowName; //!< Temporary value of flow link (when not linked & distant block can be created after) : Flow name
|
||||
etk::String m_blockName; //!< Temporary value of flow link (when not linked & distant block can be created after) : Block name
|
||||
etk::String m_flowName; //!< Temporary value of flow link (when not linked & distant block can be created after) : Flow name
|
||||
ememory::WeakPtr<BaseReference> m_remoteFlow; //!< reference on the remote flow.
|
||||
public:
|
||||
/**
|
||||
@ -65,9 +65,9 @@ namespace audio {
|
||||
* @param[in] _formatAvaillable List of format availlable (or {} of all)
|
||||
*/
|
||||
Input(audio::blockEngine::flow::Interface& _flowInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description = "",
|
||||
const std::string& _formatAvaillable="{}") :
|
||||
const etk::String& _name,
|
||||
const etk::String& _description = "",
|
||||
const etk::String& _formatAvaillable="{}") :
|
||||
Flow<T>(_flowInterfaceLink, true, _name, _description, _formatAvaillable) {
|
||||
|
||||
};
|
||||
@ -75,8 +75,8 @@ namespace audio {
|
||||
* @brief Destructor.
|
||||
*/
|
||||
virtual ~Input() { };
|
||||
virtual void setLink(const std::string& _blockName,
|
||||
const std::string& _flowLinkName) {
|
||||
virtual void setLink(const etk::String& _blockName,
|
||||
const etk::String& _flowLinkName) {
|
||||
m_blockName = _blockName;
|
||||
m_flowName = _flowLinkName;
|
||||
ABE_INFO("[" << Base::m_name << "] Link with : '" << m_blockName << "':'" << m_flowName << "'");
|
||||
@ -95,7 +95,7 @@ namespace audio {
|
||||
};
|
||||
template<typename T> class Output : public Flow<T> {
|
||||
protected:
|
||||
std::vector<ememory::WeakPtr<BaseReference>> m_remoteFlow; //!< List of reference on the remote flow (multiple childs).
|
||||
etk::Vector<ememory::WeakPtr<BaseReference>> m_remoteFlow; //!< List of reference on the remote flow (multiple childs).
|
||||
ejson::Object m_formatMix; //!< current format that is now availlable on the flow (can be on error) represent the intersection of all flow connected
|
||||
public:
|
||||
/**
|
||||
@ -106,9 +106,9 @@ namespace audio {
|
||||
* @param[in] _formatAvaillable List of format availlable (or {} of all)
|
||||
*/
|
||||
Output(audio::blockEngine::flow::Interface& _flowInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description = "",
|
||||
const std::string& _formatAvaillable="{}") :
|
||||
const etk::String& _name,
|
||||
const etk::String& _description = "",
|
||||
const etk::String& _formatAvaillable="{}") :
|
||||
Flow<T>(_flowInterfaceLink, false, _name, _description, _formatAvaillable) {
|
||||
|
||||
};
|
||||
@ -117,17 +117,17 @@ namespace audio {
|
||||
*/
|
||||
virtual ~Output() { };
|
||||
virtual void addReference(const ememory::SharedPtr<BaseReference>& _reference) {
|
||||
m_remoteFlow.push_back(_reference);
|
||||
m_remoteFlow.pushBack(_reference);
|
||||
}
|
||||
virtual int32_t checkCompatibility() {
|
||||
ABE_INFO(" check for : '" << Base::m_name << "' to " << m_remoteFlow.size() << " links");
|
||||
std::vector<ejson::Object> list;
|
||||
list.push_back(Base::getCapabilities());
|
||||
etk::Vector<ejson::Object> list;
|
||||
list.pushBack(Base::getCapabilities());
|
||||
for (auto &it : m_remoteFlow) {
|
||||
ememory::SharedPtr<BaseReference> tmp = it.lock();
|
||||
if (tmp != nullptr) {
|
||||
if (tmp->getBase() != nullptr) {
|
||||
list.push_back(tmp->getBase()->getCapabilities());
|
||||
list.pushBack(tmp->getBase()->getCapabilities());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ void audio::blockEngine::flow::Interface::flowAdd(audio::blockEngine::flow::Base
|
||||
ABE_ERROR("Try to link a nullptr flow");
|
||||
return;
|
||||
}
|
||||
m_list.push_back(_pointerOnFlow);
|
||||
m_list.pushBack(_pointerOnFlow);
|
||||
}
|
||||
|
||||
void audio::blockEngine::flow::Interface::flowRemove(audio::blockEngine::flow::Base* _pointerOnFlow) {
|
||||
@ -42,11 +42,11 @@ void audio::blockEngine::flow::Interface::flowRemove(audio::blockEngine::flow::B
|
||||
ABE_ERROR("Try to unlink a Unexistant flow");
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::blockEngine::flow::Interface::flowGetAll() const {
|
||||
std::vector<std::string> out;
|
||||
etk::Vector<etk::String> audio::blockEngine::flow::Interface::flowGetAll() const {
|
||||
etk::Vector<etk::String> out;
|
||||
for (auto &it : m_list) {
|
||||
if(it != nullptr) {
|
||||
out.push_back(it->getName());
|
||||
out.pushBack(it->getName());
|
||||
}
|
||||
}
|
||||
return out;
|
||||
@ -57,9 +57,9 @@ void audio::blockEngine::flow::Interface::flowRemoveAll() {
|
||||
}
|
||||
|
||||
|
||||
void audio::blockEngine::flow::Interface::flowSetLinkWith(const std::string& _flowName,
|
||||
const std::string& _blockName,
|
||||
const std::string& _flowLinkName) {
|
||||
void audio::blockEngine::flow::Interface::flowSetLinkWith(const etk::String& _flowName,
|
||||
const etk::String& _blockName,
|
||||
const etk::String& _flowLinkName) {
|
||||
for (auto &it : m_list) {
|
||||
if( it != nullptr
|
||||
&& it->getName() == _flowName) {
|
||||
@ -102,7 +102,7 @@ void audio::blockEngine::flow::Interface::flowGetInput() {
|
||||
}
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::flow::Interface::getFlowReference(const std::string& _flowName) {
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> audio::blockEngine::flow::Interface::getFlowReference(const etk::String& _flowName) {
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> out;
|
||||
for (auto &it : m_list) {
|
||||
if( it != nullptr
|
||||
@ -153,7 +153,7 @@ static ejson::Value intersect(const ejson::Value& _obj1, const ejson::Value& _ob
|
||||
}
|
||||
if (_obj1.isString() == true) {
|
||||
// just a single output value ... just check if it is the same value
|
||||
std::string value = _obj1.toString().get();
|
||||
etk::String value = _obj1.toString().get();
|
||||
if (_obj2.isString() == true) {
|
||||
if (value == _obj2.toString().get()) {
|
||||
return ejson::String(value);
|
||||
@ -183,7 +183,7 @@ static ejson::Value intersect(const ejson::Value& _obj1, const ejson::Value& _ob
|
||||
return ejson::Null();
|
||||
}
|
||||
|
||||
ejson::Object audio::blockEngine::flow::Interface::getFlowIntersection(const std::vector<ejson::Object>& _list) {
|
||||
ejson::Object audio::blockEngine::flow::Interface::getFlowIntersection(const etk::Vector<ejson::Object>& _list) {
|
||||
ABE_ERROR("-------------- start intersection --------------");
|
||||
ejson::Object out;
|
||||
if (_list.size() == 0) {
|
||||
|
@ -5,8 +5,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/Map.hpp>
|
||||
#include <ejson/ejson.hpp>
|
||||
|
||||
namespace audio {
|
||||
@ -18,7 +18,7 @@ namespace audio {
|
||||
class Interface {
|
||||
friend class audio::blockEngine::flow::Base; // to register parameter in the list.
|
||||
private:
|
||||
std::vector<audio::blockEngine::flow::Base*> m_list; //!< list of availlable Flow
|
||||
etk::Vector<audio::blockEngine::flow::Base*> m_list; //!< list of availlable Flow
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor.
|
||||
@ -45,7 +45,7 @@ namespace audio {
|
||||
* @brief Get All the flow list:
|
||||
* @return vector on all the flow names
|
||||
*/
|
||||
std::vector<std::string> flowGetAll() const;
|
||||
etk::Vector<etk::String> flowGetAll() const;
|
||||
/**
|
||||
* @brief Remove all flows.
|
||||
*/
|
||||
@ -56,9 +56,9 @@ namespace audio {
|
||||
* @param[in] _blockName Extern block name (if "" ==> upper block)
|
||||
* @param[in] _flowLinkName Name of the link
|
||||
*/
|
||||
void flowSetLinkWith(const std::string& _flowName,
|
||||
const std::string& _blockName,
|
||||
const std::string& _flowLinkName);
|
||||
void flowSetLinkWith(const etk::String& _flowName,
|
||||
const etk::String& _blockName,
|
||||
const etk::String& _flowLinkName);
|
||||
public:
|
||||
// get pointer on the specidic input and output from all the IOs
|
||||
virtual void flowLinkInput();
|
||||
@ -74,12 +74,12 @@ namespace audio {
|
||||
* @param[in] _name Name of the block requested
|
||||
* @return The block requested if it exist.
|
||||
*/
|
||||
virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const std::string& _name) {
|
||||
virtual ememory::SharedPtr<audio::blockEngine::Block> getBlockNamed(const etk::String& _name) {
|
||||
return nullptr;
|
||||
}
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> getFlowReference(const std::string& _name);
|
||||
ememory::SharedPtr<audio::blockEngine::flow::BaseReference> getFlowReference(const etk::String& _name);
|
||||
public:
|
||||
ejson::Object getFlowIntersection(const std::vector<ejson::Object>& _list);
|
||||
ejson::Object getFlowIntersection(const etk::Vector<ejson::Object>& _list);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class MainApplication : public ewol::context::Application {
|
||||
virtual void onCreate(ewol::Context& _context) override {
|
||||
APPL_INFO("==> OnCreate APPL (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ")");
|
||||
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
||||
std::string tmpppp = _context.getCmd().get(iii);
|
||||
etk::String tmpppp = _context.getCmd().get(iii);
|
||||
if ( tmpppp == "-h"
|
||||
|| tmpppp == "--help") {
|
||||
APPL_INFO(" -t c-flags-file-name" );
|
||||
|
@ -26,7 +26,7 @@ appl::Windows::Windows() {
|
||||
|
||||
void appl::Windows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
std::string composition = std::string("");
|
||||
etk::String composition = etk::String("");
|
||||
composition += "<sizer mode='vert'>\n";
|
||||
composition += " <sizer mode='hori'>\n";
|
||||
composition += " <button name='bt-play1'>\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user