VstEmbed: Support changing embed method without restart

This commit is contained in:
Lukas W
2017-11-10 09:18:40 +01:00
parent f9f4d0cb9c
commit 358a251cff
6 changed files with 48 additions and 22 deletions

View File

@@ -32,6 +32,7 @@
#include <QMenu>
#include <QDomElement>
#include "ConfigManager.h"
#include "BufferManager.h"
#include "Engine.h"
#include "gui_templates.h"
@@ -89,6 +90,10 @@ vestigeInstrument::vestigeInstrument( InstrumentTrack * _instrument_track ) :
// now we need a play-handle which cares for calling play()
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
connect( ConfigManager::inst(), SIGNAL( valueChanged(QString,QString,QString) ),
this, SLOT( handleConfigChange(QString, QString, QString) ),
Qt::QueuedConnection );
}
@@ -170,6 +175,20 @@ void vestigeInstrument::setParameter( void )
}
}
void vestigeInstrument::handleConfigChange(QString cls, QString attr, QString value)
{
if ( cls == "ui" && attr == "vstembedmethod" )
{
reloadPlugin();
}
}
void vestigeInstrument::reloadPlugin()
{
closePlugin();
loadFile( m_pluginDLL );
}
@@ -366,10 +385,6 @@ void vestigeInstrument::closePlugin( void )
}
m_pluginMutex.lock();
if( m_plugin )
{
delete m_plugin->pluginWidget();
}
delete m_plugin;
m_plugin = NULL;
m_pluginMutex.unlock();

View File

@@ -74,6 +74,8 @@ public:
protected slots:
void setParameter( void );
void handleConfigChange( QString cls, QString attr, QString value );
void reloadPlugin();
private:
void closePlugin( void );

View File

@@ -587,9 +587,9 @@ void VstPlugin::showUI()
void VstPlugin::hideUI()
{
RemotePlugin::hideUI();
if ( m_embedMethod == "none" )
{
RemotePlugin::hideUI();
}
else if ( pluginWidget() != nullptr )
{