summaryrefslogtreecommitdiffstats
path: root/arts/modules/effects
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /arts/modules/effects
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'arts/modules/effects')
-rw-r--r--arts/modules/effects/Makefile.am70
-rw-r--r--arts/modules/effects/artsmoduleseffects.idl147
-rw-r--r--arts/modules/effects/effect_wavecapture_impl.cc63
-rw-r--r--arts/modules/effects/fivebandmonocomplexeq_impl.cc208
-rw-r--r--arts/modules/effects/freeverb/Makefile.am5
-rw-r--r--arts/modules/effects/freeverb/allpass.cpp36
-rw-r--r--arts/modules/effects/freeverb/allpass.hpp48
-rw-r--r--arts/modules/effects/freeverb/comb.cpp48
-rw-r--r--arts/modules/effects/freeverb/comb.hpp55
-rw-r--r--arts/modules/effects/freeverb/denormals.h15
-rw-r--r--arts/modules/effects/freeverb/readme.txt67
-rw-r--r--arts/modules/effects/freeverb/revmodel.cpp257
-rw-r--r--arts/modules/effects/freeverb/revmodel.hpp87
-rw-r--r--arts/modules/effects/freeverb/tuning.h60
-rw-r--r--arts/modules/effects/freeverbguifactory_impl.cc107
-rw-r--r--arts/modules/effects/kstereovolumecontrolgui_impl.cpp132
-rw-r--r--arts/modules/effects/kstereovolumecontrolgui_impl.h97
-rw-r--r--arts/modules/effects/mcopclass/Effect_WAVECAPTURE.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/FiveBandMonoComplexEQ.mcopclass6
-rw-r--r--arts/modules/effects/mcopclass/FiveBandMonoComplexEQGuiFactory.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/FreeverbGuiFactory.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/MonoToStereo.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/StereoBalance.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/StereoBalanceGuiFactory.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/StereoCompressorGuiFactory.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/StereoFirEqualizerGuiFactory.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/StereoToMono.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/StereoVolumeControlGui.mcopclass5
-rw-r--r--arts/modules/effects/mcopclass/StereoVolumeControlGuiFactory.mcopclass6
-rw-r--r--arts/modules/effects/mcopclass/Synth_FREEVERB.mcopclass7
-rw-r--r--arts/modules/effects/mcopclass/Synth_STEREO_COMPRESSOR.mcopclass6
-rw-r--r--arts/modules/effects/mcopclass/Synth_STEREO_FIR_EQUALIZER.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT_FFT.mcopclass4
-rw-r--r--arts/modules/effects/mcopclass/Synth_VOICE_REMOVAL.mcopclass7
-rw-r--r--arts/modules/effects/mcopclass/VoiceRemovalGuiFactory.mcopclass4
-rw-r--r--arts/modules/effects/monostereoconversion_impl.cc160
-rw-r--r--arts/modules/effects/stereocompressorguifactory_impl.cc114
-rw-r--r--arts/modules/effects/stereovolumecontrolguifactory_impl.cpp45
-rw-r--r--arts/modules/effects/synth_freeverb_impl.cc84
-rw-r--r--arts/modules/effects/synth_stereo_compressor_impl.cc135
-rw-r--r--arts/modules/effects/synth_stereo_fir_equalizer_impl.cc221
-rw-r--r--arts/modules/effects/synth_stereo_pitch_shift_fft_impl.cc63
-rw-r--r--arts/modules/effects/synth_stereo_pitch_shift_impl.cc51
-rw-r--r--arts/modules/effects/synth_voice_removal_impl.cc108
-rw-r--r--arts/modules/effects/voiceremovalguifactory_impl.cc76
46 files changed, 2648 insertions, 0 deletions
diff --git a/arts/modules/effects/Makefile.am b/arts/modules/effects/Makefile.am
new file mode 100644
index 0000000..d5d54aa
--- /dev/null
+++ b/arts/modules/effects/Makefile.am
@@ -0,0 +1,70 @@
+
+SUBDIRS = freeverb
+
+INCLUDES = \
+ -I$(top_builddir)/arts/modules/effects \
+ -I$(top_srcdir)/arts/modules/effects \
+ -I$(top_builddir)/arts/modules/synth \
+ -I$(top_srcdir)/arts/modules/synth \
+ -I$(top_builddir)/arts/modules/common \
+ -I$(top_srcdir)/arts/modules/common \
+ -I$(top_builddir)/arts/modules \
+ -I$(top_srcdir)/arts/modules \
+ -I$(top_builddir)/arts/gui/common \
+ -I$(top_srcdir)/arts/gui/common \
+ -I$(top_srcdir)/arts/gui/kde \
+ -I$(top_builddir)/arts/midi \
+ -I$(top_srcdir)/arts/midi \
+ -I$(arts_includes) \
+ $(all_includes)
+
+lib_LTLIBRARIES = libartsmoduleseffects.la
+
+libartsmoduleseffects_la_SOURCES = artsmoduleseffects.cc \
+ fivebandmonocomplexeq_impl.cc \
+ monostereoconversion_impl.cc \
+ synth_stereo_pitch_shift_impl.cc synth_stereo_pitch_shift_fft_impl.cc \
+ synth_voice_removal_impl.cc voiceremovalguifactory_impl.cc \
+ synth_stereo_compressor_impl.cc stereocompressorguifactory_impl.cc \
+ synth_stereo_fir_equalizer_impl.cc \
+ synth_freeverb_impl.cc freeverbguifactory_impl.cc \
+ effect_wavecapture_impl.cc \
+ kstereovolumecontrolgui_impl.cpp stereovolumecontrolguifactory_impl.cpp
+libartsmoduleseffects_la_COMPILE_FIRST = ../../gui/common/artsgui.h \
+ ../common/artsmodulescommon.h ../../midi/artsmidi.h ../synth/artsmodulessynth.h \
+ artsmoduleseffects.h
+libartsmoduleseffects_la_LIBADD = \
+ $(top_builddir)/arts/modules/effects/freeverb/libfreeverb.la \
+ $(top_builddir)/arts/gui/common/libartsgui_idl.la \
+ $(top_builddir)/arts/gui/kde/libartsgui_kde.la \
+ $(top_builddir)/arts/modules/common/libartsmodulescommon.la \
+ -lartsflow -lartsflow_idl -lmcop
+
+libartsmoduleseffects_la_LDFLAGS = $(all_libraries) -L$(arts_libraries) -no-undefined
+
+METASOURCES=AUTO
+
+artsmoduleseffects.cc artsmoduleseffects.h artsmoduleseffects.mcoptype artsmoduleseffects.mcopclass: $(srcdir)/artsmoduleseffects.idl $(MCOPIDL)
+ $(MCOPIDL) -t $(INCLUDES) $(srcdir)/artsmoduleseffects.idl
+
+DISTCLEANFILES= artsmoduleseffects.cc artsmoduleseffects.h artsmoduleseffects.mcop*
+
+artsincludedir = $(includedir)/arts
+artsinclude_HEADERS = artsmoduleseffects.h artsmoduleseffects.idl
+
+mcoptypedir = $(libdir)/mcop
+mcoptype_DATA = artsmoduleseffects.mcoptype artsmoduleseffects.mcopclass
+
+mcopclassdir = $(libdir)/mcop/Arts
+mcopclass_DATA = \
+ mcopclass/FiveBandMonoComplexEQ.mcopclass mcopclass/FiveBandMonoComplexEQGuiFactory.mcopclass \
+ mcopclass/MonoToStereo.mcopclass mcopclass/StereoToMono.mcopclass \
+ mcopclass/StereoBalance.mcopclass mcopclass/StereoBalanceGuiFactory.mcopclass \
+ mcopclass/Synth_VOICE_REMOVAL.mcopclass mcopclass/VoiceRemovalGuiFactory.mcopclass \
+ mcopclass/Synth_STEREO_COMPRESSOR.mcopclass mcopclass/StereoCompressorGuiFactory.mcopclass \
+ mcopclass/Synth_STEREO_PITCH_SHIFT.mcopclass mcopclass/Synth_STEREO_PITCH_SHIFT_FFT.mcopclass \
+ mcopclass/Synth_STEREO_FIR_EQUALIZER.mcopclass mcopclass/StereoFirEqualizerGuiFactory.mcopclass \
+ mcopclass/Synth_FREEVERB.mcopclass mcopclass/FreeverbGuiFactory.mcopclass \
+ mcopclass/Effect_WAVECAPTURE.mcopclass \
+ mcopclass/StereoVolumeControlGui.mcopclass mcopclass/StereoVolumeControlGuiFactory.mcopclass
+
diff --git a/arts/modules/effects/artsmoduleseffects.idl b/arts/modules/effects/artsmoduleseffects.idl
new file mode 100644
index 0000000..73ecd14
--- /dev/null
+++ b/arts/modules/effects/artsmoduleseffects.idl
@@ -0,0 +1,147 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+/*
+ * DISCLAIMER: The interfaces in envmixer.idl (and the derived .cc/.h files)
+ * DO NOT GUARANTEE BINARY COMPATIBILITY YET.
+ *
+ * They are intended for developers. You shouldn't expect that applications in
+ * binary form will be fully compatibile with further releases of these
+ * interfaces.
+ */
+
+#include <artsflow.idl>
+#include <artsgui.idl>
+#include <artsmodulescommon.idl>
+
+module Arts {
+
+ interface StereoToMono : Arts::SynthModule {
+ attribute float pan; // From -1(left) to +1(right)
+ in audio stream inleft, inright;
+ out audio stream outmono;
+ };
+
+ interface MonoToStereo : Arts::SynthModule {
+ attribute float pan; // Same as StereoToMono
+ in audio stream inmono;
+ out audio stream outleft, outright;
+ };
+
+ interface StereoBalance : Arts::StereoEffect {
+ attribute float balance;
+ };
+ interface StereoBalanceGuiFactory : Arts::GuiFactory {};
+
+ interface FiveBandMonoComplexEQ : Arts::StereoEffect {
+ readonly attribute StereoToMono s2m;
+ attribute float lowfreq, lowq, lowgain;
+ attribute float mid1freq, mid1q, mid1gain;
+ attribute float mid2freq, mid2q, mid2gain;
+ attribute float mid3freq, mid3q, mid3gain;
+ attribute float highfreq, highq, highgain;
+ readonly attribute MonoToStereo m2s;
+ };
+ interface FiveBandMonoComplexEQGuiFactory : Arts::GuiFactory {};
+
+ interface Synth_VOICE_REMOVAL : StereoEffect {
+ attribute float position, frequency;
+ };
+
+ interface VoiceRemovalGuiFactory : GuiFactory {
+ };
+
+ interface Synth_STEREO_COMPRESSOR : StereoEffect {
+ attribute float attack, release, threshold, ratio, output;
+ attribute boolean thru;
+ };
+
+ interface StereoCompressorGuiFactory : GuiFactory {
+ };
+
+ interface Synth_STEREO_PITCH_SHIFT : StereoEffect {
+ attribute float speed, frequency;
+ };
+
+ interface Synth_STEREO_PITCH_SHIFT_FFT : StereoEffect {
+ attribute float speed, scaleFactor;
+ attribute long frameSize, oversample;
+ };
+
+ interface Synth_STEREO_FIR_EQUALIZER : StereoEffect {
+ attribute sequence<GraphPoint> frequencies;
+ attribute long taps;
+ };
+
+ interface StereoFirEqualizerGuiFactory : GuiFactory {
+ };
+
+ interface Synth_FREEVERB : StereoEffect {
+ attribute float roomsize, damp, wet, dry, width, mode;
+ };
+
+ interface FreeverbGuiFactory : GuiFactory {
+ };
+
+ interface Effect_WAVECAPTURE : StereoEffect {
+ attribute string filename;
+ };
+
+ interface StereoVolumeControlGui : LayoutBox {
+ /**
+ Creates a Gui for a StereoVolumeControl.
+ This should be the most often used function.
+ */
+ void constructor( Arts::StereoVolumeControl svc );
+ /*
+ The direction from min to max for all elements.
+ The elements will be order 90 degree clockwise to it.
+ */
+ //attribute Direction direction; // Is already in LayoutBox
+
+ /// The title of this volumecontrol
+ attribute string title;
+ /// the minimum and maximum value for levelmeter(only min, max is 0dB) and volumecontrol
+ attribute float dbmin, dbmax;
+
+ /**
+ The elements separate:
+ - the two levelmeter
+ - the volumefader
+ - the tickmarks for levelmeter and volumefader
+ - the Label showing the title of the VolumeControl
+ Use this only if you want to connect them to own devices.
+ */
+ readonly attribute LevelMeter left, right;
+ readonly attribute VolumeFader fader;
+ readonly attribute Tickmarks levelmetertickmarks, volumefadertickmarks;
+ readonly attribute Label label;
+
+ /**
+ Couples the two VolumeSlider
+ Is currently useless since StereoVolumeControl::scaleFactor is
+ only one value for both channels.
+ */
+ attribute boolean couple;
+
+ };
+
+ interface StereoVolumeControlGuiFactory : Arts::GuiFactory {};
+};
+
diff --git a/arts/modules/effects/effect_wavecapture_impl.cc b/arts/modules/effects/effect_wavecapture_impl.cc
new file mode 100644
index 0000000..e2b6c9a
--- /dev/null
+++ b/arts/modules/effects/effect_wavecapture_impl.cc
@@ -0,0 +1,63 @@
+/*
+ Copyright (C) 2001 Matthias Kretz <kretz@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/* $Id$ */
+
+#include "artsmoduleseffects.h"
+#include <stdsynthmodule.h>
+#include <flowsystem.h>
+
+using namespace std;
+namespace Arts {
+
+class Effect_WAVECAPTURE_impl : virtual public Effect_WAVECAPTURE_skel,
+ virtual public StdSynthModule
+{
+protected:
+ Synth_CAPTURE_WAV _capture;
+
+public:
+ void streamStart();
+ void streamEnd();
+ string filename() { return _capture.filename(); }
+ void filename( const string &newFilename ) { _capture.filename( newFilename ); }
+};
+
+void Effect_WAVECAPTURE_impl::streamStart()
+{
+ _capture.start();
+ _node()->virtualize("inleft",_capture._node(),"left");
+ _node()->virtualize("inright",_capture._node(),"right");
+ _node()->virtualize("outleft",_node(),"inleft");
+ _node()->virtualize("outright",_node(),"inright");
+}
+
+void Effect_WAVECAPTURE_impl::streamEnd()
+{
+ _node()->devirtualize("inleft",_capture._node(),"left");
+ _node()->devirtualize("inright",_capture._node(),"right");
+ _node()->devirtualize("outleft",_node(),"inleft");
+ _node()->devirtualize("outright",_node(),"inright");
+ _capture.stop();
+}
+
+REGISTER_IMPLEMENTATION(Effect_WAVECAPTURE_impl);
+
+}
+
+// vim:ts=4:sw=4
diff --git a/arts/modules/effects/fivebandmonocomplexeq_impl.cc b/arts/modules/effects/fivebandmonocomplexeq_impl.cc
new file mode 100644
index 0000000..30891b0
--- /dev/null
+++ b/arts/modules/effects/fivebandmonocomplexeq_impl.cc
@@ -0,0 +1,208 @@
+/*
+
+ Copyright ( C ) 2002 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or ( at your option ) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#include <artsflow.h>
+#include <flowsystem.h>
+#include <stdsynthmodule.h>
+#include <debug.h>
+#include <artsmoduleseffects.h>
+#include <connect.h>
+
+#include <kglobal.h>
+#include <klocale.h>
+
+namespace Arts {
+
+class FiveBandMonoComplexEQ_impl : virtual public FiveBandMonoComplexEQ_skel,
+ virtual public StdSynthModule
+{
+private:
+ Arts::StereoToMono _s2m;
+ Arts::MonoToStereo _m2s;
+ Arts::Synth_STD_EQUALIZER _low, _mid1, _mid2, _mid3, _high;
+public:
+ FiveBandMonoComplexEQ_impl() {}
+
+ Arts::StereoToMono s2m() { return _s2m; }
+ Arts::MonoToStereo m2s() { return _m2s; }
+
+ float lowfreq() { return _low.frequency(); }
+ void lowfreq( float n ) { _low.frequency( n ); };
+ float lowq() { return _low.q(); }
+ void lowq( float n ) { _low.q( n ); };
+ float lowgain() { return _low.low(); }
+ void lowgain( float n ) { _low.low( n ); };
+
+ float mid1freq() { return _mid1.frequency(); }
+ void mid1freq( float n ) { _mid1.frequency( n ); };
+ float mid1q() { return _mid1.q(); }
+ void mid1q( float n ) { _mid1.q( n ); };
+ float mid1gain() { return _mid1.mid(); }
+ void mid1gain( float n ) { _mid1.mid( n ); };
+
+ float mid2freq() { return _mid2.frequency(); }
+ void mid2freq( float n ) { _mid2.frequency( n ); };
+ float mid2q() { return _mid2.q(); }
+ void mid2q( float n ) { _mid2.q( n ); };
+ float mid2gain() { return _mid2.mid(); }
+ void mid2gain( float n ) { _mid2.mid( n ); };
+
+ float mid3freq() { return _mid3.frequency(); }
+ void mid3freq( float n ) { _mid3.frequency( n ); };
+ float mid3q() { return _mid3.q(); }
+ void mid3q( float n ) { _mid3.q( n ); };
+ float mid3gain() { return _mid3.mid(); }
+ void mid3gain( float n ) { _mid3.mid( n ); };
+
+ float highfreq() { return _high.frequency(); }
+ void highfreq( float n ) { _high.frequency( n ); };
+ float highq() { return _high.q(); }
+ void highq( float n ) { _high.q( n ); };
+ float highgain() { return _high.high(); }
+ void highgain( float n ) { _high.high( n ); };
+
+ void streamInit()
+ {
+ _s2m.start(); _low.start(); _mid1.start(); _mid2.start(); _mid3.start(); _high.start(); _m2s.start();
+
+ _node()->virtualize( "inleft", _s2m._node(), "inleft" );
+ _node()->virtualize( "inright", _s2m._node(), "inright" );
+ connect( _s2m, "outmono", _low, "invalue" );
+ connect( _low, "outvalue", _mid1, "invalue" );
+ connect( _mid1, "outvalue", _mid2, "invalue" );
+ connect( _mid2, "outvalue", _mid3, "invalue" );
+ connect( _mid3, "outvalue", _high, "invalue" );
+ connect( _high, "outvalue", _m2s, "inmono" );
+ _node()->virtualize( "outleft", _m2s._node(), "outleft" );
+ _node()->virtualize( "outright", _m2s._node(), "outright" );
+ }
+};
+REGISTER_IMPLEMENTATION( FiveBandMonoComplexEQ_impl );
+
+class FiveBandMonoComplexEQGuiFactory_impl : virtual public FiveBandMonoComplexEQGuiFactory_skel
+{
+public:
+ Arts::Widget createGui( Arts::Object object )
+ {
+ KGlobal::locale()->insertCatalogue( "artsmodules" );
+
+ arts_return_val_if_fail( !object.isNull(), Arts::Widget::null() );
+ FiveBandMonoComplexEQ ch = DynamicCast( object );
+ arts_return_val_if_fail( !ch.isNull(), Arts::Widget::null() );
+
+ Arts::LayoutBox hbox;
+ hbox.direction( Arts::LeftToRight );
+ hbox.layoutmargin( 5 ); hbox.spacing( 5 );
+
+ Arts::Poti lowgain; lowgain.caption( i18n( "Low Gain" ).utf8().data() );
+ lowgain.min( -24 ); lowgain.max( 24 );
+ lowgain.value( ch.lowgain() ); connect( lowgain, "value_changed", ch, "lowgain" );
+ hbox.addWidget( lowgain );
+ PopupBox low;
+ low.height( 100 ); low.direction( LeftToRight );
+ hbox.addWidget( low );
+ Arts::VBox lowbox; low.widget( lowbox );
+ Arts::Poti lowfreq; lowfreq.color( "grey" ); lowfreq.caption( i18n( "Low Freq" ).utf8().data() );
+ lowfreq.min( 20 ); lowfreq.max( 1000 );
+ lowfreq.value( ch.lowfreq() ); connect( lowfreq, "value_changed", ch, "lowfreq" );
+ lowfreq.parent( lowbox ); lowbox._addChild( lowfreq , "" );
+ Arts::Poti lowq; lowq.color( "grey" ); lowq.caption( i18n( "Low Q" ).utf8().data() );
+ lowq.min( 0.01 ); lowq.max( 10 );
+ lowq.value( ch.lowq() ); connect( lowq, "value_changed", ch, "lowq" );
+ lowq.parent( lowbox ); lowbox._addChild( lowq , "" );
+
+ Arts::Poti mid1gain; mid1gain.caption( i18n( "Mid1 Gain" ).utf8().data() );
+ mid1gain.min( -24 ); mid1gain.max( 24 );
+ mid1gain.value( ch.mid1gain() ); connect( mid1gain, "value_changed", ch, "mid1gain" );
+ hbox.addWidget( mid1gain );
+ PopupBox mid1;
+ mid1.height( 100 ); mid1.direction( LeftToRight );
+ hbox.addWidget( mid1 );
+ Arts::VBox mid1box; mid1.widget( mid1box );
+ Arts::Poti mid1freq; mid1freq.color( "grey" ); mid1freq.caption( i18n( "Mid1 Freq" ).utf8().data() );
+ mid1freq.min( 20 ); mid1freq.max( 5000 );
+ mid1freq.value( ch.mid1freq() ); connect( mid1freq, "value_changed", ch, "mid1freq" );
+ mid1freq.parent( mid1box ); mid1box._addChild( mid1freq , "" );
+ Arts::Poti mid1q; mid1q.color( "grey" ); mid1q.caption( i18n( "Mid1 Q" ).utf8().data() );
+ mid1q.min( 0.01 ); mid1q.max( 10 );
+ mid1q.value( ch.mid1q() ); connect( mid1q, "value_changed", ch, "mid1q" );
+ mid1q.parent( mid1box ); mid1box._addChild( mid1q , "" );
+
+ Arts::Poti mid2gain; mid2gain.caption( i18n( "Mid2 Gain" ).utf8().data() );
+ mid2gain.min( -24 ); mid2gain.max( 24 );
+ mid2gain.value( ch.mid2gain() ); connect( mid2gain, "value_changed", ch, "mid2gain" );
+ hbox.addWidget( mid2gain );
+ PopupBox mid2;
+ mid2.height( 100 ); mid2.direction( LeftToRight );
+ hbox.addWidget( mid2 );
+ Arts::VBox mid2box; mid2.widget( mid2box );
+ Arts::Poti mid2freq; mid2freq.color( "grey" ); mid2freq.caption( i18n( "Mid2 Freq" ).utf8().data() );
+ mid2freq.min( 20 ); mid2freq.max( 10000 );
+ mid2freq.value( ch.mid2freq() ); connect( mid2freq, "value_changed", ch, "mid2freq" );
+ mid2freq.parent( mid2box ); mid2box._addChild( mid2freq , "" );
+ Arts::Poti mid2q; mid2q.color( "grey" ); mid2q.caption( i18n( "Mid2 Q" ).utf8().data() );
+ mid2q.min( 0.01 ); mid2q.max( 10 );
+ mid2q.value( ch.mid2q() ); connect( mid2q, "value_changed", ch, "mid2q" );
+ mid2q.parent( mid2box ); mid2box._addChild( mid2q , "" );
+
+ Arts::Poti mid3gain; mid3gain.caption( i18n( "Mid3 Gain" ).utf8().data() );
+ mid3gain.min( -24 ); mid3gain.max( 24 );
+ mid3gain.value( ch.mid3gain() ); connect( mid3gain, "value_changed", ch, "mid3gain" );
+ hbox.addWidget( mid3gain );
+ PopupBox mid3;
+ mid3.height( 100 ); mid3.direction( LeftToRight );
+ hbox.addWidget( mid3 );
+ Arts::VBox mid3box; mid3.widget( mid3box );
+ Arts::Poti mid3freq; mid3freq.color( "grey" ); mid3freq.caption( i18n( "Mid3 Freq" ).utf8().data() );
+ mid3freq.min( 1000 ); mid3freq.max( 10000 );
+ mid3freq.value( ch.mid3freq() ); connect( mid3freq, "value_changed", ch, "mid3freq" );
+ mid3freq.parent( mid3box ); mid3box._addChild( mid3freq , "" );
+ Arts::Poti mid3q; mid3q.color( "grey" ); mid3q.caption( i18n( "Mid3 Q" ).utf8().data() );
+ mid3q.min( 0.01 ); mid3q.max( 10 );
+ mid3q.value( ch.mid3q() ); connect( mid3q, "value_changed", ch, "mid3q" );
+ mid3q.parent( mid3box ); mid3box._addChild( mid3q , "" );
+
+ Arts::Poti highgain; highgain.caption( i18n( "High Gain" ).utf8().data() );
+ highgain.min( -24 ); highgain.max( 24 );
+ highgain.value( ch.highgain() ); connect( highgain, "value_changed", ch, "highgain" );
+ hbox.addWidget( highgain );
+ PopupBox high;
+ high.height( 100 ); high.direction( LeftToRight );
+ hbox.addWidget( high );
+ Arts::VBox highbox; high.widget( highbox );
+ Arts::Poti highfreq; highfreq.color( "grey" ); highfreq.caption( i18n( "High Freq" ).utf8().data() );
+ highfreq.min( 5000 ); highfreq.max( 16000 );
+ highfreq.value( ch.highfreq() ); connect( highfreq, "value_changed", ch, "highfreq" );
+ highfreq.parent( highbox ); highbox._addChild( highfreq , "" );
+ Arts::Poti highq; highq.color( "grey" ); highq.caption( i18n( "High Q" ).utf8().data() );
+ highq.min( 0.01 ); highq.max( 10 );
+ highq.value( ch.highq() ); connect( highq, "value_changed", ch, "highq" );
+ highq.parent( highbox ); highbox._addChild( highq , "" );
+
+ hbox.addStretch( 100 );
+
+ return hbox;
+ }
+};
+REGISTER_IMPLEMENTATION( FiveBandMonoComplexEQGuiFactory_impl );
+
+}
+
diff --git a/arts/modules/effects/freeverb/Makefile.am b/arts/modules/effects/freeverb/Makefile.am
new file mode 100644
index 0000000..42d70f2
--- /dev/null
+++ b/arts/modules/effects/freeverb/Makefile.am
@@ -0,0 +1,5 @@
+
+noinst_LTLIBRARIES = libfreeverb.la
+
+libfreeverb_la_SOURCES = allpass.cpp comb.cpp revmodel.cpp
+
diff --git a/arts/modules/effects/freeverb/allpass.cpp b/arts/modules/effects/freeverb/allpass.cpp
new file mode 100644
index 0000000..ca4d8bc
--- /dev/null
+++ b/arts/modules/effects/freeverb/allpass.cpp
@@ -0,0 +1,36 @@
+// Allpass filter implementation
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#include "allpass.hpp"
+
+allpass::allpass()
+{
+ bufidx = 0;
+}
+
+void allpass::setbuffer(float *buf, int size)
+{
+ buffer = buf;
+ bufsize = size;
+}
+
+void allpass::mute()
+{
+ for (int i=0; i<bufsize; i++)
+ buffer[i]=0;
+}
+
+void allpass::setfeedback(float val)
+{
+ feedback = val;
+}
+
+float allpass::getfeedback()
+{
+ return feedback;
+}
+
+//ends
diff --git a/arts/modules/effects/freeverb/allpass.hpp b/arts/modules/effects/freeverb/allpass.hpp
new file mode 100644
index 0000000..853c7d4
--- /dev/null
+++ b/arts/modules/effects/freeverb/allpass.hpp
@@ -0,0 +1,48 @@
+// Allpass filter declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#ifndef _allpass_
+#define _allpass_
+#include "denormals.h"
+
+class allpass
+{
+public:
+ allpass();
+ void setbuffer(float *buf, int size);
+ inline float process(float inp);
+ void mute();
+ void setfeedback(float val);
+ float getfeedback();
+// private:
+ float feedback;
+ float *buffer;
+ int bufsize;
+ int bufidx;
+};
+
+
+// Big to inline - but crucial for speed
+
+inline float allpass::process(float input)
+{
+ float output;
+ float bufout;
+
+ bufout = buffer[bufidx];
+ undenormalise(bufout);
+
+ output = -input + bufout;
+ buffer[bufidx] = input + (bufout*feedback);
+
+ if(++bufidx>=bufsize) bufidx = 0;
+
+ return output;
+}
+
+#endif//_allpass
+
+//ends
diff --git a/arts/modules/effects/freeverb/comb.cpp b/arts/modules/effects/freeverb/comb.cpp
new file mode 100644
index 0000000..c05f506
--- /dev/null
+++ b/arts/modules/effects/freeverb/comb.cpp
@@ -0,0 +1,48 @@
+// Comb filter implementation
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#include "comb.hpp"
+
+comb::comb()
+{
+ filterstore = 0;
+ bufidx = 0;
+}
+
+void comb::setbuffer(float *buf, int size)
+{
+ buffer = buf;
+ bufsize = size;
+}
+
+void comb::mute()
+{
+ for (int i=0; i<bufsize; i++)
+ buffer[i]=0;
+}
+
+void comb::setdamp(float val)
+{
+ damp1 = val;
+ damp2 = 1-val;
+}
+
+float comb::getdamp()
+{
+ return damp1;
+}
+
+void comb::setfeedback(float val)
+{
+ feedback = val;
+}
+
+float comb::getfeedback()
+{
+ return feedback;
+}
+
+// ends
diff --git a/arts/modules/effects/freeverb/comb.hpp b/arts/modules/effects/freeverb/comb.hpp
new file mode 100644
index 0000000..4a73b61
--- /dev/null
+++ b/arts/modules/effects/freeverb/comb.hpp
@@ -0,0 +1,55 @@
+// Comb filter class declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#ifndef _comb_
+#define _comb_
+
+#include "denormals.h"
+
+class comb
+{
+public:
+ comb();
+ void setbuffer(float *buf, int size);
+ inline float process(float inp);
+ void mute();
+ void setdamp(float val);
+ float getdamp();
+ void setfeedback(float val);
+ float getfeedback();
+private:
+ float feedback;
+ float filterstore;
+ float damp1;
+ float damp2;
+ float *buffer;
+ int bufsize;
+ int bufidx;
+};
+
+
+// Big to inline - but crucial for speed
+
+inline float comb::process(float input)
+{
+ float output;
+
+ output = buffer[bufidx];
+ undenormalise(output);
+
+ filterstore = (output*damp2) + (filterstore*damp1);
+ undenormalise(filterstore);
+
+ buffer[bufidx] = input + (filterstore*feedback);
+
+ if(++bufidx>=bufsize) bufidx = 0;
+
+ return output;
+}
+
+#endif //_comb_
+
+//ends
diff --git a/arts/modules/effects/freeverb/denormals.h b/arts/modules/effects/freeverb/denormals.h
new file mode 100644
index 0000000..f871412
--- /dev/null
+++ b/arts/modules/effects/freeverb/denormals.h
@@ -0,0 +1,15 @@
+// Macro for killing denormalled numbers
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// Based on IS_DENORMAL macro by Jon Watte
+// This code is public domain
+
+#ifndef _denormals_
+#define _denormals_
+
+#define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f
+
+#endif//_denormals_
+
+//ends
diff --git a/arts/modules/effects/freeverb/readme.txt b/arts/modules/effects/freeverb/readme.txt
new file mode 100644
index 0000000..36361f4
--- /dev/null
+++ b/arts/modules/effects/freeverb/readme.txt
@@ -0,0 +1,67 @@
+Freeverb - Free, studio-quality reverb SOURCE CODE in the public domain
+-----------------------------------------------------------------------
+
+Written by Jezar at Dreampoint - http://www.dreampoint.co.uk
+
+
+Introduction
+------------
+
+Hello.
+
+I'll try to keep this "readme" reasonably small. There are few things in the world that I hate more than long "readme" files. Except "coding conventions" - but more on that later...
+
+In this zip file you will find two folders of C++ source code:
+
+"Components" - Contains files that should clean-compile ON ANY TYPE OF COMPUTER OR SYSTEM WHATSOEVER. It should not be necessary to make ANY changes to these files to get them to compile, except to make up for inadequacies of certain compilers. These files create three classes - a comb filter, an allpass filter, and a reverb model made up of a number of instances of the filters, with some features to control the filters at a macro level. You will need to link these classes into another program that interfaces with them. The files in the components drawer are completely independant, and can be built without dependancies on anything else. Because of the simple interface, it should be possible to interface these files to any system - VST, DirectX, anything - without changing them AT ALL.
+
+"FreeverbVST" - Contains a Steinberg VST implementation of this version of Freeverb, using the components in (surprise) the components folder. It was built on a PC but may compile properly for the Macintosh with no problems. I don't know - I don't have a Macintosh. If you've figured out how to compile the examples in the Steinberg VST Development Kit, then you should easilly figure out how to bring the files into a project and get it working in a few minutes. It should be very simple.
+
+Note that this version of Freeverb doesn't contain predelay, or any EQ. I thought that might make it difficult to understand the "reverb" part of the code. Once you figure out how Freeverb works, you should find it trivial to add such features with little CPU overhead.
+
+Also, the code in this version of Freeverb has been optimised. This has changed the sound *slightly*, but not significantly compared to how much processing power it saves.
+
+Finally, note that there is also a built copy of this version of Freeverb called "Freeverb3.dll" - this is a VST plugin for the PC. If you want a version for the Mac or anything else, then you'll need to build it yourself from the code.
+
+
+Technical Explanation
+---------------------
+
+Freeverb is a simple implementation of the standard Schroeder/Moorer reverb model. I guess the only reason why it sounds better than other reverbs, is simply because I spent a long while doing listening tests in order to create the values found in "tuning.h". It uses 8 comb filters on both the left and right channels), and you might possibly be able to get away with less if CPU power is a serious constraint for you. It then feeds the result of the reverb through 4 allpass filters on both the left and right channels. These "smooth" the sound. Adding more than four allpasses doesn't seem to add anything significant to the sound, and if you use less, the sound gets a bit "grainy". The filters on the right channel are slightly detuned compared to the left channel in order to create a stereo effect.
+
+Hopefully, you should find the code in the components drawer a model of brevity and clarity. Notice that I don't use any "coding conventions". Personally, I think that coding conventions suck. They are meant to make the code "clearer", but they inevitably do the complete opposite, making the code completely unfathomable. Anyone whose done Windows programming with its - frankly stupid - "Hungarian notation" will know exactly what I mean. Coding conventions typically promote issues that are irrelevant up to the status of appearing supremely important. It may have helped back people in the days when compilers where somewhat feeble in their type-safety, but not in the new millenium with advanced C++ compilers.
+
+Imagine if we rewrote the English language to conform to coding conventions. After all, The arguments should be just as valid for the English language as they are for a computer language. For example, we could put a lower-case "n" in front of every noun, a lower-case "p" in front of a persons name, a lower-case "v" in front of every verb, and a lower-case "a" in front of every adjective. Can you imagine what the English language would look like? All in the name of "clarity". It's just as stupid to do this for computer code as it would be to do it for the English language. I hope that the code for Freeverb in the components drawer demonstrates this, and helps start a movement back towards sanity in coding practices.
+
+
+Background
+----------
+
+Why is the Freeverb code now public domain? Simple. I only intended to create Freeverb to provide me and my friends with studio-quality reverb for free. I never intended to make any money out of it. However, I simply do not have the time to develop it any further. I'm working on a "concept album" at the moment, and I'll never finish it if I spend any more time programming.
+
+In any case, I make more far money as a contract programmer - making Mobile Internet products - than I ever could writing plugins, so it simply doesn't make financial sense for me to spend any more time on it.
+
+Rather than give Freeverb to any particular individual or organisation to profit from it, I've decided to give it away to the internet community at large, so that quality, FREE (or at the very least, low-cost) reverbs can be developed for all platforms.
+
+Feel free to use the source code for Freeverb in any of your own products, whether they are also available for free, or even if they are commercial - I really don't mind. You may do with the code whatever you wish. If you use it in a product (whether commercial or not), it would be very nice of you, if you were to send me a copy of your product - although I appreciate that this isn't always possible in all circumstances.
+
+HOWEVER, please don't bug me with questions about how to use this code. I gave away Freeverb because I don't have time to maintain it. That means I *certainly* don't have time to answer questions about the source code, so please don't email questions to me. I *will* ignore them. If you can't figure the code for Freeverb out - then find somebody who can. I hope that either way, you enjoy experimenting with it.
+
+
+Disclaimer
+----------
+
+This software and source code is given away for free, without any warranties of any kind. It has been given away to the internet community as a free gift, so please treat it in the same spirit.
+
+
+I hope this code is useful and interesting to you all!
+I hope you have lots of fun experimenting with it and make good products!
+
+Very best regards,
+Jezar.
+Technology Consultant
+Dreampoint Design and Engineering
+http://www.dreampoint.co.uk
+
+
+//ends
diff --git a/arts/modules/effects/freeverb/revmodel.cpp b/arts/modules/effects/freeverb/revmodel.cpp
new file mode 100644
index 0000000..23a766c
--- /dev/null
+++ b/arts/modules/effects/freeverb/revmodel.cpp
@@ -0,0 +1,257 @@
+// Reverb model implementation
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#include "revmodel.hpp"
+
+revmodel::revmodel()
+{
+ // Tie the components to their buffers
+ combL[0].setbuffer(bufcombL1,combtuningL1);
+ combR[0].setbuffer(bufcombR1,combtuningR1);
+ combL[1].setbuffer(bufcombL2,combtuningL2);
+ combR[1].setbuffer(bufcombR2,combtuningR2);
+ combL[2].setbuffer(bufcombL3,combtuningL3);
+ combR[2].setbuffer(bufcombR3,combtuningR3);
+ combL[3].setbuffer(bufcombL4,combtuningL4);
+ combR[3].setbuffer(bufcombR4,combtuningR4);
+ combL[4].setbuffer(bufcombL5,combtuningL5);
+ combR[4].setbuffer(bufcombR5,combtuningR5);
+ combL[5].setbuffer(bufcombL6,combtuningL6);
+ combR[5].setbuffer(bufcombR6,combtuningR6);
+ combL[6].setbuffer(bufcombL7,combtuningL7);
+ combR[6].setbuffer(bufcombR7,combtuningR7);
+ combL[7].setbuffer(bufcombL8,combtuningL8);
+ combR[7].setbuffer(bufcombR8,combtuningR8);
+ allpassL[0].setbuffer(bufallpassL1,allpasstuningL1);
+ allpassR[0].setbuffer(bufallpassR1,allpasstuningR1);
+ allpassL[1].setbuffer(bufallpassL2,allpasstuningL2);
+ allpassR[1].setbuffer(bufallpassR2,allpasstuningR2);
+ allpassL[2].setbuffer(bufallpassL3,allpasstuningL3);
+ allpassR[2].setbuffer(bufallpassR3,allpasstuningR3);
+ allpassL[3].setbuffer(bufallpassL4,allpasstuningL4);
+ allpassR[3].setbuffer(bufallpassR4,allpasstuningR4);
+
+ // Set default values
+ allpassL[0].setfeedback(0.5f);
+ allpassR[0].setfeedback(0.5f);
+ allpassL[1].setfeedback(0.5f);
+ allpassR[1].setfeedback(0.5f);
+ allpassL[2].setfeedback(0.5f);
+ allpassR[2].setfeedback(0.5f);
+ allpassL[3].setfeedback(0.5f);
+ allpassR[3].setfeedback(0.5f);
+ setwet(initialwet);
+ setroomsize(initialroom);
+ setdry(initialdry);
+ setdamp(initialdamp);
+ setwidth(initialwidth);
+ setmode(initialmode);
+
+ // Buffer will be full of rubbish - so we MUST mute them
+ mute();
+}
+
+void revmodel::mute()
+{
+ int i;
+
+ if (getmode() >= freezemode)
+ return;
+
+ for (i=0;i<numcombs;i++)
+ {
+ combL[i].mute();
+ combR[i].mute();
+ }
+ for (i=0;i<numallpasses;i++)
+ {
+ allpassL[i].mute();
+ allpassR[i].mute();
+ }
+}
+
+void revmodel::processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip)
+{
+ float outL,outR,input;
+
+ while(numsamples-- > 0)
+ {
+ int i;
+ outL = outR = 0;
+ input = (*inputL + *inputR) * gain;
+
+ // Accumulate comb filters in parallel
+ for(i=0; i<numcombs; i++)
+ {
+ outL += combL[i].process(input);
+ outR += combR[i].process(input);
+ }
+
+ // Feed through allpasses in series
+ for(i=0; i<numallpasses; i++)
+ {
+ outL = allpassL[i].process(outL);
+ outR = allpassR[i].process(outR);
+ }
+
+ // Calculate output REPLACING anything already there
+ *outputL = outL*wet1 + outR*wet2 + *inputL*dry;
+ *outputR = outR*wet1 + outL*wet2 + *inputR*dry;
+
+ // Increment sample pointers, allowing for interleave (if any)
+ inputL += skip;
+ inputR += skip;
+ outputL += skip;
+ outputR += skip;
+ }
+}
+
+void revmodel::processmix(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip)
+{
+ float outL,outR,input;
+
+ while(numsamples-- > 0)
+ {
+ int i;
+
+ outL = outR = 0;
+ input = (*inputL + *inputR) * gain;
+
+ // Accumulate comb filters in parallel
+ for(i=0; i<numcombs; i++)
+ {
+ outL += combL[i].process(input);
+ outR += combR[i].process(input);
+ }
+
+ // Feed through allpasses in series
+ for(i=0; i<numallpasses; i++)
+ {
+ outL = allpassL[i].process(outL);
+ outR = allpassR[i].process(outR);
+ }
+
+ // Calculate output MIXING with anything already there
+ *outputL += outL*wet1 + outR*wet2 + *inputL*dry;
+ *outputR += outR*wet1 + outL*wet2 + *inputR*dry;
+
+ // Increment sample pointers, allowing for interleave (if any)
+ inputL += skip;
+ inputR += skip;
+ outputL += skip;
+ outputR += skip;
+ }
+}
+
+void revmodel::update()
+{
+// Recalculate internal values after parameter change
+
+ int i;
+
+ wet1 = wet*(width/2 + 0.5f);
+ wet2 = wet*((1-width)/2);
+
+ if (mode >= freezemode)
+ {
+ roomsize1 = 1;
+ damp1 = 0;
+ gain = muted;
+ }
+ else
+ {
+ roomsize1 = roomsize;
+ damp1 = damp;
+ gain = fixedgain;
+ }
+
+ for(i=0; i<numcombs; i++)
+ {
+ combL[i].setfeedback(roomsize1);
+ combR[i].setfeedback(roomsize1);
+ }
+
+ for(i=0; i<numcombs; i++)
+ {
+ combL[i].setdamp(damp1);
+ combR[i].setdamp(damp1);
+ }
+}
+
+// The following get/set functions are not inlined, because
+// speed is never an issue when calling them, and also
+// because as you develop the reverb model, you may
+// wish to take dynamic action when they are called.
+
+void revmodel::setroomsize(float value)
+{
+ roomsize = (value*scaleroom) + offsetroom;
+ update();
+}
+
+float revmodel::getroomsize()
+{
+ return (roomsize-offsetroom)/scaleroom;
+}
+
+void revmodel::setdamp(float value)
+{
+ damp = value*scaledamp;
+ update();
+}
+
+float revmodel::getdamp()
+{
+ return damp/scaledamp;
+}
+
+void revmodel::setwet(float value)
+{
+ wet = value*scalewet;
+ update();
+}
+
+float revmodel::getwet()
+{
+ return wet/scalewet;
+}
+
+void revmodel::setdry(float value)
+{
+ dry = value*scaledry;
+}
+
+float revmodel::getdry()
+{
+ return dry/scaledry;
+}
+
+void revmodel::setwidth(float value)
+{
+ width = value;
+ update();
+}
+
+float revmodel::getwidth()
+{
+ return width;
+}
+
+void revmodel::setmode(float value)
+{
+ mode = value;
+ update();
+}
+
+float revmodel::getmode()
+{
+ if (mode >= freezemode)
+ return 1;
+ else
+ return 0;
+}
+
+//ends
diff --git a/arts/modules/effects/freeverb/revmodel.hpp b/arts/modules/effects/freeverb/revmodel.hpp
new file mode 100644
index 0000000..ca6c89a
--- /dev/null
+++ b/arts/modules/effects/freeverb/revmodel.hpp
@@ -0,0 +1,87 @@
+// Reverb model declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#ifndef _revmodel_
+#define _revmodel_
+
+#include "comb.hpp"
+#include "allpass.hpp"
+#include "tuning.h"
+
+class revmodel
+{
+public:
+ revmodel();
+ void mute();
+ void processmix(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip);
+ void processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip);
+ void setroomsize(float value);
+ float getroomsize();
+ void setdamp(float value);
+ float getdamp();
+ void setwet(float value);
+ float getwet();
+ void setdry(float value);
+ float getdry();
+ void setwidth(float value);
+ float getwidth();
+ void setmode(float value);
+ float getmode();
+private:
+ void update();
+private:
+ float gain;
+ float roomsize,roomsize1;
+ float damp,damp1;
+ float wet,wet1,wet2;
+ float dry;
+ float width;
+ float mode;
+
+ // The following are all declared inline
+ // to remove the need for dynamic allocation
+ // with its subsequent error-checking messiness
+
+ // Comb filters
+ comb combL[numcombs];
+ comb combR[numcombs];
+
+ // Allpass filters
+ allpass allpassL[numallpasses];
+ allpass allpassR[numallpasses];
+
+ // Buffers for the combs
+ float bufcombL1[combtuningL1];
+ float bufcombR1[combtuningR1];
+ float bufcombL2[combtuningL2];
+ float bufcombR2[combtuningR2];
+ float bufcombL3[combtuningL3];
+ float bufcombR3[combtuningR3];
+ float bufcombL4[combtuningL4];
+ float bufcombR4[combtuningR4];
+ float bufcombL5[combtuningL5];
+ float bufcombR5[combtuningR5];
+ float bufcombL6[combtuningL6];
+ float bufcombR6[combtuningR6];
+ float bufcombL7[combtuningL7];
+ float bufcombR7[combtuningR7];
+ float bufcombL8[combtuningL8];
+ float bufcombR8[combtuningR8];
+
+ // Buffers for the allpasses
+ float bufallpassL1[allpasstuningL1];
+ float bufallpassR1[allpasstuningR1];
+ float bufallpassL2[allpasstuningL2];
+ float bufallpassR2[allpasstuningR2];
+ float bufallpassL3[allpasstuningL3];
+ float bufallpassR3[allpasstuningR3];
+ float bufallpassL4[allpasstuningL4];
+ float bufallpassR4[allpasstuningR4];
+};
+
+#endif//_revmodel_
+
+//ends
diff --git a/arts/modules/effects/freeverb/tuning.h b/arts/modules/effects/freeverb/tuning.h
new file mode 100644
index 0000000..baaa9ce
--- /dev/null
+++ b/arts/modules/effects/freeverb/tuning.h
@@ -0,0 +1,60 @@
+// Reverb model tuning values
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#ifndef _tuning_
+#define _tuning_
+
+const int numcombs = 8;
+const int numallpasses = 4;
+const float muted = 0;
+const float fixedgain = 0.015f;
+const float scalewet = 3;
+const float scaledry = 2;
+const float scaledamp = 0.4f;
+const float scaleroom = 0.28f;
+const float offsetroom = 0.7f;
+const float initialroom = 0.5f;
+const float initialdamp = 0.5f;
+const float initialwet = 1/scalewet;
+const float initialdry = 0;
+const float initialwidth = 1;
+const float initialmode = 0;
+const float freezemode = 0.5f;
+const int stereospread = 23;
+
+// These values assume 44.1KHz sample rate
+// they will probably be OK for 48KHz sample rate
+// but would need scaling for 96KHz (or other) sample rates.
+// The values were obtained by listening tests.
+const int combtuningL1 = 1116;
+const int combtuningR1 = 1116+stereospread;
+const int combtuningL2 = 1188;
+const int combtuningR2 = 1188+stereospread;
+const int combtuningL3 = 1277;
+const int combtuningR3 = 1277+stereospread;
+const int combtuningL4 = 1356;
+const int combtuningR4 = 1356+stereospread;
+const int combtuningL5 = 1422;
+const int combtuningR5 = 1422+stereospread;
+const int combtuningL6 = 1491;
+const int combtuningR6 = 1491+stereospread;
+const int combtuningL7 = 1557;
+const int combtuningR7 = 1557+stereospread;
+const int combtuningL8 = 1617;
+const int combtuningR8 = 1617+stereospread;
+const int allpasstuningL1 = 556;
+const int allpasstuningR1 = 556+stereospread;
+const int allpasstuningL2 = 441;
+const int allpasstuningR2 = 441+stereospread;
+const int allpasstuningL3 = 341;
+const int allpasstuningR3 = 341+stereospread;
+const int allpasstuningL4 = 225;
+const int allpasstuningR4 = 225+stereospread;
+
+#endif//_tuning_
+
+//ends
+
diff --git a/arts/modules/effects/freeverbguifactory_impl.cc b/arts/modules/effects/freeverbguifactory_impl.cc
new file mode 100644
index 0000000..d24f04d
--- /dev/null
+++ b/arts/modules/effects/freeverbguifactory_impl.cc
@@ -0,0 +1,107 @@
+ /*
+
+ Copyright (C) 2001 Stefan Westerfeld
+ stefan@space.twc.de
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#include "artsmoduleseffects.h"
+#include "debug.h"
+#include "connect.h"
+
+#include <kglobal.h>
+#include <klocale.h>
+
+using namespace std;
+using namespace Arts;
+
+namespace Arts {
+
+class FreeverbGuiFactory_impl : public FreeverbGuiFactory_skel
+{
+public:
+ Widget createGui(Object freeverb);
+};
+
+REGISTER_IMPLEMENTATION(FreeverbGuiFactory_impl);
+
+}
+
+Widget FreeverbGuiFactory_impl::createGui(Object object)
+{
+ KGlobal::locale()->insertCatalogue( "artsmodules" );
+ arts_return_val_if_fail(!object.isNull(), Arts::Widget::null());
+
+ Synth_FREEVERB freeverb = DynamicCast(object);
+ arts_return_val_if_fail(!freeverb.isNull(), Arts::Widget::null());
+
+ HBox hbox;
+ hbox.width(330); hbox.height(80); hbox.show();
+
+ Poti roomsize;
+ roomsize.x(20); roomsize.y(10); roomsize.caption(i18n("roomsize").utf8().data());
+ roomsize.color("red"); roomsize.min(0); roomsize.max(1);
+ roomsize.value(freeverb.roomsize());
+ roomsize.range(100);
+ roomsize.parent(hbox);
+ roomsize.show();
+ connect(roomsize,"value_changed", freeverb, "roomsize");
+ hbox._addChild(roomsize,"roomsizeWidget");
+
+ Poti damp;
+ damp.x(80); damp.y(10); damp.caption(i18n("damp").utf8().data());
+ damp.color("red"); damp.min(0); damp.max(1);
+ damp.value(freeverb.damp());
+ damp.range(100);
+ damp.parent(hbox);
+ damp.show();
+ connect(damp,"value_changed", freeverb, "damp");
+ hbox._addChild(damp,"dampWidget");
+
+ Poti wet;
+ wet.x(140); wet.y(10); wet.caption(i18n("wet").utf8().data());
+ wet.color("red"); wet.min(0); wet.max(1);
+ wet.value(freeverb.wet());
+ wet.range(100);
+ wet.parent(hbox);
+ wet.show();
+ connect(wet,"value_changed", freeverb, "wet");
+ hbox._addChild(wet,"wetWidget");
+
+ Poti dry;
+ dry.x(200); dry.y(10); dry.caption(i18n("dry").utf8().data());
+ dry.color("red"); dry.min(0); dry.max(1);
+ dry.value(freeverb.dry());
+ dry.range(100);
+ dry.parent(hbox);
+ dry.show();
+ connect(dry,"value_changed", freeverb, "dry");
+ hbox._addChild(dry,"dryWidget");
+
+ Poti width;
+ width.x(260); width.y(10); width.caption(i18n("width").utf8().data());
+ width.color("red"); width.min(0); width.max(1);
+ width.value(freeverb.width());
+ width.range(100);
+ width.parent(hbox);
+ width.show();
+ connect(width,"value_changed", freeverb, "width");
+ hbox._addChild(width,"widthWidget");
+
+ return hbox;
+}
diff --git a/arts/modules/effects/kstereovolumecontrolgui_impl.cpp b/arts/modules/effects/kstereovolumecontrolgui_impl.cpp
new file mode 100644
index 0000000..1d0f778
--- /dev/null
+++ b/arts/modules/effects/kstereovolumecontrolgui_impl.cpp
@@ -0,0 +1,132 @@
+/*
+
+ Copyright ( C ) 2003 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation;
+ version 2 of the License.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#include "kstereovolumecontrolgui_impl.h"
+
+#include <qframe.h>
+#include <kdebug.h>
+#include <iostream>
+
+using namespace Arts;
+
+KStereoVolumeControlGui_impl::KStereoVolumeControlGui_impl( QFrame* w ) : KLayoutBox_impl( w ? w : new QFrame( 0 ) )
+{
+ //kdDebug()<<"KStereoVolumeControlGui_impl::KStereoVolumeControlGui_impl( QFrame* "<<w<<" )"<<endl;
+ _mapper = new KStereoVolumeControlGui_EventMapper( this, _qframe );
+ this->addWidget( _label, -100 );
+ _label.bottom( Arts::East );
+ _label.text( "Volume" );
+ this->addLine( 1, 0, -100 );
+ this->addWidget( _left, 20 );
+ this->addWidget( _tickmarks, -100 );
+ this->addWidget( _right, 20 );
+ this->addLine( 1, 0, -100 );
+ this->addWidget( _volumefader, 20 );
+ this->addWidget( _fadertickmarks, -100 );
+ _fadertickmarks.position( posLeft );
+ _tickmarks.position( posLeft|posRight );
+ this->dbmin( -36 );
+ this->dbmax( 6 );
+ _left.framestyle( Arts::Raised|Arts::Panel ); _left.linewidth( 4 );
+ _right.framestyle( Arts::Raised|Arts::Panel ); _right.linewidth( 4 );
+ this->layoutmargin( 1 ); this->linewidth( 1 ); this->framestyle( Arts::Panel|Arts::Raised );
+}
+
+void KStereoVolumeControlGui_impl::constructor( Arts::StereoVolumeControl svc ) {
+ //kdDebug() << k_funcinfo << endl;
+ _svc = svc;
+ connect( svc, "currentVolumeLeft_changed", _left, "invalue" );
+ connect( svc, "currentVolumeRight_changed", _right, "invalue" );
+
+ connect( svc, "scaleFactor_changed", _volumefader, "volume" );
+ connect( _volumefader, "volume_changed", svc, "scaleFactor" );
+
+ _volumefader.volume( svc.scaleFactor() );
+
+ _mapper->_timer->start( 100 );
+}
+
+Arts::Direction KStereoVolumeControlGui_impl::direction() { return _dir; }
+void KStereoVolumeControlGui_impl::direction( Arts::Direction n ) {
+kdDebug() << k_funcinfo << n << endl;
+ _dir = n;
+ Arts::KLayoutBox_impl::direction( _dir );
+ switch ( _dir ) {
+ case Arts::LeftToRight:
+ case Arts::RightToLeft:
+ allWidgets( BottomToTop );
+ _label.bottom( Arts::East );
+ break;
+ case Arts::TopToBottom:
+ allWidgets( LeftToRight );
+ _label.bottom( Arts::South );
+ break;
+ case Arts::BottomToTop:
+ allWidgets( RightToLeft );
+ _label.bottom( Arts::South );
+ break;
+ default: break;
+ }
+}
+
+void KStereoVolumeControlGui_impl::allWidgets( Arts::Direction n ) {
+ _left.direction( n );
+ _right.direction( n );
+ _volumefader.direction( n );
+ _tickmarks.direction( n );
+ _fadertickmarks.direction( n );
+}
+
+void KStereoVolumeControlGui_impl::title( const std::string& n ) { _label.text( n ); }
+std::string KStereoVolumeControlGui_impl::title() { return _label.text(); }
+
+float KStereoVolumeControlGui_impl::dbmin() { return _dbmin; }
+void KStereoVolumeControlGui_impl::dbmin( float n ) {
+ //kdDebug() << k_funcinfo << n << endl;
+ _dbmin = n;
+ _left.mindB( _dbmin );
+ _right.mindB( _dbmin );
+ _tickmarks.min( _dbmin );
+ _volumefader.dbmin( _dbmin );
+ _fadertickmarks.min( _dbmin );
+}
+
+float KStereoVolumeControlGui_impl::dbmax() { return _dbmax; }
+void KStereoVolumeControlGui_impl::dbmax( float n ) {
+ //kdDebug() << k_funcinfo << n << endl;
+ _dbmax = n;
+ _left.maxdB( 0 );
+ _right.maxdB( 0 );
+ _tickmarks.max( 0 );
+ _volumefader.dbmax( _dbmax );
+ _fadertickmarks.max( _dbmax );
+}
+
+void KStereoVolumeControlGui_impl::updateValues() {
+ _left.invalue( _svc.currentVolumeLeft() );
+ _right.invalue( _svc.currentVolumeRight() );
+}
+
+REGISTER_IMPLEMENTATION( KStereoVolumeControlGui_impl );
+
+// vim: sw=4 ts=4
+#include "kstereovolumecontrolgui_impl.moc"
+
diff --git a/arts/modules/effects/kstereovolumecontrolgui_impl.h b/arts/modules/effects/kstereovolumecontrolgui_impl.h
new file mode 100644
index 0000000..abaec6a
--- /dev/null
+++ b/arts/modules/effects/kstereovolumecontrolgui_impl.h
@@ -0,0 +1,97 @@
+/*
+
+ Copyright ( C ) 2003 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation;
+ version 2 of the License.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#ifndef ARTS_STEREOVOLUMECONTROL_GUI_H
+#define ARTS_STEREOVOLUMECONTROL_GUI_H
+
+#include <artsmoduleseffects.h>
+
+#include <klayoutbox_impl.h>
+
+#include <kdebug.h>
+
+class KStereoVolumeControlGui_EventMapper;
+
+namespace Arts { // namespace Arts
+
+class KStereoVolumeControlGui_impl : virtual public Arts::StereoVolumeControlGui_skel,
+ virtual public Arts::KLayoutBox_impl
+{
+protected:
+ Arts::StereoVolumeControl _svc;
+ Arts::LevelMeter _left, _right;
+ Arts::Tickmarks _tickmarks;
+ Arts::Tickmarks _fadertickmarks;
+ Arts::VolumeFader _volumefader;
+ Arts::Label _label;
+ KStereoVolumeControlGui_EventMapper* _mapper;
+ float _dbmin, _dbmax;
+ Arts::Direction _dir;
+public:
+ KStereoVolumeControlGui_impl( QFrame* =0 );
+
+ void constructor( Arts::StereoVolumeControl );
+
+ Arts::Direction direction();
+ void direction( Arts::Direction );
+ std::string title();
+ void title( const std::string& );
+ float dbmin();
+ void dbmin( float );
+ float dbmax();
+ void dbmax( float );
+
+ Arts::LevelMeter left() { return _left; }
+ Arts::LevelMeter right() { return _right; }
+ Arts::VolumeFader fader() { return _volumefader; }
+ Arts::Tickmarks levelmetertickmarks() { return _tickmarks; }
+ Arts::Tickmarks volumefadertickmarks() { return _fadertickmarks; }
+ Arts::Label label() { return _label; }
+
+ void couple( bool ) {}
+ bool couple() { return true; }
+
+ void updateValues();
+private:
+ void allWidgets( Arts::Direction );
+}; // class StereoVolumeControlGui
+
+} // namespace Arts
+
+#include <qobject.h>
+#include <qtimer.h>
+
+class KStereoVolumeControlGui_EventMapper : public QObject {
+ Q_OBJECT
+public:
+ QTimer* _timer;
+ Arts::KStereoVolumeControlGui_impl* _impl;
+public:
+ KStereoVolumeControlGui_EventMapper( Arts::KStereoVolumeControlGui_impl* impl, QObject* parent, const char* name=0 ) : QObject( parent,name ), _impl( impl ) {
+ _timer = new QTimer( this );
+ connect( _timer, SIGNAL( timeout() ), this, SLOT( slotTimerSignal() ) );
+ }
+public slots:
+ void slotTimerSignal() { _impl->updateValues(); }
+};
+
+#endif
+// vim: sw=4 ts=4
diff --git a/arts/modules/effects/mcopclass/Effect_WAVECAPTURE.mcopclass b/arts/modules/effects/mcopclass/Effect_WAVECAPTURE.mcopclass
new file mode 100644
index 0000000..7eae5f2
--- /dev/null
+++ b/arts/modules/effects/mcopclass/Effect_WAVECAPTURE.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=Arts::Effect_WAVECAPTURE,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/FiveBandMonoComplexEQ.mcopclass b/arts/modules/effects/mcopclass/FiveBandMonoComplexEQ.mcopclass
new file mode 100644
index 0000000..015054a
--- /dev/null
+++ b/arts/modules/effects/mcopclass/FiveBandMonoComplexEQ.mcopclass
@@ -0,0 +1,6 @@
+Buildable=true
+Interface=Arts::FiveBandMonoComplexEQ,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
+Features=RackGUI
+Name="Five Band Equalizer (Mono)"
diff --git a/arts/modules/effects/mcopclass/FiveBandMonoComplexEQGuiFactory.mcopclass b/arts/modules/effects/mcopclass/FiveBandMonoComplexEQGuiFactory.mcopclass
new file mode 100644
index 0000000..8ecb41a
--- /dev/null
+++ b/arts/modules/effects/mcopclass/FiveBandMonoComplexEQGuiFactory.mcopclass
@@ -0,0 +1,4 @@
+Interface=Arts::FiveBandMonoComplexEQGuiFactory,Arts::GuiFactory,Arts::Object
+CanCreate=Arts::FiveBandMonoComplexEQ
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/FreeverbGuiFactory.mcopclass b/arts/modules/effects/mcopclass/FreeverbGuiFactory.mcopclass
new file mode 100644
index 0000000..4c4d4e9
--- /dev/null
+++ b/arts/modules/effects/mcopclass/FreeverbGuiFactory.mcopclass
@@ -0,0 +1,4 @@
+Interface=Arts::FreeverbGuiFactory,Arts::GuiFactory,Arts::Object
+CanCreate=Arts::Synth_FREEVERB
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/MonoToStereo.mcopclass b/arts/modules/effects/mcopclass/MonoToStereo.mcopclass
new file mode 100644
index 0000000..775b00e
--- /dev/null
+++ b/arts/modules/effects/mcopclass/MonoToStereo.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=Arts::MonoToStereo,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/StereoBalance.mcopclass b/arts/modules/effects/mcopclass/StereoBalance.mcopclass
new file mode 100644
index 0000000..1a59e1f
--- /dev/null
+++ b/arts/modules/effects/mcopclass/StereoBalance.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=Arts::StereoBalance,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/StereoBalanceGuiFactory.mcopclass b/arts/modules/effects/mcopclass/StereoBalanceGuiFactory.mcopclass
new file mode 100644
index 0000000..a539a91
--- /dev/null
+++ b/arts/modules/effects/mcopclass/StereoBalanceGuiFactory.mcopclass
@@ -0,0 +1,4 @@
+Interface=Arts::StereoBalanceGuiFactory,Arts::GuiFactory,Arts::Object
+CanCreate=Arts::StereoBalance
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/StereoCompressorGuiFactory.mcopclass b/arts/modules/effects/mcopclass/StereoCompressorGuiFactory.mcopclass
new file mode 100644
index 0000000..f392adb
--- /dev/null
+++ b/arts/modules/effects/mcopclass/StereoCompressorGuiFactory.mcopclass
@@ -0,0 +1,4 @@
+Interface=Arts::StereoCompressorGuiFactory,Arts::GuiFactory,Arts::Object
+CanCreate=Arts::Synth_STEREO_COMPRESSOR
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/StereoFirEqualizerGuiFactory.mcopclass b/arts/modules/effects/mcopclass/StereoFirEqualizerGuiFactory.mcopclass
new file mode 100644
index 0000000..d8f3c71
--- /dev/null
+++ b/arts/modules/effects/mcopclass/StereoFirEqualizerGuiFactory.mcopclass
@@ -0,0 +1,4 @@
+Interface=Arts::StereoFirEqualizerGuiFactory,Arts::GuiFactory,Arts::Object
+CanCreate=Arts::Synth_STEREO_FIR_EQUALIZER
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/StereoToMono.mcopclass b/arts/modules/effects/mcopclass/StereoToMono.mcopclass
new file mode 100644
index 0000000..8208e6f
--- /dev/null
+++ b/arts/modules/effects/mcopclass/StereoToMono.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=Arts::StereoToMono,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/StereoVolumeControlGui.mcopclass b/arts/modules/effects/mcopclass/StereoVolumeControlGui.mcopclass
new file mode 100644
index 0000000..f1db522
--- /dev/null
+++ b/arts/modules/effects/mcopclass/StereoVolumeControlGui.mcopclass
@@ -0,0 +1,5 @@
+Buildable=true
+Interface=Arts::StereoVolumeControlGui,Arts::LayoutBox,Arts::Frame,Arts::Widget,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
+Requires=kdegui
diff --git a/arts/modules/effects/mcopclass/StereoVolumeControlGuiFactory.mcopclass b/arts/modules/effects/mcopclass/StereoVolumeControlGuiFactory.mcopclass
new file mode 100644
index 0000000..8668ddb
--- /dev/null
+++ b/arts/modules/effects/mcopclass/StereoVolumeControlGuiFactory.mcopclass
@@ -0,0 +1,6 @@
+Buildable=true
+Interface=Arts::StereoVolumeControlGuiFactory,Arts::GuiFactory,Arts::Object
+CanCreate=Arts::StereoVolumeControl
+Language=C++
+Library=libartsmoduleseffects.la
+Requires=kdegui
diff --git a/arts/modules/effects/mcopclass/Synth_FREEVERB.mcopclass b/arts/modules/effects/mcopclass/Synth_FREEVERB.mcopclass
new file mode 100644
index 0000000..def8bf1
--- /dev/null
+++ b/arts/modules/effects/mcopclass/Synth_FREEVERB.mcopclass
@@ -0,0 +1,7 @@
+Buildable=true
+Interface=Arts::Synth_FREEVERB,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
+Features=RackGUI
+Name="Freeverb"
+Use=directly \ No newline at end of file
diff --git a/arts/modules/effects/mcopclass/Synth_STEREO_COMPRESSOR.mcopclass b/arts/modules/effects/mcopclass/Synth_STEREO_COMPRESSOR.mcopclass
new file mode 100644
index 0000000..357215a
--- /dev/null
+++ b/arts/modules/effects/mcopclass/Synth_STEREO_COMPRESSOR.mcopclass
@@ -0,0 +1,6 @@
+Buildable=true
+Interface=Arts::Synth_STEREO_COMPRESSOR,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
+Features=RackGUI
+Name="Stereo Compressor"
diff --git a/arts/modules/effects/mcopclass/Synth_STEREO_FIR_EQUALIZER.mcopclass b/arts/modules/effects/mcopclass/Synth_STEREO_FIR_EQUALIZER.mcopclass
new file mode 100644
index 0000000..c127e6f
--- /dev/null
+++ b/arts/modules/effects/mcopclass/Synth_STEREO_FIR_EQUALIZER.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=Arts::Synth_STEREO_FIR_EQUALIZER,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT.mcopclass b/arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT.mcopclass
new file mode 100644
index 0000000..97eff8d
--- /dev/null
+++ b/arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=Arts::Synth_STEREO_PITCH_SHIFT,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT_FFT.mcopclass b/arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT_FFT.mcopclass
new file mode 100644
index 0000000..a166972
--- /dev/null
+++ b/arts/modules/effects/mcopclass/Synth_STEREO_PITCH_SHIFT_FFT.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=Arts::Synth_STEREO_PITCH_SHIFT_FFT,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/mcopclass/Synth_VOICE_REMOVAL.mcopclass b/arts/modules/effects/mcopclass/Synth_VOICE_REMOVAL.mcopclass
new file mode 100644
index 0000000..411747c
--- /dev/null
+++ b/arts/modules/effects/mcopclass/Synth_VOICE_REMOVAL.mcopclass
@@ -0,0 +1,7 @@
+Buildable=true
+Interface=Arts::Synth_VOICE_REMOVAL,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartsmoduleseffects.la
+Features=RackGUI
+Name="Voice Removal"
+Use=directly \ No newline at end of file
diff --git a/arts/modules/effects/mcopclass/VoiceRemovalGuiFactory.mcopclass b/arts/modules/effects/mcopclass/VoiceRemovalGuiFactory.mcopclass
new file mode 100644
index 0000000..9536869
--- /dev/null
+++ b/arts/modules/effects/mcopclass/VoiceRemovalGuiFactory.mcopclass
@@ -0,0 +1,4 @@
+Interface=Arts::VoiceRemovalGuiFactory,Arts::GuiFactory,Arts::Object
+CanCreate=Arts::Synth_VOICE_REMOVAL
+Language=C++
+Library=libartsmoduleseffects.la
diff --git a/arts/modules/effects/monostereoconversion_impl.cc b/arts/modules/effects/monostereoconversion_impl.cc
new file mode 100644
index 0000000..4d408e6
--- /dev/null
+++ b/arts/modules/effects/monostereoconversion_impl.cc
@@ -0,0 +1,160 @@
+/*
+
+ Copyright ( C ) 2002 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or ( at your option ) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#include <artsflow.h>
+#include <flowsystem.h>
+#include <stdsynthmodule.h>
+#include <debug.h>
+#include <artsmoduleseffects.h>
+#include <connect.h>
+
+#include <kglobal.h>
+#include <klocale.h>
+
+namespace Arts {
+
+class MonoToStereo_impl : virtual public MonoToStereo_skel,
+ virtual public StdSynthModule
+{
+protected:
+ float _pan, _pLeft, _pRight;
+public:
+ MonoToStereo_impl()
+ {
+ pan( 0 );
+ }
+
+ float pan() { return _pan; }
+ void pan( float pan )
+ {
+ if( pan < -1 ) pan = -1;
+ if( pan > 1 ) pan = 1;
+ _pan = pan;
+ _pLeft = _pRight = 1;
+ if( _pan < 0 )
+ _pRight = 1 + _pan;
+ else
+ _pLeft = 1 - _pan;
+ }
+
+ void calculateBlock( unsigned long samples )
+ {
+ for( unsigned int i=0; i<samples; i++ )
+ {
+ outleft[ i ] = inmono[ i ] * _pLeft;
+ outright[ i ] = inmono[ i ] * _pRight;
+ }
+ }
+};
+REGISTER_IMPLEMENTATION( MonoToStereo_impl );
+
+class StereoToMono_impl : virtual public StereoToMono_skel,
+ virtual public StdSynthModule
+{
+protected:
+ float _pan, _pLeft, _pRight;
+public:
+ StereoToMono_impl()
+ {
+ pan( 0 );
+ }
+
+ float pan() { return _pan; }
+ void pan( float pan )
+ {
+ if( pan < -1 ) pan = -1;
+ if( pan > 1 ) pan = 1;
+ _pan = pan;
+ _pLeft = _pRight = 1;
+ if( _pan < 0 )
+ _pRight = 1 + _pan;
+ else
+ _pLeft = 1 - _pan;
+ }
+
+ void calculateBlock( unsigned long samples )
+ {
+ for( unsigned int i=0; i<samples; i++ )
+ outmono[ i ] = ( inleft[ i ] * _pLeft + inright[ i ] * _pRight ) / ( _pLeft + _pRight );
+ }
+};
+REGISTER_IMPLEMENTATION( StereoToMono_impl );
+
+class StereoBalance_impl : virtual public StereoBalance_skel,
+ virtual public StdSynthModule
+{
+protected:
+ float _balance, _left, _right;
+public:
+ StereoBalance_impl() : _balance( 0 ), _left( 1 ), _right( 1 ) { }
+
+ float balance() { return _balance; }
+ void balance( float n )
+ {
+//arts_debug( "StereoBalance::balance( float %f )", n );
+ if( n>1 ) n=1;
+ if( n<-1 ) n=-1;
+ _balance = n;
+ _right = _left = 1;
+ if( _balance < 0 )
+ _right = 1 + _balance;
+ else
+ _left = 1 - _balance;
+ }
+
+ void calculateBlock( unsigned long samples )
+ {
+//arts_debug( "StereoBalance::calculateBlock( unsigned int %i )", samples );
+ for( unsigned long i=0; i<samples; i++ )
+ {
+ // outleft[ i ] = inleft[ i ];
+ // outright[ i ] = inright[ i ];
+ outleft[ i ] = inleft[ i ] * _left;
+ outright[ i ] = inright[ i ] * _right;
+ }
+ }
+};
+REGISTER_IMPLEMENTATION( StereoBalance_impl );
+
+class StereoBalanceGuiFactory_impl : virtual public StereoBalanceGuiFactory_skel
+{
+public:
+ Widget createGui( Object object )
+ {
+ KGlobal::locale()->insertCatalogue( "artsmodules" );
+
+ arts_return_val_if_fail( !object.isNull(), Arts::Widget::null() );
+ StereoBalance ch= DynamicCast( object );
+ arts_return_val_if_fail( !ch.isNull(), Arts::Widget::null() );
+
+ Poti bal;
+ bal.caption( i18n( "Balance" ).utf8().data() );
+ bal.min( -1 ); bal.max( 1 );
+ bal.value( ch.balance() );
+ connect( bal, "value_changed", ch, "balance" );
+
+ return bal;
+ }
+};
+REGISTER_IMPLEMENTATION( StereoBalanceGuiFactory_impl );
+
+}
+
diff --git a/arts/modules/effects/stereocompressorguifactory_impl.cc b/arts/modules/effects/stereocompressorguifactory_impl.cc
new file mode 100644
index 0000000..b2f18a6
--- /dev/null
+++ b/arts/modules/effects/stereocompressorguifactory_impl.cc
@@ -0,0 +1,114 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include <kglobal.h>
+#include <klocale.h>
+
+#include "artsmoduleseffects.h"
+#include "connect.h"
+#include "debug.h"
+
+using namespace Arts;
+
+namespace Arts {
+
+class StereoCompressorGuiFactory_impl : virtual public StereoCompressorGuiFactory_skel
+{
+public:
+ Widget createGui( Object object )
+ {
+ KGlobal::locale()->insertCatalogue( "artsmodules" );
+
+ arts_return_val_if_fail(!object.isNull(), Arts::Widget::null() );
+
+ Synth_STEREO_COMPRESSOR comp = DynamicCast(object);
+ arts_return_val_if_fail(!comp.isNull(), Arts::Widget::null());
+
+ Poti attack;
+ attack.caption(i18n("attack").utf8().data());
+ attack.color("blue");
+ attack.min(0.1); attack.max(250);
+ attack.value( comp.attack() );
+ attack.range(250);
+ connect( attack, "value_changed", comp, "attack" );
+
+ Poti release;
+ release.caption(i18n("release").utf8().data());
+ release.color("blue");
+ release.min(0.1); release.max(250);
+ release.value( comp.release() );
+ release.range(250);
+ connect( release, "value_changed", comp, "release" );
+
+ Poti threshold;
+ threshold.caption(i18n("thresh.").utf8().data());
+ threshold.min(0.00001); threshold.max(1);
+ threshold.value( comp.threshold() );
+ threshold.logarithmic( 2.0 );
+ threshold.range(200);
+ connect( threshold, "value_changed", comp, "threshold" );
+
+ Poti ratio;
+ ratio.caption(i18n("ratio").utf8().data());
+ ratio.min(0); ratio.max(1);
+ ratio.value( comp.ratio() );
+ ratio.range(200);
+ connect( ratio, "value_changed", comp, "ratio" );
+
+ Poti output;
+ output.caption(i18n("output").utf8().data());
+ output.min(0.1); output.max(10.0);
+ output.value( comp.output() );
+ output.logarithmic( 2.0 );
+ output.range(200);
+ connect( output, "value_changed", comp, "output" );
+
+ Button bon;
+ bon.text(i18n("Bypass").utf8().data());
+ bon.toggle( true );
+ connect( bon, "pressed_changed", comp, "thru" );
+
+ LayoutBox hbox;
+ hbox.direction( LeftToRight ); hbox.layoutmargin( 5 ); hbox.spacing( 5 );
+ PopupBox timesbox;
+ timesbox.name( "Timings" ); timesbox.direction( LeftToRight );
+ LayoutBox times;
+ times.direction( LeftToRight ); times.spacing( 5 );
+
+ hbox.addWidget( timesbox );
+ times.addSpace( 5 );
+ times.addWidget( attack );
+ times.addWidget( release );
+ times.addSpace( 5 );
+ timesbox.widget( times );
+ hbox.addWidget( threshold );
+ hbox.addWidget( ratio );
+ hbox.addWidget( output );
+ hbox.addWidget( bon );
+ hbox.addStretch( 10 );
+
+ return hbox;
+ }
+};
+
+// vim:sw=4:ts=4
+
+REGISTER_IMPLEMENTATION(StereoCompressorGuiFactory_impl);
+
+}
diff --git a/arts/modules/effects/stereovolumecontrolguifactory_impl.cpp b/arts/modules/effects/stereovolumecontrolguifactory_impl.cpp
new file mode 100644
index 0000000..fb2163f
--- /dev/null
+++ b/arts/modules/effects/stereovolumecontrolguifactory_impl.cpp
@@ -0,0 +1,45 @@
+/*
+
+ Copyright ( C ) 2003 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation;
+ version 2 of the License.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#include <artsmoduleseffects.h>
+#include <connect.h>
+#include <debug.h>
+
+namespace Arts {
+
+class StereoVolumeControlGuiFactory_impl : virtual public StereoVolumeControlGuiFactory_skel
+{
+public:
+ Widget createGui( Object object )
+ {
+ arts_return_val_if_fail( !object.isNull(), Arts::Widget::null() );
+ StereoVolumeControl svc = DynamicCast( object );
+ arts_return_val_if_fail( !svc.isNull(), Arts::Widget::null() );
+
+ return StereoVolumeControlGui( svc );
+ }
+};
+
+REGISTER_IMPLEMENTATION( StereoVolumeControlGuiFactory_impl );
+
+}
+// vim: sw=4 ts=4
+
diff --git a/arts/modules/effects/synth_freeverb_impl.cc b/arts/modules/effects/synth_freeverb_impl.cc
new file mode 100644
index 0000000..0f68902
--- /dev/null
+++ b/arts/modules/effects/synth_freeverb_impl.cc
@@ -0,0 +1,84 @@
+ /*
+
+ Copyright (C) 2000 Stefan Westerfeld
+ stefan@space.twc.de
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#include "freeverb/revmodel.hpp"
+#include "artsmoduleseffects.h"
+#include "stdsynthmodule.h"
+
+using namespace Arts;
+
+class Synth_FREEVERB_impl : virtual public Synth_FREEVERB_skel,
+ virtual public StdSynthModule
+{
+ revmodel *model;
+public:
+ float roomsize() { return model->getroomsize(); }
+ void roomsize(float newval) { return model->setroomsize(newval); }
+
+ float damp() { return model->getdamp(); }
+ void damp(float newval) { return model->setdamp(newval); }
+
+ float wet() { return model->getwet(); }
+ void wet(float newval) { return model->setwet(newval); }
+
+ float dry() { return model->getdry(); }
+ void dry(float newval) { return model->setdry(newval); }
+
+ float width() { return model->getwidth(); }
+ void width(float newval) { return model->setwidth(newval); }
+
+ float mode() { return model->getmode(); }
+ void mode(float newval) { return model->setmode(newval); }
+
+ void streamInit()
+ {
+ /* prevent full buffers to be carried over stop-start sequence */
+ model->mute();
+ }
+
+ void calculateBlock(unsigned long samples)
+ {
+ model->processreplace(inleft, inright, outleft, outright, samples,1);
+ // don't add the original signal - that's what the "dry" argument is for
+ //for(unsigned long i = 0;i < samples; i++)
+ //{
+ //outleft[i] += inleft[i];
+ //outright[i] += inright[i];
+ //}
+ }
+ Synth_FREEVERB_impl()
+ {
+ // "revmodel" object size is far too big, vtable
+ // can't handle it
+ model=new revmodel;
+ // set dry to 1 so it at first sounds like it always did before
+ // ok, since scaledry = 2 calling dry( 0.5 ) has the desired
+ // effect
+ dry( 0.5f );
+ }
+ ~Synth_FREEVERB_impl()
+ {
+ delete model;
+ }
+};
+
+REGISTER_IMPLEMENTATION(Synth_FREEVERB_impl);
diff --git a/arts/modules/effects/synth_stereo_compressor_impl.cc b/arts/modules/effects/synth_stereo_compressor_impl.cc
new file mode 100644
index 0000000..db3463a
--- /dev/null
+++ b/arts/modules/effects/synth_stereo_compressor_impl.cc
@@ -0,0 +1,135 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Arnold Krille <arnold@arnoldarts.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include "artsmoduleseffects.h"
+#include <stdsynthmodule.h>
+#include <flowsystem.h>
+#include <debug.h>
+
+using namespace Arts;
+
+namespace Arts {
+
+class Synth_STEREO_COMPRESSOR_impl : virtual public Synth_STEREO_COMPRESSOR_skel,
+ virtual public StdSynthModule
+{
+public:
+ Synth_STEREO_COMPRESSOR_impl()
+ {
+ attack( 10 );
+ release( 10 );
+ threshold( 1 );
+ ratio( 0.8 );
+ output( 1 );
+ _thru = false;
+ _run = false;
+ }
+
+ void streamStart()
+ {
+ _run = true;
+ compleft.start();
+ compright.start();
+ if(!_thru)
+ connectComp(true);
+ else
+ connectThru(true);
+ }
+
+ void streamEnd()
+ {
+ _run = false;
+ connectComp(false);
+ connectThru(false);
+ compleft.stop();
+ compright.stop();
+ }
+
+ float attack() { return compleft.attack(); };
+ void attack( float f ) { compleft.attack(f); compright.attack(f); }
+ float release() { return compleft.release(); };
+ void release( float f ) { compleft.release(f); compright.release(f); }
+ float threshold() { return compleft.threshold(); };
+ void threshold( float f ) { compleft.threshold(f); compright.threshold(f); }
+ float ratio() { return compleft.ratio(); };
+ void ratio( float f ) { compleft.ratio(f); compright.ratio(f); }
+ float output() { return compleft.output(); };
+ void output( float f ) { compleft.output(f); compright.output(f); }
+
+ bool thru() { return _thru; }
+ void thru( bool f )
+ {
+ if( _thru != f )
+ {
+ if(!_thru)
+ connectComp(false);
+ else
+ connectThru(false);
+ _thru = f;
+ if(!_thru)
+ connectComp(true);
+ else
+ connectThru(true);
+ }
+ }
+
+private:
+ Synth_COMPRESSOR compleft, compright;
+ bool _thru;
+ bool _run;
+
+ void connectComp( bool _connect )
+ {
+ if(_connect)
+ {
+ _node()->virtualize("inleft",compleft._node(),"invalue");
+ _node()->virtualize("inright",compright._node(),"invalue");
+ _node()->virtualize("outleft",compleft._node(),"outvalue");
+ _node()->virtualize("outright",compright._node(),"outvalue");
+ }
+ else
+ {
+ _node()->devirtualize("inleft",compleft._node(),"invalue");
+ _node()->devirtualize("inright",compright._node(),"invalue");
+ _node()->devirtualize("outleft",compleft._node(),"outvalue");
+ _node()->devirtualize("outright",compright._node(),"outvalue");
+ }
+ }
+
+ void connectThru( bool _connect )
+ {
+ if(_connect)
+ {
+ _node()->virtualize("inleft",_node(),"outleft");
+ _node()->virtualize("inright",_node(),"outright");
+ }
+ else
+ {
+ _node()->devirtualize("inleft",_node(),"outleft");
+ _node()->devirtualize("inright",_node(),"outright");
+ }
+ }
+
+};
+
+// vim:sw=4:ts=4
+
+REGISTER_IMPLEMENTATION(Synth_STEREO_COMPRESSOR_impl);
+
+}
diff --git a/arts/modules/effects/synth_stereo_fir_equalizer_impl.cc b/arts/modules/effects/synth_stereo_fir_equalizer_impl.cc
new file mode 100644
index 0000000..8125104
--- /dev/null
+++ b/arts/modules/effects/synth_stereo_fir_equalizer_impl.cc
@@ -0,0 +1,221 @@
+/*
+
+ Copyright (C) 2001-2002 Stefan Westerfeld
+ stefan@space.twc.de
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ */
+
+#include <math.h>
+
+#include <arts/debug.h>
+#include <arts/fft.h>
+#include <arts/stdsynthmodule.h>
+#include <arts/connect.h>
+#include "artsmoduleseffects.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <kglobal.h>
+#include <klocale.h>
+
+using namespace std;
+using namespace Arts;
+
+static inline bool odd(int x) { return ((x & 1) == 1); }
+
+/* returns a blackman window: x is supposed to be in the interval [0..1] */
+static inline float blackmanWindow(float x)
+{
+ if(x < 0) return 0;
+ if(x > 1) return 0;
+ return 0.42-0.5*cos(M_PI*x*2)+0.08*cos(4*M_PI*x);
+}
+
+void firapprox(double *filter, int filtersize, vector<GraphPoint>& points)
+{
+ assert((filtersize >= 3) && odd(filtersize));
+
+ int fft_size = 8;
+ while(fft_size/2 < filtersize)
+ fft_size *= 2;
+
+ vector<GraphPoint>::iterator pi = points.begin();
+ float lfreq=-2, lval=1.0, rfreq=-1, rval=1.0;
+
+ float *re = (float*) malloc(fft_size * sizeof(float));
+ for(int i=0;i<fft_size/2;i++)
+ {
+ float freq = float(i)/float(fft_size/2);
+
+ while(freq > rfreq && pi != points.end())
+ {
+ lfreq = rfreq; rfreq = pi->x;
+ lval = rval; rval = pi->y;
+ pi++;
+ }
+ float pos = (freq-lfreq)/(rfreq-lfreq);
+ float val = lval*(1.0-pos) + rval*pos;
+
+ //printf("%f %f\n",freq,val);
+ re[i] = re[fft_size-1-i] = val;
+ }
+
+ float *filter_re = (float*) malloc(fft_size * sizeof(float));
+ float *filter_im = (float*) malloc(fft_size * sizeof(float));
+ arts_fft_float (fft_size, 1, re, 0, filter_re, filter_im);
+
+ for(int i=0;i<filtersize;i++)
+ {
+ filter[i] = filter_re[(i+fft_size-filtersize/2) & (fft_size-1)]
+ * blackmanWindow(float(i+1)/float(filtersize+1));
+ }
+ free(re);
+ free(filter_re);
+ free(filter_im);
+}
+
+namespace Arts {
+
+class Synth_STEREO_FIR_EQUALIZER_impl
+ : virtual public Synth_STEREO_FIR_EQUALIZER_skel,
+ virtual public StdSynthModule
+{
+ vector<GraphPoint> _frequencies;
+ long _taps;
+ unsigned long bpos;
+ double filter[256];
+ float lbuffer[256];
+ float rbuffer[256];
+
+public:
+ Synth_STEREO_FIR_EQUALIZER_impl()
+ {
+ _frequencies.push_back(GraphPoint(0.0,1.0));
+ _frequencies.push_back(GraphPoint(1.0,1.0));
+ _taps = 3;
+ for(bpos = 0; bpos < 256; bpos++)
+ lbuffer[bpos] = rbuffer[bpos] = 0.0;
+
+ calcFilter();
+ }
+ vector<GraphPoint> *frequencies() {
+ return new vector<GraphPoint>(_frequencies);
+ }
+ void frequencies(const vector<GraphPoint>& newFrequencies)
+ {
+ _frequencies = newFrequencies;
+
+ calcFilter();
+ }
+ long taps()
+ {
+ return _taps;
+ }
+ void taps(long newTaps)
+ {
+ arts_return_if_fail(newTaps >= 3 && newTaps <= 255);
+
+ if(!odd(newTaps))
+ newTaps++;
+ _taps = newTaps;
+
+ calcFilter();
+ }
+ void calcFilter()
+ {
+ firapprox(filter, _taps, _frequencies);
+ }
+ void calculateBlock(unsigned long samples)
+ {
+ for(unsigned i=0;i<samples;i++)
+ {
+ double lval = 0.0;
+ double rval = 0.0;
+ lbuffer[bpos & 255] = inleft[i];
+ rbuffer[bpos & 255] = inright[i];
+
+ for(int j=0;j<_taps;j++)
+ {
+ lval += lbuffer[(bpos-j) & 255] * filter[j];
+ rval += rbuffer[(bpos-j) & 255] * filter[j];
+ }
+ outleft[i] = lval;
+ outright[i] = rval;
+ bpos++;
+ }
+ }
+};
+
+REGISTER_IMPLEMENTATION(Synth_STEREO_FIR_EQUALIZER_impl);
+
+class StereoFirEqualizerGuiFactory_impl : public StereoFirEqualizerGuiFactory_skel
+{
+public:
+ Widget createGui(Object equalizer);
+};
+
+REGISTER_IMPLEMENTATION(StereoFirEqualizerGuiFactory_impl);
+
+}
+
+Widget StereoFirEqualizerGuiFactory_impl::createGui(Object object)
+{
+ KGlobal::locale()->insertCatalogue( "artsmodules" );
+ arts_return_val_if_fail(!object.isNull(), Arts::Widget::null());
+
+ Synth_STEREO_FIR_EQUALIZER equalizer = DynamicCast(object);
+ arts_return_val_if_fail(!equalizer.isNull(), Arts::Widget::null());
+
+ VBox vbox;
+ vbox.show();
+
+ Graph g;
+ g.parent(vbox);
+ g.width(400);
+ g.height(230);
+ g.caption(i18n("a graph").utf8().data());
+ g.minx(0.0);
+ g.maxx(1.0);
+ g.miny(0.0);
+ g.maxy(1.0);
+ g.show();
+
+ GraphLine gline;
+ gline.graph(g);
+ vector<GraphPoint> *points = equalizer.frequencies();
+ gline.points(*points);
+ delete points;
+ gline.color("red");
+ gline.editable(true);
+
+ connect(gline,"points_changed", equalizer, "frequencies");
+ g._addChild(gline,"gline");
+
+ SpinBox spinbox;
+ spinbox.caption(i18n("channels").utf8().data());
+ spinbox.min(3); spinbox.max(255);
+ spinbox.value(equalizer.taps());
+ spinbox.parent(vbox);
+ spinbox.show();
+ connect(spinbox,"value_changed", equalizer, "taps");
+ vbox._addChild(spinbox,"spinbox");
+ vbox._addChild(g,"g");
+
+ return vbox;
+}
diff --git a/arts/modules/effects/synth_stereo_pitch_shift_fft_impl.cc b/arts/modules/effects/synth_stereo_pitch_shift_fft_impl.cc
new file mode 100644
index 0000000..390fd04
--- /dev/null
+++ b/arts/modules/effects/synth_stereo_pitch_shift_fft_impl.cc
@@ -0,0 +1,63 @@
+#include "flowsystem.h"
+#include "artsmoduleseffects.h"
+#include "stdsynthmodule.h"
+
+using namespace Arts;
+
+class Synth_STEREO_PITCH_SHIFT_FFT_impl : virtual public Synth_STEREO_PITCH_SHIFT_FFT_skel,
+ virtual public StdSynthModule
+{
+protected:
+ Synth_PITCH_SHIFT_FFT leftPitchShift, rightPitchShift;
+
+public:
+ float speed() { return leftPitchShift.speed(); }
+ void speed(float newSpeed)
+ {
+ leftPitchShift.speed(newSpeed);
+ rightPitchShift.speed(newSpeed);
+ }
+
+ float scaleFactor() { return leftPitchShift.scaleFactor(); }
+ void scaleFactor(float newScaleFactor)
+ {
+ leftPitchShift.scaleFactor(newScaleFactor);
+ rightPitchShift.scaleFactor(newScaleFactor);
+ }
+
+ long frameSize() { return leftPitchShift.frameSize(); }
+ void frameSize(long newFrameSize)
+ {
+ leftPitchShift.frameSize(newFrameSize);
+ rightPitchShift.frameSize(newFrameSize);
+ }
+
+ long oversample() { return leftPitchShift.oversample(); }
+ void oversample(long newOversample)
+ {
+ leftPitchShift.oversample(newOversample);
+ rightPitchShift.oversample(newOversample);
+ }
+
+ void streamStart()
+ {
+ leftPitchShift.start();
+ rightPitchShift.start();
+ _node()->virtualize("inleft",leftPitchShift._node(),"inStream");
+ _node()->virtualize("outleft",leftPitchShift._node(),"outStream");
+ _node()->virtualize("inright",rightPitchShift._node(),"inStream");
+ _node()->virtualize("outright",rightPitchShift._node(),"outStream");
+ }
+
+ void streamEnd()
+ {
+ _node()->devirtualize("inleft",leftPitchShift._node(),"inStream");
+ _node()->devirtualize("outleft",leftPitchShift._node(),"outStream");
+ _node()->devirtualize("inright",rightPitchShift._node(),"inStream");
+ _node()->devirtualize("outright",rightPitchShift._node(),"outStream");
+ leftPitchShift.stop();
+ rightPitchShift.stop();
+ }
+};
+
+REGISTER_IMPLEMENTATION(Synth_STEREO_PITCH_SHIFT_FFT_impl);
diff --git a/arts/modules/effects/synth_stereo_pitch_shift_impl.cc b/arts/modules/effects/synth_stereo_pitch_shift_impl.cc
new file mode 100644
index 0000000..fbf7bb0
--- /dev/null
+++ b/arts/modules/effects/synth_stereo_pitch_shift_impl.cc
@@ -0,0 +1,51 @@
+#include "flowsystem.h"
+#include "artsmoduleseffects.h"
+#include "stdsynthmodule.h"
+
+#include <artsmodulessynth.h>
+
+using namespace Arts;
+
+class Synth_STEREO_PITCH_SHIFT_impl : virtual public Synth_STEREO_PITCH_SHIFT_skel,
+ virtual public StdSynthModule
+{
+protected:
+ Synth_PITCH_SHIFT leftPitchShift, rightPitchShift;
+
+public:
+ float speed() { return leftPitchShift.speed(); }
+ void speed(float newSpeed)
+ {
+ leftPitchShift.speed(newSpeed);
+ rightPitchShift.speed(newSpeed);
+ }
+
+ float frequency() { return leftPitchShift.frequency(); }
+ void frequency(float newFrequency)
+ {
+ leftPitchShift.frequency(newFrequency);
+ rightPitchShift.frequency(newFrequency);
+ }
+
+ void streamStart()
+ {
+ leftPitchShift.start();
+ rightPitchShift.start();
+ _node()->virtualize("inleft",leftPitchShift._node(),"invalue");
+ _node()->virtualize("outleft",leftPitchShift._node(),"outvalue");
+ _node()->virtualize("inright",rightPitchShift._node(),"invalue");
+ _node()->virtualize("outright",rightPitchShift._node(),"outvalue");
+ }
+
+ void streamEnd()
+ {
+ _node()->devirtualize("inleft",leftPitchShift._node(),"invalue");
+ _node()->devirtualize("outleft",leftPitchShift._node(),"outvalue");
+ _node()->devirtualize("inright",rightPitchShift._node(),"invalue");
+ _node()->devirtualize("outright",rightPitchShift._node(),"outvalue");
+ leftPitchShift.stop();
+ rightPitchShift.stop();
+ }
+};
+
+REGISTER_IMPLEMENTATION(Synth_STEREO_PITCH_SHIFT_impl);
diff --git a/arts/modules/effects/synth_voice_removal_impl.cc b/arts/modules/effects/synth_voice_removal_impl.cc
new file mode 100644
index 0000000..8aee121
--- /dev/null
+++ b/arts/modules/effects/synth_voice_removal_impl.cc
@@ -0,0 +1,108 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2003 Matthias Kretz <kretz@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+// $Id$
+
+#include "artsmoduleseffects.h"
+#include <stdsynthmodule.h>
+#include <c_filter_stuff.h>
+#include <algorithm>
+
+using namespace Arts;
+using namespace std;
+
+class Synth_VOICE_REMOVAL_impl : virtual public Synth_VOICE_REMOVAL_skel,
+ virtual public StdSynthModule
+{
+protected:
+ float _position, _frequency;
+ filter fleft, fright;
+
+public:
+ Synth_VOICE_REMOVAL_impl()
+ : _position( 0 )
+ , _frequency( 200 )
+ {
+ }
+
+ float position() { return _position; }
+ void position(float newPosition)
+ {
+ if(newPosition != _position)
+ {
+ _position = newPosition;
+ position_changed(newPosition);
+ }
+ }
+
+ float frequency() { return _frequency; }
+ void frequency(float newFrequency)
+ {
+ if(newFrequency != _frequency)
+ {
+ _frequency = newFrequency;
+ // the shelve-lowpass-filter is extremely sensitive to frequencies which
+ // are out of it's range (it produces NaN's then) so we'll be careful ;)
+ if(_frequency > 22000.0) _frequency = 22000.0;
+ if(_frequency < 1.0) _frequency = 1.0;
+ frequency_changed(_frequency);
+ }
+ }
+
+ void streamInit()
+ {
+ initfilter(&fleft);
+ initfilter(&fright);
+ }
+
+ void calculateBlock(unsigned long samples)
+ {
+ setfilter_shelvelowpass(&fleft,_frequency,80.0);
+ setfilter_shelvelowpass(&fright,_frequency,80.0);
+
+ unsigned long i;
+ for (i=0; i<samples; i++)
+ {
+ fleft.x = inleft[i];// * min(float(1), (1 - _position));
+ fleft.y = fleft.cx * fleft.x + fleft.cx1 * fleft.x1 + fleft.cx2
+ * fleft.x2 + fleft.cy1 * fleft.y1 + fleft.cy2 * fleft.y2;
+ fleft.x2 = fleft.x1;
+ fleft.x1 = fleft.x;
+ fleft.y2 = fleft.y1;
+ fleft.y1 = fleft.y;
+ float highleft = inleft[i] - 0.95 * fleft.y;
+
+ fright.x = inright[i];// * min(float(1), (1 + _position));
+ fright.y = fright.cx * fright.x + fright.cx1 * fright.x1 + fright.cx2
+ * fright.x2 + fright.cy1 * fright.y1 + fright.cy2 * fright.y2;
+ fright.x2 = fright.x1;
+ fright.x1 = fright.x;
+ fright.y2 = fright.y1;
+ fright.y1 = fright.y;
+ float highright = inright[i] - 0.95 * fright.y;
+
+ outleft[i] = (inleft[i] - highright);// / min(float(1), (1 - _position));
+ outright[i] = (inright[i] - highleft);// / min(float(1), (1 + _position));
+ }
+ }
+
+};
+
+REGISTER_IMPLEMENTATION(Synth_VOICE_REMOVAL_impl);
+
+// vim: sw=4 ts=4
diff --git a/arts/modules/effects/voiceremovalguifactory_impl.cc b/arts/modules/effects/voiceremovalguifactory_impl.cc
new file mode 100644
index 0000000..af66647
--- /dev/null
+++ b/arts/modules/effects/voiceremovalguifactory_impl.cc
@@ -0,0 +1,76 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Matthias Kretz <kretz@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+// $Id$
+
+#include "artsmoduleseffects.h"
+#include <debug.h>
+#include <connect.h>
+#include <iostream>
+
+using namespace std;
+using namespace Arts;
+
+namespace Arts {
+
+class VoiceRemovalGuiFactory_impl : public VoiceRemovalGuiFactory_skel
+{
+ public:
+ Widget createGui( Object );
+};
+
+REGISTER_IMPLEMENTATION( VoiceRemovalGuiFactory_impl );
+
+}
+
+Widget VoiceRemovalGuiFactory_impl::createGui( Object object )
+{
+ arts_return_val_if_fail( ! object.isNull(), Arts::Widget::null() );
+
+ Synth_VOICE_REMOVAL voiceremoval = DynamicCast( object );
+ arts_return_val_if_fail( ! voiceremoval.isNull(), Arts::Widget::null() );
+
+ HBox hbox;
+ hbox.width( 140 ); hbox.height( 80 );// hbox.show();
+
+ Poti position;
+ position.x( 20 ); position.y( 10 ); position.caption( "position" );
+ position.color( "grey" ); position.min( -1 ); position.max( 1 );
+ position.value( voiceremoval.position() );
+ position.range( 100 );
+ position.parent( hbox );
+ position.show();
+ connect( position, "value_changed", voiceremoval, "position" );
+ hbox._addChild( position, "positionWidget" );
+
+ Poti freq;
+ freq.x( 80 ); freq.y( 10 ); freq.caption( "freq" );
+ freq.color( "red" ); freq.min( 1 ); freq.max( 10000 );
+ freq.value( voiceremoval.frequency() );
+ freq.range( 400 );
+ freq.logarithmic( 2.0 );
+ freq.parent( hbox );
+ freq.show();
+ connect( freq, "value_changed", voiceremoval, "frequency" );
+ hbox._addChild( freq, "freqWidget" );
+
+
+ return hbox;
+}
+
+// vim: ts=4 sw=4