VST-effect-support

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@408 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-09-21 16:17:17 +00:00
parent 3bdd39d9fb
commit e30e5583d3
37 changed files with 822 additions and 113 deletions

View File

@@ -1,3 +1,33 @@
2006-09-21 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/vst_effect/Makefile.am:
* plugins/vst_effect/logo.png:
* plugins/vst_effect/vst_effect.h:
* plugins/vst_effect/vst_effect.cpp:
* plugins/vst_effect/vst_control_dialog.h:
* plugins/vst_effect/vst_control_dialog.cpp:
* plugins/vst_effect/vst_subplugin_features.h:
* plugins/vst_effect/vst_subplugin_features.cpp:
added plugin for supporting VST-effects inside LMMS - currently very
experimental and incomplete, but it compiles and works somehow ;-)
* plugins/ladspa_effect/Makefile.am:
generating ladspa_effect.moc not needed ynmore
* plugins/vestige/Makefile.am:
- use new vstbase-library
- do not link against X11, as not needed anymore
* plugins/Makefile.am:
* plugins/vst_base/Makefile.am:
* plugins/vst_base/communication.h:
* plugins/vst_base/lvsl_client.h:
* plugins/vst_base/lvsl_client.cpp:
* plugins/vst_base/lvsl_server.c:
* plugins/vst_base/vst_base.cpp:
moved LVSL-code into separate library for allowing multiple
LMMS-plugins to deal with VST-plugins
2006-09-20 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/*/*.png:

2
TODO
View File

@@ -1,3 +1,5 @@
- try to make vestige-plugin-dlls relative
- do song-editor-tempo-connection to vst-plugin inside remoteVSTPlugin
- do not duplicate recorded notes when clicking on them
- add/remove-steps button in bb-editor for adding/removing according number of steps to/from all patterns of visible beat/baseline
- replace rest of wizard by simple directory-selection-dialog for working-dir when running the first time

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(lmms, 0.2.1-svn20060920, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20060920)
AC_INIT(lmms, 0.2.1-svn20060921, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20060921)
AM_CONFIG_HEADER(config.h)
@@ -516,6 +516,8 @@ AC_CONFIG_FILES([Makefile
plugins/triple_oscillator/Makefile
plugins/vestige/Makefile
plugins/vibed/Makefile
plugins/vst_base/Makefile
plugins/vst_effect/Makefile
lmms.spec])
AC_OUTPUT

View File

@@ -72,7 +72,8 @@ private:
bool m_bypassed;
QMutex m_processLock;
};
} ;
#endif

View File

@@ -48,13 +48,13 @@ class track;
class effectControlDialog : public QWidget, public journallingObject
{
Q_OBJECT
public:
effectControlDialog( QWidget * _parent, effect * _eff );
virtual ~effectControlDialog();
virtual ch_cnt_t getControlCount( void ) = 0;
signals:
void closed();

View File

@@ -1,5 +1,5 @@
if VST_SUPPORT
VESTIGE_SUBDIR=vestige
VST_DIRS=vst_base vst_effect vestige
endif
if LADSPA_SUPPORT
@@ -10,5 +10,5 @@ if STK_SUPPORT
STK_DIR=stk
endif
SUBDIRS = audio_file_processor bit_invader flp_import $(LADSPA_DIRS) midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VESTIGE_SUBDIR) vibed
SUBDIRS = audio_file_processor bit_invader flp_import $(LADSPA_DIRS) midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VST_DIRS) vibed

View File

@@ -22,7 +22,7 @@ CLEANFILES = $(MOC_FILES)
pkglib_LTLIBRARIES= libladspabase.la
pkglib_LTLIBRARIES = libladspabase.la
libladspabase_la_SOURCES = ladspa_base.cpp \
ladspa_port_dialog.cpp \

View File

@@ -1,5 +1,3 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_2_lmms.cpp - class that identifies and instantiates LADSPA effects
* for use with LMMS
@@ -25,8 +23,6 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "ladspa_2_lmms.h"
@@ -141,6 +137,3 @@ QString ladspa2LMMS::getShortName( const ladspa_key_t & _key )
#undef indexOf
#endif
#endif

View File

@@ -28,10 +28,9 @@
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "engine.h"
class ladspa2LMMS: public ladspaManager
{
@@ -80,7 +79,5 @@ private:
friend class engine;
};
#endif
#endif

View File

@@ -27,9 +27,6 @@
#define _LADSPA_BASE_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "plugin.h"
class ladspaControl;
@@ -89,6 +86,4 @@ inline plugin::descriptor::subPluginFeatures::key ladspaKeyToSubPluginKey(
}
#endif
#endif

View File

@@ -1,5 +1,3 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_control.cpp - widget for controlling a LADSPA port
*
@@ -24,8 +22,8 @@
*
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
@@ -395,7 +393,3 @@ void FASTCALL ladspaControl::setLink( bool _state )
#include "ladspa_control.moc"
#endif
#endif

View File

@@ -25,8 +25,7 @@
#ifndef _LADSPA_CONTROL_H
#define _LADSPA_CONTROL_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
@@ -47,6 +46,8 @@
#include "track.h"
#include "knob.h"
#include "led_checkbox.h"
#include "ladspa_manager.h"
typedef struct portDescription port_desc_t;
@@ -112,5 +113,3 @@ private:
};
#endif
#endif

View File

@@ -1,5 +1,3 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_manager.cpp - a class to manage loading and instantiation
* of ladspa plugins
@@ -26,10 +24,7 @@
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
@@ -51,6 +46,7 @@
#include <math.h>
#include "config_mgr.h"
#include "ladspa_manager.h"
@@ -1015,8 +1011,3 @@ bool FASTCALL ladspaManager::cleanup( const ladspa_key_t & _plugin,
#undef value
#endif
#endif

View File

@@ -1,5 +1,3 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_port_dialog.cpp - dialog to test a LADSPA plugin
*
@@ -26,9 +24,6 @@
#include "qt3support.h"
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
#include <QtGui/QLayout>
@@ -269,8 +264,7 @@ ladspaPortDialog::~ ladspaPortDialog()
{
}
#include "ladspa_port_dialog.moc"
#endif
#endif

View File

@@ -21,11 +21,12 @@
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _LADSPA_PORT_DIALOG_H
#define _LADSPA_PORT_DIALOG_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
@@ -57,5 +58,3 @@ private:
#endif
#endif

View File

@@ -28,10 +28,6 @@
*/
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#ifdef QT4
@@ -50,7 +46,7 @@
#include "ladspa_subplugin_features.h"
#include "ladspa_base.h"
#include "ladspa_2_lmms.h"
#include "mixer.h"
#include "audio_device.h"
@@ -188,5 +184,3 @@ void ladspaSubPluginFeatures::listSubPluginKeys( engine * _eng,
#include "ladspa_subplugin_features.moc"
#endif
#endif

View File

@@ -30,12 +30,7 @@
#define _LADSPA_SUBPLUGIN_FEATURES_H
#include "plugin.h"
#include "ladspa_2_lmms.h"
#ifdef LADSPA_SUPPORT
class QLabel;
class ladspa2LMMS;
#include "ladspa_base.h"
class ladspaSubPluginDescriptionWidget : public QWidget
@@ -64,5 +59,3 @@ public:
} ;
#endif
#endif

