Skip to content

Commit

Permalink
Enable vst qt6 (#7)
Browse files Browse the repository at this point in the history
Enable vst on linux qt 6 and disable x11 embedding
---------

Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
Co-authored-by: Michael Gregorius <michael.gregorius.git@arcor.de>
Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
Co-authored-by: Rossmaxx <mrroshan127@gmail.com>
Co-authored-by: Bimal Poudel <anytizer@users.noreply.github.com>
Co-authored-by: saker <sakertooth@gmail.com>
Co-authored-by: Pascal <81458575+khoidauminh@users.noreply.github.com>
  • Loading branch information
9 people authored May 20, 2024
1 parent d43f4e2 commit 51c0a45
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ IF(WANT_QT6)
MESSAGE("Building with Qt6 is experimental, not guaranteed to succeed")
SET(QT_VERSION_MAJOR 6)
SET(LMMS_QT_MIN_VERSION 6.0.0)
SET(WANT_VST OFF)
SET(STATUS_VST "VSTs not supported with Qt 6")
SET(STATUS_QT6 "ENABLED")
ELSE()
SET(QT_VERSION_MAJOR 5)
Expand Down Expand Up @@ -210,8 +208,7 @@ IF(WANT_QT6)
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt6::Core5Compat)
ENDIF()

IF(LMMS_BUILD_LINUX AND WANT_VST)
# Todo, enable qt6 for vst support
IF(LMMS_BUILD_LINUX AND WANT_VST AND NOT WANT_QT6)
FIND_PACKAGE(Qt5 COMPONENTS X11Extras REQUIRED)
LIST(APPEND QT_LIBRARIES Qt5::X11Extras)
ENDIF()
Expand Down
2 changes: 0 additions & 2 deletions cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)

IF(WANT_QT6)
QT6_WRAP_CPP(plugin_MOC_out ${PLUGIN_MOCFILES})
QT6_WRAP_UI(plugin_UIC_out ${PLUGIN_UICFILES})
ELSE()
QT5_WRAP_CPP(plugin_MOC_out ${PLUGIN_MOCFILES})
QT5_WRAP_UI(plugin_UIC_out ${PLUGIN_UICFILES})
ENDIF()

FOREACH(f ${PLUGIN_SOURCES})
Expand Down
7 changes: 4 additions & 3 deletions plugins/VstBase/VstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
#include <QLocale>
#include <QTemporaryFile>

#ifdef LMMS_BUILD_LINUX
#if defined(LMMS_BUILD_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6,0,0))
// x11 embedding is currently unsupported on qt6
# include <QX11Info>
# include "X11EmbedContainer.h"
#endif
Expand Down Expand Up @@ -416,7 +417,7 @@ bool VstPlugin::processMessage( const message & _m )
(LONG_PTR) gui::getGUI()->mainWindow()->winId() );
#endif

#ifdef LMMS_BUILD_LINUX
#if defined(LMMS_BUILD_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6,0,0))
XSetTransientForHint( QX11Info::display(),
m_pluginWindowID,
gui::getGUI()->mainWindow()->winId() );
Expand Down Expand Up @@ -773,7 +774,7 @@ void VstPlugin::createUI( QWidget * parent )
} else
#endif

