Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
ENDIF(LMMS_BUILD_APPLE)
IF(LMMS_BUILD_WIN32)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "")
ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_NAME}.dll)
ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} $<TARGET_FILE:${PLUGIN_NAME}>)
ENDIF(LMMS_BUILD_WIN32)

SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ER_H} ${plugin_MOC_out}")
Expand Down
6 changes: 0 additions & 6 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ class EXPORT ConfigManager
return m_sf2Dir;
}

const QString & pluginDir() const
{
return m_pluginDir;
}

const QString & vstDir() const
{
return m_vstDir;
Expand Down Expand Up @@ -257,7 +252,6 @@ class EXPORT ConfigManager
QString m_workingDir;
QString m_dataDir;
QString m_artworkDir;
QString m_pluginDir;
QString m_vstDir;
QString m_flDir;
QString m_ladDir;
Expand Down
1 change: 0 additions & 1 deletion include/EffectSelectDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ protected slots:
private:
Ui::EffectSelectDialog * ui;

Plugin::DescriptorList m_pluginDescriptors;
EffectKeyList m_effectKeys;
EffectKey m_currentSelection;

Expand Down
11 changes: 2 additions & 9 deletions include/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class EXPORT Engine : public QObject
static void init();
static void destroy();

// TODO: Remove me. Replace calls like `if( Engine::hasGUI() )` with
// `if (gui)` (gui defined in "GuiApplication.h"
static bool hasGUI();

// core
Expand Down Expand Up @@ -93,11 +95,6 @@ class EXPORT Engine : public QObject
}
static void updateFramesPerTick();

static const QMap<QString, QString> & pluginFileHandling()
{
return s_pluginFileHandling;
}

static inline Engine * inst()
{
if( s_instanceOfMe == NULL )
Expand Down Expand Up @@ -134,13 +131,9 @@ class EXPORT Engine : public QObject

static Ladspa2LMMS * s_ladspaManager;

static QMap<QString, QString> s_pluginFileHandling;

// even though most methods are static, an instance is needed for Qt slots/signals
static Engine * s_instanceOfMe;

static void initPluginFileHandling();

friend class GuiApplication;
};

Expand Down
6 changes: 1 addition & 5 deletions include/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ class EXPORT Plugin : public Model, public JournallingObject
SubPluginFeatures * subPluginFeatures;

} ;

// typedef a list so we can easily work with list of plugin descriptors
typedef QList<Descriptor> DescriptorList;
typedef QList<Descriptor*> DescriptorList;

// contructor of a plugin
Plugin( const Descriptor * descriptor, Model * parent );
Expand Down Expand Up @@ -177,9 +176,6 @@ class EXPORT Plugin : public Model, public JournallingObject
// if specified plugin couldn't be loaded, it creates a dummy-plugin
static Plugin * instantiate( const QString& pluginName, Model * parent, void * data );

// fills given list with descriptors of all available plugins
static void getDescriptorsOfAvailPlugins( DescriptorList & pluginDescriptors );

// create a view for the model
PluginView * createView( QWidget * parent );

Expand Down
3 changes: 0 additions & 3 deletions include/PluginBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ class PluginDescList : public QWidget
Q_OBJECT
public:
PluginDescList(QWidget* parent);

private:
Plugin::DescriptorList m_pluginDescriptors;
};


Expand Down
92 changes: 92 additions & 0 deletions include/PluginFactory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* PluginFactory.h
*
* Copyright (c) 2015 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#ifndef PLUGINFACTORY_H
#define PLUGINFACTORY_H

#include <QtCore/QFileInfo>
#include <QtCore/QList>

#include "export.h"
#include "Plugin.h"

class QLibrary;

class EXPORT PluginFactory
{
public:
struct PluginInfo
{
PluginInfo() : library(nullptr), descriptor(nullptr) {}
const QString name() const;
QFileInfo file;
QLibrary* library;
Plugin::Descriptor* descriptor;

bool isNull() const {return library == 0;}
};
typedef QList<PluginInfo*> PluginInfoList;
typedef QMultiMap<Plugin::PluginTypes, Plugin::Descriptor*> DescriptorMap;

PluginFactory();
~PluginFactory();

/// Returns the singleton instance of PluginFactory. You won't need to call
/// this directly, use pluginFactory instead.
static PluginFactory* instance();

/// Returns a list of all found plugins' descriptors.
const Plugin::DescriptorList descriptors() const;
const Plugin::DescriptorList descriptors(Plugin::PluginTypes type) const;

/// Returns a list of all found plugins' PluginFactory::PluginInfo objects.
const PluginInfoList& pluginInfos() const;
/// Returns a plugin that support the given file extension
const PluginInfo pluginSupportingExtension(const QString& ext);

/// Returns the PluginInfo object of the plugin with the given name.
/// If the plugin is not found, an empty PluginInfo is returned (use
/// PluginInfo::isNull() to check this).
const PluginInfo pluginInfo(const char* name) const;

/// When loading a library fails during discovery, the error string is saved.
/// It can be retrieved by calling this function.
QString errorString(QString pluginName) const;

public slots:
void discoverPlugins();

private:
DescriptorMap m_descriptors;
PluginInfoList m_pluginInfos;
QMap<QString, PluginInfo*> m_pluginByExt;

QHash<QString, QString> m_errors;

static PluginFactory* s_instance;
};

#define pluginFactory PluginFactory::instance()

#endif // PLUGINFACTORY_H
3 changes: 3 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

INCLUDE_DIRECTORIES(
${SAMPLERATE_INCLUDE_DIRS}
)
Expand Down
2 changes: 2 additions & 0 deletions plugins/LadspaEffect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ladspa")

IF(WANT_CAPS)
ADD_SUBDIRECTORY(caps)
ENDIF(WANT_CAPS)
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/calf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ENDIF()
SET_TARGET_PROPERTIES(calf PROPERTIES COMPILE_FLAGS "-O2 -finline-functions ${INLINE_FLAGS}")

IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET calf POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/calf.dll\"")
ADD_CUSTOM_COMMAND(TARGET calf POST_BUILD COMMAND "${STRIP}" "$<TARGET_FILE:calf>")
ENDIF(LMMS_BUILD_WIN32)
IF(NOT LMMS_BUILD_APPLE)
SET_TARGET_PROPERTIES(calf PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/caps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SET_TARGET_PROPERTIES(caps PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(caps PROPERTIES COMPILE_FLAGS "-O2 -funroll-loops -Wno-write-strings")

IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET caps POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/caps.dll\"")
ADD_CUSTOM_COMMAND(TARGET caps POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:caps>\")
ENDIF(LMMS_BUILD_WIN32)
IF(NOT LMMS_BUILD_APPLE)
SET_TARGET_PROPERTIES(caps PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/cmt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SET_TARGET_PROPERTIES(cmt PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(cmt PROPERTIES COMPILE_FLAGS "-Wall -O3 -fno-strict-aliasing")

IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET cmt POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/cmt.dll\"")
ADD_CUSTOM_COMMAND(TARGET cmt POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:cmt>\")
ELSE(LMMS_BUILD_WIN32)
SET_TARGET_PROPERTIES(cmt PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fPIC")
ENDIF(LMMS_BUILD_WIN32)
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/swh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FOREACH(_item ${PLUGIN_SOURCES})
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES COMPILE_FLAGS "-O3 -Wall -fomit-frame-pointer -fstrength-reduce -funroll-loops -ffast-math -c -fno-strict-aliasing")
IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET "${_plugin}" POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/${_plugin}.dll\"")
ADD_CUSTOM_COMMAND(TARGET "${_plugin}" POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:${_plugin}>\")
ELSE(LMMS_BUILD_WIN32)
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fPIC -DPIC")
ENDIF(LMMS_BUILD_WIN32)
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/tap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FOREACH(_item ${PLUGIN_SOURCES})
INSTALL(TARGETS "${_plugin}" LIBRARY DESTINATION "${PLUGIN_DIR}/ladspa")
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES PREFIX "")
IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET "${_plugin}" POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/${_plugin}.dll\"")
ADD_CUSTOM_COMMAND(TARGET "${_plugin}" POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:${_plugin}>\")
ENDIF(LMMS_BUILD_WIN32)
IF(LMMS_BUILD_APPLE)
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Bsymbolic -lm")
Expand Down
1 change: 1 addition & 0 deletions plugins/flp_import/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ INCLUDE(BuildPlugin)

INCLUDE_DIRECTORIES(unrtf)

ADD_DEFINITIONS(--std=c++0x)
BUILD_PLUGIN(flpimport FlpImport.cpp unrtf.cpp FlpImport.h)
16 changes: 5 additions & 11 deletions plugins/flp_import/FlpImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "Oscillator.h"
#include "Pattern.h"
#include "Piano.h"
#include "PluginFactory.h"
#include "ProjectJournal.h"
#include "ProjectNotes.h"
#include "Song.h"
Expand Down Expand Up @@ -1637,22 +1638,15 @@ p->putValue( jt->pos, value, false );

// process all effects
EffectKeyList effKeys;
Plugin::DescriptorList pluginDescs;
Plugin::getDescriptorsOfAvailPlugins( pluginDescs );
for( Plugin::DescriptorList::ConstIterator it = pluginDescs.begin();
it != pluginDescs.end(); ++it )
for (const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::Effect))
{
if( it->type != Plugin::Effect )
if( desc->subPluginFeatures )
{
continue;
}
if( it->subPluginFeatures )
{
it->subPluginFeatures->listSubPluginKeys( &( *it ), effKeys );
desc->subPluginFeatures->listSubPluginKeys( desc, effKeys );
}
else
{
effKeys << EffectKey( &( *it ), it->name );
effKeys << EffectKey( desc, desc->name );
}
}

Expand Down
3 changes: 1 addition & 2 deletions plugins/vst_base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ IF(LMMS_BUILD_WIN32)
ENDIF()
TARGET_LINK_LIBRARIES(RemoteVstPlugin -lpthread -lgdi32 -lws2_32)
SET_TARGET_PROPERTIES(RemoteVstPlugin PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -O0")

ADD_CUSTOM_COMMAND(TARGET RemoteVstPlugin POST_BUILD COMMAND "${STRIP}" "${CMAKE_CURRENT_BINARY_DIR}/RemoteVstPlugin.exe")
ADD_CUSTOM_COMMAND(TARGET RemoteVstPlugin POST_BUILD COMMAND "${STRIP}" "$<TARGET_FILE:RemoteVstPlugin>")
INSTALL(TARGETS RemoteVstPlugin RUNTIME DESTINATION "${PLUGIN_DIR}")

IF(LMMS_BUILD_WIN64)
Expand Down
2 changes: 1 addition & 1 deletion plugins/vst_base/Win64/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SET(CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER32}")
ADD_EXECUTABLE(RemoteVstPlugin32 "${CMAKE_CURRENT_SOURCE_DIR}/../RemoteVstPlugin.cpp")
TARGET_LINK_LIBRARIES(RemoteVstPlugin32 -lQtCore4 -lpthread -lgdi32 -lws2_32)

ADD_CUSTOM_COMMAND(TARGET RemoteVstPlugin32 POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/RemoteVstPlugin32.exe\"")
ADD_CUSTOM_COMMAND(TARGET RemoteVstPlugin32 POST_BUILD COMMAND "${STRIP}" "$<TARGET_FILE:RemoteVstPlugin32>")
SET_TARGET_PROPERTIES(RemoteVstPlugin32 PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -O0")

INSTALL(TARGETS RemoteVstPlugin32 RUNTIME DESTINATION "${PLUGIN_DIR}/32")
Expand Down
4 changes: 2 additions & 2 deletions plugins/zynaddsubfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ ENDIF(LMMS_BUILD_LINUX)


IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET ZynAddSubFxCore POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/libZynAddSubFxCore.dll\"")
ADD_CUSTOM_COMMAND(TARGET RemoteZynAddSubFx POST_BUILD COMMAND "${STRIP}" "\"${CMAKE_CURRENT_BINARY_DIR}/RemoteZynAddSubFx.exe\"")
ADD_CUSTOM_COMMAND(TARGET ZynAddSubFxCore POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:ZynAddSubFxCore>\")
ADD_CUSTOM_COMMAND(TARGET RemoteZynAddSubFx POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:RemoteZynAddSubFx>\")
ENDIF(LMMS_BUILD_WIN32)
2 changes: 1 addition & 1 deletion src/core/BandLimitedWave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void BandLimitedWave::generateWaves()
int i;

// set wavetable directory
s_wavetableDir = ConfigManager::inst()->dataDir() + "wavetables/";
s_wavetableDir = "data:wavetables/";

// set wavetable files
QFile saw_file( s_wavetableDir + "saw.bin" );
Expand Down
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ set(LMMS_SRCS
core/Piano.cpp
core/PlayHandle.cpp
core/Plugin.cpp
core/PluginFactory.cpp
core/PresetPreviewPlayHandle.cpp
core/ProjectJournal.cpp
core/ProjectRenderer.cpp
Expand Down
19 changes: 9 additions & 10 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,15 @@ ConfigManager::ConfigManager() :
#endif
),
m_artworkDir( defaultArtworkDir() ),
#ifdef LMMS_BUILD_WIN32
m_pluginDir( qApp->applicationDirPath()
+ QDir::separator() + "plugins" + QDir::separator() ),
#else
m_pluginDir( qApp->applicationDirPath() + '/' + PLUGIN_DIR ),
#endif
m_vstDir( m_workingDir + "vst" + QDir::separator() ),
m_flDir( QDir::home().absolutePath() ),
m_gigDir( m_workingDir + GIG_PATH ),
m_sf2Dir( m_workingDir + SF2_PATH ),
m_version( defaultVersion() )
{
if (! qgetenv("LMMS_DATA_DIR").isEmpty())
QDir::addSearchPath("data", QString::fromLocal8Bit(qgetenv("LMMS_DATA_DIR")));
QDir::addSearchPath("data", m_dataDir);
}


Expand Down Expand Up @@ -372,7 +369,7 @@ void ConfigManager::loadConfigFile()
( !m_ladDir.contains( ':' ) && !QDir( m_ladDir ).exists() ) )
{
#if defined(LMMS_BUILD_WIN32)
m_ladDir = m_pluginDir + "ladspa" + QDir::separator();
m_ladDir = qApp->applicationDirPath() + "/plugins/ladspa" + QDir::separator();
#elif defined(LMMS_BUILD_APPLE)
m_ladDir = qApp->applicationDirPath() + "/../lib/lmms/ladspa/";
#else
Expand All @@ -395,9 +392,11 @@ void ConfigManager::loadConfigFile()
}
#endif


QDir::setSearchPaths( "resources", QStringList() << artworkDir()
<< defaultArtworkDir() );
QStringList searchPaths;
if(! qgetenv("LMMS_THEME_PATH").isNull())
searchPaths << qgetenv("LMMS_THEME_PATH");
searchPaths << artworkDir() << defaultArtworkDir();
QDir::setSearchPaths( "resources", searchPaths);

if( !QDir( m_workingDir ).exists() &&
QApplication::type() == QApplication::GuiClient &&
Expand Down
Loading