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

Add all the Qt5 Linux VST implementations #3786

Merged
merged 58 commits into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a81f4ca
Embed VST GUI in subwindow
Jun 17, 2016
878dd94
Embed in a separate window
Oct 2, 2016
ebe63d1
Fixes for Windows builds
Jan 2, 2017
6395cd4
Enable C++11
Jan 3, 2017
e3d3052
Enable C++11 on Windows
Jan 4, 2017
12f6ea5
C++11 is enabled by default now
Jan 24, 2017
f87f363
Use window instead of embedder application
Mar 31, 2017
2d35de4
Debug window ID
Apr 1, 2017
d04fd9f
FluidSynth is currently undistributable
Apr 10, 2017
7a9396d
Let Wine handle the window interface
Apr 10, 2017
47d0e66
Re-enable SF2
tresf Apr 10, 2017
e661d26
Add X11EmbedContainer Qt5 port
lukas-w Apr 1, 2017
adef05f
X11EmbedContainer: Fix XEMBED protocol implementation
lukas-w Apr 8, 2017
f097be6
RemoteVst: Fix flickering when moving window
lukas-w Apr 8, 2017
0e311ff
X11Embed: Remove flag causing embedding to fail
lukas-w Apr 8, 2017
8fdcc6c
Fix compile on Windows
lukas-w Apr 8, 2017
7ce60c2
Travis: Add missing packages
lukas-w Apr 8, 2017
dc4a387
X11EmbedContainer: Don't grab mouse in acceptClient, more debugging msgs
lukas-w Jul 15, 2017
000fe2d
Travis: Fix xcb package name
lukas-w Jul 16, 2017
d9626e9
Move X11EmbedContainer.h to include
lukas-w Jul 19, 2017
def2b7d
Move X11EmbedContainer to submodule
lukas-w Aug 5, 2017
0d3aaf6
.gitmodules: Use https URL
lukas-w Aug 5, 2017
bd33475
Fix x11embed for non qt5+linux
lukas-w Aug 5, 2017
f7dab93
Merge branch 'qt5-vst-2-stable' into fix/qt5-vst
lukas-w Sep 1, 2017
ddab534
Allow switching VST embed method at compile time
lukas-w Sep 1, 2017
e7d0675
Fix Qt4 VST embed option
lukas-w Sep 1, 2017
df37833
Merge branch 'stable-1.2' into fix/qt5-vst
lukas-w Sep 22, 2017
ffa1b63
Fix VST effects embedding
lukas-w Sep 22, 2017
6839746
VstEmbed: Allow selecting method at runtime
lukas-w Nov 6, 2017
415316f
VstEmbed: Remove obsolete CMake flags
lukas-w Nov 6, 2017
134dae8
VstEmbed: Add missing find_package instruction for Qt5X11Extras
lukas-w Nov 6, 2017
472a74d
Minor fixes
lukas-w Nov 6, 2017
e95fdcc
Add missing includes
lukas-w Nov 6, 2017
421a85d
Update qt5-x11embed submodule
lukas-w Nov 6, 2017
e3ba9ba
Update qt5-x11embed submodule for CMake changes
lukas-w Nov 6, 2017
6eb447d
Merge branch 'stable-1.2' into fix/qt5-vst
lukas-w Nov 7, 2017
2b6f366
CMake: Only link qx11embedcontainer on Linux
lukas-w Nov 7, 2017
6fd38fe
Fix qt5-x11embed submodule reference
lukas-w Nov 7, 2017
a8311a7
Vst: Fix widget deletion
lukas-w Nov 10, 2017
f9f4d0c
VstEmbed: Store embed method on plugin start
lukas-w Nov 10, 2017
358a251
VstEmbed: Support changing embed method without restart
lukas-w Nov 10, 2017
df3c07b
Fix Qt4 compatibility
PhysSong Nov 6, 2017
b0f64de
Restrict "qt" embed method to Qt5 only
PhysSong Nov 6, 2017
7da7a70
Add Win32 embedding
PhysSong Nov 7, 2017
463d02e
Move SC_CLOSE handling code
PhysSong Nov 8, 2017
55ce90e
Try to improve embedding method logic
PhysSong Nov 18, 2017
72e882a
Add a fallback logic for VST embedding methods
PhysSong Nov 20, 2017
a8aa3e1
VST: Fix Qt4 compilation
lukas-w Nov 24, 2017
3d47344
Travis: Enable Linux/Qt4 builds
lukas-w Nov 24, 2017
e95e379
Merge pull request #3991 from PhysSong/fix/qt5-vst
lukas-w Nov 24, 2017
23cb385
VstEmbed: Remove obsolete CMake flags
lukas-w Nov 24, 2017
7019cab
Merge branch 'stable-1.2' into fix/qt5-vst
lukas-w Nov 25, 2017
238d6b6
CMake: Fix RemoteVstPlugin build when winebuild is not in PATH
lukas-w Nov 25, 2017
8c02495
Qt4 compat simplified
lukas-w Nov 25, 2017
ae488b8
Fix VstEffect width issue
lukas-w Nov 29, 2017
a446775
VST: Fix Qt-embedded VSTs not always appearing
lukas-w Nov 29, 2017
7ae348e
Vst refactorings
lukas-w Nov 29, 2017
19f4889
VST: Disable plugin reload on embed method change
lukas-w Dec 18, 2017
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/3rdparty/qt5-x11embed"]
path = src/3rdparty/qt5-x11embed
url = https://github.com/Lukas-W/qt5-x11embed.git
6 changes: 4 additions & 2 deletions .travis/linux..install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

