diff options
-rw-r--r-- | COPYING | 340 | ||||
-rw-r--r-- | StdAfx.h | 24 | ||||
-rw-r--r-- | SynapseA~.h | 21 | ||||
-rw-r--r-- | VERSION | 1 | ||||
-rw-r--r-- | about.c | 77 | ||||
-rw-r--r-- | about.h | 12 | ||||
-rwxr-xr-x | config.cache | 16 | ||||
-rwxr-xr-x | configure | 965 | ||||
-rw-r--r-- | configure.in | 15 | ||||
-rw-r--r-- | configure.scan | 15 | ||||
-rw-r--r-- | convolve~.c | 180 | ||||
-rw-r--r-- | convolve~.h | 23 | ||||
-rwxr-xr-x | doc/mjLib/about.pd | 25 | ||||
-rwxr-xr-x | doc/mjLib/metroplus.pd | 37 | ||||
-rwxr-xr-x | doc/mjLib/monorhythm.pd | 63 | ||||
-rwxr-xr-x | doc/mjLib/morse.pd | 108 | ||||
-rwxr-xr-x | doc/mjLib/n2m.pd | 21 | ||||
-rwxr-xr-x | doc/mjLib/pin~.pd | 41 | ||||
-rwxr-xr-x | doc/mjLib/polyexample.pd | 46 | ||||
-rwxr-xr-x | doc/mjLib/prob.pd | 34 | ||||
-rw-r--r-- | makefile | 37 | ||||
-rw-r--r-- | makefile.in | 59 | ||||
-rw-r--r-- | makefile.linux | 59 | ||||
-rw-r--r-- | metroplus.c | 177 | ||||
-rw-r--r-- | metroplus.h | 24 | ||||
-rw-r--r-- | mjLib.c | 42 | ||||
-rw-r--r-- | mjLib.dsp | 157 | ||||
-rw-r--r-- | mjLib.dsw | 29 | ||||
-rw-r--r-- | mjLib.exp | bin | 0 -> 571 bytes | |||
-rw-r--r-- | mjLib.h | 29 | ||||
-rw-r--r-- | mjLib.ilk | bin | 0 -> 425240 bytes | |||
-rw-r--r-- | mjLib.lib | bin | 0 -> 1698 bytes | |||
-rw-r--r-- | mjLib.ncb | bin | 0 -> 134144 bytes | |||
-rw-r--r-- | mjLib.opt | bin | 0 -> 57856 bytes | |||
-rw-r--r-- | mjLib.pdb | bin | 0 -> 306176 bytes | |||
-rw-r--r-- | mjLib.plg | 24 | ||||
-rw-r--r-- | mjLib.sln | 21 | ||||
-rw-r--r-- | mjLib.suo | bin | 0 -> 10240 bytes | |||
-rw-r--r-- | mjLib.vcproj | 115 | ||||
-rw-r--r-- | monorythm.c | 238 | ||||
-rw-r--r-- | monorythm.h | 33 | ||||
-rw-r--r-- | morse.c | 303 | ||||
-rw-r--r-- | morse.h | 34 | ||||
-rw-r--r-- | n2m.c | 131 | ||||
-rw-r--r-- | n2m.h | 15 | ||||
-rw-r--r-- | pin~.c | 205 | ||||
-rw-r--r-- | pin~.h | 23 | ||||
-rw-r--r-- | prob.c | 143 | ||||
-rw-r--r-- | prob.h | 18 | ||||
-rw-r--r-- | readme.txt | 78 | ||||
-rw-r--r-- | synapseA~.c | 118 | ||||
-rw-r--r-- | things.h | 18 | ||||
-rw-r--r-- | vc70.pdb | bin | 0 -> 61440 bytes |
53 files changed, 4194 insertions, 0 deletions
@@ -0,0 +1,340 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 PDP.LICENSE, 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 + + Appendix: 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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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. + + <signature of Ty Coon>, 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/StdAfx.h b/StdAfx.h new file mode 100644 index 0000000..1b8ed81 --- /dev/null +++ b/StdAfx.h @@ -0,0 +1,24 @@ +// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__FDC19764_88C2_4FB7_A4EB_729E948776D0__INCLUDED_)
+#define AFX_STDAFX_H__FDC19764_88C2_4FB7_A4EB_729E948776D0__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+// Insert your headers here
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#include <windows.h>
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__FDC19764_88C2_4FB7_A4EB_729E948776D0__INCLUDED_)
diff --git a/SynapseA~.h b/SynapseA~.h new file mode 100644 index 0000000..265dd53 --- /dev/null +++ b/SynapseA~.h @@ -0,0 +1,21 @@ +/* declarations for the pin~ object */
+
+typedef struct _synapseA_tilde
+{
+ t_object x_obj;
+ t_float x_f;
+ t_float x_threshold;
+ t_outlet *x_onbang;
+ t_outlet *x_offbang;
+ t_float n_inv;
+ t_float x_state;
+} t_synapseA_tilde;
+
+t_int *synapseA_tilde_perform(t_int *w);
+static void synapseA_tilde_dsp(t_synapseA_tilde *x, t_signal **sp);
+static void synapseA_tilde_free(t_synapseA_tilde *x);
+static void *synapseA_tilde_new(t_floatarg prob , t_floatarg tick);
+static void synapseA_tilde_float(t_synapseA_tilde* x, t_float n);
+static void synapseA_tilde_threshold(t_synapseA_tilde *x, t_float f );
+
+
@@ -0,0 +1 @@ +0.1 @@ -0,0 +1,77 @@ +#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include "m_pd.h"
+#include <stdlib.h>
+#include<time.h>
+#include "about.h"
+
+/**
+* The about object is designed to output a number that is
+* "about" the same as its input. A percentage error factor
+* gives the deviation.
+*/
+
+static t_class *about_class;
+
+/**
+* a float causes a number that is within x_err range
+* of the input number
+*/
+
+static void about_float(t_about *x , t_float f)
+{
+ float errp = (( (float) rand() / (float) RAND_MAX) * ( x->x_err * 2));
+ float tenp = ((errp - x->x_err)/100) * f;
+ //float ep = (errp/100) * f;
+ //float correction = ep - tenp;
+ //float outf = f + correction;
+ float outf = f + tenp;
+ outlet_float( x->x_obj.ob_outlet , outf );
+}
+
+
+/*
+* make a new about it takes one parameter - the percentage error
+*/
+
+static void *about_new( t_float f )
+{
+ t_about *x = (t_about *)pd_new(about_class);
+ about_set_err( x , f );
+ // make us some ins and outs
+ outlet_new(&x->x_obj, gensym("float"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("error"));
+
+ return (x);
+}
+
+static void about_free(t_about *x)
+{
+ // nothing doing here for now
+}
+
+/**
+* set the error factor
+*/
+
+static void about_set_err( t_about *x, t_float f )
+{
+ x->x_err = f;
+}
+
+/**
+* make a new one and setup all of our messages
+*/
+
+ void about_setup(void)
+{
+ srand( (unsigned) time( NULL ) );
+ about_class = class_new(gensym("about"), (t_newmethod)about_new,
+ (t_method)about_free, sizeof(t_about), 0, A_DEFFLOAT , 0);
+ class_addfloat( about_class, about_float );
+ class_addmethod(about_class, (t_method)about_set_err, gensym("error" ), A_FLOAT, 0);
+ class_sethelpsymbol(about_class, gensym("mjLib/about"));
+}
+
@@ -0,0 +1,12 @@ +
+typedef struct _about
+{
+ t_object x_obj;
+ t_float x_err;
+} t_about;
+
+static void *about_new( t_float t );
+static void about_set_err( t_about *x, t_float f );
+static void about_float( t_about *x, t_float f );
+static void about_free(t_about *x);
+
diff --git a/config.cache b/config.cache new file mode 100755 index 0000000..705372a --- /dev/null +++ b/config.cache @@ -0,0 +1,16 @@ +# 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. +# +ac_cv_header_stdc=${ac_cv_header_stdc=yes} +ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'} diff --git a/configure b/configure new file mode 100755 index 0000000..9432f4d --- /dev/null +++ b/configure @@ -0,0 +1,965 @@ +#! /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=metroplus.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 + + + + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:529: 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 <<EOF +#line 544 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:550: \"$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 <<EOF +#line 561 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:567: \"$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 <<EOF +#line 578 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:584: \"$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:609: 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 <<EOF +#line 614 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:622: \"$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 +#line 639 "configure" +#include "confdefs.h" +#include <string.h> +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 +#line 657 "configure" +#include "confdefs.h" +#include <stdlib.h> +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 <<EOF +#line 678 "configure" +#include "confdefs.h" +#include <ctype.h> +#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:689: \"$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 + + + + +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 <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/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 + +trap 'rm -fr `echo "makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > 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%@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 <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"makefile"} +EOF +cat >> $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 + + + 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 +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $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 new file mode 100644 index 0000000..d512b99 --- /dev/null +++ b/configure.in @@ -0,0 +1,15 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(metroplus.c) + +dnl Checks for programs. + +dnl Checks for libraries. + +dnl Checks for header files. +AC_HEADER_STDC + +dnl Checks for typedefs, structures, and compiler characteristics. + +dnl Checks for library functions. + +AC_OUTPUT(makefile) diff --git a/configure.scan b/configure.scan new file mode 100644 index 0000000..d512b99 --- /dev/null +++ b/configure.scan @@ -0,0 +1,15 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(metroplus.c) + +dnl Checks for programs. + +dnl Checks for libraries. + +dnl Checks for header files. +AC_HEADER_STDC + +dnl Checks for typedefs, structures, and compiler characteristics. + +dnl Checks for library functions. + +AC_OUTPUT(makefile) diff --git a/convolve~.c b/convolve~.c new file mode 100644 index 0000000..58bab5f --- /dev/null +++ b/convolve~.c @@ -0,0 +1,180 @@ +#include "m_pd.h"
+#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include <stdlib.h>
+#include<time.h>
+
+#include "convolve~.h"
+
+/* ------------------------ convolve_tilde~ ----------------------------- */
+
+static t_class *convolve_tilde_class;
+
+/**
+* the perform routine unpacks its parameters
+* looks to see if time is zero (do channel prob
+* everytime) if it is to chooses a channel.
+* the routine then copies everything in the input
+* to the choosen output
+*/
+
+t_int *convolve_tilde_perform(t_int *w)
+{
+ float *in = (float *)(w[1]);
+ float *outl = (float *)(w[2]);
+ float *outr = (float *)(w[3]);
+ t_convolve_tilde*obj = (t_convolve_tilde *)(w[4]);
+ int n = (t_int)(w[5]);
+
+
+
+ return w+6;
+}
+
+/**
+* set up our dsp perform routine - it takes parameters
+* the input channel, the output channels ( left and right),
+* the pin object and the number of samples in the array
+*/
+
+static void convolve_tilde_dsp(t_convolve_tilde *x, t_signal **sp)
+{
+ dsp_add(convolve_tilde_perform, 5,sp[0]->s_vec, sp[1]->s_vec , sp[2]->s_vec , x ,sp[0]->s_n);
+}
+
+/**
+* free up the tilde object - for now we only need
+* to get rid of the clock
+*/
+
+static void convolve_tilde_free(t_convolve_tilde *x)
+{
+ clock_free( x->p_clock );
+}
+
+/**
+* make a new object - set up out internal variables
+* and add our inlets and outlets
+*/
+
+static void *convolve_tilde_new(t_floatarg prob , t_floatarg tick)
+{
+ t_convolve_tilde *x = (t_convolve_tilde *)pd_new(convolve_tilde_class);
+ if ( prob < 0 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 0;
+ }
+ else if( prob > 1 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 1;
+ }
+ else if (prob == 0 )
+ {
+ // note that prob defaullts to 0.5
+ prob = 0.5;
+ }
+ x->p_prob = prob;
+ x->p_normalized_prob = prob * RAND_MAX;
+ // set up our clocks
+ x->p_ticktime = tick;
+ x->p_clock = clock_new(x, (t_method) convolve_tilde_tick);
+ if (x->p_ticktime > 0)
+ {
+ clock_delay(x->p_clock, x->p_ticktime);
+ }
+ // start off with a random channel
+ if ( rand() < x->p_normalized_prob )
+ {
+ x->p_outchannel=0;
+ }
+ else
+ {
+ x->p_outchannel=1;
+ }
+ // set up our inlets
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("prob"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("tick"));
+ outlet_new(&x->x_obj, gensym("signal"));
+ outlet_new(&x->x_obj, gensym("signal"));
+ return (x);
+}
+
+/**
+* ticktime has been set - we only care about ticks above
+* zero.
+*/
+
+static void convolve_tilde_ticktime( t_convolve_tilde* x, t_float tick )
+{
+ x->p_ticktime = tick;
+ if ( x->p_ticktime > 0 )
+ {
+ clock_delay(x->p_clock, x->p_ticktime);
+ }
+}
+
+/**
+* allows the probability to be set - note that although
+* we accept a probability between 0 and 1 we need to
+* normalize it becuase rand() produces a number between
+* 0 and rand_max. We precalucluate the normalized
+* number becuase we sometimes use it in the dsp routine
+* (if tick is zero).
+*/
+
+static void convolve_tilde_prob( t_convolve_tilde* x, t_float prob )
+{
+ if ( prob < 0 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 0;
+ }
+ else if( prob > 1 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 1;
+ }
+ x->p_prob=prob;
+ x->p_normalized_prob = prob * RAND_MAX;
+}
+
+/**
+* clock tick - choose a channel and wait again
+*/
+
+static void convolve_tilde_tick(t_convolve_tilde *x)
+{
+ if ( rand() < x->p_normalized_prob )
+ {
+ x->p_outchannel=0;
+ }
+ else
+ {
+ x->p_outchannel=1;
+ }
+ if (x->p_ticktime > 0)
+ {
+ clock_delay(x->p_clock, x->p_ticktime);
+ }
+}
+
+/**
+* setup - add our methods and seed the random number generator
+*/
+
+void convolve_tilde_setup(void)
+{
+ srand( (unsigned) time( NULL ) );
+ convolve_tilde_class = class_new(gensym("convolve~"), (t_newmethod) convolve_tilde_new, (t_method) convolve_tilde_free,
+ sizeof(t_convolve_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ CLASS_MAINSIGNALIN( convolve_tilde_class, t_convolve_tilde, x_f);
+ class_addmethod(convolve_tilde_class, (t_method) convolve_tilde_dsp, gensym("dsp"), (t_atomtype)0);
+ class_addmethod(convolve_tilde_class, (t_method) convolve_tilde_ticktime, gensym("tick") , A_DEFFLOAT , (t_atomtype)0 );
+ class_addmethod(convolve_tilde_class, (t_method) convolve_tilde_prob, gensym("prob") , A_DEFFLOAT , (t_atomtype)0 );
+ class_sethelpsymbol(convolve_tilde_class, gensym("mjLib/convolve~"));
+}
+
diff --git a/convolve~.h b/convolve~.h new file mode 100644 index 0000000..a1a306c --- /dev/null +++ b/convolve~.h @@ -0,0 +1,23 @@ +/* declarations for the pin~ object */
+
+typedef struct _convolve_tilde
+{
+ t_object x_obj;
+ float p_prob;
+ float p_ticktime;
+ int p_outchannel;
+ t_clock* p_clock;
+ long p_numticks;
+ int p_normalized_prob;
+ float x_f;
+} t_convolve_tilde;
+
+t_int *convolve_tilde_perform(t_int *w);
+static void convolve_tilde_dsp(t_convolve_tilde *x, t_signal **sp);
+static void convolve_tilde_free(t_convolve_tilde *x);
+static void *convolve_tilde_new(t_floatarg prob , t_floatarg tick);
+static void convolve_tilde_float(t_convolve_tilde* x, t_float n);
+static void convolve_tilde_ticktime( t_convolve_tilde* x, t_float tick );
+static void convolve_tilde_prob( t_convolve_tilde* x, t_float prob );
+static void convolve_tilde_tick(t_convolve_tilde *x);
+
\ No newline at end of file diff --git a/doc/mjLib/about.pd b/doc/mjLib/about.pd new file mode 100755 index 0000000..e7780b1 --- /dev/null +++ b/doc/mjLib/about.pd @@ -0,0 +1,25 @@ +#N canvas 813 185 531 430 12;
+#X floatatom 215 277 5 0 0;
+#X floatatom 217 374 5 0 0;
+#X obj 218 172 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X floatatom 325 214 5 0 0;
+#X obj 219 323 about 10;
+#X text 24 16 about;
+#X text 25 34 by mark williamson;
+#X text 22 56 (mark@junklight.com);
+#X text 26 92 about makes numbers that are + or - a percenage error
+from a given value. That is it makes numbers that are "about" the given
+value.;
+#X text 82 166 click here --->;
+#X text 103 192 and get;
+#X text 258 192 a number which is within;
+#X text 377 215 %;
+#X text 62 275 of this number--->;
+#X text 142 374 here--->;
+#X text 294 322 note: you can set the defualt;
+#X text 309 340 %age as a parameter;
+#X connect 0 0 4 0;
+#X connect 2 0 0 0;
+#X connect 3 0 4 1;
+#X connect 4 0 1 0;
diff --git a/doc/mjLib/metroplus.pd b/doc/mjLib/metroplus.pd new file mode 100755 index 0000000..4a7e170 --- /dev/null +++ b/doc/mjLib/metroplus.pd @@ -0,0 +1,37 @@ +#N canvas 614 181 575 499 12;
+#X obj 166 441 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 162 249 start;
+#X msg 118 351 stop;
+#X floatatom 460 286 5 0 0;
+#X obj 173 393 metroplus 1000 500 1000 200;
+#X msg 269 309 500 1000 200;
+#X text 28 13 metroplus;
+#X text 27 32 by mark williamson (mark@junklight.com);
+#X obj 174 279 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X text 27 65 metroplus is a variation on the metro object. Instead
+of providing a steady pulse however it can provide an irregular beat.
+It takes as its control a list of numbers representing intervals in
+milliseconds. These are the time between each "pulse". So for example
+with the initial setting below (in the metroplus object itself) - the
+first pulse comes after 1 second the second after 500ms the third after
+1 second and the fourth after 200ms - the next beat comming a second
+after that because the sequence starts again.;
+#X text 19 243 start with;
+#X text 18 257 a start message;
+#X text 18 274 or a 'bang'---->;
+#X text 20 321 stop with a;
+#X text 19 338 stop;
+#X text 21 352 message--->;
+#X text 245 286 set a new sequence;
+#X text 451 322 it still works;
+#X text 449 338 like a metro;
+#X text 422 355 object if you want;
+#X text 512 372 it to;
+#X connect 1 0 4 0;
+#X connect 2 0 4 0;
+#X connect 3 0 4 1;
+#X connect 4 0 0 0;
+#X connect 5 0 4 1;
+#X connect 8 0 4 0;
diff --git a/doc/mjLib/monorhythm.pd b/doc/mjLib/monorhythm.pd new file mode 100755 index 0000000..b227ebf --- /dev/null +++ b/doc/mjLib/monorhythm.pd @@ -0,0 +1,63 @@ +#N canvas 616 110 537 779 12;
+#X obj 255 684 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 115 505 start;
+#X obj 182 680 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X obj 336 685 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 41 494 stop;
+#X obj 173 507 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 316 526 1 2 1 1;
+#X msg 415 538 2000;
+#X msg 224 491 1 2 0 1;
+#X obj 182 611 monorhythm 2000 2 1 1;
+#X text 23 38 by mark williamson;
+#X text 25 13 monorhythm;
+#X text 23 62 (mark@junklight.com);
+#X text 28 97 The monorhythm object is designed to allow simple rythms
+to be generated. It is also constructed in such away so as to create
+more complex polyrhythms quickly and easily.;
+#X text 28 154 The monorhythm object is given a time interval and a
+rhythm pattern. It divides the interval into the number of beats in
+the pattern and outputs bangs as defined by the pattern. The performance
+time of the entire pattern is given by the time interval.;
+#X text 30 242 The pattern consists of strings of the symbols 0 \,
+1 and 2 0 is a rest \, 1 is a normal beat and 2 is an accented beat.
+A rest produces no output. A 1 produces a bang on the leftmost outlet.
+A 2 produces a bang on the left most outlet and a bang on the middle
+outlet (the accent outlet).;
+#X text 30 331 In order to synchronise multiple monorhythms there is
+a third outlet - the sync outlet. This does a bang at the start of
+every bar - which can be fed to the left most inlet of a second (or
+Nth) monorhythm.;
+#X text 29 412 for an example of a polyrhythm see:;
+#X obj 322 413 polyexample;
+#X text 162 701 beat;
+#X text 241 702 accent;
+#X text 325 704 sync;
+#X text 412 568 time interval;
+#X text 278 459 pattern;
+#X text 37 466 stop;
+#X text 104 467 start or bang;
+#X text 105 483 sets it going;
+#X msg 25 559 exclusive;
+#X msg 27 654 nonexclusive;
+#X text 22 590 beat and accent;
+#X text 20 607 bangs are mutually;
+#X text 20 622 exclusive;
+#X text 23 682 accent bang;
+#X text 23 697 supplements;
+#X text 22 715 the beat bang;
+#X connect 1 0 9 0;
+#X connect 4 0 9 0;
+#X connect 5 0 9 0;
+#X connect 6 0 9 1;
+#X connect 7 0 9 2;
+#X connect 8 0 9 1;
+#X connect 9 0 2 0;
+#X connect 9 1 0 0;
+#X connect 9 2 3 0;
+#X connect 27 0 9 0;
+#X connect 28 0 9 0;
diff --git a/doc/mjLib/morse.pd b/doc/mjLib/morse.pd new file mode 100755 index 0000000..1872049 --- /dev/null +++ b/doc/mjLib/morse.pd @@ -0,0 +1,108 @@ +#N canvas 613 249 881 774 12;
+#X obj 303 166 morse;
+#X obj 282 243 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 316 244 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 355 245 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 47 53 1;
+#X msg 107 18 stop;
+#X msg 343 93 msg this is a test message;
+#X obj 203 159 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 350 22 msg 1 2 3 4 8;
+#X obj 180 123 metro 100;
+#X obj 139 676 dac~;
+#X obj 147 635 *~;
+#X obj 235 615 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 0 1;
+#X obj 145 590 *~;
+#X obj 135 335 osc~ 440;
+#X obj 38 291 hsl 128 15 10 6000 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 1900 1;
+#X text 179 289 frequency;
+#X obj 199 551 line~;
+#X obj 275 455 delay 50;
+#X obj 257 400 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 380 453 5 0 0;
+#X floatatom 45 332 5 0 0;
+#X msg 34 257 906.1;
+#X obj 33 216 loadbang;
+#X obj 517 458 delay 50;
+#X obj 499 403 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 622 456 5 0 0;
+#X obj 357 706 writesf~ 2;
+#X msg 360 645 start;
+#X msg 423 647 stop;
+#X msg 430 676 open mouts.wav;
+#X msg 219 495 1 1;
+#X msg 275 492 0 1;
+#X msg 461 498 1 1;
+#X msg 519 498 0 1;
+#X obj 683 155 hsl 128 15 10 1000 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 0 1;
+#X text 714 129 speed;
+#X floatatom 681 185 5 0 0;
+#X obj 643 276 s dot;
+#X obj 732 274 s dash;
+#X obj 260 88 r dot;
+#X obj 332 389 r dot;
+#X obj 579 395 r dash;
+#X obj 735 224 * 3;
+#X msg 675 94 50;
+#X obj 677 51 loadbang;
+#X text 291 378 dot;
+#X text 530 376 dash;
+#X text 196 594 volume - don't forget to set!;
+#X msg 45 17 start;
+#X connect 0 0 1 0;
+#X connect 0 1 2 0;
+#X connect 0 2 3 0;
+#X connect 1 0 19 0;
+#X connect 2 0 25 0;
+#X connect 4 0 9 0;
+#X connect 5 0 9 0;
+#X connect 6 0 0 0;
+#X connect 8 0 0 0;
+#X connect 9 0 0 0;
+#X connect 9 0 7 0;
+#X connect 11 0 10 0;
+#X connect 11 0 10 1;
+#X connect 11 0 27 0;
+#X connect 11 0 27 1;
+#X connect 12 0 11 1;
+#X connect 13 0 11 0;
+#X connect 14 0 13 0;
+#X connect 15 0 14 0;
+#X connect 15 0 21 0;
+#X connect 17 0 13 1;
+#X connect 18 0 32 0;
+#X connect 19 0 18 0;
+#X connect 19 0 31 0;
+#X connect 22 0 15 0;
+#X connect 23 0 22 0;
+#X connect 24 0 34 0;
+#X connect 25 0 24 0;
+#X connect 25 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 27 0;
+#X connect 30 0 27 0;
+#X connect 31 0 17 0;
+#X connect 32 0 17 0;
+#X connect 33 0 17 0;
+#X connect 34 0 17 0;
+#X connect 35 0 37 0;
+#X connect 37 0 38 0;
+#X connect 37 0 43 0;
+#X connect 40 0 9 1;
+#X connect 41 0 18 1;
+#X connect 41 0 20 0;
+#X connect 42 0 24 1;
+#X connect 42 0 26 0;
+#X connect 43 0 39 0;
+#X connect 44 0 35 0;
+#X connect 45 0 44 0;
+#X connect 49 0 4 0;
diff --git a/doc/mjLib/n2m.pd b/doc/mjLib/n2m.pd new file mode 100755 index 0000000..0fe2937 --- /dev/null +++ b/doc/mjLib/n2m.pd @@ -0,0 +1,21 @@ +#N canvas 506 519 493 438 12;
+#X obj 104 320 n2m;
+#X obj 95 378 print;
+#X text 32 13 n2m - note to midi;
+#X text 32 36 by mark williamson (http://www.junklight.com);
+#X text 33 75 n2m converts note names in the form <note name><octave>
+to a midi number. It copes with single notes or chords.;
+#X msg 109 174 note C5 d#7 c3;
+#X msg 67 128 note c6;
+#X msg 146 220 note D;
+#X msg 182 270 note 7;
+#X text 174 129 output note C6;
+#X text 271 174 output a chord;
+#X text 244 218 Octave defaults to 4;
+#X text 266 268 note defaults to C;
+#X text 189 326 its not case sensitive;
+#X connect 0 0 1 0;
+#X connect 5 0 0 0;
+#X connect 6 0 0 0;
+#X connect 7 0 0 0;
+#X connect 8 0 0 0;
diff --git a/doc/mjLib/pin~.pd b/doc/mjLib/pin~.pd new file mode 100755 index 0000000..83ebc96 --- /dev/null +++ b/doc/mjLib/pin~.pd @@ -0,0 +1,41 @@ +#N canvas 571 384 526 605 12;
+#X obj 206 485 dac~;
+#X obj 155 395 osc~;
+#X msg 155 282 69;
+#X obj 155 327 mtof;
+#X floatatom 155 304 0 0 0;
+#X floatatom 155 349 0 0 0;
+#X obj 155 371 sig~;
+#X floatatom 234 314 5 0 1;
+#X floatatom 308 359 5 0 0;
+#X text 19 13 pin~;
+#X text 20 55 the pin~ object can be considered to be similar to the
+pin in a bagatelle game. The ball upon hitting it has a random probability
+of falling to one side or the other. The pin~ object takes a single
+signal input and outputs it to the left or right output at random based
+on the probability set (right most input). The interval at which the
+outlet is choosen can be set by the right most input. Setting this
+to 0 or less means a different output is choosen for every call of
+the dsp routine. A higher value means that the output is choosen every
+so many milliseconds.;
+#X obj 154 255 loadbang;
+#X text 19 314 test signal;
+#X text 19 327 generator---->;
+#X text 222 289 probability to choose left;
+#X text 300 307 (between 0 and 1);
+#X text 321 338 choice interval;
+#X obj 177 437 pin~ 0.5 100;
+#X text 25 523 note that no panning or envelopes are applied and therefore
+low choice intervals will add "switching" noise to the output.;
+#X text 19 30 by mark williamson (mark@junklight.com);
+#X connect 1 0 17 0;
+#X connect 2 0 4 0;
+#X connect 3 0 5 0;
+#X connect 4 0 3 0;
+#X connect 5 0 6 0;
+#X connect 6 0 1 0;
+#X connect 7 0 17 1;
+#X connect 8 0 17 2;
+#X connect 11 0 2 0;
+#X connect 17 0 0 0;
+#X connect 17 1 0 1;
diff --git a/doc/mjLib/polyexample.pd b/doc/mjLib/polyexample.pd new file mode 100755 index 0000000..281b498 --- /dev/null +++ b/doc/mjLib/polyexample.pd @@ -0,0 +1,46 @@ +#N canvas 488 354 514 349 12;
+#X obj 120 193 monorhythm;
+#X obj 157 270 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 153 91 start;
+#X obj 111 274 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X obj 200 228 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 219 90 stop;
+#X msg 220 160 2000;
+#X obj 286 194 monorhythm;
+#X obj 323 271 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X obj 277 275 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X obj 358 226 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 374 161 2000;
+#X text 42 16 An example of a polyrhythm ( 2 against 3) built with
+2 monorhythm's;
+#X obj 321 121 loadbang;
+#X msg 305 160 2 1 1;
+#X msg 170 159 2 1;
+#X text 89 294 beat;
+#X text 148 292 accent;
+#X text 250 293 beat;
+#X text 313 295 accent;
+#X connect 0 0 3 0;
+#X connect 0 1 1 0;
+#X connect 0 2 4 0;
+#X connect 0 2 7 0;
+#X connect 2 0 0 0;
+#X connect 5 0 7 0;
+#X connect 5 0 0 0;
+#X connect 6 0 0 2;
+#X connect 7 0 9 0;
+#X connect 7 1 8 0;
+#X connect 7 2 10 0;
+#X connect 11 0 7 2;
+#X connect 13 0 11 0;
+#X connect 13 0 14 0;
+#X connect 13 0 15 0;
+#X connect 13 0 6 0;
+#X connect 14 0 7 1;
+#X connect 15 0 0 1;
diff --git a/doc/mjLib/prob.pd b/doc/mjLib/prob.pd new file mode 100755 index 0000000..27cd83c --- /dev/null +++ b/doc/mjLib/prob.pd @@ -0,0 +1,34 @@ +#N canvas 692 257 515 496 12;
+#X obj 235 384 prob;
+#X obj 235 448 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X msg 134 317 start;
+#X msg 192 304 stop;
+#X floatatom 249 276 5 0 0;
+#X floatatom 294 348 5 0 1;
+#X text 221 254 time interval;
+#X text 271 314 probability;
+#X text 260 330 between 0 and 1;
+#X text 25 15 prob;
+#X text 25 36 by mark williamson;
+#X text 23 56 (mark@junklight.com);
+#X text 26 84 prob is designed to generate a random event with a given
+probability at a given interval. Every clock tick (set by time) it
+generates a random number and compares it against the probability to
+see if an event should occur. If so a bang is output at the outlet.
+;
+#X text 25 174 The probability is set as a value between 0 and 1 Time
+is measured in milliseconds. The messages start and stop - start and
+stop events being generated. The prob object can also be started with
+a bang.;
+#X obj 103 350 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
+-1;
+#X text 64 372 bang has the;
+#X text 64 389 same effect;
+#X text 64 405 as start;
+#X connect 0 0 1 0;
+#X connect 2 0 0 0;
+#X connect 3 0 0 0;
+#X connect 4 0 0 1;
+#X connect 5 0 0 2;
+#X connect 14 0 0 0;
diff --git a/makefile b/makefile new file mode 100644 index 0000000..352dd7d --- /dev/null +++ b/makefile @@ -0,0 +1,37 @@ +all: mjLib
+
+VC = "C:\Program Files\Microsoft Visual Studio .NET\Vc7"
+INCLUDE = -I. -I..\src \
+-I..\Tcl\include -I$(VC)\include -I"C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include"
+
+LDIR = $(VC)\lib
+LDIR2 = "C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib"
+
+LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \
+ /NODEFAULTLIB:uuid \
+ $(LDIR)\libc.lib $(LDIR)\oldnames.lib $(LDIR)\kernel32.lib \
+ $(LDIR2)\wsock32.lib $(LDIR2)\winmm.lib \
+ ..\bin\pd.lib
+GLIB = $(LIB) ..\lib\tcl83.lib ..\lib\tk83.lib
+CFLAGS = /nologo /W3 /WX /DNT /DPD /Ox /Zi /DVERSION=\"1\"
+LFLAGS = /nologo
+
+SRC = pin~.c mjLib.c metroplus.c monorythm.c prob.c about.c synapseA~.c convolve~.c n2m.c morse.c
+
+OBJ = $(SRC:.c=.obj)
+
+.c.obj:
+ cl /c $(CFLAGS) $(INCLUDE) $*.c
+
+
+mjLib: ..\mjLib\mjLib.dll
+
+..\mjLib\mjLib.dll ..\mjLib\mjLib.lib: $(OBJ)
+ link $(LFLAGS) /debug /dll /export:mjLib_setup \
+ /out:..\mjLib\mjLib.dll $(OBJ) $(LIB)
+
+
+# the following should also clean up "bin" but it doesn't because "bin" holds
+# precious stuff from elsewhere.
+clean:
+ del *.obj
diff --git a/makefile.in b/makefile.in new file mode 100644 index 0000000..126e864 --- /dev/null +++ b/makefile.in @@ -0,0 +1,59 @@ + +EXT = pd_linux +DEFS = -DHAVE_LIBC=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=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=32 +CC = gcc +CXX = c++ +LD = ld +AFLAGS = +LFLAGS = -export_dynamic -shared +WFLAGS = +IFLAGS = -I./include -I../src +INSTALL_PREFIX=/usr/local + +VERSION = \"$(shell cat VERSION)\" + +.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 = pin~.c mjLib.c metroplus.c monorythm.c prob.c about.c synapseA~.c convolve.c +TARGETS = $(SOURCES:.c=.$(EXT)) + +all: $(TARGETS) + +mjLib: $(TARGETS) + cc -c $(CFLAGS) -DPD mjLib.c + $(LD) -export_dynamic -shared -o mjLib.pd_linux *.o $(LIBS) + strip --strip-unneeded mjLib.pd_linux + +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.pd_linux: + $(CC) -o $@ $(PDCFLAGS) -DPD $*.o + + + +install:: + install -d $(INSTALL_PREFIX)/pd/externs + install -m 644 *.$(EXT) $(INSTALL_PREFIX)/pd/externs + -install -m 644 mjLib.pd_linux $(INSTALL_PREFIX)/pd/externs + install -m 644 doc/*.pd $(INSTALL_PREFIX)/pd/doc/5.reference + + +dist: distclean + (cd ..;tar czvf mjLib.tar.gz mjLib) diff --git a/makefile.linux b/makefile.linux new file mode 100644 index 0000000..14f65e3 --- /dev/null +++ b/makefile.linux @@ -0,0 +1,59 @@ + +EXT = pd_linux +DEFS = -DHAVE_LIBC=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=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=32 +CC = gcc +CXX = c++ +LD = ld +AFLAGS = +LFLAGS = -export_dynamic -shared +WFLAGS = +IFLAGS = -I./include -I../src +INSTALL_PREFIX=/usr/local + +VERSION = \"$(shell cat VERSION)\" + +.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 = pin~.c mjLib.c metroplus.c monorythm.c prob.c +TARGETS = $(SOURCES:.c=.$(EXT)) + +all: $(TARGETS) + +mjLib: $(TARGETS) + cc -c $(CFLAGS) -DPD mjLib.c + $(LD) -export_dynamic -shared -o mjLib.pd_linux *.o $(LIBS) + strip --strip-unneeded mjLib.pd_linux + +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.pd_linux: + $(CC) -o $@ $(PDCFLAGS) -DPD $*.o + + + +install:: + install -d $(INSTALL_PREFIX)/pd/externs + install -m 644 *.$(EXT) $(INSTALL_PREFIX)/pd/externs + -install -m 644 mjLib.pd_linux $(INSTALL_PREFIX)/pd/externs + install -m 644 doc/*.pd $(INSTALL_PREFIX)/pd/doc/5.reference + + +dist: distclean + (cd ..;tar czvf mjLib.tar.gz mjLib) diff --git a/metroplus.c b/metroplus.c new file mode 100644 index 0000000..aca86a3 --- /dev/null +++ b/metroplus.c @@ -0,0 +1,177 @@ +#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include "m_pd.h"
+
+#include <stdlib.h>
+#include<time.h>
+#include "metroplus.h"
+
+/**
+* The metroplus object is a more complex version of the metro
+* object - it allows a list of time intervals to be given which are
+* sequentially used thus giving a more compelex timing source
+* than the metro object
+*
+* the code is based on the metro code from the pd source code
+*/
+
+static t_class *metroplus_class;
+static t_class *metroplus_2_class;
+
+/**
+* clock tick - do a bang and wait the next
+* time delay in the list
+*/
+
+static void metroplus_tick(t_metroplus *x)
+{
+ x->x_hit = 0;
+ outlet_bang(x->x_obj.ob_outlet);
+ if (!x->x_hit) clock_delay(x->x_clock, metroplus_getNextDelay(x) );
+}
+
+/**
+* switch the metroplus object on or off
+*/
+
+static void metroplus_float(t_metroplus *x, t_float f)
+{
+ if (f != 0) metroplus_tick(x);
+ else clock_unset(x->x_clock);
+ x->x_hit = 1;
+}
+
+/**
+* a bang turns us on - a start message also calls this function
+*/
+
+static void metroplus_bang(t_metroplus *x)
+{
+ metroplus_float(x, 1);
+}
+
+/**
+* a stop message turns us off
+*/
+
+static void metroplus_stop(t_metroplus *x)
+{
+ metroplus_float(x, 0);
+}
+
+/**
+* free our clock and our timer array
+*/
+
+static void metroplus_free(t_metroplus *x)
+{
+ clock_free(x->x_clock);
+ free( x->x_times );
+ pd_free( &( (t_metroplus*)x->x_shadow)->x_obj.ob_pd );
+}
+
+/**
+* get the next delay time in the list - wrap
+* if we have run over the end
+*/
+
+static float metroplus_getNextDelay( t_metroplus *x )
+{
+ if ( x->x_idx == x->x_size )
+ {
+ x->x_idx = 0;
+ }
+ return x->x_times[ x->x_idx++ ];
+}
+
+/*
+* make a new metroplus - we can provide a list of times
+* so read these in too
+*/
+
+static void *metroplus_new(t_symbol *s, int argc, t_atom *argv)
+{
+ int i;
+ t_metroplus *x = (t_metroplus *)pd_new(metroplus_class);
+ t_metroplus *x1 = (t_metroplus *)pd_new(metroplus_2_class);
+ x->x_shadow=x1;
+ x1->x_shadow=x;
+ x->x_times = NULL;
+ // a silly little kludge - out time_seq method assumes it is accessed from x1
+ // so we have to pass a pointer to this so it can dereference it
+ metroplus_time_seq( x->x_shadow , s , argc , argv );
+ x->x_clock = clock_new(x, (t_method)metroplus_tick);
+ outlet_new(&x->x_obj, gensym("bang"));
+ inlet_new( &x->x_obj , &x1->x_obj.ob_pd,0,0);
+ //inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("tseq"));
+ return (x);
+}
+
+/**
+* set a time sequence and free the old array
+*/
+
+static void metroplus_time_seq( t_metroplus *x1, t_symbol *s, int ac, t_atom *av )
+{
+ int i;
+ t_metroplus *x = x1->x_shadow;
+ if ( x->x_times != NULL )
+ {
+ free( x->x_times );
+ }
+ if ( ac > 0 )
+ {
+ x->x_times = (float *) malloc( ac * sizeof( float ));
+ for( i = 0 ; i < ac ; i++ )
+ {
+ float t = atom_getfloat( &av[i] );
+ x->x_times[i] = t > 0 ? t : 10;
+ }
+ x->x_size=ac;
+ }
+ else
+ {
+ x->x_times = (float *) malloc( sizeof( float ));
+ x->x_times[0] = 10;
+ x->x_size=1;
+ }
+ x->x_idx = 0;
+ x->x_hit = 0;
+}
+
+static void metroplus_time_float( t_metroplus *x1, t_float f )
+{
+ int i;
+ t_metroplus *x = x1->x_shadow;
+ post("here with %f" , f );
+ if ( x->x_times != NULL )
+ {
+ free( x->x_times );
+ }
+ x->x_times = (float *) malloc( sizeof( float ));
+ x->x_times[0] = f > 0 ? f : 10;
+ x->x_size=1;
+ x->x_idx = 0;
+ x->x_hit = 0;
+}
+
+/**
+* make a new one and setup all of our messages
+*/
+
+ void metroplus_setup(void)
+{
+ metroplus_class = class_new(gensym("metroplus"), (t_newmethod)metroplus_new,
+ (t_method)metroplus_free, sizeof(t_metroplus), 0, A_GIMME, 0);
+ metroplus_2_class = class_new(gensym("metroplus (second inlet)"), 0,
+ 0, sizeof(t_metroplus), CLASS_PD | CLASS_NOINLET, 0);
+ class_addbang(metroplus_class, metroplus_bang);
+ class_addmethod(metroplus_class, (t_method)metroplus_stop, gensym("stop"), 0);
+ class_addmethod(metroplus_class, (t_method)metroplus_bang, gensym("start"), 0);
+ class_addmethod(metroplus_2_class, (t_method)metroplus_time_seq, gensym("list"),A_GIMME,0);
+ class_addmethod(metroplus_2_class, (t_method)metroplus_time_float ,gensym("float"),A_FLOAT,0);
+ class_sethelpsymbol(metroplus_class, gensym("mjLib/metroplus"));
+}
+
diff --git a/metroplus.h b/metroplus.h new file mode 100644 index 0000000..87088ea --- /dev/null +++ b/metroplus.h @@ -0,0 +1,24 @@ +
+
+typedef struct _metroplus
+{
+ t_object x_obj;
+ t_clock *x_clock;
+ t_float *x_times ;
+ int x_idx;
+ int x_size;
+ int x_hit;
+ void* x_shadow;
+} t_metroplus;
+
+static void metroplus_tick(t_metroplus *x);
+static void metroplus_float(t_metroplus *x, t_float f);
+static void metroplus_bang(t_metroplus *x);
+static void metroplus_stop(t_metroplus *x);
+static void metroplus_ft1(t_metroplus *x, t_floatarg g);
+static void metroplus_free(t_metroplus *x);
+static void *metroplus_new(t_symbol *s, int argc, t_atom *argv);
+static float metroplus_getNextDelay( t_metroplus *x );
+static void metroplus_time_seq( t_metroplus *x, t_symbol *s, int ac, t_atom *av );
+static void metoplus_time_float( t_metroplus *x, t_float f );
+
@@ -0,0 +1,42 @@ +#ifdef NT
+#include "stdafx.h"
+#endif
+#include "mjLib.h"
+#include "m_pd.h"
+#include "things.h"
+
+typedef struct _mjLib
+{
+ t_object x_obj;
+} t_mjLib;
+
+static t_class* mjLib_class;
+
+
+
+static void* mjLib_new(t_symbol* s) {
+ t_mjLib *x = (t_mjLib *)pd_new( mjLib_class);
+ return (x);
+}
+
+ void mjLib_setup(void)
+{
+ mjLib_class = class_new(gensym("mjLib"), (t_newmethod)mjLib_new, 0,
+ sizeof(t_mjLib), 0, (t_atomtype)0);
+
+ pin_tilde_setup();
+ metroplus_setup();
+ monorhythm_setup();
+ prob_setup();
+ about_setup();
+ synapseA_tilde_setup();
+ n2m_setup();
+ morse_setup();
+
+ post("mjLib by mark williamson");
+ post("Contact: mark@junklight.com");
+ post("website: http://www.junklight.com");
+ post("mjLib: version: 0.1 ");
+ post("mjLib: compiled: "__DATE__);
+ post("");
+}
diff --git a/mjLib.dsp b/mjLib.dsp new file mode 100644 index 0000000..4ebb469 --- /dev/null +++ b/mjLib.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="mjLib" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=mjLib - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "mjLib.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "mjLib.mak" CFG="mjLib - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mjLib - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "mjLib - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "mjLib - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f makefile"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile.exe"
+# PROP BASE Bsc_Name "makefile.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f makefile"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "mjLib.exe"
+# PROP Bsc_Name "mjLib.bsc"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "mjLib - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f makefile"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile.exe"
+# PROP BASE Bsc_Name "makefile.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f makefile"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "mjLib.exe"
+# PROP Bsc_Name "mjLib.bsc"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "mjLib - Win32 Release"
+# Name "mjLib - Win32 Debug"
+
+!IF "$(CFG)" == "mjLib - Win32 Release"
+
+!ELSEIF "$(CFG)" == "mjLib - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\about.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\about.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\convolve~.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\convolve~.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\makefile
+# End Source File
+# Begin Source File
+
+SOURCE=.\metroplus.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\metroplus.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\mjLib.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mjLib.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\monorythm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\monorythm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pin~.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pin~.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\prob.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\prob.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\synapseA~.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\SynapseA~.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\things.h
+# End Source File
+# End Target
+# End Project
diff --git a/mjLib.dsw b/mjLib.dsw new file mode 100644 index 0000000..c6605c8 --- /dev/null +++ b/mjLib.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "mjLib"=.\mjLib.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/mjLib.exp b/mjLib.exp Binary files differnew file mode 100644 index 0000000..4901734 --- /dev/null +++ b/mjLib.exp @@ -0,0 +1,29 @@ +#ifdef NT
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the MJLIB_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// MJLIB_API functions as being imported from a DLL, wheras this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef MJLIB_EXPORTS
+#define MJLIB_API __declspec(dllexport)
+#else
+#define MJLIB_API __declspec(dllimport)
+#endif
+
+// This class is exported from the mjLib.dll
+//class MJLIB_API CMjLib {
+//public:
+// CMjLib(void);
+ // TODO: add your methods here.
+//};
+
+//extern MJLIB_API int nMjLib;
+
+//MJLIB_API int fnMjLib(void);
+
+ __declspec(dllexport) void mjLib_setup( void );
+
+ #endif
+
+
\ No newline at end of file diff --git a/mjLib.ilk b/mjLib.ilk Binary files differnew file mode 100644 index 0000000..32c23a9 --- /dev/null +++ b/mjLib.ilk diff --git a/mjLib.lib b/mjLib.lib Binary files differnew file mode 100644 index 0000000..3ae9680 --- /dev/null +++ b/mjLib.lib diff --git a/mjLib.ncb b/mjLib.ncb Binary files differnew file mode 100644 index 0000000..71fdbed --- /dev/null +++ b/mjLib.ncb diff --git a/mjLib.opt b/mjLib.opt Binary files differnew file mode 100644 index 0000000..9623673 --- /dev/null +++ b/mjLib.opt diff --git a/mjLib.pdb b/mjLib.pdb Binary files differnew file mode 100644 index 0000000..2013174 --- /dev/null +++ b/mjLib.pdb diff --git a/mjLib.plg b/mjLib.plg new file mode 100644 index 0000000..09e28ae --- /dev/null +++ b/mjLib.plg @@ -0,0 +1,24 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: mjLib - Win32 Debug--------------------
+</h3>
+
+
+Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
+Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
+
+ cl /c /nologo /W3 /WX /DNT /DPD /Ox /Zi /DVERSION=\"1\" -I. -I..\src -I..\Tcl\include -I"C:\Program Files\Microsoft Visual Studio\VC98"\include convolve~.c
+convolve~.c
+ link /nologo /debug /dll /export:mjLib_setup /out:..\mjLib\mjLib.dll pin~.obj mjLib.obj metroplus.obj monorythm.obj prob.obj about.obj synapseA~.obj convolve~.obj /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NODEFAULTLIB:uuid "C:\Program Files\Microsoft Visual Studio\VC98"\lib\libc.lib "C:\Program Files\Microsoft Visual Studio\VC98"\lib\oldnames.lib "C:\Program Files\Microsoft Visual Studio\VC98"\lib\kernel32.lib "C:\Program Files\Microsoft Visual Studio\VC98"\lib\wsock32.lib "C:\Program Files\Microsoft Visual Studio\VC98"\lib\winmm.lib ..\bin\pd.lib
+ Creating library ..\mjLib\mjLib.lib and object ..\mjLib\mjLib.exp
+
+
+
+<h3>Results</h3>
+mjLib.exe - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/mjLib.sln b/mjLib.sln new file mode 100644 index 0000000..2243381 --- /dev/null +++ b/mjLib.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mjLib", "mjLib.vcproj", "{8E914D93-CEBB-4982-97EC-E9959B300143}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {8E914D93-CEBB-4982-97EC-E9959B300143}.Debug.ActiveCfg = Debug|Win32
+ {8E914D93-CEBB-4982-97EC-E9959B300143}.Debug.Build.0 = Debug|Win32
+ {8E914D93-CEBB-4982-97EC-E9959B300143}.Release.ActiveCfg = Release|Win32
+ {8E914D93-CEBB-4982-97EC-E9959B300143}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mjLib.suo b/mjLib.suo Binary files differnew file mode 100644 index 0000000..d1e6e26 --- /dev/null +++ b/mjLib.suo diff --git a/mjLib.vcproj b/mjLib.vcproj new file mode 100644 index 0000000..0ffe541 --- /dev/null +++ b/mjLib.vcproj @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding = "Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.00"
+ Name="mjLib"
+ SccProjectName=""
+ SccLocalPath=""
+ Keyword="MakeFileProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE">
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="NMAKE /f makefile"
+ ReBuildCommandLine="NMAKE /f makefile /a"
+ Output="mjLib.exe"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE">
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="NMAKE /f makefile"
+ ReBuildCommandLine="NMAKE /f makefile /a"
+ Output="mjLib.exe"/>
+ </Configuration>
+ </Configurations>
+ <Files>
+ <File
+ RelativePath=".\StdAfx.h">
+ </File>
+ <File
+ RelativePath=".\SynapseA~.h">
+ </File>
+ <File
+ RelativePath=".\about.c">
+ </File>
+ <File
+ RelativePath=".\about.h">
+ </File>
+ <File
+ RelativePath=".\convolve~.c">
+ </File>
+ <File
+ RelativePath=".\convolve~.h">
+ </File>
+ <File
+ RelativePath=".\makefile">
+ </File>
+ <File
+ RelativePath=".\metroplus.c">
+ </File>
+ <File
+ RelativePath=".\metroplus.h">
+ </File>
+ <File
+ RelativePath="mjLib.bsc">
+ </File>
+ <File
+ RelativePath=".\mjLib.c">
+ </File>
+ <File
+ RelativePath=".\mjLib.h">
+ </File>
+ <File
+ RelativePath=".\monorythm.c">
+ </File>
+ <File
+ RelativePath=".\monorythm.h">
+ </File>
+ <File
+ RelativePath="morse.c">
+ </File>
+ <File
+ RelativePath="morse.h">
+ </File>
+ <File
+ RelativePath="n2m.c">
+ </File>
+ <File
+ RelativePath="n2m.h">
+ </File>
+ <File
+ RelativePath=".\pin~.c">
+ </File>
+ <File
+ RelativePath=".\pin~.h">
+ </File>
+ <File
+ RelativePath=".\prob.c">
+ </File>
+ <File
+ RelativePath=".\prob.h">
+ </File>
+ <File
+ RelativePath=".\synapseA~.c">
+ </File>
+ <File
+ RelativePath=".\things.h">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/monorythm.c b/monorythm.c new file mode 100644 index 0000000..62bcbac --- /dev/null +++ b/monorythm.c @@ -0,0 +1,238 @@ +#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include "m_pd.h"
+#include <stdlib.h>
+#include<time.h>
+#include "monorythm.h"
+
+/**
+* The monorhythm object is designed to help build polyrythms. Given
+* a time interval and a pattern it produces the pattern within the time
+* interval given. Thus if two where set going with the same time interval
+* the two patterns (assuming they where different) would play against
+* each other.
+*
+* this filename is spelt wrong 'cos I can't spell
+*/
+
+static t_class *monorhythm_class;
+
+/**
+* clock tick - do a bang and wait the next
+* time delay in the list
+*/
+
+static void monorhythm_tick(t_monorhythm *x)
+{
+ if ( x->t_running )
+ {
+ monorhythm_do_beat( x );
+ clock_delay(x->x_clock, x->x_beattime );
+ }
+}
+
+static void monorhythm_do_beat( t_monorhythm* x )
+{
+ float beat;
+ if ( x->x_idx == x->x_size )
+ {
+ x->x_idx = 0;
+
+ }
+ if ( x->x_idx == 0)
+ {
+ outlet_bang( x->x_sync );
+ }
+ beat = x->x_pattern[ x->x_idx++ ];
+ if ( beat > 1 )
+ {
+ if ( x->t_exclusive == 0 )
+ {
+ outlet_bang( x->x_bang );
+ }
+ outlet_bang( x->x_accent );
+ }
+ else if ( beat == 1 )
+ {
+ outlet_bang( x->x_bang );
+ }
+}
+
+
+/**
+* a bang causes a reset to the start of the bar - used to
+* synchronize multiple monorhythm's. If the rhythm is not
+* running it is started
+*/
+
+
+static void monorhythm_bang(t_monorhythm *x)
+{
+ if ( x->x_beattime > 0 )
+ {
+ monorhythm_restart( x );
+ }
+}
+
+/**
+* reset the rhythm to start at the beginning
+*/
+
+static void monorhythm_restart(t_monorhythm *x)
+{
+ if ( x->x_beattime > 0 )
+ {
+ x->t_running = 1;
+ x->x_idx = 0;
+ monorhythm_do_beat( x );
+ clock_delay(x->x_clock, x->x_beattime );
+ }
+}
+
+/**
+* a stop message turns us off
+*/
+
+static void monorhythm_stop(t_monorhythm *x)
+{
+ x->t_running = 0;
+}
+
+/**
+* set exclusive mode
+*/
+
+static void monorhythm_set_exclusive(t_monorhythm *x)
+{
+ x->t_exclusive = 1;
+}
+
+/**
+* set nonexclusive mode
+*/
+
+static void monorhythm_set_nonexclusive(t_monorhythm *x)
+{
+ x->t_exclusive = 0;
+}
+
+/**
+* free our clock and our timer array
+*/
+
+static void monorhythm_free(t_monorhythm *x)
+{
+ clock_free(x->x_clock);
+ free( x->x_pattern );
+}
+
+/*
+* make a new monorhythm - we can provide a list of times
+* so read these in too
+*/
+
+static void *monorhythm_new(t_symbol *s, int argc, t_atom *argv)
+{
+ float f;
+ t_monorhythm *x = (t_monorhythm *)pd_new(monorhythm_class);
+ x->x_pattern = NULL;
+ // parse any settings
+ if ( argc > 0 )
+ {
+ f = atom_getfloat( &argv[0] );
+ monorhythm_set_time( x , f );
+ monorhythm_pattern_seq( x, s , argc - 1 , argv + 1 );
+ }
+ x->t_running=0;
+ x->t_exclusive = 0;
+ // make us some ins and outs
+ x->x_clock = clock_new(x, (t_method)monorhythm_tick);
+ x->x_bang = outlet_new(&x->x_obj, gensym("bang"));
+ x->x_accent = outlet_new(&x->x_obj, gensym("accent"));
+ x->x_sync = outlet_new(&x->x_obj, gensym("sync"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("pattern"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("timeinterval"));
+ return (x);
+}
+
+/**
+* set a time sequence and free the old array
+*/
+
+static void monorhythm_pattern_seq( t_monorhythm *x, t_symbol *s, int ac, t_atom *av )
+{
+ int i;
+ if ( x->x_pattern != NULL )
+ {
+ free( x->x_pattern );
+ }
+ if ( ac > 0 )
+ {
+ x->x_pattern = (float *) malloc( ac * sizeof( float ));
+ for( i = 0 ; i < ac ; i++ )
+ {
+ float t = atom_getfloat( &av[i] );
+ x->x_pattern[i] = t;
+ }
+ x->x_size=ac;
+ monorhythm_calculate_beat_interval( x );
+ }
+ else
+ {
+ // if there is no pattern it doens't do anything
+ x->x_pattern = NULL;
+ x->x_size=0;
+ x->t_running = 0;
+ }
+ x->x_idx = 0;
+}
+
+/**
+* the time interval is divided by the number of beats that are
+* going to happen in order to get the beat time. If this would
+* be invallid for any reason it is set to 0 and the rhythm is stopped
+*/
+
+static void monorhythm_calculate_beat_interval( t_monorhythm *x )
+{
+ if ( ( x->x_size > 0 ) && ( x->x_time > 0 ))
+ {
+ x->x_beattime = x->x_time / x->x_size;
+ }
+ else
+ {
+ x->x_beattime = 0;
+ x->t_running = 0;
+ }
+}
+
+/**
+* set the time - recalculate the beat time
+*/
+
+static void monorhythm_set_time( t_monorhythm *x, t_float f )
+{
+ x->x_time = f;
+ monorhythm_calculate_beat_interval( x );
+}
+
+/**
+* make a new one and setup all of our messages
+*/
+
+ void monorhythm_setup(void)
+{
+ monorhythm_class = class_new(gensym("monorhythm"), (t_newmethod)monorhythm_new,
+ (t_method)monorhythm_free, sizeof(t_monorhythm), 0, A_GIMME, 0);
+ class_addbang(monorhythm_class, monorhythm_bang);
+ class_addmethod(monorhythm_class, (t_method)monorhythm_stop, gensym("stop"), 0);
+ class_addmethod(monorhythm_class, (t_method)monorhythm_bang, gensym("start"), 0);
+ class_addmethod(monorhythm_class, (t_method)monorhythm_pattern_seq, gensym("pattern" ), A_GIMME, 0);
+ class_addmethod(monorhythm_class, (t_method)monorhythm_set_time, gensym("timeinterval" ), A_FLOAT, 0);
+ class_addmethod(monorhythm_class, (t_method)monorhythm_set_exclusive,gensym("exclusive"),0);
+ class_addmethod(monorhythm_class, (t_method)monorhythm_set_nonexclusive,gensym("nonexclusive"),0);
+ class_sethelpsymbol(monorhythm_class, gensym("mjLib/monorhythm"));
+}
+
diff --git a/monorythm.h b/monorythm.h new file mode 100644 index 0000000..4a0f503 --- /dev/null +++ b/monorythm.h @@ -0,0 +1,33 @@ +
+typedef struct _monorhythm
+{
+ t_object x_obj;
+ t_clock *x_clock;
+ t_float *x_pattern;
+ int x_idx;
+ int x_size;
+ t_float x_time;
+ t_float x_beattime;
+ int t_running;
+ int t_exclusive;
+ t_outlet *x_bang;
+ t_outlet *x_sync;
+ t_outlet *x_accent;
+} t_monorhythm;
+
+static void monorhythm_tick(t_monorhythm *x);
+static void monorhythm_start(t_monorhythm *x);
+static void monorhythm_stop(t_monorhythm *x);
+static void monorhythm_free(t_monorhythm *x);
+static void *monorhythm_new(t_symbol *s, int argc, t_atom *argv);
+static void monorhythm_pattern_seq( t_monorhythm *x, t_symbol *s, int ac, t_atom *av );
+static void monorhythm_time_float( t_monorhythm *x1, t_float f );
+static void monorhythm_calculate_beat_interval( t_monorhythm *x );
+static void monorhythm_set_time( t_monorhythm *x, t_float f );
+static void monorhythm_restart(t_monorhythm *x);
+static void monorhythm_do_beat( t_monorhythm* x );
+static void monorhythm_set_exclusive(t_monorhythm *x);
+static void monorhythm_set_nonexclusive(t_monorhythm *x);
+
+
+
@@ -0,0 +1,303 @@ +#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include "m_pd.h"
+#include <stdlib.h>
+#include<time.h>
+#include "morse.h"
+
+/**
+* The morse object is designed to translate messages into
+* morse code. There are two outlets - a dot outlet and a dash
+* outlet (from left to right). In addition there is an end of
+* current message outlet. Each character in the current message
+* is emited upon reciept of a bang allowing external control over the
+* timing. A dot lasts one bang - a dash lasts three bangs, the space
+* between dots and dashes is one bang, the space between characters is
+* three bangs, the space between words is seven bangs
+* it currently only does digits and numbers
+*/
+
+static t_class *morse_class;
+char* morseletter[] = {
+ ".-",
+ "-...",
+ "-.-.",
+ "-..",
+ ".",
+ "..-.",
+ "--.",
+ "....",
+ "..",
+ ".---",
+ "-.-",
+ ".-..",
+ "--",
+ "-.",
+ "---",
+ ".--.",
+ "--.-",
+ ".-.",
+ "...",
+ "-",
+ "..-",
+ "...-",
+ ".--",
+ "-..-",
+ "-.--",
+ "--..",
+};
+char * morsedigit[] = {
+ "-----",
+ ".----",
+ "..---",
+ "...--",
+ "....-",
+ ".....",
+ "-....",
+ "--...",
+ "---..",
+ "----.",
+};
+
+char* wordspace = "X";
+
+
+/**
+* a bang causes a reset to the start of the bar - used to
+* synchronize multiple morse's. If the rhythm is not
+* running it is started
+*/
+
+
+static void morse_bang(t_morse *x)
+{
+ if( x->x_spaceticks > 0 )
+ {
+ //post("Tick");
+ x->x_spaceticks--;
+ }
+ else
+ {
+ if ( x->x_curmsg != NULL)
+ {
+ if ( x->x_curmsg->idx != x->x_curmsg->length )
+ {
+ if( x->x_curmsg->msg == wordspace )
+ {
+ //post("Doing wordspace");
+ x->x_spaceticks =6;
+ x->x_curmsg->idx = 0;
+ x->x_curmsg = x->x_curmsg->next;
+ }
+ else
+ {
+ //post("Doing %c" , x->x_curmsg->msg[ x->x_curmsg->idx++ ]);
+ if( x->x_curmsg->msg[ x->x_curmsg->idx ] == '.')
+ {
+ outlet_bang( x->x_dot );
+ x->x_spaceticks = 1;
+ }
+ else
+ {
+ outlet_bang( x->x_dash );
+ x->x_spaceticks = 3;
+ }
+ x->x_curmsg->idx++ ;
+
+ }
+ }
+ else
+ {
+ if( x->x_curmsg->next != NULL )
+ {
+ if( x->x_curmsg->next->msg != wordspace )
+ {
+ //post( "Doing space" );
+ x->x_spaceticks =2;
+ }
+ else if ( x->x_curmsg->next->next == NULL )
+ {
+ //post("message end");
+ outlet_bang( x->x_end );
+ x->x_curmsg->idx = 0;
+ x->x_spaceticks = 0;
+ x->x_curmsg = x->x_curmsg->next;
+ }
+ }
+ x->x_curmsg->idx = 0;
+ x->x_curmsg = x->x_curmsg->next;
+ }
+ }
+ }
+}
+
+static void morse_rewind( t_morse *x)
+{
+ x->x_curmsg->idx = 0;
+ x->x_spaceticks = 0;
+ x->x_curmsg = x->x_msg;
+}
+
+
+/**
+* free our clock and our timer array
+*/
+
+static void morse_free(t_morse *x)
+{
+ outlet_free( x->x_dot );
+ outlet_free( x->x_dash );
+ outlet_free( x->x_end );
+ if( x->x_msg != NULL )
+ {
+ morse_freemsg( x->x_msg );
+ }
+}
+
+static void morse_freemsg( morse_msglet* msg)
+{
+ if ( msg->next != NULL )
+ {
+ morse_freemsg( msg->next );
+ }
+ freebytes( (void*) msg , sizeof( morse_msglet) );
+}
+
+
+/*
+* make a new morse - we can provide a list of times
+* so read these in too
+*/
+
+static void *morse_new(t_symbol *s, int argc, t_atom *argv)
+{
+ float f;
+ t_morse *x = (t_morse *)pd_new(morse_class);
+ x->x_msg = NULL;
+ // parse any settings
+ if ( argc > 0 )
+ {
+ morse_message( x, s , argc , argv );
+ }
+ // make us some ins and outs
+ x->x_dot = outlet_new(&x->x_obj, gensym("dot"));
+ x->x_dash = outlet_new(&x->x_obj, gensym("dash"));
+ x->x_end = outlet_new(&x->x_obj, gensym("end"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("msg"));
+ return (x);
+}
+
+/**
+* set a message and free the old array
+*/
+
+static void morse_message( t_morse *x, t_symbol *s, int ac, t_atom *av )
+{
+ int i,j,l;
+ if ( x->x_msg != NULL )
+ {
+ morse_freemsg( x->x_msg );
+ x->x_msg = NULL;
+ x->x_curmsg = NULL;
+ x->x_spaceticks =0;
+ }
+ if ( ac > 0 )
+ {
+ char buf[256];
+ for( i = 0 ; i < ac ; i++ )
+ {
+ atom_string( &av[i] , buf, 255 );
+ l = strlen( buf );
+ strlwr( buf );
+ for( j = 0 ; j < l ; j++ )
+ {
+ morse_add_msg_part( x , morse_lookup( buf[j] ));
+ }
+ morse_add_msg_part( x , wordspace );
+ }
+ x->x_curmsg = x->x_msg;
+ x->x_spaceticks =0;
+ }
+ else
+ {
+ // if there is no pattern it doens't do anything
+ x->x_msg = NULL;
+ x->x_curmsg = NULL;
+ x->x_spaceticks =0;
+ }
+}
+
+/**
+* add a non null msg part onto the end of the message list - if its null
+* the lookup failed and we just ignore it
+*/
+
+static void morse_add_msg_part( t_morse *x , char *msgpart )
+{
+ morse_msglet* idx;
+ morse_msglet* nmsg;
+ if ( msgpart != NULL )
+ {
+ idx = x->x_msg;
+ if ( idx == NULL )
+ {
+ nmsg = idx = (morse_msglet*) getbytes( sizeof( morse_msglet) );
+ x->x_msg = nmsg;
+ }
+ else
+ {
+ while( idx->next != NULL ) { idx = idx->next; }
+ idx->next = nmsg = (morse_msglet*) getbytes( sizeof( morse_msglet) );
+ }
+ nmsg->next = NULL;
+ nmsg->idx = 0;
+ if( msgpart == wordspace )
+ {
+ nmsg->length = -1;
+ }
+ else
+ {
+ nmsg->length = strlen( msgpart );
+ }
+ nmsg->msg = msgpart;
+ }
+}
+
+/**
+* morse lookup returns a pointer to a character representation of the morse
+* code for a given character. If the character is not recognized then NULL
+* is returned. DO NOT TRY TO FREE THE RETURNED POINTER - its part
+* of the array above
+*/
+
+static char *morse_lookup( char c )
+{
+ if( ( c>= 'a') && ( c<='z'))
+ {
+ return ( morseletter[ c - 'a'] );
+ }
+ else if( ( c>= '0') && ( c<='9'))
+ {
+ return ( morsedigit[ c - '0'] );
+ }
+ return NULL;
+}
+
+/**
+* make a new one and setup all of our messages
+*/
+
+ void morse_setup(void)
+{
+ morse_class = class_new(gensym("morse"), (t_newmethod)morse_new,
+ (t_method)morse_free, sizeof(t_morse), 0, A_GIMME, 0);
+ class_addbang(morse_class, morse_bang);
+ class_addmethod(morse_class, (t_method)morse_message, gensym("msg" ), A_GIMME, 0);
+ //class_addmethod(morse_class, (t_method)morse_set_time, gensym("timeinterval" ), A_FLOAT, 0);
+ class_addmethod(morse_class, (t_method)morse_rewind,gensym("rewind"),0);
+ //class_addmethod(morse_class, (t_method)morse_set_nonexclusive,gensym("nonexclusive"),0);
+ class_sethelpsymbol(morse_class, gensym("mjLib/morse"));
+}
+
@@ -0,0 +1,34 @@ +
+
+
+typedef struct _msglet
+{
+ char* msg;
+ int idx;
+ int length;
+ struct _msglet *next;
+} morse_msglet;
+
+typedef struct _morse
+{
+ t_object x_obj;
+
+ morse_msglet *x_msg;
+ morse_msglet *x_curmsg;
+ int x_spaceticks;
+ t_outlet *x_dot;
+ t_outlet *x_dash;
+ t_outlet *x_end;
+} t_morse;
+
+
+static void morse_add_msg_part( t_morse *x , char *msgpart );
+static char *morse_lookup( char c );
+static void morse_freemsg( morse_msglet* msg);
+static void morse_free(t_morse *x);
+static void *morse_new(t_symbol *s, int argc, t_atom *argv);
+static void morse_message( t_morse *x, t_symbol *s, int ac, t_atom *av );
+static void morse_do_beat( t_morse* x );
+
+
+
@@ -0,0 +1,131 @@ +#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#include<stdio.h>
+#endif
+#include "m_pd.h"
+#include <stdlib.h>
+#include<time.h>
+#include "n2m.h"
+
+char* notes_up[12] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
+int octaveoffset[11] = { 0 , 12, 24 ,36, 48, 60, 72, 84, 96, 108 ,120 };
+
+/**
+* The n2m object is designed to output a midi note number
+* in response to a note name of the form <note name><octave>
+* for example C5 or D#3.
+*/
+
+static t_class *n2m_class;
+
+/*
+* make a new n2m it takes one parameter - the percentage error
+*/
+
+static void *n2m_new( t_float f )
+{
+ t_n2m *x = (t_n2m *)pd_new(n2m_class);
+ // make us an output for the note number
+ outlet_new(&x->x_obj, gensym("float"));
+ return (x);
+}
+
+static void n2m_free(t_n2m *x)
+{
+ // nothing doing here for now
+}
+
+/**
+* set the error factor
+*/
+
+static void n2m_notename( t_n2m *x, t_symbol *s, int ac, t_atom *av )
+{
+ char buf[255];
+ char note[255];
+ int octave;
+ int i;
+ for( i = 0 ; i < ac ; i++ )
+ {
+ atom_string( &av[i] , buf, 255 );
+ //post("Symbol [%s]", buf );
+ splitsym( buf , note , &octave );
+ //post( "Which is %s note and %u octave and midi value %d" , note , octave , midilookup( note , octave ) );
+ outlet_float( x->x_obj.ob_outlet , midilookup( note , octave ) );
+ }
+}
+
+/**
+* make a new one and setup all of our messages
+*/
+
+ void n2m_setup(void)
+{
+ n2m_class = class_new(gensym("n2m"), (t_newmethod)n2m_new,
+ (t_method)n2m_free, sizeof(t_n2m), 0, 0);
+ class_addmethod(n2m_class, (t_method)n2m_notename, gensym("note" ), A_GIMME, 0);
+ class_sethelpsymbol(n2m_class, gensym("mjLib/n2m"));
+}
+
+/**
+* splitsym takes a note symbol and splits it into note and octave
+* if note not specified it defaults to C and if octave not specified
+* it defaults to 4
+*/
+
+static void splitsym( char* buf , char* note, int* octave )
+{
+ int i,j;
+ int split = -1;
+ for( i = 0 ; buf[i] != 0 ; i++ )
+ {
+ if ( ( buf[i] >= '0' ) && ( buf[i] <= '9'))
+ {
+ split = i;
+ if ( i > 0 )
+ {
+ for( j=0; j < i;j++) { note[j] = buf[j]; }
+ note[i] = 0;
+ }
+ else
+ {
+ note[0] = 'C';
+ note[1] = 0;
+ }
+ sscanf( buf + i , "%u" , octave );
+ break;
+ }
+ }
+ if ( split == -1 )
+ {
+ i = 0;
+ while( buf[i] != 0 )
+ {
+ note[i] = buf[i];
+ i++;
+ }
+ note[i] = 0;
+ *octave = 4;
+ }
+}
+
+/**
+* return a midi note value for a given note name and octave
+*/
+
+static int midilookup( char* note , int octave )
+{
+ int i,j;
+ int nnum = 4;
+ for( i = 0 ; i < 12 ; i++ )
+ {
+ if ( stricmp( note , notes_up[i]) == 0)
+ {
+ nnum = i;
+ break;
+ }
+ }
+ return octaveoffset[octave + 1 ] + nnum;
+}
+
@@ -0,0 +1,15 @@ +
+typedef struct _n2m
+{
+ t_object x_obj;
+ t_float x_err;
+} t_n2m;
+
+static void *n2m_new( t_float t );
+static void n2m_set_err( t_n2m *x, t_float f );
+static void n2m_float( t_n2m *x, t_float f );
+static void n2m_free(t_n2m *x);
+static void splitsym( char* buf , char* note, int* octave );
+static int midilookup( char* note , int octave );
+
+
@@ -0,0 +1,205 @@ +#include "m_pd.h"
+#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include <stdlib.h>
+#include<time.h>
+
+#include "pin~.h"
+
+/* ------------------------ pin_tilde~ ----------------------------- */
+
+static t_class *pin_tilde_class;
+
+/**
+* the perform routine unpacks its parameters
+* looks to see if time is zero (do channel prob
+* everytime) if it is to chooses a channel.
+* the routine then copies everything in the input
+* to the choosen output
+*/
+
+t_int *pin_tilde_perform(t_int *w)
+{
+ float *in = (float *)(w[1]);
+ float *outl = (float *)(w[2]);
+ float *outr = (float *)(w[3]);
+ t_pin_tilde*obj = (t_pin_tilde *)(w[4]);
+ int n = (t_int)(w[5]);
+ int i = 0;
+ if ( obj->p_ticktime <= 0 )
+ {
+ if ( rand() < obj->p_normalized_prob )
+ {
+ obj->p_outchannel=0;
+ }
+ else
+ {
+ obj->p_outchannel=1;
+ }
+ }
+ if ( obj->p_outchannel == 0 )
+ {
+ for( i = 0 ; i< n ; i++ )
+ {
+ *outl++ = *in++;
+ *outr++ = 0;
+ }
+ }
+ else
+ {
+ for( i = 0 ; i< n ; i++ )
+ {
+ *outr++ = *in++;
+ *outl++ = 0;
+ }
+ }
+ return w+6;
+}
+
+/**
+* set up our dsp perform routine - it takes parameters
+* the input channel, the output channels ( left and right),
+* the pin object and the number of samples in the array
+*/
+
+static void pin_tilde_dsp(t_pin_tilde *x, t_signal **sp)
+{
+ dsp_add(pin_tilde_perform, 5,sp[0]->s_vec, sp[1]->s_vec , sp[2]->s_vec , x ,sp[0]->s_n);
+}
+
+/**
+* free up the tilde object - for now we only need
+* to get rid of the clock
+*/
+
+static void pin_tilde_free(t_pin_tilde *x)
+{
+ clock_free( x->p_clock );
+}
+
+/**
+* make a new object - set up out internal variables
+* and add our inlets and outlets
+*/
+
+static void *pin_tilde_new(t_floatarg prob , t_floatarg tick)
+{
+ t_pin_tilde *x = (t_pin_tilde *)pd_new(pin_tilde_class);
+ if ( prob < 0 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 0;
+ }
+ else if( prob > 1 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 1;
+ }
+ else if (prob == 0 )
+ {
+ // note that prob defaullts to 0.5
+ prob = 0.5;
+ }
+ x->p_prob = prob;
+ x->p_normalized_prob = prob * RAND_MAX;
+ // set up our clocks
+ x->p_ticktime = tick;
+ x->p_clock = clock_new(x, (t_method) pin_tilde_tick);
+ if (x->p_ticktime > 0)
+ {
+ clock_delay(x->p_clock, x->p_ticktime);
+ }
+ // start off with a random channel
+ if ( rand() < x->p_normalized_prob )
+ {
+ x->p_outchannel=0;
+ }
+ else
+ {
+ x->p_outchannel=1;
+ }
+ // set up our inlets
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("prob"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("tick"));
+ outlet_new(&x->x_obj, gensym("signal"));
+ outlet_new(&x->x_obj, gensym("signal"));
+ return (x);
+}
+
+/**
+* ticktime has been set - we only care about ticks above
+* zero.
+*/
+
+static void pin_tilde_ticktime( t_pin_tilde* x, t_float tick )
+{
+ x->p_ticktime = tick;
+ if ( x->p_ticktime > 0 )
+ {
+ clock_delay(x->p_clock, x->p_ticktime);
+ }
+}
+
+/**
+* allows the probability to be set - note that although
+* we accept a probability between 0 and 1 we need to
+* normalize it becuase rand() produces a number between
+* 0 and rand_max. We precalucluate the normalized
+* number becuase we sometimes use it in the dsp routine
+* (if tick is zero).
+*/
+
+static void pin_tilde_prob( t_pin_tilde* x, t_float prob )
+{
+ if ( prob < 0 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 0;
+ }
+ else if( prob > 1 )
+ {
+ post("probability must be between 0 and 1 ");
+ prob = 1;
+ }
+ x->p_prob=prob;
+ x->p_normalized_prob = prob * RAND_MAX;
+}
+
+/**
+* clock tick - choose a channel and wait again
+*/
+
+static void pin_tilde_tick(t_pin_tilde *x)
+{
+ if ( rand() < x->p_normalized_prob )
+ {
+ x->p_outchannel=0;
+ }
+ else
+ {
+ x->p_outchannel=1;
+ }
+ if (x->p_ticktime > 0)
+ {
+ clock_delay(x->p_clock, x->p_ticktime);
+ }
+}
+
+/**
+* setup - add our methods and seed the random number generator
+*/
+
+void pin_tilde_setup(void)
+{
+ srand( (unsigned) time( NULL ) );
+ pin_tilde_class = class_new(gensym("pin~"), (t_newmethod) pin_tilde_new, (t_method) pin_tilde_free,
+ sizeof(t_pin_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ CLASS_MAINSIGNALIN( pin_tilde_class, t_pin_tilde, x_f);
+ class_addmethod(pin_tilde_class, (t_method) pin_tilde_dsp, gensym("dsp"), (t_atomtype)0);
+ class_addmethod(pin_tilde_class, (t_method) pin_tilde_ticktime, gensym("tick") , A_DEFFLOAT , (t_atomtype)0 );
+ class_addmethod(pin_tilde_class, (t_method) pin_tilde_prob, gensym("prob") , A_DEFFLOAT , (t_atomtype)0 );
+ class_sethelpsymbol(pin_tilde_class, gensym("mjLib/pin~"));
+}
+
@@ -0,0 +1,23 @@ +/* declarations for the pin~ object */
+
+typedef struct _pin_tilde
+{
+ t_object x_obj;
+ float p_prob;
+ float p_ticktime;
+ int p_outchannel;
+ t_clock* p_clock;
+ long p_numticks;
+ int p_normalized_prob;
+ float x_f;
+} t_pin_tilde;
+
+t_int *pin_tilde_perform(t_int *w);
+static void pin_tilde_dsp(t_pin_tilde *x, t_signal **sp);
+static void pin_tilde_free(t_pin_tilde *x);
+static void *pin_tilde_new(t_floatarg prob , t_floatarg tick);
+static void pin_tilde_float(t_pin_tilde* x, t_float n);
+static void pin_tilde_ticktime( t_pin_tilde* x, t_float tick );
+static void pin_tilde_prob( t_pin_tilde* x, t_float prob );
+static void pin_tilde_tick(t_pin_tilde *x);
+
@@ -0,0 +1,143 @@ +#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include "m_pd.h"
+#include <stdlib.h>
+#include<time.h>
+#include "prob.h"
+
+/**
+* The prob object is designed to generate random events
+* with a given probability - essentially every clock tick
+* it looks to see if it should generate an event or not
+*/
+
+static t_class *prob_class;
+
+/**
+* clock tick - do a bang and wait the next
+* time delay in the list
+*/
+
+static void prob_tick(t_prob *x)
+{
+ if ( x->x_running )
+ {
+ if ( prob_event( x) )
+ {
+ outlet_bang(x->x_obj.ob_outlet);
+ }
+ clock_delay(x->x_clock, x->x_time );
+ }
+}
+
+/**
+* prob event looks to see if we should generate and event or not
+*/
+
+static int prob_event( t_prob* x )
+{
+ int ret = 0;
+ if ( rand() < x->x_probability * RAND_MAX)
+ {
+ ret = 1;
+ }
+ return ret;
+}
+
+/**
+* a bang causes a reset to the start of the bar - used to
+* synchronize multiple prob's. If the rhythm is not
+* running it is started
+*/
+
+static void prob_bang(t_prob *x)
+{
+ x->x_running = 1;
+ clock_delay(x->x_clock, x->x_time );
+}
+
+/**
+* a stop message turns us off
+*/
+
+static void prob_stop(t_prob *x)
+{
+ x->x_running = 0;
+}
+
+/**
+* free our clock and our timer array
+*/
+
+static void prob_free(t_prob *x)
+{
+ clock_free(x->x_clock);
+}
+
+/*
+* make a new prob - we can provide a list of times
+* so read these in too
+*/
+
+static void *prob_new(t_float t , t_float probability )
+{
+ t_prob *x = (t_prob *)pd_new(prob_class);
+ prob_set_time( x , t );
+ prob_set_probability( x , probability );
+ x->x_running=0;
+ // make us some ins and outs
+ x->x_clock = clock_new(x, (t_method)prob_tick);
+ outlet_new(&x->x_obj, gensym("bang"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("time"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("probability"));
+ return (x);
+}
+
+/**
+* set the probability
+*/
+
+static void prob_set_probability( t_prob *x, t_float f )
+{
+ if ( f < 0 )
+ {
+ post("probability must be between 0 and 1 ");
+ f = 0;
+ }
+ else if( f > 1 )
+ {
+ post("probability must be between 0 and 1 ");
+ f = 1;
+ }
+ x->x_probability = f;
+}
+
+
+/**
+* set the time
+*/
+
+static void prob_set_time( t_prob *x, t_float f )
+{
+ x->x_time = f;
+}
+
+/**
+* make a new one and setup all of our messages
+*/
+
+ void prob_setup(void)
+{
+ srand( (unsigned) time( NULL ) );
+ prob_class = class_new(gensym("prob"), (t_newmethod)prob_new,
+ (t_method)prob_free, sizeof(t_prob), 0, A_DEFFLOAT , A_DEFFLOAT, 0);
+ class_addbang(prob_class, prob_bang);
+ class_addmethod(prob_class, (t_method)prob_stop, gensym("stop"), 0);
+ class_addmethod(prob_class, (t_method)prob_bang, gensym("start"), 0);
+ class_addmethod(prob_class, (t_method)prob_set_probability, gensym("probability" ), A_FLOAT, 0);
+ class_addmethod(prob_class, (t_method)prob_set_time, gensym("time" ), A_FLOAT, 0);
+ class_sethelpsymbol(prob_class, gensym("mjLib/prob"));
+}
+
@@ -0,0 +1,18 @@ +
+typedef struct _prob
+{
+ t_object x_obj;
+ t_clock *x_clock;
+ t_float x_time;
+ t_float x_probability;
+ t_float x_running;
+} t_prob;
+
+static void prob_tick(t_prob *x);
+static void prob_start(t_prob *x);
+static void prob_stop(t_prob *x);
+static void prob_free(t_prob *x);
+static void *prob_new( t_float , t_float);
+static void prob_set_time( t_prob *x, t_float f );
+static void prob_set_probability( t_prob *x, t_float f );
+static int prob_event(t_prob *x);
diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..0fe0d9c --- /dev/null +++ b/readme.txt @@ -0,0 +1,78 @@ +mjLib
+
+by
+mark williamson
+mailto:mark@junklight.com
+http://www.junklight.com
+
+The code is free for anyone to use provided you mention me somewhere - its not
+like its going to cost you anything :-). If you need support you can try
+mailing me at the address above - I can be quite busy but I will try and
+deal with any queries.
+
+Linux
+
+It is built under windows but I have included the various build files needed
+for linux - delete the file "makefile" and use the configure script to
+make a new one for linux. The files needed by autoconf are there anyway
+if that doesn't work. I can't run PD on the linux machine I have got
+access to (only telnet access) so I am not sure about installing it but all the
+stuff should be there.
+
+Windows
+
+There is a VC++ 6 project file included an it builds fine with that. I haven't
+tried anyother tools as yet. However there is a binary version included
+in case you haven't got the compiler.
+
+To install - add mjLib.dll to your pd library path:
+
+ -lib C:\pd\mjLib\mjLib
+
+and copy the contents of doc\mjLib into
+
+ [pd home]\docs\5.reference\mjLib
+
+that should be you done.
+
+General notes
+
+This library will grow a bit - there are a few more objects that I want to
+put into it.
+
+There are currently five objects:
+
+ pin~ - randomly delivers the input signal to either the right or left outlet with a given probability
+ metroplus - allows complex timing bangs to be delivered
+ prob - generates random events with a given probability
+ monorhythm - basic rhythm pattern building blocks that allows polyrhthms to be generated quickly and easily
+ about - delivers a number that is "about" the same as the input number.
+
+
+mark williamson
+January 2002
+
+___________________________________________________________
+
+history:
+
+1st February release 2
+
+added new mode to monorhythm (exclusive - allows the beat and accent bangs to be mutually exclusive)
+added about object
+
+1st february release 1
+
+added linux build files - not properly tested
+
+31st January 2002
+
+added prob and monorythm
+
+30th January 2002
+
+mods to metroplus to allow it to work just like metro is complex time mode not needed
+
+29th january 2002
+
+first release containing pin~ and metroplus
diff --git a/synapseA~.c b/synapseA~.c new file mode 100644 index 0000000..5498c41 --- /dev/null +++ b/synapseA~.c @@ -0,0 +1,118 @@ +#include "m_pd.h"
+#ifdef NT
+#include "stdafx.h"
+#include <io.h>
+#endif
+#include <stdlib.h>
+#include<time.h>
+
+#include "synapseA~.h"
+
+/* ------------------------ synapseA_tilde~ ----------------------------- */
+
+static t_class *synapseA_tilde_class;
+
+/**
+* do an average and see if it is bigger than our threshold
+* then check for state change and output accordingly
+*/
+
+t_int *synapseA_tilde_perform(t_int *w)
+{
+ float *in = (float *)(w[1]);
+ t_synapseA_tilde *x = (t_synapseA_tilde *)(w[2]);
+ int n = (t_int)(w[3]);
+
+ t_float buf = 0.;
+
+ while (n--)
+ {
+ buf += *in++;
+ }
+ if ( buf*x->n_inv > x->x_threshold )
+ {
+ if( !x->x_state )
+ {
+ x->x_state = 1;
+ outlet_float( x->x_obj.ob_outlet , x->x_state );
+ outlet_bang( x->x_onbang );
+ }
+ }
+ else
+ {
+ if( x->x_state )
+ {
+ x->x_state = 0;
+ outlet_float( x->x_obj.ob_outlet , x->x_state );
+ outlet_bang( x->x_offbang );
+ }
+ }
+ return (w+4);
+}
+
+/**
+* set up our dsp perform routine - it takes parameters
+* the input channel, the output channels ( left and right),
+* the pin object and the number of samples in the array
+*/
+
+static void synapseA_tilde_dsp(t_synapseA_tilde *x, t_signal **sp)
+{
+ x->n_inv=1./sp[0]->s_n;
+ dsp_add(synapseA_tilde_perform, 3,sp[0]->s_vec , x ,sp[0]->s_n);
+}
+
+/**
+* free up the tilde object - for now we only need
+* to get rid of the clock
+*/
+
+static void synapseA_tilde_free(t_synapseA_tilde *x)
+{
+
+}
+
+static void synapseA_tilde_threshold(t_synapseA_tilde *x, t_float f )
+{
+ if ( f > 0 )
+ {
+ x->x_threshold = f;
+ }
+ else
+ {
+ post( "Threshold must be bigger than 0 - setting to 0");
+ x->x_threshold = 0;
+ }
+}
+
+/**
+* make a new object - set up out internal variables
+* and add our inlets and outlets
+*/
+
+static void *synapseA_tilde_new(t_floatarg prob , t_floatarg tick)
+{
+ // set up our inlets
+ t_synapseA_tilde *x = (t_synapseA_tilde *)pd_new(synapseA_tilde_class);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("threshold"));
+ outlet_new(&x->x_obj, gensym("float"));
+ x->x_onbang = outlet_new(&x->x_obj, gensym("bang"));
+ x->x_offbang = outlet_new(&x->x_obj, gensym("bang"));
+ return (x);
+}
+
+
+/**
+* setup - add our methods and seed the random number generator
+*/
+
+ void synapseA_tilde_setup(void)
+{
+ synapseA_tilde_class = class_new(gensym("synapseA~"), (t_newmethod) synapseA_tilde_new, (t_method) synapseA_tilde_free,
+ sizeof(t_synapseA_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ CLASS_MAINSIGNALIN( synapseA_tilde_class, t_synapseA_tilde, x_f);
+ class_addmethod(synapseA_tilde_class, (t_method) synapseA_tilde_dsp, gensym("dsp"), (t_atomtype)0);
+ class_addmethod(synapseA_tilde_class, (t_method) synapseA_tilde_threshold, gensym("threshold") , A_DEFFLOAT , (t_atomtype)0 );
+ class_sethelpsymbol(synapseA_tilde_class, gensym("mjLib/synapseA~"));
+}
+
diff --git a/things.h b/things.h new file mode 100644 index 0000000..7c20e80 --- /dev/null +++ b/things.h @@ -0,0 +1,18 @@ +
+#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
+extern "C" {
+#endif
+
+void pin_tilde_setup();
+void metroplus_setup(void);
+void monorhythm_setup(void);
+void prob_setup(void);
+void about_setup(void);
+void synapseA_tilde_setup(void);
+void convolve_tilde_setup(void);
+void n2m_setup(void);
+void morse_setup(void);
+
+#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
+}
+#endif
\ No newline at end of file diff --git a/vc70.pdb b/vc70.pdb Binary files differnew file mode 100644 index 0000000..c37d91a --- /dev/null +++ b/vc70.pdb |