[DEV] update gitignore & chaneg log base

This commit is contained in:
Edouard DUPIN 2015-02-05 21:33:12 +01:00
parent ff6c33d566
commit 4fe4ac40bf
11 changed files with 146 additions and 146 deletions

View File

@ -16,7 +16,7 @@ drain::Algo::Algo() :
m_outputData(),
m_formatSize(0),
m_needProcess(false) {
AIRTALGO_VERBOSE("CREATE ALGO");
DRAIN_VERBOSE("CREATE ALGO");
}
void drain::Algo::init() {
@ -57,7 +57,7 @@ void drain::Algo::configurationChange() {
m_formatSize = sizeof(double);
break;
case audio::format_unknow:
AIRTALGO_ERROR("format not configured...");
DRAIN_ERROR("format not configured...");
m_formatSize = 8;
break;
}

View File

@ -9,9 +9,9 @@
drain::AutoLogInOut::AutoLogInOut(const std::string& _value) :
m_value(_value) {
AIRTALGO_VERBOSE(" '" << m_value << "' [START]");
DRAIN_VERBOSE(" '" << m_value << "' [START]");
}
drain::AutoLogInOut::~AutoLogInOut() {
AIRTALGO_VERBOSE(" '" << m_value << "' [STOP]");
DRAIN_VERBOSE(" '" << m_value << "' [STOP]");
}

View File

@ -33,17 +33,17 @@ 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 ...");
DRAIN_ERROR("can not support Format Change ...");
m_needProcess = false;
}
if (m_input.getFrequency() != m_output.getFrequency()) {
AIRTALGO_ERROR("can not support frequency Change ...");
DRAIN_ERROR("can not support frequency Change ...");
m_needProcess = false;
}
if (m_input.getMap() == m_output.getMap()) {
// nothing to process...
m_needProcess = false;
AIRTALGO_INFO(" no need to convert ... " << m_input.getMap() << " ==> " << m_output.getMap());
DRAIN_INFO(" no need to convert ... " << m_input.getMap() << " ==> " << m_output.getMap());
return;
}
}
@ -64,7 +64,7 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
if (_input == nullptr) {
_output = &(m_outputData[0]);
_outputNbChunk = 0;
AIRTALGO_ERROR("null pointer input ... ");
DRAIN_ERROR("null pointer input ... ");
return false;
}
m_outputData.resize(_outputNbChunk*m_output.getMap().size()*m_formatSize);
@ -73,7 +73,7 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
switch (m_output.getFormat()) {
case audio::format_int8:
{
AIRTALGO_VERBOSE("convert " << m_input.getMap() << " ==> " << m_output.getMap() << " format=" << int32_t(m_formatSize));
DRAIN_VERBOSE("convert " << m_input.getMap() << " ==> " << m_output.getMap() << " format=" << int32_t(m_formatSize));
int8_t* in = static_cast<int8_t*>(_input);
int8_t* out = static_cast<int8_t*>(_output);
for (size_t kkk=0; kkk<m_output.getMap().size(); ++kkk) {
@ -89,7 +89,7 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
}
}
}
AIRTALGO_VERBOSE(" " << convertId << " ==> " << kkk);
DRAIN_VERBOSE(" " << convertId << " ==> " << kkk);
if (convertId == -1) {
for (size_t iii=0; iii<_outputNbChunk; ++iii) {
out[iii*m_output.getMap().size()+kkk] = 0;
@ -105,7 +105,7 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
default:
case audio::format_int16:
{
AIRTALGO_VERBOSE("convert " << m_input.getMap() << " ==> " << m_output.getMap() << " format=" << int32_t(m_formatSize));
DRAIN_VERBOSE("convert " << m_input.getMap() << " ==> " << m_output.getMap() << " format=" << int32_t(m_formatSize));
int16_t* in = static_cast<int16_t*>(_input);
int16_t* out = static_cast<int16_t*>(_output);
for (size_t kkk=0; kkk<m_output.getMap().size(); ++kkk) {
@ -121,7 +121,7 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
}
}
}
AIRTALGO_VERBOSE(" " << convertId << " ==> " << kkk);
DRAIN_VERBOSE(" " << convertId << " ==> " << kkk);
if (convertId == -1) {
for (size_t iii=0; iii<_outputNbChunk; ++iii) {
out[iii*m_output.getMap().size()+kkk] = 0;
@ -139,7 +139,7 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
case audio::format_int32:
case audio::format_float:
{
AIRTALGO_VERBOSE("convert (2) " << m_input.getMap() << " ==> " << m_output.getMap());
DRAIN_VERBOSE("convert (2) " << m_input.getMap() << " ==> " << m_output.getMap());
uint32_t* in = static_cast<uint32_t*>(_input);
uint32_t* out = static_cast<uint32_t*>(_output);
for (size_t kkk=0; kkk<m_output.getMap().size(); ++kkk) {
@ -169,7 +169,7 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
break;
case audio::format_double:
{
AIRTALGO_VERBOSE("convert (2) " << m_input.getMap() << " ==> " << m_output.getMap());
DRAIN_VERBOSE("convert (2) " << m_input.getMap() << " ==> " << m_output.getMap());
uint64_t* in = static_cast<uint64_t*>(_input);
uint64_t* out = static_cast<uint64_t*>(_output);
for (size_t kkk=0; kkk<m_output.getMap().size(); ++kkk) {

View File

@ -41,7 +41,7 @@ std::shared_ptr<drain::EndPointCallback> drain::EndPointCallback::create(haveNew
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));
DRAIN_INFO("update : format=" << m_output.getFormat() << " map=" << m_input.getMap() << " freq=" << m_input.getFrequency() << " size=" << int32_t(m_formatSize));
m_needProcess = true;
}
@ -56,14 +56,14 @@ bool drain::EndPointCallback::process(std::chrono::system_clock::time_point& _ti
// update buffer size ...
m_outputData.resize(_inputNbChunk*m_output.getMap().size()*m_formatSize);
// call user
AIRTALGO_VERBOSE("call user get " << _inputNbChunk << "*" << m_output.getMap().size() << " map=" << m_output.getMap() << " datasize=" << int32_t(m_formatSize));
DRAIN_VERBOSE("call user get " << _inputNbChunk << "*" << m_output.getMap().size() << " map=" << m_output.getMap() << " datasize=" << int32_t(m_formatSize));
m_outputFunction(_time,
_inputNbChunk,
m_output.getMap(),
&m_outputData[0],
m_output.getFormat());
if (m_outputData.size() != _inputNbChunk*m_output.getMap().size()*m_formatSize) {
AIRTALGO_ERROR(" can not get enough data from user ... " << m_outputData.size() << " != " << _inputNbChunk*m_output.getMap().size());
DRAIN_ERROR(" can not get enough data from user ... " << m_outputData.size() << " != " << _inputNbChunk*m_output.getMap().size());
return false;
}
_output = &m_outputData[0];
@ -72,7 +72,7 @@ bool drain::EndPointCallback::process(std::chrono::system_clock::time_point& _ti
}
if (m_inputFunction != nullptr) {
// Call user ...
AIRTALGO_VERBOSE("call user set " << _inputNbChunk << "*" << m_input.getMap().size());
DRAIN_VERBOSE("call user set " << _inputNbChunk << "*" << m_input.getMap().size());
m_inputFunction(_time,
_inputNbChunk,
m_input.getMap(),

View File

@ -38,14 +38,14 @@ bool drain::EndPointWrite::process(std::chrono::system_clock::time_point& _time,
void*& _output,
size_t& _outputNbChunk){
drain::AutoLogInOut tmpLog("EndPointWrite");
//AIRTALGO_INFO(" nb Sample in buffer : " << m_tmpData.size());
//DRAIN_INFO(" nb Sample in buffer : " << m_tmpData.size());
if (m_function != nullptr) {
if (m_tmpData.size() <= 20000) {
m_function(_time, _inputNbChunk, m_output.getMap(), m_output.getFormat());
}
}
// resize output buffer:
//AIRTALGO_INFO(" resize : " << (int32_t)m_formatSize << "*" << (int32_t)_inputNbChunk << "*" << (int32_t)m_outputMap.size());
//DRAIN_INFO(" resize : " << (int32_t)m_formatSize << "*" << (int32_t)_inputNbChunk << "*" << (int32_t)m_outputMap.size());
m_outputData.resize(m_formatSize*_inputNbChunk*m_output.getMap().size(), 0);
// set output pointer:
_outputNbChunk = m_outputData.size()/(m_formatSize*m_output.getMap().size());
@ -53,26 +53,26 @@ bool drain::EndPointWrite::process(std::chrono::system_clock::time_point& _time,
std::unique_lock<std::mutex> lock(m_mutex);
// check if data in the tmpBuffer
if (m_tmpData.size() == 0) {
AIRTALGO_WARNING("No data in the user buffer (write null data ... " << _outputNbChunk << " chunks)");
DRAIN_WARNING("No data in the user buffer (write null data ... " << _outputNbChunk << " chunks)");
// just send no data ...
return true;
}
AIRTALGO_INFO("Write " << _outputNbChunk << " chunks");
DRAIN_INFO("Write " << _outputNbChunk << " chunks");
// check if we have enought data:
int32_t nbChunkToCopy = std::min(_inputNbChunk, m_tmpData.size()/(m_output.getMap().size()*m_formatSize));
AIRTALGO_INFO(" " << nbChunkToCopy << " chunks ==> " << nbChunkToCopy*m_output.getMap().size()*m_formatSize << " Byte sizeBuffer=" << m_tmpData.size());
DRAIN_INFO(" " << nbChunkToCopy << " chunks ==> " << nbChunkToCopy*m_output.getMap().size()*m_formatSize << " Byte sizeBuffer=" << m_tmpData.size());
// copy data to the output:
memcpy(_output, &m_tmpData[0], nbChunkToCopy*m_output.getMap().size()*m_formatSize);
// remove old data:
m_tmpData.erase(m_tmpData.begin(), m_tmpData.begin() + nbChunkToCopy*m_output.getMap().size()*m_formatSize);
//AIRTALGO_INFO(" nb Sample in buffer : " << m_tmpData.size());
//DRAIN_INFO(" nb Sample in buffer : " << m_tmpData.size());
return true;
}
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"
DRAIN_INFO("[ASYNC] Write data : " << _nbChunk << " chunks"
<< " ==> " << _nbChunk*m_output.getMap().size() << " samples"
<< " formatSize=" << int32_t(m_formatSize)
<< " bufferSize=" << m_tmpData.size());

View File

@ -103,7 +103,7 @@ static void convert__float__to__int16(void* _input, void* _output, size_t _nbSam
float value = in[iii] * static_cast<float>(INT16_MAX);
value = std::min(std::max(static_cast<float>(INT16_MIN), value), static_cast<float>(INT16_MAX));
out[iii] = static_cast<int16_t>(value);
//AIRTALGO_DEBUG(iii << " in=" << in[iii] << " out=" << out[iii]);
//DRAIN_DEBUG(iii << " in=" << in[iii] << " out=" << out[iii]);
}
}
static void convert__float__to__int16_on_int32(void* _input, void* _output, size_t _nbSample) {
@ -145,11 +145,11 @@ std::shared_ptr<drain::FormatUpdate> drain::FormatUpdate::create() {
void drain::FormatUpdate::configurationChange() {
drain::Algo::configurationChange();
if (m_input.getMap() != m_output.getMap()) {
AIRTALGO_ERROR("can not support Map Change ...");
DRAIN_ERROR("can not support Map Change ...");
m_needProcess = false;
}
if (m_input.getFrequency() != m_output.getFrequency()) {
AIRTALGO_ERROR("can not support frequency Change ...");
DRAIN_ERROR("can not support frequency Change ...");
m_needProcess = false;
}
if (m_input.getFormat() == m_output.getFormat()) {
@ -163,19 +163,19 @@ void drain::FormatUpdate::configurationChange() {
switch (m_output.getFormat()) {
default:
case audio::format_int16:
AIRTALGO_ERROR(" Impossible case 1");
DRAIN_ERROR(" Impossible case 1");
break;
case audio::format_int16_on_int32:
m_functionConvert = &convert__int16__to__int16_on_int32;
AIRTALGO_DEBUG(" use converter : 'convert__int16__to__int16_on_int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int16__to__int16_on_int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int32:
m_functionConvert = &convert__int16__to__int32;
AIRTALGO_DEBUG(" use converter : 'convert__int16__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int16__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_float:
m_functionConvert = &convert__int16__to__float;
AIRTALGO_DEBUG(" use converter : 'convert__int16__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int16__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
}
break;
@ -184,18 +184,18 @@ void drain::FormatUpdate::configurationChange() {
default:
case audio::format_int16:
m_functionConvert = &convert__int16_on_int32__to__int16;
AIRTALGO_DEBUG(" use converter : 'convert__int16_on_int32__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int16_on_int32__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int16_on_int32:
AIRTALGO_ERROR(" Impossible case 2");
DRAIN_ERROR(" Impossible case 2");
break;
case audio::format_int32:
m_functionConvert = &convert__int16_on_int32__to__int32;
AIRTALGO_DEBUG(" use converter : 'convert__int16_on_int32__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int16_on_int32__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_float:
m_functionConvert = &convert__int16_on_int32__to__float;
AIRTALGO_DEBUG(" use converter : 'convert__int16_on_int32__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int16_on_int32__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
}
break;
@ -204,18 +204,18 @@ void drain::FormatUpdate::configurationChange() {
default:
case audio::format_int16:
m_functionConvert = &convert__int32__to__int16;
AIRTALGO_DEBUG(" use converter : 'convert__int32__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int32__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int16_on_int32:
m_functionConvert = &convert__int32__to__int16_on_int32;
AIRTALGO_DEBUG(" use converter : 'convert__int32__to__int16_on_int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int32__to__int16_on_int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int32:
AIRTALGO_ERROR(" Impossible case 3");
DRAIN_ERROR(" Impossible case 3");
break;
case audio::format_float:
m_functionConvert = &convert__int32__to__float;
AIRTALGO_DEBUG(" use converter : 'convert__int32__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__int32__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
}
break;
@ -224,18 +224,18 @@ void drain::FormatUpdate::configurationChange() {
default:
case audio::format_int16:
m_functionConvert = &convert__float__to__int16;
AIRTALGO_DEBUG(" use converter : 'convert__float__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__float__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int16_on_int32:
m_functionConvert = &convert__float__to__int16_on_int32;
AIRTALGO_DEBUG(" use converter : 'convert__float__to__int16_on_int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__float__to__int16_on_int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int32:
m_functionConvert = &convert__float__to__int32;
AIRTALGO_DEBUG(" use converter : 'convert__float__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG(" use converter : 'convert__float__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_float:
AIRTALGO_ERROR(" Impossible case 4");
DRAIN_ERROR(" Impossible case 4");
break;
}
break;
@ -258,14 +258,14 @@ bool drain::FormatUpdate::process(std::chrono::system_clock::time_point& _time,
if (_input == nullptr) {
_output = &(m_outputData[0]);
_outputNbChunk = 0;
AIRTALGO_ERROR("null pointer input ... ");
DRAIN_ERROR("null pointer input ... ");
return false;
}
_outputNbChunk = _inputNbChunk;
m_outputData.resize(_outputNbChunk*m_input.getMap().size()*m_formatSize);
_output = &(m_outputData[0]);
if (m_functionConvert == nullptr) {
AIRTALGO_ERROR("null function ptr");
DRAIN_ERROR("null function ptr");
return false;
}
m_functionConvert(_input, _output, _outputNbChunk*m_input.getMap().size());

View File

@ -35,7 +35,7 @@ bool drain::Process::push(std::chrono::system_clock::time_point& _time,
size_t _nbChunk) {
void* out = nullptr;
size_t nbChunkOut;
AIRTALGO_VERBOSE(" Process push");
DRAIN_VERBOSE(" Process push");
process(_time, _data, _nbChunk, out, nbChunkOut);
return true;
}
@ -99,7 +99,7 @@ bool drain::Process::process(std::chrono::system_clock::time_point& _time,
_outNbChunk = _inNbChunk;
return true;
}
AIRTALGO_VERBOSE(" process : " << m_listAlgo.size() << " algos nbChunk=" << _outNbChunk);
DRAIN_VERBOSE(" process : " << m_listAlgo.size() << " algos nbChunk=" << _outNbChunk);
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
//std::cout << " Algo " << iii+1 << "/" << m_listAlgo.size() << std::endl;
if (m_listAlgo[iii] != nullptr) {
@ -161,27 +161,27 @@ void drain::Process::updateInterAlgo() {
// cahin is already configured
return ;
}
AIRTALGO_INFO(" display properties : nbAlgo : " << m_listAlgo.size());
DRAIN_INFO(" display properties : nbAlgo : " << m_listAlgo.size());
for (auto &it : m_listAlgo) {
AIRTALGO_INFO(" [" << it->getType() << "] '" << it->getName() << "'");
DRAIN_INFO(" [" << it->getType() << "] '" << it->getName() << "'");
if (it->getInputFormat().getConfigured() == true) {
AIRTALGO_INFO(" Input : " << it->getInputFormat());
DRAIN_INFO(" Input : " << it->getInputFormat());
} else {
AIRTALGO_INFO(" Input : Not configured");
AIRTALGO_INFO(" format : " << it->getFormatSupportedInput());
AIRTALGO_INFO(" frequency : " << it->getFrequencySupportedInput());
AIRTALGO_INFO(" map : " << it->getMapSupportedInput());
DRAIN_INFO(" Input : Not configured");
DRAIN_INFO(" format : " << it->getFormatSupportedInput());
DRAIN_INFO(" frequency : " << it->getFrequencySupportedInput());
DRAIN_INFO(" map : " << it->getMapSupportedInput());
}
if (it->getOutputFormat().getConfigured() == true) {
AIRTALGO_INFO(" Output: " << it->getOutputFormat());
DRAIN_INFO(" Output: " << it->getOutputFormat());
} else {
AIRTALGO_INFO(" Output : Not configured");
AIRTALGO_INFO(" format : " << it->getFormatSupportedOutput());
AIRTALGO_INFO(" frequency : " << it->getFrequencySupportedOutput());
AIRTALGO_INFO(" map : " << it->getMapSupportedOutput());
DRAIN_INFO(" Output : Not configured");
DRAIN_INFO(" format : " << it->getFormatSupportedOutput());
DRAIN_INFO(" frequency : " << it->getFrequencySupportedOutput());
DRAIN_INFO(" map : " << it->getMapSupportedOutput());
}
}
AIRTALGO_INFO("********* configuration START *************");
DRAIN_INFO("********* configuration START *************");
for (size_t iii=1; iii<m_listAlgo.size(); ++iii) {
if ( m_listAlgo[iii-1]->getOutputFormat().getConfigured() == false
&& m_listAlgo[iii]->getInputFormat().getConfigured() == false) {
@ -201,7 +201,7 @@ void drain::Process::updateInterAlgo() {
if ( freq.size() >= 1
&& map.size() >= 1
&& format.size() >= 1) {
AIRTALGO_INFO(" find 1 compatibility :{format=" << format << ",frequency=" << freq << ",map=" << map << "}");
DRAIN_INFO(" find 1 compatibility :{format=" << format << ",frequency=" << freq << ",map=" << map << "}");
drain::IOFormatInterface tmp(map[0], format[0], freq[0]);
m_listAlgo[iii-1]->setOutputFormat(tmp);
m_listAlgo[iii]->setInputFormat(tmp);
@ -276,12 +276,12 @@ void drain::Process::updateInterAlgo() {
}
}
}
AIRTALGO_INFO(" union:");
AIRTALGO_INFO(" format : " << format);
AIRTALGO_INFO(" frequency : " << freq);
AIRTALGO_INFO(" map : " << map);
AIRTALGO_INFO(" update: out=" << out);
AIRTALGO_INFO(" in=" << in);
DRAIN_INFO(" union:");
DRAIN_INFO(" format : " << format);
DRAIN_INFO(" frequency : " << freq);
DRAIN_INFO(" map : " << map);
DRAIN_INFO(" update: out=" << out);
DRAIN_INFO(" in=" << in);
m_listAlgo[iii-1]->setOutputFormat(out);
m_listAlgo[iii]->setInputFormat(in);
// TODO : Add updater with an optimisation of CPU
@ -297,7 +297,7 @@ void drain::Process::updateInterAlgo() {
out.setFormat(audio::format_int16);
algo->setOutputFormat(out);
m_listAlgo.insert(m_listAlgo.begin()+iii, algo);
AIRTALGO_INFO("convert " << out.getFormat() << " -> " << in.getFormat());
DRAIN_INFO("convert " << out.getFormat() << " -> " << in.getFormat());
iii++;
}
// need add a resampler
@ -307,7 +307,7 @@ void drain::Process::updateInterAlgo() {
out.setFrequency(in.getFrequency());
algo->setOutputFormat(out);
m_listAlgo.insert(m_listAlgo.begin()+iii, algo);
AIRTALGO_INFO("convert " << out.getFrequency() << " -> " << in.getFrequency());
DRAIN_INFO("convert " << out.getFrequency() << " -> " << in.getFrequency());
out.setFrequency(in.getFrequency());
iii++;
}
@ -319,7 +319,7 @@ void drain::Process::updateInterAlgo() {
out.setMap(in.getMap());
algo->setOutputFormat(out);
m_listAlgo.insert(m_listAlgo.begin()+iii, algo);
AIRTALGO_INFO("convert " << out.getMap() << " -> " << in.getMap());
DRAIN_INFO("convert " << out.getMap() << " -> " << in.getMap());
iii++;
}
if (out.getFormat() != in.getFormat()) {
@ -330,27 +330,27 @@ void drain::Process::updateInterAlgo() {
out.setFormat(in.getFormat());
algo->setOutputFormat(out);
m_listAlgo.insert(m_listAlgo.begin()+iii, algo);
AIRTALGO_INFO("convert " << out.getFormat() << " -> " << in.getFormat());
DRAIN_INFO("convert " << out.getFormat() << " -> " << in.getFormat());
iii++;
}
} else if ( m_listAlgo[iii-1]->getOutputFormat().getConfigured() == false
|| m_listAlgo[iii]->getInputFormat().getConfigured() == false) {
AIRTALGO_ERROR(" configuration error mode in " << iii-1 << " && " << iii );
DRAIN_ERROR(" configuration error mode in " << iii-1 << " && " << iii );
}
}
AIRTALGO_INFO("********* configuration will be done *************");
DRAIN_INFO("********* configuration will be done *************");
for (auto &it : m_listAlgo) {
AIRTALGO_INFO(" [" << it->getType() << "] '" << it->getName() << "'");
DRAIN_INFO(" [" << it->getType() << "] '" << it->getName() << "'");
if (it->getInputFormat().getConfigured() == true) {
AIRTALGO_INFO(" Input : " << it->getInputFormat());
DRAIN_INFO(" Input : " << it->getInputFormat());
} else {
AIRTALGO_ERROR(" Input : Not configured");
DRAIN_ERROR(" Input : Not configured");
}
if (it->getOutputFormat().getConfigured() == true) {
AIRTALGO_INFO(" Output: " << it->getOutputFormat());
DRAIN_INFO(" Output: " << it->getOutputFormat());
} else {
AIRTALGO_ERROR(" Output : Not configured");
DRAIN_ERROR(" Output : Not configured");
}
}
m_isConfigured = true;

View File

@ -44,16 +44,16 @@ drain::Resampler::~Resampler() {
void drain::Resampler::configurationChange() {
drain::Algo::configurationChange();
if (m_input.getFormat() != m_output.getFormat()) {
AIRTALGO_ERROR("can not support Format Change ...");
DRAIN_ERROR("can not support Format Change ...");
m_needProcess = false;
}
if (m_input.getFormat() != audio::format_int16) {
AIRTALGO_ERROR("can not support Format other than int16_t ...");
DRAIN_ERROR("can not support Format other than int16_t ...");
m_needProcess = false;
return;
}
if (m_output.getMap() != m_output.getMap()) {
AIRTALGO_ERROR("can not support map Change ...");
DRAIN_ERROR("can not support map Change ...");
m_needProcess = false;
}
if (m_input.getFrequency() == m_output.getFrequency()) {
@ -72,7 +72,7 @@ void drain::Resampler::configurationChange() {
m_output.getFrequency(),
10, &err);
#else
AIRTALGO_WARNING("SPEEX DSP lib not accessible ==> can not resample");
DRAIN_WARNING("SPEEX DSP lib not accessible ==> can not resample");
m_needProcess = false;
#endif
}
@ -87,7 +87,7 @@ bool drain::Resampler::process(std::chrono::system_clock::time_point& _time,
_outputNbChunk = 2048;
// chack if we need to process:
if (m_needProcess == false) {
AIRTALGO_WARNING("no process");
DRAIN_WARNING("no process");
_output = _input;
_outputNbChunk = _inputNbChunk;
return true;
@ -95,7 +95,7 @@ bool drain::Resampler::process(std::chrono::system_clock::time_point& _time,
if (_input == nullptr) {
_output = &(m_outputData[0]);
_outputNbChunk = 0;
AIRTALGO_ERROR("null pointer input ... ");
DRAIN_ERROR("null pointer input ... ");
return false;
}
#ifdef HAVE_SPEEX_DSP_RESAMPLE
@ -103,38 +103,38 @@ bool drain::Resampler::process(std::chrono::system_clock::time_point& _time,
float nbOutputSample = nbInputTime*m_output.getFrequency();
// we add 10% of the buffer size to have all the time enought data in the output to proceed all the input data...
_outputNbChunk = size_t(nbOutputSample*1.5f);
AIRTALGO_VERBOSE(" freq in=" << m_input.getFrequency() << " out=" << m_output.getFrequency());
AIRTALGO_VERBOSE(" Frame duration=" << nbInputTime);
AIRTALGO_VERBOSE(" nbInput chunk=" << _inputNbChunk << " nbOutputChunk=" << nbOutputSample);
DRAIN_VERBOSE(" freq in=" << m_input.getFrequency() << " out=" << m_output.getFrequency());
DRAIN_VERBOSE(" Frame duration=" << nbInputTime);
DRAIN_VERBOSE(" nbInput chunk=" << _inputNbChunk << " nbOutputChunk=" << nbOutputSample);
m_outputData.resize(_outputNbChunk*m_output.getMap().size()*m_formatSize*16);
_output = &(m_outputData[0]);
if (m_speexResampler == nullptr) {
AIRTALGO_ERROR(" No speex resampler");
DRAIN_ERROR(" No speex resampler");
return false;
}
uint32_t nbChunkInput = _inputNbChunk;
uint32_t nbChunkOutput = _outputNbChunk;
AIRTALGO_VERBOSE(" >> input=" << nbChunkInput << " output=" << nbChunkOutput);
DRAIN_VERBOSE(" >> input=" << nbChunkInput << " output=" << nbChunkOutput);
int ret = speex_resampler_process_interleaved_int(m_speexResampler,
static_cast<int16_t*>(_input),
&nbChunkInput,
static_cast<int16_t*>(_output),
&nbChunkOutput);
AIRTALGO_VERBOSE(" << input=" << nbChunkInput << " output=" << nbChunkOutput);
DRAIN_VERBOSE(" << input=" << nbChunkInput << " output=" << nbChunkOutput);
// update position of data:
m_positionWrite += nbChunkOutput;
// Check all input and output ...
if (nbChunkInput != _inputNbChunk) {
AIRTALGO_ERROR(" inputSize (not all read ...) proceed=" << nbChunkInput << " requested=" << _inputNbChunk);
DRAIN_ERROR(" inputSize (not all read ...) proceed=" << nbChunkInput << " requested=" << _inputNbChunk);
// TODO : manage this case ...
}
if (nbChunkOutput == _outputNbChunk) {
AIRTALGO_ERROR(" Might have not enought data in output... output size=" << _outputNbChunk);
DRAIN_ERROR(" Might have not enought data in output... output size=" << _outputNbChunk);
// TODO : manage this case ...
}
_outputNbChunk = nbChunkOutput;
AIRTALGO_VERBOSE(" process chunk=" << nbChunkInput << " out=" << nbChunkOutput);
DRAIN_VERBOSE(" process chunk=" << nbChunkInput << " out=" << nbChunkOutput);
return true;
#else
_output = _input;

View File

@ -57,7 +57,7 @@ static void convert__int16__to__int32(void* _input, void* _output, size_t _nbSam
for (size_t iii=0; iii<_nbSample; ++iii) {
out[iii] = (int32_t(in[iii]) * int32_t(_volumeCoef)) >> _volumeDecalage;
}
//AIRTALGO_INFO("plop " << in[0] << " >> " << out[0]);
//DRAIN_INFO("plop " << in[0] << " >> " << out[0]);
}
static void convert__int32__to__int16(void* _input, void* _output, size_t _nbSample, int32_t _volumeCoef, int32_t _volumeDecalage, float _volumeAppli) {
@ -75,7 +75,7 @@ static void convert__int32__to__int32(void* _input, void* _output, size_t _nbSam
for (size_t iii=0; iii<_nbSample; ++iii) {
out[iii] = int32_t((int64_t(in[iii]) * int64_t(_volumeCoef)) >> _volumeDecalage);
}
//AIRTALGO_INFO("plop " << in[0] << " >> " << out[0]);
//DRAIN_INFO("plop " << in[0] << " >> " << out[0]);
}
static void convert__float__to__float(void* _input, void* _output, size_t _nbSample, int32_t _volumeCoef, int32_t _volumeDecalage, float _volumeAppli) {
@ -95,15 +95,15 @@ void drain::Volume::configurationChange() {
default:
case audio::format_int16:
m_functionConvert = &convert__int16__to__int16;
AIRTALGO_DEBUG("Use converter : 'convert__int16__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG("Use converter : 'convert__int16__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int16_on_int32:
case audio::format_int32:
m_functionConvert = &convert__int16__to__int32;
AIRTALGO_DEBUG("Use converter : 'convert__int16__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG("Use converter : 'convert__int16__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_float:
AIRTALGO_ERROR("Impossible case 1");
DRAIN_ERROR("Impossible case 1");
break;
}
break;
@ -113,15 +113,15 @@ void drain::Volume::configurationChange() {
default:
case audio::format_int16:
m_functionConvert = &convert__int32__to__int16;
AIRTALGO_DEBUG("Use converter : 'convert__int32__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG("Use converter : 'convert__int32__to__int16' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_int16_on_int32:
case audio::format_int32:
m_functionConvert = &convert__int32__to__int32;
AIRTALGO_DEBUG("Use converter : 'convert__int32__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG("Use converter : 'convert__int32__to__int32' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
case audio::format_float:
AIRTALGO_ERROR("Impossible case 2");
DRAIN_ERROR("Impossible case 2");
break;
}
break;
@ -131,20 +131,20 @@ void drain::Volume::configurationChange() {
case audio::format_int16:
case audio::format_int16_on_int32:
case audio::format_int32:
AIRTALGO_ERROR("Impossible case 4");
DRAIN_ERROR("Impossible case 4");
break;
case audio::format_float:
m_functionConvert = &convert__float__to__float;
AIRTALGO_DEBUG("Use converter : 'convert__float__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
DRAIN_DEBUG("Use converter : 'convert__float__to__float' for " << m_input.getFormat() << " to " << m_output.getFormat());
break;
}
break;
}
if (m_input.getMap() != m_output.getMap()) {
AIRTALGO_ERROR("Volume map change is not supported");
DRAIN_ERROR("Volume map change is not supported");
}
if (m_input.getFrequency() != m_output.getFrequency()) {
AIRTALGO_ERROR("Volume frequency change is not supported");
DRAIN_ERROR("Volume frequency change is not supported");
}
// nee to process all time (the format not change (just a simple filter))
m_needProcess = true;
@ -159,9 +159,9 @@ void drain::Volume::volumeChange() {
continue;
}
volumedB += it->getVolume();
AIRTALGO_VERBOSE("append volume : '" << it->getName() << " vol=" << it->getVolume() << "dB");
DRAIN_VERBOSE("append volume : '" << it->getName() << " vol=" << it->getVolume() << "dB");
}
AIRTALGO_DEBUG(" Total volume : " << volumedB << "dB nbVolume=" << m_volumeList.size());
DRAIN_DEBUG(" Total volume : " << volumedB << "dB nbVolume=" << m_volumeList.size());
m_volumeAppli = std::pow(10.0f, volumedB/20.0f);
switch (m_input.getFormat()) {
default:
@ -193,7 +193,7 @@ void drain::Volume::volumeChange() {
m_volumeDecalage = 0;
break;
case audio::format_float:
AIRTALGO_ERROR("Impossible case 1");
DRAIN_ERROR("Impossible case 1");
break;
}
break;
@ -225,7 +225,7 @@ void drain::Volume::volumeChange() {
m_volumeDecalage = 0;
break;
case audio::format_float:
AIRTALGO_ERROR("Impossible case 2");
DRAIN_ERROR("Impossible case 2");
break;
}
break;
@ -257,7 +257,7 @@ void drain::Volume::volumeChange() {
m_volumeDecalage = 16;
break;
case audio::format_float:
AIRTALGO_ERROR("Impossible case 3");
DRAIN_ERROR("Impossible case 3");
break;
}
break;
@ -314,17 +314,17 @@ bool drain::Volume::process(std::chrono::system_clock::time_point& _time,
if (_input == nullptr) {
_output = &(m_outputData[0]);
_outputNbChunk = 0;
AIRTALGO_ERROR("null pointer input ... ");
DRAIN_ERROR("null pointer input ... ");
return false;
}
_outputNbChunk = _inputNbChunk;
m_outputData.resize(_outputNbChunk*m_input.getMap().size()*m_formatSize);
_output = &(m_outputData[0]);
if (m_functionConvert == nullptr) {
AIRTALGO_ERROR("null function ptr");
DRAIN_ERROR("null function ptr");
return false;
}
//AIRTALGO_WARNING("Apply volume : " << m_volumedB << "dB " << m_volumeAppli << " ==> x*" << m_volumeCoef << ">>" << m_volumeDecalage << " ex:50*C>>D=" << (50*m_volumeCoef>>m_volumeDecalage) );
//DRAIN_WARNING("Apply volume : " << m_volumedB << "dB " << m_volumeAppli << " ==> x*" << m_volumeCoef << ">>" << m_volumeDecalage << " ex:50*C>>D=" << (50*m_volumeCoef>>m_volumeDecalage) );
m_functionConvert(_input, _output, _outputNbChunk*m_input.getMap().size(), m_volumeCoef, m_volumeDecalage, m_volumeAppli);
return true;
}
@ -363,17 +363,17 @@ bool drain::Volume::setParameter(const std::string& _parameter, const std::strin
}
if ( value < -300
|| value > 300) {
AIRTALGO_ERROR("Can not set volume ... : '" << _parameter << "' out of range : [-300..300]");
DRAIN_ERROR("Can not set volume ... : '" << _parameter << "' out of range : [-300..300]");
return false;
}
it->setVolume(value);
AIRTALGO_DEBUG("Set volume : FLOW = " << value << " dB (from:" << _value << ")");
DRAIN_DEBUG("Set volume : FLOW = " << value << " dB (from:" << _value << ")");
volumeChange();
return true;
}
}
}
AIRTALGO_ERROR("unknow set Parameter : '" << _parameter << "' with Value: '" << _value << "'");
DRAIN_ERROR("unknow set Parameter : '" << _parameter << "' with Value: '" << _value << "'");
return false;
}
@ -389,7 +389,7 @@ std::string drain::Volume::getParameter(const std::string& _parameter) const {
}
}
}
AIRTALGO_ERROR("unknow get Parameter : '" << _parameter << "'");
DRAIN_ERROR("unknow get Parameter : '" << _parameter << "'");
return "[ERROR]";
}
@ -405,7 +405,7 @@ std::string drain::Volume::getParameterProperty(const std::string& _parameter) c
}
}
}
AIRTALGO_ERROR("unknow Parameter property for: '" << _parameter << "'");
DRAIN_ERROR("unknow Parameter property for: '" << _parameter << "'");
return "[ERROR]";
}

View File

@ -4,8 +4,8 @@
* @license APACHE v2.0 (see license file)
*/
#ifndef __AIRTALGO_DEBUG_H__
#define __AIRTALGO_DEBUG_H__
#ifndef __DRAIN_DEBUG_H__
#define __DRAIN_DEBUG_H__
#include <etk/log.h>
@ -13,7 +13,7 @@ namespace drain {
int32_t getLogId();
};
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
#define AIRTALGO_BASE(info,data) \
#define DRAIN_BASE(info,data) \
do { \
if (info <= etk::log::getLevel(drain::getLogId())) { \
std::stringbuf sb; \
@ -23,25 +23,25 @@ namespace drain {
} \
} while(0)
#define AIRTALGO_CRITICAL(data) AIRTALGO_BASE(1, data)
#define AIRTALGO_ERROR(data) AIRTALGO_BASE(2, data)
#define AIRTALGO_WARNING(data) AIRTALGO_BASE(3, data)
#define DRAIN_CRITICAL(data) DRAIN_BASE(1, data)
#define DRAIN_ERROR(data) DRAIN_BASE(2, data)
#define DRAIN_WARNING(data) DRAIN_BASE(3, data)
#ifdef DEBUG
#define AIRTALGO_INFO(data) AIRTALGO_BASE(4, data)
#define AIRTALGO_DEBUG(data) AIRTALGO_BASE(5, data)
#define AIRTALGO_VERBOSE(data) AIRTALGO_BASE(6, data)
#define AIRTALGO_TODO(data) AIRTALGO_BASE(4, "TODO : " << data)
#define DRAIN_INFO(data) DRAIN_BASE(4, data)
#define DRAIN_DEBUG(data) DRAIN_BASE(5, data)
#define DRAIN_VERBOSE(data) DRAIN_BASE(6, data)
#define DRAIN_TODO(data) DRAIN_BASE(4, "TODO : " << data)
#else
#define AIRTALGO_INFO(data) do { } while(false)
#define AIRTALGO_DEBUG(data) do { } while(false)
#define AIRTALGO_VERBOSE(data) do { } while(false)
#define AIRTALGO_TODO(data) do { } while(false)
#define DRAIN_INFO(data) do { } while(false)
#define DRAIN_DEBUG(data) do { } while(false)
#define DRAIN_VERBOSE(data) do { } while(false)
#define DRAIN_TODO(data) do { } while(false)
#endif
#define AIRTALGO_ASSERT(cond,data) \
#define DRAIN_ASSERT(cond,data) \
do { \
if (!(cond)) { \
AIRTALGO_CRITICAL(data); \
DRAIN_CRITICAL(data); \
assert(!#cond); \
} \
} while (0)

View File

@ -6,17 +6,17 @@
* @license BSD 3 clauses (see license file)
*/
#ifdef __AIRTALGOO_DEBUG_H__
#undef __AIRTALGOO_DEBUG_H__
#ifdef __DRAINO_DEBUG_H__
#undef __DRAINO_DEBUG_H__
#undef AIRTALGO_BASE
#undef AIRTALGO_CRITICAL
#undef AIRTALGO_ERROR
#undef AIRTALGO_WARNING
#undef AIRTALGO_INFO
#undef AIRTALGO_DEBUG
#undef AIRTALGO_VERBOSE
#undef AIRTALGO_TODO
#undef AIRTALGO_ASSERT
#undef DRAIN_BASE
#undef DRAIN_CRITICAL
#undef DRAIN_ERROR
#undef DRAIN_WARNING
#undef DRAIN_INFO
#undef DRAIN_DEBUG
#undef DRAIN_VERBOSE
#undef DRAIN_TODO
#undef DRAIN_ASSERT
#endif