aboutsummaryrefslogtreecommitdiff
path: root/xvalue
diff options
context:
space:
mode:
Diffstat (limited to 'xvalue')
-rw-r--r--xvalue/LICENSE.txt30
-rw-r--r--xvalue/makefile94
-rw-r--r--xvalue/test.pd14
-rw-r--r--xvalue/xvalue.c77
4 files changed, 215 insertions, 0 deletions
diff --git a/xvalue/LICENSE.txt b/xvalue/LICENSE.txt
new file mode 100644
index 0000000..a56a51e
--- /dev/null
+++ b/xvalue/LICENSE.txt
@@ -0,0 +1,30 @@
+This software is copyrighted by Miller Puckette and others. The following
+terms (the "Standard Improved BSD License") apply to all files associated with
+the software unless explicitly disclaimed in individual files:
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+3. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/xvalue/makefile b/xvalue/makefile
new file mode 100644
index 0000000..2ce2bf2
--- /dev/null
+++ b/xvalue/makefile
@@ -0,0 +1,94 @@
+NAME=xvalue
+CSYM=xvalue
+
+current: pd_linux
+
+# ----------------------- NT -----------------------
+
+pd_nt: $(NAME).dll
+
+.SUFFIXES: .dll
+
+PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
+VC="C:\Program Files\Microsoft Visual Studio\Vc98"
+
+PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include
+
+PDNTLDIR = $(VC)\lib
+PDNTLIB = $(PDNTLDIR)\libc.lib \
+ $(PDNTLDIR)\oldnames.lib \
+ $(PDNTLDIR)\kernel32.lib \
+ ..\..\bin\pd.lib
+
+.c.dll:
+ cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
+ link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB)
+
+# ----------------------- IRIX 5.x -----------------------
+
+pd_irix5: $(NAME).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: $(NAME).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 -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
+ rm $*.o
+
+# ----------------------- LINUX i386 -----------------------
+
+pd_linux: $(NAME).pd_linux
+
+.SUFFIXES: .pd_linux
+
+LINUXCFLAGS = -DPD -O2 -fPIC -funroll-loops -fomit-frame-pointer \
+ -Wall -W -Wshadow -Wstrict-prototypes -Werror \
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+LINUXINCLUDE = -I../../src
+
+LSTRIP = strip --strip-unneeded -R .note -R .comment
+
+.c.pd_linux:
+ cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
+ cc -Wl,--export-dynamic --shared -o $*.pd_linux $*.o -lm
+ $(LSTRIP) $*.pd_linux
+ rm -f $*.o
+
+# ----------------------- Mac OSX -----------------------
+
+pd_darwin: $(NAME).pd_darwin
+
+.SUFFIXES: .pd_darwin
+
+DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+.c.pd_darwin:
+ $(CC) $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
+ $(CC) -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
+ rm -f $*.o
+
+# ----------------------------------------------------------
+
+clean:
+ rm -f *.o *.pd_* so_locations
diff --git a/xvalue/test.pd b/xvalue/test.pd
new file mode 100644
index 0000000..6b7e3c0
--- /dev/null
+++ b/xvalue/test.pd
@@ -0,0 +1,14 @@
+#N canvas 0 0 450 300 10;
+#X obj 39 133 xvalue test1;
+#X obj 220 139 value test;
+#X floatatom 254 115 5 0 0 0 - - -;
+#X floatatom 32 192 5 0 0 0 - - -;
+#X obj 34 72 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 68 63 5 0 0 0 - - -;
+#X msg 94 96 set test;
+#X connect 0 0 3 0;
+#X connect 2 0 1 0;
+#X connect 4 0 0 0;
+#X connect 5 0 0 0;
+#X connect 6 0 0 0;
diff --git a/xvalue/xvalue.c b/xvalue/xvalue.c
new file mode 100644
index 0000000..4f16f06
--- /dev/null
+++ b/xvalue/xvalue.c
@@ -0,0 +1,77 @@
+/* extended (settable) value object
+ Copyright (c) 2004 Tim Blechmann
+ a huge part of the code is broken out of the code of the value object.
+
+ * Copyright (c) 1997-1999 Miller Puckette.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+#include "m_pd.h"
+
+
+/* -------------------- xvalue ----------------------------- */
+
+static t_class *xvalue_class;
+
+static t_class *vcommon_class;
+
+typedef struct vcommon
+{
+ t_pd c_pd;
+ int c_refcount;
+ t_float c_f;
+} t_vcommon;
+
+
+typedef struct _xvalue
+{
+ t_object x_obj;
+ t_symbol *x_sym;
+ t_float *x_floatstar;
+} t_xvalue;
+
+static void *xvalue_new(t_symbol *s)
+{
+ t_xvalue *x = (t_xvalue *)pd_new(xvalue_class);
+ x->x_sym = s;
+ x->x_floatstar = value_get(s);
+ outlet_new(&x->x_obj, &s_float);
+ return (x);
+}
+
+static void xvalue_bang(t_xvalue *x)
+{
+ outlet_float(x->x_obj.ob_outlet, *x->x_floatstar);
+}
+
+static void xvalue_float(t_xvalue *x, t_float f)
+{
+ *x->x_floatstar = f;
+}
+
+static void xvalue_ff(t_xvalue *x)
+{
+ value_release(x->x_sym);
+}
+
+static void xvalue_set(t_xvalue *x, t_symbol *s)
+{
+ x->x_sym = s;
+ x->x_floatstar = value_get(s);
+}
+
+void xvalue_setup(void)
+{
+ xvalue_class = class_new(gensym("xvalue"), (t_newmethod)xvalue_new,
+ (t_method)xvalue_ff,
+ sizeof(t_xvalue), 0, A_DEFSYM, 0);
+ class_addcreator((t_newmethod)xvalue_new, gensym("xv"), A_DEFSYM, 0);
+ class_addbang(xvalue_class, xvalue_bang);
+ class_addfloat(xvalue_class, xvalue_float);
+ class_addmethod(xvalue_class, (t_method) xvalue_set, gensym("set"),
+ A_SYMBOL, 0);
+ vcommon_class = class_new(gensym("xvalue"), 0, 0,
+ sizeof(t_vcommon), CLASS_PD, 0);
+}
+
+