VstEmbed: Store embed method on plugin start

Avoids bugs when embed method is changed in setup dialog while VSTs are
running.
This commit is contained in:
Lukas W
2017-11-10 08:12:20 +01:00
parent a8311a7b49
commit f9f4d0cb9c
3 changed files with 21 additions and 23 deletions

View File

@@ -53,12 +53,13 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
l->setVerticalSpacing( 2 );
l->setHorizontalSpacing( 2 );
bool embed_vst = ConfigManager::inst()->vstEmbedMethod() != "none";
bool embed_vst = false;
if( _ctl != NULL && _ctl->m_effect != NULL &&
_ctl->m_effect->m_plugin != NULL )
{
m_plugin = _ctl->m_effect->m_plugin;
embed_vst = m_plugin->embedMethod() != "none";
if (embed_vst) {
m_plugin->createUI( nullptr, true );

View File

@@ -85,21 +85,12 @@ public:
VstPlugin::VstPlugin( const QString & _plugin ) :
RemotePlugin(),
JournallingObject(),
m_plugin( _plugin ),
m_pluginWidget( NULL ),
m_pluginWindowID( 0 ),
m_embedMethod( ConfigManager::inst()->vstEmbedMethod() ),
m_badDllFormat( false ),
m_name(),
m_version( 0 ),
m_vendorString(),
m_productString(),
m_currentProgramName(),
m_allProgramNames(),
p_name(),
m_currentProgram(),
m_idleTimer()
m_currentProgram()
{
setSplittedChannels( true );
@@ -139,7 +130,7 @@ VstPlugin::~VstPlugin()
void VstPlugin::tryLoad( const QString &remoteVstPluginExecutable )
{
init( remoteVstPluginExecutable, false, {ConfigManager::inst()->vstEmbedMethod()} );
init( remoteVstPluginExecutable, false, {m_embedMethod} );
waitForHostInfoGotten();
if( failed() )
@@ -246,7 +237,7 @@ void VstPlugin::loadSettings( const QDomElement & _this )
void VstPlugin::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
if ( ConfigManager::inst()->vstEmbedMethod() != "none" )
if ( m_embedMethod != "none" )
{
if( pluginWidget() != NULL )
{
@@ -286,7 +277,7 @@ void VstPlugin::saveSettings( QDomDocument & _doc, QDomElement & _this )
void VstPlugin::toggleUI()
{
if ( ConfigManager::inst()->vstEmbedMethod() == "none" )
if ( m_embedMethod == "none" )
{
RemotePlugin::toggleUI();
}
@@ -369,7 +360,7 @@ void VstPlugin::setParameterDump( const QMap<QString, QString> & _pdump )
QWidget *VstPlugin::pluginWidget(bool _top_widget)
{
if ( ConfigManager::inst()->vstEmbedMethod() != "none" )
if ( m_embedMethod != "none" )
{
if( _top_widget && m_pluginWidget )
{
@@ -576,8 +567,7 @@ void VstPlugin::idleUpdate()
void VstPlugin::showUI()
{
QString embedMethod = ConfigManager::inst()->vstEmbedMethod();
if ( embedMethod == "none" )
if ( m_embedMethod == "none" )
{
RemotePlugin::showUI();
}
@@ -598,7 +588,7 @@ void VstPlugin::showUI()
void VstPlugin::hideUI()
{
RemotePlugin::hideUI();
if ( ConfigManager::inst()->vstEmbedMethod() == "none" )
if ( m_embedMethod == "none" )
{
}
else if ( pluginWidget() != nullptr )
@@ -669,8 +659,7 @@ void VstPlugin::createUI( QWidget * parent, bool isEffect )
m_pluginSubWindow = new vstSubWin( gui->mainWindow()->workspace() );
auto sw = m_pluginSubWindow.data();
QString embedMethod = ConfigManager::inst()->vstEmbedMethod();
if (embedMethod == "qt" )
if (m_embedMethod == "qt" )
{
QWindow* vw = QWindow::fromWinId(m_pluginWindowID);
container = QWidget::createWindowContainer(vw, sw );
@@ -680,7 +669,7 @@ void VstPlugin::createUI( QWidget * parent, bool isEffect )
// Wait for remote reply
}
#ifdef LMMS_BUILD_LINUX
else if (embedMethod == "xembed" )
else if (m_embedMethod == "xembed" )
{
QX11EmbedContainer * embedContainer = new QX11EmbedContainer( sw );
connect(embedContainer, SIGNAL(clientIsEmbedded()), this, SLOT(handleClientEmbed()));
@@ -690,7 +679,7 @@ void VstPlugin::createUI( QWidget * parent, bool isEffect )
#endif
else
{
qCritical() << "Unknown embed method" << embedMethod;
qCritical() << "Unknown embed method" << m_embedMethod;
delete m_pluginSubWindow;
return;
}
@@ -718,6 +707,11 @@ void VstPlugin::createUI( QWidget * parent, bool isEffect )
container->setFixedSize( m_pluginGeometry );
}
QString VstPlugin::embedMethod() const
{
return m_embedMethod;
}

View File

@@ -107,6 +107,8 @@ public:
void createUI( QWidget *parent, bool isEffect );
QString embedMethod() const;
public slots:
void setTempo( bpm_t _bpm );
void updateSampleRate();
@@ -132,6 +134,7 @@ private:
QPointer<vstSubWin> m_pluginSubWindow;
int m_pluginWindowID;
QSize m_pluginGeometry;
const QString m_embedMethod;
bool m_badDllFormat;