[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();
//! Destructor
virtual ~SimpleGateRms() {}
virtual ~SimpleGateRms() override {}
//! set sample rate
virtual void setSampleRate(double sampleRate);
virtual void setSampleRate(double sampleRate) override;
//! set RMS window
virtual void setWindow(double ms);
@@ -91,7 +91,7 @@ namespace chunkware_simple
virtual double getWindow(void) const { return ave_.getTc(); }
//! call before runtime (in resume())
virtual void initRuntime(void);
virtual void initRuntime(void) override;
//! gate runtime process
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());

View File

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

View File

@@ -61,5 +61,12 @@ namespace BlackSound
{
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
void setMakeUpGain(double gain);
//! Set channels 1 or 2
void setChannels(int channels);
private:
QTimer *m_timer = nullptr;
ISampleProvider *m_sourceStream = nullptr;
bool m_enabled = true;
const int m_channels = 1;
int m_channels = 1;
chunkware_simple::SimpleComp m_simpleCompressor;
};
} // ns