labeled axes and correct logarithmic view
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1128 0778d3d1-df1d-0410-868b-ea421aaaa00d
11
ChangeLog
@@ -1,5 +1,16 @@
|
||||
2008-06-14 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/spectrum_analyzer/log_x_axis.png:
|
||||
* plugins/spectrum_analyzer/log_y_axis.png:
|
||||
* plugins/spectrum_analyzer/background.png:
|
||||
* plugins/spectrum_analyzer/spectrum_background.png:
|
||||
* plugins/spectrum_analyzer/spectrum_background_plain.png:
|
||||
* plugins/spectrum_analyzer/spectrumanalyzer_control_dialog.cpp:
|
||||
* plugins/spectrum_analyzer/spectrum_analyzer.cpp:
|
||||
* plugins/spectrum_analyzer/spectrumanalyzer_controls.cpp:
|
||||
* plugins/spectrum_analyzer/spectrumanalyzer_control_dialog.h:
|
||||
labeled axes and correct logarithmic view
|
||||
|
||||
* plugins/spectrum_analyzer/background.png:
|
||||
* plugins/spectrum_analyzer/spectrum_background.png:
|
||||
* plugins/spectrum_analyzer/spectrum_background_plain.png:
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 22 KiB |
BIN
plugins/spectrum_analyzer/log_x_axis.png
Normal file
|
After Width: | Height: | Size: 744 B |
BIN
plugins/spectrum_analyzer/log_y_axis.png
Normal file
|
After Width: | Height: | Size: 465 B |
@@ -363,12 +363,12 @@ bool spectrumAnalyzer::processAudioBuffer( sampleFrame * _buf,
|
||||
MAX_BANDS,
|
||||
LOWEST_FREQ*(BUFFER_SIZE+1)/(double)(sr/2),
|
||||
HIGHEST_FREQ*(BUFFER_SIZE+1)/(double)(sr/2) );
|
||||
m_energy = maximum( m_bands, MAX_BANDS );
|
||||
m_energy = maximum( m_bands, MAX_BANDS ) / maximum( m_buffer, BUFFER_SIZE );
|
||||
}
|
||||
else
|
||||
{
|
||||
calc13octaveband31( m_absSpecBuf, m_bands, BUFFER_SIZE+1, sr/2.0);
|
||||
m_energy = signalpower( m_buffer, BUFFER_SIZE );
|
||||
m_energy = signalpower( m_buffer, BUFFER_SIZE ) / maximum( m_buffer, BUFFER_SIZE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 577 B |
@@ -93,11 +93,11 @@ public:
|
||||
{
|
||||
if( lin_y )
|
||||
{
|
||||
h = height() * (*b / e );
|
||||
h = height() * 2.0 / 3.0 * (*b / e );
|
||||
}
|
||||
else
|
||||
{
|
||||
h = (int)( height() * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
h = (int)( height() * 2.0 / 3.0 * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
}
|
||||
if( h < 0 )
|
||||
{
|
||||
@@ -116,11 +116,11 @@ public:
|
||||
{
|
||||
if( lin_y )
|
||||
{
|
||||
h = height() * (*b / e );
|
||||
h = height() * 2.0 / 3.0 * ( 1.2 * *b / e );
|
||||
}
|
||||
else
|
||||
{
|
||||
h = (int)( height() * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
h = (int)( height() * 2.0 / 3.0 * (20*(log10( *b / e ) ) - LOWER_Y ) / (-LOWER_Y ) );
|
||||
}
|
||||
if( h < 0 )
|
||||
{
|
||||
@@ -149,9 +149,14 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
spectrumAnalyzerControlDialog::spectrumAnalyzerControlDialog(
|
||||
spectrumAnalyzerControls * _controls ) :
|
||||
effectControlDialog( _controls )
|
||||
effectControlDialog( _controls ),
|
||||
m_controls( _controls ),
|
||||
m_logXAxis( PLUGIN_NAME::getIconPixmap( "log_x_axis" ) ),
|
||||
m_logYAxis( PLUGIN_NAME::getIconPixmap( "log_y_axis" ) )
|
||||
{
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
@@ -161,7 +166,7 @@ spectrumAnalyzerControlDialog::spectrumAnalyzerControlDialog(
|
||||
setPalette( pal );
|
||||
/* QVBoxLayout * l = new QVBoxLayout( this );*/
|
||||
spectrumView * v = new spectrumView( _controls->m_effect, this );
|
||||
v->move( 24, 30 );
|
||||
v->move( 27, 30 );
|
||||
|
||||
ledCheckBox * lin_spec = new ledCheckBox( tr( "Linear spectrum" ), this );
|
||||
lin_spec->move( 24, 204 );
|
||||
@@ -170,6 +175,11 @@ spectrumAnalyzerControlDialog::spectrumAnalyzerControlDialog(
|
||||
ledCheckBox * lin_y = new ledCheckBox( tr( "Linear Y axis" ), this );
|
||||
lin_y->move( 24, 220 );
|
||||
lin_y->setModel( &_controls->m_linearYAxis );
|
||||
|
||||
connect( &_controls->m_linearSpec, SIGNAL( dataChanged() ),
|
||||
this, SLOT( update() ) );
|
||||
connect( &_controls->m_linearYAxis, SIGNAL( dataChanged() ),
|
||||
this, SLOT( update() ) );
|
||||
/* l->addWidget( v );
|
||||
l->addWidget( lin_spec );
|
||||
l->addWidget( lin_y );*/
|
||||
@@ -177,3 +187,19 @@ spectrumAnalyzerControlDialog::spectrumAnalyzerControlDialog(
|
||||
}
|
||||
|
||||
|
||||
void spectrumAnalyzerControlDialog::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
if( !m_controls->m_linearSpec.value() )
|
||||
{
|
||||
p.drawPixmap( 25, 183, m_logXAxis );
|
||||
}
|
||||
if( !m_controls->m_linearYAxis.value() )
|
||||
{
|
||||
p.drawPixmap( 3, 47, m_logYAxis);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
|
||||
spectrumAnalyzerControls * m_controls;
|
||||
|
||||
QPixmap m_logXAxis;
|
||||
QPixmap m_logYAxis;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@ spectrumAnalyzerControls::spectrumAnalyzerControls( spectrumAnalyzer * _eff ) :
|
||||
effectControls( _eff ),
|
||||
m_effect( _eff ),
|
||||
m_linearSpec( FALSE, this, tr( "Linear spectrum" ) ),
|
||||
m_linearYAxis( TRUE, this, tr( "Linear Y-axis" ) ),
|
||||
m_linearYAxis( FALSE, this, tr( "Linear Y-axis" ) ),
|
||||
m_channelMode( spectrumAnalyzer::MergeChannels, spectrumAnalyzer::MergeChannels, spectrumAnalyzer::RightChannel, this, tr( "Channel mode" ) )
|
||||
{
|
||||
}
|
||||
|
||||