summaryrefslogtreecommitdiffstats
path: root/noatun/modules/artseffects
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 /noatun/modules/artseffects
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 'noatun/modules/artseffects')
-rw-r--r--noatun/modules/artseffects/ExtraStereo.mcopclass5
-rw-r--r--noatun/modules/artseffects/ExtraStereoGuiFactory.mcopclass5
-rw-r--r--noatun/modules/artseffects/Makefile.am25
-rw-r--r--noatun/modules/artseffects/RawWriter.mcopclass4
-rw-r--r--noatun/modules/artseffects/VoiceRemoval.mcopclass5
-rw-r--r--noatun/modules/artseffects/artseffects.idl17
-rw-r--r--noatun/modules/artseffects/effect.cpp1
-rw-r--r--noatun/modules/artseffects/extrastereo_impl.cc153
-rw-r--r--noatun/modules/artseffects/extrastereogui_impl.cc28
-rw-r--r--noatun/modules/artseffects/extrastereogui_impl.h26
10 files changed, 269 insertions, 0 deletions
diff --git a/noatun/modules/artseffects/ExtraStereo.mcopclass b/noatun/modules/artseffects/ExtraStereo.mcopclass
new file mode 100644
index 00000000..7fb466ec
--- /dev/null
+++ b/noatun/modules/artseffects/ExtraStereo.mcopclass
@@ -0,0 +1,5 @@
+Buildable=true
+Interface=ExtraStereo,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartseffects.la
+Use=directly \ No newline at end of file
diff --git a/noatun/modules/artseffects/ExtraStereoGuiFactory.mcopclass b/noatun/modules/artseffects/ExtraStereoGuiFactory.mcopclass
new file mode 100644
index 00000000..5b5521ae
--- /dev/null
+++ b/noatun/modules/artseffects/ExtraStereoGuiFactory.mcopclass
@@ -0,0 +1,5 @@
+Buildable=true
+Interface=ExtraStereoGuiFactory,Arts::GuiFactory,Arts::Object
+Library=libartseffects.la
+Language=C++
+CanCreate=ExtraStereo
diff --git a/noatun/modules/artseffects/Makefile.am b/noatun/modules/artseffects/Makefile.am
new file mode 100644
index 00000000..49a5bb99
--- /dev/null
+++ b/noatun/modules/artseffects/Makefile.am
@@ -0,0 +1,25 @@
+INCLUDES= -I$(top_builddir)/arts/gui/common -I$(top_srcdir)/arts/gui/common -I$(kde_includes)/arts $(all_includes)
+lib_LTLIBRARIES = libartseffects.la
+#libartseffectsui.la
+
+libartseffects_la_SOURCES = artseffects.cc extrastereo_impl.cc
+libartseffects_la_COMPILE_FIRST = artseffects.cc
+libartseffects_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+libartseffects_la_LIBADD = $(top_builddir)/arts/gui/common/libartsgui_idl.la -lkmedia2_idl -lsoundserver_idl -lartsflow
+
+
+artseffects.mcopclass: artseffects.h
+artseffects.mcoptype: artseffects.h
+artseffects.cc artseffects.h: $(srcdir)/artseffects.idl $(MCOPIDL)
+ $(MCOPIDL) -t -I$(top_builddir)/arts/gui/common -I$(top_srcdir)/arts/gui/common -I$(kde_includes)/arts $(srcdir)/artseffects.idl
+
+CLEANFILES = artsmidi.cc artsmidi.h artsmidi.mcoptype artsmidi.mcopclass
+
+mcoptypedir = $(libdir)/mcop
+mcoptype_DATA = artseffects.mcoptype artseffects.mcopclass
+
+mcopclassdir = $(libdir)/mcop
+mcopclass_DATA = ExtraStereo.mcopclass VoiceRemoval.mcopclass RawWriter.mcopclass ExtraStereoGuiFactory.mcopclass
+
+artseffects.lo: artseffects.h ../../../arts/gui/common/artsgui.h
+extrastereo_impl.lo: ../../../arts/gui/common/artsgui.h artseffects.h
diff --git a/noatun/modules/artseffects/RawWriter.mcopclass b/noatun/modules/artseffects/RawWriter.mcopclass
new file mode 100644
index 00000000..535db20a
--- /dev/null
+++ b/noatun/modules/artseffects/RawWriter.mcopclass
@@ -0,0 +1,4 @@
+Buildable=true
+Interface=RawWriter,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartseffects.la
diff --git a/noatun/modules/artseffects/VoiceRemoval.mcopclass b/noatun/modules/artseffects/VoiceRemoval.mcopclass
new file mode 100644
index 00000000..661029bd
--- /dev/null
+++ b/noatun/modules/artseffects/VoiceRemoval.mcopclass
@@ -0,0 +1,5 @@
+Buildable=true
+Interface=VoiceRemoval,Arts::StereoEffect,Arts::SynthModule,Arts::Object
+Language=C++
+Library=libartseffects.la
+Use=directly
diff --git a/noatun/modules/artseffects/artseffects.idl b/noatun/modules/artseffects/artseffects.idl
new file mode 100644
index 00000000..86fdea16
--- /dev/null
+++ b/noatun/modules/artseffects/artseffects.idl
@@ -0,0 +1,17 @@
+#include <artsflow.idl>
+#include <artsgui.idl>
+
+interface ExtraStereo : Arts::StereoEffect {
+ attribute float intensity;
+};
+
+interface VoiceRemoval : Arts::StereoEffect {
+};
+
+interface RawWriter : Arts::StereoEffect
+{
+};
+
+interface ExtraStereoGuiFactory : Arts::GuiFactory {
+};
+
diff --git a/noatun/modules/artseffects/effect.cpp b/noatun/modules/artseffects/effect.cpp
new file mode 100644
index 00000000..8d1c8b69
--- /dev/null
+++ b/noatun/modules/artseffects/effect.cpp
@@ -0,0 +1 @@
+
diff --git a/noatun/modules/artseffects/extrastereo_impl.cc b/noatun/modules/artseffects/extrastereo_impl.cc
new file mode 100644
index 00000000..3dc92705
--- /dev/null
+++ b/noatun/modules/artseffects/extrastereo_impl.cc
@@ -0,0 +1,153 @@
+#include "artsgui.h"
+#include "artseffects.h"
+#include "stdsynthmodule.h"
+#include <dynamicrequest.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <convert.h>
+#include "debug.h"
+#include <connect.h>
+#include <cstdlib>
+
+using namespace Arts;
+
+class ExtraStereo_impl : virtual public ExtraStereo_skel,
+ virtual public StdSynthModule
+{
+ float _intensity;
+// StereoEffectGUI mStereoEffectGUI;
+public:
+ float intensity() { return _intensity; }
+ void intensity(float newValue) {
+ _intensity = newValue;
+// cout << " **** INTENSITY = " << newValue << endl;
+ }
+
+ ExtraStereo_impl() : _intensity(2.0)
+ {
+// mStereoEffectGUI = DynamicCast(server.createObject("Arts::ExtraStereo"));
+// DynamicRequest(mStereoEffectGUI).method("_set_effect").param(*this).invoke();
+
+ }
+ void calculateBlock(unsigned long samples)
+ {
+ unsigned long i;
+
+ for(i = 0; i < samples; i++)
+ {
+ float average = (inleft[i] + inright[i]) / 2.0;
+
+ float outleftnew = average + (inleft[i] - average) * _intensity;
+ if(outleftnew > 1.0) outleft[i] = 1.0;
+ else if(outleftnew < -1.0) outleft[i] = -1.0;
+ else outleft[i] = outleftnew;
+
+ float outrightnew = average + (inright[i] - average) * _intensity;
+ if(outrightnew > 1.0) outright[i] = 1.0;
+ else if(outrightnew < -1.0) outright[i] = -1.0;
+ else outright[i] = outrightnew;
+ }
+ }
+};
+
+
+class VoiceRemoval_impl : virtual public VoiceRemoval_skel,
+ virtual public StdSynthModule
+{
+public:
+
+ VoiceRemoval_impl()
+ {
+
+ }
+ // This is based on the work of Anders Carlsson <anders.carlsson@tordata.se>
+ void calculateBlock(unsigned long samples)
+ {
+ for (unsigned i = 0; i < samples; i++)
+ {
+ float outleftnew=inleft[i]-inright[i];
+ float outrightnew=inright[i]-inleft[i];
+
+ if (inleft[i] < -1.0) outleftnew = -1.0;
+ else if (inleft[i] > 1.0) outleftnew = 1.0;
+
+ if (inright[i] < -1.0) outrightnew = -1.0;
+ else if (inright[i] > 1.0) outrightnew = 1.0;
+ outleft[i] = outleftnew;
+ outright[i] = outrightnew;
+ }
+
+ }
+};
+
+class RawWriter_impl : virtual public RawWriter_skel,
+ virtual public StdSynthModule
+{
+ int mFd;
+public:
+ RawWriter_impl()
+ {
+ std::string file=getenv("HOME");
+ file.append("/arts-write.raw");
+ mFd=::open(file.c_str(), O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
+ }
+ ~RawWriter_impl()
+ {
+ ::close(mFd);
+ }
+ // This is based on the work of Anders Carlsson <anders.carlsson@tordata.se>
+ void calculateBlock(unsigned long samples)
+ {
+ for (unsigned i = 0; i < samples; i++)
+ {
+ outleft[i]=inleft[i];
+ outright[i]=inright[i];
+ }
+ unsigned char *buffer=new unsigned char[samples*4];
+ convert_stereo_2float_i16le(samples,
+ inleft, inright, buffer);
+ ::write(mFd, (const void*)buffer, samples*4);
+ delete [] buffer;
+ }
+};
+
+class ExtraStereoGuiFactory_impl : public ExtraStereoGuiFactory_skel
+{
+public:
+ Widget createGui(Object object)
+ {
+ arts_return_val_if_fail(!object.isNull(), Arts::Widget::null());
+
+ ExtraStereo e = DynamicCast(object);
+ arts_return_val_if_fail(!e.isNull(), Arts::Widget::null());
+
+ HBox hbox;
+ hbox.width(80);
+ hbox.height(80);
+ hbox.show();
+
+
+ Poti intense;
+ intense.caption("Intensity");
+ intense.color("red");
+ intense.min(0);
+ intense.max(5);
+ intense.value(e.intensity());
+ intense.parent(hbox);
+ intense.show();
+ connect(intense,"value_changed", e, "intensity");
+
+ hbox._addChild(intense,"intensityWidget");
+
+ return hbox;
+ }
+};
+
+
+REGISTER_IMPLEMENTATION(ExtraStereo_impl);
+REGISTER_IMPLEMENTATION(VoiceRemoval_impl);
+REGISTER_IMPLEMENTATION(RawWriter_impl);
+REGISTER_IMPLEMENTATION(ExtraStereoGuiFactory_impl);
+
+
diff --git a/noatun/modules/artseffects/extrastereogui_impl.cc b/noatun/modules/artseffects/extrastereogui_impl.cc
new file mode 100644
index 00000000..5952c80e
--- /dev/null
+++ b/noatun/modules/artseffects/extrastereogui_impl.cc
@@ -0,0 +1,28 @@
+#include <qlayout.h>
+#include <qslider.h>
+#include "extrastereogui_impl.h"
+
+namespace Arts {
+
+ExtraStereoGUI_impl::ExtraStereoGUI_impl() : QWidget(0)
+{
+ (new QHBoxLayout(this))->setAutoAdd(true);
+ mSlider=new QSlider(0,100,10, 0, Horizontal, this);
+ mSlider->show();
+ show();
+}
+
+void ExtraStereoGUI_impl::changeSlider(int v)
+{
+ effect.intensity((float)v/100.0);
+}
+
+void ExtraStereoGUI_impl::setEffect(StereoEffect newEffect)
+{
+ effect = DynamicCast(newEffect);
+}
+
+REGISTER_IMPLEMENTATION(ExtraStereoGUI_impl);
+
+};
+
diff --git a/noatun/modules/artseffects/extrastereogui_impl.h b/noatun/modules/artseffects/extrastereogui_impl.h
new file mode 100644
index 00000000..56104ae8
--- /dev/null
+++ b/noatun/modules/artseffects/extrastereogui_impl.h
@@ -0,0 +1,26 @@
+#include "artseffects.h"
+#include "stdsynthmodule.h"
+#include <qwidget.h>
+
+class QSlider;
+
+namespace Arts {
+
+class ExtraStereoGUI_impl : public QWidget, virtual public ExtraStereoGUI_skel
+{
+public:
+ ExtraStereo effect;
+
+ ExtraStereoGUI_impl();
+
+ void setEffect(StereoEffect newEffect);
+
+public slots:
+ void changeSlider(int);
+
+private:
+ QSlider *mSlider;
+};
+
+
+};