aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/dyn
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-01-30 17:13:00 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-01-30 17:13:00 +0000
commite0be7cac38aecb4e22e596a82cecccce5c3dcb94 (patch)
tree812d56d53f8a55b42d3e239557f018ad8ba23e24 /externals/grill/dyn
parent16b860c92fcd9670354b26570dce4d1a3d681029 (diff)
""
svn path=/trunk/; revision=370
Diffstat (limited to 'externals/grill/dyn')
-rw-r--r--externals/grill/dyn/build-pd-darwin.sh11
-rw-r--r--externals/grill/dyn/build-pd-linux.sh11
-rw-r--r--externals/grill/dyn/build-pd-msvc.bat4
-rw-r--r--externals/grill/dyn/config-pd-darwin.txt32
-rw-r--r--externals/grill/dyn/config-pd-linux.txt31
-rw-r--r--externals/grill/dyn/config-pd-msvc.txt22
-rw-r--r--externals/grill/dyn/dyn.dsp95
-rw-r--r--externals/grill/dyn/gpl.txt346
-rw-r--r--externals/grill/dyn/license.txt50
-rw-r--r--externals/grill/dyn/make-files.txt6
-rw-r--r--externals/grill/dyn/makefile.pd-darwin79
-rw-r--r--externals/grill/dyn/makefile.pd-linux80
-rw-r--r--externals/grill/dyn/makefile.pd-msvc60
-rw-r--r--externals/grill/dyn/pd/dyn~.pd117
-rw-r--r--externals/grill/dyn/src/main.cpp590
15 files changed, 1534 insertions, 0 deletions
diff --git a/externals/grill/dyn/build-pd-darwin.sh b/externals/grill/dyn/build-pd-darwin.sh
new file mode 100644
index 00000000..edd03207
--- /dev/null
+++ b/externals/grill/dyn/build-pd-darwin.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. config-pd-darwin.txt
+
+make -f makefile.pd-darwin &&
+{
+ if [ $INSTPATH != "" ]; then
+ echo Now install as root
+ sudo make -f makefile.pd-darwin install
+ fi
+}
diff --git a/externals/grill/dyn/build-pd-linux.sh b/externals/grill/dyn/build-pd-linux.sh
new file mode 100644
index 00000000..413650f7
--- /dev/null
+++ b/externals/grill/dyn/build-pd-linux.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. config-pd-linux.txt
+
+make -f makefile.pd-linux &&
+{
+ if [ $INSTPATH != "" ]; then
+ echo Now install as root
+ su -c "make -f makefile.pd-linux install"
+ fi
+}
diff --git a/externals/grill/dyn/build-pd-msvc.bat b/externals/grill/dyn/build-pd-msvc.bat
new file mode 100644
index 00000000..d6187f08
--- /dev/null
+++ b/externals/grill/dyn/build-pd-msvc.bat
@@ -0,0 +1,4 @@
+@echo --- Building with MS Visual C++ ---
+
+nmake -f makefile.pd-msvc clean
+nmake -f makefile.pd-msvc
diff --git a/externals/grill/dyn/config-pd-darwin.txt b/externals/grill/dyn/config-pd-darwin.txt
new file mode 100644
index 00000000..cce81447
--- /dev/null
+++ b/externals/grill/dyn/config-pd-darwin.txt
@@ -0,0 +1,32 @@
+# dyn~ - dynamic object management for PD
+#
+# Copyright (c)Thomas Grill (xovo@gmx.net)
+# For information on usage and redistribution, and for a DISCLAIMER OF ALL
+# WARRANTIES, see the file, "license.txt," in this distribution.
+#
+
+# your c++ compiler (define only if not g++)
+# CXX=
+
+# where are the PD header files?
+# leave it blank if it is a system directory (like /usr/local/include),
+# since gcc 3.2 complains about it
+PDPATH=/usr/local/pd/src
+
+# where is the PD executable?
+PD=/usr/local/pd/bin/pd
+
+# where do the flext libraries reside?
+FLEXTPATH=/usr/local/pd/flext
+
+# where should flext libraries be built?
+TARGDIR=./pd-darwin
+
+# where should pool be installed?
+# (leave blank to omit installation)
+INSTPATH=/usr/local/pd/extra
+
+
+# additional compiler flags
+# (check if they fit for your system!)
+# UFLAGS=-maltivec
diff --git a/externals/grill/dyn/config-pd-linux.txt b/externals/grill/dyn/config-pd-linux.txt
new file mode 100644
index 00000000..55159ebb
--- /dev/null
+++ b/externals/grill/dyn/config-pd-linux.txt
@@ -0,0 +1,31 @@
+# dyn~ - dynamic object management for PD
+#
+# Copyright (c)Thomas Grill (xovo@gmx.net)
+# For information on usage and redistribution, and for a DISCLAIMER OF ALL
+# WARRANTIES, see the file, "license.txt," in this distribution.
+#
+
+# your c++ compiler (define only if not g++)
+# CXX=
+
+# where are the PD header files?
+# leave it blank if it is a system directory (like /usr/local/include),
+# since gcc 3.2 complains about it
+PDPATH=
+
+# where do the flext libraries reside?
+FLEXTPATH=/usr/local/lib/pd/flext
+
+# where should flext libraries be built?
+TARGDIR=./pd-linux
+
+# where should the external be installed?
+# (leave blank to omit installation)
+INSTPATH=/usr/local/lib/pd/extra
+
+
+# additional compiler flags
+# (check if they fit for your system!)
+UFLAGS=-mcpu=pentiumpro # gcc 2.95
+# UFLAGS=-mcpu=pentium3 -msse # gcc 3.2
+
diff --git a/externals/grill/dyn/config-pd-msvc.txt b/externals/grill/dyn/config-pd-msvc.txt
new file mode 100644
index 00000000..67c9a0cb
--- /dev/null
+++ b/externals/grill/dyn/config-pd-msvc.txt
@@ -0,0 +1,22 @@
+# dyn~ - dynamic object management for PD
+#
+# Copyright (c)Thomas Grill (xovo@gmx.net)
+# For information on usage and redistribution, and for a DISCLAIMER OF ALL
+# WARRANTIES, see the file, "license.txt," in this distribution.
+#
+
+# where is PD?
+PDPATH=c:\programme\audio\pd
+
+# where do the flext libraries reside?
+FLEXTPATH=$(PDPATH)\flext
+
+# where is MS VC++?
+MSVCPATH=c:\programme\prog\microsoft visual studio\VC98
+
+# where should the external be built?
+OUTPATH=pd-msvc
+
+# where should the external be installed?
+# (leave blank to omit installation)
+INSTPATH=$(PDPATH)\extra
diff --git a/externals/grill/dyn/dyn.dsp b/externals/grill/dyn/dyn.dsp
new file mode 100644
index 00000000..30e28f82
--- /dev/null
+++ b/externals/grill/dyn/dyn.dsp
@@ -0,0 +1,95 @@
+# Microsoft Developer Studio Project File - Name="dyn" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=dyn - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "dyn.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "dyn.mak" CFG="dyn - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "dyn - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "dyn - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName "dyn"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "dyn - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "pd-msvc/r"
+# PROP Intermediate_Dir "pd-msvc/r"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYN_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "f:\prog\pd\pd-cvs\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "NDEBUG"
+# ADD RSC /l 0xc07 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib pthreadVC.lib /nologo /dll /machine:I386 /out:"pd-msvc/dyn~.dll" /libpath:"f:\prog\pd\pd-cvs/bin" /libpath:"..\flext\pd-msvc"
+
+!ELSEIF "$(CFG)" == "dyn - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "pd-msvc/d"
+# PROP Intermediate_Dir "pd-msvc/d"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DYN_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "f:\prog\pd\pd-cvs\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PD" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "_DEBUG"
+# ADD RSC /l 0xc07 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib pd.lib flext_d-pdwin.lib pthreadVC.lib /nologo /dll /debug /machine:I386 /out:"pd-msvc/d/dyn~.dll" /pdbtype:sept /libpath:"f:\prog\pd\pd-cvs/bin" /libpath:"..\flext\pd-msvc"
+
+!ENDIF
+
+# Begin Target
+
+# Name "dyn - Win32 Release"
+# Name "dyn - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\src\main.cpp
+# End Source File
+# End Target
+# End Project
diff --git a/externals/grill/dyn/gpl.txt b/externals/grill/dyn/gpl.txt
new file mode 100644
index 00000000..5ea29a7d
--- /dev/null
+++ b/externals/grill/dyn/gpl.txt
@@ -0,0 +1,346 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 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/externals/grill/dyn/license.txt b/externals/grill/dyn/license.txt
new file mode 100644
index 00000000..4a10fba2
--- /dev/null
+++ b/externals/grill/dyn/license.txt
@@ -0,0 +1,50 @@
+dyn~ - dynamic object management for PD
+Copyright (c) Thomas Grill (xovo@gmx.net)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+In the official dyn~ distribution, the GNU General Public License is
+in the file gpl.txt
+
+---------------------------------------------------------
+
+ OTHER COPYRIGHT NOTICES
+
+---------------------------------------------------------
+This package uses the flext C++ layer - See its license text below:
+
+
+--- flext ----------------------------------------------
+flext - C++ layer for Max/MSP and pd (pure data) externals
+Copyright (C) 2001-2003 Thomas Grill
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+In the official flext distribution, the GNU General Public License is
+in the file gpl.txt
+
+
diff --git a/externals/grill/dyn/make-files.txt b/externals/grill/dyn/make-files.txt
new file mode 100644
index 00000000..81d7cbdc
--- /dev/null
+++ b/externals/grill/dyn/make-files.txt
@@ -0,0 +1,6 @@
+# all the source files from the package
+DIR=src
+
+SRCS= main.cpp
+HDRS=
+
diff --git a/externals/grill/dyn/makefile.pd-darwin b/externals/grill/dyn/makefile.pd-darwin
new file mode 100644
index 00000000..5af65eaa
--- /dev/null
+++ b/externals/grill/dyn/makefile.pd-darwin
@@ -0,0 +1,79 @@
+# dyn~ - dynamic object management for PD
+#
+# Copyright (c)Thomas Grill (xovo@gmx.net)
+# For information on usage and redistribution, and for a DISCLAIMER OF ALL
+# WARRANTIES, see the file, "license.txt," in this distribution.
+#
+#
+# Makefile for gcc @ darwin (OSX)
+#
+# usage:
+# to build run "make -f makefile.pd-darwin"
+# to install (as root), do "make -f makefile.pd-darwin install"
+#
+
+CONFIG=config-pd-darwin.txt
+
+include $(CONFIG)
+
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+# compiler+linker stuff
+INCLUDES=$(PDPATH)
+LIBPATH=
+FLAGS=-DFLEXT_SYS=2 ${U_FLAGS}
+CFLAGS=-O6 -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes -fno-exceptions -fno-rtti
+#CFLAGS=-g
+LIBS=m
+LDFLAGS=-bundle -bundle_loader $(PD)
+
+
+# ---------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+
+NAME=dyn~
+
+# all the source files from the package
+include make-files.txt
+
+TARGET=$(TARGDIR)/$(NAME).pd_darwin
+
+# default target
+all: $(TARGDIR) $(TARGET)
+
+$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(FLEXTLIB) $(CONFIG)
+ touch $@
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(TARGDIR)/%.o : $(DIR)/%.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) $^ $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@
+ chmod 755 $@
+
+$(INSTPATH):
+ mkdir $(INSTPATH)
+
+install:: $(INSTPATH)
+
+install:: $(TARGET)
+ cp $^ $(INSTPATH)
+# chown root.root $(patsubst %,$(INSTPATH)/%,$(notdir $^))
+# chmod 755 $(patsubst %,$(INSTPATH)/%,$(notdir $^))
+
+.PHONY: clean
+clean:
+ rm -f $(TARGDIR)/*.o $(TARGET)
+
+
+
+
+
+
+
+
+
diff --git a/externals/grill/dyn/makefile.pd-linux b/externals/grill/dyn/makefile.pd-linux
new file mode 100644
index 00000000..45c25f6c
--- /dev/null
+++ b/externals/grill/dyn/makefile.pd-linux
@@ -0,0 +1,80 @@
+# dyn~ - dynamic object management for PD
+#
+# Copyright (c)Thomas Grill (xovo@gmx.net)
+# For information on usage and redistribution, and for a DISCLAIMER OF ALL
+# WARRANTIES, see the file, "license.txt," in this distribution.
+#
+#
+# Makefile for gcc @ linux
+#
+# usage:
+# to build run "make -f makefile.pd-linux"
+# to install (as root), do "make -f makefile.pd-linux install"
+#
+
+CONFIG=config-pd-linux.txt
+
+include $(CONFIG)
+
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+# compiler+linker stuff
+INCLUDES=$(PDPATH)
+LIBPATH=
+FLAGS=-DFLEXT_SYS=2 ${U_FLAGS}
+CFLAGS=-O6
+#CFLAGS=-g
+LIBS=m util
+
+
+# ---------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+
+NAME=dyn~
+
+# all the source files from the package
+include make-files.txt
+
+
+
+TARGET=$(TARGDIR)/$(NAME).pd_linux
+
+# default target
+all: $(TARGDIR) $(TARGET)
+
+$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(FLEXTLIB) $(CONFIG)
+ touch $@
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(TARGDIR)/%.o : $(DIR)/%.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) -shared $^ $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@
+ chmod 755 $@
+
+$(INSTPATH):
+ mkdir $(INSTPATH)
+
+install:: $(INSTPATH)
+
+install:: $(TARGET)
+ cp $^ $(INSTPATH)
+ chown root.root $(patsubst %,$(INSTPATH)/%,$(notdir $^))
+ chmod 755 $(patsubst %,$(INSTPATH)/%,$(notdir $^))
+
+.PHONY: clean
+clean:
+ rm -f $(TARGDIR)/*.o $(TARGET)
+
+
+
+
+
+
+
+
+
diff --git a/externals/grill/dyn/makefile.pd-msvc b/externals/grill/dyn/makefile.pd-msvc
new file mode 100644
index 00000000..17c6b0eb
--- /dev/null
+++ b/externals/grill/dyn/makefile.pd-msvc
@@ -0,0 +1,60 @@
+# dyn~ - dynamic object management for PD
+#
+# Copyright (c)Thomas Grill (xovo@gmx.net)
+# For information on usage and redistribution, and for a DISCLAIMER OF ALL
+# WARRANTIES, see the file, "license.txt," in this distribution.
+#
+#
+# Makefile for MSVC++ 6
+#
+# usage:
+# to build run "make -f makefile.pd-msvc"
+#
+
+!include config-pd-msvc.txt
+
+# includes
+INCPATH=/I"$(MSVCPATH)\include" /I"$(PDPATH)\src" /I"$(FLEXTPATH)"
+LIBPATH=/LIBPATH:"$(MSVCPATH)\lib" /LIBPATH:"$(PDPATH)\bin" /LIBPATH:"$(FLEXTPATH)"
+LIBS=pd.lib flext-pdwin.lib
+
+# compiler definitions and flags
+DEFS=/DFLEXT_SYS=2
+
+CFLAGS=/GR- /GX- /GD /G6 /Ox /ML
+
+# the rest can stay untouched
+# ----------------------------------------------
+
+# all the source files from the package
+!include make-files.txt
+
+# -----------------------------------------------
+
+NAME=dyn~
+
+all: $(OUTPATH) $(OUTPATH)\$(NAME).dll
+
+# remove build
+clean:
+ -del /q $(OUTPATH) > nul
+ -rmdir $(OUTPATH) > nul
+
+OBJS= $(SRCS:.cpp=.obj)
+
+$(OUTPATH):
+ -mkdir $(OUTPATH) > nul
+
+{$(DIR)}.cpp{}.obj:
+ cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(OUTPATH)\$@
+
+$(OUTPATH)\$(NAME).dll: $(OBJS)
+ cd $(OUTPATH)
+ link /DLL /out:$(NAME).dll /INCREMENTAL:NO $** $(LIBS) $(LIBPATH)
+ @-del *.exp
+ @-del *.lib
+ cd ..
+!ifdef INSTPATH
+ @-if not exist $(INSTPATH) mkdir $(INSTPATH)
+ copy $@ $(INSTPATH) > nul
+!endif
diff --git a/externals/grill/dyn/pd/dyn~.pd b/externals/grill/dyn/pd/dyn~.pd
new file mode 100644
index 00000000..dc480cb2
--- /dev/null
+++ b/externals/grill/dyn/pd/dyn~.pd
@@ -0,0 +1,117 @@
+#N canvas 65 78 628 544 12;
+#N canvas 218 20 566 665 examples 0;
+#X floatatom 153 276 5 0 0 0 - - -;
+#X floatatom 110 353 5 0 0 0 - - -;
+#X floatatom 111 576 5 0 0 0 - - -;
+#X msg 44 232 reset \, new a + \, conn 0 a 0 \, conn 1 a 1 \, conn
+a 0 0;
+#X obj 220 316 +;
+#X floatatom 221 351 5 0 0 0 - - -;
+#X floatatom 153 498 5 0 0 0 - - -;
+#X floatatom 210 498 5 0 0 0 - - -;
+#X floatatom 263 498 5 0 0 0 - - -;
+#X msg 35 443 reset \, new a * 2 \, new b + 1 \, conn 0 a 0 \, conn
+1 a 1 \, conn a 0 b 0 \, conn 2 b 1 \, conn b 0 0;
+#X obj 227 542 * 2;
+#X obj 260 545 + 1;
+#X floatatom 236 573 5 0 0 0 - - -;
+#X floatatom 225 276 5 0 0 0 - - -;
+#X floatatom 201 73 5 0 0 0 - - -;
+#X floatatom 100 155 5 0 0 0 - - -;
+#X floatatom 216 153 5 0 0 0 - - -;
+#X msg 34 34 reset \, new a f \, conn 0 a 0 \, conn a 0 0;
+#X obj 215 118 f;
+#X obj 101 117 dyn~ 0 1 0 1;
+#X obj 111 315 dyn~ 0 2 0 1;
+#X obj 111 543 dyn~ 0 3 0 1;
+#X connect 0 0 4 0;
+#X connect 0 0 20 1;
+#X connect 3 0 20 0;
+#X connect 4 0 5 0;
+#X connect 6 0 10 0;
+#X connect 6 0 21 1;
+#X connect 7 0 10 1;
+#X connect 7 0 21 2;
+#X connect 8 0 11 1;
+#X connect 8 0 21 3;
+#X connect 9 0 21 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 13 0 4 1;
+#X connect 13 0 20 2;
+#X connect 14 0 18 0;
+#X connect 14 0 19 1;
+#X connect 17 0 19 0;
+#X connect 18 0 16 0;
+#X connect 19 0 15 0;
+#X connect 20 0 1 0;
+#X connect 21 0 2 0;
+#X restore 514 459 pd examples;
+#X msg 129 97 reset;
+#X text 186 97 clear all objects and connections;
+#X msg 129 157 new a + 1;
+#X text 221 155 make new object [+ 1] with name "a";
+#X msg 129 187 conn 0 a 0;
+#X text 224 186 connect dyn-inlet 0 to a-inlet 0;
+#X msg 129 216 conn a 0 0;
+#X text 224 215 connect a-outlet 0 to dyn-outlet 0;
+#X msg 129 249 conn x 2 y 3;
+#X text 234 248 connect x-outlet 2 to y-inlet 3;
+#X msg 129 312 del a;
+#X text 181 314 delete object "a";
+#X obj 11 10 cnv 15 600 40 empty empty dyn~ 10 22 0 24 -260818 -1 0
+;
+#X text 133 32 http://www.parasitaere-kapazitaeten.net;
+#X text 133 12 dynamic object management \, (C)2003 Thomas Grill;
+#X msg 128 343 send a message 1;
+#X text 270 343 send "message 1" to a-inlet 0;
+#X obj 54 433 dyn~ 0 1 0 2;
+#X text 156 432 dyn sig/msg inlets sig/msg outlets;
+#X msg 165 377 vis \$1;
+#X obj 129 377 tgl 20 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X text 222 373 make patch visible/invisible;
+#X msg 129 279 dis x 2 y 3;
+#X text 234 280 disconnect x-outlet 2 to y-inlet 3;
+#X text 189 125 reload all objects (keep connections);
+#X msg 129 125 reload;
+#X text 218 388 (connections are not drawn at the moment!);
+#N canvas 178 192 567 381 dsp-ex 0;
+#X obj 77 345 dac~;
+#X obj 143 281 hsl 128 15 0 1000 0 1 empty empty empty -2 -6 0 8 -261681
+-1 -1 800 1;
+#X obj 155 306 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0
+10 -262144 -1 -1 62.9921 256;
+#X msg 66 101 reset;
+#X msg 64 152 new o1 osc~ \, conn 0 o1 0 \, conn o1 0 0;
+#X obj 482 19 loadbang;
+#X msg 481 43 \; pd dsp 1;
+#X text 65 79 clear all;
+#X obj 47 301 dyn~ 0 1 2 0;
+#X msg 67 210 new m * 2 \, new o2 osc~ \, conn 0 m 0 \, conn m 0 o2
+0 \, conn o2 0 1;
+#X text 70 130 make an oscillator (left);
+#X text 66 190 add an oscillator (double frq \, right);
+#X text 24 17 signals passing through dyn~ are delayed by one block
+;
+#X text 67 261 select frequency;
+#X connect 1 0 2 0;
+#X connect 1 0 8 1;
+#X connect 3 0 8 0;
+#X connect 4 0 8 0;
+#X connect 5 0 6 0;
+#X connect 8 0 0 0;
+#X connect 8 1 0 1;
+#X connect 9 0 8 0;
+#X restore 514 487 pd dsp-ex;
+#X connect 1 0 18 0;
+#X connect 3 0 18 0;
+#X connect 5 0 18 0;
+#X connect 7 0 18 0;
+#X connect 9 0 18 0;
+#X connect 11 0 18 0;
+#X connect 16 0 18 0;
+#X connect 20 0 18 0;
+#X connect 21 0 20 0;
+#X connect 23 0 18 0;
+#X connect 26 0 18 0;
diff --git a/externals/grill/dyn/src/main.cpp b/externals/grill/dyn/src/main.cpp
new file mode 100644
index 00000000..d1381386
--- /dev/null
+++ b/externals/grill/dyn/src/main.cpp
@@ -0,0 +1,590 @@
+/*
+
+dyn~ - dynamical object management for PD
+
+Copyright (c) 2002-2003 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+
+-- this is all a bit hacky, but hey, it's PD! --
+
+*/
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 402)
+#error You need at least flext version 0.4.2
+#endif
+
+#define DYN_VERSION "0.0.1"
+
+
+#if FLEXT_SYS != FLEXT_SYS_PD
+#error Sorry, dyn~ works for PD only!
+#endif
+
+
+#include "flinternal.h"
+#include <stdlib.h>
+
+#pragma warning(disable: 4091 4244)
+#include "g_canvas.h"
+
+
+class dyn:
+ public flext_dsp
+{
+ FLEXT_HEADER_S(dyn,flext_dsp,setup)
+public:
+ dyn(int argc,const t_atom *argv);
+ virtual ~dyn();
+
+ void m_reset();
+ void m_reload(); // refresh objects/abstractions
+ void m_newobj(int argc,const t_atom *argv);
+ void m_del(const t_symbol *n);
+ void m_connect(int argc,const t_atom *argv) { conndis(true,argc,argv); }
+ void m_disconnect(int argc,const t_atom *argv) { conndis(false,argc,argv); }
+ void m_send(int argc,const t_atom *argv);
+ void m_vis(bool vis);
+
+protected:
+
+ class obj {
+ public:
+ obj(const t_symbol *n,t_object *o): name(n),object(o),nxt(NULL) {}
+
+ void Add(obj *o);
+
+ const t_symbol *name;
+ t_object *object;
+ obj *nxt;
+ } *root;
+
+ obj *Find(const t_symbol *n);
+ void Add(const t_symbol *n,t_object *o);
+ void ToCanvas(t_object *o,t_binbuf *b,int x,int y);
+ void FromCanvas(t_object *o);
+
+ virtual bool m_method_(int n,const t_symbol *s,int argc,const t_atom *argv);
+ virtual void m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs);
+
+ static t_class *pxin_class,*pxout_class;
+ static t_class *pxins_class,*pxouts_class;
+
+
+ // proxy for inbound messages
+ class proxyin
+ {
+ public:
+ t_object obj;
+ dyn *th;
+ t_outlet *outlet;
+ t_sample *buf;
+ bool sig;
+ int n;
+ t_sample defsig;
+
+ void Message(const t_symbol *s,int argc,const t_atom *argv)
+ {
+ typedmess((t_pd *)&obj,(t_symbol *)s,argc,(t_atom *)argv);
+ }
+
+ void init(dyn *t,bool s)
+ {
+ th = t; sig = s;
+ n = 0,buf = NULL;
+ defsig = 0;
+ outlet = outlet_new(&obj,sig?&s_signal:&s_anything);
+ }
+
+ void exit() { if(buf) delete[] buf; }
+
+ static void px_method(proxyin *obj,const t_symbol *s,int argc,const t_atom *argv)
+ {
+ outlet_anything(obj->outlet,(t_symbol *)s,argc,(t_atom *)argv);
+ }
+
+ static void dsp(proxyin *x, t_signal **sp);
+ } **pxin;
+
+ // proxy for outbound messages
+ class proxyout
+ {
+ public:
+ t_object obj;
+ dyn *th;
+ int outlet;
+ int n;
+ bool sig;
+ t_sample *buf;
+ t_sample defsig;
+
+ void init(dyn *t,int o,bool s)
+ {
+ th = t,outlet = o;
+ sig = s;
+ defsig = 0;
+ n = 0,buf = NULL;
+ if(sig) outlet_new(&obj,&s_signal);
+ }
+
+ void exit() { if(buf) delete[] buf; }
+
+ static void px_method(proxyout *obj,const t_symbol *s,int argc,const t_atom *argv)
+ {
+ obj->th->ToOutAnything(obj->outlet,s,argc,argv);
+ }
+
+ static void dsp(proxyout *x, t_signal **sp);
+ } **pxout;
+
+ int m_inlets,s_inlets,m_outlets,s_outlets;
+ t_canvas *canvas;
+
+ void conndis(bool conn,int argc,const t_atom *argv);
+
+private:
+ static void setup(t_classid c);
+
+ FLEXT_CALLBACK(m_reset)
+ FLEXT_CALLBACK(m_reload)
+ FLEXT_CALLBACK_V(m_newobj)
+ FLEXT_CALLBACK_S(m_del)
+ FLEXT_CALLBACK_V(m_connect)
+ FLEXT_CALLBACK_V(m_disconnect)
+ FLEXT_CALLBACK_V(m_send)
+ FLEXT_CALLBACK_B(m_vis)
+};
+
+FLEXT_NEW_DSP_V("dyn~",dyn)
+
+
+t_class *dyn::pxin_class = NULL,*dyn::pxout_class = NULL;
+t_class *dyn::pxins_class = NULL,*dyn::pxouts_class = NULL;
+
+void dyn::setup(t_classid c)
+{
+ post("");
+ post("dyn~ %s - dynamic object management, (C)2003 Thomas Grill",DYN_VERSION);
+ post("");
+
+ // set up proxy class for inbound messages
+ pxin_class = class_new(gensym("dyn proxy in"),NULL,NULL,sizeof(proxyin),0, A_NULL);
+ add_anything(pxin_class,proxyin::px_method);
+
+ pxins_class = class_new(gensym("dyn proxy in~"),NULL,NULL,sizeof(proxyin),0, A_NULL);
+ add_dsp(pxins_class,proxyin::dsp);
+ CLASS_MAINSIGNALIN(pxins_class, proxyin, defsig);
+
+ // set up proxy class for outbound messages
+ pxout_class = class_new(gensym("dyn proxy out"),NULL,NULL,sizeof(proxyout),0, A_NULL);
+ add_anything(pxout_class,proxyout::px_method);
+
+ pxouts_class = class_new(gensym("dyn proxy out~"),NULL,NULL,sizeof(proxyout),0, A_NULL);
+ add_dsp(pxouts_class,proxyout::dsp);
+ CLASS_MAINSIGNALIN(pxouts_class, proxyout, defsig);
+
+ // set up dyn~
+ FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
+ FLEXT_CADDMETHOD_(c,0,"reload",m_reload);
+ FLEXT_CADDMETHOD_(c,0,"new",m_newobj);
+ FLEXT_CADDMETHOD_(c,0,"del",m_del);
+ FLEXT_CADDMETHOD_(c,0,"conn",m_connect);
+ FLEXT_CADDMETHOD_(c,0,"dis",m_disconnect);
+ FLEXT_CADDMETHOD_(c,0,"send",m_send);
+ FLEXT_CADDMETHOD_(c,0,"vis",m_vis);
+}
+
+
+/*
+There must be a separate canvas for the dynamically created objects as some mechanisms in PD
+(like copy/cut/paste) get confused.
+On the other hand it seems to be possible to create objects without a canvas.
+They won't receive DSP processing, though, hence it's only possible for message objects.
+Problems arise when an object is not yet loaded... the canvas environment is then needed to
+load it.. if there is no canvas, PD currently crashes.
+
+
+How to create the canvas:
+
+1) via direct call to canvas_new()
+2) a message to pd_canvasmaker
+ con: does not return a pointer for the created canvas
+
+
+There are two possibilities for the canvas
+
+1) make a sub canvas to the one where dyn~ resides:
+ pro: no problems with environment (abstractions are found and loaded correctly)
+ con: canvas must be manually added to the list of canvases so that it gets DSP
+ (the respective functions must be exported from PD)
+2) make a root canvas:
+ pro: it will be in the canvas list per default, hence DSP is processed
+ con: canvas environment must be created manually
+ (is normally done by pd_canvasmaker if there is a directory set, which is again done somewhere else)
+
+
+In both cases the 1)s have been chosen as the cleaner solution
+*/
+
+dyn::dyn(int argc,const t_atom *argv):
+ root(NULL),
+ canvas(NULL)
+{
+ if(argc < 4) { InitProblem(); return; }
+
+ s_inlets = GetAInt(argv[0]);
+ m_inlets = GetAInt(argv[1]);
+ s_outlets = GetAInt(argv[2]);
+ m_outlets = GetAInt(argv[3]);
+
+ int i;
+
+#ifdef ROOT_CANVAS
+ // set NULL for creation of a root canvas
+ // so that DSP is called without connections to dyn~ canvas
+ canvas_setcurrent(NULL);
+#endif
+
+ // make a canvas for dyn~
+ canvas = canvas_new(NULL, gensym("canvas"), 0, NULL);
+
+#ifndef ROOT_CANVAS
+ canvas_addtolist(canvas);
+#endif
+
+ // must do that....
+ canvas_unsetcurrent(canvas);
+
+#ifdef ROOT_CANVAS
+ canvas_unsetcurrent(NULL);
+#endif
+
+ pxin = new proxyin *[s_inlets+m_inlets];
+ for(i = 0; i < s_inlets+m_inlets; ++i) {
+ bool sig = i < s_inlets;
+ pxin[i] = (proxyin *)object_new(sig?pxins_class:pxin_class);
+ pxin[i]->init(this,sig);
+ t_binbuf *b = binbuf_new();
+ binbuf_text(b,"dyn-in~",7);
+ ToCanvas(&pxin[i]->obj,b,i*100,10); // place them left-to-right
+ }
+
+ pxout = new proxyout *[s_outlets+m_outlets];
+ for(i = 0; i < s_outlets+m_outlets; ++i) {
+ bool sig = i < s_outlets;
+ pxout[i] = (proxyout *)object_new(sig?pxouts_class:pxout_class);
+ pxout[i]->init(this,i,sig);
+ t_binbuf *b = binbuf_new();
+ binbuf_text(b,"dyn-out~",8);
+ ToCanvas(&pxout[i]->obj,b,i*100,500); // place them left-to-right
+ }
+
+ AddInSignal("Messages (new,del,conn,dis)");
+ AddInSignal(s_inlets);
+ AddInAnything(m_inlets);
+ AddOutSignal(s_outlets);
+ AddOutAnything(m_outlets);
+}
+
+dyn::~dyn()
+{
+ m_reset();
+
+ if(pxin) {
+ for(int i = 0; i < s_inlets+m_inlets; ++i)
+ if(pxin[i]) { pxin[i]->exit(); FromCanvas(&pxin[i]->obj); }
+ delete[] pxin;
+ }
+ if(pxout) {
+ for(int i = 0; i < s_outlets+m_outlets; ++i)
+ if(pxout[i]) { pxout[i]->exit(); FromCanvas(&pxout[i]->obj); }
+ delete[] pxout;
+ }
+
+ if(canvas) {
+#ifndef ROOT_CANVAS
+ canvas_takeofflist(canvas);
+#endif
+ pd_free((t_pd *)canvas);
+ }
+}
+
+
+void dyn::obj::Add(obj *o) { if(nxt) nxt->Add(o); else nxt = o; }
+
+dyn::obj *dyn::Find(const t_symbol *n)
+{
+ for(obj *o = root; o && o->name != n; o = o->nxt) {}
+ return o;
+}
+
+void dyn::Add(const t_symbol *n,t_object *ob)
+{
+ obj *o = new obj(n,ob);
+ if(root) root->Add(o); else root = o;
+}
+
+void dyn::ToCanvas(t_object *o,t_binbuf *b,int x,int y)
+{
+ // add object to the glist.... this is needed to use canvas_deletelinesfor
+ // which is needed to have all connections be properly deleted
+
+ o->te_binbuf = b;
+ o->te_xpix = x,o->te_ypix = y;
+ o->te_width = 0;
+ o->te_type = T_OBJECT;
+
+ glist_add(canvas, &o->te_g);
+}
+
+void dyn::FromCanvas(t_object *o)
+{
+ glist_delete(canvas,&o->te_g);
+}
+
+void dyn::m_reset()
+{
+ obj *o = root;
+ while(o) {
+ FromCanvas(o->object);
+ obj *n = o->nxt;
+ delete o;
+ o = n;
+ }
+ root = NULL;
+}
+
+void dyn::m_vis(bool vis)
+{
+ canvas_vis(canvas,vis?1:0);
+}
+
+void dyn::m_reload()
+{
+ post("%s - reload: not implemented yet",thisName());
+}
+
+
+void dyn::m_newobj(int _argc_,const t_atom *_argv_)
+{
+ int argc = 0;
+ const t_atom *argv = NULL;
+ int posx,posy;
+
+ if(_argc_ >= 4 && CanbeInt(_argv_[0]) && CanbeInt(_argv_[1]) && IsSymbol(_argv_[2]) && IsSymbol(_argv_[3])) {
+ posx = GetAInt(_argv_[0]);
+ posy = GetAInt(_argv_[1]);
+ argc = _argc_-2;
+ argv = _argv_+2;
+ }
+ else if(_argc_ >= 2 && IsSymbol(_argv_[0]) && IsSymbol(_argv_[1])) {
+ // random position if not given
+ posx = rand()%600;
+ posy = 50+rand()%400;
+ argc = _argc_;
+ argv = _argv_;
+ }
+
+ if(argv) {
+ const t_symbol *name = GetSymbol(argv[0]);
+
+ if(Find(name))
+ post("%s - new: object \"%s\" is already present",thisName(),GetString(name));
+ else {
+ // now set canvas
+ canvas_setcurrent(canvas);
+
+ // send message to object maker
+ t_binbuf *b = binbuf_new();
+ binbuf_add(b,argc-1,(t_atom *)argv+1);
+ binbuf_eval(b,&pd_objectmaker,0,NULL);
+
+ t_object *x = (t_object *)pd_newest();
+ if(x) {
+ // place it
+ ToCanvas(x,b,posx,posy);
+ Add(name,x);
+ }
+ else {
+ post("%s - new: Could not create object",thisName());
+ binbuf_free(b);
+ }
+
+ canvas_unsetcurrent(canvas);
+ }
+ }
+ else
+ post("%s - new name object [args]",thisName());
+}
+
+void dyn::m_del(const t_symbol *n)
+{
+ obj *p = NULL,*o = root;
+ for(; o && o->name != n; p = o,o = o->nxt) {}
+
+ if(o) {
+ if(p) p->nxt = o->nxt; else root = o->nxt;
+
+ FromCanvas(o->object);
+ delete o;
+ }
+ else
+ post("%s - del: object not found",thisName());
+}
+
+void dyn::conndis(bool conn,int argc,const t_atom *argv)
+{
+ const t_symbol *s_n = NULL,*d_n = NULL;
+ int s_x,d_x;
+
+ if(argc == 4 && IsSymbol(argv[0]) && CanbeInt(argv[1]) && IsSymbol(argv[2]) && CanbeInt(argv[3])) {
+ s_n = GetSymbol(argv[0]);
+ s_x = GetAInt(argv[1]);
+ d_n = GetSymbol(argv[2]);
+ d_x = GetAInt(argv[3]);
+ }
+ else if(argc == 3 && CanbeInt(argv[0]) && IsSymbol(argv[1]) && CanbeInt(argv[2])) {
+ s_n = NULL;
+ s_x = GetAInt(argv[0]);
+ d_n = GetSymbol(argv[1]);
+ d_x = GetAInt(argv[2]);
+ }
+ else if(argc == 3 && IsSymbol(argv[0]) && CanbeInt(argv[1]) && CanbeInt(argv[2])) {
+ s_n = GetSymbol(argv[0]);
+ s_x = GetAInt(argv[1]);
+ d_n = NULL;
+ d_x = GetAInt(argv[2]);
+ }
+ else if(argc == 2 && CanbeInt(argv[0]) && CanbeInt(argv[1])) {
+ // pure connection between proxy-in and proxy-out (for testing above all....)
+ s_n = NULL;
+ s_x = GetAInt(argv[0]);
+ d_n = NULL;
+ d_x = GetAInt(argv[1]);
+ }
+ else {
+ post("%s - connect: [src] srcslot [dst] dstslot",thisName());
+ return;
+ }
+
+ t_object *s_obj,*d_obj;
+ if(s_n) {
+ obj *s_o = Find(s_n);
+ if(!s_o) {
+ post("%s - connect: source \"%s\" not found",thisName(),GetString(s_n));
+ return;
+ }
+ s_obj = s_o->object;
+ }
+ else if(s_x < 0 && s_x >= s_inlets+m_inlets) {
+ post("%s - connect: inlet %i out of range (0..%i)",thisName(),s_x,s_inlets+m_inlets-1);
+ return;
+ }
+ else {
+ s_obj = &pxin[s_x]->obj;
+ s_x = 0; // always 0 for proxy
+ }
+
+ if(d_n) {
+ obj *d_o = Find(d_n);
+ if(!d_o) {
+ post("%s - connect: destination \"%s\" not found",thisName(),GetString(d_n));
+ return;
+ }
+ d_obj = d_o->object;
+ }
+ else if(d_x < 0 && d_x >= s_outlets+m_outlets) {
+ post("%s - connect: outlet %i out of range (0..%i)",thisName(),d_x,s_outlets+m_outlets-1);
+ return;
+ }
+ else {
+ d_obj = &pxout[d_x]->obj;
+ d_x = 0; // always 0 for proxy
+ }
+
+#ifndef NO_VIS
+ int s_oix = canvas_getindex(canvas,&s_obj->ob_g);
+ int d_oix = canvas_getindex(canvas,&d_obj->ob_g);
+#endif
+
+ if(conn) {
+ if(!canvas_isconnected(canvas,s_obj,s_x,d_obj,d_x)) {
+#ifdef NO_VIS
+ if(!obj_connect(s_obj, s_x, d_obj, d_x))
+ post("%s - connect: connection could not be made",thisName());
+#else
+ canvas_connect(canvas,s_oix,s_x,d_oix,d_x);
+#endif
+ }
+ }
+ else {
+#ifdef NO_VIS
+ obj_disconnect(s_obj, s_x, d_obj, d_x);
+#else
+ canvas_disconnect(canvas,s_oix,s_x,d_oix,d_x);
+#endif
+ }
+}
+
+
+bool dyn::m_method_(int n,const t_symbol *s,int argc,const t_atom *argv)
+{
+ if(n == 0)
+ return flext_base::m_method_(n,s,argc,argv);
+ else {
+ pxin[n-1]->Message(s,argc,argv);
+ return true;
+ }
+}
+
+
+void dyn::m_send(int argc,const t_atom *argv)
+{
+ if(argc < 2 || !IsSymbol(argv[0]))
+ post("%s - Syntax: send name message [args]",thisName());
+ else {
+ obj *o = Find(GetSymbol(argv[0]));
+ if(!o)
+ post("%s - send: object \"%s\" not found",thisName(),GetString(argv[0]));
+ else
+ pd_forwardmess((t_pd *)o->object,argc-1,(t_atom *)argv+1);
+ }
+}
+
+
+void dyn::proxyin::dsp(proxyin *x,t_signal **sp)
+{
+ int n = sp[0]->s_n;
+ if(n != x->n) {
+ // if vector size has changed make new buffer
+ if(x->buf) delete[] x->buf;
+ x->buf = new t_sample[x->n = n];
+ }
+ dsp_add_copy(x->buf,sp[0]->s_vec,n);
+}
+
+
+void dyn::proxyout::dsp(proxyout *x,t_signal **sp)
+{
+ int n = sp[0]->s_n;
+ if(n != x->n) {
+ // if vector size has changed make new buffer
+ if(x->buf) delete[] x->buf;
+ x->buf = new t_sample[x->n = n];
+ }
+ dsp_add_copy(sp[0]->s_vec,x->buf,n);
+}
+
+
+void dyn::m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs)
+{
+ int i;
+ for(i = 0; i < s_inlets; ++i)
+ CopySamples(pxin[i]->buf,insigs[i+1],n);
+ for(i = 0; i < s_outlets; ++i)
+ CopySamples(outsigs[i],pxout[i]->buf,n);
+}
+