PACKAGES="cmake libsndfile-dev fftw3-dev libvorbis-dev libogg-dev libmp3lame-dev
libasound2-dev libjack-dev libsdl-dev libsamplerate0-dev libstk0-dev
libfluidsynth-dev portaudio19-dev wine-dev g++-multilib libfltk1.3-dev
libfluidsynth-dev portaudio19-dev g++-multilib libfltk1.3-dev
libgig-dev libsoundio-dev"

VST_PACKAGES="wine-dev libqt5x11extras5-dev qtbase5-private-dev libxcb-util0-dev libxcb-keysyms1-dev"

# Help with unmet dependencies
PACKAGES="$PACKAGES libjack0"
PACKAGES="$PACKAGES $VST_PACKAGES libjack0"

if [ $QT5 ]; then
PACKAGES="$PACKAGES qtbase5-dev qttools5-dev-tools qttools5-dev"
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ IF(WANT_QT5)
Qt5::Xml
)

IF(LMMS_BUILD_LINUX)
FIND_PACKAGE(Qt5X11Extras REQUIRED)
LIST(APPEND QT_LIBRARIES Qt5::X11Extras)
ENDIF()

FIND_PACKAGE(Qt5Test)
SET(QT_QTTEST_LIBRARY Qt5::Test)
ELSE()
Expand Down
2 changes: 2 additions & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ class EXPORT ConfigManager
return m_recentlyOpenedProjects;
}

QString vstEmbedMethod() const;

// returns true if the working dir (e.g. ~/lmms) exists on disk
bool hasWorkingDir() const;

Expand Down
33 changes: 28 additions & 5 deletions include/RemotePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ class shmFifo
enum RemoteMessageIDs
{
IdUndefined,
IdHostInfoGotten,
IdInitDone,
IdQuit,
IdSampleRateInformation,
Expand All @@ -427,6 +428,8 @@ enum RemoteMessageIDs
IdChangeInputOutputCount,
IdShowUI,
IdHideUI,
IdToggleUI,
IdIsUIVisible,
IdSaveSettingsToString,
IdSaveSettingsToFile,
IdLoadSettingsFromString,
Expand Down Expand Up @@ -768,7 +771,13 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase
#endif
}

bool init( const QString &pluginExecutable, bool waitForInitDoneMsg );
bool init( const QString &pluginExecutable, bool waitForInitDoneMsg, QStringList extraArgs = {} );

inline void waitForHostInfoGotten()
{
m_failed = waitForMessage( IdHostInfoGotten ).id
!= IdHostInfoGotten;
}

inline void waitForInitDone( bool _busyWaiting = true )
{
Expand All @@ -788,18 +797,21 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase
unlock();
}

void showUI()

virtual void toggleUI()
{
lock();
sendMessage( IdShowUI );
sendMessage( IdToggleUI );
unlock();
}

void hideUI()
int isUIVisible()
{
lock();
sendMessage( IdHideUI );
sendMessage( IdIsUIVisible );
unlock();
message m = waitForMessage( IdIsUIVisible );
return m.id != IdIsUIVisible ? -1 : m.getInt() ? 1 : 0;
}

inline bool failed() const
Expand All @@ -817,6 +829,9 @@ class EXPORT RemotePlugin : public QObject, public RemotePluginBase
m_commMutex.unlock();
}

public slots:
virtual void showUI();
virtual void hideUI();

