[DEV] change volume update

This commit is contained in:
Edouard DUPIN 2015-02-04 21:08:06 +01:00
parent 0714b0f851
commit 8396ae4496
2 changed files with 8 additions and 6 deletions

View File

@ -148,9 +148,10 @@ void airtalgo::Volume::configurationChange() {
} }
// nee to process all time (the format not change (just a simple filter)) // nee to process all time (the format not change (just a simple filter))
m_needProcess = true; m_needProcess = true;
volumeChange();
} }
void airtalgo::Volume::updateVolumeValues() { void airtalgo::Volume::volumeChange() {
//m_volumeAppli = 20 * log(m_volumedB); //m_volumeAppli = 20 * log(m_volumedB);
float volumedB = 0.0f; float volumedB = 0.0f;
for (auto &it : m_volumeList) { for (auto &it : m_volumeList) {
@ -323,8 +324,6 @@ bool airtalgo::Volume::process(std::chrono::system_clock::time_point& _time,
AIRTALGO_ERROR("null function ptr"); AIRTALGO_ERROR("null function ptr");
return false; return false;
} }
// Calculate in every case the volume to apply :
updateVolumeValues();
//AIRTALGO_WARNING("Apply volume : " << m_volumedB << "dB " << m_volumeAppli << " ==> x*" << m_volumeCoef << ">>" << m_volumeDecalage << " ex:50*C>>D=" << (50*m_volumeCoef>>m_volumeDecalage) ); //AIRTALGO_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); m_functionConvert(_input, _output, _outputNbChunk*m_input.getMap().size(), m_volumeCoef, m_volumeDecalage, m_volumeAppli);
return true; return true;
@ -346,6 +345,7 @@ void airtalgo::Volume::addVolumeStage(const std::shared_ptr<VolumeElement>& _vol
} }
} }
m_volumeList.push_back(_volume); m_volumeList.push_back(_volume);
volumeChange();
} }
bool airtalgo::Volume::setParameter(const std::string& _parameter, const std::string& _value) { bool airtalgo::Volume::setParameter(const std::string& _parameter, const std::string& _value) {
@ -363,6 +363,7 @@ bool airtalgo::Volume::setParameter(const std::string& _parameter, const std::st
// TODO : Check if out of range ... // TODO : Check if out of range ...
it->setVolume(value); it->setVolume(value);
AIRTALGO_DEBUG("Set volume : FLOW = " << value << " dB (from:" << _value << ")"); AIRTALGO_DEBUG("Set volume : FLOW = " << value << " dB (from:" << _value << ")");
volumeChange();
return true; return true;
} }
} }
@ -402,3 +403,4 @@ std::string airtalgo::Volume::getParameterProperty(const std::string& _parameter
AIRTALGO_ERROR("unknow Parameter property for: '" << _parameter << "'"); AIRTALGO_ERROR("unknow Parameter property for: '" << _parameter << "'");
return "[ERROR]"; return "[ERROR]";
} }

View File

@ -76,13 +76,13 @@ namespace airtalgo {
public: public:
virtual std::vector<airtalgo::format> getFormatSupportedInput(); virtual std::vector<airtalgo::format> getFormatSupportedInput();
virtual std::vector<airtalgo::format> getFormatSupportedOutput(); virtual std::vector<airtalgo::format> getFormatSupportedOutput();
protected:
virtual void updateVolumeValues();
public: public:
virtual void addVolumeStage(const std::shared_ptr<airtalgo::VolumeElement>& _volume); virtual void addVolumeStage(const std::shared_ptr<airtalgo::VolumeElement>& _volume);
virtual bool setParameter(const std::string& _parameter, const std::string& _value); virtual bool setParameter(const std::string& _parameter, const std::string& _value);
virtual std::string getParameter(const std::string& _parameter) const; virtual std::string getParameter(const std::string& _parameter) const;
virtual std::string getParameterProperty(const std::string& _parameter) const; virtual std::string getParameterProperty(const std::string& _parameter) const;
public:
void volumeChange();
}; };
}; };