Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tryLock in audio threads for VST/ZynAddSubFX #4460

Merged
merged 2 commits into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions plugins/VstEffect/VstEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ bool VstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
sampleFrame * buf = new sampleFrame[_frames];
#endif
memcpy( buf, _buf, sizeof( sampleFrame ) * _frames );
m_pluginMutex.lock();
m_plugin->process( buf, buf );
m_pluginMutex.unlock();
if (m_pluginMutex.tryLock())
{
m_plugin->process( buf, buf );
m_pluginMutex.unlock();
}

double out_sum = 0.0;
const float w = wetLevel();
Expand Down
4 changes: 1 addition & 3 deletions plugins/vestige/vestige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,12 @@ void vestigeInstrument::loadFile( const QString & _file )

void vestigeInstrument::play( sampleFrame * _buf )
{
m_pluginMutex.lock();
if (!m_pluginMutex.tryLock()) {return;}

const fpp_t frames = Engine::mixer()->framesPerPeriod();

if( m_plugin == NULL )
{
BufferManager::clear( _buf, frames );

m_pluginMutex.unlock();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/zynaddsubfx/ZynAddSubFx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ QString ZynAddSubFxInstrument::nodeName() const

void ZynAddSubFxInstrument::play( sampleFrame * _buf )
{
m_pluginMutex.lock();
if (!m_pluginMutex.tryLock()) {return;}
if( m_remotePlugin )
{
m_remotePlugin->process( NULL, _buf );
Expand Down