[SCM] calf/master: Remove support for LADSPA, DSSI and external LV2 GUI.
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:45 UTC 2013
The following commit has been merged in the master branch:
commit 460642bfae534679b4094e6887714828c90d8172
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Fri Dec 16 22:42:02 2011 +0000
Remove support for LADSPA, DSSI and external LV2 GUI.
I don't think the obsolete standards are still worth supporting. Most major
hosts already support LV2 to some degree, and having multiple versions
of the same plugin is a recipe for trouble. Also, it makes testing
easier, may let me remove more code in future (all the OSC stuff) and
concentrate on getting the most useful features stable.
diff --git a/configure.ac b/configure.ac
index cb8f659..de1b6ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,10 +19,6 @@ AC_PROG_INSTALL
############################################################################################
# Set initial values of shell variables
-LADSPA_ENABLED="no"
-EXEC_GUI_ENABLED="no"
-DSSI_GUI_ENABLED="no"
-LV2_GTK_GUI_ENABLED="no"
LV2_GUI_ENABLED="no"
JACK_FOUND="no"
JACK_ENABLED="no"
@@ -52,10 +48,6 @@ PKG_PROG_PKG_CONFIG
AC_HEADER_STDC
AC_CHECK_HEADERS([memory.h stdint.h stdlib.h string.h time.h math.h])
-AC_CHECK_HEADER(ladspa.h, LADSPA_FOUND="yes", LADSPA_FOUND="no")
-
-AC_CHECK_HEADER(dssi.h, DSSI_FOUND="yes", DSSI_FOUND="no")
-
AC_CHECK_HEADER(expat.h, true, AC_MSG_ERROR([Expat XML library not found]))
AC_CHECK_LIB(expat, XML_Parse, true, AC_MSG_ERROR([Expat XML library not found]))
@@ -92,12 +84,10 @@ PKG_CHECK_MODULES(SLV2_HACK, slv2 <= 0.6.1, SLV2_UNSUPPORTED="yes", SLV2_UNSUPPO
############################################################################################
# Assign initial values to feature control variables
-LADSPA_ENABLED=$LADSPA_FOUND
-DSSI_ENABLED=$DSSI_FOUND
LV2_ENABLED=$LV2_FOUND
LASH_ENABLED=$LASH_FOUND
-if test "$JACK_FOUND" = "yes" -o "$DSSI_FOUND" = "yes" -o "$LV2_FOUND" = "yes"; then
+if test "$JACK_FOUND" = "yes" -o "$LV2_FOUND" = "yes"; then
PKG_CHECK_MODULES(GUI_DEPS, gtk+-2.0 >= 2.12.0 gconf-2.0 >= 2.8.0 cairo >= 1.2.0,
GUI_ENABLED="yes",
GUI_ENABLED="no (GTK+ 2.12, GConf 2.8 and cairo 1.2 or newer required)"
@@ -106,22 +96,6 @@ fi
############################################################################################
# Look for settings and installed libraries to determine what to compile/install/use
-if test "$LADSPA_FOUND" = "yes"; then
- AC_MSG_CHECKING([whether to allow LADSPA])
- AC_ARG_WITH(ladspa,
- AC_HELP_STRING([--without-ladspa],[disable LADSPA and DSSI interfaces]),
- [if test "$withval" = "no"; then LADSPA_ENABLED="no"; DSSI_ENABLED="no"; fi],[])
- AC_MSG_RESULT($LADSPA_ENABLED)
-fi
-
-if test "$DSSI_FOUND" = "yes"; then
- AC_MSG_CHECKING([whether to allow DSSI])
- AC_ARG_WITH(dssi,
- AC_HELP_STRING([--without-dssi],[disable DSSI interface]),
- [if test "$withval" = "no"; then DSSI_ENABLED="no"; fi],[])
- AC_MSG_RESULT($DSSI_ENABLED)
-fi
-
if test "$LV2_FOUND" = "yes"; then
AC_MSG_CHECKING([whether to allow LV2])
AC_ARG_WITH(lv2,
@@ -145,13 +119,6 @@ AC_ARG_ENABLE(experimental,
[set_enable_experimental="no"])
AC_MSG_RESULT($set_enable_experimental)
-AC_MSG_CHECKING([whether to enable old-style in-process GTK+ GUI])
-AC_ARG_ENABLE(in-process-lv2-gui,
- AC_HELP_STRING([--enable-in-process-lv2-gui],[enable old-style in-process GTK+ GUI - not recommended!]),
- [set_enable_gtk_gui="$enableval"],
- [set_enable_gtk_gui="no"])
-AC_MSG_RESULT($set_enable_gtk_gui)
-
AC_MSG_CHECKING([whether to enable debugging mode])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debug mode - slow!]),
@@ -176,18 +143,8 @@ if test "$GUI_ENABLED" = "yes" -a "$JACK_FOUND" = "yes"; then
JACK_ENABLED="yes"
fi
-if test "$GUI_ENABLED" = "yes" -a "$DSSI_ENABLED" = "yes"; then
- DSSI_GUI_ENABLED="yes"
- EXEC_GUI_ENABLED="yes"
-fi
-
if test "$GUI_ENABLED" = "yes" -a "$LV2_ENABLED" = "yes"; then
LV2_GUI_ENABLED="yes"
- EXEC_GUI_ENABLED="yes"
-fi
-
-if test "$set_enable_gtk_gui" = "yes" -a "$LV2_ENABLED" = "yes" -a "$GUI_ENABLED" = "yes"; then
- LV2_GTK_GUI_ENABLED="yes"
fi
if test "$set_enable_debug" = "yes"; then
@@ -198,27 +155,16 @@ fi
############################################################################################
# Create automake conditional symbols
-AM_CONDITIONAL(USE_DSSI, test "$DSSI_ENABLED" = "yes")
-AM_CONDITIONAL(USE_LADSPA, test "$LADSPA_ENABLED" = "yes")
AM_CONDITIONAL(USE_JACK, test "$JACK_ENABLED" = "yes")
AM_CONDITIONAL(USE_LV2, test "$LV2_ENABLED" = "yes")
AM_CONDITIONAL(USE_GUI, test "$GUI_ENABLED" = "yes")
-AM_CONDITIONAL(USE_DSSI_GUI, test "$DSSI_GUI_ENABLED" = "yes")
-AM_CONDITIONAL(USE_EXEC_GUI, test "$EXEC_GUI_ENABLED" = "yes")
AM_CONDITIONAL(USE_LV2_GUI, test "$LV2_GUI_ENABLED" = "yes")
-AM_CONDITIONAL(USE_LV2_GTK_GUI, test "$set_enable_gtk_gui" = "yes")
AM_CONDITIONAL(USE_LASH, test "$LASH_ENABLED" = "yes")
AM_CONDITIONAL(USE_LASH_0_6, test "$LASH_0_6_ENABLED" = "yes")
AM_CONDITIONAL(USE_DEBUG, test "$set_enable_debug" = "yes")
############################################################################################
# Create autoconf symbols for config.h
-if test "$LADSPA_ENABLED" = "yes"; then
- AC_DEFINE(USE_LADSPA, 1, [LADSPA wrapper will be built])
-fi
-if test "$DSSI_ENABLED" = "yes"; then
- AC_DEFINE(USE_DSSI, 1, [DSSI wrapper will be built])
-fi
if test "$LV2_ENABLED" = "yes"; then
AC_DEFINE(USE_LV2, 1, [LV2 wrapper will be built])
fi
@@ -234,48 +180,15 @@ if test "$LASH_ENABLED" = "yes"; then
AC_DEFINE(USE_LASH_0_6, 1, "Unstable LASH API is enabled")
fi
fi
-if test "$EXEC_GUI_ENABLED" = "yes"; then
- AC_DEFINE(USE_EXEC_GUI, 1, [Out-of-process GTK+ GUI for LV2/DSSI will be built])
-fi
-if test "$DSSI_GUI_ENABLED" = "yes"; then
- AC_DEFINE(USE_DSSI_GUI, 1, [GTK+ GUI executable will be used for DSSI])
-fi
if test "$LV2_GUI_ENABLED" = "yes"; then
AC_DEFINE(USE_LV2_GUI, 1, [GTK+ GUI executable will be used for LV2])
fi
if test "$set_enable_experimental" = "yes"; then
AC_DEFINE([ENABLE_EXPERIMENTAL], [1], "Experimental features are enabled")
fi
-if test "$set_enable_gtk_gui" = "yes"; then
- AC_DEFINE([USE_LV2_GTK_GUI], [1], "In-process GTK+ LV2 GUI features is enabled")
-fi
############################################################################################
# Output directories
-AC_MSG_CHECKING(where to install LADSPA plugins)
-AC_ARG_WITH(ladspa_dir,
- AC_HELP_STRING([--with-ladspa-dir],[install LADSPA plugins to DIR (default=$prefix/lib/ladspa/)]),
- ,
- [with_ladspa_dir="$prefix/lib/ladspa/"])
-AC_MSG_RESULT($with_ladspa_dir)
-AC_SUBST(with_ladspa_dir)
-
-AC_MSG_CHECKING(where to install LADSPA RDF file)
-AC_ARG_WITH(ladspa_rdf_dir,
- AC_HELP_STRING([--with-ladspa-rdf-dir],[install RDF file to DIR (default=$prefix/share/ladspa/rdf/)]),
- ,
- [with_ladspa_rdf_dir="$prefix/share/ladspa/rdf/"])
-AC_MSG_RESULT($with_ladspa_rdf_dir)
-AC_SUBST(with_ladspa_rdf_dir)
-
-AC_MSG_CHECKING(where to install DSSI plugins)
-AC_ARG_WITH(dssi_dir,
- AC_HELP_STRING([--with-dssi-dir],[install DSSI plugins to DIR (default=$prefix/lib/dssi/)]),
- ,
- [with_dssi_dir="$prefix/lib/dssi/"])
-AC_MSG_RESULT($with_dssi_dir)
-AC_SUBST(with_dssi_dir)
-
if test "$LV2_ENABLED" == "yes"; then
AC_MSG_CHECKING(where to install LV2 plugins)
AC_ARG_WITH(lv2_dir,
@@ -307,14 +220,9 @@ AC_MSG_RESULT([
Debug mode: $set_enable_debug
Experimental plugins: $set_enable_experimental
- LADSPA enabled: $LADSPA_ENABLED
Common GUI code: $GUI_ENABLED
- Out-of-process GUI code: $EXEC_GUI_ENABLED
- DSSI enabled: $DSSI_ENABLED
- DSSI GUI enabled: $DSSI_GUI_ENABLED
LV2 enabled: $LV2_ENABLED
- LV2 in-process GUI enabled: $LV2_GTK_GUI_ENABLED
- LV2 GUI enabled: $LV2_GUI_ENABLED
+ LV2 GTK+ GUI enabled: $LV2_GUI_ENABLED
JACK host enabled: $JACK_ENABLED
LASH enabled: $LASH_ENABLED])
if test "$LASH_ENABLED" = "yes"; then
diff --git a/src/Makefile.am b/src/Makefile.am
index 3716750..319d8c4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,6 @@ INCLUDES = -I$(top_srcdir) -I$(srcdir)
SUBDIRS = calf
-ladspadir = $(with_ladspa_dir)
lv2dir = $(with_lv2_dir)/calf.lv2
bin_PROGRAMS =
@@ -12,13 +11,6 @@ noinst_LTLIBRARIES =
noinst_PROGRAMS = calfbenchmark
pkglib_LTLIBRARIES = calf.la
-if USE_DSSI_GUI
-pkglib_PROGRAMS = calf_gtk
-endif
-if USE_LV2_GUI
-noinst_LTLIBRARIES += calflv2gui.la
-pkglib_PROGRAMS = calf_gtk
-endif
AM_CXXFLAGS = -ffast-math -finline-limit=80 $(FLUIDSYNTH_DEPS_CFLAGS)
@@ -45,25 +37,20 @@ calfmakerdf_LDADD = calf.la
calfbenchmark_SOURCES = benchmark.cpp
calfbenchmark_LDADD = $(GLIB_DEPS_LIBS) calf.la
-if USE_EXEC_GUI
-calf_gtk_SOURCES = dssigui.cpp
-calf_gtk_LDADD = calf.la libcalfgui.la $(GLIB_DEPS_LIBS) $(GUI_DEPS_LIBS)
-calfbenchmark_CXXFLAGS = $(AM_CXXFLAGS) -DTEST_OSC
-calfbenchmark_LDADD += libcalfgui.la
-endif
-
calf_la_SOURCES = audio_fx.cpp metadata.cpp modules.cpp modules_comp.cpp modules_limit.cpp modules_dist.cpp modules_eq.cpp modules_mod.cpp fluidsynth.cpp giface.cpp monosynth.cpp organ.cpp osctl.cpp osctlnet.cpp plugin.cpp preset.cpp synth.cpp utils.cpp wavetable.cpp modmatrix.cpp
calf_la_LIBADD ?= $(FLUIDSYNTH_DEPS_LIBS)
if USE_DEBUG
-calf_la_LDFLAGS = -rpath $(ladspadir) -avoid-version -module -lexpat -disable-static $(FLUIDSYNTH_DEPS_LIBS)
+calf_la_LDFLAGS = -rpath $(lv2dir) -avoid-version -module -lexpat -disable-static $(FLUIDSYNTH_DEPS_LIBS)
else
-calf_la_LDFLAGS = -rpath $(ladspadir) -avoid-version -module -lexpat -disable-static -export-symbols-regex "(ladspa_|lv2_|dssi_)descriptor" $(FLUIDSYNTH_DEPS_LIBS)
+calf_la_LDFLAGS = -rpath $(lv2dir) -avoid-version -module -lexpat -disable-static -export-symbols-regex "lv2_descriptor" $(FLUIDSYNTH_DEPS_LIBS)
endif
-if USE_LV2_GTK_GUI
+if USE_LV2_GUI
# Version WITH out-of-process GUI - links GTK+, UI controls etc.
+noinst_LTLIBRARIES += calflv2gui.la
+
calflv2gui_la_SOURCES = gui.cpp gui_config.cpp gui_controls.cpp ctl_curve.cpp ctl_keyboard.cpp ctl_led.cpp ctl_vumeter.cpp custom_ctl.cpp metadata.cpp giface.cpp preset.cpp preset_gui.cpp lv2gui.cpp osctl.cpp osctlnet.cpp utils.cpp
if USE_DEBUG
@@ -72,21 +59,6 @@ else
calflv2gui_la_LDFLAGS = -rpath $(lv2dir) -avoid-version -module -lexpat -export-symbols-regex "lv2ui_descriptor" $(GUI_DEPS_LIBS) -disable-static
endif
-else
-
-# Version WITHOUT out-of-process GUI - links GLib only
-
-if USE_LV2_GUI
-calflv2gui_la_SOURCES = metadata.cpp giface.cpp preset.cpp lv2gui.cpp osctl.cpp osctlnet.cpp utils.cpp
-
-if USE_DEBUG
-calflv2gui_la_LDFLAGS = -rpath $(lv2dir) -avoid-version -module -lexpat $(GLIB_DEPS_LIBS) -disable-static
-else
-calflv2gui_la_LDFLAGS = -rpath $(lv2dir) -avoid-version -module -lexpat -export-symbols-regex "lv2ui_descriptor" $(GLIB_DEPS_LIBS) -disable-static
-endif
-
-endif
-
endif
if USE_GUI
@@ -103,22 +75,9 @@ install-data-hook:
if USE_GUI
install -c -m 644 $(top_srcdir)/calf-gui.xml $(DESTDIR)$(pkgdatadir)
endif
-if USE_LADSPA
- install -d -m 755 $(DESTDIR)$(with_ladspa_dir)
- install -d -m 755 $(DESTDIR)$(with_ladspa_rdf_dir)
- ln -sf $(pkglibdir)/calf.so $(DESTDIR)$(with_ladspa_dir)/calf.so
- $(top_builddir)/src/calfmakerdf > $(DESTDIR)$(with_ladspa_rdf_dir)/calf.rdf
-endif
-if USE_DSSI
- install -d -m 755 $(DESTDIR)$(with_dssi_dir)
- install -d -m 755 $(DESTDIR)$(with_dssi_dir)/calf
- ln -sf $(pkglibdir)/calf.so $(DESTDIR)$(with_dssi_dir)/calf.so
- ln -sf $(pkglibdir)/calf_gtk $(DESTDIR)$(with_dssi_dir)/calf/calf_gtk
-endif
if USE_LV2
install -d -m 755 $(DESTDIR)$(lv2dir)
ln -sf $(pkglibdir)/calf.so $(DESTDIR)$(lv2dir)/calf.so
- ln -sf $(pkglibdir)/calf_gtk $(DESTDIR)$(lv2dir)/calf_gtk
if USE_LV2_GUI
install -c -m 755 $(top_builddir)/src/.libs/calflv2gui.so $(DESTDIR)$(lv2dir)/calflv2gui.so
endif
@@ -131,7 +90,6 @@ uninstall-hook:
if USE_LV2
if USE_LV2_GUI
rm -f $(DESTDIR)$(lv2dir)/calflv2gui.so
- rm -f $(DESTDIR)$(lv2dir)/calf_gtk
endif
rm -f $(DESTDIR)$(lv2dir)/calf.so
rm -f $(DESTDIR)$(lv2dir)/*.ttl
@@ -142,16 +100,4 @@ if USE_GUI
endif
rm -f $(DESTDIR)$(pkgdatadir)/presets*.xml
rmdir $(DESTDIR)$(pkgdatadir) || true
-if USE_LADSPA
- $(RM) -f $(DESTDIR)$(with_ladspa_dir)/calf.so
- $(RM) -f $(DESTDIR)$(with_ladspa_rdf_dir)/calf.rdf
- rmdir -p $(DESTDIR)$(with_ladspa_rdf_dir) || true
-endif
-if USE_DSSI
- $(RM) -f $(DESTDIR)$(with_dssi_dir)/calf.so
-if USE_DSSI_GUI
- $(RM) -f $(DESTDIR)$(with_dssi_dir)/calf/calf_gtk
-endif
- rmdir -p $(DESTDIR)$(with_dssi_dir)/calf || true
-endif
diff --git a/src/calf/Makefile.am b/src/calf/Makefile.am
index 53d312e..cc77109 100644
--- a/src/calf/Makefile.am
+++ b/src/calf/Makefile.am
@@ -2,7 +2,7 @@ noinst_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h custom_ctl.h \
ctl_curve.h ctl_keyboard.h ctl_led.h ctl_vumeter.h \
delay.h envelope.h fft.h fixed_point.h giface.h gtk_session_env.h gtk_main_win.h \
gui.h gui_config.h gui_controls.h inertia.h jackhost.h \
- host_session.h ladspa_wrap.h loudness.h \
+ host_session.h loudness.h \
lv2_data_access.h lv2_event.h lv2_external_ui.h \
lv2_state.h lv2_progress.h lv2_ui.h lv2_uri_map.h lv2helpers.h lv2wrap.h \
metadata.h modmatrix.h \
diff --git a/src/calf/ladspa_wrap.h b/src/calf/ladspa_wrap.h
deleted file mode 100644
index d94ebce..0000000
--- a/src/calf/ladspa_wrap.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Calf DSP Library
- * API wrappers for LADSPA/DSSI
- *
- * Copyright (C) 2007-2008 Krzysztof Foltman
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __CALF_LADSPA_WRAP_H
-#define __CALF_LADSPA_WRAP_H
-
-#if USE_LADSPA
-
-#include <string.h>
-#include <ladspa.h>
-#if USE_DSSI
-#include <dssi.h>
-#endif
-#include "giface.h"
-#include "preset.h"
-
-namespace calf_plugins {
-
-struct ladspa_plugin_metadata_set;
-/// A template implementing plugin_ctl_iface for a given plugin
-struct ladspa_instance: public plugin_ctl_iface
-{
- audio_module_iface *module;
- const plugin_metadata_iface *metadata;
- ladspa_plugin_metadata_set *ladspa;
- bool activate_flag;
- float **ins, **outs, **params;
-#if USE_DSSI
- dssi_feedback_sender *feedback_sender;
-#endif
-
- ladspa_instance(audio_module_iface *_module, ladspa_plugin_metadata_set *_ladspa, int sample_rate);
- virtual const line_graph_iface *get_line_graph_iface() const { return module->get_line_graph_iface(); }
- virtual float get_param_value(int param_no);
- virtual void set_param_value(int param_no, float value);
- virtual bool activate_preset(int bank, int program);
- virtual char *configure(const char *key, const char *value);
- virtual float get_level(unsigned int port) { return 0.f; }
- virtual void execute(int cmd_no) {
- module->execute(cmd_no);
- }
- virtual void send_configures(send_configure_iface *sci) {
- module->send_configures(sci);
- }
- virtual int send_status_updates(send_updates_iface *sui, int last_serial) { return module->send_status_updates(sui, last_serial); }
- void run(unsigned long SampleCount);
-#if USE_DSSI
- /// Utility function: handle MIDI event (only handles a subset in this version)
- void process_dssi_event(snd_seq_event_t &event);
- void run_synth(unsigned long SampleCount, snd_seq_event_t *Events, unsigned long EventCount);
-#endif
- virtual const plugin_metadata_iface *get_metadata_iface() const
- {
- return metadata;
- }
-};
-
-/// Set of metadata produced by LADSPA wrapper for LADSPA-related purposes
-struct ladspa_plugin_metadata_set
-{
- /// LADSPA descriptor
- LADSPA_Descriptor descriptor;
- /// LADSPA descriptor for DSSI (uses a different name for the plugin, otherwise same as descriptor)
- LADSPA_Descriptor descriptor_for_dssi;
-#if USE_DSSI
- /// Extended DSSI descriptor (points to descriptor_for_dssi for things like name/label/port info etc.)
- DSSI_Descriptor dssi_descriptor;
- DSSI_Program_Descriptor dssi_default_program;
-
- std::vector<plugin_preset> *presets;
- std::vector<DSSI_Program_Descriptor> *preset_descs;
-#endif
-
- int input_count, output_count, param_count;
- const plugin_metadata_iface *metadata;
-
- ladspa_plugin_metadata_set();
- void prepare(const plugin_metadata_iface *md, LADSPA_Handle (*cb_instantiate)(const struct _LADSPA_Descriptor * Descriptor, unsigned long sample_rate));
- void prepare_dssi();
- ~ladspa_plugin_metadata_set();
-};
-
-/// A wrapper class for plugin class object (there is only one ladspa_wrapper singleton for many instances of the same plugin)
-template<class Module>
-struct ladspa_wrapper
-{
- static ladspa_plugin_metadata_set output;
-
-private:
- ladspa_wrapper(const plugin_metadata_iface *md)
- {
- output.prepare(md, cb_instantiate);
- }
-
-public:
- /// LADSPA instantiation function (create a plugin instance)
- static LADSPA_Handle cb_instantiate(const struct _LADSPA_Descriptor * Descriptor, unsigned long sample_rate)
- {
- return new ladspa_instance(new Module, &output, sample_rate);
- }
-
- /// Get a wrapper singleton - used to prevent initialization order problems which were present in older versions
- static ladspa_plugin_metadata_set &get() {
- static ladspa_wrapper instance(new typename Module::metadata_class);
- return instance.output;
- }
-};
-
-};
-
-#endif
-
-#endif
diff --git a/src/lv2gui.cpp b/src/lv2gui.cpp
index 12295a8..f1584d1 100644
--- a/src/lv2gui.cpp
+++ b/src/lv2gui.cpp
@@ -19,9 +19,7 @@
*/
#include <sys/wait.h>
#include "config.h"
-#if USE_LV2_GTK_GUI
#include <calf/gui.h>
-#endif
#include <calf/giface.h>
#include <calf/lv2_data_access.h>
#include <calf/lv2_ui.h>
@@ -190,7 +188,6 @@ void plugin_proxy_base::enable_all_sends()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#if USE_LV2_GTK_GUI
/// Plugin controller that uses LV2 host with help of instance/data access to remotely
/// control a plugin from the GUI
struct lv2_plugin_proxy: public plugin_ctl_iface, public plugin_proxy_base, public gui_environment
@@ -327,283 +324,8 @@ const void *gui_extension(const char *uri)
return NULL;
}
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////
-
-class ext_plugin_gui: public lv2_external_ui, public plugin_proxy_base, public osc_message_sink<osc_strstream>, public send_updates_iface
-{
-public:
- GPid child_pid;
- osc_server srv;
- osc_client cli;
- bool confirmed;
- string prefix;
- dssi_feedback_sender *feedback_sender;
- bool enable_graph_updates;
- osc_inline_typed_strstream status_data;
-
- ext_plugin_gui(const plugin_metadata_iface *metadata, LV2UI_Write_Function wf, LV2UI_Controller c, const LV2_Feature* const* f);
-
- bool initialise();
-
- void show_impl();
- void hide_impl();
- void run_impl();
- void port_event_impl(uint32_t port, uint32_t buffer_size, uint32_t format, const void *buffer);
-
- virtual void send_status(const char *key, const char *value);
- virtual void receive_osc_message(std::string address, std::string args, osc_strstream &buffer);
- virtual ~ext_plugin_gui();
-
-private:
- static void show_(lv2_external_ui *h) { ((ext_plugin_gui *)(h))->show_impl(); }
- static void hide_(lv2_external_ui *h) { ((ext_plugin_gui *)(h))->hide_impl(); }
- static void run_(lv2_external_ui *h) { ((ext_plugin_gui *)(h))->run_impl(); }
-};
-
-ext_plugin_gui::ext_plugin_gui(const plugin_metadata_iface *metadata, LV2UI_Write_Function wf, LV2UI_Controller c, const LV2_Feature* const* f)
-: plugin_proxy_base(metadata, wf, c, f)
-{
- confirmed = false;
- feedback_sender = NULL;
-
- show = show_;
- hide = hide_;
- run = run_;
-}
-
-bool ext_plugin_gui::initialise()
-{
- if (ext_ui_host == NULL)
- return false;
-
- srv.sink = this;
- srv.bind("127.0.0.1");
-
- return true;
-}
-
-void ext_plugin_gui::show_impl()
-{
- struct osc_configure_sender: public send_configure_iface
- {
- osc_client &cli;
-
- osc_configure_sender(osc_client &c)
- : cli(c)
- {
- }
-
- virtual void send_configure(const char *key, const char *value)
- {
- osc_inline_typed_strstream data;
- data << key;
- data << value;
- cli.send("/configure", data);
- }
- };
-
- osc_configure_sender sender(cli);
-
- if (instance)
- instance->send_configures(&sender);
-
- cli.send("/show");
-}
-
-void ext_plugin_gui::hide_impl()
-{
- cli.send("/hide");
-}
-
-void ext_plugin_gui::send_status(const char *key, const char *value)
-{
- status_data << key << value;
-}
-
-void ext_plugin_gui::port_event_impl(uint32_t port, uint32_t buffer_size, uint32_t format, const void *buffer)
-{
- assert(confirmed);
- assert(port >= (uint32_t)param_offset);
- if (port >= (uint32_t)param_offset)
- {
- int param = port - param_offset;
- if (!sends[param])
- return;
- TempSendSetter _a_(sends[param], false);
- if (format == 0)
- {
- osc_inline_typed_strstream data;
- data << port;
- data << *(float *)buffer;
- cli.send("/control", data);
- }
- }
-}
-
-void ext_plugin_gui::run_impl()
-{
- srv.read_from_socket();
- if (waitpid(child_pid, NULL, WNOHANG) != 0)
- {
- ext_ui_host->ui_closed(controller);
- return;
- }
- if (feedback_sender && enable_graph_updates)
- feedback_sender->update();
-}
-
-void ext_plugin_gui::receive_osc_message(std::string address, std::string args, osc_strstream &buffer)
-{
- if (address == "/bridge/update" && args == "s")
- {
- if (confirmed)
- {
- g_warning("Update message already received, ignoring");
- return;
- }
- string url;
- buffer >> url;
- cli.bind();
- cli.set_url(url.c_str());
- if (get_line_graph_iface())
- {
- feedback_sender = new dssi_feedback_sender(&cli, get_line_graph_iface());
- feedback_sender->add_graphs(plugin_metadata->get_param_props(0), param_count);
- }
- confirmed = true;
- }
- else
- if (address == "/bridge/control" && args == "if")
- {
- int port;
- float value;
- buffer >> port >> value;
- assert(port >= param_offset);
- send_float_to_host(port - param_offset, value);
- }
- else
- if (address == "/bridge/enable_updates" && args == "i")
- {
- int updates;
- buffer >> updates;
- enable_graph_updates = updates != 0;
- if (enable_graph_updates && feedback_sender)
- feedback_sender->update();
- }
- else
- if (address == "/bridge/configure" && (args == "s" || args == "ss"))
- {
- string key, value;
- buffer >> key;
- if (args == "ss")
- {
- buffer >> value;
- plugin_proxy_base::configure(key.c_str(), value.c_str());
- }
- else
- plugin_proxy_base::configure(key.c_str(), NULL);
- }
- else
- if (address == "/bridge/send_status" && args == "i")
- {
- if (instance)
- {
- int serial;
- buffer >> serial;
-
- status_data.clear();
- status_data << (uint32_t)instance->send_status_updates(this, serial);
- cli.send("/status_data", status_data);
- }
- }
- else
- srv.dump.receive_osc_message(address, args, buffer);
-}
-
-ext_plugin_gui::~ext_plugin_gui()
-{
- if (confirmed)
- {
- cli.send("/quit");
- }
- if (feedback_sender)
- delete feedback_sender;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////
-
-LV2UI_Handle extgui_instantiate(const struct _LV2UI_Descriptor* descriptor,
- const char* plugin_uri,
- const char* bundle_path,
- LV2UI_Write_Function write_function,
- LV2UI_Controller controller,
- LV2UI_Widget* widget,
- const LV2_Feature* const* features)
-{
- const plugin_metadata_iface *plugin_metadata = plugin_registry::instance().get_by_uri(plugin_uri);
- if (!plugin_metadata)
- return false;
-
- ext_plugin_gui *ui = new ext_plugin_gui(plugin_metadata, write_function, controller, features);
- if (!ui->initialise())
- return NULL;
-
- string url = ui->srv.get_url() + "/bridge";
- const gchar *argv[] = { "./calf_gtk", url.c_str(), "calf.so", plugin_uri, (ui->ext_ui_host->plugin_human_id ? ui->ext_ui_host->plugin_human_id : "Unknown"), NULL };
- GError *error = NULL;
- if (g_spawn_async(bundle_path, (gchar **)argv, NULL, (GSpawnFlags)G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &ui->child_pid, &error))
- {
- // wait for the sign of life from the GUI
- while(!ui->confirmed && waitpid(ui->child_pid, NULL, WNOHANG) == 0)
- {
- printf("Waiting for the GUI to open\n");
- ui->srv.read_from_socket();
- usleep(500000);
- }
-
- if (ui->confirmed)
- {
- *(lv2_external_ui **)widget = ui;
- ui->enable_all_sends();
- return (LV2UI_Handle)ui;
- }
- else
- {
- g_warning("The GUI exited before establishing contact with the host");
- return NULL;
- }
- }
- else
- {
- g_warning("%s", error->message);
- return NULL;
- }
-}
-
-void extgui_cleanup(LV2UI_Handle handle)
-{
- ext_plugin_gui *gui = (ext_plugin_gui *)handle;
- delete gui;
-}
-
-void extgui_port_event(LV2UI_Handle handle, uint32_t port, uint32_t buffer_size, uint32_t format, const void *buffer)
-{
- ((ext_plugin_gui *)handle)->port_event_impl(port, buffer_size, format, buffer);;
-}
-
-const void *extgui_extension(const char *uri)
-{
- printf("extgui_extension %s\n", uri);
- return NULL;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////
-
const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index)
{
-#if USE_LV2_GTK_GUI
static LV2UI_Descriptor gtkgui;
gtkgui.URI = "http://calf.sourceforge.net/plugins/gui/gtk2-gui";
gtkgui.instantiate = gui_instantiate;
@@ -612,15 +334,6 @@ const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index)
gtkgui.extension_data = gui_extension;
if (!index--)
return >kgui;
-#endif
- static LV2UI_Descriptor extgui;
- extgui.URI = "http://calf.sourceforge.net/plugins/gui/ext-gui";
- extgui.instantiate = extgui_instantiate;
- extgui.cleanup = extgui_cleanup;
- extgui.port_event = extgui_port_event;
- extgui.extension_data = extgui_extension;
- if (!index--)
- return &extgui;
return NULL;
}
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index 14b7cb8..052989a 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -1,6 +1,7 @@
/* Calf DSP Library
- * RDF file generator for LADSPA plugins.
- * Copyright (C) 2007 Krzysztof Foltman
+ * RDF file generator for LV2 plugins.
+ * Copyright (C) 2007-2011 Krzysztof Foltman and others.
+ * See AUTHORS file for a complete list.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -42,118 +43,6 @@ static struct option long_options[] = {
{0,0,0,0},
};
-#if USE_LADSPA
-
-static std::string unit_to_string(const parameter_properties &props)
-{
- uint32_t flags = props.flags & PF_UNITMASK;
-
- switch(flags) {
- case PF_UNIT_DB:
- return "ladspa:hasUnit=\"&ladspa;dB\" ";
- case PF_UNIT_COEF:
- return "ladspa:hasUnit=\"&ladspa;coef\" ";
- case PF_UNIT_HZ:
- return "ladspa:hasUnit=\"&ladspa;Hz\" ";
- case PF_UNIT_SEC:
- return "ladspa:hasUnit=\"&ladspa;seconds\" ";
- case PF_UNIT_MSEC:
- return "ladspa:hasUnit=\"&ladspa;milliseconds\" ";
- default:
- return string();
- }
-}
-
-static std::string scale_to_string(const parameter_properties &props)
-{
- if ((props.flags & PF_TYPEMASK) != PF_ENUM) {
- return "/";
- }
- string tmp = "><ladspa:hasScale><ladspa:Scale>\n";
- for (int i = (int)props.min; i <= (int)props.max; i++) {
- tmp += " <ladspa:hasPoint><ladspa:Point rdf:value=\""+i2s(i)+"\" ladspa:hasLabel=\""+props.choices[(int)(i - props.min)]+"\" /></ladspa:hasPoint>\n";
- }
- return tmp+" </ladspa:Scale></ladspa:hasScale></ladspa:InputControlPort";
-}
-
-std::string generate_ladspa_rdf(const ladspa_plugin_info &info, const parameter_properties *params, const char *param_names[], unsigned int count,
- unsigned int ctl_ofs)
-{
- string rdf;
- string plugin_id = "&ladspa;" + i2s(info.unique_id);
- string plugin_type = string(info.plugin_type);
-
- rdf += " <ladspa:" + plugin_type + " rdf:about=\"" + plugin_id + "\">\n";
- rdf += " <dc:creator>" + xml_escape(info.maker) + "</dc:creator>\n";
- rdf += " <dc:title>" + xml_escape(info.name) + "</dc:title>\n";
-
- for (unsigned int i = 0; i < count; i++) {
- rdf +=
- " <ladspa:hasPort>\n"
- " <ladspa:" + string(params[i].flags & PF_PROP_OUTPUT ? "Output" : "Input")
- + "ControlPort rdf:about=\"" + plugin_id + "."+i2s(ctl_ofs + i)+"\" "
- + unit_to_string(params[i]) +
- "ladspa:hasLabel=\"" + params[i].short_name + "\" "
- + scale_to_string(params[i]) +
- ">\n"
- " </ladspa:hasPort>\n";
- }
- rdf += " <ladspa:hasSetting>\n"
- " <ladspa:Default>\n";
- for (unsigned int i = 0; i < count; i++) {
- rdf +=
- " <ladspa:hasPortValue>\n"
- " <ladspa:PortValue rdf:value=\"" + f2s(params[i].def_value) + "\">\n"
- " <ladspa:forPort rdf:resource=\"" + plugin_id + "." + i2s(ctl_ofs + i) + "\"/>\n"
- " </ladspa:PortValue>\n"
- " </ladspa:hasPortValue>\n";
- }
- rdf += " </ladspa:Default>\n"
- " </ladspa:hasSetting>\n";
-
- rdf += " </ladspa:" + plugin_type + ">\n";
- return rdf;
-}
-
-void make_rdf()
-{
- string rdf;
- rdf =
- "<?xml version='1.0' encoding='ISO-8859-1'?>\n"
- "<!DOCTYPE rdf:RDF [\n"
- " <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>\n"
- " <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>\n"
- " <!ENTITY dc 'http://purl.org/dc/elements/1.1/'>\n"
- " <!ENTITY ladspa 'http://ladspa.org/ontology#'>\n"
- "]>\n";
-
- rdf += "<rdf:RDF xmlns:rdf=\"&rdf;\" xmlns:rdfs=\"&rdfs;\" xmlns:dc=\"&dc;\" xmlns:ladspa=\"&ladspa;\">\n";
-
- const plugin_registry::plugin_vector &plugins = plugin_registry::instance().get_all();
- set<int> used_ids;
- for (unsigned int i = 0; i < plugins.size(); i++)
- {
- const plugin_metadata_iface *p = plugins[i];
- const ladspa_plugin_info &info = p->get_plugin_info();
-
- if(used_ids.count(info.unique_id))
- {
- fprintf(stderr, "ERROR: Duplicate ID %d in plugin %s\n", info.unique_id, info.name);
- assert(0);
- }
- used_ids.insert(info.unique_id);
-
- if (!p->requires_midi()) {
- rdf += generate_ladspa_rdf(info, p->get_param_props(0), p->get_port_names(), p->get_param_count(), p->get_param_port_offset());
- }
- delete p;
- }
- rdf += "</rdf:RDF>\n";
-
- printf("%s\n", rdf.c_str());
-}
-#endif
-
#if USE_LV2
static void add_port(string &ports, const char *symbol, const char *name, const char *direction, int pidx, const char *type = "lv2:AudioPort", bool optional = false)
{
@@ -338,7 +227,6 @@ void make_ttl(string path_prefix)
#if USE_LV2_GUI
string gtkgui_uri = "<http://calf.sourceforge.net/plugins/gui/gtk2-gui>";
-#if USE_LV2_GTK_GUI
gui_header = gtkgui_uri + "\n"
" a uiext:GtkUI ;\n"
" uiext:binary <calflv2gui.so> ;\n"
@@ -346,13 +234,6 @@ void make_ttl(string path_prefix)
"\n"
;
#endif
- string extgui_uri = "<http://calf.sourceforge.net/plugins/gui/ext-gui>";
- gui_header += extgui_uri + "\n"
- " a uiext:external ;\n"
- " uiext:binary <calflv2gui.so> .\n"
- "\n"
- ;
-#endif
map<string, string> id_to_label;
@@ -373,10 +254,7 @@ void make_ttl(string path_prefix)
if (props.flags & PF_PROP_OUTPUT)
{
string portnot = " uiext:portNotification [\n uiext:plugin " + uri + " ;\n uiext:portIndex " + i2s(j) + "\n] .\n\n";
-#if USE_LV2_GTK_GUI
ttl += gtkgui_uri + portnot;
-#endif
- ttl += extgui_uri + portnot;
}
}
#endif
@@ -391,10 +269,7 @@ void make_ttl(string path_prefix)
ttl += " doap:maintainer [ foaf:name \""+string(lpi.maker)+"\" ; ] ;\n";
#if USE_LV2_GUI
-#if USE_LV2_GTK_GUI
ttl += " uiext:ui <http://calf.sourceforge.net/plugins/gui/gtk2-gui> ;\n";
-#endif
- ttl += " uiext:ui <http://calf.sourceforge.net/plugins/gui/ext-gui> ;\n";
ttl += " lv2:optionalFeature <http://lv2plug.in/ns/ext/instance-access> ;\n";
ttl += " lv2:optionalFeature <http://lv2plug.in/ns/ext/data-access> ;\n";
#endif
@@ -685,7 +560,7 @@ int main(int argc, char *argv[])
switch(c) {
case 'h':
case '?':
- printf("LADSPA RDF / LV2 TTL / XML GUI generator for Calf plugin pack\nSyntax: %s [--help] [--version] [--mode rdf|ttl|gui] [--path <path>]\n", argv[0]);
+ printf("LV2 TTL / XML GUI generator for Calf plugin pack\nSyntax: %s [--help] [--version] [--mode rdf|ttl|gui] [--path <path>]\n", argv[0]);
return 0;
case 'v':
printf("%s\n", PACKAGE_STRING);
@@ -712,10 +587,6 @@ int main(int argc, char *argv[])
if (false)
{
}
-#if USE_LADSPA
- else if (mode == "rdf")
- make_rdf();
-#endif
#if USE_LV2
else if (mode == "ttl")
make_ttl(path_prefix);
diff --git a/src/plugin.cpp b/src/plugin.cpp
index 568df81..326809a 100644
--- a/src/plugin.cpp
+++ b/src/plugin.cpp
@@ -19,7 +19,6 @@
* Boston, MA 02110-1301 USA
*/
#include <config.h>
-#include <calf/ladspa_wrap.h>
#include <calf/lv2wrap.h>
#include <calf/modules.h>
#include <calf/modules_comp.h>
@@ -35,447 +34,6 @@
using namespace calf_plugins;
using namespace osctl;
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if USE_LADSPA
-
-ladspa_instance::ladspa_instance(audio_module_iface *_module, ladspa_plugin_metadata_set *_ladspa, int sample_rate)
-{
- module = _module;
- metadata = module->get_metadata_iface();
- ladspa = _ladspa;
-
- module->get_port_arrays(ins, outs, params);
-
- activate_flag = true;
-#if USE_DSSI
- feedback_sender = NULL;
-#endif
-
- module->set_sample_rate(sample_rate);
- module->post_instantiate();
-}
-
-float ladspa_instance::get_param_value(int param_no)
-{
- // XXXKF hack
- if (param_no >= ladspa->param_count)
- return 0;
- return *params[param_no];
-}
-
-void ladspa_instance::set_param_value(int param_no, float value)
-{
- // XXXKF hack
- if (param_no >= ladspa->param_count)
- return;
- *params[param_no] = value;
-}
-
-bool ladspa_instance::activate_preset(int bank, int program)
-{
- return false;
-}
-
-/// LADSPA run function - does set sample rate / activate logic when it's run first time after activation
-void ladspa_instance::run(unsigned long SampleCount)
-{
- if (activate_flag)
- {
- module->activate();
- activate_flag = false;
- }
- module->params_changed();
- module->process_slice(0, SampleCount);
-}
-
-#if USE_DSSI
-
-void ladspa_instance::run_synth(unsigned long SampleCount, snd_seq_event_t *Events, unsigned long EventCount)
-{
- if (activate_flag)
- {
- module->activate();
- activate_flag = false;
- }
- module->params_changed();
-
- uint32_t offset = 0;
- for (uint32_t e = 0; e < EventCount; e++)
- {
- uint32_t timestamp = Events[e].time.tick;
- if (timestamp != offset)
- module->process_slice(offset, timestamp);
- process_dssi_event(Events[e]);
- offset = timestamp;
- }
- if (offset != SampleCount)
- module->process_slice(offset, SampleCount);
-}
-
-#endif
-
-char *ladspa_instance::configure(const char *key, const char *value)
-{
-#if USE_DSSI_GUI
- if (!strcmp(key, "OSC:FEEDBACK_URI"))
- {
- const line_graph_iface *lgi = dynamic_cast<const line_graph_iface *>(metadata);
- //if (!lgi)
- // return NULL;
- if (*value)
- {
- if (feedback_sender) {
- delete feedback_sender;
- feedback_sender = NULL;
- }
- feedback_sender = new dssi_feedback_sender(value, lgi);
- feedback_sender->add_graphs(metadata->get_param_props(0), metadata->get_param_count());
- }
- else
- {
- if (feedback_sender) {
- delete feedback_sender;
- feedback_sender = NULL;
- }
- }
- return NULL;
- }
- else
- if (!strcmp(key, "OSC:UPDATE"))
- {
- if (feedback_sender)
- feedback_sender->update();
- return NULL;
- }
- else
- if (!strcmp(key, "OSC:SEND_STATUS"))
- {
- if (!feedback_sender)
- return NULL;
- struct status_gatherer: public send_updates_iface
- {
- osc_inline_typed_strstream str;
- void send_status(const char *key, const char *value)
- {
- str << key << value;
- }
- } sg;
- int serial = atoi(value);
- serial = module->send_status_updates(&sg, serial);
- sg.str << (uint32_t)serial;
- feedback_sender->client->send("/status_data", sg.str);
- return NULL;
- }
- else
-#endif
- if (!strcmp(key, "ExecCommand"))
- {
- if (*value)
- {
- execute(atoi(value));
- }
- return NULL;
- }
- return module->configure(key, value);
-}
-
-template<class Module>
-ladspa_plugin_metadata_set ladspa_wrapper<Module>::output;
-
-#if USE_DSSI
-
-/// Utility function: handle MIDI event (only handles a subset in this version)
-void ladspa_instance::process_dssi_event(snd_seq_event_t &event)
-{
- switch(event.type) {
- case SND_SEQ_EVENT_NOTEON:
- module->note_on(event.data.note.channel, event.data.note.note, event.data.note.velocity);
- break;
- case SND_SEQ_EVENT_NOTEOFF:
- module->note_off(event.data.note.channel, event.data.note.note, event.data.note.velocity);
- break;
- case SND_SEQ_EVENT_PGMCHANGE:
- module->program_change(event.data.control.channel, event.data.control.value);
- break;
- case SND_SEQ_EVENT_CONTROLLER:
- module->control_change(event.data.control.channel, event.data.control.param, event.data.control.value);
- break;
- case SND_SEQ_EVENT_PITCHBEND:
- module->pitch_bend(event.data.control.channel, event.data.control.value);
- break;
- case SND_SEQ_EVENT_CHANPRESS:
- module->channel_pressure(event.data.control.channel, event.data.control.value);
- break;
- }
-}
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// LADSPA callbacks
-
-/// LADSPA activate function (note that at this moment the ports are not set)
-static void cb_activate(LADSPA_Handle Instance)
-{
- ((ladspa_instance *)(Instance))->activate_flag = true;
-}
-
-/// LADSPA run function - does set sample rate / activate logic when it's run first time after activation
-static void cb_run(LADSPA_Handle Instance, unsigned long SampleCount) {
- ((ladspa_instance *)(Instance))->run(SampleCount);
-}
-
-/// LADSPA port connection function
-static void cb_connect(LADSPA_Handle Instance, unsigned long port, LADSPA_Data *DataLocation)
-{
- ladspa_instance *const mod = (ladspa_instance *)Instance;
-
- int first_out = mod->ladspa->input_count;
- int first_param = first_out + mod->ladspa->output_count;
- int ladspa_port_count = first_param + mod->ladspa->param_count;
-
- if ((int)port < first_out)
- mod->ins[port] = DataLocation;
- else if ((int)port < first_param)
- mod->outs[port - first_out] = DataLocation;
- else if ((int)port < ladspa_port_count) {
- int i = port - first_param;
- mod->params[i] = DataLocation;
- *mod->params[i] = mod->metadata->get_param_props(i)->def_value;
- }
-}
-
-
-/// LADSPA deactivate function
-static void cb_deactivate(LADSPA_Handle Instance) {
- ((ladspa_instance *)(Instance))->module->deactivate();
-}
-
-/// LADSPA cleanup (delete instance) function
-static void cb_cleanup(LADSPA_Handle Instance) {
- delete ((ladspa_instance *)(Instance));
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// DSSI callbacks
-
-#if USE_DSSI
-/// DSSI "run synth" function, same as run() except it allows for event delivery
-static void cb_run_synth(LADSPA_Handle Instance, unsigned long SampleCount,
- snd_seq_event_t *Events, unsigned long EventCount) {
- ((ladspa_instance *)(Instance))->run_synth(SampleCount, Events, EventCount);
-}
-
-/// DSSI configure function (named properties)
-static char *cb_configure(LADSPA_Handle Instance,
- const char *Key,
- const char *Value)
-{
- return ((ladspa_instance *)(Instance))->configure(Key, Value);
-}
-
-/// DSSI get program descriptor function; for 0, it returns the default program (from parameter properties table), for others, it uses global or user preset
-static const DSSI_Program_Descriptor *cb_get_program(LADSPA_Handle Instance, unsigned long index)
-{
- ladspa_plugin_metadata_set *ladspa = ((ladspa_instance *)(Instance))->ladspa;
- if (index > ladspa->presets->size())
- return NULL;
- if (index)
- return &(*ladspa->preset_descs)[index - 1];
- return &ladspa->dssi_default_program;
-}
-
-/// DSSI select program function; for 0, it sets the defaults, for others, it sets global or user preset
-static void cb_select_program(LADSPA_Handle Instance, unsigned long Bank, unsigned long Program)
-{
- ladspa_instance *mod = (ladspa_instance *)Instance;
- ladspa_plugin_metadata_set *ladspa = mod->ladspa;
- unsigned int no = (Bank << 7) + Program - 1;
- // printf("no = %d presets = %p:%d\n", no, presets, presets->size());
- if (no == -1U) {
- int rpc = ladspa->param_count;
- for (int i =0 ; i < rpc; i++)
- *mod->params[i] = mod->metadata->get_param_props(i)->def_value;
- return;
- }
- if (no >= ladspa->presets->size())
- return;
- plugin_preset &p = (*ladspa->presets)[no];
- // printf("activating preset %s\n", p.name.c_str());
- p.activate(mod);
-}
-
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ladspa_plugin_metadata_set::ladspa_plugin_metadata_set()
-{
- metadata = NULL;
- memset(&descriptor, 0, sizeof(descriptor));
-
-#if USE_DSSI
- presets = NULL;
- preset_descs = NULL;
- memset(&descriptor_for_dssi, 0, sizeof(descriptor_for_dssi));
- memset(&dssi_descriptor, 0, sizeof(dssi_descriptor));
-#endif
-}
-
-void ladspa_plugin_metadata_set::prepare(const plugin_metadata_iface *md, LADSPA_Handle (*cb_instantiate)(const struct _LADSPA_Descriptor * Descriptor, unsigned long sample_rate))
-{
- metadata = md;
-
- input_count = md->get_input_count();
- output_count = md->get_output_count();
- param_count = md->get_param_count(); // XXXKF ladspa_instance<Module>::real_param_count();
-
- const ladspa_plugin_info &plugin_info = md->get_plugin_info();
- descriptor.UniqueID = plugin_info.unique_id;
- descriptor.Label = plugin_info.label;
- descriptor.Name = strdup((std::string(plugin_info.name) + " LADSPA").c_str());
- descriptor.Maker = plugin_info.maker;
- descriptor.Copyright = plugin_info.copyright;
- descriptor.Properties = md->is_rt_capable() ? LADSPA_PROPERTY_HARD_RT_CAPABLE : 0;
- descriptor.PortCount = input_count + output_count + param_count;
- descriptor.PortNames = new char *[descriptor.PortCount];
- descriptor.PortDescriptors = new LADSPA_PortDescriptor[descriptor.PortCount];
- descriptor.PortRangeHints = new LADSPA_PortRangeHint[descriptor.PortCount];
- int i;
- for (i = 0; i < input_count + output_count; i++)
- {
- LADSPA_PortRangeHint &prh = ((LADSPA_PortRangeHint *)descriptor.PortRangeHints)[i];
- ((int *)descriptor.PortDescriptors)[i] = i < input_count ? LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO
- : LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
- prh.HintDescriptor = 0;
- ((const char **)descriptor.PortNames)[i] = md->get_port_names()[i];
- }
- for (; i < input_count + output_count + param_count; i++)
- {
- LADSPA_PortRangeHint &prh = ((LADSPA_PortRangeHint *)descriptor.PortRangeHints)[i];
- const parameter_properties &pp = *md->get_param_props(i - input_count - output_count);
- ((int *)descriptor.PortDescriptors)[i] =
- LADSPA_PORT_CONTROL | (pp.flags & PF_PROP_OUTPUT ? LADSPA_PORT_OUTPUT : LADSPA_PORT_INPUT);
- prh.HintDescriptor = LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW;
- ((const char **)descriptor.PortNames)[i] = pp.name;
- prh.LowerBound = pp.min;
- prh.UpperBound = pp.max;
- switch(pp.flags & PF_TYPEMASK) {
- case PF_BOOL:
- prh.HintDescriptor |= LADSPA_HINT_TOGGLED;
- prh.HintDescriptor &= ~(LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW);
- break;
- case PF_INT:
- case PF_ENUM:
- prh.HintDescriptor |= LADSPA_HINT_INTEGER;
- break;
- default: {
- int defpt = (int)(100 * (pp.def_value - pp.min) / (pp.max - pp.min));
- if ((pp.flags & PF_SCALEMASK) == PF_SCALE_LOG)
- defpt = (int)(100 * log(pp.def_value / pp.min) / log(pp.max / pp.min));
- if (defpt < 12)
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_MINIMUM;
- else if (defpt < 37)
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_LOW;
- else if (defpt < 63)
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_MIDDLE;
- else if (defpt < 88)
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_HIGH;
- else
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_MAXIMUM;
- }
- }
- if (pp.def_value == 0 || pp.def_value == 1 || pp.def_value == 100 || pp.def_value == 440 ) {
- prh.HintDescriptor &= ~LADSPA_HINT_DEFAULT_MASK;
- if (pp.def_value == 1)
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_1;
- else if (pp.def_value == 100)
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_100;
- else if (pp.def_value == 440)
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_440;
- else
- prh.HintDescriptor |= LADSPA_HINT_DEFAULT_0;
- }
- switch(pp.flags & PF_SCALEMASK) {
- case PF_SCALE_LOG:
- prh.HintDescriptor |= LADSPA_HINT_LOGARITHMIC;
- break;
- }
- }
- descriptor.ImplementationData = this;
- descriptor.instantiate = cb_instantiate;
- descriptor.connect_port = cb_connect;
- descriptor.activate = cb_activate;
- descriptor.run = cb_run;
- descriptor.run_adding = NULL;
- descriptor.set_run_adding_gain = NULL;
- descriptor.deactivate = cb_deactivate;
- descriptor.cleanup = cb_cleanup;
- prepare_dssi();
-}
-
-void ladspa_plugin_metadata_set::prepare_dssi()
-{
-#if USE_DSSI
- const ladspa_plugin_info &plugin_info = metadata->get_plugin_info();
- memcpy(&descriptor_for_dssi, &descriptor, sizeof(descriptor));
- descriptor_for_dssi.Name = strdup((std::string(plugin_info.name) + " DSSI").c_str());
- memset(&dssi_descriptor, 0, sizeof(dssi_descriptor));
- dssi_descriptor.DSSI_API_Version = 1;
- dssi_descriptor.LADSPA_Plugin = &descriptor_for_dssi;
- dssi_descriptor.configure = cb_configure;
- dssi_descriptor.get_program = cb_get_program;
- dssi_descriptor.select_program = cb_select_program;
- if (metadata->get_midi())
- dssi_descriptor.run_synth = cb_run_synth;
-
- presets = new std::vector<plugin_preset>;
- preset_descs = new std::vector<DSSI_Program_Descriptor>;
-
- preset_list plist_tmp, plist;
- plist.load_defaults(true);
- plist_tmp.load_defaults(false);
- plist.presets.insert(plist.presets.end(), plist_tmp.presets.begin(), plist_tmp.presets.end());
-
- // XXXKF this assumes that plugin name in preset is case-insensitive equal to plugin label
- // if I forget about this, I'll be in a deep trouble
- dssi_default_program.Bank = 0;
- dssi_default_program.Program = 0;
- dssi_default_program.Name = "default";
-
- int pos = 1;
- for (unsigned int i = 0; i < plist.presets.size(); i++)
- {
- plugin_preset &pp = plist.presets[i];
- if (strcasecmp(pp.plugin.c_str(), descriptor.Label))
- continue;
- DSSI_Program_Descriptor pd;
- pd.Bank = pos >> 7;
- pd.Program = pos++;
- pd.Name = pp.name.c_str();
- preset_descs->push_back(pd);
- presets->push_back(pp);
- }
-#endif
-}
-
-ladspa_plugin_metadata_set::~ladspa_plugin_metadata_set()
-{
- delete []descriptor.PortNames;
- delete []descriptor.PortDescriptors;
- delete []descriptor.PortRangeHints;
-#if USE_DSSI
- if (presets)
- presets->clear();
- if (preset_descs)
- preset_descs->clear();
- delete presets;
- delete preset_descs;
-#endif
-}
-
-#endif
-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
#if USE_LV2
@@ -497,33 +55,6 @@ const LV2_Descriptor *lv2_descriptor(uint32_t index)
#endif
-#if USE_LADSPA
-extern "C" {
-
-const LADSPA_Descriptor *ladspa_descriptor(unsigned long Index)
-{
- #define PER_MODULE_ITEM(name, isSynth, jackname) if (!isSynth && !(Index--)) return &ladspa_wrapper<name##_audio_module>::get().descriptor;
- #include <calf/modulelist.h>
- return NULL;
-}
-
-};
-
-#if USE_DSSI
-extern "C" {
-
-const DSSI_Descriptor *dssi_descriptor(unsigned long Index)
-{
- #define PER_MODULE_ITEM(name, isSynth, jackname) if (!(Index--)) return &calf_plugins::ladspa_wrapper<name##_audio_module>::get().dssi_descriptor;
- #include <calf/modulelist.h>
- return NULL;
-}
-
-};
-#endif
-
-#endif
-
#if USE_JACK
extern "C" {
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list