pax_global_header00006660000000000000000000000064142210645350014514gustar00rootroot0000000000000052 comment=7fc425cc526d2520a8ddf458fc65015959503b5f hcs-0.2.1/000077500000000000000000000000001422106453500122715ustar00rootroot00000000000000hcs-0.2.1/ISOdate-help.pd000066400000000000000000000011251422106453500150330ustar00rootroot00000000000000#N canvas 0 31 393 252 10; #X msg 139 82 bang; #X symbolatom 138 156 0 0 0 0 - - -; #X text 49 29 output the current date in ISO format; #X obj 139 114 ISOdate; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control; #X text 12 45 DESCRIPTION output the current date in ISO format; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 symbol; #X restore 332 217 pd META; #X connect 0 0 3 0; #X connect 3 0 1 0; hcs-0.2.1/ISOdate.pd000066400000000000000000000007041422106453500141070ustar00rootroot00000000000000#N canvas 0 31 462 310 10; #X obj 93 84 zexy/date -----------; #X obj 93 31 inlet; #X obj 93 58 bang; #X obj 93 229 outlet; #X obj 93 175 pack float symbol symbol; #X obj 93 202 zexy/makesymbol %s-%s-%s; #X obj 118 129 makefilename %02d; #X obj 247 129 makefilename %02d; #X connect 0 0 4 0; #X connect 0 1 6 0; #X connect 0 2 7 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 4 0 5 0; #X connect 5 0 3 0; #X connect 6 0 4 1; #X connect 7 0 4 2; hcs-0.2.1/ISOtime-help.pd000066400000000000000000000011251422106453500150540ustar00rootroot00000000000000#N canvas 0 31 362 237 10; #X msg 139 82 bang; #X symbolatom 138 156 0 0 0 0 - - -; #X obj 139 114 ISOtime; #X text 49 29 output the current time in ISO format; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control; #X text 12 45 DESCRIPTION output the current time in ISO format; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 symbol; #X restore 302 212 pd META; #X connect 0 0 2 0; #X connect 2 0 1 0; hcs-0.2.1/ISOtime.pd000066400000000000000000000017401422106453500141310ustar00rootroot00000000000000#N canvas 0 31 470 318 10; #X obj 93 31 inlet; #X obj 93 58 bang; #X obj 93 229 outlet; #N canvas 0 22 462 312 addzero 0; #X obj 186 38 inlet; #X obj 191 255 outlet; #X obj 188 102 moses 10; #X obj 244 187 zexy/makesymbol %s; #X obj 65 187 zexy/makesymbol 0%s; #X connect 0 0 2 0; #X connect 2 0 4 0; #X connect 2 1 3 0; #X connect 3 0 1 0; #X connect 4 0 1 0; #X restore 136 135 pd addzero; #N canvas 0 22 462 312 addzero 0; #X obj 186 38 inlet; #X obj 191 255 outlet; #X obj 188 102 moses 10; #X obj 244 187 zexy/makesymbol %s; #X obj 65 187 zexy/makesymbol 0%s; #X connect 0 0 2 0; #X connect 2 0 4 0; #X connect 2 1 3 0; #X connect 3 0 1 0; #X connect 4 0 1 0; #X restore 216 135 pd addzero; #X obj 93 84 zexy/time -----------; #X obj 93 175 pack float symbol symbol; #X obj 93 202 zexy/makesymbol %s:%s:%s; #X connect 0 0 1 0; #X connect 1 0 5 0; #X connect 3 0 6 1; #X connect 4 0 6 2; #X connect 5 0 6 0; #X connect 5 1 3 0; #X connect 5 2 4 0; #X connect 6 0 7 0; #X connect 7 0 2 0; hcs-0.2.1/LICENSE.txt000066400000000000000000001045131422106453500141200ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state 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 3 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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 Lesser General Public License instead of this License. But first, please read . hcs-0.2.1/Makefile000066400000000000000000000035261422106453500137370ustar00rootroot00000000000000# Makefile to build class 'helloworld' for Pure Data. # Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build # settings and rules. # library name lib.name = hcs # input source file (class name == source file basename) class.sources = \ canvas_name.c \ ce_path.c \ classpath.c \ colorpanel.c \ cursor.c \ folder_list.c \ group.c \ helppath.c \ passwd.c \ screensize.c \ setenv.c \ split_path.c \ sql_query.c \ stat.c \ sys_gui.c \ uname.c \ unsetenv.c \ version.c \ window_name.c \ $(empty) # list all pd objects (i.e. myobject.pd) files here, and their helpfiles will # be included automatically abstractions = \ ISOdate.pd \ ISOtime.pd \ ascii2int.pd \ autoscale.pd \ blocksize_in_ms.pd \ debounce.pd \ debug.pd \ embed.pd \ file_type.pd \ float2ascii.pd \ get-audio-dialog.pd \ get-midi-dialog.pd \ gid2group_name.pd \ group_name2gid.pd \ hostname.pd \ make-audio-dialog.pd \ mouse_region.pd \ noquit.pd \ pi.pd \ pointer_position.pd \ pwm.pd \ pwm~.pd \ split_my_msgs.pd \ square~.pd \ tcl_version.pd \ tkconsole.pd \ tremolo~.pd \ uid2username.pd \ username2uid.pd \ $(empty) # standard supplementary files datafiles = $(lib.name)-meta.pd README.txt LICENSE.txt # example patches and related files, in the 'examples' subfolder datadirs = examples # some Tcl/Tk files datafiles += colorpanel.tcl cursor.tcl # For objects that only build on certain platforms, add those to class.sources # line for the right platforms. define forLinux datafiles += README-ifeel.txt class.sources += ifeel.c endef datafiles += \ $(class.sources:%.c=%-help.pd) \ $(empty) datafiles += \ $(abstractions) \ $(abstractions:%.pd=%-help.pd) \ $(empty) # include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' PDLIBBUILDER_DIR=pd-lib-builder/ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder hcs-0.2.1/README-ifeel.txt000066400000000000000000000007771422106453500150640ustar00rootroot00000000000000 You need the iFeel linux kernel module from http://sourceforge.net/projects/tactile in order to use this external. The iFeel mouse uses periodic pulses to create the various haptic effects. ------------------------------------------------------------------------------ control type raw range pd range ------------------------------------------------------------------------------ strength of pulse 1-255 0 - 1 delay between pulses 1-255 0 - infinite milliseconds number of pulses 1-255 0 - infinite hcs-0.2.1/README.txt000066400000000000000000000032001422106453500137620ustar00rootroot00000000000000 The 'hcs' library is a random grabbag of objects that are experiments that sometimes lead to full-fledged libraries. ==== TODO ==== - pddate compare object - make ISOdate and ISOtime accept pddate format - rename [folder_list] to [file/match] and make other file lib objects - make [file/match] handle lists of patterns - make [file/match] behave like [qlist] - [cursor] object - based on [MouseState] and/or [gcanvas] - inlet to control the mouse cursor icon (pointer, X, text select, etc) - mDNS objects! - add pan objects to audio basics library - create math library - standard constants like Pi, etc. - standard math functions - create networking library - socket objects - multicast DNS objects - create mapping library - move [hid] toolkit objects into mapping lib - sort thru Cyrille's ds_ objects - objects for smoothing sensor data - create i/o library - add hid, comport, platform-specific hid, libusb, midi - convert [hid] to libhid - write [directinput] - [serial] - port numbering on darwin: number /dev/cu.* sequentially - perhaps specific objects for sensorboxs like the arduino, multio, etc - create standard gui objects lib (what's the name?) - dsp - pan - amp - create support lib for creating objects in Pd - *_argument objects - rename blocksize_in_ms to block_size_in_ms - how about "foundation" or "class" or "support" ifeel.c ------------------------------------------------------------------------ - make default device be /dev/input/ifeel0 when there are no arguments - add abort command ( http://moore.cx/dan/out/ifeel/ http://inebriated-innovation.org/ifeel/ ) hcs-0.2.1/ascii2int-help.pd000066400000000000000000000021201422106453500154240ustar00rootroot00000000000000#N canvas 0 26 462 276 10; #X floatatom 253 143 5 0 0 0 - - -; #X obj 241 191 ascii2int; #X msg 305 168 bang; #X msg 192 168 bang; #X text 20 169 output current value -2; #X text 343 168 <-- reset; #X floatatom 241 220 0 0 0 0 - - -; #X obj 241 117 int; #X text 38 28 convert a stream of ASCII digits to a single int value ; #X msg 242 63 49 52 57 32; #X msg 138 63 53 56 49 50 1; #X obj 241 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 241 95 zexy/drip 500; #N canvas 404 246 494 344 META 0; #X text 12 135 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 115 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control conversion abstraction; #X text 12 45 DESCRIPTION convert a stream of ASCII digits to a single int value; #X text 12 75 INLET_0 float; #X text 12 95 OUTLET_0 float; #X restore 412 256 pd META; #X connect 1 0 6 0; #X connect 2 0 1 1; #X connect 3 0 1 0; #X connect 6 0 11 0; #X connect 7 0 0 0; #X connect 7 0 1 0; #X connect 9 0 12 0; #X connect 10 0 12 0; #X connect 12 0 7 0; hcs-0.2.1/ascii2int.pd000066400000000000000000000023121422106453500145010ustar00rootroot00000000000000#N canvas 0 31 490 433 10; #X obj 206 298 +; #X obj 176 320 float; #X obj 206 160 trigger float bang; #X obj 222 259 float; #X obj 222 278 * 10; #X obj 303 286 float; #X msg 179 220 0; #X text 212 222 <-- reset for the next pot reading; #X obj 68 57 moses 48; #X obj 206 111 - 48; #X obj 119 76 moses 58; #X obj 106 140 bang; #X obj 106 160 purepd/once; #X obj 176 345 outlet; #X obj 16 36 route bang float symbol; #X obj 16 7 inlet; #X obj 327 12 inlet; #X text 286 12 reset; #X obj 327 34 trigger bang bang; #X obj 16 270 bang; #X text 244 404 released under the GNU GPL; #X text 27 390 (C) Copyright 2006 Hans-Christoph Steiner ; #X text 25 366 TODO: make it support negative numbers; #X connect 0 0 1 1; #X connect 0 0 5 0; #X connect 1 0 13 0; #X connect 2 0 0 0; #X connect 2 1 3 0; #X connect 3 0 4 0; #X connect 4 0 0 1; #X connect 5 0 3 1; #X connect 6 0 3 1; #X connect 8 0 11 0; #X connect 8 1 10 0; #X connect 9 0 2 0; #X connect 9 0 12 1; #X connect 10 0 9 0; #X connect 10 1 11 0; #X connect 11 0 12 0; #X connect 12 0 6 0; #X connect 12 0 1 0; #X connect 14 0 19 0; #X connect 14 1 8 0; #X connect 15 0 14 0; #X connect 16 0 18 0; #X connect 18 0 11 0; #X connect 18 1 12 1; #X connect 19 0 1 0; hcs-0.2.1/autoscale-help.pd000066400000000000000000000041601422106453500155250ustar00rootroot00000000000000#N canvas 0 26 462 532 10; #X floatatom 26 88 5 0 0 0 - - -; #X floatatom 26 152 0 0 0 0 - - -; #X obj 68 270 autoscale; #X obj 2 2 cnv 15 450 20 empty empty autoscale 2 11 1 18 -233017 -66577 0; #X msg 418 3 pddp; #X text 18 35 [autoscale] scales a stream of numbers based on an output range set as arguments \, and an input range which is set dynamically. ; #X text 13 193 If you use [autoscale] with no arguments \, then the output range defaults to 0-127.; #X floatatom 68 249 5 0 0 0 - - -; #X obj 71 293 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X text 17 453 (C) Copyright 2004 Hans-Christoph Steiner ; #X text 234 467 released under the GNU GPL; #X floatatom 150 152 0 0 0 0 - - -; #X floatatom 297 152 0 0 0 0 - - -; #X obj 213 83 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X text 17 486 $Revision: 1.5 $$Date: 2006-03-17 04:50:03 $; #X text 18 499 $Author: eighthave $; #X text 25 336 The [reset( message resets the stored max and min to zero.; #X floatatom 46 360 5 0 0 0 - - -; #X obj 71 413 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X msg 96 358 reset; #X obj 26 122 autoscale 0 1; #X obj 150 122 autoscale -0.01 0.01; #X obj 297 122 autoscale -4095 4095; #X obj 68 390 autoscale; #N canvas 356 214 494 344 META 0; #X text 12 235 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 215 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control conversion; #X text 12 45 DESCRIPTION scale a stream of numbers based on an output range set as arguments; #X text 12 95 INLET_1 float; #X text 12 75 INLET_0 float reset; #X text 12 115 INLET_2 float; #X text 12 135 INLET_3 float bang; #X text 12 155 OUTLET_0 float; #X text 12 175 OUTLET_1 float; #X text 12 195 OUTLET_2 float; #X restore 403 501 pd META; #X floatatom 71 168 5 0 0 0 - - -; #X connect 0 0 20 0; #X connect 2 0 8 0; #X connect 7 0 2 0; #X connect 13 0 21 0; #X connect 13 0 22 0; #X connect 17 0 23 0; #X connect 19 0 23 0; #X connect 20 0 1 0; #X connect 21 0 11 0; #X connect 22 0 12 0; #X connect 23 0 18 0; hcs-0.2.1/autoscale.pd000066400000000000000000000042071422106453500146010ustar00rootroot00000000000000#N canvas 0 31 773 542 10; #X obj 45 30 inlet; #X obj 175 453 outlet; #X obj 235 268 f; #X text 262 268 min; #X text 360 269 max; #X obj 454 167 f \$1; #X obj 652 167 f \$2; #X obj 235 245 moses 0; #X obj 320 245 moses 0; #X obj 175 102 trigger float float float bang bang; #X obj 175 390 expr (($f1 - $f2) * (($f5 - $f4) / ($f3 - $f2))) + $f4 ; #X obj 326 205 oneshot; #X obj 364 226 f; #X obj 320 178 t f b f; #X obj 241 205 oneshot; #X obj 279 226 f; #X obj 235 178 t f b f; #X obj 384 269 + 1e-09; #X obj 478 213 ==; #X obj 478 233 sel 1; #X obj 545 77 loadbang; #X obj 478 299 print [autoscale]; #X floatatom 472 189 5 0 0 0 - - -; #X obj 545 100 t b b; #X obj 454 329 expr if ($f1 == $f2 \, 0 \, $f1) \; if ($f1 == $f2 \, 127 \, $f2); #X msg 478 278 using default range (0-127); #X obj 478 256 oneshot; #X text 2 476 (C) Copyright 2004 Hans-Christoph Steiner ; #X text 219 491 released under the GNU GPL; #X text 417 475 $Revision: 1.5 $$Date: 2004-11-28 20:50:14 $; #X text 417 488 $Author: eighthave $; #X obj 45 62 route reset; #X obj 45 81 bang; #X msg 45 129 0; #X msg 114 102 clear; #X text 172 47 these [oneshot] bits are just here to get the max/min tracking started; #X text 8 3 [autoscale]; #X connect 0 0 31 0; #X connect 2 0 7 1; #X connect 2 0 10 1; #X connect 5 0 18 0; #X connect 5 0 22 0; #X connect 5 0 24 0; #X connect 6 0 18 1; #X connect 6 0 24 1; #X connect 7 0 2 0; #X connect 8 1 17 0; #X connect 9 0 10 0; #X connect 9 1 16 0; #X connect 9 2 13 0; #X connect 9 3 5 0; #X connect 9 4 6 0; #X connect 10 0 1 0; #X connect 11 0 12 0; #X connect 12 0 8 1; #X connect 13 0 8 0; #X connect 13 1 11 0; #X connect 13 2 12 1; #X connect 14 0 15 0; #X connect 15 0 7 1; #X connect 16 0 7 0; #X connect 16 1 14 0; #X connect 16 2 15 1; #X connect 17 0 8 1; #X connect 17 0 10 2; #X connect 18 0 19 0; #X connect 19 0 26 0; #X connect 20 0 23 0; #X connect 23 0 5 0; #X connect 23 1 6 0; #X connect 24 0 10 3; #X connect 24 1 10 4; #X connect 25 0 21 0; #X connect 26 0 25 0; #X connect 31 0 32 0; #X connect 31 1 9 0; #X connect 32 0 33 0; #X connect 32 0 34 0; #X connect 33 0 2 0; #X connect 33 0 12 0; #X connect 34 0 14 0; #X connect 34 0 11 0; hcs-0.2.1/blocksize_in_ms-help.pd000066400000000000000000000017371422106453500167260ustar00rootroot00000000000000#N canvas 0 26 474 344 10; #X obj 5 2 cnv 15 450 20 empty empty blocksize_in_ms 2 11 1 18 -233017 -66577 0; #X msg 422 3 pddp; #X text 27 270 (C) Copyright 2004 Hans-Christoph Steiner ; #X text 244 284 released under the GNU GPL; #X obj 152 157 blocksize_in_ms; #X msg 152 115 bang; #X text 197 117 bang to recalculate; #X floatatom 152 210 7 0 0 1 ms - -; #X text 18 36 Output the current blocksize in ms rather than samples. This is currently set at a fixed blocksize of 64 \, but it will change dynamically in the future.; #N canvas 484 26 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION output current blocksize in ms; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 float; #X text 12 5 KEYWORDS control conversion abstraction; #X restore 412 310 pd META; #X connect 4 0 7 0; #X connect 5 0 4 0; hcs-0.2.1/blocksize_in_ms.pd000066400000000000000000000010241422106453500157650ustar00rootroot00000000000000#N canvas 0 22 458 308 10; #X obj 178 262 outlet; #X obj 164 31 inlet; #X obj 164 56 bang; #X text 209 31 bang to recalculate; #X obj 164 124 samplerate~; #X obj 178 192 /; #X msg 164 170 64; #X obj 164 151 t b f; #X text 30 170 default block size:; #X text 8 25 [blocksize_in_ms]; #X obj 178 229 * 1000; #X text 35 278 TODO: make blocksize read from actual Pd setting; #X connect 1 0 2 0; #X connect 2 0 4 0; #X connect 4 0 7 0; #X connect 5 0 10 0; #X connect 6 0 5 0; #X connect 7 0 6 0; #X connect 7 1 5 1; #X connect 10 0 0 0; hcs-0.2.1/canvas_name-help.pd000066400000000000000000000165231422106453500160260ustar00rootroot00000000000000#N canvas 178 98 493 398 10; #X obj 136 290 sys_gui; #X symbolatom 254 206 0 0 0 0 - - -; #X obj 241 145 loadbang; #X msg 136 260 \$2 configure -background \$1; #X obj 136 231 pack symbol symbol; #X obj 86 64 colorpanel; #X obj 67 356 pddp/pddplink http://tcl.tk/man/tcl8.5/TkCmd/canvas.htm ; #X text 34 330 for more options:; #N canvas 685 90 416 325 generate 0; #X obj 81 23 inlet; #X obj 82 262 outlet; #X obj 83 66 unpack float float float; #X obj 83 90 * 255; #X obj 83 113 int; #X obj 83 136 makefilename %x; #X obj 183 90 * 255; #X obj 183 113 int; #X obj 183 136 makefilename %x; #X obj 283 90 * 255; #X obj 283 113 int; #X obj 283 136 makefilename %x; #X obj 83 171 pack symbol symbol symbol; #X obj 83 195 zexy/makesymbol #%s%s%s; #X connect 0 0 2 0; #X connect 2 0 3 0; #X connect 2 1 6 0; #X connect 2 2 9 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 12 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 12 1; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 0 12 2; #X connect 12 0 13 0; #X connect 13 0 1 0; #X restore 86 85 pd generate web color; #X obj 86 20 bng 35 250 50 0 empty empty empty 17 7 0 10 -204786 -1 -1; #X symbolatom 106 113 10 0 0 0 - - -; #X obj 198 293 print; #X obj 241 182 canvas_name; #X msg 138 143 grey; #X msg 148 162 white; #X msg 158 183 pink; #X msg 162 205 black; #N canvas 660 76 459 460 get 0; #X symbolatom 42 225 0 0 0 0 - - -; #X obj 42 204 canvas_name; #X obj 42 181 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X symbolatom 126 225 0 0 0 0 - - -; #X obj 126 181 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 0 22 450 300 subname 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 107 137 canvas_name; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 126 204 pd subname; #X symbolatom 209 225 0 0 0 0 - - -; #X obj 209 181 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X symbolatom 73 118 0 0 0 0 - - -; #X obj 73 74 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 47 26 You can get the canvas name of other patches that this one is embedded in by setting the argument to the level:; #X obj 73 97 canvas_name 1; #X text 78 137 ^-- this is the same as the top level of this help patch ; #X symbolatom 299 225 0 0 0 0 - - -; #X obj 299 181 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 43 268 some more examples:; #X text 35 308 get the canvas name using a float message representing depth; #X obj 94 363 canvas_name; #X symbolatom 93 389 10 0 0 0 - - -; #X msg 78 335 0; #X msg 108 335 1; #N canvas 0 22 450 300 open 0; #N canvas 511 55 450 300 open 0; #X obj 131 37 inlet; #X obj 129 109 outlet; #N canvas 772 55 450 300 open 0; #X obj 131 37 inlet; #X obj 129 109 outlet; #N canvas 0 22 450 300 open 0; #X obj 141 47 inlet; #X obj 139 119 outlet; #X obj 143 84 canvas_name; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 128 76 pd open me; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 129 74 pd open me; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 138 87 pd open me; #X obj 141 47 inlet; #X obj 139 119 outlet; #X connect 0 0 2 0; #X connect 1 0 0 0; #X restore 260 382 pd open me; #N canvas 496 269 450 300 get_parent 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 canvas_name 1; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 209 204 pd get_parent; #N canvas 496 269 450 300 get_parent_of_parent 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 canvas_name 2; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 299 204 pd get_parent_of_parent; #N canvas 169 157 481 329 get-from-parent 0; #X symbolatom 114 120 0 0 0 0 - - -; #X obj 101 96 canvas_name 1; #X symbolatom 119 205 0 0 0 0 - - -; #X obj 84 66 loadbang; #X obj 106 181 canvas_name 0; #X symbolatom 43 204 0 0 0 0 - - -; #X obj 30 180 canvas_name; #N canvas 0 22 450 300 add 0; #X symbolatom 175 224 0 0 0 0 - - -; #X obj 162 200 canvas_name 1; #X symbolatom 264 224 0 0 0 0 - - -; #X obj 251 200 canvas_name 2; #X symbolatom 85 224 0 0 0 0 - - -; #X obj 175 101 loadbang; #X obj 72 200 canvas_name 0; #X text 59 28 Now 0 is this subpatch \, 1 is the "pd get from parent" subpatch that this subpatch is in \, and 2 is the "canvas_name-help.pd" patch.; #X connect 1 0 0 0; #X connect 3 0 2 0; #X connect 5 0 1 0; #X connect 5 0 3 0; #X connect 5 0 6 0; #X connect 6 0 4 0; #X restore 164 267 pd add another level; #X text 31 14 Following the interface of [getdir] and others \, you can get the canvas name from parent patches by using a float to represent how many levels up you want to get:; #X text 36 237 To see it in action with a 2nd level \, check this subpatch: ; #X text 189 204 <-- these two are the same since Pd inits to 0; #X text 187 119 <-- this gets the canvas name from the parent; #X connect 1 0 0 0; #X connect 3 0 1 0; #X connect 3 0 4 0; #X connect 3 0 6 0; #X connect 4 0 2 0; #X connect 6 0 5 0; #X restore 183 267 pd get-from-parent; #X symbolatom 260 406 10 0 0 0 - - -; #X obj 260 338 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144 -1 -1 0; #X floatatom 271 360 5 0 0 0 - - -; #X msg 139 335 2; #X text 121 429 .x0.c means a non-existent canvas; #X connect 1 0 0 0; #X connect 2 0 1 0; #X connect 4 0 5 0; #X connect 5 0 3 0; #X connect 7 0 22 0; #X connect 9 0 11 0; #X connect 11 0 8 0; #X connect 14 0 23 0; #X connect 17 0 18 0; #X connect 19 0 17 0; #X connect 20 0 17 0; #X connect 21 0 25 0; #X connect 22 0 6 0; #X connect 23 0 13 0; #X connect 26 0 21 0; #X connect 26 0 27 0; #X connect 28 0 17 0; #X restore 265 51 pd get from different levels; #N canvas 196 75 460 490 get 0; #X symbolatom 77 428 0 0 0 0 - - -; #X symbolatom 72 176 0 0 0 0 - - -; #X obj 72 132 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 220 77 namecanvas myname; #X symbolatom 73 99 0 0 0 0 - - -; #X obj 73 55 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 73 78 canvas_name myname; #X text 53 14 You can also use the canvas receive symbol to get the canvas_name:; #X obj 77 407 canvas_name; #X msg 129 376 pd-canvas_name-help.pd; #X symbolatom 71 275 0 0 0 0 - - -; #X obj 71 229 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 71 254 canvas_name pd-canvas_name-help.pd; #X text 65 213 this help patch:; #X text 49 302 or via the inlet:; #N canvas 0 22 450 300 getmyname 0; #X restore 250 155 pd getmyname; #X obj 72 155 canvas_name pd-getmyname; #X msg 79 351 myname; #X msg 64 325 symbol this_does_not_exist; #X msg 129 351 symbol pd-getmyname; #X text 91 459 .x0.c means a non-existent canvas; #X connect 2 0 16 0; #X connect 5 0 6 0; #X connect 6 0 4 0; #X connect 8 0 0 0; #X connect 9 0 8 0; #X connect 11 0 12 0; #X connect 12 0 10 0; #X connect 16 0 1 0; #X connect 17 0 8 0; #X connect 18 0 8 0; #X connect 19 0 8 0; #X restore 265 76 pd get by canvas receive symbol; #N canvas 410 155 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION get canvas id; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 symbol; #X text 12 5 KEYWORDS control canvas_op; #X restore 430 366 pd META; #X connect 2 0 12 0; #X connect 3 0 0 0; #X connect 3 0 11 0; #X connect 4 0 3 0; #X connect 5 0 8 0; #X connect 8 0 10 0; #X connect 8 0 4 0; #X connect 9 0 5 0; #X connect 12 0 1 0; #X connect 12 0 4 1; #X connect 13 0 4 0; #X connect 14 0 4 0; #X connect 15 0 4 0; #X connect 16 0 4 0; hcs-0.2.1/canvas_name.c000066400000000000000000000050741422106453500147160ustar00rootroot00000000000000#include #include #include #include #define DEBUG(x) static t_class *canvas_name_class; typedef struct _canvas_name { t_object x_obj; t_canvas *x_canvas; t_symbol *receive_name; t_int depth; } t_canvas_name; static t_symbol* make_canvas_symbol(t_canvas* canvas) { char buf[MAXPDSTRING]; snprintf(buf, MAXPDSTRING, ".x%lx.c", (long unsigned int)canvas); return gensym(buf); } static t_symbol* get_canvas_by_depth(t_canvas_name *x) { t_canvas *canvas = x->x_canvas; int depth = x->depth; if(depth<0)depth=0; while(depth && canvas) { canvas = canvas->gl_owner; depth--; } return make_canvas_symbol(canvas); } static t_symbol* get_canvas_by_name(t_canvas_name *x) { return make_canvas_symbol((t_canvas *)pd_findbyclass(x->receive_name, canvas_class)); } static t_symbol* get_canvas_name(t_canvas_name *x) { if(x->receive_name == &s_) return get_canvas_by_depth(x); else return get_canvas_by_name(x); } static void canvas_name_bang(t_canvas_name *x) { /* actually get the canvas name each time to make sure we get * accurate info in case of changes. If we cache the result, a * canvas could have been deleted or renamed. */ outlet_symbol(x->x_obj.ob_outlet, get_canvas_name(x)); } static void canvas_name_anything(t_canvas_name *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *first_symbol = atom_getsymbolarg(0,argc,argv); x->depth = 0; x->receive_name = &s_; if(s == &s_float) x->depth = (t_int) atom_getfloatarg(0,argc,argv); else if (first_symbol == &s_) x->receive_name = s; else x->receive_name = first_symbol; canvas_name_bang(x); } static void *canvas_name_new(t_symbol *s, int argc, t_atom *argv) { t_canvas_name *x = (t_canvas_name *)pd_new(canvas_name_class); t_glist* glist = (t_glist *)canvas_getcurrent(); x->x_canvas = (t_canvas *)glist_getcanvas(glist); t_symbol *tmp = atom_getsymbolarg(0,argc,argv); x->depth = 0; x->receive_name = &s_; if(tmp == &s_) x->depth = (t_int) atom_getfloatarg(0,argc,argv); else x->receive_name = tmp; outlet_new(&x->x_obj, &s_symbol); return(x); } void canvas_name_setup(void) { canvas_name_class = class_new(gensym("canvas_name"), (t_newmethod)canvas_name_new, NULL, sizeof(t_canvas_name), 0, A_GIMME, 0); class_addbang(canvas_name_class, (t_method)canvas_name_bang); class_addanything(canvas_name_class, (t_method)canvas_name_anything); } hcs-0.2.1/ce_path-help.pd000066400000000000000000000020221422106453500151430ustar00rootroot00000000000000#N canvas 0 26 423 338 10; #X declare -lib cyclone -lib zexy; #X msg 21 52 bang; #X symbolatom 32 170 0 0 0 0 - - -; #X obj 21 246 print; #X text 80 75 start at the top of the list again; #X msg 33 76 rewind; #X obj 21 129 ce_path; #X obj 61 150 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 81 148 done; #X text 68 51 get next item in list of canvas-local paths; #X text 29 269 Sending bangs to [ce_path] makes it output the loaded paths one at a time.; #N canvas 433 104 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control canvas_op; #X text 12 45 DESCRIPTION report canvas-local paths; #X text 12 65 INLET_0 bang rewind; #X text 12 85 OUTLET_0 symbol; #X text 12 105 OUTLET_1 bang; #X restore 372 316 pd META; #X obj 223 15 import cyclone zexy; #X connect 0 0 5 0; #X connect 4 0 5 0; #X connect 5 0 1 0; #X connect 5 0 2 0; #X connect 5 1 6 0; hcs-0.2.1/ce_path.c000066400000000000000000000060671422106453500140510ustar00rootroot00000000000000/* * This object allows you to see what is currently in the canvas-local path. */ #include #include #include #include #include #include /* WARNING: KLUDGE! */ /* * this struct is not publicly defined (its in g_canvas.c) so I need to * include this here. Its from Pd 0.41-test03 2006-11-19. */ struct _canvasenvironment { t_symbol *ce_dir; /* directory patch lives in */ int ce_argc; /* number of "$" arguments */ t_atom *ce_argv; /* array of "$" arguments */ int ce_dollarzero; /* value of "$0" */ t_namelist *ce_path; /* search path */ }; static char *version = "$Revision: 1.2 $"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ t_class *ce_path_class; typedef struct _ce_path { t_object x_obj; t_canvas *x_canvas; t_namelist *x_current; t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_ce_path; static void ce_path_output(t_ce_path* x) { DEBUG(post("ce_path_output");); char buffer[FILENAME_MAX]; /* TODO: think about using x->x_current->nl_next so that if [ce_path] is at * the end of its list, and another element gets added to the local * namespace, [ce_path] will output the new element on the next bang. */ if(x->x_current) { strncpy(buffer, x->x_current->nl_string, FILENAME_MAX-1); outlet_symbol( x->x_data_outlet, gensym(buffer)); x->x_current = x->x_current->nl_next; } else outlet_bang(x->x_status_outlet); } static void ce_path_rewind(t_ce_path* x) { t_canvasenvironment *e = canvas_getenv(x->x_canvas); x->x_current = e->ce_path; } static void *ce_path_new(t_floatarg f) { t_ce_path *x = (t_ce_path *)pd_new(ce_path_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; ce_path_rewind(x); x->x_data_outlet = outlet_new(&x->x_obj, &s_symbol); x->x_status_outlet = outlet_new(&x->x_obj, 0); return (x); } void ce_path_setup(void) { ce_path_class = class_new(gensym("ce_path"), (t_newmethod)ce_path_new, NULL, sizeof(t_ce_path), CLASS_DEFAULT, A_DEFFLOAT, 0); /* add inlet atom methods */ class_addbang(ce_path_class, (t_method) ce_path_output); /* add inlet selector methods */ class_addmethod(ce_path_class, (t_method) ce_path_rewind, gensym("rewind"), 0); logpost(NULL, 4, "[ce_path] %s", version); logpost(NULL, 4, "\tcompiled on "__DATE__" at "__TIME__ " "); logpost(NULL, 4, "\tcompiled against Pd version %d.%d.%d", PD_MAJOR_VERSION, PD_MINOR_VERSION, PD_BUGFIX_VERSION); } hcs-0.2.1/classpath-help.pd000066400000000000000000000020051422106453500155230ustar00rootroot00000000000000#N canvas 0 26 425 241 10; #X obj 40 130 classpath; #X msg 40 92 bang; #X obj 65 180 print; #X symbolatom 40 208 0 0 0 0 - - -; #X obj 101 155 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 19 22 This object returns each path in the global classpath one at a time with each bang. [reset( refreshs the classpath data and starts again at the top of the list \, like [textfile] or [qlist]'s [reset(.; #X text 124 154 <-- banged when the end of the list is reached; #X msg 82 92 rewind; #N canvas 435 26 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION report global class paths; #X text 12 65 INLET_0 bang rewind; #X text 12 85 OUTLET_0 symbol; #X text 12 105 OUTLET_1 bang; #X text 12 5 KEYWORDS control pd-op; #X restore 376 221 pd META; #X connect 0 0 2 0; #X connect 0 0 3 0; #X connect 0 1 4 0; #X connect 1 0 0 0; #X connect 7 0 0 0; hcs-0.2.1/classpath.c000066400000000000000000000111531422106453500144200ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* This object outputs the global search path for finding objects using a */ /* similar interface as [textfile] and [qlist]. */ /* */ /* Copyright (c) 2006 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #include #include #include /* #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #else #include #endif */ static char *version = "$Revision: 1.3 $"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *classpath_class; typedef struct _classpath { t_object x_obj; t_namelist *x_top; t_namelist *x_current; t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_classpath; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void classpath_output(t_classpath* x) { DEBUG(post("classpath_output");); /* TODO: think about using x->x_current->nl_next so that if [classlist] is at * the end of its list, and another element gets added to the global * classpath, [classpath] will output the new element on the next bang. */ if(x->x_current) { outlet_symbol( x->x_data_outlet, gensym(x->x_current->nl_string) ); x->x_current = x->x_current->nl_next; } else outlet_bang(x->x_status_outlet); } static void classpath_rewind(t_classpath* x) { DEBUG(post("classpath_output");); char buffer[MAXPDSTRING]; strncpy(buffer, sys_libdir->s_name, MAXPDSTRING - 6); strcat(buffer, "/extra"); x->x_top = namelist_append(NULL, buffer, 0); x->x_top->nl_next = STUFF->st_searchpath; x->x_current = x->x_top; } static void classpath_add(t_classpath* x, t_symbol *s) { DEBUG(post("classpath_add");); } static void *classpath_new() { DEBUG(post("classpath_new");); t_classpath *x = (t_classpath *)pd_new(classpath_class); x->x_data_outlet = outlet_new(&x->x_obj, &s_symbol); x->x_status_outlet = outlet_new(&x->x_obj, 0); classpath_rewind(x); return (x); } void classpath_free() { // TODO: look into freeing the namelist } void classpath_setup(void) { DEBUG(post("classpath_setup");); classpath_class = class_new(gensym("classpath"), (t_newmethod)classpath_new, 0, sizeof(t_classpath), 0, 0); /* add inlet datatype methods */ class_addbang(classpath_class,(t_method) classpath_output); /* add inlet message methods */ class_addmethod(classpath_class,(t_method) classpath_rewind, gensym("rewind"), 0); class_addmethod(classpath_class,(t_method) classpath_add,gensym("add"), A_DEFSYMBOL, 0); logpost(NULL, 4, "[classpath] %s",version); logpost(NULL, 4, "\twritten by Hans-Christoph Steiner "); logpost(NULL, 4, "\tcompiled on "__DATE__" at "__TIME__ " "); logpost(NULL, 4, "\tcompiled against Pd version %d.%d.%d", PD_MAJOR_VERSION, PD_MINOR_VERSION, PD_BUGFIX_VERSION); } hcs-0.2.1/colorpanel-help.pd000066400000000000000000000023171422106453500157050ustar00rootroot00000000000000#N canvas 0 26 472 323 10; #X obj 99 139 colorpanel; #X msg 99 56 bang; #X obj 112 198 pddp/print; #X obj 98 226 unpack float float float; #X obj 30 278 nbx 8 20 -1e+37 1e+37 0 0 empty empty red 0 28 0 14 -261234 -1 -1 0 256; #X obj 150 278 nbx 8 20 -1e+37 1e+37 0 0 empty empty green 0 28 0 14 -204786 -1 -1 0 256; #X obj 270 278 nbx 8 20 -1e+37 1e+37 0 0 empty empty blue 0 28 0 14 -203904 -1 -1 0 256; #X text 35 16 pop up a color picker and output the red \, green \, blue values as a list of three floats ranging from 0 to 1; #X text 129 177 the list:; #X text 202 78 or open the window with an initial color; #X msg 108 78 symbol #beefee; #X msg 160 107 0.5 0.5 0.5; #N canvas 442 194 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control GUI; #X text 12 45 DESCRIPTION graphical color chooser; #X text 12 65 INLET_0 bang symbol list; #X text 12 85 OUTLET_0 list; #X restore 422 302 pd META; #X connect 0 0 2 0; #X connect 0 0 3 0; #X connect 1 0 0 0; #X connect 3 0 4 0; #X connect 3 1 5 0; #X connect 3 2 6 0; #X connect 10 0 0 0; #X connect 11 0 0 0; hcs-0.2.1/colorpanel.c000066400000000000000000000061731422106453500146020ustar00rootroot00000000000000#include #include #include #include #include static t_class *colorpanel_class; typedef struct _colorpanel { t_object x_obj; t_symbol *x_s; char current_color[MAXPDSTRING]; } t_colorpanel; static void colorpanel_bang(t_colorpanel *x) { sys_vgui("after idle [list after 100 ::hcs::colorpanel::open %s %s]\n", x->x_s->s_name, x->current_color); } static void colorpanel_symbol(t_colorpanel *x, t_symbol *s) { strncpy(x->current_color, s->s_name, MAXPDSTRING); colorpanel_bang(x); } static void colorpanel_list(t_colorpanel *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *tmp_symbol = s; /* <-- this gets rid of the unused variable warning */ int i; unsigned int tmp_int; char color_buffer[3]; char color_string[MAXPDSTRING]; strncpy(color_string,"#",MAXPDSTRING); if(argc > 3) logpost(x, 2, "[colorpanel] warning more than three elements in list"); for(i=0; i<3; i++) { tmp_symbol = atom_getsymbolarg(i, argc, argv); if(tmp_symbol == &s_) { tmp_int = (unsigned int)(atom_getfloatarg(i, argc , argv) * 255); snprintf(color_buffer, 3, "%02x", (tmp_int > 255 ? 255 : tmp_int)); strncat(color_string, color_buffer, 3); } else { pd_error(x,"[colorpanel] symbols are not allowed in the color list"); return; } } memcpy(x->current_color, color_string, 7); colorpanel_bang(x); } static void colorpanel_callback(t_colorpanel *x, t_symbol *color) { t_atom output_atoms[3]; unsigned int red, green, blue; if(color != &s_) { strncpy(x->current_color, color->s_name, MAXPDSTRING); sscanf(x->current_color, "#%02x%02x%02x", &red, &green, &blue); SETFLOAT(output_atoms, (t_float) red / 255); SETFLOAT(output_atoms + 1, (t_float) green / 255); SETFLOAT(output_atoms + 2, (t_float) blue / 255); outlet_list(x->x_obj.ob_outlet, &s_list, 3, output_atoms); } } static void colorpanel_free(t_colorpanel *x) { pd_unbind(&x->x_obj.ob_pd, x->x_s); } static void *colorpanel_new( void) { char buf[MAXPDSTRING]; t_colorpanel *x = (t_colorpanel *)pd_new(colorpanel_class); sprintf(buf, "#%lx", (t_int)x); x->x_s = gensym(buf); pd_bind(&x->x_obj.ob_pd, x->x_s); outlet_new(&x->x_obj, &s_list); strcpy(x->current_color,"#ffffff"); return(x); } void colorpanel_setup(void) { colorpanel_class = class_new(gensym("colorpanel"), (t_newmethod)colorpanel_new, (t_method)colorpanel_free, sizeof(t_colorpanel), 0, 0); if (!colorpanel_class) return; class_addbang(colorpanel_class, (t_method)colorpanel_bang); class_addsymbol(colorpanel_class, (t_method)colorpanel_symbol); class_addlist(colorpanel_class, (t_method)colorpanel_list); class_addmethod(colorpanel_class, (t_method)colorpanel_callback, gensym("callback"), A_DEFSYMBOL, 0); sys_vgui("eval [read [open {%s/%s.tcl}]]\n", colorpanel_class->c_externdir->s_name, colorpanel_class->c_name->s_name); } hcs-0.2.1/colorpanel.tcl000066400000000000000000000003041422106453500151300ustar00rootroot00000000000000 namespace eval ::hcs::colorpanel:: { } proc ::hcs::colorpanel::open {objectid initialcolor} { set color [tk_chooseColor -initialcolor $initialcolor] pdsend "$objectid callback $color" } hcs-0.2.1/cursor-help.pd000066400000000000000000000063231422106453500150650ustar00rootroot00000000000000#N canvas 1 88 659 523 10; #X obj 388 293 pddp/pddplink http://tcl.tk/man/tcl8.5/TkCmd/cursors.htm ; #X text 273 276 Here's a complete list of the available cursors:; #X msg 441 124 dot; #X msg 518 124 gumby; #X msg 561 124 gobbler; #X msg 370 124 coffee_mug; #X msg 471 124 pirate; #X msg 42 44 runmode_nothing; #N canvas 0 22 462 312 make 0; #X obj 95 9 inlet; #X obj 114 258 outlet; #X obj 116 168 pack symbol symbol; #X obj 221 147 symbol; #X obj 94 51 symbol; #X obj 227 16 inlet; #X msg 116 192 set \$1 \$2; #X obj 115 220 trigger bang anything; #X connect 0 0 4 0; #X connect 2 0 6 0; #X connect 3 0 2 1; #X connect 4 0 2 0; #X connect 5 0 3 0; #X connect 6 0 7 0; #X connect 7 0 1 0; #X connect 7 1 1 0; #X restore 169 205 pd make message; #X msg 59 63 runmode_clickme; #X msg 75 82 runmode_thicken; #X msg 92 101 runmode_addpoint; #X msg 110 120 editmode_nothing; #X obj 169 266 cursor; #X text 342 238 <-- this is the actual message to send; #X text 15 18 set your mouse cursors for this patch:; #X text 279 309 Here are some pictures of the cursors:; #X obj 387 325 pddp/pddplink http://www.lehigh.edu/~sol0/ptk/cursors.gif ; #X msg 126 139 editmode_connect; #X msg 143 158 editmode_disconnect; #X msg 169 239 editmode_disconnect arrow; #X text 290 55 first pick a cursor:; #X text 189 80 <-- then choose your cursor mode; #X obj 46 390 cursor; #X msg 55 367 bang; #X obj 46 448 route x y; #X floatatom 33 472 5 0 0 0 x - -; #X floatatom 71 472 5 0 0 1 y - -; #X obj 46 342 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X floatatom 135 488 5 0 0 1 mousewheel - -; #X obj 46 414 route motion mousewheel button; #X text 65 339 turn on to get mouse motion and buttons; #X obj 164 440 route 1 2 3; #X obj 164 460 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 185 460 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 206 460 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X text 227 459 <-- mouse buttons; #X text 86 366 or bang to get the current mouse position; #N canvas 583 22 481 747 image 0; #X obj 240 373 moonlib/image examples/cursor.gif 0; #X restore 509 309 pd image of all cursors; #X msg 328 124 clock; #X msg 288 124 arrow; #N canvas 413 246 494 344 META 0; #X text 12 155 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 135 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION set mouse cursors for patch; #X text 12 65 INLET_0 runmode_nothing runmod_clickme runmode_thicken runmode_addpoint editmode_nothing editmode_connect editmode_disconnect ; #X text 12 115 OUTLET_0; #X text 12 5 KEYWORDS control canvas-op user_input; #X restore 600 498 pd META; #X connect 2 0 8 1; #X connect 3 0 8 1; #X connect 4 0 8 1; #X connect 5 0 8 1; #X connect 6 0 8 1; #X connect 7 0 8 0; #X connect 8 0 20 0; #X connect 9 0 8 0; #X connect 10 0 8 0; #X connect 11 0 8 0; #X connect 12 0 8 0; #X connect 18 0 8 0; #X connect 19 0 8 0; #X connect 20 0 13 0; #X connect 23 0 30 0; #X connect 24 0 23 0; #X connect 25 0 26 0; #X connect 25 1 27 0; #X connect 28 0 23 0; #X connect 30 0 25 0; #X connect 30 1 29 0; #X connect 30 2 32 0; #X connect 32 0 33 0; #X connect 32 1 34 0; #X connect 32 2 35 0; #X connect 39 0 8 1; #X connect 40 0 8 1; hcs-0.2.1/cursor.c000066400000000000000000000130051422106453500137510ustar00rootroot00000000000000/* TODO add reset method for cursor icons, this should probably be done in pd.tk, or cursor reset method could be done in help patch */ #include #include #include #include #include #include #define POLLTIME 10 static t_symbol *button_symbol; static t_symbol *mousewheel_symbol; static t_symbol *motion_symbol; static t_symbol *x_symbol; static t_symbol *y_symbol; static t_symbol *cursor_receive_symbol; t_int cursor_instances_polling; static t_class *cursor_class; typedef struct _cursor { t_object x_obj; t_int am_polling; t_symbol *receive_symbol; t_canvas *parent_canvas; t_outlet *data_outlet; // t_outlet *status_outlet; // not used (yet?) } t_cursor; static void cursor_setmethod(t_cursor *x, t_symbol *s, int argc, t_atom *argv) { sys_vgui("set ::cursor_%s \"%s\"\n", s->s_name, atom_getsymbol(argv)->s_name); canvas_setcursor(x->parent_canvas, 0); /* hack to refresh the cursor */ } static void cursor_bang(t_cursor *x) { sys_vgui("pdsend \"%s motion [winfo pointerxy .]\";\n", x->receive_symbol->s_name); } static void cursor_float(t_cursor *x, t_float f) { /* "bind all only gives data when over windows, so its commented * out. See the cursor_bang function to see the pointer x,y data getting */ if(f == 0) { if (x->am_polling) { x->am_polling = 0; cursor_instances_polling--; /* if no more objects are listening, stop sending the events */ if (cursor_instances_polling == 0) sys_gui("::hcs::cursor::stoppolling \n"); pd_unbind(&x->x_obj.ob_pd, cursor_receive_symbol); } } else { if ( ! x->am_polling) { x->am_polling = 1; pd_bind(&x->x_obj.ob_pd, cursor_receive_symbol); cursor_instances_polling++; /* if this is the first instance to start, set up Tcl binding and polling */ if (cursor_instances_polling == 1) sys_gui("::hcs::cursor::startpolling\n"); } } } static void cursor_button_callback(t_cursor *x, t_float button, t_float state) { t_atom output_atoms[2]; SETFLOAT(output_atoms, button); SETFLOAT(output_atoms + 1, state); outlet_anything(x->data_outlet, button_symbol, 2, output_atoms); } static void cursor_motion_callback(t_cursor *x, t_float x_position, t_float y_position) { t_atom output_atoms[2]; SETSYMBOL(output_atoms, x_symbol); SETFLOAT(output_atoms + 1, x_position); outlet_anything(x->data_outlet, motion_symbol, 2, output_atoms); SETSYMBOL(output_atoms, y_symbol); SETFLOAT(output_atoms + 1, y_position); outlet_anything(x->data_outlet, motion_symbol, 2, output_atoms); } static void cursor_mousewheel_callback(t_cursor *x, t_float f) { t_atom output_atom; SETFLOAT(&output_atom, f); outlet_anything(x->data_outlet, mousewheel_symbol, 1, &output_atom); } static void cursor_free(t_cursor *x) { cursor_float(x, 0); pd_unbind(&x->x_obj.ob_pd, x->receive_symbol); } static void *cursor_new(void) { char buf[MAXPDSTRING]; t_cursor *x = (t_cursor *)pd_new(cursor_class); x->parent_canvas = canvas_getcurrent(); sprintf(buf, "#%lx", (t_int)x); x->receive_symbol = gensym(buf); pd_bind(&x->x_obj.ob_pd, x->receive_symbol); x->data_outlet = outlet_new(&x->x_obj, 0); //x->status_outlet = outlet_new(&x->x_obj, 0); x->am_polling = 0; return(x); } void cursor_setup(void) { cursor_class = class_new(gensym("cursor"), (t_newmethod)cursor_new, (t_method)cursor_free, sizeof(t_cursor), 0, 0); if(!cursor_class) return; class_addbang(cursor_class, (t_method)cursor_bang); class_addfloat(cursor_class, (t_method)cursor_float); button_symbol = gensym("button"); mousewheel_symbol = gensym("mousewheel"); motion_symbol = gensym("motion"); x_symbol = gensym("x"); y_symbol = gensym("y"); //status_symbol = gensym("status"); cursor_receive_symbol = gensym("#hcs_cursor_class_receive"); class_addmethod(cursor_class, (t_method)cursor_button_callback, button_symbol, A_DEFFLOAT, A_DEFFLOAT, 0); class_addmethod(cursor_class, (t_method)cursor_motion_callback, motion_symbol, A_DEFFLOAT, A_DEFFLOAT, 0); class_addmethod(cursor_class, (t_method)cursor_mousewheel_callback, mousewheel_symbol, A_DEFFLOAT, 0); /* methods for setting the cursor icon */ class_addmethod(cursor_class, (t_method)cursor_setmethod, gensym("runmode_nothing"), A_GIMME, 0); class_addmethod(cursor_class, (t_method)cursor_setmethod, gensym("runmode_clickme"), A_GIMME, 0); class_addmethod(cursor_class, (t_method)cursor_setmethod, gensym("runmode_thicken"), A_GIMME, 0); class_addmethod(cursor_class, (t_method)cursor_setmethod, gensym("runmode_addpoint"), A_GIMME, 0); class_addmethod(cursor_class, (t_method)cursor_setmethod, gensym("editmode_nothing"), A_GIMME, 0); class_addmethod(cursor_class, (t_method)cursor_setmethod, gensym("editmode_connect"), A_GIMME, 0); class_addmethod(cursor_class, (t_method)cursor_setmethod, gensym("editmode_disconnect"), A_GIMME, 0); sys_vgui("eval [read [open {%s/%s.tcl}]]\n", cursor_class->c_externdir->s_name, cursor_class->c_name->s_name); sys_vgui("::hcs::cursor::setup %s\n", cursor_receive_symbol->s_name); } hcs-0.2.1/cursor.tcl000066400000000000000000000037751422106453500143260ustar00rootroot00000000000000 namespace eval ::hcs::cursor:: { variable continue_pollmotion 0 variable last_x 0 variable last_y 0 variable receive_symbol } # idea from #tcl for a Tcl unbind proc ::hcs::cursor::unbind {tag event script} { set bind {} foreach x [split [bind $tag $event] \"\n\"] { if {$x != $script} { lappend bind $x } } bind $tag $event {} foreach x $bind {bind $tag $event $x} } proc ::hcs::cursor::button {button state} { variable receive_symbol pdsend "$receive_symbol button $button $state" } proc ::hcs::cursor::mousewheel {delta} { variable receive_symbol pdsend "$receive_symbol mousewheel $delta" } proc ::hcs::cursor::motion {x y} { variable last_x variable last_y variable receive_symbol if { $x != $last_x || $y != $last_y} { pdsend "$receive_symbol motion $x $y" set last_x $x set last_y $y } } proc ::hcs::cursor::pollmotion {} { variable continue_pollmotion motion [winfo pointerx .] [winfo pointery .] if {$continue_pollmotion != 0} { after 10 ::hcs::cursor::pollmotion } } proc ::hcs::cursor::startpolling {} { variable continue_pollmotion 1 pollmotion bind all {+::hcs::cursor::button %b 1} bind all {+::hcs::cursor::button %b 0} bind all {+::hcs::cursor::mousewheel %D} } proc ::hcs::cursor::stoppolling {} { variable continue_pollmotion 0 unbind all {::hcs::cursor::button %b 1} unbind all {::hcs::cursor::button %b 0} unbind all {::hcs::cursor::mousewheel %D} } # in Pd 0.43, the internal proc changed from 'pd' to 'pdsend' proc ::hcs::cursor::setup {symbol} { variable receive_symbol $symbol # check if we are Pd < 0.43, which has no 'pdsend', but a 'pd' coded in C if {[llength [info procs "::pdsend"]] == 0} { pdtk_post "creating 0.43+ 'pdsend' using legacy 'pd' proc" proc ::pdsend {args} {pd "[join $args { }] ;"} } } hcs-0.2.1/debounce-help.pd000066400000000000000000000033321422106453500153310ustar00rootroot00000000000000#N canvas 0 26 470 540 10; #X obj 2 2 cnv 15 450 20 empty empty debounce 2 11 1 18 -233017 -66577 0; #X msg 418 3 pddp; #X text 234 467 released under the GNU GPL; #X text 17 486 $Revision: 1.2 $$Date: 2006-03-17 04:50:03 $; #X text 18 499 $Author: eighthave $; #X text 17 453 (C) Copyright 2005 Hans-Christoph Steiner ; #X obj 122 78 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 -1; #X obj 123 102 t b b; #X obj 123 142 delay; #X obj 63 121 bang; #X obj 122 202 tgl 35 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X floatatom 166 203 5 0 0 0 - - -; #X obj 122 271 tgl 35 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 123 166 random 2; #X msg 85 78 stop; #X obj 244 211 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 240 277 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 26 387 Right now \, it handles "floats" and "bangs". Everything else is converted to a "bang".; #X obj 152 122 random 1000; #X obj 237 247 debounce 900; #X obj 122 246 debounce 900; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filter; #X text 12 45 DESCRIPTION debounce; #X text 12 85 OUTLET_0 float bang; #X text 12 65 INLET_0 anything; #X restore 410 510 pd META; #X obj 249 62 namecanvas f; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 7 1 18 0; #X connect 8 0 9 0; #X connect 8 0 13 0; #X connect 8 0 15 0; #X connect 9 0 7 0; #X connect 10 0 20 0; #X connect 13 0 10 0; #X connect 13 0 11 0; #X connect 14 0 8 0; #X connect 15 0 19 0; #X connect 18 0 8 1; #X connect 19 0 16 0; #X connect 20 0 12 0; hcs-0.2.1/debounce.pd000066400000000000000000000012401422106453500143770ustar00rootroot00000000000000#N canvas 0 31 478 432 10; #X obj 38 43 inlet; #X obj 252 108 f \$1; #X obj 252 85 loadbang; #X obj 226 33 inlet; #X obj 251 132 select 0; #X text 274 34 delay between state change; #X obj 62 381 outlet; #X obj 61 325 f; #X text 298 152 set default; #X obj 246 189 send \$0-delay; #X obj 157 271 delay; #X obj 187 248 receive \$0-delay; #X text 80 31 float input; #X text 120 378 debounced float output; #X msg 250 152 10; #X obj 100 103 change; #X connect 0 0 7 1; #X connect 0 0 15 0; #X connect 1 0 4 0; #X connect 2 0 1 0; #X connect 3 0 9 0; #X connect 4 0 14 0; #X connect 4 1 9 0; #X connect 7 0 6 0; #X connect 10 0 7 0; #X connect 11 0 10 1; #X connect 14 0 9 0; hcs-0.2.1/debug-help.pd000066400000000000000000000007441422106453500146370ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 148 137 debug testing; #X text 31 46 a simple object to control the flow of print messages \, and label them.; #N canvas 329 160 494 344 META 0; #X text 12 105 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 85 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION debounce; #X text 12 65 INLET_0 anything; #X text 12 5 KEYWORDS control; #X restore 388 268 pd META; hcs-0.2.1/debug.pd000066400000000000000000000005421422106453500137050ustar00rootroot00000000000000#N canvas 0 31 278 181 10; #X obj 74 0 inlet; #X obj 1 4 tgl 15 0 empty ATORAT_DEBUG empty 14 8 1 8 -261440 -1 -1 0 1; #X obj 74 53 spigot; #X obj 74 113 print \$1; #X text 8 150 (C) Copyright 2004 Hans-Christoph Steiner; #X text 112 166 released under the GNU GPL; #X connect 0 0 2 0; #X connect 1 0 2 1; #X connect 2 0 3 0; #X coords 0 0 1 1 130 18 1; hcs-0.2.1/embed-help.pd000066400000000000000000000010041422106453500146130ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X text 119 127 [embed]; #X text 55 50 This object is used for hiding the Pd window when making an embedded app based on Pd.; #N canvas 329 160 494 344 META 0; #X text 12 95 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 75 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION hide the Pd window when making an embedded app based on Pd.; #X text 12 5 KEYWORDS control pd_op; #X restore 392 269 pd META; hcs-0.2.1/embed.pd000066400000000000000000000010211422106453500136640ustar00rootroot00000000000000#N canvas 103 147 450 300 10; #X msg 282 79 wm title .pdwindow "Error Log"; #X obj 69 37 trigger bang bang bang bang bang bang bang bang bang; #X msg 182 84 wm withdraw .pdwindow; #X msg 140 13 bang; #X obj 170 245 hcs/sys_gui; #X obj 35 75 hcs/window_name; #X msg 35 98 wm iconify \$1; #X msg 23 29 bang; #X obj 70 12 loadbang; #X connect 0 0 4 0; #X connect 1 0 5 0; #X connect 1 4 2 0; #X connect 1 8 0 0; #X connect 2 0 4 0; #X connect 3 0 1 0; #X connect 5 0 6 0; #X connect 6 0 4 0; #X connect 7 0 5 0; #X connect 8 0 1 0; hcs-0.2.1/examples/000077500000000000000000000000001422106453500141075ustar00rootroot00000000000000hcs-0.2.1/examples/changing_the_colors.pd000066400000000000000000000045011422106453500204330ustar00rootroot00000000000000#N canvas 231 465 735 462 10; #X declare -path ..; #X obj 133 416 hcs/sys_gui; #X msg 39 15 set canvas_fill green; #N canvas 0 22 492 479 default 0; #X obj 84 23 inlet; #X obj 74 366 outlet; #X obj 83 80 bang; #X msg 74 119 set canvas_fill "white" \, set text_color "#000" \, set select_color "#00f" \, set dash_outline "#f00" \, set dash_fill "#f7f7f7" \, set box_outline "#ccc" \, set graph_outline "#777" \, set atom_box_fill "#eee" \, set msg_box_fill "#f8f8f6" \, set obj_box_fill "#f6f8f8" \, set signal_cord_highlight "#58a" \, set signal_cord "#558" \, set signal_nlet $signal_cord \, set msg_cord_highlight "#474" \, set msg_cord "#565" \, set msg_nlet "white" \, set mixed_nlet "#88aaff"; #X connect 0 0 2 0; #X connect 2 0 3 0; #X connect 3 0 1 0; #X restore 271 387 pd default color scheme; #X msg 271 365 bang; #X msg 47 35 set text_color grey50; #X msg 67 76 set dash_color orange; #X msg 57 55 set select_color magenta; #X msg 79 95 set dash_fill green; #X msg 87 115 set box_outline yellow; #X msg 97 135 set graph_outline green; #X msg 107 155 set atom_box_fill green; #X text 268 47 changes don't always take effect immediately \, open a new window to see the changes.; #X msg 119 175 set msg_box_fill green; #X msg 127 195 set obj_box_fill grey50; #X msg 137 215 set signal_cord_highlight magenta; #X msg 159 255 set signal_nlet green; #X msg 167 275 set msg_cord_highlight yellow; #X msg 177 295 set msg_cord green; #X msg 187 315 set msg_cord_nlet green; #X msg 197 335 set mixed_nlet green; #X text 297 115 you can use X11 color names or web colors; #X obj 325 144 pddp/pddplink http://en.wikipedia.org/wiki/X11_color_names ; #X obj 326 164 pddp/pddplink http://en.wikipedia.org/wiki/Web_colors ; #X obj 362 225 pddp/pddplink http://wiki.tcl.tk/1424; #X text 352 185 more on using color with Tcl/Tk:; #X obj 362 207 pddp/pddplink http://wiki.tcl.tk/3538 -text color values available for syntactic use in Tcl scripts; #X msg 147 236 set signal_cord #ffbb00; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 2 0; #X connect 4 0 0 0; #X connect 5 0 0 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; #X connect 9 0 0 0; #X connect 10 0 0 0; #X connect 12 0 0 0; #X connect 13 0 0 0; #X connect 14 0 0 0; #X connect 15 0 0 0; #X connect 16 0 0 0; #X connect 17 0 0 0; #X connect 18 0 0 0; #X connect 19 0 0 0; #X connect 26 0 0 0; hcs-0.2.1/examples/cursor.gif000066400000000000000000000267051422106453500161250ustar00rootroot00000000000000GIF87aØäñÿÿÿÙÙÙ,ØäþŒ©Ëí£œ´Ú‹³Þ¼û†"”扦êʶî Ç®!×öçs ÷þЂĢ5<*—º$ó ÝE§T$¯Š:³\ã¶ þ}ÃdܸŒŽÓlÖº ?½ãñ9½m¿§óú2¿öØ%8˜UhX…˜8µÈåøÈ)©DYéu…‰v$ð¹ò)P§  ×É$º:Ê– uŠZ¶šR+;x‹7» öª*JšÆzBŒ«g||ÇìÊ 7 ÚêÌfœ¼»ÌL÷ ¼ý‹]ÍÜ, M~ǽN;->®þÝE^®ÜǾGߦÏÉ_ïš9pºæ{×ÎÂ} ŒwhÑ$ž“ǰºþy øKˆ,â¿^#!b´H¦ÙÇŒ ½<é`kY¢)·%I,êvÚè‰ãšÀ’7Ãå„ç“ Ð¤0–Ú¨Y3æ°•™*•iõˆÓ"Kt%³•k¥°YS-++Ú g× QëÖGÛµsÑÖ-{7k^«{™öMú×gàƒIîuxSbL‹ÇÂÛ„ßÑ“©TÎ!è² Í†¶Nã,©qhɞʀ®‘¹´àÇA=Òe ùÆ›Ó.h+±Ýô1îP€aSn¡Ò«ðÏ8?»ÖâHpãïb'$Ùè)]Ò'/7Qûóã¶œo§È9su¯Å‹­¼>Ü<öõ¶„{¤ê&ùfî(¶ºŸÝ¨{iÈþëíÏŸß~®íÄl§ßt € ˜]}Þ7àƒRÌg!~żw ƒ~8a…v(CXJ¸¡…õQ¨b\°hŠžÈiªÇ!{GÁˆ¢ŽéåÄヱØBj7jG^Š;’Hß4†ØdnOl·"qD’ç{ÈçC-1®¸!F×\0Ôyg™="¹^šÄ…ɤ â•)MqV²àåšI¶‰çtð­ Ú#22h"…ZC9Ûu-ú¤D&i‹Šyè ™²iê1B¨¢ŽJj©¦žŠjªª®Êj«®¾ k¬²ÎJk­¢6: —¸©ë®€öê«YÀ›±E|Zþ•±c*ËÖ°Ê"ë³b8k,´IkµÄZ«¶%j,·Hy+¸¾Š ¹?™»+º6©‹»¸*&‡á¤]½KÜ«ïU‰üyˆ¼:T*U5Zö»¯À›!\ã¿ Oªp T ]?ƒ1 Îé™nJ=R¬HÆ/Øcϸ/øp&SieÇ'£œò²îDkÉ_%rmßyš³ÄÇ“èšÇ‹º˜v»a¹#¶»b½3ö;£µ¿ànÝÃÿzü…É#¿<óÍ û¼œÁ3n³/°å×§Î2o)Nù½Tš}‰(Ç¿Œ¡ñF(Ýœ/¥Œo~æÀmÌü᫦ÂBÛK¾Æ¬_¾)ýO.ïÓÙ,óìy—±ÓLª„3×áKÝ Dö¤3Á½Çl jQ˜Aòí‰C•)S¾î×7µEèË XؾûeiI&T!}ÈÁbpl% ”ˆô$©â‡?Ôœ9Kcvr˜¸¤&1­YMlÚj›Üì¦7¿ ÎpŠsœä,§9ωÎWaÚÌ%¡Üi(xvFžg[gñ fÍ{F°ö¤'§ü)LjêÓ‚ý,(?šO€*.¡e(BþªÐdAcžÙ¨§Ýd·6¤Åsk%HGû·Ñs„È7G5Œf´zÌ|—Á>ª˜V¯e$¨F¤Ù:É4¦ÿ$x´qÒÙ$¨Óœ¨LWÖS·!’¨üêQgš8‰òt§3Rž˜ Ì‹ÒÍe´ˆÓJ5šÔ”’‘ø,Ý3÷i±'rµl*ýêóWØYFC¤œêžÊÖ×¹QVë^§@Kšº”hx]Þ½™Ç¿†n¤m¨Ç~ª&¬roªauÍì½ÃZG°iIÍúµÓO³—•l±<[Øä ´’a™\‡·ÚÎ:´—U,êb+ÄÙ6ö¡ÃÄíùxûËTد‚·¡#†þËÇßÈV9á*æúòÆÜÚÄÓ Úq][Óôý”˜Ò³Ù ×€žì.¯;ËòR§åj#GUV¹‡µtj–b¥58GvƒÐ„µ`ØHWªÕ>—\Z%ÙËI’¿7Œ#|›CpÀV«£»È;–1ˆúHÚpÆ 5ŽuÃ4 ‚Ø{ZÕd8Mu„Ù97î(ÃV$£÷´˜_úŒ…¿H£—Æ8†P‰ÁØ_w‰Ç8”e-cøàèîˆHN.*·hÜ.±”®$î™49_Û¸À\¶¡•;èÀ(G Ág¾ {éf_sÌ©D3aQ6˱½¥§i·þ ¢~ê¬Èd¡³®ü¹©†ÎkuÛg>7”®´¥/éLkzӜÉ)éÌF³ÏómÀ+êP—zÔ¢…-«_[;S‡LÕÍ“5tQ½jZöն圭 ½[HOZ×,•óyU·‘V'&k}leµæÜÖLÁumvÙô¨ìk/šÑÐÞ*ZÁJKc[wq¡Øö ,ÌÆDÓiÛÙ¤’ümgÓÜîDwY%Ál:g¶ik“Mï­±{²øN!¬aÁ2=û¬ ìõ[Ÿ]ìr³›_sKòÂ+‡]kÏ•%Ó8`?í[wûг&lÃ=ë]‚\Ü4]í-m2å°j²Óí5þX<1"+ε D˜—œ¤O±YõKê½ÆËÕh\….ò‰}ÎÈfö`ýóSŸß;âà©PÀ'ÂôxÓ–åJÆÚË«ýóØ‘Œ_':Ä/úöœë|â½CnÚ«÷Z«\¯4G¸tÎ×¼ïºê¡<0jkxxý:§ÃƵމ=Z^÷r‹‡„ä%›—û¾òΔßÝçªÝGo\½›w|0?_>õ›ñ~'.c#ºÀžˆ…z^Ã7­G]9Öd]ÏcH‹_8Ñ<įJB®æÖ¹ŠC;ë;?óE.8æKn±ß8cÞ$Vú{Vºz²Hfê›÷‹^¾£ô$•YÐÿ½r™Gè|>þ_Ü{¹ï•¶|êdÖ9ßü>°c_^¹oÿ·fûehâ= ¢EB–sÉ•IÔÖt'ln4•w~œ—r’@h,gˆ{˜kíôi#H‚%h‚'ˆ‚)¨‚+È‚ €·%yW÷x¦§Z1ˆz0ø‚¾fƒ[—j4y9Hy;(v=‚3X„ƒçƒ®„†Ó”„€uD«/EU>%xr÷Yò6bwmWhvSÇN#ç…×Da—$5†Šâu 5v`†JåW\¨†iX>Ì'‡ëPxI‡uoTtô’Zs8Vúvx7'ˆ—Xz(sw¸Qh†¶_„¨ˆGTämÛ…†U(wfbuWþl˜xç†üÂqž(z؆thI‘µ‰ShrløˆšHrÏ—‰Èg‰Vuµ¨SRÕURDwá†íæS|¨‹TèŠ/sG…È6‹ñt船ˆˆ]h‡ŸH.<'$Å'ƒî†‰]uˆÈ¨x»´FÖȃ­8ŒÓFve‚­U|½ø^Åh…Ùˆ„GXƒK˜ŒBȉDl÷hŠù(ø¸§‰R)îè}‰ôÓ¨Pœ±=”eè5ŽPEÒè-ƒöŒ'·ˆì¸‹7yuJÇr ¦~ f%ûÕ^·qbæ'%€ ØLëe€~Â5 v3è1a‰)uÇAÌH€ª÷}~;™}NrE R“Åå“Aþ^tH"5‹”>V†x”€6–!=I;ÿÖ!·hy­`Ö‘µw“@BW1æ^[Bnd²ØpPÆEÁ÷bö‘¿7”ViG8yA¡ ‚C‰È1å±çEEg¥’Ôt' ãö¨`Iãa9J°ä—•È+ñðImÇö¨˜Ù‰¿Hu—iR´è„ðøƒOˆƒ"Ø‚§‰š©©š«Éš­éš*(Ý›êÒ„+é™Fx›ï˜›ñHš:8›ù›I¥ØÅ©™ÇyŽ»9𢩄½9ˆÇÝ…B‘€x„mÑI’å1„Sj÷2V]õ¸™¿¸)’‰‹ ¡ŽØøáé þ|Šò‹9i }QY¼·'ÜÙrŸ‰žéÙmö©|–Ÿözb( Ä— C4e ÉRúŠóIŸÁè Ø‰ŸYsŠl)— Z‘z^£¡)ÅŸbé9j3çžk¶Ÿ`(aé¡÷‰Š ¢7˜¡u2£÷Y¢&ŠŽøqˆ·¢¼÷Ÿäéty†=ê£xSœ©ŒãŽþ¡KÁ)‰œù†‰(ZzÌ©¤ì™¥Vz¥Í©¥¥¦¾éœL8œ¬ˆ›™™œjª|kâ¢ÀT*f ©“‡¤Ì¸#:~¸÷¥÷wµ×¥é] 6ê§äe§ic~(•¢ا ©®—¤MS§ý—!*þ”j©2–2wÁ—hÆfFÚŸsJ 覦tHé¸3ÃW€ªŠyÚž2 — ¨e©ú˜Z%W´©šÇªP¸Dlthª“fÙ"Ì!FA ¬º7§Õ”Q%EÑ÷Hbp­W)!;Ò>Ûç–æX‘DFD…º{Oñ­Ò'’WfF¦/ãåATƈк®f3êzKìú¬‚ãWyÚ©Ló©0J‰ÚõÕ’¯zg›š«ï× ýò ÁQ°¥”^‹Ù¾7ªµê€ ›]n¦#Iz½Ê¦º¹Ky¦â·¦ê¹ž¾H ÜynC  ijœ!+j¯é²/ ³1+³3K³5Ke:R*-µylÊ ¦>»¥@þ+¦BK¦c„:Ë,<›|È©²L˱+Û´,+µQKµ±—‡Z}”¸£€SQ9jµ1*‰Ù‡*§µ 9¡èµú¶Ï¯þÚŒêF`:‹º§l²µmC¢>©CÖžXk i˶6'·?Š‘wºcñ·¶a;aƒëL~ø «˜Ú¸(K¤l¥B;·wgò¸æ…«’;´ :¥q·UY:…ë·Û’¹@깊º­;D4¶/a¶ˆq3™¸5Wº€ U.)ªYyn‹–]È`¹»>¤h¨J¯†K]î'º®K·¾:幊Cø ú5²„½2 ¸À¹¤^’½º½m:¾²I²„*¬·[¾þ4:©EK´G»¤Óë´¼i´fŠ´Ïò±)û´ó»œïk¿ŠK§Ù5¼Ä+¿©ç;âȤæ^5z¶YÀ“»¨Ì«•´»Ê3–,©ܨ뛵l¼Rfe–)¤® “t"q]ö»B%v„’·Ê•šSìЯÕX¹;“Û¯ Ù~l7®fÔfLf›a[ªJÙÃ5¼ Eà—ÂË ÄÚ”?™c¶K]óZD-f®.Ö³SŠ—_âÄmÛÀì‹Å„TÃ¥q—ÄÆKœ-Ç g°8°_`^ÅÄ£{•e\qT±AŒ¥–šf˜'2:”’&ü˜ kÀÂã ¤´´Ê½¸ã¥ùC¹YŒ \¥P{¼x‘þ¿G*Éô Q6«É›ÌÉìÉŸ Ê­r¿ÕRÉo;µû{ʘ¼±ª|Éý»Ê®ÜÊ?ûʲËA;˶\ËŸ›Ëî{˺̿Ëɦ¼{ aÕ›¼Ï©µL§ñ©Á<™HêÁÖ+¢¤äÌ€v»‘û¼º;u×þÞ ß ~×òý¿êM›ÞÜ îàŽÊyÕV…½ÐWÙ™­×ëEÈN7ÜÑ ÜÔ[»¥mRþ¬ÑÔãlËhÕ‘ ¥¾7ÖîœÚîÛ'¾ÏÉ=Òò0ãÀ¨žT‡;Îã«­}8m7„9ä4^Ÿ_MªÈä´­}#®Ù/·âIíT˜ˆ Úà³Y3.ŠŽëåèÒ@®vfŽåò3æm¾0|â?ºÖ\>ÓfícÎäG¯O~(u®æ æáÝãWÎÔ›—ëáGþäP>Óƒ~þÝ·äpî]“ä»”~¸ˆ»Ûß én剴çi´7Þâg®¨Q ‡>êmØèŽîQ˜>2rÚ™'ã®Ç*žæ,Þ°þ¶¨ê¼n.Õ ^Ðl¾èø+àí"ìÒáÄ~àÍá>ß½íb-®aζ®í¼‹Ä*Ùqa"¨Jå¶ÎíúÙ'¶½—‘ÞàîÐ 2[þÚ«Òt=àÈÆgZêK—+î}ô€‰ŽÈò®˜«G{õjçŽï¬¹)©ëÍÅpœâÍ‹”b,CÀJ•ˆ©¼Åkðs©«žéØÇeØê®3â±èøðíx=á çíó‡^_%þêFN’º“èøSã‘ïõ,-ëD^ùì}Bù”%åœ?ú1\5™Z›ßÞ¬ïµ~ù¦ûãàâæŽê&ïã¡ÒµӮϒ ØÒ+ûsnËoû9>¹ÂoõÝUüÇþø¾OnÀÿåÒˆoÃûŒº¥o—Ûoê•nýÀ\2þª?‹¹>ì©Ò??ùá¿q¥•ý~ÑöR½È_þ–oüz÷ÇïÖâäoø‰Oð1u¹EZ”“ÆjÖéuïh³‹<ÑT•ÌÕ}aªéžmíÛŸ0'q?áЂ!‘ˆ`’™[6 "IÊxV±©k–»ÙvÁ“o˜¼—цsº¼f‡Ýïn\ž¥×«w›ÔásõVø'þþ’ñß3¨:9È%+)# §,ós"C4OF‡NiT0+Jû¢XeaQWý&£¦8g‡\) o¡€ SA‰¥twqs•[C_ isŸ—›c³e7kOŠ=­¨˜I?¹‰À}`uËO©þ¥÷(Í·Ùú Èí…Ôëwq²$‚`3l &¤ñOÒ9õ)̶ÏÛ † –ík‘c'vU\|¸É!¾†ãÉ«‘±¤ÆŽc¹„1†È–ù^~×Oå±{#sRÜéká¼U½°•Z©?£)˜E]ún”0’o<…Õš.Ie©Eë4~¼z|‰4]ÙF€Ü¾ÅbÓ'\¹J‰Ååò! Ý»ßôþàl¬Ó½ à ü‰_Æ^?î)yÎË—1gÖ¼™sgÏŸA‡=štiÓ§Q§V½šukׯaÇ–=›vmÛ·qçÖ½›woß”Á8.&òðÂ7@žÜLqæ/–?Wâ\zþHêÕQDÇ®½:wéÞŸƒg.>9yãæ‡£®ž2{ÉîÃg,ÿ/ý»öåâ«¿EøËaƒ½Šˆj¾¼n¥ÑÏ+#ƒ‡´©, ##©þ,G:ŒaB¾ ›¬ -ÔðªÿBœf)9ÜÛ¡KZܣļ$ ˆÃ»¹¦]СSÔpD™ˆq’qä1)¡hÌ,!+´KÅp~¸ôÐB/þ=²Ò&Ñ,¤S'ÔMK|ÕO 1ÍU45ðL4m°U ¢ÉWZ1=ÕÀ_MiØ7#ÕÐß$ÖÔUCX]a½Ì0¥å[<¥ÑXn±kÌZ¨¨5¬TCË0UU'-×DfC•·-{ïÅW]}Yå×Ósåõë ¸ÞºdÅë¦hüí·áj†x˜@YÚh„k¸\ƒÚ:·;×*Yká*Ý 8v–²“yœµPb9+t×ò±)mØ’hdtÂr¼´Vœ‰«]“©J,›û”²gMš)^FMB4'˜ÎrZÇ«­>ùg;r´gNÂéªÝÜÙ–TÉ´Ú]`£~«Šþ»¦úë¸Ç%® *³~†gpÅ6¨aG­[âwõYcrõôûè¦L¾ùŽÝ¶în€ŒŽyqM‘ JíÆo67â¢>Ï8ô°3ÿÎeÓGÿ8uŸAVzÖÕ%‡,Ùg§0ßpÏ]÷ÝyïÝ÷ß^øá‰/Þøã‘'ÍvÀ–o¹ùRŽöy ¢_vz”O/ûñ¶/¯ûó¾O/üõÆo¯ü÷Î/ýùÖ¯¯ýûÞÏ/þýæßñzìïÇ?»÷g¡~ûç¿A}ëu'rÝ¿ HÀµ5‵K ¥-ú… lˆc`³³¾ ŒV¼T ö?¤ÐHè¨à¼Jh?\yk`"¤™×Á=Á0v¸þÚ ³@•^‚ž{`³¤gC„P†=#"(”­uÑÐ"í;¡‰À: Q‰¥Ú!¯˜H::õhXLâ± Œª±ˆWŒ¢ §DHåðÊZc ¥(%"qM$Ü‹ÞÆN‡W‚{£w¶‚Œ{L€’(’Å&*â‰ÔV#QhH5¤/-Š\dq(ÄfY².Ìäa8YCf…riVô&I|J~ª\eù¼AJxD®<$-UæÊê=M—¸,d/mÉÇ`Nr˜Äü‹,•ãK땎{†RNFTñ0sdf ZyÍ›‘L#2›#*4 œƒ»ãÑÅTmn„dþæîʽЎªÚœXzÅÎÎòjQëG¯øw‹”Ä#c;ÆL#M{T¾¤‰³y>žÆÊ 2ºÅQ›­Â¹ ‰vmJ’R‹GzaåSn…èäFÚP—F3Y;A5:µOÎ*Áò£1'¦Q²õs§íT¤v4÷“M¢3•a¬ÕXQ{ºSMe\ä ÊÐ<ŽñF"¹)NeZŠÔœÉ@ÍÇ6Ú™§Så¦6ÁwNô© íâ[]ÇB¢zªr—Ô4d_“<Á–°…5ìa›XÅ.–±ml1ؽJR²¤¬2yÉWÌúu•í¢f!ëÙS´w fþi¥ ZÒnV— -k'ûWØZV¶¯µíiÀ#ŽS™Åk­r;Àànq·šÜ [_éÌ© W®{k-q?Ïb!÷–Ê=u“K¯qv…Ñ­ë¡ [&ä*´Ý$A'ô¦ôŽxC¨xÅ&.nÒ´3Mm™;^®…×¼}ÛY?ûÛãb·ºKŒªo¿ë^¢ö÷š Íï»Ö«ÅÊ·–L«HÕ Ó˜ø­â´ï­Yáó‚÷§Þl¡dËÐË»R|UR"Užûr0pµchTµWcG–lÓÎMï˜r´˜±¡fË™ê]PŒ Ô·“V¥†RêšÄ)õŒm´a¿!J¬Ö ‹íÈiU&-iÞøl…_‘{Ø}¦›Ú$wë¤Ø§²ªÐ&-ïåuÚÖðš¯íªëî©¥ènÛEÓRQŒDÙËõ6Vò‚¯Îh¥ã86çDþ·RSÜÒÃ8—éêN^ŽØ’5¦‹à¡y—œŸ{›’%·–è?«OÔÞc2¹ƒ$»>w8ð}EzÖp½œtÖ±šïüZÇ.éMwúÓ¡u©OêK¿mÒí¬ç¬ÛÒè‚FºÖ±v°ëx6mÙ¯Nv9«]µbGûÖ×þv·Ç½MQÕ•±ÌæHçYïf¤”ßé…wlï8ÇGÇ+üî.ø¾ÓÒ5•˜f7'Xñ†ãìø¬^y@¨d0Œ t9 Y¥’Ÿ|éMßÃ{ÞðL#}é Úøx">,‡|ï •¿zÐÖü ë½>úÛ]îVü¹êÑ&ûΚ]ô0®äµ‘=þńǻøÕïòó+ùéGœøt<öÏó<€]÷¡&G=ü-_lw-Ü©üò3?óïG¢ˆÝßý¶çùi·þþÿÏþøoþüÏûêÎOà°Äæ.m÷*íåïô åꬹ@eššJ]M|`m-fŽï§Í2!ÕÈOÃJ„ýJ Ø:°™p› з/à$®WN3pA.ndtHär誊Sàæ ˆÂ¸M×L0™6oŸÞkã„­pv¦ù!¼.P1HÖ¬ªûiÖd$†Dáo(f¢ óDÉçļ.*m6¥jlÒí *WîÝ ŽÛÔÐ ËÍÚ$å ÅþšÖDòÜ0!Ì0»<ÞxðÝZªý6€ßŠê%ØÐÝx*ëdI â&Š£1¬¶‹MÎû-ïtÞ¦ÂØ‚L¦B‘;Å/6Ér¦é‰MíZ‚Ðâ¶kÅÊp°‰«2h moÐånQÕ,ŽH¾Êß”0YŠ1«|0ÐÂ3± ©‡þ*pßÌ[/mkŒÃüBv. ½±“º½Æñì Pÿ°ìªîá1åqé±íñ{§pûþÚ‘ ÐÙq ûqîöñ ÿ! 2 2!r!¹Q ÷‡`ÂÏ….’ðO»"Žxï·:”B2ò6òûï#þ¬ið‘ ÏH%Wò%9O˾è¯&£/þޝù2§VðNûrO„1ø¤iIp2Ó)(iA÷FR¡°Oý"E*UD)ïÏ*#Å([ )²½žrr°R¹´r&õÑ)_¯(¿².Æ’*+R(™2&Í’-l-Qry€2-5-,»«gv²þ 2ùÎÒùúòE²sÛr)õ’%–H$*ëÒvî20A’2±Úäò~&33ÑÊ2ãk+Q"²+'¬$r"ð/óÇü~ð4GÔ¶Oïýe d$*oñàj÷S%ðiÑÑ¡6õâ6“ÚOã@ðDcóÓ’“þ6ùÅ6]Ä÷Ž0w³åX¹è »"ØxfÖÒéàNÓ » …° Á3 õç”b'vqrÖ“<‘pÉ £-píCm5‘sJÚêpÛ ‘1Qâþ‡ eBË$'sñU´ïÛ@Í!oîd?¡asŽÄ@³ÀJq@ECëmW‘ G1åÌEï0 ï¡§&)cO‘“F®âBp£jÔûPc†ê¤Þ nОâ8‰MB#Í+ºªF¼“Ö–´¥±×^Ôy6îJs” ‰ÑK?>[´BKDùíq¶dLq沉·Þ”4¯çÒñK•”ºÐ”Pþ­DCó¬Nâ(a´!US3µ‘(³uQµQõQ!5Rƒ§, uN5I2" 5351ESSåtzXS8+UT/µ5’S]TSSUSõ5;u5³&MÓM¯“'‹ /• ðluœàô-›²ï<órsð~ÕW÷,û(éåŒ -íNÃhïs‘.”3û¦X«ì…ø´O§rZÏGÜ”ÕüU,¡ñóz/¡WÉIP¹¯3ÇuÄ0s6{]CS¡µX-ï}ÜSQ0§"óS]Á,8³'…f1yk_5%Õ\‰•`¶hxÁZ×õåõ2éu[”$µM»L;ÿuW{“Íþ€ˆ]¹•ªuXNG/,U–n•_+_Iñœöðe{gƒê]mbí5¢°*dɱavW˵9¿+fÖ¬QW%SƒdÓ&Ï•fÕ#4:-õ¶hƒh[öјkM•R]µTŸgT”UcÕPßa_5i‘UÓë8ã ö‘µ˜A©VЧÊ7«7#Ÿ¹!­‰q®ŒÙ9Xc™)¼°Æf‘—-w«wÔJær¡ø «ñ8ó@´w‘¬ —¿H¿lj é9}5ާ‚·ÙP5ìp1£(‘CMWA×Öÿ‰ · ß‘”p?\Ê{º´ÔpÑCJó“À޼G3AÛ gDA?J¢ÕíaŽA÷Û\ÞþºÏàœÞJ\É ±…kv·¼TÔxϼw·Mi¥ímsÿ-—w»ÍŽaÏǹyÒ¨™T*ñ¨—Zr÷Çíy‘ ár¼;ýGýÊvâÈ…¹™£¼}¯Wíû“÷7óJ§‘™o½z½±ÙÖ㜰5ܰïºÃÛz؉½ØýØ‘}êòØ-v0üuÛü“/ÜÃ3œÁ™}ÂQYÛ}Û;|Ù¿ý°7ü×Ã=ØÝÛÜ}8×—9–{Ï?“Їܲ“Å™ÞѼ]·sk[ÝùÝy]Ñ9NÑJ ܲɻµuœKWûÕ–?ý›» ÞOo(â‰Î…S(Ñã]DxvµþÕ[×Yàé<ït¹G…Ç×ÜjY˜½Í»¼3¾ÆM幋A¾‚[žæ)Þ:“ŠÞ3Ûâ)ûá¢äexçmâWÖ_>so~j‘ç@Ž~Ú[8E‰›Ûí9¹£]ºíÔéê!YÜ‘wÞ[±è©úoÅ~ì«ÜÏ=ƒÿÝÔ¥^Ú·]¹E¼ÙWçÙ‡ÝÉÞîSï¹Yî»Ùç9\»e<ïMžäû=ðË÷GណÖÄ]üïi¼¾ò°¦“ó_2£[:™Üˆdñ¿`nÝмIE¾LmÛ…4˜Cÿô¡ý¹§åòýÖ•“ÉÚÁøTõ¢BÙ‚öõ©YÍQ÷Ò{¿þ×)mJoÜJ÷mŸBMQ‘·al; Ÿ_ß“-ù½?ÕžÈA]¦‘M%LÎâ# ãL&‹ =ýqE©ê¨¶çå,Ö­¿ÇIí}³ŒÜÚ >¦.F0Œ’‰Z§¹xså:Š#™|%jiÓŠ¢§ËóÓ7.Û9ßw»/(ô<†Æ#À¡\2›Î'4*R«Ö+6«Ýr»Þ/8,“Ëæ3:­^³Ûî7<./"ë½9>¯ßóûb;`Žß a¡á¡Z â b£ã#$äâäK¤å%ff"%gˆæ'h¨¨Tg)Ç(jªj¤i«Ä*l¬lžë€Jéì.ooY-Âm«/q˱qppí1s3s²í²ó4µ,t†tµö6è5n6w¸¸£·ø8z:_ù¹ºû»»+<}ý&´ù¼ý>?˜üp¿€¯ü35ð Â'ׄLè0a²[ 9=¬8Ð0‹ùal·ñ#ºŽú@’ )²aÉ”Ü:å©ò¥6–'“À¬ÙŒÓDo6w”¯eË @¿ % ˆ'Ò^Z˜û‰ëgSlQ&­kiЩLD ŠÄ*XU>±E³¥ÁëPªa×v›Ù‰-\Mn߯­Ëj.%»z÷òí «;hcs-0.2.1/examples/move_pd_window.pd000066400000000000000000000021251422106453500174540ustar00rootroot00000000000000#N canvas 532 145 637 496 10; #X declare -path ..; #X symbolatom 247 208 0 0 0 0 - - -; #X obj 232 155 pack 0 0; #X text 72 -108 move the Pd window around; #X text 29 337 You can do lots of things using Tcl/Tk commands:; #X obj 328 338 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/wm.htm ; #X obj 246 130 trigger bang float; #X obj 53 -76 unauthorized/grid pdwin 200 0 800 150 0 600 0 4 5 10 10 65 -53; #X obj 232 186 zexy/makesymbol +%s+%s; #X obj 246 109 -; #X msg 246 86 600 \$1; #X text 412 234 "." means the Pd window; #X obj 232 259 pack symbol symbol; #X msg 232 281 wm geometry \$2 \$1; #X obj 337 238 symbol; #X msg 395 206 .; #X obj 395 182 loadbang; #X obj 471 205 hcs/window_name; #X obj 231 308 hcs/sys_gui; #X msg 471 181 bang; #X text 503 178 current window; #X connect 1 0 7 0; #X connect 5 0 1 0; #X connect 5 1 1 1; #X connect 6 0 1 0; #X connect 6 1 9 0; #X connect 7 0 0 0; #X connect 7 0 11 0; #X connect 8 0 5 0; #X connect 9 0 8 0; #X connect 11 0 12 0; #X connect 12 0 17 0; #X connect 13 0 11 1; #X connect 14 0 13 0; #X connect 15 0 14 0; #X connect 16 0 13 0; #X connect 18 0 16 0; hcs-0.2.1/file_type-help.pd000066400000000000000000000023601422106453500155250ustar00rootroot00000000000000#N canvas 0 26 422 304 10; #X obj 180 210 file_type; #X obj 181 41 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 -1; #X obj 181 59 openpanel; #X msg 203 118 symbol /usr/bin/gcc; #X obj 239 235 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 258 236 bang if no match; #X msg 206 142 symbol /dev/tty; #X obj 181 96 symbol; #X msg 141 76 bang; #X symbolatom 179 262 0 0 0 0 file_type - -; #X obj 207 185 folder_list; #X msg 207 166 symbol /tmp/ssh-*/agent.*; #X msg 83 148 symbol /usr; #X msg 25 129 symbol /tmp; #X text 16 10 find the file type of a file; #N canvas 392 173 494 344 META 0; #X text 12 144 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control symbol_op filesystem; #X text 12 45 DESCRIPTION find the file type of a file; #X text 12 65 INLET_0 symbol; #X text 12 85 OUTLET_0 symbol; #X text 12 105 OUTLET_1 bang; #X restore 372 282 pd META; #X connect 0 0 9 0; #X connect 0 1 4 0; #X connect 1 0 2 0; #X connect 2 0 7 0; #X connect 3 0 0 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 8 0 7 0; #X connect 10 0 0 0; #X connect 11 0 10 0; #X connect 12 0 0 0; #X connect 13 0 0 0; hcs-0.2.1/file_type.pd000066400000000000000000000020671422106453500146030ustar00rootroot00000000000000#N canvas 0 31 585 375 10; #X obj 28 8 inlet; #X obj 29 34 stat; #X obj 29 65 list; #X obj 29 85 list split 2; #X obj 29 105 list split 1; #X msg 10 235 fifo; #X obj 197 312 symbol; #X obj 197 333 outlet; #X msg 47 235 character; #X msg 121 235 folder; #X msg 175 235 block; #X msg 226 235 file; #X msg 268 235 symlink; #X msg 329 235 socket; #X msg 384 235 whiteout; #X obj 442 325 outlet; #X text 433 342 bang if no match; #X obj 69 140 & 61440; #X obj 35 178 route 4096 8192 16384 24576 32768 40960 49152 57344; #X obj 394 205 print [file_type]_ERROR; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 1 15 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 1 17 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 8 0 6 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 11 0 6 0; #X connect 12 0 6 0; #X connect 13 0 6 0; #X connect 14 0 6 0; #X connect 17 0 18 0; #X connect 18 0 5 0; #X connect 18 1 8 0; #X connect 18 2 9 0; #X connect 18 3 10 0; #X connect 18 4 11 0; #X connect 18 5 12 0; #X connect 18 6 13 0; #X connect 18 7 14 0; #X connect 18 8 19 0; hcs-0.2.1/float2ascii-help.pd000066400000000000000000000012321422106453500157420ustar00rootroot00000000000000#N canvas 0 26 392 273 10; #X obj 123 128 float2ascii; #X obj 126 71 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X symbolatom 123 188 10 0 0 0 - - -; #X floatatom 135 100 5 0 0 0 - - -; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control conversion; #X text 12 65 INLET_0 float; #X text 12 85 OUTLET_0 symbol; #X text 12 45 DESCRIPTION convert a float to ASCII; #X restore 342 252 pd META; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 1 0 3 0; hcs-0.2.1/float2ascii.pd000066400000000000000000000012521422106453500150160ustar00rootroot00000000000000#N canvas 0 31 491 429 10; #X obj 160 25 inlet; #X obj 160 47 int; #X obj 203 192 select 123 125; #X obj 160 70 moses 0; #X obj 295 233 outlet; #X obj 295 212 makefilename %c; #X msg 126 273 ASCII character \$1 is not allowed in Pd!!; #X msg 125 243 123; #X msg 155 243 125; #X obj 42 334 purepd/purepd_error float2ascii; #X obj 203 95 moses 128; #X msg 7 161 \$1 outside of ASCII range (0-127); #X connect 0 0 1 0; #X connect 1 0 3 0; #X connect 2 0 7 0; #X connect 2 1 8 0; #X connect 2 2 5 0; #X connect 3 0 11 0; #X connect 3 1 10 0; #X connect 5 0 4 0; #X connect 6 0 9 0; #X connect 7 0 6 0; #X connect 8 0 6 0; #X connect 10 0 2 0; #X connect 10 1 11 0; #X connect 11 0 9 0; hcs-0.2.1/folder_list-help.pd000066400000000000000000000042401422106453500160520ustar00rootroot00000000000000#N canvas 0 26 546 485 10; #X msg 19 73 bang; #X msg 27 355 bang; #X obj 64 300 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 11 420 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 176 255 symbol /usr/*; #X text 54 73 list current directory; #X text 160 237 set pattern without no output; #X obj 27 386 folder_list; #X obj 83 277 folder_list /*; #X obj 83 298 print; #X text 8 49 left/hot inlet gives immediate output using stored path ; #X text 19 325 For UNIX people \, [folder_list] behaves just like "ls -d1A"; #X obj 28 419 print; #X msg 91 146 symbol ~/*.*; #X text 187 197 relative paths work; #X msg 102 198 symbol ../*; #X text 164 124 drive letters work on ReactOS/Windows; #X msg 77 123 symbol C:/*; #X text 190 148 all files with a dot in your home; #X msg 40 98 symbol %USERPROFILE%/*; #X text 203 99 ReactOS/Windows environment variables work; #X text 262 218 nested wildcards work on UNIX; #X msg 119 219 symbol /var/*/*.log; #X text 173 173 patterns default to path that Pd launched from; #X text 329 464 released under the GNU GPL; #X text 15 449 (C) Copyright 2006 Hans-Christoph Steiner ; #X text 8 5 Get a listing of files based on a wildcard pattern. On UNIX \, it follows glob rules \, on ReactOS/Windows it follows the cmd.exe rules.; #X text 115 380 With no argument \, it defaults to the contents of the folder of the current patch \, i.e. "/path/to/current/patch/*". ; #X msg 97 173 symbol *.pd; #N canvas 280 175 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION get listing of files based on wildcard pattern ; #X text 12 65 INLET_0 bang symbol; #X text 12 85 INLET_1 symbol; #X text 12 105 OUTLET_0 symbol; #X text 12 5 KEYWORDS control filesystem patchfile_op; #X restore 498 465 pd META; #X connect 0 0 8 0; #X connect 1 0 7 0; #X connect 4 0 8 1; #X connect 7 0 3 0; #X connect 7 0 12 0; #X connect 8 0 2 0; #X connect 8 0 9 0; #X connect 13 0 8 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 8 0; #X connect 22 0 8 0; #X connect 28 0 8 0; hcs-0.2.1/folder_list.c000066400000000000000000000205341422106453500147470ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* object for getting file listings using wildcard patterns */ /* Written by Hans-Christoph Steiner */ /* */ /* Copyright (c) 2006 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #include #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #else #include #include #endif #include #include static char *version = "$Revision: 1.12 $"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *folder_list_class; typedef struct _folder_list { t_object x_obj; t_symbol* x_pattern; t_canvas* x_canvas; } t_folder_list; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ // TODO: make FindFirstFile display when its just a dir static void normalize_path(t_folder_list* x, char *normalized, const char *original) { char buf[FILENAME_MAX]; t_symbol *cwd = canvas_getdir(x->x_canvas); #ifdef _WIN32 sys_unbashfilename(original, buf); #else strncpy(buf, original, FILENAME_MAX-1); #endif if(sys_isabsolutepath(buf)) { strncpy(normalized, buf, FILENAME_MAX); return; } strncpy(normalized, cwd->s_name, FILENAME_MAX-1); if(normalized[(strlen(normalized)-1)] != '/') { strncat(normalized, "/", 2); } if(buf[0] == '.') { if(buf[1] == '/') { strncat(normalized, buf + 2, FILENAME_MAX - strlen(normalized)); } else if(buf[1] == '.' && buf[2] == '/') { strncat(normalized, buf, FILENAME_MAX - strlen(normalized)); } } else if(buf[0] != '/') { strncat(normalized, buf, FILENAME_MAX - strlen(normalized)); } else { strncpy(normalized, buf, FILENAME_MAX); } } static void folder_list_output(t_folder_list* x) { DEBUG(post("folder_list_output");); char normalized_path[FILENAME_MAX] = ""; normalize_path(x, normalized_path, x->x_pattern->s_name); #ifdef _WIN32 WIN32_FIND_DATA findData; HANDLE hFind; DWORD errorNumber; LPVOID lpErrorMessage; char fullPathNameBuffer[FILENAME_MAX] = ""; char unbashBuffer[FILENAME_MAX] = ""; char outputBuffer[FILENAME_MAX] = ""; char *pathBuffer; // arg, looks perfect, but only in Windows Vista // GetFinalPathNameByHandle(hFind,fullPathNameBuffer,FILENAME_MAX,FILE_NAME_NORMALIZED); GetFullPathName(normalized_path, FILENAME_MAX, fullPathNameBuffer, NULL); sys_unbashfilename(fullPathNameBuffer,unbashBuffer); hFind = FindFirstFile(fullPathNameBuffer, &findData); if (hFind == INVALID_HANDLE_VALUE) { errorNumber = GetLastError(); switch (errorNumber) { case ERROR_FILE_NOT_FOUND: case ERROR_PATH_NOT_FOUND: pd_error(x,"[folder_list] nothing found for \"%s\"",x->x_pattern->s_name); break; default: FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, errorNumber, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpErrorMessage, 0, NULL ); pd_error(x,"[folder_list] %s", (char *)lpErrorMessage); } return; } char* unbashBuffer_position = strrchr(unbashBuffer, '/'); if(unbashBuffer_position) { pathBuffer = getbytes(FILENAME_MAX+1); strncpy(pathBuffer, unbashBuffer, unbashBuffer_position - unbashBuffer); } do { // skip "." and ".." if( strcmp(findData.cFileName, ".") && strcmp(findData.cFileName, "..") ) { strncpy(outputBuffer, pathBuffer, FILENAME_MAX); strcat(outputBuffer,"/"); strcat(outputBuffer,findData.cFileName); outlet_symbol( x->x_obj.ob_outlet, gensym(outputBuffer) ); } } while (FindNextFile(hFind, &findData) != 0); FindClose(hFind); #else unsigned int i; glob_t glob_buffer; DEBUG(post("globbing %s",normalized_path);); switch( glob( normalized_path, GLOB_TILDE, NULL, &glob_buffer ) ) { case GLOB_NOSPACE: pd_error(x,"[folder_list] out of memory for \"%s\"",normalized_path); break; # ifdef GLOB_ABORTED case GLOB_ABORTED: pd_error(x,"[folder_list] aborted \"%s\"",normalized_path); break; # endif # ifdef GLOB_NOMATCH case GLOB_NOMATCH: pd_error(x,"[folder_list] nothing found for \"%s\"",normalized_path); break; # endif } for(i = 0; i < glob_buffer.gl_pathc; i++) outlet_symbol( x->x_obj.ob_outlet, gensym(glob_buffer.gl_pathv[i]) ); globfree( &(glob_buffer) ); #endif } static void folder_list_set(t_folder_list* x, t_symbol *s) { DEBUG(post("folder_list_set");); #ifdef _WIN32 char *patternBuffer; char envVarBuffer[FILENAME_MAX]; if( (s->s_name[0] == '~') && (s->s_name[1] == '/')) { // TODO this is probably never freed! patternBuffer = getbytes(FILENAME_MAX); strcpy(patternBuffer,"%USERPROFILE%"); strncat(patternBuffer, s->s_name + 1, FILENAME_MAX - 1); verbose(-1, "set: %s", patternBuffer); } else { patternBuffer = s->s_name; } ExpandEnvironmentStrings(patternBuffer, envVarBuffer, FILENAME_MAX - 2); x->x_pattern = gensym(envVarBuffer); #else // UNIX // TODO translate env vars to a full path x->x_pattern = s; #endif /* _WIN32 */ } static void folder_list_symbol(t_folder_list *x, t_symbol *s) { folder_list_set(x,s); folder_list_output(x); } static void *folder_list_new(t_symbol *s) { DEBUG(post("folder_list_new");); t_folder_list *x = (t_folder_list *)pd_new(folder_list_class); t_symbol *currentdir; char buffer[MAXPDSTRING]; x->x_canvas = canvas_getcurrent(); symbolinlet_new(&x->x_obj, &x->x_pattern); outlet_new(&x->x_obj, &s_symbol); /* set to the value from the object argument, if that exists */ if (s != &s_) { x->x_pattern = s; } else { currentdir = canvas_getcurrentdir(); strncpy(buffer, currentdir->s_name, MAXPDSTRING-1); strncat(buffer, "/*", MAXPDSTRING-1); x->x_pattern = gensym(buffer); logpost(x, 3, "setting pattern to default: %s",x->x_pattern->s_name); } return (x); } void folder_list_setup(void) { DEBUG(post("folder_list_setup");); folder_list_class = class_new(gensym("folder_list"), (t_newmethod)folder_list_new, 0, sizeof(t_folder_list), 0, A_DEFSYMBOL, 0); /* add inlet datatype methods */ class_addbang(folder_list_class,(t_method) folder_list_output); class_addsymbol(folder_list_class,(t_method) folder_list_symbol); /* add inlet message methods */ class_addmethod(folder_list_class,(t_method) folder_list_set,gensym("set"), A_DEFSYMBOL, 0); } hcs-0.2.1/general/000077500000000000000000000000001422106453500137065ustar00rootroot00000000000000hcs-0.2.1/general/amp~.pd000066400000000000000000000010561422106453500152100ustar00rootroot00000000000000#N canvas 231 38 546 314 10; #X text 192 9 input range: 0 to 1; #X obj 19 30 inlet~; #X obj 84 269 outlet~; #X text 180 269 audio signal; #X text 70 31 audio signal; #X obj 85 211 *~; #X obj 194 170 line~; #X obj 197 27 inlet; #X obj 302 117 blocksize_in_ms; #X text 9 5 [amp~]; #X obj 371 18 loadbang; #X obj 195 139 pack float float; #X obj 196 53 float_argument \$1; #X connect 1 0 5 0; #X connect 5 0 2 0; #X connect 6 0 5 1; #X connect 7 0 12 0; #X connect 8 0 11 1; #X connect 10 0 8 0; #X connect 10 0 12 0; #X connect 11 0 6 0; #X connect 12 0 11 0; hcs-0.2.1/general/doc/000077500000000000000000000000001422106453500144535ustar00rootroot00000000000000hcs-0.2.1/general/doc/amp~-help.pd000066400000000000000000000017311422106453500167030ustar00rootroot00000000000000#N canvas 0 31 465 358 10; #X obj 5 2 cnv 15 450 20 empty empty amp~ 2 11 1 18 -233017 -66577 0; #X msg 422 3 pddp; #X text 27 270 (C) Copyright 2004 Hans-Christoph Steiner ; #X text 244 284 released under the GNU GPL; #X floatatom 192 115 5 0 0 0 - - -; #X obj 195 95 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271 -1 -1 0 1; #X obj 157 219 dac~; #X obj 127 139 osc~ 350; #X obj 169 178 amp~; #X text 28 43 Smooth amplitude control.; #N canvas 356 214 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control conversion; #X text 12 45 DESCRIPTION smooth amplitude control; #X text 12 65 INLET_0 signal; #X text 12 85 INLET_1 float; #X text 12 105 OUTLET_0 signal; #X restore 407 328 pd META; #X connect 4 0 8 1; #X connect 5 0 4 0; #X connect 7 0 8 0; #X connect 8 0 6 0; #X connect 8 0 6 1; hcs-0.2.1/general/doc/failsafe-help.pd000066400000000000000000000021061422106453500174770ustar00rootroot00000000000000#N canvas 0 31 469 358 10; #X obj 5 2 cnv 15 450 20 empty empty failsafe 2 11 1 18 -233017 -66577 0; #X msg 422 3 pddp; #X text 244 284 released under the GNU GPL; #X text 27 270 (C) Copyright 2006 Hans-Christoph Steiner ; #X obj 206 182 gemwin; #X msg 206 162 0; #X text 25 38 When the CPU is pegged \, first [failsafe] turns of DSP and bangs the right outlet. Then if the CPU is still pegged \, it bangs the left inlet and ultimately quits Pd.; #X text 36 222 You can add your own conditions using the bangs from the outlets.; #X obj 155 127 failsafe; #X obj 155 95 loadbang; #X msg 119 172 \; pd quit; #N canvas 356 214 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION; #X text 12 5 KEYWORDS control pd_op; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 bang; #X text 12 105 OUTLET_1 bang; #X restore 414 328 pd META; #X connect 5 0 4 0; #X connect 8 0 10 0; #X connect 8 1 5 0; #X connect 9 0 8 0; hcs-0.2.1/general/failsafe.pd000066400000000000000000000040031422106453500160020ustar00rootroot00000000000000#N canvas 21 23 579 511 10; #X obj 459 5 import purepd; #X obj 191 201 cputime; #X msg 35 72 1; #X obj 347 241 moses; #X obj 203 6 inlet; #X obj 161 158 metro; #X obj 371 6 inlet; #X obj 371 100 float_argument \$2 1000; #X obj 35 51 trigger bang bang bang; #X obj 161 177 trigger bang bang; #X msg 107 357 \; pd quit; #X msg 49 292 stop; #X msg 348 299 stop; #X msg 499 365 \; pd dsp 0; #X obj 107 292 once; #X obj 385 299 once; #X obj 49 233 moses 990; #X text 381 25 sampling rate in ms; #X obj 385 442 outlet; #X obj 187 440 outlet; #X obj 107 338 trigger bang bang; #X obj 385 344 trigger bang bang; #X obj 202 100 float_argument \$1 990; #X obj 385 322 delay 4000; #N canvas 303 168 551 211 status 0; #X obj 320 18 inlet; #X obj 12 15 inlet; #X obj 193 148 print [failsafe]; #X msg 320 37 CPU pegged!! Turning off DSP.; #X msg 11 37 CPU pegged for 10 seconds!! Quitting pd!!; #X connect 0 0 3 0; #X connect 1 0 4 0; #X connect 3 0 2 0; #X connect 4 0 2 0; #X restore 238 399 pd status messages; #X obj 107 253 bang; #X obj 107 319 delay 10000; #X text 291 483 released under the GNU GPL; #X text 74 472 (C) Copyright 2006 Hans-Christoph Steiner ; #X obj 347 272 bang; #X obj 385 272 bang; #X text 210 24 load to trigger at; #X obj 49 263 bang; #X obj 35 21 inlet; #X connect 1 0 3 0; #X connect 1 0 16 0; #X connect 2 0 5 0; #X connect 3 0 15 1; #X connect 3 0 29 0; #X connect 3 1 30 0; #X connect 4 0 22 0; #X connect 5 0 9 0; #X connect 6 0 7 0; #X connect 7 0 5 1; #X connect 8 0 2 0; #X connect 8 1 22 0; #X connect 8 2 7 0; #X connect 9 0 1 0; #X connect 9 1 1 1; #X connect 11 0 26 0; #X connect 12 0 23 0; #X connect 14 0 26 0; #X connect 15 0 23 0; #X connect 16 0 14 1; #X connect 16 0 32 0; #X connect 16 1 25 0; #X connect 20 0 10 0; #X connect 20 1 19 0; #X connect 20 1 24 0; #X connect 21 0 18 0; #X connect 21 0 24 1; #X connect 21 1 13 0; #X connect 22 0 3 1; #X connect 23 0 21 0; #X connect 25 0 14 0; #X connect 26 0 20 0; #X connect 29 0 12 0; #X connect 30 0 15 0; #X connect 32 0 11 0; #X connect 33 0 8 0; hcs-0.2.1/general/rgb-0x3epd.pd000066400000000000000000000021421422106453500161050ustar00rootroot00000000000000#N canvas 642 48 565 527 10; #X obj 59 50 inlet; #X obj 243 50 inlet; #X obj 111 301 outlet; #X text 114 326 -pow(2 \, 16) * R - pow(2 \, 8) * G - pow(2 \, 0) * B - 1; #X obj 388 50 inlet; #X obj 112 97 float_argument \$1; #X obj 243 97 float_argument \$2; #X obj 388 97 float_argument \$3; #X text 267 372 released under the GNU GPL; #X text 50 357 (C) Copyright 2006 Hans-Christoph Steiner ; #X text 67 395 Based on ideas from Joao Miguel Pais/Frank Barknecht. ; #X obj 59 72 route list float; #X obj 111 258 expr -65536 * $i1 - 256 * $i2 - $i3 - 1 \;; #X obj 52 159 unpack float float float; #X obj 248 230 * 255; #X obj 386 230 * 255; #X text 101 50 [math/list/clip]; #X obj 243 73 clip 0 1; #X obj 388 73 clip 0 1; #X obj 111 229 * 255; #X connect 0 0 11 0; #X connect 1 0 17 0; #X connect 4 0 18 0; #X connect 5 0 19 0; #X connect 6 0 14 0; #X connect 7 0 15 0; #X connect 11 0 13 0; #X connect 11 1 5 0; #X connect 12 0 2 0; #X connect 13 0 19 0; #X connect 13 1 14 0; #X connect 13 2 15 0; #X connect 14 0 12 1; #X connect 15 0 12 2; #X connect 17 0 6 0; #X connect 18 0 7 0; #X connect 19 0 12 0; hcs-0.2.1/get-audio-dialog-help.pd000066400000000000000000000022211422106453500166540ustar00rootroot00000000000000#N canvas 0 26 611 344 10; #X msg 14 101 bang; #X obj 53 164 pddp/print; #X obj 33 169 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 14 193 prepend set; #X obj 14 268 send pd; #X obj 14 132 get-audio-dialog; #X text 133 83 Open the Audio Settings and click OK to get the data \, then click bang to use them in the patch; #X text 9 23 get the Audio settings to save as part of the patch.; #N canvas 280 175 494 344 META 0; #X text 12 135 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 115 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION get the audio settings to save as part of the patch; #X text 12 75 INLET_0 bang; #X text 12 95 OUTLET_0 bang audio-dialog; #X text 12 5 KEYWORDS control pd_op; #X restore 562 322 pd META; #X msg 14 239; #X text 226 259 ^-- this message will be saved as part of your patch. click it or [loadbang] it to configure the Audio settings. Make sure it is attached to a [send pd] so that Pd gets the message.; #X connect 0 0 5 0; #X connect 3 0 9 0; #X connect 5 0 1 0; #X connect 5 0 2 0; #X connect 5 0 3 0; #X connect 9 0 4 0; hcs-0.2.1/get-audio-dialog.pd000066400000000000000000000013651422106453500157360ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 143 88 receive pd; #X obj 143 111 route audio-dialog; #X obj 122 161 list; #X obj 122 16 inlet; #X obj 122 43 route bang; #X obj 179 63 print ERROR: no method for; #X obj 179 272 outlet; #X obj 122 185 route bang; #X obj 85 235 print WARNING: no audio-dialog data! Open the Audio Settings and click OK to get the data.; #X obj 179 209 cyclone/prepend audio-dialog; #X obj 143 132 trigger bang anything; #X text 211 180 in a singleton; #X text 159 160 <-- TODO this list should be globally available; #X connect 0 0 1 0; #X connect 1 0 10 0; #X connect 2 0 7 0; #X connect 3 0 4 0; #X connect 4 0 2 0; #X connect 4 1 5 0; #X connect 7 0 8 0; #X connect 7 1 9 0; #X connect 9 0 6 0; #X connect 10 0 2 0; #X connect 10 1 2 1; hcs-0.2.1/get-midi-dialog-help.pd000066400000000000000000000022471422106453500165050ustar00rootroot00000000000000#N canvas 0 26 611 344 10; #X msg 34 111 bang; #X obj 73 174 pddp/print; #X obj 53 179 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 9 23 get the MIDI settings to save as part of the patch.; #X text 153 93 Open the MIDI Settings and click OK to get the data \, then click bang to use them in the patch; #X obj 34 142 get-midi-dialog; #X obj 34 203 prepend set; #X obj 34 278 send pd; #X text 246 249 <-- this message will be saved as part of your patch. click it or [loadbang] it to configure the MIDI settings. Make sure it is attached to a [send pd] so that Pd gets the message.; #X msg 34 249 midi-dialog 0 0 0 0 0 0 0 0 1 1; #N canvas 386 198 494 344 META 0; #X text 12 135 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 115 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION get Pd's MIDI settings to save as part of the patch; #X text 12 75 INLET_0 bang; #X text 12 95 OUTLET_0 midi-dialog; #X text 12 5 KEYWORDS control pd_op; #X restore 562 322 pd META; #X connect 0 0 5 0; #X connect 5 0 1 0; #X connect 5 0 2 0; #X connect 5 0 6 0; #X connect 6 0 9 0; #X connect 9 0 7 0; hcs-0.2.1/get-midi-dialog.pd000066400000000000000000000013631422106453500155550ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 143 88 receive pd; #X obj 122 161 list; #X obj 122 16 inlet; #X obj 122 43 route bang; #X obj 179 63 print ERROR: no method for; #X obj 179 272 outlet; #X obj 122 185 route bang; #X obj 143 132 trigger bang anything; #X text 211 180 in a singleton; #X text 159 160 <-- TODO this list should be globally available; #X obj 143 111 route midi-dialog; #X obj 179 209 cyclone/prepend midi-dialog; #X obj 85 235 print WARNING: no midi-dialog data! Open the MIDI Settings and click OK to get the data.; #X connect 0 0 10 0; #X connect 1 0 6 0; #X connect 2 0 3 0; #X connect 3 0 1 0; #X connect 3 1 4 0; #X connect 6 0 12 0; #X connect 6 1 11 0; #X connect 7 0 1 0; #X connect 7 1 1 1; #X connect 10 0 7 0; #X connect 11 0 5 0; hcs-0.2.1/gid2group_name-help.pd000066400000000000000000000024401422106453500164460ustar00rootroot00000000000000#N canvas 0 26 461 324 10; #X msg 43 118 bang; #X obj 59 210 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 300 129 bang; #X obj 184 216 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 187 238 ^-- bang if not found; #X text 12 14 convert a UID to a username; #X symbolatom 84 212 0 0 0 0 - - -; #X msg 172 132 1; #X symbolatom 301 212 0 0 0 0 - - -; #X obj 89 63 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X floatatom 87 93 5 0 0 0 - - -; #X obj 85 160 gid2group_name; #X obj 417 193 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 301 171 gid2group_name 0; #N canvas 280 175 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION convert a UID to a username; #X text 12 65 INLET_0 float bang; #X text 12 85 INLET_1 float; #X text 12 105 OUTLET_0 symbol; #X text 12 125 OUTLET_1 bang; #X restore 412 302 pd META; #X connect 0 0 11 0; #X connect 2 0 13 0; #X connect 7 0 11 1; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 0 1 0; #X connect 11 0 6 0; #X connect 11 1 3 0; #X connect 13 0 8 0; #X connect 13 1 12 0; hcs-0.2.1/gid2group_name.pd000066400000000000000000000006271422106453500155250ustar00rootroot00000000000000#N canvas 0 31 514 233 10; #X obj 18 12 inlet; #X obj 19 183 outlet; #X obj 66 12 inlet; #X obj 118 31 loadbang; #X obj 66 59 purepd/float_argument \$1; #X obj 82 183 outlet; #X obj 18 118 list; #X obj 18 147 list split 1; #X obj 18 85 hcs/group; #X connect 0 0 8 0; #X connect 2 0 4 0; #X connect 3 0 4 0; #X connect 4 0 8 1; #X connect 6 0 7 0; #X connect 7 0 1 0; #X connect 8 0 6 0; #X connect 8 1 5 0; hcs-0.2.1/grabbag/000077500000000000000000000000001422106453500136565ustar00rootroot00000000000000hcs-0.2.1/grabbag/gnome-screensaver-help.pd000066400000000000000000000011161422106453500205530ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 109 129 gnome-screensaver; #X obj 109 108 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X text 68 58 activate/deactivate the gnome-screensaver; #N canvas 404 246 494 344 META 0; #X text 12 105 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 85 AUTHOR Hans-Christoph Steiner; #X text 12 65 INLET_0 float; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION activate/deactivate the gnome-screensaver ; #X restore 392 266 pd META; #X connect 1 0 0 0; hcs-0.2.1/grabbag/gnome-screensaver.pd000066400000000000000000000016101422106453500176240ustar00rootroot00000000000000#N canvas 728 402 450 300 10; #X obj 89 37 inlet; #X obj 89 228 motex/system; #X msg 89 97 gnome-screensaver-command --activate; #X obj 89 57 select 1 0; #N canvas 0 22 450 300 disable 0; #X obj 51 14 inlet; #X obj 53 248 outlet; #X msg 72 128 gnome-screensaver-command --deactivate; #X msg 97 162 xset -display :0.0 s off; #X obj 51 43 bang; #X msg 107 188 xset -display :0.0 dpms force off; #X msg 123 208 xset -display :0.0 s noblank; #X connect 0 0 4 0; #X connect 2 0 1 0; #X connect 3 0 1 0; #X connect 4 0 2 0; #X connect 4 0 3 0; #X connect 4 0 5 0; #X connect 4 0 6 0; #X connect 5 0 1 0; #X connect 6 0 1 0; #X restore 121 154 pd disable commands; #X obj 21 271 pddp/pddplink http://lists.puredata.info/pipermail/pd-list/2010-07/080680.html ; #X text 8 255 TODO implement the xset stuff here:; #X connect 0 0 3 0; #X connect 2 0 1 0; #X connect 3 0 2 0; #X connect 3 1 4 0; #X connect 4 0 1 0; hcs-0.2.1/grabbag/itunes-help.pd000066400000000000000000000016651422106453500164500ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 71 226 itunes; #X msg 86 80 next; #X msg 95 105 play; #X msg 99 128 pause; #X msg 71 58 previous; #X obj 104 159 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 101 177 set sound volume to \$1; #X msg 100 203 set EQ enabled to true; #X obj 55 270 pddp/pddplink http://dougscripts.com/itunes/itinfo/info01.php ; #X text 34 20 On Mac OS X \, control iTunes; #N canvas 404 246 494 344 META 0; #X text 12 105 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 85 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION On Mac OS X \, control iTunes; #X text 12 65 INLET_0 previous next play pause set; #X restore 392 266 pd META; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 6 0; #X connect 6 0 0 0; #X connect 7 0 0 0; hcs-0.2.1/grabbag/itunes.pd000066400000000000000000000010371422106453500155130ustar00rootroot00000000000000#N canvas 59 74 428 314 10; #X obj 46 28 inlet; #X obj 99 169 zexy/list2symbol; #X obj 99 147 list; #X msg 142 116 next track; #X obj 44 91 bang; #X obj 143 92 bang; #X obj 99 258 motex/system; #X msg 99 196 osascript -e 'tell application "iTunes" to \$1' &; #X obj 46 56 route previous next; #X msg 44 117 previous track; #X connect 0 0 8 0; #X connect 1 0 7 0; #X connect 2 0 1 0; #X connect 3 0 2 0; #X connect 4 0 9 0; #X connect 5 0 3 0; #X connect 7 0 6 0; #X connect 8 0 4 0; #X connect 8 1 5 0; #X connect 8 2 2 0; #X connect 9 0 2 0; hcs-0.2.1/grabbag/osascript-help.pd000066400000000000000000000012321422106453500171360ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 47 213 osascript; #X text 21 23 run AppleScripts on Mac OS X; #X msg 33 99 tell application "safari" to open location "http://puredata.info" ; #X msg 64 152 tell application "firefox" to open location "http://puredata.info" ; #N canvas 404 246 494 344 META 0; #X text 12 105 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 85 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION run AppleScripts on Mac OS X; #X text 12 65 INLET_0 tell; #X restore 392 266 pd META; #X connect 2 0 0 0; #X connect 3 0 0 0; hcs-0.2.1/grabbag/osascript.pd000066400000000000000000000003661422106453500162170ustar00rootroot00000000000000#N canvas 288 314 450 300 10; #X obj 81 29 inlet; #X obj 81 263 motex/system; #X msg 81 232 osascript -e '\$1' &; #X obj 81 108 list; #X obj 81 137 zexy/list2symbol; #X connect 0 0 3 0; #X connect 2 0 1 0; #X connect 3 0 4 0; #X connect 4 0 2 0; hcs-0.2.1/grabbag/screensaver-help.pd000066400000000000000000000012501422106453500174470ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 127 148 screensaver; #X obj 130 96 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X text 43 31 set the screensaver timer (in seconds). 0 turns the screensaver off; #X floatatom 141 126 5 0 0 1 seconds - -; #N canvas 404 246 494 344 META 0; #X text 12 105 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 85 AUTHOR Hans-Christoph Steiner; #X text 12 65 INLET_0 float; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION set the screensaver timer (in seconds); #X restore 392 266 pd META; #X connect 1 0 0 0; #X connect 1 0 3 0; hcs-0.2.1/grabbag/screensaver.pd000066400000000000000000000015321422106453500165240ustar00rootroot00000000000000#N canvas 255 231 748 455 10; #X obj 14 4 inlet; #X obj 359 305 motex/system; #X obj 359 249 spigot 0; #X obj 302 47 loadbang; #X obj 302 95 select linux windows macos; #X obj 302 69 zexy/operating_system; #X msg 302 115 1; #X msg 353 115 1; #X msg 404 115 1; #X obj 34 257 motex/system; #X obj 34 175 spigot 0; #X msg 359 270 /usr/bin/defaults -currentHost write com.apple.screensaver idleTime -int \$1; #X msg 34 212 what is this?; #X obj 38 384 pddp/pddplink http://lists.puredata.info/pipermail/pd-list/2010-07/080680.html ; #X text 25 369 TODO implement the xset stuff here for linux:; #X connect 0 0 2 0; #X connect 0 0 10 0; #X connect 2 0 11 0; #X connect 3 0 5 0; #X connect 4 0 6 0; #X connect 4 1 7 0; #X connect 4 2 8 0; #X connect 5 0 4 0; #X connect 6 0 10 1; #X connect 8 0 2 1; #X connect 10 0 12 0; #X connect 11 0 1 0; #X connect 12 0 9 0; hcs-0.2.1/group-help.pd000066400000000000000000000032751422106453500147070ustar00rootroot00000000000000#N canvas 0 26 535 345 10; #X obj 97 40 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X floatatom 94 63 5 0 0 0 User_ID - -; #X obj 47 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 112 86 bang; #X text 209 168 <-- set by argument or cold inlet; #X text 148 86 output current; #X symbolatom 94 308 0 0 0 3 group_name - -; #X floatatom 205 308 0 0 0 3 gid - -; #X msg 269 110 symbol trash; #X msg 269 56 symbol daemon; #X text 188 195 bang on right inlet if no match; #X obj 138 195 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 94 167 group; #X obj 94 200 list; #X msg 269 83 symbol wheel; #X msg 269 135 20; #X obj 128 245 print group_members; #X text 37 20 fetch passwd data based on UID or group name; #X text 356 110 ignore bad group names; #X obj 94 281 unpack symbol float; #X obj 94 220 list split 2; #N canvas 443 240 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION fetch passwd data based on UID or group name ; #X text 12 65 INLET_0 float bang symbol; #X text 12 85 INLET_1 float; #X text 12 105 OUTLET_0 anything; #X text 12 125 OUTLET_1 bang; #X restore 486 323 pd META; #X text 356 83 use a symbolic group name; #X connect 0 0 1 0; #X connect 1 0 12 0; #X connect 3 0 12 0; #X connect 8 0 12 0; #X connect 9 0 12 0; #X connect 12 0 2 0; #X connect 12 0 13 0; #X connect 12 1 11 0; #X connect 13 0 20 0; #X connect 14 0 12 0; #X connect 15 0 12 1; #X connect 19 0 6 0; #X connect 19 1 7 0; #X connect 20 0 19 0; #X connect 20 1 16 0; hcs-0.2.1/group.c000066400000000000000000000161631422106453500136000ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* converts a GID number to a user name symbol */ /* Written by Hans-Christoph Steiner */ /* */ /* Copyright (c) 2006 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #ifndef _WIN32 // this doesn't work on Windows (yet?) #include #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #include #else #include #include #include #endif #include static char *version = "$Revision: 1.3 $"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *group_class; typedef struct _group { t_object x_obj; t_float x_gid; /* output */ t_atom *output; // holder for a list of atoms to be outputted t_int output_count; // number of atoms in in x->output t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_group; /*------------------------------------------------------------------------------ * SUPPORT FUNCTIONS */ /* add one new atom to the list to be outputted */ static void add_atom_to_output(t_group *x, t_atom *new_atom) { t_atom *new_atom_list; new_atom_list = (t_atom *)getbytes((x->output_count + 1) * sizeof(t_atom)); memcpy(new_atom_list, x->output, x->output_count * sizeof(t_atom)); freebytes(x->output, x->output_count * sizeof(t_atom)); x->output = new_atom_list; memcpy(x->output + x->output_count, new_atom, sizeof(t_atom)); ++(x->output_count); } static void add_symbol_to_output(t_group *x, t_symbol *s) { t_atom *temp_atom = getbytes(sizeof(t_atom)); SETSYMBOL(temp_atom, s); add_atom_to_output(x,temp_atom); freebytes(temp_atom,sizeof(t_atom)); } static void add_float_to_output(t_group *x, t_float f) { t_atom *temp_atom = getbytes(sizeof(t_atom)); SETFLOAT(temp_atom, f); add_atom_to_output(x,temp_atom); freebytes(temp_atom,sizeof(t_atom)); } static void reset_output(t_group *x) { if(x->output) { freebytes(x->output, x->output_count * sizeof(t_atom)); x->output = NULL; x->output_count = 0; } } /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void group_output(t_group *x) { DEBUG(post("group_output");); struct group *group_pointer; char **members; #ifdef _WIN32 /* TODO: implement for Windows! */ #else if( x->x_gid < 0 ) { post("[group]: ignoring bad username or GID less than zero"); outlet_bang(x->x_status_outlet); } else { group_pointer = getgrgid((gid_t)x->x_gid); if( group_pointer != NULL ) { reset_output(x); /* group passwd just seems to be always blank, so omit it */ /* add_symbol_to_output(x, gensym(group_pointer->gr_passwd)); */ add_float_to_output(x, group_pointer->gr_gid); members = group_pointer->gr_mem; while(*members) { add_symbol_to_output(x, gensym( *(members) )); members++; } outlet_anything(x->x_data_outlet, gensym(group_pointer->gr_name), x->output_count, x->output); } else { outlet_bang(x->x_status_outlet); } } #endif /* _WIN32 */ } static t_float get_gid_from_arguments(int argc, t_atom *argv) { t_symbol *first_argument; t_float gid = -1; struct group *group_pointer; if(argc == 0) return(0); if(argc != 1) post("[group]: too many arguments (%d), ignoring all but the first", argc); first_argument = atom_getsymbolarg(0,argc,argv); if(first_argument == &s_) { // single float arg means GID # gid = atom_getfloatarg(0,argc,argv); if( gid < 0 ) { error("[group]: GID less than zero not allowed (%d)", (int)gid); return(-1); } } else { // single symbol arg means username group_pointer = getgrnam(first_argument->s_name); if( group_pointer != NULL ) return((t_float) group_pointer->gr_gid); else return(-1); } return(-1); } static void group_set(t_group *x, t_symbol *s, int argc, t_atom *argv) { /* get rid of the unused variable warning with the if() statement */ if( strcmp(s->s_name, "set") == 0 ) x->x_gid = get_gid_from_arguments(argc, argv); } static void group_float(t_group *x, t_float f) { x->x_gid = f; group_output(x); } static void group_symbol(t_group *x, t_symbol *s) { t_atom argv[1]; SETSYMBOL(argv, s); group_set(x, gensym("set"), 1, argv); group_output(x); } static void *group_new(t_symbol *s, int argc, t_atom *argv) { DEBUG(post("group_new");); t_group *x = (t_group *)pd_new(group_class); floatinlet_new(&x->x_obj, &x->x_gid); x->x_data_outlet = outlet_new(&x->x_obj, 0); x->x_status_outlet = outlet_new(&x->x_obj, 0); group_set(x, gensym("set"), argc, argv); return (x); } void group_free(void) { #ifdef _WIN32 #else endgrent(); #endif /* _WIN32 */ } void group_setup(void) { DEBUG(post("group_setup");); group_class = class_new(gensym("group"), (t_newmethod)group_new, 0, sizeof(t_group), 0, A_GIMME, 0); /* add inlet datatype methods */ class_addbang(group_class, (t_method) group_output); class_addfloat(group_class, (t_method) group_float); class_addsymbol(group_class, (t_method) group_symbol); /* add inlet message methods */ class_addmethod(group_class, (t_method) group_set, gensym("set"), A_GIMME, 0); logpost(NULL, 4, "[group] %s",version); logpost(NULL, 4, "\twritten by Hans-Christoph Steiner "); logpost(NULL, 4, "\tcompiled on "__DATE__" at "__TIME__ " "); } #endif /* NOT _WIN32 */ hcs-0.2.1/group_name2gid-help.pd000066400000000000000000000026211422106453500164470ustar00rootroot00000000000000#N canvas 0 26 481 320 10; #X floatatom 56 240 5 0 0 0 - - -; #X msg 14 148 bang; #X msg 137 162 symbol daemon; #X obj 30 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 93 109 symbol lp; #X msg 99 135 symbol trash; #X floatatom 262 227 5 0 0 0 - - -; #X msg 262 162 bang; #X obj 137 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 140 262 ^-- bang if not found; #X obj 379 227 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 56 49 symbol wheel; #X msg 75 81 symbol staff; #X text 12 14 convert a group name to a GID.; #X obj 262 197 group_name2gid staff; #X obj 56 190 group_name2gid; #X msg 379 162 symbol postfix; #N canvas 417 281 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION convert a group name to a GID; #X text 12 65 INLET_0 bang symbol; #X text 12 85 INLET_1 symbol; #X text 12 105 OUTLET_0 bang float; #X text 12 125 OUTLET_1 bang; #X restore 431 300 pd META; #X connect 1 0 15 0; #X connect 2 0 15 1; #X connect 4 0 15 0; #X connect 5 0 15 0; #X connect 7 0 14 0; #X connect 11 0 15 0; #X connect 12 0 15 0; #X connect 14 0 6 0; #X connect 14 1 10 0; #X connect 15 0 0 0; #X connect 15 0 3 0; #X connect 15 1 8 0; #X connect 16 0 14 1; hcs-0.2.1/group_name2gid.pd000066400000000000000000000013141422106453500155170ustar00rootroot00000000000000#N canvas 0 31 389 458 10; #X obj 18 12 inlet; #X obj 61 12 inlet; #X obj 18 322 outlet; #X obj 108 31 loadbang; #X obj 56 59 purepd/any_argument \$1; #X obj 57 93 route float; #X obj 226 323 outlet; #X obj 129 135 list; #X obj 18 241 list; #X obj 19 213 hcs/group; #X obj 129 114 hcs/group; #X obj 129 155 list split 2; #X obj 129 176 list split 1; #X obj 18 261 list split 2; #X obj 18 282 list split 1; #X connect 0 0 9 0; #X connect 1 0 4 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 9 1; #X connect 5 1 10 0; #X connect 7 0 11 0; #X connect 8 0 13 0; #X connect 9 0 8 0; #X connect 9 1 6 0; #X connect 10 0 7 0; #X connect 11 0 12 0; #X connect 12 1 9 1; #X connect 13 0 14 0; #X connect 14 1 2 0; hcs-0.2.1/gui/000077500000000000000000000000001422106453500130555ustar00rootroot00000000000000hcs-0.2.1/gui/asl.pd000066400000000000000000000024351422106453500141650ustar00rootroot00000000000000#N canvas 162 102 438 654 10; #X obj 100 102 vsl 20 120 1.12 112 0 0 empty \$0-asl empty 0 -8 0 8 -124993 -262140 -262140 11900 0; #X obj 99 22 inlet; #X obj 27 314 outlet; #X obj 181 567 send \$0-asl; #X obj 178 267 moses 1; #X obj 177 430 trigger bang float; #X obj 222 287 trigger float bang; #X msg 342 430 0; #X obj 178 504 rgb->pd 0 0 0; #X msg 177 460 0; #X msg 15 418 0 0 0; #X msg 59 417 1 0 0; #X msg 105 416 0 1 0; #X msg 22 470 0 0 1; #X obj 222 326 * 4; #X obj 242 367 -; #X msg 242 347 1 \$1; #X obj 222 307 - 1; #X obj 254 398 mapping/curve 3; #X obj 121 103 vu 15 120 empty empty -1 -8 0 8 -66577 -1 1 0; #X msg 71 469 1 1 1; #X msg 183 536 color \$1 -1.67772e+07 -1.67772e+07; #X obj 178 246 / 100; #X floatatom 124 283 5 0 0 0 - - -; #X connect 0 0 2 0; #X connect 0 0 22 0; #X connect 1 0 0 0; #X connect 4 0 5 0; #X connect 4 1 6 0; #X connect 5 0 9 0; #X connect 5 1 8 1; #X connect 6 0 17 0; #X connect 6 1 7 0; #X connect 7 0 8 2; #X connect 8 0 21 0; #X connect 9 0 8 0; #X connect 10 0 8 0; #X connect 11 0 8 0; #X connect 12 0 8 0; #X connect 13 0 8 0; #X connect 14 0 16 0; #X connect 14 0 8 0; #X connect 15 0 8 1; #X connect 16 0 15 0; #X connect 17 0 14 0; #X connect 20 0 8 0; #X connect 21 0 3 0; #X connect 22 0 4 0; #X connect 22 0 23 0; #X coords 0 -1 1 1 37 125 1 100 100; hcs-0.2.1/gui/help/000077500000000000000000000000001422106453500140055ustar00rootroot00000000000000hcs-0.2.1/gui/help/asl-help.pd000066400000000000000000000007311422106453500160400ustar00rootroot00000000000000#N canvas 0 31 458 308 10; #X obj 142 80 asl; #X floatatom 269 196 5 0 0 0 - - -; #X obj 269 56 asl; #N canvas 404 246 494 344 META 0; #X text 12 105 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 85 AUTHOR Hans-Christoph Steiner; #X text 12 65 OUTLET_0 float; #X text 12 6 KEYWORDS control needs_work (help patch); #X text 12 45 DESCRIPTION; #X restore 392 276 pd META; #X connect 2 0 1 0; hcs-0.2.1/hcs-meta.pd000066400000000000000000000005421422106453500143200ustar00rootroot00000000000000#N canvas 0 31 200 200 10; #N canvas 20 20 420 300 META 0; #X text 10 10 META this is a prototype of a libdir meta file; #X text 10 30 NAME hcs; #X text 10 50 AUTHOR Hans-Christoph Steiner ; #X text 10 70 DESCRIPTION random grab bag of object prototypes; #X text 10 90 LICENSE GNU GPL; #X text 10 110 VERSION 0.2; #X restore 10 10 pd META; hcs-0.2.1/helppath-help.pd000066400000000000000000000023521422106453500153530ustar00rootroot00000000000000#N canvas 0 26 466 316 10; #X obj 40 130 helppath; #X msg 37 99 bang; #X obj 54 176 print; #X symbolatom 29 213 0 0 0 0 - - -; #X obj 101 151 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 79 102 reset; #X text 19 22 This object returns each path in the global classpath one at a time with each bang. [reset( refreshs the classpath data and starts again at the top of the list \, like [textfile] or [qlist]'s [reset(.; #X text 124 153 <-- banged when the end of the list is reached; #X text 234 294 released under the GNU GPL; #X text 18 281 (C) Copyright 2006 Hans-Christoph Steiner ; #X obj 31 238 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 280 175 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control pd_op; #X text 12 45 DESCRIPTION returns each path in the global class path ; #X text 12 65 INLET_0 bang reset; #X text 12 85 OUTLET_0 symbol; #X text 12 105 OUTLET_1 bang; #X restore 417 296 pd META; #X connect 0 0 2 0; #X connect 0 0 3 0; #X connect 0 1 4 0; #X connect 1 0 0 0; #X connect 3 0 10 0; #X connect 5 0 0 0; hcs-0.2.1/helppath.c000066400000000000000000000066171422106453500142540ustar00rootroot00000000000000/* * This object outputs the global search path for finding objects using a * similar interface as [textfile]. * * Copyright (c) 2007 Free Software Foundation * * 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 3 * of the License, or (at your option) any later version. * * See file LICENSE for further information on licensing terms. * * 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. */ #include #include #include /* #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #else #include #endif */ static char *version = "$Revision: 1.1 $"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *helppath_class; typedef struct _helppath { t_object x_obj; t_namelist *x_top; t_namelist *x_current; t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_helppath; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void helppath_output(t_helppath* x) { DEBUG(post("helppath_output");); /* TODO: think about using x->x_current->nl_next so that if [helppath] is at * the end of its list, and another element gets added to the global * helppath, [helppath] will output the new element on the next bang. */ if(x->x_current) { outlet_symbol( x->x_data_outlet, gensym(x->x_current->nl_string) ); x->x_current = x->x_current->nl_next; } else { outlet_bang(x->x_status_outlet); } } static void helppath_reset(t_helppath* x) { DEBUG(post("helppath_reset");); x->x_current = x->x_top = STUFF->st_helppath; } static void helppath_add(t_helppath* x, t_symbol *s) { DEBUG(post("helppath_add");); } static void *helppath_new() { DEBUG(post("helppath_new");); t_helppath *x = (t_helppath *)pd_new(helppath_class); x->x_data_outlet = outlet_new(&x->x_obj, &s_symbol); x->x_status_outlet = outlet_new(&x->x_obj, 0); helppath_reset(x); return (x); } void helppath_free() { // TODO: look into freeing the namelist } void helppath_setup(void) { DEBUG(post("helppath_setup");); helppath_class = class_new(gensym("helppath"), (t_newmethod)helppath_new, 0, sizeof(t_helppath), 0, 0); /* add inlet datatype methods */ class_addbang(helppath_class,(t_method) helppath_output); /* add inlet message methods */ class_addmethod(helppath_class,(t_method) helppath_reset, gensym("reset"), 0); class_addmethod(helppath_class,(t_method) helppath_add,gensym("add"), A_DEFSYMBOL, 0); logpost(NULL, 4, "[helppath] %s", version); logpost(NULL, 4, "\tcompiled on "__DATE__" at "__TIME__ " "); logpost(NULL, 4, "\tcompiled against Pd version %d.%d.%d", PD_MAJOR_VERSION, PD_MINOR_VERSION, PD_BUGFIX_VERSION); } hcs-0.2.1/hostname-help.pd000066400000000000000000000012071422106453500153620ustar00rootroot00000000000000#N canvas 0 26 353 225 10; #X obj 124 139 hostname; #X msg 124 94 bang; #X symbolatom 124 174 0 0 0 0 - - -; #X text 14 19 get the hostname of the machine. Currently it probably doesn't work on Windows...; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION get the hostname of the machine; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 symbol; #X restore 303 204 pd META; #X connect 0 0 2 0; #X connect 1 0 0 0; hcs-0.2.1/hostname.pd000066400000000000000000000003201422106453500144270ustar00rootroot00000000000000#N canvas 0 22 454 304 10; #X obj 91 29 inlet; #X obj 92 108 uname; #X obj 92 131 unpack symbol symbol symbol symbol symbol; #X obj 162 209 outlet; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 1 3 0; hcs-0.2.1/ifeel-help.pd000066400000000000000000000044641422106453500146400ustar00rootroot00000000000000#N canvas 0 26 480 482 10; #X obj 187 324 ifeel /dev/input/ifeel0; #X obj 242 224 hsl 128 20 0 255 0 0 empty empty interval_(0-255) 6 10 1 10 -225271 -1 -1 0 0; #X obj 294 253 hsl 128 20 0 255 0 0 empty empty count_(0-255) 6 10 1 10 -261681 -1 -1 0 0; #X obj 346 282 hsl 128 20 0 1 0 0 empty empty strength_(0-1) 6 10 1 10 -261689 -1 -1 0 0; #X obj 182 46 bng 25 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 -1; #X obj 226 46 bng 25 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 -1; #X msg 226 76 stop; #X msg 182 76 start; #X obj 343 305 nbx 5 14 -1e+37 1e+37 0 0 pack_bang_env empty empty 0 -6 0 10 -233017 -1 -1 0 256; #X obj 291 276 nbx 3 14 -1e+37 1e+37 0 0 pack_bang_env empty empty 0 -6 0 10 -233017 -1 -1 0 256; #X obj 239 247 nbx 3 14 -1e+37 1e+37 0 0 pack_bang_env empty empty 0 -6 0 10 -233017 -1 -1 0 256; #X obj 3 4 cnv 15 470 30 empty empty [ifeel] 4 12 1 16 -228992 -66577 0; #X text 73 10 control the pulse in an iFeel mouse; #X text 37 359 If you feed data to the ifeel mouse too quickly \, it has a tendency to crash the whole machine. I suspect a bug in the kernel module ifeel.o.; #X text 13 449 by Hans-Christoph Steiner ; #X obj 324 416 pddp/pddplink ../all_about_haptics.pd -text all_about_haptics ; #X text 201 417 For more info:; #X msg 251 168 strength 0.56; #X msg 234 124 interval 73; #X msg 243 147 count 14; #X msg 26 271 command 50 10 1; #X text 19 223 interval count strength; #X text 1 205 Or give a single command:; #X msg 26 249 command 25 255 1; #X msg 26 293 command 0 0 0; #N canvas 280 175 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control user_input; #X text 12 45 DESCRIPTION control the pulse in an iFeel mouse; #X text 12 65 INLET_0 start stop command interval count strength; #X text 12 85 INLET_1 float; #X text 12 105 INLET_2 float; #X text 12 125 INLET_3 float; #X restore 430 460 pd META; #X connect 1 0 10 0; #X connect 2 0 9 0; #X connect 3 0 8 0; #X connect 4 0 7 0; #X connect 5 0 6 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 3; #X connect 9 0 0 2; #X connect 10 0 0 1; #X connect 17 0 0 0; #X connect 18 0 0 0; #X connect 19 0 0 0; #X connect 20 0 0 0; #X connect 23 0 0 0; #X connect 24 0 0 0; hcs-0.2.1/ifeel.c000066400000000000000000000171411422106453500135250ustar00rootroot00000000000000/* * ifeel mouse object for Miller Puckette's Pure Data * copyright 2003 Hans-Christoph Steiner * 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 3 * 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. * * * based on ifeel_send.c from the linux iFeel driver: * http://sourceforge.net/projects/tactile * * there is a difference in the naming schemes of the ifeel driver and this * object. The ifeel driver uses strength, delay, and count. This object * uses strength, interval, and count. * * strength - the strength of the pulse (I am searching for a better word) * delay/interval - the interval in between each pulse * count - the total number of pulses to do */ #include #include #include #include #include #include #include #include #include #ifndef NT #include #endif #include "ifeel.h" #define DEBUG(x) /*#define DEBUG(x) x */ #define IFEEL_DEVICE "/dev/input/ifeel0" static t_class *ifeel_class; typedef struct _ifeel { t_object x_obj; int x_fd; struct ifeel_command x_ifeel_command; } t_ifeel; /****************************************************************************** support functions ******************************************************************************/ void ifeel_playcommand(t_ifeel *x) { /* const struct timespec *requested_time; */ /* struct timespec *remaining; */ #ifdef __linux__ if (ioctl(x->x_fd, USB_IFEEL_BUZZ_IOCTL, &x->x_ifeel_command) < 0) { post("x->x_fd: %d",x->x_fd); post("strength: %d interval: %d count: %d", x->x_ifeel_command.strength,x->x_ifeel_command.delay,x->x_ifeel_command.count); post("ERROR %s", strerror(errno)); close(x->x_fd); } #endif /* __linux__ */ DEBUG( post("strength: %d interval: %d count: %d", x->x_ifeel_command.strength,x->x_ifeel_command.delay,x->x_ifeel_command.count); post("");); } /****************************************************************************** input/control functions ******************************************************************************/ void ifeel_start(t_ifeel *x) { DEBUG(post("ifeel_start");) /* * since ifeel_stop sets everything to zero, we need to * read the inlets again to get current values */ ifeel_playcommand(x); } void ifeel_stop(t_ifeel *x) { DEBUG(post("ifeel_stop");); struct ifeel_command temp_ifeel_command; /* store previous command for restoring after stop */ temp_ifeel_command.strength = x->x_ifeel_command.strength; temp_ifeel_command.delay = x->x_ifeel_command.delay; temp_ifeel_command.count = x->x_ifeel_command.count; /* * there is no 'stop' ioctl, so set everything to zero * to achieve the same effect */ x->x_ifeel_command.strength = 0; x->x_ifeel_command.delay = 0; x->x_ifeel_command.count = 0; ifeel_playcommand(x); /* restore previous command so the start msg will work */ x->x_ifeel_command.strength = temp_ifeel_command.strength; x->x_ifeel_command.delay = temp_ifeel_command.delay; x->x_ifeel_command.count = temp_ifeel_command.count; } void ifeel_strength(t_ifeel *x, t_floatarg strength) { DEBUG(post("ifeel_strength");); /* * make sure its in the proper range * this object takes floats 0-1 * the ifeel driver takes ints 0-255 */ strength = strength * 255; strength = (strength > 255 ? 255 : strength); strength = (strength < 0 ? 0 : strength); x->x_ifeel_command.strength = (unsigned int)strength; } void ifeel_interval(t_ifeel *x, t_floatarg interval) { DEBUG(post("ifeel_interval");); interval = (interval < 0 ? 0 : interval); x->x_ifeel_command.delay = (unsigned int)interval; } void ifeel_count(t_ifeel *x, t_floatarg count ) { DEBUG(post("ifeel_count");); count = (count < 0 ? 0 : count); x->x_ifeel_command.count = (unsigned int)count; } void ifeel_command(t_ifeel *x, t_floatarg interval, t_floatarg count, t_floatarg strength) { DEBUG(post("ifeel_command");); ifeel_strength(x,strength); ifeel_interval(x,interval); ifeel_count(x,count); ifeel_playcommand(x); } static int ifeel_open(t_ifeel *x) { return 1; } /****************************************************************************** init/free functions ******************************************************************************/ void ifeel_free(t_ifeel *x) { DEBUG(post("ifeel_free");); /* stop effect */ ifeel_stop(x); /* close device */ close(x->x_fd); } void *ifeel_new(t_symbol *device, t_floatarg strength, t_floatarg interval, t_floatarg count) { DEBUG(post("ifeel_new");); t_ifeel *x = (t_ifeel *)pd_new(ifeel_class); post("iFeel mouse, by Hans-Christoph Steiner "); post(""); post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING"); post ("This object is under development! The interface could change at anytime!"); post ("As I write cross-platform versions, the interface might have to change."); post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING"); post(""); #ifndef __linux__ post(" !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!"); post(" This is a dummy, since this object only works with a Linux kernel!"); post(" !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!"); #endif /* * init to zero so I can use the ifeel_* methods to set the * struct with the argument values */ x->x_ifeel_command.strength = 0; x->x_ifeel_command.delay = 0; x->x_ifeel_command.count = 0; inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("interval")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("count")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("strength")); if (device != &s_) { post("Using %s",device->s_name); /* x->x_fd = open(IFEEL_DEVICE, O_RDWR); */ if ((x->x_fd = open((char *) device->s_name, O_RDWR | O_NONBLOCK, 0)) <= 0) { printf("ERROR %s\n", strerror(errno)); return 0; } /* ifeel_strength(x,strength); */ /* ifeel_interval(x,interval); */ /* ifeel_count(x,count); */ } else { post("ifeel: You need to set an ifeel device (i.e /dev/input/ifeel0)"); } return (void*)x; } void ifeel_setup(void) { DEBUG(post("ifeel_setup");); ifeel_class = class_new(gensym("ifeel"), (t_newmethod)ifeel_new, (t_method)ifeel_free, sizeof(t_ifeel), CLASS_DEFAULT, A_DEFSYMBOL, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); class_addbang(ifeel_class,ifeel_start); class_addmethod(ifeel_class, (t_method)ifeel_start,gensym("start"),0); class_addmethod(ifeel_class, (t_method)ifeel_stop,gensym("stop"),0); class_addmethod(ifeel_class, (t_method)ifeel_command,gensym("command"), A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); class_addmethod(ifeel_class, (t_method)ifeel_strength,gensym("strength"),A_DEFFLOAT,0); class_addmethod(ifeel_class, (t_method)ifeel_interval,gensym("interval"),A_DEFFLOAT,0); class_addmethod(ifeel_class, (t_method)ifeel_count,gensym("count"),A_DEFFLOAT,0); } hcs-0.2.1/ifeel.h000066400000000000000000000002461422106453500135300ustar00rootroot00000000000000#define USB_IFEEL_BUZZ_IOCTL _IOW('U', 1, struct ifeel_command) struct ifeel_command { unsigned int strength; unsigned int delay; unsigned int count; }; hcs-0.2.1/make-audio-dialog-help.pd000066400000000000000000000016521422106453500170210ustar00rootroot00000000000000#N canvas 0 26 432 293 10; #X msg 59 115 bang; #X msg 59 203 \; pd audio-dialog 0 0 0 0 2 0 0 0 0 0 0 0 2 0 0 0 44100 50 0; #X obj 59 176 make-audio-dialog; #X text 40 23 [make-audio-dialog] takes the audio-dialog message from [get-audio-dialog] and generates a clickable message box that will set the audio settings. This message box is also suitable for use with a [loadbang]; #N canvas 280 175 494 344 META 0; #X text 12 135 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 115 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control abstraction; #X text 12 45 DESCRIPTION take the audio-dialog message from [get-audio-dialog] and generate a clickable message box; #X text 12 75 INLET_0 anything; #X text 12 95 OUTLET_0 anything; #X restore 382 272 pd META; #X obj 59 147 get-audio-dialog; #X connect 0 0 5 0; #X connect 2 0 1 0; #X connect 5 0 2 0; hcs-0.2.1/make-audio-dialog.pd000066400000000000000000000010241422106453500160640ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 91 23 inlet; #X msg 338 141 set; #X obj 103 246 outlet; #X msg 274 146 addsemi; #X msg 216 150 add2 pd; #X obj 23 147 cyclone/prepend add2; #X obj 99 64 route audio-dialog; #X msg 72 173 add2 audio-dialog; #X obj 98 111 trigger anything bang bang bang bang; #X connect 0 0 6 0; #X connect 1 0 2 0; #X connect 3 0 2 0; #X connect 4 0 2 0; #X connect 5 0 2 0; #X connect 6 0 8 0; #X connect 7 0 2 0; #X connect 8 0 5 0; #X connect 8 1 7 0; #X connect 8 2 4 0; #X connect 8 3 3 0; #X connect 8 4 1 0; hcs-0.2.1/mouse_region-help.pd000066400000000000000000000022231422106453500162360ustar00rootroot00000000000000#N canvas 0 26 496 360 10; #X obj 33 173 pointer_position; #X obj 33 145 tgl 15 1 empty empty empty 0 -6 0 10 -262144 -1 -1 1 1; #X msg 52 144 bang; #X obj 342 136 cnv 15 100 60 empty empty empty 20 12 0 14 -233017 -66577 0; #X obj 52 84 keyup; #X obj 52 105 select 32; #X text 124 41 give mouse coordinates only after clicking and dragging in a region.; #X obj 145 295 unpack float float; #X floatatom 145 325 5 0 0 0 - - -; #X floatatom 250 325 5 0 0 0 - - -; #N canvas 419 129 494 344 META 0; #X text 12 195 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 175 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control user_input; #X text 12 45 DESCRIPTION give mouse coordinates only after clicking and dragging a region; #X text 12 95 INLET_1 float; #X text 12 115 INLET_2 float; #X text 12 135 INLET_3 float; #X text 12 155 OUTLET_0 list; #X text 12 75 INLET_0 float; #X restore 437 330 pd META; #X obj 145 246 mouse_region 342 443 137 194; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 4 0 5 0; #X connect 5 0 2 0; #X connect 7 0 8 0; #X connect 7 1 9 0; #X connect 11 0 7 0; hcs-0.2.1/mouse_region.pd000066400000000000000000000107061422106453500153150ustar00rootroot00000000000000#N canvas 354 110 732 550 10; #N canvas 224 109 399 332 constrain 0; #X obj 15 12 inlet; #X obj 112 254 outlet; #X obj 15 52 unpack float float float float; #X obj 45 116 receive \$0-xmin; #X obj 75 137 receive \$0-xmax; #X obj 15 137 moses; #X obj 45 157 moses; #X obj 112 225 pack float float; #X obj 200 137 moses; #X obj 230 157 moses; #X obj 260 137 receive \$0-ymax; #X obj 230 116 receive \$0-ymin; #X connect 0 0 2 0; #X connect 2 0 5 0; #X connect 2 1 8 0; #X connect 3 0 5 1; #X connect 4 0 6 1; #X connect 5 1 6 0; #X connect 6 0 7 0; #X connect 7 0 1 0; #X connect 8 1 9 0; #X connect 9 0 7 1; #X connect 10 0 9 1; #X connect 11 0 8 1; #X restore 100 461 pd constrain mouse messages; #N canvas 0 22 470 320 set 0; #X obj 75 26 inlet; #X obj 108 115 send \$0-xmax; #X obj 19 115 send \$0-xmin; #X obj 200 114 send \$0-ymin; #X obj 291 114 send \$0-ymax; #X obj 74 52 unpack float float float float; #X connect 0 0 5 0; #X connect 5 0 2 0; #X connect 5 1 1 0; #X connect 5 2 3 0; #X connect 5 3 4 0; #X restore 93 437 pd set xmin xmax ymin ymax; #X text 173 396 xmin xmax ymin ymax; #X msg 84 410 273 103 473 303; #X obj 83 15 inlet xmin; #X obj 234 14 inlet xmax; #X obj 385 14 inlet ymin; #X obj 536 14 inlet ymax; #X obj 448 436 outlet events; #X obj 83 83 unpack float float float float; #X obj 83 137 purepd/float_argument \$1; #X obj 234 137 purepd/float_argument \$2; #X obj 398 83 loadbang; #X obj 83 58 route list; #X obj 385 137 purepd/float_argument \$3; #X obj 536 137 purepd/float_argument \$4; #N canvas 0 22 601 552 constrain 0; #X obj 10 24 inlet data; #X obj 101 24 inlet xmin; #X obj 182 24 inlet xmax; #X obj 293 24 inlet ymin; #X obj 404 24 inlet ymax; #X obj 91 343 outlet; #X obj 61 110 unpack float float float float; #X obj 61 155 moses; #X obj 91 175 moses; #X obj 91 293 pack float float; #X obj 194 155 moses; #X obj 224 175 moses; #X obj 251 198 bang; #X obj 251 220 float; #X obj 191 198 bang; #X obj 191 220 float; #X obj 118 198 bang; #X obj 118 220 float; #X obj 51 198 bang; #X obj 51 220 float; #X connect 0 0 6 0; #X connect 1 0 7 1; #X connect 1 0 19 1; #X connect 2 0 8 1; #X connect 2 0 17 1; #X connect 3 0 10 1; #X connect 3 0 15 1; #X connect 4 0 11 1; #X connect 4 0 13 1; #X connect 6 0 7 0; #X connect 6 1 10 0; #X connect 7 0 18 0; #X connect 7 1 8 0; #X connect 8 0 9 0; #X connect 8 1 16 0; #X connect 9 0 5 0; #X connect 10 0 14 0; #X connect 10 1 11 0; #X connect 11 0 9 1; #X connect 11 1 12 0; #X connect 12 0 13 0; #X connect 13 0 9 1; #X connect 14 0 15 0; #X connect 15 0 9 1; #X connect 16 0 17 0; #X connect 17 0 9 0; #X connect 18 0 19 0; #X connect 19 0 9 0; #X restore 448 383 pd constrain mouse messages; #X obj 86 275 bang; #X obj 37 332 spigot; #N canvas 95 390 538 391 constrain 0; #X obj 113 352 outlet; #X obj 10 24 inlet data; #X obj 101 24 inlet xmin; #X obj 182 24 inlet xmax; #X obj 293 24 inlet ymin; #X obj 404 24 inlet ymax; #X obj 61 110 unpack float float float float; #X obj 61 155 moses; #X obj 91 175 moses; #X obj 214 155 moses; #X obj 244 175 moses; #X obj 204 212 bang; #X obj 113 330 &&; #X obj 238 212 bang; #X msg 238 235 1; #X msg 204 235 0; #X obj 58 212 bang; #X obj 92 212 bang; #X msg 92 235 1; #X msg 58 235 0; #X connect 1 0 6 0; #X connect 2 0 7 1; #X connect 3 0 8 1; #X connect 4 0 9 1; #X connect 5 0 10 1; #X connect 6 0 7 0; #X connect 6 1 9 0; #X connect 7 0 16 0; #X connect 7 1 8 0; #X connect 8 0 17 0; #X connect 8 1 16 0; #X connect 9 0 11 0; #X connect 9 1 10 0; #X connect 10 0 13 0; #X connect 10 1 11 0; #X connect 11 0 15 0; #X connect 12 0 0 0; #X connect 13 0 14 0; #X connect 14 0 12 1; #X connect 15 0 12 1; #X connect 16 0 19 0; #X connect 17 0 18 0; #X connect 18 0 12 0; #X connect 19 0 12 0; #X restore 137 290 pd constrain mousedown; #X obj 35 253 route motion mouseup mouse; #X msg 86 296 0; #X obj 35 222 iemguts/receivecanvas 1; #X connect 3 0 1 0; #X connect 4 0 13 0; #X connect 5 0 11 0; #X connect 6 0 14 0; #X connect 7 0 15 0; #X connect 9 0 10 0; #X connect 9 1 11 0; #X connect 9 2 14 0; #X connect 9 3 15 0; #X connect 10 0 16 1; #X connect 10 0 19 1; #X connect 11 0 16 2; #X connect 11 0 19 2; #X connect 12 0 11 0; #X connect 12 0 10 0; #X connect 12 0 14 0; #X connect 12 0 15 0; #X connect 13 0 9 0; #X connect 13 1 10 0; #X connect 14 0 16 3; #X connect 14 0 19 3; #X connect 15 0 16 4; #X connect 15 0 19 4; #X connect 16 0 8 0; #X connect 17 0 21 0; #X connect 18 0 16 0; #X connect 19 0 18 1; #X connect 20 0 18 0; #X connect 20 1 17 0; #X connect 20 2 19 0; #X connect 21 0 18 1; #X connect 22 0 20 0; hcs-0.2.1/noquit-help.pd000066400000000000000000000023301422106453500150610ustar00rootroot00000000000000#N canvas 0 26 420 305 10; #X obj 64 222 noquit; #X obj 64 107 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X msg 81 131 bang; #X msg 97 155 reset; #X msg 108 178 quit; #X obj 9 7 cnv 15 400 30 empty empty noquit 20 16 0 14 -261682 -66577 0; #X obj 64 250 bng 35 250 50 0 empty empty bang_on_quit 38 17 0 12 -261234 -1 -1; #X msg 108 198 quitnow; #X text 159 177 quit in the normal way; #X text 88 106 override/reset quitting; #X text 118 132 override quitting; #X text 139 153 re-enable normal quit function; #X text 159 197 quit now without any confirmation at all; #X text 34 58 override quitting Pd for installations \, performances \, etc.; #N canvas 280 175 494 344 META 0; #X text 12 135 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 115 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control abstraction pd_op; #X text 12 45 DESCRIPTION override quitting Pd for installations \, performances \, etc.; #X text 12 75 INLET_0 float bang reset quit quitnow; #X text 12 95 OUTLET_0 bang; #X restore 371 284 pd META; #X connect 0 0 6 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 7 0 0 0; hcs-0.2.1/noquit.pd000066400000000000000000000023651422106453500141430ustar00rootroot00000000000000#N canvas 0 31 497 454 10; #X obj 85 49 inlet; #X obj 86 75 route bang float; #X text 38 12 this disables/enables the menu_quit proc in the GUI to prevent quitting; #X obj 132 98 select 0; #X obj 191 145 bang; #X obj 332 121 print ERROR: no method for; #X obj 276 173 send pd; #X msg 237 142 verifyquit; #X msg 115 221 set semicolon [format %c 59]; #X obj 124 390 receive #noquit; #X obj 124 421 outlet; #X msg 16 200 proc menu_quit "" [list pd "#noquit bang $semicolon"] ; #X obj 16 175 trigger bang bang; #X msg 191 339 rename old_menu_quit menu_quit; #X obj 191 297 trigger bang bang; #X msg 131 241 rename menu_quit old_menu_quit; #X msg 290 318 rename menu_quit ""; #X obj 191 98 route reset quit quitnow; #X msg 312 142 quit; #X obj 124 363 hcs/sys_gui; #X connect 0 0 1 0; #X connect 1 0 12 0; #X connect 1 1 3 0; #X connect 1 2 17 0; #X connect 3 0 4 0; #X connect 3 1 12 0; #X connect 4 0 14 0; #X connect 7 0 6 0; #X connect 8 0 19 0; #X connect 9 0 10 0; #X connect 11 0 19 0; #X connect 12 0 11 0; #X connect 12 1 8 0; #X connect 12 1 15 0; #X connect 13 0 19 0; #X connect 14 0 13 0; #X connect 14 1 16 0; #X connect 15 0 19 0; #X connect 16 0 19 0; #X connect 17 0 4 0; #X connect 17 1 7 0; #X connect 17 2 18 0; #X connect 17 3 5 0; #X connect 18 0 6 0; hcs-0.2.1/passwd-help.pd000066400000000000000000000035621422106453500150530ustar00rootroot00000000000000#N canvas 0 26 517 370 10; #X obj 98 40 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X floatatom 95 63 5 0 0 0 User_ID - -; #X obj 47 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 194 148 10; #X msg 112 86 bang; #X text 209 168 <-- set by argument or cold inlet; #X text 148 85 output current; #X obj 94 167 passwd; #X text 37 20 fetch passwd data based on UID or username; #X msg 271 83 symbol hans; #X symbolatom 22 318 0 0 0 3 username - -; #X symbolatom 88 317 0 0 0 3 password - -; #X floatatom 184 317 0 0 0 3 uid - -; #X floatatom 215 317 0 0 0 3 gid - -; #X symbolatom 264 317 0 0 0 3 gecos - -; #X symbolatom 335 282 0 0 0 3 home_folder - -; #X symbolatom 395 250 0 0 0 3 shell - -; #X msg 269 105 symbol trash; #X text 361 105 ignore bad usernames; #X text 363 83 use a symbolic username; #X msg 269 56 symbol daemon; #X text 188 195 bang on right inlet if no match; #X obj 138 195 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 76 224 unpack symbol symbol float float symbol symbol symbol ; #N canvas 280 175 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION fetch passwd data based on UID or username ; #X text 12 65 INLET_0 float bang; #X text 12 85 INLET_1 float; #X text 12 105 OUTLET_0 anything; #X text 12 125 OUTLET_1 bang; #X restore 468 349 pd META; #X connect 0 0 1 0; #X connect 1 0 7 0; #X connect 3 0 7 1; #X connect 4 0 7 0; #X connect 7 0 2 0; #X connect 7 0 23 0; #X connect 7 1 22 0; #X connect 9 0 7 0; #X connect 17 0 7 0; #X connect 20 0 7 0; #X connect 23 0 10 0; #X connect 23 1 11 0; #X connect 23 2 12 0; #X connect 23 3 13 0; #X connect 23 4 14 0; #X connect 23 5 15 0; #X connect 23 6 16 0; hcs-0.2.1/passwd.c000066400000000000000000000136051422106453500137430ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* converts a UID number to a user name symbol */ /* Written by Hans-Christoph Steiner */ /* */ /* Copyright (c) 2006 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #ifndef _WIN32 // this doesn't work on Windows (yet?) #include #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #include #else #include #include #endif #include static char *version = "$Revision: 1.3 $"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *passwd_class; typedef struct _passwd { t_object x_obj; t_float x_uid; t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_passwd; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void passwd_output(t_passwd *x) { DEBUG(post("passwd_output");); struct passwd *passwd_pointer; t_atom output_data[6]; #ifdef _WIN32 /* TODO: implement for Windows! */ #else if( x->x_uid < 0 ) { post("[passwd]: ignoring bad username or UID less than zero"); outlet_bang(x->x_status_outlet); } else { passwd_pointer = getpwuid((uid_t)x->x_uid); if( passwd_pointer != NULL ) { SETSYMBOL(output_data, gensym(passwd_pointer->pw_passwd)); SETFLOAT(output_data + 1, passwd_pointer->pw_uid); SETFLOAT(output_data + 2, passwd_pointer->pw_gid); SETSYMBOL(output_data + 3, gensym(passwd_pointer->pw_gecos)); SETSYMBOL(output_data + 4, gensym(passwd_pointer->pw_dir)); SETSYMBOL(output_data + 5, gensym(passwd_pointer->pw_shell)); outlet_anything(x->x_data_outlet, gensym(passwd_pointer->pw_name), 6, output_data); } else { outlet_bang(x->x_status_outlet); } } #endif /* _WIN32 */ } static t_float get_uid_from_arguments(int argc, t_atom *argv) { t_symbol *first_argument; t_float uid = -1; struct passwd *passwd_pointer; if(argc == 0) return(0); if(argc != 1) post("[passwd]: too many arguments (%d), ignoring all but the first", argc); first_argument = atom_getsymbolarg(0,argc,argv); if(first_argument == &s_) { // single float arg means UID # uid = atom_getfloatarg(0,argc,argv); if( uid < 0 ) { error("[passwd]: UID less than zero not allowed (%d)", (int)uid); return(-1); } } else { // single symbol arg means username passwd_pointer = getpwnam(first_argument->s_name); if( passwd_pointer != NULL ) return((t_float) passwd_pointer->pw_uid); else return(-1); } return(-1); } static void passwd_set(t_passwd *x, t_symbol *s, int argc, t_atom *argv) { /* get rid of the unused variable warning with the if() statement */ if( strcmp(s->s_name, "set") == 0 ) x->x_uid = get_uid_from_arguments(argc, argv); } static void passwd_float(t_passwd *x, t_float f) { x->x_uid = f; passwd_output(x); } static void passwd_symbol(t_passwd *x, t_symbol *s) { t_atom argv[1]; SETSYMBOL(argv, s); passwd_set(x, gensym("set"), 1, argv); passwd_output(x); } static void *passwd_new(t_symbol *s, int argc, t_atom *argv) { DEBUG(post("passwd_new");); t_passwd *x = (t_passwd *)pd_new(passwd_class); floatinlet_new(&x->x_obj, &x->x_uid); x->x_data_outlet = outlet_new(&x->x_obj, 0); x->x_status_outlet = outlet_new(&x->x_obj, 0); passwd_set(x, gensym("set"), argc, argv); return (x); } void passwd_free(void) { #ifdef _WIN32 #else endpwent(); #endif /* _WIN32 */ } void passwd_setup(void) { DEBUG(post("passwd_setup");); passwd_class = class_new(gensym("passwd"), (t_newmethod)passwd_new, 0, sizeof(t_passwd), 0, A_GIMME, 0); /* add inlet datatype methods */ class_addbang(passwd_class, (t_method) passwd_output); class_addfloat(passwd_class, (t_method) passwd_float); class_addsymbol(passwd_class, (t_method) passwd_symbol); /* add inlet message methods */ class_addmethod(passwd_class, (t_method) passwd_set, gensym("set"), A_GIMME, 0); logpost(NULL, 4, "[passwd] %s",version); logpost(NULL, 4, "\twritten by Hans-Christoph Steiner "); logpost(NULL, 4, "\tcompiled on "__DATE__" at "__TIME__ " "); } #endif /* NOT _WIN32 */ hcs-0.2.1/pd-lib-builder/000077500000000000000000000000001422106453500150645ustar00rootroot00000000000000hcs-0.2.1/pd-lib-builder/CHANGELOG.txt000066400000000000000000000066431422106453500171250ustar00rootroot00000000000000Changelog for Makefile.pdlibbuilder. v0.6.0, dated 2019-12-21 - detect target platform (OS and architecture) rather than build platform (#55) - introduce optional user variable 'PLATFORM' for cross compilation - no longer build OSX/MacOS fat binaries by default (#21, #50) - do build fat binaries when 'extension=d_fat' is specified for OSX/MacOS - fix bug where minimum OSX/MacOS version wasn't defined, and set it to 10.6 v0.5.1, dated 2018-03-15 Fixes and improvements for Windows builds: - properly evaluate variables 'PDDIR' and 'PDBINDIR' to find pd.dll - define default path of 32 bit Pd on 64 bit Windows - link C++ externals with standard C libs on Windows, they don't load otherwise - strip installed Windows binaries by default (issues #34, #39, #41, #42 respectively) Warning for all platforms: variable 'PD_PATH' is no longer supported, use the equivalent 'PDDIR'. v0.5.0, dated 2018-01-23 Implement target architecture detection for Windows builds, and set appropriate options for 32 and 64 bit (used to be for 32 bit only). (feature, issue #37 #38, merge commit 215bf3e) v0.4.4, dated 2016-11-22 Use variable 'system' when evaluating 'for{Linux,Darwin,Windows}' (bugfix, issue #31, commit 2c14110) v0.4.3, dated 2016-11-02 Replace flags '-fpic' by 'fPIC'. (bugfix, issue #29, commit 426b38b) v0.4.2, dated 2016-10-30 Fix issue where incorrect message about m_pd.h is given. (bugfix, commit 2e13d8f) v0.4.1, dated 2016-10-27 Respect cflag for minimum OSX version when defined by lib makefile. (bugfix, pull request #22, commit 48c4127) v0.4.0, dated 2016-10-14 Introduced path variables PDDIR, PDINCLUDEDIR, PDBINDIR, PDLIBDIR which can also be defined in environment. (feature, issue #27, commit b0dab72) v0.3.1, dated 2016-10-13 Fix bug where pd.dll wouldn't be found. (bugfix, commit a0c87be) v0.3.0, dated 2016-10-09 Variable 'PD_PATH' introduced for pd-extended / pd-l2ork compatibility. (feature, issue #26, commit 41e9743) v0.2.8, dated 2016-10-09 Allow installed files to contain weird characters (notably '$'). (bugfix, pull request #20, commit 5b920b1) v0.2.7, dated 2016-10-04 Remove all default pd search paths except vanilla's. (discussion, issue #25, commit a6a89dc) v0.2.6, dated 2016-09-20 Redefined dependency checking so it won't stall rebuilds on OSX. (bugfix, issue #16, commit 9fd1795) v0.2.5, dated 2016-06-26 Fixed dependency checking for object files in other directories. (bugfix, commit f06e550) v0.2.4, dated 2016-06-25 Fixed regression bug that disabled all dependency checking. (bugfix, commit 1d7bb5e) v0.2.3, dated 2016-03-29 Disabled dependency checking for OSX <= 10.5 because it stalled rebuilds. (bugfix, issue #16, commit eb614fd) v0.2.2, dated 2016-03-28 Removed target 'pre' because it forced rebuild of everything in 'all'. (bugfix, issue #17, commit c989c8e) v0.2.1, dated 2015-12-27 Implement / respect 'CPPFLAGS','CFLAGS'and 'LDFLAGS'. (bugfix, issue #5, commit 98f3582) v0.2.0, dated 2015-12-19 Added per-platform multiline defines 'forLinux', 'forDarwin', 'forWindows'. (feature, pull request #9, commit 3946ea5) v0.1.0, dated 2015-12-08 Added targets 'pre' and 'post' to automatically run before and after 'all'. (feature, pull request #4, commit a5678ac) v0.0.2, dated 2015-12-06 Improved methods for searching pd paths. (bugfix, commit ed37e6b) v0.0.1, dated 2015-10-31 Fixed expansion of variable 'lib.version'. (bugfix, issue #1, commit 974b617) v0.0.0, dated 2015-06-24 Initial version. (commit 16517a2) hcs-0.2.1/pd-lib-builder/Makefile.pdlibbuilder000066400000000000000000001266041422106453500211750ustar00rootroot00000000000000# Makefile.pdlibbuilder dated 2019-12-21 version = 0.6.0 # 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. # # Grab the newest version of Makefile.pdlibbuilder from # https://github.com/pure-data/pd-lib-builder/ # # 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 # # Optional multiline defines evaluated per operating system: # # - forLinux # - forDarwin # - forWindows # # Variables available for your makefile or make command line: # # - make-lib-executable # - suppress-wunused # # Path variables for make command line or environment: # # - PDDIR # - PDINCLUDEDIR # - PDBINDIR # - PDLIBDIR # # Standard make variables for make command line or environment: # # - CPPFLAGS # - CFLAGS # - LDFLAGS # - CC # - CXX # - INSTALL # - STRIP # - DESTDIR # # Optional user variables for make command line or environment: # # - PLATFORM # # Deprecated path variables: # # - pdincludepath # - pdbinpath # - objectsdir # # #=== 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. # # forLinux, forDarwin, forWindows: # Shorthand for 'variable definitions for Linux only' etc. Use like: # define forLinux # cflags += -DLINUX # class.sources += linuxthing.c # endef # # makefiles and makefiledirs: # Extra makefiles or directories with makefiles that should be made in sub-make # processes. # # 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 overridden 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. # # PDDIR: # Root directory of 'portable' pd package. When defined, PDINCLUDEDIR and # PDBINDIR will be evaluated as $(PDDIR)/src and $(PDDIR)/bin. # # PDINCLUDEDIR: # Directory where Pd API m_pd.h should be found, and other Pd header files. # Overrides the default search path. # # PDBINDIR: # Directory where pd.dll should be found for linking (Windows only). Overrides # the default search path. # # PDLIBDIR: # Root directory for installation of Pd library directories. Overrides the # default install location. # # DESTDIR: # Prepended path component for staged install. # # PLATFORM: # Target platform for cross compilation in the form of GNU triplet: # cpu-vendor-os. Example: x86_64-w64-mingw32. This specifies the tool chain that # pdlibbuilder will use, if installed and locatable. System and architecture # will then be autodefined accordingly. In most cases no other variables need to # be overridden. # # CPPFLAGS: # Preprocessor flags which are not strictly required for building. # # CFLAGS: # Compiler flags which are not strictly required for building. Compiler flags # defined by Makefile.pdlibbuilder for warning, optimization and architecture # specification are overriden by CFLAGS. # # LDFLAGS: # Linker flags which are not strictly required for building. Linker flags # defined by Makefile.pdlibbuilder for architecture specification are overriden # by LDFLAGS. # # CC and CXX: # C and C++ compiler programs as defined in your build environment. # # INSTALL # Definition of install program. # # STRIP # Name of strip program. Default 'strip' can be overridden in cross compilation # environments. # # objectsdir: # Root directory for installation of Pd library directories, like PDLIBDIR but # not overridable by environment. Supported for compatibility with pd-extended # central makefile, but deprecated otherwise. # # pdincludepath, pdbinpath: # As PDINCLUDEDIR and PDBINDIR but not overridable by environment. Deprecated # as user variables. # # #=== 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. # # Default search path for m_pd.h and other API header files is platform # dependent, and overridable by PDINCLUDEDIR: # # Linux: /usr/include/pd # # OSX: /Applications/Pd*.app/Contents/Resources/src # # Windows: %PROGRAMFILES%/Pd/src # %PROGRAMFILES(X86)%/Pd/src (32 bit builds on 64 bit Windows) # # Default search path for binary pd.dll (Windows), overridable by PDBINDIR # # %PROGRAMFILES%/Pd/bin # %PROGRAMFILES(X86)%/Pd/bin (32 bit builds on 64 bit Windows) # # Default location to install pd libraries is platform dependent, and # overridable by PDLIBDIR: # # Linux: /usr/local/lib/pd-externals # OSX: ~/Library/Pd # Windows: %APPDATA%/Pd # # https://puredata.info/docs/faq/how-do-i-install-externals-and-help-files # 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 $(executables) plus optional post target # post: target to build after $(executables) # 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 # dumpmachine: print compiler output of option '-dumpmachine' # coffee: dummy target # # Variable $(executables) expands to class executables plus optional shared lib, # or alternatively to single lib executable when make-lib-executable=true. # Targets pre and post can be defined by library makefile. Make sure to include # Makefile.pdlibbuilder first so default target all will not be redefined. # # #=== 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 # - 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. 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 ################################################################################ ### target platform detection ################################################## ################################################################################ #=== target platform =========================================================== # PLATFORM: optional user variable to define target platform for cross # compilation. Redefine build tools accordingly. PLATFORM should match # the exact target prefix of tools present in $PATH, like x86_64-w64-mingw32, # x86_64-apple-darwin12 etc. Tool definitions are exported to ensure submakes # will get the same. ifneq ($(PLATFORM),) ifneq ($(findstring darwin, $(PLATFORM)),) export CC = $(PLATFORM)-cc export CXX = $(PLATFORM)-c++ export CPP = $(PLATFORM)-cc else export CC = $(PLATFORM)-gcc export CXX = $(PLATFORM)-g++ export CPP = $(PLATFORM)-cpp endif STRIP = $(PLATFORM)-strip endif # Let (native or cross-) compiler report target triplet and isolate individual # words therein to facilitate later processing. target.triplet := $(subst -, ,$(shell $(CC) -dumpmachine)) #=== operating system ========================================================== # The following systems are defined: Linux, Darwin, Windows. GNU and # GNU/kFreeBSD are treated as Linux to get the same options. ifneq ($(filter linux gnu% kfreebsd, $(target.triplet)),) system = Linux endif ifneq ($(filter darwin%, $(target.triplet)),) system = Darwin endif ifneq ($(filter mingw% cygwin%, $(target.triplet)),) system = Windows endif # evaluate possible system-specific multiline defines from library makefile $(eval $(for$(system))) # TODO: Cygwin, Android #=== architecture ============================================================== # The following CPU names can be processed by pdlibbuilder: # i*86 Intel 32 bit # x86_64 Intel 64 bit # arm ARM 32 bit # aarch64 ARM 64 bit target.arch := $(firstword $(target.triplet)) ################################################################################ ### variables per platform ##################################################### ################################################################################ #=== flags per architecture ==================================================== # Set architecture-dependent cflags, mainly for Linux. For Mac and Windows, # arch.c.flags are overriden below. To see gcc's default architecture flags: # $ gcc -Q --help=target # ARMv6: Raspberry Pi 1st gen, not detectable from target.arch ifeq ($(shell uname), armv6l) arch.c.flags = -march=armv6 -mfpu=vfp -mfloat-abi=hard # ARMv7: Beagle, Udoo, RPi2 etc. else ifeq ($(target.arch), arm) arch.c.flags = -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard # ARMv8 64 bit, not tested yet else ifeq ($(target.arch), aarch64) arch.c.flags = -mcpu=cortex-a53 # Intel 32 bit, build with SSE and SSE2 instructions else ifneq ($(filter i%86, $(target.arch)),) arch.c.flags = -march=pentium4 -mfpmath=sse -msse -msse2 # Intel/AMD 64 bit, build with SSE, SSE2 and SSE3 instructions else ifeq ($(target.arch), x86_64) arch.c.flags = -march=core2 -mfpmath=sse -msse -msse2 -msse3 # if none of the above architectures detected else arch.c.flags = endif #=== flags and paths for Linux ================================================= ifeq ($(system), Linux) prefix = /usr/local libdir := $(prefix)/lib pkglibdir = $(libdir)/pd-externals pdincludepath := $(wildcard /usr/include/pd) 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) endif #=== flags and paths for Darwin ================================================ # LLVM-clang doesn't support -fcheck-new, therefore this flag is only used when # compiling with g++. ifeq ($(system), Darwin) pkglibdir = $(HOME)/Library/Pd pdincludepath := $(firstword $(wildcard \ /Applications/Pd*.app/Contents/Resources/src)) 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 ifneq ($(filter %g++, $(CXX)),) cxx.flags := -fcheck-new endif ifeq ($(extension), d_fat) arch := i386 x86_64 else arch := $(target.arch) endif ifneq ($(filter -mmacosx-version-min=%, $(cflags)),) version.flag := $(filter -mmacosx-version-min=%, $(cflags)) else version.flag = -mmacosx-version-min=10.6 endif arch.c.flags := $(addprefix -arch , $(arch)) $(version.flag) arch.ld.flags := $(arch.c.flags) 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 when probing for a path, and use double quotes # when specifying a path in a command argument. # Default paths in Mingw / Mingw-w64 environments. 'PROGRAMFILES' is standard # location for builds with native architecture, 'ProgramFiles(x86)' for i686 # builds on x86_64 Windows (detection method by Lucas Cordiviola). Curly braces # required because of parentheses in variable name. ifeq ($(system), Windows) pkglibdir := $(APPDATA)/Pd ifeq ($(target.arch), i686) programfiles := ${ProgramFiles(x86)} else programfiles := $(PROGRAMFILES) endif pdbinpath := $(programfiles)/Pd/bin pdincludepath := $(programfiles)/Pd/src endif # Store default path to pd.dll in PDBINDIR if the latter is not user-defined. # For include path this is done in the platform-independent paths section below, # but for PDBINDIR it is done here so ld flags can be evaluated as immediate # variables. ifeq ($(system), Windows) ifdef PDDIR PDBINDIR := $(PDDIR)/bin endif PDBINDIR ?= $(pdbinpath) endif # TODO: decide whether -mms-bitfields should be specified. ifeq ($(system), Windows) cpp.flags := -DMSW -DNT ifeq ($(target.arch), i686) arch.c.flags := -march=pentium4 -msse -msse2 -mfpmath=sse else ifeq ($(target.arch), x86_64) cpp.flags := -DMSW -DNT -DPD_LONGINTTYPE=__int64 arch.c.flags := -march=core2 -msse -msse2 -msse3 -mfpmath=sse else arch.c.flags = endif extension = dll c.flags := c.ldflags := -static-libgcc -shared \ -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" c.ldlibs := cxx.flags := -fcheck-new cxx.ldflags := -static-libgcc -static-libstdc++ -shared \ -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" cxx.ldlibs := shared.extension = dll shared.ldflags := -static-libgcc -shared "$(PDBINDIR)/pd.dll" stripflags = --strip-all endif #=== paths ===================================================================== # Platform-dependent default paths are specified above, but overridable. # Path variables in upper case can be defined as make command argument or in the # environment. Variable 'objectsdir' is supported for compatibility with # the build system that pd-l2ork has inherited from pd-extended. PDINCLUDEDIR ?= $(pdincludepath) PDLIBDIR ?= $(firstword $(objectsdir) $(pkglibdir)) ifdef PDDIR PDINCLUDEDIR := $(wildcard $(PDDIR)/src) endif # base path where all components of the lib will be installed by default installpath := $(DESTDIR)$(PDLIBDIR)/$(lib.name) # check if include path 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, $(PDINCLUDEDIR)), $(PDINCLUDEDIR)) #=== 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 "$(PDINCLUDEDIR)" $(cpp.flags) $(CPPFLAGS) # flags for dependency checking (cflags from makefile may define -I options) depcheck.flags := $(cpp.flags) $(cflags) # 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. # print Makefile.pdlibbuilder version before possible termination $(info ++++ info: using Makefile.pdlibbuilder version $(version)) # Terminate if target triplet remained empty, to avoid all sorts of confusing # scenarios and spurious bugs. ifeq ($(target.triplet),) $(error Command "$(CC) -dumpmachine" did not return a target triplet, \ needed for a build. \ Is compiler "$(CC)" installed in your PATH? ($(PATH)). \ Does compiler "$(CC)" support option "-dumpmachine"?) endif # '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 # store path to Pd API m_pd.h if it is found ifdef PDINCLUDEDIR mpdh := $(shell ls "$(PDINCLUDEDIR)/m_pd.h") endif # store path to pd.dll; if not found, ls will give a useful error ifeq ($(system), Windows) pddll := $(shell ls "$(PDBINDIR)/pd.dll") endif # when making target all, check if m_pd.h is found and print info about it ifeq ($(goals), all) $(if $(mpdh), \ $(info ++++ info: using Pd API $(mpdh)), \ $(warning Where is Pd API m_pd.h? Do 'make help' for info.)) endif # 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 post build-lib \ $(classes) $(makefiledirs) $(makefiles) \ install install-executables install-datafiles install-datadirs \ force clean vars allvars depend help ################################################################################ ### rules: build targets ####################################################### ################################################################################ # Target all forces the build of targets [$(executables) post] in # deterministic order. Target $(executables) builds class executables plus # optional shared lib or alternatively a single lib executable when # make-lib-executable=true. Target post is optionally defined by # library makefile. all: post post: $(executables) all: $(info ++++info: target all in lib $(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. disable-dependency-tracking := $(strip $(pdincludepathwithspaces)) ifndef disable-dependency-tracking must-build-everything := $(filter all, $(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) # dir is explicitly added because option -MM strips it by default define declare-object-target $(dir $1)$(filter %.o: %.h, $(shell $(CPP) $(depcheck.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 ################################################ ################################################################################ #=== strip ===================================================================== # Stripping of installed binaries will only be done when variable 'stripflags' # is defined non-empty. No default definition is provided except for Windows # where the unstripped binaries are large, especially in the case of Mingw-w64. # Note: while stripping all symbols ('-s' or '--strip-all') is possible for # Linux and Windows, in the case of OSX only non-global symbols can be stripped # (option '-x' or '--discard-all'). # Make definition of strip command overridable so it can be defined in an # environment for cross-compilation. STRIP ?= strip # Commands in 'strip-executables' will be executed conditionally in the rule for # target 'install-executables'. strip-executables = cd "$(installpath)" && \ $(foreach v, $(executables), $(STRIP) $(stripflags) '$v';) #=== install =================================================================== # 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)" $(foreach v, $(executables), \ $(INSTALL_PROGRAM) '$v' "$(installpath)";) $(info ++++ info: executables of lib $(lib.name) installed \ from $(CURDIR) to $(installpath)) $(if $(stripflags), $(strip-executables),) install-datafiles: all $(INSTALL_DIR) -v "$(installpath)" $(foreach v, $(datafiles), \ $(INSTALL_DATA) '$(v)' "$(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 ifdef mpdh mpdhinfo := $(mpdh) else mpdhinfo := m_pd.h was not found. Is Pd installed? endif 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 " $(mpdhinfo)" @echo " You may specify your preferred Pd include directory as argument" @echo " to the make command, like 'PDINCLUDEDIR=path/to/pd/src'." @echo @echo " Path for installation of your libdir(s):" @echo " $(PDLIBDIR)" @echo " Alternatively you may specify your path for installation as argument" @echo " to the make command, like 'PDLIBDIR=path/to/pd-externals'." @echo @echo " Default paths are listed in the doc sections in Makefile.pdlibbuilder." @echo #=== platform test ============================================================= # This target can be used to test if the compiler for specified PLATFORM is # correctly defined and available. dumpmachine: @$(CC) -dumpmachine #=== 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: hcs-0.2.1/pd-lib-builder/README.md000066400000000000000000000102421422106453500163420ustar00rootroot00000000000000 ### Makefile.pdlibbuilder ### Helper makefile for Pure Data external libraries. Written by Katja Vetter March-June 2015 for the public domain and since then developed as a Pd community project. 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 target platform * 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 name == 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, read the documentation sections in Makefile.pdlibbuilder. ### paths ### Makefile.pdlibbuilder >= v0.4.0 supports pd path variables which can be defined not only as make command argument but also in the environment, to override platform-dependent defaults: PDDIR: Root directory of 'portable' pd package. When defined, PDINCLUDEDIR and PDBINDIR will be evaluated as $(PDDIR)/src and $(PDDIR)/bin. PDINCLUDEDIR: Directory where Pd API m_pd.h should be found, and other Pd header files. Overrides the default search path. PDBINDIR: Directory where pd.dll should be found for linking (Windows only). Overrides the default search path. PDLIBDIR: Root directory for installation of Pd library directories. Overrides the default install location. ### documentation ### This README.md provides only basic information. A large comment section inside Makefile.pdlibbuilder lists and explains the available user variables, default paths, and targets. The internal documentation reflects the exact functionality of the particular version. For suggestions about project maintenance and advanced compilation see tips-tricks.md. ### versioning ### The project is versioned in MAJOR.MINOR.BUGFIX format (see http://semver.org), and maintained at https://github.com/pure-data/pd-lib-builder. Pd lib developers are invited to regulary check for updates, and to contribute and discuss improvements here. If you really need to distribute a personalized version with your library, rename Makefile.pdlibbuilder to avoid confusion. ### examples ### The list of projects using pd-lib-builder can be helpful if you are looking for examples, from the simplest use case to more complex implementations. - helloworld: traditional illustration of simplest use case - pd-windowing: straightforward real world use case of a small library - pd-nilwind / pd-cyclone: more elaborate source tree - zexy: migrated from autotools to pd-lib-builder ### projects using pd-lib-builder ### non-exhaustive list https://github.com/pure-data/helloworld https://github.com/electrickery/pd-nilwind https://github.com/electrickery/pd-maxlib https://github.com/electrickery/pd-sigpack https://github.com/electrickery/pd-tof https://github.com/electrickery/pd-windowing https://github.com/electrickery/pd-smlib https://github.com/porres/pd-cyclone https://github.com/porres/pd-else https://github.com/porres/pd-psycho https://git.iem.at/pd/comport https://git.iem.at/pd/hexloader https://git.iem.at/pd/iemgui https://git.iem.at/pd/iemguts https://git.iem.at/pd/iemlib https://git.iem.at/pd/iemnet https://git.iem.at/pd/iem_ambi https://git.iem.at/pd/iem_tab https://git.iem.at/pd/iem_adaptfilt https://git.iem.at/pd/iem_roomsim https://git.iem.at/pd/iem_spec2 https://git.iem.at/pd/mediasettings https://git.iem.at/pd/zexy https://git.iem.at/pd-gui/punish https://github.com/residuum/PuRestJson https://github.com/libpd/abl_link https://github.com/wbrent/timbreID https://github.com/MetaluNet/moonlib hcs-0.2.1/pd-lib-builder/tips-tricks.md000066400000000000000000000162561422106453500176740ustar00rootroot00000000000000pd-lib-builder cheatsheet ========================= # Creating special builds ## cross-compiling on linux x86_64 for other platforms Using pd-lib-builder >=0.6.0 we can define variable `PLATFORM` to specify a target triplet for cross-compilation. Example to build W32 binaries (assuming package `mingw-w64` is installed and a W32 package for Pd is unzipped into a path `${PDWIN32}`: make PLATFORM=x86_64-w64-mingw32 PDDIR="${PDWIN32}" #### older pd-lib-builder versions Using pd-lib-builder < 0.6.0, in the absence of variable `PLATFORM`, you would instead override variables `system`, `target.arch`, `CC` and / or `CXX`, `STRIP`. Example: make system=Windows target.arch=i686 CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip PDDIR="${PDWIN32}" #### toolchains Cross toolchains for relevant platforms in Debian Buster (install g++ with dependencies for a given platform to get the whole tool chain): - `arm-linux-gnueabihf` - `aarch64-linux-gnu` - `i686-linux-gnu` - `i686-w64-mingw32` and `x86_64-w64-mingw32` (install `mingw-w64`) OSX/MacOS cross tool chains are not distributed by Debian. Use project `osxcross` from Thomas Poechtraeger to create the tools. ## building double-precision externals At the time of writing (2018-02) there is no official Pd that supports double-precision numbers yet. However, if you do get hold of an experimental double-precision Pd, you can easily build your externals for 64-bit numbers: make CPPFLAGS="-DPD_FLOATSIZE=64" ## building externals for W64 (64-bit Windows) At the time of writing (2018-02) there is no official Pd that supports W64 yet. However, if you do get hold of an experimental W64 Pd, you can easily build your externals for this environment with make CPPFLAGS="-DPD_LONGINTTYPE=__int64" CC=x86_64-w64-mingw32-gcc To build a double-precision external for W64, use something like: make CPPFLAGS="-DPD_LONGINTTYPE=__int64 -DPD_FLOATSIZE=64" CC=x86_64-w64-mingw32-gcc ## TODO universal binaries on OSX # Project management In general it is advised to put the `Makefile.pdlibbuilder` into a separate subdirectory (e.g. `pd-lib-builder/`). This makes it much easier to update the `Makefile.pdlibbuilder` later You *should* also use a variable to the actual path of the Makefile.pdlibbuilder (even if you keep it in the root-directory), as this allows easy experimenting with newer (or older) (or site-specific) versions of the pd-lib-builder Makefile. ~~~make PDLIBBUILDER_DIR=pd-lib-builder/ include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder ~~~ ## Keeping pd-lib-builder up-to-date ### `git subtree` With git-subtrees, you make the pd-lib-builder repository (or any other repository for that matter) part of your own repository - with full history and everything - put nicely into a distinct subdirectory. Support for *manipulating* subtrees has been added with Git-v1.7.11 (May 2012). The nice thing however is, that from "outside" the subtree is part of your repository like any other directory. E.g. older versions of Git can clone your repository with the full subtree (and all it's history) just fine. You can also use git-archive to make a complete snapshot of your repository (including the subtree) - nice, if you e.g. want self-contained downloads of your project from git hosting platforms (like Github, Gitlab, Bitbucket,...) In short, `git subtree` is the better `git submodule`. So here's how to do it: #### Initial setup/check-out This will create a `pd-lib-builder/` directory containing the full history of the pd-lib-builder repository up to its release `v0.5.0` ~~~sh git subtree add --prefix=pd-lib-builder/ https://github.com/pure-data/pd-lib-builder v0.5.0 ~~~ This will automatically merge the `pd-lib-builder/` history into your current branch, so everything is ready to go. #### Cloning your repository with the subtree Nothing special, really. Just clone your repository as always: ~~~sh git clone https://git.example.org/pd/superbonk~.git ~~~ #### Updating the subtree Time passes and sooner or later you will find, that there is a shiny new pd-lib-builder with plenty of bugfixes and new features. To update your local copy to pd-lib-builder's current `master`, simply run: ~~~sh git subtree pull --prefix pd-lib-builder/ https://github.com/pure-data/pd-lib-builder master ~~~ #### Pulling the updated subtree into existing clones Again, nothing special. Just pull as always: ~~~sh git pull ~~~ #### Further reading More on the power of `git subtree` can be found online - https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844 - https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree - ... ### ~~`git submodule`~~ [DISCOURAGED] #### Initial setup/check-out To add a new submodule to your repository, just run `git submodule add` and commit the changes: ~~~sh git submodule add https://github.com/pure-data/pd-lib-builder git commit .gitmodules pd-lib-builder/ -m "Added pd-lib-builder as git-submodule" ~~~ #### Cloning your repository with the submodule When doing a fresh clone of your repository, pass the `--recursive` option to automatically fetch all submodules: ~~~sh git clone --recursive https://git.example.org/pd/superbonk~.git ~~~ If you've cloned non-recursively, you can initialize and update the submodules manually: ~~~sh git submodule init git submodule update ~~~ #### Updating the submodule Submodules are usually fixed to a given commit in their repository. To update the `pd-lib-builder` submodule to the current `master` do something like: ~~~sh cd pd-lib-builder git checkout master git pull cd .. git status pd-lib-builder git commit pd-lib-builder -m "Updated pd-lib-builder to current master" ~~~ #### Pulling the updated submodule into existing clones After you have pushed the submodule updates in your repository, other clones of the repository can be updated as follows: ~~~sh git pull ~~~ The above will make your repository aware, that the submodule is out-of-sync. ~~~sh $ LANG=C git status pd-lib-builder On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: pd-lib-builder (new commits) $ ~~~ In order to sync the submodule to the correct commit, run the following: ~~~sh git submodule update ~~~ #### Drawbacks `git submodule` has a number of drawbacks: - it requires special commands to synchronize the submodules, in addition to synching your repository. - you must make sure to use an URL for the submodule that is accessible to your potential users. e.g. using `git@github.com:pure-data/pd-lib-builder` is bad, because it requires everybody who wants to checkout your sources to have a github-account - even if they could checkout *your* repository anonymously. - submodules will be excluded from `git archive`. This means, that if you use a mainstream git provider (like Github, GitLab, Bitbucket,...) and make releases by creating a `git tag`, the automatically generated zipfiles with the sources will lack the submodule - and your users will not be able to compile your source code. In general, I would suggest to **avoid** `git submodule`, and instead use the better `git subtree` (above). hcs-0.2.1/pi-help.pd000066400000000000000000000013031422106453500141510ustar00rootroot00000000000000#N canvas 0 26 466 232 10; #X obj 5 2 cnv 15 450 20 empty empty pi 2 11 1 18 -233017 -66577 0 ; #X msg 422 3 pddp; #X obj 142 149 pi; #X floatatom 142 192 11 0 0 0 - - -; #X msg 142 106 bang; #X text 32 51 The value of pi as accurate as Pd can manage:; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control trigonometry; #X text 12 45 DESCRIPTION value of pi as accurately as Pd can manage ; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 float; #X restore 417 211 pd META; #X connect 2 0 3 0; #X connect 4 0 2 0; hcs-0.2.1/pi.pd000066400000000000000000000005131422106453500132250ustar00rootroot00000000000000#N canvas 0 31 298 274 10; #X obj 36 56 inlet; #X obj 82 185 outlet; #X obj 82 98 bang; #X obj 122 56 loadbang; #X text 15 17 bang to get the value of pi; #X msg 82 120 1; #X obj 82 142 atan; #X obj 82 164 * 4; #X connect 0 0 2 0; #X connect 2 0 5 0; #X connect 3 0 2 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 7 0 1 0; hcs-0.2.1/pointer_position-help.pd000066400000000000000000000014501422106453500171500ustar00rootroot00000000000000#N canvas 0 26 462 312 10; #X obj 163 146 pointer_position; #X text 24 38 Get the current (x \, y) location of the pointer in this window.; #X text 25 9 [pointer_position]; #X obj 163 78 tgl 15 1 empty empty empty 0 -6 0 10 -262144 -1 -1 1 1; #X msg 177 103 bang; #X text 191 78 enable/disable all motion events; #X text 215 103 show only next motion event; #N canvas 342 208 494 344 META 0; #X text 12 115 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 95 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control canvas_op GUI; #X text 12 45 DESCRIPTION get the current (x \, y) location of the pointer in this window; #X text 12 75 INLET_0 float bang; #X restore 412 292 pd META; #X connect 3 0 0 0; #X connect 4 0 0 0; hcs-0.2.1/pointer_position.pd000066400000000000000000000031121422106453500162170ustar00rootroot00000000000000#N canvas 705 40 499 478 10; #X obj 99 201 cnv 15 50 18 empty \$0-Y 174) 3 11 0 16 -233017 -1 0 ; #X obj 51 201 cnv 15 50 18 empty \$0-X (218 3 11 0 16 -233017 -1 0 ; #X msg 325 357 label \$1; #X obj 325 381 send \$0-Y; #X obj 325 333 zexy/makesymbol %s); #X obj 229 296 unpack float float float; #X msg 195 357 label \$1; #X obj 195 333 zexy/makesymbol (%s; #X obj 195 381 send \$0-X; #X obj 124 6 inlet; #X obj 124 104 select 0; #X obj 124 31 route float bang; #X obj 229 221 cyclone/gate 2; #N canvas 0 22 454 304 capture 0; #X obj 288 102 loadbang; #X obj 148 207 route motion; #X msg 260 125 1; #X msg 196 125 0; #X obj 174 44 inlet; #X obj 269 44 inlet; #X obj 148 243 outlet; #X obj 269 65 bang; #X obj 174 68 bang; #X obj 148 183 spigot; #X obj 16 121 iemguts/receivecanvas 2; #X connect 0 0 2 0; #X connect 1 0 6 0; #X connect 2 0 9 1; #X connect 3 0 9 1; #X connect 4 0 8 0; #X connect 5 0 7 0; #X connect 7 0 2 0; #X connect 8 0 3 0; #X connect 9 0 1 0; #X connect 10 0 9 0; #X restore 165 159 pd capture motion; #X obj 124 83 trigger float bang; #X msg 229 104 1; #X obj 264 83 trigger bang bang; #X msg 363 103 2; #X connect 2 0 3 0; #X connect 4 0 2 0; #X connect 5 0 7 0; #X connect 5 1 4 0; #X connect 6 0 8 0; #X connect 7 0 6 0; #X connect 9 0 11 0; #X connect 10 0 13 0; #X connect 10 1 13 1; #X connect 11 0 14 0; #X connect 11 1 16 0; #X connect 12 0 5 0; #X connect 12 1 13 0; #X connect 12 1 5 0; #X connect 13 0 12 1; #X connect 14 0 10 0; #X connect 14 1 15 0; #X connect 15 0 12 0; #X connect 16 0 13 1; #X connect 16 1 17 0; #X connect 17 0 12 0; #X coords 0 -1 1 1 100 20 1 50 200; hcs-0.2.1/pwm-help.pd000066400000000000000000000035741422106453500143600ustar00rootroot00000000000000#N canvas 0 26 502 423 10; #X text 130 148 the argument sets the frequency; #X obj 86 102 tgl 15 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 1 ; #X obj 122 96 hsl 128 15 0 1 0 0 empty empty amount -2 -6 1 12 -261681 -1 -1 0 1; #X floatatom 129 118 5 0 0 0 - - -; #X text 14 20 this object does Pulse Width Modulation at the message rate:; #X text 11 100 turn on/off; #X obj 67 397 pddp/pddplink http://en.wikipedia.org/wiki/Pulse-width_modulation ; #X text 7 376 for more info:; #N canvas 0 0 450 300 (subpatch) 0; #X array \$0-pwm 200 float 0; #X coords 0 1.2 199 -0.2 200 140 1; #X restore 274 202 graph; #N canvas 570 94 454 304 display 0; #X obj 115 35 inlet; #X obj 117 265 tabwrite \$0-pwm; #X obj 238 127 float; #X obj 281 127 + 1; #X obj 275 157 arraysize \$0-pwm; #X obj 250 31 inlet; #X obj 356 110 bang; #X obj 258 181 mod; #X obj 116 103 spigot; #X obj 118 239 float; #X obj 194 204 trigger bang float; #X obj 237 105 metro 3; #X connect 0 0 8 0; #X connect 2 0 7 0; #X connect 3 0 2 1; #X connect 4 0 7 1; #X connect 5 0 6 0; #X connect 5 0 8 1; #X connect 5 0 11 0; #X connect 6 0 4 0; #X connect 7 0 3 0; #X connect 7 0 10 0; #X connect 8 0 9 1; #X connect 9 0 1 0; #X connect 10 0 9 0; #X connect 10 1 1 1; #X connect 11 0 2 0; #X restore 86 310 pd display guts; #X obj 173 283 tgl 15 0 empty empty display 0 -6 0 8 -225271 -1 -1 0 1; #X obj 86 147 pwm 10; #N canvas 280 175 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION pulse width modulation at message rate; #X text 12 5 KEYWORDS control abstraction; #X text 12 65 INLET_0 float; #X text 12 85 INLET_1 float; #X text 12 105 OUTLET_0 float; #X restore 453 403 pd META; #X connect 1 0 11 0; #X connect 2 0 3 0; #X connect 2 0 11 1; #X connect 10 0 9 1; #X connect 11 0 9 0; hcs-0.2.1/pwm.pd000066400000000000000000000030301422106453500134150ustar00rootroot00000000000000#N canvas 0 31 501 567 10; #X msg 208 411 0; #X msg 157 412 1; #X text 281 361 duty cycle; #X obj 6 30 inlet; #X obj 256 31 inlet; #X text 46 30 start/stop; #X obj 226 384 delay; #X obj 157 146 select 1; #X obj 208 168 bang; #X obj 7 332 spigot; #X obj 7 290 bang; #X obj 328 254 /; #X msg 290 222 1000; #X obj 290 130 loadbang; #X obj 7 310 delay 100; #X obj 256 361 *; #X obj 256 88 max 0; #X obj 256 66 min 1; #X text 27 8 argument = pwm rate in Hz; #X obj 290 177 abs; #X obj 184 493 outlet; #X text 228 533 released under the GNU GPL; #X text 14 517 (C) Copyright 2006 Hans-Christoph Steiner ; #X text 299 32 pulse width (0-1); #X obj 290 154 purepd/float_argument \$1 30; #X obj 290 201 trigger bang float; #X obj 184 441 float; #X obj 328 293 send \$0-ms; #X obj 272 336 receive \$0-ms; #X obj 65 289 receive \$0-ms; #X obj 6 104 trigger float float; #X obj 157 232 purepd/once; #X connect 0 0 26 0; #X connect 1 0 10 0; #X connect 1 0 26 0; #X connect 3 0 30 0; #X connect 4 0 17 0; #X connect 6 0 0 0; #X connect 7 0 31 0; #X connect 7 1 8 0; #X connect 8 0 0 0; #X connect 8 0 31 1; #X connect 9 0 6 0; #X connect 9 0 1 0; #X connect 10 0 14 0; #X connect 11 0 27 0; #X connect 12 0 11 0; #X connect 13 0 24 0; #X connect 14 0 9 0; #X connect 15 0 6 1; #X connect 16 0 15 0; #X connect 17 0 16 0; #X connect 19 0 25 0; #X connect 24 0 19 0; #X connect 25 0 12 0; #X connect 25 1 11 1; #X connect 26 0 20 0; #X connect 28 0 15 1; #X connect 29 0 14 1; #X connect 30 0 7 0; #X connect 30 1 9 1; #X connect 31 0 1 0; #X connect 31 0 6 0; hcs-0.2.1/pwm~-help.pd000066400000000000000000000025651422106453500145550ustar00rootroot00000000000000#N canvas 0 26 492 402 10; #N canvas 0 22 450 300 (subpatch) 0; #X array \$0-pwm~ 100 float 0; #X coords 0 1.1 100 -0.1 200 100 1; #X restore 58 236 graph; #X obj 83 144 r metro; #X text 355 21 <-- Click to start; #X text 194 193 <-- graph the output; #X text 302 287 see also:; #X obj 311 20 tgl 25 0 empty empty start 0 -6 1 9 -24198 -1 -1 0 1 ; #X msg 311 48 \; pd dsp \$1 \; metro \$1; #X obj 376 287 pwm; #X obj 70 66 hsl 128 15 0 1 0 1 empty empty pulse_width -2 -6 1 12 -225280 -1 -1 10700 0; #X floatatom 79 88 5 0 0 0 - - -; #X text 139 112 argument = pwm rate in Hz; #X obj 67 112 pwm~ 2000; #X obj 83 169 metro 238.3; #X obj 82 372 pddp/pddplink http://en.wikipedia.org/wiki/Pulse-width_modulation ; #X text 22 351 for more info:; #X text 16 11 pulse width modulation at audio rate; #X obj 67 193 tabwrite~ \$0-pwm~; #N canvas 280 175 494 344 META 0; #X text 12 5 GENRE help; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 25 KEYWORDS signal; #X text 12 45 LICENSE GPL v3; #X text 12 65 DESCRIPTION pulse width modulation at audio rate; #X text 12 85 INLET_0 float; #X text 12 105 OUTLET_0 signal; #X restore 442 381 pd META; #X connect 1 0 12 0; #X connect 1 0 12 0; #X connect 5 0 6 0; #X connect 8 0 9 0; #X connect 8 0 11 0; #X connect 11 0 16 0; #X connect 12 0 16 0; hcs-0.2.1/pwm~.pd000066400000000000000000000011551422106453500136210ustar00rootroot00000000000000#N canvas 0 31 493 443 10; #X obj 29 49 inlet; #X obj 113 405 outlet~; #X obj 113 198 phasor~; #X obj 280 43 inlet; #X obj 31 94 t b f; #X msg 31 114 1; #X obj 45 135 -; #X text 77 113 invert so 1 = full power; #X obj 280 75 purepd/float_argument \$1 60; #X obj 113 172 sig~; #X obj 326 43 loadbang; #X text 43 11 after an idea from Roman Haefeli and Martin Peach; #X obj 113 226 expr~ $v1 > $v2; #X connect 0 0 4 0; #X connect 2 0 12 0; #X connect 3 0 8 0; #X connect 4 0 5 0; #X connect 4 1 6 1; #X connect 5 0 6 0; #X connect 6 0 12 1; #X connect 8 0 9 0; #X connect 9 0 2 0; #X connect 10 0 8 0; #X connect 12 0 1 0; hcs-0.2.1/regression/000077500000000000000000000000001422106453500144515ustar00rootroot00000000000000hcs-0.2.1/regression/canvas_name-regression.pd000066400000000000000000000067231422106453500214370ustar00rootroot00000000000000#N canvas 271 39 873 553 10; #X symbolatom 21 204 0 0 0 0 - - -; #X obj 21 183 canvas_name; #X obj 21 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X symbolatom 98 204 0 0 0 0 - - -; #X obj 98 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 canvas_name 1; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 98 183 pd get parent; #X symbolatom 188 204 0 0 0 0 - - -; #X obj 188 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 122 252 outlet; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 canvas_name 2; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 123 133 pd get parent; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 188 183 pd get parent of parent; #X symbolatom 338 204 0 0 0 0 - - -; #X obj 338 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 0 22 450 300 get 0; #X obj 59 14 inlet; #X obj 61 269 outlet; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 122 252 outlet; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 canvas_name 3; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 123 133 pd get parent; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 75 116 pd get parent of parent; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 337 181 pd get parent of parent of parent; #X symbolatom 549 204 0 0 0 0 - - -; #X obj 549 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 549 183 canvas_name pd-canvas_name-regression.pd; #X symbolatom 562 125 0 0 0 0 - - -; #X obj 562 81 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 562 104 canvas_name my_long_name_to_avoid_conflicts; #X obj 602 78 namecanvas my_long_name_to_avoid_conflicts; #X obj 70 79 trigger bang bang bang bang bang bang; #X obj 500 489 print ERROR; #X obj 199 507 print SUCCESS; #X obj 349 346 select symbol; #X obj 424 306 select symbol; #X obj 499 266 select symbol; #X msg 92 48 bang; #X obj 75 18 loadbang; #X obj 499 286 symbol; #X obj 424 326 symbol; #X obj 499 245 t a a; #X obj 424 285 t a a; #X obj 349 366 symbol; #X obj 349 325 t a a; #X obj 274 386 select symbol; #X obj 274 406 symbol; #X obj 274 365 t a a; #X obj 199 426 select symbol; #X text 197 29 this tests all the ways of the getting the symbol against each other. They should all get the same value; #X connect 1 0 0 0; #X connect 1 0 36 0; #X connect 2 0 1 0; #X connect 4 0 5 0; #X connect 5 0 3 0; #X connect 5 0 35 0; #X connect 7 0 8 0; #X connect 8 0 6 0; #X connect 8 0 32 0; #X connect 10 0 11 0; #X connect 11 0 9 0; #X connect 11 0 30 0; #X connect 13 0 14 0; #X connect 14 0 12 0; #X connect 14 0 29 0; #X connect 16 0 17 0; #X connect 17 0 15 0; #X connect 17 0 24 1; #X connect 19 0 1 0; #X connect 19 1 5 0; #X connect 19 2 8 0; #X connect 19 3 11 0; #X connect 19 4 14 0; #X connect 19 5 17 0; #X connect 22 0 31 0; #X connect 22 1 20 0; #X connect 23 0 28 0; #X connect 23 1 20 0; #X connect 24 0 27 0; #X connect 25 0 19 0; #X connect 26 0 19 0; #X connect 27 0 23 1; #X connect 28 0 22 1; #X connect 29 0 24 0; #X connect 29 1 27 1; #X connect 30 0 23 0; #X connect 30 1 28 1; #X connect 31 0 33 1; #X connect 32 0 22 0; #X connect 32 1 31 1; #X connect 33 0 34 0; #X connect 33 1 20 0; #X connect 34 0 36 1; #X connect 35 0 33 0; #X connect 35 1 34 1; #X connect 36 0 21 0; #X connect 36 1 20 0; hcs-0.2.1/regression/window_name-regression.pd000066400000000000000000000067231422106453500214730ustar00rootroot00000000000000#N canvas 271 39 873 553 10; #X symbolatom 21 204 0 0 0 0 - - -; #X obj 21 183 window_name; #X obj 21 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X symbolatom 98 204 0 0 0 0 - - -; #X obj 98 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 window_name 1; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 98 183 pd get parent; #X symbolatom 188 204 0 0 0 0 - - -; #X obj 188 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 122 252 outlet; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 window_name 2; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 123 133 pd get parent; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 188 183 pd get parent of parent; #X symbolatom 338 204 0 0 0 0 - - -; #X obj 338 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 0 22 450 300 get 0; #X obj 59 14 inlet; #X obj 61 269 outlet; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 122 252 outlet; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 window_name 3; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 123 133 pd get parent; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 75 116 pd get parent of parent; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 337 181 pd get parent of parent of parent; #X symbolatom 549 204 0 0 0 0 - - -; #X obj 549 160 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 549 183 window_name pd-window_name-regression.pd; #X symbolatom 562 125 0 0 0 0 - - -; #X obj 562 81 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 562 104 window_name my_long_name_to_avoid_conflicts; #X obj 602 78 namecanvas my_long_name_to_avoid_conflicts; #X obj 70 79 trigger bang bang bang bang bang bang; #X obj 500 489 print ERROR; #X obj 199 507 print SUCCESS; #X obj 349 346 select symbol; #X obj 424 306 select symbol; #X obj 499 266 select symbol; #X msg 92 48 bang; #X obj 75 18 loadbang; #X obj 499 286 symbol; #X obj 424 326 symbol; #X obj 499 245 t a a; #X obj 424 285 t a a; #X obj 349 366 symbol; #X obj 349 325 t a a; #X obj 274 386 select symbol; #X obj 274 406 symbol; #X obj 274 365 t a a; #X obj 199 426 select symbol; #X text 197 29 this tests all the ways of the getting the symbol against each other. They should all get the same value; #X connect 1 0 0 0; #X connect 1 0 36 0; #X connect 2 0 1 0; #X connect 4 0 5 0; #X connect 5 0 3 0; #X connect 5 0 35 0; #X connect 7 0 8 0; #X connect 8 0 6 0; #X connect 8 0 32 0; #X connect 10 0 11 0; #X connect 11 0 9 0; #X connect 11 0 30 0; #X connect 13 0 14 0; #X connect 14 0 12 0; #X connect 14 0 29 0; #X connect 16 0 17 0; #X connect 17 0 15 0; #X connect 17 0 24 1; #X connect 19 0 1 0; #X connect 19 1 5 0; #X connect 19 2 8 0; #X connect 19 3 11 0; #X connect 19 4 14 0; #X connect 19 5 17 0; #X connect 22 0 31 0; #X connect 22 1 20 0; #X connect 23 0 28 0; #X connect 23 1 20 0; #X connect 24 0 27 0; #X connect 25 0 19 0; #X connect 26 0 19 0; #X connect 27 0 23 1; #X connect 28 0 22 1; #X connect 29 0 24 0; #X connect 29 1 27 1; #X connect 30 0 23 0; #X connect 30 1 28 1; #X connect 31 0 33 1; #X connect 32 0 22 0; #X connect 32 1 31 1; #X connect 33 0 34 0; #X connect 33 1 20 0; #X connect 34 0 36 1; #X connect 35 0 33 0; #X connect 35 1 34 1; #X connect 36 0 21 0; #X connect 36 1 20 0; hcs-0.2.1/screensize-help.pd000066400000000000000000000013261422106453500157200ustar00rootroot00000000000000#N canvas 0 26 372 243 10; #X msg 184 101 bang; #X floatatom 184 170 5 0 0 0 width - -; #X floatatom 241 170 5 0 0 1 height - -; #X text 111 47 get the current screen resolution; #X obj 184 138 screensize; #N canvas 280 175 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 45 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 25 KEYWORDS control; #X text 12 5 GENRE help filesystem; #X text 12 65 DESCRIPTION get the current screen resolution; #X text 12 85 INLET_0 bang; #X text 12 105 OUTLET_0 float; #X text 12 125 OUTLET_1 float; #X restore 323 223 pd META; #X connect 0 0 4 0; #X connect 4 0 1 0; #X connect 4 1 2 0; hcs-0.2.1/screensize.c000066400000000000000000000027411422106453500146130ustar00rootroot00000000000000/* this object just asks Tcl for the screen resolution and outputs it */ #include #include static t_class *screensize_class; typedef struct _screensize { t_object x_obj; t_symbol *receive_symbol; t_outlet *width_outlet; t_outlet *height_outlet; } t_screensize; static void screensize_bang(t_screensize *x) { sys_vgui("pdsend \"%s screensize [winfo screenwidth .] [winfo screenheight .]\"\n", x->receive_symbol->s_name); } static void screensize_callback(t_screensize *x, t_float width, t_float height) { outlet_float(x->height_outlet, height); outlet_float(x->width_outlet, width); } static void *screensize_new(void) { char buf[MAXPDSTRING]; t_screensize *x = (t_screensize *)pd_new(screensize_class); sprintf(buf, "#%lx", (t_int)x); x->receive_symbol = gensym(buf); pd_bind(&x->x_obj.ob_pd, x->receive_symbol); x->width_outlet = outlet_new(&x->x_obj, 0); x->height_outlet = outlet_new(&x->x_obj, 0); return(x); } static void screensize_free(t_screensize *x) { pd_unbind(&x->x_obj.ob_pd, x->receive_symbol); } void screensize_setup(void) { screensize_class = class_new(gensym("screensize"), (t_newmethod)screensize_new, (t_method)screensize_free, sizeof(t_screensize), 0, 0); class_addbang(screensize_class, (t_method)screensize_bang); class_addmethod(screensize_class, (t_method)screensize_callback, gensym("screensize"), A_DEFFLOAT, A_DEFFLOAT, 0); } hcs-0.2.1/setenv-help.pd000066400000000000000000000025401422106453500150510ustar00rootroot00000000000000#N canvas 0 26 483 444 10; #X obj 196 145 setenv; #X msg 196 47 bang; #X symbolatom 196 192 0 0 0 0 - - -; #X msg 59 51 bang; #X symbolatom 59 181 0 0 0 0 - - -; #X obj 59 134 setenv HOME; #X msg 229 113 symbol SHELL; #X msg 316 113 symbol PATH; #X msg 396 113 symbol HOME; #X symbolatom 56 408 0 0 0 0 - - -; #X text 49 240 to enable overwrite mode \, set the second argument to 1 (i.e. non-zero); #X obj 56 361 setenv HOME 1; #X msg 56 278 symbol /home/hans; #X msg 66 308 symbol /Users/hans; #X text 33 10 by default \, it will not overwrite existing values; #X msg 72 89 symbol /blah; #X obj 247 358 setenv SHELL 1; #X symbolatom 247 401 0 0 0 0 - - -; #X msg 247 300 this is a test; #N canvas 401 226 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 65 INLET_0 bang symbol anything; #X text 12 85 OUTLET_0 symbol; #X text 12 45 DESCRIPTION set system environment variables; #X restore 434 424 pd META; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 3 0 5 0; #X connect 5 0 4 0; #X connect 6 0 0 1; #X connect 7 0 0 1; #X connect 8 0 0 1; #X connect 11 0 9 0; #X connect 12 0 11 0; #X connect 13 0 11 0; #X connect 15 0 5 0; #X connect 16 0 17 0; #X connect 18 0 16 0; hcs-0.2.1/setenv.c000066400000000000000000000110241422106453500137370ustar00rootroot00000000000000/* sets an environment variable */ /* */ /* Copyright (c) 2008 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #include #include #include #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #else #include #endif #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *setenv_class; typedef struct _setenv { t_object x_obj; t_symbol* x_variable_name; t_int x_overwrite; t_outlet* x_data_outlet; } t_setenv; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void setenv_output(t_setenv* x) { DEBUG(post("setenv_output");); char *envvar_value; if(x->x_variable_name != &s_) { envvar_value = getenv(x->x_variable_name->s_name); if(envvar_value) outlet_symbol(x->x_data_outlet, gensym(envvar_value)); else pd_error(x, "[setenv]: The environment variable %s is not defined.", x->x_variable_name->s_name); } else pd_error(x, "[setenv]: no environment variable name is set."); } static void setenv_symbol(t_setenv* x, t_symbol *s) { DEBUG(post("setenv_output");); #ifdef _WIN32 SetEnvironmentVariable(x->x_variable_name->s_name, s->s_name); #else if(x->x_overwrite == 0) post("[setenv]: not in overwrite mode."); setenv(x->x_variable_name->s_name, s->s_name, x->x_overwrite); #endif setenv_output(x); } static void setenv_anything(t_setenv* x, t_symbol* s, int argc, t_atom* argv) { t_binbuf *argument_binbuf = binbuf_new(); char *argument_buffer; int buffer_length; if(s != &s_list) { t_atom selector; SETSYMBOL(&selector, s); binbuf_add(argument_binbuf, 1, &selector); } binbuf_add(argument_binbuf, argc, argv); binbuf_gettext(argument_binbuf, &argument_buffer, &buffer_length); binbuf_free(argument_binbuf); argument_buffer[buffer_length] = 0; setenv_symbol(x, gensym(argument_buffer)); } static void *setenv_new(t_symbol* s, t_float f) { DEBUG(post("setenv_new");); t_setenv *x = (t_setenv *)pd_new(setenv_class); symbolinlet_new(&x->x_obj, &x->x_variable_name); x->x_data_outlet = outlet_new(&x->x_obj, &s_symbol); x->x_overwrite = (t_int) f; x->x_variable_name = s; return (x); } void setenv_setup(void) { DEBUG(post("setenv_setup");); setenv_class = class_new(gensym("setenv"), (t_newmethod)setenv_new, 0, sizeof(t_setenv), 0, A_DEFSYMBOL, A_DEFFLOAT, 0); /* add inlet datatype methods */ class_addbang(setenv_class, (t_method)setenv_output); class_addsymbol(setenv_class, (t_method)setenv_symbol); class_addanything(setenv_class, (t_method)setenv_anything); } hcs-0.2.1/split_my_msgs-help.pd000066400000000000000000000031241422106453500164350ustar00rootroot00000000000000#N canvas 0 26 505 387 10; #X obj 10 8 cnv 15 480 110 empty empty split_my_msgs 20 12 1 18 -233017 -66624 0; #X symbolatom 60 291 25 0 0 0 - - -; #X msg 218 200 bar; #X msg 84 138 foo 12 ag 24 ga; #X obj 61 271 list2symbol; #X symbolatom 244 291 25 0 0 0 - - -; #X obj 245 271 list2symbol; #X msg 92 156 bar 30 eo 20 fa; #X msg 99 174 234 as asdf asdf; #X text 36 34 This object is used to split a stream of messages. A unique ID is set either with a creation argument or by sending it to the right-inlet. That unique ID is then compared to the first element in each message \, and if it matches \, the rest of that message is sent to the left outlet. Otherwise \, the result is sent to the right outlet.; #X msg 250 200 234; #X text 23 327 There are a number of issues due to oddness in [select]: only symbols and ints will work for selectors on the right inlet \, floats probably won't work properly. Only a symbol can be used for a creation argument; #X obj 115 229 split_my_msgs foo; #N canvas 280 175 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION split a stream of messages; #X text 12 65 INLET_0 anything; #X text 12 5 KEYWORDS control abstraction filter; #X text 12 85 OUTLET_0 anything; #X text 12 105 OUTLET_1 anything; #X restore 452 367 pd META; #X connect 2 0 12 1; #X connect 3 0 12 0; #X connect 4 0 1 0; #X connect 6 0 5 0; #X connect 7 0 12 0; #X connect 8 0 12 0; #X connect 10 0 12 1; #X connect 12 0 4 0; #X connect 12 1 6 0; hcs-0.2.1/split_my_msgs.pd000066400000000000000000000034001422106453500155040ustar00rootroot00000000000000#N canvas 0 31 532 592 10; #X obj 75 146 inlet; #X obj 100 476 outlet; #X obj 278 143 inlet; #X text 260 125 name to select; #X text 69 126 raw messages; #X obj 76 383 niagara 1; #X obj 100 432 spigot; #X obj 171 239 niagara 1; #X obj 76 214 t a a; #X obj 10 8 cnv 15 480 110 empty empty split_my_msgs 20 12 1 18 -233017 -66624 0; #X msg 171 380 1; #X msg 278 380 0; #X obj 171 339 symbol; #X obj 242 477 outlet; #X obj 242 433 spigot; #X obj 279 413 expr 1-$f1; #X text 100 499 my_msgs; #X text 216 496 everything else; #X obj 171 359 select localhost; #X obj 278 339 symbol \$1; #X obj 302 317 loadbang; #X text 33 34 This object is used to split a stream of messages. A unique ID is set either with a creation argument or by sending it to the right-inlet. That unique ID is then compared to the first element in each message \, and if it matches \, the rest of that message is sent to the left outlet. Otherwise \, the result is sent to the right outlet.; #X obj 277 213 route float; #X obj 277 233 makesymbol split_on_%s; #X obj 171 268 route float; #X obj 171 288 makesymbol split_on_%s; #X obj 352 279 debug SELECT_KEY; #X obj 179 533 debug MSG_SELECT; #X obj 393 528 debug MSG_HEADER; #X connect 0 0 8 0; #X connect 2 0 22 0; #X connect 5 1 6 0; #X connect 5 1 14 0; #X connect 6 0 1 0; #X connect 7 0 24 0; #X connect 7 0 28 0; #X connect 8 0 5 0; #X connect 8 1 7 0; #X connect 10 0 6 1; #X connect 10 0 15 0; #X connect 11 0 6 1; #X connect 11 0 15 0; #X connect 12 0 18 0; #X connect 14 0 13 0; #X connect 15 0 14 1; #X connect 18 0 10 0; #X connect 18 1 11 0; #X connect 19 0 18 1; #X connect 20 0 19 0; #X connect 22 0 23 0; #X connect 22 1 19 0; #X connect 23 0 19 0; #X connect 23 0 26 0; #X connect 24 0 25 0; #X connect 24 1 12 0; #X connect 25 0 12 0; #X connect 25 0 27 0; hcs-0.2.1/split_path-help.pd000066400000000000000000000024771422106453500157250ustar00rootroot00000000000000#N canvas 0 26 430 344 10; #X obj 111 221 split_path; #X symbolatom 111 281 0 0 0 3 path - -; #X symbolatom 175 245 0 0 0 3 filename - -; #X msg 31 20 symbol just-a-file.pd; #X obj 95 241 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 159 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 139 102 symbol relative-path/; #X text 302 102 <-- note trailing /; #X msg 152 156 symbol /path/to/too/many//////slashes; #X text 213 303 ^-- always ends without a /; #X msg 76 46 symbol /path/to/just-a-file.pd; #X msg 118 78 symbol no-trailing-slash; #X msg 146 131 symbol ../another/relative/path/to/file.pd; #X msg 154 179 symbol /path/with/trailing/slash/; #N canvas 280 175 494 344 META 0; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control symbol_op; #X text 12 45 DESCRIPTION split a path from a file name; #X text 12 65 INLET_0 symbol; #X text 12 85 OUTLET_0 symbol; #X text 12 105 OUTLET_1 symbol; #X restore 380 324 pd META; #X connect 0 0 1 0; #X connect 0 0 4 0; #X connect 0 1 2 0; #X connect 0 1 5 0; #X connect 3 0 0 0; #X connect 6 0 0 0; #X connect 8 0 0 0; #X connect 10 0 0 0; #X connect 11 0 0 0; #X connect 12 0 0 0; #X connect 13 0 0 0; hcs-0.2.1/split_path.c000066400000000000000000000034511422106453500146070ustar00rootroot00000000000000/* (C) Guenter Geiger */ /* I started with stripdir.c and turned it into split_path.c */ #include #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif static char *version = "$Revision: 1.1 $"; /* ------------------------ split_path ----------------------------- */ static t_class *split_path_class; typedef struct _split_path { t_object x_obj; t_outlet *x_path_outlet; t_outlet *x_filename_outlet; } t_split_path; void split_path_symbol(t_split_path *x, t_symbol *s) { int length = strlen(s->s_name); char path_buffer[MAXPATHLEN] = ""; while (length--) if (*(s->s_name + length) == '/') break; if (length < MAXPATHLEN) outlet_symbol(x->x_filename_outlet,gensym(s->s_name + length + 1)); else error("[split_path] filename name too long. The limit is %d characters",MAXPATHLEN); while (length > 0) { length--; if(*(s->s_name + length) != '/') break; } if (length < MAXPATHLEN) { strncpy(path_buffer, s->s_name, length + 1); outlet_symbol(x->x_path_outlet,gensym(path_buffer)); } else { error("[split_path] path name too long. The limit is %d characters",MAXPATHLEN); } } static void *split_path_new() { t_split_path *x = (t_split_path *)pd_new(split_path_class); x->x_path_outlet = (t_outlet *)outlet_new(&x->x_obj, &s_symbol); x->x_filename_outlet = (t_outlet *)outlet_new(&x->x_obj, &s_symbol); return (x); } void split_path_setup(void) { split_path_class = class_new(gensym("split_path"), (t_newmethod)split_path_new, 0, sizeof(t_split_path), 0,0); class_addsymbol(split_path_class,split_path_symbol); logpost(NULL, 4, "[split_path] %s",version); logpost(NULL, 4, "\twritten by Hans-Christoph Steiner "); } hcs-0.2.1/sql_query-help.pd000066400000000000000000000034061422106453500155730ustar00rootroot00000000000000#N canvas 1 96 562 464 10; #X obj 342 184 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X floatatom 400 216 5 0 0 0 - - -; #X text 375 163 age; #N canvas 402 387 450 300 sql 0; #X obj 73 37 inlet; #X obj 259 37 inlet; #X obj 63 251 outlet; #X obj 270 267 outlet; #X obj 255 78 print COLD; #X obj 61 82 print HOT; #X connect 0 0 5 0; #X connect 1 0 4 0; #X restore 247 368 pd sql; #X obj 203 435 print RESULTS; #X obj 329 436 print STATUS; #X obj 305 392 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 327 393 bang when done; #X msg 100 172 Chinua; #X msg 60 173 Mary; #X msg 152 171 symbol Ang; #X obj 99 262 sql_query insert into table (name \, age) values (? \, ?); #X obj 98 45 sql_query this is a test? more ? ? ? ?; #X msg 19 175 bang; #X msg 157 208 234; #X msg 460 215 symbol twenty; #X msg 98 16 fred; #X msg 154 17 one; #X msg 210 18 2; #X msg 266 18 3; #X msg 323 18 4; #X obj 98 95 pddp/print; #X obj 323 71 pddp/print; #N canvas 447 187 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION; #X text 12 85 INLET_1; #X text 12 105 OUTLET_0; #X text 12 125 OUTLET_1; #X text 12 65 INLET_0; #X text 12 5 KEYWORDS control; #X restore 513 443 pd META; #X connect 0 0 11 1; #X connect 1 0 11 1; #X connect 3 0 4 0; #X connect 3 1 5 0; #X connect 3 1 6 0; #X connect 8 0 11 0; #X connect 9 0 11 0; #X connect 10 0 11 0; #X connect 11 0 3 0; #X connect 11 1 3 1; #X connect 12 0 21 0; #X connect 12 1 22 0; #X connect 13 0 11 0; #X connect 14 0 11 0; #X connect 15 0 11 1; #X connect 16 0 12 0; #X connect 17 0 12 1; #X connect 18 0 12 2; #X connect 19 0 12 3; #X connect 20 0 12 4; hcs-0.2.1/sql_query.c000066400000000000000000000133421422106453500144640ustar00rootroot00000000000000/* * object for generating SQL queries with SQL ? placeholders * Written by Hans-Christoph Steiner * * Copyright (c) 2007 Free Software Foundation * * 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 3 * of the License, or (at your option) any later version. * * See file LICENSE for further information on licensing terms. * * 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. * */ #include #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #else #include #endif #include #define DEBUG(x) //#define DEBUG(x) x #define PLACEHOLDER '?' /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *sql_query_class; static t_class *proxy_inlet_class; typedef struct _proxy_inlet { t_pd pd; void *owner; unsigned int id; } t_proxy_inlet; typedef struct _sql_query { t_object x_obj; t_binbuf* x_query_binbuf; // binbuf for converting args to string t_proxy_inlet* inlets; // pointer to array of _proxy_inlets t_atom* atoms; // pointer to array of atoms unsigned int placeholder_count;// number of items in above arrays t_outlet* x_data_outlet; // for list of data to plug into query t_outlet* x_query_outlet; // for SQL query } t_sql_query; /*------------------------------------------------------------------------------ * FUNCTION PROTOTYPES */ static void sql_query_set_atom(t_sql_query *x, int atom_num, t_symbol *s, int argc, t_atom *a); /*------------------------------------------------------------------------------ * PROXY INLET FUNCTIONS */ static void proxy_inlet_new(t_proxy_inlet *p, t_object *owner, unsigned int id) { DEBUG(post("proxy_inlet_new");); p->pd = proxy_inlet_class; p->owner = owner; p->id = id; inlet_new(owner, &p->pd, 0, 0); } static void proxy_inlet_anything(t_proxy_inlet *p, t_symbol *s, int argc, t_atom *argv) { DEBUG(post("proxy_inlet_anything");); sql_query_set_atom(p->owner, p->id, s, argc, argv); } static void proxy_inlet_setup(void) { post("proxy_inlet_setup"); proxy_inlet_class = (t_class *)class_new(gensym("#__PROXY_INLET__"), 0, 0, sizeof(t_proxy_inlet), 0, A_GIMME, 0); class_addanything(proxy_inlet_class, (t_method)proxy_inlet_anything); } /*------------------------------------------------------------------------------ * STANDARD CLASS FUNCTIONS */ static void sql_query_set_atom(t_sql_query *x, int atom_num, t_symbol *s, int argc, t_atom *a) { DEBUG(post("sql_query_set_atom");); if( (s == &s_symbol) || (s == &s_list) || (s == &s_float) ) x->atoms[atom_num] = *a; else SETSYMBOL(&x->atoms[atom_num], s); } static void sql_query_output(t_sql_query *x) { DEBUG(post("sql_query_output");); int natom = binbuf_getnatom(x->x_query_binbuf); t_atom *vec = binbuf_getvec(x->x_query_binbuf); outlet_anything(x->x_query_outlet, vec[0].a_w.w_symbol, natom - 1, vec + 1); outlet_list(x->x_data_outlet, &s_list, x->placeholder_count, x->atoms); } static void sql_query_anything(t_sql_query *x, t_symbol *s, int argc, t_atom *argv) { sql_query_set_atom(x, 0, s, argc, argv); sql_query_output(x); } static void sql_query_free(t_sql_query *x) { binbuf_free(x->x_query_binbuf); } static void *sql_query_new(t_symbol *s, int argc, t_atom *argv) { DEBUG(post("sql_query_new");); unsigned int i; int bufsize; char *buf; char *current = NULL; t_sql_query *x = (t_sql_query *)pd_new(sql_query_class); x->x_query_binbuf = binbuf_new(); binbuf_add(x->x_query_binbuf, argc, argv); binbuf_gettext(x->x_query_binbuf, &buf, &bufsize); buf[bufsize] = 0; x->placeholder_count = 0; current = strchr(buf, PLACEHOLDER); while (current != NULL) { x->placeholder_count++; current = strchr(current + 1, PLACEHOLDER); } x->inlets = getbytes(x->placeholder_count * sizeof(t_proxy_inlet)); for(i = 1; i < x->placeholder_count; ++i) proxy_inlet_new(&x->inlets[i], (t_object *)x, i); x->atoms = getbytes(x->placeholder_count * sizeof(t_atom)); for(i = 0; i < x->placeholder_count; ++i) SETSYMBOL(&x->atoms[i], &s_); x->x_data_outlet = outlet_new(&x->x_obj, 0); x->x_query_outlet = outlet_new(&x->x_obj, 0); return (x); } void sql_query_setup(void) { sql_query_class = class_new(gensym("sql_query"), (t_newmethod)sql_query_new, (t_method)sql_query_free, sizeof(t_sql_query), 0, A_GIMME, 0); /* add inlet datatype methods */ class_addbang(sql_query_class, (t_method) sql_query_output); class_addanything(sql_query_class, (t_method) sql_query_anything); /* set up proxy inlet class */ proxy_inlet_setup(); } hcs-0.2.1/square~-help.pd000066400000000000000000000013021422106453500152360ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 126 141 square~; #X obj 129 205 dac~; #X obj 126 103 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X obj 127 172 *~ 0.2; #X text 83 38 a simple square wave generator; #N canvas 404 246 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 65 INLET_0 float; #X text 12 5 KEYWORDS signal abstraction; #X text 12 45 DESCRIPTION a simple square wave generator; #X text 12 85 OUTLET_0 signal; #X restore 385 263 pd META; #X connect 0 0 3 0; #X connect 2 0 0 0; #X connect 3 0 1 0; #X connect 3 0 1 1; hcs-0.2.1/square~.pd000066400000000000000000000005621422106453500143170ustar00rootroot00000000000000#N canvas 0 31 351 357 10; #X obj 73 281 outlet~; #X obj 96 8 inlet; #X obj 73 195 *~ 2; #X obj 73 222 -~ 1; #X msg 65 86 0.5; #X obj 97 86 purepd/float_argument \$1; #X obj 169 8 loadbang; #X obj 73 155 pwm~; #X connect 1 0 5 0; #X connect 2 0 3 0; #X connect 3 0 0 0; #X connect 4 0 7 0; #X connect 5 0 7 1; #X connect 6 0 5 0; #X connect 6 0 4 0; #X connect 7 0 2 0; hcs-0.2.1/stat-help.pd000066400000000000000000000067561422106453500145350ustar00rootroot00000000000000#N canvas 1 88 577 526 10; #X msg 108 68 bang; #X text 150 68 run on current folder; #X symbolatom 6 470 0 0 0 3 filename - -; #X floatatom 29 365 0 0 0 3 file_mode - -; #X floatatom 175 365 0 0 0 3 User_ID - -; #X floatatom 271 365 0 0 0 3 Group_ID - -; #X floatatom 338 365 0 0 0 3 Device_ID - -; #X obj 163 175 route error; #X symbolatom 163 213 0 0 0 0 error - -; #X floatatom 419 386 0 0 0 3 File_Size - -; #X floatatom 419 353 0 0 0 3 Blocks_Allocated - -; #X floatatom 419 317 0 0 0 3 preferred_block_size - -; #X obj 17 36 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 -1 ; #X obj 17 63 openpanel; #X text 46 31 try it on any file (it doesn't change anything \, just reads data from the file system).; #X text 117 146 <-- set filename by cold inlet or object argument; #X symbolatom 270 434 0 0 0 3 group_name - -; #X obj 163 194 symbol; #X floatatom 98 365 0 0 0 3 hard_links - -; #X symbolatom 174 434 0 0 0 3 username - -; #X obj 174 405 uid2username; #X obj 81 147 stat; #X obj 9 203 list; #X obj 9 223 list split 9; #X obj 9 285 unpack symbol float float float float float float float float; #N canvas 0 22 470 320 time 0; #X obj 136 34 inlet; #X floatatom 19 193 6 0 0 3 days - -; #X floatatom 66 193 6 0 0 3 seconds - -; #X text 26 223 last access; #X floatatom 158 192 6 0 0 3 days - -; #X floatatom 205 192 6 0 0 3 seconds - -; #X text 144 220 last modification; #X floatatom 305 194 6 0 0 3 days - -; #X floatatom 352 194 6 0 0 3 seconds - -; #X text 290 222 last status change; #X obj 49 137 unpack float float float float float float; #X connect 0 0 10 0; #X connect 10 0 1 0; #X connect 10 1 2 0; #X connect 10 2 4 0; #X connect 10 3 5 0; #X connect 10 4 7 0; #X connect 10 5 8 0; #X restore 48 253 pd time stamps; #X msg 132 118 symbol /usr/bin/gcc; #X text 139 251 <-- open this to see the timestamps; #X obj 84 175 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 121 94 symbol /tmp/this_file_doesn't_exist; #X text 249 191 <-- errors are reported in Pd space and the Pd window ; #N canvas 0 22 458 308 possible 0; #X text 47 62 access_denied; #X text 47 82 io_error; #X text 47 102 symlink_loop; #X text 47 122 name_too_long; #X text 47 142 does_not_exist; #X text 47 162 not_folder; #X text 47 182 internal_overflow; #X text 47 202 internal_fault; #X text 19 21 Here are the possible errors that [stat] will report on its right outlet:; #X text 47 222 invalid; #X text 47 242 unknown; #X restore 398 218 pd possible errors; #X text 8 3 [stat] gets information about files; #N canvas 278 183 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION get information about files; #X text 12 65 INLET_0 symbol bang; #X text 12 85 INLET_1; #X text 12 105 OUTLET_0 anything; #X text 12 125 OUTLET_1 anything; #X text 12 5 KEYWORDS control; #X restore 528 505 pd META; #X obj 270 405 gid2group_name; #X connect 0 0 21 0; #X connect 4 0 20 0; #X connect 5 0 34 0; #X connect 7 0 17 0; #X connect 12 0 13 0; #X connect 13 0 21 0; #X connect 17 0 8 0; #X connect 20 0 19 0; #X connect 21 0 22 0; #X connect 21 0 28 0; #X connect 21 1 7 0; #X connect 22 0 23 0; #X connect 23 0 24 0; #X connect 23 1 25 0; #X connect 24 0 2 0; #X connect 24 1 3 0; #X connect 24 2 18 0; #X connect 24 3 4 0; #X connect 24 4 5 0; #X connect 24 5 6 0; #X connect 24 6 9 0; #X connect 24 7 10 0; #X connect 24 8 11 0; #X connect 26 0 21 0; #X connect 29 0 21 0; #X connect 34 0 16 0; hcs-0.2.1/stat.c000066400000000000000000000222141422106453500134110ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* object for getting file type (dir, link, exe, etc) using a filename */ /* Written by Hans-Christoph Steiner */ /* */ /* Copyright (c) 2006 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #include #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #else #include #endif #include #include #include #include static char *version = "$Revision: 1.5 $"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *stat_class; #ifdef _WIN32 typedef struct _stat_win { #else typedef struct _stat { #endif /* _WIN32 */ t_object x_obj; t_symbol *x_filename; /* output */ t_atom *output; // holder for a list of atoms to be outputted t_int output_count; // number of atoms in in x->output t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_stat; /*------------------------------------------------------------------------------ * SUPPORT FUNCTIONS */ /* add one new atom to the list to be outputted */ static void add_atom_to_output(t_stat *x, t_atom *new_atom) { t_atom *new_atom_list; new_atom_list = (t_atom *)getbytes((x->output_count + 1) * sizeof(t_atom)); memcpy(new_atom_list, x->output, x->output_count * sizeof(t_atom)); freebytes(x->output, x->output_count * sizeof(t_atom)); x->output = new_atom_list; memcpy(x->output + x->output_count, new_atom, sizeof(t_atom)); ++(x->output_count); } /* static void add_symbol_to_output(t_stat *x, t_symbol *s) { t_atom *temp_atom = getbytes(sizeof(t_atom)); SETSYMBOL(temp_atom, s); add_atom_to_output(x,temp_atom); freebytes(temp_atom,sizeof(t_atom)); } */ static void add_float_to_output(t_stat *x, t_float f) { t_atom *temp_atom = getbytes(sizeof(t_atom)); SETFLOAT(temp_atom, f); add_atom_to_output(x,temp_atom); freebytes(temp_atom,sizeof(t_atom)); } static void reset_output(t_stat *x) { if(x->output) { freebytes(x->output, x->output_count * sizeof(t_atom)); x->output = NULL; x->output_count = 0; } } /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void stat_output_error(t_stat *x) { DEBUG(post("stat_output_error");); t_atom output_atoms[2]; switch(errno) { case EACCES: error("[stat]: access denied: %s", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("access_denied")); break; case EIO: error("[stat]: An error occurred while reading %s", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("io_error")); break; #ifndef _WIN32 case ELOOP: error("[stat]: A loop exists in symbolic links in %s", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("symlink_loop")); break; #endif case ENAMETOOLONG: error("[stat]: The filename %s is too long", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("name_too_long")); break; case ENOENT: error("[stat]: %s does not exist", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("does_not_exist")); break; case ENOTDIR: error("[stat]: A component of %s is not a existing folder", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("not_folder")); break; #ifndef _WIN32 case EOVERFLOW: error("[stat]: %s caused overflow in stat struct", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("internal_overflow")); break; #endif case EFAULT: error("[stat]: fault in stat struct (%s)", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("internal_fault")); break; case EINVAL: error("[stat]: invalid argument to stat() (%s)", x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("invalid")); break; default: error("[stat]: unknown error %d: %s", errno, x->x_filename->s_name); SETSYMBOL(output_atoms, gensym("unknown")); } SETSYMBOL(output_atoms + 1, x->x_filename); outlet_anything(x->x_status_outlet, gensym("error"), 2, output_atoms); } static void stat_output(t_stat* x) { DEBUG(post("stat_output");); #ifdef _WIN32 struct _stat stat_buffer; #else struct stat stat_buffer; #endif int result; #ifdef _WIN32 result = _stat(x->x_filename->s_name, &stat_buffer); #else result = stat(x->x_filename->s_name, &stat_buffer); #endif /* _WIN32 */ if(result != 0) { stat_output_error(x); } else { reset_output(x); add_float_to_output(x, (t_float) stat_buffer.st_mode); add_float_to_output(x, (t_float) stat_buffer.st_nlink); add_float_to_output(x, (t_float) stat_buffer.st_uid); add_float_to_output(x, (t_float) stat_buffer.st_gid); add_float_to_output(x, (t_float) stat_buffer.st_rdev); add_float_to_output(x, (t_float) stat_buffer.st_size); #ifdef _WIN32 add_float_to_output(x, (t_float) 0); add_float_to_output(x, (t_float) 0); #else add_float_to_output(x, (t_float) stat_buffer.st_blocks); add_float_to_output(x, (t_float) stat_buffer.st_blksize); #endif /* 86400 seconds == 24 hours == 1 day */ #if defined(_POSIX_C_SOURCE) || defined(_WIN32) add_float_to_output(x, (t_float) (stat_buffer.st_atime / 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_atime % 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_mtime / 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_mtime % 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_ctime / 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_ctime % 86400)); #else add_float_to_output(x, (t_float) (stat_buffer.st_atimespec.tv_sec / 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_atimespec.tv_sec % 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_mtimespec.tv_sec / 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_mtimespec.tv_sec % 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_ctimespec.tv_sec / 86400)); add_float_to_output(x, (t_float) (stat_buffer.st_ctimespec.tv_sec % 86400)); #endif /* _POSIX_C_SOURCE */ outlet_anything(x->x_data_outlet,x->x_filename, x->output_count,x->output); } } static void stat_set(t_stat* x, t_symbol *s) { DEBUG(post("stat_set");); #ifdef _WIN32 char string_buffer[MAX_PATH]; ExpandEnvironmentStrings(s->s_name, string_buffer, MAX_PATH); x->x_filename = gensym(string_buffer); #else x->x_filename = s; #endif } static void stat_symbol(t_stat *x, t_symbol *s) { stat_set(x,s); stat_output(x); } static void *stat_new(t_symbol *s) { DEBUG(post("stat_new");); t_stat *x = (t_stat *)pd_new(stat_class); symbolinlet_new(&x->x_obj, &x->x_filename); x->x_data_outlet = outlet_new(&x->x_obj, 0); x->x_status_outlet = outlet_new(&x->x_obj, 0); /* set to the value from the object argument, if that exists */ if (s != &s_) { x->x_filename = s; } else { x->x_filename = canvas_getcurrentdir(); post("setting pattern to default: %s",x->x_filename->s_name); } return (x); } void stat_setup(void) { DEBUG(post("stat_setup");); stat_class = class_new(gensym("stat"), (t_newmethod)stat_new, 0, sizeof(t_stat), 0, A_DEFSYM, 0); /* add inlet datatype methods */ class_addbang(stat_class,(t_method) stat_output); class_addsymbol(stat_class,(t_method) stat_symbol); /* add inlet message methods */ class_addmethod(stat_class,(t_method) stat_set,gensym("set"), A_DEFSYM, 0); logpost(NULL, 4, "[stat] %s",version); logpost(NULL, 4, "\twritten by Hans-Christoph Steiner "); logpost(NULL, 4, "\tcompiled on "__DATE__" at "__TIME__ " "); } hcs-0.2.1/sys_gui-help.pd000066400000000000000000000107361422106453500152350ustar00rootroot00000000000000#N canvas 194 88 620 614 10; #X obj 78 213 sys_gui; #X text 136 59 open the help browser; #X msg 51 93 set text_color #f0f; #X text 180 93 set variables; #X msg 91 140 bang; #X obj 304 115 colorpanel; #X obj 303 90 bng 17 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 333 89 choose a color; #N canvas 0 22 454 304 generate 0; #X obj 101 15 inlet; #X obj 103 275 outlet; #X obj 103 58 unpack float float float; #X obj 103 82 * 255; #X obj 103 105 int; #X obj 103 128 makefilename %x; #X obj 203 82 * 255; #X obj 203 105 int; #X obj 203 128 makefilename %x; #X obj 303 82 * 255; #X obj 303 105 int; #X obj 303 128 makefilename %x; #X obj 103 163 pack symbol symbol symbol; #X obj 103 187 zexy/makesymbol #%s%s%s; #X msg 103 212 set set obj_box_fill \$1; #X obj 103 238 trigger bang anything; #X connect 0 0 2 0; #X connect 2 0 3 0; #X connect 2 1 6 0; #X connect 2 2 9 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 12 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 12 1; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 0 12 2; #X connect 12 0 13 0; #X connect 13 0 14 0; #X connect 14 0 15 0; #X connect 15 0 1 0; #X connect 15 1 1 0; #X restore 304 141 pd generate web color; #X msg 303 165 set obj_box_fill #a3cfb5; #X obj 38 302 pddp/pddplink http://pure-data.cvs.sourceforge.net/pure-data/pd/src ; #X text 24 257 You can find things to mess with by looking thru the Pd code \, look for things that have "sys_gui" and "sys_vgui". These are Tcl/Tk commands from the pd to the Pg GUI process.; #X obj 170 548 sys_gui; #X obj 257 405 loadbang; #X obj 317 467 canvas_name; #X msg 199 453 black; #X msg 156 453 green; #X obj 33 392 colorpanel; #N canvas 685 90 416 325 generate 0; #X obj 81 23 inlet; #X obj 82 262 outlet; #X obj 83 66 unpack float float float; #X obj 83 90 * 255; #X obj 83 113 int; #X obj 83 136 makefilename %x; #X obj 183 90 * 255; #X obj 183 113 int; #X obj 183 136 makefilename %x; #X obj 283 90 * 255; #X obj 283 113 int; #X obj 283 136 makefilename %x; #X obj 83 171 pack symbol symbol symbol; #X obj 83 195 zexy/makesymbol #%s%s%s; #X connect 0 0 2 0; #X connect 2 0 3 0; #X connect 2 1 6 0; #X connect 2 2 9 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 12 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 12 1; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 0 12 2; #X connect 12 0 13 0; #X connect 13 0 1 0; #X restore 33 413 pd generate web color; #X obj 33 348 bng 35 250 50 0 empty empty empty 17 7 0 10 -204786 -1 -1; #X text -29 325 change the highlight color:; #X msg 170 518 \$3 configure -highlightcolor \$1 -highlightthickness \$2; #X obj 246 350 hsl 128 15 0 127 0 1 empty empty empty -2 -8 0 10 -262144 -1 -1 500 1; #X obj 243 378 int; #X floatatom 275 378 5 0 0 0 - - -; #N canvas 1009 401 454 304 pak 0; #X obj 25 16 inlet; #X obj 167 15 inlet; #X obj 305 16 inlet; #X obj 122 241 outlet; #X obj 83 150 pack symbol 0 symbol; #X obj 78 69 trigger bang float; #X connect 0 0 4 0; #X connect 1 0 5 0; #X connect 2 0 4 2; #X connect 4 0 3 0; #X connect 5 0 4 0; #X connect 5 1 4 1; #X restore 170 489 pd pak ------------------; #N canvas 278 183 494 344 META 0; #X text 12 65 PLATFORM windows macosx gnulinux; #X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 125 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION send raw Tcl directly to the Pd GUI process ; #X text 12 85 INLET_0 anything; #X text 12 105 OUTLET_0; #X text 12 5 KEYWORDS control pd_op; #X restore 512 562 pd META; #X obj 78 236 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 257 427 trigger bang bang; #X text 99 236 <-- bang when command finished; #X text 135 215 DANGER! You can crash Pd with this!! :D; #X msg 27 61 menu_helpbrowser; #X text -24 17 This object gives you the ability to send raw Tcl commands directly to the 'pd-gui' process just like GUI objects do.; #X text 127 139 run previous command; #X obj 170 572 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X connect 0 0 27 0; #X connect 2 0 0 0; #X connect 4 0 0 0; #X connect 5 0 8 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 0 0; #X connect 12 0 34 0; #X connect 13 0 28 0; #X connect 14 0 25 2; #X connect 15 0 25 0; #X connect 16 0 25 0; #X connect 17 0 18 0; #X connect 18 0 25 0; #X connect 19 0 17 0; #X connect 21 0 12 0; #X connect 22 0 23 0; #X connect 22 0 24 0; #X connect 23 0 25 1; #X connect 25 0 21 0; #X connect 28 0 15 0; #X connect 28 1 14 0; #X connect 31 0 0 0; hcs-0.2.1/sys_gui.c000066400000000000000000000044711422106453500141250ustar00rootroot00000000000000#include #include #include #include static t_class *sys_gui_class; typedef struct _sys_gui { t_object x_obj; t_symbol* x_receive_symbol; t_outlet* x_outlet; char *send_buffer; } t_sys_gui; static void execute_buffer(t_sys_gui *x, int argc, t_atom *argv) { int i = 0; char buf[MAXPDSTRING]; for(i=0;isend_buffer, buf, MAXPDSTRING - strlen(x->send_buffer)); strncat(x->send_buffer, " ", MAXPDSTRING - strlen(x->send_buffer)); } strncat(x->send_buffer, " ;\n", MAXPDSTRING - strlen(x->send_buffer)); snprintf(buf, MAXPDSTRING - strlen(x->send_buffer), "pdsend \"%s finished\";\n", x->x_receive_symbol->s_name ); strncat(x->send_buffer, buf, MAXPDSTRING - strlen(x->send_buffer)); sys_gui(x->send_buffer); } static void sys_gui_bang(t_sys_gui *x) { sys_gui(x->send_buffer); } static void sys_gui_finished(t_sys_gui *x) { outlet_bang(x->x_outlet); } static void sys_gui_anything(t_sys_gui *x, t_symbol *s, int argc, t_atom *argv) { snprintf(x->send_buffer, MAXPDSTRING, "%s ", s->s_name); execute_buffer(x, argc, argv); } static void sys_gui_list(t_sys_gui *x, t_symbol *s, int argc, t_atom *argv) { x->send_buffer = '\0'; execute_buffer(x, argc, argv); } static void sys_gui_free(t_sys_gui *x) { pd_unbind(&x->x_obj.ob_pd, x->x_receive_symbol); freebytes(x->send_buffer,MAXPDSTRING); } static void *sys_gui_new(t_symbol *s) { t_sys_gui *x = (t_sys_gui *)pd_new(sys_gui_class); x->x_outlet = outlet_new(&x->x_obj, &s_anything); char buf[MAXPDSTRING]; sprintf(buf, "#%lx", (t_int)x); x->x_receive_symbol = gensym(buf); pd_bind(&x->x_obj.ob_pd, x->x_receive_symbol); x->send_buffer = (char *)getbytes(MAXPDSTRING); return(x); } void sys_gui_setup(void) { sys_gui_class = class_new( gensym("sys_gui"), (t_newmethod)sys_gui_new, (t_method)sys_gui_free, sizeof(t_sys_gui), 0, 0); class_addanything(sys_gui_class, (t_method)sys_gui_anything); class_addbang(sys_gui_class, (t_method)sys_gui_bang); class_addlist(sys_gui_class, (t_method)sys_gui_list); class_addmethod(sys_gui_class, (t_method)sys_gui_finished, gensym("finished"), 0); } hcs-0.2.1/tcl_version-help.pd000066400000000000000000000014131422106453500160720ustar00rootroot00000000000000#N canvas 0 26 341 234 10; #X obj 97 117 tcl_version; #X msg 97 70 bang; #X obj 97 157 unpack float float float; #X floatatom 97 186 5 0 0 3 major - -; #X floatatom 167 185 5 0 0 3 minor - -; #X floatatom 238 186 5 0 0 3 bugfix - -; #X text 23 21 get the current Tcl/Tk version:; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control abstraction; #X text 12 45 DESCRIPTION get the current Tcl/Tk version; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 list; #X restore 292 214 pd META; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 2 0 3 0; #X connect 2 1 4 0; #X connect 2 2 5 0; hcs-0.2.1/tcl_version.pd000066400000000000000000000005761422106453500151550ustar00rootroot00000000000000#N canvas 779 237 365 251 10; #X obj 63 170 zexy/symbol2list .; #X obj 62 196 outlet; #X obj 64 49 bang; #X obj 64 23 inlet; #X obj 64 100 hcs/sys_gui; #X obj 63 126 receive #tcl_version; #X msg 64 74 pdsend "#tcl_version [info patchlevel]"; #X obj 63 147 list; #X connect 0 0 1 0; #X connect 2 0 6 0; #X connect 3 0 2 0; #X connect 5 0 7 0; #X connect 6 0 4 0; #X connect 7 0 0 0; hcs-0.2.1/tkconsole-help.pd000066400000000000000000000013641422106453500155510ustar00rootroot00000000000000#N canvas 0 26 385 246 10; #X obj 183 165 tkconsole; #X obj 183 142 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X text 24 18 The Tcl/Tk Wish Shell \, which Pd's GUI is built on top of \, provides an interactive console. In this console you can run Tcl code on the live GUI. This object makes it easy to show and hide the Tk console.; #N canvas 326 192 494 344 META 0; #X text 12 105 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 85 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control abstraction pd_op; #X text 12 45 DESCRIPTION toggle visibility of the Tcl/Tk Wish Shell ; #X text 12 65 INLET_0 float; #X restore 336 226 pd META; #X connect 1 0 0 0; hcs-0.2.1/tkconsole.pd000066400000000000000000000006441422106453500146230ustar00rootroot00000000000000#N canvas 0 31 450 300 10; #X obj 184 52 route float; #X obj 184 76 select 0; #X obj 184 23 inlet; #X msg 185 166 console \$1; #X obj 229 97 bang; #X obj 185 209 hcs/sys_gui; #X msg 229 120 show; #X msg 185 120 hide; #X obj 185 143 symbol; #X connect 0 0 1 0; #X connect 1 0 7 0; #X connect 1 1 4 0; #X connect 2 0 0 0; #X connect 3 0 5 0; #X connect 4 0 6 0; #X connect 6 0 8 0; #X connect 7 0 8 0; #X connect 8 0 3 0; hcs-0.2.1/tremolo~-help.pd000066400000000000000000000016541422106453500154310ustar00rootroot00000000000000#N canvas 0 26 317 260 10; #X obj 26 15 osc~ 270; #X obj 19 222 dac~; #X obj 179 14 pddp/dsp; #X obj 69 65 hsl 128 17 0 1 0 0 empty empty amount 6 9 0 10 -262144 -1 -1 0 1; #X floatatom 77 84 5 0 0 0 - - -; #X obj 110 112 hsl 128 17 0.01 10 1 0 empty empty frequency 6 9 0 10 -262144 -1 -1 0 1; #X floatatom 118 131 5 0 0 0 - - -; #X obj 26 141 tremolo~ 0.5 7; #N canvas 280 175 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 45 DESCRIPTION tremolo; #X text 12 65 INLET_0 signal; #X text 12 5 KEYWORDS signal abstraction; #X text 12 85 INLET_1 float; #X text 12 105 INLET_2 float; #X text 12 125 OUTLET_0 signal; #X restore 267 238 pd META; #X connect 0 0 7 0; #X connect 3 0 4 0; #X connect 3 0 7 1; #X connect 5 0 6 0; #X connect 5 0 7 2; #X connect 7 0 1 0; #X connect 7 0 1 1; hcs-0.2.1/tremolo~.pd000066400000000000000000000015671422106453500145060ustar00rootroot00000000000000#N canvas 0 31 518 350 10; #X obj 308 220 *~; #X obj 56 257 +~; #X obj 323 199 *~; #X obj 56 20 inlet~; #X obj 56 287 outlet~; #X obj 323 20 inlet; #X obj 143 20 inlet; #X msg 71 146 1 \$1; #X obj 71 168 -; #X obj 338 178 line~; #X msg 338 155 \$1 5; #X msg 71 189 \$1 5; #X obj 71 210 line~; #X obj 56 230 *~; #X obj 323 69 purepd/float_argument \$2 5; #X obj 323 92 osc~; #X obj 337 47 loadbang; #X obj 157 47 loadbang; #X obj 143 69 purepd/float_argument \$2 0.5; #X connect 0 0 1 1; #X connect 1 0 4 0; #X connect 2 0 0 1; #X connect 3 0 0 0; #X connect 3 0 13 0; #X connect 5 0 14 0; #X connect 6 0 18 0; #X connect 7 0 8 0; #X connect 8 0 11 0; #X connect 9 0 2 1; #X connect 10 0 9 0; #X connect 11 0 12 0; #X connect 12 0 13 1; #X connect 13 0 1 0; #X connect 14 0 15 0; #X connect 15 0 2 0; #X connect 16 0 14 0; #X connect 17 0 18 0; #X connect 18 0 7 0; #X connect 18 0 10 0; hcs-0.2.1/uid2username-help.pd000066400000000000000000000022631422106453500161520ustar00rootroot00000000000000#N canvas 0 26 429 292 10; #X msg 14 148 bang; #X obj 31 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 272 159 bang; #X obj 142 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 145 262 ^-- bang if not found; #X text 12 14 convert a UID to a username; #X symbolatom 56 242 0 0 0 0 - - -; #X msg 143 162 1; #X symbolatom 272 242 0 0 0 0 - - -; #X obj 59 93 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X floatatom 56 123 5 0 0 0 - - -; #X obj 56 190 uid2username; #X obj 272 201 uid2username 0; #N canvas 407 170 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control; #X text 12 45 DESCRIPTION convert a UID to a username; #X text 12 65 INLET_0 float bang; #X text 12 85 INLET_0 float; #X text 12 105 OUTLET_0 symbol; #X text 12 125 OUTLET_1 bang; #X restore 371 262 pd META; #X connect 0 0 11 0; #X connect 2 0 12 0; #X connect 7 0 11 1; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 0 1 0; #X connect 11 0 6 0; #X connect 11 1 3 0; #X connect 12 0 8 0; hcs-0.2.1/uid2username.pd000066400000000000000000000006301422106453500152200ustar00rootroot00000000000000#N canvas 2 31 510 229 10; #X obj 18 85 hcs/passwd; #X obj 18 12 inlet; #X obj 19 183 outlet; #X obj 66 12 inlet; #X obj 118 31 loadbang; #X obj 66 59 purepd/float_argument \$1; #X obj 82 183 outlet; #X obj 18 118 list; #X obj 18 147 list split 1; #X connect 0 0 7 0; #X connect 0 1 6 0; #X connect 1 0 0 0; #X connect 3 0 5 0; #X connect 4 0 5 0; #X connect 5 0 0 1; #X connect 7 0 8 0; #X connect 8 0 2 0; hcs-0.2.1/uname-help.pd000066400000000000000000000014741422106453500146570ustar00rootroot00000000000000#N canvas 0 26 427 299 10; #X obj 49 54 uname; #X msg 49 17 bang; #X obj 49 115 unpack symbol symbol symbol symbol symbol; #X symbolatom 331 143 0 0 0 0 - - -; #X symbolatom 49 259 0 0 0 0 - - -; #X symbolatom 118 236 0 0 0 0 - - -; #X symbolatom 189 215 0 0 0 0 - - -; #X symbolatom 258 169 0 0 0 0 - - -; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION get uname; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 anything; #X restore 377 277 pd META; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 2 0 4 0; #X connect 2 1 5 0; #X connect 2 2 6 0; #X connect 2 3 7 0; #X connect 2 4 3 0; hcs-0.2.1/uname.c000066400000000000000000000072611422106453500135500ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* object for getting uname info */ /* Written by Hans-Christoph Steiner */ /* */ /* Copyright (c) 2006,2010 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ /* sadly, there is no uname in Windows, Cygwin has it tho */ #ifndef _WIN32 #include #include /* sadly, there is no uname in Windows, Cygwin has it tho */ #ifdef _WIN32 # include # include #else # include #endif static char *version = "1.4"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *uname_class; typedef struct _uname { t_object x_obj; } t_uname; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void uname_output(t_uname* x) { DEBUG(post("uname_output");); #ifdef _WIN32 // TODO fake uname for Windows // http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx #else struct utsname utsname_struct; t_atom uname_data[5]; if ( uname(&utsname_struct) > -1 ) { SETSYMBOL(uname_data, gensym(utsname_struct.sysname)); SETSYMBOL(uname_data + 1, gensym(utsname_struct.nodename)); SETSYMBOL(uname_data + 2, gensym(utsname_struct.release)); SETSYMBOL(uname_data + 3, gensym(utsname_struct.version)); SETSYMBOL(uname_data + 4, gensym(utsname_struct.machine)); outlet_anything(x->x_obj.ob_outlet, atom_gensym(uname_data), 4, uname_data + 1); } #endif /* _WIN32 */ } static void *uname_new(t_symbol *s) { DEBUG(post("uname_new");); t_uname *x = (t_uname *)pd_new(uname_class); outlet_new(&x->x_obj, &s_symbol); return (x); } void uname_setup(void) { DEBUG(post("uname_setup");); uname_class = class_new(gensym("uname"), (t_newmethod)uname_new, 0, sizeof(t_uname), 0, 0); /* add inlet datatype methods */ class_addbang(uname_class,(t_method) uname_output); } #endif /* NOT _WIN32 */ hcs-0.2.1/unsetenv-help.pd000066400000000000000000000014551422106453500154200ustar00rootroot00000000000000#N canvas 0 26 512 273 10; #X obj 221 152 setenv; #X msg 221 54 bang; #X symbolatom 221 199 0 0 0 0 - - -; #X msg 19 51 bang; #X msg 254 120 symbol SHELL; #X msg 341 120 symbol PATH; #X msg 421 120 symbol HOME; #X obj 19 134 unsetenv HOME; #X msg 94 107 symbol SHELL; #X text 67 51 bang unsets; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION unset env; #X text 12 65 INLET_0 bang; #X text 12 85 INLET_1 symbol; #X restore 463 253 pd META; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 3 0 7 0; #X connect 4 0 0 1; #X connect 5 0 0 1; #X connect 6 0 0 1; #X connect 8 0 7 1; hcs-0.2.1/unsetenv.c000066400000000000000000000067411422106453500143140ustar00rootroot00000000000000/* unsets an environment variable */ /* */ /* Copyright (c) 2008 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #include #include #include #ifdef _WIN32 #define _WIN32_WINNT 0x0400 #include #include #else #include #endif #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *unsetenv_class; typedef struct _unsetenv { t_object x_obj; t_symbol* x_variable_name; t_outlet* x_data_outlet; } t_unsetenv; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void unsetenv_bang(t_unsetenv* x) { DEBUG(post("unsetenv_bang");); #ifdef _WIN32 if(x->x_variable_name != &s_) { char buf[MAXPDSTRING]; strncpy(buf, x->x_variable_name->s_name, MAXPDSTRING - 1); strcat(buf, "="); putenv(buf); } #else if(x->x_variable_name != &s_) unsetenv(x->x_variable_name->s_name); #endif } static void unsetenv_symbol(t_unsetenv* x, t_symbol *s) { DEBUG(post("unsetenv_bang");); x->x_variable_name = s; } static void *unsetenv_new(t_symbol* s) { DEBUG(post("unsetenv_new");); t_unsetenv *x = (t_unsetenv *)pd_new(unsetenv_class); symbolinlet_new(&x->x_obj, &x->x_variable_name); x->x_variable_name = s; return (x); } void unsetenv_setup(void) { DEBUG(post("unsetenv_setup");); unsetenv_class = class_new(gensym("unsetenv"), (t_newmethod)unsetenv_new, 0, sizeof(t_unsetenv), 0, A_DEFSYMBOL, 0); /* add inlet datatype methods */ class_addbang(unsetenv_class, (t_method)unsetenv_bang); class_addsymbol(unsetenv_class, (t_method)unsetenv_symbol); } hcs-0.2.1/usbhid/000077500000000000000000000000001422106453500135475ustar00rootroot00000000000000hcs-0.2.1/usbhid/Makefile000066400000000000000000000204531422106453500152130ustar00rootroot00000000000000# To use this Makefile for your project, first put the name of your library in # LIBRARY_NAME variable. The folder for your project should have the same name # as your library. LIBRARY_NAME = usbhid LIBRARY_VERSION = 0.1 # Next, add your .c source files to the SOURCES variable. The help files will # be included automatically SOURCES = # For objects that only build on certain platforms, add those to the SOURCES # line for the right platforms. SOURCES_android = SOURCES_cygwin = SOURCES_macosx = usbhid.c SOURCES_iphoneos = SOURCES_linux = usbhid.c SOURCES_windows = # list all pd objects (i.e. myobject.pd) files here, and their helpfiles will # be included automatically PDOBJECTS = # if you want to include any other files in the source and binary tarballs, # list them here. This can be anything from header files, READMEs, example # patches, documentation, etc. EXTRA_DIST = #------------------------------------------------------------------------------# # # you shouldn't need to edit anything below here, if we did it right :) # #------------------------------------------------------------------------------# # where Pd lives PD_PATH = ../../../pd # where to install the library prefix = /usr/local libdir = $(prefix)/lib pkglibdir = $(libdir)/pd-externals objectsdir = $(pkglibdir) INSTALL = install INSTALL_FILE = $(INSTALL) -p -m 644 INSTALL_DIR = $(INSTALL) -p -m 755 -d CFLAGS = -DPD -I$(PD_PATH)/src -Wall -W -g LDFLAGS = LIBS = -lusb -lhid ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows) UNAME := $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) ifeq ($(CPU),arm) # iPhone/iPod Touch SOURCES += $(SOURCES_macosx) EXTENSION = pd_darwin OS = iphoneos IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin CC=$(IPHONE_BASE)/gcc CPP=$(IPHONE_BASE)/cpp CXX=$(IPHONE_BASE)/g++ ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6 OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS) \ -I/Applications/Pd-extended.app/Contents/Resources/include LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) LIBS += -lc STRIP = strip -x DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) else # Mac OS X SOURCES += $(SOURCES_macosx) EXTENSION = pd_darwin OS = macosx OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast FAT_FLAGS = -arch i386 -arch ppc -mmacosx-version-min=10.4 CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \ -I/Applications/Pd-extended.app/Contents/Resources/include LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib # if the 'pd' binary exists, check the linking against it to aid with stripping LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd) LIBS += -lc STRIP = strip -x DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) endif endif ifeq ($(UNAME),Linux) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux OS = linux OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer CFLAGS += -fPIC LDFLAGS += -Wl,--export-dynamic -shared -fPIC LIBS += -lc STRIP = strip --strip-unneeded -R .note -R .comment DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) SOURCES += $(SOURCES_cygwin) EXTENSION = dll OS = cygwin OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer CFLAGS += LDFLAGS += -Wl,--export-dynamic -shared -L$(PD_PATH)/src LIBS += -lc -lpd STRIP = strip --strip-unneeded -R .note -R .comment DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) endif ifeq (MINGW,$(findstring MINGW,$(UNAME))) SOURCES += $(SOURCES_windows) EXTENSION = dll OS = windows OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer WINDOWS_HACKS = -D'O_NONBLOCK=1' CFLAGS += -mms-bitfields $(WINDOWS_HACKS) LDFLAGS += -s -shared -Wl,--enable-auto-import LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 STRIP = strip --strip-unneeded -R .note -R .comment DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) endif CFLAGS += $(OPT_CFLAGS) .PHONY = install libdir_install single_install install-doc install-exec install-examples clean dist etags all: $(SOURCES:.c=.$(EXTENSION)) %.o: %.c $(CC) $(CFLAGS) -o "$*.o" -c "$*.c" %.$(EXTENSION): %.o $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) chmod a-x "$*.$(EXTENSION)" # this links everything into a single binary file $(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS) chmod a-x $(LIBRARY_NAME).$(EXTENSION) install: libdir_install # The meta and help files are explicitly installed to make sure they are # actually there. Those files are not optional, then need to be there. libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(SOURCES))" || (\ $(INSTALL_FILE) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \ $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION)))) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_FILE) $(PDOBJECTS) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) # install library linked as single binary single_install: $(LIBRARY_NAME) install-doc install-exec $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_FILE) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION) install-doc: $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(SOURCES))" || \ $(INSTALL_FILE) $(SOURCES:.c=-help.pd) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) # this is the only bit not really handled well... $(INSTALL_FILE) README $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt $(INSTALL_FILE) VERSION $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/VERSION.txt $(INSTALL_FILE) CHANGES $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/CHANGES.txt install-examples: test ! -d examples || (\ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \ $(INSTALL_FILE) examples/*.* $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples) clean: -rm -f -- $(SOURCES:.c=.o) -rm -f -- $(SOURCES:.c=.$(EXTENSION)) -rm -f -- $(LIBRARY_NAME).$(EXTENSION) distclean: clean -rm -f -- $(DISTBINDIR).tar.gz -rm -rf -- $(DISTBINDIR) -rm -f -- $(DISTDIR).tar.gz -rm -rf -- $(DISTDIR) $(DISTBINDIR): $(INSTALL_DIR) $(DISTBINDIR) libdir: all $(DISTBINDIR) $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR) $(INSTALL_FILE) $(SOURCES) $(DISTBINDIR) $(INSTALL_FILE) $(SOURCES:.c=-help.pd) $(DISTBINDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_FILE) $(EXTRA_DIST) $(DISTBINDIR) # tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR) $(DISTDIR): $(INSTALL_DIR) $(DISTDIR) dist: $(DISTDIR) $(INSTALL_FILE) Makefile $(DISTDIR) $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTDIR) test -z "$(strip $(ALLSOURCES))" || \ $(INSTALL_FILE) $(ALLSOURCES) $(DISTDIR) test -z "$(strip $(ALLSOURCES))" || \ $(INSTALL_FILE) $(ALLSOURCES:.c=-help.pd) $(DISTDIR) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_FILE) $(PDOBJECTS) $(DISTDIR) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) $(DISTDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_FILE) $(EXTRA_DIST) $(DISTDIR) tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) etags: etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h showpaths: @echo "PD_PATH: $(PD_PATH)" @echo "objectsdir: $(objectsdir)" @echo "LIBRARY_NAME: $(LIBRARY_NAME)" @echo "SOURCES: $(SOURCES)" @echo "ALLSOURCES: $(ALLSOURCES)" @echo "UNAME: $(UNAME)" @echo "CPU: $(CPU)" hcs-0.2.1/usbhid/usbhid-help.pd000066400000000000000000000230321422106453500163000ustar00rootroot00000000000000#N canvas 210 31 710 649 10; #X obj 177 545 usbhid; #X msg 291 197 close; #X msg 298 217 reset; #X msg 311 255 print; #X text 367 62 Gravis/Destroyer Tiltpad; #N canvas 0 22 462 312 buttons 0; #X obj 99 36 inlet; #X obj 63 108 & 1; #X obj 63 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X obj 93 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 2 ; #X obj 123 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 4; #X obj 153 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 8; #X obj 183 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 16; #X obj 223 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 32; #X obj 263 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 64; #X obj 303 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 128; #X obj 93 108 & 2; #X obj 123 108 & 4; #X obj 153 108 & 8; #X obj 183 108 & 16; #X obj 223 108 & 32; #X obj 263 108 & 64; #X obj 303 108 & 128; #X connect 0 0 1 0; #X connect 0 0 10 0; #X connect 0 0 11 0; #X connect 0 0 12 0; #X connect 0 0 13 0; #X connect 0 0 14 0; #X connect 0 0 15 0; #X connect 0 0 16 0; #X connect 1 0 2 0; #X connect 10 0 3 0; #X connect 11 0 4 0; #X connect 12 0 5 0; #X connect 13 0 6 0; #X connect 14 0 7 0; #X connect 15 0 8 0; #X connect 16 0 9 0; #X restore 115 655 pd buttons test; #X obj 177 613 unpack float float float float; #X obj 42 155 metro 400; #X obj 44 129 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X floatatom 236 639 5 0 0 0 - - -; #X floatatom 306 640 5 0 0 0 - - -; #X floatatom 386 635 5 0 0 0 - - -; #X msg 49 17 open vendorId productId; #X floatatom 175 636 5 0 0 0 - - -; #X msg 336 371 debug \$1; #X obj 336 349 hradio 15 1 0 10 empty empty empty 0 -6 0 8 -262144 -1 -1 0; #X obj 77 592 print data; #X text 58 222 how many bytes to read; #X msg 308 236 refresh; #X text 373 237 reinit and refresh device list; #X text 347 217 resets device (don't really know what that does tho) ; #X obj 216 588 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X msg 316 280 descriptor; #X text 395 280 get descriptor; #X text 322 298 for writing to the device:; #X msg 75 308 set 2; #X text 228 551 <- status outlet; #X text 66 552 data outlet ->; #X msg 213 39 open 0x046d 0xc01d; #X text 355 41 Logitech USB-PS/2 Optical Mouse; #X msg 206 15 open 0x1043 0x0015; #X text 363 132 Logitech RumblePad 2 USB; #X msg 241 132 open 0x046d 0xc218; #X obj 341 480 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X obj 281 585 print ELSE; #X obj 42 180 hradio 15 1 0 9 empty empty empty 0 -8 0 10 -262144 -1 -1 0; #X msg 94 204 get \$1; #X floatatom 44 204 5 0 0 0 - - -; #X text 373 152 CUI I/O test; #X msg 251 152 open 0x0925 0x1299; #X obj 216 566 route open; #X obj 338 499 int; #X msg 338 519 write 0x01 0x05 0x01 \$1 0; #X symbolatom 389 500 10 0 0 0 - - -; #X text 385 174 Logitech Inc. iFeel Mouse; #X msg 261 173 open 0x046d 0xc030; #X msg 23 306 get 24; #X msg 323 314 path 0x00010002 0x00000000 0xff000002; #X text 559 314 iFeel buzz; #N canvas 0 22 450 300 ifeel 1; #X obj 43 257 outlet; #X obj 30 41 hsl 128 15 0 255 0 0 empty empty amplitude 11 8 0 10 -262130 -1 -1 0 0; #N canvas 0 22 450 300 pak 0; #X obj 45 15 inlet; #X obj 45 39 int; #X obj 48 265 outlet; #X obj 48 222 pack 0 0 0; #X obj 105 15 inlet; #X obj 105 39 int; #X obj 104 62 trigger bang 0; #X obj 205 15 inlet; #X obj 205 39 int; #X obj 204 62 trigger bang 0; #X connect 0 0 1 0; #X connect 1 0 3 0; #X connect 3 0 2 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 3 0; #X connect 6 1 3 1; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 9 1 3 2; #X restore 60 84 pd pak; #X obj 169 41 hsl 128 15 255 1.8 1 0 empty empty pitch 11 8 0 10 -204786 -1 -1 0 0; #X obj 310 41 hsl 128 15 1 255 1 0 empty empty how_many_pulses -2 -6 0 10 -204800 -1 -1 0 0; #X msg 60 105 set 0x11 0x0a \$1 \$2 0x00 \$3 0x00; #X msg 79 142 set 0x13 0x00 0x00 0x00 0x00 0x00 0x00; #X text 266 103 buzz; #X text 321 142 abort buzz; #X msg 11 10 path 0x00010002 0x00000000 0xff000002; #X text 247 10 iFeel buzz; #X obj 202 185 receive buzz; #X floatatom 220 221 5 0 0 0 - - -; #X obj 178 217 abs; #X floatatom 172 265 5 0 0 0 - - -; #X obj 179 242 * 20; #X floatatom 310 72 5 0 0 0 - - -; #X floatatom 167 65 5 0 0 0 - - -; #X floatatom 56 61 5 0 0 0 - - -; #X connect 1 0 2 0; #X connect 1 0 18 0; #X connect 2 0 5 0; #X connect 3 0 2 1; #X connect 3 0 17 0; #X connect 4 0 2 2; #X connect 4 0 16 0; #X connect 5 0 0 0; #X connect 6 0 0 0; #X connect 9 0 0 0; #X connect 11 0 12 0; #X connect 11 0 13 0; #X connect 13 0 15 0; #X connect 15 0 2 0; #X connect 15 0 14 0; #X restore 326 413 pd ifeel; #N canvas 50 159 735 546 CUI 0; #X obj 74 239 outlet; #X obj 122 46 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #N canvas 0 22 450 300 pak 0; #X obj 45 15 inlet; #X obj 45 39 int; #X obj 48 265 outlet; #X obj 48 222 pack 0 0 0; #X obj 105 15 inlet; #X obj 105 39 int; #X obj 104 62 trigger bang 0; #X obj 205 15 inlet; #X obj 205 39 int; #X obj 204 62 trigger bang 0; #X connect 0 0 1 0; #X connect 1 0 3 0; #X connect 3 0 2 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 3 0; #X connect 6 1 3 1; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 9 1 3 2; #X restore 158 66 pd pak; #X obj 262 46 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X obj 402 46 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X msg 159 85 set 0x11 0x0a \$1 \$2 0x00 \$3 0x00; #X obj 154 151 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X msg 153 176 set \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1; #X msg 13 11 path 0x00010005 0x00010036; #X connect 1 0 2 0; #X connect 2 0 5 0; #X connect 3 0 2 1; #X connect 4 0 2 2; #X connect 5 0 0 0; #X connect 6 0 7 0; #X connect 7 0 0 0; #X connect 8 0 0 0; #X restore 335 437 pd CUI LED; #X text 344 16 CUI v1.0 LED; #X msg 226 61 open 0x1043 0x0015; #X msg 238 110 open 0x1043 0x0015; #X text 368 111 iCreate Technologies Corporation JxCore2; #N canvas 329 421 612 367 JxCore2 0; #X obj 74 239 outlet; #X obj 122 46 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #N canvas 0 22 450 300 pak 0; #X obj 45 15 inlet; #X obj 45 39 int; #X obj 48 265 outlet; #X obj 48 222 pack 0 0 0; #X obj 105 15 inlet; #X obj 105 39 int; #X obj 104 62 trigger bang 0; #X obj 205 15 inlet; #X obj 205 39 int; #X obj 204 62 trigger bang 0; #X connect 0 0 1 0; #X connect 1 0 3 0; #X connect 3 0 2 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 3 0; #X connect 6 1 3 1; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 3 0; #X connect 9 1 3 2; #X restore 158 66 pd pak; #X obj 262 46 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X obj 402 46 hsl 128 15 0 255 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X msg 159 85 set 0x11 0x0a \$1 \$2 0x00 \$3 0x00; #X obj 154 151 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X msg 153 176 set \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1 \$1; #X msg 13 11 path 0x00010005 0x00010001; #X connect 1 0 2 0; #X connect 2 0 5 0; #X connect 3 0 2 1; #X connect 4 0 2 2; #X connect 5 0 0 0; #X connect 6 0 7 0; #X connect 7 0 0 0; #X connect 8 0 0 0; #X restore 405 437 pd JxCore2; #X msg 231 86 open 0x1043 0x0015; #X text 361 87 STEIM JxCore2; #N canvas 0 22 450 300 keyboard 0; #X obj 170 265 outlet; #X msg 228 233 write 0x11 0x01 0 \$1; #X obj 228 212 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0 1; #X obj 213 171 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0 1; #X msg 213 192 write 0x11 0x00 0 \$1; #X text 344 190 numlock; #X text 359 231 capslock; #X msg 163 134 write 0x15 \$1 0 \$2; #X obj 161 97 pack symbol float; #X symbolatom 171 65 10 0 0 0 - - -; #X obj 151 40 makefilename 0x%d; #X obj 154 13 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X obj 260 68 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X floatatom 277 89 5 0 0 0 - - -; #X connect 1 0 0 0; #X connect 2 0 1 0; #X connect 3 0 4 0; #X connect 4 0 0 0; #X connect 7 0 0 0; #X connect 8 0 7 0; #X connect 10 0 9 0; #X connect 10 0 8 0; #X connect 11 0 10 0; #X connect 12 0 8 1; #X connect 12 0 13 0; #X restore 566 420 pd keyboard LED; #X msg 132 237 get 4; #X msg 114 157 bang; #N canvas 232 222 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control conversion abstraction; #X text 12 45 DESCRIPTION convert a stream of ASCII digits to a single int value; #X text 12 75 INLET_0 open close reset refresh print descriptor path debug write get set; #X text 12 105 OUTLET_0 list; #X text 12 125 OUTLET_1 anything; #X restore 639 640 pd META; #X connect 0 0 6 0; #X connect 0 0 16 0; #X connect 0 1 40 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #X connect 6 0 5 0; #X connect 6 0 13 0; #X connect 6 1 9 0; #X connect 6 2 10 0; #X connect 6 3 11 0; #X connect 7 0 35 0; #X connect 8 0 7 0; #X connect 14 0 0 0; #X connect 15 0 14 0; #X connect 18 0 0 0; #X connect 22 0 0 0; #X connect 25 0 0 0; #X connect 28 0 0 0; #X connect 30 0 0 0; #X connect 32 0 0 0; #X connect 33 0 41 0; #X connect 35 0 36 0; #X connect 35 0 37 0; #X connect 36 0 0 0; #X connect 39 0 0 0; #X connect 40 0 21 0; #X connect 40 1 34 0; #X connect 41 0 42 0; #X connect 42 0 0 0; #X connect 43 0 42 0; #X connect 45 0 0 0; #X connect 46 0 0 0; #X connect 47 0 0 0; #X connect 49 0 0 0; #X connect 50 0 0 0; #X connect 52 0 0 0; #X connect 53 0 0 0; #X connect 55 0 0 0; #X connect 56 0 0 0; #X connect 59 0 0 0; #X connect 60 0 35 0; hcs-0.2.1/usbhid/usbhid.c000066400000000000000000000661321422106453500152010ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* Pd interface to the USB HID API using libhid, which is built on libusb */ /* Written by Hans-Christoph Steiner */ /* */ /* Copyright (c) 2004 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ /* libhid hasn't been ported to Win32 yet */ #ifndef _WIN32 #include #include #include #include #include #include #include #include "m_pd.h" /* * TODO: rename read, get, set messages so they make sense * TODO: make size output work well */ /* * BUG: for some reason it skips one of the button bits */ /*------------------------------------------------------------------------------ * INCLUDE KLUDGE */ /* NOTE: included from libusb/usbi.h. UGLY, i know, but so is libusb! * this struct doesn't seem to be defined in usb.h, only prototyped */ struct usb_dev_handle { int fd; struct usb_bus *bus; struct usb_device *device; int config; int interface; int altsetting; void *impl_info; }; /*------------------------------------------------------------------------------ * GLOBAL VARIABLES */ /* count the number of instances of this object so that certain free() * functions can be called only after the final instance is destroyed. */ t_int usbhid_instance_count; #define HID_ID_MAX 32 char *hid_id[HID_ID_MAX]; /* FIXME: 32 devices MAX */ t_int hid_id_count; /* this array is for keeping track of whether each device has been read in * each cycle */ char usbhid_device_read_status[HID_ID_MAX]; /*------------------------------------------------------------------------------ * CLASS DEF */ typedef struct _usbhid { t_object x_obj; /* usbhid types */ HIDInterface *x_hidinterface; hid_return x_hid_return; /* internal state */ unsigned short vendor_id; // idVendor for current device unsigned short product_id; // idProduct for current device unsigned short debug_level; // control debug messages to the console t_int x_device_number; t_int x_read_element_count; t_int *x_read_elements; t_int x_write_path_count; t_int *x_write_paths; t_int report_size; // size in bytes of the HID report /* output */ t_atom *output; // holder for a list of atoms to be outputted t_int output_count; // number of atoms in in x->output t_outlet *x_data_outlet; t_outlet *x_status_outlet; } t_usbhid; /*------------------------------------------------------------------------------ * LOCAL DEFINES */ #define USBHID_MAJOR_VERSION 0 #define USBHID_MINOR_VERSION 0 static t_class *usbhid_class; /* for USB strings */ #define STRING_BUFFER_LENGTH 256 #define SEND_PACKET_LENGTH 1 #define RECEIVE_PACKET_LENGTH 6 #define PATH_LENGTH 3 /*------------------------------------------------------------------------------ * SUPPORT FUNCTIONS */ /* add one new atom to the list to be outputted */ static void add_atom_to_output(t_usbhid *x, t_atom *new_atom) { t_atom *new_atom_list; new_atom_list = (t_atom *)getbytes((x->output_count + 1) * sizeof(t_atom)); memcpy(new_atom_list, x->output, x->output_count * sizeof(t_atom)); freebytes(x->output, x->output_count * sizeof(t_atom)); x->output = new_atom_list; memcpy(x->output + x->output_count, new_atom, sizeof(t_atom)); ++(x->output_count); } static void add_symbol_to_output(t_usbhid *x, t_symbol *s) { t_atom *temp_atom = getbytes(sizeof(t_atom)); SETSYMBOL(temp_atom, s); add_atom_to_output(x,temp_atom); freebytes(temp_atom,sizeof(t_atom)); } static void add_float_to_output(t_usbhid *x, t_float f) { t_atom *temp_atom = getbytes(sizeof(t_atom)); SETFLOAT(temp_atom, f); add_atom_to_output(x,temp_atom); freebytes(temp_atom,sizeof(t_atom)); } static void reset_output(t_usbhid *x) { if(x->output) { freebytes(x->output, x->output_count * sizeof(t_atom)); x->output = NULL; x->output_count = 0; } } static t_int init_libhid(t_usbhid *x) { if (! hid_is_initialised() ) { x->x_hid_return = hid_init(); if(x->x_hid_return != HID_RET_SUCCESS) { error("[usbhid] hid_init failed with return code %d\n", x->x_hid_return); } } return(x->x_hid_return); } /* * This function is used in a HIDInterfaceMatcher to iterate thru all of the * HID devices on the USB bus */ static bool device_iterator (struct usb_dev_handle const* usbdev, void* custom, unsigned int length) { bool ret = false; t_int i; char current_dev_path[10]; /* only here to prevent the unused warning */ /* TODO remove */ length = *((unsigned long*)custom); /* Obtain the device's full path */ sprintf(current_dev_path, "%s/%s", usbdev->bus->dirname, usbdev->device->filename); /* Check if we already saw this dev */ for ( i = 0 ; ( hid_id[i] != NULL ) ; i++ ) { if (!strcmp(hid_id[i], current_dev_path ) ) break; } /* Append device to the list if needed */ if (hid_id[i] == NULL) { hid_id[i] = (char *) malloc(strlen(usbdev->device->filename) + strlen(usbdev->bus->dirname) ); sprintf(hid_id[i], "%s/%s", usbdev->bus->dirname, usbdev->device->filename); } else /* device already seen */ { return false; } /* Filter non HID device */ if ( (usbdev->device->descriptor.bDeviceClass == 0) /* Class defined at interface level */ && usbdev->device->config && usbdev->device->config->interface->altsetting->bInterfaceClass == USB_CLASS_HID) { post("bus %s device %s: %d %d", usbdev->bus->dirname, usbdev->device->filename, usbdev->device->descriptor.idVendor, usbdev->device->descriptor.idProduct); ret = true; } else { ret = false; } return ret; } /* -------------------------------------------------------------------------- */ /* This function is used in a HIDInterfaceMatcher in order to match devices by * serial number. */ /* static bool match_serial_number(struct usb_dev_handle* usbdev, void* custom, unsigned int length) */ /* { */ /* bool ret; */ /* char* buffer = (char*)malloc(length); */ /* usb_get_string_simple(usbdev, usb_device(usbdev)->descriptor.iSerialNumber, */ /* buffer, length); */ /* ret = strncmp(buffer, (char*)custom, length) == 0; */ /* free(buffer); */ /* return ret; */ /* } */ /* -------------------------------------------------------------------------- */ /* static bool get_device_by_number(struct usb_dev_handle* usbdev, */ /* void* custom, */ /* unsigned int length) */ /* { */ /* bool ret; */ /* return ret; */ /* } */ /* -------------------------------------------------------------------------- */ static long* make_hid_path(t_int argc, t_atom *argv) { t_int i; t_symbol *tmp_symbol; t_int *return_array = NULL; // TODO: free memory first return_array = (t_int *) getbytes(sizeof(t_int) * argc); /* A usbhid path component is 32 bits, the high 16 bits identify the usage page, * and the low 16 bits the item number. */ /* TODO: print error if a symbol is found in the data list */ for(i=0; is_name, 0, 16); post("make_hid_path[%d]: 0x%08x %s", i, return_array[i], tmp_symbol->s_name); } return return_array; } static char* make_hid_packet(t_int argc, t_atom *argv) { t_int i; t_symbol *tmp_symbol; char *return_array = NULL; // TODO: free memory first return_array = (char *) getbytes(sizeof(char) * argc); /* A usbhid path component is 32 bits, the high 16 bits identify the usage page, * and the low 16 bits the item number. */ /* TODO: print error if a symbol is found in the data list */ for(i=0; is_name, 0, 16); post("make_hid_packet[%d]: 0x%02x %s", i, return_array[i], tmp_symbol->s_name); } return return_array; } static t_int get_device_string(HIDInterface *hidif, char *device_string) { int length; t_int ret = 0; char buffer[STRING_BUFFER_LENGTH] = ""; char return_buffer[STRING_BUFFER_LENGTH] = ""; if ( !hid_is_opened(hidif) ) return(0); if (hidif->device->descriptor.iManufacturer) { length = usb_get_string_simple(hidif->dev_handle, hidif->device->descriptor.iManufacturer, buffer, STRING_BUFFER_LENGTH); if (length > 0) { strncat(return_buffer, buffer, STRING_BUFFER_LENGTH - strlen(device_string)); strncat(return_buffer, " ",1); ret = 1; } else { post("(unable to fetch manufacturer string)"); } } if (hidif->device->descriptor.iProduct) { length = usb_get_string_simple(hidif->dev_handle, hidif->device->descriptor.iProduct, buffer, STRING_BUFFER_LENGTH); if (length > 0) { strncat(return_buffer, buffer, STRING_BUFFER_LENGTH - strlen(device_string)); strncat(return_buffer, " ",1); ret = 1; } else { post("(unable to fetch product string)"); } } if (hidif->device->descriptor.iSerialNumber) { length = usb_get_string_simple(hidif->dev_handle, hidif->device->descriptor.iSerialNumber, buffer, STRING_BUFFER_LENGTH); if (length > 0) strncat(return_buffer, buffer, STRING_BUFFER_LENGTH - strlen(device_string)); else post("(unable to fetch product string)"); } if (return_buffer) strncpy(device_string, return_buffer, STRING_BUFFER_LENGTH); return ret; } /*------------------------------------------------------------------------------ * IMPLEMENTATION */ /* -------------------------------------------------------------------------- */ static void usbhid_close(t_usbhid *x) { if(x->debug_level) post("usbhid_close"); t_int ret; char string_buffer[STRING_BUFFER_LENGTH]; if ( hid_is_opened(x->x_hidinterface) ) { ret = get_device_string(x->x_hidinterface,string_buffer); x->x_hid_return = hid_close(x->x_hidinterface); if (x->x_hid_return == HID_RET_SUCCESS) { if (ret) post("[usbhid]: closed %s",string_buffer); else post("[usbhid]: closed device"); reset_output(x); add_float_to_output(x,0); outlet_anything(x->x_status_outlet, gensym("open"), x->output_count, x->output); } else { error("[usbhid] could not close %d, error #%d",x->x_device_number,x->x_hid_return); } } } /* -------------------------------------------------------------------------- */ static void usbhid_open(t_usbhid *x, t_symbol *vendor_id_hex, t_symbol *product_id_hex) { if(x->debug_level) post("usbhid_open"); char string_buffer[STRING_BUFFER_LENGTH]; if( init_libhid(x) != HID_RET_SUCCESS ) return; /* convert hex symbols to ints */ x->vendor_id = (unsigned short) strtol(vendor_id_hex->s_name, NULL, 16); x->product_id = (unsigned short) strtol(product_id_hex->s_name, NULL, 16); if( hid_is_opened(x->x_hidinterface) ) { if( (x->vendor_id == x->x_hidinterface->device->descriptor.idVendor) && (x->product_id == x->x_hidinterface->device->descriptor.idProduct)) { post("[usbhid] device already opened"); return; } else { usbhid_close(x); } } if( !hid_is_opened(x->x_hidinterface) ) { HIDInterfaceMatcher matcher = { x->vendor_id, x->product_id, NULL, NULL, 0 }; x->x_hid_return = hid_force_open(x->x_hidinterface, 0, &matcher, 3); if (x->x_hid_return == HID_RET_SUCCESS) { if (get_device_string(x->x_hidinterface,string_buffer)) post("[usbhid]: opened %s",string_buffer); reset_output(x); add_float_to_output(x,1); outlet_anything(x->x_status_outlet, gensym("open"), x->output_count, x->output); } else { error("[usbhid] hid_force_open failed with return code %d\n", x->x_hid_return); } } } /* -------------------------------------------------------------------------- */ static void usbhid_get(t_usbhid *x, t_float length_arg) { if(x->debug_level) post("usbhid_get"); int i; int packet_bytes = (int)length_arg; char packet[packet_bytes]; if ( !hid_is_opened(x->x_hidinterface) ) { error("[usbhid] device not open, can't get data"); return; } x->x_hid_return = hid_get_input_report(x->x_hidinterface, NULL, x->x_read_element_count, packet, length_arg); if (x->x_hid_return != HID_RET_SUCCESS) { error("[usbhid] hid_get_input_report failed with return code %d\n", x->x_hid_return); reset_output(x); add_float_to_output(x, x->x_hid_return); outlet_anything(x->x_status_outlet, gensym("getError"), x->output_count, x->output); } reset_output(x); for(i=0; ix_data_outlet, &s_list, x->output_count, x->output); post("x->x_read_elements %d",x->x_read_elements); } /* -------------------------------------------------------------------------- */ static void usbhid_path(t_usbhid *x, t_symbol *s, int argc, t_atom *argv) { if(x->debug_level) post("usbhid_path"); int i; t_symbol *tmp_symbol; if(argc > x->x_write_path_count) { if(x->debug_level) post("usbhid_path: freeing/allocating memory"); freebytes(x->x_write_paths, sizeof(t_int) * x->x_write_path_count); x->x_write_paths = (t_int *) getbytes(sizeof(t_int) * argc); } for(i=0; ix_write_paths[i] = strtoul(tmp_symbol->s_name, 0, 16); post("x->x_write_paths[%d]: 0x%08x %s", i, x->x_write_paths[i], tmp_symbol->s_name); } } /* -------------------------------------------------------------------------- */ static void usbhid_set(t_usbhid *x, t_symbol *s, int argc, t_atom *argv) { if(x->debug_level) post("usbhid_set"); char *packet; if ( !hid_is_opened(x->x_hidinterface) ) { error("[usbhid] device not open, can't set data"); return; } packet = make_hid_packet(argc, argv); x->x_hid_return = hid_set_output_report(x->x_hidinterface, x->x_write_paths, x->x_write_path_count, packet, argc); if (x->x_hid_return != HID_RET_SUCCESS) { error("[usbhid] hid_get_input_report failed with return code %d\n", x->x_hid_return); reset_output(x); add_float_to_output(x, x->x_hid_return); outlet_anything(x->x_status_outlet, gensym("set_error"), x->output_count, x->output); } } /* -------------------------------------------------------------------------- */ static void usbhid_read(t_usbhid *x) { if(x->debug_level) post("usbhid_read"); } /* -------------------------------------------------------------------------- */ static void usbhid_write(t_usbhid *x, t_symbol *s, int argc, t_atom *argv) { if(x->debug_level) post("usbhid_write"); int i; // const int path[] = {0x000c0001, 0x000c0001}; // int path[] = {0x00010005, 0x00010036}; int path[] = {0xffa00001, 0xffa00005}; // int *path; unsigned int const depth = 2; // number of 32bit chunks in the path unsigned char const SEND_PACKET_LEN = 1; // number of bytes in packet char const PACKET[] = { 0xff, 0xff }; // the data to write // char const PACKET[] = { 0x00, 0x00 }; // the data to write // char PACKET[] = { 0x00, 0x00 }; // the data to write if ( !hid_is_opened(x->x_hidinterface) ) { error("[usbhid] device not open, can't set data"); return; } /* path = getbytes(sizeof(int) * (argc - 1)); depth = (argc - 1) / 2; for(i = 0; i < argc - 1; ++i) { path[(i+1)/2] = (strtol(atom_getsymbol(argv + i)->s_name, NULL, 16) << 16) + (strtol(atom_getsymbol(argv + i + 1)->s_name, NULL, 16) & 0x0000ffff); ++i; } SEND_PACKET_LEN = 2; PACKET[1] = (unsigned short) atom_getfloat(argv + argc - 1); */ post("depth: %d SEND_PACKET_LEN: %d PACKET[0]: %d PACKET[1]: %d", depth, SEND_PACKET_LEN, PACKET[0], PACKET[1]); for(i = 0; i < (argc - 1) / 2; ++i) { post("path %d: 0x%08x", i, path[i]); } x->x_hid_return = hid_set_output_report(x->x_hidinterface, path, depth, PACKET, SEND_PACKET_LEN); if (x->x_hid_return != HID_RET_SUCCESS) { error("[usbhid] hid_set_output_report failed with return code %d", x->x_hid_return); reset_output(x); add_float_to_output(x, x->x_hid_return); outlet_anything(x->x_status_outlet, gensym("get_error"), x->output_count, x->output); } post("wrote"); } /* -------------------------------------------------------------------------- */ /* reinit libhid to get update the list of attached devices */ static void usbhid_refresh(t_usbhid *x) { x->x_hid_return = hid_cleanup(); if (x->x_hid_return != HID_RET_SUCCESS) error("[usbhid] hid_cleanup failed with return code %d\n", x->x_hid_return); if( init_libhid(x) != HID_RET_SUCCESS ) return; } /* -------------------------------------------------------------------------- */ /* convert a list to a HID packet and set it */ /* set the HID packet for which elements to write */ static void usbhid_set_descriptor(t_usbhid *x, int argc, t_atom *argv) { if(x->debug_level) post("usbhid_descriptor"); /* int const PATH_IN[PATH_LENGTH] = { 0xffa00001, 0xffa00002, 0xffa10003 }; */ // int const PATH_OUT[3] = { 0x00010002, 0x00010001, 0x00010030 }; t_int i; } /* -------------------------------------------------------------------------- */ static void usbhid_get_descriptor(t_usbhid *x) { if(x->debug_level) post("usbhid_get"); unsigned int i = 0; t_int input_size = 0; t_int output_size = 0; t_int feature_size = 0; char buf[MAXPDSTRING]; if (!hid_is_opened(x->x_hidinterface)) { error("[usbget] cannot dump tree of unopened HIDinterface."); } else { post("[usbhid] parse tree of HIDInterface %s:\n", x->x_hidinterface->id); // reset_output(x); while (HIDParse(x->x_hidinterface->hid_parser, x->x_hidinterface->hid_data)) { reset_output(x); // add_symbol_to_output(x, gensym("path")); switch(x->x_hidinterface->hid_data->Type) { case 0x80: add_symbol_to_output(x, gensym("input")); input_size = input_size + x->x_hidinterface->hid_data->Size; break; case 0x90: add_symbol_to_output(x, gensym("output")); output_size = output_size + x->x_hidinterface->hid_data->Size; break; case 0xb0: add_symbol_to_output(x, gensym("feature")); feature_size = feature_size + x->x_hidinterface->hid_data->Size; break; default: add_symbol_to_output(x, gensym("UNKNOWN_TYPE")); } add_float_to_output(x, x->x_hidinterface->hid_data->Size); add_float_to_output(x, x->x_hidinterface->hid_data->Offset); add_symbol_to_output(x, gensym("path")); for (i = 0; i < x->x_hidinterface->hid_data->Path.Size; ++i) { // sprintf(buf, "0x%04x", x->x_hidinterface->hid_data->Path.Node[i].UPage); // add_symbol_to_output(x, gensym(buf)); // sprintf(buf, "0x%04x", x->x_hidinterface->hid_data->Path.Node[i].Usage); // add_symbol_to_output(x, gensym(buf)); // post("0x%04x%04x",x->x_hidinterface->hid_data->Path.Node[i].UPage, // x->x_hidinterface->hid_data->Path.Node[i].Usage); } add_symbol_to_output(x, gensym("logical")); add_float_to_output(x, x->x_hidinterface->hid_data->LogMin); add_float_to_output(x, x->x_hidinterface->hid_data->LogMax); outlet_anything(x->x_status_outlet, gensym("element"), x->output_count, x->output); } reset_output(x); // add_symbol_to_output(x, gensym("totalSize")); add_float_to_output(x, input_size); add_float_to_output(x, output_size); add_float_to_output(x, feature_size); outlet_anything(x->x_status_outlet, gensym("totalSize"), x->output_count, x->output); // outlet_anything(x->x_status_outlet, gensym("device"), // x->output_count, x->output); } } /* -------------------------------------------------------------------------- */ static void usbhid_descriptor(t_usbhid *x, t_symbol *s, int argc, t_atom *argv) { if(s == gensym("descriptor")) // get rid of unused s warning { if(argc) usbhid_set_descriptor(x,argc,argv); else usbhid_get_descriptor(x); } } /* -------------------------------------------------------------------------- */ static void usbhid_print(t_usbhid *x) { if(x->debug_level) post("usbhid_print"); t_int i; char string_buffer[STRING_BUFFER_LENGTH]; /* t_atom event_data[3]; */ for ( i = 0 ; ( hid_id[i] != NULL ) ; i++ ) { if( hid_id[i] != NULL ) post("hid_id[%d]: %s",i,hid_id[i]); } if(get_device_string(x->x_hidinterface,string_buffer)) post("%s is currently open",string_buffer); x->x_hid_return = hid_dump_tree(stdout, x->x_hidinterface); if (x->x_hid_return != HID_RET_SUCCESS) { fprintf(stderr, "hid_dump_tree failed with return code %d\n", x->x_hid_return); return; } /* SETSYMBOL(event_data, gensym(type)); /\* type *\/ */ /* SETSYMBOL(event_data + 1, gensym(code)); /\* code *\/ */ /* SETSYMBOL(event_data + 2, value); /\* value *\/ */ // outlet_list(x->x_status_outlet, &s_list, } /* -------------------------------------------------------------------------- */ static void usbhid_reset(t_usbhid *x) { if(x->debug_level) post("usbhid_reset"); hid_reset_HIDInterface(x->x_hidinterface); } /* -------------------------------------------------------------------------- */ static void usbhid_debug(t_usbhid *x, t_float f) { x->debug_level = f; switch(x->debug_level) { case 0: hid_set_usb_debug(0); hid_set_debug(HID_DEBUG_NONE); break; case 1: hid_set_usb_debug(0); hid_set_debug(HID_DEBUG_ERRORS); break; case 2: hid_set_usb_debug(0); hid_set_debug(HID_DEBUG_ERRORS | HID_DEBUG_WARNINGS); break; case 3: hid_set_usb_debug(0); hid_set_debug(HID_DEBUG_ERRORS | HID_DEBUG_WARNINGS | HID_DEBUG_NOTICES); break; case 4: hid_set_usb_debug(0); hid_set_debug(HID_DEBUG_NOTRACES); break; case 5: hid_set_usb_debug(0); hid_set_debug(HID_DEBUG_ALL); break; default: hid_set_usb_debug(x->debug_level - 5); hid_set_debug(HID_DEBUG_ALL); break; } } /* -------------------------------------------------------------------------- */ static void usbhid_free(t_usbhid* x) { if(x->debug_level) post("usbhid_free"); usbhid_close(x); freebytes(x->x_read_elements,sizeof(t_int) * x->x_read_element_count); freebytes(x->x_write_paths,sizeof(t_int) * x->x_write_path_count); if(x->debug_level) post("[usbhid] freeing instance %d",usbhid_instance_count); hid_delete_HIDInterface(&(x->x_hidinterface)); if(usbhid_instance_count <= 1) { post("[usbhid] freeing last instance"); x->x_hid_return = hid_cleanup(); if (x->x_hid_return != HID_RET_SUCCESS) error("[usbhid] hid_cleanup failed with return code %d\n", x->x_hid_return); } usbhid_instance_count--; } /* -------------------------------------------------------------------------- */ static void *usbhid_new(t_float f) { t_int i; HIDInterfaceMatcher matcher; t_usbhid *x = (t_usbhid *)pd_new(usbhid_class); if(x->debug_level) post("usbhid_new"); /* only display the version when the first instance is loaded */ if(!usbhid_instance_count) post("[usbhid] %d.%d, written by Hans-Christoph Steiner ", USBHID_MAJOR_VERSION, USBHID_MINOR_VERSION); /* create anything outlet used for HID data */ x->x_data_outlet = outlet_new(&x->x_obj, 0); x->x_status_outlet = outlet_new(&x->x_obj, 0); /* turn off the flood of libhid debug messages by default */ hid_set_debug(HID_DEBUG_NONE); hid_set_debug_stream(stdout); hid_set_usb_debug(0); /* data init */ x->output = NULL; x->output_count = 0; for (i = 0 ; i < HID_ID_MAX ; i++) hid_id[i] = NULL; x->x_hidinterface = hid_new_HIDInterface(); matcher.vendor_id = HID_ID_MATCH_ANY; matcher.product_id = HID_ID_MATCH_ANY; matcher.matcher_fn = device_iterator; x->x_write_path_count = 0; x->x_device_number = f; /* Open the device and save settings. If there is an error, return the object * anyway, so that the inlets and outlets are created, thus not breaking the * patch. */ /* if (usbhid_open(x,f)) */ /* error("[usbhid] device %d did not open",(t_int)f); */ usbhid_instance_count++; return (x); } void usbhid_setup(void) { usbhid_class = class_new(gensym("usbhid"), (t_newmethod)usbhid_new, (t_method)usbhid_free, sizeof(t_usbhid), CLASS_DEFAULT, A_DEFFLOAT, NULL); /* add inlet datatype methods */ // class_addbang(usbhid_class,(t_method) usbhid_bang); /* add inlet message methods */ class_addmethod(usbhid_class,(t_method)usbhid_print, gensym("print"), 0); class_addmethod(usbhid_class,(t_method)usbhid_reset, gensym("reset"), 0); class_addmethod(usbhid_class,(t_method)usbhid_refresh, gensym("refresh"), 0); class_addmethod(usbhid_class,(t_method)usbhid_debug, gensym("debug"), A_DEFFLOAT,0); class_addmethod(usbhid_class,(t_method)usbhid_descriptor, gensym("descriptor"), A_GIMME, 0); class_addmethod(usbhid_class,(t_method)usbhid_path, gensym("path"), A_GIMME, 0); class_addmethod(usbhid_class,(t_method)usbhid_get,gensym("get"), A_DEFFLOAT, 0); class_addmethod(usbhid_class,(t_method)usbhid_set,gensym("set"), A_GIMME,0); class_addmethod(usbhid_class,(t_method)usbhid_read,gensym("read"), 0); class_addmethod(usbhid_class,(t_method)usbhid_write,gensym("write"), A_GIMME, 0); class_addmethod(usbhid_class,(t_method)usbhid_open,gensym("open"), A_DEFSYM, A_DEFSYM, 0); class_addmethod(usbhid_class,(t_method)usbhid_close,gensym("close"), 0); } #endif /* NOT _WIN32 */ hcs-0.2.1/username2uid-help.pd000066400000000000000000000025641422106453500161560ustar00rootroot00000000000000#N canvas 0 26 443 294 10; #X msg 56 49 symbol root; #X msg 75 81 symbol hans; #X floatatom 56 240 5 0 0 0 - - -; #X text 12 14 convert a username to a UID.; #X msg 14 148 bang; #X msg 143 162 symbol daemon; #X obj 30 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 93 109 symbol lp; #X msg 99 135 symbol trash; #X floatatom 272 231 5 0 0 0 - - -; #X msg 272 159 bang; #X text 192 136 ignore bad usernames; #X obj 142 240 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 145 262 ^-- bang if not found; #X obj 409 228 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #N canvas 280 175 494 344 META 0; #X text 12 165 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 145 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control filesystem; #X text 12 45 DESCRIPTION convert a username to a UID; #X text 12 65 INLET_0 bang symbol; #X text 12 85 INLET_1 symbol; #X text 12 105 OUTLET_0 float; #X text 12 125 OUTLET_1 bang; #X restore 391 271 pd META; #X obj 56 190 username2uid; #X obj 272 201 username2uid daemon; #X connect 0 0 16 0; #X connect 1 0 16 0; #X connect 4 0 16 0; #X connect 5 0 16 1; #X connect 7 0 16 0; #X connect 8 0 16 0; #X connect 10 0 17 0; #X connect 16 0 2 0; #X connect 16 0 6 0; #X connect 16 1 12 0; #X connect 17 0 9 0; #X connect 17 1 14 0; hcs-0.2.1/username2uid.pd000066400000000000000000000013161422106453500152220ustar00rootroot00000000000000#N canvas 0 31 353 422 10; #X obj 19 213 hcs/passwd; #X obj 18 12 inlet; #X obj 61 12 inlet; #X obj 18 322 outlet; #X obj 108 31 loadbang; #X obj 56 59 purepd/any_argument \$1; #X obj 57 93 route float; #X obj 129 114 hcs/passwd; #X obj 226 323 outlet; #X obj 129 135 list; #X obj 129 155 list split 3; #X obj 129 176 list split 2; #X obj 18 241 list; #X obj 18 261 list split 3; #X obj 18 282 list split 2; #X connect 0 0 12 0; #X connect 0 1 8 0; #X connect 1 0 0 0; #X connect 2 0 5 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 0 1; #X connect 6 1 7 0; #X connect 7 0 9 0; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 11 1 0 1; #X connect 12 0 13 0; #X connect 13 0 14 0; #X connect 14 1 3 0; hcs-0.2.1/version-help.pd000066400000000000000000000017441422106453500152370ustar00rootroot00000000000000#N canvas 0 26 445 258 10; #X msg 49 57 bang; #X text 40 12 Get the version of the currently running Pd.; #X obj 49 119 version; #X floatatom 49 168 5 0 0 3 major - -; #X floatatom 102 168 5 0 0 3 minor - -; #X floatatom 155 168 5 0 0 3 bugfix - -; #X symbolatom 209 168 0 0 0 3 test - -; #X obj 49 144 unpack float float float symbol symbol symbol; #X symbolatom 262 173 0 0 0 3 date - -; #X symbolatom 316 171 0 0 0 3 time - -; #N canvas 280 175 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control pd_op; #X text 12 45 DESCRIPTION get the version of the currently running Pd; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 list; #X restore 394 234 pd META; #X connect 0 0 2 0; #X connect 2 0 7 0; #X connect 7 0 3 0; #X connect 7 1 4 0; #X connect 7 2 5 0; #X connect 7 3 6 0; #X connect 7 4 8 0; #X connect 7 5 9 0; hcs-0.2.1/version.c000066400000000000000000000066211422106453500141270ustar00rootroot00000000000000/* --------------------------------------------------------------------------*/ /* */ /* object for getting the version of Pd-extended */ /* (it gets the version at compile time, so it will show the version of Pd */ /* that is was compiled against) */ /* Written by Hans-Christoph Steiner */ /* */ /* Copyright (c) 2006, 2010 Hans-Christoph Steiner */ /* */ /* 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 3 */ /* of the License, or (at your option) any later version. */ /* */ /* See file LICENSE for further information on licensing terms. */ /* */ /* 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. */ /* */ /* --------------------------------------------------------------------------*/ #include static char *version = "1.3"; #define DEBUG(x) //#define DEBUG(x) x /*------------------------------------------------------------------------------ * CLASS DEF */ static t_class *version_class; typedef struct _version { t_object x_obj; } t_version; /*------------------------------------------------------------------------------ * IMPLEMENTATION */ static void version_output(t_version* x) { DEBUG(post("version_output");); int major, minor, bugfix; t_atom version_data[6]; sys_getversion(&major, &minor, &bugfix); SETFLOAT(version_data, (t_float) major); SETFLOAT(version_data + 1, (t_float) minor); SETFLOAT(version_data + 2, (t_float) bugfix); SETSYMBOL(version_data + 3, gensym(PD_TEST_VERSION)); SETSYMBOL(version_data + 4, gensym(__DATE__)); SETSYMBOL(version_data + 5, gensym(__TIME__)); outlet_list(x->x_obj.ob_outlet, &s_list, 6, version_data); } static void *version_new(t_symbol *s) { DEBUG(post("version_new");); t_version *x = (t_version *)pd_new(version_class); outlet_new(&x->x_obj, &s_list); return (x); } void version_setup(void) { DEBUG(post("version_setup");); version_class = class_new(gensym("version"), (t_newmethod)version_new, 0, sizeof(t_version), 0, 0); /* add inlet datatype methods */ class_addbang(version_class,(t_method) version_output); } hcs-0.2.1/window_name-help.pd000066400000000000000000000176461422106453500160710ustar00rootroot00000000000000#N canvas 111 51 576 352 10; #X obj 124 207 sys_gui; #X symbolatom 239 101 0 0 0 0 - - -; #X obj 223 32 loadbang; #X obj 124 148 pack float symbol; #X obj 59 88 hsl 128 15 0.1 1 1 1 empty empty window_alpha -2 -8 0 10 -204800 -1 -1 12700 1; #X floatatom 56 123 5 0 0 0 - - -; #X msg 124 177 wm attributes \$2 -alpha \$1; #X text 210 274 for more options:; #X obj 241 292 pddp/pddplink http://tcl.tk/man/tcl8.5/TkCmd/wm.htm ; #X text 113 234 alpha does not work with X11 :(; #X obj 223 69 window_name; #X text 13 37 change alpha of this window:; #N canvas 83 292 729 228 Mac 0; #X obj 25 163 sys_gui; #X obj 124 74 window_name; #X obj 25 102 pack float symbol; #X msg 25 133 wm attributes \$2 -transparent \$1; #X obj 124 49 loadbang; #X obj 25 60 tgl 30 0 empty empty empty 17 7 0 10 -204786 -1 -1 0 1 ; #X text 43 13 turn off window shadow; #X obj 265 163 sys_gui; #X obj 364 74 window_name; #X obj 265 102 pack float symbol; #X obj 364 49 loadbang; #X obj 265 60 tgl 30 0 empty empty empty 17 7 0 10 -204786 -1 -1 0 1; #X msg 265 133 wm attributes \$2 -fullscreen \$1; #X text 263 13 make this window fullscreen; #X obj 495 163 sys_gui; #X obj 594 74 window_name; #X obj 495 102 pack float symbol; #X obj 594 49 loadbang; #X obj 495 60 tgl 30 0 empty empty empty 17 7 0 10 -204786 -1 -1 0 1; #X text 479 15 make this window on top of all others; #X msg 495 133 wm attributes \$2 -topmost \$1; #X connect 1 0 2 1; #X connect 2 0 3 0; #X connect 3 0 0 0; #X connect 4 0 1 0; #X connect 5 0 2 0; #X connect 8 0 9 1; #X connect 9 0 12 0; #X connect 10 0 8 0; #X connect 11 0 9 0; #X connect 12 0 7 0; #X connect 15 0 16 1; #X connect 16 0 20 0; #X connect 17 0 15 0; #X connect 18 0 16 0; #X connect 20 0 14 0; #X restore 60 277 pd Mac OS X tricks; #N canvas 67 329 729 228 Windows 0; #X obj 25 163 sys_gui; #X obj 124 74 window_name; #X obj 25 102 pack float symbol; #X obj 124 49 loadbang; #X obj 25 60 tgl 30 0 empty empty empty 17 7 0 10 -204786 -1 -1 0 1 ; #X obj 265 163 sys_gui; #X obj 364 74 window_name; #X obj 265 102 pack float symbol; #X obj 364 49 loadbang; #X obj 265 60 tgl 30 0 empty empty empty 17 7 0 10 -204786 -1 -1 0 1; #X obj 495 163 sys_gui; #X obj 594 74 window_name; #X obj 495 102 pack float symbol; #X obj 594 49 loadbang; #X obj 495 60 tgl 30 0 empty empty empty 17 7 0 10 -204786 -1 -1 0 1; #X text 479 15 make this window on top of all others; #X msg 495 133 wm attributes \$2 -topmost \$1; #X msg 265 133 wm attributes \$2 -toolwindow \$1; #X text 263 13 make this window a "toolwindow"; #X text 23 13 make this a "disabled" window; #X msg 25 133 wm attributes \$2 -disabled \$1; #X connect 1 0 2 1; #X connect 2 0 20 0; #X connect 3 0 1 0; #X connect 4 0 2 0; #X connect 6 0 7 1; #X connect 7 0 17 0; #X connect 8 0 6 0; #X connect 9 0 7 0; #X connect 11 0 12 1; #X connect 12 0 16 0; #X connect 13 0 11 0; #X connect 14 0 12 0; #X connect 16 0 10 0; #X connect 17 0 5 0; #X connect 20 0 0 0; #X restore 60 297 pd Windows tricks; #N canvas 228 139 462 430 get 0; #X symbolatom 42 235 0 0 0 0 - - -; #X obj 42 191 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X symbolatom 126 235 0 0 0 0 - - -; #X obj 126 191 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 0 22 450 300 subname 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 107 137 window_name; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 126 214 pd subname; #X symbolatom 209 235 0 0 0 0 - - -; #X obj 209 191 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 window_name 1; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 209 214 pd get parent; #X symbolatom 73 128 0 0 0 0 - - -; #X obj 73 84 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 47 36 You can get the canvas name of other patches that this one is embedded in by setting the argument to the level:; #X text 78 147 ^-- this is the same as the top level of this help patch ; #X symbolatom 299 235 0 0 0 0 - - -; #X obj 299 191 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #N canvas 496 269 450 300 get 0; #X obj 117 21 inlet; #X obj 119 265 outlet; #X obj 109 137 window_name 2; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 299 214 pd get parent of parent; #X obj 73 107 window_name 1; #X obj 42 214 window_name; #X text 45 278 get the canvas name using a float message representing depth; #X symbolatom 103 359 10 0 0 0 - - -; #X msg 88 305 0; #X msg 118 305 1; #N canvas 0 22 450 300 open 0; #N canvas 511 55 450 300 open 0; #X obj 131 37 inlet; #X obj 129 109 outlet; #N canvas 772 55 450 300 open 0; #X obj 131 37 inlet; #X obj 129 109 outlet; #N canvas 0 22 450 300 open 0; #X obj 141 47 inlet; #X obj 139 119 outlet; #X obj 143 84 window_name; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 128 76 pd open me; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 129 74 pd open me; #X connect 0 0 2 0; #X connect 2 0 1 0; #X restore 138 87 pd open me; #X obj 141 47 inlet; #X obj 139 119 outlet; #X connect 0 0 2 0; #X connect 1 0 0 0; #X restore 270 352 pd open me; #X symbolatom 270 376 10 0 0 0 - - -; #X obj 270 308 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144 -1 -1 6; #X text 131 399 .x0.c means a non-existent window; #X floatatom 281 330 5 0 0 0 - - -; #X msg 149 305 2; #X obj 104 333 window_name; #X connect 1 0 16 0; #X connect 3 0 4 0; #X connect 4 0 2 0; #X connect 6 0 7 0; #X connect 7 0 5 0; #X connect 9 0 15 0; #X connect 13 0 14 0; #X connect 14 0 12 0; #X connect 15 0 8 0; #X connect 16 0 0 0; #X connect 19 0 27 0; #X connect 20 0 27 0; #X connect 21 0 22 0; #X connect 23 0 21 0; #X connect 23 0 25 0; #X connect 26 0 27 0; #X connect 27 0 18 0; #X restore 336 39 pd get from different levels; #N canvas 692 51 454 468 get 0; #X symbolatom 73 259 0 0 0 0 - - -; #X obj 73 215 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X symbolatom 72 176 0 0 0 0 - - -; #X obj 72 132 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 220 77 namecanvas myname; #X symbolatom 73 99 0 0 0 0 - - -; #X obj 73 55 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 53 14 You can also use the canvas receive symbol to get the canvas_name:; #X obj 73 78 window_name myname; #X obj 73 238 window_name pd-window_name-help.pd; #X symbolatom 97 418 0 0 0 0 - - -; #X text 69 292 or via the inlet:; #X msg 99 341 myname; #X msg 84 315 symbol this_does_not_exist; #X msg 149 341 symbol pd-getmyname; #X text 111 439 .x0 means a non-existent window; #X obj 72 155 window_name pd-getmyname; #N canvas 0 22 450 300 getmyname 0; #X symbolatom 188 150 0 0 0 0 - - -; #X obj 188 106 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 188 129 window_name; #X connect 1 0 2 0; #X connect 2 0 0 0; #X restore 231 155 pd getmyname; #X msg 149 366 pd-window_name-help.pd; #X obj 97 397 window_name; #X connect 1 0 9 0; #X connect 3 0 16 0; #X connect 6 0 8 0; #X connect 8 0 5 0; #X connect 9 0 0 0; #X connect 12 0 19 0; #X connect 13 0 19 0; #X connect 14 0 19 0; #X connect 16 0 2 0; #X connect 18 0 19 0; #X connect 19 0 10 0; #X restore 336 64 pd get by canvas receive symbol; #X text 341 114 turn on/off resizing of this window:; #X obj 474 177 window_name; #X obj 375 197 pack float symbol; #X obj 474 157 loadbang; #X obj 375 155 tgl 30 0 empty empty empty 17 7 0 10 -204786 -1 -1 1 1; #X msg 375 222 wm resizable \$2 \$1 \$1; #N canvas 398 189 494 344 META 0; #X text 12 125 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v3; #X text 12 105 AUTHOR Hans-Christoph Steiner; #X text 12 5 KEYWORDS control canvas_op; #X text 12 45 DESCRIPTION get the name of a window; #X text 12 65 INLET_0 bang; #X text 12 85 OUTLET_0 symbol; #X restore 525 330 pd META; #X obj 375 248 sys_gui; #X connect 2 0 10 0; #X connect 3 0 6 0; #X connect 4 0 3 0; #X connect 4 0 5 0; #X connect 6 0 0 0; #X connect 10 0 3 1; #X connect 10 0 1 0; #X connect 17 0 18 1; #X connect 18 0 21 0; #X connect 19 0 17 0; #X connect 20 0 18 0; #X connect 21 0 23 0; hcs-0.2.1/window_name.c000066400000000000000000000050721422106453500147500ustar00rootroot00000000000000#include #include #include #include #define DEBUG(x) static t_class *window_name_class; typedef struct _window_name { t_object x_obj; t_canvas *x_canvas; t_symbol *receive_name; t_int depth; } t_window_name; static t_symbol* make_canvas_symbol(t_canvas* canvas) { char buf[MAXPDSTRING]; snprintf(buf, MAXPDSTRING, ".x%lx", (long unsigned int)canvas); return gensym(buf); } static t_symbol* get_canvas_by_depth(t_window_name *x) { t_canvas *canvas = x->x_canvas; int depth = x->depth; if(depth<0)depth=0; while(depth && canvas) { canvas = canvas->gl_owner; depth--; } return make_canvas_symbol(canvas); } static t_symbol* get_canvas_by_name(t_window_name *x) { return make_canvas_symbol((t_canvas *)pd_findbyclass(x->receive_name, canvas_class)); } static t_symbol* get_window_name(t_window_name *x) { if(x->receive_name == &s_) return get_canvas_by_depth(x); else return get_canvas_by_name(x); } static void window_name_bang(t_window_name *x) { /* actually get the canvas name each time to make sure we get * accurate info in case of changes. If we cache the result, a * canvas could have been deleted or renamed. */ outlet_symbol(x->x_obj.ob_outlet, get_window_name(x)); } static void window_name_anything(t_window_name *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *first_symbol = atom_getsymbolarg(0,argc,argv); x->depth = 0; x->receive_name = &s_; if(s == &s_float) x->depth = (t_int) atom_getfloatarg(0,argc,argv); else if (first_symbol == &s_) x->receive_name = s; else x->receive_name = first_symbol; window_name_bang(x); } static void *window_name_new(t_symbol *s, int argc, t_atom *argv) { t_window_name *x = (t_window_name *)pd_new(window_name_class); t_glist* glist = (t_glist *)canvas_getcurrent(); x->x_canvas = (t_canvas *)glist_getcanvas(glist); t_symbol *tmp = atom_getsymbolarg(0,argc,argv); x->depth = 0; x->receive_name = &s_; if(tmp == &s_) x->depth = (t_int) atom_getfloatarg(0,argc,argv); else x->receive_name = tmp; outlet_new(&x->x_obj, &s_symbol); return(x); } void window_name_setup(void) { window_name_class = class_new(gensym("window_name"), (t_newmethod)window_name_new, NULL, sizeof(t_window_name), 0, A_GIMME, 0); class_addbang(window_name_class, (t_method)window_name_bang); class_addanything(window_name_class, (t_method)window_name_anything); }