protected:
inline void setSplittedChannels( bool _on )
Expand Down Expand Up @@ -1173,6 +1188,7 @@ RemotePluginClient::RemotePluginClient( const char * socketPath ) :
m_vstSyncData = (VstSyncData *) m_shmQtID.data();
m_bufferSize = m_vstSyncData->m_bufferSize;
m_sampleRate = m_vstSyncData->m_sampleRate;
sendMessage( IdHostInfoGotten );
return;
}
#else
Expand Down Expand Up @@ -1200,6 +1216,7 @@ RemotePluginClient::RemotePluginClient( const char * socketPath ) :
{
m_bufferSize = m_vstSyncData->m_bufferSize;
m_sampleRate = m_vstSyncData->m_sampleRate;
sendMessage( IdHostInfoGotten );

// detach segment
if( shmdt(m_vstSyncData) == -1 )
Expand All @@ -1215,6 +1232,12 @@ RemotePluginClient::RemotePluginClient( const char * socketPath ) :
// if attaching shared memory fails
sendMessage( IdSampleRateInformation );
sendMessage( IdBufferSizeInformation );
if( waitForMessage( IdBufferSizeInformation ).id
!= IdBufferSizeInformation )
{
fprintf( stderr, "Could not get buffer size information\n" );
}
sendMessage( IdHostInfoGotten );
}


Expand Down
3 changes: 2 additions & 1 deletion include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ private slots:
MswMap m_midiIfaceSetupWidgets;
trMap m_midiIfaceNames;


QComboBox* m_vstEmbedComboBox;
QString m_vstEmbedMethod;
} ;


Expand Down
70 changes: 55 additions & 15 deletions plugins/VstEffect/VstEffectControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "VstEffectControlDialog.h"
#include "VstEffect.h"

#include "ConfigManager.h"
#include "PixmapButton.h"
#include "embed.h"
#include "ToolTip.h"
Expand All @@ -52,32 +53,43 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
l->setVerticalSpacing( 2 );
l->setHorizontalSpacing( 2 );

bool embed_vst = ConfigManager::inst()->vstEmbedMethod() != "none";

if( _ctl != NULL && _ctl->m_effect != NULL &&
_ctl->m_effect->m_plugin != NULL )
{
m_plugin = _ctl->m_effect->m_plugin;
m_plugin->showEditor( NULL, true );
m_pluginWidget = m_plugin->pluginWidget();

if (embed_vst) {
m_plugin->createUI( nullptr, true );
m_pluginWidget = m_plugin->pluginWidget( false );

#ifdef LMMS_BUILD_WIN32
if( !m_pluginWidget )
{
m_pluginWidget = m_plugin->pluginWidget( false );
}
#endif

if( !m_pluginWidget )
{
m_pluginWidget = m_plugin->pluginWidget( false );
}
#endif
}

if( m_pluginWidget )
if ( m_plugin && (!embed_vst || m_pluginWidget) )
{
setWindowTitle( m_pluginWidget->windowTitle() );
setWindowTitle( m_plugin->name() );
setMinimumWidth( 250 );

QPushButton * btn = new QPushButton( tr( "Show/hide" ) );
btn->setCheckable( true );
connect( btn, SIGNAL( toggled( bool ) ),
m_pluginWidget, SLOT( setVisible( bool ) ) );
emit btn->click();

if (embed_vst) {
btn->setCheckable( true );
btn->setChecked( true );
connect( btn, SIGNAL( toggled( bool ) ),
SLOT( togglePluginUI( bool ) ) );
} else {
connect( btn, SIGNAL( clicked( bool ) ),
SLOT( togglePluginUI( bool ) ) );
}

btn->setMinimumWidth( 78 );
btn->setMaximumWidth( 78 );
Expand Down Expand Up @@ -206,8 +218,15 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
m_savePresetButton->setMinimumHeight( 21 );
m_savePresetButton->setMaximumHeight( 21 );

int newSize = m_pluginWidget->width() + 20;
newSize = (newSize < 250) ? 250 : newSize;
int newSize;

if (embed_vst) {
newSize = m_pluginWidget->width() + 20;
newSize = (newSize < 250) ? 250 : newSize;
} else {
newSize = 250;
}

QWidget* resize = new QWidget(this);
resize->resize( newSize, 10 );
QWidget* space0 = new QWidget(this);
Expand All @@ -219,7 +238,9 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
l->addItem( new QSpacerItem( newSize - 20, 30, QSizePolicy::Fixed,
QSizePolicy::Fixed ), 1, 0 );
l->addWidget( resize, 2, 0, 1, 1, Qt::AlignCenter );
l->addWidget( m_pluginWidget, 3, 0, 1, 1, Qt::AlignCenter );
if (embed_vst) {
l->addWidget( m_pluginWidget, 3, 0, 1, 1, Qt::AlignCenter );
}
l->setRowStretch( 5, 1 );
l->setColumnStretch( 1, 1 );

Expand Down Expand Up @@ -264,3 +285,22 @@ VstEffectControlDialog::~VstEffectControlDialog()
//delete m_pluginWidget;
}




void VstEffectControlDialog::togglePluginUI( bool checked )
{
if( !m_plugin ) {
return;
}

if( ConfigManager::inst()->vstEmbedMethod() != "none" )
{
m_pluginWidget->setVisible( checked );
}
else
{
m_plugin->toggleUI();
}
}

3 changes: 3 additions & 0 deletions plugins/VstEffect/VstEffectControlDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class VstEffectControlDialog : public EffectControlDialog
VstPlugin * m_plugin;

QLabel * tbLabel;

private slots:
void togglePluginUI( bool checked );
} ;

