[AFV] Ref T730, CPPCheck (e.g. virtual function call in ctor)

This commit is contained in:
Klaus Basan
2019-10-13 21:23:27 +02:00
parent abae20031d
commit fc43199c32
5 changed files with 21 additions and 6 deletions

View File

@@ -79,10 +79,10 @@ namespace chunkware_simple
SimpleGateRms(); SimpleGateRms();
//! Destructor //! Destructor
virtual ~SimpleGateRms() {} virtual ~SimpleGateRms() override {}
//! set sample rate //! set sample rate
virtual void setSampleRate(double sampleRate); virtual void setSampleRate(double sampleRate) override;
//! set RMS window //! set RMS window
virtual void setWindow(double ms); virtual void setWindow(double ms);
@@ -91,7 +91,7 @@ namespace chunkware_simple
virtual double getWindow(void) const { return ave_.getTc(); } virtual double getWindow(void) const { return ave_.getTc(); }
//! call before runtime (in resume()) //! call before runtime (in resume())
virtual void initRuntime(void); virtual void initRuntime(void) override;
//! gate runtime process //! gate runtime process
void process(double &in1, double &in2); void process(double &in1, double &in2);

View File

@@ -58,7 +58,7 @@ namespace chunkware_simple
} }
//------------------------------------------------------------- //-------------------------------------------------------------
void SimpleLimit::setAttack(double ms) void SimpleLimit::setAttackImpl(double ms)
{ {
unsigned int samp = static_cast<unsigned>(0.001 * ms * att_.getSampleRate()); unsigned int samp = static_cast<unsigned>(0.001 * ms * att_.getSampleRate());

View File

@@ -42,12 +42,15 @@ namespace chunkware_simple
class SimpleLimit class SimpleLimit
{ {
public: public:
//! Ctor
SimpleLimit(); SimpleLimit();
//! Dtor
virtual ~SimpleLimit() {} virtual ~SimpleLimit() {}
//! @{ set parameters //! @{ set parameters
virtual void setThresh(double dB); virtual void setThresh(double dB);
virtual void setAttack(double ms); virtual void setAttack(double ms) { this->setAttackImpl(ms); } // used in ctor
virtual void setRelease(double ms); virtual void setRelease(double ms);
//! @} //! @}
@@ -88,6 +91,8 @@ namespace chunkware_simple
}; };
private: private:
//! Impl. function as it is used in ctor, non virtual
void setAttackImpl(double ms);
// transfer function // transfer function
double threshdB_; // threshold (dB) double threshdB_; // threshold (dB)

View File

@@ -61,5 +61,12 @@ namespace BlackSound
{ {
m_simpleCompressor.setMakeUpGain(gain); m_simpleCompressor.setMakeUpGain(gain);
} }
void CSimpleCompressorEffect::setChannels(int channels)
{
if (channels < 1) { channels = 1; }
else if (channels > 2) { channels = 2; }
m_channels = channels;
}
} }
} }

View File

@@ -40,11 +40,14 @@ namespace BlackSound
//! Set gain //! Set gain
void setMakeUpGain(double gain); void setMakeUpGain(double gain);
//! Set channels 1 or 2
void setChannels(int channels);
private: private:
QTimer *m_timer = nullptr; QTimer *m_timer = nullptr;
ISampleProvider *m_sourceStream = nullptr; ISampleProvider *m_sourceStream = nullptr;
bool m_enabled = true; bool m_enabled = true;
const int m_channels = 1; int m_channels = 1;
chunkware_simple::SimpleComp m_simpleCompressor; chunkware_simple::SimpleComp m_simpleCompressor;
}; };
} // ns } // ns