summaryrefslogtreecommitdiffstats
path: root/audio-plugins
diff options
context:
space:
mode:
authorFlorian Franzmann2014-03-20 23:31:56 +0000
committerFlorian Franzmann2014-03-20 23:31:56 +0000
commit84c871053078563ebbb9d6e05e8b0d6cc42ad5d2 (patch)
treedac98f7c52c1e409048509afc45f65e6f71790f2 /audio-plugins
parent00bc5611458b4dd307574d08d404840107505c8f (diff)
audio-plugins/vlevel: new spell, a compressor with lookahead for LADSPA
Diffstat (limited to 'audio-plugins')
-rw-r--r--audio-plugins/vlevel/0001-make-FLAGS-settable-from-the-environment.patch67
-rw-r--r--audio-plugins/vlevel/0002-increase-compiler-warning-level.patch178
-rwxr-xr-xaudio-plugins/vlevel/BUILD1
-rwxr-xr-xaudio-plugins/vlevel/DEPENDS2
-rwxr-xr-xaudio-plugins/vlevel/DETAILS25
-rw-r--r--audio-plugins/vlevel/HISTORY6
-rwxr-xr-xaudio-plugins/vlevel/INSTALL1
-rwxr-xr-xaudio-plugins/vlevel/PRE_BUILD4
8 files changed, 284 insertions, 0 deletions
diff --git a/audio-plugins/vlevel/0001-make-FLAGS-settable-from-the-environment.patch b/audio-plugins/vlevel/0001-make-FLAGS-settable-from-the-environment.patch
new file mode 100644
index 0000000000..78367c6e7e
--- /dev/null
+++ b/audio-plugins/vlevel/0001-make-FLAGS-settable-from-the-environment.patch
@@ -0,0 +1,67 @@
+From 7addac8d049f673edcbdd23cf42eef7919c52ac1 Mon Sep 17 00:00:00 2001
+From: Florian Franzmann <siflfran@hawo.stw.uni-erlangen.de>
+Date: Thu, 20 Mar 2014 23:19:55 +0000
+Subject: [PATCH 1/2] make FLAGS settable from the environment
+
+- also remove redundant rule bodies
+- declare all and install PHONY
+- correctly set LDLIBS so linking works with recent linkers
+- correctly set and use PREFIX
+---
+ Makefile | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 94fa21e..35af52b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -19,18 +19,23 @@
+ # User-editable options:
+
+ # Change this to suit your preferences (maybe add -march=cputype)
+-CXXFLAGS=-Wall -O3 -fPIC -DPIC -g
++CXXFLAGS ?= -O3 -g
++
++CPPFLAGS += -DPIC
++
++CXXFLAGS += -fPIC
++LDLIBS=-lstdc++ -lm
+
+ # This is where it will be installed
+-PREFIX=/usr/local/bin/
+-LADSPA_PREFIX=/usr/local/lib/ladspa/
++PREFIX ?= /usr/local/
++LADSPA_PREFIX ?= /usr/local/lib/ladspa/
+
+ # End of user-editable options
+
+ all: vlevel-bin vlevel-ladspa.so
+
+ install: all
+- cp -f vlevel-bin $(PREFIX)
++ cp -f vlevel-bin $(PREFIX)/bin/
+ mkdir -p $(LADSPA_PREFIX)
+ cp -f vlevel-ladspa.so $(LADSPA_PREFIX)
+
+@@ -41,17 +46,13 @@ vlevel-ladspa.so: vlevel-ladspa.o volumeleveler.o
+ $(CXX) $(CXXFLAGS) -shared -o vlevel-ladspa.so vlevel-ladspa.o volumeleveler.o
+
+ vlevel-ladspa.o: vlevel-ladspa.cpp volumeleveler.h vlevel-ladspa.h vlevel.h ladspa.h
+- $(CXX) $(CXXFLAGS) -c vlevel-ladspa.cpp
+
+ vlevel-bin: volumeleveler.o commandline.o vlevel-bin.o vlevel.h
+- $(CXX) $(CXXFLAGS) -o vlevel-bin vlevel-bin.o volumeleveler.o commandline.o
+
+ volumeleveler.o: volumeleveler.cpp volumeleveler.h vlevel.h
+- $(CXX) $(CXXFLAGS) -c volumeleveler.cpp
+
+ vlevel-bin.o: vlevel-bin.cpp volumeleveler.h commandline.h vlevel.h
+- $(CXX) $(CXXFLAGS) -c vlevel-bin.cpp
+
+ commandline.o: commandline.cpp commandline.h
+- $(CXX) $(CXXFLAGS) -c commandline.cpp
+
++.PHONY: all install
+--
+1.9.0
+
diff --git a/audio-plugins/vlevel/0002-increase-compiler-warning-level.patch b/audio-plugins/vlevel/0002-increase-compiler-warning-level.patch
new file mode 100644
index 0000000000..59bb2bf836
--- /dev/null
+++ b/audio-plugins/vlevel/0002-increase-compiler-warning-level.patch
@@ -0,0 +1,178 @@
+From af665e15d590cca4d02716fe01371cdddb751658 Mon Sep 17 00:00:00 2001
+From: Florian Franzmann <siflfran@hawo.stw.uni-erlangen.de>
+Date: Thu, 20 Mar 2014 23:21:10 +0000
+Subject: [PATCH 2/2] increase compiler warning level
+
+---
+ Makefile | 8 ++++++++
+ vlevel-bin.cpp | 2 +-
+ vlevel-ladspa.cpp | 12 +++++++-----
+ volumeleveler.cpp | 17 +++++++++--------
+ volumeleveler.h | 2 +-
+ 5 files changed, 26 insertions(+), 15 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 35af52b..3a3f018 100644
+--- a/Makefile
++++ b/Makefile
+@@ -24,6 +24,14 @@ CXXFLAGS ?= -O3 -g
+ CPPFLAGS += -DPIC
+
+ CXXFLAGS += -fPIC
++CXXFLAGS += -Wall -Wextra -Werror -pedantic
++CXXFLAGS += -Wcast-align -Wfloat-equal -Wformat-nonliteral -Wformat-security
++CXXFLAGS += -Winit-self -Wmissing-include-dirs
++CXXFLAGS += -Wno-suggest-attribute=noreturn -Wno-write-strings -Wpointer-arith -Wundef -Wpacked
++CXXFLAGS += -Wredundant-decls
++CXXFLAGS += -Wunreachable-code -Wno-unused-parameter -Wconversion -Wshadow
++CXXFLAGS += -Woverloaded-virtual
++
+ LDLIBS=-lstdc++ -lm
+
+ # This is where it will be installed
+diff --git a/vlevel-bin.cpp b/vlevel-bin.cpp
+index ef61b95..b969891 100644
+--- a/vlevel-bin.cpp
++++ b/vlevel-bin.cpp
+@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
+ CommandLine cmd(argc, argv);
+ size_t length = 3 * 44100;
+ size_t channels = 2;
+- value_t strength = .8, max_multiplier = 20;
++ value_t strength = .8f, max_multiplier = 20.0f;
+ bool undo = false;
+ string option, argument;
+
+diff --git a/vlevel-ladspa.cpp b/vlevel-ladspa.cpp
+index 7022f68..7d278b2 100644
+--- a/vlevel-ladspa.cpp
++++ b/vlevel-ladspa.cpp
+@@ -44,7 +44,7 @@ LADSPA_PortDescriptor vlevel_port_descriptors[] = {
+ LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO
+ };
+
+-char *vlevel_port_names[] = {
++const char *vlevel_port_names[] = {
+ "Look-ahead (seconds)",
+ "Strength",
+ "Use Maximum Multiplier",
+@@ -209,11 +209,13 @@ void VLevelInstance::ConnectPort(unsigned long port, value_t *data_location)
+ {
+ ports[port] = data_location;
+
+- if(port >= CONTROL_PORT_COUNT) // is a control port
+- if((port - CONTROL_PORT_COUNT) % 2 == 0) // is an input port
++ if(port >= CONTROL_PORT_COUNT) { // is a control port
++ if((port - CONTROL_PORT_COUNT) % 2 == 0) { // is an input port
+ in[(port - CONTROL_PORT_COUNT) / 2] = data_location;
+- else if((port - CONTROL_PORT_COUNT) % 2 == 1) // is an output port
++ } else if((port - CONTROL_PORT_COUNT) % 2 == 1) { // is an output port
+ out[(port - CONTROL_PORT_COUNT) / 2] = data_location;
++ }
++ }
+ }
+
+ void VLevelInstance::Activate()
+@@ -224,7 +226,7 @@ void VLevelInstance::Activate()
+ void VLevelInstance::Run(unsigned long sample_count)
+ {
+
+- size_t samples = (size_t) (*ports[CONTROL_PORT_LOOK_AHEAD] * sample_rate);
++ size_t samples = (size_t) (*ports[CONTROL_PORT_LOOK_AHEAD] * (value_t)sample_rate);
+ if(samples != vl.GetSamples()) {
+ if(samples > 60 * sample_rate) samples = 60 * sample_rate;
+ if(samples < 2) samples = 2;
+diff --git a/volumeleveler.cpp b/volumeleveler.cpp
+index 2a49b84..8a29f8b 100644
+--- a/volumeleveler.cpp
++++ b/volumeleveler.cpp
+@@ -22,6 +22,7 @@
+ #include <assert.h>
+ #include <math.h>
+ #include <iostream>
++#include <limits>
+
+ #include "vlevel.h"
+ #include "volumeleveler.h"
+@@ -50,7 +51,7 @@ void VolumeLeveler::SetStrength(value_t s)
+
+ void VolumeLeveler::SetMaxMultiplier(value_t m)
+ {
+- if(m <= 0) m = HUGE_VAL;
++ if(m <= 0) m = std::numeric_limits<float>::max();
+ max_multiplier = m;
+ }
+
+@@ -87,7 +88,7 @@ void VolumeLeveler::Flush()
+
+ value_t VolumeLeveler::GetMultiplier()
+ {
+- value_t multiplier = pow(avg_amp, -strength);
++ value_t multiplier = powf(avg_amp, -strength);
+ if(multiplier > max_multiplier) multiplier = max_multiplier;
+ return multiplier;
+ }
+@@ -121,7 +122,7 @@ void VolumeLeveler::Exchange_n(value_t **in_bufs, value_t **out_bufs, size_t in_
+ for(size_t user_pos = 0; user_pos < in_samples; ++user_pos) {
+
+ // compute multiplier
+- value_t multiplier = pow(avg_amp, -strength);
++ value_t multiplier = powf(avg_amp, -strength);
+ if(multiplier > max_multiplier) multiplier = max_multiplier;
+
+ // swap buf[pos] with user_buf[user_pos], scaling user[buf] by
+@@ -132,7 +133,7 @@ void VolumeLeveler::Exchange_n(value_t **in_bufs, value_t **out_bufs, size_t in_
+ value_t in = in_bufs[ch][user_pos];
+ out_bufs[ch][user_pos] = bufs[ch][pos] * multiplier;
+ bufs[ch][pos] = in;
+- if(VLEVEL_ABS(in) > new_val) new_val = fabs(in);
++ if(VLEVEL_ABS(in) > new_val) new_val = fabsf(in);
+ }
+
+ pos = (pos + 1) % samples; // now pos is the oldest, new one is pos-1
+@@ -141,14 +142,14 @@ void VolumeLeveler::Exchange_n(value_t **in_bufs, value_t **out_bufs, size_t in_
+
+ if(pos == max_slope_pos) {
+ // recompute (this is expensive)
+- max_slope = -HUGE_VAL;
++ max_slope = std::numeric_limits<float>::min();
+ for(size_t i = 1; i < samples; ++i) {
+ value_t sample_val = 0;
+ for(size_t ch = 0; ch < channels; ++ch) {
+ value_t ch_val = VLEVEL_ABS(bufs[ch][(pos + i) % samples]);
+ if(ch_val > sample_val) sample_val = ch_val;
+ }
+- value_t slope = (sample_val - avg_amp) / i;
++ value_t slope = (sample_val - avg_amp) / (value_t)i;
+ if(slope >= max_slope) { // must be >=, otherwise clipping causes excessive computation
+ max_slope_pos = (pos + i) % samples;
+ max_slope = slope;
+@@ -159,10 +160,10 @@ void VolumeLeveler::Exchange_n(value_t **in_bufs, value_t **out_bufs, size_t in_
+ // only chance of higher slope is the new sample
+
+ // recomputing max_slope isn't really necessary...
+- max_slope = (max_slope_val - avg_amp) / ((max_slope_pos - pos + samples) % samples);
++ max_slope = (max_slope_val - avg_amp) / (value_t) ((max_slope_pos - pos + samples) % samples);
+ // ...but it doesn't take long and has a small effect.
+
+- value_t slope = (new_val - avg_amp) / (samples - 1);
++ value_t slope = (new_val - avg_amp) / (value_t)(samples - 1);
+
+ if(slope >= max_slope) { // probably needs to be >= for same reason as above
+ max_slope_pos = (pos - 1) % samples;
+diff --git a/volumeleveler.h b/volumeleveler.h
+index 0b24798..960123f 100644
+--- a/volumeleveler.h
++++ b/volumeleveler.h
+@@ -35,7 +35,7 @@ public:
+ // constructs and destructs a VolumeLeveler with a length of l
+ // samples with c channels each, an effect strength of s and a
+ // maximum multiplier of m
+- VolumeLeveler(size_t l = 44100, size_t c = 2, value_t s = .8, value_t m = 25);
++ VolumeLeveler(size_t l = 44100, size_t c = 2, value_t s = .8f, value_t m = 25);
+ ~VolumeLeveler();
+
+ // Reallocates a buffer of l samples and c channels (contents are
+--
+1.9.0
+
diff --git a/audio-plugins/vlevel/BUILD b/audio-plugins/vlevel/BUILD
new file mode 100755
index 0000000000..6dfecc1f8a
--- /dev/null
+++ b/audio-plugins/vlevel/BUILD
@@ -0,0 +1 @@
+default_build_make
diff --git a/audio-plugins/vlevel/DEPENDS b/audio-plugins/vlevel/DEPENDS
new file mode 100755
index 0000000000..49520acc49
--- /dev/null
+++ b/audio-plugins/vlevel/DEPENDS
@@ -0,0 +1,2 @@
+depends -sub CXX gcc &&
+depends ladspa
diff --git a/audio-plugins/vlevel/DETAILS b/audio-plugins/vlevel/DETAILS
new file mode 100755
index 0000000000..1e19f8fde9
--- /dev/null
+++ b/audio-plugins/vlevel/DETAILS
@@ -0,0 +1,25 @@
+ SPELL=vlevel
+ VERSION=0.5
+ SOURCE="${SPELL}-${VERSION}.tar.gz"
+ SOURCE_URL[0]=$SOURCEFORGE_URL/project/${SPELL}/${SPELL}/${VERSION}/${SOURCE}
+ SOURCE_HASH=sha512:b84a989f7493f6f008134408fcdc235980c2ef71069125399c67a6144a6f86863d795f1c7b8c10ac21d126e2e819ba117578f3da9bcac29025cfc6580ff3e8f4
+SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELL}-${VERSION}"
+ WEB_SITE="http://vlevel.sourceforge.net/about/"
+ LICENSE[0]=GPL
+ ENTERED=20140321
+ SHORT="a compressor with lookahead for LADSPA"
+cat << EOF
+VLevel keeps your music from making you jump out of your seat, and it keeps
+you from having to fiddle with the volume constantly. It's different from
+other dynamic compressors because it looks ahead. You can think of VLevel
+as someone who knows your music by heart, and turns the volume up during
+quiet passages, but smoothly turns it back down when he knows a loud part
+is coming. It's great for making CDs to listen to in your car, or to play
+background music on your computer.
+
+VLevel is currently a LADSPA plugin and a command-line filter. You can use
+it with many Linux audio programs including XMMS, GStreamer, GLAME, GDAM,
+and others, and you can use it in shell scripts to level your music before
+burning a CD. In the future, it may be ported to other audio programs like
+SOX and WinAMP, and it will be made generally easier to use.
+EOF
diff --git a/audio-plugins/vlevel/HISTORY b/audio-plugins/vlevel/HISTORY
new file mode 100644
index 0000000000..e90cdc5443
--- /dev/null
+++ b/audio-plugins/vlevel/HISTORY
@@ -0,0 +1,6 @@
+2014-03-21 Florian Franzmann <siflfran@hawo.stw.uni-erlangen.de>
+ * 0001-make-FLAGS-settable-from-the-environment.patch,
+ 0002-increase-compiler-warning-level.patch,
+ BUILD, DEPENDS, DETAILS, INSTALL, PRE_BUILD:
+ spell created
+
diff --git a/audio-plugins/vlevel/INSTALL b/audio-plugins/vlevel/INSTALL
new file mode 100755
index 0000000000..e58a2f3293
--- /dev/null
+++ b/audio-plugins/vlevel/INSTALL
@@ -0,0 +1 @@
+LADSPA_PREFIX=${INSTALL_ROOT}/usr/lib/ladspa PREFIX=${INSTALL_ROOT}/usr default_install
diff --git a/audio-plugins/vlevel/PRE_BUILD b/audio-plugins/vlevel/PRE_BUILD
new file mode 100755
index 0000000000..2899ad1ada
--- /dev/null
+++ b/audio-plugins/vlevel/PRE_BUILD
@@ -0,0 +1,4 @@
+default_pre_build &&
+cd ${SOURCE_DIRECTORY} &&
+patch -p1 < $SPELL_DIRECTORY/0001-make-FLAGS-settable-from-the-environment.patch &&
+patch -p1 < $SPELL_DIRECTORY/0002-increase-compiler-warning-level.patch