diff --git a/drain/Algo.cpp b/drain/Algo.cpp index c4314fc..b85573f 100644 --- a/drain/Algo.cpp +++ b/drain/Algo.cpp @@ -57,7 +57,7 @@ void drain::Algo::configurationChange() { m_formatSize = sizeof(double); break; case audio::format_unknow: - DRAIN_ERROR("format not configured..."); + DRAIN_VERBOSE("format not configured..."); m_formatSize = 8; break; } diff --git a/drain/Process.cpp b/drain/Process.cpp index a93ec96..98aaab5 100644 --- a/drain/Process.cpp +++ b/drain/Process.cpp @@ -144,27 +144,27 @@ template std::vector getUnion(const std::vector& _out, const s void drain::Process::displayAlgo() { - DRAIN_DEBUG(" Input : " << m_inputConfig); + DRAIN_VERBOSE(" Input : " << m_inputConfig); for (size_t iii=0; iiigetType() << "] '" << m_listAlgo[iii]->getName() << "'"); + DRAIN_VERBOSE(" [" << m_listAlgo[iii]->getType() << "] '" << m_listAlgo[iii]->getName() << "'"); if (m_listAlgo[iii]->getInputFormat().getConfigured() == true) { - DRAIN_DEBUG(" Input : " << m_listAlgo[iii]->getInputFormat()); + DRAIN_VERBOSE(" Input : " << m_listAlgo[iii]->getInputFormat()); } else { - DRAIN_DEBUG(" Input : Not configured"); - DRAIN_DEBUG(" format : " << m_listAlgo[iii]->getFormatSupportedInput()); - DRAIN_DEBUG(" frequency : " << m_listAlgo[iii]->getFrequencySupportedInput()); - DRAIN_DEBUG(" map : " << m_listAlgo[iii]->getMapSupportedInput()); + DRAIN_VERBOSE(" Input : Not configured"); + DRAIN_VERBOSE(" format : " << m_listAlgo[iii]->getFormatSupportedInput()); + DRAIN_VERBOSE(" frequency : " << m_listAlgo[iii]->getFrequencySupportedInput()); + DRAIN_VERBOSE(" map : " << m_listAlgo[iii]->getMapSupportedInput()); } if (m_listAlgo[iii]->getOutputFormat().getConfigured() == true) { - DRAIN_DEBUG(" Output: " << m_listAlgo[iii]->getOutputFormat()); + DRAIN_VERBOSE(" Output: " << m_listAlgo[iii]->getOutputFormat()); } else { - DRAIN_DEBUG(" Output : Not configured"); - DRAIN_DEBUG(" format : " << m_listAlgo[iii]->getFormatSupportedOutput()); - DRAIN_DEBUG(" frequency : " << m_listAlgo[iii]->getFrequencySupportedOutput()); - DRAIN_DEBUG(" map : " << m_listAlgo[iii]->getMapSupportedOutput()); + DRAIN_VERBOSE(" Output : Not configured"); + DRAIN_VERBOSE(" format : " << m_listAlgo[iii]->getFormatSupportedOutput()); + DRAIN_VERBOSE(" frequency : " << m_listAlgo[iii]->getFrequencySupportedOutput()); + DRAIN_VERBOSE(" map : " << m_listAlgo[iii]->getMapSupportedOutput()); } } - DRAIN_DEBUG(" Output : " << m_outputConfig); + DRAIN_VERBOSE(" Output : " << m_outputConfig); } void drain::Process::updateAlgo(size_t _position) { @@ -196,7 +196,7 @@ void drain::Process::updateAlgo(size_t _position) { std::vector freq = getUnion(freqOut, freqIn); DRAIN_VERBOSE(" freq out :" << freqOut); DRAIN_VERBOSE(" freq in :" << freqIn); - DRAIN_DEBUG(" freq union :" << freq); + DRAIN_VERBOSE(" freq union :" << freq); // step 2 : Check map: std::vector > mapOut; @@ -214,7 +214,7 @@ void drain::Process::updateAlgo(size_t _position) { std::vector > map = getUnion >(mapOut, mapIn); DRAIN_VERBOSE(" map out :" << mapOut); DRAIN_VERBOSE(" map in :" << mapIn); - DRAIN_DEBUG(" map union :" << map); + DRAIN_VERBOSE(" map union :" << map); // step 3 : Check Format: std::vector formatOut; std::vector formatIn; @@ -231,12 +231,12 @@ void drain::Process::updateAlgo(size_t _position) { std::vector format = getUnion(formatOut, formatIn); DRAIN_VERBOSE(" format out :" << formatOut); DRAIN_VERBOSE(" format in :" << formatIn); - DRAIN_DEBUG(" format union :" << format); + DRAIN_VERBOSE(" format union :" << format); if ( freq.size() >= 1 && map.size() >= 1 && format.size() >= 1) { - DRAIN_DEBUG(" find 1 compatibility :{format=" << format << ",frequency=" << freq << ",map=" << map << "}"); + DRAIN_VERBOSE(" find 1 compatibility :{format=" << format << ",frequency=" << freq << ",map=" << map << "}"); drain::IOFormatInterface tmp(map[0], format[0], freq[0]); if (_position > 0) { m_listAlgo[_position-1]->setOutputFormat(tmp); @@ -327,8 +327,8 @@ void drain::Process::updateAlgo(size_t _position) { } } } - DRAIN_DEBUG(" update: out=" << out); - DRAIN_DEBUG(" in=" << in); + DRAIN_VERBOSE(" update: out=" << out); + DRAIN_VERBOSE(" in=" << in); if (_position > 0) { m_listAlgo[_position-1]->setOutputFormat(out); } @@ -348,7 +348,7 @@ void drain::Process::updateAlgo(size_t _position) { out.setFormat(audio::format_int16); algo->setOutputFormat(out); m_listAlgo.insert(m_listAlgo.begin()+_position, algo); - DRAIN_DEBUG("convert " << out.getFormat() << " -> " << in.getFormat()); + DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat()); _position++; } // need add a resampler @@ -358,7 +358,7 @@ void drain::Process::updateAlgo(size_t _position) { out.setFrequency(in.getFrequency()); algo->setOutputFormat(out); m_listAlgo.insert(m_listAlgo.begin()+_position, algo); - DRAIN_DEBUG("convert " << out.getFrequency() << " -> " << in.getFrequency()); + DRAIN_VERBOSE("convert " << out.getFrequency() << " -> " << in.getFrequency()); out.setFrequency(in.getFrequency()); _position++; } @@ -370,7 +370,7 @@ void drain::Process::updateAlgo(size_t _position) { out.setMap(in.getMap()); algo->setOutputFormat(out); m_listAlgo.insert(m_listAlgo.begin()+_position, algo); - DRAIN_DEBUG("convert " << out.getMap() << " -> " << in.getMap()); + DRAIN_VERBOSE("convert " << out.getMap() << " -> " << in.getMap()); _position++; } if (out.getFormat() != in.getFormat()) { @@ -381,7 +381,7 @@ void drain::Process::updateAlgo(size_t _position) { out.setFormat(in.getFormat()); algo->setOutputFormat(out); m_listAlgo.insert(m_listAlgo.begin()+_position, algo); - DRAIN_DEBUG("convert " << out.getFormat() << " -> " << in.getFormat()); + DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat()); _position++; } @@ -401,9 +401,9 @@ void drain::Process::updateInterAlgo() { // cahin is already configured return ; } - DRAIN_DEBUG("Display properties : nbAlgo : " << m_listAlgo.size()); + DRAIN_VERBOSE("Display properties : nbAlgo : " << m_listAlgo.size()); displayAlgo(); - DRAIN_DEBUG("********* configuration START *************"); + DRAIN_VERBOSE("********* configuration START *************"); // configure first the endpoint ... if (m_listAlgo.size() > 1) { updateAlgo(m_listAlgo.size()); @@ -411,7 +411,7 @@ void drain::Process::updateInterAlgo() { for (size_t iii=0; iii<=m_listAlgo.size(); ++iii) { updateAlgo(iii); } - DRAIN_DEBUG("********* configuration will be done *************"); + DRAIN_VERBOSE("********* configuration will be done *************"); displayAlgo(); m_isConfigured = true; //exit(-1); diff --git a/drain/Resampler.cpp b/drain/Resampler.cpp index 70050b5..9ccc751 100644 --- a/drain/Resampler.cpp +++ b/drain/Resampler.cpp @@ -24,6 +24,7 @@ void drain::Resampler::init() { drain::Algo::init(); m_type = "Resampler"; m_supportedFormat.push_back(audio::format_int16); + m_residualTimeInResampler = std11::chrono::nanoseconds(0); } std11::shared_ptr drain::Resampler::create() { @@ -77,6 +78,7 @@ void drain::Resampler::configurationChange() { m_input.getFrequency(), m_output.getFrequency(), 10, &err); + m_residualTimeInResampler = std11::chrono::nanoseconds(0); #else DRAIN_WARNING("SPEEX DSP lib not accessible ==> can not resample"); m_needProcess = false; @@ -107,7 +109,7 @@ bool drain::Resampler::process(std11::chrono::system_clock::time_point& _time, DRAIN_VERBOSE("Resampler correct timestamp : " << _time << " ==> " << (_time - m_residualTimeInResampler)); _time -= m_residualTimeInResampler; - std11::chrono::nanoseconds inTime((int64_t(_inputNbChunk)*int64_t(1000000000)) / int64_t(m_input.getFrequency())); + std11::chrono::nanoseconds inTime((int64_t(_inputNbChunk)*1000000000LL) / int64_t(m_input.getFrequency())); m_residualTimeInResampler += inTime; #ifdef HAVE_SPEEX_DSP_RESAMPLE float nbInputTime = float(_inputNbChunk)/m_input.getFrequency(); @@ -146,7 +148,8 @@ bool drain::Resampler::process(std11::chrono::system_clock::time_point& _time, } _outputNbChunk = nbChunkOutput; DRAIN_VERBOSE(" process chunk=" << nbChunkInput << " out=" << nbChunkOutput); - std11::chrono::nanoseconds outTime((int64_t(_outputNbChunk)*int64_t(1000000000)) / int64_t(m_output.getFrequency())); + std11::chrono::nanoseconds outTime((int64_t(_outputNbChunk)*1000000000LL) / int64_t(m_output.getFrequency())); + DRAIN_VERBOSE("convert " << _inputNbChunk << " ==> " << _outputNbChunk << " " << inTime.count() << " => " << outTime.count()); // correct time : m_residualTimeInResampler -= outTime; /*