From 2453c05054b69951b301527f1f7b132cff143359 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 14 May 2010 02:48:03 +0000 Subject: first steps towards porting to template Makefile and debianizing, split up randomix.c into separete files for each objectclass, much left to do svn path=/trunk/externals/cxc/; revision=13540 --- ENV-help.pd | 34 + LICENSE.txt | 340 ++++++++ Makefile | 283 +++++++ README | 92 -- README.txt | 92 ++ VERSION | 1 - ascseq-help.pd | 12 + ascwave-help.pd | 65 ++ bfilt-help.pd | 23 + bfilt2-help.pd | 23 + configure | 1961 ------------------------------------------- configure.in | 84 -- cx.c | 112 --- cx.h | 6 - cxc-meta.pd | 9 + cxc.c | 112 +++ cxc.h | 6 + delta~-help.pd | 63 ++ dist_normal-help.pd | 223 +++++ dist_normal.c | 174 ++++ gpl.txt | 340 -------- install-sh | 251 ------ makefile.in | 62 -- proc-help.pd | 75 ++ random1-help.pd | 223 +++++ random1.c | 137 +++ random1~-help.pd | 223 +++++ random1~.c | 115 +++ random_fl-help.pd | 223 +++++ random_fl.c | 129 +++ random_fl~-help.pd | 223 +++++ random_fl~.c | 100 +++ random_icg-help.pd | 223 +++++ random_icg.c | 173 ++++ random_icg~-help.pd | 223 +++++ random_icg~.c | 164 ++++ random_tw-help.pd | 223 +++++ random_tw.c | 181 ++++ randomix.c | 874 ------------------- reference/ENV-help.pd | 34 - reference/ascseq-help.pd | 12 - reference/ascwave-help.pd | 65 -- reference/bfilt-help.pd | 23 - reference/bfilt2-help.pd | 23 - reference/delta~-help.pd | 63 -- reference/proc-help.pd | 75 -- reference/randomix-help.pd | 223 ----- reference/reson~-help.pd | 3 - reference/serialize-help.pd | 10 - reference/utime-help.pd | 9 - reson~-help.pd | 3 + serialize-help.pd | 10 + utime-help.pd | 9 + 53 files changed, 4116 insertions(+), 4323 deletions(-) create mode 100644 ENV-help.pd create mode 100644 LICENSE.txt create mode 100644 Makefile delete mode 100644 README create mode 100644 README.txt delete mode 100644 VERSION create mode 100644 ascseq-help.pd create mode 100644 ascwave-help.pd create mode 100644 bfilt-help.pd create mode 100644 bfilt2-help.pd delete mode 100755 configure delete mode 100644 configure.in delete mode 100644 cx.c delete mode 100644 cx.h create mode 100644 cxc-meta.pd create mode 100644 cxc.c create mode 100644 cxc.h create mode 100644 delta~-help.pd create mode 100644 dist_normal-help.pd create mode 100644 dist_normal.c delete mode 100644 gpl.txt delete mode 100644 install-sh delete mode 100644 makefile.in create mode 100644 proc-help.pd create mode 100644 random1-help.pd create mode 100644 random1.c create mode 100644 random1~-help.pd create mode 100644 random1~.c create mode 100644 random_fl-help.pd create mode 100644 random_fl.c create mode 100644 random_fl~-help.pd create mode 100644 random_fl~.c create mode 100644 random_icg-help.pd create mode 100644 random_icg.c create mode 100644 random_icg~-help.pd create mode 100644 random_icg~.c create mode 100644 random_tw-help.pd create mode 100644 random_tw.c delete mode 100644 randomix.c delete mode 100644 reference/ENV-help.pd delete mode 100644 reference/ascseq-help.pd delete mode 100644 reference/ascwave-help.pd delete mode 100644 reference/bfilt-help.pd delete mode 100644 reference/bfilt2-help.pd delete mode 100644 reference/delta~-help.pd delete mode 100644 reference/proc-help.pd delete mode 100644 reference/randomix-help.pd delete mode 100644 reference/reson~-help.pd delete mode 100644 reference/serialize-help.pd delete mode 100644 reference/utime-help.pd create mode 100644 reson~-help.pd create mode 100644 serialize-help.pd create mode 100644 utime-help.pd diff --git a/ENV-help.pd b/ENV-help.pd new file mode 100644 index 0000000..7582c67 --- /dev/null +++ b/ENV-help.pd @@ -0,0 +1,34 @@ +#N canvas 370 240 625 314 10; +#X obj 147 203 ENV; +#X msg 147 163 RAND_MAX; +#X floatatom 226 253 10 0 0; +#X obj 147 277 print; +#X msg 214 164 getenv \$1; +#X symbolatom 215 130 10 0 0; +#X obj 295 130 symbol; +#X msg 311 105 HOSTNAME; +#X msg 310 80 USERNAME; +#X obj 147 228 route symbol; +#X msg 147 253 \$1; +#X msg 424 110 USERNAME bla; +#X obj 386 168 cxc.prepend setenv; +#X obj 395 202 print pre; +#X msg 425 135 HOSTNAME testi; +#X msg 312 45 RANDOM; +#X text 18 7 get and set environment variables etc ...; +#X msg 244 51 DATE; +#X connect 0 0 9 0; +#X connect 1 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 6 0 4 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; +#X connect 9 0 10 0; +#X connect 9 1 2 0; +#X connect 10 0 3 0; +#X connect 11 0 12 0; +#X connect 12 0 0 0; +#X connect 14 0 12 0; +#X connect 15 0 6 0; +#X connect 17 0 6 0; diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,340 @@ + 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. + + GNU GENERAL PUBLIC LICENSE + 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5c4cbb9 --- /dev/null +++ b/Makefile @@ -0,0 +1,283 @@ +## Pd library template version 1.0 +# For instructions on how to use this template, see: +# http://puredata.info/docs/developer/MakefileTemplate +LIBRARY_NAME = cxc + +# add your .c source files to the SOURCES variable, help files will be +# included automatically +SOURCES = ENV.c ascseq.c ascwave.c bfilt.c bfilt2.c binshift.c counter.c cxavgdev.c cxmean.c cxstddev.c delta~.c dist_normal.c hex2dec.c ixprint.c mean~.c prepend.c random1.c random1~.c random_fl.c random_fl~.c random_icg.c random_icg~.c random_tw.c reson~.c split.c utime.c + +# For objects that only build on certain platforms, add those to the SOURCES +# line for the right platforms. +SOURCES_android = +SOURCES_cygwin = +SOURCES_macosx = +SOURCES_iphoneos = +SOURCES_linux = proc.c +SOURCES_windows = + +# list all pd objects (i.e. myobject.pd) files here, and their helpfiles will +# be included automatically +PDOBJECTS = + +# example patches and related files, in the 'examples' subfolder +EXAMPLES = + +# manuals and related files, in the 'manual' subfolder +MANUAL = + +# if you want to include any other files in the source and binary tarballs, +# list them here. This can be anything from header files, example patches, +# documentation, etc. README.txt and LICENSE.txt are required and therefore +# automatically included +EXTRA_DIST = TODO REFERENCES x_connective_pd034.diff x_connective_pd035.diff cxc.h cxc.c + + + +#------------------------------------------------------------------------------# +# +# you shouldn't need to edit anything below here, if we did it right :) +# +#------------------------------------------------------------------------------# + +# get library version from meta file +LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd) + +# where Pd lives +PD_PATH = ../../pd +# where to install the library +prefix = /usr/local +libdir = $(prefix)/lib +pkglibdir = $(libdir)/pd-externals +objectsdir = $(pkglibdir) + + +INSTALL = install +INSTALL_FILE = $(INSTALL) -p -m 644 +INSTALL_DIR = $(INSTALL) -p -m 755 -d + +CFLAGS = -DPD -I$(PD_PATH)/src -Wall -W -g -DVERSION='"$(LIBRARY_VERSION)"' +LDFLAGS = +LIBS = +ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ + $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows) + +UNAME := $(shell uname -s) +ifeq ($(UNAME),Darwin) + CPU := $(shell uname -p) + ifeq ($(CPU),arm) # iPhone/iPod Touch + SOURCES += $(SOURCES_iphoneos) + EXTENSION = pd_darwin + OS = iphoneos + IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin + CC=$(IPHONE_BASE)/gcc + CPP=$(IPHONE_BASE)/cpp + CXX=$(IPHONE_BASE)/g++ + ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk + IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6 + OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer + CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS) \ + -I/Applications/Pd-extended.app/Contents/Resources/include + LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) + LIBS += -lc + STRIP = strip -x + DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) + DISTBINDIR=$(DISTDIR)-$(OS) + else # Mac OS X + SOURCES += $(SOURCES_macosx) + EXTENSION = pd_darwin + OS = macosx + OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast +# build universal 32-bit on 10.4 and 32/64 on newer + ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) + FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 + else + FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 + SOURCES += $(SOURCES_iphoneos) + endif + CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \ + -I/Applications/Pd-extended.app/Contents/Resources/include + LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib + # if the 'pd' binary exists, check the linking against it to aid with stripping + LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd) + LIBS += -lc + STRIP = strip -x + DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) + DISTBINDIR=$(DISTDIR)-$(OS) +# install into ~/Library/Pd on Mac OS X since /usr/local isn't used much + pkglibdir=$(HOME)/Library/Pd + endif +endif +ifeq ($(UNAME),Linux) + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + OS = linux + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += -fPIC + LDFLAGS += -Wl,--export-dynamic -shared -fPIC + LIBS += -lc + STRIP = strip --strip-unneeded -R .note -R .comment + DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif +ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) + SOURCES += $(SOURCES_cygwin) + EXTENSION = dll + OS = cygwin + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += + LDFLAGS += -Wl,--export-dynamic -shared -L$(PD_PATH)/src + LIBS += -lc -lpd + STRIP = strip --strip-unneeded -R .note -R .comment + DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) + DISTBINDIR=$(DISTDIR)-$(OS) +endif +ifeq (MINGW,$(findstring MINGW,$(UNAME))) + SOURCES += $(SOURCES_windows) + EXTENSION = dll + OS = windows + OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4 + CFLAGS += -mms-bitfields + LDFLAGS += -s -shared -Wl,--enable-auto-import + LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 + STRIP = strip --strip-unneeded -R .note -R .comment + DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) + DISTBINDIR=$(DISTDIR)-$(OS) +endif + +CFLAGS += $(OPT_CFLAGS) + + +.PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags + +all: $(SOURCES:.c=.$(EXTENSION)) + +%.o: %.c + $(CC) $(CFLAGS) -o "$*.o" -c "$*.c" + +%.$(EXTENSION): %.o + $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) + chmod a-x "$*.$(EXTENSION)" + +# this links everything into a single binary file +$(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o + $(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS) + chmod a-x $(LIBRARY_NAME).$(EXTENSION) + + +install: libdir_install + +# The meta and help files are explicitly installed to make sure they are +# actually there. Those files are not optional, then need to be there. +libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install-manual + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(SOURCES))" || (\ + $(INSTALL_FILE) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \ + $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION)))) + test -z "$(strip $(PDOBJECTS))" || \ + $(INSTALL_FILE) $(PDOBJECTS) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + +# install library linked as single binary +single_install: $(LIBRARY_NAME) install-doc install-exec + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(INSTALL_FILE) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION) + +install-doc: + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(SOURCES))" || \ + $(INSTALL_FILE) $(SOURCES:.c=-help.pd) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(PDOBJECTS))" || \ + $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(INSTALL_FILE) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt + $(INSTALL_FILE) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt + +install-examples: + test -z "$(strip $(EXAMPLES))" || \ + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \ + for file in $(EXAMPLES); do \ + $(INSTALL_FILE) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \ + done + +install-manual: + test -z "$(strip $(MANUAL))" || \ + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \ + for file in $(MANUAL); do \ + $(INSTALL_FILE) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \ + done + + +clean: + -rm -f -- $(SOURCES:.c=.o) + -rm -f -- $(SOURCES:.c=.$(EXTENSION)) + -rm -f -- $(LIBRARY_NAME).o + -rm -f -- $(LIBRARY_NAME).$(EXTENSION) + +distclean: clean + -rm -f -- $(DISTBINDIR).tar.gz + -rm -rf -- $(DISTBINDIR) + -rm -f -- $(DISTDIR).tar.gz + -rm -rf -- $(DISTDIR) + + +$(DISTBINDIR): + $(INSTALL_DIR) $(DISTBINDIR) + +libdir: all $(DISTBINDIR) + $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR) + $(INSTALL_FILE) $(SOURCES) $(DISTBINDIR) + $(INSTALL_FILE) $(SOURCES:.c=-help.pd) $(DISTBINDIR) + test -z "$(strip $(EXTRA_DIST))" || \ + $(INSTALL_FILE) $(EXTRA_DIST) $(DISTBINDIR) +# tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR) + +$(DISTDIR): + $(INSTALL_DIR) $(DISTDIR) + +dist: $(DISTDIR) + $(INSTALL_FILE) Makefile $(DISTDIR) + $(INSTALL_FILE) README.txt $(DISTDIR) + $(INSTALL_FILE) LICENSE.txt $(DISTDIR) + $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTDIR) + test -z "$(strip $(ALLSOURCES))" || \ + $(INSTALL_FILE) $(ALLSOURCES) $(DISTDIR) + test -z "$(strip $(ALLSOURCES))" || \ + $(INSTALL_FILE) $(ALLSOURCES:.c=-help.pd) $(DISTDIR) + test -z "$(strip $(PDOBJECTS))" || \ + $(INSTALL_FILE) $(PDOBJECTS) $(DISTDIR) + test -z "$(strip $(PDOBJECTS))" || \ + $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) $(DISTDIR) + test -z "$(strip $(EXTRA_DIST))" || \ + $(INSTALL_FILE) $(EXTRA_DIST) $(DISTDIR) + test -z "$(strip $(EXAMPLES))" || \ + $(INSTALL_DIR) $(DISTDIR)/examples && \ + for file in $(EXAMPLES); do \ + $(INSTALL_FILE) examples/$$file $(DISTDIR)/examples; \ + done + test -z "$(strip $(MANUAL))" || \ + $(INSTALL_DIR) $(DISTDIR)/manual && \ + for file in $(MANUAL); do \ + $(INSTALL_FILE) manual/$$file $(DISTDIR)/manual; \ + done + tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) + + +etags: + etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h + +showsetup: + @echo "PD_PATH: $(PD_PATH)" + @echo "objectsdir: $(objectsdir)" + @echo "LIBRARY_NAME: $(LIBRARY_NAME)" + @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)" + @echo "SOURCES: $(SOURCES)" + @echo "PDOBJECTS: $(PDOBJECTS)" + @echo "ALLSOURCES: $(ALLSOURCES)" + @echo "UNAME: $(UNAME)" + @echo "CPU: $(CPU)" + @echo "pkglibdir: $(pkglibdir)" diff --git a/README b/README deleted file mode 100644 index 80c9f86..0000000 --- a/README +++ /dev/null @@ -1,92 +0,0 @@ --------------------------- - cxc pd eternals library - powered by zt0ln d4ta --------------------------- - -USE AT YOUR OWN RISK! -NO WARRANTY WHATSOEVER! -THIS IS GPL SOFTWARE. -see gpl.txt in this directory or http://www.gnu.org/licenses/gpl.txt -etc blah blah ... - -install: -./configure --prefix=/path/to - -then type -$ make -$ make install - -(install cxc.pd_linux in $PREFIX/lib/pd/externs -and documentation in $PREFIX/lib/pd/doc/5.refernce - - -included objects: - -ixprint: -print data on console without prefix (needed for ascwave) - -binshift: -binary shift objects (<<,>>) - -ascseq: -ascii-sequencer: input anything, which is output again sequentially -character by character with a given delay - -ascwave: -print funny ascii constructions on console - -bfilt alias bangfilter: -re-output every argumen-th event -useful for modulo-sequencers -internal: modulo x -> sel 0 - -bfilt2: -features internal counter, output just bangs - -counter: -cloned out of markex so i dont need to load gem to have these - -reson: -same as above - -cxc_prepend: -prepend stuff with another symbol - -cxc_split: -split incoming string at specified delimiter - -utime: -output seconds since epoch and microsecond fraction - -random1, random_fl, random_icg, random_tw, dist_normal: -various PRNG algorithms from http://remus.rutgers.edu/~rhoads/Code - -random1~, random_fl~, random_icg~: -signal version of above algorithms - -ENV: -get and set environment variables and certain defines like RAND_MAX - -proc: -get stuff out of the linux proc directory (so far: cpuinfo, loadavg, -version, uptime) - -delta~: -emit distance to last sample as signal. - -cx.mean, cx.avgdev, cx.stddev: -calculate mean, standard and average deviation of a signal in an array - ----------------------------------------------------------------------- - -x_connective*.diffs: -patch for pd-src to make receives have inlets and set method. - - -see reference folder for objects in action - - -jdl@xdv.org, 20030301 ------------------------------- -references see REFERENCES file -bla diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..80c9f86 --- /dev/null +++ b/README.txt @@ -0,0 +1,92 @@ +-------------------------- + cxc pd eternals library + powered by zt0ln d4ta +-------------------------- + +USE AT YOUR OWN RISK! +NO WARRANTY WHATSOEVER! +THIS IS GPL SOFTWARE. +see gpl.txt in this directory or http://www.gnu.org/licenses/gpl.txt +etc blah blah ... + +install: +./configure --prefix=/path/to + +then type +$ make +$ make install + +(install cxc.pd_linux in $PREFIX/lib/pd/externs +and documentation in $PREFIX/lib/pd/doc/5.refernce + + +included objects: + +ixprint: +print data on console without prefix (needed for ascwave) + +binshift: +binary shift objects (<<,>>) + +ascseq: +ascii-sequencer: input anything, which is output again sequentially +character by character with a given delay + +ascwave: +print funny ascii constructions on console + +bfilt alias bangfilter: +re-output every argumen-th event +useful for modulo-sequencers +internal: modulo x -> sel 0 + +bfilt2: +features internal counter, output just bangs + +counter: +cloned out of markex so i dont need to load gem to have these + +reson: +same as above + +cxc_prepend: +prepend stuff with another symbol + +cxc_split: +split incoming string at specified delimiter + +utime: +output seconds since epoch and microsecond fraction + +random1, random_fl, random_icg, random_tw, dist_normal: +various PRNG algorithms from http://remus.rutgers.edu/~rhoads/Code + +random1~, random_fl~, random_icg~: +signal version of above algorithms + +ENV: +get and set environment variables and certain defines like RAND_MAX + +proc: +get stuff out of the linux proc directory (so far: cpuinfo, loadavg, +version, uptime) + +delta~: +emit distance to last sample as signal. + +cx.mean, cx.avgdev, cx.stddev: +calculate mean, standard and average deviation of a signal in an array + +---------------------------------------------------------------------- + +x_connective*.diffs: +patch for pd-src to make receives have inlets and set method. + + +see reference folder for objects in action + + +jdl@xdv.org, 20030301 +------------------------------ +references see REFERENCES file +bla diff --git a/VERSION b/VERSION deleted file mode 100644 index e9b8f99..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.05 diff --git a/ascseq-help.pd b/ascseq-help.pd new file mode 100644 index 0000000..5038a84 --- /dev/null +++ b/ascseq-help.pd @@ -0,0 +1,12 @@ +#N canvas 454 117 570 300 10; +#X obj 132 168 print ascseq; +#X msg 253 112 bang; +#X obj 223 70 random_fl -10000 10000; +#X obj 131 118 ascseq 100; +#X floatatom 268 137 5 0 0; +#X msg 83 34 "abcde 123 dsfjnsdf ewrte 3k4n5 3n hjb5465hj 6"; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 3 0 0 0; +#X connect 4 0 3 1; +#X connect 5 0 3 0; diff --git a/ascwave-help.pd b/ascwave-help.pd new file mode 100644 index 0000000..bb36502 --- /dev/null +++ b/ascwave-help.pd @@ -0,0 +1,65 @@ +#N canvas 448 258 407 316 10; +#X msg 80 153 bang; +#X floatatom 169 176; +#X floatatom 214 58; +#X obj 151 13 loadbang; +#X obj 157 97 metro 100; +#X msg 157 196 1; +#X msg 157 58 1; +#X msg 186 58 0; +#X obj 145 221 ascwave; +#X msg 75 192 fill 1; +#X msg 74 211 fill 0; +#X obj 145 262 ixprint; +#X msg 145 241 \$1; +#N canvas 517 176 588 372 modulate 0; +#X obj 84 200 outlet; +#X obj 84 139 random 80; +#X msg 30 110 bang; +#X obj 84 75 * 50; +#X obj 84 93 metro 5000; +#X obj 29 52 loadbang; +#X msg 29 70 1; +#X obj 84 161 pack 1 5000; +#X obj 84 180 line; +#X obj 86 31 inlet start/stop; +#X obj 130 53 inlet time; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 3 0 4 0; +#X connect 3 0 7 1; +#X connect 4 0 1 0; +#X connect 5 0 6 0; +#X connect 6 0 4 0; +#X connect 7 0 8 0; +#X connect 8 0 0 0; +#X connect 9 0 4 0; +#X connect 10 0 3 0; +#X restore 169 154 page modulate; +#X floatatom 262 132; +#X obj 262 179 min 127; +#X obj 262 154 max 33; +#X obj 157 77 f; +#X obj 210 78 f; +#X text 200 178 <== here; +#X text 297 131 <== and here; +#X connect 0 0 8 0; +#X connect 1 0 8 2; +#X connect 2 0 18 0; +#X connect 3 0 6 0; +#X connect 4 0 5 0; +#X connect 5 0 8 1; +#X connect 6 0 17 0; +#X connect 7 0 17 0; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 12 0 11 0; +#X connect 13 0 8 2; +#X connect 14 0 16 0; +#X connect 15 0 8 3; +#X connect 16 0 15 0; +#X connect 17 0 4 0; +#X connect 17 0 13 0; +#X connect 18 0 4 1; +#X connect 18 0 13 1; diff --git a/bfilt-help.pd b/bfilt-help.pd new file mode 100644 index 0000000..4be9d45 --- /dev/null +++ b/bfilt-help.pd @@ -0,0 +1,23 @@ +#N canvas 203 207 404 226 10; +#X floatatom 85 119; +#X obj 57 175 print; +#X floatatom 45 120; +#X obj 58 146 bfilt 5; +#X text 43 16 bfilt (at the moment) is: modulo something + select 0; +#X floatatom 167 120; +#X obj 139 176 print; +#X floatatom 127 121; +#X obj 140 147 bfilt2 5; +#X obj 145 87 metro 100; +#X msg 145 68 1; +#X text 42 29 bfilt2: real bangfilter: bangs on first inlet \, internal counter \, only outputs every arg2th bang ...; +#X msg 169 67 0; +#X connect 0 0 3 1; +#X connect 2 0 3 0; +#X connect 3 0 1 0; +#X connect 5 0 8 1; +#X connect 7 0 8 0; +#X connect 8 0 6 0; +#X connect 9 0 8 0; +#X connect 10 0 9 0; +#X connect 12 0 9 0; diff --git a/bfilt2-help.pd b/bfilt2-help.pd new file mode 100644 index 0000000..4be9d45 --- /dev/null +++ b/bfilt2-help.pd @@ -0,0 +1,23 @@ +#N canvas 203 207 404 226 10; +#X floatatom 85 119; +#X obj 57 175 print; +#X floatatom 45 120; +#X obj 58 146 bfilt 5; +#X text 43 16 bfilt (at the moment) is: modulo something + select 0; +#X floatatom 167 120; +#X obj 139 176 print; +#X floatatom 127 121; +#X obj 140 147 bfilt2 5; +#X obj 145 87 metro 100; +#X msg 145 68 1; +#X text 42 29 bfilt2: real bangfilter: bangs on first inlet \, internal counter \, only outputs every arg2th bang ...; +#X msg 169 67 0; +#X connect 0 0 3 1; +#X connect 2 0 3 0; +#X connect 3 0 1 0; +#X connect 5 0 8 1; +#X connect 7 0 8 0; +#X connect 8 0 6 0; +#X connect 9 0 8 0; +#X connect 10 0 9 0; +#X connect 12 0 9 0; diff --git a/configure b/configure deleted file mode 100755 index 5fd38c5..0000000 --- a/configure +++ /dev/null @@ -1,1961 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=cx.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:529: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:559: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:610: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 653 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:689: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:717: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:779: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:836: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:868: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 879 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:910: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:915: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:943: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi - - - - - - - - - - -echo $ac_n "checking for main in -lc""... $ac_c" 1>&6 -echo "configure:984: checking for main in -lc" >&5 -ac_lib_var=`echo c'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lc $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo c | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:1027: checking for main in -lm" >&5 -ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lm $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1071: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1151: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -#include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : -else - cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -if { (eval echo configure:1231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -for ac_hdr in stdlib.h stdio.h string.h math.h time.h sys/time.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1258: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1296: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:1310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_time=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 -if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF -#define TIME_WITH_SYS_TIME 1 -EOF - -fi - - -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1335: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_func in getpagesize -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1374: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1427: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat > conftest.$ac_ext < -#include -#include - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif - -/* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif - -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - -int -main() -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); - - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); -} - -EOF -if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_MMAP 1 -EOF - -fi - -for ac_func in select socket strerror -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1600: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - - -LD=ld - -if test `uname -s` = Linux; -then - LFLAGS="-export_dynamic -shared" - EXT=pd_linux - DFLAGS="-DUNIX -DLINUX" - STRIPFLAGS="--strip-unneeded" -fi - -if test `uname -s` = Darwin; -then - LD=cc - LFLAGS="-bundle -undefined suppress -flat_namespace" - EXT=pd_darwin - DFLAGS="-DUNIX -DMACOSX" - STRIPFLAGS= -fi - -if test `uname -s` = IRIX64; -then - LFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ - -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \ - -shared -rdata_shared" - EXT=pd_irix6 - DFLAGS="-DUNIX -DIRIX6" - STRIPFLAGS="--strip-unneeded" -fi - -if test `uname -s` = IRIX32; -then - LFLAGS="-o32 -DUNIX -DIRIX -O2 - -shared -rdata_shared" - EXT=pd_irix5 - DFLAGS="-DUNIX -DIRIX5" - STRIPFLAGS="--strip-unneeded" -fi - - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@CC@%$CC%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@CXX@%$CXX%g -s%@STK@%$STK%g -s%@DFLAGS@%$DFLAGS%g -s%@LFLAGS@%$LFLAGS%g -s%@EXT@%$EXT%g -s%@LD@%$LD%g -s%@STRIPFLAGS@%$STRIPFLAGS%g -s%@CPP@%$CPP%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/configure.in b/configure.in deleted file mode 100644 index d17d27c..0000000 --- a/configure.in +++ /dev/null @@ -1,84 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(cx.c) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_CXX - -AC_SUBST(STK) -AC_SUBST(DFLAGS) -AC_SUBST(LFLAGS) -AC_SUBST(EXT) -AC_SUBST(LD) -AC_SUBST(STRIPFLAGS) - - -dnl Checks for libraries. -dnl Replace `main' with a function in -lc: -AC_CHECK_LIB(c, main) -dnl Replace `main' with a function in -lm: -AC_CHECK_LIB(m, main) -dnl Replace `main' with a function in -lpthread: -dnl AC_CHECK_LIB(pthread, main) -dnl Replace `main' with a function in -lstk: -dnl AC_CHECK_LIB(stk, main, STK=yes) - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(stdlib.h stdio.h string.h math.h time.h sys/time.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_TIME - -dnl Checks for library functions. -AC_FUNC_MMAP -AC_CHECK_FUNCS(select socket strerror) - - -LD=ld - -dnl -dnl OK, checks for machines are here now -dnl -if test `uname -s` = Linux; -then - LFLAGS="-export_dynamic -shared" - EXT=pd_linux - DFLAGS="-DUNIX -DLINUX" - STRIPFLAGS="--strip-unneeded" -fi - -dnl This should use '-bundle_loader /path/to/pd/bin/pd' instead of'-undefined suppress' -dnl then strip might do something -if test `uname -s` = Darwin; -then - LD=cc - LFLAGS="-bundle -undefined suppress -flat_namespace" - EXT=pd_darwin - DFLAGS="-DUNIX -DMACOSX" - STRIPFLAGS= -fi - -if test `uname -s` = IRIX64; -then - LFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ - -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \ - -shared -rdata_shared" - EXT=pd_irix6 - DFLAGS="-DUNIX -DIRIX6" - STRIPFLAGS="--strip-unneeded" -fi - -if test `uname -s` = IRIX32; -then - LFLAGS="-o32 -DUNIX -DIRIX -O2 - -shared -rdata_shared" - EXT=pd_irix5 - DFLAGS="-DUNIX -DIRIX5" - STRIPFLAGS="--strip-unneeded" -fi - - - -AC_OUTPUT(makefile) diff --git a/cx.c b/cx.c deleted file mode 100644 index ee725b8..0000000 --- a/cx.c +++ /dev/null @@ -1,112 +0,0 @@ - -#ifndef VERSION -#define VERSION "0.04" -#endif - -#ifndef __DATE__ -#define __DATE__ "without using a gnu compiler" -#endif - -#include -#include "cx.h" - -typedef struct _cxc -{ - t_object x_obj; -} t_cxc; - -static t_class* cxc_class; - -void binshift_setup(); -void ascwave_setup(); -void ascseq_setup(); -void ixprint_setup(); -//void mixer_setup(); -//void makesymbol_setup(); -void bfilt_setup(); -void bfilt2_setup(); -/* void sendOSC_setup(); */ -/* void dumpOSC_setup(); */ -/* void routeOSC_setup(); */ -//void testy_tilde_setup(); -//void garlic_tilde_setup(); -void counter_setup(); -void reson_setup(); -//void serialize_setup(); -void prepend_setup(); -void split_setup(); -void utime_setup(); -// RNG's -void random1_setup(); -void random1_tilde_setup(); // signal version -void random_fl_setup(); -void random_fl_tilde_setup(); -void random_icg_setup(); -void random_icg_tilde_setup(); -void random_tw_setup(); -void dist_normal_setup(); - -void ENV_setup(); -void proc_setup(); - -void cxmean_setup(); -void cxavgdev_setup(); -void cxstddev_setup(); - -void mean_tilde_setup(); - -void delta_tilde_setup(); - -static void* cxc_new(t_symbol* s) { - t_cxc *x = (t_cxc *)pd_new(cxc_class); - return (x); -} - -void cxc_setup(void) -{ - cxc_class = class_new(gensym("cxc"), (t_newmethod)cxc_new, 0, - sizeof(t_cxc), 0,0); - ixprint_setup(); - binshift_setup(); - ascwave_setup(); - ascseq_setup(); - // mixer_setup(); - // makesymbol_setup(); - bfilt_setup(); - bfilt2_setup(); -/* sendOSC_setup(); */ -/* dumpOSC_setup(); */ -/* routeOSC_setup(); */ - counter_setup(); - reson_setup(); - //serialize_setup(); - prepend_setup(); - split_setup(); - utime_setup(); - // RNG's - random1_setup(); - random1_tilde_setup(); - random_fl_setup(); - random_fl_tilde_setup(); - random_icg_setup(); - random_icg_tilde_setup(); - random_tw_setup(); - dist_normal_setup(); - - ENV_setup(); - proc_setup(); - - cxmean_setup(); - cxavgdev_setup(); - cxstddev_setup(); - - mean_tilde_setup(); - - delta_tilde_setup(); - - post("c : jdl@xdv.org ========================================"); - post(" x : ver: "VERSION" ============================================"); - post(" c: compiled: "__DATE__" =================================="); - // post("\\"); - // L; -} diff --git a/cx.h b/cx.h deleted file mode 100644 index 11cb10e..0000000 --- a/cx.h +++ /dev/null @@ -1,6 +0,0 @@ - -#include - -#ifndef L -#define L fprintf(stderr,"%s:%d\n",__FILE__,__LINE__); -#endif diff --git a/cxc-meta.pd b/cxc-meta.pd new file mode 100644 index 0000000..deea13f --- /dev/null +++ b/cxc-meta.pd @@ -0,0 +1,9 @@ +#N canvas 10 10 200 200 10; +#N canvas 20 20 420 300 META 0; +#X text 10 10 META this is a prototype of a libdir meta file; +#X text 10 30 NAME cxc; +#X text 10 50 AUTHOR jdl@xdv.org; +#X text 10 70 DESCRIPTION library of randoms, averages, and system tools; +#X text 10 90 LICENSE ; +#X text 10 110 VERSION 0.5; +#X restore 10 10 pd META; diff --git a/cxc.c b/cxc.c new file mode 100644 index 0000000..25717ed --- /dev/null +++ b/cxc.c @@ -0,0 +1,112 @@ + +#ifndef VERSION +#define VERSION "0.05" +#endif + +#ifndef __DATE__ +#define __DATE__ "without using a gnu compiler" +#endif + +#include +#include "cxc.h" + +typedef struct _cxc +{ + t_object x_obj; +} t_cxc; + +static t_class* cxc_class; + +void binshift_setup(); +void ascwave_setup(); +void ascseq_setup(); +void ixprint_setup(); +//void mixer_setup(); +//void makesymbol_setup(); +void bfilt_setup(); +void bfilt2_setup(); +/* void sendOSC_setup(); */ +/* void dumpOSC_setup(); */ +/* void routeOSC_setup(); */ +//void testy_tilde_setup(); +//void garlic_tilde_setup(); +void counter_setup(); +void reson_tilde_setup(); +//void serialize_setup(); +void prepend_setup(); +void split_setup(); +void utime_setup(); +// RNG's +void random1_setup(); +void random1_tilde_setup(); // signal version +void random_fl_setup(); +void random_fl_tilde_setup(); +void random_icg_setup(); +void random_icg_tilde_setup(); +void random_tw_setup(); +void dist_normal_setup(); + +void ENV_setup(); +void proc_setup(); + +void cxmean_setup(); +void cxavgdev_setup(); +void cxstddev_setup(); + +void mean_tilde_setup(); + +void delta_tilde_setup(); + +static void* cxc_new(t_symbol* s) { + t_cxc *x = (t_cxc *)pd_new(cxc_class); + return (x); +} + +void cxc_setup(void) +{ + cxc_class = class_new(gensym("cxc"), (t_newmethod)cxc_new, 0, + sizeof(t_cxc), 0,0); + ixprint_setup(); + binshift_setup(); + ascwave_setup(); + ascseq_setup(); + // mixer_setup(); + // makesymbol_setup(); + bfilt_setup(); + bfilt2_setup(); +/* sendOSC_setup(); */ +/* dumpOSC_setup(); */ +/* routeOSC_setup(); */ + counter_setup(); + reson_tilde_setup(); + //serialize_setup(); + prepend_setup(); + split_setup(); + utime_setup(); + // RNG's + random1_setup(); + random1_tilde_setup(); + random_fl_setup(); + random_fl_tilde_setup(); + random_icg_setup(); + random_icg_tilde_setup(); + random_tw_setup(); + dist_normal_setup(); + + ENV_setup(); + proc_setup(); + + cxmean_setup(); + cxavgdev_setup(); + cxstddev_setup(); + + mean_tilde_setup(); + + delta_tilde_setup(); + + post("c : jdl@xdv.org ========================================"); + post(" x : ver: "VERSION" ============================================"); + post(" c: compiled: "__DATE__" =================================="); + // post("\\"); + // L; +} diff --git a/cxc.h b/cxc.h new file mode 100644 index 0000000..11cb10e --- /dev/null +++ b/cxc.h @@ -0,0 +1,6 @@ + +#include + +#ifndef L +#define L fprintf(stderr,"%s:%d\n",__FILE__,__LINE__); +#endif diff --git a/delta~-help.pd b/delta~-help.pd new file mode 100644 index 0000000..7f0bf8b --- /dev/null +++ b/delta~-help.pd @@ -0,0 +1,63 @@ +#N canvas 9 51 986 579 10; +#X obj 139 177 delta~; +#X obj 80 44 noise~; +#X obj 83 268 print a; +#X obj 143 267 print b; +#X obj 329 312 dac~; +#X obj 226 47 osc~ 400; +#X graph graph1 0 -1 999 1 497 206 697 66; +#X array orig 1000 float 0; +#X pop; +#X graph graph2 0 -1 999 1 431 563 931 203; +#X array diff 1000 float 0; +#X pop; +#X obj 129 390 tabwrite~ diff; +#X msg 220 340 bang; +#X floatatom 225 24 5 0 0; +#X obj 139 468 table test; +#X msg 139 442 resize 2205; +#X obj 242 389 tabwrite~ test; +#X obj 243 415 tabwrite~ orig; +#X obj 403 515 print; +#X msg 350 441 bang; +#X obj 346 530 t b; +#X obj 332 552 spigot; +#X obj 375 528 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 320 474 tabread~ test; +#X obj 201 532 phasor~ 10; +#X floatatom 201 510 5 0 0; +#X obj 201 556 *~ 2205; +#X obj 147 45 phasor~ 1; +#X obj 160 93 nop~; +#X obj 287 224 metro 100; +#X obj 287 198 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X floatatom 173 18 5 0 0; +#X obj 109 77 *~ 0.1; +#X floatatom 86 103 5 0 0; +#X text 308 36 if this sample is larger than last \, value is positive +\, else negative ...; +#X text 308 18 delta~: difference between this and last sample; +#X connect 0 0 4 1; +#X connect 0 0 8 0; +#X connect 1 0 29 0; +#X connect 9 0 8 0; +#X connect 9 0 13 0; +#X connect 9 0 14 0; +#X connect 10 0 5 0; +#X connect 12 0 11 0; +#X connect 17 0 18 0; +#X connect 19 0 18 1; +#X connect 21 0 23 0; +#X connect 22 0 21 0; +#X connect 23 0 20 0; +#X connect 24 0 25 0; +#X connect 25 0 0 0; +#X connect 25 0 13 0; +#X connect 25 0 14 0; +#X connect 26 0 9 0; +#X connect 27 0 26 0; +#X connect 28 0 24 0; +#X connect 29 0 25 0; +#X connect 30 0 29 1; diff --git a/dist_normal-help.pd b/dist_normal-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/dist_normal-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/dist_normal.c b/dist_normal.c new file mode 100644 index 0000000..7847745 --- /dev/null +++ b/dist_normal.c @@ -0,0 +1,174 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +static int rand_random_fl(seed) { + int q; + double state; + + /* The following parameters are recommended settings based on research + uncomment the one you want. */ + + double a = 1389796, m = RAND_MAX; + /* static double a = 950975, m = 2147483647; */ + /* static double a = 3467255, m = 21474836472; */ + /* static double a = 657618, m = 4294967291; */ + /* static double a = 93167, m = 4294967291; */ + /* static double a = 1345659, m = 4294967291; */ + + state = seed; + state *= a; + q = state / m; + state -= q*m; + return state; +} + +/* -------------------------- dist_normal ------------------------------ */ +/* Generate a normal random variable with mean 0 and standard deviation + of 1. To adjust to some other distribution, multiply by the standard + deviation and add the mean. Box-Muller method + note: rand() is a function that returns a uniformly distributed random + number from 0 to RAND_MAX +*/ + +static t_class *dist_normal_class; + +typedef struct _dist_normal +{ + t_object x_obj; + t_float x_mn; // mean + t_float x_dv; // deviation + t_float x_u1; + t_float x_u2; + + t_float x_f; // lower limit + t_float x_g; // upper limit + unsigned int x_state; // current seed +} t_dist_normal; + +static void *dist_normal_new(t_floatarg mn, t_floatarg dv) +{ + t_dist_normal *x = (t_dist_normal *)pd_new(dist_normal_class); + x->x_mn = (mn) ? mn : 0; + x->x_dv = (dv) ? dv : 1; + x->x_u1 = 13; + x->x_u2 = 1000; + x->x_f = 0; + x->x_g = RAND_MAX; + //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); + x->x_state = makeseed(); + 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")); + //outlet_new(&x->x_obj, &s_float); + outlet_new(&x->x_obj, 0); + return (x); +} + +static double dist_normal_rand(t_dist_normal *x) +{ + int n = x->x_f; + double nval; + double m; + + m = (double)RAND_MAX * 2; + + // post("cxc/randomix.c: x_state: %d",x->x_state); + x->x_state = rand_random_fl(x->x_state); + //nval = ((double)x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f; + nval = (double)x->x_state; + return (nval); +} + +static void dist_normal_doit(t_dist_normal *x) +{ + static double V2, fac; + static int phase = 0; + double S, Z, U1, U2, V1; + + if (phase) + Z = V2 * fac; + else + { + do { +/* U1 = (double)rand() / RAND_MAX; */ +/* U2 = (double)rand() / RAND_MAX; */ + U1 = (double)dist_normal_rand(x) / RAND_MAX; + U2 = (double)dist_normal_rand(x) / RAND_MAX; + + // post("cxc/randomix.c: test %f %f %f %f", x->x_u1, x->x_u2, U1, U2); + + V1 = 2 * U1 - 1; + V2 = 2 * U2 - 1; + S = V1 * V1 + V2 * V2; + } while(S >= 1); + + fac = sqrt (-2 * log(S) / S); + Z = V1 * fac; + } + + phase = 1 - phase; + + //return Z; + outlet_float(x->x_obj.ob_outlet, Z); +} + +static void dist_normal_bang(t_dist_normal *x) +{ +/* post("cxc/randomix.c: dist_normal banged"); */ +/* post("cxc/randomix.c: RAND_MAX: %d",RAND_MAX); */ +/* post("cxc/randomix.c: test: %f %f", x->x_u1, x->x_u2); */ + dist_normal_doit(x); +} + +void dist_normal_low(t_dist_normal *x, t_floatarg mn) +{ + x->x_mn = mn; +} + +void dist_normal_upp(t_dist_normal *x, t_floatarg dv) +{ + x->x_dv = dv; +} + +void dist_normal_float(t_dist_normal *x, t_floatarg r) +{ + outlet_float(x->x_obj.ob_outlet, r); +} + +void dist_normal_list(t_dist_normal *x, t_symbol *s, int argc, t_atom *argv) +{ + outlet_list(x->x_obj.ob_outlet, s, argc, argv); +} + +void dist_normal_setup(void) +{ + dist_normal_class = class_new(gensym("dist_normal"), (t_newmethod)dist_normal_new, 0, + sizeof(t_dist_normal), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(dist_normal_class, dist_normal_bang); + class_addmethod(dist_normal_class, (t_method)dist_normal_low, gensym("fl1"), A_FLOAT, 0); + // class_addmethod(dist_normal_class, (t_method)dist_normal_upp, gensym("fl2"), A_FLOAT, 0); + class_addlist (dist_normal_class, dist_normal_list); + +/* class_addmethod(dist_normal_class, (t_method)dist_normal_seed, */ +/* gensym("seed"), A_FLOAT, 0); */ +} diff --git a/gpl.txt b/gpl.txt deleted file mode 100644 index 5b6e7c6..0000000 --- a/gpl.txt +++ /dev/null @@ -1,340 +0,0 @@ - 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. - - GNU GENERAL PUBLIC LICENSE - 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 - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/install-sh b/install-sh deleted file mode 100644 index e9de238..0000000 --- a/install-sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/makefile.in b/makefile.in deleted file mode 100644 index 163b6e1..0000000 --- a/makefile.in +++ /dev/null @@ -1,62 +0,0 @@ - -EXT = @EXT@ -DEFS = @DFLAGS@ -DHAVE_LIBC=1 -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRERROR=1 -DPD_VERSION_MINOR=36 -CC = @CC@ -CXX = @CXX@ -LD = @LD@ -AFLAGS = -LFLAGS = @LFLAGS@ -WFLAGS = -IFLAGS = -I. -I../../pd/src -PREFIX=@prefix@ -INSTALL_PREFIX=$(PREFIX) - -VERSION = \"$(shell cat VERSION)\" -TARNAME = cxc-$(shell cat VERSION).tar.gz - -.SUFFIXES: .$(EXT) - -PDCFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) $(LFLAGS) $(AFLAGS) -DVERSION=$(VERSION) -CFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) -DVERSION=$(VERSION) -CXXFLAGS = $(CFLAGS) - -LIBS = -lc -lm -#LIBS = -lpthread -lm -lc -SOURCES = ENV.c ascseq.c ascwave.c bangfilt.c bangfilt2.c binshift.c counter.c cx.c ixprint.c mean.c utime.c prepend.c proc.c randomix.c reson~.c sigdelta.c split.c -TARGETS = $(SOURCES:.c=.$(EXT)) - -# all: $(TARGETS) -all: cxc - -cxc: $(TARGETS) -# cc -c $(CFLAGS) -o cxc.o -DPD cx.c - $(LD) $(LFLAGS) -o cxc.$(EXT) *.o $(LIBS) - strip @STRIPFLAGS@ cxc.$(EXT) - -clean:: - -rm *.$(EXT) *.o - -distclean: clean - -rm config.cache config.log config.status makefile - - - -.c.o: - $(CC) -c -o $@ $(CFLAGS) -DPD $*.c - -# cp $@ $*_stat.o - -.o.$(EXT): - $(CC) -o $@ $(PDCFLAGS) -DPD $*.o - - - -install:: - install -d $(INSTALL_PREFIX)/pd/externs -# install -m 644 *.$(EXT) $(INSTALL_PREFIX)/pd/externs - -install -m 644 cxc.$(EXT) $(INSTALL_PREFIX)/pd/externs - install -m 644 reference/*.pd $(INSTALL_PREFIX)/pd/doc/5.reference - - -dist: distclean - (cd ..;tar czvf $(TARNAME) cxc) diff --git a/proc-help.pd b/proc-help.pd new file mode 100644 index 0000000..65411ae --- /dev/null +++ b/proc-help.pd @@ -0,0 +1,75 @@ +#N canvas 179 113 717 546 10; +#X obj 151 118 proc; +#X text 96 15 interface to the linux proc filesystem; +#X msg 88 80 cpuinfo; +#X obj 27 281 unpack f f f; +#X floatatom 25 304 5 0 0; +#X floatatom 67 305 5 0 0; +#X floatatom 109 304 5 0 0; +#X text 37 254 cpu-id \, cpu-mhz \, bogomips; +#X obj 151 147 print proc_raw; +#X msg 151 94 proc \$1; +#X obj 151 71 symbol; +#X msg 123 38 cpuinfo; +#X msg 183 38 uptime; +#X msg 351 38 stat; +#X msg 389 38 blubb; +#X obj 242 276 unpack f f; +#X text 241 255 uptime in s \, idle-time in s; +#X floatatom 241 301 5 0 0; +#X floatatom 302 305 5 0 0; +#X msg 237 38 loadavg; +#X msg 297 39 version; +#X obj 174 349 unpack f f f f f f; +#X floatatom 172 373 5 0 0; +#X floatatom 187 397 5 0 0; +#X floatatom 220 373 5 0 0; +#X floatatom 238 397 5 0 0; +#X floatatom 271 372 5 0 0; +#X floatatom 289 396 5 0 0; +#X text 315 345 apparently the loadavg format is something liek this +; +#X text 318 359 my manpage seems outdated ...; +#X text 330 379 1: number of jobs in the run queue (1'); +#X text 340 394 2: numofjobs in R qu (5'); +#X text 348 411 3: numofjobs in R qu (15'); +#X text 339 425 4: num of procs waiting for disk io?; +#X text 339 452 6: num of processes ever total; +#X text 339 438 5: num of processes now total; +#X obj 27 234 route cpuinfo uptime loadavg version stat; +#X obj 458 241 unpack f f f; +#X floatatom 458 267 5 0 0; +#X floatatom 484 293 5 0 0; +#X floatatom 516 266 5 0 0; +#X text 462 215 uname -r; +#X text 307 82 really useless stuff but maybe good for estimating number +of voices in self-generating patches; +#X connect 0 0 8 0; +#X connect 0 0 36 0; +#X connect 2 0 0 0; +#X connect 3 0 4 0; +#X connect 3 1 5 0; +#X connect 3 2 6 0; +#X connect 9 0 0 0; +#X connect 10 0 9 0; +#X connect 11 0 10 0; +#X connect 12 0 10 0; +#X connect 13 0 10 0; +#X connect 14 0 10 0; +#X connect 15 0 17 0; +#X connect 15 1 18 0; +#X connect 19 0 10 0; +#X connect 20 0 10 0; +#X connect 21 0 22 0; +#X connect 21 1 23 0; +#X connect 21 2 24 0; +#X connect 21 3 25 0; +#X connect 21 4 26 0; +#X connect 21 5 27 0; +#X connect 36 0 3 0; +#X connect 36 1 15 0; +#X connect 36 2 21 0; +#X connect 36 3 37 0; +#X connect 37 0 38 0; +#X connect 37 1 39 0; +#X connect 37 2 40 0; diff --git a/random1-help.pd b/random1-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/random1-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/random1.c b/random1.c new file mode 100644 index 0000000..5c6c963 --- /dev/null +++ b/random1.c @@ -0,0 +1,137 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static int makeseed(void); +static int rand_random1(int); + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +/* -------------------------- random1 ------------------------------ */ +/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ +static int rand_random1(seed) +{ + int state; + + //unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901; + // unsigned int a = 1588635695, m = (RAND_MAX * 2), q = 2, r = 1117695901; + + /* static unsigned int a = 1223106847, m = 4294967291U, q = 3, r = 625646750;*/ + /* static unsigned int a = 279470273, m = 4294967291U, q = 15, r = 102913196;*/ + //static unsigned int a = 1583458089, m = 2147483647, q = 1, r = 564025558; + static unsigned int a = 784588716, m = 2147483647, q = 2, r = 578306215; + /* static unsigned int a = 16807, m = 2147483647, q = 127773, r = 2836; */ + /* static unsigned int a = 950706376, m = 2147483647, q = 2, r = 246070895; */ + + //state = (seed) ? seed : makeseed(); + state = seed; + state = a*(state % q) - r*(state / q); + return (state); +} + +/* -------------------------- random1 ------------------------------ */ +/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ + +static t_class *random1_class; + +typedef struct _random1 +{ + t_object x_obj; + t_float x_f; // lower limit + t_float x_g; // upper limit + unsigned int x_state; // current seed +} t_random1; + +static void *random1_new(t_floatarg f, t_floatarg g) +{ + t_random1 *x = (t_random1 *)pd_new(random1_class); + x->x_f = (f) ? f : 0; + x->x_g = (g) ? g : RAND_MAX; + //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); + x->x_state = makeseed(); + 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")); + outlet_new(&x->x_obj, &s_float); + return (x); +} + +/* -------------------------- random_fl ------------------------------ */ +/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */ +/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */ +/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */ + +/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ +/* works if your floating pt. mantissa has at least 53 bits. + faster than other versions */ +static void random1_bang(t_random1 *x) +{ + int n = x->x_f; + double nval; + unsigned int m; + // this seems weird? + m = (RAND_MAX * 2); + // unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901; + + // post("cxc/randomix.c: x_state: %d",x->x_state); + x->x_state = rand_random1(x->x_state); + nval = ((double)x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f; + // post("cxc/randomix.c: lolim: %f, uplim: %f", x->x_f, x->x_g); + // post("cxc/randomix.c: nval: %f",nval); + outlet_float(x->x_obj.ob_outlet, nval); +} + +void random1_low(t_random1 *x, t_floatarg f) +{ + if(f >= x->x_g) { + post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", + SMALLEST_RANGE, + x->x_g - SMALLEST_RANGE); + x->x_f = x->x_g - SMALLEST_RANGE; + } else x->x_f = f; +} + +void random1_upp(t_random1 *x, t_floatarg f) +{ + if(f <= x->x_f) { + post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", + SMALLEST_RANGE, + x->x_f + SMALLEST_RANGE); + x->x_g = x->x_f + SMALLEST_RANGE; + } else x->x_g = f; +} + +static void random1_seed(t_random1 *x, float f, float glob) +{ + x->x_state = f; +} + +void random1_setup(void) +{ + random1_class = class_new(gensym("random1"), (t_newmethod)random1_new, 0, + sizeof(t_random1), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(random1_class, random1_bang); + class_addmethod(random1_class, (t_method)random1_low, gensym("fl1"), A_FLOAT, 0); + class_addmethod(random1_class, (t_method)random1_upp, gensym("fl2"), A_FLOAT, 0); + + class_addmethod(random1_class, (t_method)random1_seed, + gensym("seed"), A_FLOAT, 0); +} + diff --git a/random1~-help.pd b/random1~-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/random1~-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/random1~.c b/random1~.c new file mode 100644 index 0000000..0c03fd7 --- /dev/null +++ b/random1~.c @@ -0,0 +1,115 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static int makeseed(void); +static int rand_random1(int); + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +/* -------------------------- random1 ------------------------------ */ +/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ +static int rand_random1(seed) +{ + int state; + + //unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901; + // unsigned int a = 1588635695, m = (RAND_MAX * 2), q = 2, r = 1117695901; + + /* static unsigned int a = 1223106847, m = 4294967291U, q = 3, r = 625646750;*/ + /* static unsigned int a = 279470273, m = 4294967291U, q = 15, r = 102913196;*/ + //static unsigned int a = 1583458089, m = 2147483647, q = 1, r = 564025558; + static unsigned int a = 784588716, m = 2147483647, q = 2, r = 578306215; + /* static unsigned int a = 16807, m = 2147483647, q = 127773, r = 2836; */ + /* static unsigned int a = 950706376, m = 2147483647, q = 2, r = 246070895; */ + + //state = (seed) ? seed : makeseed(); + state = seed; + state = a*(state % q) - r*(state / q); + return (state); +} + +/* -------------------------- random1 ------------------------------ */ +/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ + +static t_class *random1_class; + +typedef struct _random1 +{ + t_object x_obj; + t_float x_f; // lower limit + t_float x_g; // upper limit + unsigned int x_state; // current seed +} t_random1; + +/* -------------------------- random1 ------------------------------ */ +/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ +/* signal version */ + +static t_class *random1_tilde_class; + +typedef struct _random1_tilde +{ + t_object x_obj; + unsigned int x_state; // current seed +} t_random1_tilde; + +static void *random1_tilde_new() +{ + t_random1_tilde *x = (t_random1_tilde *)pd_new(random1_tilde_class); + x->x_state = makeseed(); + outlet_new(&x->x_obj, gensym("signal")); + return (x); +} + +static void random1_tilde_seed(t_random1_tilde *x, float f, float glob) +{ + x->x_state = f; +} + +static t_int *random1_tilde_perform(t_int *w) +{ + t_random1_tilde *x = (t_random1_tilde *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = (int)(w[3]); + + while (n--) { + // generate new noise sample + x->x_state = rand_random1(x->x_state); + *out++ = (t_float)x->x_state / RAND_MAX - 1; + } + + return (w+4); +} + +static void random1_tilde_dsp(t_random1_tilde *x, t_signal **sp) +{ + dsp_add(random1_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); +} + +void random1_tilde_setup(void) +{ + random1_tilde_class = class_new(gensym("random1~"), + (t_newmethod)random1_tilde_new, + 0, sizeof(t_random1_tilde), 0, 0); + class_addmethod(random1_tilde_class, (t_method)random1_tilde_seed,gensym("seed"), A_FLOAT, 0); + class_addmethod(random1_tilde_class, (t_method)random1_tilde_dsp, gensym("dsp"), 0); +} diff --git a/random_fl-help.pd b/random_fl-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/random_fl-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/random_fl.c b/random_fl.c new file mode 100644 index 0000000..33c88d3 --- /dev/null +++ b/random_fl.c @@ -0,0 +1,129 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static int makeseed(void); +static int rand_random_fl(int); + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +static int rand_random_fl(seed) { + int q; + double state; + + /* The following parameters are recommended settings based on research + uncomment the one you want. */ + + double a = 1389796, m = RAND_MAX; + /* static double a = 950975, m = 2147483647; */ + /* static double a = 3467255, m = 21474836472; */ + /* static double a = 657618, m = 4294967291; */ + /* static double a = 93167, m = 4294967291; */ + /* static double a = 1345659, m = 4294967291; */ + + state = seed; + state *= a; + q = state / m; + state -= q*m; + return state; +} + +/* -------------------------- random_fl ------------------------------ */ +/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */ +/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */ +/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */ + +/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ +/* works if your floating pt. mantissa has at least 53 bits. + faster than other versions */ + +static t_class *random_fl_class; + +typedef struct _random_fl +{ + t_object x_obj; + t_float x_f; // lower limit + t_float x_g; // upper limit + unsigned int x_state; // current seed +} t_random_fl; + +static void *random_fl_new(t_floatarg f, t_floatarg g) +{ + t_random_fl *x = (t_random_fl *)pd_new(random_fl_class); + x->x_f = (f) ? f : 0; + x->x_g = (g) ? g : RAND_MAX; + //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); + x->x_state = makeseed(); + 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")); + outlet_new(&x->x_obj, &s_float); + return (x); +} + +void random_fl_bang(t_random_fl *x) +{ + int n = x->x_f; + int q; + double nval; + double m; + + m = RAND_MAX; + x->x_state = rand_random_fl(x->x_state); + nval = ((x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f); + outlet_float(x->x_obj.ob_outlet, nval); +} + +void random_fl_low(t_random_fl *x, t_floatarg f) +{ + if(f >= x->x_g) { + post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", + SMALLEST_RANGE, + x->x_g - SMALLEST_RANGE); + x->x_f = x->x_g - SMALLEST_RANGE; + } else x->x_f = f; +} + +void random_fl_upp(t_random_fl *x, t_floatarg f) +{ + if(f <= x->x_f) { + post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", + SMALLEST_RANGE, + x->x_f + SMALLEST_RANGE); + x->x_g = x->x_f + SMALLEST_RANGE; + } else x->x_g = f; +} + +static void random_fl_seed(t_random_fl *x, float f, float glob) +{ + x->x_state = f; +} + +void random_fl_setup(void) +{ + random_fl_class = class_new(gensym("random_fl"), (t_newmethod)random_fl_new, 0, + sizeof(t_random_fl), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(random_fl_class, random_fl_bang); + class_addmethod(random_fl_class, (t_method)random_fl_low, gensym("fl1"), A_FLOAT, 0); + class_addmethod(random_fl_class, (t_method)random_fl_upp, gensym("fl2"), A_FLOAT, 0); + + class_addmethod(random_fl_class, (t_method)random_fl_seed, + gensym("seed"), A_FLOAT, 0); +} diff --git a/random_fl~-help.pd b/random_fl~-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/random_fl~-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/random_fl~.c b/random_fl~.c new file mode 100644 index 0000000..83b4347 --- /dev/null +++ b/random_fl~.c @@ -0,0 +1,100 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static int makeseed(void); +static int rand_random_fl(int); + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +static int rand_random_fl(seed) { + int q; + double state; + + /* The following parameters are recommended settings based on research + uncomment the one you want. */ + + double a = 1389796, m = RAND_MAX; + /* static double a = 950975, m = 2147483647; */ + /* static double a = 3467255, m = 21474836472; */ + /* static double a = 657618, m = 4294967291; */ + /* static double a = 93167, m = 4294967291; */ + /* static double a = 1345659, m = 4294967291; */ + + state = seed; + state *= a; + q = state / m; + state -= q*m; + return state; +} + +/* ------------------------------- random_fl signal version -------------------- */ + +static t_class *random_fl_tilde_class; + +typedef struct _random_fl_tilde +{ + t_object x_obj; + unsigned int x_state; // current seed +} t_random_fl_tilde; + +static void *random_fl_tilde_new() +{ + t_random_fl_tilde *x = (t_random_fl_tilde *)pd_new(random_fl_tilde_class); + x->x_state = makeseed(); + outlet_new(&x->x_obj, gensym("signal")); + return (x); +} + +static void random_fl_tilde_seed(t_random_fl_tilde *x, float f, float glob) +{ + x->x_state = f; +} + +static t_int *random_fl_tilde_perform(t_int *w) +{ + t_random_fl_tilde *x = (t_random_fl_tilde *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = (int)(w[3]); + + while (n--) { + // generate new noise sample + x->x_state = rand_random_fl(x->x_state); + *out++ = (t_float)x->x_state / RAND_MAX * 2 - 1; + } + + return (w+4); +} + +static void random_fl_tilde_dsp(t_random_fl_tilde *x, t_signal **sp) +{ + dsp_add(random_fl_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); +} + +void random_fl_tilde_setup(void) +{ + random_fl_tilde_class = class_new(gensym("random_fl~"), + (t_newmethod)random_fl_tilde_new, 0, + sizeof(t_random_fl_tilde), 0, 0); + class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_seed, + gensym("seed"), A_FLOAT, 0); + class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_dsp, gensym("dsp"), 0); +} diff --git a/random_icg-help.pd b/random_icg-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/random_icg-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/random_icg.c b/random_icg.c new file mode 100644 index 0000000..a1d76f1 --- /dev/null +++ b/random_icg.c @@ -0,0 +1,173 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static unsigned random_icg_INVERSE_seed (); +static int makeseed(void); +static int rand_random_icg(int, int); +static unsigned int rand_random_icg_INVERSE_seed(int, int); + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +static int rand_random_icg(seed, p) +{ + static int a, b, q, r; + int state; + unsigned int inv; + a = 22211, b = 11926380,q = 96685, r = 12518; + /* static int p = 2147483053, a = 858993221, b = 1,q = 2, r = 429496611;*/ + /* static int p = 2147483053, a = 579, b = 24456079, q = 3708951, r = 424;*/ + /* static int p = 2147483053, a = 11972, b = 62187060,q = 179375, r = 5553;*/ + /* static int p = 2147483053, a = 21714, b = 94901263,q = 98898, r = 11881;*/ + /* static int p = 2147483053, a = 4594, b = 44183289,q = 467453, r = 3971;*/ + /* static int p = 2147483647, a = 1288490188, b = 1, q = 1, r = 858993459;*/ + /* static int p = 2147483647, a = 9102, b = 36884165, q = 235935, r =3277;*/ + /* static int p = 2147483647, a = 14288, b = 758634, q = 150299, r = 11535;*/ + /* static int p = 2147483647, a = 21916, b = 71499791, q = 97987, r = 555;*/ + /* static int p = 2147483647, a = 28933, b = 59217914, q = 74222, r = 18521;*/ + /* static int p = 2147483647, a = 31152, b = 48897674, q = 68935, r = 20527;*/ + + // state = seed; + + inv = rand_random_icg_INVERSE_seed(seed, p); + + state = a*(inv % q) - r*(inv / q) + b; + + if (state < 0) state += p; + else if (state >= state) state -= p; + + return state; +} + +/* Modular Inversion using the extended Euclidean alg. for GCD */ +/***************************************************************/ +static unsigned rand_random_icg_INVERSE_seed (int state, int p) +{ + unsigned int q,d; + signed int u,v,inv,t; + + if (state <= 1) return(state); + + d = p; inv = 0; v = 1; u = state; + + do { + q = d / u; + t = d % u; + d = u; + u = t; + t = inv - q*v; + inv = v; + v = t; + } while (u != 0); + + if (inv < 0 ) inv += p; + +/* if (1 != d) */ +/* post ("inverse_iter: Can't invert !"); */ + + return(inv); +} + +/* -------------------------- random_icg ------------------------------ */ +/* Inverse Congruential generator. This generator is quite a bit slower than the other ones on this page. and it */ +/* fails some statistical tests. The main factor in its favor is that its properties tend to be the opposite of linear congruential */ +/* generators. I.e. this generator is very likely to be good for those applications where linear congruential generators are */ +/* bad. You can choose among several parameters. */ + +/* inversive congruential generator. */ + +static t_class *random_icg_class; + +typedef struct _random_icg +{ + t_object x_obj; + t_float x_f; // lower limit + t_float x_g; // upper limit + t_float x_p; // 1st shared parameter of iter function .. + unsigned int x_state; // current seed +} t_random_icg; + +static void *random_icg_new(t_floatarg f, t_floatarg g) +{ + t_random_icg *x = (t_random_icg *)pd_new(random_icg_class); + x->x_f = (f) ? f : 0; + x->x_g = (g) ? g : RAND_MAX; + x->x_p = 2147483053; + //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); + x->x_state = makeseed(); + 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")); + outlet_new(&x->x_obj, &s_float); + return (x); +} + +static void random_icg_bang(t_random_icg *x) +{ + double nval; + + x->x_state = rand_random_icg(x->x_state, x->x_p); + + nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f); + + // hakc, why is it out of range? + if(nval < (double)x->x_f) { + random_icg_bang(x); + } else { + outlet_float(x->x_obj.ob_outlet, nval); + } +} + +void random_icg_low(t_random_icg *x, t_floatarg f) +{ + if(f >= x->x_g) { + post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", + SMALLEST_RANGE, + x->x_g - SMALLEST_RANGE); + x->x_f = x->x_g - SMALLEST_RANGE; + } else x->x_f = f; +} + +void random_icg_upp(t_random_icg *x, t_floatarg f) +{ + if(f <= x->x_f) { + post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", + SMALLEST_RANGE, + x->x_f + SMALLEST_RANGE); + x->x_g = x->x_f + SMALLEST_RANGE; + } else x->x_g = f; +} + +static void random_icg_seed(t_random_icg *x, float f, float glob) +{ + x->x_state = f; +} + +void random_icg_setup(void) +{ + random_icg_class = class_new(gensym("random_icg"), (t_newmethod)random_icg_new, 0, + sizeof(t_random_icg), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(random_icg_class, random_icg_bang); + class_addmethod(random_icg_class, (t_method)random_icg_low, gensym("fl1"), A_FLOAT, 0); + class_addmethod(random_icg_class, (t_method)random_icg_upp, gensym("fl2"), A_FLOAT, 0); + + class_addmethod(random_icg_class, (t_method)random_icg_seed, + gensym("seed"), A_FLOAT, 0); +} diff --git a/random_icg~-help.pd b/random_icg~-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/random_icg~-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/random_icg~.c b/random_icg~.c new file mode 100644 index 0000000..178814b --- /dev/null +++ b/random_icg~.c @@ -0,0 +1,164 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static int makeseed(void); +static int rand_random_icg(int, int); +static unsigned int rand_random_icg_INVERSE_seed(int, int); + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +static int rand_random_icg(seed, p) +{ + static int a, b, q, r; + int state; + unsigned int inv; + a = 22211, b = 11926380,q = 96685, r = 12518; + /* static int p = 2147483053, a = 858993221, b = 1,q = 2, r = 429496611;*/ + /* static int p = 2147483053, a = 579, b = 24456079, q = 3708951, r = 424;*/ + /* static int p = 2147483053, a = 11972, b = 62187060,q = 179375, r = 5553;*/ + /* static int p = 2147483053, a = 21714, b = 94901263,q = 98898, r = 11881;*/ + /* static int p = 2147483053, a = 4594, b = 44183289,q = 467453, r = 3971;*/ + /* static int p = 2147483647, a = 1288490188, b = 1, q = 1, r = 858993459;*/ + /* static int p = 2147483647, a = 9102, b = 36884165, q = 235935, r =3277;*/ + /* static int p = 2147483647, a = 14288, b = 758634, q = 150299, r = 11535;*/ + /* static int p = 2147483647, a = 21916, b = 71499791, q = 97987, r = 555;*/ + /* static int p = 2147483647, a = 28933, b = 59217914, q = 74222, r = 18521;*/ + /* static int p = 2147483647, a = 31152, b = 48897674, q = 68935, r = 20527;*/ + + // state = seed; + + inv = rand_random_icg_INVERSE_seed(seed, p); + + state = a*(inv % q) - r*(inv / q) + b; + + if (state < 0) state += p; + else if (state >= state) state -= p; + + return state; +} + +/* Modular Inversion using the extended Euclidean alg. for GCD */ +/***************************************************************/ +static unsigned rand_random_icg_INVERSE_seed (int state, int p) +{ + unsigned int q,d; + signed int u,v,inv,t; + + if (state <= 1) return(state); + + d = p; inv = 0; v = 1; u = state; + + do { + q = d / u; + t = d % u; + d = u; + u = t; + t = inv - q*v; + inv = v; + v = t; + } while (u != 0); + + if (inv < 0 ) inv += p; + +/* if (1 != d) */ +/* post ("inverse_iter: Can't invert !"); */ + + return(inv); +} + +/* -------------------------- random_icg ------------------------------ */ +/* inverse congruential generator. */ + +static t_class *random_icg_tilde_class; + +typedef struct _random_icg_tilde +{ + t_object x_obj; + t_float x_f; // lower limit + t_float x_g; // upper limit + t_float x_p; // 1st shared parameter of iter function .. + unsigned int x_state; // current seed +} t_random_icg_tilde; + +static void *random_icg_tilde_new() +{ + t_random_icg_tilde *x = (t_random_icg_tilde *)pd_new(random_icg_tilde_class); +/* x->x_f = (f) ? f : 0; */ +/* x->x_g = (g) ? g : RAND_MAX; */ + x->x_p = 2147483053; + //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); + x->x_state = makeseed(); + outlet_new(&x->x_obj, gensym("signal")); + return (x); +} + +static void random_icg_tilde_bang(t_random_icg_tilde *x) +{ + double nval; + + x->x_state = rand_random_icg(x->x_state, x->x_p); + + nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f); + + // hakc, why is it out of range? + if(nval < (double)x->x_f) { + random_icg_tilde_bang(x); + } else { + outlet_float(x->x_obj.ob_outlet, nval); + } +} + +static void random_icg_tilde_seed(t_random_icg_tilde *x, float f, float glob) +{ + x->x_state = f; +} + +static t_int *random_icg_tilde_perform(t_int *w) +{ + t_random_icg_tilde *x = (t_random_icg_tilde *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = (int)(w[3]); + + while (n--) { + // generate new noise sample + x->x_state = rand_random_icg(x->x_state, x->x_p); + *out++ = (t_float)(x->x_state / x->x_p - 1) * 2 - 1; + } + + return (w+4); +} + + +static void random_icg_tilde_dsp(t_random_icg_tilde *x, t_signal **sp) +{ + dsp_add(random_icg_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); +} + + +void random_icg_tilde_setup(void) +{ + random_icg_tilde_class = class_new(gensym("random_icg~"), (t_newmethod)random_icg_tilde_new, 0, + sizeof(t_random_icg_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_seed, + gensym("seed"), A_FLOAT, 0); + class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_dsp, gensym("dsp"), 0); +} diff --git a/random_tw-help.pd b/random_tw-help.pd new file mode 100644 index 0000000..d913f39 --- /dev/null +++ b/random_tw-help.pd @@ -0,0 +1,223 @@ +#N canvas 33 162 966 505 10; +#X msg 197 150 bang; +#X floatatom 244 150 5 0 0 0 - - -; +#X floatatom 197 218 10 0 0 0 - - -; +#X floatatom 53 162 5 0 0 0 - - -; +#X msg 54 111 bang; +#X floatatom 289 152 5 0 0 0 - - -; +#X obj 53 135 random 100; +#X msg 427 151 bang; +#X floatatom 474 151 5 0 0 0 - - -; +#X floatatom 427 219 10 0 0 0 - - -; +#X floatatom 519 153 5 0 0 0 - - -; +#X obj 196 183 random1 0 1; +#X obj 426 184 random_fl 0 1; +#X msg 672 152 bang; +#X floatatom 719 152 5 0 0 0 - - -; +#X floatatom 672 220 10 0 0 0 - - -; +#X floatatom 764 154 5 0 0 0 - - -; +#X obj 671 185 random_icg 0 1; +#X msg 197 276 bang; +#X floatatom 244 276 5 0 0 0 - - -; +#X floatatom 197 344 10 0 0 0 - - -; +#X floatatom 289 278 5 0 0 0 - - -; +#X text 193 251 random_icg lowerlimit \, upperlimit; +#X msg 368 288 help; +#X text 253 10 the random number generatorse; +#X obj 539 406 dist_normal; +#X msg 540 356 bang; +#X obj 579 357 metro 100; +#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 196 309 random_tw 0 1; +#X floatatom 637 334 5 0 0 0 - - -; +#N canvas 0 0 600 400 streamview 0; +#N canvas 0 0 450 300 graph2 0; +#X array randstream 100 float 0; +#X coords 0 2 99 -2 200 140 1; +#X restore 92 222 graph; +#X obj 146 144 tabwrite randstream; +#X obj 200 63 count; +#X obj 200 88 % 100; +#X obj 156 28 t f b; +#X obj 49 15 inlet; +#X connect 2 0 3 0; +#X connect 3 0 1 1; +#X connect 4 0 1 0; +#X connect 4 1 2 0; +#X connect 5 0 4 0; +#X restore 570 433 pd streamview; +#N canvas 306 24 679 400 distview 0; +#N canvas 0 0 450 300 graph1 0; +#X array randview1 100 float 0; +#X coords 0 200 99 0 400 200 1; +#X restore 248 31 graph; +#X obj 28 26 inlet; +#X obj 45 355 tabwrite randview1; +#X obj 136 201 * 100; +#X obj 136 225 int; +#X obj 136 153 + 2; +#X obj 45 280 tabread randview1; +#X obj 136 176 / 4; +#X obj 136 250 t f f; +#X obj 45 304 t f b; +#X obj 45 329 + 1; +#X obj 136 129 t f; +#X connect 1 0 11 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 5 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 3 0; +#X connect 8 0 6 0; +#X connect 8 1 2 1; +#X connect 9 0 10 0; +#X connect 10 0 2 0; +#X connect 11 0 5 0; +#X restore 550 458 pd distview; +#X obj 540 381 t b; +#X floatatom 477 430 5 0 0 0 - - -; +#N canvas 0 0 600 400 seedit 0; +#X msg 284 154 seed \$1; +#X obj 284 107 utime; +#X msg 304 74 bang; +#X obj 254 28 loadbang; +#X obj 284 130 * 1e+06; +#X obj 360 167 until; +#X msg 455 156 bang; +#X obj 359 194 random 2.14748e+08; +#X msg 359 267 seed \$1; +#X msg 385 294 seed \$1; +#X msg 412 318 seed \$1; +#X msg 439 267 seed \$1; +#X msg 466 293 seed \$1; +#X obj 254 50 t b b; +#X obj 195 155 print seed1; +#X obj 143 360 outlet; +#X obj 204 361 outlet; +#X obj 264 361 outlet; +#X obj 317 361 outlet; +#X obj 367 361 outlet; +#X text 35 9 seed one random obj \, which generates the seeds for all +the others.; +#X obj 359 218 serialize 6; +#X msg 360 140 6; +#X obj 359 242 unpack f f f f f f; +#X msg 485 317 seed \$1; +#X obj 420 359 outlet; +#X connect 0 0 7 0; +#X connect 1 1 4 0; +#X connect 2 0 1 0; +#X connect 3 0 13 0; +#X connect 4 0 0 0; +#X connect 4 0 14 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 21 0; +#X connect 8 0 15 0; +#X connect 9 0 16 0; +#X connect 10 0 17 0; +#X connect 11 0 18 0; +#X connect 12 0 19 0; +#X connect 13 0 22 0; +#X connect 13 1 1 0; +#X connect 21 0 23 0; +#X connect 22 0 5 0; +#X connect 23 0 8 0; +#X connect 23 1 9 0; +#X connect 23 2 10 0; +#X connect 23 3 11 0; +#X connect 23 4 12 0; +#X connect 23 5 24 0; +#X connect 24 0 25 0; +#X restore 258 33 pd seedit; +#X text 37 79 std pd random; +#X text 197 124 linear congruential generator; +#X text 197 77 creation arguments for the extra randoms are:; +#X text 205 92 \, defaults to 0 respectively +RAND_MAX; +#X text 545 17 see also:; +#X obj 545 40 utime; +#X text 428 129 another lcg method ..; +#X text 668 127 inverse linear congruential generator; +#X text 536 249 normal distribution mean 0 and dist 1; +#X text 536 264 right now it uses random1 for the actual rand values +; +#X text 537 278 but later on it should take one of the randoms as creation +argument \, so yu can specify which generator is being used.; +#X text 198 106 they all output floats); +#X text 540 311 also \, there is some burst at the upper and lower +limits; +#N canvas 622 685 592 356 signalversions 1; +#X obj 68 131 random1~; +#X obj 368 239 tabwrite~ randomix_test; +#N canvas 0 0 450 300 graph1 0; +#X array randomix_test 64 float 1; +#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 +0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 +0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 +-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 +-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 +-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 +-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 +-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 +0.0862183 -0.995607 0.585034 0.205198 -0.337256; +#X coords 0 1 63 -1 200 140 1; +#X restore 351 23 graph; +#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 440 184 5 0 0 0 - - -; +#X obj 382 201 metro 100; +#X msg 342 201 bang; +#X obj 73 295 dac~; +#X floatatom 140 220 5 0 0 0 - - -; +#X msg 68 58 seed 30000; +#X obj 142 131 random_fl~; +#X text 120 98 etc ..; +#X obj 229 131 random_icg~; +#X obj 81 241 fader 75; +#X connect 0 0 13 0; +#X connect 3 0 5 0; +#X connect 4 0 5 1; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 13 1; +#X connect 12 0 1 0; +#X connect 12 0 13 0; +#X connect 13 0 7 0; +#X connect 13 1 7 1; +#X restore 98 421 pd signalversions; +#X connect 0 0 11 0; +#X connect 1 0 11 1; +#X connect 4 0 6 0; +#X connect 5 0 11 2; +#X connect 6 0 3 0; +#X connect 7 0 12 0; +#X connect 8 0 12 1; +#X connect 10 0 12 2; +#X connect 11 0 2 0; +#X connect 12 0 9 0; +#X connect 13 0 17 0; +#X connect 14 0 17 1; +#X connect 16 0 17 2; +#X connect 17 0 15 0; +#X connect 18 0 29 0; +#X connect 19 0 29 1; +#X connect 21 0 29 2; +#X connect 23 0 29 0; +#X connect 25 0 31 0; +#X connect 25 0 32 0; +#X connect 25 0 34 0; +#X connect 26 0 33 0; +#X connect 27 0 33 0; +#X connect 28 0 27 0; +#X connect 29 0 20 0; +#X connect 30 0 27 1; +#X connect 33 0 25 0; +#X connect 35 0 6 0; +#X connect 35 1 11 0; +#X connect 35 2 12 0; +#X connect 35 3 17 0; +#X connect 35 4 29 0; diff --git a/random_tw.c b/random_tw.c new file mode 100644 index 0000000..6e7fba8 --- /dev/null +++ b/random_tw.c @@ -0,0 +1,181 @@ +/* + (c) 2002:cxc@web.fm + randomix: various PRNG's + code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html + let's check it out + */ + +#include +#include +#include + +#define SMALLEST_RANGE .0001 + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +static int makeseed(void) +{ + static unsigned int random1_nextseed = 1489853723; + random1_nextseed = random1_nextseed * 435898247 + 938284287; + return (random1_nextseed & 0x7fffffff); +} + +/* -------------------------- random_tw ------------------------------ */ +/* Combination of three tausworth generators. Has parameters for two different generators. Fast and excellent. */ +/* Combination of 3 tausworth generators -- assumes 32-bit integers */ + +static t_class *random_tw_class; + +typedef struct _random_tw +{ + t_object x_obj; + t_float x_f; // lower limit + t_float x_g; // upper limit + + t_int x_s1; + t_int x_s2; + t_int x_s3; + + t_int x_mask1; + t_int x_mask2; + t_int x_mask3; + + t_int x_shft1; + t_int x_shft2; + t_int x_shft3; + t_int x_k1; + t_int x_k2; + t_int x_k3; + + t_int x_q1; + t_int x_q2; + t_int x_q3; + t_int x_p1; + t_int x_p2; + t_int x_p3; + + unsigned int x_state; // current seed +} t_random_tw; + +void random_tw_rand_seed (t_random_tw *x, unsigned int a, unsigned int b, unsigned int c) +{ + static unsigned int zf = 4294967295U; + + x->x_shft1 = x->x_k1 - x->x_p1; + x->x_shft2=x->x_k2-x->x_p2; + x->x_shft3=x->x_k3-x->x_p3; + x->x_mask1 = zf << (32-x->x_k1); + x->x_mask2 = zf << (32-x->x_k2); + x->x_mask3 = zf << (32-x->x_k3); + if (a > (unsigned int)(1<x_shft1)) x->x_s1 = a; + if (b > (unsigned int)(1<x_shft2)) x->x_s2 = b; + if (c > (unsigned int)(1<x_shft3)) x->x_s3 = c; + // rand(); +} + +static void *random_tw_new(t_floatarg f, t_floatarg g) +{ + t_random_tw *x = (t_random_tw *)pd_new(random_tw_class); + + x->x_f = (f) ? f : 0; + x->x_g = (g) ? g : RAND_MAX; + //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); + x->x_state = makeseed(); + + x->x_s1=390451501; + x->x_s2=613566701; + x->x_s3=858993401; + + x->x_k1=31; + x->x_k2=29; + x->x_k3=28; + + x->x_q1=13; + x->x_q2=2; + x->x_q3=3; + x->x_p1=12; + x->x_p2=4; + x->x_p3=17; + +/* x->x_q1=3; */ +/* x->x_q2=2; */ +/* x->x_q3=13; */ +/* x->x_p1=20; */ +/* x->x_p2=16; */ +/* x->x_p3=7; */ + + random_tw_rand_seed(x, makeseed(),makeseed(),makeseed()); + 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")); + outlet_new(&x->x_obj, &s_float); + return (x); +} + + +static void random_tw_bang(t_random_tw *x) +{ + unsigned int b; + double nval; + static unsigned int zf = 4294967295U; + + b = ((x->x_s1 << x->x_q1)^x->x_s1) >> x->x_shft1; + x->x_s1 = ((x->x_s1 & x->x_mask1) << x->x_p1) ^ b; + b = ((x->x_s2 << x->x_q2) ^ x->x_s2) >> x->x_shft2; + x->x_s2 = ((x->x_s2 & x->x_mask2) << x->x_p2) ^ b; + b = ((x->x_s3 << x->x_q3) ^ x->x_s3) >> x->x_shft3; + x->x_s3 = ((x->x_s3 & x->x_mask3) << x->x_p3) ^ b; + nval = (((double)(x->x_s1 ^ x->x_s2 ^ x->x_s3) / (double)(zf) + 0.5) * (double)(x->x_g - x->x_f) + (double)x->x_f); + + //nval = ((x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f); + //post("cxc/randomix.c: current rand: %f", nval); + outlet_float(x->x_obj.ob_outlet, nval); +} + +void random_tw_low(t_random_tw *x, t_floatarg f) +{ + if(f >= x->x_g) { + post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", + SMALLEST_RANGE, + x->x_g - SMALLEST_RANGE); + x->x_f = x->x_g - SMALLEST_RANGE; + } else x->x_f = f; +} + +void random_tw_upp(t_random_tw *x, t_floatarg f) +{ + if(f <= x->x_f) { + post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", + SMALLEST_RANGE, + x->x_f + SMALLEST_RANGE); + x->x_g = x->x_f + SMALLEST_RANGE; + } else x->x_g = f; +} + +static void random_tw_seed(t_random_tw *x, float f, float glob) +{ + //x->x_state = f; + // questionable .. dont quite get how this one's seeded .. + random_tw_rand_seed(x, (int)f, (int)(f*0.455777), (int)f); +} + +static void random_tw_help(t_random_tw *x) +{ + post("RAND_MAX: %d",RAND_MAX); + post("range: %f - %f", x->x_f, x->x_g); +} + +void random_tw_setup(void) +{ + random_tw_class = class_new(gensym("random_tw"), (t_newmethod)random_tw_new, 0, + sizeof(t_random_tw), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(random_tw_class, random_tw_bang); + class_addmethod(random_tw_class, (t_method)random_tw_low, gensym("fl1"), A_FLOAT, 0); + class_addmethod(random_tw_class, (t_method)random_tw_upp, gensym("fl2"), A_FLOAT, 0); + + class_addmethod(random_tw_class, (t_method)random_tw_seed, + gensym("seed"), A_FLOAT, 0); + class_addmethod(random_tw_class, (t_method)random_tw_help, + gensym("help"), 0, 0); +} diff --git a/randomix.c b/randomix.c deleted file mode 100644 index 4700766..0000000 --- a/randomix.c +++ /dev/null @@ -1,874 +0,0 @@ -/* - (c) 2002:cxc@web.fm - randomix: various PRNG's - code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html - let's check it out - */ - -#include -#include -#include - -#define SMALLEST_RANGE .0001 - -#ifndef RAND_MAX -#define RAND_MAX 2147483647 -#endif - -static unsigned random_icg_INVERSE_seed (); -static int makeseed(void); -static int rand_random1(int); -static int rand_random_fl(int); -static int rand_random_icg(int, int); -static unsigned int rand_random_icg_INVERSE_seed(int, int); -//static void random_tw_rand_seed(t_class, int, int, int); - -static int makeseed(void) -{ - static unsigned int random1_nextseed = 1489853723; - random1_nextseed = random1_nextseed * 435898247 + 938284287; - return (random1_nextseed & 0x7fffffff); -} - -/* -------------------------- random1 ------------------------------ */ -/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ -static int rand_random1(seed) -{ - int state; - - //unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901; - // unsigned int a = 1588635695, m = (RAND_MAX * 2), q = 2, r = 1117695901; - - /* static unsigned int a = 1223106847, m = 4294967291U, q = 3, r = 625646750;*/ - /* static unsigned int a = 279470273, m = 4294967291U, q = 15, r = 102913196;*/ - //static unsigned int a = 1583458089, m = 2147483647, q = 1, r = 564025558; - static unsigned int a = 784588716, m = 2147483647, q = 2, r = 578306215; - /* static unsigned int a = 16807, m = 2147483647, q = 127773, r = 2836; */ - /* static unsigned int a = 950706376, m = 2147483647, q = 2, r = 246070895; */ - - //state = (seed) ? seed : makeseed(); - state = seed; - state = a*(state % q) - r*(state / q); - return (state); -} - -static int rand_random_fl(seed) { - int q; - double state; - - /* The following parameters are recommended settings based on research - uncomment the one you want. */ - - double a = 1389796, m = RAND_MAX; - /* static double a = 950975, m = 2147483647; */ - /* static double a = 3467255, m = 21474836472; */ - /* static double a = 657618, m = 4294967291; */ - /* static double a = 93167, m = 4294967291; */ - /* static double a = 1345659, m = 4294967291; */ - - state = seed; - state *= a; - q = state / m; - state -= q*m; - return state; -} - -static int rand_random_icg(seed, p) -{ - static int a, b, q, r; - int state; - unsigned int inv; - a = 22211, b = 11926380,q = 96685, r = 12518; - /* static int p = 2147483053, a = 858993221, b = 1,q = 2, r = 429496611;*/ - /* static int p = 2147483053, a = 579, b = 24456079, q = 3708951, r = 424;*/ - /* static int p = 2147483053, a = 11972, b = 62187060,q = 179375, r = 5553;*/ - /* static int p = 2147483053, a = 21714, b = 94901263,q = 98898, r = 11881;*/ - /* static int p = 2147483053, a = 4594, b = 44183289,q = 467453, r = 3971;*/ - /* static int p = 2147483647, a = 1288490188, b = 1, q = 1, r = 858993459;*/ - /* static int p = 2147483647, a = 9102, b = 36884165, q = 235935, r =3277;*/ - /* static int p = 2147483647, a = 14288, b = 758634, q = 150299, r = 11535;*/ - /* static int p = 2147483647, a = 21916, b = 71499791, q = 97987, r = 555;*/ - /* static int p = 2147483647, a = 28933, b = 59217914, q = 74222, r = 18521;*/ - /* static int p = 2147483647, a = 31152, b = 48897674, q = 68935, r = 20527;*/ - - // state = seed; - - inv = rand_random_icg_INVERSE_seed(seed, p); - - state = a*(inv % q) - r*(inv / q) + b; - - if (state < 0) state += p; - else if (state >= state) state -= p; - - return state; -} - -/* Modular Inversion using the extended Euclidean alg. for GCD */ -/***************************************************************/ -static unsigned rand_random_icg_INVERSE_seed (int state, int p) -{ - unsigned int q,d; - signed int u,v,inv,t; - - if (state <= 1) return(state); - - d = p; inv = 0; v = 1; u = state; - - do { - q = d / u; - t = d % u; - d = u; - u = t; - t = inv - q*v; - inv = v; - v = t; - } while (u != 0); - - if (inv < 0 ) inv += p; - -/* if (1 != d) */ -/* post ("inverse_iter: Can't invert !"); */ - - return(inv); -} - -/* -------------------------- random1 ------------------------------ */ -/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ - -static t_class *random1_class; - -typedef struct _random1 -{ - t_object x_obj; - t_float x_f; // lower limit - t_float x_g; // upper limit - unsigned int x_state; // current seed -} t_random1; - -static void *random1_new(t_floatarg f, t_floatarg g) -{ - t_random1 *x = (t_random1 *)pd_new(random1_class); - x->x_f = (f) ? f : 0; - x->x_g = (g) ? g : RAND_MAX; - //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); - x->x_state = makeseed(); - 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")); - outlet_new(&x->x_obj, &s_float); - return (x); -} - -/* -------------------------- random_fl ------------------------------ */ -/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */ -/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */ -/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */ - -/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ -/* works if your floating pt. mantissa has at least 53 bits. - faster than other versions */ -static void random1_bang(t_random1 *x) -{ - int n = x->x_f; - double nval; - unsigned int m; - // this seems weird? - m = (RAND_MAX * 2); - // unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901; - - // post("cxc/randomix.c: x_state: %d",x->x_state); - x->x_state = rand_random1(x->x_state); - nval = ((double)x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f; - // post("cxc/randomix.c: lolim: %f, uplim: %f", x->x_f, x->x_g); - // post("cxc/randomix.c: nval: %f",nval); - outlet_float(x->x_obj.ob_outlet, nval); -} - -void random1_low(t_random1 *x, t_floatarg f) -{ - if(f >= x->x_g) { - post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", - SMALLEST_RANGE, - x->x_g - SMALLEST_RANGE); - x->x_f = x->x_g - SMALLEST_RANGE; - } else x->x_f = f; -} - -void random1_upp(t_random1 *x, t_floatarg f) -{ - if(f <= x->x_f) { - post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", - SMALLEST_RANGE, - x->x_f + SMALLEST_RANGE); - x->x_g = x->x_f + SMALLEST_RANGE; - } else x->x_g = f; -} - -static void random1_seed(t_random1 *x, float f, float glob) -{ - x->x_state = f; -} - -void random1_setup(void) -{ - random1_class = class_new(gensym("random1"), (t_newmethod)random1_new, 0, - sizeof(t_random1), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addbang(random1_class, random1_bang); - class_addmethod(random1_class, (t_method)random1_low, gensym("fl1"), A_FLOAT, 0); - class_addmethod(random1_class, (t_method)random1_upp, gensym("fl2"), A_FLOAT, 0); - - class_addmethod(random1_class, (t_method)random1_seed, - gensym("seed"), A_FLOAT, 0); -} - - -/* -------------------------- random1 ------------------------------ */ -/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ -/* signal version */ - -static t_class *random1_tilde_class; - -typedef struct _random1_tilde -{ - t_object x_obj; - unsigned int x_state; // current seed -} t_random1_tilde; - -static void *random1_tilde_new() -{ - t_random1_tilde *x = (t_random1_tilde *)pd_new(random1_tilde_class); - x->x_state = makeseed(); - outlet_new(&x->x_obj, gensym("signal")); - return (x); -} - -static void random1_tilde_seed(t_random1_tilde *x, float f, float glob) -{ - x->x_state = f; -} - -static t_int *random1_tilde_perform(t_int *w) -{ - t_random1_tilde *x = (t_random1_tilde *)(w[1]); - t_float *out = (t_float *)(w[2]); - int n = (int)(w[3]); - - while (n--) { - // generate new noise sample - x->x_state = rand_random1(x->x_state); - *out++ = (t_float)x->x_state / RAND_MAX - 1; - } - - return (w+4); -} - -static void random1_tilde_dsp(t_random1_tilde *x, t_signal **sp) -{ - dsp_add(random1_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); -} - -void random1_tilde_setup(void) -{ - random1_tilde_class = class_new(gensym("random1~"), - (t_newmethod)random1_tilde_new, - 0, sizeof(t_random1_tilde), 0, 0); - class_addmethod(random1_tilde_class, (t_method)random1_tilde_seed,gensym("seed"), A_FLOAT, 0); - class_addmethod(random1_tilde_class, (t_method)random1_tilde_dsp, gensym("dsp"), 0); -} - - - -/* -------------------------- random_fl ------------------------------ */ -/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */ -/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */ -/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */ - -/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */ -/* works if your floating pt. mantissa has at least 53 bits. - faster than other versions */ - -static t_class *random_fl_class; - -typedef struct _random_fl -{ - t_object x_obj; - t_float x_f; // lower limit - t_float x_g; // upper limit - unsigned int x_state; // current seed -} t_random_fl; - -static void *random_fl_new(t_floatarg f, t_floatarg g) -{ - t_random_fl *x = (t_random_fl *)pd_new(random_fl_class); - x->x_f = (f) ? f : 0; - x->x_g = (g) ? g : RAND_MAX; - //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); - x->x_state = makeseed(); - 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")); - outlet_new(&x->x_obj, &s_float); - return (x); -} - -void random_fl_bang(t_random_fl *x) -{ - int n = x->x_f; - int q; - double nval; - double m; - - m = RAND_MAX; - x->x_state = rand_random_fl(x->x_state); - nval = ((x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f); - outlet_float(x->x_obj.ob_outlet, nval); -} - -void random_fl_low(t_random_fl *x, t_floatarg f) -{ - if(f >= x->x_g) { - post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", - SMALLEST_RANGE, - x->x_g - SMALLEST_RANGE); - x->x_f = x->x_g - SMALLEST_RANGE; - } else x->x_f = f; -} - -void random_fl_upp(t_random_fl *x, t_floatarg f) -{ - if(f <= x->x_f) { - post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", - SMALLEST_RANGE, - x->x_f + SMALLEST_RANGE); - x->x_g = x->x_f + SMALLEST_RANGE; - } else x->x_g = f; -} - -static void random_fl_seed(t_random_fl *x, float f, float glob) -{ - x->x_state = f; -} - -void random_fl_setup(void) -{ - random_fl_class = class_new(gensym("random_fl"), (t_newmethod)random_fl_new, 0, - sizeof(t_random_fl), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addbang(random_fl_class, random_fl_bang); - class_addmethod(random_fl_class, (t_method)random_fl_low, gensym("fl1"), A_FLOAT, 0); - class_addmethod(random_fl_class, (t_method)random_fl_upp, gensym("fl2"), A_FLOAT, 0); - - class_addmethod(random_fl_class, (t_method)random_fl_seed, - gensym("seed"), A_FLOAT, 0); -} - -/* ------------------------------- random_fl signal version -------------------- */ - -static t_class *random_fl_tilde_class; - -typedef struct _random_fl_tilde -{ - t_object x_obj; - unsigned int x_state; // current seed -} t_random_fl_tilde; - -static void *random_fl_tilde_new() -{ - t_random_fl_tilde *x = (t_random_fl_tilde *)pd_new(random_fl_tilde_class); - x->x_state = makeseed(); - outlet_new(&x->x_obj, gensym("signal")); - return (x); -} - -static void random_fl_tilde_seed(t_random_fl_tilde *x, float f, float glob) -{ - x->x_state = f; -} - -static t_int *random_fl_tilde_perform(t_int *w) -{ - t_random_fl_tilde *x = (t_random_fl_tilde *)(w[1]); - t_float *out = (t_float *)(w[2]); - int n = (int)(w[3]); - - while (n--) { - // generate new noise sample - x->x_state = rand_random_fl(x->x_state); - *out++ = (t_float)x->x_state / RAND_MAX * 2 - 1; - } - - return (w+4); -} - -static void random_fl_tilde_dsp(t_random_fl_tilde *x, t_signal **sp) -{ - dsp_add(random_fl_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); -} - -void random_fl_tilde_setup(void) -{ - random_fl_tilde_class = class_new(gensym("random_fl~"), - (t_newmethod)random_fl_tilde_new, 0, - sizeof(t_random_fl_tilde), 0, 0); - class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_seed, - gensym("seed"), A_FLOAT, 0); - class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_dsp, gensym("dsp"), 0); -} - - - - -/* -------------------------- random_icg ------------------------------ */ -/* Inverse Congruential generator. This generator is quite a bit slower than the other ones on this page. and it */ -/* fails some statistical tests. The main factor in its favor is that its properties tend to be the opposite of linear congruential */ -/* generators. I.e. this generator is very likely to be good for those applications where linear congruential generators are */ -/* bad. You can choose among several parameters. */ - -/* inversive congruential generator. */ - -static t_class *random_icg_class; - -typedef struct _random_icg -{ - t_object x_obj; - t_float x_f; // lower limit - t_float x_g; // upper limit - t_float x_p; // 1st shared parameter of iter function .. - unsigned int x_state; // current seed -} t_random_icg; - -static void *random_icg_new(t_floatarg f, t_floatarg g) -{ - t_random_icg *x = (t_random_icg *)pd_new(random_icg_class); - x->x_f = (f) ? f : 0; - x->x_g = (g) ? g : RAND_MAX; - x->x_p = 2147483053; - //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); - x->x_state = makeseed(); - 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")); - outlet_new(&x->x_obj, &s_float); - return (x); -} - -static void random_icg_bang(t_random_icg *x) -{ - double nval; - - x->x_state = rand_random_icg(x->x_state, x->x_p); - - nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f); - - // hakc, why is it out of range? - if(nval < (double)x->x_f) { - random_icg_bang(x); - } else { - outlet_float(x->x_obj.ob_outlet, nval); - } -} - -void random_icg_low(t_random_icg *x, t_floatarg f) -{ - if(f >= x->x_g) { - post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", - SMALLEST_RANGE, - x->x_g - SMALLEST_RANGE); - x->x_f = x->x_g - SMALLEST_RANGE; - } else x->x_f = f; -} - -void random_icg_upp(t_random_icg *x, t_floatarg f) -{ - if(f <= x->x_f) { - post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", - SMALLEST_RANGE, - x->x_f + SMALLEST_RANGE); - x->x_g = x->x_f + SMALLEST_RANGE; - } else x->x_g = f; -} - -static void random_icg_seed(t_random_icg *x, float f, float glob) -{ - x->x_state = f; -} - -void random_icg_setup(void) -{ - random_icg_class = class_new(gensym("random_icg"), (t_newmethod)random_icg_new, 0, - sizeof(t_random_icg), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addbang(random_icg_class, random_icg_bang); - class_addmethod(random_icg_class, (t_method)random_icg_low, gensym("fl1"), A_FLOAT, 0); - class_addmethod(random_icg_class, (t_method)random_icg_upp, gensym("fl2"), A_FLOAT, 0); - - class_addmethod(random_icg_class, (t_method)random_icg_seed, - gensym("seed"), A_FLOAT, 0); -} - - -/* -------------------------- random_icg ------------------------------ */ -/* inverse congruential generator. */ - -static t_class *random_icg_tilde_class; - -typedef struct _random_icg_tilde -{ - t_object x_obj; - t_float x_f; // lower limit - t_float x_g; // upper limit - t_float x_p; // 1st shared parameter of iter function .. - unsigned int x_state; // current seed -} t_random_icg_tilde; - -static void *random_icg_tilde_new() -{ - t_random_icg_tilde *x = (t_random_icg_tilde *)pd_new(random_icg_tilde_class); -/* x->x_f = (f) ? f : 0; */ -/* x->x_g = (g) ? g : RAND_MAX; */ - x->x_p = 2147483053; - //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); - x->x_state = makeseed(); - outlet_new(&x->x_obj, gensym("signal")); - return (x); -} - -static void random_icg_tilde_bang(t_random_icg_tilde *x) -{ - double nval; - - x->x_state = rand_random_icg(x->x_state, x->x_p); - - nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f); - - // hakc, why is it out of range? - if(nval < (double)x->x_f) { - random_icg_tilde_bang(x); - } else { - outlet_float(x->x_obj.ob_outlet, nval); - } -} - -static void random_icg_tilde_seed(t_random_icg_tilde *x, float f, float glob) -{ - x->x_state = f; -} - -static t_int *random_icg_tilde_perform(t_int *w) -{ - t_random_icg_tilde *x = (t_random_icg_tilde *)(w[1]); - t_float *out = (t_float *)(w[2]); - int n = (int)(w[3]); - - while (n--) { - // generate new noise sample - x->x_state = rand_random_icg(x->x_state, x->x_p); - *out++ = (t_float)(x->x_state / x->x_p - 1) * 2 - 1; - } - - return (w+4); -} - - -static void random_icg_tilde_dsp(t_random_icg_tilde *x, t_signal **sp) -{ - dsp_add(random_icg_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); -} - - -void random_icg_tilde_setup(void) -{ - random_icg_tilde_class = class_new(gensym("random_icg~"), (t_newmethod)random_icg_tilde_new, 0, - sizeof(t_random_icg_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_seed, - gensym("seed"), A_FLOAT, 0); - class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_dsp, gensym("dsp"), 0); -} - - - -/* -------------------------- random_tw ------------------------------ */ -/* Combination of three tausworth generators. Has parameters for two different generators. Fast and excellent. */ -/* Combination of 3 tausworth generators -- assumes 32-bit integers */ - -static t_class *random_tw_class; - -typedef struct _random_tw -{ - t_object x_obj; - t_float x_f; // lower limit - t_float x_g; // upper limit - - t_int x_s1; - t_int x_s2; - t_int x_s3; - - t_int x_mask1; - t_int x_mask2; - t_int x_mask3; - - t_int x_shft1; - t_int x_shft2; - t_int x_shft3; - t_int x_k1; - t_int x_k2; - t_int x_k3; - - t_int x_q1; - t_int x_q2; - t_int x_q3; - t_int x_p1; - t_int x_p2; - t_int x_p3; - - unsigned int x_state; // current seed -} t_random_tw; - -void random_tw_rand_seed (t_random_tw *x, unsigned int a, unsigned int b, unsigned int c) -{ - static unsigned int zf = 4294967295U; - - x->x_shft1 = x->x_k1 - x->x_p1; - x->x_shft2=x->x_k2-x->x_p2; - x->x_shft3=x->x_k3-x->x_p3; - x->x_mask1 = zf << (32-x->x_k1); - x->x_mask2 = zf << (32-x->x_k2); - x->x_mask3 = zf << (32-x->x_k3); - if (a > (unsigned int)(1<x_shft1)) x->x_s1 = a; - if (b > (unsigned int)(1<x_shft2)) x->x_s2 = b; - if (c > (unsigned int)(1<x_shft3)) x->x_s3 = c; - // rand(); -} - -static void *random_tw_new(t_floatarg f, t_floatarg g) -{ - t_random_tw *x = (t_random_tw *)pd_new(random_tw_class); - - x->x_f = (f) ? f : 0; - x->x_g = (g) ? g : RAND_MAX; - //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); - x->x_state = makeseed(); - - x->x_s1=390451501; - x->x_s2=613566701; - x->x_s3=858993401; - - x->x_k1=31; - x->x_k2=29; - x->x_k3=28; - - x->x_q1=13; - x->x_q2=2; - x->x_q3=3; - x->x_p1=12; - x->x_p2=4; - x->x_p3=17; - -/* x->x_q1=3; */ -/* x->x_q2=2; */ -/* x->x_q3=13; */ -/* x->x_p1=20; */ -/* x->x_p2=16; */ -/* x->x_p3=7; */ - - random_tw_rand_seed(x, makeseed(),makeseed(),makeseed()); - 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")); - outlet_new(&x->x_obj, &s_float); - return (x); -} - - -static void random_tw_bang(t_random_tw *x) -{ - unsigned int b; - double nval; - static unsigned int zf = 4294967295U; - - b = ((x->x_s1 << x->x_q1)^x->x_s1) >> x->x_shft1; - x->x_s1 = ((x->x_s1 & x->x_mask1) << x->x_p1) ^ b; - b = ((x->x_s2 << x->x_q2) ^ x->x_s2) >> x->x_shft2; - x->x_s2 = ((x->x_s2 & x->x_mask2) << x->x_p2) ^ b; - b = ((x->x_s3 << x->x_q3) ^ x->x_s3) >> x->x_shft3; - x->x_s3 = ((x->x_s3 & x->x_mask3) << x->x_p3) ^ b; - nval = (((double)(x->x_s1 ^ x->x_s2 ^ x->x_s3) / (double)(zf) + 0.5) * (double)(x->x_g - x->x_f) + (double)x->x_f); - - //nval = ((x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f); - //post("cxc/randomix.c: current rand: %f", nval); - outlet_float(x->x_obj.ob_outlet, nval); -} - -void random_tw_low(t_random_tw *x, t_floatarg f) -{ - if(f >= x->x_g) { - post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f", - SMALLEST_RANGE, - x->x_g - SMALLEST_RANGE); - x->x_f = x->x_g - SMALLEST_RANGE; - } else x->x_f = f; -} - -void random_tw_upp(t_random_tw *x, t_floatarg f) -{ - if(f <= x->x_f) { - post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f", - SMALLEST_RANGE, - x->x_f + SMALLEST_RANGE); - x->x_g = x->x_f + SMALLEST_RANGE; - } else x->x_g = f; -} - -static void random_tw_seed(t_random_tw *x, float f, float glob) -{ - //x->x_state = f; - // questionable .. dont quite get how this one's seeded .. - random_tw_rand_seed(x, (int)f, (int)(f*0.455777), (int)f); -} - -static void random_tw_help(t_random_tw *x) -{ - post("RAND_MAX: %d",RAND_MAX); - post("range: %f - %f", x->x_f, x->x_g); -} - -void random_tw_setup(void) -{ - random_tw_class = class_new(gensym("random_tw"), (t_newmethod)random_tw_new, 0, - sizeof(t_random_tw), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addbang(random_tw_class, random_tw_bang); - class_addmethod(random_tw_class, (t_method)random_tw_low, gensym("fl1"), A_FLOAT, 0); - class_addmethod(random_tw_class, (t_method)random_tw_upp, gensym("fl2"), A_FLOAT, 0); - - class_addmethod(random_tw_class, (t_method)random_tw_seed, - gensym("seed"), A_FLOAT, 0); - class_addmethod(random_tw_class, (t_method)random_tw_help, - gensym("help"), 0, 0); -} - - - - -/* -------------------------- dist_normal ------------------------------ */ -/* Generate a normal random variable with mean 0 and standard deviation - of 1. To adjust to some other distribution, multiply by the standard - deviation and add the mean. Box-Muller method - note: rand() is a function that returns a uniformly distributed random - number from 0 to RAND_MAX -*/ - -static t_class *dist_normal_class; - -typedef struct _dist_normal -{ - t_object x_obj; - t_float x_mn; // mean - t_float x_dv; // deviation - t_float x_u1; - t_float x_u2; - - t_float x_f; // lower limit - t_float x_g; // upper limit - unsigned int x_state; // current seed -} t_dist_normal; - -static void *dist_normal_new(t_floatarg mn, t_floatarg dv) -{ - t_dist_normal *x = (t_dist_normal *)pd_new(dist_normal_class); - x->x_mn = (mn) ? mn : 0; - x->x_dv = (dv) ? dv : 1; - x->x_u1 = 13; - x->x_u2 = 1000; - x->x_f = 0; - x->x_g = RAND_MAX; - //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g); - x->x_state = makeseed(); - 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")); - //outlet_new(&x->x_obj, &s_float); - outlet_new(&x->x_obj, 0); - return (x); -} - -static double dist_normal_rand(t_dist_normal *x) -{ - int n = x->x_f; - double nval; - double m; - - m = (double)RAND_MAX * 2; - - // post("cxc/randomix.c: x_state: %d",x->x_state); - x->x_state = rand_random_fl(x->x_state); - //nval = ((double)x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f; - nval = (double)x->x_state; - return (nval); -} - -static void dist_normal_doit(t_dist_normal *x) -{ - static double V2, fac; - static int phase = 0; - double S, Z, U1, U2, V1; - - if (phase) - Z = V2 * fac; - else - { - do { -/* U1 = (double)rand() / RAND_MAX; */ -/* U2 = (double)rand() / RAND_MAX; */ - U1 = (double)dist_normal_rand(x) / RAND_MAX; - U2 = (double)dist_normal_rand(x) / RAND_MAX; - - // post("cxc/randomix.c: test %f %f %f %f", x->x_u1, x->x_u2, U1, U2); - - V1 = 2 * U1 - 1; - V2 = 2 * U2 - 1; - S = V1 * V1 + V2 * V2; - } while(S >= 1); - - fac = sqrt (-2 * log(S) / S); - Z = V1 * fac; - } - - phase = 1 - phase; - - //return Z; - outlet_float(x->x_obj.ob_outlet, Z); -} - -static void dist_normal_bang(t_dist_normal *x) -{ -/* post("cxc/randomix.c: dist_normal banged"); */ -/* post("cxc/randomix.c: RAND_MAX: %d",RAND_MAX); */ -/* post("cxc/randomix.c: test: %f %f", x->x_u1, x->x_u2); */ - dist_normal_doit(x); -} - -void dist_normal_low(t_dist_normal *x, t_floatarg mn) -{ - x->x_mn = mn; -} - -void dist_normal_upp(t_dist_normal *x, t_floatarg dv) -{ - x->x_dv = dv; -} - -void dist_normal_float(t_dist_normal *x, t_floatarg r) -{ - outlet_float(x->x_obj.ob_outlet, r); -} - -void dist_normal_list(t_dist_normal *x, t_symbol *s, int argc, t_atom *argv) -{ - outlet_list(x->x_obj.ob_outlet, s, argc, argv); -} - -void dist_normal_setup(void) -{ - dist_normal_class = class_new(gensym("dist_normal"), (t_newmethod)dist_normal_new, 0, - sizeof(t_dist_normal), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addbang(dist_normal_class, dist_normal_bang); - class_addmethod(dist_normal_class, (t_method)dist_normal_low, gensym("fl1"), A_FLOAT, 0); - // class_addmethod(dist_normal_class, (t_method)dist_normal_upp, gensym("fl2"), A_FLOAT, 0); - class_addlist (dist_normal_class, dist_normal_list); - -/* class_addmethod(dist_normal_class, (t_method)dist_normal_seed, */ -/* gensym("seed"), A_FLOAT, 0); */ -} diff --git a/reference/ENV-help.pd b/reference/ENV-help.pd deleted file mode 100644 index 7582c67..0000000 --- a/reference/ENV-help.pd +++ /dev/null @@ -1,34 +0,0 @@ -#N canvas 370 240 625 314 10; -#X obj 147 203 ENV; -#X msg 147 163 RAND_MAX; -#X floatatom 226 253 10 0 0; -#X obj 147 277 print; -#X msg 214 164 getenv \$1; -#X symbolatom 215 130 10 0 0; -#X obj 295 130 symbol; -#X msg 311 105 HOSTNAME; -#X msg 310 80 USERNAME; -#X obj 147 228 route symbol; -#X msg 147 253 \$1; -#X msg 424 110 USERNAME bla; -#X obj 386 168 cxc.prepend setenv; -#X obj 395 202 print pre; -#X msg 425 135 HOSTNAME testi; -#X msg 312 45 RANDOM; -#X text 18 7 get and set environment variables etc ...; -#X msg 244 51 DATE; -#X connect 0 0 9 0; -#X connect 1 0 0 0; -#X connect 4 0 0 0; -#X connect 5 0 4 0; -#X connect 6 0 4 0; -#X connect 7 0 6 0; -#X connect 8 0 6 0; -#X connect 9 0 10 0; -#X connect 9 1 2 0; -#X connect 10 0 3 0; -#X connect 11 0 12 0; -#X connect 12 0 0 0; -#X connect 14 0 12 0; -#X connect 15 0 6 0; -#X connect 17 0 6 0; diff --git a/reference/ascseq-help.pd b/reference/ascseq-help.pd deleted file mode 100644 index 5038a84..0000000 --- a/reference/ascseq-help.pd +++ /dev/null @@ -1,12 +0,0 @@ -#N canvas 454 117 570 300 10; -#X obj 132 168 print ascseq; -#X msg 253 112 bang; -#X obj 223 70 random_fl -10000 10000; -#X obj 131 118 ascseq 100; -#X floatatom 268 137 5 0 0; -#X msg 83 34 "abcde 123 dsfjnsdf ewrte 3k4n5 3n hjb5465hj 6"; -#X connect 1 0 2 0; -#X connect 2 0 3 0; -#X connect 3 0 0 0; -#X connect 4 0 3 1; -#X connect 5 0 3 0; diff --git a/reference/ascwave-help.pd b/reference/ascwave-help.pd deleted file mode 100644 index bb36502..0000000 --- a/reference/ascwave-help.pd +++ /dev/null @@ -1,65 +0,0 @@ -#N canvas 448 258 407 316 10; -#X msg 80 153 bang; -#X floatatom 169 176; -#X floatatom 214 58; -#X obj 151 13 loadbang; -#X obj 157 97 metro 100; -#X msg 157 196 1; -#X msg 157 58 1; -#X msg 186 58 0; -#X obj 145 221 ascwave; -#X msg 75 192 fill 1; -#X msg 74 211 fill 0; -#X obj 145 262 ixprint; -#X msg 145 241 \$1; -#N canvas 517 176 588 372 modulate 0; -#X obj 84 200 outlet; -#X obj 84 139 random 80; -#X msg 30 110 bang; -#X obj 84 75 * 50; -#X obj 84 93 metro 5000; -#X obj 29 52 loadbang; -#X msg 29 70 1; -#X obj 84 161 pack 1 5000; -#X obj 84 180 line; -#X obj 86 31 inlet start/stop; -#X obj 130 53 inlet time; -#X connect 1 0 7 0; -#X connect 2 0 1 0; -#X connect 3 0 4 0; -#X connect 3 0 7 1; -#X connect 4 0 1 0; -#X connect 5 0 6 0; -#X connect 6 0 4 0; -#X connect 7 0 8 0; -#X connect 8 0 0 0; -#X connect 9 0 4 0; -#X connect 10 0 3 0; -#X restore 169 154 page modulate; -#X floatatom 262 132; -#X obj 262 179 min 127; -#X obj 262 154 max 33; -#X obj 157 77 f; -#X obj 210 78 f; -#X text 200 178 <== here; -#X text 297 131 <== and here; -#X connect 0 0 8 0; -#X connect 1 0 8 2; -#X connect 2 0 18 0; -#X connect 3 0 6 0; -#X connect 4 0 5 0; -#X connect 5 0 8 1; -#X connect 6 0 17 0; -#X connect 7 0 17 0; -#X connect 8 0 12 0; -#X connect 9 0 8 0; -#X connect 10 0 8 0; -#X connect 12 0 11 0; -#X connect 13 0 8 2; -#X connect 14 0 16 0; -#X connect 15 0 8 3; -#X connect 16 0 15 0; -#X connect 17 0 4 0; -#X connect 17 0 13 0; -#X connect 18 0 4 1; -#X connect 18 0 13 1; diff --git a/reference/bfilt-help.pd b/reference/bfilt-help.pd deleted file mode 100644 index 4be9d45..0000000 --- a/reference/bfilt-help.pd +++ /dev/null @@ -1,23 +0,0 @@ -#N canvas 203 207 404 226 10; -#X floatatom 85 119; -#X obj 57 175 print; -#X floatatom 45 120; -#X obj 58 146 bfilt 5; -#X text 43 16 bfilt (at the moment) is: modulo something + select 0; -#X floatatom 167 120; -#X obj 139 176 print; -#X floatatom 127 121; -#X obj 140 147 bfilt2 5; -#X obj 145 87 metro 100; -#X msg 145 68 1; -#X text 42 29 bfilt2: real bangfilter: bangs on first inlet \, internal counter \, only outputs every arg2th bang ...; -#X msg 169 67 0; -#X connect 0 0 3 1; -#X connect 2 0 3 0; -#X connect 3 0 1 0; -#X connect 5 0 8 1; -#X connect 7 0 8 0; -#X connect 8 0 6 0; -#X connect 9 0 8 0; -#X connect 10 0 9 0; -#X connect 12 0 9 0; diff --git a/reference/bfilt2-help.pd b/reference/bfilt2-help.pd deleted file mode 100644 index 4be9d45..0000000 --- a/reference/bfilt2-help.pd +++ /dev/null @@ -1,23 +0,0 @@ -#N canvas 203 207 404 226 10; -#X floatatom 85 119; -#X obj 57 175 print; -#X floatatom 45 120; -#X obj 58 146 bfilt 5; -#X text 43 16 bfilt (at the moment) is: modulo something + select 0; -#X floatatom 167 120; -#X obj 139 176 print; -#X floatatom 127 121; -#X obj 140 147 bfilt2 5; -#X obj 145 87 metro 100; -#X msg 145 68 1; -#X text 42 29 bfilt2: real bangfilter: bangs on first inlet \, internal counter \, only outputs every arg2th bang ...; -#X msg 169 67 0; -#X connect 0 0 3 1; -#X connect 2 0 3 0; -#X connect 3 0 1 0; -#X connect 5 0 8 1; -#X connect 7 0 8 0; -#X connect 8 0 6 0; -#X connect 9 0 8 0; -#X connect 10 0 9 0; -#X connect 12 0 9 0; diff --git a/reference/delta~-help.pd b/reference/delta~-help.pd deleted file mode 100644 index 7f0bf8b..0000000 --- a/reference/delta~-help.pd +++ /dev/null @@ -1,63 +0,0 @@ -#N canvas 9 51 986 579 10; -#X obj 139 177 delta~; -#X obj 80 44 noise~; -#X obj 83 268 print a; -#X obj 143 267 print b; -#X obj 329 312 dac~; -#X obj 226 47 osc~ 400; -#X graph graph1 0 -1 999 1 497 206 697 66; -#X array orig 1000 float 0; -#X pop; -#X graph graph2 0 -1 999 1 431 563 931 203; -#X array diff 1000 float 0; -#X pop; -#X obj 129 390 tabwrite~ diff; -#X msg 220 340 bang; -#X floatatom 225 24 5 0 0; -#X obj 139 468 table test; -#X msg 139 442 resize 2205; -#X obj 242 389 tabwrite~ test; -#X obj 243 415 tabwrite~ orig; -#X obj 403 515 print; -#X msg 350 441 bang; -#X obj 346 530 t b; -#X obj 332 552 spigot; -#X obj 375 528 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 -1; -#X obj 320 474 tabread~ test; -#X obj 201 532 phasor~ 10; -#X floatatom 201 510 5 0 0; -#X obj 201 556 *~ 2205; -#X obj 147 45 phasor~ 1; -#X obj 160 93 nop~; -#X obj 287 224 metro 100; -#X obj 287 198 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 -1; -#X floatatom 173 18 5 0 0; -#X obj 109 77 *~ 0.1; -#X floatatom 86 103 5 0 0; -#X text 308 36 if this sample is larger than last \, value is positive -\, else negative ...; -#X text 308 18 delta~: difference between this and last sample; -#X connect 0 0 4 1; -#X connect 0 0 8 0; -#X connect 1 0 29 0; -#X connect 9 0 8 0; -#X connect 9 0 13 0; -#X connect 9 0 14 0; -#X connect 10 0 5 0; -#X connect 12 0 11 0; -#X connect 17 0 18 0; -#X connect 19 0 18 1; -#X connect 21 0 23 0; -#X connect 22 0 21 0; -#X connect 23 0 20 0; -#X connect 24 0 25 0; -#X connect 25 0 0 0; -#X connect 25 0 13 0; -#X connect 25 0 14 0; -#X connect 26 0 9 0; -#X connect 27 0 26 0; -#X connect 28 0 24 0; -#X connect 29 0 25 0; -#X connect 30 0 29 1; diff --git a/reference/proc-help.pd b/reference/proc-help.pd deleted file mode 100644 index 65411ae..0000000 --- a/reference/proc-help.pd +++ /dev/null @@ -1,75 +0,0 @@ -#N canvas 179 113 717 546 10; -#X obj 151 118 proc; -#X text 96 15 interface to the linux proc filesystem; -#X msg 88 80 cpuinfo; -#X obj 27 281 unpack f f f; -#X floatatom 25 304 5 0 0; -#X floatatom 67 305 5 0 0; -#X floatatom 109 304 5 0 0; -#X text 37 254 cpu-id \, cpu-mhz \, bogomips; -#X obj 151 147 print proc_raw; -#X msg 151 94 proc \$1; -#X obj 151 71 symbol; -#X msg 123 38 cpuinfo; -#X msg 183 38 uptime; -#X msg 351 38 stat; -#X msg 389 38 blubb; -#X obj 242 276 unpack f f; -#X text 241 255 uptime in s \, idle-time in s; -#X floatatom 241 301 5 0 0; -#X floatatom 302 305 5 0 0; -#X msg 237 38 loadavg; -#X msg 297 39 version; -#X obj 174 349 unpack f f f f f f; -#X floatatom 172 373 5 0 0; -#X floatatom 187 397 5 0 0; -#X floatatom 220 373 5 0 0; -#X floatatom 238 397 5 0 0; -#X floatatom 271 372 5 0 0; -#X floatatom 289 396 5 0 0; -#X text 315 345 apparently the loadavg format is something liek this -; -#X text 318 359 my manpage seems outdated ...; -#X text 330 379 1: number of jobs in the run queue (1'); -#X text 340 394 2: numofjobs in R qu (5'); -#X text 348 411 3: numofjobs in R qu (15'); -#X text 339 425 4: num of procs waiting for disk io?; -#X text 339 452 6: num of processes ever total; -#X text 339 438 5: num of processes now total; -#X obj 27 234 route cpuinfo uptime loadavg version stat; -#X obj 458 241 unpack f f f; -#X floatatom 458 267 5 0 0; -#X floatatom 484 293 5 0 0; -#X floatatom 516 266 5 0 0; -#X text 462 215 uname -r; -#X text 307 82 really useless stuff but maybe good for estimating number -of voices in self-generating patches; -#X connect 0 0 8 0; -#X connect 0 0 36 0; -#X connect 2 0 0 0; -#X connect 3 0 4 0; -#X connect 3 1 5 0; -#X connect 3 2 6 0; -#X connect 9 0 0 0; -#X connect 10 0 9 0; -#X connect 11 0 10 0; -#X connect 12 0 10 0; -#X connect 13 0 10 0; -#X connect 14 0 10 0; -#X connect 15 0 17 0; -#X connect 15 1 18 0; -#X connect 19 0 10 0; -#X connect 20 0 10 0; -#X connect 21 0 22 0; -#X connect 21 1 23 0; -#X connect 21 2 24 0; -#X connect 21 3 25 0; -#X connect 21 4 26 0; -#X connect 21 5 27 0; -#X connect 36 0 3 0; -#X connect 36 1 15 0; -#X connect 36 2 21 0; -#X connect 36 3 37 0; -#X connect 37 0 38 0; -#X connect 37 1 39 0; -#X connect 37 2 40 0; diff --git a/reference/randomix-help.pd b/reference/randomix-help.pd deleted file mode 100644 index d913f39..0000000 --- a/reference/randomix-help.pd +++ /dev/null @@ -1,223 +0,0 @@ -#N canvas 33 162 966 505 10; -#X msg 197 150 bang; -#X floatatom 244 150 5 0 0 0 - - -; -#X floatatom 197 218 10 0 0 0 - - -; -#X floatatom 53 162 5 0 0 0 - - -; -#X msg 54 111 bang; -#X floatatom 289 152 5 0 0 0 - - -; -#X obj 53 135 random 100; -#X msg 427 151 bang; -#X floatatom 474 151 5 0 0 0 - - -; -#X floatatom 427 219 10 0 0 0 - - -; -#X floatatom 519 153 5 0 0 0 - - -; -#X obj 196 183 random1 0 1; -#X obj 426 184 random_fl 0 1; -#X msg 672 152 bang; -#X floatatom 719 152 5 0 0 0 - - -; -#X floatatom 672 220 10 0 0 0 - - -; -#X floatatom 764 154 5 0 0 0 - - -; -#X obj 671 185 random_icg 0 1; -#X msg 197 276 bang; -#X floatatom 244 276 5 0 0 0 - - -; -#X floatatom 197 344 10 0 0 0 - - -; -#X floatatom 289 278 5 0 0 0 - - -; -#X text 193 251 random_icg lowerlimit \, upperlimit; -#X msg 368 288 help; -#X text 253 10 the random number generatorse; -#X obj 539 406 dist_normal; -#X msg 540 356 bang; -#X obj 579 357 metro 100; -#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 -1; -#X obj 196 309 random_tw 0 1; -#X floatatom 637 334 5 0 0 0 - - -; -#N canvas 0 0 600 400 streamview 0; -#N canvas 0 0 450 300 graph2 0; -#X array randstream 100 float 0; -#X coords 0 2 99 -2 200 140 1; -#X restore 92 222 graph; -#X obj 146 144 tabwrite randstream; -#X obj 200 63 count; -#X obj 200 88 % 100; -#X obj 156 28 t f b; -#X obj 49 15 inlet; -#X connect 2 0 3 0; -#X connect 3 0 1 1; -#X connect 4 0 1 0; -#X connect 4 1 2 0; -#X connect 5 0 4 0; -#X restore 570 433 pd streamview; -#N canvas 306 24 679 400 distview 0; -#N canvas 0 0 450 300 graph1 0; -#X array randview1 100 float 0; -#X coords 0 200 99 0 400 200 1; -#X restore 248 31 graph; -#X obj 28 26 inlet; -#X obj 45 355 tabwrite randview1; -#X obj 136 201 * 100; -#X obj 136 225 int; -#X obj 136 153 + 2; -#X obj 45 280 tabread randview1; -#X obj 136 176 / 4; -#X obj 136 250 t f f; -#X obj 45 304 t f b; -#X obj 45 329 + 1; -#X obj 136 129 t f; -#X connect 1 0 11 0; -#X connect 3 0 4 0; -#X connect 4 0 8 0; -#X connect 5 0 7 0; -#X connect 6 0 9 0; -#X connect 7 0 3 0; -#X connect 8 0 6 0; -#X connect 8 1 2 1; -#X connect 9 0 10 0; -#X connect 10 0 2 0; -#X connect 11 0 5 0; -#X restore 550 458 pd distview; -#X obj 540 381 t b; -#X floatatom 477 430 5 0 0 0 - - -; -#N canvas 0 0 600 400 seedit 0; -#X msg 284 154 seed \$1; -#X obj 284 107 utime; -#X msg 304 74 bang; -#X obj 254 28 loadbang; -#X obj 284 130 * 1e+06; -#X obj 360 167 until; -#X msg 455 156 bang; -#X obj 359 194 random 2.14748e+08; -#X msg 359 267 seed \$1; -#X msg 385 294 seed \$1; -#X msg 412 318 seed \$1; -#X msg 439 267 seed \$1; -#X msg 466 293 seed \$1; -#X obj 254 50 t b b; -#X obj 195 155 print seed1; -#X obj 143 360 outlet; -#X obj 204 361 outlet; -#X obj 264 361 outlet; -#X obj 317 361 outlet; -#X obj 367 361 outlet; -#X text 35 9 seed one random obj \, which generates the seeds for all -the others.; -#X obj 359 218 serialize 6; -#X msg 360 140 6; -#X obj 359 242 unpack f f f f f f; -#X msg 485 317 seed \$1; -#X obj 420 359 outlet; -#X connect 0 0 7 0; -#X connect 1 1 4 0; -#X connect 2 0 1 0; -#X connect 3 0 13 0; -#X connect 4 0 0 0; -#X connect 4 0 14 0; -#X connect 5 0 7 0; -#X connect 6 0 7 0; -#X connect 7 0 21 0; -#X connect 8 0 15 0; -#X connect 9 0 16 0; -#X connect 10 0 17 0; -#X connect 11 0 18 0; -#X connect 12 0 19 0; -#X connect 13 0 22 0; -#X connect 13 1 1 0; -#X connect 21 0 23 0; -#X connect 22 0 5 0; -#X connect 23 0 8 0; -#X connect 23 1 9 0; -#X connect 23 2 10 0; -#X connect 23 3 11 0; -#X connect 23 4 12 0; -#X connect 23 5 24 0; -#X connect 24 0 25 0; -#X restore 258 33 pd seedit; -#X text 37 79 std pd random; -#X text 197 124 linear congruential generator; -#X text 197 77 creation arguments for the extra randoms are:; -#X text 205 92 \, defaults to 0 respectively -RAND_MAX; -#X text 545 17 see also:; -#X obj 545 40 utime; -#X text 428 129 another lcg method ..; -#X text 668 127 inverse linear congruential generator; -#X text 536 249 normal distribution mean 0 and dist 1; -#X text 536 264 right now it uses random1 for the actual rand values -; -#X text 537 278 but later on it should take one of the randoms as creation -argument \, so yu can specify which generator is being used.; -#X text 198 106 they all output floats); -#X text 540 311 also \, there is some burst at the upper and lower -limits; -#N canvas 622 685 592 356 signalversions 1; -#X obj 68 131 random1~; -#X obj 368 239 tabwrite~ randomix_test; -#N canvas 0 0 450 300 graph1 0; -#X array randomix_test 64 float 1; -#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236 -0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908 -0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915 --0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131 --1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501 --0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181 --0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187 --0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429 -0.0862183 -0.995607 0.585034 0.205198 -0.337256; -#X coords 0 1 63 -1 200 140 1; -#X restore 351 23 graph; -#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 -1; -#X floatatom 440 184 5 0 0 0 - - -; -#X obj 382 201 metro 100; -#X msg 342 201 bang; -#X obj 73 295 dac~; -#X floatatom 140 220 5 0 0 0 - - -; -#X msg 68 58 seed 30000; -#X obj 142 131 random_fl~; -#X text 120 98 etc ..; -#X obj 229 131 random_icg~; -#X obj 81 241 fader 75; -#X connect 0 0 13 0; -#X connect 3 0 5 0; -#X connect 4 0 5 1; -#X connect 5 0 1 0; -#X connect 6 0 1 0; -#X connect 8 0 13 2; -#X connect 9 0 0 0; -#X connect 10 0 13 1; -#X connect 12 0 1 0; -#X connect 12 0 13 0; -#X connect 13 0 7 0; -#X connect 13 1 7 1; -#X restore 98 421 pd signalversions; -#X connect 0 0 11 0; -#X connect 1 0 11 1; -#X connect 4 0 6 0; -#X connect 5 0 11 2; -#X connect 6 0 3 0; -#X connect 7 0 12 0; -#X connect 8 0 12 1; -#X connect 10 0 12 2; -#X connect 11 0 2 0; -#X connect 12 0 9 0; -#X connect 13 0 17 0; -#X connect 14 0 17 1; -#X connect 16 0 17 2; -#X connect 17 0 15 0; -#X connect 18 0 29 0; -#X connect 19 0 29 1; -#X connect 21 0 29 2; -#X connect 23 0 29 0; -#X connect 25 0 31 0; -#X connect 25 0 32 0; -#X connect 25 0 34 0; -#X connect 26 0 33 0; -#X connect 27 0 33 0; -#X connect 28 0 27 0; -#X connect 29 0 20 0; -#X connect 30 0 27 1; -#X connect 33 0 25 0; -#X connect 35 0 6 0; -#X connect 35 1 11 0; -#X connect 35 2 12 0; -#X connect 35 3 17 0; -#X connect 35 4 29 0; diff --git a/reference/reson~-help.pd b/reference/reson~-help.pd deleted file mode 100644 index d90c159..0000000 --- a/reference/reson~-help.pd +++ /dev/null @@ -1,3 +0,0 @@ -#N canvas 0 22 454 304 10; -#X obj 183 119 reson~; -#X text 104 237 An interpolating reson filter; diff --git a/reference/serialize-help.pd b/reference/serialize-help.pd deleted file mode 100644 index b9d8469..0000000 --- a/reference/serialize-help.pd +++ /dev/null @@ -1,10 +0,0 @@ -#N canvas 246 82 551 292 10; -#X obj 34 141 print; -#X floatatom 34 69 0 0 0; -#X text 30 195 (C) 2000 Guenter Geiger; -#X text 30 39 serialize ... turn a stream of floats into a list; -#X obj 33 107 serialize 4; -#X floatatom 105 82 5 0 0; -#X connect 1 0 4 0; -#X connect 4 0 0 0; -#X connect 5 0 4 1; diff --git a/reference/utime-help.pd b/reference/utime-help.pd deleted file mode 100644 index aa5af83..0000000 --- a/reference/utime-help.pd +++ /dev/null @@ -1,9 +0,0 @@ -#N canvas 305 149 450 300 10; -#X obj 199 94 utime; -#X msg 192 55 bang; -#X floatatom 259 170 8 0 0; -#X floatatom 174 129 20 0 0; -#X text 25 8 output seconds since epoch and microsecond fraction; -#X connect 0 0 3 0; -#X connect 0 1 2 0; -#X connect 1 0 0 0; diff --git a/reson~-help.pd b/reson~-help.pd new file mode 100644 index 0000000..d90c159 --- /dev/null +++ b/reson~-help.pd @@ -0,0 +1,3 @@ +#N canvas 0 22 454 304 10; +#X obj 183 119 reson~; +#X text 104 237 An interpolating reson filter; diff --git a/serialize-help.pd b/serialize-help.pd new file mode 100644 index 0000000..b9d8469 --- /dev/null +++ b/serialize-help.pd @@ -0,0 +1,10 @@ +#N canvas 246 82 551 292 10; +#X obj 34 141 print; +#X floatatom 34 69 0 0 0; +#X text 30 195 (C) 2000 Guenter Geiger; +#X text 30 39 serialize ... turn a stream of floats into a list; +#X obj 33 107 serialize 4; +#X floatatom 105 82 5 0 0; +#X connect 1 0 4 0; +#X connect 4 0 0 0; +#X connect 5 0 4 1; diff --git a/utime-help.pd b/utime-help.pd new file mode 100644 index 0000000..aa5af83 --- /dev/null +++ b/utime-help.pd @@ -0,0 +1,9 @@ +#N canvas 305 149 450 300 10; +#X obj 199 94 utime; +#X msg 192 55 bang; +#X floatatom 259 170 8 0 0; +#X floatatom 174 129 20 0 0; +#X text 25 8 output seconds since epoch and microsecond fraction; +#X connect 0 0 3 0; +#X connect 0 1 2 0; +#X connect 1 0 0 0; -- cgit v1.2.1