From 34b181465b17c6460e055f89d9ad1b47d4517a1b Mon Sep 17 00:00:00 2001
From: Felipe Sateler
Date: Sat, 13 Apr 2019 13:53:59 -0400
Subject: New upstream version 1.15
---
doc/background.html | 50 +++++++++++++++-
doc/changes.html | 147 +++++++++++++++++++++++++++++++++++++----------
doc/download.html | 75 ++++++++++++++++++++----
doc/example_plugins.html | 51 +++++++++++++++-
doc/index.html | 49 +++++++++++-----
doc/installation.html | 72 +++++++++++++++++++----
doc/license.html | 47 +++++++++++++++
doc/overview.html | 49 +++++++++++++++-
doc/shared_plugins.html | 47 +++++++++++++++
doc/unique_ids.html | 53 ++++++++++++++++-
src/Makefile | 145 ++++++++++++++++++++++++++++++++++++++++++++++
src/gcc_exports.map | 7 +++
src/load.c | 61 ++++++++++----------
src/makefile | 126 ----------------------------------------
src/plugins/amp.c | 26 ++++-----
src/plugins/delay.c | 24 ++++----
src/plugins/filter.c | 30 +++++-----
src/plugins/noise.c | 26 ++++-----
src/plugins/sine.cpp | 52 +++++++++++------
src/search.c | 8 ++-
src/utils.h | 33 +++++++++++
21 files changed, 866 insertions(+), 312 deletions(-)
create mode 100644 src/Makefile
create mode 100644 src/gcc_exports.map
delete mode 100644 src/makefile
diff --git a/doc/background.html b/doc/background.html
index ba9af8d..5f923d4 100644
--- a/doc/background.html
+++ b/doc/background.html
@@ -1,8 +1,20 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
Background
The Linux Audio Developer's Simple Plugin API (LADSPA) originates
-in frustration on the part of Richard Furse with the lack
+in frustration on the part of Richard Furse with the lack
of consensus on a standard audio plugin API for Linux. The API is
intended to describe a very light-weight plugin form that can be
handled by many types of host. To achieve this simplicity various
@@ -20,3 +32,37 @@ additional contributions have been made by the members of the Linux
Audio Developer's mailing list after whom the plugin is named. Thanks
in particular to Alexander Konig.
+
+
+
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/changes.html b/doc/changes.html
index ecf0a85..b6d8e89 100644
--- a/doc/changes.html
+++ b/doc/changes.html
@@ -1,120 +1,205 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
Changes
[Version numbers relate to the SDK, not the ladspa.h
-header file itself.]
+ header file itself.]
Version 1.01 - 2 Apr 2000
-- Initial Release with header file, limited documentation, three
-plugins and two hosts.
+ - Initial Release with header file, limited documentation, three
+ plugins and two hosts.
Version 1.02 - 4 May 2000
-- Introduction of version numbering for SDK.
+ - Introduction of version numbering for SDK.
-- Plugins added, bringing basic example set to ten. Further
-development of basic plugins for serious use shifted away to the CMT
-project.
+ - Plugins added, bringing basic example set to ten. Further
+ development of basic plugins for serious use shifted away to the CMT
+ project.
-- Bug fix to applyplugin when handling channel count changes.
+ - Bug fix to applyplugin when handling channel count changes.
-- Introduce support for the
LADSPA_PATH
environment
-variable to both example hosts.
+ - Introduce support for the
LADSPA_PATH
environment
+ variable to both example hosts.
Version 1.03 - 4 May 2000
-- Documentation Converted to HTML.
+ - Documentation Converted to HTML.
Version 1.04 - 11 May 2000
-- Use
_init()
and _fini()
in example
-plugins.
+ - Use
_init()
and _fini()
in example
+ plugins.
Version 1.05 - 14 May 2000
-- Updated to correspond to http://www.ladspa.org/.
+ - Updated to correspond to http://www.ladspa.org/.
Version 1.06 - 18 May 2000
-- Add listplugins program.
+ - Add listplugins program.
Version 1.07 - 24 Sep 2000
-- Discourage reliance on LD_LIBRARY_PATH by stopping analyseplugin
-and applyplugin from searching it when looking for LADSPA
-plugins.
+ - Discourage reliance on LD_LIBRARY_PATH by stopping analyseplugin
+ and applyplugin from searching it when looking for LADSPA
+ plugins.
Version 1.08 - 30 Sep 2000
-- Use constructor/destructor rather than _fini() and _init() in
-C++. Use C++ for linkage.
+ - Use constructor/destructor rather than _fini() and _init() in
+ C++. Use C++ for linkage.
Version 1.09 - 4 Nov 2000
-- Add optional plugin label parameter to analyseplugin.
+ - Add optional plugin label parameter to analyseplugin.
Version 1.10 - 8 May 2001
-- Introduction of LGPL license.
+ - Introduction of LGPL license.
-- Removal of superfluous semicolon on line 492 of header file.
+ - Removal of superfluous semicolon on line 492 of header file.
Version 1.11 - 21 Jul 2001
-- Remove memory leak in search code.
+ - Remove memory leak in search code.
Version 1.12 - 7 Aug 2002
-- Update for LADSPA v1.1 (default values and 1.0f=0dB).
+ - Update for LADSPA v1.1 (default values and 1.0f=0dB).
Version 1.13 - 6 Nov 2007
-- Fix compile error in sine.cpp (GCC4).
+ - Fix compile error in sine.cpp (GCC4).
+
+ - Fix typo in text output by analyseplugin.
+
+ - Extra usage text in analyseplugin and applyplugin.
+
+ - Replace strdup() with localStrdup() in sine.cpp to avoid
+ malloc/new mismatch.
+
+ - Remove "local" part from install directories.
+
+
+
+Version 1.14 - 3 Jan 2019
+
+
+ - Rename Makefile.
+
+ - Modernise C++ #include style.
+
+ - Make some globals static.
+
+ - Use mkdir -p rather than mkdirhier during build.
+
+ - Use GCC export map to ensure only the ladspa_descriptor()
+ exported.
+
+ - Put libraries at the end of link instructions.
+
+ - Package with version number in archive and directory names.
+
+ - Tweaks to documentation processing.
+
+ - Fix bug in LADSPA plugin search which did not handle shared
+ libraries that are not plugins correctly.
+
+ - Introduce a default LADSPA plugin search path.
+
+
+
+Version 1.15 - 6 Jan 2019
+
+
+ - Perform macro string expansion in C code rather than in Makefile
+ for better portability.
-- Fix typo in text output by analyseplugin.
+ - Modernise init()/fini() style in GNU C plugin builds (not C++),
+ tweak link line to correspond.
+
+
-Extra usage text in analyseplugin and applyplugin.
+
-Replace strdup() with localStrdup() in sine.cpp to avoid
-malloc/new mismatch.
+LADSPA SDK Index
-Remove "local" part from install directories.
+
+
+Other Links
+
+
+
+
+
+
+
+
+
diff --git a/doc/download.html b/doc/download.html
index fdeb431..0824f39 100644
--- a/doc/download.html
+++ b/doc/download.html
@@ -1,20 +1,71 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
Download
Please select the file you wish to download:
-
-File |
-Description |
-
+
+ File |
+ Description |
+
+
+
+
+
+ ladspa_sdk_1.15.tgz
+ |
+
+ The LADSPA SDK, including the ladspa.h API header
+ file, ten example LADSPA plugins and three example programs
+ (applyplugin, analyseplugin and listplugins).
+ |
+
+
+
-
-
-ladspa_sdk.tgz |
-The LADSPA SDK, including the ladspa.h API header
-file, ten example LADSPA plugins and three example programs
-(applyplugin, analyseplugin and listplugins). |
-
+
-
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/example_plugins.html b/doc/example_plugins.html
index a42250d..26fa549 100644
--- a/doc/example_plugins.html
+++ b/doc/example_plugins.html
@@ -1,3 +1,16 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
Example Plugins
Ten example plugins are provided. These provide a rudimentary basis
@@ -8,8 +21,8 @@ rather crude and failures during malloc()
will produce
unpleasant behaviour.
Note that these plugins are examples. More polished versions of
-them all are included within the CMT plugin
+them all are included within
+the CMT plugin
set.
The following plugins are provided:
@@ -88,3 +101,37 @@ control.
+
+
+
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/index.html b/doc/index.html
index fb7f61b..7fb01f4 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -1,25 +1,44 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
LADSPA SDK Index
Other Links
-The author Richard Furse can be emailed as
-richard@muse.demon.co.uk.
-
+
+
+
+
+
+
+
diff --git a/doc/installation.html b/doc/installation.html
index 1b0b339..061eb80 100644
--- a/doc/installation.html
+++ b/doc/installation.html
@@ -1,19 +1,67 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
Installation
This distribution includes both the ladspa.h API header file and a
-number of hosts and example plugins. Go to the src/
-directory and type make
to build and test them.
+ number of hosts and example plugins. Go to the src/
+ directory and type make
to build and test them.
The ladspa.h
API header
-file is needed to build hosts and plugins. It may be useful to
-install it in /usr/local/include/
or
-/usr/include/
. The programs generated in the
-bin/
directory may be moved to
-/usr/local/bin/
or /usr/bin/
and the plugins
-generated in the plugins/
directory may be moved to
-/usr/local/lib/ladspa/
or
-/usr/lib/ladspa/
.
+ file is needed to build hosts and plugins. It may be useful to
+ install it in /usr/local/include/
or
+ /usr/include/
. The programs generated in the
+ bin/
directory may be moved to
+ /usr/local/bin/
or /usr/bin/
and the
+ plugins generated in the plugins/
directory may be
+ moved to
+ /usr/local/lib/ladspa/
or
+ /usr/lib/ladspa/
.
To perform automatic installation, log in as root and run
-make install
. This by default will install plugins, hosts
-and the header file into the /usr/local/
tree.
+ make install
. This by default will install plugins,
+ hosts and the header file into the /usr/
tree.
+
+
+
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/license.html b/doc/license.html
index 3e740ff..019a343 100644
--- a/doc/license.html
+++ b/doc/license.html
@@ -1,3 +1,16 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
LADSPA and LADSPA SDK License
The LADSPA Software Development Kit and the LADSPA plugin API
@@ -11,3 +24,37 @@ applications can use it without having to use a derived LGPL library
that LGPL is already free enough for this, but we aren't sure. Does
anyone want to pay for a lawyer? In the meantime, please mail me if
this is an issue for you.
+
+
+
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/overview.html b/doc/overview.html
index e19e21f..ef79ecd 100644
--- a/doc/overview.html
+++ b/doc/overview.html
@@ -1,4 +1,17 @@
-LADSPA SDK v1.13 Overview
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
+LADSPA SDK v1.15 Overview
There is a large number of synthesis packages in use or development
on the Linux platform at this time. The Linux Audio Developer's Simple
@@ -32,3 +45,37 @@ further development.
as the basis for further development.
+
+
+
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/shared_plugins.html b/doc/shared_plugins.html
index 721c6a2..f94b21c 100644
--- a/doc/shared_plugins.html
+++ b/doc/shared_plugins.html
@@ -1,3 +1,16 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
Shared Plugins
Plugins may be used by a range of different hosts. However, the
@@ -20,3 +33,37 @@ LADSPA_PATH=$LADSPA_PATH:/home/<user>/.ladspa:/usr/local/lib/ladspa:/usr/l
To list the plugins that can be found on your
LADSPA_PATH
, run the listplugins
program.
+
+
+
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/unique_ids.html b/doc/unique_ids.html
index c923867..3a32ff0 100644
--- a/doc/unique_ids.html
+++ b/doc/unique_ids.html
@@ -1,9 +1,22 @@
+
+
+ LADSPA SDK Documentation
+
+
+
+
+
+
+
+
+
Unique IDs
Plugin types are identified by unique IDs. At the time of writing
-plugin writers may request these from ladspa@muse.demon.co.uk.
-This may change, in which case
+plugin writers may request these
+from ids@ladspa.org. This may
+change, in which case
http://www.ladspa.org is likely to provide information on new
sources.
@@ -15,3 +28,37 @@ ID 0 will never be allocated.
event that this range needs to be extended it will be, possibly with
the addition of a second dimension (e.g. developer ID). In the
meantime hosts may assume that IDs will not exceed 0x00FFFFFF.
+
+
+
+LADSPA SDK Index
+
+
+
+Other Links
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..c339524
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,145 @@
+###############################################################################
+#
+# Installation DIRECTORIES
+#
+# Change these if you want to install somewhere else.
+
+INSTALL_PLUGINS_DIR = /usr/lib/ladspa/
+INSTALL_INCLUDE_DIR = /usr/include/
+INSTALL_BINARY_DIR = /usr/bin/
+
+###############################################################################
+#
+# GENERAL
+#
+
+INCLUDES = -I.
+LIBRARIES = -ldl -lm
+CFLAGS = $(INCLUDES) -Wall -Werror -O2 -fPIC \
+ -DDEFAULT_LADSPA_PATH=$(INSTALL_PLUGINS_DIR)
+BINFLAGS = -fPIE -pie
+CXXFLAGS = $(CFLAGS)
+PLUGINS = ../plugins/amp.so \
+ ../plugins/delay.so \
+ ../plugins/filter.so \
+ ../plugins/noise.so \
+ ../plugins/sine.so
+PROGRAMS = ../bin/analyseplugin \
+ ../bin/applyplugin \
+ ../bin/listplugins
+CC = cc
+CPP = c++
+
+###############################################################################
+#
+# RULES TO BUILD PLUGINS FROM C OR C++ CODE
+#
+
+../plugins/%.so: plugins/%.c ladspa.h gcc_exports.map
+ $(CC) $(CFLAGS) -o plugins/$*.o -c plugins/$*.c
+ $(CC) -o ../plugins/$*.so \
+ plugins/$*.o \
+ -shared \
+ $(CFLAGS) \
+ -fvisibility=hidden \
+ -fvisibility-inlines-hidden \
+ -s \
+ -Wl,--version-script=gcc_exports.map
+
+../plugins/%.so: plugins/%.cpp ladspa.h gcc_exports.map
+ $(CPP) $(CXXFLAGS) -o plugins/$*.o -c plugins/$*.cpp
+ $(CPP) -o ../plugins/$*.so \
+ plugins/$*.o \
+ -shared \
+ $(CXXFLAGS) \
+ -fvisibility=hidden \
+ -fvisibility-inlines-hidden \
+ -s \
+ -Wl,--version-script=gcc_exports.map
+
+###############################################################################
+#
+# TARGETS
+#
+
+test: /tmp/test.wav ../snd/noise.wav always
+ @echo ---------------------------------------------
+ @echo First listen to the white noise input signal:
+ @echo ---------------------------------------------
+ -sndfile-play ../snd/noise.wav
+ @echo -------------------------
+ @echo Compare to plugin output.
+ @echo -------------------------
+ @echo Should be a noise band around 6000Hz, repeated quietly after 1s.
+ -sndfile-play /tmp/test.wav
+ @echo Test complete.
+
+install: targets
+ -mkdir -p $(INSTALL_PLUGINS_DIR)
+ -mkdir -p $(INSTALL_INCLUDE_DIR)
+ -mkdir -p $(INSTALL_BINARY_DIR)
+ cp ../plugins/* $(INSTALL_PLUGINS_DIR)
+ cp ladspa.h $(INSTALL_INCLUDE_DIR)
+ cp ../bin/* $(INSTALL_BINARY_DIR)
+
+/tmp/test.wav: targets ../snd/noise.wav
+ ../bin/listplugins
+ ../bin/analyseplugin ../plugins/filter.so
+ ../bin/analyseplugin ../plugins/delay.so
+ ../bin/analyseplugin ../plugins/sine.so
+ echo ; ../bin/analyseplugin -l ../plugins/sine.so ; echo
+ ../bin/analyseplugin ../plugins/amp.so
+ ../bin/analyseplugin ../plugins/noise.so
+ ../bin/applyplugin -s 1 \
+ ../snd/noise.wav /tmp/test.wav \
+ ../plugins/filter.so lpf 500 \
+ ../plugins/filter.so lpf 500 \
+ ../plugins/sine.so sine_fcaa 6000 \
+ ../plugins/delay.so delay_5s 1 0.1 \
+ ../plugins/amp.so amp_mono 4 \
+
+targets: $(PLUGINS) $(PROGRAMS)
+
+###############################################################################
+#
+# PROGRAMS
+#
+
+../bin/applyplugin: applyplugin.o load.o default.o
+ $(CC) $(CFLAGS) $(BINFLAGS) \
+ -o ../bin/applyplugin \
+ applyplugin.o load.o default.o \
+ $(LIBRARIES)
+
+../bin/analyseplugin: analyseplugin.o load.o default.o
+ $(CC) $(CFLAGS) $(BINFLAGS) \
+ -o ../bin/analyseplugin \
+ analyseplugin.o load.o default.o \
+ $(LIBRARIES)
+
+../bin/listplugins: listplugins.o search.o
+ $(CC) $(CFLAGS) $(BINFLAGS) \
+ -o ../bin/listplugins \
+ listplugins.o search.o \
+ $(LIBRARIES)
+
+###############################################################################
+#
+# UTILITIES
+#
+
+always:
+
+clean:
+ -rm -f `find . -name "*.o"` ../bin/* ../plugins/*
+ -rm -f `find .. -name "*~"`
+ -rm -f *.bak core score.srt
+ -rm -f *.bb *.bbg *.da *-ann gmon.out bb.out
+ -rm -f `find .. -name "*.class"`
+
+backup: clean
+ (cd ../../; \
+ tar czf `date '+../backup/ladspa_sdk.%Y%m%d%H%M.tgz'` ladspa_sdk/)
+
+###############################################################################
+
diff --git a/src/gcc_exports.map b/src/gcc_exports.map
new file mode 100644
index 0000000..7333e5a
--- /dev/null
+++ b/src/gcc_exports.map
@@ -0,0 +1,7 @@
+LADSPA_SDK
+{
+ global:
+ ladspa_descriptor;
+ local:
+ *;
+};
diff --git a/src/load.c b/src/load.c
index c2a5aa7..fb0bca0 100644
--- a/src/load.c
+++ b/src/load.c
@@ -53,37 +53,36 @@ dlopenLADSPA(const char * pcFilename, int iFlag) {
LD_LIBRARY_PATH, whereas the LADSPA_PATH is the correct place
to search. */
- pcLADSPAPath = getenv("LADSPA_PATH");
-
- if (pcLADSPAPath) {
-
- pcStart = pcLADSPAPath;
- while (*pcStart != '\0') {
- pcEnd = pcStart;
- while (*pcEnd != ':' && *pcEnd != '\0')
- pcEnd++;
-
- pcBuffer = malloc(iFilenameLength + 2 + (pcEnd - pcStart));
- if (pcEnd > pcStart)
- strncpy(pcBuffer, pcStart, pcEnd - pcStart);
- iNeedSlash = 0;
- if (pcEnd > pcStart)
- if (*(pcEnd - 1) != '/') {
- iNeedSlash = 1;
- pcBuffer[pcEnd - pcStart] = '/';
- }
- strcpy(pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename);
-
- pvResult = dlopen(pcBuffer, iFlag);
-
- free(pcBuffer);
- if (pvResult != NULL)
- return pvResult;
-
- pcStart = pcEnd;
- if (*pcStart == ':')
- pcStart++;
- }
+ pcLADSPAPath = getenv("LADSPA_PATH");
+ if (pcLADSPAPath == NULL)
+ pcLADSPAPath = EXPAND_AND_STRINGIFY(DEFAULT_LADSPA_PATH);
+
+ pcStart = pcLADSPAPath;
+ while (*pcStart != '\0') {
+ pcEnd = pcStart;
+ while (*pcEnd != ':' && *pcEnd != '\0')
+ pcEnd++;
+
+ pcBuffer = malloc(iFilenameLength + 2 + (pcEnd - pcStart));
+ if (pcEnd > pcStart)
+ strncpy(pcBuffer, pcStart, pcEnd - pcStart);
+ iNeedSlash = 0;
+ if (pcEnd > pcStart)
+ if (*(pcEnd - 1) != '/') {
+ iNeedSlash = 1;
+ pcBuffer[pcEnd - pcStart] = '/';
+ }
+ strcpy(pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename);
+
+ pvResult = dlopen(pcBuffer, iFlag);
+
+ free(pcBuffer);
+ if (pvResult != NULL)
+ return pvResult;
+
+ pcStart = pcEnd;
+ if (*pcStart == ':')
+ pcStart++;
}
}
diff --git a/src/makefile b/src/makefile
deleted file mode 100644
index 886237f..0000000
--- a/src/makefile
+++ /dev/null
@@ -1,126 +0,0 @@
-###############################################################################
-#
-# Installation DIRECTORIES
-#
-# Change these if you want to install somewhere else.
-
-INSTALL_PLUGINS_DIR = /usr/lib/ladspa/
-INSTALL_INCLUDE_DIR = /usr/include/
-INSTALL_BINARY_DIR = /usr/bin/
-
-###############################################################################
-#
-# GENERAL
-#
-
-INCLUDES = -I.
-LIBRARIES = -ldl -lm
-CFLAGS = $(INCLUDES) -Wall -Werror -O3 -fPIC
-CXXFLAGS = $(CFLAGS)
-PLUGINS = ../plugins/amp.so \
- ../plugins/delay.so \
- ../plugins/filter.so \
- ../plugins/noise.so \
- ../plugins/sine.so
-PROGRAMS = ../bin/analyseplugin \
- ../bin/applyplugin \
- ../bin/listplugins
-CC = cc
-CPP = c++
-
-###############################################################################
-#
-# RULES TO BUILD PLUGINS FROM C OR C++ CODE
-#
-
-../plugins/%.so: plugins/%.c ladspa.h
- $(CC) $(CFLAGS) -o plugins/$*.o -c plugins/$*.c
- $(LD) -o ../plugins/$*.so plugins/$*.o -shared
-
-../plugins/%.so: plugins/%.cpp ladspa.h
- $(CPP) $(CXXFLAGS) -o plugins/$*.o -c plugins/$*.cpp
- $(CPP) -o ../plugins/$*.so plugins/$*.o -shared
-
-###############################################################################
-#
-# TARGETS
-#
-
-test: /tmp/test.wav ../snd/noise.wav always
- @echo ---------------------------------------------
- @echo First listen to the white noise input signal:
- @echo ---------------------------------------------
- -sndfile-play ../snd/noise.wav
- @echo -------------------------
- @echo Compare to plugin output.
- @echo -------------------------
- @echo Should be a noise band around 6000Hz, repeated quietly after 1s.
- -sndfile-play /tmp/test.wav
- @echo Test complete.
-
-install: targets
- -mkdirhier $(INSTALL_PLUGINS_DIR)
- -mkdirhier $(INSTALL_INCLUDE_DIR)
- -mkdirhier $(INSTALL_BINARY_DIR)
- cp ../plugins/* $(INSTALL_PLUGINS_DIR)
- cp ladspa.h $(INSTALL_INCLUDE_DIR)
- cp ../bin/* $(INSTALL_BINARY_DIR)
-
-/tmp/test.wav: targets ../snd/noise.wav
- ../bin/listplugins
- ../bin/analyseplugin ../plugins/filter.so
- ../bin/analyseplugin ../plugins/delay.so
- ../bin/analyseplugin ../plugins/sine.so
- echo ; ../bin/analyseplugin -l ../plugins/sine.so ; echo
- ../bin/analyseplugin ../plugins/amp.so
- ../bin/analyseplugin ../plugins/noise.so
- ../bin/applyplugin -s 1 \
- ../snd/noise.wav /tmp/test.wav \
- ../plugins/filter.so lpf 500 \
- ../plugins/filter.so lpf 500 \
- ../plugins/sine.so sine_fcaa 6000 \
- ../plugins/delay.so delay_5s 1 0.1 \
- ../plugins/amp.so amp_mono 4 \
-
-targets: $(PLUGINS) $(PROGRAMS)
-
-###############################################################################
-#
-# PROGRAMS
-#
-
-../bin/applyplugin: applyplugin.o load.o default.o
- $(CC) $(CFLAGS) $(LIBRARIES) \
- -o ../bin/applyplugin \
- applyplugin.o load.o default.o
-
-../bin/analyseplugin: analyseplugin.o load.o default.o
- $(CC) $(CFLAGS) $(LIBRARIES) \
- -o ../bin/analyseplugin \
- analyseplugin.o load.o default.o
-
-../bin/listplugins: listplugins.o search.o
- $(CC) $(CFLAGS) $(LIBRARIES) \
- -o ../bin/listplugins \
- listplugins.o search.o
-
-###############################################################################
-#
-# UTILITIES
-#
-
-always:
-
-clean:
- -rm -f `find . -name "*.o"` ../bin/* ../plugins/*
- -rm -f `find .. -name "*~"`
- -rm -f *.bak core score.srt
- -rm -f *.bb *.bbg *.da *-ann gmon.out bb.out
- -rm -f `find .. -name "*.class"`
-
-backup: clean
- (cd ../../; \
- tar czf `date '+../backup/ladspa_sdk.%Y%m%d%H%M.tgz'` ladspa_sdk/)
-
-###############################################################################
-
diff --git a/src/plugins/amp.c b/src/plugins/amp.c
index b6d2345..9028b5d 100644
--- a/src/plugins/amp.c
+++ b/src/plugins/amp.c
@@ -16,6 +16,7 @@
/*****************************************************************************/
#include "ladspa.h"
+#include "utils.h"
/*****************************************************************************/
@@ -48,7 +49,7 @@ typedef struct {
/*****************************************************************************/
/* Construct a new plugin instance. */
-LADSPA_Handle
+static LADSPA_Handle
instantiateAmplifier(const LADSPA_Descriptor * Descriptor,
unsigned long SampleRate) {
return malloc(sizeof(Amplifier));
@@ -57,7 +58,7 @@ instantiateAmplifier(const LADSPA_Descriptor * Descriptor,
/*****************************************************************************/
/* Connect a port to a data location. */
-void
+static void
connectPortToAmplifier(LADSPA_Handle Instance,
unsigned long Port,
LADSPA_Data * DataLocation) {
@@ -88,7 +89,7 @@ connectPortToAmplifier(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
runMonoAmplifier(LADSPA_Handle Instance,
unsigned long SampleCount) {
@@ -110,7 +111,7 @@ runMonoAmplifier(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
runStereoAmplifier(LADSPA_Handle Instance,
unsigned long SampleCount) {
@@ -137,8 +138,8 @@ runStereoAmplifier(LADSPA_Handle Instance,
/*****************************************************************************/
-/* Throw away a simple delay line. */
-void
+/* Throw away an amplifier. */
+static void
cleanupAmplifier(LADSPA_Handle Instance) {
free(Instance);
}
@@ -150,10 +151,8 @@ LADSPA_Descriptor * g_psStereoDescriptor = NULL;
/*****************************************************************************/
-/* _init() is called automatically when the plugin library is first
- loaded. */
-void
-_init() {
+/* Called automatically when the plugin library is first loaded. */
+ON_LOAD_ROUTINE {
char ** pcPortNames;
LADSPA_PortDescriptor * piPortDescriptors;
@@ -315,7 +314,7 @@ _init() {
/*****************************************************************************/
-void
+static void
deleteDescriptor(LADSPA_Descriptor * psDescriptor) {
unsigned long lIndex;
if (psDescriptor) {
@@ -334,9 +333,8 @@ deleteDescriptor(LADSPA_Descriptor * psDescriptor) {
/*****************************************************************************/
-/* _fini() is called automatically when the library is unloaded. */
-void
-_fini() {
+/* Called automatically when the library is unloaded. */
+ON_UNLOAD_ROUTINE {
deleteDescriptor(g_psMonoDescriptor);
deleteDescriptor(g_psStereoDescriptor);
}
diff --git a/src/plugins/delay.c b/src/plugins/delay.c
index 8b03979..5b473da 100644
--- a/src/plugins/delay.c
+++ b/src/plugins/delay.c
@@ -18,6 +18,7 @@
/*****************************************************************************/
#include "ladspa.h"
+#include "utils.h"
/*****************************************************************************/
@@ -77,7 +78,7 @@ typedef struct {
/*****************************************************************************/
/* Construct a new plugin instance. */
-LADSPA_Handle
+static LADSPA_Handle
instantiateSimpleDelayLine(const LADSPA_Descriptor * Descriptor,
unsigned long SampleRate) {
@@ -113,7 +114,7 @@ instantiateSimpleDelayLine(const LADSPA_Descriptor * Descriptor,
/*****************************************************************************/
/* Initialise and activate a plugin instance. */
-void
+static void
activateSimpleDelayLine(LADSPA_Handle Instance) {
SimpleDelayLine * psSimpleDelayLine;
@@ -130,7 +131,7 @@ activateSimpleDelayLine(LADSPA_Handle Instance) {
/*****************************************************************************/
/* Connect a port to a data location. */
-void
+static void
connectPortToSimpleDelayLine(LADSPA_Handle Instance,
unsigned long Port,
LADSPA_Data * DataLocation) {
@@ -157,7 +158,7 @@ connectPortToSimpleDelayLine(LADSPA_Handle Instance,
/*****************************************************************************/
/* Run a delay line instance for a block of SampleCount samples. */
-void
+static void
runSimpleDelayLine(LADSPA_Handle Instance,
unsigned long SampleCount) {
@@ -209,7 +210,7 @@ runSimpleDelayLine(LADSPA_Handle Instance,
/*****************************************************************************/
/* Throw away a simple delay line. */
-void
+static void
cleanupSimpleDelayLine(LADSPA_Handle Instance) {
SimpleDelayLine * psSimpleDelayLine;
@@ -222,14 +223,12 @@ cleanupSimpleDelayLine(LADSPA_Handle Instance) {
/*****************************************************************************/
-LADSPA_Descriptor * g_psDescriptor = NULL;
+static LADSPA_Descriptor * g_psDescriptor = NULL;
/*****************************************************************************/
-/* _init() is called automatically when the plugin library is first
- loaded. */
-void
-_init() {
+/* Called automatically when the plugin library is first loaded. */
+ON_LOAD_ROUTINE {
char ** pcPortNames;
LADSPA_PortDescriptor * piPortDescriptors;
@@ -321,9 +320,8 @@ _init() {
/*****************************************************************************/
-/* _fini() is called automatically when the library is unloaded. */
-void
-_fini() {
+/* Called automatically when the library is unloaded. */
+ON_UNLOAD_ROUTINE {
long lIndex;
if (g_psDescriptor) {
free((char *)g_psDescriptor->Label);
diff --git a/src/plugins/filter.c b/src/plugins/filter.c
index 3f50457..b20d506 100644
--- a/src/plugins/filter.c
+++ b/src/plugins/filter.c
@@ -18,6 +18,7 @@
/*****************************************************************************/
#include "ladspa.h"
+#include "utils.h"
/*****************************************************************************/
@@ -56,7 +57,7 @@ typedef struct {
structure can be used for low- or high-pass filters we can get away
with only only writing one of these functions. Normally one would
be required for each plugin type. */
-LADSPA_Handle
+static LADSPA_Handle
instantiateSimpleFilter(const LADSPA_Descriptor * Descriptor,
unsigned long SampleRate) {
@@ -81,7 +82,7 @@ instantiateSimpleFilter(const LADSPA_Descriptor * Descriptor,
/* Initialise and activate a plugin instance. Normally separate
functions would have to be written for the different plugin types,
however we can get away with a single function in this case. */
-void
+static void
activateSimpleFilter(LADSPA_Handle Instance) {
SimpleFilter * psSimpleFilter;
psSimpleFilter = (SimpleFilter *)Instance;
@@ -93,7 +94,7 @@ activateSimpleFilter(LADSPA_Handle Instance) {
/* Connect a port to a data location. Normally separate functions
would have to be written for the different plugin types, however we
can get away with a single function in this case. */
-void
+static void
connectPortToSimpleFilter(LADSPA_Handle Instance,
unsigned long Port,
LADSPA_Data * DataLocation) {
@@ -118,7 +119,7 @@ connectPortToSimpleFilter(LADSPA_Handle Instance,
/*****************************************************************************/
/* Run the LPF algorithm for a block of SampleCount samples. */
-void
+static void
runSimpleLowPassFilter(LADSPA_Handle Instance,
unsigned long SampleCount) {
@@ -177,7 +178,7 @@ runSimpleLowPassFilter(LADSPA_Handle Instance,
/*****************************************************************************/
/* Run the HPF algorithm for a block of SampleCount samples. */
-void
+static void
runSimpleHighPassFilter(LADSPA_Handle Instance,
unsigned long SampleCount) {
@@ -238,22 +239,20 @@ runSimpleHighPassFilter(LADSPA_Handle Instance,
/* Throw away a filter instance. Normally separate functions
would have to be written for the different plugin types, however we
can get away with a single function in this case. */
-void
+static void
cleanupSimpleFilter(LADSPA_Handle Instance) {
free(Instance);
}
/*****************************************************************************/
-LADSPA_Descriptor * g_psLPFDescriptor = NULL;
-LADSPA_Descriptor * g_psHPFDescriptor = NULL;
+static LADSPA_Descriptor * g_psLPFDescriptor = NULL;
+static LADSPA_Descriptor * g_psHPFDescriptor = NULL;
/*****************************************************************************/
-/* _init() is called automatically when the plugin library is first
- loaded. */
-void
-_init() {
+/* Called automatically when the plugin library is first loaded. */
+ON_LOAD_ROUTINE {
char ** pcPortNames;
LADSPA_PortDescriptor * piPortDescriptors;
@@ -411,7 +410,7 @@ _init() {
/*****************************************************************************/
-void
+static void
deleteDescriptor(LADSPA_Descriptor * psDescriptor) {
unsigned long lIndex;
if (psDescriptor) {
@@ -430,9 +429,8 @@ deleteDescriptor(LADSPA_Descriptor * psDescriptor) {
/*****************************************************************************/
-/* _fini() is called automatically when the library is unloaded. */
-void
-_fini() {
+/* Called automatically when the library is unloaded. */
+ON_UNLOAD_ROUTINE {
deleteDescriptor(g_psLPFDescriptor);
deleteDescriptor(g_psHPFDescriptor);
}
diff --git a/src/plugins/noise.c b/src/plugins/noise.c
index 0fdd938..4068b5c 100644
--- a/src/plugins/noise.c
+++ b/src/plugins/noise.c
@@ -16,6 +16,7 @@
/*****************************************************************************/
#include "ladspa.h"
+#include "utils.h"
/*****************************************************************************/
@@ -48,7 +49,7 @@ typedef struct {
/*****************************************************************************/
/* Construct a new plugin instance. */
-LADSPA_Handle
+static LADSPA_Handle
instantiateNoiseSource(const LADSPA_Descriptor * Descriptor,
unsigned long SampleRate) {
return malloc(sizeof(NoiseSource));
@@ -57,7 +58,7 @@ instantiateNoiseSource(const LADSPA_Descriptor * Descriptor,
/*****************************************************************************/
/* Connect a port to a data location. */
-void
+static void
connectPortToNoiseSource(LADSPA_Handle Instance,
unsigned long Port,
LADSPA_Data * DataLocation) {
@@ -74,7 +75,7 @@ connectPortToNoiseSource(LADSPA_Handle Instance,
/*****************************************************************************/
/* Run a delay line instance for a block of SampleCount samples. */
-void
+static void
runNoiseSource(LADSPA_Handle Instance,
unsigned long SampleCount) {
@@ -97,7 +98,7 @@ runNoiseSource(LADSPA_Handle Instance,
/* Run a delay line instance for a block of SampleCount samples. *ADD*
the output to the output buffer. */
-void
+static void
runAddingNoiseSource(LADSPA_Handle Instance,
unsigned long SampleCount) {
@@ -120,7 +121,7 @@ runAddingNoiseSource(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
setNoiseSourceRunAddingGain(LADSPA_Handle Instance,
LADSPA_Data Gain) {
((NoiseSource *)Instance)->m_fRunAddingGain = Gain;
@@ -129,21 +130,19 @@ setNoiseSourceRunAddingGain(LADSPA_Handle Instance,
/*****************************************************************************/
/* Throw away a simple delay line. */
-void
+static void
cleanupNoiseSource(LADSPA_Handle Instance) {
free(Instance);
}
/*****************************************************************************/
-LADSPA_Descriptor * g_psDescriptor;
+static LADSPA_Descriptor * g_psDescriptor;
/*****************************************************************************/
-/* _init() is called automatically when the plugin library is first
- loaded. */
-void
-_init() {
+/* Called automatically when the plugin library is first loaded. */
+ON_LOAD_ROUTINE {
char ** pcPortNames;
LADSPA_PortDescriptor * piPortDescriptors;
@@ -218,9 +217,8 @@ _init() {
/*****************************************************************************/
-/* _fini() is called automatically when the library is unloaded. */
-void
-_fini() {
+/* Called automatically when the library is unloaded. */
+ON_UNLOAD_ROUTINE {
long lIndex;
if (g_psDescriptor) {
free((char *)g_psDescriptor->Label);
diff --git a/src/plugins/sine.cpp b/src/plugins/sine.cpp
index c3d1a6e..012ad8e 100644
--- a/src/plugins/sine.cpp
+++ b/src/plugins/sine.cpp
@@ -15,9 +15,9 @@
/*****************************************************************************/
-#include
-#include
-#include
+#include
+#include
+#include
/*****************************************************************************/
@@ -37,12 +37,12 @@
#define SINE_TABLE_BITS 14
#define SINE_TABLE_SHIFT (8 * sizeof(unsigned long) - SINE_TABLE_BITS)
-LADSPA_Data * g_pfSineTable = NULL;
-LADSPA_Data g_fPhaseStepBase = 0;
+static LADSPA_Data * g_pfSineTable = NULL;
+static LADSPA_Data g_fPhaseStepBase = 0;
/*****************************************************************************/
-inline char *
+static inline char *
localStrdup(const char * input) {
char * output = new char[strlen(input) + 1];
strcpy(output, input);
@@ -51,7 +51,7 @@ localStrdup(const char * input) {
/*****************************************************************************/
-void
+static void
initialise_sine_table() {
if (g_pfSineTable == NULL) {
long lTableSize = (1 << SINE_TABLE_BITS);
@@ -68,6 +68,22 @@ initialise_sine_table() {
/*****************************************************************************/
+static LADSPA_Handle instantiateSineOscillator(const LADSPA_Descriptor *,
+ unsigned long SampleRate);
+static void connectPortToSineOscillator(LADSPA_Handle Instance,
+ unsigned long Port,
+ LADSPA_Data * DataLocation);
+static void activateSineOscillator(void * pvHandle);
+static void runSineOscillator_FreqAudio_AmpAudio(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+static void runSineOscillator_FreqAudio_AmpCtrl(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+static void runSineOscillator_FreqCtrl_AmpAudio(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+static void runSineOscillator_FreqCtrl_AmpCtrl(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+static void cleanupSineOscillator(void *pvHandle);
+
class SineOscillator {
private:
@@ -120,7 +136,7 @@ private:
/*****************************************************************************/
-LADSPA_Handle
+static LADSPA_Handle
instantiateSineOscillator(const LADSPA_Descriptor *,
unsigned long SampleRate) {
return new SineOscillator(SampleRate);
@@ -128,7 +144,7 @@ instantiateSineOscillator(const LADSPA_Descriptor *,
/*****************************************************************************/
-void
+static void
connectPortToSineOscillator(LADSPA_Handle Instance,
unsigned long Port,
LADSPA_Data * DataLocation) {
@@ -147,14 +163,14 @@ connectPortToSineOscillator(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
activateSineOscillator(void * pvHandle) {
((SineOscillator *)pvHandle)->m_lPhase = 0;
}
/*****************************************************************************/
-void
+static void
runSineOscillator_FreqAudio_AmpAudio(LADSPA_Handle Instance,
unsigned long SampleCount) {
SineOscillator * poSineOscillator = (SineOscillator *)Instance;
@@ -174,7 +190,7 @@ runSineOscillator_FreqAudio_AmpAudio(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
runSineOscillator_FreqAudio_AmpCtrl(LADSPA_Handle Instance,
unsigned long SampleCount) {
SineOscillator * poSineOscillator = (SineOscillator *)Instance;
@@ -195,7 +211,7 @@ runSineOscillator_FreqAudio_AmpCtrl(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
runSineOscillator_FreqCtrl_AmpAudio(LADSPA_Handle Instance,
unsigned long SampleCount) {
SineOscillator * poSineOscillator = (SineOscillator *)Instance;
@@ -212,7 +228,7 @@ runSineOscillator_FreqCtrl_AmpAudio(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
runSineOscillator_FreqCtrl_AmpCtrl(LADSPA_Handle Instance,
unsigned long SampleCount) {
SineOscillator * poSineOscillator = (SineOscillator *)Instance;
@@ -230,7 +246,7 @@ runSineOscillator_FreqCtrl_AmpCtrl(LADSPA_Handle Instance,
/*****************************************************************************/
-void
+static void
cleanupSineOscillator(void *pvHandle) {
delete (SineOscillator *)pvHandle;
}
@@ -239,7 +255,7 @@ cleanupSineOscillator(void *pvHandle) {
typedef char * char_ptr;
-LADSPA_Descriptor * g_psDescriptors[4] = { NULL, NULL, NULL, NULL };
+static LADSPA_Descriptor * g_psDescriptors[4] = { NULL, NULL, NULL, NULL };
/*****************************************************************************/
@@ -403,7 +419,9 @@ public:
delete [] g_pfSineTable;
}
-} g_oShutdownStartupHandler;
+};
+
+static StartupShutdownHandler g_oShutdownStartupHandler;
/*****************************************************************************/
diff --git a/src/search.c b/src/search.c
index 0006712..7b2eb05 100644
--- a/src/search.c
+++ b/src/search.c
@@ -80,7 +80,7 @@ LADSPADirectoryPluginSearch
}
else {
/* It was a library, but not a LADSPA one. Unload it. */
- dlclose(pcFilename);
+ dlclose(pvPluginHandle);
free(pcFilename);
}
}
@@ -101,8 +101,10 @@ LADSPAPluginSearch(LADSPAPluginSearchCallbackFunction fCallbackFunction) {
if (!pcLADSPAPath) {
fprintf(stderr,
"Warning: You do not have a LADSPA_PATH "
- "environment variable set.\n");
- return;
+ "environment variable set. Defaulting to "
+ EXPAND_AND_STRINGIFY(DEFAULT_LADSPA_PATH)
+ ".\n");
+ pcLADSPAPath = EXPAND_AND_STRINGIFY(DEFAULT_LADSPA_PATH);
}
pcStart = pcLADSPAPath;
diff --git a/src/utils.h b/src/utils.h
index d94c420..050db6c 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -65,6 +65,39 @@ int getLADSPADefault(const LADSPA_PortRangeHint * psPortRangeHint,
const unsigned long lSampleRate,
LADSPA_Data * pfResult);
+
+/*****************************************************************************/
+
+/* During C pre-processing, take a string (passed in from the
+ Makefile) and put quote marks around it. */
+#define RAW_STRINGIFY(x) #x
+#define EXPAND_AND_STRINGIFY(x) RAW_STRINGIFY(x)
+
+/*****************************************************************************/
+
+#ifndef __cplusplus
+/* In C, special incantations are needed to trigger initialisation and
+ cleanup routines when a dynamic plugin library is loaded or
+ unloaded (e.g. with dlopen() or dlclose()). _init() and _fini() are
+ classic exported symbols to achieve this, but these days GNU C
+ likes to do things a different way. Ideally we would check the GNU
+ version as older ones will probably expect the classic behaviour,
+ but for now... */
+# if __GNUC__
+/* Modern GNU C incantations: */
+# define ON_LOAD_ROUTINE static void __attribute__ ((constructor)) init()
+# define ON_UNLOAD_ROUTINE static void __attribute__ ((destructor)) fini()
+# else
+/* Classic incantations: */
+# define ON_LOAD_ROUTINE void _init()
+# define ON_UNLOAD_ROUTINE void _fini()
+# endif
+#else
+/* In C++, we use the constructor/destructor of a static object to
+ manage initialisation and cleanup, so we don't need these
+ routines. */
+#endif
+
/*****************************************************************************/
#endif
--
cgit v1.2.3