[DEV] change channel reorder

This commit is contained in:
Edouard DUPIN 2015-02-19 22:00:21 +01:00
parent 01d36bd995
commit aa020d5e3c
2 changed files with 22 additions and 1 deletions

View File

@ -104,7 +104,18 @@ bool drain::ChannelReorder::process(std::chrono::system_clock::time_point& _time
break;
default:
case audio::format_int16:
{
if (m_output.getMap().size() == 1) {
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 iii=0; iii<_outputNbChunk; ++iii) {
int32_t val = 0;
for (size_t jjj=0; jjj<m_input.getMap().size(); ++jjj) {
val += in[iii*m_input.getMap().size()+jjj];
}
out[iii] = val/m_input.getMap().size();
}
} else {
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);

View File

@ -102,6 +102,16 @@ namespace drain{
m_isConfigured = false;
m_listAlgo.clear();
}
size_t size() {
return m_listAlgo.size();
}
std::vector<std::shared_ptr<drain::Algo> >::iterator begin() {
return m_listAlgo.begin();
}
std::vector<std::shared_ptr<drain::Algo> >::iterator end() {
return m_listAlgo.end();
}
template<typename T> void removeIfFirst() {
if (m_listAlgo.size() > 0) {
std::shared_ptr<T> algoEP = std::dynamic_pointer_cast<T>(m_listAlgo[0]);