pax_global_header00006660000000000000000000000064127744645370014535gustar00rootroot0000000000000052 comment=fbfcf54548e8852ef9ad164f906c608187822ed0 iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/000077500000000000000000000000001277446453700210115ustar00rootroot00000000000000iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/.gitignore000066400000000000000000000003711277446453700230020ustar00rootroot00000000000000# git ls-files --others --exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of # exclude patterns (uncomment them if you want to use them): *.[oa] *~ *.pd_* *.dll iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/.travis.yml000066400000000000000000000027001277446453700231210ustar00rootroot00000000000000language: c sudo: required dist: trusty env: global: - secure: "VtjMps4NzAMe2I3/CClJ6r8XJeXZ+4dtQR2EIul+IgPNhCexLA96Y9MLjXaE90+frOYZvuQUN/WXjqRrc5M3PgsaRnSRqlpqQSQX47AII/qoY8xf/mEJ2fn/QhF63XDRe+91cVFNG5MHUKLPDcl3QhiPBUmkN8eJtFDPrtXZiU+2zGs+sbyqB/E5BCvQAq1QCqSNbI/JUTQpcafbQf11rrzfsJBo9e/C/VK6rK+LB8Xch1ajiKPlud/VL8RXef8DfReOSsQ0LP0VI1Aj4tQs17zqKXOaUiMQUav3s7qTcIuLVaYf6w0bY3a6URV59Lj5F9+B7gkbwuAJLNPO8Dv87WeIZE8NreszPRLsTUoLrsq8OgDKiYEi4dfZH1vPpF8YhkQy+eaWImi7l7E5NNzi/k8oa6Ej/1P3aRvMuivpX8c0GRJDF5LOowG8WfGF8IkW1KeoRvYM/N7ZnIzppeMgEhKx6V+cXY1RZDUjgCO5hjUUhi9Yj1JRuInPoc5pycG0HbaMwVaZe+zyiTWRX7takuh0gQrsq1r6jg7PkcU+V8+U7QiXfwfp8KzMSr0TZxiw7DDO/Fzckg0wTsFb6Ya7RTvQPx7hM84RJ6eXzt0a+ixkKEntKaljTaW2pKvqFuTjHYq7ybisf6dnR6mjk02uqigvoVaZclDR/stLeWTqf5Q=" - COVERITY_SCAN_BRANCH_PATTERN="(master|coverity-.*)" - COVERITY_SCAN_NOTIFICATION_EMAIL="dev@umlaeute.mur.at" - COVERITY_SCAN_BUILD_COMMAND="make" matrix: include: - compiler: clang - compiler: gcc env: - COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG" before_install: - sudo apt-get update -qq - sudo apt-get install -qq puredata-dev before_script: # implement Coverity Scan with before_script instead of addons.coverity_scan # to work around too-early quota check by the coverity_scan addon - if [[ -n $COVERITY_SCAN_PROJECT_NAME ]] ; then curl -s 'https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh' | bash || true ; fi script: - make iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/ChangeLog000066400000000000000000000035761277446453700225760ustar00rootroot000000000000002016-06-20 IOhannes m zmölnig * src/canvasdelete.c: map indices to objects before deleting them since indices change when we remove a single object, we first need to turn the indices to (pointers to) the objects themselves. 2016-04-25 IOhannes m zmölnig * src/oreceive.c: fixed size-calculation of struct CID:98830 2016-04-25 IOhannes m zmölnig * src/oreceive.c: consistent NULL-check CID:98829 2016-04-25 IOhannes m zmölnig * .travis.yml: Travis-CI config 2016-04-25 IOhannes m zmölnig * src/autoabstraction.c, src/canvasdelete.c: added a few FIXME warnings 2016-04-25 IOhannes m zmölnig * src/canvasargs.c, src/canvaserror.c, src/canvasname.c, src/canvasselect.c, src/classtest.c: fixed a number of unused-variable warnings 2016-04-25 IOhannes m zmölnig * src/canvasconnections.c, src/canvasselect.c, src/iemguts-objlist.h, src/oreceive.c, src/patcherize.c, src/savebangs.c: don't cast to/from void; use sizeof(var) rather than sizeof(type); this should make the code more readable and more robust to type-changes. 2016-04-16 IOhannes m zmölnig * src/canvasselect.c: TODO with selections 2016-04-14 IOhannes m zmölnig * src/canvasargs.c: in-code documentation... 2016-04-14 IOhannes m zmölnig * src/canvasargs.c: report arguments in early init phase Thanks Liam Goodacre for the bugreport. 2016-04-02 IOhannes m zmölnig * Makefile: Drop mentioning of 'creb' Closes: https://github.com/iem-projects/pd-iemguts/issues/3 2016-04-01 Antoine Villeret * Makefile: add missing files for installation Closes: https://github.com/iem-projects/pd-iemguts/issues/1 iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/LICENSE.txt000066400000000000000000000450371277446453700226450ustar00rootroot00000000000000iemguts - infrastructure objects for Pd Copyright (C) 2007-2010 IOhannes m zmölnig additional copyrights: src/canvasdollarzero.c: Copyright (C) 2000-2006 Thomas Musil 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 =============================================================================== GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/Makefile000066400000000000000000000022001277446453700224430ustar00rootroot00000000000000#!/usr/bin/make -f # Makefile to the 'iemguts' library for Pure Data. # Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build # settings and rules (https://github.com/pure-data/pd-lib-builder). lib.name = iemguts # special file that does not provide a class lib.setup.sources = # all other C and C++ files in subdirs are source files per class # (alternatively, enumerate them by hand) class.sources = $(filter-out $(lib.setup.sources),$(wildcard src/*.c)) datafiles = \ $(wildcard help/*.pd) \ LICENSE.txt \ README.txt \ iemguts-meta.pd datadirs = examples cflags = -DVERSION=$(lib.version) ################################################################################ ### pdlibbuilder ############################################################### ################################################################################ # This Makefile is based on the Makefile from pd-lib-builder written by # Katja Vetter. You can get it from: # https://github.com/pure-data/pd-lib-builder PDLIBBUILDER_DIR=pd-lib-builder/ include $(firstword $(wildcard $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder Makefile.pdlibbuilder)) iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/Makefile.pdlibbuilder000066400000000000000000001135411277446453700251160ustar00rootroot00000000000000# Makefile.pdlibbuilder version 0.0.1, dated 2015-10-31 # # Helper makefile for Pure Data external libraries. # Written by Katja Vetter March-June 2015 for the public domain. No warranties. # Inspired by Hans Christoph Steiner's Makefile Template and Stephan Beal's # ShakeNMake. # # GNU make version >= 3.81 required. # # #=== characteristics =========================================================== # # # - defines build settings based on autodetected OS and architecture # - defines rules to build Pd class- or lib executables from C or C++ sources # - defines rules for libdir installation # - defines convenience targets for developer and user # - evaluates implicit dependencies for non-clean builds # # #=== basic usage =============================================================== # # # In your Makefile, define your Pd lib name and class files, and include # Makefile.pdlibbuilder at the end of the Makefile. Like so: # # ________________________________________________________________________ # # # Makefile for mylib # # lib.name = mylib # # class.sources = myclass1.c myclass2.c # # datafiles = myclass1-help.pd myclass2-help.pd README.txt LICENSE.txt # # include Makefile.pdlibbuilder # ________________________________________________________________________ # # # For files in class.sources it is assumed that class basename == source file # basename. The default target builds all classes as individual executables # with Pd's default extension for the platform. For anything more than the # most basic usage, continue reading. # # #=== list of Makefile.pdlibbuilder API variables =============================== # # # Variables available for definition in your library Makefile: # # - lib.name # - lib.setup.sources # - class.sources # - common.sources # - shared.sources # - .class.sources # - .class.ldflags # - .class.ldlibs # - cflags # - ldflags # - ldlibs # - datafiles # - datadirs # - makefiles # - makefiledirs # - externalsdir # # Variables avaialable for (re)definition via command arguments: # # - pdbinpath (Windows only) # - pdincludepath # - DESTDIR # - prefix # - libdir # - pkglibdir # - CFLAGS # - CC # - CXX # - INSTALL # - INSTALL_PROGRAM # - INSTALL_DATA # - INSTALL_DIR # # Variables available for your makefile or as command argument: # # - objectsdir # - make-lib-executable # - suppress-wunused # # #=== descriptions of Makefile.pdlibbuilder API variables ======================= # # # lib.name: # Name of the library directory as it will be installed / distributed. Also the # name of the lib executable in the case where all classes are linked into # a single binary. # # lib.setup.sources: # Source file(s) (C or C++) which must be compiled only when linking all classes # into a single lib binary. # # class.sources: # All sources files (C or C++) for which the condition holds that # class name == source file basename. # # .class.sources: # Source file(s) (C or C++) specific to class . Use this for # multiple-source classes or when class name != source file basename. # # common.sources: # Source file(s) which must be statically linked to each class in the library. # # shared.sources: # Source file(s) (C or C++) to build a shared dynamic link lib, to be linked # with all class executables. # # cflags, ldflags, ldlibs: # Define cflags (preprocessor&compiler), ldflags (linker) and ldlibs (dynamic # link libs) for the whole library. These flags are added to platform-specific # flags defined by Makefile.pdlibbuilder. # # .class.ldflags and .class.ldlibs: # Define ldflags resp. ldlibs specific to class . These flags are # added to platform-specific flags defined by Makefile.pdlibbuilder, and flags # defined in your Makefile for the whole library. Note: cflags can not be # defined per class in the current implementation. # # datafiles and datadirs: # All extra files you want to include in binary distributions of the # library: abstractions and help patches, example patches, meta patch, readme # and license texts, manuals, sound files, etcetera. Use 'datafiles' for all # files that should go into your lib rootdir and 'datadirs' for complete # directories you want to copy from source to distribution. # # externalsdir: # Relative path to directory 'externals' in the context of pd-extended SVN, or # any other centralized build layout for multiple libraries. Default value # is '..', meaning the direct parent. The value is used in search paths for # pd core components (header files, and executable in the case of Windows). # # makefiles and makefiledirs: # Extra makefiles or directories with makefiles that should be made in sub-make # processes. # # pdbinpath: # For Windows only. Directory where pd.dll can be found for linking. # # pdincludepath: # Directory where Pd API m_pd.h can be found, and other Pd header files. # # DESTDIR, prefix, libdir: # Components of the path for installation as conventionally used on Linux. # # pkglibdir: # Base path for installation of Pd library directories. Default is specified # per OS, see section about paths below. # # objectsdir: # Alias of pkglibdir. Can be defined in your makefile to enable project- # dependent relative install locations. # # CFLAGS: # Compiler (notably optimization) flags which are defined by # Makefile.pdlibbuilder, but may be overriden via command argument. # # CC and CXX: # C and C++ compiler programs as defined in your build environment. # # INSTALL, INSTALL_PROGRAM, INSTALL_DATA, INSTALL_DIR: # Definitions of install program, may be overriden via command argument. # # make-lib-executable: # When this variable is defined 'yes' in your makefile or as command argument, # Makefile.pdlibbuilder will try to build all classes into a single library # executable (but it will force exit if lib.setup.sources is undefined). # If your makefile defines 'make-lib-executable=yes' as the library default, # this can still be overriden with 'make-lib-executable=no' as command argument # to build individual class executables (the Makefile.pdlibbuilder default.) # # suppress-wunused: # When this variable is defined ('yes' or any other value), -Wunused-variable, # -Wunused-parameter, -Wunused-value and -Wunused-function are suppressed, # but the other warnings from -Wall are retained. # # #=== paths ===================================================================== # # # Source files in directories other than current working directory must be # prefixed with their relative path. Do not rely on VPATH or vpath. # Object (.o) files are built in the directory of their source files. # Executables are built in current working directory. # # Variable 'pdincludepath' stores the location where m_pd.h was found. # Locations where Makefile.pdlibbuilder tries to find it, in order of priority: # # any OS: $(externalsdir)../pd/src/ # # Linux: /usr/include/pdextended/ # /usr/include/pd/ # # OSX: /Applications/Pd-extended.app/Contents/Resources/include/pdextended/ # /Applications/Pd.app/Contents/Resources/src/ # # Windows: %PROGRAMFILES%/pd/include/pdextended/ # %PROGRAMFILES%/pd/src/ # # The path for installation of all library components is constructed as: # # installpath := $(DESTDIR)$(objectsdir)/$(lib.name) # # Default for 'objectsdir' is defined per platform and follows this convention: # https://puredata.info/docs/faq/how-do-i-install-externals-and-help-files # # Linux: /usr/local/lib/pd-externals # OSX: ~/Library/Pd # Windows: %APPDATA%/Pd # # The rationale for not installing to ~/pd-externals by default on Linux # is that some people share the home dir between 32 and 64 bit installations. # # #=== targets =================================================================== # # # all: build classes (default) or library blob (if make-lib-executable=true) # alldebug: build all with -g option turned on for debug symbols # : force clean build of an individual class # .pre: make preprocessor output file in current working directory # .lst: make asm/source output file in current working directory # # install: install executables and data files # clean: remove build products from source tree # # help: print help text # vars: print makefile variables # allvars: print all variables # depend: print generated prerequisites # coffee: dummy target # # #=== Pd-extended libdir concept ================================================ # # # For libdir layout as conceived by Hans-Christoph Steiner, see: # # https://puredata.info/docs/developer/Libdir # # Files README.txt, LICENSE.txt and -meta.pd are part of the libdir # convention. Help patches for each class and abstraction are supposed to be # available. Makefile.pdlibbuilder does not force the presence of these files # however. It does not automatically include such files in libdir installations. # Data files you want to include in distributions must be defined explicitly in # your Makefile. # # #=== Makefile.pdlibbuilder syntax conventions ================================== # # # Makefile.pdlibbuilder variable names are lower case. Default make variables, # environment variables, and standard user variables (CC, CXX, CFLAGS, DESTDIR) # are upper case. Use target 'allvars' to print all variables and their values. # # 'Fields' in data variables are separated by dots, like in 'foo.class.sources'. # Words in variables expressing a function or command are separated by dashes, # like in 'make-lib-executable'. # # #=== useful make options ======================================================= # # # Use 'make -d ' to print debug details of the make process. # Use 'make -p ' to print make's database. # # #=== TODO ====================================================================== # # # - decide whether to use -static-libgcc or shared dll in MinGW # - cygwin support # - android support # - Windows 64 bit support # - figure out how to handle '$' in filenames # - add makefile template targets dpkg-source dist libdir distclean tags? # # #=== end of documentation sections ============================================= # # ################################################################################ ################################################################################ ################################################################################ # GNU make version 3.81 (2006) or higher is required because of the following: # - function 'info' # - variable '.DEFAULT_GOAL' # force exit when make version is < 3.81 ifneq ($(firstword $(sort 3.81 $(MAKE_VERSION))), 3.81) $(error GNU make version 3.81 or higher is required) endif # Relative path to externals root dir in multi-lib source tree like # pd-extended SVN. Default is parent of current working directory. May be # defined differently in including makefile. This variable is used to probe for # paths. externalsdir ?= .. # variable you can use to check if Makefile.pdlibbuilder is already included Makefile.pdlibbuilder = true ################################################################################ ### variables: library name and version ######################################## ################################################################################ # strip possibles spaces from lib.name, they mess up calculated file names lib.name := $(strip $(lib.name)) # if meta file exists, check library version metafile := $(wildcard $(lib.name)-meta.pd) ifdef metafile lib.version := $(shell sed -n \ 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' \ $(metafile)) endif ################################################################################ ### variables: files ########################################################### ################################################################################ #=== sources =================================================================== # (re)define .class.sources using file names in class.sources define add-class-source $(notdir $(basename $v)).class.sources += $v endef $(foreach v, $(class.sources), $(eval $(add-class-source))) # derive class names from .class.sources variables sourcevariables := $(filter %.class.sources, $(.VARIABLES)) classes := $(basename $(basename $(sourcevariables))) # accumulate all source files specified in makefile classes.sources := $(sort $(foreach v, $(sourcevariables), $($v))) all.sources := $(classes.sources) $(lib.setup.sources) \ $(shared.sources) $(common.sources) #=== object files ============================================================== # construct object filenames from all C and C++ source file names classes.objects := $(addsuffix .o, $(basename $(classes.sources))) common.objects := $(addsuffix .o, $(basename $(common.sources))) shared.objects := $(addsuffix .o, $(basename $(shared.sources))) lib.setup.objects := $(addsuffix .o, $(basename $(lib.setup.sources))) all.objects = $(classes.objects) $(common.objects) $(shared.objects) \ $(lib.setup.objects) #=== executables =============================================================== # use recursive variables here because executable extension is not yet known # construct class executable names from class names classes.executables = $(addsuffix .$(extension), $(classes)) # construct shared lib executable name if shared sources are defined ifdef shared.sources shared.lib = lib$(lib.name).$(shared.extension) else shared.lib = endif ################################################################################ ### variables per platform ##################################################### ################################################################################ #=== flags per architecture ==================================================== # Set architecture-dependent cflags, mainly for Linux. For Mac and Windows, # arch.c.flags are overriden below. machine := $(shell uname -m) # Raspberry Pi 1st generation ifeq ($(machine), armv6l) arch.c.flags = -march=armv6 -mfpu=vfp -mfloat-abi=hard endif # Beagle, Udoo, RPi2 etc. ifeq ($(machine), armv7l) arch.c.flags = -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard endif # Intel 32 bit, build with SSE and SSE2 instructions ifeq ($(findstring $(machine), i386 i686), $(machine)) arch.c.flags = -march=pentium4 -mfpmath=sse -msse -msse2 endif # Intel/AMD 64 bit, build with SSE, SSE2 and SSE3 instructions ifeq ($(findstring $(machine), ia64 x86_64), $(machine)) arch.c.flags = -march=core2 -mfpmath=sse -msse -msse2 -msse3 endif #=== operating system ========================================================== # The following systems are defined: Linux, Darwin, Windows. GNU and # GNU/kFreeBSD are treated as Linux to get the same options. uname := $(shell uname) ifeq ($(findstring $(uname), Linux GNU GNU/kFreeBSD), $(uname)) system = Linux endif ifeq ($(uname), Darwin) system = Darwin endif ifeq ($(findstring MINGW, $(uname)), MINGW) system = Windows endif # TODO: Cygwin, Android #=== flags and paths for Linux ================================================= ifeq ($(system), Linux) prefix = /usr/local libdir := $(prefix)/lib pkglibdir = $(libdir)/pd-externals pdincludepath := $(firstword $(dir $(wildcard \ $(externalsdir)/../pd/src/m_pd.h \ /usr/include/pdextended/m_pd.h \ /usr/include/pd/m_pd.h))) extension = pd_linux cpp.flags := -DUNIX c.flags := -fpic c.ldflags := -rdynamic -shared -fpic -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags c.ldlibs := -lc -lm cxx.flags := -fpic -fcheck-new cxx.ldflags := -rdynamic -shared -fpic -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags cxx.ldlibs := -lc -lm -lstdc++ shared.extension = so shared.ldflags := -rdynamic -fpic -shared -Wl,-soname,$(shared.lib) stripflags = --strip-unneeded -R .note -R .comment endif #=== flags and paths for Darwin ================================================ # On OSX we try to build fat binaries by default. It is assumed that OSX i386 # can build for ppc and OSX x86_64 can't. TODO: try to refine this condition. # LLVM-clang doesn't support -fcheck-new, therefore this flag is omitted for # OSX x86_64. ifeq ($(system), Darwin) pkglibdir = $(HOME)/Library/Pd pdincludepath := $(firstword $(dir $(wildcard \ $(externalsdir)/../pd/src/m_pd.h \ /Applications/Pd-extended.app/Contents/Resources/include/pdextended/m_pd.h \ /Applications/Pd.app/Contents/Resources/src/m_pd.h))) extension = pd_darwin cpp.flags := -DUNIX -DMACOSX -I /sw/include c.flags := c.ldflags := -undefined suppress -flat_namespace -bundle c.ldlibs := -lc cxx.ldflags := -undefined suppress -flat_namespace -bundle cxx.ldlibs := -lc shared.extension = dylib shared.ldflags = -dynamiclib -undefined dynamic_lookup \ -install_name @loader_path/$(shared.lib) \ -compatibility_version 1 -current_version 1.0 stripflags = -x ifeq ($(machine), i386) cxx.flags := -fcheck-new arch.c.flags := -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 arch.ld.flags := -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 endif ifeq ($(machine), x86_64) arch.c.flags := -arch i386 -arch x86_64 -mmacosx-version-min=10.5 arch.ld.flags := -arch i386 -arch x86_64 -mmacosx-version-min=10.5 endif endif #=== flags and paths for Windows =============================================== # Standard paths on Windows contain spaces, and GNU make functions treat such # paths as lists, with unintended effects. Therefore we must use shell function # ls instead of make's wildcard, and probe for each standard path individually. # Using double quotes around paths with spaces is obligatory. Since some path # variables are assembled or re-expanded later, great care must be taken to put # quotes at appropriate points throughout the makefile. Thanks, Bill. # paths for 32-bit executables on 64-bit Windows aren't yet defined here (TODO) ifeq ($(system), Windows) pkglibdir := $(APPDATA)/Pd pdbinpath := $(wildcard $(externalsdir)/../pd/bin/) pdincludepath := $(wildcard $(externalsdir)/../pd/src/) ifndef pdbinpath pdbinpath := $(shell ls -d "$(PROGRAMFILES)/pd/bin/") endif ifndef pdincludepath pdincludepath := $(shell ls -d "$(PROGRAMFILES)/pd/include/pdextended/") endif ifndef pdincludepath pdincludepath := $(shell ls -d "$(PROGRAMFILES)/pd/src/") endif endif # On Windows we build 32 bit by default to match Pd(-extended) binary # distributions. This may change in the future. # TODO: decide whether -mms-bitfields should be specified. ifeq ($(system), Windows) extension = dll CC = gcc CXX = g++ arch.c.flags := -march=pentium4 -msse -msse2 -mfpmath=sse cpp.flags := -DMSW -DNT c.flags := c.ldflags := -static-libgcc -shared \ -Wl,--enable-auto-import "$(pdbinpath)pd.dll" c.ldlibs := cxx.flags := -fcheck-new cxx.ldflags := -static-libstdc++ -shared \ -Wl,--enable-auto-import "$(pdbinpath)pd.dll" cxx.ldlibs := shared.extension = dll shared.ldflags := -static-libgcc -shared "$(pdbinpath)pd.dll" stripflags = --strip-unneeded -R .note -R .comment endif #=== paths ===================================================================== # Default pkglibdir is specified above per operating system. It is aliased as # 'objectsdir' to retain compatibility with pd-extended template. Assignment # operator '?=' is used to enable a project-relative path definition in the # including makefile. objectsdir ?= $(pkglibdir) # base path where all components of the lib will be installed by default installpath := $(DESTDIR)$(objectsdir)/$(lib.name) # check if pdincludepath contains spaces (as is often the case on Windows) # if so, store the path so we can later do checks with it pdincludepathwithspaces := $(if $(word 2, $(pdincludepath)), $(pdincludepath)) #=== accumulated build flags =================================================== # From GNU make docs: 'Users expect to be able to specify CFLAGS freely # themselves.' So we use CFLAGS to define options which are not strictly # required for compilation: optimizations, architecture specifications, and # warnings. CFLAGS can be safely overriden using a make command argument. # Variables cflags, ldflags and ldlibs may be defined in including makefile. optimization.flags = -O3 -ffast-math -funroll-loops -fomit-frame-pointer warn.flags = -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing # suppress -Wunused-variable & Co if you don't want to clutter a build log ifdef suppress-wunused warn.flags += $(addprefix -Wno-unused-, function parameter value variable) endif CFLAGS = $(warn.flags) $(optimization.flags) $(arch.c.flags) # preprocessor flags cpp.flags += -DPD -I "$(pdincludepath)" $(CPPFLAGS) # architecture specifications for linker are overridable by LDFLAGS LDFLAGS := $(arch.ld.flags) # now add the same ld flags to shared dynamic lib shared.ldflags := $(shared.ldflags) $(LDFLAGS) # accumulated flags for C compiler / linker c.flags := $(cpp.flags) $(c.flags) $(cflags) $(CFLAGS) c.ldflags := $(c.ldflags) $(ldflags) $(LDFLAGS) c.ldlibs := $(c.ldlibs) $(ldlibs) # accumulated flags for C++ compiler / linker cxx.flags := $(cpp.flags) $(cxx.flags) $(cflags) $(CFLAGS) cxx.ldflags := $(cxx.ldflags) $(ldflags) $(LDFLAGS) cxx.ldlibs := $(cxx.ldlibs) $(ldlibs) ################################################################################ ### variables: tools ########################################################### ################################################################################ # aliases so we can later define 'compile-$1' and set 'c' or 'cxx' as argument compile-c := $(CC) compile-cxx := $(CXX) ################################################################################ ### checks ##################################################################### ################################################################################ # At this point most variables are defined. Now do some checks and info's # before rules begin. # 'forward declaration' of default target, needed to do checks all: # To avoid unpredictable results, make sure the default target is not redefined # by including makefile. ifneq ($(.DEFAULT_GOAL), all) $(error Default target must be 'all'.) endif # find out which target(s) will be made ifdef MAKECMDGOALS goals := $(MAKECMDGOALS) else goals := all endif # check if m_pd.h is found and print info about it $(if $(shell ls "$(pdincludepath)m_pd.h"), \ $(info ++++ info: using Pd API $(pdincludepath)m_pd.h), \ $(warning Where is your m_pd.h? Do 'make help' for info.)) # print target info $(info ++++ info: making target $(goals) $(if $(lib.name),in lib $(lib.name))) # when installing, print installpath info $(if $(filter install install-lib, $(goals)), $(info ++++ info: \ installpath is '$(installpath)')) #=== define executables ======================================================== # By default we build class executables, and optionally a shared dynamic link # lib. When make-lib-executable=yes we build all classes into a single lib # executable, on the condition that variable lib.setup.sources is defined. ifeq ($(make-lib-executable),yes) $(if $(lib.setup.sources), ,\ $(error Can not build library blob because lib.setup.sources is undefined)) executables := $(lib.name).$(extension) else executables := $(classes.executables) $(shared.lib) endif ################################################################################ ### rules: special targets ##################################################### ################################################################################ # Disable built-in rules. If some target can't be built with the specified # rules, it should not be built at all. MAKEFLAGS += --no-builtin-rules .PRECIOUS: .SUFFIXES: .PHONY: all build-classes build-lib $(classes) $(makefiledirs) $(makefiles)\ install install-executables install-datafiles install-datadirs \ force clean vars allvars depend help ################################################################################ ### rules: build targets ####################################################### ################################################################################ # target all builds class executables plus optional shared lib # or alternatively a single lib executable when make-lib-executable=true all: $(executables) $(info ++++ info: $(if $(executables),executables in $(lib.name) completed)) # build all with -g option turned on for debug symbols alldebug: c.flags += -g alldebug: cxx.flags += -g alldebug: all #=== class executable ========================================================== # recipe for linking objects in class executable # argument $1 = compiler type (c or cxx) # argument $2 = class basename define link-class $(compile-$1) \ $($1.ldflags) $($2.class.ldflags) \ -o $2.$(extension) \ $(addsuffix .o, $(basename $($2.class.sources))) \ $(addsuffix .o, $(basename $(common.sources))) \ $($1.ldlibs) $($2.class.ldlibs) $(shared.lib) endef # general rule for linking object files in class executable %.$(extension): $(shared.lib) $(info ++++ info: linking objects in $@ for lib $(lib.name)) $(if $(filter %.cc %.cpp, $($*.class.sources)), \ $(call link-class,cxx,$*), \ $(call link-class,c,$*)) #=== library blob ============================================================== # build all classes into single executable build-lib: $(lib.name).$(extension) $(info ++++ info: library blob $(lib.name).$(extension) completed) # recipe for linking objects in lib executable # argument $1 = compiler type (c or cxx) define link-lib $(compile-$1) \ $($1.ldflags) $(lib.ldflags) \ -o $(lib.name).$(extension) $(all.objects) \ $($1.ldlibs) $(lib.ldlibs) endef # rule for linking objects in lib executable # declared conditionally to avoid name clashes ifeq ($(make-lib-executable),yes) $(lib.name).$(extension): $(all.objects) $(if $(filter %.cc %.cpp, $(all.sources)), \ $(call link-lib,cxx), \ $(call link-lib,c)) endif #=== shared dynamic lib ======================================================== # recipe for linking objects in shared executable # argument $1 = compiler type (c or cxx) define link-shared $(compile-$1) \ $(shared.ldflags) \ -o lib$(lib.name).$(shared.extension) $(shared.objects) \ $($1.ldlibs) $(shared.ldlibs) endef # rule for linking objects in shared executable # build recipe is in macro 'link-shared' lib$(lib.name).$(shared.extension): $(shared.objects) $(info ++++ info: linking objects in shared lib $@) $(if $(filter %.cc %.cpp, $(shared.sources)), \ $(call link-shared,cxx), \ $(call link-shared,c)) #=== object files ============================================================== # recipe to make .o file from source # argument $1 is compiler type (c or cxx) define make-object-file $(info ++++ info: making $@ in lib $(lib.name)) $(compile-$1) \ $($1.flags) \ -o $@ -c $< endef # Three rules to create .o files. These are double colon 'terminal' rules, # meaning they are the last in a rules chain. %.o:: %.c $(call make-object-file,c) %.o:: %.cc $(call make-object-file,cxx) %.o:: %.cpp $(call make-object-file,cxx) #=== explicit prerequisites for class executables ============================== # For class executables, prerequisite rules are declared in run time. Target # 'depend' prints these rules for debugging purposes. # declare explicit prerequisites rule like 'class: class.extension' # argument $v is class basename define declare-class-target $v: $v.$(extension) endef # declare explicit prerequisites rule like 'class.extension: object1.o object2.o' # argument $v is class basename define declare-class-executable-target $v.$(extension): $(addsuffix .o, $(basename $($v.class.sources))) \ $(addsuffix .o, $(basename $(common.sources))) endef # evaluate explicit prerequisite rules for all classes $(foreach v, $(classes), $(eval $(declare-class-target))) $(foreach v, $(classes), $(eval $(declare-class-executable-target))) #=== implicit prerequisites for class executables ============================== # Evaluating implicit prerequisites (header files) with help from the # preprocessor is 'expensive' so this is done conditionally and selectively. # Note that it is also possible to trigger a build via install targets, in # which case implicit prerequisites are not checked. # When the Pd include path contains spaces it will mess up the implicit # prerequisites rules so we do not evaluate them in that case. ifndef pdincludepathwithspaces must-build-everything := $(filter all default lib, $(goals)) must-build-class := $(filter $(classes), $(goals)) must-build-sources := $(foreach v, $(must-build-class), $($v.class.sources)) endif # declare implicit prerequisites rule like 'object.o: header1.h header2.h ...' # argument $1 is input source file(s) define declare-object-target $(filter %.o: %.h, $(shell $(CPP) $(c.flags) -MM $1)) $(MAKEFILE_LIST) endef # evaluate implicit prerequisite rules when rebuilding everything ifdef must-build-everything $(if $(wildcard $(all.objects)), \ $(info ++++ info: evaluating implicit prerequisites in lib $(lib.name).....) \ $(foreach v, $(all.sources), $(eval $(call declare-object-target, $v)))) endif # evaluate implicit prerequisite rules when selectively building classes ifdef must-build-class $(foreach v, $(must-build-sources), \ $(eval $(call declare-object-target, $v))) $(foreach v, $(shared.sources), \ $(eval $(call declare-object-target, $v))) endif ################################################################################ ### rules: preprocessor and assembly files ##################################### ################################################################################ # Preprocessor and assembly output files for bug tracing etc. They are not part # of the build processes for executables. By default these files are created in # the current working directory. Dependency tracking is not performed, the build # is forced instead to make sure it's up to date. force: #=== preprocessor file ========================================================= # make preprocessor output file with extension .pre # argument $1 = compiler type (c or cxx) define make-preprocessor-file $(info ++++ info: making preprocessor output file $(notdir $*.pre) \ in current working directory) $(compile-$1) -E $< $(c.flags) $($1.flags) -o $(notdir $*.pre) endef %.pre:: %.c force $(call make-preprocessor-file,c) %.pre:: %.cc force $(call make-preprocessor-file,cxx) %.pre:: %.cpp force $(call make-preprocessor-file,cxx) #=== assembly file ============================================================= # make C / assembly interleaved output file with extension .lst # argument $1 = compiler type (c or cxx) define make-assembly-file $(info ++++ info: making assembly output file $(notdir $*.lst) \ in current working directory) $(compile-$1) \ -c -Wa,-a,-ad -fverbose-asm \ $($1.flags) \ $< > $(notdir $*.lst) endef %.lst:: %.c force $(call make-assembly-file,c) %.lst:: %.cc force $(call make-assembly-file,cxx) %.lst:: %.cpp force $(call make-assembly-file,cxx) ################################################################################ ### rules: installation targets ################################################ ################################################################################ # Install targets depend on successful exit status of target all because nothing # must be installed in case of a build error. # -p = preserve time stamps # -m = set permission mode (as in chmod) # -d = create all components of specified directories INSTALL = install INSTALL_PROGRAM := $(INSTALL) -p -m 644 INSTALL_DATA := $(INSTALL) -p -m 644 INSTALL_DIR := $(INSTALL) -m 755 -d # strip spaces from file names executables := $(strip $(executables)) datafiles := $(strip $(datafiles)) datadirs := $(strip $(datadirs)) # Do not make any install sub-target with empty variable definition because the # install program would exit with an error. install: $(if $(executables), install-executables) install: $(if $(datafiles), install-datafiles) install: $(if $(datadirs), install-datadirs) install-executables: all $(INSTALL_DIR) -v "$(installpath)" $(INSTALL_PROGRAM) $(executables) "$(installpath)" $(info ++++ info: executables of lib $(lib.name) installed \ from $(CURDIR) to $(installpath)) install-datafiles: all $(INSTALL_DIR) -v "$(installpath)" $(INSTALL_DATA) $(datafiles) "$(installpath)" $(info ++++ info: data files of lib $(lib.name) installed \ from $(CURDIR) to $(installpath)) install-datadirs: all $(foreach v, $(datadirs), $(INSTALL_DIR) "$(installpath)/$v";) $(foreach v, $(datadirs), \ $(INSTALL_DATA) $(wildcard $v/*) "$(installpath)/$v";) $(info ++++ info: data directories of lib $(lib.name) installed \ from $(CURDIR) to $(installpath)) ################################################################################ ### rules: distribution targets ################################################ ################################################################################ # TODO # These targets are implemented in Makefile Template, but I have to figure out # how to do it under the not-so-strict conditions of Makefile.pdlibbuilder. # make source package dist: @echo "target dist not yet implemented" # make Debian source package dpkg-source: @echo "target dpkg-source not yet implemented" $(ORIGDIR): $(DISTDIR): ################################################################################ ### rules: clean targets ####################################################### ################################################################################ # delete build products from build tree clean: rm -f $(all.objects) rm -f $(classes.executables) $(lib.name).$(extension) $(shared.lib) rm -f *.pre *.lst # remove distribution directories and tarballs from build tree distclean: clean @echo "target distclean not yet implemented" ################################################################################ ### rules: submake targets ##################################################### ################################################################################ # Iterate over sub-makefiles or makefiles in other directories. # When 'continue-make=yes' is set, sub-makes will report 'true' to the parent # process regardless of their real exit status. This prevents the parent make # from being aborted by a sub-make error. Useful when you want to quickly find # out which sub-makes from a large set will succeed. ifeq ($(continue-make),yes) continue = || true endif # These targets will trigger sub-make processes for entries in 'makefiledirs' # and 'makefiles'. all alldebug install clean distclean dist dkpg-source: \ $(makefiledirs) $(makefiles) # this expands to identical rules for each entry in 'makefiledirs' $(makefiledirs): $(MAKE) --directory=$@ $(MAKECMDGOALS) $(continue) # this expands to identical rules for each entry in 'makefiles' $(makefiles): $(MAKE) --directory=$(dir $@) --makefile=$(notdir $@) $(MAKECMDGOALS) $(continue) ################################################################################ ### rules: convenience targets ################################################# ################################################################################ #=== show variables ============================================================ # Several 'function' macro's cause errors when expanded within a rule or without # proper arguments. Variables which are set with the define directive are only # shown by name for that reason. functions = \ add-class-source \ declare-class-target \ declare-class-executable-target \ declare-object-target \ link-class \ link-lib \ link-shared \ make-object-file \ make-preprocessor-file \ make-assembly-file # show variables from makefiles vars: $(info ++++ info: showing makefile variables:) $(foreach v,\ $(sort $(filter-out $(functions) functions, $(.VARIABLES))),\ $(if $(filter file, $(origin $v)),\ $(info variable $v = $($v)))) $(foreach v, $(functions), $(info 'function' name: $v)) @echo # show all variables allvars: $(info ++++ info: showing default, automatic and makefile variables:) $(foreach v, \ $(sort $(filter-out $(functions) functions, $(.VARIABLES))), \ $(info variable ($(origin $v)) $v = $($v))) $(foreach v, $(functions), $(info 'function' name: $v)) @echo #=== show dependencies ========================================================= # show generated prerequisites rules depend: $(info ++++ info: generated prerequisite rules) $(foreach v, $(classes), $(info $(declare-class-target))) $(foreach v, $(classes), $(info $(declare-class-executable-target))) $(foreach v, $(all.sources), $(info $(call declare-object-target, $v))) @echo #=== show help text ============================================================ # brief info about targets and paths mpdh := $(shell ls "$(pdincludepath)m_pd.h") mpdh := $(if $(mpdh), $(mpdh), m_pd.h not found. Is Pd(-extended) installed?) help: @echo @echo " Main targets:" @echo " all: build executables (default target)" @echo " install: install all components of the library" @echo " vars: print makefile variables for troubleshooting" @echo " allvars: print all variables for troubleshooting" @echo " help: print this help text" @echo @echo " Pd API m_pd.h:" @echo " $(shell ls "$(pdincludepath)m_pd.h")" @echo " You may specify your preferred include path as argument to" @echo " the make command, like 'pdincludepath=path/to/pd/src'." @echo @echo " Path for installation of your libdir(s):" @echo " $(objectsdir)" @echo " Alternatively you may specify your path for installation as argument" @echo " to the make command, like 'objectsdir=path/to/pd-externals'." @echo " For detailed info read the doc sections in Makefile.pdlibbuilder." @echo #=== dummy target ============================================================== coffee: @echo "Makefile.pdlibbuilder: Can not make coffee. Sorry." ################################################################################ ### end of rules sections ###################################################### ################################################################################ # for syntax highlighting in vim and github # vim: set filetype=make: iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/README.txt000066400000000000000000000032441277446453700225120ustar00rootroot00000000000000============================================================================== IEMguts ============================================================================== whatsit:: --------- IEMguts is an extension-library (aka: external, plugin) for miller.s.puckette's realtime computer-music environment "Pure Data"; it is of no use without Pure Data! IEMguts is a collection of low level objects that deal with the infrastructure to build better abstractions. they might be of no use on their own... danger:: -------- IEMguts often deal with non-official internals of Pure data. these internals might change in future versions of Pd, rendering IEMguts unusable. always make sure that you are using IEMguts with the same version of Pd as it was compiled with! else you might experience non-functional, crashing or exploding intestines. installation:: -------------- #2> make #3> make install note: IEMguts depends on some internal headers of Pd. therefore you might have to specify the full path to your Pd-sources using the 'pdincludepath' make-variable should do the trick. something like: #2> make pdincludepath=/home/me/src/pd-0.47-0/src should do the trick. (if you happen to need to the path to the Pd-binaries as well, you can additionally use the 'pdbinpath' variable.) license:: --------- this software is released under the GNU General Public License v2 or later. you can find the full text of this license in the GnuGPL.txt file that must be shipped with this software. authors:: --------- this software is copyleft 2007- by IOhannes m zmölnig , Institute of Electronic Music and Acoustics, University of Music and Dramatic Arts, Graz, Austria iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/000077500000000000000000000000001277446453700226275ustar00rootroot00000000000000iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/03.persistent_properties.pd000066400000000000000000000006501277446453700300520ustar00rootroot00000000000000#N canvas 416 189 491 300 10; #X text 98 82 right-click on the objects and select "properties".; #X text 99 103 then modify the properties and click on "OK"; #X text 100 125 finally save this patch and re-open it!; #X obj 73 195 gopcanvas 150 212 0; #X text 77 175 [gopcanvas]; #X text 263 179 [gopcanvas]; #X text 266 164 another; #X text 46 43 persistent properties for abstractions!; #X obj 259 199 gopcanvas 255 120 28; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/04.moving_in_gem.pd000066400000000000000000000017631277446453700262220ustar00rootroot00000000000000#N canvas 0 59 600 373 10; #X declare -lib Gem; #X obj 297 266 gemmover sphere; #X obj 153 273 gemmover light; #N canvas 180 249 555 286 gemwin 0; #X obj 103 210 gemwin; #X obj 102 119 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 101 141 select 1 0; #X msg 45 182 reset \, create \, 1 \, lighting 1; #X msg 169 209 destroy; #X obj 304 121 gemhead 1; #X obj 304 198 world_light; #X msg 382 151 0.5 0.5 0.5; #X obj 382 117 loadbang; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 2 1 4 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 6 0; #X connect 7 0 6 1; #X connect 8 0 7 0; #X coords 0 -1 1 1 85 35 1 100 100; #X restore 461 33 pd gemwin; #X obj 155 199 gemmover teapot; #X text 60 14 moving Gem's Geos in an interactive way; #X obj 456 73 declare -lib Gem; #X text 80 102 change into edit-mode \, select the [gemmover] objects below and drag them around \; watch the Gem-window.; #X text 78 137 you can also add new [gemmover] objects; #X text 301 53 turn rendering on --->; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/05.flies.pd000066400000000000000000000014001277446453700244740ustar00rootroot00000000000000#N canvas 0 0 776 456 10; #X obj 17 61 s tick; #X obj 17 41 metro 50; #X obj 17 23 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 ; #X obj 557 363 fly; #X obj 544 255 fly; #X obj 385 407 fly; #X obj 293 332 fly; #X obj 460 356 fly; #X obj 269 244 fly; #X obj 291 397 fly; #X obj 152 265 fly; #X text 54 21 <-- turn me on!; #X text 304 31 moving objects!; #X text 255 68 when you turn on the toggle \, all the [fly] objects will start to move. once they reach the borders of the canvas \, they will bounce off.; #X text 253 132 if you resize the canvas \, you probably have to "save" the patch in order to make the [fly]s aware of the changed borders. ; #X text 255 109 other objects will not be effected by the [fly]s.; #X connect 1 0 0 0; #X connect 2 0 1 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/06.interacting_sound.pd000066400000000000000000000035331277446453700271230ustar00rootroot00000000000000#N canvas 359 15 640 654 10; #X obj 15 88 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1 ; #X obj 426 27 namecanvas \$0-canvas; #X obj 15 127 s tick; #X obj 15 107 metro 100; #X obj 197 324 valX~ \$0; #X obj 12 255 s automove; #X obj 12 234 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X msg 450 62 \; pd dsp 1; #X text 50 87 <-- turn auto-connect on; #X text 109 170 select a [FM~] object and move it around to see what it does.; #X text 49 237 <-- let the agents move around by themselves; #X text 81 202 see here for a description of the agents:; #N canvas 59 213 619 385 agents 0; #X obj 56 288 sink~; #X text 115 291 sends the incoming signal to the specified [dac~]; #X text 36 108 sources:; #X obj 479 74 valX~; #X text 122 132 generates a signal which holds the horizontal position of the object; #X obj 410 68 valY~; #X text 122 162 generates a signal which holds the vertical position of the object; #X text 36 270 sinks:; #X text 32 208 effects:; #X obj 435 44 FM~; #X text 121 219 simple FM-modulator \; it's position determines the modulation index and the modulation frequency \; the inlet~ is the carrier \; if no signal is at the inlet~ \, a sine-wave with the specified frequency is generated as carrier.; #X text 24 6 available agents; #X text 112 59 the other arguments can be used to parameterize the agent.; #X text 110 23 the first argument of all agents MUST be "\$0" in order to communicate with the parent patch; #X restore 377 201 pd agents; #X obj 595 14 FM~ \$0 600; #X obj 271 555 sink~ \$0 1; #X text 109 111 when you turn "auto-connect" on \, each agent will try to connect itself (that is: its outlet~) with the nearest other agent (that is: its inlet~). Agents that are too far away cannot be connected too.; #X text 54 15 interacting sound agents; #X connect 0 0 3 0; #X connect 3 0 2 0; #X connect 4 0 14 0; #X connect 6 0 5 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/FM~.pd000066400000000000000000000132331277446453700236560ustar00rootroot00000000000000#N canvas 376 60 873 521 10; #X obj 314 163 canvasposition; #X msg 314 131 bang; #X obj 314 189 t l l; #X obj 99 459 outlet~; #N canvas 555 32 725 619 connector 0; #X obj 26 46 symbol \$0-pos; #X obj 140 110 r \$0-pos; #X obj 140 248 pack; #X obj 26 4 inlet; #X obj 26 144 s \$1-getpos; #X obj 254 34 inlet currentposition; #N canvas 412 176 450 300 distance 0; #X obj 98 237 outlet; #X obj 220 59 inlet pos2; #X obj 89 68 inlet pos1; #X obj 89 93 unpack; #X obj 91 139 -; #X obj 91 159 t f f; #X obj 92 178 *; #X obj 141 141 -; #X obj 141 161 t f f; #X obj 138 179 *; #X obj 97 206 +; #X obj 221 93 unpack; #X connect 1 0 11 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 1 7 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 5 1 6 1; #X connect 6 0 10 0; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 8 1 9 1; #X connect 9 0 10 1; #X connect 10 0 0 0; #X connect 11 0 4 1; #X connect 11 1 7 1; #X restore 180 172 pd distance; #X obj 140 131 list split 1; #N canvas 62 346 450 300 getnearest 0; #X obj 163 112 min; #X obj 163 136 t f f; #X obj 163 206 f; #X obj 163 186 t b; #X msg 339 108 1e+09; #X obj 338 37 inlet reset; #X obj 163 245 outlet id; #X obj 163 91 unpack; #X obj 163 41 inlet ; #X obj 163 161 change; #X msg 344 141 set \$1; #X connect 0 0 1 0; #X connect 1 0 9 0; #X connect 1 1 0 1; #X connect 2 0 6 0; #X connect 3 0 2 0; #X connect 4 0 0 1; #X connect 4 0 10 0; #X connect 5 0 4 0; #X connect 7 0 0 0; #X connect 7 1 2 1; #X connect 8 0 7 0; #X connect 9 0 3 0; #X connect 10 0 9 0; #X restore 140 282 pd getnearest; #N canvas 0 0 666 372 connectme 0; #X obj 234 258 t a; #X obj 126 199 pack 0 0; #X obj 138 21 inlet ; #X obj 276 30 inlet ; #X obj 234 288 outlet mess; #X msg 123 227 connect \$2 0 \$1 0; #X text 305 52 ; #X connect 0 0 4 0; #X connect 1 0 5 0; #X connect 2 0 1 0; #X connect 3 0 1 1; #X connect 5 0 0 0; #X restore 182 456 pd connectme; #X obj 430 32 inlet canvasindex; #X obj 182 486 s \$1-canvas; #X obj 531 371 outlet spigot; #X text 436 64 ; #X obj 338 462 disconnectme; #X obj 26 76 t s b b; #X obj 338 440 list; #X obj 317 125 t f l; #X obj 31 110 t b s b; #X msg 83 190 0; #X msg 54 189 1; #X obj 65 214 t f; #X obj 122 345 f; #X obj 122 366 change; #X obj 122 421 select -1; #X obj 32 24 t b b b; #X msg 99 26 -1; #X obj 140 198 swap; #X obj 123 392 t f b; #X obj 139 221 moses 150000; #X connect 0 0 15 0; #X connect 1 0 7 0; #X connect 2 0 8 0; #X connect 3 0 25 0; #X connect 5 0 6 1; #X connect 6 0 27 1; #X connect 7 0 27 0; #X connect 7 1 6 0; #X connect 8 0 22 1; #X connect 9 0 11 0; #X connect 10 0 17 0; #X connect 14 0 11 0; #X connect 15 0 18 0; #X connect 15 1 8 1; #X connect 16 0 14 0; #X connect 17 0 9 1; #X connect 17 1 16 1; #X connect 18 0 20 0; #X connect 18 1 4 0; #X connect 18 2 19 0; #X connect 19 0 21 0; #X connect 20 0 21 0; #X connect 21 0 12 0; #X connect 22 0 23 0; #X connect 23 0 28 0; #X connect 24 1 9 0; #X connect 25 0 22 0; #X connect 25 1 0 0; #X connect 25 2 26 0; #X connect 26 0 22 1; #X connect 27 0 29 0; #X connect 27 1 2 1; #X connect 28 0 24 0; #X connect 28 1 16 0; #X connect 29 0 2 0; #X restore 314 380 pd connector; #X obj 395 336 canvasindex; #X obj 395 359 pack; #X obj 314 302 t b l b; #X obj 100 389 osc~; #X obj 100 217 *~; #X obj 99 180 osc~; #N canvas 0 0 450 300 scale 0; #X obj 146 157 /; #X obj 177 156 /; #X obj 195 106 unpack; #X obj 136 115 unpack; #X obj 147 185 pack; #X obj 141 80 inlet; #X obj 191 80 inlet; #X obj 164 239 outlet; #X connect 0 0 4 0; #X connect 1 0 4 1; #X connect 2 0 0 1; #X connect 2 1 1 1; #X connect 3 0 0 0; #X connect 3 1 1 0; #X connect 4 0 7 0; #X connect 5 0 3 0; #X connect 6 0 2 0; #X restore 428 205 pd scale; #X obj 99 20 unpack; #X obj 99 71 * \$2; #X obj 99 46 * 4; #X obj 100 434 *~ 0.2; #X obj 98 120 line~; #X obj 99 97 pack 0 100; #X obj 138 215 line~; #X obj 139 192 pack 0 100; #X obj 671 81 canvasposition; #X obj 648 226 s; #X obj 648 57 t b b s; #X obj 648 202 pack 0 0 0; #X obj 681 130 unpack; #X obj 648 104 canvasindex; #X obj 648 6 r \$1-getpos; #X obj 648 28 spigot 1; #X obj 343 27 r tick; #X obj 228 20 inlet~; #N canvas 0 0 450 300 default~ 0; #X obj 103 45 inlet~; #X obj 103 261 outlet~; #X obj 331 128 sig~ \$2; #X obj 128 85 env~; #X obj 128 119 != 0; #X obj 128 157 line~; #X obj 128 138 pack 0 50; #X obj 104 205 *~; #X obj 152 192 *~ -1; #X obj 152 213 +~ 1; #X obj 153 236 *~; #X connect 0 0 3 0; #X connect 0 0 7 0; #X connect 2 0 10 1; #X connect 3 0 4 0; #X connect 4 0 6 0; #X connect 5 0 7 1; #X connect 5 0 8 0; #X connect 6 0 5 0; #X connect 7 0 1 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 10 0 1 0; #X restore 227 46 pd default~; #X obj 101 279 +~; #X obj 138 173 * 1000; #X obj 346 223 mover; #X obj 102 318 delwrite~ \$0-del 0; #X obj 101 337 delread~ \$0-del; #X connect 0 0 2 0; #X connect 0 0 11 0; #X connect 0 1 11 1; #X connect 0 1 33 1; #X connect 1 0 0 0; #X connect 2 0 7 0; #X connect 2 1 33 0; #X connect 4 0 27 1; #X connect 5 0 6 0; #X connect 5 1 6 1; #X connect 6 0 4 2; #X connect 7 0 4 0; #X connect 7 1 4 1; #X connect 7 2 5 0; #X connect 8 0 15 0; #X connect 9 0 31 0; #X connect 10 0 9 0; #X connect 11 0 12 0; #X connect 12 0 14 0; #X connect 12 1 32 0; #X connect 13 0 17 0; #X connect 14 0 13 0; #X connect 15 0 3 0; #X connect 16 0 10 0; #X connect 17 0 16 0; #X connect 18 0 9 1; #X connect 19 0 18 0; #X connect 20 0 24 0; #X connect 22 0 25 0; #X connect 22 1 20 0; #X connect 22 2 21 1; #X connect 23 0 21 0; #X connect 24 0 23 1; #X connect 24 1 23 2; #X connect 25 0 23 0; #X connect 26 0 27 0; #X connect 27 0 22 0; #X connect 28 0 1 0; #X connect 29 0 30 0; #X connect 30 0 31 1; #X connect 31 0 34 0; #X connect 32 0 19 0; #X connect 33 0 0 0; #X connect 35 0 8 0; #X coords 0 0 1 1 32 50 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/disconnectme.pd000066400000000000000000000007731277446453700256360ustar00rootroot00000000000000#N canvas 0 0 450 300 10; #X obj 278 127 swap; #X obj 304 148 t b f; #X obj 272 208 pack; #X obj 260 150 until; #X obj 271 187 i; #X obj 301 188 + 1; #X msg 303 167 0; #X obj 279 96 inlet ; #X obj 272 277 outlet; #X msg 272 234 disconnect \$2 0 \$1 0; #X connect 0 0 3 0; #X connect 0 1 1 0; #X connect 1 0 6 0; #X connect 1 1 2 1; #X connect 2 0 9 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 4 0 2 0; #X connect 5 0 4 1; #X connect 6 0 4 1; #X connect 7 0 0 0; #X connect 9 0 8 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/fly.pd000066400000000000000000000015651277446453700237550ustar00rootroot00000000000000#N canvas 267 53 673 475 10; #X obj 230 143 canvasposition; #X msg 234 111 bang; #N canvas 0 0 478 440 mover 0; #X obj 230 167 unpack; #X obj 216 285 pack 0 0; #X obj 297 167 unpack; #X obj 269 245 randomwalk; #X obj 297 187 - 30; #X obj 337 187 - 30; #X obj 230 121 inlet; #X obj 296 122 inlet; #X obj 227 320 outlet; #X obj 230 225 randomwalk; #X connect 0 0 9 0; #X connect 0 1 3 0; #X connect 1 0 8 0; #X connect 2 0 4 0; #X connect 2 1 5 0; #X connect 3 0 1 1; #X connect 4 0 9 1; #X connect 5 0 3 1; #X connect 6 0 0 0; #X connect 7 0 2 0; #X connect 9 0 1 0; #X restore 249 202 pd mover; #X obj 224 169 t l l; #X obj 228 81 r tick; #X msg 294 118 \$1 100; #X floatatom 297 93 5 0 0 0 - - -; #X connect 0 0 3 0; #X connect 0 1 2 1; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 1 2 0; #X connect 4 0 0 0; #X connect 5 0 0 0; #X connect 6 0 5 0; #X coords 0 0 1 1 32 50 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/gemmover.pd000066400000000000000000000013611277446453700247760ustar00rootroot00000000000000#N canvas 267 53 673 475 10; #X obj 164 154 canvasposition; #X obj 115 90 gemhead; #X obj 115 116 t a b; #X obj 115 318 translateXYZ; #X obj 164 179 unpack; #X obj 224 179 unpack; #X obj 171 208 /; #X obj 245 208 /; #X obj 171 229 * 2; #X obj 171 250 - 1; #X obj 245 250 - 1; #X obj 171 272 * 4; #X obj 245 229 * 2; #X obj 245 271 * -4; #X obj 115 353 \$1; #X connect 0 0 4 0; #X connect 0 1 5 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 2 1 0 0; #X connect 3 0 14 0; #X connect 4 0 6 0; #X connect 4 1 7 0; #X connect 5 0 6 1; #X connect 5 1 7 1; #X connect 6 0 8 0; #X connect 7 0 12 0; #X connect 8 0 9 0; #X connect 9 0 11 0; #X connect 10 0 13 0; #X connect 11 0 3 1; #X connect 12 0 10 0; #X connect 13 0 3 2; #X coords 0 0 1 1 32 50 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/gopcanvas.pd000066400000000000000000000132501277446453700251360ustar00rootroot00000000000000#N canvas 452 272 631 456 10; #X obj 138 250 propertybang; #N canvas 203 89 362 187 \$0-properties 0; #X obj 58 137 cnv 15 200 35 empty empty empty 20 12 0 14 -233017 -66577 0; #X obj 67 145 bng 15 250 50 0 \$0-done empty OK 17 7 0 10 -24198 -1 -1; #X obj 188 145 bng 15 250 50 0 \$0-cancel empty cancel 17 7 0 10 -258699 -1 -1; #X obj 61 76 hsl 128 15 0 255 0 0 \$0-R \$0-R empty -2 -8 0 10 -258699 -1 -1 0 1; #X obj 61 93 hsl 128 15 0 255 0 0 \$0-G \$0-G empty -2 -8 0 10 -24198 -1 -1 0 1; #X obj 61 110 hsl 128 15 0 255 0 0 \$0-B \$0-B empty -2 -8 0 10 -62784 -1 -1 0 1; #X obj 206 76 cnv 15 50 50 empty \$0-color empty 20 12 0 14 -154945 -262144 0; #X obj 120 145 bng 15 250 50 0 \$0-apply empty apply 17 7 0 10 -241291 -1 -1; #X text 90 37 select your color!; #X restore 138 419 pd \$0-properties; #X obj 138 282 t b b; #X obj 101 101 cnv 15 83 58 empty \$0-label empty 20 12 0 14 -154945 -262144 0; #X obj 138 398 s pd-\$0-properties; #X msg 138 381 vis \$1; #X msg 163 361 1; #X msg 138 361 0; #N canvas 42 382 857 456 propertyguts 0; #X obj 118 105 r \$0-R; #X obj 160 105 r \$0-G; #X obj 201 105 r \$0-B; #N canvas 15 207 606 448 RGB_____________ 0; #X obj 97 56 inlet; #X obj 262 43 inlet; #X obj 339 45 inlet; #X obj 405 44 inlet; #X obj 97 230 bang; #X msg 97 255 0; #X msg 123 254 1; #X obj 146 228 bang; #X msg 152 255 0; #X msg 180 255 1; #X obj 312 313 spigot; #X obj 249 385 outlet; #X text 93 33 select; #X text 267 28 red; #X text 337 30 green; #X text 409 30 blue; #X obj 405 132 t b f; #X obj 339 160 +; #X obj 339 185 t b f; #X obj 339 216 +; #X obj 296 385 outlet; #X obj 296 361 f; #X obj 249 361 f; #X obj 262 109 * -65536; #X obj 339 110 * -256; #X obj 405 110 * -1; #X obj 339 247 - 1; #X obj 97 135 route back label bang; #X obj 235 168 t b b b; #X obj 265 313 spigot 1; #X obj 262 77 max 0; #X obj 262 93 min 255; #X obj 339 77 max 0; #X obj 339 93 min 255; #X obj 405 77 max 0; #X obj 405 93 min 255; #X obj 262 61 i; #X obj 339 61 i; #X obj 405 61 i; #X connect 0 0 27 0; #X connect 1 0 36 0; #X connect 2 0 37 0; #X connect 3 0 38 0; #X connect 4 0 5 0; #X connect 4 0 6 0; #X connect 5 0 10 1; #X connect 6 0 29 1; #X connect 7 0 8 0; #X connect 7 0 9 0; #X connect 8 0 29 1; #X connect 9 0 10 1; #X connect 10 0 21 1; #X connect 16 0 17 0; #X connect 16 1 17 1; #X connect 17 0 18 0; #X connect 18 0 19 0; #X connect 18 1 19 1; #X connect 19 0 26 0; #X connect 21 0 20 0; #X connect 22 0 11 0; #X connect 23 0 19 0; #X connect 24 0 17 0; #X connect 25 0 16 0; #X connect 26 0 10 0; #X connect 26 0 29 0; #X connect 27 0 4 0; #X connect 27 1 7 0; #X connect 27 2 28 0; #X connect 28 0 22 0; #X connect 28 1 21 0; #X connect 28 2 26 0; #X connect 29 0 22 1; #X connect 30 0 31 0; #X connect 31 0 23 0; #X connect 32 0 33 0; #X connect 33 0 24 0; #X connect 34 0 35 0; #X connect 35 0 25 0; #X connect 36 0 30 0; #X connect 37 0 32 0; #X connect 38 0 34 0; #X restore 118 244 pd RGB_____________; #X obj 118 165 b; #X obj 118 130 t b f; #X obj 160 130 t b f; #X obj 201 130 t b f; #X obj 118 304 s \$0-color; #X obj 202 63 r \$0-done; #X obj 202 81 t b b; #X obj 29 100 b; #X obj 29 47 r \$0-cancel; #X obj 432 28 inlet properties opened; #X obj 29 415 outlet close properties; #X msg 118 285 color \$1 0; #X obj 257 355 route 0; #X obj 257 303 t b b; #X obj 310 357 f; #X obj 118 262 t f f; #X obj 310 392 s \$0-label; #X msg 310 374 color \$1 0; #X obj 257 83 r \$0-apply; #X obj 257 101 t b b; #X obj 335 106 pack \$1 \$2 \$3; #X obj 335 126 unpack 0 0 0; #X obj 310 44 loadbang; #X obj 310 63 t b b; #X obj 257 414 outlet arguments; #X obj 257 324 pack 0 \$1 \$2 \$3; #X obj 154 213 i; #X obj 190 213 i; #X obj 228 213 i; #X obj 432 100 b; #X obj 432 308 route 0; #X obj 432 287 pack 0 \$1 \$2 \$3; #X obj 432 345 s \$0-R; #X obj 474 345 s \$0-G; #X obj 515 345 s \$0-B; #X obj 432 327 unpack 0 0 0; #X connect 0 0 5 0; #X connect 1 0 6 0; #X connect 2 0 7 0; #X connect 3 0 19 0; #X connect 4 0 3 0; #X connect 5 0 4 0; #X connect 5 1 30 0; #X connect 6 0 4 0; #X connect 6 1 31 0; #X connect 7 0 4 0; #X connect 7 1 32 0; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 10 1 23 0; #X connect 11 0 14 0; #X connect 12 0 11 0; #X connect 13 0 33 0; #X connect 15 0 8 0; #X connect 16 0 28 0; #X connect 17 0 29 0; #X connect 17 1 18 0; #X connect 18 0 21 0; #X connect 19 0 15 0; #X connect 19 1 18 1; #X connect 21 0 20 0; #X connect 22 0 23 0; #X connect 23 0 17 0; #X connect 24 0 25 0; #X connect 25 0 5 0; #X connect 25 1 3 2; #X connect 25 2 3 3; #X connect 26 0 27 0; #X connect 27 0 18 0; #X connect 27 1 24 0; #X connect 29 0 16 0; #X connect 30 0 3 1; #X connect 30 0 29 1; #X connect 30 0 35 1; #X connect 31 0 3 2; #X connect 31 0 29 2; #X connect 31 0 35 2; #X connect 32 0 3 3; #X connect 32 0 29 3; #X connect 32 0 35 3; #X connect 33 0 35 0; #X connect 34 0 39 0; #X connect 35 0 34 0; #X connect 39 0 36 0; #X connect 39 1 37 0; #X connect 39 2 38 0; #X restore 138 304 pd propertyguts; #X obj 223 331 canvasargs; #X text 43 37 this is a simple abstraction that displays a canvas via gop.; #X text 38 168 the canvas-color can be changed via a properties-panel (which is really the subpatch [\$0-properties]); #X text 38 196 saving the parent-patch (wherein this abstraction is embedded will also save the properties); #X text 228 248 <- enables the "property" menu and emits a bang when it is selected; #X text 237 306 <- all the property handling logic; #X text 277 333 <- handles the overriding of arguments in the parent patch; #X text 255 420 <-- the property-panel subpatch; #X text 42 53 it is used in the "persistent_properties" example.; #X connect 0 0 2 0; #X connect 2 0 8 0; #X connect 2 1 6 0; #X connect 5 0 4 0; #X connect 6 0 5 0; #X connect 7 0 5 0; #X connect 8 0 7 0; #X connect 8 1 9 0; #X coords 0 -1 1 1 85 60 2 100 100; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/mover.pd000066400000000000000000000010751277446453700243070ustar00rootroot00000000000000#N canvas 0 0 470 427 10; #X obj 230 167 unpack; #X obj 216 285 pack 0 0; #X obj 230 225 randomwalk; #X obj 297 167 unpack; #X obj 269 245 randomwalk; #X obj 297 187 - 30; #X obj 337 187 - 30; #X obj 230 121 inlet; #X obj 296 122 inlet; #X obj 227 320 outlet; #X obj 215 146 spigot; #X obj 313 68 r automove; #X connect 0 0 2 0; #X connect 0 1 4 0; #X connect 1 0 9 0; #X connect 2 0 1 0; #X connect 3 0 5 0; #X connect 3 1 6 0; #X connect 4 0 1 1; #X connect 5 0 2 1; #X connect 6 0 4 1; #X connect 7 0 10 0; #X connect 8 0 3 0; #X connect 10 0 0 0; #X connect 11 0 10 1; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/randomoffset.pd000066400000000000000000000011301277446453700256360ustar00rootroot00000000000000#N canvas 203 115 450 300 10; #X obj 148 54 inlet; #X obj 148 253 outlet; #X obj 148 118 random 101; #X obj 148 88 b; #X obj 148 140 / 50; #X obj 148 165 - 1; #X obj 148 212 + 0.5; #X obj 148 232 i; #X obj 258 59 inlet; #X obj 315 57 loadbang; #X obj 315 80 f \$1; #X obj 251 142 t f; #X obj 315 103 select 0; #X obj 148 185 * 5; #X connect 0 0 3 0; #X connect 2 0 4 0; #X connect 3 0 2 0; #X connect 4 0 5 0; #X connect 5 0 13 0; #X connect 6 0 7 0; #X connect 7 0 1 0; #X connect 8 0 11 0; #X connect 9 0 10 0; #X connect 10 0 12 0; #X connect 11 0 13 1; #X connect 12 1 11 0; #X connect 13 0 6 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/randomwalk.pd000066400000000000000000000016611277446453700253170ustar00rootroot00000000000000#N canvas 198 71 450 466 10; #X obj 171 140 randomoffset; #X obj 139 119 t f b; #X obj 139 167 +; #X obj 139 72 inlet; #X obj 310 61 inlet bound; #X obj 139 218 t f f; #X obj 246 239 t f f; #X obj 139 196 + 1; #X obj 139 266 outlet; #X obj 278 277 > 400; #X obj 246 277 < 0; #X obj 246 319 select 1; #X obj 246 300 change; #X obj 316 319 select 1; #X obj 316 300 change; #X msg 316 339 -1; #X obj 246 366 t f; #X floatatom 291 374 5 0 0 0 - - -; #X msg 246 337 1; #X obj 245 391 * 3; #X connect 0 0 2 1; #X connect 1 0 2 0; #X connect 1 1 0 0; #X connect 2 0 7 0; #X connect 3 0 1 0; #X connect 4 0 9 1; #X connect 5 0 8 0; #X connect 5 1 6 0; #X connect 6 0 10 0; #X connect 6 1 9 0; #X connect 7 0 5 0; #X connect 9 0 14 0; #X connect 10 0 12 0; #X connect 11 0 18 0; #X connect 12 0 11 0; #X connect 13 0 15 0; #X connect 14 0 13 0; #X connect 15 0 16 0; #X connect 16 0 19 0; #X connect 17 0 19 1; #X connect 18 0 16 0; #X connect 19 0 7 1; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/sink~.pd000066400000000000000000000007661277446453700243270ustar00rootroot00000000000000#N canvas 351 0 673 475 10; #X obj 99 60 inlet~; #X obj 461 121 canvasposition; #X obj 438 266 s; #X obj 438 97 t b b s; #X obj 438 242 pack 0 0 0; #X obj 471 170 unpack; #X obj 438 144 canvasindex; #X obj 438 76 r \$1-getpos; #X obj 100 214 dac~ \$2; #X obj 98 331 outlet~; #X connect 0 0 8 0; #X connect 1 0 5 0; #X connect 3 0 6 0; #X connect 3 1 1 0; #X connect 3 2 2 1; #X connect 4 0 2 0; #X connect 5 0 4 1; #X connect 5 1 4 2; #X connect 6 0 4 0; #X connect 7 0 3 0; #X coords 0 0 1 1 32 50 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/valX~.pd000066400000000000000000000103071277446453700242650ustar00rootroot00000000000000#N canvas 376 60 873 521 10; #X obj 320 163 canvasposition; #X msg 324 131 bang; #X obj 314 189 t l l; #X obj 99 459 outlet~; #N canvas 555 32 725 619 connector 0; #X obj 26 46 symbol \$0-pos; #X obj 140 110 r \$0-pos; #X obj 140 248 pack; #X obj 26 4 inlet; #X obj 26 144 s \$1-getpos; #X obj 254 34 inlet currentposition; #N canvas 412 176 450 300 distance 0; #X obj 98 237 outlet; #X obj 220 59 inlet pos2; #X obj 89 68 inlet pos1; #X obj 89 93 unpack; #X obj 91 139 -; #X obj 91 159 t f f; #X obj 92 178 *; #X obj 141 141 -; #X obj 141 161 t f f; #X obj 138 179 *; #X obj 97 206 +; #X obj 221 93 unpack; #X connect 1 0 11 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 1 7 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 5 1 6 1; #X connect 6 0 10 0; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 8 1 9 1; #X connect 9 0 10 1; #X connect 10 0 0 0; #X connect 11 0 4 1; #X connect 11 1 7 1; #X restore 180 172 pd distance; #X obj 140 131 list split 1; #N canvas 62 346 450 300 getnearest 0; #X obj 163 112 min; #X obj 163 136 t f f; #X obj 163 206 f; #X obj 163 186 t b; #X msg 339 108 1e+09; #X obj 338 37 inlet reset; #X obj 163 245 outlet id; #X obj 163 91 unpack; #X obj 163 41 inlet ; #X obj 163 161 change; #X msg 344 141 set \$1; #X connect 0 0 1 0; #X connect 1 0 9 0; #X connect 1 1 0 1; #X connect 2 0 6 0; #X connect 3 0 2 0; #X connect 4 0 0 1; #X connect 4 0 10 0; #X connect 5 0 4 0; #X connect 7 0 0 0; #X connect 7 1 2 1; #X connect 8 0 7 0; #X connect 9 0 3 0; #X connect 10 0 9 0; #X restore 140 282 pd getnearest; #N canvas 0 0 666 372 connectme 0; #X obj 234 258 t a; #X obj 126 199 pack 0 0; #X obj 138 21 inlet ; #X obj 276 30 inlet ; #X obj 234 288 outlet mess; #X msg 123 227 connect \$2 0 \$1 0; #X text 305 52 ; #X connect 0 0 4 0; #X connect 1 0 5 0; #X connect 2 0 1 0; #X connect 3 0 1 1; #X connect 5 0 0 0; #X restore 182 456 pd connectme; #X obj 430 32 inlet canvasindex; #X obj 182 486 s \$1-canvas; #X obj 531 371 outlet spigot; #X text 436 64 ; #X obj 338 462 disconnectme; #X obj 26 76 t s b b; #X obj 338 440 list; #X obj 317 125 t f l; #X obj 31 110 t b s b; #X msg 83 190 0; #X msg 54 189 1; #X obj 65 214 t f; #X obj 122 345 f; #X obj 122 366 change; #X obj 122 421 select -1; #X obj 32 24 t b b b; #X msg 99 26 -1; #X obj 140 198 swap; #X obj 123 392 t f b; #X obj 139 221 moses 150000; #X connect 0 0 15 0; #X connect 1 0 7 0; #X connect 2 0 8 0; #X connect 3 0 25 0; #X connect 5 0 6 1; #X connect 6 0 27 1; #X connect 7 0 27 0; #X connect 7 1 6 0; #X connect 8 0 22 1; #X connect 9 0 11 0; #X connect 10 0 17 0; #X connect 14 0 11 0; #X connect 15 0 18 0; #X connect 15 1 8 1; #X connect 16 0 14 0; #X connect 17 0 9 1; #X connect 17 1 16 1; #X connect 18 0 20 0; #X connect 18 1 4 0; #X connect 18 2 19 0; #X connect 19 0 21 0; #X connect 20 0 21 0; #X connect 21 0 12 0; #X connect 22 0 23 0; #X connect 23 0 28 0; #X connect 24 1 9 0; #X connect 25 0 22 0; #X connect 25 1 0 0; #X connect 25 2 26 0; #X connect 26 0 22 1; #X connect 27 0 29 0; #X connect 27 1 2 1; #X connect 28 0 24 0; #X connect 28 1 16 0; #X connect 29 0 2 0; #X restore 314 380 pd connector; #X obj 395 336 canvasindex; #X obj 395 359 pack; #X obj 314 302 t b l b; #X obj 671 81 canvasposition; #X obj 648 226 s; #X obj 648 57 t b b s; #X obj 648 202 pack 0 0 0; #X obj 681 130 unpack; #X obj 648 104 canvasindex; #X obj 648 6 r \$1-getpos; #X obj 648 28 spigot 1; #X obj 343 27 r tick; #X obj 229 17 inlet~; #X obj 127 217 unpack; #X obj 100 353 line~; #X obj 100 323 pack 0 100; #X obj 346 212 mover; #X obj 100 398 delwrite~ \$0-del 0; #X obj 100 417 delread~ \$0-del; #X connect 0 0 2 0; #X connect 0 0 18 0; #X connect 0 1 21 1; #X connect 1 0 0 0; #X connect 2 0 7 0; #X connect 2 1 21 0; #X connect 4 0 15 1; #X connect 5 0 6 0; #X connect 5 1 6 1; #X connect 6 0 4 2; #X connect 7 0 4 0; #X connect 7 1 4 1; #X connect 7 2 5 0; #X connect 8 0 12 0; #X connect 10 0 13 0; #X connect 10 1 8 0; #X connect 10 2 9 1; #X connect 11 0 9 0; #X connect 12 0 11 1; #X connect 12 1 11 2; #X connect 13 0 11 0; #X connect 14 0 15 0; #X connect 15 0 10 0; #X connect 16 0 1 0; #X connect 18 0 20 0; #X connect 19 0 22 0; #X connect 20 0 19 0; #X connect 21 0 0 0; #X connect 23 0 3 0; #X coords 0 0 1 1 32 50 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/valY~.pd000066400000000000000000000103051277446453700242640ustar00rootroot00000000000000#N canvas 376 60 873 521 10; #X obj 320 163 canvasposition; #X msg 324 131 bang; #X obj 314 189 t l l; #X obj 99 459 outlet~; #N canvas 555 32 725 619 connector 0; #X obj 26 46 symbol \$0-pos; #X obj 140 110 r \$0-pos; #X obj 140 248 pack; #X obj 26 4 inlet; #X obj 26 144 s \$1-getpos; #X obj 254 34 inlet currentposition; #N canvas 412 176 450 300 distance 0; #X obj 98 237 outlet; #X obj 220 59 inlet pos2; #X obj 89 68 inlet pos1; #X obj 89 93 unpack; #X obj 91 139 -; #X obj 91 159 t f f; #X obj 92 178 *; #X obj 141 141 -; #X obj 141 161 t f f; #X obj 138 179 *; #X obj 97 206 +; #X obj 221 93 unpack; #X connect 1 0 11 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 1 7 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 5 1 6 1; #X connect 6 0 10 0; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 8 1 9 1; #X connect 9 0 10 1; #X connect 10 0 0 0; #X connect 11 0 4 1; #X connect 11 1 7 1; #X restore 180 172 pd distance; #X obj 140 131 list split 1; #N canvas 62 346 450 300 getnearest 0; #X obj 163 112 min; #X obj 163 136 t f f; #X obj 163 206 f; #X obj 163 186 t b; #X msg 339 108 1e+09; #X obj 338 37 inlet reset; #X obj 163 245 outlet id; #X obj 163 91 unpack; #X obj 163 41 inlet ; #X obj 163 161 change; #X msg 344 141 set \$1; #X connect 0 0 1 0; #X connect 1 0 9 0; #X connect 1 1 0 1; #X connect 2 0 6 0; #X connect 3 0 2 0; #X connect 4 0 0 1; #X connect 4 0 10 0; #X connect 5 0 4 0; #X connect 7 0 0 0; #X connect 7 1 2 1; #X connect 8 0 7 0; #X connect 9 0 3 0; #X connect 10 0 9 0; #X restore 140 282 pd getnearest; #N canvas 0 0 666 372 connectme 0; #X obj 234 258 t a; #X obj 126 199 pack 0 0; #X obj 138 21 inlet ; #X obj 276 30 inlet ; #X obj 234 288 outlet mess; #X msg 123 227 connect \$2 0 \$1 0; #X text 305 52 ; #X connect 0 0 4 0; #X connect 1 0 5 0; #X connect 2 0 1 0; #X connect 3 0 1 1; #X connect 5 0 0 0; #X restore 182 456 pd connectme; #X obj 430 32 inlet canvasindex; #X obj 182 486 s \$1-canvas; #X obj 531 371 outlet spigot; #X text 436 64 ; #X obj 338 462 disconnectme; #X obj 26 76 t s b b; #X obj 338 440 list; #X obj 317 125 t f l; #X obj 31 110 t b s b; #X msg 83 190 0; #X msg 54 189 1; #X obj 65 214 t f; #X obj 122 345 f; #X obj 122 366 change; #X obj 122 421 select -1; #X obj 32 24 t b b b; #X msg 99 26 -1; #X obj 140 198 swap; #X obj 123 392 t f b; #X obj 139 221 moses 150000; #X connect 0 0 15 0; #X connect 1 0 7 0; #X connect 2 0 8 0; #X connect 3 0 25 0; #X connect 5 0 6 1; #X connect 6 0 27 1; #X connect 7 0 27 0; #X connect 7 1 6 0; #X connect 8 0 22 1; #X connect 9 0 11 0; #X connect 10 0 17 0; #X connect 14 0 11 0; #X connect 15 0 18 0; #X connect 15 1 8 1; #X connect 16 0 14 0; #X connect 17 0 9 1; #X connect 17 1 16 1; #X connect 18 0 20 0; #X connect 18 1 4 0; #X connect 18 2 19 0; #X connect 19 0 21 0; #X connect 20 0 21 0; #X connect 21 0 12 0; #X connect 22 0 23 0; #X connect 23 0 28 0; #X connect 24 1 9 0; #X connect 25 0 22 0; #X connect 25 1 0 0; #X connect 25 2 26 0; #X connect 26 0 22 1; #X connect 27 0 29 0; #X connect 27 1 2 1; #X connect 28 0 24 0; #X connect 28 1 16 0; #X connect 29 0 2 0; #X restore 314 380 pd connector; #X obj 395 336 canvasindex; #X obj 395 359 pack; #X obj 314 302 t b l b; #X obj 671 81 canvasposition; #X obj 648 226 s; #X obj 648 57 t b b s; #X obj 648 202 pack 0 0 0; #X obj 681 130 unpack; #X obj 648 104 canvasindex; #X obj 648 6 r \$1-getpos; #X obj 648 28 spigot 1; #X obj 343 27 r tick; #X obj 229 17 inlet~; #X obj 127 217 unpack; #X obj 100 373 line~; #X obj 100 343 pack 0 100; #X obj 346 222 mover; #X obj 99 418 delwrite~ \$0-del 0; #X obj 99 437 delread~ \$0-del; #X connect 0 0 2 0; #X connect 0 0 18 0; #X connect 0 1 21 1; #X connect 1 0 0 0; #X connect 2 0 7 0; #X connect 2 1 21 0; #X connect 4 0 15 1; #X connect 5 0 6 0; #X connect 5 1 6 1; #X connect 6 0 4 2; #X connect 7 0 4 0; #X connect 7 1 4 1; #X connect 7 2 5 0; #X connect 8 0 12 0; #X connect 10 0 13 0; #X connect 10 1 8 0; #X connect 10 2 9 1; #X connect 11 0 9 0; #X connect 12 0 11 1; #X connect 12 1 11 2; #X connect 13 0 11 0; #X connect 14 0 15 0; #X connect 15 0 10 0; #X connect 16 0 1 0; #X connect 18 1 20 0; #X connect 19 0 22 0; #X connect 20 0 19 0; #X connect 21 0 0 0; #X connect 23 0 3 0; #X coords 0 0 1 1 32 50 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/examples/versioning.pd000066400000000000000000000036071277446453700253450ustar00rootroot00000000000000#N canvas 474 208 450 587 10; #X msg 151 401 savetofile \$1.pd .; #X obj 198 105 canvasname 1; #X obj 124 68 savebangs 2; #X obj 151 421 sendcanvas 1; #N canvas 159 471 450 398 versioning 0; #X obj 114 39 inlet; #X obj 114 262 outlet; #X text 179 266 new name; #X text 164 39 old name; #X obj 114 129 list split 1; #X obj 114 217 list append; #N canvas 0 0 450 455 reversion 0; #X obj 78 394 outlet; #N canvas 437 238 450 300 symbolize 0; #X obj 72 50 inlet; #X obj 72 262 outlet; #X obj 181 124 symbol; #X obj 72 147 makefilename %d; #X obj 72 177 t s; #X obj 72 100 route float bang; #X msg 126 121 0; #X connect 0 0 5 0; #X connect 2 0 4 0; #X connect 3 0 4 0; #X connect 4 0 1 0; #X connect 5 0 3 0; #X connect 5 1 6 0; #X connect 5 2 2 0; #X connect 6 0 3 0; #X restore 78 83 pd symbolize; #X obj 78 363 l2s :; #X obj 78 126 s2l :; #X obj 78 46 inlet next; #X obj 78 148 t l l; #X obj 110 171 list length; #X obj 110 193 - 1; #X obj 78 215 list split; #X obj 78 339 list append; #X obj 152 265 + 1; #X obj 152 243 t f; #X obj 152 311 t l b; #X obj 152 288 list append 0; #X connect 1 0 3 0; #X connect 2 0 0 0; #X connect 3 0 5 0; #X connect 4 0 1 0; #X connect 5 0 8 0; #X connect 5 1 6 0; #X connect 6 0 7 0; #X connect 7 0 8 1; #X connect 8 0 9 0; #X connect 8 1 11 0; #X connect 9 0 2 0; #X connect 10 0 13 0; #X connect 11 0 10 0; #X connect 12 0 9 1; #X connect 12 1 13 1; #X connect 13 0 12 0; #X restore 154 171 pd reversion; #X obj 328 62 inlet branch!; #X obj 114 102 s2l |; #X obj 114 239 l2s |; #X connect 0 0 8 0; #X connect 4 0 5 0; #X connect 4 1 6 0; #X connect 5 0 9 0; #X connect 6 0 5 1; #X connect 8 0 4 0; #X connect 9 0 1 0; #X restore 198 293 pd versioning; #X symbolatom 222 252 10 0 0 0 - - -; #X msg 222 228 bang; #X obj 119 291 t s s; #X connect 0 0 3 0; #X connect 1 0 4 0; #X connect 2 1 1 0; #X connect 4 0 7 0; #X connect 5 0 4 0; #X connect 6 0 5 0; #X connect 7 0 1 0; #X connect 7 1 0 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/000077500000000000000000000000001277446453700217415ustar00rootroot00000000000000iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/autoabstraction-help.pd000066400000000000000000000006371277446453700264240ustar00rootroot00000000000000#N canvas 306 0 450 300 10; #X text 39 169 this code adds an external "loader" to Miller S. Puckette's "pure data" \, * which allows the on-the-fly creation of abstractions by just creating an * object which is of a yet unknown file and for which no abstraction-file exists * * the new abstraction should be minimal and eventually be loaded from a template; #X text 134 91 FIXME; #X text 58 41 THIS IS ONLY A STUB; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasargs-help.pd000066400000000000000000000020111277446453700253360ustar00rootroot00000000000000#N canvas 315 241 645 450 10; #X text 39 77 usage:; #X text 367 336 (c) IOhannes m zmoelnig @ iem \, 2007; #X obj 90 43 canvasargs; #X text 174 44 manipulate the abstractions arguments (and name) on saving; #X obj 71 384 canvasargs; #X msg 71 281 list 10 20; #X msg 91 303 list quite a lot of arguments; #X msg 102 340 abstraction1; #X msg 118 357 abstraction2 argument1; #X text 83 78 put the [canvasargs] in your abstraction; #X text 81 114 send a _list_ of new arguments to the [canvasargs]; #X text 82 130 save the parent patch; #X text 83 94 put the abstraction in your parent patch; #X text 74 150 --> the parent patch will save your abstraction with the arguments you sent to [canvasargs] instead of the original ones; #X text 77 203 you can also change the (saved) name of the abstraction \, by using a selector other than "list" (and the like).; #X text 77 226 take care \, as this can totally change the behaviour of your patch (or break it); #X connect 5 0 4 0; #X connect 6 0 4 0; #X connect 7 0 4 0; #X connect 8 0 4 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasconnections-help.pd000066400000000000000000000034761277446453700267440ustar00rootroot00000000000000#N canvas 141 112 570 510 10; #X msg 38 79 outlets; #X msg 71 188 outlet \$1; #X floatatom 71 166 5 0 0 0 - - -; #X floatatom 62 121 5 0 0 0 - - -; #X msg 28 57 inlets; #X msg 62 143 inlet \$1; #X msg 108 280 inconnect \$1; #X msg 97 240 outconnect \$1; #X obj 28 429 print canvasconnnection; #X floatatom 97 220 5 0 0 0 - - -; #X floatatom 108 260 5 0 0 0 - - -; #N canvas 720 574 450 300 subpatch 0; #X obj 13 26 inlet; #X obj 64 28 inlet; #X obj 108 27 inlet; #X obj 159 29 inlet; #X obj 13 242 outlet; #X obj 72 243 outlet; #X obj 128 243 outlet; #X obj 13 110 canvasconnections; #N canvas 0 23 450 300 subsubpatch 0; #X obj 156 118 canvasconnections 1; #X obj 165 153 print canvasconnections_1; #X obj 162 80 inlet; #X connect 0 0 1 0; #X connect 2 0 0 0; #X restore 168 132 pd subsubpatch; #X connect 0 0 7 0; #X connect 1 0 8 0; #X connect 7 0 4 0; #X restore 28 348 pd subpatch; #X obj 59 397 pack f f f f f; #X text 103 347 <- there is a [canvasconnections] inside; #X obj 29 7 canvasconnections; #X text 144 7 query the connections of the containing canvas; #X text 95 66 get the number of inlets and outlets of the canvas; #X text 123 126 get objectID and and outletID of the object that is connected to the given inlet of the canvas; #X text 138 171 get objectID and and inletID of the object that is connected to the given outlet of the canvas; #X text 177 219; #X text 196 246 Those work similar \, but give the all info about the given connection.; #X text 153 395 <- dummy object; #X obj 98 314 unpack f f f f; #X text 194 311 <- dummy object; #X connect 0 0 11 0; #X connect 1 0 11 0; #X connect 2 0 1 0; #X connect 3 0 5 0; #X connect 4 0 11 0; #X connect 5 0 11 0; #X connect 6 0 11 0; #X connect 7 0 11 0; #X connect 9 0 7 0; #X connect 10 0 6 0; #X connect 11 0 8 0; #X connect 11 1 12 1; #X connect 11 2 12 3; #X connect 22 2 11 2; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasdelete-help.pd000066400000000000000000000133251277446453700256560ustar00rootroot00000000000000#N canvas 548 244 526 374 10; #X obj 45 14 canvasdelete; #N canvas 4 99 634 353 canvas 0; #N canvas 543 50 194 274 \$0.sandbox 0; #X obj 20 140 t a a; #X msg 20 110 Bitte entferne mich!; #X obj 20 80 f 20; #X restore 29 199 pd \$0.sandbox; #X obj 199 247 s pd-\$0.sandbox; #X msg 229 192 delete 1; #X text 302 193 <- click; #X text 28 287 Note:; #X text 55 306 If you happen to 'delete' on object that is involved in the deleting process \, Pd will ungracefully crash. Use with care! ; #X text 28 21 When you load(!) the canvasdelete object/library \, it will also add a 'delete' method for canvases (aka: windows) to Pd. ; #X text 27 64 This allows to remove single objects by their index. Counting starts at 0 and follows the order of creation.; #X text 30 96 Nevertheless \, let's hope that one day Pd will have a "delete" method itself...; #X msg 199 150 vis 1; #X text 247 153 <- open a patch; #X msg 384 230 reset; #X obj 384 252 s \$0.init; #X connect 2 0 1 0; #X connect 9 0 1 0; #X connect 11 0 12 0; #X restore 334 249 pd canvas messages; #X text 38 69 the canvasdelete will delete itself when it receives a "bang"; #X text 41 112 you can specify the depth of the parent patch via an optional argument; #X obj 41 145 canvasdelete 1; #X text 148 145 will delete the containing canvas (parent-depth:1) ; #N canvas 4 49 450 300 \$0.examples 0; #X msg 20 100 bang; #X obj 20 130 canvasdelete; #X text 60 100 this will only delete the [canvasdelete] object itself ; #X msg 20 200 bang; #N canvas 4 49 450 300 1003.parent-deletion 0; #X obj 20 20 inlet; #X obj 20 50 delay 1000; #X obj 20 80 canvasdelete 1; #X connect 0 0 1 0; #X connect 1 0 2 0; #X restore 20 230 pd 1003.parent-deletion; #X text 60 200 the containing [canvasdelete 1] will delete the entire subpatch after 1 second; #X msg 20 20 click here to regenerate this patch; #X obj 20 40 s 1003.init; #X connect 0 0 1 0; #X connect 3 0 4 0; #X connect 6 0 7 0; #X restore 275 213 pd \$0.examples; #X text 40 212 two examples on how to use this:; #X text 43 249 for advanced lovers of dynamic patching:; #N canvas 41 71 418 300 \$0.init 0; #N canvas 53 50 735 315 dynamic 0; #X obj 56 73 r \$0.init; #X obj 56 97 t b; #X obj 56 119 del; #X obj 88 151 loadbang; #X obj 56 171 s \$0.realinit; #X obj 502 75 receivecanvas 1; #X obj 502 97 route map vis; #X obj 502 119 route 1; #X obj 502 141 t b; #X msg 502 185 vis 0; #X obj 502 207 sendcanvas 1; #X obj 502 163 del 2000; #X text 509 54 autoclose; #X text 83 122 protect against self-deletion (might crash); #N canvas 0 50 450 300 canvas.messages 0; #X msg 29 168 clear \, obj 20 140 t a a \, msg 20 110 Bitte entferne mich! \, obj 20 80 f 20; #X obj 29 208 s pd-\$0.sandbox; #X obj 29 143 r \$0.realinit; #X connect 0 0 1 0; #X connect 2 0 0 0; #X restore 85 251 pd canvas.messages; #N canvas 0 50 450 300 examples 0; #X obj 89 254 s pd-\$0.examples; #X msg 149 214 clear; #N canvas 0 50 781 300 withmakesubpatch 0; #X obj 91 10 inlet; #X obj 88 292 outlet; #X obj 91 32 t b; #X obj 91 54 f \$0; #X obj 91 76 t f f f; #X obj 201 213 s; #X obj 201 130 t b f; #X obj 217 74 pack 0 0; #X msg 235 149 symbol pd-\$1.parent-deletion; #X msg 56 249 text 60 200 the containing [canvasdelete 1] will delete the entire subpatch after 1 second \, connect 3 0 4 0; #X msg 201 170 vis 0 \, obj 20 20 inlet \, obj 20 50 delay 1000 \, obj 20 80 canvasdelete 1 \, connect 0 0 1 0 \, connect 1 0 2 0; #X msg 199 100 msg 20 200 bang \, obj 20 230 pd \$1.parent-deletion ; #X connect 0 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 9 0; #X connect 4 1 6 0; #X connect 4 2 7 0; #X connect 6 0 10 0; #X connect 6 1 8 0; #X connect 7 0 11 0; #X connect 8 0 5 1; #X connect 9 0 1 0; #X connect 10 0 5 0; #X connect 11 0 1 0; #X restore 109 157 pd withmakesubpatch; #X obj 89 89 t b; #N canvas 0 50 450 300 nosubpatch 0; #X obj 111 19 inlet; #X obj 126 219 outlet; #X msg 21 118 msg 20 100 bang \, obj 20 130 canvasdelete \, text 60 100 this will only delete the [canvasdelete] object itself \, connect 0 0 1 0; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 129 133 pd nosubpatch; #X obj 89 109 t b b b b; #N canvas 0 50 671 300 initializer 0; #X obj 73 19 inlet; #X obj 73 252 outlet; #X obj 73 41 t b; #X obj 73 63 pack \$0 0; #X msg 73 103 msg 20 20 click here to regenerate this patch \, obj 20 40 s \$1.init \, connect 6 0 7 0; #X connect 0 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 1 0; #X restore 89 185 pd initializer; #X obj 89 69 r \$0.realinit; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 5 0; #X connect 4 0 0 0; #X connect 5 0 6 0; #X connect 5 1 2 0; #X connect 5 2 4 0; #X connect 5 3 1 0; #X connect 6 0 0 0; #X connect 7 0 3 0; #X restore 84 275 pd examples; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 4 0; #X connect 3 0 4 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 6 1 7 0; #X connect 7 0 8 0; #X connect 8 0 11 0; #X connect 9 0 10 0; #X connect 11 0 9 0; #X restore 127 138 pd dynamic patching; #X text 80 94 I'm sure you don't want to see this...; #X text 164 191 go away...; #X restore 308 395 pd \$0.init; #X text 163 14 delete ourselves (or a parent); #X text 182 397 secret init stuff; #X text 42 311 (c) 2010 IOhannes m zmoelnig \, Roman Haefeli; #X text 77 334 this is part of iemguts; #X text 48 281 shut down a top-level patch:; #N canvas 4 49 685 353 close 0; #X obj 109 285 canvasdelete 2; #X msg 109 266 bang; #X text 31 69 you can also close the top-level patch (which was opened via File->Open rather than instantiated as an abstraction).; #X msg 108 150 bang; #X obj 108 170 canvasdelete 3; #X text 229 273 parent-depth:2 is the top-level patch; #X text 217 157 parent-depth:3 does not exist (one level too above top-level patch) - so this won't do anything; #X connect 1 0 0 0; #X connect 3 0 4 0; #X restore 271 282 pd close top-level patch; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasdollarzero-help.pd000066400000000000000000000021631277446453700265670ustar00rootroot00000000000000#N canvas 251 447 635 427 10; #X obj 99 229 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 81 25 canvasdollarzero; #X text 207 25 get \$0 of the (parent) canvas; #X msg 88 128 bang; #X obj 88 148 canvasdollarzero; #X symbolatom 88 168 10 0 0 0 - - -; #X text 57 85 this object is a shameless clone of iemlib's [parentdollarzero] with an added feature.; #X text 53 194 the feature is \, that you can query the \$0 of _any_ parent canvas; #N canvas 0 0 781 383 canvasdollarzero 0; #X obj 147 72 inlet; #X text 298 167 "1" indicates to read the parent patch's (depth:1) \$0; #X msg 147 126 bang; #X symbolatom 182 188 10 0 0 0 - - -; #X obj 147 213 outlet; #X obj 147 166 canvasdollarzero 1; #X text 125 275 ok \, this example is not very splendid \, as \$0 is the same for a patch and all it's subpatches anyhow \; nevertheless \, believe me that it also works with abstractions; #X connect 0 0 2 0; #X connect 2 0 5 0; #X connect 5 0 3 0; #X connect 5 0 4 0; #X restore 99 248 pd canvasdollarzero 1; #X text 58 308 (c) 2008 IOhannes m zmoelnig \, Thomas Musil; #X connect 0 0 8 0; #X connect 3 0 4 0; #X connect 4 0 5 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvaserror-help.pd000066400000000000000000000014671277446453700255510ustar00rootroot00000000000000#N canvas 283 13 427 386 10; #X obj 209 272 canvaserror; #X obj 18 13 canvaserror; #X text 103 12 print an error to the Pd console; #X obj 62 205 route apple orange banana; #X obj 209 229 list; #X msg 209 251 '\$1' is not a fruit!; #X msg 38 148 banana; #X msg 122 145 apple; #X msg 137 173 orange; #X msg 97 116 carot; #X text 18 57 This object lets you print real error messages to the Pd console.; #X obj 62 236 bng 15 250 50 0 empty empty empty 17 7 0 10 -4034 -1 -1; #X obj 111 237 bng 15 250 50 0 empty empty empty 17 7 0 10 -260097 -1 -1; #X obj 160 238 bng 15 250 50 0 empty empty empty 17 7 0 10 -257985 -1 -1; #X connect 3 0 11 0; #X connect 3 1 12 0; #X connect 3 2 13 0; #X connect 3 3 4 0; #X connect 4 0 5 0; #X connect 5 0 0 0; #X connect 6 0 3 0; #X connect 7 0 3 0; #X connect 8 0 3 0; #X connect 9 0 3 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasindex-help.pd000066400000000000000000000032211277446453700255150ustar00rootroot00000000000000#N canvas 180 165 635 592 10; #X msg 88 118 bang; #X obj 81 25 canvasindex; #X text 207 25 get the ID/index of an abstraction/subpatch within it's containing patch; #X text 95 71 this object allows you to dynamically find out indicies to connect with dynamic patching; #N canvas 0 0 450 300 object1 0; #X obj 75 48 inlet; #X obj 75 189 outlet; #X obj 75 129 canvasindex; #X obj 324 59 inlet; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 88 168 pd object1; #X obj 88 138 t b b; #N canvas 0 0 450 300 object2 0; #X obj 75 48 inlet; #X obj 75 189 outlet; #X obj 75 129 canvasindex; #X obj 281 205 outlet; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 188 168 pd object2; #X floatatom 188 191 5 0 0 0 - - -; #X floatatom 88 192 5 0 0 0 - - -; #X text 47 547 (c) 2008 IOhannes m zmoelnig; #X obj 88 288 namecanvas \$0-canvas; #X obj 88 269 send \$0-canvas; #X msg 88 245 connect \$2 1 \$1 1; #X obj 88 222 pack; #X msg 101 378 bang; #X floatatom 101 422 5 0 0 0 - - -; #N canvas 0 0 450 300 objectcount 0; #X obj 75 48 inlet; #X obj 75 189 outlet; #X obj 75 129 canvasindex 1; #X connect 0 0 2 0; #X connect 2 1 1 0; #X restore 101 398 pd objectcount; #X text 71 347 the second outlet tells you \, how many objects the parent patch contains in total.; #X text 55 461 you can specify the depth of the parent-patch via a optional argument:; #X obj 79 496 canvasindex 2; #X text 178 494 will work on the grandparent (parent-depth:2) of this patch; #X connect 0 0 5 0; #X connect 4 0 8 0; #X connect 5 0 4 0; #X connect 5 1 6 0; #X connect 6 0 7 0; #X connect 7 0 13 1; #X connect 8 0 13 0; #X connect 12 0 11 0; #X connect 13 0 12 0; #X connect 14 0 16 0; #X connect 16 0 15 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasname-abs.pd000066400000000000000000000003351277446453700251460ustar00rootroot00000000000000#N canvas 306 54 450 300 10; #X obj 26 107 canvasname; #X obj 26 45 inlet; #X obj 26 182 outlet; #X obj 103 145 outlet; #X obj 110 65 inlet; #X connect 0 0 2 0; #X connect 0 1 3 0; #X connect 1 0 0 0; #X connect 4 0 0 1; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasname-help.pd000066400000000000000000000035601277446453700253340ustar00rootroot00000000000000#N canvas 53 49 609 519 10; #X msg 40 132 bang; #X symbolatom 29 73 10 0 0 0 - - -, f 10; #X obj 29 184 canvasname-abs; #X obj 21 14 canvasname; #X msg 29 265 bang; #X symbolatom 67 310 10 0 0 0 - - -, f 10; #X text 100 14 query and modify the name of a canvas; #X obj 29 217 print canvasname; #X text 109 69 change the name of the canvas initially named 'canvasname-abs'. When the patch is saved \, the new name for the canvas is saved with the patch. This is a good way to break patches!; #N canvas 616 405 145 217 subpatch 0; #X obj 28 25 inlet; #X obj 28 85 canvasname; #X obj 28 169 outlet; #X obj 95 122 outlet; #X symbolatom 91 46 10 0 0 0 - - -, f 10; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 1 3 0; #X connect 4 0 1 1; #X restore 29 338 pd subpatch; #X text 74 261 This even works for subpatches \, though only the 'pd' part can be modifed. This way you can have subpatches whose names start with something different than 'pd'.; #X text 140 310 1 change the name; #X text 140 328 2 save a copy of this patch; #X text 140 347 3 reopen the copy to inspect the modification; #X text 30 415 NOTE:; #X text 76 132 <- get the current canvas name; #X text 30 432 To change the arguments of an abstraction \, use [canvasargs]. ; #X obj 29 364 print pd-subpatch; #X obj 159 217 print canvas-displayname; #X obj 159 364 print pd-displayname; #X text 173 173 the 2nd outlet gives the name as displayed in the window-title. ; #X text 270 152 sets the displayed name (does not get saved); #X msg 175 152 symbol muff; #X text 30 455 NOTE:; #X text 30 472 Changing the displayed name (2nd inlet) will only update the window-title when the window is re-created. Also this is purely cosmetic (and won't get saved!); #X connect 0 0 2 0; #X connect 1 0 2 0; #X connect 2 0 7 0; #X connect 2 1 18 0; #X connect 4 0 9 0; #X connect 5 0 9 0; #X connect 9 0 17 0; #X connect 9 1 19 0; #X connect 22 0 2 1; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasobjectposition-help.pd000066400000000000000000000034361277446453700274510ustar00rootroot00000000000000#N canvas 424 144 674 662 10; #X text 48 441 you can specify the depth of the parent-patch via a optional argument:; #X text 219 473 will work on the grandparent (parent-depth:2) of this patch; #X msg 98 124 bang; #X obj 98 172 unpack; #X floatatom 137 194 5 0 0 0 - - -; #X floatatom 98 194 5 0 0 0 - - -; #N canvas 0 0 648 414 getpos 0; #X obj 75 48 inlet; #X obj 75 189 outlet; #X obj 75 129 canvasobjectposition 1 18; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 98 148 pd getpos; #N canvas 0 0 450 300 setpos 0; #X obj 75 48 inlet; #X obj 167 63 loadbang; #X msg 167 84 350 200; #X obj 75 129 canvasobjectposition 1 18; #X connect 0 0 3 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X restore 108 332 pd setpos; #X obj 111 290 hsl 128 15 300 400 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 300 1; #X text 60 631 (c) 2009 IOhannes m zmoelnig; #X obj 48 28 canvasobjectposition; #X text 207 25 get/set the position of an arbitrary object in the specified (parent) canvas.; #X text 217 143 you can move this object and click "bang" again; #X text 363 164 |; #X text 364 176 V; #X obj 350 200 blabla; #X msg 108 310 \$1 200; #X text 50 534 you can specify the object to set/query via a 2nd optional argument \, or via the 2nd inlet; #X obj 52 475 canvasobjectposition 2; #X obj 53 595 canvasobjectposition 0 18; #X text 240 594 will work on object #18 in this patch; #X msg 53 573 350 210; #X msg 225 570 18; #X text 39 88 this object allows you to retrieve the position of any object (with a known index) within it's containing canvas; #X text 54 260 you can move an object around (without any hackish mouse emulation); #X text 53 394 arguments:; #X connect 2 0 6 0; #X connect 3 0 5 0; #X connect 3 1 4 0; #X connect 6 0 3 0; #X connect 8 0 16 0; #X connect 16 0 7 0; #X connect 21 0 19 0; #X connect 22 0 19 1; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasposition-help.pd000066400000000000000000000036711277446453700262630ustar00rootroot00000000000000#N canvas 1388 107 635 592 10; #X text 47 547 (c) 2008 IOhannes m zmoelnig; #X text 55 471 you can specify the depth of the parent-patch via a optional argument:; #X text 178 504 will work on the grandparent (parent-depth:2) of this patch; #X text 207 25 get/set the position of the containing patch within it's parent; #X text 39 88 this object allows you to retrieve the position of an abstraction/subpatch within it's containing canvas; #X msg 98 124 bang; #X obj 98 172 unpack; #X floatatom 137 194 5 0 0 0 - - -; #X floatatom 98 194 5 0 0 0 - - -; #X text 178 145 <--- you can move this object and click "bang" again ; #X msg 88 253 bang; #X obj 88 292 unpack; #X floatatom 127 314 5 0 0 0 - - -; #X floatatom 88 314 5 0 0 0 - - -; #X text 168 269 <--- you can move this object and click "bang" again ; #X text 39 218 you can also query the size of the containing canvas via the 2nd outlet; #N canvas 0 0 450 300 getsize 0; #X obj 75 48 inlet; #X obj 75 189 outlet; #X obj 75 129 canvasposition; #X connect 0 0 2 0; #X connect 2 1 1 0; #X restore 88 272 pd getsize; #N canvas 0 0 450 300 getpos 0; #X obj 75 48 inlet; #X obj 75 189 outlet; #X obj 75 129 canvasposition; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 98 148 pd getpos; #X text 69 333 note: there is a bug in Pd that might require you to save a patch \, before the "size" will actually change; #N canvas 0 0 450 300 setpos 0; #X obj 75 48 inlet; #X obj 75 129 canvasposition; #X connect 0 0 1 0; #X restore 100 440 pd setpos; #X obj 103 398 hsl 128 15 100 400 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X obj 52 505 canvasposition 2; #X text 46 368 finally you can move an object around (without any hackish mouse emulation); #X msg 100 418 \$1 440; #X obj 81 25 canvasposition; #X connect 5 0 17 0; #X connect 6 0 8 0; #X connect 6 1 7 0; #X connect 10 0 16 0; #X connect 11 0 13 0; #X connect 11 1 12 0; #X connect 16 0 11 0; #X connect 17 0 6 0; #X connect 20 0 23 0; #X connect 23 0 19 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/canvasselect-help.pd000066400000000000000000000026751277446453700257010ustar00rootroot00000000000000#N canvas 54 15 492 397 10; #X obj 43 292 canvasselect 0; #X msg 43 107 select \$1; #X floatatom 43 84 5 0 0 0 - - -; #N canvas 0 0 326 235 subpatch 0; #X msg 63 113 select \$1; #X obj 63 27 inlet; #X obj 63 157 canvasselect 1; #X obj 149 26 inlet; #X msg 149 112 deselect \$1; #X msg 63 69 3 \, 4 \, 16 \, 21; #X msg 149 68 3 \, 4 \, 16 \, 21; #X connect 0 0 2 0; #X connect 1 0 5 0; #X connect 3 0 6 0; #X connect 4 0 2 0; #X connect 5 0 0 0; #X connect 6 0 4 0; #X restore 248 316 pd subpatch; #X obj 248 272 bng 15 250 50 0 empty empty select 17 7 0 10 -262144 -1 -1; #X floatatom 62 137 5 0 0 0 - - -; #X msg 108 188 select; #X msg 62 160 deselect \$1; #X obj 10 7 canvasselect; #X text 96 3 selects/deselects an object in the canvas. It also gives a list of the currently selected objects in the canvas.; #X obj 82 246 loadbang; #X obj 82 268 metro 500; #X obj 43 320 list prepend set; #X obj 43 343 list trim; #X msg 43 365; #X obj 311 296 bng 15 250 50 0 empty empty deselect 17 7 0 10 -262144 -1 -1; #X msg 120 212 deselect; #X text 94 43 The first argument specifies the parent depth.; #X text 174 190 <- select all; #X text 176 211 <- deselect all; #X text 324 314 <- have a look inside; #X connect 0 0 12 0; #X connect 1 0 0 0; #X connect 2 0 1 0; #X connect 4 0 3 0; #X connect 5 0 7 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 10 0 11 0; #X connect 11 0 0 0; #X connect 12 0 13 0; #X connect 13 0 14 0; #X connect 15 0 3 1; #X connect 16 0 0 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/classtest-help.pd000066400000000000000000000022051277446453700252200ustar00rootroot00000000000000#N canvas 0 0 957 437 10; #X obj 90 56 classtest; #X text 167 55 check the availability of object-classes; #X obj 154 292 classtest; #X floatatom 154 318 5 0 0 0 - - -; #X text 233 313 1..class exists; #X text 233 328 0..class does not exist; #X obj 154 226 symbol; #X msg 154 106 f; #X text 197 107 check for [f] (should always evaluate to 'true'); #X msg 170 138 niagara; #X text 239 164 check for [qwert]; #X msg 184 167 qwert; #X text 70 364 note: "classes" are object that Pd knows about (internals \, or externals (with a classloader)). Currently "abstractions" are _not_ treated as full-featured classes \, therefore testing for abstractions will result in 'false'.; #X msg 188 203 classloader-help; #X symbolatom 154 259 0 0 0 0 - - -; #X text 374 165 (probably this will always evaluate as 'false'); #X text 226 139 check for [niagara] (evaluates to 'true' if zexy is loaded); #X text 317 202 check for this abstraction (evaluates as 'false'!) ; #X text 558 292 (c)opyleft 2008 IOhannes m zmölnig @ iem; #X connect 2 0 3 0; #X connect 6 0 14 0; #X connect 7 0 6 0; #X connect 9 0 6 0; #X connect 11 0 6 0; #X connect 13 0 6 0; #X connect 14 0 2 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/closebang-help.pd000066400000000000000000000005761277446453700251610ustar00rootroot00000000000000#N canvas 612 413 505 298 10; #X obj 28 38 closebang; #X text 108 39 emits a bang when an abstraction is deleted.; #X text 41 126 [closebang] notifies you when an abstraction is about to be deleted \, so you can:; #X text 52 162 - cleanup ressources; #X text 52 177 - keep track of instances (PUSH); #X text 52 193 - say goodbye; #X text 24 240 note: [closebang] requires Pd>=0.47; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/findbrokenobjects-help.pd000066400000000000000000000040071277446453700267100ustar00rootroot00000000000000#N canvas 255 179 867 556 10; #X obj 57 19 findbrokenobjects; #X obj 59 494 /dev/device; #X obj 170 493 color 1; #X text 202 18 finds broken objects; #N canvas 321 143 706 395 subpatch 0; #X msg 37 129 bang; #X msg 309 129 bang; #X obj 309 153 findbrokenobjects 0; #X obj 37 153 findbrokenobjects; #X text 33 73 without args \, it finds ALL broken objects in the running Pd-instance, f 23; #X msg 511 129 bang; #X obj 511 153 findbrokenobjects 1; #X text 507 56 an argument specifies the search root. '1' will search the parent canvas and its children, f 23; #X text 304 56 an argument specifies the search root. '0' will only search in this canvas and its children, f 23; #X obj 375 289 /////////////; #X text 201 290 another unknown object:; #X obj 511 175 print borked-in-parent; #X obj 309 175 print borked-here; #X obj 37 175 print all; #X connect 0 0 3 0; #X connect 1 0 2 0; #X connect 2 0 12 0; #X connect 3 0 13 0; #X connect 5 0 6 0; #X connect 6 0 11 0; #X restore 102 292 pd subpatch; #X text 33 254 if you don't give an argument \, the entire Pd-instance is searched., f 66; #X msg 44 353 verbose 1 \, bang; #X obj 44 375 findbrokenobjects; #X text 31 205 arguments: you can pass a number (int>=0) as argument to [findbrokenobjects] to limit the search to a given root-canvas and it's children. '0' is the canvas the [findbrokenobjects] object lives in \, '1' is it's parent-canvas and so on., f 80; #X text 198 293 <- open to see rooted-search in action; #X text 245 493 <- a few broken objects...; #X text 185 363 when "verbose" is turned on \, the objects are also printed to the console where you can - them; #X msg 54 67 bang; #X obj 54 133 print not-found; #X obj 54 111 route not-found not-created; #X text 180 129 objects that are broken because Pd doesn't know how to create them; #X obj 147 167 print not-created; #X text 281 165 objects that failed to create for other reasons; #X obj 54 89 findbrokenobjects; #X connect 6 0 7 0; #X connect 12 0 18 0; #X connect 14 0 13 0; #X connect 14 1 16 0; #X connect 18 0 14 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/ib_demux.pd000066400000000000000000000075431277446453700240730ustar00rootroot00000000000000#N canvas 299 382 555 300 10; #X obj 182 96 inlet; #X obj 303 96 inlet index; #X obj 182 126 send; #X obj 231 96 initbang; #N canvas 635 253 727 361 guts 0; #X obj 66 309 sendcanvas 1; #N canvas 852 153 450 491 cleanup 0; #X obj 113 166 inlet; #X obj 113 187 canvasindex 1; #X obj 201 231 t f b; #X obj 201 253 until; #X obj 123 435 canvasdelete; #X msg 201 351 delete \$1; #X obj 201 373 outlet; #X obj 244 184 r \$0-skipobjects; #X obj 201 286 i 5; #X obj 244 206 t f f; #X obj 201 209 - 5; #X text 15 62 this uses [canvasindex] to get the number of objects in the grandparent-patch (the first-level patch of [ib_demux]).; #X text 32 24 cleanup unwanted objects.; #X text 15 95 \$0-skipobjects is the number (N) of objects that should be kept (the fixed objects are created first \, so they occupy the IDs 0..N. everything after N is a dynamically created object which we want to remove \, so we can create anew).; #X connect 0 0 1 0; #X connect 1 1 10 0; #X connect 2 0 3 0; #X connect 3 0 8 0; #X connect 5 0 6 0; #X connect 7 0 9 0; #X connect 8 0 5 0; #X connect 9 0 10 1; #X connect 9 1 8 1; #X connect 10 0 2 0; #X restore 183 241 pd cleanup; #X msg 164 95 bang; #N canvas 568 189 677 449 creator 0; #X obj 63 89 inlet; #X obj 62 379 outlet; #X obj 179 231 r \$0-skipobjects; #X obj 87 280 + 50; #X obj 142 254 +; #X obj 142 276 t f f; #X obj 174 299 + 1; #X obj 63 111 t f b; #X obj 63 133 until; #X obj 63 155 i; #X obj 63 177 t f f; #X obj 94 154 + 1; #X msg 108 135 0; #X obj 142 231 * 2; #X obj 62 203 t f f f b; #X obj 87 258 * 70; #X msg 62 357 obj \$2 200 r \$5-\$1 \, obj \$2 230 outlet #\$1 \, connect \$3 0 \$4 0; #X obj 62 319 pack 0 0 0 0 \$0; #X text 63 20 this creates N output structures (a [send \$0-#] and an [outlet] object which are connected).; #X text 70 50 for connecting them up \, we need to know their patch-IDs \, which we can calculate if we know the number of (fixed) objects in the patch (given via \$0-skipobjects); #X text 274 266 #1: index; #X text 274 281 #2: x-position; #X text 274 296 #3: canvas-ID of [send]; #X text 274 311 #4: canvas-ID of [outlet]; #X text 274 326 #5: \$0 (pre-expanded); #X connect 0 0 7 0; #X connect 2 0 4 1; #X connect 3 0 17 1; #X connect 4 0 5 0; #X connect 5 0 17 2; #X connect 5 1 6 0; #X connect 6 0 17 3; #X connect 7 0 8 0; #X connect 7 1 12 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 10 0 14 0; #X connect 10 1 11 0; #X connect 11 0 9 1; #X connect 12 0 9 1; #X connect 13 0 4 0; #X connect 14 0 17 0; #X connect 14 1 15 0; #X connect 14 2 13 0; #X connect 15 0 3 0; #X connect 16 0 1 0; #X connect 17 0 16 0; #X restore 66 244 pd creator; #X obj 66 141 i \$1; #X obj 66 207 t f; #X msg 66 185 2; #X obj 67 163 moses 1; #X obj 66 97 inlet; #X obj 520 209 max 0; #X obj 520 231 pack 0 \$0; #X msg 520 253 symbol \$2-\$1; #X obj 520 275 outlet; #X obj 520 155 inlet; #X obj 66 279 t a a; #X obj 301 190 s \$0-skipobjects; #X obj 66 119 t b b b b; #X obj 520 187 i \$2; #X msg 183 220 bang; #X msg 301 168 7; #X text 100 40 [pd cleanup] removes unwanted objects; #X text 101 57 [pd creator] creates a number of send/outlet pairs and connects them.; #X text 59 17 here's the fun part:; #X connect 1 0 14 0; #X connect 2 0 16 0; #X connect 3 0 14 0; #X connect 4 0 7 0; #X connect 5 0 3 0; #X connect 6 0 5 0; #X connect 7 0 6 0; #X connect 7 1 5 0; #X connect 8 0 16 0; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 0 12 0; #X connect 13 0 17 0; #X connect 14 0 0 0; #X connect 16 0 4 0; #X connect 16 1 18 0; #X connect 16 2 19 0; #X connect 16 3 17 0; #X connect 17 0 9 0; #X connect 18 0 1 0; #X connect 19 0 15 0; #X restore 231 126 pd guts; #X text 85 165 vv- below this line \, everything is created dynamically -vv; #X text 38 30 [ib_demux] is an abstraction implementation of a demultiplexer \, it uses [initbang] to create a dynamic number of outlets.; #X connect 0 0 2 0; #X connect 1 0 4 1; #X connect 3 0 4 0; #X connect 4 0 2 1; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/initbang-help.pd000066400000000000000000000025731277446453700250160ustar00rootroot00000000000000#N canvas 541 256 656 407 10; #X obj 24 47 initbang; #X text 100 41 emits a bang right after the abstraction got loaded (and *before* the parent patch continues to load); #X floatatom 64 206 5 0 0 0 - - -, f 5; #X obj 124 207 hradio 15 1 0 2 empty empty empty 0 -8 0 10 -262144 -1 -1 1; #X obj 403 199 hradio 15 1 0 4 empty empty empty 0 -8 0 10 -262144 -1 -1 0; #X obj 308 277 print B1; #X obj 308 299 print B2; #X obj 373 277 print B3; #X obj 373 299 print B4; #X floatatom 64 263 5 0 0 0 - - -, f 5; #X floatatom 124 263 5 0 0 0 - - -, f 5; #X text 59 327 note: [initbang] will *not* trigger in [subpatches] ; #X text 76 88 this makes it possible to create abstractions with variable iolets (something that is not possible with [loadbang]).; #X obj 308 225 ib_demux 4 1; #X obj 64 241 ib_demux 2; #X floatatom 308 177 5 0 0 0 - - -, f 5; #X msg 308 199 foo bar \$1; #X text 40 134 [ib_demux] is an abstraction. the number of outlets is given as the 1st argument! (2nd argument is the initially selected outlet); #X text 59 348 note2: if you are running an older version of Pd \, the [ib_demux] objects might not have outlets due to [initbang] not working properly.; #X connect 2 0 14 0; #X connect 3 0 14 1; #X connect 4 0 13 1; #X connect 13 0 5 0; #X connect 13 1 6 0; #X connect 13 2 7 0; #X connect 13 3 8 0; #X connect 14 0 9 0; #X connect 14 1 10 0; #X connect 15 0 16 0; #X connect 16 0 13 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/oreceive-help.pd000066400000000000000000000023631277446453700250210ustar00rootroot00000000000000#N canvas 114 45 505 423 10; #X obj 28 355 oreceive bla 0; #X obj 28 381 print first; #X obj 228 355 oreceive bla 2; #X obj 128 381 print second; #X obj 228 381 print last; #X obj 56 230 send bla; #X symbolatom 77 172 10 0 0 0 - - -; #X msg 87 195 one two three four; #X floatatom 39 185 5 0 0 0 - - -; #X obj 128 355 oreceive bla 1; #X floatatom 209 323 5 0 0 0 - - -; #X symbolatom 291 170 10 0 0 0 - - -; #X msg 306 199 one two three four; #X floatatom 253 183 5 0 0 0 - - -; #X obj 272 229 send blu; #X msg 28 296 symbol blu; #X msg 56 316 symbol bla; #X obj 32 13 oreceive; #X text 87 13 an ordered receive object; #X text 245 324 change order; #X text 103 295 set receive symbol; #X text 30 106 This object behaves similar to the common [receive] class \, but uses a second argument to define a priority.; #X text 28 47 The big disadvantage of using [send]/[receive] pairs over a direct connection together with [trigger] is that there is no way to define an order \, if several [receice]s belong to a [send]. ; #X connect 0 0 1 0; #X connect 2 0 4 0; #X connect 6 0 5 0; #X connect 7 0 5 0; #X connect 8 0 5 0; #X connect 9 0 3 0; #X connect 10 0 9 1; #X connect 11 0 14 0; #X connect 12 0 14 0; #X connect 13 0 14 0; #X connect 15 0 0 0; #X connect 16 0 0 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/propertybang-help.pd000066400000000000000000000016611277446453700257340ustar00rootroot00000000000000#N canvas 233 253 645 300 10; #X obj 90 43 propertybang; #N canvas 0 0 450 300 with 0; #X obj 110 126 propertybang; #X obj 110 146 t b b; #X obj 135 166 print property; #X obj 110 200 outlet; #X connect 0 0 1 0; #X connect 1 0 3 0; #X connect 1 1 2 0; #X restore 86 172 pd with propertybang; #X obj 86 196 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 184 44 enables the "property" menu for abstractions; #X text 90 77 usage:; #X text 140 77 put a [propertybang] object into your abstraction; #X text 139 94 put your abstraction into your patch; #X text 61 224 note: the [propertybang] is PER ABSTRACTION! having multiple [propertybang]s within one abstraction \, will trigger them all at the same time.; #X text 127 114 --> the [propertybang] will send out a bang \, everytime you right-clock on your abstraction instance and select "Properties" ; #X text 369 275 (c) IOhannes m zmoelnig @ iem \, 2010; #X connect 1 0 2 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/receivecanvas-help.pd000066400000000000000000000012061277446453700260310ustar00rootroot00000000000000#N canvas 33 0 430 262 10; #N canvas 386 115 340 151 subpatch 0; #N canvas 450 70 152 94 subsubpatch 0; #X obj 2 10 receivecanvas 1; #X obj 2 37 print pd-subpatch; #X connect 0 0 1 0; #X restore 52 90 pd subsubpatch; #X text 48 33 The first argument sets the parent depth.; #X text 51 49 Have a look at the subsubpatch.; #X restore 26 206 pd subpatch; #X obj 25 104 receivecanvas 0; #X obj 25 129 print receivecanvas-help.pd; #X obj 23 16 receivecanvas; #X text 111 16 receives all messages sent to the canvas; #X text 21 66 depth 0 receives from the canvas containing the [receivecanvas] object.; #X text 25 181 Check also:; #X connect 1 0 2 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/savebangs-help.pd000066400000000000000000000013241277446453700251650ustar00rootroot00000000000000#N canvas 0 0 459 321 10; #X text 83 15 sends a bang \, whenever the containing patch is saved ; #X obj 18 153 bng 30 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 18 15 savebangs; #X obj 18 124 savebangs; #X text 17 55 This works also inside abstractions when saving the parent patch by providing the parent depth as an argument.; #X obj 15 212 savebangs 1; #X obj 15 236 bng 30 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 13 192 This would send a bang when the parent patch is be saved: ; #X text 14 91 This sends a bang when the current patch containing [savebangs] is saved:; #X text 18 288 the 2nd outlet triggers BEFORE the actual patch is saved. ; #X connect 3 0 1 0; #X connect 5 0 6 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/sendcanvas-help.pd000066400000000000000000000017771277446453700253550ustar00rootroot00000000000000#N canvas 251 447 635 427 10; #X obj 81 25 sendcanvas; #X text 168 27 send messages to a (parent) canvas; #X obj 88 151 sendcanvas; #X msg 88 130 obj 300 150 f; #X text 57 85 this object will send messages to a canvas \; by default it will send a message to the canvas containing it:; #X text 53 194 but you can also send to a message to a parent-canvas (of any depth); #N canvas 0 0 781 310 sendcanvas 0; #X obj 147 72 inlet; #X obj 147 166 sendcanvas 1; #X msg 147 126 obj 300 250 print; #X text 252 170 "1" means that the message is sent to the parent-patch (depth:1); #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 99 248 pd sendcanvas; #X obj 99 229 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 80 306 you can basically achieve this functionality with [namecanvas] and an ordinary [send] \; so this object is merely convenient as you can dynamify a canvas without prior thought to it; #X text 58 295 note:; #X text 72 390 (c) 2008 IOhannes m zmoelnig; #X connect 3 0 2 0; #X connect 7 0 6 0; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/help/try-help.pd000066400000000000000000000011251277446453700240310ustar00rootroot00000000000000#N canvas 0 0 450 300 10; #X obj 13 15 try this or \, that or \, f; #X obj 16 174 try sin~ \, cos~; #X text 11 81 This object provides a way to create an object with a fallback. [try bla 13 \, blu 134] will first try to create an obect [bla 13] and if this fails use [blu 134] instead.; #X text 15 34 create an object with a fallback to a different object class; #X text 14 141 You can open the help of this in order to see \, which object - [sin~] or [cos~] - was finally instantiated.; #X text 15 219 NOTE:; #X text 14 236 This does not (yet) work with abstractions \, but only with externals.; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/iemguts-meta.pd000066400000000000000000000002731277446453700237410ustar00rootroot00000000000000#N canvas 15 49 200 200 10; #N canvas 25 49 420 300 META 1; #X text 13 41 NAME iemguts; #X text 10 25 AUTHOR forum::für::umläute; #X text 10 10 VERSION 0.2.1; #X restore 10 10 pd META; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/000077500000000000000000000000001277446453700216005ustar00rootroot00000000000000iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/Makefile000066400000000000000000000000211277446453700232310ustar00rootroot00000000000000all: make -C .. iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/autoabstraction.c000066400000000000000000000116411277446453700251510ustar00rootroot00000000000000/* Copyright (c) 2008 IOhannes m zmölnig @ IEM * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," that comes with Pd. ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this code adds an external "loader" to Miller S. Puckette's "pure data", * which allows the on-the-fly creation of abstractions by just creating an * object which is of a yet unknown file and for which no abstraction-file exists * * the new abstraction should be minimal and eventually be loaded from a template * * possible default abstraction: '#N canvas 0 0 450 300 10; #X vis 1;' * * TODO: currently the template-abstraction is only initialized once. * this means that we cannot change the template after loading of "autoabstraction" * - FIX(LATER): add a "reload"-message to the [autoabstraction] object * - FIX(ALT): check whether the template-file has changed and reload it */ #ifdef __WIN32__ # define MSW #endif #include "iemguts.h" typedef struct _autoabstraction { t_object x_obj; } t_autoabstraction; static t_class *autoabstraction_class; static int s_state=0; /* this is the name of the filename that get's loaded as a default template for new abstractions */ static char*s_templatefilename="autoabstraction.template"; /* if the loading above fails, we resort to a simple default abstraction that automatically opens up */ /* LATER: make the font-size the same as the one used by Pd */ static char*s_templatestring="#N canvas 0 0 450 300 10; #X vis 1;"; #if (PD_MINOR_VERSION >= 40) # define AUTOABSTRACTION_ENABLED 1 #endif #ifdef AUTOABSTRACTION_ENABLED # include "s_stuff.h" # include "g_canvas.h" # include # include # include # ifdef UNISTD # include # include # endif # ifdef _WIN32 # include # include # endif #if (PD_MINOR_VERSION < 42) /* definitions taken from s_loader.c, since they weren't in header orignally */ typedef int (*loader_t)(t_canvas *canvas, char *classname); void sys_register_loader(loader_t loader); void class_set_extern_dir(t_symbol *s); #endif static t_binbuf*s_bb=0; static void autoabstraction_createpatch(t_canvas*canvas, char*classname) { if(!s_state) { /* autoabstraction turned off... */ return; } if(s_bb) { char name[MAXPDSTRING]; snprintf(name, MAXPDSTRING, "%s.pd", classname); binbuf_write(s_bb, name, "", 0); } else { verbose(1, "[autoabstraction]: no template"); } } /** * the loader * * @param canvas the context of the object to be created * @param classname the name of the object (external, library) to be created * @return 1 on success, 0 on failure */ static int autoabstraction_loader(t_canvas *canvas, char *classname) { /* check whether there is an abstraction with the given within the scope of */ int fd=0; char dirbuf[MAXPDSTRING], *nameptr; if((fd=canvas_open(canvas, classname, ".pd", dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) { /* oops, there's already an abstraction of the given */ close(fd); return(0); } /* none! we create one, so Pd can later find it... */ autoabstraction_createpatch(canvas, classname); /* we always fail, because we want Pd to do the real opening of abstractions */ return 0; } static void autoabstraction_initialize(void) { if(s_bb) binbuf_free(s_bb); s_bb=binbuf_new(); /* try to read a template file */ if(binbuf_read(s_bb, s_templatefilename, "", 0)) { /* if this fails, use the default template */ size_t length=strlen(s_templatestring); binbuf_text(s_bb, s_templatestring, length); } s_state=1; } #endif /* AUTOABSTRACTION_ENABLED */ static void autoabstraction_state(t_autoabstraction*x, t_floatarg f) { int state=(int)(f>=1.0); s_state=state; } static void*autoabstraction_new(t_symbol *s, int argc, t_atom *argv) { t_autoabstraction*x = (t_autoabstraction*)pd_new(autoabstraction_class); if(argc&&A_SYMBOL==argv->a_type) { s_templatefilename=atom_getsymbol(argv)->s_name; } #ifdef AUTOABSTRACTION_ENABLED autoabstraction_initialize(); #endif /* AUTOABSTRACTION_ENABLED */ return (x); } void autoabstraction_setup(void) { /* relies on t.grill's loader functionality, fully added in 0.40 */ iemguts_boilerplate("automatic abstraction creator", 0); #ifdef AUTOABSTRACTION_ENABLED autoabstraction_initialize(); sys_register_loader(autoabstraction_loader); #warning FIXME loader-0.47 mode! #else error("autoabstraction needs to be compiled against Pd 0.40 or higher,\n"); error("\tor a version that has sys_register_loader()"); #endif autoabstraction_class = class_new(gensym("autoabstraction"), (t_newmethod)autoabstraction_new, 0, sizeof(t_autoabstraction), 0, A_GIMME, 0); class_addfloat(autoabstraction_class, (t_method)autoabstraction_state); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasargs.c000066400000000000000000000062161277446453700241010ustar00rootroot00000000000000/****************************************************** * * canvasargs - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to manipulate the parent-patches arguments (and name!) * usage: * + put this object into an abstraction * + put the abstraction in a patch * + send the object a _list_ of arguments * + the next time the patch (wherein the abstraction that holds this object lives) * is saved, it will be saved with the new arguments instead of the old ones! * - example: "list 2 3 4" will save the object as [ 2 3 4] * + you can also change the abstraction name itself by using a selector other than "list" * - example: "bonkers 8 9" will save the object as [bonkers 8 9] regardless of it's original name * - use with care! * * nice, eh? */ #include "iemguts.h" #include "g_canvas.h" /* ------------------------- canvasargs ---------------------------- */ static t_class *canvasargs_class; typedef struct _canvasargs { t_object x_obj; t_canvas *x_canvas; } t_canvasargs; static void canvasargs_list(t_canvasargs *x, t_symbol*s, int argc, t_atom*argv) { t_binbuf*b=0; t_atom name[1]; if(!x || !x->x_canvas) return; b=x->x_canvas->gl_obj.te_binbuf; if(!b)return; /* if this method is called with a non-special selector, we *rename* the object */ if(s==0 || s==gensym("") || s==&s_list || s==&s_bang || s==&s_float || s==&s_symbol || s==&s_) { /* keep the given name */ t_atom*ap=binbuf_getvec(b); s=atom_getsymbol(ap); } SETSYMBOL(name, s); binbuf_clear(b); binbuf_add(b, 1, name); binbuf_add(b, argc, argv); } static void canvasargs_bang(t_canvasargs *x) { int argc=0; t_atom*argv=0; t_binbuf*b=0; if(!x->x_canvas) return; b=x->x_canvas->gl_obj.te_binbuf; if(b) { argc=binbuf_getnatom(b)-1; argv=binbuf_getvec(b)+1; } else { canvas_setcurrent(x->x_canvas); canvas_getargs(&argc, &argv); canvas_unsetcurrent(x->x_canvas); } if(argv) outlet_list(x->x_obj.ob_outlet, &s_list, argc, argv); } static void canvasargs_free(t_canvasargs *x) { x->x_canvas = 0; } static void *canvasargs_new(t_floatarg f) { t_canvasargs *x = (t_canvasargs *)pd_new(canvasargs_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_canvas = canvas; outlet_new(&x->x_obj, 0); return (x); } void canvasargs_setup(void) { iemguts_boilerplate("[canvasargs]", 0); canvasargs_class = class_new(gensym("canvasargs"), (t_newmethod)canvasargs_new, (t_method)canvasargs_free, sizeof(t_canvasargs), 0, A_DEFFLOAT, 0); class_addlist(canvasargs_class, (t_method)canvasargs_list); class_addbang(canvasargs_class, (t_method)canvasargs_bang); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasconnections.c000066400000000000000000000313021277446453700254610ustar00rootroot00000000000000 /****************************************************** * * canvasconnections - implementation file * * copyleft (c) IOhannes m zmölnig * * 2008:forum::für::umläute:2008 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to send messages to query the connections * of the containing canvas; * but you can give the "depth" as argument; * e.g. [canvasconnections 1] will query the parent of the containing canvas */ #include "iemguts.h" #include "g_canvas.h" #include "m_imp.h" #include int glist_getindex(t_glist *x, t_gobj *y); /* ------------------------- canvasconnections ---------------------------- */ static t_class *canvasconnections_class; typedef struct _canvasconnections { t_object x_obj; t_canvas *x_parent; t_object *x_object; t_outlet *x_out; } t_canvasconnections; typedef struct _intvec { int num_elements; /* number of valid elements in the 'elements' vector */ int*elements; /* elements */ int size; /* private: the full length of the 'elements' vector */ } t_intvec; static t_intvec*intvec_new(int initial_size) { t_intvec*res=getbytes(sizeof(*res)); if(initial_size<1) initial_size=32; res->num_elements=0; res->size=initial_size; res->elements=getbytes(res->size*sizeof(*res->elements)); return res; } static void intvec_free(t_intvec*vec) { if(NULL==vec)return; if(vec->elements) freebytes(vec->elements, vec->size * sizeof(*vec->elements)); vec->elements=NULL; vec->size=0; vec->num_elements=0; freebytes(vec, sizeof(*vec)); } static t_intvec*intvec_add(t_intvec*vec, int element) { /* ensure that vector is big enough */ if(vec->size<=vec->num_elements) { /* resize! */ t_intvec*vec2=intvec_new(2*vec->num_elements); memcpy(vec2->elements, vec->elements, vec->size); vec2->num_elements=vec->size; intvec_free(vec); vec=vec2; } /* add the new element to the end of the vector */ vec->elements[vec->num_elements]=element; vec->num_elements++; return vec; } /* just for debugging... */ static void intvec_post(t_intvec*vec) { int i=0; post("vec: 0x%X :: 0x%X holds %d/%d elements", vec, vec->elements, vec->num_elements, vec->size); startpost("elements:"); for(i=0; inum_elements; i++) { startpost(" %02d", vec->elements[i]); } endpost(); } static int query_inletconnections(t_canvasconnections *x, t_intvec***outobj, t_intvec***outwhich) { int i=0; t_intvec**invecs=NULL; t_intvec**inwhich=NULL; int ninlets=0; t_gobj*y; if(0==x->x_object || 0==x->x_parent) return 0; ninlets=obj_ninlets(x->x_object); // TODO....find objects connecting TO this object /* as Pd does not have any information about connections to inlets, * we have to find out ourselves * this is done by traversing all objects in the canvas and try * to find out, whether they are connected to us! */ invecs =getbytes(ninlets*sizeof(*invecs)); inwhich=getbytes(ninlets*sizeof(*inwhich)); for(i=0; ix_parent->gl_list; y; y = y->g_next) /* traverse all objects in canvas */ { t_object*obj=(t_object*)y; int obj_nout=obj_noutlets(obj); int nout=0; int sourcewhich=0; for(nout=0; noutx_object) { // connected to us! int connid = glist_getindex(x->x_parent, (t_gobj*)obj); // post("inlet from %d:%d to my:%d", connid, sourcewhich, which); /* add it to the inletconnectionlist */ intvec_add(invecs[which], connid); intvec_add(inwhich[which], sourcewhich); } } sourcewhich++; } } if(outobj)*outobj=invecs; if(outwhich)*outwhich=inwhich; // return invecs; return ninlets; } static void canvasconnections_queryinlets(t_canvasconnections *x) { t_atom at; t_intvec**invecs=0; int ninlets=query_inletconnections(x, &invecs, 0); int i; // t_intvec**invecs=query_inletconnections(x, &ninlets); SETFLOAT(&at, (t_float)ninlets); outlet_anything(x->x_out, gensym("inlets"), 1, &at); for(i=0; inum_elements; if(size>0) { t_atom*ap=getbytes((size+1)*sizeof(*ap)); int j=0; t_symbol*s=gensym("inlet"); SETFLOAT(ap, (t_float)i); for(j=0; jelements[j])); outlet_anything(x->x_out, s, size+1, ap); freebytes(ap, (size+1) * sizeof(*ap)); } intvec_free(invecs[i]); } if(invecs)freebytes(invecs, ninlets * sizeof(*invecs)); } static void canvasconnections_inlet(t_canvasconnections *x, t_floatarg f) { int inlet=f; t_intvec**invecs=0; int ninlets=query_inletconnections(x, &invecs, 0); if(inlet >= 0 && inlet < ninlets) { int size=invecs[inlet]->num_elements; t_atom*ap=getbytes((size+1)*sizeof(*ap)); t_symbol*s=gensym("inlet"); if(obj_issignalinlet(x->x_object,inlet)) { s=gensym("inlet~"); } SETFLOAT(ap, (t_float)inlet); if(size>0) { int j=0; for(j=0; jelements[j])); } outlet_anything(x->x_out, s, size+1, ap); freebytes(ap, (size+1) * sizeof(*ap)); intvec_free(invecs[inlet]); } if(invecs)freebytes(invecs, ninlets * sizeof(*invecs)); } static int canvasconnections_inlets(t_canvasconnections *x) { t_atom at; int ninlets=0; if(0==x->x_object || 0==x->x_parent) return 0; ninlets=obj_ninlets(x->x_object); // ninlets=obj_ninlets(x->x_object); SETFLOAT(&at, (t_float)ninlets); outlet_anything(x->x_out, gensym("inlets"), 1, &at); return ninlets; } static void canvasconnections_inconnect(t_canvasconnections *x, t_floatarg f) { const int inlet=f; t_intvec**invecs=0; t_intvec**inwhich=0; int ninlets=query_inletconnections(x, &invecs, &inwhich); if(!ninlets || inlet < 0 || inlet>ninlets) { post("nonexisting inlet: %d", inlet); /* non-existing inlet! */ return; } else { int i; t_atom at[4]; int id=glist_getindex(x->x_parent, (t_gobj*)x->x_object); for(i=0; inum_elements; j++) { SETFLOAT(at+0, (t_float)invecs[i]->elements[j]); SETFLOAT(at+1, (t_float)inwhich[i]->elements[j]); SETFLOAT(at+2, (t_float)id); SETFLOAT(at+3, (t_float)i); outlet_anything(x->x_out, gensym("inconnect"), 4, at); } } intvec_free(invecs[i]); intvec_free(inwhich[i]); } } if(invecs) freebytes(invecs , ninlets * sizeof(*invecs)); if(inwhich)freebytes(inwhich, ninlets * sizeof(*inwhich)); } static int canvasconnections_outlets(t_canvasconnections *x) { t_atom at; int noutlets=0; if(0==x->x_object || 0==x->x_parent) return 0; noutlets=obj_noutlets(x->x_object); SETFLOAT(&at, (t_float)noutlets); outlet_anything(x->x_out, gensym("outlets"), 1, &at); return noutlets; } static void canvasconnections_outconnect(t_canvasconnections *x, t_floatarg f) { int outlet=f; t_atom at[4]; int noutlets=0; if(0==x->x_object || 0==x->x_parent) return; noutlets=obj_noutlets(x->x_object); if(outlet<0 || outlet>=noutlets) { post("nonexisting outlet: %d", outlet); /* non-existing outlet! */ return; } else { t_outlet*out=0; t_outconnect*conn=obj_starttraverseoutlet(x->x_object, &out, outlet); t_object*dest=0; t_inlet*in=0; int id=glist_getindex(x->x_parent, (t_gobj*)x->x_object); conn=obj_starttraverseoutlet(x->x_object, &out, outlet); while(conn) { int destid=0; int destwhich=0; conn=obj_nexttraverseoutlet(conn, &dest, &in, &destwhich); destid = glist_getindex(x->x_parent, (t_gobj*)dest); //post("connection from %d|%d to %d|%d", id, outlet, destid, destwhich); SETFLOAT(at+0, (t_float)id); SETFLOAT(at+1, (t_float)outlet); SETFLOAT(at+2, (t_float)destid); SETFLOAT(at+3, (t_float)destwhich); outlet_anything(x->x_out, gensym("outconnect"), 4, at); } } } static void canvasconnections_outlet(t_canvasconnections *x, t_floatarg f) { int outlet=f; int noutlets=0; if(0==x->x_object || 0==x->x_parent) return; noutlets=obj_noutlets(x->x_object); if(outlet >= 0 && outlet < noutlets) { t_outlet*out=0; t_inlet*in=0; t_object*dest=0; int which; t_outconnect*conn=obj_starttraverseoutlet(x->x_object, &out, outlet); t_atom*abuf=0; int count=0; t_symbol*s=gensym("outlet"); if(obj_issignaloutlet(x->x_object,outlet)) { s=gensym("outlet~"); } while(conn) { conn=obj_nexttraverseoutlet(conn, &dest, &in, &which); count++; } abuf=getbytes((count+1)*sizeof(*abuf)); SETFLOAT(abuf, outlet); if(count>0) { int i=0; conn=obj_starttraverseoutlet(x->x_object, &out, outlet); while(conn) { int connid=0; conn=obj_nexttraverseoutlet(conn, &dest, &in, &which); connid = glist_getindex(x->x_parent, (t_gobj*)dest); SETFLOAT(abuf+1+i, (t_float)connid); i++; } } outlet_anything(x->x_out, s, count+1, abuf); freebytes(abuf, (count+1) * sizeof(*abuf)); } } static void canvasconnections_queryoutlets(t_canvasconnections *x) { int noutlets=canvasconnections_outlets(x); int nout=0; t_atom at; SETFLOAT(&at, (t_float)noutlets); outlet_anything(x->x_out, gensym("outlets"), 1, &at); for(nout=0; noutx_object, &out, nout); t_object*dest=0; t_inlet*in=0; int which=0; int count=0; while(conn) { conn=obj_nexttraverseoutlet(conn, &dest, &in, &which); count++; } if(count>0) { int i=0; t_atom*abuf=getbytes((count+1)*sizeof(*abuf)); SETFLOAT(abuf, nout); conn=obj_starttraverseoutlet(x->x_object, &out, nout); while(conn) { int connid=0; conn=obj_nexttraverseoutlet(conn, &dest, &in, &which); connid = glist_getindex(x->x_parent, (t_gobj*)dest); SETFLOAT(abuf+1+i, (t_float)connid); i++; } outlet_anything(x->x_out, gensym("outlet"), count+1, abuf); freebytes(abuf, (count+1) * sizeof(*abuf)); } } } static void canvasconnections_bang(t_canvasconnections *x) { canvasconnections_queryinlets(x); canvasconnections_queryoutlets(x); } static void canvasconnections_free(t_canvasconnections *x) { x->x_object=0; outlet_free(x->x_out); x->x_out=0; } static void *canvasconnections_new(t_floatarg f) { t_canvasconnections *x = (t_canvasconnections *)pd_new(canvasconnections_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; x->x_parent=0; x->x_object=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } if(canvas) { x->x_object = pd_checkobject((t_pd*)canvas); x->x_parent = canvas->gl_owner; } x->x_out=outlet_new(&x->x_obj, 0); return (x); } void canvasconnections_setup(void) { iemguts_boilerplate("[canvasconnections]", 0); canvasconnections_class = class_new(gensym("canvasconnections"), (t_newmethod)canvasconnections_new, (t_method)canvasconnections_free, sizeof(t_canvasconnections), 0, A_DEFFLOAT, 0); class_addbang(canvasconnections_class, (t_method)canvasconnections_bang); class_addmethod(canvasconnections_class, (t_method)canvasconnections_outlets, gensym("outlets"), 0); class_addmethod(canvasconnections_class, (t_method)canvasconnections_outlet, gensym("outlet"), A_FLOAT, 0); class_addmethod(canvasconnections_class, (t_method)canvasconnections_outconnect, gensym("outconnect"), A_FLOAT, 0); class_addmethod(canvasconnections_class, (t_method)canvasconnections_inlets, gensym("inlets"), 0); class_addmethod(canvasconnections_class, (t_method)canvasconnections_inlet, gensym("inlet"), A_FLOAT, 0); class_addmethod(canvasconnections_class, (t_method)canvasconnections_inconnect, gensym("inconnect"), A_FLOAT, 0); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasdelete.c000066400000000000000000000076321277446453700244120ustar00rootroot00000000000000 /****************************************************** * * canvasdelete - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object deletes itself (or the specified parent canvas) when banged */ #include "iemguts.h" #include "g_canvas.h" /* ------------------------- canvasdelete ---------------------------- */ static t_class *canvasdelete_class; typedef struct _canvasdelete { t_object x_obj; t_glist*x_glist; t_gobj *x_gobj; t_clock *x_clock; } t_canvasdelete; static void canvasdelete_doit(t_canvasdelete *x) { int dspstate= canvas_suspend_dsp(); clock_free(x->x_clock); x->x_clock=NULL; if(x->x_glist) glist_delete(x->x_glist, x->x_gobj); else { t_atom ap[1]; SETFLOAT(ap, 1); typedmess(x->x_gobj, gensym("menuclose"), 1, ap); } canvas_resume_dsp(dspstate); } static void canvasdelete_bang(t_canvasdelete *x) { if(x->x_clock) { pd_error(x, "deletion already scheduled"); return; } if(NULL==x->x_gobj)return; x->x_clock=clock_new(x, (t_method)canvasdelete_doit); clock_delay(x->x_clock, 0); } static void *canvasdelete_new(t_floatarg f) { t_canvasdelete *x = (t_canvasdelete *)pd_new(canvasdelete_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); t_gobj*obj=(t_gobj*)x; int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { obj=(t_gobj*)canvas; canvas=canvas->gl_owner; depth--; } x->x_glist = x->x_gobj = NULL; if (!depth) { x->x_glist = canvas; x->x_gobj=obj; } x->x_clock=NULL; return (x); } static void canvasdelete_free(t_canvasdelete*x) { } static void canvasdelete_canvasmethods(void); void canvasdelete_setup(void) { iemguts_boilerplate("[canvasdelete] - delete message for the canvas", 0); canvasdelete_class = class_new(gensym("canvasdelete"), (t_newmethod)canvasdelete_new, (t_method)canvasdelete_free, sizeof(t_canvasdelete), 0, A_DEFFLOAT, 0); class_addbang(canvasdelete_class, (t_method)canvasdelete_bang); canvasdelete_canvasmethods(); } /* 'delete' message for the canvas */ static int canvas_delete_docb(t_glist*glist, t_gobj*wantobj) { /* this will crash Pd if the object to be deleted is on the stack * workarounds: * - use a clock (see above) * - finally fix this in Pd */ t_gobj*obj=NULL; if(!glist || !wantobj) return 0; for(obj=glist->gl_list; obj; obj=obj->g_next) { if(wantobj == obj) break; } if(!obj) return 0; glist_delete(glist, obj); return 1; } static t_gobj**canvasdelete_indices2glist(const t_glist*glist, unsigned int argc, t_atom*argv) { t_gobj**result = malloc(argc*sizeof(*result)); t_gobj**resptr=result; int i=0; for(i=0; igl_list; /* get handle to object */ while(index-->0 && obj) { obj=obj->g_next; } if(obj) { *resptr++=obj; } } return result; } static void canvas_delete_cb(t_canvas*x, t_symbol*s, int argc, t_atom*argv) { int dspstate= canvas_suspend_dsp(); t_gobj**objs=canvasdelete_indices2glist(x, argc>0?argc:0, argv); int i; for(i=0; is_dollzero) outlet_symbol(x->x_obj.ob_outlet, x->s_dollzero); } static void *canvasdollarzero_new(t_floatarg f) { t_canvasdollarzero *x = (t_canvasdollarzero *)pd_new(canvasdollarzero_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->s_dollzero=0; if(canvas) { x->s_dollzero = canvas_realizedollar(canvas, gensym("$0")); } outlet_new(&x->x_obj, &s_symbol); return (x); } void canvasdollarzero_setup(void) { iemguts_boilerplate("[canvasdollarzero]", 0); canvasdollarzero_class = class_new(gensym("canvasdollarzero"), (t_newmethod)canvasdollarzero_new, 0, sizeof(t_canvasdollarzero), 0, A_DEFFLOAT, 0); class_addbang(canvasdollarzero_class, (t_method)canvasdollarzero_bang); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvaserror.c000066400000000000000000000051731277446453700242770ustar00rootroot00000000000000 /****************************************************** * * canvaserror - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to manipulate the parent-patches arguments (and name!) * usage: * + put this object into an abstraction * + put the abstraction in a patch * + send the object a _list_ of arguments * + the next time the patch (wherein the abstraction that holds this object lives) * is saved, it will be saved with the new arguments instead of the old ones! * - example: "list 2 3 4" will save the object as [ 2 3 4] * + you can also change the abstraction name itself by using a selector other than "list" * - example: "bonkers 8 9" will save the object as [bonkers 8 9] regardless of it's original name * - use with care! * * nice, eh? */ #include "iemguts.h" #include "g_canvas.h" /* ------------------------- canvaserror ---------------------------- */ static t_class *canvaserror_class; typedef struct _canvaserror { t_object x_obj; t_canvas *x_canvas; } t_canvaserror; static void canvaserror_any(t_canvaserror *x, t_symbol*s, int argc, t_atom*argv) { t_canvas*c=x->x_canvas; t_atom name[1]; char*bbstring; int length; t_binbuf*bb=binbuf_new(); SETSYMBOL(name, s); binbuf_add(bb, 1, name); binbuf_add(bb, argc, argv); binbuf_gettext(bb, &bbstring, &length); binbuf_free(bb); bbstring[length]=0; if(!c) { pd_error(x, "%s", bbstring); } else { t_symbol*objectname=c->gl_name; pd_error(c, "[%s]: %s", objectname->s_name, bbstring); } freebytes(bbstring, length); } static void canvaserror_free(t_canvaserror *x) { x->x_canvas = 0; } static void *canvaserror_new(t_floatarg f) { t_canvaserror *x = (t_canvaserror *)pd_new(canvaserror_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_canvas = canvas; return (x); } void canvaserror_setup(void) { iemguts_boilerplate("[canvaserror]", 0); canvaserror_class = class_new(gensym("canvaserror"), (t_newmethod)canvaserror_new, (t_method)canvaserror_free, sizeof(t_canvaserror), 0, A_DEFFLOAT, 0); class_addanything(canvaserror_class, (t_method)canvaserror_any); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasindex.c000066400000000000000000000100731277446453700242500ustar00rootroot00000000000000 /****************************************************** * * canvasindex - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to get the position of the containing abstraction * within the parent-patch * this makes it easy to (dis)connect this abstraction to others * * by default the index of the containing abstraction within the parent-patch is * queried; however you can give the "depth" as argument: * e.g. [canvasindex 1] will give you the index of the abstraction containing the * abstraction that holds this object */ #include "iemguts.h" #include "m_imp.h" #include "g_canvas.h" int glist_getindex(t_glist *x, t_gobj *y); /* ------------------------- canvasindex ---------------------------- */ static t_class *canvasindex_class; typedef struct _canvasindex { t_object x_obj; t_canvas *x_canvas; t_outlet*xoutlet, *youtlet; } t_canvasindex; typedef struct _intlist { int value; struct _intlist*next; } t_intlist; static void canvasindex_symbol(t_canvasindex *x, t_symbol*s) { /* check whether an object of name is in the canvas */ t_canvas*c=x->x_canvas; t_gobj*y; int index=0; if(!c || !c->gl_owner) return; c =c->gl_owner; for (y = (t_gobj*)c->gl_list; y; y = y->g_next) /* traverse all objects in canvas */ { t_object*obj=(t_object*)y; t_class*obj_c=y->g_pd; t_symbol*cname=obj_c->c_name; t_binbuf*b=obj->te_binbuf; t_atom*ap=binbuf_getvec(b); int ac=binbuf_getnatom(b); if(s!=cname && ac) { cname=atom_getsymbol(ap); } if(s==cname){ #warning LATER think about output format outlet_float(x->xoutlet, (t_float)index); } index++; } } static void canvasindex_float(t_canvasindex *x, t_floatarg f) { /* get the objectname of object # */ int index=f, cur=0; t_canvas*c=x->x_canvas; t_gobj*y; if(index < 0 || !c || !c->gl_owner) return; c =c->gl_owner; for (y = (t_gobj*)c->gl_list; y && curg_next) /* traverse all objects in canvas */ { cur++; } if(y) { t_object*obj=(t_object*)y; t_binbuf*b=obj->te_binbuf; t_atom*ap=binbuf_getvec(b); int ac=binbuf_getnatom(b); t_atom classatom[1]; SETSYMBOL(classatom, y->g_pd->c_name); /* LATER: shan't we output the index of the object as well? */ outlet_anything(x->youtlet, gensym("class"), 1, classatom); outlet_anything(x->xoutlet, gensym("binbuf"), ac, ap); } } static void canvasindex_bang(t_canvasindex *x) { t_canvas*c=x->x_canvas; t_canvas*c0=0; if(!c) return; c0=c->gl_owner; if(!c0)return; outlet_float(x->youtlet, (t_float)(glist_getindex(c0, 0))); outlet_float(x->xoutlet, (t_float)(glist_getindex(c0, (t_gobj*)c))); } static void canvasindex_free(t_canvasindex *x) { outlet_free(x->xoutlet); outlet_free(x->youtlet); } static void *canvasindex_new(t_floatarg f) { t_canvasindex *x = (t_canvasindex *)pd_new(canvasindex_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_canvas = canvas; x->xoutlet=outlet_new(&x->x_obj, &s_float); x->youtlet=outlet_new(&x->x_obj, &s_float); return (x); } void canvasindex_setup(void) { iemguts_boilerplate("[canvasindex]", 0); canvasindex_class = class_new(gensym("canvasindex"), (t_newmethod)canvasindex_new, (t_method)canvasindex_free, sizeof(t_canvasindex), 0, A_DEFFLOAT, 0); class_addbang(canvasindex_class, (t_method)canvasindex_bang); class_addsymbol(canvasindex_class, (t_method)canvasindex_symbol); class_addfloat(canvasindex_class, (t_method)canvasindex_float); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasname.c000066400000000000000000000070371277446453700240670ustar00rootroot00000000000000 /****************************************************** * * canvasname - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to manipulate the parent-patches arguments (and name!) * usage: * + put this object into an abstraction * + put the abstraction in a patch * + send the object a _list_ of arguments * + the next time the patch (wherein the abstraction that holds this object lives) * is saved, it will be saved with the new arguments instead of the old ones! * - example: "list 2 3 4" will save the object as [ 2 3 4] * + you can also change the abstraction name itself by using a selector other than "list" * - example: "bonkers 8 9" will save the object as [bonkers 8 9] regardless of it's original name * - use with care! * * nice, eh? */ #include "iemguts.h" #include "g_canvas.h" /* ------------------------- canvasname ---------------------------- */ static t_class *canvasname_class; typedef struct _canvasname { t_object x_obj; t_canvas *x_canvas; t_outlet*x_nameout; t_outlet*x_displaynameout; t_inlet*x_displaynamein; } t_canvasname; static void canvasname_bang(t_canvasname *x) { t_canvas*c=x->x_canvas; t_binbuf*b=0; if(!c) return; if(c->gl_name) outlet_symbol(x->x_displaynameout, c->gl_name); b=c->gl_obj.te_binbuf; if(b) { /* get the binbufs atomlist */ t_atom*ap=binbuf_getvec(b); t_symbol*s=atom_getsymbol(ap); if(s) outlet_symbol(x->x_nameout, s); } else { #if 0 post("empty binbuf for %x", x->x_canvas); #endif } } static void canvasname_symbol(t_canvasname *x, t_symbol*s) { t_binbuf*b=0; if(!x->x_canvas) return; b=x->x_canvas->gl_obj.te_binbuf; if(b) { /* get the binbufs atomlist */ t_atom*ap=binbuf_getvec(b); SETSYMBOL(ap, s); return; } } static void canvasname_displayname(t_canvasname *x, t_symbol*s) { t_canvas*c=x->x_canvas; if(!c) return; c->gl_name = s; } static void canvasname_free(t_canvasname *x) { if(x->x_nameout )outlet_free(x->x_nameout );x->x_nameout=NULL ; if(x->x_displaynameout)outlet_free(x->x_displaynameout);x->x_displaynameout=NULL; if(x->x_displaynamein )inlet_free (x->x_displaynamein );x->x_displaynamein=NULL; } static void *canvasname_new(t_floatarg f) { t_canvasname *x = (t_canvasname *)pd_new(canvasname_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_canvas = canvas; x->x_displaynamein=inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym("display")); x->x_nameout=outlet_new(&x->x_obj, &s_symbol); x->x_displaynameout=outlet_new(&x->x_obj, &s_symbol); return (x); } void canvasname_setup(void) { iemguts_boilerplate("[canvasname]", 0); canvasname_class = class_new(gensym("canvasname"), (t_newmethod)canvasname_new, (t_method)canvasname_free, sizeof(t_canvasname), 0, A_DEFFLOAT, 0); class_addsymbol(canvasname_class, (t_method)canvasname_symbol); class_addmethod(canvasname_class, (t_method)canvasname_displayname, gensym("display"), A_SYMBOL, 0); class_addbang (canvasname_class, (t_method)canvasname_bang); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasobjectposition.c000066400000000000000000000115151277446453700261760ustar00rootroot00000000000000 /****************************************************** * * canvasposition - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to get and set the position of the containing * abstraction within the parent-patch * * by default the position of the containing abstraction within the parent-patch is * queried * you can give the "depth" as argument; * e.g. [canvasobjectposition 1] will set/get the position of the abstraction containing the * abstraction within its canvas. */ #include "iemguts.h" #include "g_canvas.h" #include "m_imp.h" /* ------------------------- canvasobjectposition ---------------------------- */ static t_class *canvasobjectposition_class; typedef struct _canvasobjectposition { t_object x_obj; t_canvas *x_parent; // the canvas we are acting on t_canvas *x_canvas; // an object in the x_canvas selected via the 2nd inlet (index) t_outlet*xoutlet, *youtlet; } t_canvasobjectposition; static void canvasobjectposition_object(t_canvasobjectposition *x, t_float f); static void canvasobjectposition_bang(t_canvasobjectposition *x) { t_canvas*c=x->x_canvas; t_canvas*c0=x->x_parent; int x1=0, y1=0, width=0, height=0; t_atom alist[2]; if(!c) return; x1=c->gl_obj.te_xpix; y1=c->gl_obj.te_ypix; if(NULL!=c0) { width= (int)(c0->gl_screenx2 - c0->gl_screenx1); height=(int)(c0->gl_screeny2 - c0->gl_screeny1); } SETFLOAT(alist, (t_float)width); SETFLOAT(alist+1, (t_float)height); outlet_list(x->youtlet, 0, 2, alist); // outlet_float(x->youtlet, y1); SETFLOAT(alist, (t_float)x1); SETFLOAT(alist+1, (t_float)y1); outlet_list(x->xoutlet, 0, 2, alist); } static void canvasobjectposition_list(t_canvasobjectposition *x, t_symbol*s, int argc, t_atom*argv) { t_canvas*c =x->x_canvas; t_canvas*c0=x->x_parent; int dx, dy; if(!c) return; // c0=c->gl_owner; if(argc==0){ canvasobjectposition_bang(x); return; } if(argc!=2 || (A_FLOAT != (argv+0)->a_type) || (A_FLOAT != (argv+1)->a_type)) { pd_error(x, "expected as new position"); return; } dx = atom_getint(argv+0) - c->gl_obj.te_xpix; dy = atom_getint(argv+1) - c->gl_obj.te_ypix; if(c0&&glist_isvisible(c0)) { gobj_displace((t_gobj*)c, c0, dx, dy); canvas_fixlinesfor(c0, (t_text*)c); } else { c->gl_obj.te_xpix+=dx; c->gl_obj.te_ypix+=dy; } } static void canvasobjectposition_free(t_canvasobjectposition *x) { outlet_free(x->xoutlet); outlet_free(x->youtlet); } static void *canvasobjectposition_new(t_symbol*s, int argc, t_atom*argv) { if(argc>2) { error("syntax: canvasobjectposition []"); return NULL; } else { t_canvasobjectposition *x = (t_canvasobjectposition *)pd_new(canvasobjectposition_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int index=-1; int depth=0; switch(argc) { case 2: index=atom_getint(argv+1); case 1: depth=atom_getint(argv); default: break; } if(depth<0)depth=0; //post("depth=%d\tindex=%d", depth, index); while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_parent = canvas; x->x_canvas=NULL; x->xoutlet=outlet_new(&x->x_obj, &s_list); x->youtlet=outlet_new(&x->x_obj, &s_list); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("object")); if(index>=0) canvasobjectposition_object(x, index); return (x); } return NULL; } static void canvasobjectposition_object(t_canvasobjectposition *x, t_float f) { t_gobj*obj=NULL; int index=(int)f; int i=index; t_glist*glist=x->x_parent; if(x->x_parent==NULL) return; if(index<0) return; if(NULL==glist) return; obj=glist->gl_list; while(i-- && obj) { obj=obj->g_next; } x->x_canvas=NULL; if(obj) { x->x_canvas=(t_canvas*)obj; } } void canvasobjectposition_setup(void) { iemguts_boilerplate("[canvasobjectposition]", 0); canvasobjectposition_class = class_new(gensym("canvasobjectposition"), (t_newmethod)canvasobjectposition_new, (t_method)canvasobjectposition_free, sizeof(t_canvasobjectposition), 0, A_GIMME, 0); class_addbang(canvasobjectposition_class, (t_method)canvasobjectposition_bang); class_addlist(canvasobjectposition_class, (t_method)canvasobjectposition_list); class_addmethod(canvasobjectposition_class, (t_method)canvasobjectposition_object, gensym("object"), A_FLOAT, 0); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasposition.c000066400000000000000000000067321277446453700250140ustar00rootroot00000000000000 /****************************************************** * * canvasposition - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to get and set the position of the containing * abstraction within the parent-patch * * by default the position of the containing abstraction within the parent-patch is * queried * you can give the "depth" as argument; * e.g. [canvasposition 1] will set/get the position of the abstraction containing the * abstraction within its canvas. */ #include "iemguts.h" #include "g_canvas.h" #include "m_imp.h" /* ------------------------- canvasposition ---------------------------- */ static t_class *canvasposition_class; typedef struct _canvasposition { t_object x_obj; t_canvas *x_canvas; t_outlet*xoutlet, *youtlet; } t_canvasposition; static void canvasposition_bang(t_canvasposition *x) { t_canvas*c=x->x_canvas; t_canvas*c0=0; int x1=0, y1=0, width=0, height=0; t_atom alist[2]; if(!c) return; x1=c->gl_obj.te_xpix; y1=c->gl_obj.te_ypix; c0=c->gl_owner; if(c0!=0) { width= (int)(c0->gl_screenx2 - c0->gl_screenx1); height=(int)(c0->gl_screeny2 - c0->gl_screeny1); } SETFLOAT(alist, (t_float)width); SETFLOAT(alist+1, (t_float)height); outlet_list(x->youtlet, 0, 2, alist); // outlet_float(x->youtlet, y1); SETFLOAT(alist, (t_float)x1); SETFLOAT(alist+1, (t_float)y1); outlet_list(x->xoutlet, 0, 2, alist); } static void canvasposition_list(t_canvasposition *x, t_symbol*s, int argc, t_atom*argv) { t_canvas*c=x->x_canvas; t_canvas*c0=0; int dx, dy; if(!c) return; c0=c->gl_owner; if(argc==0){ canvasposition_bang(x); return; } if(argc!=2 || (A_FLOAT != (argv+0)->a_type) || (A_FLOAT != (argv+1)->a_type)) { pd_error(x, "expected as new position"); return; } dx = atom_getint(argv+0) - c->gl_obj.te_xpix; dy = atom_getint(argv+1) - c->gl_obj.te_ypix; if ((dx!=0)||(dy!=0)) { if(c0&&glist_isvisible(c0)) { gobj_displace((t_gobj*)c, c0, dx, dy); canvas_fixlinesfor(c0, (t_text*)c); } else { c->gl_obj.te_xpix+=dx; c->gl_obj.te_ypix+=dy; } } } static void canvasposition_free(t_canvasposition *x) { outlet_free(x->xoutlet); outlet_free(x->youtlet); } static void *canvasposition_new(t_floatarg f) { t_canvasposition *x = (t_canvasposition *)pd_new(canvasposition_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_canvas = canvas; x->xoutlet=outlet_new(&x->x_obj, &s_list); x->youtlet=outlet_new(&x->x_obj, &s_list); return (x); } void canvasposition_setup(void) { iemguts_boilerplate("[canvasposition]", 0); canvasposition_class = class_new(gensym("canvasposition"), (t_newmethod)canvasposition_new, (t_method)canvasposition_free, sizeof(t_canvasposition), 0, A_DEFFLOAT, 0); class_addbang(canvasposition_class, (t_method)canvasposition_bang); class_addlist(canvasposition_class, (t_method)canvasposition_list); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/canvasselect.c000066400000000000000000000131411277446453700244170ustar00rootroot00000000000000/****************************************************** * * canvasselect - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object allows to select other objects on the canvas * it also allows to query the selection of the canvas * * it also adds a "select" message to the canvas * * TODO: * - save selection to file * - patcherize selection */ #include "iemguts.h" #include "g_canvas.h" /* ------------------------- canvasselect ---------------------------- */ static t_class *canvasselect_class; typedef struct _canvasselect { t_object x_obj; t_canvas*x_canvas; } t_canvasselect; static void canvasselect_bang(t_canvasselect *x) { /* get the selection of the canvas */ t_glist*glist=x->x_canvas; t_gobj*obj=NULL; int index=0; if(NULL==glist) { return; } int nselected=0; for(obj=glist->gl_list; obj; obj=obj->g_next, index++) { if(glist_isselected(glist, obj)) { // post("selected: %d", index); nselected++; } } int n=0; index=0; t_atom *atombuf; atombuf = getbytes(nselected*sizeof(*atombuf)); for(obj=glist->gl_list; obj; obj=obj->g_next, index++) { if(glist_isselected(glist, obj)) { SETFLOAT(&atombuf[n], index); n++; } } outlet_list(x->x_obj.ob_outlet, &s_list, nselected, atombuf); } static int canvasselect_doselect(t_glist*glist, int index) { t_gobj*obj=NULL; int i=index; if(NULL==glist) { return -1; } if(i<0) { return -1; } obj=glist->gl_list; while(i-- && obj) { obj=obj->g_next; } if(obj) { if(!glist_isselected(glist, obj)) glist_select(glist, obj); } else { return -1; } return index; } static void canvasselect_select(t_canvasselect*x, t_floatarg f) { int i=f; if(canvasselect_doselect(x->x_canvas, i)<0) { pd_error(x, "invalid selection %d", i); } } static void canvasselect_selectall(t_canvasselect*x) { t_glist*glist=x->x_canvas; if(glist)glist_selectall(glist); } static void canvasselect_select_cb(t_canvasselect*x, t_symbol*s, int argc, t_atom*argv) { if(argc) { while(argc--){ canvasselect_select(x, atom_getint(argv++)); } } else { canvasselect_selectall(x); } } static int canvasselect_dodeselect(t_glist*glist, int index) { t_gobj*obj=NULL; int i=index; if(NULL==glist) { return -1; } if(i<0) { return -1; } obj=glist->gl_list; while(i-- && obj) { obj=obj->g_next; } if(obj) { if(glist_isselected(glist, obj)) { glist_deselect(glist, obj); } else return index; } else { return -1; } return index; } static void canvasselect_deselect(t_canvasselect*x, t_floatarg f) { int i=f; if(canvasselect_dodeselect(x->x_canvas, i)<0) { pd_error(x, "invalid deselection %d", i); } } static void canvasselect_deselectall(t_canvasselect*x) { if(NULL==x->x_canvas) { return; } glist_noselect((t_glist*)x->x_canvas); } static void canvasselect_deselect_cb(t_canvasselect*x, t_symbol*s, int argc, t_atom*argv) { if(argc) { while(argc--){ canvasselect_deselect(x, atom_getint(argv++)); } } else { canvasselect_deselectall(x); } } static void *canvasselect_new(t_floatarg f) { t_canvasselect *x = (t_canvasselect *)pd_new(canvasselect_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_canvas = canvas; outlet_new(&x->x_obj, 0); return (x); } static void canvasselect_free(t_canvasselect*x) { x->x_canvas = 0; } static void canvas_select_cb(t_canvas*x, t_float f) { canvasselect_doselect(x, f); } static void canvas_selectall_cb(t_canvas*x) { t_glist*glist=x; if(glist)glist_selectall(glist); } static void canvas_deselect_cb(t_canvas*x, t_float f) { canvasselect_dodeselect(x, f); } static void canvas_deselectall_cb(t_canvas*x) { t_glist*glist=x; if(glist)glist_noselect(glist); } static void register_methods(void) { if(NULL==canvas_class)return; /* check whether we already have this function: zgetfn(canvasclass, gensym("select")) */ if(NULL==zgetfn(&canvas_class, gensym("select"))) class_addmethod(canvas_class, (t_method)canvas_select_cb, gensym("select"), A_FLOAT, 0); if(NULL==zgetfn(&canvas_class, gensym("selectall"))) class_addmethod(canvas_class, (t_method)canvas_selectall_cb, gensym("selectall"), 0); if(NULL==zgetfn(&canvas_class, gensym("deselect"))) class_addmethod(canvas_class, (t_method)canvas_deselect_cb, gensym("deselect"), A_FLOAT, 0); if(NULL==zgetfn(&canvas_class, gensym("deselectall"))) class_addmethod(canvas_class, (t_method)canvas_deselectall_cb, gensym("deselectall"), 0); } void canvasselect_setup(void) { iemguts_boilerplate("[canvasselect] - (de)select messages for canvas", 0); canvasselect_class = class_new(gensym("canvasselect"), (t_newmethod)canvasselect_new, (t_method)canvasselect_free, sizeof(t_canvasselect), 0, A_DEFFLOAT, 0); class_addbang(canvasselect_class, (t_method)canvasselect_bang); class_addmethod(canvasselect_class, (t_method)canvasselect_select_cb, gensym("select"), A_GIMME, 0); class_addmethod(canvasselect_class, (t_method)canvasselect_deselect_cb, gensym("deselect"), A_GIMME, 0); register_methods(); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/classtest.c000066400000000000000000000033671277446453700237620ustar00rootroot00000000000000 /****************************************************** * * classtest - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to send messages to upstream canvases * by default it sends messages to the containing canvas, but you can give the * "depth" as argument; * e.g. [classtest 1] will send messages to the parent of the containing canvas */ #include "iemguts.h" #include "g_canvas.h" int glist_getindex(t_glist *x, t_gobj *y); /* ------------------------- classtest ---------------------------- */ static t_class *classtest_class; typedef struct _classtest { t_object x_obj; t_outlet *x_out; } t_classtest; static void classtest_symbol(t_classtest *x, t_symbol*s) { t_float result=0.; if(!pd_objectmaker) { pd_error(x, "[classtest]: couldn't find pd_objectmaker!"); return; } if(0!=zgetfn(&pd_objectmaker, s)) result=1.; outlet_float(x->x_out, result); } static void classtest_free(t_classtest *x) { outlet_free(x->x_out); } static void *classtest_new(void) { t_classtest *x = (t_classtest *)pd_new(classtest_class); x->x_out = outlet_new(&x->x_obj, &s_float); return (x); } void classtest_setup(void) { iemguts_boilerplate("[classtest]", 0); classtest_class = class_new(gensym("classtest"), (t_newmethod)classtest_new, (t_method)classtest_free, sizeof(t_classtest), 0, 0); class_addsymbol(classtest_class, (t_method)classtest_symbol); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/closebang.c000066400000000000000000000034471277446453700237110ustar00rootroot00000000000000/****************************************************** * * closebang - implementation file * * copyleft (c) IOhannes m zmölnig * * 1901:forum::für::umläute:2016 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object send out a bang when an abstraction was loaded * (but before the parent abstraction continues to load) * usage: * + it can be used to create abstractions with dynamic numbers of iolets * nice, eh? */ #include "iemguts.h" /* need g_canvas.h for loadbang-actions */ #include "g_canvas.h" #ifndef LB_CLOSE # warning compiling against a version of Pd without closebang support # define LB_CLOSE 2 #endif /* ------------------------- closebang ---------------------------- */ static t_class *closebang_class; typedef struct _closebang { t_object x_obj; } t_closebang; static void closebang_loadbang(t_closebang *x, t_float type) { if(LB_CLOSE == (int)type) outlet_bang(x->x_obj.ob_outlet); } static void *closebang_new(void) { t_closebang *x = (t_closebang *)pd_new(closebang_class); outlet_new(&x->x_obj, &s_bang); return (x); } void closebang_setup(void) { iemguts_boilerplate("[closebang]", 0); #if (PD_MINOR_VERSION < 47) verbose(0, "[closebang] has been compiled against an incompatible version of Pd, proceeding anyway..."); #endif closebang_class = class_new(gensym("closebang"), (t_newmethod)closebang_new, 0, sizeof(t_closebang), CLASS_NOINLET, 0); if(iemguts_check_atleast_pdversion(0,47,0)) class_addmethod(closebang_class, (t_method)closebang_loadbang, gensym("loadbang"), A_DEFFLOAT, 0); else error("[closebang] requires Pd>=0.47"); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/findbrokenobjects.c000066400000000000000000000136251277446453700254460ustar00rootroot00000000000000 /****************************************************** * * findbrokenobjects - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * find broken objects (objects that could not be created) * these objects are of class 'text_class' objsrc = pd_checkobject(&src->g_pd); if (objsrc && pd_class(&src->g_pd) == text_class && objsrc->te_type == T_OBJECT) { // 'src' is a broken object } TODO: - output more data: canvas and object-ID */ #include "iemguts.h" #include "g_canvas.h" #include "m_imp.h" #include int glist_getindex(t_glist *x, t_gobj *y); /* ------------------------- findbrokenobjects ---------------------------- */ static t_class *findbrokenobjects_class; typedef struct _findbrokenobjects { t_object x_obj; t_outlet *x_out; t_canvas *x_parent; // the canvas we are acting on int x_verbose; } t_findbrokenobjects; extern t_class *text_class; extern t_class *canvas_class; static void print_obj(const char*prefix, t_object *obj) { int ntxt; char *txt; t_binbuf*bb=obj->te_binbuf; binbuf_gettext(bb, &txt, &ntxt); pd_error(obj, "%s%p\t%s", prefix, obj, txt); } static void findbrokenobjects_doit(t_canvas*cnv) { t_gobj*src; for (src = cnv->gl_list; src; src = src->g_next) { /* traverse all objects in canvas */ t_object*obj=pd_checkobject(&src->g_pd); if (obj && (pd_class(&src->g_pd) == text_class && obj->te_type == T_OBJECT)) { // found broken object print_obj("broken:\t", obj); } } } static int fbo_has_ctor(t_atom*ab) { t_symbol*s=(ab&&pd_objectmaker)?atom_getsymbol(ab):0; if(!s) return 0; if(zgetfn(&pd_objectmaker, s)) return 1; return 0; } static void fbo_iterate(t_findbrokenobjects*x, t_canvas*cnv, int verbose) { // iterate over all top-level canvases if(!(cnv && cnv->gl_name && cnv->gl_name->s_name)) return; t_gobj*g=0; int count=0; for(g=cnv->gl_list;g;g=g->g_next) { // iterate over all objects on the canvas t_object*ob=pd_checkobject(&g->g_pd); t_class*cls=0; count++; if(!(ob && ob->te_type == T_OBJECT)) continue; cls=pd_class(&g->g_pd); if (cls == canvas_class) { // this is just another abstraction, recurse into it fbo_iterate(x, ob, verbose); } else if (cls == text_class) { t_binbuf*bb=ob->te_binbuf; t_atom*argv=binbuf_getvec(bb); int argc=binbuf_getnatom(bb); /* broken object */ if(verbose) { int ntxt; char *txt; binbuf_gettext(bb, &txt, &ntxt); pd_error(ob, "[%s] broken object!", txt); freebytes(txt, ntxt); } //post("%s %d", cnv->gl_name->s_name, count); if(argc && fbo_has_ctor(argv)) { outlet_anything(x->x_out, gensym("not-created"), argc, argv); } else { outlet_anything(x->x_out, gensym("not-found"), argc, argv); } } } } static void findbrokenobjects_iterate(t_findbrokenobjects *x, int verbose) { // find all broken objects in the current patch if(x->x_parent) { fbo_iterate(x, x->x_parent, verbose); } else { t_canvas *c; for (c = pd_getcanvaslist(); c; c = c->gl_next) { const char*name=c->gl_name->s_name; /* only allow names ending with '.pd' * (reject template canvases) */ int len=strlen(name); const char*exclude_name; int exclude=1; for(exclude_name="etalpmet_"; *exclude_name && len; len--, exclude_name++) { if(*exclude_name != name[len-1]) { exclude=0; break; } } if(!exclude){ fbo_iterate(x, c, verbose); }// else post("canvas: %s", name); } } } static void findbrokenobjects_bang(t_findbrokenobjects *x) { findbrokenobjects_iterate(x, x->x_verbose); } static void findbrokenobjects_verbose(t_findbrokenobjects *x, t_float f) { x->x_verbose=(int)f; } static void findbrokenobjects_free(t_findbrokenobjects *x) { outlet_free(x->x_out); } static void *findbrokenobjects_new(t_symbol*s, int argc, t_atom*argv) { t_findbrokenobjects *x = (t_findbrokenobjects *)pd_new(findbrokenobjects_class); x->x_parent=0; if(argc==1 && argv->a_type == A_FLOAT) { int depth=atom_getint(argv); t_glist *glist=(t_glist *)canvas_getcurrent(); if(depth>=0) { t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); while(depth && canvas) { canvas=canvas->gl_owner; depth--; } if(canvas) x->x_parent = canvas; } } x->x_verbose=0; x->x_out = outlet_new(&x->x_obj, 0); return (x); } static char fbo_file[]; static void fbo_persist(void) { static t_pd*fbo_canvas=0; if(fbo_canvas) return; t_binbuf *b = binbuf_new(); glob_setfilename(0, gensym("_deken_workspace"), gensym(".")); binbuf_text(b, fbo_file, strlen(fbo_file)); binbuf_eval(b, &pd_canvasmaker, 0, 0); fbo_canvas = s__X.s_thing; vmess(s__X.s_thing, gensym("pop"), "i", 0); glob_setfilename(0, &s_, &s_); binbuf_free(b); } void findbrokenobjects_setup(void) { iemguts_boilerplate("[findbrokenobjects]", 0); findbrokenobjects_class = class_new(gensym("findbrokenobjects"), (t_newmethod)findbrokenobjects_new, (t_method)findbrokenobjects_free, sizeof(t_findbrokenobjects), 0, A_GIMME, 0); class_addbang (findbrokenobjects_class, (t_method)findbrokenobjects_bang); class_addmethod(findbrokenobjects_class, (t_method)findbrokenobjects_verbose, gensym("verbose"), A_FLOAT, 0); if(0) fbo_persist(); } static char fbo_file[] = "\ canvas 0 0 300 200;\n\ #X obj 20 20 receive __deken_findbroken_objects;\n\ #X obj 20 60 findbrokenobjects;\n\ #X obj 20 80 list prepend plugin-dispatch deken;\n\ #X msg 20 40 unique;\n\ #X obj 20 100 list trim;\n\ #X obj 20 120 s pd;\n\ #X connect 0 0 3 0;\n\ #X connect 1 0 2 0;\n\ #X connect 2 0 4 0;\n\ #X connect 3 0 1 0;\n\ #X connect 4 0 5 0;\n\ "; iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/iemguts-objlist.h000066400000000000000000000064301277446453700250750ustar00rootroot00000000000000/****************************************************** * * iemguts - implementation file * * copyleft (c) IOhannes m zmölnig * * 2008:forum::für::umläute:2015 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* this file implements some helper functions for dealing with lists of * objects (containing other objects) * * used for callbacks to enumerated objects without $0 tricks */ /* * TODO: documentation */ #ifndef INCLUDE_IEMGUTS_OBJECTLIST_H_ #define INCLUDE_IEMGUTS_OBJECTLIST_H_ #include "iemguts.h" /* ------------------------- helper methods for callbacks ---------------------------- */ typedef struct _iemguts_objlist { const t_pd*obj; struct _iemguts_objlist*next; } t_iemguts_objlist; typedef struct _iemguts_canvaslist { const t_pd*parent; t_iemguts_objlist*obj; struct _iemguts_canvaslist*next; } t_iemguts_canvaslist; static t_iemguts_canvaslist*s_canvaslist=0; static t_iemguts_canvaslist*findCanvas(const t_pd*parent) { t_iemguts_canvaslist*list=s_canvaslist; if(0==parent || 0==list) return 0; for(list=s_canvaslist; list; list=list->next) { if(parent == list->parent) { return list; } } return 0; } static t_iemguts_canvaslist*addCanvas(const t_pd*parent) { t_iemguts_canvaslist*list=findCanvas(parent); if(!list) { list=getbytes(sizeof(*list)); list->parent=parent; list->obj=0; list->next=0; if(0==s_canvaslist) { /* new list */ s_canvaslist=list; } else { /* add to the end of existing list */ t_iemguts_canvaslist*dummy=s_canvaslist; while(dummy->next) dummy=dummy->next; dummy->next = list; } } return list; } static t_iemguts_objlist*objectsInCanvas(const t_pd*parent) { t_iemguts_canvaslist*list=findCanvas(parent); if(list) return list->obj; return 0; } static void addObjectToCanvas(const t_pd*parent, const t_pd*obj) { t_iemguts_canvaslist*p=addCanvas(parent); t_iemguts_objlist*list=0; t_iemguts_objlist*entry=0; if(!p || !obj) return; list=p->obj; if(list&&obj==list->obj) return; while(list && list->next) { if(obj==list->obj) /* obj already in list */ return; list=list->next; } /* we are at the end of the list that does not contain obj yet, so add it */ entry=getbytes(sizeof(*entry)); entry->obj=obj; entry->next=0; if(list) { list->next=entry; } else { p->obj=entry; } } static void removeObjectFromCanvas(const t_pd*parent, const t_pd*obj) { t_iemguts_canvaslist*p=findCanvas(parent); t_iemguts_objlist*list=0, *last=0, *next=0; if(!p || !obj)return; list=p->obj; if(!list) return; while(list && obj!=list->obj) { last=list; list=list->next; } if(!list) /* couldn't find this object */ return; next=list->next; if(last) last->next=next; else p->obj=next; freebytes(list, sizeof(*list)); list=0; } static void removeObjectFromCanvases(const t_pd*obj) { t_iemguts_canvaslist*parents=s_canvaslist; while(parents) { removeObjectFromCanvas(parents->parent, obj); parents=parents->next; } #endif /* INCLUDE_IEMGUTS_OBJECTLIST_H_ */ } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/iemguts.h000066400000000000000000000045341277446453700234340ustar00rootroot00000000000000/****************************************************** * * iemguts - implementation file * * copyleft (c) IOhannes m zmölnig * * 2008:forum::für::umläute:2015 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* generic include header for iemguts * includes other necessary files (m_pd.h) * and provides boilerplate functions/macros */ #ifndef INCLUDE_IEMGUTS_H_ #define INCLUDE_IEMGUTS_H_ #include "m_pd.h" #ifdef STRINGIFY # undef STRINGIFY #endif #define IEMGUTS_STRINGIFY_AUX(s) #s #define STRINGIFY(s) IEMGUTS_STRINGIFY_AUX(s) #ifndef BUILD_DATE # define BUILD_DATE "on " __DATE__ " at " __TIME__ #endif /* * check whether we run at least a given Pd-version */ static int iemguts_check_atleast_pdversion(int major, int minor, int bugfix) { int got_major=0, got_minor=0, got_bugfix=0; sys_getversion(&got_major, &got_minor, &got_bugfix); #pragma push_macro("cmpver_") #ifdef cmpver_ # undef cmpver_ #endif #define cmpver_(got, want) if(got < want)return 0; else if (got > want)return 1; cmpver_(got_major , major ); cmpver_(got_minor , minor ); cmpver_(got_bugfix, bugfix); return 1; #pragma pop_macro("cmpver_") } /** * print some boilerplate about when the external was compiled * and against which version of Pd */ static void iemguts_boilerplate(const char*name, const char*copyright) { const int v=0; if(name && *name) { #ifdef VERSION verbose(v, "%s " STRINGIFY(VERSION), name); #else verbose(v, "%s", name); #endif /* if copyright is NULL, assume default; if it's empty skip it */ if(!copyright) copyright="IOhannes m zmölnig, IEM "; if(*copyright) verbose(v, "\t© %s", copyright); verbose(v, "\tcompiled "BUILD_DATE); if(*PD_TEST_VERSION) verbose(v, "\t against Pd version %d.%d-%d (%s)", PD_MAJOR_VERSION, PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION); else verbose(v, "\t against Pd version %d.%d-%d", PD_MAJOR_VERSION, PD_MINOR_VERSION, PD_BUGFIX_VERSION); if(!iemguts_check_atleast_pdversion(PD_MAJOR_VERSION, PD_MINOR_VERSION, PD_BUGFIX_VERSION)) verbose(v, "\tNOTE: you are running an older version of Pd!"); } } #endif /* INCLUDE_IEMGUTS_H_ */ iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/initbang.c000066400000000000000000000034421277446453700235420ustar00rootroot00000000000000/****************************************************** * * initbang - implementation file * * copyleft (c) IOhannes m zmölnig * * 1901:forum::für::umläute:2016 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object send out a bang when an abstraction was loaded * (but before the parent abstraction continues to load) * usage: * + it can be used to create abstractions with dynamic numbers of iolets * nice, eh? */ #include "iemguts.h" /* need g_canvas.h for loadbang-actions */ #include "g_canvas.h" #ifndef LB_INIT # warning compiling against a version of Pd without initbang support # define LB_INIT 1 # define LB_CLOSE 2 #endif /* ------------------------- initbang ---------------------------- */ static t_class *initbang_class; typedef struct _initbang { t_object x_obj; } t_initbang; static void initbang_loadbang(t_initbang *x, t_float type) { if(LB_INIT == (int)type) outlet_bang(x->x_obj.ob_outlet); } static void *initbang_new(void) { t_initbang *x = (t_initbang *)pd_new(initbang_class); outlet_new(&x->x_obj, &s_bang); return (x); } void initbang_setup(void) { iemguts_boilerplate("[initbang]", 0); #if (PD_MINOR_VERSION < 47) verbose(0, "[initbang] has been compiled against an incompatible version of Pd, proceeding anyway..."); #endif initbang_class = class_new(gensym("initbang"), (t_newmethod)initbang_new, 0, sizeof(t_initbang), CLASS_NOINLET, 0); if(iemguts_check_atleast_pdversion(0,47,0)) class_addmethod(initbang_class, (t_method)initbang_loadbang, gensym("loadbang"), A_DEFFLOAT, 0); else error("[initbang] requires Pd>=0.47"); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/oreceive.c000066400000000000000000000163201277446453700235470ustar00rootroot00000000000000 /****************************************************** * * oreceive - implementation file * * copyleft (c) IOhannes m zmölnig * * 2307:forum::für::umläute:2008 * * institute of electronic music and acoustics (iem) * unsiversity of music and dramatic arts graz (kug) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ #include "iemguts.h" #if 0 # define debug_post post #else static void debug_post(const char *fmt, ...) {;} #endif static t_class *oreceive_class, *oreceive_proxy_class; /* ------------------------------------------------------------- */ /* * [oreceive] : ordered receive * * * there come the guts: our own bind/unbind mechanism that * includes priorities * * the plan is as follows: * [oreceive] tells us, which name it wants to bind to; * it doesn't _really_ get bound to this name! * * we have an invisible permanent object, that keeps track of * sorted (by priority) lists of the [oreceive] objects * * this object binds itself to the requested name * and when it gets called, it in turn calls all the [oreceive] objects * * that's it */ typedef struct _bind_element { t_pd *object; t_float priority; struct _bind_element*next; } t_bind_element; typedef struct _bind_list { t_object p_obj; t_symbol*key; t_bind_element*elements; struct _bind_list*next; } t_oreceive_proxy; static t_oreceive_proxy*priority_receiver=0; static t_oreceive_proxy*guts_find_key(t_symbol*key) { t_oreceive_proxy*binding=0; for(binding=priority_receiver; binding; binding=binding->next) { if(binding->key == key) return binding; } /* not found */ return 0; } static t_oreceive_proxy*guts_add_key(t_symbol*key) { t_oreceive_proxy*bind_list=0; bind_list=(t_oreceive_proxy*)pd_new(oreceive_proxy_class); bind_list->key=key; bind_list->elements=0; bind_list->next=0; debug_post("binding %x to %s", bind_list, key->s_name); pd_bind(&bind_list->p_obj.ob_pd, key); t_oreceive_proxy*last=priority_receiver; if(last) { while(last->next) { last=last->next; } last->next = bind_list; } else { priority_receiver = bind_list; } return bind_list; } static void guts_add_element(t_oreceive_proxy*bind_list, t_bind_element*element) { /* insert the object according to it's priority * this is already the right queue */ t_float priority=element->priority; t_bind_element*elements=bind_list->elements, *last=0; debug_post("priority insert of %x:%g", element, priority); if(!elements || elements->priority >= priority) { bind_list->elements = element; element->next = elements; debug_post("inserting in the beginngin"); return; } debug_post("trying %x:%g", elements, elements->priority); while(elements && elements->priority < priority) { debug_post("skipping %x:%g to %x", elements, elements->priority, elements->next); last=elements; elements=elements->next; } debug_post("inserting after %x:%g", last, (last ? (last->priority):0)); debug_post("inserting befor %x:%g", elements, (elements?(elements->priority):0)); element->next=elements; if(last) { last->next = element; } else { bug("\nlast object invalid when inserting prioritized receiver\n"); } } static void pd_bind_priority(t_pd*x, t_symbol*key, t_float priority) { t_oreceive_proxy*bind_list=0; t_bind_element*element=0; debug_post("trying to bind '%s':%g via %x", key->s_name, priority, priority_receiver); bind_list=guts_find_key(key); if(!bind_list) bind_list=guts_add_key(key); if(!bind_list)return; element=getbytes(sizeof(*element)); element->object=x; element->priority=priority; element->next=0; guts_add_element(bind_list, element); } static void pd_unbind_priority(t_pd*x, t_symbol*key) { t_oreceive_proxy*list=0, *last=0; t_bind_element*elements=0, *lastlmn=0; debug_post("trying to unbind '%s' from %x", key->s_name, priority_receiver); for(list=priority_receiver; list && list->key!=key; list=list->next){ last=list; } if(!list)return; for(elements=list->elements; elements && elements->object != x; elements=elements->next) { lastlmn=elements; } if(elements) { /* found it, now remove it */ if(lastlmn) { lastlmn->next=elements->next; } else { list->elements=elements->next; } elements->object=0; elements->priority=0; elements->next=0; freebytes(elements, sizeof(*elements)); } else { // not here... } if(0==list->elements) { // should we unbind ?? if(last) { last->next=list->next; } else { priority_receiver=list->next; } pd_unbind(&list->p_obj.ob_pd, list->key); list->next=0; list->key=0; pd_free(&list->p_obj.ob_pd); } } /* -------------------- oreceive ------------------------------ */ typedef struct _oreceive { t_object x_obj; t_symbol *x_sym; t_float x_priority; t_inlet*x_symin,*x_fltin; } t_oreceive; static void oreceive_anything(t_oreceive *x, t_symbol *s, int argc, t_atom *argv); static void oreceive_proxy_anything(t_oreceive_proxy*p, t_symbol*s, int argc, t_atom*argv) { t_bind_element*elements=p->elements; debug_post("proxy anything: %x", p); while(elements) { t_pd*o=elements->object; elements=elements->next; if(o) { oreceive_anything((t_oreceive*)o, s, argc, argv); } } } /* ------------------------------------------------------------- */ static void oreceive_anything(t_oreceive *x, t_symbol *s, int argc, t_atom *argv) { outlet_anything(x->x_obj.ob_outlet, s, argc, argv); } static void oreceive_priority(t_oreceive *x, t_float p) { x->x_priority=p; if(x->x_sym) { pd_unbind_priority(&x->x_obj.ob_pd, x->x_sym); pd_bind_priority(&x->x_obj.ob_pd, x->x_sym, x->x_priority); } } static void oreceive_name(t_oreceive *x, t_symbol*s) { if(x->x_sym) { pd_unbind_priority(&x->x_obj.ob_pd, x->x_sym); } x->x_sym=s; pd_bind_priority(&x->x_obj.ob_pd, x->x_sym, x->x_priority); } static void *oreceive_new(t_symbol *s, t_float priority) { t_oreceive *x = (t_oreceive *)pd_new(oreceive_class); x->x_symin = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_symbol, &s_symbol); x->x_fltin = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, &s_float); x->x_sym = s; x->x_priority = priority; pd_bind_priority(&x->x_obj.ob_pd, s, priority); outlet_new(&x->x_obj, 0); return (x); } static void oreceive_free(t_oreceive *x) { pd_unbind_priority(&x->x_obj.ob_pd, x->x_sym); } void oreceive_setup(void) { iemguts_boilerplate("[oreceive] (ordered receive)", 0); oreceive_class = class_new(gensym("oreceive"), (t_newmethod)oreceive_new, (t_method)oreceive_free, sizeof(t_oreceive), CLASS_NOINLET, A_DEFSYM, A_DEFFLOAT, 0); class_addcreator((t_newmethod)oreceive_new, gensym("r"), A_DEFSYM, A_DEFFLOAT, 0); class_addsymbol(oreceive_class, oreceive_name); class_addmethod(oreceive_class, (t_method)oreceive_priority, &s_float, A_FLOAT, 0); oreceive_proxy_class = class_new(0, 0, 0, sizeof(t_oreceive_proxy), CLASS_NOINLET | CLASS_PD, 0); class_addanything(oreceive_proxy_class, oreceive_proxy_anything); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/propertybang.c000066400000000000000000000044641277446453700244700ustar00rootroot00000000000000 /****************************************************** * * propertybang - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2010 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to make an abstraction "property" aware * usage: * + put this object into an abstraction * + put the abstraction in a patch * + you can now right-click on the abstraction and select the "properties" menu * + selecting the "properties" menu, will send a bang to the outlet of this object * * nice, eh? */ #include "iemguts-objlist.h" #include "g_canvas.h" /* ------------------------- propertybang ---------------------------- */ static t_class *propertybang_class; typedef struct _propertybang { t_object x_obj; } t_propertybang; t_propertiesfn s_orgfun=NULL; static void propertybang_free(t_propertybang *x) { removeObjectFromCanvases((t_pd*)x); } static void propertybang_bang(t_propertybang *x) { outlet_bang(x->x_obj.ob_outlet); } static void propertybang_properties(t_gobj*z, t_glist*owner) { t_iemguts_objlist*objs=objectsInCanvas((t_pd*)z); if(NULL==objs) { s_orgfun(z, owner); } while(objs) { t_propertybang*x=(t_propertybang*)objs->obj; propertybang_bang(x); objs=objs->next; } } static void *propertybang_new(void) { t_propertybang *x = (t_propertybang *)pd_new(propertybang_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); t_class *class = ((t_gobj*)canvas)->g_pd; t_propertiesfn orgfun=NULL; outlet_new(&x->x_obj, &s_bang); orgfun=class_getpropertiesfn(class); if(orgfun!=propertybang_properties) s_orgfun=orgfun; class_setpropertiesfn(class, propertybang_properties); addObjectToCanvas((t_pd*)canvas, (t_pd*)x); return (x); } void propertybang_setup(void) { iemguts_boilerplate("[propertybang]", 0); propertybang_class = class_new(gensym("propertybang"), (t_newmethod)propertybang_new, (t_method)propertybang_free, sizeof(t_propertybang), CLASS_NOINLET, 0); class_addbang(propertybang_class, propertybang_bang); s_orgfun=NULL; } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/receivecanvas.c000066400000000000000000000074001277446453700245630ustar00rootroot00000000000000 /***************************************************** * * receivecanvas - implementation file * * copyleft (c) 2009, IOhannes m zmölnig * * forum::für::umläute * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to receive messages to upstream canvases * by default it receives messages to the containing canvas, but you can give the "depth" as argument; * e.g. [receivecanvas 1] will receive messages to the parent of the containing canvas */ /* NOTES: * it would be _really_ nice to get all the messages that are somehow "sent" to a (parent) object, * no matter whether using typedmess() or using sendcanvas() * this would require (however) to overwrite and proxy the classmethods for canvas which is a chore * * currently this objects only gets the messages from typedmess()... */ #include "iemguts.h" #include "g_canvas.h" #include static t_class *receivecanvas_class, *receivecanvas_proxy_class; typedef struct _receivecanvas_proxy { t_object p_obj; t_symbol*p_sym; t_clock *p_clock; struct _receivecanvas*p_parent; } t_receivecanvas_proxy; typedef struct _receivecanvas { t_object x_obj; t_receivecanvas_proxy*x_proxy; } t_receivecanvas; /* ------------------------- receivecanvas proxy ---------------------------- */ static void receivecanvas_anything(t_receivecanvas *x, t_symbol*s, int argc, t_atom*argv); static void receivecanvas_proxy_anything(t_receivecanvas_proxy *p, t_symbol*s, int argc, t_atom*argv) { if(p->p_parent) receivecanvas_anything(p->p_parent, s, argc, argv); } static void receivecanvas_proxy_free(t_receivecanvas_proxy *p) { if(p->p_sym) pd_unbind(&p->p_obj.ob_pd, p->p_sym); p->p_sym=NULL; clock_free(p->p_clock); p->p_clock=NULL; p->p_parent=NULL; pd_free(&p->p_obj.ob_pd); p=NULL; } static t_receivecanvas_proxy*receivecanvas_proxy_new(t_receivecanvas *x, t_symbol*s) { t_receivecanvas_proxy*p=NULL; if(!x) return p; p=(t_receivecanvas_proxy*)pd_new(receivecanvas_proxy_class); p->p_sym=s; if(p->p_sym) { pd_bind(&p->p_obj.ob_pd, p->p_sym); } p->p_parent=x; p->p_clock=clock_new(p, (t_method)receivecanvas_proxy_free); return p; } /* ------------------------- receivecanvas ---------------------------- */ static void receivecanvas_anything(t_receivecanvas *x, t_symbol*s, int argc, t_atom*argv) { outlet_anything(x->x_obj.ob_outlet, s, argc, argv); } static void receivecanvas_free(t_receivecanvas *x) { if(x->x_proxy) { x->x_proxy->p_parent = NULL; clock_delay(x->x_proxy->p_clock, 0); } } static void *receivecanvas_new(t_floatarg f) { t_receivecanvas *x = (t_receivecanvas *)pd_new(receivecanvas_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_proxy=NULL; if(canvas) { char buf[MAXPDSTRING]; snprintf(buf, MAXPDSTRING-1, ".x%lx", (t_int)canvas); buf[MAXPDSTRING-1]=0; x->x_proxy=receivecanvas_proxy_new(x, gensym(buf)); } outlet_new(&x->x_obj, 0); return (x); } void receivecanvas_setup(void) { iemguts_boilerplate("[receivecanvas]", 0); receivecanvas_class = class_new(gensym("receivecanvas"), (t_newmethod)receivecanvas_new, (t_method)receivecanvas_free, sizeof(t_receivecanvas), CLASS_NOINLET, A_DEFFLOAT, 0); receivecanvas_proxy_class = class_new(0, 0, 0, sizeof(t_receivecanvas_proxy), CLASS_NOINLET | CLASS_PD, 0); class_addanything(receivecanvas_proxy_class, receivecanvas_proxy_anything); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/savebangs.c000066400000000000000000000105321277446453700237160ustar00rootroot00000000000000 /****************************************************** * * propertybang - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object outputs a bang when the savfn of the parent abstraction is called */ /* * LATER sketch: * monkey-patching the parent canvas so that stores a local function table * then modify this function-table so that the savefn points to us * on call: we call the parents savefunction and output bangs */ /* * TODO: how does this behave in sub-patches? * -> BUG: the depth should _really_ refer to the abstraction-depth * else we get weird duplicates (most likely due to the "$0" trick */ #include "iemguts-objlist.h" #include "g_canvas.h" /* ------------------------- helper methods for savefunctions ---------------------------- */ typedef struct _savefuns { t_class*class; t_savefn savefn; struct _savefuns *next; } t_savefuns; static t_savefuns*s_savefuns=0; static t_savefn find_savefn(const t_class*class) { t_savefuns*fun=s_savefuns; if(0==s_savefuns || 0==class) return 0; for(fun=s_savefuns; fun; fun=fun->next) { if(class == fun->class) { return fun->savefn; } } return 0; } static void add_savefn(t_class*class) { if(0!=find_savefn(class)) { return; } else { t_savefuns*sfun=getbytes(sizeof(*sfun)); sfun->class=class; sfun->savefn=class_getsavefn(class); sfun->next=0; if(0==s_savefuns) { s_savefuns=sfun; } else { t_savefuns*sfp=s_savefuns; while(sfp->next) sfp=sfp->next; sfp->next = sfun; } } } /* ------------------------- savefunctions ---------------------------- */ static void orig_savefn(t_gobj*z, t_binbuf*b) { t_class*class=z->g_pd; t_savefn savefn=find_savefn(class); if(savefn) { savefn(z, b); } } static void savebangs_bangem(t_iemguts_objlist*objs, int pst); static void savebangs_savefn(t_gobj*z, t_binbuf*b) { /* z is the parent abstraction; * we maintain a list of all [savebangs] within a parent, in order to call all of them */ t_iemguts_objlist*obj=objectsInCanvas((t_pd*)z); savebangs_bangem(obj, 0); orig_savefn(z, b); savebangs_bangem(obj, 1); } /* ------------------------- savebangs ---------------------------- */ static t_class *savebangs_class; typedef struct _savebangs { t_object x_obj; t_outlet *x_pre, *x_post; t_canvas *x_parent; } t_savebangs; static void savebangs_bangs(t_savebangs*x, int pst) { if(!pst) outlet_bang(x->x_pre); else outlet_bang(x->x_post); } static void savebangs_bangem(t_iemguts_objlist*objs, int pst) { while(objs) { t_savebangs*x=(t_savebangs*)objs->obj; savebangs_bangs(x, pst); objs=objs->next; } } static void savebangs_mysavefn(t_gobj*z, t_binbuf*b) { t_savebangs*x=(t_savebangs*)z; int doit=(!x->x_parent); if(doit)savebangs_bangs(x, 0); orig_savefn(z, b); if(doit)savebangs_bangs(x, 1); } static void *savebangs_new(t_floatarg f) { t_savebangs *x = (t_savebangs *)pd_new(savebangs_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); t_class *class = 0; int depth=(int)f; if(depth<0)depth=0; if(depth) { depth--; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } if(canvas) { class=((t_gobj*)canvas)->g_pd; add_savefn(class); class_setsavefn(class, savebangs_savefn); x->x_parent=canvas; } else { x->x_parent=0; } addObjectToCanvas((t_pd*)canvas, (t_pd*)x); } x->x_post=outlet_new(&x->x_obj, &s_bang); x->x_pre=outlet_new(&x->x_obj, &s_bang); return (x); } static void savebangs_free(t_savebangs *x) { /* unpatch the parent canvas */ removeObjectFromCanvases((t_pd*)x); } void savebangs_setup(void) { iemguts_boilerplate("[savebangs]", 0); savebangs_class = class_new(gensym("savebangs"), (t_newmethod)savebangs_new, (t_method)savebangs_free, sizeof(t_savebangs), CLASS_NOINLET, A_DEFFLOAT, 0); add_savefn(savebangs_class); class_setsavefn(savebangs_class, savebangs_mysavefn); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/sendcanvas.c000066400000000000000000000035061277446453700240750ustar00rootroot00000000000000 /****************************************************** * * sendcanvas - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to send messages to upstream canvases * by default it sends messages to the containing canvas, but you can give the * "depth" as argument; * e.g. [sendcanvas 1] will send messages to the parent of the containing canvas */ #include "iemguts.h" #include "g_canvas.h" int glist_getindex(t_glist *x, t_gobj *y); /* ------------------------- sendcanvas ---------------------------- */ static t_class *sendcanvas_class; typedef struct _sendcanvas { t_object x_obj; t_pd *x_pd; } t_sendcanvas; static void sendcanvas_anything(t_sendcanvas *x, t_symbol*s, int argc, t_atom*argv) { if(0==x->x_pd) return; typedmess(x->x_pd, s, argc, argv); } static void sendcanvas_free(t_sendcanvas *x) { x->x_pd=0; } static void *sendcanvas_new(t_floatarg f) { t_sendcanvas *x = (t_sendcanvas *)pd_new(sendcanvas_class); t_glist *glist=(t_glist *)canvas_getcurrent(); t_canvas *canvas=(t_canvas*)glist_getcanvas(glist); int depth=(int)f; if(depth<0)depth=0; while(depth && canvas) { canvas=canvas->gl_owner; depth--; } x->x_pd = (t_pd*)canvas; return (x); } void sendcanvas_setup(void) { iemguts_boilerplate("[sendcanvas]", 0); sendcanvas_class = class_new(gensym("sendcanvas"), (t_newmethod)sendcanvas_new, (t_method)sendcanvas_free, sizeof(t_sendcanvas), 0, A_DEFFLOAT, 0); class_addanything(sendcanvas_class, (t_method)sendcanvas_anything); } iemguts-v0.2.1-fbfcf54548e8852ef9ad164f906c608187822ed0/src/try.c000066400000000000000000000037411277446453700225670ustar00rootroot00000000000000 /****************************************************** * * try - implementation file * * copyleft (c) IOhannes m zmölnig * * 2007:forum::für::umläute:2007 * * institute of electronic music and acoustics (iem) * ****************************************************** * * license: GNU General Public License v.2 (or later) * ******************************************************/ /* * this object provides a way to create an object with a fallback * [try bla 13, blu 134] will first try to create an obect [bla 13] and if this fails use [blu 134] instead. * * currently this only works for objectclasses (no abstractions) * currently this doesn't work (well) with [list] */ #include "iemguts.h" #include "g_canvas.h" int glist_getindex(t_glist *x, t_gobj *y); /* ------------------------- try ---------------------------- */ static t_class *try_class; typedef struct _try { t_object x_obj; } t_try; typedef t_pd *(*t_newgimme)(t_symbol *s, int argc, t_atom *argv); t_pd*try_this(int argc, t_atom*argv) { t_symbol*s=NULL; if(!argc)return NULL; s=atom_getsymbol(argv); if(A_SYMBOL==argv->a_type) { argc--; argv++; } //startpost("[%s] (%x): ", s->s_name, s); postatom(argc, argv); endpost(); t_newgimme fun=(t_newgimme)zgetfn(&pd_objectmaker, s); if(fun) { //post("found a creator for [%s]", s->s_name); return fun(s, argc, argv); } return NULL; } static void *try_new(t_symbol*s, int argc, t_atom*argv) { t_pd*x=NULL; int start=0, i=0; if(!pd_objectmaker) { error("[try] could not find pd_objectmaker"); return NULL; } for(i=0; i