[RENAME] change airtalgo => drain

This commit is contained in:
Edouard DUPIN 2015-02-05 19:10:53 +01:00
parent 8f29bd608b
commit ff6c33d566
31 changed files with 210 additions and 210 deletions

View File

@ -3,7 +3,7 @@
* @copyright 2011, Edouard DUPIN, all right reserved
* @license APACHE v2.0 (see license file)
*/
#include <airtalgo/Algo.h>
#include <drain/Algo.h>
#include <functional>
#include "debug.h"
@ -11,7 +11,7 @@
#undef __class__
#define __class__ "Algo"
airtalgo::Algo::Algo() :
drain::Algo::Algo() :
m_temporary(false),
m_outputData(),
m_formatSize(0),
@ -19,15 +19,15 @@ airtalgo::Algo::Algo() :
AIRTALGO_VERBOSE("CREATE ALGO");
}
void airtalgo::Algo::init() {
void drain::Algo::init() {
// set notification callback :
m_input.setCallback(std::bind(&airtalgo::Algo::configurationChangeLocal, this));
m_output.setCallback(std::bind(&airtalgo::Algo::configurationChangeLocal, this));
m_input.setCallback(std::bind(&drain::Algo::configurationChangeLocal, this));
m_output.setCallback(std::bind(&drain::Algo::configurationChangeLocal, this));
// first configure ==> update the internal parameters
configurationChange();
}
void airtalgo::Algo::configurationChange() {
void drain::Algo::configurationChange() {
m_needProcess = false;
if (m_input.getFormat() != m_output.getFormat()) {
m_needProcess = true;
@ -63,7 +63,7 @@ void airtalgo::Algo::configurationChange() {
}
}
size_t airtalgo::Algo::needInputData(size_t _output) {
size_t drain::Algo::needInputData(size_t _output) {
size_t input = _output;
/* NOT good at all ...
if (m_input.getFormat() != m_output.getFormat()) {

View File

@ -20,7 +20,7 @@
#include "IOFormatInterface.h"
#include "debug.h"
namespace airtalgo{
namespace drain{
class Algo : public std::enable_shared_from_this<Algo> {
private:
std::string m_name;

View File

@ -7,11 +7,11 @@
#include "AutoLogInOut.h"
#include "debug.h"
airtalgo::AutoLogInOut::AutoLogInOut(const std::string& _value) :
drain::AutoLogInOut::AutoLogInOut(const std::string& _value) :
m_value(_value) {
AIRTALGO_VERBOSE(" '" << m_value << "' [START]");
}
airtalgo::AutoLogInOut::~AutoLogInOut() {
drain::AutoLogInOut::~AutoLogInOut() {
AIRTALGO_VERBOSE(" '" << m_value << "' [STOP]");
}

View File

@ -11,7 +11,7 @@
#include <string>
#include "debug.h"
namespace airtalgo{
namespace drain{
class AutoLogInOut {
private:
std::string m_value;

View File

@ -4,7 +4,7 @@
* @license APACHE v2.0 (see license file)
*/
#include <airtalgo/ChannelReorder.h>
#include <drain/ChannelReorder.h>
#include <iostream>
#include "debug.h"
#include "debug.h"
@ -13,25 +13,25 @@
#undef __class__
#define __class__ "ChannelReorder"
airtalgo::ChannelReorder::ChannelReorder() {
drain::ChannelReorder::ChannelReorder() {
}
void airtalgo::ChannelReorder::init() {
airtalgo::Algo::init();
void drain::ChannelReorder::init() {
drain::Algo::init();
m_type = "ChannelReorder";
}
std::shared_ptr<airtalgo::ChannelReorder> airtalgo::ChannelReorder::create() {
std::shared_ptr<airtalgo::ChannelReorder> tmp(new airtalgo::ChannelReorder());
std::shared_ptr<drain::ChannelReorder> drain::ChannelReorder::create() {
std::shared_ptr<drain::ChannelReorder> tmp(new drain::ChannelReorder());
tmp->init();
return tmp;
}
void airtalgo::ChannelReorder::configurationChange() {
airtalgo::AutoLogInOut("ChannelReorder (config)");
airtalgo::Algo::configurationChange();
void drain::ChannelReorder::configurationChange() {
drain::AutoLogInOut("ChannelReorder (config)");
drain::Algo::configurationChange();
if (m_input.getFormat() != m_output.getFormat()) {
AIRTALGO_ERROR("can not support Format Change ...");
m_needProcess = false;
@ -49,12 +49,12 @@ void airtalgo::ChannelReorder::configurationChange() {
}
bool airtalgo::ChannelReorder::process(std::chrono::system_clock::time_point& _time,
bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time,
void* _input,
size_t _inputNbChunk,
void*& _output,
size_t& _outputNbChunk) {
airtalgo::AutoLogInOut tmpLog("ChannelReorder");
drain::AutoLogInOut tmpLog("ChannelReorder");
_outputNbChunk = _inputNbChunk;
// check if we need to process:
if (m_needProcess == false) {

View File

@ -7,9 +7,9 @@
#ifndef __AIRT_ALGO_CHANNEL_REORDER_H__
#define __AIRT_ALGO_CHANNEL_REORDER_H__
#include <airtalgo/Algo.h>
#include <drain/Algo.h>
namespace airtalgo{
namespace drain{
class ChannelReorder : public Algo {
protected:
/**

View File

@ -7,9 +7,9 @@
#ifndef __AIRT_ALGO_END_POINT_H__
#define __AIRT_ALGO_END_POINT_H__
#include <airtalgo/Algo.h>
#include <drain/Algo.h>
namespace airtalgo{
namespace drain{
class EndPoint : public Algo {
protected:
/**
@ -17,7 +17,7 @@ namespace airtalgo{
*/
EndPoint() {};
void init() {
airtalgo::Algo::init();
drain::Algo::init();
};
public:
/**

View File

@ -5,53 +5,53 @@
*/
#include "debug.h"
#include <airtalgo/EndPointCallback.h>
#include <drain/EndPointCallback.h>
#undef __class__
#define __class__ "EndPointCallback"
airtalgo::EndPointCallback::EndPointCallback() :
drain::EndPointCallback::EndPointCallback() :
m_outputFunction(nullptr),
m_inputFunction(nullptr) {
}
void airtalgo::EndPointCallback::init(needDataFunction _callback) {
void drain::EndPointCallback::init(needDataFunction _callback) {
m_outputFunction = _callback;
airtalgo::EndPoint::init();
drain::EndPoint::init();
m_type = "EndPointCallback";
}
void airtalgo::EndPointCallback::init(haveNewDataFunction _callback) {
void drain::EndPointCallback::init(haveNewDataFunction _callback) {
m_inputFunction = _callback;
airtalgo::EndPoint::init();
drain::EndPoint::init();
m_type = "EndPointCallback";
}
std::shared_ptr<airtalgo::EndPointCallback> airtalgo::EndPointCallback::create(needDataFunction _callback) {
std::shared_ptr<airtalgo::EndPointCallback> tmp(new airtalgo::EndPointCallback());
std::shared_ptr<drain::EndPointCallback> drain::EndPointCallback::create(needDataFunction _callback) {
std::shared_ptr<drain::EndPointCallback> tmp(new drain::EndPointCallback());
tmp->init(_callback);
return tmp;
}
std::shared_ptr<airtalgo::EndPointCallback> airtalgo::EndPointCallback::create(haveNewDataFunction _callback) {
std::shared_ptr<airtalgo::EndPointCallback> tmp(new airtalgo::EndPointCallback());
std::shared_ptr<drain::EndPointCallback> drain::EndPointCallback::create(haveNewDataFunction _callback) {
std::shared_ptr<drain::EndPointCallback> tmp(new drain::EndPointCallback());
tmp->init(_callback);
return tmp;
}
void airtalgo::EndPointCallback::configurationChange() {
airtalgo::EndPoint::configurationChange();
void drain::EndPointCallback::configurationChange() {
drain::EndPoint::configurationChange();
AIRTALGO_INFO("update : format=" << m_output.getFormat() << " map=" << m_input.getMap() << " freq=" << m_input.getFrequency() << " size=" << int32_t(m_formatSize));
m_needProcess = true;
}
bool airtalgo::EndPointCallback::process(std::chrono::system_clock::time_point& _time,
bool drain::EndPointCallback::process(std::chrono::system_clock::time_point& _time,
void* _input, // uneeded
size_t _inputNbChunk, // requested number of sample ...
void*& _output,
size_t& _outputNbChunk){
airtalgo::AutoLogInOut tmpLog("EndPointCallback");
drain::AutoLogInOut tmpLog("EndPointCallback");
if (m_outputFunction != nullptr) {
// update buffer size ...
m_outputData.resize(_inputNbChunk*m_output.getMap().size()*m_formatSize);

View File

@ -7,11 +7,11 @@
#ifndef __AIRT_ALGO_END_POINT_CALLBACK_H__
#define __AIRT_ALGO_END_POINT_CALLBACK_H__
#include <airtalgo/EndPoint.h>
#include <drain/EndPoint.h>
#include <functional>
namespace airtalgo {
namespace drain {
typedef std::function<void (const std::chrono::system_clock::time_point& _playTime,
size_t _nbChunk,
const std::vector<audio::channel>& _map,

View File

@ -5,39 +5,39 @@
*/
#include "debug.h"
#include <airtalgo/EndPointRead.h>
#include <drain/EndPointRead.h>
#undef __class__
#define __class__ "EndPointRead"
airtalgo::EndPointRead::EndPointRead() {
drain::EndPointRead::EndPointRead() {
}
void airtalgo::EndPointRead::init() {
airtalgo::EndPoint::init();
void drain::EndPointRead::init() {
drain::EndPoint::init();
m_type = "EndPointRead";
}
std::shared_ptr<airtalgo::EndPointRead> airtalgo::EndPointRead::create() {
std::shared_ptr<airtalgo::EndPointRead> tmp(new airtalgo::EndPointRead());
std::shared_ptr<drain::EndPointRead> drain::EndPointRead::create() {
std::shared_ptr<drain::EndPointRead> tmp(new drain::EndPointRead());
tmp->init();
return tmp;
}
void airtalgo::EndPointRead::configurationChange() {
airtalgo::EndPoint::configurationChange();
void drain::EndPointRead::configurationChange() {
drain::EndPoint::configurationChange();
m_needProcess = true;
}
bool airtalgo::EndPointRead::process(std::chrono::system_clock::time_point& _time,
bool drain::EndPointRead::process(std::chrono::system_clock::time_point& _time,
void* _input,
size_t _inputNbChunk,
void*& _output,
size_t& _outputNbChunk){
airtalgo::AutoLogInOut tmpLog("EndPointRead");
drain::AutoLogInOut tmpLog("EndPointRead");
return false;
}

View File

@ -7,9 +7,9 @@
#ifndef __AIRT_ALGO_END_POINT_READ_H__
#define __AIRT_ALGO_END_POINT_READ_H__
#include <airtalgo/EndPoint.h>
#include <drain/EndPoint.h>
namespace airtalgo{
namespace drain{
class EndPointRead : public EndPoint {
protected:
/**

View File

@ -4,40 +4,40 @@
* @license APACHE v2.0 (see license file)
*/
#include "debug.h"
#include <airtalgo/EndPointWrite.h>
#include <drain/EndPointWrite.h>
#undef __class__
#define __class__ "EndPointWrite"
airtalgo::EndPointWrite::EndPointWrite() :
drain::EndPointWrite::EndPointWrite() :
m_function(nullptr) {
}
void airtalgo::EndPointWrite::init() {
airtalgo::EndPoint::init();
void drain::EndPointWrite::init() {
drain::EndPoint::init();
m_type = "EndPoint";
}
std::shared_ptr<airtalgo::EndPointWrite> airtalgo::EndPointWrite::create() {
std::shared_ptr<airtalgo::EndPointWrite> tmp(new airtalgo::EndPointWrite());
std::shared_ptr<drain::EndPointWrite> drain::EndPointWrite::create() {
std::shared_ptr<drain::EndPointWrite> tmp(new drain::EndPointWrite());
tmp->init();
return tmp;
}
void airtalgo::EndPointWrite::configurationChange() {
airtalgo::EndPoint::configurationChange();
void drain::EndPointWrite::configurationChange() {
drain::EndPoint::configurationChange();
m_needProcess = true;
}
bool airtalgo::EndPointWrite::process(std::chrono::system_clock::time_point& _time,
bool drain::EndPointWrite::process(std::chrono::system_clock::time_point& _time,
void* _input,
size_t _inputNbChunk,
void*& _output,
size_t& _outputNbChunk){
airtalgo::AutoLogInOut tmpLog("EndPointWrite");
drain::AutoLogInOut tmpLog("EndPointWrite");
//AIRTALGO_INFO(" nb Sample in buffer : " << m_tmpData.size());
if (m_function != nullptr) {
if (m_tmpData.size() <= 20000) {
@ -70,7 +70,7 @@ bool airtalgo::EndPointWrite::process(std::chrono::system_clock::time_point& _ti
return true;
}
void airtalgo::EndPointWrite::write(const void* _value, size_t _nbChunk) {
void drain::EndPointWrite::write(const void* _value, size_t _nbChunk) {
std::unique_lock<std::mutex> lock(m_mutex);
AIRTALGO_INFO("[ASYNC] Write data : " << _nbChunk << " chunks"
<< " ==> " << _nbChunk*m_output.getMap().size() << " samples"

View File

@ -7,11 +7,11 @@
#ifndef __AIRT_ALGO_ALGO_END_POINT_WRITE_H__
#define __AIRT_ALGO_ALGO_END_POINT_WRITE_H__
#include <airtalgo/EndPoint.h>
#include <drain/EndPoint.h>
#include <mutex>
#include <functional>
namespace airtalgo{
namespace drain{
typedef std::function<void (const std::chrono::system_clock::time_point& _playTime,
const size_t& _nbChunk,
const std::vector<audio::channel>& _map,

View File

@ -5,7 +5,7 @@
*/
#include "debug.h"
#include <airtalgo/FormatUpdate.h>
#include <drain/FormatUpdate.h>
#include <iostream>
#undef __class__
@ -126,24 +126,24 @@ static void convert__float__to__int32(void* _input, void* _output, size_t _nbSam
}
airtalgo::FormatUpdate::FormatUpdate() :
drain::FormatUpdate::FormatUpdate() :
m_functionConvert(nullptr) {
}
void airtalgo::FormatUpdate::init() {
airtalgo::Algo::init();
void drain::FormatUpdate::init() {
drain::Algo::init();
m_type = "FormatUpdate";
}
std::shared_ptr<airtalgo::FormatUpdate> airtalgo::FormatUpdate::create() {
std::shared_ptr<airtalgo::FormatUpdate> tmp(new airtalgo::FormatUpdate());
std::shared_ptr<drain::FormatUpdate> drain::FormatUpdate::create() {
std::shared_ptr<drain::FormatUpdate> tmp(new drain::FormatUpdate());
tmp->init();
return tmp;
}
void airtalgo::FormatUpdate::configurationChange() {
airtalgo::Algo::configurationChange();
void drain::FormatUpdate::configurationChange() {
drain::Algo::configurationChange();
if (m_input.getMap() != m_output.getMap()) {
AIRTALGO_ERROR("can not support Map Change ...");
m_needProcess = false;
@ -243,12 +243,12 @@ void airtalgo::FormatUpdate::configurationChange() {
}
bool airtalgo::FormatUpdate::process(std::chrono::system_clock::time_point& _time,
bool drain::FormatUpdate::process(std::chrono::system_clock::time_point& _time,
void* _input,
size_t _inputNbChunk,
void*& _output,
size_t& _outputNbChunk) {
airtalgo::AutoLogInOut tmpLog("FormatUpdate");
drain::AutoLogInOut tmpLog("FormatUpdate");
// chack if we need to process:
if (m_needProcess == false) {
_output = _input;

View File

@ -6,9 +6,9 @@
#ifndef __AIRT_ALGO_FORMAT_UPDATE_H__
#define __AIRT_ALGO_FORMAT_UPDATE_H__
#include <airtalgo/Algo.h>
#include <drain/Algo.h>
namespace airtalgo {
namespace drain {
class FormatUpdate : public Algo {
protected:
/**

View File

@ -11,7 +11,7 @@
#define __class__ "IOFormatInterface"
std::ostream& airtalgo::operator <<(std::ostream& _os, const IOFormatInterface& _obj) {
std::ostream& drain::operator <<(std::ostream& _os, const IOFormatInterface& _obj) {
_os << "{";
if (_obj.getConfigured() == false) {
_os << "Not configured";
@ -24,7 +24,7 @@ std::ostream& airtalgo::operator <<(std::ostream& _os, const IOFormatInterface&
return _os;
}
airtalgo::IOFormatInterface::IOFormatInterface() :
drain::IOFormatInterface::IOFormatInterface() :
m_configured(false),
m_format(audio::format_unknow),
m_map(),
@ -33,7 +33,7 @@ airtalgo::IOFormatInterface::IOFormatInterface() :
m_map.push_back(audio::channel_frontRight);
}
airtalgo::IOFormatInterface::IOFormatInterface(std::vector<audio::channel> _map, audio::format _format, float _frequency) :
drain::IOFormatInterface::IOFormatInterface(std::vector<audio::channel> _map, audio::format _format, float _frequency) :
m_configured(true),
m_format(_format),
m_map(_map),
@ -41,7 +41,7 @@ airtalgo::IOFormatInterface::IOFormatInterface(std::vector<audio::channel> _map,
}
void airtalgo::IOFormatInterface::set(std::vector<audio::channel> _map, audio::format _format, float _frequency) {
void drain::IOFormatInterface::set(std::vector<audio::channel> _map, audio::format _format, float _frequency) {
bool hasChange = false;
if (m_map != _map) {
m_map = _map;
@ -61,19 +61,19 @@ void airtalgo::IOFormatInterface::set(std::vector<audio::channel> _map, audio::f
}
}
void airtalgo::IOFormatInterface::setConfigured(bool _value) {
void drain::IOFormatInterface::setConfigured(bool _value) {
m_configured = _value;
}
bool airtalgo::IOFormatInterface::getConfigured() const {
bool drain::IOFormatInterface::getConfigured() const {
return m_configured;
}
audio::format airtalgo::IOFormatInterface::getFormat() const {
audio::format drain::IOFormatInterface::getFormat() const {
return m_format;
}
void airtalgo::IOFormatInterface::setFormat(audio::format _value) {
void drain::IOFormatInterface::setFormat(audio::format _value) {
if (m_format == _value) {
return;
}
@ -82,11 +82,11 @@ void airtalgo::IOFormatInterface::setFormat(audio::format _value) {
configurationChange();
}
const std::vector<audio::channel>& airtalgo::IOFormatInterface::getMap() const{
const std::vector<audio::channel>& drain::IOFormatInterface::getMap() const{
return m_map;
}
void airtalgo::IOFormatInterface::setMap(const std::vector<audio::channel>& _value) {
void drain::IOFormatInterface::setMap(const std::vector<audio::channel>& _value) {
if (m_map == _value) {
return;
}
@ -95,11 +95,11 @@ void airtalgo::IOFormatInterface::setMap(const std::vector<audio::channel>& _val
configurationChange();
}
float airtalgo::IOFormatInterface::getFrequency() const{
float drain::IOFormatInterface::getFrequency() const{
return m_frequency;
}
void airtalgo::IOFormatInterface::setFrequency(float _value) {
void drain::IOFormatInterface::setFrequency(float _value) {
if (m_frequency == _value) {
return;
}
@ -108,12 +108,12 @@ void airtalgo::IOFormatInterface::setFrequency(float _value) {
configurationChange();
}
void airtalgo::IOFormatInterface::configurationChange() {
void drain::IOFormatInterface::configurationChange() {
if (m_ioChangeFunctor != nullptr) {
m_ioChangeFunctor();
}
}
void airtalgo::IOFormatInterface::setCallback(const std::function<void()>& _functor) {
void drain::IOFormatInterface::setCallback(const std::function<void()>& _functor) {
m_ioChangeFunctor = _functor;
}

View File

@ -19,7 +19,7 @@
#include "AutoLogInOut.h"
#include "debug.h"
namespace airtalgo{
namespace drain{
class IOFormatInterface {
public:
IOFormatInterface();

View File

@ -11,26 +11,26 @@
#include <stdint.h>
#include <audio/format.h>
#include <audio/channel.h>
#include <airtalgo/Process.h>
#include <airtalgo/ChannelReorder.h>
#include <airtalgo/FormatUpdate.h>
#include <airtalgo/Resampler.h>
#include <drain/Process.h>
#include <drain/ChannelReorder.h>
#include <drain/FormatUpdate.h>
#include <drain/Resampler.h>
#include <chrono>
#undef __class__
#define __class__ "Process"
airtalgo::Process::Process() :
drain::Process::Process() :
m_isConfigured(false) {
}
airtalgo::Process::~Process() {
drain::Process::~Process() {
for (auto &it : m_listAlgo) {
it.reset();
}
}
bool airtalgo::Process::push(std::chrono::system_clock::time_point& _time,
bool drain::Process::push(std::chrono::system_clock::time_point& _time,
void* _data,
size_t _nbChunk) {
void* out = nullptr;
@ -40,7 +40,7 @@ bool airtalgo::Process::push(std::chrono::system_clock::time_point& _time,
return true;
}
bool airtalgo::Process::pull(std::chrono::system_clock::time_point& _time,
bool drain::Process::pull(std::chrono::system_clock::time_point& _time,
void* _data,
size_t _nbChunk,
size_t _chunkSize) {
@ -89,7 +89,7 @@ bool airtalgo::Process::pull(std::chrono::system_clock::time_point& _time,
}
bool airtalgo::Process::process(std::chrono::system_clock::time_point& _time,
bool drain::Process::process(std::chrono::system_clock::time_point& _time,
void* _inData,
size_t _inNbChunk,
void*& _outData,
@ -111,12 +111,12 @@ bool airtalgo::Process::process(std::chrono::system_clock::time_point& _time,
return true;
}
void airtalgo::Process::pushBack(const std::shared_ptr<airtalgo::Algo>& _algo) {
void drain::Process::pushBack(const std::shared_ptr<drain::Algo>& _algo) {
removeAlgoDynamic();
m_listAlgo.push_back(_algo);
}
void airtalgo::Process::pushFront(const std::shared_ptr<airtalgo::Algo>& _algo) {
void drain::Process::pushFront(const std::shared_ptr<drain::Algo>& _algo) {
removeAlgoDynamic();
m_listAlgo.insert(m_listAlgo.begin(), _algo);
}
@ -156,7 +156,7 @@ template<typename T> std::vector<T> getUnion(const std::vector<T>& _out, const s
return out;
}
void airtalgo::Process::updateInterAlgo() {
void drain::Process::updateInterAlgo() {
if (m_isConfigured == true) {
// cahin is already configured
return ;
@ -202,14 +202,14 @@ void airtalgo::Process::updateInterAlgo() {
&& map.size() >= 1
&& format.size() >= 1) {
AIRTALGO_INFO(" find 1 compatibility :{format=" << format << ",frequency=" << freq << ",map=" << map << "}");
airtalgo::IOFormatInterface tmp(map[0], format[0], freq[0]);
drain::IOFormatInterface tmp(map[0], format[0], freq[0]);
m_listAlgo[iii-1]->setOutputFormat(tmp);
m_listAlgo[iii]->setInputFormat(tmp);
continue;
}
// create mapping to transform:
airtalgo::IOFormatInterface out;
airtalgo::IOFormatInterface in;
drain::IOFormatInterface out;
drain::IOFormatInterface in;
if (freq.size() > 0) {
out.setFrequency(freq[0]);
in.setFrequency(freq[0]);
@ -291,7 +291,7 @@ void airtalgo::Process::updateInterAlgo() {
if ( out.getFormat() != audio::format_int16
/* && out.getFormat() != format_float */) {
// need add a format Updater
std::shared_ptr<airtalgo::FormatUpdate> algo = airtalgo::FormatUpdate::create();
std::shared_ptr<drain::FormatUpdate> algo = drain::FormatUpdate::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setFormat(audio::format_int16);
@ -301,7 +301,7 @@ void airtalgo::Process::updateInterAlgo() {
iii++;
}
// need add a resampler
std::shared_ptr<airtalgo::Resampler> algo = airtalgo::Resampler::create();
std::shared_ptr<drain::Resampler> algo = drain::Resampler::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setFrequency(in.getFrequency());
@ -313,7 +313,7 @@ void airtalgo::Process::updateInterAlgo() {
}
if (out.getMap() != in.getMap()) {
// need add a channel Reorder
std::shared_ptr<airtalgo::ChannelReorder> algo = airtalgo::ChannelReorder::create();
std::shared_ptr<drain::ChannelReorder> algo = drain::ChannelReorder::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setMap(in.getMap());
@ -324,7 +324,7 @@ void airtalgo::Process::updateInterAlgo() {
}
if (out.getFormat() != in.getFormat()) {
// need add a format Updater
std::shared_ptr<airtalgo::FormatUpdate> algo = airtalgo::FormatUpdate::create();
std::shared_ptr<drain::FormatUpdate> algo = drain::FormatUpdate::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setFormat(in.getFormat());
@ -357,7 +357,7 @@ void airtalgo::Process::updateInterAlgo() {
//exit(-1);
}
void airtalgo::Process::removeAlgoDynamic() {
void drain::Process::removeAlgoDynamic() {
if (m_isConfigured == true) {
// chain is already unconfigured.
return;

View File

@ -13,11 +13,11 @@
#include <stdint.h>
#include <audio/format.h>
#include <audio/channel.h>
#include <airtalgo/Algo.h>
#include <drain/Algo.h>
#include <chrono>
#include <memory>
namespace airtalgo{
namespace drain{
class Process {
protected:
std::vector<int8_t> m_data; //!< temporary overlap output buffer (change size of the output data)
@ -65,10 +65,10 @@ namespace airtalgo{
void*& _outData,
size_t& _outNbChunk);
protected:
std::vector<std::shared_ptr<airtalgo::Algo> > m_listAlgo;
std::vector<std::shared_ptr<drain::Algo> > m_listAlgo;
public:
void pushBack(const std::shared_ptr<airtalgo::Algo>& _algo);
void pushFront(const std::shared_ptr<airtalgo::Algo>& _algo);
void pushBack(const std::shared_ptr<drain::Algo>& _algo);
void pushFront(const std::shared_ptr<drain::Algo>& _algo);
void clear() {
m_isConfigured = false;
m_listAlgo.clear();

View File

@ -5,13 +5,13 @@
*/
#include "debug.h"
#include <airtalgo/Resampler.h>
#include <drain/Resampler.h>
#include <iostream>
#undef __class__
#define __class__ "Resampler"
airtalgo::Resampler::Resampler() :
drain::Resampler::Resampler() :
#ifdef HAVE_SPEEX_DSP_RESAMPLE
m_speexResampler(nullptr),
#endif
@ -20,19 +20,19 @@ airtalgo::Resampler::Resampler() :
}
void airtalgo::Resampler::init() {
airtalgo::Algo::init();
void drain::Resampler::init() {
drain::Algo::init();
m_type = "Resampler";
m_supportedFormat.push_back(audio::format_int16);
}
std::shared_ptr<airtalgo::Resampler> airtalgo::Resampler::create() {
std::shared_ptr<airtalgo::Resampler> tmp(new airtalgo::Resampler());
std::shared_ptr<drain::Resampler> drain::Resampler::create() {
std::shared_ptr<drain::Resampler> tmp(new drain::Resampler());
tmp->init();
return tmp;
}
airtalgo::Resampler::~Resampler() {
drain::Resampler::~Resampler() {
#ifdef HAVE_SPEEX_DSP_RESAMPLE
if (m_speexResampler != nullptr) {
speex_resampler_destroy(m_speexResampler);
@ -41,8 +41,8 @@ airtalgo::Resampler::~Resampler() {
#endif
}
void airtalgo::Resampler::configurationChange() {
airtalgo::Algo::configurationChange();
void drain::Resampler::configurationChange() {
drain::Algo::configurationChange();
if (m_input.getFormat() != m_output.getFormat()) {
AIRTALGO_ERROR("can not support Format Change ...");
m_needProcess = false;
@ -78,12 +78,12 @@ void airtalgo::Resampler::configurationChange() {
}
bool airtalgo::Resampler::process(std::chrono::system_clock::time_point& _time,
bool drain::Resampler::process(std::chrono::system_clock::time_point& _time,
void* _input,
size_t _inputNbChunk,
void*& _output,
size_t& _outputNbChunk) {
airtalgo::AutoLogInOut tmpLog("Resampler");
drain::AutoLogInOut tmpLog("Resampler");
_outputNbChunk = 2048;
// chack if we need to process:
if (m_needProcess == false) {

View File

@ -7,13 +7,13 @@
#ifndef __AIRT_ALGO_RESAMPLER_H__
#define __AIRT_ALGO_RESAMPLER_H__
#include <airtalgo/Algo.h>
#include <drain/Algo.h>
#ifdef HAVE_SPEEX_DSP_RESAMPLE
#include <speex/speex_resampler.h>
#endif
#include <memory>
namespace airtalgo {
namespace drain {
class Resampler : public Algo {
private:
#ifdef HAVE_SPEEX_DSP_RESAMPLE

View File

@ -5,32 +5,32 @@
*/
#include "debug.h"
#include <airtalgo/Volume.h>
#include <drain/Volume.h>
#include <iostream>
#undef __class__
#define __class__ "Volume"
airtalgo::Volume::Volume() :
drain::Volume::Volume() :
m_volumeAppli(1.0f),
m_functionConvert(nullptr) {
}
void airtalgo::Volume::init() {
airtalgo::Algo::init();
void drain::Volume::init() {
drain::Algo::init();
m_type = "Volume";
m_supportedFormat.push_back(audio::format_int16);
m_supportedFormat.push_back(audio::format_int16_on_int32);
}
std::shared_ptr<airtalgo::Volume> airtalgo::Volume::create() {
std::shared_ptr<airtalgo::Volume> tmp(new airtalgo::Volume());
std::shared_ptr<drain::Volume> drain::Volume::create() {
std::shared_ptr<drain::Volume> tmp(new drain::Volume());
tmp->init();
return tmp;
}
airtalgo::Volume::~Volume() {
drain::Volume::~Volume() {
}
@ -86,8 +86,8 @@ static void convert__float__to__float(void* _input, void* _output, size_t _nbSam
}
}
void airtalgo::Volume::configurationChange() {
airtalgo::Algo::configurationChange();
void drain::Volume::configurationChange() {
drain::Algo::configurationChange();
switch (m_input.getFormat()) {
default:
case audio::format_int16:
@ -151,7 +151,7 @@ void airtalgo::Volume::configurationChange() {
volumeChange();
}
void airtalgo::Volume::volumeChange() {
void drain::Volume::volumeChange() {
//m_volumeAppli = 20 * log(m_volumedB);
float volumedB = 0.0f;
for (auto &it : m_volumeList) {
@ -268,7 +268,7 @@ void airtalgo::Volume::volumeChange() {
}
std::vector<audio::format> airtalgo::Volume::getFormatSupportedInput() {
std::vector<audio::format> drain::Volume::getFormatSupportedInput() {
std::vector<audio::format> tmp;
if (m_output.getFormat() == audio::format_float) {
tmp.push_back(audio::format_float);
@ -283,7 +283,7 @@ std::vector<audio::format> airtalgo::Volume::getFormatSupportedInput() {
return tmp;
};
std::vector<audio::format> airtalgo::Volume::getFormatSupportedOutput() {
std::vector<audio::format> drain::Volume::getFormatSupportedOutput() {
std::vector<audio::format> tmp;
if (m_input.getFormat() == audio::format_float) {
tmp.push_back(audio::format_float);
@ -299,12 +299,12 @@ std::vector<audio::format> airtalgo::Volume::getFormatSupportedOutput() {
};
bool airtalgo::Volume::process(std::chrono::system_clock::time_point& _time,
bool drain::Volume::process(std::chrono::system_clock::time_point& _time,
void* _input,
size_t _inputNbChunk,
void*& _output,
size_t& _outputNbChunk) {
airtalgo::AutoLogInOut tmpLog("Volume");
drain::AutoLogInOut tmpLog("Volume");
// chack if we need to process:
if (m_needProcess == false) {
_output = _input;
@ -329,7 +329,7 @@ bool airtalgo::Volume::process(std::chrono::system_clock::time_point& _time,
return true;
}
void airtalgo::Volume::addVolumeStage(const std::shared_ptr<VolumeElement>& _volume) {
void drain::Volume::addVolumeStage(const std::shared_ptr<VolumeElement>& _volume) {
if (_volume == nullptr) {
return;
}
@ -349,7 +349,7 @@ void airtalgo::Volume::addVolumeStage(const std::shared_ptr<VolumeElement>& _vol
volumeChange();
}
bool airtalgo::Volume::setParameter(const std::string& _parameter, const std::string& _value) {
bool drain::Volume::setParameter(const std::string& _parameter, const std::string& _value) {
if (_parameter == "FLOW") {
// set Volume ...
for (auto &it : m_volumeList) {
@ -377,7 +377,7 @@ bool airtalgo::Volume::setParameter(const std::string& _parameter, const std::st
return false;
}
std::string airtalgo::Volume::getParameter(const std::string& _parameter) const {
std::string drain::Volume::getParameter(const std::string& _parameter) const {
if (_parameter == "FLOW") {
// set Volume ...
for (auto &it : m_volumeList) {
@ -393,7 +393,7 @@ std::string airtalgo::Volume::getParameter(const std::string& _parameter) const
return "[ERROR]";
}
std::string airtalgo::Volume::getParameterProperty(const std::string& _parameter) const {
std::string drain::Volume::getParameterProperty(const std::string& _parameter) const {
if (_parameter == "FLOW") {
// set Volume ...
for (auto &it : m_volumeList) {

View File

@ -7,13 +7,13 @@
#ifndef __AIRT_ALGO_VOLUME_H__
#define __AIRT_ALGO_VOLUME_H__
#include <airtalgo/Algo.h>
#include <drain/Algo.h>
#ifdef HAVE_SPEEX_DSP_RESAMPLE
#include <speex/speex_resampler.h>
#endif
#include <memory>
namespace airtalgo {
namespace drain {
// data structure.
class VolumeElement {
public:
@ -45,7 +45,7 @@ namespace airtalgo {
// TODO: Manage set volume
class Volume : public Algo {
private:
std::vector<std::shared_ptr<airtalgo::VolumeElement>> m_volumeList;
std::vector<std::shared_ptr<drain::VolumeElement>> m_volumeList;
// for float input :
float m_volumeAppli;
// for integer input :
@ -77,7 +77,7 @@ namespace airtalgo {
virtual std::vector<audio::format> getFormatSupportedInput();
virtual std::vector<audio::format> getFormatSupportedOutput();
public:
virtual void addVolumeStage(const std::shared_ptr<airtalgo::VolumeElement>& _volume);
virtual void addVolumeStage(const std::shared_ptr<drain::VolumeElement>& _volume);
virtual bool setParameter(const std::string& _parameter, const std::string& _value);
virtual std::string getParameter(const std::string& _parameter) const;
virtual std::string getParameterProperty(const std::string& _parameter) const;

View File

@ -9,10 +9,10 @@
#include <string>
#include <audio/format.h>
#include <airtalgo/channel.h>
#include <drain/channel.h>
#include <chrono>
namespace airtalgo {
namespace drain {
/**
* @brief Init the instance af algorithm (add all internal factory)
*/
@ -26,13 +26,13 @@ namespace airtalgo {
* @param[in] _name Name of the Algorithm.
* @return Instanciate algorithm
*/
airtalgo::Algo* createAlgo(const std::string& _name);
drain::Algo* createAlgo(const std::string& _name);
/**
* @brief Add a Factory Algorithm in the internal List (static for all instance)
* @param[in] _name Name of the Algorithm.
* @param[in] _functor Function of the factory
*/
void addAlgoFactory(const std::string& _name, std::function<airtalgo::Algo*(void)> _functor);
void addAlgoFactory(const std::string& _name, std::function<drain::Algo*(void)> _functor);
/**
* @brief Remove a Factory Algorithm in the internal List (static for all instance)
* @param[in] _name Name of the Algorithm.

View File

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

View File

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

View File

@ -1,45 +0,0 @@
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
import lutinDebug as debug
def get_desc():
return "airtalgo : Basic algo interface"
def create(target):
myModule = module.Module(__file__, 'airtalgo', 'LIBRARY')
myModule.add_src_file([
'airtalgo/debug.cpp',
'airtalgo/airtalgo.cpp',
'airtalgo/Algo.cpp',
'airtalgo/ChannelReorder.cpp',
'airtalgo/EndPointCallback.cpp',
'airtalgo/EndPoint.cpp',
'airtalgo/EndPointRead.cpp',
'airtalgo/EndPointWrite.cpp',
'airtalgo/FormatUpdate.cpp',
'airtalgo/Process.cpp',
'airtalgo/Resampler.cpp',
'airtalgo/Volume.cpp',
'airtalgo/IOFormatInterface.cpp',
'airtalgo/AutoLogInOut.cpp'
])
# TODO: myModule.add_optional_module_depend('speexdsp', "HAVE_SPEEX_DSP_RESAMPLE")
myModule.compile_flags_CC("-DHAVE_SPEEX_DSP_RESAMPLE")
myModule.add_module_depend(['etk', 'audio', 'speexdsp'])
myModule.add_export_path(tools.get_current_path(__file__))
# add the currrent module at the
return myModule

45
lutin_drain.py Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
import lutinDebug as debug
def get_desc():
return "drain : Basic audio algo interface single pipe to provess data"
def create(target):
myModule = module.Module(__file__, 'drain', 'LIBRARY')
myModule.add_src_file([
'drain/debug.cpp',
'drain/airtalgo.cpp',
'drain/Algo.cpp',
'drain/ChannelReorder.cpp',
'drain/EndPointCallback.cpp',
'drain/EndPoint.cpp',
'drain/EndPointRead.cpp',
'drain/EndPointWrite.cpp',
'drain/FormatUpdate.cpp',
'drain/Process.cpp',
'drain/Resampler.cpp',
'drain/Volume.cpp',
'drain/IOFormatInterface.cpp',
'drain/AutoLogInOut.cpp'
])
# TODO: myModule.add_optional_module_depend('speexdsp', "HAVE_SPEEX_DSP_RESAMPLE")
myModule.compile_flags_CC("-DHAVE_SPEEX_DSP_RESAMPLE")
myModule.add_module_depend(['etk', 'audio', 'speexdsp'])
myModule.add_export_path(tools.get_current_path(__file__))
# add the currrent module at the
return myModule