protect critical section when creating STK-synths as STK is not thread-safe (closes #2005888)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1283 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
2008-07-05 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/stk/mallets/mallets.cpp:
|
||||
protect critical section when creating STK-synths as STK is not
|
||||
thread-safe (closes #2005888)
|
||||
|
||||
* include/instrument_track.h:
|
||||
* src/tracks/instrument_track.cpp:
|
||||
- set hand-cursor for instrument-track-window button
|
||||
|
||||
@@ -204,47 +204,51 @@ void malletsInstrument::playNote( notePlayHandle * _n, bool,
|
||||
const float freq = _n->frequency();
|
||||
if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )
|
||||
{
|
||||
float vel = static_cast<float>( _n->getVolume() ) / 100.0f;
|
||||
|
||||
const float vel = _n->getVolume() / 100.0f;
|
||||
|
||||
// critical section as STK is not thread-safe
|
||||
static QMutex m;
|
||||
m.lock();
|
||||
if( p < 9 )
|
||||
{
|
||||
_n->m_pluginData = new malletsSynth( freq,
|
||||
vel,
|
||||
m_vibratoGainModel.value(),
|
||||
m_hardnessModel.value(),
|
||||
m_positionModel.value(),
|
||||
m_stickModel.value(),
|
||||
m_vibratoFreqModel.value(),
|
||||
p,
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
vel,
|
||||
m_vibratoGainModel.value(),
|
||||
m_hardnessModel.value(),
|
||||
m_positionModel.value(),
|
||||
m_stickModel.value(),
|
||||
m_vibratoFreqModel.value(),
|
||||
p,
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
else if( p == 9 )
|
||||
{
|
||||
_n->m_pluginData = new malletsSynth( freq,
|
||||
vel,
|
||||
p,
|
||||
m_lfoDepthModel.value(),
|
||||
m_modulatorModel.value(),
|
||||
m_crossfadeModel.value(),
|
||||
m_lfoSpeedModel.value(),
|
||||
m_adsrModel.value(),
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
vel,
|
||||
p,
|
||||
m_lfoDepthModel.value(),
|
||||
m_modulatorModel.value(),
|
||||
m_crossfadeModel.value(),
|
||||
m_lfoSpeedModel.value(),
|
||||
m_adsrModel.value(),
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
else
|
||||
{
|
||||
_n->m_pluginData = new malletsSynth( freq,
|
||||
vel,
|
||||
m_pressureModel.value(),
|
||||
m_motionModel.value(),
|
||||
m_vibratoModel.value(),
|
||||
p - 10,
|
||||
m_strikeModel.value() * 128.0,
|
||||
m_velocityModel.value(),
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
vel,
|
||||
m_pressureModel.value(),
|
||||
m_motionModel.value(),
|
||||
m_vibratoModel.value(),
|
||||
p - 10,
|
||||
m_strikeModel.value() * 128.0,
|
||||
m_velocityModel.value(),
|
||||
(Uint8) m_spreadModel.value(),
|
||||
engine::getMixer()->processingSampleRate() );
|
||||
}
|
||||
m.unlock();
|
||||
}
|
||||
|
||||
const fpp_t frames = _n->framesLeftForCurrentPeriod();
|
||||
|
||||
Reference in New Issue
Block a user