Add pitch-bend support to BitInvader, Move smooth button, and some minor coding style corrections

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1669 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-09-21 17:06:31 +00:00
parent 58b90a88d2
commit 424dc3b0e8
3 changed files with 28 additions and 27 deletions

View File

@@ -68,30 +68,20 @@ plugin::descriptor PLUGIN_EXPORT bitinvader_plugin_descriptor =
}
bSynth::bSynth( float * shape, int length, float _pitch, bool _interpolation,
float factor, const sample_rate_t _sample_rate )
bSynth::bSynth( float * _shape, int _length, notePlayHandle * _nph, bool _interpolation,
float _factor, const sample_rate_t _sample_rate ) :
sample_length( _length ),
nph( _nph ),
interpolation( _interpolation),
sample_rate( _sample_rate ),
sample_index( 0 ),
sample_realindex( 0 )
{
interpolation = _interpolation;
// init variables
sample_length = length;
sample_shape = new float[sample_length];
for (int i=0; i < length; i++)
for (int i=0; i < _length; i++)
{
sample_shape[i] = shape[i] * factor;
sample_shape[i] = _shape[i] * _factor;
}
sample_index = 0;
sample_realindex = 0;
sample_step = static_cast<float>( sample_length / ( _sample_rate /
_pitch ) );
}
@@ -102,6 +92,8 @@ bSynth::~bSynth()
sample_t bSynth::nextStringSample( void )
{
float sample_step =
static_cast<float>( sample_length / ( sample_rate / nph->frequency() ) );
// check overflow
@@ -281,7 +273,7 @@ void bitInvader::playNote( notePlayHandle * _n, bool,
_n->m_pluginData = new bSynth(
const_cast<float*>( m_graph.samples() ),
m_graph.length(),
_n->frequency(),
_n,
m_interpolation.value(), factor,
engine::getMixer()->processingSampleRate() );
}
@@ -402,7 +394,7 @@ bitInvaderView::bitInvaderView( instrument * _instrument,
tr( "Click here for a user-defined shape." ) );
smoothBtn = new pixmapButton( this, tr( "Smooth" ) );
smoothBtn->move( 55, 225 );
smoothBtn->move( 35, 200 );
smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"smooth" ) );
smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(

View File

@@ -42,8 +42,9 @@ class bitInvaderView;
class bSynth
{
public:
bSynth( float * sample, int length, float _pitch, bool _interpolation,
float factor, const sample_rate_t _sample_rate );
bSynth( float * sample, int length, notePlayHandle * _nph,
bool _interpolation, float factor,
const sample_rate_t _sample_rate );
virtual ~bSynth();
sample_t nextStringSample();
@@ -52,9 +53,10 @@ public:
private:
int sample_index;
float sample_realindex;
int sample_length;
float* sample_shape;
float sample_step;
notePlayHandle* nph;
const int sample_length;
const sample_rate_t sample_rate;
bool interpolation;