EQ tidy up,
This commit is contained in:
@@ -2,5 +2,5 @@ INCLUDE(BuildPlugin)
|
||||
INCLUDE_DIRECTORIES(${FFTW3F_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${FFTW3F_LIBRARY_DIRS})
|
||||
LINK_LIBRARIES(${FFTW3F_LIBRARIES})
|
||||
BUILD_PLUGIN(eq EqEffect.cpp EqControls.cpp EqControlsDialog.cpp EqFilter.h EqParameterWidget.cpp EqFader.h EqSpectrumView.h ../../src/gui/widgets/Fader.cpp
|
||||
MOCFILES EqControls.h EqParameterWidget.h EqFader.h ../../include/Fader.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
|
||||
BUILD_PLUGIN(eq EqEffect.cpp EqControls.cpp EqControlsDialog.cpp EqFilter.h EqParameterWidget.cpp EqFader.h EqSpectrumView.h
|
||||
MOCFILES EqControls.h EqParameterWidget.h EqFader.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
|
||||
|
||||
@@ -85,6 +85,8 @@ EqControls::EqControls( EqEffect *effect ) :
|
||||
m_para1GainModel.setScaleLogarithmic( true );
|
||||
m_inPeakL = 0;
|
||||
m_inPeakR = 0;
|
||||
m_outPeakL = 0;
|
||||
m_outPeakR = 0;
|
||||
m_lowShelfPeakL = 0; m_lowShelfPeakR = 0;
|
||||
m_para1PeakL = 0; m_para1PeakR = 0;
|
||||
m_para2PeakL = 0; m_para2PeakR = 0;
|
||||
|
||||
@@ -51,7 +51,8 @@ Plugin::Descriptor PLUGIN_EXPORT eq_plugin_descriptor =
|
||||
|
||||
EqEffect::EqEffect(Model *parent, const Plugin::Descriptor::SubPluginFeatures::Key *key) :
|
||||
Effect( &eq_plugin_descriptor, parent, key ),
|
||||
m_eqControls( this )
|
||||
m_eqControls( this ),
|
||||
m_upBufFrames( 0 )
|
||||
{
|
||||
m_dFilterCount = 4;
|
||||
m_downsampleFilters = new EqLinkwitzRiley[m_dFilterCount];
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
|
||||
class EqFader : public Fader
|
||||
class EXPORT EqFader : public Fader
|
||||
{
|
||||
|
||||
public:
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
m_rPeak = rPeak;
|
||||
connect( Engine::mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) );
|
||||
m_model = model;
|
||||
setPeak_L( 0 );
|
||||
setPeak_R( 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -336,7 +336,9 @@ class EqLinkwitzRiley : public StereoLinkwitzRiley
|
||||
{
|
||||
public:
|
||||
EqLinkwitzRiley() :
|
||||
StereoLinkwitzRiley( 44100)
|
||||
StereoLinkwitzRiley( 44100),
|
||||
m_freq(0 ),
|
||||
m_sr( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ EqParameterWidget::EqParameterWidget( QWidget *parent ) :
|
||||
m_pixelsPerUnitHeight = (height() - 4) / ( totalHeight );
|
||||
m_scale = 1.5;
|
||||
m_pixelsPerOctave = freqToXPixel( 10000 ) - freqToXPixel( 5000 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +57,7 @@ EqParameterWidget::~EqParameterWidget()
|
||||
if(m_bands)
|
||||
{
|
||||
delete m_bands;
|
||||
m_bands = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +212,10 @@ EqBand::EqBand() :
|
||||
res ( 0 ),
|
||||
freq ( 0 ),
|
||||
color ( QColor( 255, 255, 255 ) ),
|
||||
name ( QString( "" ) )
|
||||
x( 0 ),
|
||||
y( 0 ),
|
||||
name ( QString( "" ) ),
|
||||
peakL( 0 ),
|
||||
peakR( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -32,18 +32,19 @@
|
||||
class EqBand
|
||||
{
|
||||
public :
|
||||
EqBand();
|
||||
FloatModel* gain;
|
||||
FloatModel* res;
|
||||
FloatModel* freq;
|
||||
BoolModel* active;
|
||||
QColor color;
|
||||
int x;
|
||||
int y;
|
||||
QString name;
|
||||
EqBand();
|
||||
FloatModel* gain;
|
||||
FloatModel* res;
|
||||
FloatModel* freq;
|
||||
BoolModel* active;
|
||||
QColor color;
|
||||
int x;
|
||||
int y;
|
||||
QString name;
|
||||
float* peakL;
|
||||
float* peakR;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -52,51 +53,51 @@ class EqParameterWidget : public QWidget
|
||||
{
|
||||
|
||||
public:
|
||||
explicit EqParameterWidget( QWidget *parent = 0 );
|
||||
~EqParameterWidget();
|
||||
const int bandCount()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
explicit EqParameterWidget( QWidget *parent = 0 );
|
||||
~EqParameterWidget();
|
||||
const int bandCount()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const int maxDistanceFromHandle()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
const int maxDistanceFromHandle()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
EqBand* getBandModels( int i )
|
||||
{
|
||||
return &m_bands[i];
|
||||
}
|
||||
EqBand* getBandModels( int i )
|
||||
{
|
||||
return &m_bands[i];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const int activeAplha()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
const int activeAplha()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const int inactiveAlpha()
|
||||
{
|
||||
const int inactiveAlpha()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const float resPixelMultiplyer()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
const float resPixelMultiplyer()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
|
||||
signals:
|
||||
@@ -104,55 +105,55 @@ signals:
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
virtual void paintEvent ( QPaintEvent * event );
|
||||
virtual void mousePressEvent(QMouseEvent * event );
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event);
|
||||
virtual void mouseMoveEvent(QMouseEvent * event);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent * event);
|
||||
virtual void paintEvent ( QPaintEvent * event );
|
||||
virtual void mousePressEvent(QMouseEvent * event );
|
||||
virtual void mouseReleaseEvent(QMouseEvent * event);
|
||||
virtual void mouseMoveEvent(QMouseEvent * event);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent * event);
|
||||
|
||||
private:
|
||||
EqBand* m_bands;
|
||||
float m_pixelsPerUnitWidth;
|
||||
float m_pixelsPerUnitHeight;
|
||||
float m_pixelsPerOctave;
|
||||
float m_scale;
|
||||
EqBand* m_selectedBand;
|
||||
EqBand *m_bands;
|
||||
float m_pixelsPerUnitWidth;
|
||||
float m_pixelsPerUnitHeight;
|
||||
float m_pixelsPerOctave;
|
||||
float m_scale;
|
||||
EqBand* m_selectedBand;
|
||||
|
||||
EqBand* selectNearestHandle( const int x, const int y );
|
||||
EqBand* selectNearestHandle( const int x, const int y );
|
||||
|
||||
enum MouseAction { none, drag, res } m_mouseAction;
|
||||
int m_oldX, m_oldY;
|
||||
enum MouseAction { none, drag, res } m_mouseAction;
|
||||
int m_oldX, m_oldY;
|
||||
int *m_xGridBands;
|
||||
|
||||
|
||||
inline int freqToXPixel( float freq )
|
||||
{
|
||||
return ( log10( freq ) * m_pixelsPerUnitWidth * m_scale ) - ( width() * 0.5 );
|
||||
}
|
||||
inline int freqToXPixel( float freq )
|
||||
{
|
||||
return ( log10( freq ) * m_pixelsPerUnitWidth * m_scale ) - ( width() * 0.5 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline float xPixelToFreq( int x )
|
||||
{
|
||||
return pow( 10, ( x + ( width() * 0.5 ) ) / ( m_pixelsPerUnitWidth * m_scale ) );
|
||||
}
|
||||
inline float xPixelToFreq( int x )
|
||||
{
|
||||
return pow( 10, ( x + ( width() * 0.5 ) ) / ( m_pixelsPerUnitWidth * m_scale ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline int gainToYPixel( float gain )
|
||||
{
|
||||
return ( height() - 3) - ( gain * m_pixelsPerUnitHeight ) - ( (height() -3 ) * 0.5);
|
||||
}
|
||||
inline int gainToYPixel( float gain )
|
||||
{
|
||||
return ( height() - 3) - ( gain * m_pixelsPerUnitHeight ) - ( (height() -3 ) * 0.5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline float yPixelToGain( int y )
|
||||
{
|
||||
return ( ( 0.5 * height() ) - y) / m_pixelsPerUnitHeight;
|
||||
}
|
||||
inline float yPixelToGain( int y )
|
||||
{
|
||||
return ( ( 0.5 * height() ) - y) / m_pixelsPerUnitHeight;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -46,7 +46,10 @@ public:
|
||||
int m_sr;
|
||||
|
||||
|
||||
EqAnalyser()
|
||||
EqAnalyser() :
|
||||
m_framesFilledUp ( 0 ),
|
||||
m_energy ( 0 ),
|
||||
m_sr ( 1 )
|
||||
{
|
||||
m_inProgress=false;
|
||||
m_specBuf = (fftwf_complex *) fftwf_malloc( ( FFT_BUFFER_SIZE + 1 ) * sizeof( fftwf_complex ) );
|
||||
@@ -73,7 +76,7 @@ public:
|
||||
m_framesFilledUp = 0;
|
||||
m_energy = 0;
|
||||
memset( m_buffer, 0, sizeof( m_buffer ) );
|
||||
|
||||
memset( m_bands, 0, sizeof( m_bands ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user