[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: division module [PATCH]
From:       Matthias Kretz <kretz () kde ! org>
Date:       2004-11-25 10:35:59
Message-ID: 200411251136.05358.kretz () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Here's the patch, I can commit it for KDE 3.4...

On Thursday 25 November 2004 10:52, Matthias Kretz wrote:
> Hi Wolfgang,
>
> I guess nobody ever thought there would be a need for that. I can write
> that module for you in a few seconds (copy the multiplication module and
> substitute multiplication with division). Would you be able to use the code
> from CVS then?
>
> On Saturday 20 November 2004 16:21, Wolfgang Jeltsch wrote:
> > why isn't there a division module in aRts like there is a multiplication
> > module?  I want to do additive synthesis and want to divide the n-th
> > harmonic by n.  Another solution would probably be to have a filter which
> > filters -3dB(?) per octave.

-- 
C'ya
        Matthias
________________________________________________________
Matthias Kretz (Germany)                          <><
http://Vir.homeip.net/
MatthiasKretz@gmx.net, kretz@kde.org,
Matthias.Kretz@urz.uni-heidelberg.de

["synth_div.patch" (text/x-diff)]

Index: Makefile.am
===================================================================
RCS file: /home/kde/kdemultimedia/arts/modules/synth/Makefile.am,v
retrieving revision 1.9
diff -u -3 -p -r1.9 Makefile.am
--- Makefile.am	18 Aug 2004 05:52:18 -0000	1.9
+++ Makefile.am	25 Nov 2004 10:20:26 -0000
@@ -24,7 +24,8 @@ libartsmodulessynth_la_SOURCES = artsmod
 	synth_wave_tri_impl.cc synth_noise_impl.cc synth_wave_softsaw_impl.cc \
synth_wave_square_impl.cc synth_wave_pulse_impl.cc synth_osc_impl.cc \
synth_play_pat_impl.cc \  synth_capture_wav_impl.cc \
 	synth_midi_test_impl.cc synth_sequence_impl.cc synth_sequence_freq_impl.cc \
-	synth_midi_debug_impl.cc objectcache_impl.cc synth_nil_impl.cc synth_debug_impl.cc \
synth_data_impl.cc +	synth_midi_debug_impl.cc objectcache_impl.cc synth_nil_impl.cc \
synth_debug_impl.cc synth_data_impl.cc \ +	synth_div_impl.cc
 libartsmodulessynth_la_COMPILE_FIRST = artsmodulessynth.h
 
 libartsmodulessynth_la_LIBADD = \
Index: artsmodulessynth.idl
===================================================================
RCS file: /home/kde/kdemultimedia/arts/modules/synth/artsmodulessynth.idl,v
retrieving revision 1.3
diff -u -3 -p -r1.3 artsmodulessynth.idl
--- artsmodulessynth.idl	20 Aug 2003 20:11:22 -0000	1.3
+++ artsmodulessynth.idl	25 Nov 2004 10:20:26 -0000
@@ -40,6 +40,15 @@ module Arts {
 
 // Arithmetic & Mixing
 
+/**
+ * Divides two audio streams
+ */
+interface Synth_DIV : SynthModule {
+	in audio stream invalue1,invalue2;
+	out audio stream outvalue;
+	default invalue1, invalue2;
+};
+
 interface Synth_XFADE : SynthModule {
 	in audio stream invalue1,invalue2,percentage;
 	out audio stream outvalue;
Index: synth_div_impl.cc
===================================================================
RCS file: synth_div_impl.cc
diff -N synth_div_impl.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ synth_div_impl.cc	25 Nov 2004 10:20:26 -0000
@@ -0,0 +1,45 @@
+    /*
+
+    Copyright (C) 2000 Stefan Westerfeld
+                       stefan@space.twc.de
+                  2004 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 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 "artsmodulessynth.h"
+#include "stdsynthmodule.h"
+
+using namespace Arts;
+
+namespace Arts {
+
+class Synth_DIV_impl :public Synth_DIV_skel, public StdSynthModule
+{
+public:
+	void calculateBlock(unsigned long samples)
+	{
+		unsigned long i;
+
+		for(i = 0;i < samples; i++) 
+			outvalue[i] = invalue1[i] / invalue2[i];
+	}
+};
+
+REGISTER_IMPLEMENTATION(Synth_DIV_impl);
+
+}


[Attachment #8 (application/pgp-signature)]

_______________________________________________
kde-multimedia mailing list
kde-multimedia@kde.org
https://mail.kde.org/mailman/listinfo/kde-multimedia


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic