Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion include/BasicFilters.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ template<ch_cnt_t CHANNELS>
class BiQuad
{
public:
BiQuad()
BiQuad() :
m_a1(0.),
m_a2(0.),
m_b0(0.),
m_b1(0.),
m_b2(0.)
{
clearHistory();
}
Expand Down
8 changes: 7 additions & 1 deletion plugins/Eq/EqEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,20 @@ bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )

float EqEffect::peakBand( float minF, float maxF, EqAnalyser *fft, int sr )
{
auto const fftEnergy = fft->getEnergy();
if (fftEnergy == 0.)
{
return 0.;
}

float peak = -60;
float *b = fft->m_bands;
float h = 0;
for( int x = 0; x < MAX_BANDS; x++, b++ )
{
if( bandToFreq( x ,sr) >= minF && bandToFreq( x,sr ) <= maxF )
{
h = 20 * ( log10( *b / fft->getEnergy() ) );
h = 20 * ( log10( *b / fftEnergy ) );
peak = h > peak ? h : peak;
}
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/Eq/EqSpectrumView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ EqSpectrumView::EqSpectrumView(EqAnalyser *b, QWidget *_parent) :

void EqSpectrumView::paintEvent(QPaintEvent *event)
{
const float energy = m_analyser->getEnergy();
if( energy <= 0 && m_peakSum <= 0 )
const float energy = m_analyser->getEnergy();
if (energy <= 0)
{
//dont draw anything
// If there is no energy in the signal we don't need to draw anything
return;
}

Expand All @@ -238,7 +238,7 @@ void EqSpectrumView::paintEvent(QPaintEvent *event)
const float fallOff = 1.07;
for( int x = 0; x < MAX_BANDS; ++x, ++bands )
{
peak = ( fh * 2.0 / 3.0 * ( 20 * ( log10( *bands / energy ) ) - LOWER_Y ) / ( - LOWER_Y ) );
peak = *bands != 0 ? ( fh * 2.0 / 3.0 * ( 20 * ( log10( *bands / energy ) ) - LOWER_Y ) / ( - LOWER_Y ) ) : 0.;
if( peak < 0 )
{
peak = 0;
Expand Down