View File

@@ -11,7 +11,7 @@ AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="ladspaeffect"
$(MOC) -o $@ $<
MOC_FILES = ./ladspa_effect.moc ./ladspa_control_dialog.moc
MOC_FILES = ./ladspa_control_dialog.moc
BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h

View File

@@ -1,5 +1,3 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* ladspa_control_dialog.cpp - dialog for displaying and editing control port
* values for LADSPA plugins
@@ -26,6 +24,8 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QMessageBox>
@@ -281,5 +281,3 @@ void ladspaControlDialog::link( bool _state )
#include "ladspa_control_dialog.moc"
#endif

View File

@@ -26,9 +26,7 @@
#ifndef _LADSPA_CONTROL_DIALOG_H
#define _LADSPA_CONTROL_DIALOG_H
#include "ladspa_manager.h"
#ifdef LADSPA_SUPPORT
#include "qt3support.h"
#ifdef QT4
@@ -42,8 +40,6 @@
#endif
#include "qt3support.h"
#include "effect_control_dialog.h"
#include "ladspa_control.h"
#include "track.h"
@@ -99,5 +95,3 @@ private:
} ;
#endif
#endif

View File

@@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign 1.4
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I/usr/X11R6/include
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I../vst_base
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="vestige"
@@ -24,22 +24,10 @@ EXTRA_DIST = $(EMBEDDED_RESOURCES)
pkglib_LTLIBRARIES = libvestige.la
libvestige_la_SOURCES = vestige.cpp vestige.h lvsl_client.cpp lvsl_client.h
libvestige_la_SOURCES = vestige.cpp vestige.h
libvestige_la_LIBADD = -L../vst_base -lvstbase
$(libvestige_la_SOURCES): ./embedded_resources.h
CC = wineg++
pkglib_PROGRAMS = lvsl_server
lvsl_server_SOURCES = lvsl_server.c communication.h
lvsl_server_LDFLAGS = -mwindows -L/usr/X11R6/lib -lX11 -lpthread -o $(pkglib_PROGRAMS)
lvsl_server_LINK = wineg++
nobase_pkglib_DATA = $(pkglib_PROGRAMS).exe.so
CLEANFILES = $(MOC_FILES) ./embedded_resources.h $(nobase_pkglib_DATA)
install-exec-hook:
cd $(DESTDIR)$(pkglibdir) ; \
strip $(nobase_pkglib_DATA)
CLEANFILES = $(MOC_FILES) ./embedded_resources.h

