added additional check to avoid segfault

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@505 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-08-04 01:59:23 +00:00
parent 6243edf1ec
commit d0370bb4e9
13 changed files with 61 additions and 0 deletions

View File

@@ -1,5 +1,18 @@
2007-08-04 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/audio_file_processor/audio_file_processor.cpp:
* plugins/bit_invader/bit_invader.cpp:
* plugins/kicker/kicker.cpp:
* plugins/lb302/lb302.cpp:
* plugins/patman/patman.cpp:
* plugins/plucked_string_synth/plucked_string_synth.cpp:
* plugins/polyb302/polyb302.cpp:
* plugins/singerbot/singerbot.cpp:
* plugins/stk/mallets/mallets.cpp:
* plugins/vibed/vibed.cpp:
added check for framesLeftForCurrentPeriod() being zero - fixes
segfault in some cases
* src/tracks/instrument_track.cpp:
- do not simply pass-through _frames-parameter, use
notePlayHandle::framesLeftForCurrentPeriod() if possible

View File

@@ -392,6 +392,10 @@ void audioFileProcessor::setAudioFile( const QString & _audio_file, bool _rename
void audioFileProcessor::playNote( notePlayHandle * _n, bool )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame * buf = new sampleFrame[frames];
if( !_n->m_pluginData )

View File

@@ -702,6 +702,10 @@ void bitInvader::playNote( notePlayHandle * _n, bool )
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame * buf = new sampleFrame[frames];
bSynth * ps = static_cast<bSynth *>( _n->m_pluginData );

View File

@@ -199,6 +199,10 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool )
:
engine::getMixer()->framesPerAudioBuffer();*/
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
const float f1 = m_startFreqKnob->value() + tfp * fdiff / decfr;
const float f2 = m_startFreqKnob->value() + (frames+tfp-1)*fdiff/decfr;

View File

@@ -739,6 +739,10 @@ void lb302Synth::playNote( notePlayHandle * _n, bool )
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame *buf = new sampleFrame[frames];
process(buf, frames);

View File

@@ -360,6 +360,10 @@ void organicInstrument::playNote( notePlayHandle * _n, bool )
)->oscRight;
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame * buf = new sampleFrame[frames];
osc_l->update( buf, frames, 0 );

View File

@@ -214,6 +214,10 @@ QString patmanSynth::nodeName( void ) const
void patmanSynth::playNote( notePlayHandle * _n, bool )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame * buf = new sampleFrame[frames];
if( !_n->m_pluginData )

View File

@@ -144,6 +144,10 @@ void pluckedStringSynth::playNote( notePlayHandle * _n, bool )
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame * buf = new sampleFrame[frames];
pluckSynth * ps = static_cast<pluckSynth *>( _n->m_pluginData );

View File

@@ -552,6 +552,10 @@ void polyb302Synth::playNote( notePlayHandle * _n, bool )
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame * buf = new sampleFrame[frames];
hstate->process( buf, frames, _n->frequency() );

View File

@@ -146,6 +146,10 @@ singerBot::~singerBot()
void singerBot::playNote( notePlayHandle * _n, bool )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
if( !_n->m_pluginData )
{

View File

@@ -442,6 +442,10 @@ void mallets::playNote( notePlayHandle * _n, bool )
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
malletsSynth * ps = static_cast<malletsSynth *>( _n->m_pluginData );
sample_t add_scale = 0.0f;

View File

@@ -687,6 +687,10 @@ void tripleOscillator::playNote( notePlayHandle * _n, bool )
)->oscRight;
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
sampleFrame * buf = new sampleFrame[frames];
osc_l->update( buf, frames, 0 );

View File

@@ -576,6 +576,10 @@ void vibed::playNote( notePlayHandle * _n, bool )
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
if( frames == 0 )
{
return;
}
stringContainer * ps = static_cast<stringContainer *>(
_n->m_pluginData );