#ifdef LMMS_BUILD_LINUX
#if defined(LMMS_BUILD_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6,0,0))
if (m_embedMethod == "xembed" )
{
if (parent)
Expand Down
2 changes: 1 addition & 1 deletion plugins/VstBase/vstbase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ TARGET_INCLUDE_DIRECTORIES(vstbase
PUBLIC ../
)

IF(LMMS_BUILD_LINUX)
IF(LMMS_BUILD_LINUX AND NOT WANT_QT6)
TARGET_LINK_LIBRARIES(vstbase qx11embedcontainer)
ENDIF()
2 changes: 1 addition & 1 deletion src/3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if(LMMS_BUILD_LINUX AND LMMS_HAVE_VST)
if(LMMS_BUILD_LINUX AND LMMS_HAVE_VST AND NOT WANT_QT6)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(qt5-x11embed)
ENDIF()
Expand Down
2 changes: 1 addition & 1 deletion src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ QStringList ConfigManager::availableVstEmbedMethods()
#ifdef LMMS_BUILD_WIN32
methods.append("win32");
#endif
#ifdef LMMS_BUILD_LINUX
#if defined(LMMS_BUILD_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6,0,0))
if (static_cast<QGuiApplication*>(QApplication::instance())->
platformName() == "xcb")
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/Sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ void Sample::setAllPointFrames(int startFrame, int endFrame, int loopStartFrame,

void Sample::playRaw(sampleFrame* dst, size_t numFrames, const PlaybackState* state, Loop loopMode) const
{
if (m_buffer->size() < 1) { return; }

auto index = state->m_frameIndex;
auto backwards = state->m_backwards;

Expand Down
8 changes: 4 additions & 4 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4905,7 +4905,7 @@ PianoRollWindow::PianoRollWindow() :

m_quantizeComboBox = new ComboBox( m_toolBar );
m_quantizeComboBox->setModel( &m_editor->m_quantizeModel );
m_quantizeComboBox->setFixedSize( 64, ComboBox::DEFAULT_HEIGHT );
m_quantizeComboBox->setFixedSize(85, ComboBox::DEFAULT_HEIGHT);
m_quantizeComboBox->setToolTip( tr( "Quantization") );

// setup note-len-stuff
Expand All @@ -4929,7 +4929,7 @@ PianoRollWindow::PianoRollWindow() :

m_scaleComboBox = new ComboBox( m_toolBar );
m_scaleComboBox->setModel( &m_editor->m_scaleModel );
m_scaleComboBox->setFixedSize( 105, ComboBox::DEFAULT_HEIGHT );
m_scaleComboBox->setFixedSize(155, ComboBox::DEFAULT_HEIGHT);
m_scaleComboBox->setToolTip( tr( "Scale") );

// setup chord-stuff
Expand All @@ -4938,7 +4938,7 @@ PianoRollWindow::PianoRollWindow() :

m_chordComboBox = new ComboBox( m_toolBar );
m_chordComboBox->setModel( &m_editor->m_chordModel );
m_chordComboBox->setFixedSize( 105, ComboBox::DEFAULT_HEIGHT );
m_chordComboBox->setFixedSize(125, ComboBox::DEFAULT_HEIGHT);
m_chordComboBox->setToolTip( tr( "Chord" ) );

// setup snap-stuff
Expand All @@ -4947,7 +4947,7 @@ PianoRollWindow::PianoRollWindow() :

m_snapComboBox = new ComboBox(m_toolBar);
m_snapComboBox->setModel(&m_editor->m_snapModel);
m_snapComboBox->setFixedSize(105, ComboBox::DEFAULT_HEIGHT);
m_snapComboBox->setFixedSize(96, ComboBox::DEFAULT_HEIGHT);
m_snapComboBox->setToolTip(tr("Snap mode"));

// -- Clear ghost MIDI clip button
Expand Down
11 changes: 10 additions & 1 deletion src/gui/embed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ namespace {

auto loadPixmap(const QString& name, int width, int height, const char* const* xpm) -> QPixmap
{
if (xpm) { return QPixmap{xpm}; }
if (xpm) { return QPixmap{xpm}; }
QString cacheName;
if (width > 0 && height > 0)
{
cacheName = QString("%1_%2_%3").arg(pixmapName).arg(width).arg(height);
}
else
{
cacheName = pixmapName;
}

const auto resourceName = QDir::isAbsolutePath(name) ? name : "artwork:" + name;
auto reader = QImageReader{resourceName};
Expand Down

0 comments on commit 51c0a45

Please sign in to comment.