aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.pan_gogins~75
-rw-r--r--pan_gogins~.README39
-rw-r--r--pan_gogins~.c109
-rw-r--r--pan_gogins~.pd95
4 files changed, 318 insertions, 0 deletions
diff --git a/Makefile.pan_gogins~ b/Makefile.pan_gogins~
new file mode 100644
index 0000000..7548ce1
--- /dev/null
+++ b/Makefile.pan_gogins~
@@ -0,0 +1,75 @@
+current:
+ echo make pd_linux, pd_nt, pd_irix5, or pd_irix6
+
+clean: ; rm -f *.pd_linux *.o
+
+# ----------------------- NT -----------------------
+
+pd_nt: pan_gogins~.dll
+
+.SUFFIXES: .dll
+
+PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
+VC="C:\Program Files\Microsoft Visual Studio\Vc98"
+
+PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include
+
+PDNTLDIR = $(VC)\lib
+PDNTLIB = $(PDNTLDIR)\libc.lib \
+ $(PDNTLDIR)\oldnames.lib \
+ $(PDNTLDIR)\kernel32.lib \
+ \ftp\pd\bin\pd.lib
+
+.c.dll:
+ cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
+ link /dll /export:$*_setup $*.obj $(PDNTLIB)
+
+# ----------------------- IRIX 5.x -----------------------
+
+pd_irix5: pan_gogins~.pd_irix5
+
+.SUFFIXES: .pd_irix5
+
+SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
+
+
+SGIINCLUDE = -I../../src/
+
+.c.pd_irix5:
+ cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
+ ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
+ rm $*.o
+
+# ----------------------- IRIX 6.x -----------------------
+
+pd_irix6: pan_gogins~.pd_irix6
+
+.SUFFIXES: .pd_irix6
+
+SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
+ -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
+ -Ofast=ip32
+
+.c.pd_irix6:
+ cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c
+ ld -IPA -n32 -shared -rdata_shared -o $*.pd_irix6 $*.o
+ rm $*.o
+
+# ----------------------- LINUX i386 -----------------------
+
+pd_linux: pan_gogins~.pd_linux
+
+.SUFFIXES: .pd_linux
+
+LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
+ -Wall -W -Wshadow -Wstrict-prototypes -Werror \
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+LINUXINCLUDE = -I/usr/local/lib/pd/include
+
+.c.pd_linux:
+ cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
+ ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
+ strip --strip-unneeded $*.pd_linux
+ rm $*.o
+
diff --git a/pan_gogins~.README b/pan_gogins~.README
new file mode 100644
index 0000000..7a059ef
--- /dev/null
+++ b/pan_gogins~.README
@@ -0,0 +1,39 @@
+***********************************************************************
+ File: pan_gogins~.c (a quick hack of pan~.c)
+ Auth: Marco Scoffier [marco@metm.org] modified code by
+ Iain Mott [iain.mott@bigpond.com]
+ Maintainer (of pan~.c) : Iain Mott [iain.mott@bigpond.com]
+ Date: March 2003
+
+ Description: Pd signal external. Stereo panning implementing an
+ algorithm concieved by Michael Gogins and described at
+ http://www.csounds.com/ezine/autumn1999/beginners/
+ Angle input specified in degrees. -45 left, 0 centre, 45 right.
+ See supporting Pd patch: pan_gogins~.pd
+
+ Copyright (C) 2001 by Iain Mott [iain.mott@bigpond.com]
+
+ 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, 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, which should be included with this
+ program, for more details.
+
+***********************************************************************
+I only tested this patch under linux.
+
+INSTALLATION:
+
+ type make pd_linux (or your platform's make target see Makefile)
+
+ cp pan_gogins~.pd_linux to your pd/externs directory,
+ or somewhere in your pd -path
+
+ cp pan_gogins~.pd into your pd/docs/5.reference directory
+
+Enjoy
diff --git a/pan_gogins~.c b/pan_gogins~.c
new file mode 100644
index 0000000..3bef226
--- /dev/null
+++ b/pan_gogins~.c
@@ -0,0 +1,109 @@
+/***************************************************************************
+ * File: pan_gogins~.c (a quick hack of pan~.c)
+ * Auth: Marco Scoffier [marco@metm.org] modified code by
+ * Iain Mott [iain.mott@bigpond.com]
+ * Maintainer (of pan~.c) : Iain Mott [iain.mott@bigpond.com]
+ * Date: March 2003
+ *
+ * Description: Pd signal external. Stereo panning implementing an
+ * algorithm concieved by Michael Gogins and described at
+ * http://www.csounds.com/ezine/autumn1999/beginners/
+ * Angle input specified in degrees. -45 left, 0 centre, 45 right.
+ * See supporting Pd patch: pan_gogins~.pd
+ *
+ * Copyright (C) 2001 by Iain Mott [iain.mott@bigpond.com]
+ *
+ * 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, 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, which should be included with this
+ * program, for more details.
+ *
+ ****************************************************************************/
+
+
+#include "m_pd.h"
+#include <math.h>
+
+static t_class *pan_gogins_class;
+#define RADCONST 0.017453293
+#define ROOT2DIV2 0.707106781
+// PHASECONST = pi - pi/2
+// as per http://www.csounds.com/ezine/autumn1999/beginners/
+#define PHASECONST 1.570796327
+
+typedef struct _pan_gogins
+{
+ t_object x_obj;
+ float x_f;
+ float pan;
+ float left;
+ float right;
+} t_pan_gogins;
+
+static void *pan_gogins_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_pan_gogins *x = (t_pan_gogins *)pd_new(pan_gogins_class);
+ outlet_new(&x->x_obj, gensym("signal"));
+ outlet_new(&x->x_obj, gensym("signal"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("panf"));
+
+ x->x_f = 0;
+ x->left = ROOT2DIV2;
+ x->right = ROOT2DIV2;
+ return (x);
+}
+
+static t_int *pan_gogins_perform(t_int *w)
+{
+ float *in1 = (t_float *)(w[1]);
+ float *out1 = (t_float *)(w[2]);
+ float *out2 = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ t_pan_gogins *x = (t_pan_gogins *)(w[5]);
+ float value;
+ while (n--)
+ {
+ value = *in1++;
+ *out1++ = value * x->left;
+ *out2++ = value * x->right;
+ }
+ return (w+6);
+}
+
+static void pan_gogins_dsp(t_pan_gogins *x, t_signal **sp)
+{
+ int n = sp[0]->s_n;
+ float *in1 = sp[0]->s_vec;
+ float *out1 = sp[1]->s_vec;
+ float *out2 = sp[2]->s_vec;
+
+ dsp_add(pan_gogins_perform, 5,
+ in1, out1, out2, n, x);
+}
+
+void pan_gogins_f(t_pan_gogins *x, t_floatarg f)
+{
+ double angle;
+ f = f < -45 ? -45 : f;
+ f = f > 45 ? 45 : f;
+ angle = f * RADCONST * PHASECONST; // convert degrees to radians
+ x->right = ROOT2DIV2 * (cos(angle) + sin(angle));
+ x->left = ROOT2DIV2 * (cos(angle) - sin(angle));
+/* post("left = %f : right = %f", x->left, x->right); */
+}
+
+void pan_gogins_tilde_setup(void)
+{
+ pan_gogins_class = class_new(gensym("pan_gogins~"), (t_newmethod)pan_gogins_new, 0,
+ sizeof(t_pan_gogins), 0, A_GIMME, 0);
+ class_addmethod(pan_gogins_class, nullfn, gensym("signal"), 0);
+
+ class_addmethod(pan_gogins_class, (t_method)pan_gogins_dsp, gensym("dsp"), 0);
+ class_addmethod(pan_gogins_class, (t_method)pan_gogins_f, gensym("panf"), A_FLOAT, 0);
+}
diff --git a/pan_gogins~.pd b/pan_gogins~.pd
new file mode 100644
index 0000000..281573d
--- /dev/null
+++ b/pan_gogins~.pd
@@ -0,0 +1,95 @@
+#N canvas 229 280 522 407 10;
+#X floatatom 94 35 4 -45 45 0 - - -;
+#X floatatom 112 85 0 0 0 0 - - -;
+#N canvas 184 223 495 266 output 0;
+#X obj 338 160 t b;
+#X obj 338 110 f;
+#X obj 338 60 inlet;
+#X text 344 29 mute;
+#X obj 338 185 f;
+#X msg 425 178 0;
+#X msg 338 85 bang;
+#X obj 338 135 moses 1;
+#X obj 425 153 t b f;
+#X obj 397 117 moses 1;
+#X obj 83 148 dbtorms;
+#X obj 397 92 r master-lvl;
+#X obj 83 42 r master-lvl;
+#X obj 338 210 s master-lvl;
+#X obj -15 176 inlet~;
+#X obj 199 41 inlet;
+#X text 199 18 level;
+#X obj 199 100 s master-lvl;
+#X msg 96 65 set \$1;
+#X obj 96 89 outlet;
+#X msg 214 64 \; pd dsp 1;
+#X obj 83 194 line~;
+#X obj -15 207 *~;
+#X obj -15 236 dac~;
+#X obj 83 171 pack 0 50;
+#X text -17 153 audio;
+#X text 93 110 show level;
+#X obj 31 182 inlet~;
+#X obj 31 218 *~;
+#X connect 0 0 4 0;
+#X connect 1 0 7 0;
+#X connect 2 0 6 0;
+#X connect 4 0 13 0;
+#X connect 5 0 13 0;
+#X connect 6 0 1 0;
+#X connect 7 0 0 0;
+#X connect 7 1 8 0;
+#X connect 8 0 5 0;
+#X connect 9 1 4 1;
+#X connect 10 0 24 0;
+#X connect 11 0 1 1;
+#X connect 11 0 9 0;
+#X connect 12 0 10 0;
+#X connect 12 0 18 0;
+#X connect 14 0 22 0;
+#X connect 15 0 17 0;
+#X connect 15 0 20 0;
+#X connect 18 0 19 0;
+#X connect 21 0 22 1;
+#X connect 21 0 28 1;
+#X connect 22 0 23 0;
+#X connect 24 0 21 0;
+#X connect 27 0 28 0;
+#X connect 28 0 23 1;
+#X restore 74 112 pd output;
+#X msg 132 84 MUTE;
+#X text 166 83 <-- output amplitude;
+#N canvas 5 21 600 400 pulse 0;
+#X obj 175 203 cos~;
+#X obj 175 131 -~ 0.5;
+#X obj 175 179 clip~ -0.5 0.5;
+#X obj 175 227 hip~ 5;
+#X obj 175 155 *~ 82;
+#X obj 175 107 phasor~ 16;
+#X obj 175 251 outlet~;
+#X connect 0 0 3 0;
+#X connect 1 0 4 0;
+#X connect 2 0 0 0;
+#X connect 3 0 6 0;
+#X connect 4 0 2 0;
+#X connect 5 0 1 0;
+#X restore 22 33 pd pulse;
+#X msg 21 177 \; pd dsp 1;
+#X msg 91 177 \; pd dsp 0;
+#X text 43 208 ON;
+#X text 108 208 OFF;
+#X obj 22 152 loadbang;
+#X text 133 36 angle in degrees range -45 to 45;
+#X obj 22 58 pan_gogins~;
+#X text 17 324 pan_gogins~ a modification of pan~ by Ian Mott;
+#X text 16 341 implements an algorithm conceived by Michael Gogins
+and described at: http://www.csounds.com/ezine/autumn1999/beginners/
+;
+#X connect 0 0 12 1;
+#X connect 1 0 2 2;
+#X connect 2 0 1 0;
+#X connect 3 0 2 3;
+#X connect 5 0 12 0;
+#X connect 10 0 6 0;
+#X connect 12 0 2 0;
+#X connect 12 1 2 1;