View File

@@ -108,9 +108,6 @@ vestigeInstrument::vestigeInstrument( instrumentTrack * _channel_track ) :
setErasePixmap( *s_artwork );
#endif
connect( eng()->getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ),
this, SLOT( changeTempo( bpm_t ) ) );
m_openPluginButton = new pixmapButton( this, NULL, eng(), NULL );
m_openPluginButton->setCheckable( FALSE );
m_openPluginButton->setCursor( Qt::PointingHandCursor );
@@ -300,6 +297,9 @@ void vestigeInstrument::setParameter( const QString & _param,
return;
}*/
m_plugin->showEditor();
connect( eng()->getSongEditor(),
SIGNAL( tempoChanged( bpm_t ) ),
m_plugin, SLOT( setTempo( bpm_t ) ) );
m_plugin->setTempo( eng()->getSongEditor()->getTempo() );
if( set_ch_name == TRUE )
{
@@ -500,7 +500,7 @@ void vestigeInstrument::noteOffAll( void )
/*
void vestigeInstrument::changeTempo( bpm_t _new_tempo )
{
m_pluginMutex.lock();
@@ -510,7 +510,7 @@ void vestigeInstrument::changeTempo( bpm_t _new_tempo )
}
m_pluginMutex.unlock();
}
*/

View File

@@ -89,7 +89,6 @@ protected slots:
void openPlugin( void );
void toggleGUI( void );
void noteOffAll( void );
void changeTempo( bpm_t _new_tempo );
protected:

View File

@@ -0,0 +1,35 @@
AUTOMAKE_OPTIONS = foreign 1.4
INCLUDES = -I$(top_srcdir)/include -I.
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="vstbase"
%.moc: ./%.h
$(MOC) -o $@ $<
MOC_FILES = ./lvsl_client.moc
BUILT_SOURCES = $(MOC_FILES)
pkglib_LTLIBRARIES = libvstbase.la
libvstbase_la_SOURCES = vst_base.cpp \
lvsl_client.cpp \
lvsl_client.h
CC = wineg++
pkglib_PROGRAMS = lvsl_server
lvsl_server_SOURCES = lvsl_server.c communication.h
lvsl_server_LDFLAGS = -mwindows -lpthread -o $(pkglib_PROGRAMS)
lvsl_server_LINK = wineg++
nobase_pkglib_DATA = $(pkglib_PROGRAMS).exe.so
CLEANFILES = $(MOC_FILES) $(nobase_pkglib_DATA)
install-exec-hook:
cd $(DESTDIR)$(pkglibdir) ; \
strip $(nobase_pkglib_DATA)

View File

@@ -37,6 +37,7 @@
#include <qapplication.h>
#include <qlocale.h>
#include <qdir.h>
#include "qxembed.h"
@@ -85,6 +86,7 @@
remoteVSTPlugin::remoteVSTPlugin( const QString & _plugin, engine * _engine ) :
QObject(),
engineObject( _engine ),
m_failed( TRUE ),
m_plugin( _plugin ),
@@ -118,6 +120,7 @@ remoteVSTPlugin::remoteVSTPlugin( const QString & _plugin, engine * _engine ) :
dup2( m_pipes[0][0], 0 );
dup2( m_pipes[1][1], 1 );
QString lvsl_server_exec = configManager::inst()->pluginDir() +
QDir::separator() +
"lvsl_server";
execlp( lvsl_server_exec.
#ifdef QT4
@@ -151,9 +154,15 @@ remoteVSTPlugin::remoteVSTPlugin( const QString & _plugin, engine * _engine ) :
default: break;
}
writeValueS<hostLanguages>( hlang );
QString p = m_plugin;
if( QFileInfo( p ).dir().isRelative() )
{
p = configManager::inst()->vstDir() + QDir::separator() + p;
}
printf("loading %s\n", p.ascii());
writeValueS<Sint16>( VST_LOAD_PLUGIN );
writeStringS( m_plugin.
writeStringS( p.
#ifdef QT4
toAscii().constData()
#else
@@ -380,7 +389,7 @@ void remoteVSTPlugin::enqueueMidiEvent( const midiEvent & _event,
void remoteVSTPlugin::setTempo( const bpm_t _bpm )
void remoteVSTPlugin::setTempo( bpm_t _bpm )
{
lock();
writeValueS<Sint16>( VST_BPM );
@@ -585,3 +594,6 @@ Sint16 remoteVSTPlugin::processNextMessage( void )
}
#include "lvsl_client.moc"

View File

@@ -48,11 +48,12 @@
class remoteVSTPlugin : public engineObject
class remoteVSTPlugin : public QObject, public engineObject
{
Q_OBJECT
public:
remoteVSTPlugin( const QString & _plugin, engine * _engine );
~remoteVSTPlugin();
virtual ~remoteVSTPlugin();
void showEditor( void );
void hideEditor( void );
@@ -88,7 +89,6 @@ public:
void FASTCALL enqueueMidiEvent( const midiEvent & _event,
const f_cnt_t _frames_ahead );
void FASTCALL setTempo( const bpm_t _bpm );
const QMap<QString, QString> & parameterDump( void );
void setParameterDump( const QMap<QString, QString> & _pdump );
@@ -115,6 +115,10 @@ public:
}
public slots:
void setTempo( bpm_t _bpm );
private:
template<typename T>
inline T readValueS( void ) const

View File

@@ -0,0 +1,47 @@
/*
* vst_base.cpp - VST-base-code to be used by any LMMS-plugins dealing with VST-
* plugins
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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.
*
*/
#include "plugin.h"
extern "C"
{
plugin::descriptor vstbase_plugin_descriptor =
{
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
"VST Base",
"library for all LMMS-plugins dealing with VST-plugins",
"Tobias Doerffel <tobydox/at/users/dot/sf/dot/net>",
0x0100,
plugin::Library,
NULL,
NULL
} ;
}

View File

@@ -0,0 +1,40 @@
AUTOMAKE_OPTIONS = foreign 1.4
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I../vst_base/
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="vsteffect"
%.moc: ./%.h
$(MOC) -o $@ $<
#MOC_FILES = ./vst_control_dialog.moc
BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h
EMBEDDED_RESOURCES = $(wildcard *png)
./embedded_resources.h: $(EMBEDDED_RESOURCES)
$(top_builddir)/buildtools/bin2res $(EMBEDDED_RESOURCES) > $@
EXTRA_DIST = $(EMBEDDED_RESOURCES)
CLEANFILES = $(MOC_FILES) ./embedded_resources.h
pkglib_LTLIBRARIES= libvsteffect.la
libvsteffect_la_SOURCES = vst_effect.cpp \
vst_control_dialog.cpp \
vst_subplugin_features.cpp \
vst_subplugin_features.h \
vst_effect.h \
vst_control_dialog.h
libvsteffect_la_LIBADD = -L../vst_base -lvstbase
$(libvsteffect_la_SOURCES): ./embedded_resources.h

BIN
plugins/vst_effect/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,85 @@
/*
* vst_control_dialog.cpp - dialog for displaying GUI of VST-effect-plugin
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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.
*
*/
#ifdef QT4
#include <QtGui/QMessageBox>
#include <QtGui/QLayout>
#else
#include <qmessagebox.h>
#include <qlayout.h>
#endif
#include "vst_effect.h"
vstControlDialog::vstControlDialog( QWidget * _parent,
vstEffect * _eff ) :
effectControlDialog( _parent, _eff ),
m_effect( _eff )
{
QVBoxLayout * l = new QVBoxLayout( this );
QWidget * pw = m_effect->m_plugin->pluginWidget();
if( pw )
{
pw->reparent( this, QPoint( 0, 0 ) );
pw->show();
l->addWidget( pw );
}
}
vstControlDialog::~vstControlDialog()
{
QWidget * pw = m_effect->m_plugin->pluginWidget();
if( pw )
{
pw->reparent( parentWidget(), QPoint( 0, 0 ) );
}
}
void FASTCALL vstControlDialog::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
// TODO: save settings of plugin
}
void FASTCALL vstControlDialog::loadSettings( const QDomElement & _this )
{
// TODO: load settings of plugin
}

View File

@@ -0,0 +1,59 @@
/*
* vst_control_dialog.h - dialog for displaying GUI of VST-effect-plugin
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _VST_CONTROL_DIALOG_H
#define _VST_CONTROL_DIALOG_H
#include "effect_control_dialog.h"
class vstEffect;
class vstControlDialog : public effectControlDialog
{
public:
vstControlDialog( QWidget * _parent, vstEffect * _eff );
virtual ~vstControlDialog();
virtual void FASTCALL saveSettings( QDomDocument & _doc,
QDomElement & _parent );
virtual void FASTCALL loadSettings( const QDomElement & _this );
inline virtual QString nodeName( void ) const
{
return( "vstcontrols" );
}
virtual ch_cnt_t getControlCount( void )
{
return( 1 );
}
private:
vstEffect * m_effect;
} ;
#endif

View File

@@ -0,0 +1,213 @@
/*
* vst_effect.cpp - class for handling VST effect plugins
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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.
*
*/
#ifdef QT4
#include <QtGui/QMessageBox>
#else
#include <qmessagebox.h>
#endif
#include "vst_effect.h"
#include "vst_subplugin_features.h"
#include "song_editor.h"
#include "text_float.h"
#include "buffer_allocator.h"
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
extern "C"
{
plugin::descriptor vsteffect_plugin_descriptor =
{
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
"VST Effect",
QT_TRANSLATE_NOOP( "pluginBrowser",
"plugin for using arbitrary VST-effects "
"inside LMMS." ),
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::Effect,
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ),
new vstSubPluginFeatures( plugin::Effect )
} ;
}
vstEffect::vstEffect( effect::constructionData * _cdata ) :
effect( &vsteffect_plugin_descriptor, _cdata ),
m_plugin( NULL ),
m_pluginMutex(),
m_key( _cdata->key )
{
if( !m_key.user.toString().isEmpty() )
{
openPlugin( m_key.user.toString() );
}
}
vstEffect::~vstEffect()
{
closePlugin();
}
bool FASTCALL vstEffect::processAudioBuffer( surroundSampleFrame * _buf,
const fpab_t _frames )
{
if( isBypassed() || !isRunning () )
{
return( FALSE );
}
if( m_plugin )
{
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>(
_frames );
for( fpab_t f = 0; f < _frames; ++f )
{
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
{
buf[f][ch] = _buf[f][ch];
}
}
m_pluginMutex.lock();
m_plugin->process( buf, buf, TRUE );
m_pluginMutex.unlock();
double out_sum = 0.0;
for( fpab_t f = 0; f < _frames; ++f )
{
for( ch_cnt_t ch = 0; ch < SURROUND_CHANNELS; ++ch )
{
_buf[f][ch] = getDryLevel() * _buf[f][ch] +
getWetLevel() *
buf[f][ch%DEFAULT_CHANNELS];
out_sum += _buf[f][ch]*_buf[f][ch];
}
}
bufferAllocator::free( buf );
if( out_sum <= getGate() )
{
incrementBufferCount();
if( getBufferCount() > getTimeout() )
{
stopRunning();
resetBufferCount();
}
}
else
{
resetBufferCount();
}
}
return( isRunning() );
}
void vstEffect::openPlugin( const QString & _plugin )
{
textFloat * tf = textFloat::displayMessage(
remoteVSTPlugin::tr( "Loading plugin" ),
remoteVSTPlugin::tr(
"Please wait while loading VST-plugin..." ),
PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 );
m_pluginMutex.lock();
m_plugin = new remoteVSTPlugin( _plugin, eng() );
if( m_plugin->failed() )
{
m_pluginMutex.unlock();
closePlugin();
delete tf;
QMessageBox::information( NULL,
remoteVSTPlugin::tr( "Failed loading VST-plugin" ),
remoteVSTPlugin::tr( "The VST-plugin %1 could not "
"be loaded for some reason.\n"
"If it runs with other VST-"
"software under Linux, please "
"contact an LMMS-developer!"
).arg( _plugin ),
QMessageBox::Ok );
return;
}
m_plugin->showEditor();
remoteVSTPlugin::connect( eng()->getSongEditor(),
SIGNAL( tempoChanged( bpm_t ) ),
m_plugin, SLOT( setTempo( bpm_t ) ) );
m_plugin->setTempo( eng()->getSongEditor()->getTempo() );
if( m_plugin->pluginWidget() != NULL )
{
/*#ifdef QT4
m_plugin->pluginWidget()->setWindowIcon(
getInstrumentTrack()->windowIcon() );
#else
m_plugin->pluginWidget()->setWindowIcon(
*( getInstrumentTrack()->windowIcon() ) );
#endif*/
m_plugin->hideEditor();
}
m_pluginMutex.unlock();
delete tf;
}
void vstEffect::closePlugin( void )
{
m_pluginMutex.lock();
delete m_plugin;
m_plugin = NULL;
m_pluginMutex.unlock();
}
extern "C"
{
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
{
return( new vstEffect(
static_cast<effect::constructionData *>( _data ) ) );
}
}

View File

@@ -0,0 +1,88 @@
/*
* vst_effect.h - class for handling VST effect plugins
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _VST_EFFECT_H
#define _VST_EFFECT_H
#include "qt3support.h"
#ifdef QT4
#include <QtCore/QMutex>
#else
#include <qmutex.h>
#endif
#include "effect.h"
#include "main_window.h"
#include "lvsl_client.h"
#include "vst_control_dialog.h"
class vstEffect : public effect
{
public:
vstEffect( effect::constructionData * _cdata );
virtual ~vstEffect();
virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf,
const fpab_t _frames );
virtual inline QString publicName( void ) const
{
return( m_plugin->name() );
}
virtual inline effectControlDialog * createControlDialog( track * )
{
return( new vstControlDialog(
eng()->getMainWindow()->workspace(),
this ) );
}
inline virtual QString nodeName( void ) const
{
return( "vsteffect" );
}
private:
void openPlugin( const QString & _plugin );
void closePlugin( void );
remoteVSTPlugin * m_plugin;
QMutex m_pluginMutex;
effectKey m_key;
friend class vstControlDialog;
} ;
#endif

View File

@@ -0,0 +1,103 @@
/*
* vst_subplugin_features.cpp - derivation from
* plugin::descriptor::subPluginFeatures for
* hosting VST-plugins
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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.
*
*/
#ifdef QT4
#include <QtCore/QDir>
#include <QtGui/QGroupBox>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#else
#include <qdir.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#endif
#include "vst_subplugin_features.h"
#include "config_mgr.h"
vstSubPluginDescriptionWidget::vstSubPluginDescriptionWidget(
QWidget * _parent, engine * _engine,
const effectKey & _key ) :
QWidget( _parent )
{
QVBoxLayout * l = new QVBoxLayout( this );
#ifndef QT3
QGroupBox * groupbox = new QGroupBox( tr( "Description" ), this );
#else
QGroupBox * groupbox = new QGroupBox( 9, Qt::Vertical,
tr( "Description" ), this );
#endif
new QLabel( tr( "Name: " ) + _key.name, groupbox );
new QLabel( tr( "File: " ) + _key.user.toString(), groupbox );
l->addWidget( groupbox );
}
vstSubPluginFeatures::vstSubPluginFeatures( plugin::pluginTypes _type ) :
subPluginFeatures( _type )
{
}
QWidget * vstSubPluginFeatures::createDescriptionWidget(
QWidget * _parent, engine * _eng, const key & _key )
{
return( new vstSubPluginDescriptionWidget( _parent, _eng, _key ) );
}
void vstSubPluginFeatures::listSubPluginKeys( engine * _eng,
plugin::descriptor * _desc, keyList & _kl )
{
QStringList dlls = QDir( configManager::inst()->vstDir() ).
entryList( "*.dll", QDir::Files, QDir::Name );
// TODO: eval m_type
for( QStringList::const_iterator it = dlls.begin();
it != dlls.end(); ++it )
{
_kl.push_back( key( _desc, QFileInfo( *it ).baseName(),
*it ) );
}
}

View File

@@ -0,0 +1,60 @@
/*
* vst_subplugin_features.h - derivation from
* plugin::descriptor::subPluginFeatures for
* hosting VST-plugins
*
* Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* 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 _VST_SUBPLUGIN_FEATURES_H
#define _VST_SUBPLUGIN_FEATURES_H
#include "effect.h"
class vstSubPluginDescriptionWidget : public QWidget
{
public:
vstSubPluginDescriptionWidget( QWidget * _parent, engine * _engine,
const effectKey & _key );
} ;
class vstSubPluginFeatures : public plugin::descriptor::subPluginFeatures
{
public:
vstSubPluginFeatures( plugin::pluginTypes _type );
virtual QWidget * createDescriptionWidget( QWidget * _parent,
engine * _eng,
const key & _key );
virtual void listSubPluginKeys( engine * _eng,
plugin::descriptor * _desc, keyList & _kl );
} ;
#endif