#endif
7 changes: 7 additions & 0 deletions plugins/vestige/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
IF(LMMS_EMBED_VST)
ADD_DEFINITIONS(-DLMMS_EMBED_VST)
IF(LMMS_EMBED_VST_X11)
ADD_DEFINITIONS(-DLMMS_EMBED_VST_X11)
ENDIF()
ENDIF()

IF(LMMS_SUPPORT_VST)
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../vst_base")
Expand Down
16 changes: 2 additions & 14 deletions plugins/vestige/vestige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void vestigeInstrument::loadFile( const QString & _file )
return;
}

m_plugin->showEditor( NULL, false );
m_plugin->showUI();

if( set_ch_name )
{
Expand Down Expand Up @@ -739,19 +739,7 @@ void VestigeInstrumentView::toggleGUI( void )
{
return;
}
QWidget * w = m_vi->m_plugin->pluginWidget();
if( w == NULL )
{
return;
}
if( w->isHidden() )
{
w->show();
}
else
{
w->hide();
}
m_vi->m_plugin->toggleUI();
}


Expand Down
27 changes: 19 additions & 8 deletions plugins/vst_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ SET(REMOTE_VST_PLUGIN_FILEPATH "RemoteVstPlugin" CACHE STRING "Relative file pat

ADD_DEFINITIONS(-DREMOTE_VST_PLUGIN_FILEPATH="${REMOTE_VST_PLUGIN_FILEPATH}")
BUILD_PLUGIN(vstbase vst_base.cpp VstPlugin.cpp VstPlugin.h communication.h MOCFILES VstPlugin.h)
TARGET_LINK_LIBRARIES(vstbase qx11embedcontainer)

IF(LMMS_BUILD_LINUX AND NOT WANT_VST_NOWINE)

Expand All @@ -48,15 +49,25 @@ ENDIF(LMMS_HOST_X86_64)
SET(WINE_CXX_FLAGS "" CACHE STRING "Extra flags passed to wineg++")

STRING(REPLACE " " ";" WINE_BUILD_FLAGS ${CMAKE_CXX_FLAGS} " " ${CMAKE_EXE_LINKER_FLAGS} " " ${WINE_CXX_FLAGS})

ADD_CUSTOM_COMMAND(
SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp"
COMMAND ${WINE_CXX}
ARGS -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_INSTALL_PREFIX}/include/wine/windows -I${CMAKE_INSTALL_PREFIX}/include -I/usr/include/wine/windows ${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp -ansi -mwindows -lpthread ${EXTRA_FLAGS} -fno-omit-frame-pointer ${WINE_BUILD_FLAGS} -o ../RemoteVstPlugin
# Ensure correct file extension
COMMAND sh -c "mv ../RemoteVstPlugin.exe ../RemoteVstPlugin || true"
TARGET vstbase
OUTPUTS ../RemoteVstPlugin
)
SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp"
COMMAND ${WINE_CXX}
ARGS -I${CMAKE_BINARY_DIR}
-I${CMAKE_SOURCE_DIR}/include
-I${CMAKE_INSTALL_PREFIX}/include/wine/windows
-I${CMAKE_INSTALL_PREFIX}/include
-I${WINE_INCLUDE_BASE_DIR}
-L${WINE_LIBRARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/RemoteVstPlugin.cpp
-std=c++0x
-mwindows -lpthread ${EXTRA_FLAGS} -fno-omit-frame-pointer
${WINE_BUILD_FLAGS}
-o ../RemoteVstPlugin
COMMAND sh -c "mv ../RemoteVstPlugin.exe ../RemoteVstPlugin || true"
TARGET vstbase
OUTPUTS ../RemoteVstPlugin
)

SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ../RemoteVstPlugin.exe.so)
INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin" "${CMAKE_CURRENT_BINARY_DIR}/../RemoteVstPlugin.exe.so" DESTINATION "${PLUGIN_DIR}")
Expand Down
Loading