diff --git a/plugins/waveshaper/artwork.png b/plugins/waveshaper/artwork.png index ba6d952ea..876bac563 100644 Binary files a/plugins/waveshaper/artwork.png and b/plugins/waveshaper/artwork.png differ diff --git a/plugins/waveshaper/reset_active.png b/plugins/waveshaper/reset_active.png new file mode 100644 index 000000000..0f4c8b9a6 Binary files /dev/null and b/plugins/waveshaper/reset_active.png differ diff --git a/plugins/waveshaper/reset_inactive.png b/plugins/waveshaper/reset_inactive.png new file mode 100644 index 000000000..57c0a7a85 Binary files /dev/null and b/plugins/waveshaper/reset_inactive.png differ diff --git a/plugins/waveshaper/smooth_active.png b/plugins/waveshaper/smooth_active.png new file mode 100644 index 000000000..62cba64b5 Binary files /dev/null and b/plugins/waveshaper/smooth_active.png differ diff --git a/plugins/waveshaper/smooth_inactive.png b/plugins/waveshaper/smooth_inactive.png new file mode 100644 index 000000000..53bddbb83 Binary files /dev/null and b/plugins/waveshaper/smooth_inactive.png differ diff --git a/plugins/waveshaper/wavegraph.png b/plugins/waveshaper/wavegraph.png index 18d99a81e..eb3efa968 100644 Binary files a/plugins/waveshaper/wavegraph.png and b/plugins/waveshaper/wavegraph.png differ diff --git a/plugins/waveshaper/waveshaper_control_dialog.cpp b/plugins/waveshaper/waveshaper_control_dialog.cpp index c699b66ca..9a3454b9d 100644 --- a/plugins/waveshaper/waveshaper_control_dialog.cpp +++ b/plugins/waveshaper/waveshaper_control_dialog.cpp @@ -30,7 +30,8 @@ #include "waveshaper_controls.h" #include "embed.h" #include "graph.h" - +#include "pixmap_button.h" +#include "tooltip.h" waveShaperControlDialog::waveShaperControlDialog( @@ -42,48 +43,47 @@ waveShaperControlDialog::waveShaperControlDialog( pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); - setFixedSize( 222, 300 ); - - QVBoxLayout * tl = new QVBoxLayout( this ); - tl->addSpacing( 30 ); - tl->addStrut( 204 ); + setFixedSize( 224, 300 ); graph * waveGraph = new graph( this, graph::NearestStyle, 204, 204 ); + waveGraph -> move( 10, 32 ); waveGraph -> setModel( &_controls -> m_wavegraphModel ); - - waveGraph -> setAutoFillBackground( true ); - pal = QPalette(); pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap("wavegraph") ); waveGraph->setPalette( pal ); waveGraph->setGraphColor( QColor( 170, 255, 255 ) ); - -// waveGraph -> setMinimumSize( 204, 204); -// waveGraph -> resize( 204, 204); - waveGraph -> setMaximumSize( 204, 204 ); - tl -> setSizeConstraint( QLayout::SetNoConstraint ); - tl -> addWidget( waveGraph ); - - QHBoxLayout * l = new QHBoxLayout; - knob * inputKnob = new knob( knobBright_26, this); + inputKnob -> move( 10, 251 ); inputKnob->setModel( &_controls->m_inputModel ); inputKnob->setLabel( tr( "INPUT" ) ); inputKnob->setHintText( tr( "Input gain:" ) + " ", "" ); - + knob * outputKnob = new knob( knobBright_26, this ); + outputKnob -> move( 50, 251 ); outputKnob->setModel( &_controls->m_outputModel ); outputKnob->setLabel( tr( "OUTPUT" ) ); outputKnob->setHintText( tr( "Output gain:" ) + " ", "" ); - l->addWidget( inputKnob ); - l->addWidget( outputKnob ); - - tl->addLayout( l ); - setLayout( tl ); + pixmapButton * resetButton = new pixmapButton( this, tr("Reset waveform") ); + resetButton -> move( 164, 251 ); + resetButton -> resize( 12, 48 ); + resetButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "reset_active" ) ); + resetButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "reset_inactive" ) ); + toolTip::add( resetButton, tr( "Click here to reset the wavegraph back to default" ) ); + + pixmapButton * smoothButton = new pixmapButton( this, tr("Smooth waveform") ); + smoothButton -> move( 164, 267 ); + smoothButton -> resize( 12, 48 ); + smoothButton -> setActiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_active" ) ); + smoothButton -> setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "smooth_inactive" ) ); + toolTip::add( smoothButton, tr( "Click here to apply smooth to wavegraph" ) ); + + connect( resetButton, SIGNAL (clicked () ), + _controls, SLOT ( resetClicked() ) ); + connect( smoothButton, SIGNAL (clicked () ), + _controls, SLOT ( smoothClicked() ) ); } - diff --git a/plugins/waveshaper/waveshaper_control_dialog.h b/plugins/waveshaper/waveshaper_control_dialog.h index 6fb974ebf..d028ed04e 100644 --- a/plugins/waveshaper/waveshaper_control_dialog.h +++ b/plugins/waveshaper/waveshaper_control_dialog.h @@ -40,6 +40,7 @@ public: { } + private: } ; diff --git a/plugins/waveshaper/waveshaper_controls.cpp b/plugins/waveshaper/waveshaper_controls.cpp index 40c60a895..0a027b93a 100644 --- a/plugins/waveshaper/waveshaper_controls.cpp +++ b/plugins/waveshaper/waveshaper_controls.cpp @@ -29,7 +29,8 @@ #include "waveshaper_controls.h" #include "waveshaper.h" #include "graph.h" - +#include "engine.h" +#include "song.h" waveShaperControls::waveShaperControls( waveShaperEffect * _eff ) : @@ -125,5 +126,19 @@ void waveShaperControls::setDefaultShape() m_wavegraphModel.setSamples( (float*)&shp ); } +void waveShaperControls::resetClicked() +{ + setDefaultShape(); + engine::getSong()->setModified(); +} + +void waveShaperControls::smoothClicked() +{ + m_wavegraphModel.smooth(); + engine::getSong()->setModified(); +} + + + #include "moc_waveshaper_controls.cxx" diff --git a/plugins/waveshaper/waveshaper_controls.h b/plugins/waveshaper/waveshaper_controls.h index e69436b7c..a77c6a2e7 100644 --- a/plugins/waveshaper/waveshaper_controls.h +++ b/plugins/waveshaper/waveshaper_controls.h @@ -67,6 +67,9 @@ private slots: void changeInput(); void changeOutput(); void samplesChanged( int, int ); + + void resetClicked(); + void smoothClicked(); private: waveShaperEffect * m_effect; diff --git a/src/gui/widgets/graph.cpp b/src/gui/widgets/graph.cpp index 9c3877467..d426e3a6b 100644 --- a/src/gui/widgets/graph.cpp +++ b/src/gui/widgets/graph.cpp @@ -558,11 +558,12 @@ void graphModel::smooth() QVector temp = m_samples; // Smoothing - m_samples[0] = ( temp[0] + temp[length()-1] ) * 0.5f; - for ( int i=1; i < length(); i++ ) + m_samples[0] = ( temp[length()-1] + ( temp[0] * 2 ) + temp[1] ) * 0.25f; + for ( int i=1; i < ( length()-1 ); i++ ) { - m_samples[i] = ( temp[i-1] + temp[i] ) * 0.5f; + m_samples[i] = ( temp[i-1] + ( temp[i] * 2 ) + temp[i+1] ) * 0.25f; } + m_samples[length()-1] = ( temp[length()-2] + ( temp[length()-1] * 2 ) + temp[0] ) * 0.25f; emit samplesChanged(0, length()-1); }