InstrumentPlayHandle: do not process if InstrumentTrack is muted

While regular instruments were excluded from processing when muted
this did not happen for InstrumentPlayHandle-based instruments. Muting
for exampling tracks with VSTi's inside did not decrease CPU usage.
Checking whether related InstrumentTrack is muted before calling
Instrument::play() fixes this issue.

Closes #2857426.
(cherry picked from commit 6940d19969)
This commit is contained in:
Tobias Doerffel
2009-09-15 10:10:02 +02:00
parent 3c9dd294dc
commit f7da4a0f7e
8 changed files with 41 additions and 22 deletions

View File

@@ -31,7 +31,7 @@
#include "lb302.h"
#include "automatable_button.h"
#include "engine.h"
#include "instrument_play_handle.h"
#include "InstrumentPlayHandle.h"
#include "InstrumentTrack.h"
#include "knob.h"
#include "note_play_handle.h"

View File

@@ -33,7 +33,7 @@
#include "lb303.h"
#include "engine.h"
#include "instrument_play_handle.h"
#include "InstrumentPlayHandle.h"
#include "InstrumentTrack.h"
#include "knob.h"
#include "note_play_handle.h"

View File

@@ -33,7 +33,7 @@
#include "sf2_player.h"
#include "engine.h"
#include "InstrumentTrack.h"
#include "instrument_play_handle.h"
#include "InstrumentPlayHandle.h"
#include "note_play_handle.h"
#include "knob.h"
#include "song.h"

View File

@@ -33,7 +33,7 @@
#include "engine.h"
#include "gui_templates.h"
#include "instrument_play_handle.h"
#include "InstrumentPlayHandle.h"
#include "InstrumentTrack.h"
#include "VstPlugin.h"
#include "pixmap_button.h"
@@ -202,12 +202,15 @@ void vestigeInstrument::play( sampleFrame * _buf )
bool vestigeInstrument::handleMidiEvent( const midiEvent & _me,
const midiTime & _time )
{
m_pluginMutex.lock();
if( m_plugin != NULL )
if( !isMuted() )
{
m_plugin->processMidiEvent( _me, _time );
m_pluginMutex.lock();
if( m_plugin != NULL )
{
m_plugin->processMidiEvent( _me, _time );
}
m_pluginMutex.unlock();
}
m_pluginMutex.unlock();
return true;
}

View File

@@ -32,7 +32,7 @@
#include "ZynAddSubFx.h"
#include "engine.h"
#include "mmp.h"
#include "instrument_play_handle.h"
#include "InstrumentPlayHandle.h"
#include "InstrumentTrack.h"
#include "gui_templates.h"
#include "string_pair_drag.h"
@@ -232,16 +232,19 @@ void ZynAddSubFxInstrument::play( sampleFrame * _buf )
bool ZynAddSubFxInstrument::handleMidiEvent( const midiEvent & _me,
const midiTime & _time )
{
m_pluginMutex.lock();
if( m_remotePlugin )
if( !isMuted() )
{
m_remotePlugin->processMidiEvent( _me, 0 );
m_pluginMutex.lock();
if( m_remotePlugin )
{
m_remotePlugin->processMidiEvent( _me, 0 );
}
else
{
m_plugin->processMidiEvent( _me );
}
m_pluginMutex.unlock();
}
else
{
m_plugin->processMidiEvent( _me );
}
m_pluginMutex.unlock();
return true;
}