From c8f3e3674f08bf56407e478c3160c4392196c118 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 30 Jul 2003 21:52:27 +0000 Subject: separated out all objects into individual files; created a few missing help files; moves all help files to new 0.37 help- standard; removed [reson~] and [abs~] since they are now maintained elsewhere; created Makefile for Linux and Darwin svn path=/trunk/externals/markex/; revision=806 --- GEM.LICENSE.TERMS | 204 ++++++++++++++++++++++++++++++++++++ GnuGPL.LICENSE | 290 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 45 ++++++++ README | 33 ++++++ alternate.c | 78 ++++++++++++++ gem_average.c | 83 +++++++++++++++ gem_change.c | 46 +++++++++ gem_counter.c | 228 +++++++++++++++++++++++++++++++++++++++++ help-alternate.pd | 15 +++ help-gem_average.pd | 18 ++++ help-gem_change.pd | 13 +++ help-gem_counter.pd | 33 ++++++ help-invert.pd | 10 ++ help-oneshot.pd | 11 ++ help-randomF.pd | 12 +++ help-strcat.pd | 12 +++ help-tripleLine.pd | 17 +++ help-tripleRand.pd | 19 ++++ invert.c | 41 ++++++++ multiselect.c | 97 ++++++++++++++++++ oneshot.c | 61 +++++++++++ randomF.c | 61 +++++++++++ strcat.c | 64 ++++++++++++ tripleLine.c | 132 ++++++++++++++++++++++++ tripleRand.c | 109 ++++++++++++++++++++ 25 files changed, 1732 insertions(+) create mode 100644 GEM.LICENSE.TERMS create mode 100644 GnuGPL.LICENSE create mode 100644 Makefile create mode 100644 README create mode 100644 alternate.c create mode 100644 gem_average.c create mode 100644 gem_change.c create mode 100644 gem_counter.c create mode 100644 help-alternate.pd create mode 100644 help-gem_average.pd create mode 100644 help-gem_change.pd create mode 100644 help-gem_counter.pd create mode 100644 help-invert.pd create mode 100644 help-oneshot.pd create mode 100644 help-randomF.pd create mode 100644 help-strcat.pd create mode 100644 help-tripleLine.pd create mode 100644 help-tripleRand.pd create mode 100644 invert.c create mode 100644 multiselect.c create mode 100644 oneshot.c create mode 100644 randomF.c create mode 100644 strcat.c create mode 100644 tripleLine.c create mode 100644 tripleRand.c diff --git a/GEM.LICENSE.TERMS b/GEM.LICENSE.TERMS new file mode 100644 index 0000000..878e741 --- /dev/null +++ b/GEM.LICENSE.TERMS @@ -0,0 +1,204 @@ +GEM - Graphics Environment for Multimedia +Copyright (C) 1997-2000 Mark Danks +Copyright (C) Günter Geiger +Copyright (C) 2001-2002 IOhannes m zmölnig + +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. + +In the official GEM distribution, the GNU General Public License is +in the file GnuGPL.LICENSE + +--------------------------------------------------------- + + ACKNOWLEDGMENTS + +--------------------------------------------------------- +Not all of the source code provided here has entirely been written by me. +I would like to point at the great openGL-tutorials at http://nehe.gamedev.net +Since these are tutorials, there is no copyright notice here. +Some of the pix_fx code is borrowed from effecTV by Kentarou Fukuchi et al. +at http://effectv.sourceforge.net released under the Gnu GPL. +Future releases might also incorporate the FreeJ-tool by Jaromil +at http://freej.dyne.org/ released under the Gnu GPL. + + +--------------------------------------------------------- + + OTHER COPYRIGHT NOTICES + +--------------------------------------------------------- + + +This file contains all of the licenses from the various libraries which +are included in GEM. If there is no license associated with a +library, then the author has not included one or not required that the +full license be included. + +All of the files and documentation for the various libraries in the +"Gemlibs" portion of GEM are copyrighted by their respective authors +and not by Mark Danks/Guenter Geiger/IOhannes m zmoelnig. All copyright notices are included in the +respective library directories, GemLibs/*, and this file. +The "GemLibs" portion of GEM consists of + +libTiff: + Author: Sam Leffner + sam@engr.sgi.com + ftp://ftp.sgi.com/graphics/tiff/ + Copyright (c) 1988-1996 Sam Leffler + Copyright (c) 1991-1996 Silicon Graphics, Inc. + see license below + +fstimage: + Masayuki Matsumoto + sgi image loader. + matumot@dst.nk-exa.co.jp + Copyright (C) 1995 Masayuki Mastumoto + Modified so that it doesn't exit on error. + Added support for reading grayscale, rgb, and rgba images + Mark Danks - 1998 + +libjpeg: + Author: Independent JPEG Group + jpeg-info@uunet.uu.net + ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/ + Copyright (C) 1991-1996, Thomas G. Lane. + +Glut: + Author: Mark Kilgard + http://reality.sgi.com/mjk_asd/ + Copyright 1996 by Evans & Sutherland Computer Corporation. + +GLTT: + Author: Stephane Rehel + rehel@worldnet.fr + http://home.worldnet.fr/~rehel/gltt/gltt.html + Copyright (C) 1991 Stephane Rehel + This is covered under the GNU Library General Public License, + Version 2 or greater. + +Freetype: + Authors: David Turner, Robert Wilhelm, and Werner Lemberg + turner@enst.fr + robert@physiol.med.tu-muenchen.de + a7971428@unet.univie.ac.at + http://www.physiol.med.tu-muenchen.de/~robert/freetype.html + Copyright 1996,1997 by David Turner, Robert Wilhelm, and Werner Lemberg + +libmpeg: + Authors: MPEG Software Simulation Group + mssg@mpeg.org + http://www.mpeg.org/MSSG/ + Copyright (c) 1996 MPEG Software Simulation Group + +Wintab: + Author: Rick Poyner, LCS/Telegraphics + wintab@pointing.com + Copyright 1991-1995 by LCS/Telegraphics. + see license below + +libOrb: + Author: John Stone + j.stone@acm.org + http://www.umr.edu/~johns/projects/liborb/ + Copyright (c) 1997-1998 John E. Stone + see license below + +particle: + Author: David McAllister + davemc@cs.unc.edu + http://www.cs.unc.edu/~davemc/Particle/ + Copyright (c) 1998 David K. McAllister + +---------------------------------------------------------------------------- +libTiff: + Author: Sam Leffner + sam@engr.sgi.com + ftp://ftp.sgi.com/graphics/tiff/ + Copyright (c) 1988-1996 Sam Leffler + Copyright (c) 1991-1996 Silicon Graphics, Inc. + +Copyright (c) 1988-1996 Sam Leffler +Copyright (c) 1991-1996 Silicon Graphics, Inc. + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, provided +that (i) the above copyright notices and this permission notice appear in +all copies of the software and related documentation, and (ii) the names of +Sam Leffler and Silicon Graphics may not be used in any advertising or +publicity relating to the software without the specific, prior written +permission of Sam Leffler and Silicon Graphics. + +THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +OF THIS SOFTWARE. + + +---------------------------------------------------------------------------- +Wintab: + Author: Rick Poyner, LCS/Telegraphics + wintab@pointing.com + + The Wintab specification is intended to be an open standard. The + Wintab Programmer's Kit is an aid to understanding the Wintab + standard and implementing Wintab-compliant applications. As such, + the text and information contained herein may be freely used, copied, + or distributed without compensation or licensing restrictions. + + The Wintab Programmer's Kit is copyright 1991-1995 by + LCS/Telegraphics. + + LCS/Telegraphics does not assume any liability for damages resulting + from the use of the information contained herein. + +---------------------------------------------------------------------------- +libOrb: + +/* + * Copyright (c) 1997, 1998 John E. Stone (j.stone@acm.org) + * All rights reserved. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by John E. Stone + * 4. 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/GnuGPL.LICENSE b/GnuGPL.LICENSE new file mode 100644 index 0000000..fa0bef4 --- /dev/null +++ b/GnuGPL.LICENSE @@ -0,0 +1,290 @@ +GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom +to share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This General +Public License applies to most of the Free Software Foundation's +software and to any other program whose authors commit to using it. +(Some other Free Software Foundation software is covered by the +GNU Library General Public License instead.) You can apply it to your +programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new free +programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone +to deny you these rights or to ask you to surrender the rights. These +restrictions translate to certain responsibilities for you if you distribute +copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis +or for a fee, you must give the recipients all the rights that you have. You +must make sure that they, too, receive or can get the source code. And +you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, +we want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software patents. +We wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program +proprietary. To prevent this, we have made it clear that any patent must +be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS FOR +COPYING, DISTRIBUTION AND +MODIFICATION + +0. This License applies to any program or other work which contains a +notice placed by the copyright holder saying it may be distributed under +the terms of this General Public License. The "Program", below, refers +to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, either +verbatim or with modifications and/or translated into another language. +(Hereinafter, translation is included without limitation in the term +"modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of running +the Program is not restricted, and the output from the Program is +covered only if its contents constitute a work based on the Program +(independent of having been made by running the Program). Whether +that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the notices +that refer to this License and to the absence of any warranty; and give +any other recipients of the Program a copy of this License along with the +Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, and +can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based on +the Program, the distribution of the whole must be on the terms of this +License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based +on the Program. + +In addition, mere aggregation of another work not based on the +Program with the Program (or with a work based on the Program) on a +volume of a storage or distribution medium does not bring the other +work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding + machine-readable source code, which must be distributed under + the terms of Sections 1 and 2 above on a medium customarily + used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your cost + of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a + medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with + such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to control +compilation and installation of the executable. However, as a special +exception, the source code distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies the +executable. + +If distribution of executable or object code is made by offering access to +copy from a designated place, then offering equivalent access to copy +the source code from the same place counts as distribution of the source +code, even though third parties are not compelled to copy the source +along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense or distribute the Program is void, and will +automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not +have their licenses terminated so long as such parties remain in full +compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and all +its terms and conditions for copying, distributing or modifying the +Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these terms +and conditions. You may not impose any further restrictions on the +recipients' exercise of the rights granted herein. You are not responsible +for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot distribute +so as to satisfy simultaneously your obligations under this License and +any other pertinent obligations, then as a consequence you may not +distribute the Program at all. For example, if a patent license would not +permit royalty-free redistribution of the Program by all those who +receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system, which is implemented by public license +practices. Many people have made generous contributions to the wide +range of software distributed through that system in reliance on +consistent application of that system; it is up to the author/donor to +decide if he or she is willing to distribute software through any other +system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be +a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original +copyright holder who places the Program under this License may add an +explicit geographical distribution limitation excluding those countries, so +that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new +versions of the General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number +of this License, you may choose any version ever published by the Free +Software Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we +sometimes make exceptions for this. Our decision will be guided by the +two goals of preserving the free status of all derivatives of our free +software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF +CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, +TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT +WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE +PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, +EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD +THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE +COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW +OR AGREED TO IN WRITING WILL ANY COPYRIGHT +HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED +ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING +ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT +LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE +WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR +OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY +OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5039f93 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +CC=gcc + +current: pd_darwin + +# ----------------------- DARWIN ----------------------- + +# replace this line with the one above, since this one has been hacked up +pd_darwin: alternate.pd_darwin gem_average.pd_darwin gem_change.pd_darwin gem_counter.pd_darwin invert.pd_darwin multiselect.pd_darwin oneshot.pd_darwin randomF.pd_darwin strcat.pd_darwin tripleLine.pd_darwin tripleRand.pd_darwin + +.SUFFIXES: .pd_darwin + +DARWINCFLAGS = -DMACOSX -DUNIX -DPD -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch + +DARWININCLUDE = -I/usr/local/lib/pd/include -I../../pd/src -I /usr/local/include + +.c.pd_darwin: + $(CC) $(DARWINCFLAGS) $(DARWININCLUDE) -o $*.o -c $*.c + $(CC) -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o -lc -lm + rm $*.o + + +# ----------------------- LINUX ----------------------- + +pd_linux: alternate.pd_linux gem_average.pd_linux gem_change.pd_linux gem_counter.pd_linux invert.pd_linux multiselect.pd_linux oneshot.pd_linux randomF.pd_linux strcat.pd_linux tripleLine.pd_linux tripleRand.pd_linux + +.SUFFIXES: .pd_linux + +LINUXCFLAGS = -DUNIX -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 -I../../pd/src + +.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 + +# ----------------------- CLEAN ----------------------- + +clean: ; rm -f *.pd_* *.o *~ + diff --git a/README b/README new file mode 100644 index 0000000..f72e23b --- /dev/null +++ b/README @@ -0,0 +1,33 @@ + +------------------------------ + GEM and MARKEX +------------------------------ + +These are objects from GEM which don't have any dependencies besides libc. +What is here is the entire contents of Gem/src/MarkEx except [hsv2rsb] and +the vector lib. Hopefully they will be removed from Gem once they become a +proper part of this repository. + + +------------------------------ + CONFLICTS +------------------------------ + +These objects have name conflicts with other objects/libs therefore: + +Name Conflicts with +----------------------------------- +[average] (maxlib) +[counter] (cxc,cyclone) +[change] (pd) + +Since these names have all been taken, these objects have been renamed by +adding "gem_" before the original name. + + +------------------------------ + OMISSIONS +------------------------------ + +[reson~] has been left out since it is now part of cxc. +[abs~] has been left out since its now part of creb. diff --git a/alternate.c b/alternate.c new file mode 100644 index 0000000..a2d7ed0 --- /dev/null +++ b/alternate.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- alternate ------------------------------ */ + +/* instance structure */ + +static t_class *alternate_class; + +typedef struct _alternate +{ + t_object x_obj; /* obligatory object header */ + int a_which; /* which outlet to go out 0 = left, 1 = right */ + t_outlet *t_out1; /* the outlet */ + t_outlet *t_out2; /* the other outlet */ +} t_alternate; + +static void alternate_list(t_alternate *x, t_symbol *s, int argc, t_atom *argv) +{ + static t_symbol *listSym = NULL; + + if (!listSym) + listSym = gensym("list"); + + if (!x->a_which) outlet_list(x->t_out1, listSym, argc, argv); + else outlet_list(x->t_out2, listSym, argc, argv); + x->a_which++; + x->a_which = (x->a_which > 1) ? 0 : x->a_which; +} + +static void alternate_float(t_alternate *x, t_floatarg n) +{ + if (!x->a_which) outlet_float(x->t_out1, n); + else outlet_float(x->t_out2, n); + x->a_which++; + x->a_which = (x->a_which > 1) ? 0 : x->a_which; +} + +static void alternate_bang(t_alternate *x) +{ + if (!x->a_which) outlet_bang(x->t_out1); + else outlet_bang(x->t_out2); + x->a_which++; + x->a_which = (x->a_which > 1) ? 0 : x->a_which; +} + +static void alternate_reset(t_alternate *x) +{ + x->a_which = 0; +} + +static void *alternate_new(t_symbol *s) /* init vals in struc */ +{ + t_alternate *x = (t_alternate *)pd_new(alternate_class); + x->t_out1 = outlet_new(&x->x_obj, 0); + x->t_out2 = outlet_new(&x->x_obj, 0); + x->a_which = 0; + return (x); +} + +void alternate_setup(void) +{ + alternate_class = class_new(gensym("alternate"), (t_newmethod)alternate_new, 0, + sizeof(t_alternate), 0, A_NULL); + class_addfloat(alternate_class, (t_method)alternate_float); + class_addbang(alternate_class, (t_method)alternate_bang); + class_addmethod(alternate_class, (t_method)alternate_reset, gensym("reset"), A_NULL); + class_addmethod(alternate_class, (t_method)alternate_list, + gensym("list"), A_GIMME, A_NULL); + + class_sethelpsymbol(alternate_class, gensym("help-alternate")); +} + diff --git a/gem_average.c b/gem_average.c new file mode 100644 index 0000000..80edf85 --- /dev/null +++ b/gem_average.c @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- alternate ------------------------------ */ + +/* instance structure */ +static t_class *gem_average_class; + +typedef struct _gem_average +{ + t_object x_obj; /* obligatory object header */ + int a_total; /* number of numbers to gem_average */ + int a_whichNum; /* which number are pointing at */ + float a_numbers[100]; /* numbers to gem_average, 100 maximum */ + t_outlet *t_out1; /* the outlet */ +} t_gem_average; + +void gem_average_bang(t_gem_average *x) +{ + float gem_average = 0.0f; + int n; + + for (n = 0; n < x->a_total; n++) gem_average = gem_average + x->a_numbers[n]; + gem_average = gem_average / (float)x->a_total; + + outlet_float(x->t_out1, gem_average); +} + +void gem_average_float(t_gem_average *x, t_floatarg n) +{ + if (x->a_whichNum >= x->a_total) x->a_whichNum = 0; + x->a_numbers[x->a_whichNum] = n; + x->a_whichNum++; + gem_average_bang(x); +} + +void gem_average_total(t_gem_average *x, t_floatarg n) +{ + x->a_total = (int)n; +} + +void gem_average_reset(t_gem_average *x, t_floatarg newVal) +{ + int n; + for (n=0; n < 100; n ++) x->a_numbers[n] = newVal; +} + +void gem_average_clear(t_gem_average *x) +{ + int n; + for ( n = 0; n < 100; n ++) x->a_numbers[n] = 0.0f; +} + +void *gem_average_new(t_floatarg f) /* init vals in struc */ +{ + t_gem_average *x = (t_gem_average *)pd_new(gem_average_class); + x->t_out1 = outlet_new(&x->x_obj, 0); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1")); + gem_average_clear(x); + if (f) x->a_total = (int)f; + else x->a_total = 10; + x->a_whichNum = 0; + return (x); +} + +void gem_average_setup(void) +{ + gem_average_class = class_new(gensym("gem_average"), (t_newmethod)gem_average_new, 0, + sizeof(t_gem_average), 0, A_DEFFLOAT, 0); + class_addbang(gem_average_class, (t_method)gem_average_bang); + class_addfloat(gem_average_class, (t_method)gem_average_float); + class_addmethod(gem_average_class, (t_method)gem_average_total, gensym("fl1"), A_FLOAT, 0); + class_addmethod(gem_average_class, (t_method)gem_average_clear, gensym("clear"), A_NULL); + class_addmethod(gem_average_class, (t_method)gem_average_reset, gensym("reset"), A_FLOAT, 0); + + class_sethelpsymbol(gem_average_class, gensym("help-gem_average")); +} + diff --git a/gem_change.c b/gem_change.c new file mode 100644 index 0000000..a577868 --- /dev/null +++ b/gem_change.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- gem_change ------------------------------ */ + +/* instance structure */ + +static t_class *gem_change_class; + +typedef struct _gem_change +{ + t_object x_obj; /* obligatory object header */ + float x_cur; + t_outlet *t_out1; /* the outlet */ +} t_gem_change; + +static void gem_change_float(t_gem_change *x, t_floatarg n) +{ + if (n != x->x_cur) + { + outlet_float(x->t_out1, n); + x->x_cur = n; + } +} + +static void *gem_change_new(void) /* init vals in struc */ +{ + t_gem_change *x = (t_gem_change *)pd_new(gem_change_class); + x->x_cur = -1.f; + x->t_out1 = outlet_new(&x->x_obj, 0); + return(x); +} + +void gem_change_setup(void) +{ + gem_change_class = class_new(gensym("gem_change"), (t_newmethod)gem_change_new, 0, + sizeof(t_gem_change), 0, A_NULL); + class_addfloat(gem_change_class, gem_change_float); + + class_sethelpsymbol(gem_change_class, gensym("help-gem_change")); +} diff --git a/gem_counter.c b/gem_counter.c new file mode 100644 index 0000000..da4434f --- /dev/null +++ b/gem_counter.c @@ -0,0 +1,228 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- gem_counter ------------------------------ */ + +/* instance structure */ +static t_class *gem_counter_class; + +typedef struct _gem_counter +{ + t_object x_obj; /* obligatory object header */ + int c_current; /* current number */ + int c_high; /* highest number */ + int c_low; /* lowest number */ + int c_updown; /* 0 = going up, 1 = going down */ + int c_dir; /* gem_counter dir. 1=up, 2=down, 3=up/down */ + t_outlet *t_out1; /* the outlet */ + t_outlet *t_out2; /* the outlet */ +} t_gem_counter; + +void gem_counter_bang(t_gem_counter *x) +{ + int sendBang = 0; + switch(x->c_dir) + { + // count up + case 1: + x->c_current++; + if (x->c_current > x->c_high) + x->c_current = x->c_low; + else if (x->c_current < x->c_low) + x->c_current = x->c_low; + else if (x->c_current == x->c_high) + sendBang = 1; + break; + // count down + case 2: + x->c_current--; + if (x->c_current < x->c_low) + x->c_current = x->c_high; + else if (x->c_current > x->c_high) + x->c_current = x->c_high; + else if (x->c_current == x->c_low) + sendBang = 1; + break; + // count up and down + case 3: + // going up + if (x->c_updown == 0) + { + x->c_current++; + if (x->c_current > x->c_high) + { + x->c_current = x->c_high - 1; + x->c_updown = 1; + } + else if (x->c_current < x->c_low) + x->c_current = x->c_low; + else if (x->c_current == x->c_high) + sendBang = 1; + } + // going down + else if (x->c_updown == 1) + { + x->c_current--; + if (x->c_current < x->c_low) + { + x->c_current = x->c_low + 1; + x->c_updown = 0; + } + else if (x->c_current > x->c_high) + x->c_current = x->c_high; + else if (x->c_current == x->c_low) + sendBang = 1; + } + else + { + error("up/down wrong"); + return; + } + break; + default: + error("dir wrong"); + return; + } + outlet_float(x->t_out1, (float)x->c_current); + if (sendBang) + outlet_bang(x->t_out2); +} + +void gem_counter_dir(t_gem_counter *x, t_floatarg n) +{ + if (n == 1 || n == 2 || n == 3) x->c_dir = (int)n; + else error("bad dir"); +} + +void gem_counter_high(t_gem_counter *x, t_floatarg n) +{ + x->c_high = (int)n; +} + +void gem_counter_low(t_gem_counter *x, t_floatarg n) +{ + x->c_low = (int)n; +} + +void gem_counter_reset(t_gem_counter *x, t_symbol *s, int argc, t_atom *argv) +{ + if (!argc) + { + switch(x->c_dir) + { + case 1: + x->c_current = x->c_low; + break; + case 2: + x->c_current = x->c_high; + break; + case 3: + if (x->c_updown == 0) x->c_current = x->c_low; + else if (x->c_updown == 1) x->c_current = x->c_high; + break; + default: + return; + } + } + else + { + switch(argv[0].a_type) + { + case A_FLOAT : + x->c_current = (int)argv[0].a_w.w_float; + break; + default : + error ("gem_counter: reset not float"); + break; + } + } + outlet_float(x->t_out1, (float)x->c_current); +} + +void gem_counter_clear(t_gem_counter *x, t_symbol *s, int argc, t_atom *argv) +{ + if (!argc) + { + switch(x->c_dir) + { + case 1: + x->c_current = x->c_low - 1; + break; + case 2: + x->c_current = x->c_high + 1; + break; + case 3: + if (x->c_updown == 0) x->c_current = x->c_low - 1; + else if (x->c_updown == 1) x->c_current = x->c_high + 1; + break; + default: + break; + } + } + else + { + switch(argv[0].a_type) + { + case A_FLOAT : + x->c_current = (int)argv[0].a_w.w_float - 1; + break; + default : + error ("gem_counter: reset not float"); + break; + } + } +} + +void *gem_counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in struc */ +{ + t_gem_counter *x = (t_gem_counter *)pd_new(gem_counter_class); + x->t_out1 = outlet_new(&x->x_obj, 0); + x->t_out2 = outlet_new(&x->x_obj, 0); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl3")); + x->c_current = 0; + x->c_updown = 0; + if (h) + { + gem_counter_low(x, f); + gem_counter_high(x, g); + gem_counter_dir(x, h); + } + else if (g) + { + x->c_dir = 1; + gem_counter_low(x, f); + gem_counter_high(x, g); + } + else if (f) + { + x->c_dir = x->c_low = 1; + gem_counter_high(x, f); + } + else + { + x->c_dir = x->c_low = 1; + x->c_high = 10; + } + return (x); +} + +void gem_counter_setup(void) +{ + gem_counter_class = class_new(gensym("gem_counter"), (t_newmethod)gem_counter_new, 0, + sizeof(t_gem_counter), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(gem_counter_class, (t_method)gem_counter_bang); + class_addmethod(gem_counter_class, (t_method)gem_counter_dir, gensym("fl1"), A_FLOAT, 0); + class_addmethod(gem_counter_class, (t_method)gem_counter_low, gensym("fl2"), A_FLOAT, 0); + class_addmethod(gem_counter_class, (t_method)gem_counter_high, gensym("fl3"), A_FLOAT, 0); + class_addmethod(gem_counter_class, (t_method)gem_counter_reset, gensym("reset"), A_GIMME, 0); + class_addmethod(gem_counter_class, (t_method)gem_counter_clear, gensym("clear"), A_GIMME, 0); + + class_sethelpsymbol(gem_counter_class, gensym("help-gem_counter")); +} diff --git a/help-alternate.pd b/help-alternate.pd new file mode 100644 index 0000000..e79f2f8 --- /dev/null +++ b/help-alternate.pd @@ -0,0 +1,15 @@ +#N canvas 296 299 600 500 10; +#X text 124 68 GEM object; +#X msg 170 156 1; +#X obj 123 298 print out1; +#X obj 123 219 alternate; +#X msg 123 155 bang; +#X msg 219 155 reset; +#X obj 190 263 print out2; +#X text 91 390 [alternate] between two outputs; +#X text 138 23 [alternate]; +#X connect 1 0 3 0; +#X connect 3 0 2 0; +#X connect 3 1 6 0; +#X connect 4 0 3 0; +#X connect 5 0 3 0; diff --git a/help-gem_average.pd b/help-gem_average.pd new file mode 100644 index 0000000..fb923f3 --- /dev/null +++ b/help-gem_average.pd @@ -0,0 +1,18 @@ +#N canvas 271 381 600 500 10; +#X text 124 68 GEM object; +#X obj 123 298 print out1; +#X obj 123 220 average; +#X floatatom 123 160 0 0 0; +#X msg 184 162 bang; +#X msg 247 164 reset 5; +#X msg 345 168 clear; +#X text 89 408 The initial argument is the number to average together. +The default is 10 numbers.; +#X obj 421 231 average 20; +#X text 139 23 [average]; +#X text 81 371 [average] together a series of numbers.; +#X connect 2 0 1 0; +#X connect 3 0 2 0; +#X connect 4 0 2 0; +#X connect 5 0 2 0; +#X connect 6 0 2 0; diff --git a/help-gem_change.pd b/help-gem_change.pd new file mode 100644 index 0000000..c02ddd1 --- /dev/null +++ b/help-gem_change.pd @@ -0,0 +1,13 @@ +#N canvas 356 327 600 500 10; +#X text 124 68 GEM object; +#X obj 123 298 print out1; +#X obj 123 219 change; +#X msg 123 156 0; +#X msg 166 154 1; +#X text 138 23 [change]; +#X text 58 360 [change] only outputs when the inlet receives a value +that is different than the previous value.; +#X text 57 404 [change] is very nice for the == and > objects.; +#X connect 2 0 1 0; +#X connect 3 0 2 0; +#X connect 4 0 2 0; diff --git a/help-gem_counter.pd b/help-gem_counter.pd new file mode 100644 index 0000000..84f276e --- /dev/null +++ b/help-gem_counter.pd @@ -0,0 +1,33 @@ +#N canvas 597 145 600 590 10; +#X text 124 68 GEM object; +#X obj 123 298 print out1; +#X text 138 23 counter; +#X msg 123 97 bang; +#X text 58 362 counter counts the number of bangs; +#X obj 123 220 counter 0 5; +#X msg 319 154 bang; +#X text 58 394 The third argument is the direction 1 == up 2 == down 3 == up and down; +#X obj 319 297 print out2; +#X obj 319 219 counter 0 5 3; +#X obj 195 265 print done1; +#X obj 405 267 print done2; +#X text 58 439 The right outlet sends a bang when the counter rolls over. The bang occurs after the left inlet sends the value.; +#X msg 147 129 direction; +#X msg 171 154 low value; +#X msg 195 182 high value; +#X msg 71 176 reset; +#X msg 26 177 clear; +#X text 58 524 A reset message will set the counter back to the starting value and send the value out the left outlet.; +#X text 58 486 A clear message will set the counter back to the starting value.; +#X text 331 189 count from 0 to 5 and back down to 0; +#X connect 3 0 5 0; +#X connect 5 0 1 0; +#X connect 5 1 10 0; +#X connect 6 0 9 0; +#X connect 9 0 8 0; +#X connect 9 1 11 0; +#X connect 13 0 5 1; +#X connect 14 0 5 2; +#X connect 15 0 5 3; +#X connect 16 0 5 0; +#X connect 17 0 5 0; diff --git a/help-invert.pd b/help-invert.pd new file mode 100644 index 0000000..22af453 --- /dev/null +++ b/help-invert.pd @@ -0,0 +1,10 @@ +#N canvas 151 485 600 500 10; +#X text 124 68 GEM object; +#X msg 170 156 1; +#X obj 123 298 print out1; +#X obj 123 219 invert; +#X msg 123 155 0; +#X text 139 22 invert; +#X connect 1 0 3 0; +#X connect 3 0 2 0; +#X connect 4 0 3 0; diff --git a/help-oneshot.pd b/help-oneshot.pd new file mode 100644 index 0000000..f976360 --- /dev/null +++ b/help-oneshot.pd @@ -0,0 +1,11 @@ +#N canvas 151 485 600 500 10; +#X text 124 68 GEM object; +#X obj 123 298 print out1; +#X msg 123 155 bang; +#X text 138 23 oneshot; +#X obj 123 219 oneshot; +#X msg 188 154 clear; +#X text 61 385 oneshot blocks after the initial bang \, until a clear message is received.; +#X connect 2 0 4 0; +#X connect 4 0 1 0; +#X connect 5 0 4 0; diff --git a/help-randomF.pd b/help-randomF.pd new file mode 100644 index 0000000..148e7d6 --- /dev/null +++ b/help-randomF.pd @@ -0,0 +1,12 @@ +#N canvas 749 231 604 504 10; +#X text 124 68 GEM object; +#X msg 123 155 bang; +#X text 138 23 randomF; +#X obj 123 223 randomF 0.5; +#X text 60 385 randomF is a floating point random number generator +; +#X floatatom 195 161 5 0 0 1 range - -; +#X floatatom 123 289 5 0 0 0 - - -; +#X connect 1 0 3 0; +#X connect 3 0 6 0; +#X connect 5 0 3 1; diff --git a/help-strcat.pd b/help-strcat.pd new file mode 100644 index 0000000..55f2211 --- /dev/null +++ b/help-strcat.pd @@ -0,0 +1,12 @@ +#N canvas 330 185 454 304 10; +#X obj 181 131 strcat foo; +#X msg 147 58 symbol bar; +#X symbolatom 181 182 0 0 0 0 - - -; +#X text 16 255 [strcat] prepends its text to any symbol that is sent +to it.; +#X msg 173 79 symbol kneipe; +#X msg 195 101 symbol d; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; diff --git a/help-tripleLine.pd b/help-tripleLine.pd new file mode 100644 index 0000000..ed23fe5 --- /dev/null +++ b/help-tripleLine.pd @@ -0,0 +1,17 @@ +#N canvas 749 231 600 500 10; +#X text 124 68 GEM object; +#X text 138 24 tripleLine; +#X obj 123 223 tripleLine; +#X obj 123 273 unpack 0 0 0; +#X floatatom 123 319; +#X floatatom 168 348; +#X floatatom 214 319; +#X msg 123 157 1 0 0 2000; +#X msg 234 158 0 1 0.1 2000; +#X text 46 406 tripleLine is like the line object except that it works with 3 values at once.; +#X connect 2 0 3 0; +#X connect 3 0 4 0; +#X connect 3 1 5 0; +#X connect 3 2 6 0; +#X connect 7 0 2 0; +#X connect 8 0 2 0; diff --git a/help-tripleRand.pd b/help-tripleRand.pd new file mode 100644 index 0000000..4e6714f --- /dev/null +++ b/help-tripleRand.pd @@ -0,0 +1,19 @@ +#N canvas 132 108 604 504 10; +#X text 124 68 GEM object; +#X obj 136 234 unpack 0 0 0; +#X floatatom 136 280 4 0 0 0 - - -; +#X floatatom 175 280 4 0 0 0 - - -; +#X floatatom 215 280 4 0 0 0 - - -; +#X text 138 24 tripleRine; +#X text 84 395 [tripleRand] generates three distinct random numbers +at once within the range specified.; +#X obj 136 184 tripleRand 5; +#X floatatom 215 146 5 0 0 0 - - -; +#X obj 136 134 bng 15 250 50 0 empty empty empty 0 -6 32 8 -262144 +-1 -1; +#X connect 1 0 2 0; +#X connect 1 1 3 0; +#X connect 1 2 4 0; +#X connect 7 0 1 0; +#X connect 8 0 7 1; +#X connect 9 0 7 0; diff --git a/invert.c b/invert.c new file mode 100644 index 0000000..0b15ec3 --- /dev/null +++ b/invert.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- invert ------------------------------ */ + +/* instance structure */ + +static t_class *invert_class; + +typedef struct _invert +{ + t_object x_obj; /* obligatory object header */ + t_outlet *t_out1; /* the outlet */ +} t_invert; + +static void invert_float(t_invert *x, t_floatarg n) +{ + if (n) outlet_float(x->t_out1, 0.f); + else outlet_float(x->t_out1, 1.f); +} + +static void *invert_new(t_symbol *s) /* init vals in struc */ +{ + t_invert *x = (t_invert *)pd_new(invert_class); + x->t_out1 = outlet_new(&x->x_obj, 0); + return(x); +} + +void invert_setup(void) +{ + invert_class = class_new(gensym("invert"), (t_newmethod)invert_new, 0, + sizeof(t_invert), 0, A_NULL); + class_addfloat(invert_class, (t_method)invert_float); + + class_sethelpsymbol(invert_class, gensym("help-invert")); +} diff --git a/multiselect.c b/multiselect.c new file mode 100644 index 0000000..fcba331 --- /dev/null +++ b/multiselect.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- multiselect ------------------------------ */ + +static t_class *multiselect_class; + +typedef struct _multiselectElem +{ + t_float val; + t_outlet *acceptOutlet; + t_int active; +} t_multiselectElem; + +typedef struct _multiselect +{ + t_object x_obj; + t_multiselectElem *x_elem; + int x_num; + t_outlet *x_rejectOutlet; + t_inlet *x_inlet; +} t_multiselect; + +static void multiselect_float(t_multiselect *x, t_floatarg f) +{ + int i; + int shotOut = 0; + for (i = 0; i < x->x_num; i++) + { + if (x->x_elem[i].val == f && x->x_elem[i].active) + { + outlet_bang(x->x_elem[i].acceptOutlet); + shotOut = 1; + } + } + if (!shotOut) + outlet_float(x->x_rejectOutlet, f); +} + +static void multiselect_params(t_multiselect *x, t_symbol *s, int argc, t_atom *argv) +{ + int n; + freebytes(x->x_elem, x->x_num * sizeof(t_multiselectElem)); + for (n = 0; n < argc; n++) + { + x->x_elem[n].val = atom_getfloatarg(n, argc, argv); + x->x_elem[n].active = 1; + } + for (; n < x->x_num; n++) + x->x_elem[n].active = 0; +} + +static void multiselect_free(t_multiselect *x) +{ + int i; + for (i = 0; i < x->x_num; i++) + { + outlet_free(x->x_elem[i].acceptOutlet); + } + freebytes(x->x_elem, x->x_num * sizeof(t_multiselectElem)); + inlet_free(x->x_inlet); +} + +static void *multiselect_new(t_symbol *s, int argc, t_atom *argv) +{ + int n; + t_multiselect *x = (t_multiselect *)pd_new(multiselect_class); + x->x_num = argc; + x->x_elem = (t_multiselectElem *)getbytes(argc * sizeof(t_multiselectElem)); + for (n = 0; n < argc; n++) + { + x->x_elem[n].val = atom_getfloatarg(n, argc, argv); + x->x_elem[n].acceptOutlet = outlet_new(&x->x_obj, &s_bang); + x->x_elem[n].active = 1; + } + x->x_rejectOutlet = outlet_new(&x->x_obj, &s_float); + x->x_inlet = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_list, gensym("params")); + return (x); +} + +void multiselect_setup(void) +{ + multiselect_class = class_new(gensym("multiselect"), (t_newmethod)multiselect_new, + (t_method)multiselect_free, sizeof(t_multiselect), 0, A_GIMME, 0); + class_addcreator((t_newmethod)multiselect_new, gensym("multisel"), A_GIMME, 0); + + class_addfloat(multiselect_class, multiselect_float); + class_addmethod(multiselect_class, (t_method)multiselect_params, + gensym("params"), A_GIMME, A_NULL); + + class_sethelpsymbol(multiselect_class, gensym("help-multiselect")); +} diff --git a/oneshot.c b/oneshot.c new file mode 100644 index 0000000..ba2e0a0 --- /dev/null +++ b/oneshot.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- oneshot ------------------------------ */ + +/* instance structure */ +static t_class *oneshot_class; + +typedef struct _oneshot +{ + t_object x_obj; /* obligatory object header */ + int t_armed; /* if willing to pass data */ + t_outlet *t_out1; /* the outlet */ +} t_oneshot; + +static void oneshot_float(t_oneshot *x, t_floatarg n) +{ + if (x->t_armed) + { + outlet_float(x->t_out1, n); + x->t_armed = 0; + } +} + +static void oneshot_bang(t_oneshot *x) +{ + if (x->t_armed) + { + outlet_bang(x->t_out1); + x->t_armed = 0; + } +} + +static void oneshot_clear(t_oneshot *x) +{ + x->t_armed = 1; +} + +static void *oneshot_new(t_symbol *s) /* init vals in struc */ +{ + t_oneshot *x = (t_oneshot *)pd_new(oneshot_class); + x->t_out1 = outlet_new(&x->x_obj, 0); + x->t_armed = 1; + return (x); +} + +void oneshot_setup(void) +{ + oneshot_class = class_new(gensym("oneshot"), (t_newmethod)oneshot_new, 0, + sizeof(t_oneshot), 0, A_NULL); + class_addfloat(oneshot_class, (t_method)oneshot_float); + class_addbang(oneshot_class, (t_method)oneshot_bang); + class_addmethod(oneshot_class, (t_method)oneshot_clear, gensym("clear"), A_NULL); + class_sethelpsymbol(oneshot_class, gensym("help-oneshot")); +} + diff --git a/randomF.c b/randomF.c new file mode 100644 index 0000000..d7e4046 --- /dev/null +++ b/randomF.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" +#include + +#ifndef MACOSX +#include +#endif + +#ifdef NT +int random(void) +{ + static int foo = 1489853723; + foo = foo * (int)435898247 + (int)9382842987; + return (foo & 0x7fffffff); +} +#endif + +/* -------------------------- randomF ------------------------------ */ + +/* instance structure */ + +static t_class *randomF_class; + +typedef struct _randomF +{ + t_object x_obj; + t_float x_range; + t_outlet *t_out1; /* the outlet */ +} t_randomF; + +static void *randomF_new(t_floatarg n) +{ + t_randomF *x = (t_randomF *)pd_new(randomF_class); + x->x_range = (float)n; + floatinlet_new(&x->x_obj, &x->x_range); + x->t_out1 = outlet_new(&x->x_obj, 0); + return (x); +} + +static void randomF_bang(t_randomF *x) +{ + double range = (x->x_range < 0 ? 0 : x->x_range); + double n = (double)range * (double)random() * (1. / 2147483648.); + if (n >= range) n = range - 1; + outlet_float(x->t_out1, (float)n); +} + +void randomF_setup(void) +{ + randomF_class = class_new(gensym("randomF"), (t_newmethod)randomF_new, 0, + sizeof(t_randomF), 0, A_DEFFLOAT, 0); + + class_addbang(randomF_class, (t_method)randomF_bang); + + class_sethelpsymbol(randomF_class, gensym("help-randomF")); +} diff --git a/strcat.c b/strcat.c new file mode 100644 index 0000000..4c23144 --- /dev/null +++ b/strcat.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" +#include + +/* -------------------------- strcat ------------------------------ */ + +/* instance structure */ + +static t_class *strcat_class; + +typedef struct _strcat +{ + t_object x_obj; /* obligatory object header */ + t_symbol *a_text; /* the first part of the text */ + t_symbol *a_symbol; /* the last symbol sent out */ + t_outlet *t_out1; /* the outlet */ +} t_strcat; + +void strcat_sym(t_strcat *x, t_symbol *sym) +{ + char temp[64]; + sprintf(temp, "%s%s", x->a_text->s_name, sym->s_name); + x->a_symbol = gensym(temp); + outlet_symbol(x->t_out1, x->a_symbol); +} + +void strcat_float(t_strcat *x, t_floatarg n) +{ + char temp[64]; + sprintf(temp, "%s%f", x->a_text->s_name, n); + x->a_symbol = gensym(temp); + outlet_symbol(x->t_out1, x->a_symbol); +} + +void strcat_bang(t_strcat *x) +{ + outlet_symbol(x->t_out1, x->a_symbol); +} + +void *strcat_new(t_symbol *textname) /* init vals in struc */ +{ + t_strcat *x = (t_strcat *)pd_new(strcat_class); + x->t_out1 = outlet_new(&x->x_obj, 0); + x->a_text = textname; + x->a_symbol = textname; + return (x); +} + +void strcat_setup(void) +{ + strcat_class = class_new(gensym("strcat"), (t_newmethod)strcat_new, 0, + sizeof(t_strcat), 0, A_SYMBOL, 0); + class_addsymbol(strcat_class, (t_method)strcat_sym); + class_addfloat(strcat_class, (t_method)strcat_float); + class_addbang(strcat_class, (t_method)strcat_bang); + + class_sethelpsymbol(strcat_class, gensym("help-strcat")); +} + diff --git a/tripleLine.c b/tripleLine.c new file mode 100644 index 0000000..bc8530d --- /dev/null +++ b/tripleLine.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" + +/* -------------------------- tripleLine ------------------------------ */ + +/* instance structure */ + +static t_class *tripleLine_class; + +typedef struct _tripleLine +{ + t_object x_obj; /* obligatory object header */ + t_clock *clock; + float grain; + float destTime; + float curTime; + float curVal[3]; + float destVal[3]; + float stepVal[3]; + t_outlet *t_out1; /* the outlet */ +} t_tripleLine; + +static void tripleTick(t_tripleLine *x) +{ + t_atom argv[3]; + int i; + x->curTime += x->grain; + if (x->curTime >= x->destTime) + { + for (i = 0; i < 3; i++) + { + x->curVal[i] = x->destVal[i]; + SETFLOAT((&argv[i]), x->curVal[i]); + } + } + else + { + for (i = 0; i < 3; i++) + { + x->curVal[i] += x->stepVal[i]; + SETFLOAT((&argv[i]), x->curVal[i]); + } + clock_delay(x->clock, x->grain); + } + + outlet_list(x->t_out1, &s_list, 3, argv); +} + +static void setLineParameters(t_tripleLine *x, t_symbol *s, int argc, t_atom *argv) +{ + float numCounts; + int i; + t_atom newargv[3]; + float time = x->destTime; + + clock_unset(x->clock); + + if (argc == 4) time = atom_getfloat(&argv[3]); + else if (argc != 3) + { + error("tripleLine: requires 3 or 4 args"); + return; + } + + x->destTime = time; + numCounts = time / x->grain; + if (x->destTime <= 0.) + { + x->curTime = 0; + for (i = 0; i < 3; i++) + { + x->curVal[i] = x->destVal[i] = atom_getfloat(&argv[i]); + SETFLOAT((&newargv[i]), x->curVal[i]); + } + outlet_list(x->t_out1, &s_list, 3, newargv); + return; + } + else + { + for (i = 0; i < 3; i++) + { + x->destVal[i] = atom_getfloat(&argv[i]); + x->stepVal[i] = (x->destVal[i] - x->curVal[i]) / numCounts; + SETFLOAT((&newargv[i]), x->curVal[i]); + } + } + x->curTime = 0; + + clock_delay(x->clock, x->grain); + outlet_list(x->t_out1, &s_list, 3, newargv); +} + +static void tripleLine_free(t_tripleLine *x) +{ + clock_free(x->clock); +} + +static void *tripleLine_new(t_floatarg time, t_floatarg grain) /* init vals in struc */ +{ + int i; + t_tripleLine *x = (t_tripleLine *)pd_new(tripleLine_class); + x->curTime = 0; + x->destTime = time; + x->clock = clock_new(x, (t_method)tripleTick); + for (i = 0; i < 3; i++) + { + x->curVal[i] = x->destVal[i] = x->stepVal[i] = 0.; + } + if (grain <= 0) grain = 50; + x->grain = (float)grain; + + x->t_out1 = outlet_new(&x->x_obj, 0); + return(x); +} + +void tripleLine_setup(void) +{ + tripleLine_class = class_new(gensym("tripleLine"), (t_newmethod)tripleLine_new, + (t_method)tripleLine_free, sizeof(t_tripleLine), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + + class_addmethod(tripleLine_class, (t_method)setLineParameters, + &s_list, A_GIMME, A_NULL); + + class_sethelpsymbol(tripleLine_class, gensym("help-tripleLine")); +} + + diff --git a/tripleRand.c b/tripleRand.c new file mode 100644 index 0000000..136dd61 --- /dev/null +++ b/tripleRand.c @@ -0,0 +1,109 @@ +/* + * Copyright (c) 1997-1999 Mark Danks. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. + */ + +#include "m_pd.h" +#include + +#ifndef MACOSX +#include +#endif + +#ifdef NT +int random(void) +{ + static int foo = 1489853723; + foo = foo * (int)435898247 + (int)9382842987; + return (foo & 0x7fffffff); +} +#endif + +/* -------------------------- tripleRand ------------------------------ */ + +/* instance structure */ + +static t_class *tripleRand_class; + +typedef struct _tripleRand +{ + t_object x_obj; + t_float x_range[3]; + t_outlet *t_out1; /* the outlet */ +} t_tripleRand; + +void setTripleRandVals(t_tripleRand *x, t_symbol *s, int argc, t_atom *argv) +{ + if (argc < 1 || argc > 3) + { + error("tripleRand: Requires 1 - 3 values"); + return; + } + if (argc >= 1) + { + x->x_range[0] = atom_getfloat(&argv[0]); + if (x->x_range[0] < 0) x->x_range[0] = 0; + x->x_range[2] = x->x_range[1] = x->x_range[0]; + } + if (argc >= 2) + { + x->x_range[1] = atom_getfloat(&argv[1]); + if (x->x_range[1] < 0) x->x_range[1] = 0; + x->x_range[2] = x->x_range[1]; + } + if (argc >= 3) + { + x->x_range[2] = atom_getfloat(&argv[2]); + if (x->x_range[2] < 0) x->x_range[2] = 0; + } +} + +static void tripleRand_bang(t_tripleRand *x) +{ + int i; + t_atom argv[3]; + + for (i = 0; i < 3; i++) + { + float n = (float)((double)x->x_range[i] * (double)random() * (1. / 2147483648.)); + if (n > x->x_range[i]) n = x->x_range[i] - 1; + SETFLOAT((&argv[i]), (float)n); + } + + outlet_list(x->t_out1, &s_list, 3, argv); +} + +static void *tripleRand_new(t_floatarg arg1, t_floatarg arg2, t_floatarg arg3) +{ + t_tripleRand *x = (t_tripleRand *)pd_new(tripleRand_class); + if (arg1 < 0.f) + x->x_range[0] = 0.f; + else + x->x_range[0] = (float)arg1; + if (arg2 <= 0.f) + x->x_range[1] = x->x_range[0]; + else + x->x_range[1] = (float)arg2; + if (arg3 <= 0.f) + x->x_range[2] = x->x_range[1]; + else + x->x_range[2] = (float)arg3; + x->t_out1 = outlet_new(&x->x_obj, 0); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_list, gensym("newVals")); + return (x); +} + +void tripleRand_setup(void) +{ + tripleRand_class = class_new(gensym("tripleRand"), (t_newmethod)tripleRand_new, 0, + sizeof(t_tripleRand), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(tripleRand_class, (t_method)tripleRand_bang); + class_addmethod(tripleRand_class, (t_method)setTripleRandVals, + gensym("newVals"), A_GIMME, A_NULL); + + class_sethelpsymbol(tripleRand_class, gensym("help-tripleRand")); +} + + -- cgit v1.2.1