added smooth button
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@53 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -95,7 +95,6 @@ bSynth::bSynth(float* shape, int length, float _pitch, bool _interpolation, floa
|
||||
interpolation = _interpolation;
|
||||
|
||||
// init variables
|
||||
// sample_length = static_cast<int>(_val1);
|
||||
|
||||
sample_length = length;
|
||||
sample_shape = new float[sample_length];
|
||||
@@ -223,9 +222,9 @@ bitInvader::bitInvader( channelTrack * _channel_track ) :
|
||||
m_graph->move(55,120);
|
||||
m_graph->setSamplePointer( sample_shape, sample_length );
|
||||
|
||||
QPixmap p = embed::getIconPixmap("wavegraph") ;
|
||||
QPixmap p = PLUGIN_NAME::getIconPixmap("wavegraph") ;
|
||||
|
||||
m_graph->setBackground( &p );
|
||||
m_graph->setBackground( p );
|
||||
|
||||
connect( m_graph, SIGNAL ( sampleSizeChanged( float ) ),
|
||||
this, SLOT (sampleSizeChanged( float ) ) );
|
||||
@@ -296,6 +295,22 @@ bitInvader::bitInvader( channelTrack * _channel_track ) :
|
||||
connect( whiteNoiseWaveBtn, SIGNAL ( clicked ( void ) ),
|
||||
this, SLOT ( noiseWaveClicked( void ) ) );
|
||||
|
||||
|
||||
smoothBtn = new pixmapButton( this );
|
||||
smoothBtn->move( 55, 225 );
|
||||
smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"smooth" ) );
|
||||
smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"smooth" ) );
|
||||
smoothBtn->setChecked( TRUE );
|
||||
toolTip::add( smoothBtn,
|
||||
tr( "Click here to "
|
||||
"smooth waveform." ) );
|
||||
|
||||
connect( smoothBtn, SIGNAL ( clicked ( void ) ),
|
||||
this, SLOT ( smoothClicked( void ) ) );
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
|
||||
@@ -521,6 +536,33 @@ QString bitInvader::nodeName( void ) const
|
||||
}
|
||||
|
||||
|
||||
void bitInvader::smoothClicked( void )
|
||||
{
|
||||
// store values in temporary array
|
||||
float* temp = new float[sample_length];
|
||||
for (int i=0; i < sample_length; i++)
|
||||
{
|
||||
temp[i] = sample_shape[i];
|
||||
}
|
||||
|
||||
|
||||
// Smoothing
|
||||
sample_shape[0] = temp[0]+temp[sample_length-1] * 0.5f;
|
||||
for ( int i=1; i < sample_length; i++)
|
||||
{
|
||||
sample_shape[i] = (temp[i-1] + temp[i]) * 0.5f;
|
||||
}
|
||||
|
||||
|
||||
// Clean up
|
||||
delete[] temp;
|
||||
|
||||
// paint
|
||||
update();
|
||||
m_graph->update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bitInvader::playNote( notePlayHandle * _n )
|
||||
|
||||
@@ -90,8 +90,11 @@ public:
|
||||
public slots:
|
||||
void sampleSizeChanged( float _new_sample_length );
|
||||
void sampleChanged( void );
|
||||
|
||||
void interpolationToggle( bool value );
|
||||
void normalizeToggle( bool value );
|
||||
void smoothClicked( void );
|
||||
|
||||
void sinWaveClicked( void );
|
||||
void triangleWaveClicked( void );
|
||||
void sqrWaveClicked( void );
|
||||
@@ -111,6 +114,7 @@ private:
|
||||
pixmapButton * sqrWaveBtn;
|
||||
pixmapButton * sawWaveBtn;
|
||||
pixmapButton * whiteNoiseWaveBtn;
|
||||
pixmapButton * smoothBtn;
|
||||
|
||||
static QPixmap * s_artwork;
|
||||
|
||||
|
||||
BIN
plugins/bit_invader/smooth.png
Normal file
BIN
plugins/bit_invader/smooth.png
Normal file
Binary file not shown.
Reference in New Issue
Block a user