aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2006-11-30 14:57:40 +0000
committermusil <tmusil@users.sourceforge.net>2006-11-30 14:57:40 +0000
commita63b9787cf2a0c188d6e923bcd033c1e3c23a424 (patch)
tree520c2ff222e47997e6340859ab5435de0a329572
initial commitsvn2git-root
changed float to t_float -fno-strict-aliasing #pragma obsolete help-*.pd to *-help.pd svn path=/trunk/externals/iem/iem_roomsim/; revision=6544
-rw-r--r--GnuGPL.txt340
-rw-r--r--LICENSE.txt27
-rw-r--r--READ_ME.txt12
-rw-r--r--help/cart2del_damp_2d-help.pd332
-rw-r--r--help/cart2del_damp_3d-help.pd573
-rw-r--r--src/cart2del_damp_2d.c388
-rw-r--r--src/cart2del_damp_3d.c582
-rw-r--r--src/early_reflections_2d.c536
-rw-r--r--src/early_reflections_3d.c902
-rw-r--r--src/iem_roomsim.c34
-rw-r--r--src/iem_roomsim.dsp85
-rw-r--r--src/iem_roomsim.dsw29
-rw-r--r--src/iemlib.h102
-rw-r--r--src/makefile50
-rw-r--r--src/makefile_linux50
-rw-r--r--src/makefile_win41
16 files changed, 4083 insertions, 0 deletions
diff --git a/GnuGPL.txt b/GnuGPL.txt
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/GnuGPL.txt
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..d9761e4
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,27 @@
+iem_roomsim - dynamic library for pd; 2 mirror source method rendering objects
+
+Copyright (C) 2000-2006 Thomas MUSIL [musil_at_iem.at]
+
+IEM - Institute of Electronic Music and Acoustics, Graz
+Inffeldgasse 10/3, 8010 Graz, Austria
+http://iem.at
+
+
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details ( GnuGPL.txt ).
+ (e.g. http://www.gnu.org/copyleft/gpl.html)
+
+ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Graz, 15 Nov. 2006
+ Thomas Musil \ No newline at end of file
diff --git a/READ_ME.txt b/READ_ME.txt
new file mode 100644
index 0000000..8a63e15
--- /dev/null
+++ b/READ_ME.txt
@@ -0,0 +1,12 @@
+This library extends the performance of miller puckette's pure data (pd).
+
+iem_roomsim is written by Thomas Musil from IEM Graz Austria
+ and it is compatible to miller puckette's pd-0.37-3 to pd-0.39-2.
+see also LICENCE.txt, GnuGPL.txt.
+
+iem_roomsim contains 2 objects:
+"cart2del_damp_2d" and "cart2del_damp_3d".
+
+this are 2 mirror source method rendering objects, the calculate the radius distance,
+the delay time and the spheric coordinates in case of 3D or the polar coordinates in case of 2D
+of all the first and second reflections between an subjekt and an object in a cuboid room.
diff --git a/help/cart2del_damp_2d-help.pd b/help/cart2del_damp_2d-help.pd
new file mode 100644
index 0000000..74ea6af
--- /dev/null
+++ b/help/cart2del_damp_2d-help.pd
@@ -0,0 +1,332 @@
+#N canvas 11 8 974 613 10;
+#X text 11 9 cart2del_damp_2d;
+#X obj 48 288 cart2del_damp_2d;
+#X msg 59 83 sonic_speed 340;
+#X msg 67 104 r_ambi 1.4;
+#X obj 105 154 pack;
+#X obj 139 154 t b f;
+#X floatatom 98 137 5 -20 20 0 - - -;
+#X floatatom 141 137 5 -20 20 0 - - -;
+#X text 183 136 m x m;
+#X obj 151 225 pack;
+#X obj 185 225 t b f;
+#X floatatom 144 208 5 -20 20 0 - - -;
+#X floatatom 187 208 5 -20 20 0 - - -;
+#X text 229 207 m x m;
+#X obj 48 313 print;
+#X msg 105 175 head_xy \$1 \$2;
+#X msg 151 246 src_xy \$1 \$2;
+#X obj 96 314 s xxx;
+#X obj 368 19 r xxx;
+#X obj 368 41 route direct early1 early2;
+#X obj 368 424 route del damp index_phi;
+#X floatatom 368 508 5 0 0 0 - - -;
+#X floatatom 414 485 5 0 0 0 - - -;
+#X floatatom 460 465 5 0 0 0 - - -;
+#X obj 418 241 route del damp index_phi;
+#X floatatom 510 290 5 0 0 0 - - -;
+#X floatatom 551 290 5 0 0 0 - - -;
+#X obj 418 358 unpack 0 0 0 0;
+#X floatatom 418 380 5 0 0 0 - - -;
+#X floatatom 460 380 5 0 0 0 - - -;
+#X floatatom 502 380 5 0 0 0 - - -;
+#X floatatom 545 380 5 0 0 0 - - -;
+#X obj 464 309 unpack 0 0 0 0;
+#X floatatom 464 339 5 0 0 0 - - -;
+#X floatatom 506 339 5 0 0 0 - - -;
+#X floatatom 548 339 5 0 0 0 - - -;
+#X floatatom 591 339 5 0 0 0 - - -;
+#X obj 460 444 route 1;
+#X obj 510 265 route 1 2 3 4;
+#X floatatom 592 290 5 0 0 0 - - -;
+#X floatatom 633 290 5 0 0 0 - - -;
+#X obj 468 62 route del damp index_phi;
+#X floatatom 560 112 5 0 0 0 - - -;
+#X floatatom 601 112 5 0 0 0 - - -;
+#X floatatom 468 204 5 0 0 0 - - -;
+#X floatatom 510 204 5 0 0 0 - - -;
+#X floatatom 552 204 5 0 0 0 - - -;
+#X floatatom 595 204 5 0 0 0 - - -;
+#X floatatom 642 112 5 0 0 0 - - -;
+#X floatatom 683 112 5 0 0 0 - - -;
+#X obj 560 87 route 1 2 3 4 5 6 7 8;
+#X floatatom 724 112 5 0 0 0 - - -;
+#X floatatom 765 112 5 0 0 0 - - -;
+#X floatatom 806 112 5 0 0 0 - - -;
+#X floatatom 847 112 5 0 0 0 - - -;
+#X text 673 290 degree;
+#X text 587 379 ms;
+#X text 499 466 degree;
+#X text 409 508 ms;
+#X text 808 204 ms;
+#X obj 468 181 unpack 0 0 0 0 0 0 0 0;
+#X floatatom 637 204 5 0 0 0 - - -;
+#X floatatom 679 204 5 0 0 0 - - -;
+#X floatatom 721 204 5 0 0 0 - - -;
+#X floatatom 764 204 5 0 0 0 - - -;
+#X floatatom 514 156 5 0 0 0 - - -;
+#X floatatom 556 156 5 0 0 0 - - -;
+#X floatatom 598 156 5 0 0 0 - - -;
+#X floatatom 641 156 5 0 0 0 - - -;
+#X obj 514 133 unpack 0 0 0 0 0 0 0 0;
+#X floatatom 683 156 5 0 0 0 - - -;
+#X floatatom 725 156 5 0 0 0 - - -;
+#X floatatom 767 156 5 0 0 0 - - -;
+#X floatatom 810 156 5 0 0 0 - - -;
+#X text 885 110 degree;
+#X text 78 385 IEM KUG;
+#X text 62 373 musil;
+#X text 92 373 @;
+#X text 98 373 iem.at;
+#X text 61 395 Graz \, Austria;
+#X text 13 362 (c) Thomas Musil 2000 - 2006;
+#X text 163 81 sonic speed in meter per second;
+#X text 148 105 minimum raduis in meter;
+#X text 149 64 room dimensions in meter;
+#X text 237 250 object coordinates;
+#X text 194 174 subject coordinates;
+#X text 847 156 linear rms;
+#X text 629 338 linear rms;
+#X text 452 483 linear rms;
+#X text 684 378 |;
+#X text 684 386 |;
+#X text 684 394 |;
+#X text 684 402 |;
+#X text 720 378 |;
+#X text 720 386 |;
+#X text 720 394 |;
+#X text 720 402 |;
+#X text 756 378 |;
+#X text 756 386 |;
+#X text 756 394 |;
+#X text 756 402 |;
+#X text 792 378 |;
+#X text 792 386 |;
+#X text 792 394 |;
+#X text 792 402 |;
+#X text 828 378 |;
+#X text 828 386 |;
+#X text 828 394 |;
+#X text 828 402 |;
+#X text 768 322 + y;
+#X text 671 371 --+-----+-----+-----+-----+-----+--;
+#X text 864 378 |;
+#X text 864 386 |;
+#X text 864 394 |;
+#X text 864 402 |;
+#X text 684 416 |;
+#X text 684 424 |;
+#X text 684 432 |;
+#X text 684 440 |;
+#X text 720 416 |;
+#X text 720 424 |;
+#X text 720 432 |;
+#X text 720 440 |;
+#X text 756 416 |;
+#X text 756 424 |;
+#X text 756 432 |;
+#X text 756 440 |;
+#X text 792 416 |;
+#X text 792 424 |;
+#X text 792 432 |;
+#X text 792 440 |;
+#X text 828 416 |;
+#X text 828 424 |;
+#X text 828 432 |;
+#X text 828 440 |;
+#X text 671 409 --+-----+-----+-----+-----+-----+--;
+#X text 864 416 |;
+#X text 864 424 |;
+#X text 864 432 |;
+#X text 864 440 |;
+#X text 684 454 |;
+#X text 684 462 |;
+#X text 684 470 |;
+#X text 684 478 |;
+#X text 720 454 |;
+#X text 720 462 |;
+#X text 720 470 |;
+#X text 720 478 |;
+#X text 756 454 |;
+#X text 756 462 |;
+#X text 756 470 |;
+#X text 756 478 |;
+#X text 792 454 |;
+#X text 792 462 |;
+#X text 792 470 |;
+#X text 792 478 |;
+#X text 828 454 |;
+#X text 828 462 |;
+#X text 828 470 |;
+#X text 828 478 |;
+#X text 671 447 --+-----+-----+-----+-----+-----+--;
+#X text 864 454 |;
+#X text 864 462 |;
+#X text 864 470 |;
+#X text 864 478 |;
+#X text 684 492 |;
+#X text 684 500 |;
+#X text 684 508 |;
+#X text 684 516 |;
+#X text 720 492 |;
+#X text 720 500 |;
+#X text 720 508 |;
+#X text 720 516 |;
+#X text 756 492 |;
+#X text 756 500 |;
+#X text 756 508 |;
+#X text 756 516 |;
+#X text 792 492 |;
+#X text 792 500 |;
+#X text 792 508 |;
+#X text 792 516 |;
+#X text 828 492 |;
+#X text 828 500 |;
+#X text 828 508 |;
+#X text 828 516 |;
+#X text 671 485 --+-----+-----+-----+-----+-----+--;
+#X text 864 492 |;
+#X text 864 500 |;
+#X text 864 508 |;
+#X text 864 516 |;
+#X text 684 530 |;
+#X text 684 538 |;
+#X text 684 546 |;
+#X text 684 554 |;
+#X text 720 530 |;
+#X text 720 538 |;
+#X text 720 546 |;
+#X text 720 554 |;
+#X text 756 530 |;
+#X text 756 538 |;
+#X text 756 546 |;
+#X text 756 554 |;
+#X text 792 530 |;
+#X text 792 538 |;
+#X text 792 546 |;
+#X text 792 554 |;
+#X text 828 530 |;
+#X text 828 538 |;
+#X text 828 546 |;
+#X text 828 554 |;
+#X text 671 523 --+-----+-----+-----+-----+-----+--;
+#X text 864 530 |;
+#X text 864 538 |;
+#X text 864 546 |;
+#X text 864 554 |;
+#X text 671 561 --+-----+-----+-----+-----+-----+--;
+#X text 750 461 ___________________________;
+#X text 911 466 > + x;
+#X text 774 338 |;
+#X text 774 345 |;
+#X text 774 352 |;
+#X text 774 359 |;
+#X text 774 366 |;
+#X text 774 373 |;
+#X text 774 380 |;
+#X text 774 387 |;
+#X text 774 394 |;
+#X text 774 401 |;
+#X text 774 408 |;
+#X text 774 415 |;
+#X text 774 414 |;
+#X text 774 421 |;
+#X text 774 428 |;
+#X text 774 435 |;
+#X text 774 441 |;
+#X text 774 448 |;
+#X text 774 455 |;
+#X text 774 462 |;
+#X text 774 469 |;
+#X text 774 476 |;
+#X text 774 483 |;
+#X text 774 490 |;
+#X text 774 334 ^;
+#X text 799 474 e1_1;
+#X text 762 429 e1_2;
+#X text 728 474 e1_3;
+#X text 763 507 e1_4;
+#X text 835 474 e2_1;
+#X text 762 389 e2_2;
+#X text 692 474 e2_3;
+#X text 763 543 e2_4;
+#X text 800 429 e2_5;
+#X text 728 429 e2_8;
+#X text 728 505 e2_6;
+#X text 800 505 e2_7;
+#X text 767 474 d_1;
+#X text 799 246 d .. direct;
+#X text 794 258 e1 .. early 1;
+#X text 794 270 e2 .. early 2;
+#X text 793 345 mirror source rooms;
+#X msg 48 63 room_dim 20 10;
+#X text 564 6 renders the delay time \, the damping and the direction
+of direct \, early_1 and early_2 reflections in a cuboid room model
+(2 dimensional);
+#X connect 1 0 14 0;
+#X connect 1 0 17 0;
+#X connect 2 0 1 0;
+#X connect 3 0 1 0;
+#X connect 4 0 15 0;
+#X connect 5 0 4 0;
+#X connect 5 1 4 1;
+#X connect 6 0 4 0;
+#X connect 7 0 5 0;
+#X connect 9 0 16 0;
+#X connect 10 0 9 0;
+#X connect 10 1 9 1;
+#X connect 11 0 9 0;
+#X connect 12 0 10 0;
+#X connect 15 0 1 0;
+#X connect 16 0 1 0;
+#X connect 18 0 19 0;
+#X connect 19 0 20 0;
+#X connect 19 1 24 0;
+#X connect 19 2 41 0;
+#X connect 20 0 21 0;
+#X connect 20 1 22 0;
+#X connect 20 2 37 0;
+#X connect 24 0 27 0;
+#X connect 24 1 32 0;
+#X connect 24 2 38 0;
+#X connect 27 0 28 0;
+#X connect 27 1 29 0;
+#X connect 27 2 30 0;
+#X connect 27 3 31 0;
+#X connect 32 0 33 0;
+#X connect 32 1 34 0;
+#X connect 32 2 35 0;
+#X connect 32 3 36 0;
+#X connect 37 0 23 0;
+#X connect 38 0 25 0;
+#X connect 38 1 26 0;
+#X connect 38 2 39 0;
+#X connect 38 3 40 0;
+#X connect 41 0 60 0;
+#X connect 41 1 69 0;
+#X connect 41 2 50 0;
+#X connect 50 0 42 0;
+#X connect 50 1 43 0;
+#X connect 50 2 48 0;
+#X connect 50 3 49 0;
+#X connect 50 4 51 0;
+#X connect 50 5 52 0;
+#X connect 50 6 53 0;
+#X connect 50 7 54 0;
+#X connect 60 0 44 0;
+#X connect 60 1 45 0;
+#X connect 60 2 46 0;
+#X connect 60 3 47 0;
+#X connect 60 4 61 0;
+#X connect 60 5 62 0;
+#X connect 60 6 63 0;
+#X connect 60 7 64 0;
+#X connect 69 0 65 0;
+#X connect 69 1 66 0;
+#X connect 69 2 67 0;
+#X connect 69 3 68 0;
+#X connect 69 4 70 0;
+#X connect 69 5 71 0;
+#X connect 69 6 72 0;
+#X connect 69 7 73 0;
+#X connect 260 0 1 0;
diff --git a/help/cart2del_damp_3d-help.pd b/help/cart2del_damp_3d-help.pd
new file mode 100644
index 0000000..59c9677
--- /dev/null
+++ b/help/cart2del_damp_3d-help.pd
@@ -0,0 +1,573 @@
+#N canvas 65 59 947 553 10;
+#X msg 28 87 sonic_speed 340;
+#X msg 36 108 r_ambi 1.4;
+#X obj 17 339 print;
+#X obj 65 340 s xxx;
+#X obj 307 27 r xxx;
+#X obj 307 49 route direct early1 early2;
+#X floatatom 307 520 5 0 0 0 - - -;
+#X floatatom 365 504 5 0 0 0 - - -;
+#X floatatom 423 487 5 0 0 0 - - -;
+#X floatatom 535 493 5 0 0 0 - - -;
+#X floatatom 555 512 5 0 0 0 - - -;
+#X floatatom 576 493 5 0 0 0 - - -;
+#X floatatom 596 512 5 0 0 0 - - -;
+#X obj 423 466 route 1;
+#X floatatom 318 270 5 0 0 0 - - -;
+#X floatatom 332 287 5 0 0 0 - - -;
+#X floatatom 347 304 5 0 0 0 - - -;
+#X floatatom 361 270 5 0 0 0 - - -;
+#X text 873 514 degree;
+#X text 659 495 ms;
+#X text 462 488 degree;
+#X text 344 520 ms;
+#X text 603 304 ms;
+#X floatatom 376 287 5 0 0 0 - - -;
+#X floatatom 390 304 5 0 0 0 - - -;
+#X floatatom 405 270 5 0 0 0 - - -;
+#X floatatom 419 287 5 0 0 0 - - -;
+#X text 15 7 cart2del_damp_3d;
+#X obj 17 314 cart2del_damp_3d;
+#X obj 172 261 t b f;
+#X floatatom 81 244 5 -20 20 0 - - -;
+#X floatatom 174 244 5 -20 20 0 - - -;
+#X obj 88 261 pack 0 0 0;
+#X obj 222 261 t b f;
+#X floatatom 224 244 5 0 30 0 - - -;
+#X text 147 224 m x m x m;
+#X obj 143 179 t b f;
+#X floatatom 52 162 5 -20 20 0 - - -;
+#X floatatom 145 162 5 -20 20 0 - - -;
+#X obj 59 179 pack 0 0 0;
+#X obj 193 179 t b f;
+#X floatatom 195 162 5 0 30 0 - - -;
+#X text 108 140 m x m x m;
+#X msg 88 282 src_xyz \$1 \$2 \$3;
+#X msg 59 200 head_xyz \$1 \$2 \$3;
+#X msg 17 66 room_dim 20 10 5;
+#X obj 322 72 route del damp index_theta_phi;
+#X obj 535 351 route del damp index_theta_phi;
+#X obj 307 445 route del damp index_theta_phi;
+#X obj 535 472 unpack 0 0 0 0 0 0;
+#X floatatom 617 493 5 0 0 0 - - -;
+#X floatatom 638 512 5 0 0 0 - - -;
+#X obj 753 398 route 1 2 3 4 5 6;
+#X floatatom 434 304 5 0 0 0 - - -;
+#X floatatom 448 270 5 0 0 0 - - -;
+#X floatatom 463 287 5 0 0 0 - - -;
+#X floatatom 477 304 5 0 0 0 - - -;
+#X floatatom 492 270 5 0 0 0 - - -;
+#X floatatom 506 287 5 0 0 0 - - -;
+#X floatatom 521 304 5 0 0 0 - - -;
+#X floatatom 535 270 5 0 0 0 - - -;
+#X floatatom 550 287 5 0 0 0 - - -;
+#X floatatom 565 304 5 0 0 0 - - -;
+#X obj 318 247 unpack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
+#X obj 378 102 route 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;
+#X text 90 404 IEM KUG;
+#X text 74 392 musil;
+#X text 104 392 @;
+#X text 110 392 iem.at;
+#X text 73 414 Graz \, Austria;
+#X text 25 381 (c) Thomas Musil 2000 - 2006;
+#X text 127 87 sonic speed in meter per second;
+#X text 111 108 minimum raduis in meter;
+#X text 118 68 room dimensions in meter;
+#X text 194 281 object coordinates;
+#X text 171 199 subject coordinates;
+#X text 594 658 |;
+#X text 594 666 |;
+#X text 594 674 |;
+#X text 594 682 |;
+#X text 630 658 |;
+#X text 630 666 |;
+#X text 630 674 |;
+#X text 630 682 |;
+#X text 666 658 |;
+#X text 666 666 |;
+#X text 666 674 |;
+#X text 666 682 |;
+#X text 702 658 |;
+#X text 702 666 |;
+#X text 702 674 |;
+#X text 702 682 |;
+#X text 738 658 |;
+#X text 738 666 |;
+#X text 738 674 |;
+#X text 738 682 |;
+#X text 678 602 + y;
+#X text 581 651 --+-----+-----+-----+-----+-----+--;
+#X text 774 658 |;
+#X text 774 666 |;
+#X text 774 674 |;
+#X text 774 682 |;
+#X text 594 696 |;
+#X text 594 704 |;
+#X text 594 712 |;
+#X text 594 720 |;
+#X text 630 696 |;
+#X text 630 704 |;
+#X text 630 712 |;
+#X text 630 720 |;
+#X text 666 696 |;
+#X text 666 704 |;
+#X text 666 712 |;
+#X text 666 720 |;
+#X text 702 696 |;
+#X text 702 704 |;
+#X text 702 712 |;
+#X text 702 720 |;
+#X text 738 696 |;
+#X text 738 704 |;
+#X text 738 712 |;
+#X text 738 720 |;
+#X text 581 689 --+-----+-----+-----+-----+-----+--;
+#X text 774 696 |;
+#X text 774 704 |;
+#X text 774 712 |;
+#X text 774 720 |;
+#X text 594 734 |;
+#X text 594 742 |;
+#X text 594 750 |;
+#X text 594 758 |;
+#X text 630 734 |;
+#X text 630 742 |;
+#X text 630 750 |;
+#X text 630 758 |;
+#X text 666 734 |;
+#X text 666 742 |;
+#X text 666 750 |;
+#X text 666 758 |;
+#X text 702 734 |;
+#X text 702 742 |;
+#X text 702 750 |;
+#X text 702 758 |;
+#X text 738 734 |;
+#X text 738 742 |;
+#X text 738 750 |;
+#X text 738 758 |;
+#X text 581 727 --+-----+-----+-----+-----+-----+--;
+#X text 774 734 |;
+#X text 774 742 |;
+#X text 774 750 |;
+#X text 774 758 |;
+#X text 594 772 |;
+#X text 594 780 |;
+#X text 594 788 |;
+#X text 594 796 |;
+#X text 630 772 |;
+#X text 630 780 |;
+#X text 630 788 |;
+#X text 630 796 |;
+#X text 666 772 |;
+#X text 666 780 |;
+#X text 666 788 |;
+#X text 666 796 |;
+#X text 702 772 |;
+#X text 702 780 |;
+#X text 702 788 |;
+#X text 702 796 |;
+#X text 738 772 |;
+#X text 738 780 |;
+#X text 738 788 |;
+#X text 738 796 |;
+#X text 581 765 --+-----+-----+-----+-----+-----+--;
+#X text 774 772 |;
+#X text 774 780 |;
+#X text 774 788 |;
+#X text 774 796 |;
+#X text 594 810 |;
+#X text 594 818 |;
+#X text 594 826 |;
+#X text 594 834 |;
+#X text 630 810 |;
+#X text 630 818 |;
+#X text 630 826 |;
+#X text 630 834 |;
+#X text 666 810 |;
+#X text 666 818 |;
+#X text 666 826 |;
+#X text 666 834 |;
+#X text 702 810 |;
+#X text 702 818 |;
+#X text 702 826 |;
+#X text 702 834 |;
+#X text 738 810 |;
+#X text 738 818 |;
+#X text 738 826 |;
+#X text 738 834 |;
+#X text 581 803 --+-----+-----+-----+-----+-----+--;
+#X text 774 810 |;
+#X text 774 818 |;
+#X text 774 826 |;
+#X text 774 834 |;
+#X text 581 841 --+-----+-----+-----+-----+-----+--;
+#X text 660 741 ___________________________;
+#X text 821 746 > + x;
+#X text 684 618 |;
+#X text 684 625 |;
+#X text 684 632 |;
+#X text 684 639 |;
+#X text 684 646 |;
+#X text 684 653 |;
+#X text 684 660 |;
+#X text 684 667 |;
+#X text 684 674 |;
+#X text 684 681 |;
+#X text 684 688 |;
+#X text 684 695 |;
+#X text 684 694 |;
+#X text 684 701 |;
+#X text 684 708 |;
+#X text 684 715 |;
+#X text 684 721 |;
+#X text 684 728 |;
+#X text 684 735 |;
+#X text 684 742 |;
+#X text 684 749 |;
+#X text 684 756 |;
+#X text 684 763 |;
+#X text 684 770 |;
+#X text 684 614 ^;
+#X text 709 754 e1_1;
+#X text 672 709 e1_2;
+#X text 745 754 e2_1;
+#X text 672 669 e2_2;
+#X text 677 758 d_1;
+#X text 239 738 d .. direct;
+#X text 234 750 e1 .. early 1;
+#X text 234 762 e2 .. early 2;
+#X text 710 630 mirror source rooms;
+#X text 400 504 linear rms;
+#X floatatom 545 397 5 0 0 0 - - -;
+#X floatatom 565 416 5 0 0 0 - - -;
+#X floatatom 586 397 5 0 0 0 - - -;
+#X floatatom 606 416 5 0 0 0 - - -;
+#X obj 545 376 unpack 0 0 0 0 0 0;
+#X floatatom 627 397 5 0 0 0 - - -;
+#X floatatom 648 416 5 0 0 0 - - -;
+#X text 665 396 linear rms;
+#X obj 753 420 unpack;
+#X floatatom 753 457 5 0 0 0 - - -;
+#X floatatom 761 440 5 0 0 0 - - -;
+#X obj 769 477 unpack;
+#X floatatom 769 514 5 0 0 0 - - -;
+#X floatatom 777 497 5 0 0 0 - - -;
+#X obj 785 420 unpack;
+#X floatatom 785 457 5 0 0 0 - - -;
+#X floatatom 793 440 5 0 0 0 - - -;
+#X obj 801 477 unpack;
+#X floatatom 801 514 5 0 0 0 - - -;
+#X floatatom 809 497 5 0 0 0 - - -;
+#X obj 817 420 unpack;
+#X floatatom 817 457 5 0 0 0 - - -;
+#X floatatom 825 440 5 0 0 0 - - -;
+#X obj 833 477 unpack;
+#X floatatom 833 514 5 0 0 0 - - -;
+#X floatatom 841 497 5 0 0 0 - - -;
+#X text 879 497 degree;
+#X text 857 456 degree;
+#X text 863 439 degree;
+#X text 694 456 elevation;
+#X text 706 440 azimuth;
+#X text 709 512 elevation;
+#X text 723 495 azimuth;
+#X floatatom 617 275 5 0 0 0 - - -;
+#X floatatom 631 292 5 0 0 0 - - -;
+#X floatatom 646 309 5 0 0 0 - - -;
+#X floatatom 660 275 5 0 0 0 - - -;
+#X floatatom 675 292 5 0 0 0 - - -;
+#X floatatom 689 309 5 0 0 0 - - -;
+#X floatatom 704 275 5 0 0 0 - - -;
+#X floatatom 718 292 5 0 0 0 - - -;
+#X floatatom 733 309 5 0 0 0 - - -;
+#X floatatom 747 275 5 0 0 0 - - -;
+#X floatatom 762 292 5 0 0 0 - - -;
+#X floatatom 776 309 5 0 0 0 - - -;
+#X floatatom 791 275 5 0 0 0 - - -;
+#X floatatom 805 292 5 0 0 0 - - -;
+#X floatatom 820 309 5 0 0 0 - - -;
+#X floatatom 834 275 5 0 0 0 - - -;
+#X floatatom 849 292 5 0 0 0 - - -;
+#X floatatom 864 309 5 0 0 0 - - -;
+#X obj 617 252 unpack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
+#X text 872 273 linear rms;
+#X obj 378 124 unpack;
+#X floatatom 378 161 5 0 0 0 - - -;
+#X floatatom 386 144 5 0 0 0 - - -;
+#X obj 410 124 unpack;
+#X floatatom 410 161 5 0 0 0 - - -;
+#X floatatom 418 144 5 0 0 0 - - -;
+#X obj 443 124 unpack;
+#X floatatom 443 161 5 0 0 0 - - -;
+#X floatatom 451 144 5 0 0 0 - - -;
+#X obj 394 181 unpack;
+#X floatatom 394 218 5 0 0 0 - - -;
+#X floatatom 402 201 5 0 0 0 - - -;
+#X obj 427 181 unpack;
+#X floatatom 427 218 5 0 0 0 - - -;
+#X floatatom 435 201 5 0 0 0 - - -;
+#X obj 459 181 unpack;
+#X floatatom 459 218 5 0 0 0 - - -;
+#X floatatom 467 201 5 0 0 0 - - -;
+#X obj 477 124 unpack;
+#X floatatom 477 161 5 0 0 0 - - -;
+#X floatatom 485 144 5 0 0 0 - - -;
+#X obj 509 124 unpack;
+#X floatatom 509 161 5 0 0 0 - - -;
+#X floatatom 517 144 5 0 0 0 - - -;
+#X obj 542 124 unpack;
+#X floatatom 542 161 5 0 0 0 - - -;
+#X floatatom 550 144 5 0 0 0 - - -;
+#X obj 493 181 unpack;
+#X floatatom 493 218 5 0 0 0 - - -;
+#X floatatom 501 201 5 0 0 0 - - -;
+#X obj 526 181 unpack;
+#X floatatom 526 218 5 0 0 0 - - -;
+#X floatatom 534 201 5 0 0 0 - - -;
+#X obj 558 181 unpack;
+#X floatatom 558 218 5 0 0 0 - - -;
+#X floatatom 566 201 5 0 0 0 - - -;
+#X obj 577 124 unpack;
+#X floatatom 577 161 5 0 0 0 - - -;
+#X floatatom 585 144 5 0 0 0 - - -;
+#X obj 609 124 unpack;
+#X floatatom 609 161 5 0 0 0 - - -;
+#X floatatom 617 144 5 0 0 0 - - -;
+#X obj 642 124 unpack;
+#X floatatom 642 161 5 0 0 0 - - -;
+#X floatatom 650 144 5 0 0 0 - - -;
+#X obj 593 181 unpack;
+#X floatatom 593 218 5 0 0 0 - - -;
+#X floatatom 601 201 5 0 0 0 - - -;
+#X obj 626 181 unpack;
+#X floatatom 626 218 5 0 0 0 - - -;
+#X floatatom 634 201 5 0 0 0 - - -;
+#X obj 658 181 unpack;
+#X floatatom 658 218 5 0 0 0 - - -;
+#X floatatom 666 201 5 0 0 0 - - -;
+#X text 694 218 degree;
+#X text 700 201 degree;
+#X text 678 160 degree;
+#X text 684 143 degree;
+#X text 319 160 elevation;
+#X text 331 144 azimuth;
+#X text 334 216 elevation;
+#X text 348 199 azimuth;
+#X text 564 6 renders the delay time \, the damping and the direction
+of direct \, early_1 and early_2 reflections in a cuboid room model
+(3 dimensional);
+#X text 679 746 (;
+#X text 689 746 );
+#X text 684 741 -;
+#X text 684 751 -;
+#X text 687 740 .;
+#X text 682 740 .;
+#X text 682 748 .;
+#X text 687 748 .;
+#X text 685 744 .;
+#X text 684 744 .;
+#X text 684 745 .;
+#X text 685 745 .;
+#X text 685 743 .;
+#X text 684 743 .;
+#X text 689 737 +z;
+#X text 683 743 .;
+#X text 683 744 .;
+#X text 683 745 .;
+#X text 72 500 e2_3;
+#X text 74 560 e1_3;
+#X text 107 560 e2_8;
+#X text 74 543 e2_9;
+#X text 36 562 e2_17;
+#X text 74 579 e2_18;
+#X text 77 651 d_1;
+#X text 110 651 e1_1;
+#X text 77 634 e1_2;
+#X text 77 670 e1_5;
+#X text 39 653 e1_4;
+#X text 143 650 e2_1;
+#X text 75 619 e2_2;
+#X text 8 653 e2_4;
+#X text 78 685 e2_5;
+#X text 110 633 e2_7;
+#X text 36 670 e2_10;
+#X text 108 669 e2_13;
+#X text 37 636 e2_16;
+#X text 494 638 z-axe shows out of the display;
+#X text 78 745 e1_6;
+#X text 40 747 e2_11;
+#X text 78 764 e2_12;
+#X text 111 745 e2_14;
+#X text 78 728 e2_15;
+#X text 82 808 e2_6;
+#X text 635 708 e2_16;
+#X text 710 709 e2_7;
+#X text 638 754 e1_4;
+#X text 601 754 e2_4;
+#X text 635 786 e2_10;
+#X text 673 787 e1_5;
+#X text 708 786 e2_13;
+#X text 673 823 e2_5;
+#X text 70 851 bottom (-z);
+#X text 69 463 top (+z);
+#X text 489 656 shows only;
+#X text 487 676 the x/y-plane;
+#X text 52 449 mirror source rooms (3D);
+#X connect 0 0 28 0;
+#X connect 1 0 28 0;
+#X connect 4 0 5 0;
+#X connect 5 0 48 0;
+#X connect 5 1 47 0;
+#X connect 5 2 46 0;
+#X connect 13 0 8 0;
+#X connect 28 0 2 0;
+#X connect 28 0 3 0;
+#X connect 29 0 32 0;
+#X connect 29 1 32 1;
+#X connect 30 0 32 0;
+#X connect 31 0 29 0;
+#X connect 32 0 43 0;
+#X connect 33 0 32 0;
+#X connect 33 1 32 2;
+#X connect 34 0 33 0;
+#X connect 36 0 39 0;
+#X connect 36 1 39 1;
+#X connect 37 0 39 0;
+#X connect 38 0 36 0;
+#X connect 39 0 44 0;
+#X connect 40 0 39 0;
+#X connect 40 1 39 2;
+#X connect 41 0 40 0;
+#X connect 43 0 28 0;
+#X connect 44 0 28 0;
+#X connect 45 0 28 0;
+#X connect 46 0 63 0;
+#X connect 46 1 291 0;
+#X connect 46 2 64 0;
+#X connect 47 0 49 0;
+#X connect 47 1 244 0;
+#X connect 47 2 52 0;
+#X connect 48 0 6 0;
+#X connect 48 1 7 0;
+#X connect 48 2 13 0;
+#X connect 49 0 9 0;
+#X connect 49 1 10 0;
+#X connect 49 2 11 0;
+#X connect 49 3 12 0;
+#X connect 49 4 50 0;
+#X connect 49 5 51 0;
+#X connect 52 0 248 0;
+#X connect 52 1 251 0;
+#X connect 52 2 254 0;
+#X connect 52 3 257 0;
+#X connect 52 4 260 0;
+#X connect 52 5 263 0;
+#X connect 63 0 14 0;
+#X connect 63 1 15 0;
+#X connect 63 2 16 0;
+#X connect 63 3 17 0;
+#X connect 63 4 23 0;
+#X connect 63 5 24 0;
+#X connect 63 6 25 0;
+#X connect 63 7 26 0;
+#X connect 63 8 53 0;
+#X connect 63 9 54 0;
+#X connect 63 10 55 0;
+#X connect 63 11 56 0;
+#X connect 63 12 57 0;
+#X connect 63 13 58 0;
+#X connect 63 14 59 0;
+#X connect 63 15 60 0;
+#X connect 63 16 61 0;
+#X connect 63 17 62 0;
+#X connect 64 0 293 0;
+#X connect 64 1 302 0;
+#X connect 64 2 296 0;
+#X connect 64 3 305 0;
+#X connect 64 4 299 0;
+#X connect 64 5 308 0;
+#X connect 64 6 311 0;
+#X connect 64 7 320 0;
+#X connect 64 8 314 0;
+#X connect 64 9 323 0;
+#X connect 64 10 317 0;
+#X connect 64 11 326 0;
+#X connect 64 12 329 0;
+#X connect 64 13 338 0;
+#X connect 64 14 332 0;
+#X connect 64 15 341 0;
+#X connect 64 16 335 0;
+#X connect 64 17 344 0;
+#X connect 244 0 240 0;
+#X connect 244 1 241 0;
+#X connect 244 2 242 0;
+#X connect 244 3 243 0;
+#X connect 244 4 245 0;
+#X connect 244 5 246 0;
+#X connect 248 0 249 0;
+#X connect 248 1 250 0;
+#X connect 251 0 252 0;
+#X connect 251 1 253 0;
+#X connect 254 0 255 0;
+#X connect 254 1 256 0;
+#X connect 257 0 258 0;
+#X connect 257 1 259 0;
+#X connect 260 0 261 0;
+#X connect 260 1 262 0;
+#X connect 263 0 264 0;
+#X connect 263 1 265 0;
+#X connect 291 0 273 0;
+#X connect 291 1 274 0;
+#X connect 291 2 275 0;
+#X connect 291 3 276 0;
+#X connect 291 4 277 0;
+#X connect 291 5 278 0;
+#X connect 291 6 279 0;
+#X connect 291 7 280 0;
+#X connect 291 8 281 0;
+#X connect 291 9 282 0;
+#X connect 291 10 283 0;
+#X connect 291 11 284 0;
+#X connect 291 12 285 0;
+#X connect 291 13 286 0;
+#X connect 291 14 287 0;
+#X connect 291 15 288 0;
+#X connect 291 16 289 0;
+#X connect 291 17 290 0;
+#X connect 293 0 294 0;
+#X connect 293 1 295 0;
+#X connect 296 0 297 0;
+#X connect 296 1 298 0;
+#X connect 299 0 300 0;
+#X connect 299 1 301 0;
+#X connect 302 0 303 0;
+#X connect 302 1 304 0;
+#X connect 305 0 306 0;
+#X connect 305 1 307 0;
+#X connect 308 0 309 0;
+#X connect 308 1 310 0;
+#X connect 311 0 312 0;
+#X connect 311 1 313 0;
+#X connect 314 0 315 0;
+#X connect 314 1 316 0;
+#X connect 317 0 318 0;
+#X connect 317 1 319 0;
+#X connect 320 0 321 0;
+#X connect 320 1 322 0;
+#X connect 323 0 324 0;
+#X connect 323 1 325 0;
+#X connect 326 0 327 0;
+#X connect 326 1 328 0;
+#X connect 329 0 330 0;
+#X connect 329 1 331 0;
+#X connect 332 0 333 0;
+#X connect 332 1 334 0;
+#X connect 335 0 336 0;
+#X connect 335 1 337 0;
+#X connect 338 0 339 0;
+#X connect 338 1 340 0;
+#X connect 341 0 342 0;
+#X connect 341 1 343 0;
+#X connect 344 0 345 0;
+#X connect 344 1 346 0;
diff --git a/src/cart2del_damp_2d.c b/src/cart2del_damp_2d.c
new file mode 100644
index 0000000..a092e73
--- /dev/null
+++ b/src/cart2del_damp_2d.c
@@ -0,0 +1,388 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_roomsim written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+#include <math.h>
+
+
+/* -------------------------- cart2del_damp_2d ------------------------------ */
+/*
+** pos. x-Richtung Nase
+** pos. y-Richtung Linke Hand
+** pos. z-Richtung Scheitel
+** Kartesischer Koordinaten-Ursprung liegt in der Mitte des Raums am Boden
+
+ aenderungen: src-index von 1 .. n auf 0 .. (n-1)
+ aenderungen: azimuth von rad auf degree
+*/
+
+/*
+Reihenfolge der bundle-sektoren: index phi:
+
+
+ 1 0
+ 2 45
+ 3 90
+ 4 135
+ 5 180
+ 6 225
+ 7 270
+ 8 315
+
+ 1. und 2. reflexionen:
+
+
+ +x
+ 5
+ 9 1 11
++y 6 2 0 4 8
+ 12 3 10
+ 7
+
+*/
+
+
+
+typedef struct _cart2del_damp_2d
+{
+ t_object x_obj;
+ t_symbol *x_s_direct;
+ t_symbol *x_s_early1;
+ t_symbol *x_s_early2;
+ t_symbol *x_s_del;
+ t_symbol *x_s_damp;
+ t_symbol *x_s_index_phi;
+ t_float x_room_x;
+ t_float x_room_y;
+ t_float x_head_x;
+ t_float x_head_y;
+ t_float x_src_x;
+ t_float x_src_y;
+ t_float x_r_ambi;
+ t_float x_speed;
+ t_float x_180_over_pi;
+ void *x_clock;
+} t_cart2del_damp_2d;
+
+static t_class *cart2del_damp_2d_class;
+
+static t_float cart2del_damp_2d_calc_radius(t_floatarg r_ambi, t_floatarg dx, t_floatarg dy)
+{
+ t_float r = (t_float)sqrt(dx*dx + dy*dy);
+
+ if(r < r_ambi)
+ return(r_ambi);
+ else
+ return(r);
+}
+
+static t_float cart2del_damp_2d_calc_azimuth(t_floatarg x_180_over_pi, t_floatarg dx, t_floatarg dy)/*changes*/
+{
+ if(dx == 0.0f)
+ {
+ if(dy < 0.0f)
+ return(270.0f);
+ else
+ return(90.0f);
+ }
+ else if(dx < 0.0f)
+ {
+ return(180.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ }
+ else
+ {
+ if(dy < 0.0f)
+ return(360.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ else
+ return(x_180_over_pi * (t_float)atan(dy / dx));
+ }
+}
+
+static void cart2del_damp_2d_doit(t_cart2del_damp_2d *x)
+{
+ t_float diff_x, diff_y;
+ t_float sum_x, sum_y;
+ t_float lx, wy;
+ t_float x0, y0;
+ t_float xp1, yp1;
+ t_float xn1, yn1;
+ t_float xp2, yp2;
+ t_float xn2, yn2;
+ t_float m2ms = 1000.0f / x->x_speed;
+ t_float x_180_over_pi=x->x_180_over_pi;
+ t_float r_ambi = x->x_r_ambi;
+ t_float rad[20];
+ t_atom at[20];
+
+ lx = x->x_room_x;
+ wy = x->x_room_y;
+
+ diff_x = x->x_src_x - x->x_head_x;
+ diff_y = x->x_src_y - x->x_head_y;
+ sum_x = x->x_src_x + x->x_head_x;
+ sum_y = x->x_src_y + x->x_head_y;
+
+ x0 = diff_x;
+ y0 = diff_y;
+ xp1 = lx - sum_x;
+ yp1 = wy - sum_y;
+ xn1 = -lx - sum_x;
+ yn1 = -wy - sum_y;
+ xp2 = 2.0f*lx + diff_x;
+ yp2 = 2.0f*wy + diff_y;
+ xn2 = -2.0f*lx + diff_x;
+ yn2 = -2.0f*wy + diff_y;
+
+ rad[0] = cart2del_damp_2d_calc_radius(r_ambi, x0, y0);
+ rad[1] = cart2del_damp_2d_calc_radius(r_ambi, xp1, y0);
+ rad[2] = cart2del_damp_2d_calc_radius(r_ambi, x0, yp1);
+ rad[3] = cart2del_damp_2d_calc_radius(r_ambi, xn1, y0);
+ rad[4] = cart2del_damp_2d_calc_radius(r_ambi, x0, yn1);
+ rad[5] = cart2del_damp_2d_calc_radius(r_ambi, xp2, y0);
+ rad[6] = cart2del_damp_2d_calc_radius(r_ambi, x0, yp2);
+ rad[7] = cart2del_damp_2d_calc_radius(r_ambi, xn2, y0);
+ rad[8] = cart2del_damp_2d_calc_radius(r_ambi, x0, yn2);
+ rad[9] = cart2del_damp_2d_calc_radius(r_ambi, xp1, yp1);
+ rad[10] = cart2del_damp_2d_calc_radius(r_ambi, xn1, yn1);
+ rad[11] = cart2del_damp_2d_calc_radius(r_ambi, xp1, yn1);
+ rad[12] = cart2del_damp_2d_calc_radius(r_ambi, xn1, yp1);
+
+ /* delay-reihenfolge: 0,
+ +1x, +1y, -1x, -1y
+ +2x, +2y, -2x, -2y
+ +1x+1y, -1x-1y
+ +1x-1y, -1x+1y
+ */
+
+ SETSYMBOL(at, x->x_s_del);
+
+ SETFLOAT(at+1, rad[0] * m2ms);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_direct, 2, at);
+
+ SETFLOAT(at+1, rad[1] *m2ms);
+ SETFLOAT(at+2, rad[2] *m2ms);
+ SETFLOAT(at+3, rad[3] *m2ms);
+ SETFLOAT(at+4, rad[4] *m2ms);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 5, at);
+
+ SETFLOAT(at+1, rad[5] *m2ms);
+ SETFLOAT(at+2, rad[6] *m2ms);
+ SETFLOAT(at+3, rad[7] *m2ms);
+ SETFLOAT(at+4, rad[8] *m2ms);
+ SETFLOAT(at+5, rad[9] *m2ms);
+ SETFLOAT(at+6, rad[10] *m2ms);
+ SETFLOAT(at+7, rad[11] *m2ms);
+ SETFLOAT(at+8, rad[12] *m2ms);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 9, at);
+
+
+ /* daempfungs-reihenfolge:
+ 0,
+ +1x, +1y, -1x, -1y
+ +2x, +2y, -2x, -2y
+ +1x+1y, -1x-1y
+ +1x-1y, -1x+1y
+ */
+
+ SETSYMBOL(at, x->x_s_damp);
+
+ SETFLOAT(at+1, r_ambi / rad[0]);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_direct, 2, at);
+
+ SETFLOAT(at+1, r_ambi / rad[1]);
+ SETFLOAT(at+2, r_ambi / rad[2]);
+ SETFLOAT(at+3, r_ambi / rad[3]);
+ SETFLOAT(at+4, r_ambi / rad[4]);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 5, at);
+
+ SETFLOAT(at+1, r_ambi / rad[5]);
+ SETFLOAT(at+2, r_ambi / rad[6]);
+ SETFLOAT(at+3, r_ambi / rad[7]);
+ SETFLOAT(at+4, r_ambi / rad[8]);
+ SETFLOAT(at+5, r_ambi / rad[9]);
+ SETFLOAT(at+6, r_ambi / rad[10]);
+ SETFLOAT(at+7, r_ambi / rad[11]);
+ SETFLOAT(at+8, r_ambi / rad[12]);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 9, at);
+
+
+ /* encoder-winkel-reihenfolge: index delta phi
+ 0,
+ +1x, +1y, -1x, -1y
+ +2x, +2y, -2x, -2y
+ +1x+1y, -1x-1y
+ +1x-1y, -1x+1y
+ */
+
+ SETSYMBOL(at, x->x_s_index_phi);
+
+ SETFLOAT(at+1, 1.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, x0, y0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_direct, 3, at);
+
+
+ SETFLOAT(at+1, 1.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xp1, y0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 3, at);
+
+ SETFLOAT(at+1, 2.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, x0, yp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 3, at);
+
+ SETFLOAT(at+1, 3.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xn1, y0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 3, at);
+
+ SETFLOAT(at+1, 4.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, x0, yn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 3, at);
+
+
+ SETFLOAT(at+1, 1.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xp2, y0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+
+ SETFLOAT(at+1, 2.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, x0, yp2));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+
+ SETFLOAT(at+1, 3.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xn2, y0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+
+ SETFLOAT(at+1, 4.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, x0, yn2));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+
+ SETFLOAT(at+1, 5.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xp1, yp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+
+ SETFLOAT(at+1, 6.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xn1, yn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+
+ SETFLOAT(at+1, 7.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xp1, yn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+
+ SETFLOAT(at+1, 8.0f);
+ SETFLOAT(at+2, cart2del_damp_2d_calc_azimuth(x_180_over_pi, xn1, yp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 3, at);
+}
+
+static void cart2del_damp_2d_src_xy(t_cart2del_damp_2d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 2)&&IS_A_FLOAT(argv, 0)&&IS_A_FLOAT(argv, 1))
+ {
+ t_float xr2=0.5f*x->x_room_x, yr2=0.5f*x->x_room_y;
+
+ x->x_src_x = atom_getfloat(argv++);
+ x->x_src_y = atom_getfloat(argv);
+ if(x->x_src_x > xr2)
+ x->x_src_x = xr2;
+ if(x->x_src_x < -xr2)
+ x->x_src_x = -xr2;
+ if(x->x_src_y > yr2)
+ x->x_src_y = yr2;
+ if(x->x_src_y < -yr2)
+ x->x_src_y = -yr2;
+ clock_delay(x->x_clock, 0.0f);
+ }
+}
+
+static void cart2del_damp_2d_head_xy(t_cart2del_damp_2d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 2)&&IS_A_FLOAT(argv, 0)&&IS_A_FLOAT(argv, 1))
+ {
+ t_float xr2=0.5f*x->x_room_x, yr2=0.5f*x->x_room_y;
+
+ x->x_head_x = atom_getfloat(argv++);
+ x->x_head_y = atom_getfloat(argv);
+ if(x->x_head_x > xr2)
+ x->x_head_x = xr2;
+ if(x->x_head_x < -xr2)
+ x->x_head_x = -xr2;
+ if(x->x_head_y > yr2)
+ x->x_head_y = yr2;
+ if(x->x_head_y < -yr2)
+ x->x_head_y = -yr2;
+ clock_delay(x->x_clock, 0.0f);
+ }
+}
+
+static void cart2del_damp_2d_room_dim(t_cart2del_damp_2d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 2)&&IS_A_FLOAT(argv, 0)&&IS_A_FLOAT(argv, 1))
+ {
+ x->x_room_x = atom_getfloat(argv++);
+ x->x_room_y = atom_getfloat(argv);
+ if(x->x_room_x < 0.5f)
+ x->x_room_x = 0.5f;
+ if(x->x_room_y < 0.5f)
+ x->x_room_y = 0.5f;
+ clock_delay(x->x_clock, 0.0f);
+ }
+}
+
+static void cart2del_damp_2d_r_ambi(t_cart2del_damp_2d *x, t_floatarg r_ambi)
+{
+ if(r_ambi < 0.1f)
+ r_ambi = 0.1f;
+ x->x_r_ambi = r_ambi;
+ clock_delay(x->x_clock, 0.0f);
+}
+
+static void cart2del_damp_2d_sonic_speed(t_cart2del_damp_2d *x, t_floatarg speed)
+{
+ if(speed < 10.0f)
+ speed = 10.0f;
+ if(speed > 2000.0f)
+ speed = 2000.0f;
+ x->x_speed = speed;
+ clock_delay(x->x_clock, 0.0f);
+}
+
+static void cart2del_damp_2d_free(t_cart2del_damp_2d *x)
+{
+ clock_free(x->x_clock);
+}
+
+static void *cart2del_damp_2d_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_cart2del_damp_2d *x = (t_cart2del_damp_2d *)pd_new(cart2del_damp_2d_class);
+
+ x->x_room_x = 12.0f;
+ x->x_room_y = 8.0f;
+ x->x_head_x = 0.0f;
+ x->x_head_y = 0.0f;
+ x->x_src_x = 3.0f;
+ x->x_src_y = 0.5f;
+ x->x_r_ambi = 1.4f;
+ x->x_speed = 340.0f;
+ x->x_s_direct = gensym("direct");
+ x->x_s_early1 = gensym("early1");
+ x->x_s_early2 = gensym("early2");
+ x->x_s_damp = gensym("damp");
+ x->x_s_del = gensym("del");
+ x->x_s_index_phi = gensym("index_phi");
+ outlet_new(&x->x_obj, &s_list);
+ x->x_clock = clock_new(x, (t_method)cart2del_damp_2d_doit);
+ x->x_180_over_pi = (t_float)(180.0 / (4.0 * atan(1.0)));
+ return (x);
+}
+
+void cart2del_damp_2d_setup(void)
+{
+ cart2del_damp_2d_class = class_new(gensym("cart2del_damp_2d"), (t_newmethod)cart2del_damp_2d_new, (t_method)cart2del_damp_2d_free,
+ sizeof(t_cart2del_damp_2d), 0, A_GIMME, 0);
+ class_addmethod(cart2del_damp_2d_class, (t_method)cart2del_damp_2d_src_xy, gensym("src_xy"), A_GIMME, 0);
+ class_addmethod(cart2del_damp_2d_class, (t_method)cart2del_damp_2d_head_xy, gensym("head_xy"), A_GIMME, 0);
+ class_addmethod(cart2del_damp_2d_class, (t_method)cart2del_damp_2d_room_dim, gensym("room_dim"), A_GIMME, 0);
+ class_addmethod(cart2del_damp_2d_class, (t_method)cart2del_damp_2d_sonic_speed, gensym("sonic_speed"), A_FLOAT, 0);
+ class_addmethod(cart2del_damp_2d_class, (t_method)cart2del_damp_2d_r_ambi, gensym("r_ambi"), A_FLOAT, 0);
+ class_sethelpsymbol(cart2del_damp_2d_class, gensym("iemhelp2/cart2del_damp_2d-help"));
+}
diff --git a/src/cart2del_damp_3d.c b/src/cart2del_damp_3d.c
new file mode 100644
index 0000000..9612aea
--- /dev/null
+++ b/src/cart2del_damp_3d.c
@@ -0,0 +1,582 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_roomsim written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */
+
+
+#include "m_pd.h"
+#include "iemlib.h"
+#include <math.h>
+
+
+/* -------------------------- cart2del_damp_3d ------------------------------ */
+/*
+** pos. x-Richtung Nase
+** pos. y-Richtung Linke Hand
+** pos. z-Richtung Scheitel
+** Kartesischer Koordinaten-Ursprung liegt in der Mitte des Raums am Boden
+*/
+
+/*
+Reihenfolge der bundle-sektoren: index delta phi:
+
+ 1 90 0
+ 2 45 45
+ 3 45 135
+ 4 45 225
+ 5 45 315
+ 6 0 0
+ 7 0 45
+ 8 0 90
+ 9 0 135
+ 10 0 180
+ 11 0 225
+ 12 0 270
+ 13 0 315
+ 14 -45 45
+ 15 -45 135
+ 16 -45 225
+ 17 -45 315
+
+
+ top
+
+
+ +x
+
+
+ +y 9
+
+
+
+ +x
+
+ 15
+ +y 23 3 14
+ 24
+
+
+ +x
+ 8
+ 22 2 13
+ +y 10 4 0 1 7
+ 16 5 19
+ 11
+
+ +x
+
+ 21
+ +y 17 6 20
+ 18
+
+ +x
+
+
+ +y 12
+
+
+
+*/
+
+
+
+typedef struct _cart2del_damp_3d
+{
+ t_object x_obj;
+ t_symbol *x_s_direct;
+ t_symbol *x_s_early1;
+ t_symbol *x_s_early2;
+ t_symbol *x_s_del;
+ t_symbol *x_s_damp;
+ t_symbol *x_s_index_theta_phi;
+ t_float x_room_x;
+ t_float x_room_y;
+ t_float x_room_z;
+ t_float x_head_x;
+ t_float x_head_y;
+ t_float x_head_z;
+ t_float x_src_x;
+ t_float x_src_y;
+ t_float x_src_z;
+ t_float x_r_ambi;
+ t_float x_speed;
+ t_float x_180_over_pi;
+ void *x_clock;
+} t_cart2del_damp_3d;
+
+static t_class *cart2del_damp_3d_class;
+
+static t_float cart2del_damp_3d_calc_radius(t_floatarg r_ambi, t_floatarg dx, t_floatarg dy, t_floatarg dz)
+{
+ t_float r = (t_float)sqrt(dx*dx + dy*dy + dz*dz);
+
+ if(r < r_ambi)
+ return(r_ambi);
+ else
+ return(r);
+}
+
+static t_float cart2del_damp_3d_calc_azimuth(t_floatarg x_180_over_pi, t_floatarg dx, t_floatarg dy, t_floatarg dz)
+{
+ if(dx == 0.0f)
+ {
+ if(dy < 0.0f)
+ return(270.0f);
+ else
+ return(90.0f);
+ }
+ else if(dx < 0.0f)
+ {
+ return(180.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ }
+ else
+ {
+ if(dy < 0.0f)
+ return(360.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ else
+ return(x_180_over_pi * (t_float)atan(dy / dx));
+ }
+}
+
+static t_float cart2del_damp_3d_calc_elevation(t_floatarg x_180_over_pi, t_floatarg dx, t_floatarg dy, t_floatarg dz)
+{
+ t_float dxy = sqrt(dx*dx + dy*dy);
+
+ if(dxy == 0.0f)
+ {
+ if(dz < 0.0f)
+ return(-90.0f);
+ else
+ return(90.0f);
+ }
+ else
+ {
+ return(x_180_over_pi * (t_float)atan(dz / dxy));
+ }
+}
+
+static void cart2del_damp_3d_doit(t_cart2del_damp_3d *x)
+{
+ t_float diff_x, diff_y, diff_z;
+ t_float sum_x, sum_y, sum_z;
+ t_float lx, wy, hz;
+ t_float x0, y0, z0;
+ t_float xp1, yp1, zp1;
+ t_float xn1, yn1, zn1;
+ t_float xp2, yp2, zp2;
+ t_float xn2, yn2, zn2;
+ t_float m2ms = 1000.0f / x->x_speed;
+ t_float x_180_over_pi=x->x_180_over_pi;
+ t_float r_ambi = x->x_r_ambi;
+ t_float rad[30];
+ t_atom at[30];
+
+ lx = x->x_room_x;
+ wy = x->x_room_y;
+ hz = x->x_room_z;
+
+ diff_x = x->x_src_x - x->x_head_x;
+ diff_y = x->x_src_y - x->x_head_y;
+ diff_z = x->x_src_z - x->x_head_z;
+ sum_x = x->x_src_x + x->x_head_x;
+ sum_y = x->x_src_y + x->x_head_y;
+ sum_z = x->x_src_z + x->x_head_z - hz;
+
+ x0 = diff_x;
+ y0 = diff_y;
+ z0 = diff_z;
+ xp1 = lx - sum_x;
+ yp1 = wy - sum_y;
+ zp1 = hz - sum_z;
+ xn1 = -lx - sum_x;
+ yn1 = -wy - sum_y;
+ zn1 = -hz - sum_z;
+ xp2 = 2.0f*lx + diff_x;
+ yp2 = 2.0f*wy + diff_y;
+ zp2 = 2.0f*hz + diff_z;
+ xn2 = -2.0f*lx + diff_x;
+ yn2 = -2.0f*wy + diff_y;
+ zn2 = -2.0f*hz + diff_z;
+
+ rad[0] = cart2del_damp_3d_calc_radius(r_ambi, x0, y0, z0);
+ rad[1] = cart2del_damp_3d_calc_radius(r_ambi, xp1, y0, z0);
+ rad[2] = cart2del_damp_3d_calc_radius(r_ambi, x0, yp1, z0);
+ rad[3] = cart2del_damp_3d_calc_radius(r_ambi, x0, y0, zp1);
+ rad[4] = cart2del_damp_3d_calc_radius(r_ambi, xn1, y0, z0);
+ rad[5] = cart2del_damp_3d_calc_radius(r_ambi, x0, yn1, z0);
+ rad[6] = cart2del_damp_3d_calc_radius(r_ambi, x0, y0, zn1);
+ rad[7] = cart2del_damp_3d_calc_radius(r_ambi, xp2, y0, z0);
+ rad[8] = cart2del_damp_3d_calc_radius(r_ambi, x0, yp2, z0);
+ rad[9] = cart2del_damp_3d_calc_radius(r_ambi, x0, y0, zp2);
+ rad[10] = cart2del_damp_3d_calc_radius(r_ambi, xn2, y0, z0);
+ rad[11] = cart2del_damp_3d_calc_radius(r_ambi, x0, yn2, z0);
+ rad[12] = cart2del_damp_3d_calc_radius(r_ambi, x0, y0, zn2);
+ rad[13] = cart2del_damp_3d_calc_radius(r_ambi, xp1, yp1, z0);
+ rad[14] = cart2del_damp_3d_calc_radius(r_ambi, xp1, y0, zp1);
+ rad[15] = cart2del_damp_3d_calc_radius(r_ambi, x0, yp1, zp1);
+ rad[16] = cart2del_damp_3d_calc_radius(r_ambi, xn1, yn1, z0);
+ rad[17] = cart2del_damp_3d_calc_radius(r_ambi, xn1, y0, zn1);
+ rad[18] = cart2del_damp_3d_calc_radius(r_ambi, x0, yn1, zn1);
+ rad[19] = cart2del_damp_3d_calc_radius(r_ambi, xp1, yn1, z0);
+ rad[20] = cart2del_damp_3d_calc_radius(r_ambi, xp1, y0, zn1);
+ rad[21] = cart2del_damp_3d_calc_radius(r_ambi, x0, yp1, zn1);
+ rad[22] = cart2del_damp_3d_calc_radius(r_ambi, xn1, yp1, z0);
+ rad[23] = cart2del_damp_3d_calc_radius(r_ambi, xn1, y0, zp1);
+ rad[24] = cart2del_damp_3d_calc_radius(r_ambi, x0, yn1, zp1);
+
+ /* delay-reihenfolge: 0 auslassen,
+ +1x, +1y, +1z, -1x, -1y, -1z
+ +2x, +2y, +2z, -2x, -2y, -2z
+ +1x+1y, +1x+1z, +1y+1z
+ -1x-1y, -1x-1z, -1y-1z
+ +1x-1y, +1x-1z, +1y-1z
+ -1x+1y, -1x+1z, -1y+1z
+ */
+
+ SETSYMBOL(at, x->x_s_del);
+
+ SETFLOAT(at+1, rad[0] * m2ms);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_direct, 2, at);
+
+ SETFLOAT(at+1, rad[1] *m2ms);
+ SETFLOAT(at+2, rad[2] *m2ms);
+ SETFLOAT(at+3, rad[3] *m2ms);
+ SETFLOAT(at+4, rad[4] *m2ms);
+ SETFLOAT(at+5, rad[5] *m2ms);
+ SETFLOAT(at+6, rad[6] *m2ms);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 7, at);
+
+ SETFLOAT(at+1, rad[7] *m2ms);
+ SETFLOAT(at+2, rad[8] *m2ms);
+ SETFLOAT(at+3, rad[9] *m2ms);
+ SETFLOAT(at+4, rad[10] *m2ms);
+ SETFLOAT(at+5, rad[11] *m2ms);
+ SETFLOAT(at+6, rad[12] *m2ms);
+ SETFLOAT(at+7, rad[13] *m2ms);
+ SETFLOAT(at+8, rad[14] *m2ms);
+ SETFLOAT(at+9, rad[15] *m2ms);
+ SETFLOAT(at+10, rad[16] *m2ms);
+ SETFLOAT(at+11, rad[17] *m2ms);
+ SETFLOAT(at+12, rad[18] *m2ms);
+ SETFLOAT(at+13, rad[19] *m2ms);
+ SETFLOAT(at+14, rad[20] *m2ms);
+ SETFLOAT(at+15, rad[21] *m2ms);
+ SETFLOAT(at+16, rad[22] *m2ms);
+ SETFLOAT(at+17, rad[23] *m2ms);
+ SETFLOAT(at+18, rad[24] *m2ms);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 19, at);
+
+
+ /* daempfungs-reihenfolge:
+ 0,
+ +1x, +1y, +1z, -1x, -1y, -1z
+
+ +2x, +2y, +2z, -2x, -2y, -2z
+ +1x+1y, +1x+1z, +1y+1z
+ -1x-1y, -1x-1z, -1y-1z
+ +1x-1y, +1x-1z, +1y-1z
+ -1x+1y, -1x+1z, -1y+1z
+ */
+
+ SETSYMBOL(at, x->x_s_damp);
+
+ SETFLOAT(at+1, r_ambi / rad[0]);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_direct, 2, at);
+
+ SETFLOAT(at+1, r_ambi / rad[1]);
+ SETFLOAT(at+2, r_ambi / rad[2]);
+ SETFLOAT(at+3, r_ambi / rad[3]);
+ SETFLOAT(at+4, r_ambi / rad[4]);
+ SETFLOAT(at+5, r_ambi / rad[5]);
+ SETFLOAT(at+6, r_ambi / rad[6]);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 7, at);
+
+ SETFLOAT(at+1, r_ambi / rad[7]);
+ SETFLOAT(at+2, r_ambi / rad[8]);
+ SETFLOAT(at+3, r_ambi / rad[9]);
+ SETFLOAT(at+4, r_ambi / rad[10]);
+ SETFLOAT(at+5, r_ambi / rad[11]);
+ SETFLOAT(at+6, r_ambi / rad[12]);
+ SETFLOAT(at+7, r_ambi / rad[13]);
+ SETFLOAT(at+8, r_ambi / rad[14]);
+ SETFLOAT(at+9, r_ambi / rad[15]);
+ SETFLOAT(at+10, r_ambi / rad[16]);
+ SETFLOAT(at+11, r_ambi / rad[17]);
+ SETFLOAT(at+12, r_ambi / rad[18]);
+ SETFLOAT(at+13, r_ambi / rad[19]);
+ SETFLOAT(at+14, r_ambi / rad[20]);
+ SETFLOAT(at+15, r_ambi / rad[21]);
+ SETFLOAT(at+16, r_ambi / rad[22]);
+ SETFLOAT(at+17, r_ambi / rad[23]);
+ SETFLOAT(at+18, r_ambi / rad[24]);
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 19, at);
+
+
+ /* encoder-winkel-reihenfolge: index delta phi
+ 0,
+ +1x, +1y, +1z, -1x, -1y, -1z
+ +2x, +2y, +2z, -2x, -2y, -2z
+ +1x+1y, +1x+1z, +1y+1z
+ -1x-1y, -1x-1z, -1y-1z
+ +1x-1y, +1x-1z, +1y-1z
+ -1x+1y, -1x+1z, -1y+1z
+ */
+
+ SETSYMBOL(at, x->x_s_index_theta_phi);
+
+ SETFLOAT(at+1, 1.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, y0, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, y0, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_direct, 4, at);
+
+
+ SETFLOAT(at+1, 1.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xp1, y0, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xp1, y0, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 4, at);
+
+ SETFLOAT(at+1, 2.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yp1, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yp1, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 4, at);
+
+ SETFLOAT(at+1, 3.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, y0, zp1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, y0, zp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 4, at);
+
+ SETFLOAT(at+1, 4.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xn1, y0, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xn1, y0, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 4, at);
+
+ SETFLOAT(at+1, 5.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yn1, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yn1, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 4, at);
+
+ SETFLOAT(at+1, 6.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, y0, zn1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, y0, zn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early1, 4, at);
+
+
+ SETFLOAT(at+1, 1.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xp2, y0, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xp2, y0, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 2.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yp2, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yp2, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 3.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, y0, zp2));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, y0, zp2));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 4.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xn2, y0, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xn2, y0, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 5.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yn2, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yn2, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 6.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, y0, zn2));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, y0, zn2));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 7.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xp1, yp1, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xp1, yp1, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 8.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xp1, y0, zp1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xp1, y0, zp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 9.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yp1, zp1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yp1, zp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 10.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xn1, yn1, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xn1, yn1, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 11.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xn1, y0, zn1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xn1, y0, zn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 12.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yn1, zn1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yn1, zn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 13.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xp1, yn1, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xp1, yn1, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 14.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xp1, y0, zn1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xp1, y0, zn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 15.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yp1, zn1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yp1, zn1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 16.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xn1, yp1, z0));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xn1, yp1, z0));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 17.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, xn1, y0, zp1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, xn1, y0, zp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+
+ SETFLOAT(at+1, 18.0f);
+ SETFLOAT(at+2, cart2del_damp_3d_calc_elevation(x_180_over_pi, x0, yn1, zp1));
+ SETFLOAT(at+3, cart2del_damp_3d_calc_azimuth(x_180_over_pi, x0, yn1, zp1));
+ outlet_anything(x->x_obj.ob_outlet, x->x_s_early2, 4, at);
+}
+
+static void cart2del_damp_3d_src_xyz(t_cart2del_damp_3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 3)&&IS_A_FLOAT(argv, 0)&&IS_A_FLOAT(argv, 1)&&IS_A_FLOAT(argv, 2))
+ {
+ t_float xr2=0.5f*x->x_room_x, yr2=0.5f*x->x_room_y;
+
+ x->x_src_x = atom_getfloat(argv++);
+ x->x_src_y = atom_getfloat(argv++);
+ x->x_src_z = atom_getfloat(argv);
+ if(x->x_src_x > xr2)
+ x->x_src_x = xr2;
+ if(x->x_src_x < -xr2)
+ x->x_src_x = -xr2;
+ if(x->x_src_y > yr2)
+ x->x_src_y = yr2;
+ if(x->x_src_y < -yr2)
+ x->x_src_y = -yr2;
+ if(x->x_src_z > x->x_room_z)
+ x->x_src_z = x->x_room_z;
+ if(x->x_src_z < 0.0f)
+ x->x_src_z = 0.0f;
+ clock_delay(x->x_clock, 0.0f);
+ }
+}
+
+static void cart2del_damp_3d_head_xyz(t_cart2del_damp_3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 3)&&IS_A_FLOAT(argv, 0)&&IS_A_FLOAT(argv, 1)&&IS_A_FLOAT(argv, 2))
+ {
+ t_float xr2=0.5f*x->x_room_x, yr2=0.5f*x->x_room_y;
+
+ x->x_head_x = atom_getfloat(argv++);
+ x->x_head_y = atom_getfloat(argv++);
+ x->x_head_z = atom_getfloat(argv);
+ if(x->x_head_x > xr2)
+ x->x_head_x = xr2;
+ if(x->x_head_x < -xr2)
+ x->x_head_x = -xr2;
+ if(x->x_head_y > yr2)
+ x->x_head_y = yr2;
+ if(x->x_head_y < -yr2)
+ x->x_head_y = -yr2;
+ if(x->x_head_z > x->x_room_z)
+ x->x_head_z = x->x_room_z;
+ if(x->x_head_z < 0.0f)
+ x->x_head_z = 0.0f;
+ clock_delay(x->x_clock, 0.0f);
+ }
+}
+
+static void cart2del_damp_3d_room_dim(t_cart2del_damp_3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 3)&&IS_A_FLOAT(argv, 0)&&IS_A_FLOAT(argv, 1)&&IS_A_FLOAT(argv, 2))
+ {
+ x->x_room_x = atom_getfloat(argv++);
+ x->x_room_y = atom_getfloat(argv++);
+ x->x_room_z = atom_getfloat(argv);
+ if(x->x_room_x < 0.5f)
+ x->x_room_x = 0.5f;
+ if(x->x_room_y < 0.5f)
+ x->x_room_y = 0.5f;
+ if(x->x_room_z < 0.5f)
+ x->x_room_z = 0.5f;
+ clock_delay(x->x_clock, 0.0f);
+ }
+}
+
+static void cart2del_damp_3d_r_ambi(t_cart2del_damp_3d *x, t_floatarg r_ambi)
+{
+ if(r_ambi < 0.1f)
+ r_ambi = 0.1f;
+ x->x_r_ambi = r_ambi;
+ clock_delay(x->x_clock, 0.0f);
+}
+
+static void cart2del_damp_3d_sonic_speed(t_cart2del_damp_3d *x, t_floatarg speed)
+{
+ if(speed < 10.0f)
+ speed = 10.0f;
+ if(speed > 2000.0f)
+ speed = 2000.0f;
+ x->x_speed = speed;
+ clock_delay(x->x_clock, 0.0f);
+}
+
+static void cart2del_damp_3d_free(t_cart2del_damp_3d *x)
+{
+ clock_free(x->x_clock);
+}
+
+static void *cart2del_damp_3d_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_cart2del_damp_3d *x = (t_cart2del_damp_3d *)pd_new(cart2del_damp_3d_class);
+
+ x->x_room_x = 12.0f;
+ x->x_room_y = 8.0f;
+ x->x_room_z = 4.0f;
+ x->x_head_x = 0.0f;
+ x->x_head_y = 0.0f;
+ x->x_head_z = 1.7f;
+ x->x_src_x = 3.0f;
+ x->x_src_y = 0.5f;
+ x->x_src_z = 2.5f;
+ x->x_r_ambi = 1.4f;
+ x->x_speed = 340.0f;
+ x->x_s_direct = gensym("direct");
+ x->x_s_early1 = gensym("early1");
+ x->x_s_early2 = gensym("early2");
+ x->x_s_del = gensym("del");
+ x->x_s_damp = gensym("damp");
+ x->x_s_index_theta_phi = gensym("index_theta_phi");
+ outlet_new(&x->x_obj, &s_list);
+ x->x_clock = clock_new(x, (t_method)cart2del_damp_3d_doit);
+ x->x_180_over_pi = (t_float)(180.0 / (4.0 * atan(1.0)));
+ return (x);
+}
+
+void cart2del_damp_3d_setup(void)
+{
+ cart2del_damp_3d_class = class_new(gensym("cart2del_damp_3d"), (t_newmethod)cart2del_damp_3d_new, (t_method)cart2del_damp_3d_free,
+ sizeof(t_cart2del_damp_3d), 0, A_GIMME, 0);
+ class_addmethod(cart2del_damp_3d_class, (t_method)cart2del_damp_3d_src_xyz, gensym("src_xyz"), A_GIMME, 0);
+ class_addmethod(cart2del_damp_3d_class, (t_method)cart2del_damp_3d_head_xyz, gensym("head_xyz"), A_GIMME, 0);
+ class_addmethod(cart2del_damp_3d_class, (t_method)cart2del_damp_3d_room_dim, gensym("room_dim"), A_GIMME, 0);
+ class_addmethod(cart2del_damp_3d_class, (t_method)cart2del_damp_3d_sonic_speed, gensym("sonic_speed"), A_FLOAT, 0);
+ class_addmethod(cart2del_damp_3d_class, (t_method)cart2del_damp_3d_r_ambi, gensym("r_ambi"), A_FLOAT, 0);
+ class_sethelpsymbol(cart2del_damp_3d_class, gensym("iemhelp2/cart2del_damp_3d-help"));
+}
diff --git a/src/early_reflections_2d.c b/src/early_reflections_2d.c
new file mode 100644
index 0000000..438db82
--- /dev/null
+++ b/src/early_reflections_2d.c
@@ -0,0 +1,536 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_roomsim written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+#include <math.h>
+
+/* -------------------------- early_reflections_2d ------------------------------ */
+/*
+** pos. x-Richtung Nase
+** pos. y-Richtung Linke Hand
+** pos. z-Richtung Scheitel
+** Kartesischer Koordinaten-Ursprung liegt in der Mitte des Raums am Boden
+
+ aenderungen: src-index von 1 .. n auf 0 .. (n-1)
+ aenderungen: azimuth von rad auf degree
+*/
+
+/*
+Reihenfolge der bundle-sektoren: index phi:
+
+
+ 1 0
+ 2 45
+ 3 90
+ 4 135
+ 5 180
+ 6 225
+ 7 270
+ 8 315
+
+ 1. und 2. reflexionen:
+
+
+ +x
+ 5
+ 9 1 11
+ +y 6 2 0 4 8
+ 12 3 10
+ 7
+
+*/
+
+
+
+typedef struct _early_reflections_2d
+{
+ t_object x_obj;
+ t_atom x_para_at[27];
+ void *x_direct_out;
+ void *x_early_out;
+ void *x_rev_out;
+ t_symbol *x_s_del0;
+ t_symbol *x_s_del1;
+ t_symbol *x_s_del2;
+ t_symbol *x_s_damp;
+ t_symbol *x_s_index_phi;
+ t_symbol *x_s_bundle;
+ t_float x_azimuth_denominator;
+ t_float x_azimuth_offset;
+ t_float x_room_x;
+ t_float x_room_y;
+ t_float x_head_x;
+ t_float x_head_y;
+ int x_n_src;
+ int x_bundle;
+ t_float x_src_x[30];
+ t_float x_src_y[30];
+ t_float x_r_ambi;
+ t_float x_speed;
+ t_float x_180_over_pi;
+} t_early_reflections_2d;
+
+static t_class *early_reflections_2d_class;
+
+static t_float early_reflections_2d_calc_radius(t_floatarg r_ambi, t_floatarg dx, t_floatarg dy)
+{
+ t_float r = (t_float)sqrt(dx*dx + dy*dy);
+
+ if(r < r_ambi)
+ return(r_ambi);
+ else
+ return(r);
+}
+
+static t_float early_reflections_2d_calc_azimuth(t_floatarg x_180_over_pi, t_floatarg dx, t_floatarg dy)/*changes*/
+{
+ if(dx == 0.0f)
+ {
+ if(dy < 0.0f)
+ return(270.0f);
+ else
+ return(90.0f);
+ }
+ else if(dx < 0.0f)
+ {
+ return(180.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ }
+ else
+ {
+ if(dy < 0.0f)
+ return(360.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ else
+ return(x_180_over_pi * (t_float)atan(dy / dx));
+ }
+}
+
+static t_float early_reflections_2d_calc_bundle_index(t_floatarg phi)/*changes*/
+{
+ phi += 22.5f;
+ if(phi >= 360.0f)
+ phi -= 360.0f;
+
+ if(phi <= 180.0f)
+ {
+ if(phi <= 90.0f)
+ {
+ if(phi <= 45.0f)/* 0 .. 45 */
+ return(1.0f);
+ else
+ return(2.0f);
+ }
+ else
+ {
+ if(phi <= 135.0f)
+ return(3.0f);
+ else
+ return(4.0f);
+ }
+ }
+ else
+ {
+ if(phi <= 270.0f)
+ {
+ if(phi <= 225.0f)
+ return(5.0f);
+ else
+ return(6.0f);
+ }
+ else
+ {
+ if(phi <= 315.0f)/* 270 .. 315 */
+ return(7.0f);
+ else
+ return(8.0f);/* 315 .. 360 */
+ }
+ }
+}
+
+static void early_reflections_2d_doit(t_early_reflections_2d *x)
+{
+ t_atom *at;
+ t_float diff_x, diff_y;
+ t_float sum_x, sum_y;
+ t_float lx, wy;
+ t_float x0, y0;
+ t_float xp1, yp1;
+ t_float xn1, yn1;
+ t_float xp2, yp2;
+ t_float xn2, yn2;
+ t_float m2ms = 1000.0f / x->x_speed;
+ t_float x_180_over_pi=x->x_180_over_pi;
+ t_float r_ambi = x->x_r_ambi;
+ t_float phi[50];
+ t_float rad[50];
+ int n_src=x->x_n_src;
+ int i;
+
+ lx = x->x_room_x;
+ wy = x->x_room_y;
+
+ SETFLOAT(x->x_para_at, early_reflections_2d_calc_radius(r_ambi, lx, wy)*m2ms);
+ outlet_anything(x->x_rev_out, x->x_s_del0, 1, x->x_para_at);
+
+ for(i=0; i<n_src; i++)
+ {
+ diff_x = x->x_src_x[i] - x->x_head_x;
+ diff_y = x->x_src_y[i] - x->x_head_y;
+ sum_x = x->x_src_x[i] + x->x_head_x;
+ sum_y = x->x_src_y[i] + x->x_head_y;
+
+ x0 = diff_x;
+ y0 = diff_y;
+ xp1 = lx - sum_x;
+ yp1 = wy - sum_y;
+ xn1 = -lx - sum_x;
+ yn1 = -wy - sum_y;
+ xp2 = 2.0f*lx + diff_x;
+ yp2 = 2.0f*wy + diff_y;
+ xn2 = -2.0f*lx + diff_x;
+ yn2 = -2.0f*wy + diff_y;
+
+ rad[0] = early_reflections_2d_calc_radius(r_ambi, x0, y0);
+ rad[1] = early_reflections_2d_calc_radius(r_ambi, xp1, y0);
+ rad[2] = early_reflections_2d_calc_radius(r_ambi, x0, yp1);
+ rad[3] = early_reflections_2d_calc_radius(r_ambi, xn1, y0);
+ rad[4] = early_reflections_2d_calc_radius(r_ambi, x0, yn1);
+ rad[5] = early_reflections_2d_calc_radius(r_ambi, xp2, y0);
+ rad[6] = early_reflections_2d_calc_radius(r_ambi, x0, yp2);
+ rad[7] = early_reflections_2d_calc_radius(r_ambi, xn2, y0);
+ rad[8] = early_reflections_2d_calc_radius(r_ambi, x0, yn2);
+ rad[9] = early_reflections_2d_calc_radius(r_ambi, xp1, yp1);
+ rad[10] = early_reflections_2d_calc_radius(r_ambi, xn1, yn1);
+ rad[11] = early_reflections_2d_calc_radius(r_ambi, xp1, yn1);
+ rad[12] = early_reflections_2d_calc_radius(r_ambi, xn1, yp1);
+
+ /* delay-reihenfolge: 0,
+ +1x, +1y, -1x, -1y
+ +2x, +2y, -2x, -2y
+ +1x+1y, -1x-1y
+ +1x-1y, -1x+1y
+ */
+
+ at = x->x_para_at;
+ SETFLOAT(at, (t_float)(i+1));/*changes*/
+ at++;
+ SETFLOAT(at, rad[0] * m2ms);
+ outlet_anything(x->x_direct_out, x->x_s_del0, 2, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, rad[1] *m2ms);
+ at++;
+ SETFLOAT(at, rad[2] *m2ms);
+ at++;
+ SETFLOAT(at, rad[3] *m2ms);
+ at++;
+ SETFLOAT(at, rad[4] *m2ms);
+ outlet_anything(x->x_early_out, x->x_s_del1, 5, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, rad[5] *m2ms);
+ at++;
+ SETFLOAT(at, rad[6] *m2ms);
+ at++;
+ SETFLOAT(at, rad[7] *m2ms);
+ at++;
+ SETFLOAT(at, rad[8] *m2ms);
+ at++;
+ SETFLOAT(at, rad[9] *m2ms);
+ at++;
+ SETFLOAT(at, rad[10] *m2ms);
+ at++;
+ SETFLOAT(at, rad[11] *m2ms);
+ at++;
+ SETFLOAT(at, rad[12] *m2ms);
+ outlet_anything(x->x_early_out, x->x_s_del2, 9, x->x_para_at);
+
+
+ /* daempfungs-reihenfolge:
+ 0,
+ +1x, +1y, -1x, -1y
+ +2x, +2y, -2x, -2y
+ +1x+1y, -1x-1y
+ +1x-1y, -1x+1y
+ */
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, r_ambi / rad[0]);
+ outlet_anything(x->x_direct_out, x->x_s_damp, 2, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, r_ambi / rad[1]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[2]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[3]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[4]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[5]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[6]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[7]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[8]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[9]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[10]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[11]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[12]);
+
+ outlet_anything(x->x_early_out, x->x_s_damp, 13, x->x_para_at);
+
+
+ /* encoder-winkel-reihenfolge: index delta phi
+ 0,
+ +1x, +1y, -1x, -1y
+ +2x, +2y, -2x, -2y
+ +1x+1y, -1x-1y
+ +1x-1y, -1x+1y
+ */
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, early_reflections_2d_calc_azimuth(x_180_over_pi, x0, y0));
+
+ outlet_anything(x->x_direct_out, x->x_s_index_phi, 2, x->x_para_at);
+
+ /* encoder-winkel-reihenfolge: bundle
+ 0,
+ +1x, +1y, -1x, -1y
+ +2x, +2y, -2x, -2y
+ +1x+1y, -1x-1y
+ +1x-1y, -1x+1y
+ */
+
+ phi[0] = early_reflections_2d_calc_azimuth(x_180_over_pi, xp1, y0);
+ phi[1] = early_reflections_2d_calc_azimuth(x_180_over_pi, x0, yp1);
+ phi[2] = early_reflections_2d_calc_azimuth(x_180_over_pi, xn1, y0);
+ phi[3] = early_reflections_2d_calc_azimuth(x_180_over_pi, x0, yn1);
+ phi[4] = early_reflections_2d_calc_azimuth(x_180_over_pi, xp2, y0);
+ phi[5] = early_reflections_2d_calc_azimuth(x_180_over_pi, x0, yp2);
+ phi[6] = early_reflections_2d_calc_azimuth(x_180_over_pi, xn2, y0);
+ phi[7] = early_reflections_2d_calc_azimuth(x_180_over_pi, x0, yn2);
+ phi[8] = early_reflections_2d_calc_azimuth(x_180_over_pi, xp1, yp1);
+ phi[9] = early_reflections_2d_calc_azimuth(x_180_over_pi, xn1, yn1);
+ phi[10] = early_reflections_2d_calc_azimuth(x_180_over_pi, xp1, yn1);
+ phi[11] = early_reflections_2d_calc_azimuth(x_180_over_pi, xn1, yp1);
+
+ if(x->x_bundle)
+ {
+ at = x->x_para_at+1;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[0]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[1]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[2]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[3]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[4]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[5]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[6]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[7]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[8]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[9]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[10]));
+ at++;
+ SETFLOAT(at, early_reflections_2d_calc_bundle_index(phi[11]));
+
+ outlet_anything(x->x_early_out, x->x_s_bundle, 13, x->x_para_at);
+ }
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 1.0f);
+ at++;
+ SETFLOAT(at, phi[0]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 2.0f);
+ at++;
+ SETFLOAT(at, phi[1]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 3.0f);
+ at++;
+ SETFLOAT(at, phi[2]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 4.0f);
+ at++;
+ SETFLOAT(at, phi[3]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 5.0f);
+ at++;
+ SETFLOAT(at, phi[4]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 6.0f);
+ at++;
+ SETFLOAT(at, phi[5]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 7.0f);
+ at++;
+ SETFLOAT(at, phi[6]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 8.0f);
+ at++;
+ SETFLOAT(at, phi[7]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 9.0f);
+ at++;
+ SETFLOAT(at, phi[8]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 10.0f);
+ at++;
+ SETFLOAT(at, phi[9]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 11.0f);
+ at++;
+ SETFLOAT(at, phi[10]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 12.0f);
+ at++;
+ SETFLOAT(at, phi[11]);
+ outlet_anything(x->x_early_out, x->x_s_index_phi, 3, x->x_para_at);
+ }
+}
+
+static void early_reflections_2d_dump_para(t_early_reflections_2d *x)
+{
+ int i, n=x->x_n_src;
+
+ post("*******************************************************************************");
+ post("room-dimensions: L_x = %.3f, W_y = %.3f", x->x_room_x, x->x_room_y);
+ post("hear-position: x_hear = %.3f, y_hear = %.3f", x->x_head_x, x->x_head_y);
+ for(i=0; i<n; i++)
+ post("source-coordinates: x_src%d = %.3f, y_src%d = %.3f",
+ i+1, x->x_src_x[i], i+1, x->x_src_y[i]);
+ post("ambisonic-radius: %f", x->x_r_ambi);
+ post("sonic-speed: %.3f", x->x_speed);
+ post("order of outputs: direct early rev");
+ post("*******************************************************************************");
+}
+
+static void early_reflections_2d_para(t_early_reflections_2d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int i, n=x->x_n_src*2 + 5;/* r_ambi + 2*room + 2*head */
+
+ if(argc != n)
+ {
+ post("early_reflections_2d ERROR: para needs 1 r_ambi + 2*room + 2*head +n*2*src");
+ return;
+ }
+
+ x->x_r_ambi = atom_getfloat(argv++);
+ x->x_room_x = atom_getfloat(argv++);
+ x->x_room_y = atom_getfloat(argv++);
+ x->x_head_x = atom_getfloat(argv++);
+ x->x_head_y = atom_getfloat(argv++);
+ n = x->x_n_src;
+ for(i=0; i<n; i++)
+ {
+ x->x_src_x[i] = atom_getfloat(argv++);
+ x->x_src_y[i] = atom_getfloat(argv++);
+ }
+ early_reflections_2d_doit(x);
+}
+
+static void early_reflections_2d_sonic_speed(t_early_reflections_2d *x, t_floatarg speed)
+{
+ if(speed < 300.0f)
+ speed = 300.0f;
+ if(speed > 400.0f)
+ speed = 400.0f;
+ x->x_speed = speed;
+}
+
+static void early_reflections_2d_bundle(t_early_reflections_2d *x, t_floatarg bundle)
+{
+ if(bundle == 0.0f)
+ x->x_bundle = 0;
+ else
+ x->x_bundle = 1;
+}
+
+static void early_reflections_2d_free(t_early_reflections_2d *x)
+{
+}
+
+static void *early_reflections_2d_new(t_floatarg fn_src)
+{
+ int i, n;
+ t_early_reflections_2d *x = (t_early_reflections_2d *)pd_new(early_reflections_2d_class);
+
+ n = (int)fn_src;
+ if(n < 1)
+ n = 1;
+ if(n > 30)
+ n = 30;
+ x->x_n_src = n;
+ x->x_room_x = 12.0f;
+ x->x_room_y = 8.0f;
+ x->x_head_x = 0.0f;
+ x->x_head_y = 0.0f;
+ for(i=0; i<n; i++)
+ {
+ x->x_src_x[i] = 3.0f;
+ x->x_src_y[i] = 0.5f;
+ }
+ x->x_r_ambi = 1.4f;
+ x->x_speed = 340.0f;
+
+ x->x_s_del0 = gensym("del0");
+ x->x_s_del1 = gensym("del1");
+ x->x_s_del2 = gensym("del2");
+ x->x_s_damp = gensym("damp");
+ x->x_s_index_phi = gensym("index_phi");
+ x->x_s_bundle = gensym("bundle");
+ x->x_direct_out = outlet_new(&x->x_obj, &s_list);
+ x->x_early_out = outlet_new(&x->x_obj, &s_list);
+ x->x_rev_out = outlet_new(&x->x_obj, &s_list);
+ x->x_180_over_pi = (t_float)(180.0 / (4.0 * atan(1.0)));
+ x->x_bundle = 0;
+ return (x);
+}
+
+void early_reflections_2d_setup(void)
+{
+ early_reflections_2d_class = class_new(gensym("early_reflections_2d"), (t_newmethod)early_reflections_2d_new, (t_method)early_reflections_2d_free,
+ sizeof(t_early_reflections_2d), 0, A_DEFFLOAT, 0);
+ class_addmethod(early_reflections_2d_class, (t_method)early_reflections_2d_para, gensym("para"), A_GIMME, 0);
+ class_addmethod(early_reflections_2d_class, (t_method)early_reflections_2d_sonic_speed, gensym("sonic_speed"), A_FLOAT, 0);
+ class_addmethod(early_reflections_2d_class, (t_method)early_reflections_2d_bundle, gensym("bundle"), A_FLOAT, 0);
+ class_addmethod(early_reflections_2d_class, (t_method)early_reflections_2d_dump_para, gensym("dump_para"), 0);
+ class_sethelpsymbol(early_reflections_2d_class, gensym("iemhelp2/early_reflections_2d-help"));
+}
diff --git a/src/early_reflections_3d.c b/src/early_reflections_3d.c
new file mode 100644
index 0000000..a55f908
--- /dev/null
+++ b/src/early_reflections_3d.c
@@ -0,0 +1,902 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_roomsim written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+#include <math.h>
+
+
+/* -------------------------- early_reflections_3d ------------------------------ */
+/*
+** pos. x-Richtung Nase
+** pos. y-Richtung Linke Hand
+** pos. z-Richtung Scheitel
+** Kartesischer Koordinaten-Ursprung liegt in der Mitte des Raums am Boden
+*/
+
+/*
+Reihenfolge der bundle-sektoren: index delta phi:
+
+ 1 90 0
+ 2 45 45
+ 3 45 135
+ 4 45 225
+ 5 45 315
+ 6 0 0
+ 7 0 45
+ 8 0 90
+ 9 0 135
+ 10 0 180
+ 11 0 225
+ 12 0 270
+ 13 0 315
+ 14 -45 45
+ 15 -45 135
+ 16 -45 225
+ 17 -45 315
+
+
+ top
+
+
+ +x
+
+
+ +y 9
+
+
+
+ +x
+
+ 15
+ +y 23 3 14
+ 24
+
+
+ +x
+ 8
+ 22 2 13
+ +y 10 4 0 1 7
+ 16 5 19
+ 11
+
+ +x
+
+ 21
+ +y 17 6 20
+ 18
+
+ +x
+
+
+ +y 12
+
+
+
+*/
+
+typedef struct _early_reflections_3d
+{
+ t_object x_obj;
+ t_atom x_para_at[27];
+ void *x_direct_out;
+ void *x_early_out;
+ void *x_rev_out;
+ t_symbol *x_s_del0;
+ t_symbol *x_s_del1;
+ t_symbol *x_s_del2;
+ t_symbol *x_s_damp;
+ t_symbol *x_s_index_delta_phi;
+ t_symbol *x_s_bundle;
+ t_float x_room_x;
+ t_float x_room_y;
+ t_float x_room_z;
+ t_float x_head_x;
+ t_float x_head_y;
+ t_float x_head_z;
+ int x_n_src;
+ int x_bundle;
+ t_float x_src_x[30];
+ t_float x_src_y[30];
+ t_float x_src_z[30];
+ t_float x_r_ambi;
+ t_float x_speed;
+ t_float x_180_over_pi;
+} t_early_reflections_3d;
+
+static t_class *early_reflections_3d_class;
+
+static t_float early_reflections_3d_calc_radius(t_floatarg r_ambi, t_floatarg dx, t_floatarg dy, t_floatarg dz)
+{
+ t_float r = (t_float)sqrt(dx*dx + dy*dy + dz*dz);
+
+ if(r < r_ambi)
+ return(r_ambi);
+ else
+ return(r);
+}
+
+static t_float early_reflections_3d_calc_azimuth(t_floatarg x_180_over_pi, t_floatarg dx, t_floatarg dy, t_floatarg dz)
+{
+ if(dx == 0.0f)
+ {
+ if(dy < 0.0f)
+ return(270.0f);
+ else
+ return(90.0f);
+ }
+ else if(dx < 0.0f)
+ {
+ return(180.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ }
+ else
+ {
+ if(dy < 0.0f)
+ return(360.0f + x_180_over_pi * (t_float)atan(dy / dx));
+ else
+ return(x_180_over_pi * (t_float)atan(dy / dx));
+ }
+}
+
+static t_float early_reflections_3d_calc_elevation(t_floatarg x_180_over_pi, t_floatarg dx, t_floatarg dy, t_floatarg dz)/*changes*/
+{
+ t_float dxy = sqrt(dx*dx + dy*dy);
+
+ if(dxy == 0.0f)
+ {
+ if(dz < 0.0f)
+ return(-90.0f);
+ else
+ return(90.0f);
+ }
+ else
+ {
+ return(x_180_over_pi * (t_float)atan(dz / dxy));
+ }
+}
+
+static t_float early_reflections_3d_calc_bundle_index(t_floatarg delta, t_floatarg phi)/*changes*/
+{
+ if(delta > 67.5f)
+ return(1.0f);
+ else if(delta > 22.5f)
+ {
+ if(phi <= 180.0f)
+ {
+ if(phi <= 90.0f)
+ return(2.0f);
+ else
+ return(3.0f);
+ }
+ else
+ {
+ if(phi <= 270.0f)
+ return(4.0f);
+ else
+ return(5.0f);
+ }
+ }
+ else if(delta > -22.5f)
+ {
+ phi += 22.5f;
+ if(phi >= 360.0f)
+ phi -= 360.0f;
+
+ if(phi <= 180.0f)
+ {
+ if(phi <= 90.0f)
+ {
+ if(phi <= 45.0f)/* 0 .. 45 */
+ return(6.0f);
+ else
+ return(7.0f);
+ }
+ else
+ {
+ if(phi <= 135.0f)
+ return(8.0f);
+ else
+ return(9.0f);
+ }
+ }
+ else
+ {
+ if(phi <= 270.0f)
+ {
+ if(phi <= 225.0f)
+ return(10.0f);
+ else
+ return(11.0f);
+ }
+ else
+ {
+ if(phi <= 315.0f)/* 270 .. 315 */
+ return(12.0f);
+ else
+ return(13.0f);/* 315 .. 360 */
+ }
+ }
+ }
+ else
+ {
+ if(phi <= 180.0f)
+ {
+ if(phi <= 90.0f)
+ return(14.0f);
+ else
+ return(15.0f);
+ }
+ else
+ {
+ if(phi <= 270.0f)
+ return(16.0f);
+ else
+ return(17.0f);
+ }
+ }
+}
+
+static void early_reflections_3d_doit(t_early_reflections_3d *x)
+{
+ t_atom *at;
+ t_float diff_x, diff_y, diff_z;
+ t_float sum_x, sum_y, sum_z;
+ t_float lx, wy, hz;
+ t_float x0, y0, z0;
+ t_float xp1, yp1, zp1;
+ t_float xn1, yn1, zn1;
+ t_float xp2, yp2, zp2;
+ t_float xn2, yn2, zn2;
+ t_float m2ms = 1000.0f / x->x_speed;
+ t_float x_180_over_pi=x->x_180_over_pi;
+ t_float r_ambi = x->x_r_ambi;
+ t_float rad[50], delta[50], phi[50];
+ int n_src=x->x_n_src;
+ int i;
+ /*t_float hz2 = 0.5f*x->x_room_z;
+
+ diff_x = x->x_src_x - x->x_head_x;
+ diff_y = x->x_src_y - x->x_head_y;
+ diff_z = (x->x_src_z - hz2) - (x->x_head_z - hz2);
+ sum_x = x->x_src_x + x->x_head_x;
+ sum_y = x->x_src_y + x->x_head_y;
+ sum_z = (x->x_src_z - hz2) + (x->x_head_z - hz2);*/
+
+ lx = x->x_room_x;
+ wy = x->x_room_y;
+ hz = x->x_room_z;
+
+ SETFLOAT(x->x_para_at, early_reflections_3d_calc_radius(r_ambi, lx, wy, hz)*m2ms);
+ outlet_anything(x->x_rev_out, x->x_s_del0, 1, x->x_para_at);
+
+ for(i=0; i<n_src; i++)
+ {
+ diff_x = x->x_src_x[i] - x->x_head_x;
+ diff_y = x->x_src_y[i] - x->x_head_y;
+ diff_z = x->x_src_z[i] - x->x_head_z;
+ sum_x = x->x_src_x[i] + x->x_head_x;
+ sum_y = x->x_src_y[i] + x->x_head_y;
+ sum_z = x->x_src_z[i] + x->x_head_z - hz;
+
+ x0 = diff_x;
+ y0 = diff_y;
+ z0 = diff_z;
+ xp1 = lx - sum_x;
+ yp1 = wy - sum_y;
+ zp1 = hz - sum_z;
+ xn1 = -lx - sum_x;
+ yn1 = -wy - sum_y;
+ zn1 = -hz - sum_z;
+ xp2 = 2.0f*lx + diff_x;
+ yp2 = 2.0f*wy + diff_y;
+ zp2 = 2.0f*hz + diff_z;
+ xn2 = -2.0f*lx + diff_x;
+ yn2 = -2.0f*wy + diff_y;
+ zn2 = -2.0f*hz + diff_z;
+
+ rad[0] = early_reflections_3d_calc_radius(r_ambi, x0, y0, z0);
+ rad[1] = early_reflections_3d_calc_radius(r_ambi, xp1, y0, z0);
+ rad[2] = early_reflections_3d_calc_radius(r_ambi, x0, yp1, z0);
+ rad[3] = early_reflections_3d_calc_radius(r_ambi, x0, y0, zp1);
+ rad[4] = early_reflections_3d_calc_radius(r_ambi, xn1, y0, z0);
+ rad[5] = early_reflections_3d_calc_radius(r_ambi, x0, yn1, z0);
+ rad[6] = early_reflections_3d_calc_radius(r_ambi, x0, y0, zn1);
+ rad[7] = early_reflections_3d_calc_radius(r_ambi, xp2, y0, z0);
+ rad[8] = early_reflections_3d_calc_radius(r_ambi, x0, yp2, z0);
+ rad[9] = early_reflections_3d_calc_radius(r_ambi, x0, y0, zp2);
+ rad[10] = early_reflections_3d_calc_radius(r_ambi, xn2, y0, z0);
+ rad[11] = early_reflections_3d_calc_radius(r_ambi, x0, yn2, z0);
+ rad[12] = early_reflections_3d_calc_radius(r_ambi, x0, y0, zn2);
+ rad[13] = early_reflections_3d_calc_radius(r_ambi, xp1, yp1, z0);
+ rad[14] = early_reflections_3d_calc_radius(r_ambi, xp1, y0, zp1);
+ rad[15] = early_reflections_3d_calc_radius(r_ambi, x0, yp1, zp1);
+ rad[16] = early_reflections_3d_calc_radius(r_ambi, xn1, yn1, z0);
+ rad[17] = early_reflections_3d_calc_radius(r_ambi, xn1, y0, zn1);
+ rad[18] = early_reflections_3d_calc_radius(r_ambi, x0, yn1, zn1);
+ rad[19] = early_reflections_3d_calc_radius(r_ambi, xp1, yn1, z0);
+ rad[20] = early_reflections_3d_calc_radius(r_ambi, xp1, y0, zn1);
+ rad[21] = early_reflections_3d_calc_radius(r_ambi, x0, yp1, zn1);
+ rad[22] = early_reflections_3d_calc_radius(r_ambi, xn1, yp1, z0);
+ rad[23] = early_reflections_3d_calc_radius(r_ambi, xn1, y0, zp1);
+ rad[24] = early_reflections_3d_calc_radius(r_ambi, x0, yn1, zp1);
+
+ /* delay-reihenfolge: 0 auslassen,
+ +1x, +1y, +1z, -1x, -1y, -1z
+ +2x, +2y, +2z, -2x, -2y, -2z
+ +1x+1y, +1x+1z, +1y+1z
+ -1x-1y, -1x-1z, -1y-1z
+ +1x-1y, +1x-1z, +1y-1z
+ -1x+1y, -1x+1z, -1y+1z
+ */
+
+ at = x->x_para_at;
+ SETFLOAT(at, (t_float)(i+1));/*changes*/
+ at++;
+ SETFLOAT(at, rad[0] * m2ms);
+ outlet_anything(x->x_direct_out, x->x_s_del0, 2, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, rad[1] *m2ms);
+ at++;
+ SETFLOAT(at, rad[2] *m2ms);
+ at++;
+ SETFLOAT(at, rad[3] *m2ms);
+ at++;
+ SETFLOAT(at, rad[4] *m2ms);
+ at++;
+ SETFLOAT(at, rad[5] *m2ms);
+ at++;
+ SETFLOAT(at, rad[6] *m2ms);
+ outlet_anything(x->x_early_out, x->x_s_del1, 7, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, rad[7] *m2ms);
+ at++;
+ SETFLOAT(at, rad[8] *m2ms);
+ at++;
+ SETFLOAT(at, rad[9] *m2ms);
+ at++;
+ SETFLOAT(at, rad[10] *m2ms);
+ at++;
+ SETFLOAT(at, rad[11] *m2ms);
+ at++;
+ SETFLOAT(at, rad[12] *m2ms);
+ at++;
+ SETFLOAT(at, rad[13] *m2ms);
+ at++;
+ SETFLOAT(at, rad[14] *m2ms);
+ at++;
+ SETFLOAT(at, rad[15] *m2ms);
+ at++;
+ SETFLOAT(at, rad[16] *m2ms);
+ at++;
+ SETFLOAT(at, rad[17] *m2ms);
+ at++;
+ SETFLOAT(at, rad[18] *m2ms);
+ at++;
+ SETFLOAT(at, rad[19] *m2ms);
+ at++;
+ SETFLOAT(at, rad[20] *m2ms);
+ at++;
+ SETFLOAT(at, rad[21] *m2ms);
+ at++;
+ SETFLOAT(at, rad[22] *m2ms);
+ at++;
+ SETFLOAT(at, rad[23] *m2ms);
+ at++;
+ SETFLOAT(at, rad[24] *m2ms);
+ outlet_anything(x->x_early_out, x->x_s_del2, 19, x->x_para_at);
+
+
+ /* daempfungs-reihenfolge:
+ 0,
+ +1x, +1y, +1z, -1x, -1y, -1z
+
+ +2x, +2y, +2z, -2x, -2y, -2z
+ +1x+1y, +1x+1z, +1y+1z
+ -1x-1y, -1x-1z, -1y-1z
+ +1x-1y, +1x-1z, +1y-1z
+ -1x+1y, -1x+1z, -1y+1z
+ */
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, r_ambi / rad[0]);
+ outlet_anything(x->x_direct_out, x->x_s_damp, 2, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, r_ambi / rad[1]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[2]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[3]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[4]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[5]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[6]);
+ at++;
+
+ SETFLOAT(at, r_ambi / rad[7]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[8]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[9]);
+ at++;
+
+ SETFLOAT(at, r_ambi / rad[10]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[11]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[12]);
+ at++;
+
+ SETFLOAT(at, r_ambi / rad[13]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[14]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[15]);
+ at++;
+
+ SETFLOAT(at, r_ambi / rad[16]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[17]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[18]);
+ at++;
+
+ SETFLOAT(at, r_ambi / rad[19]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[20]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[21]);
+ at++;
+
+ SETFLOAT(at, r_ambi / rad[22]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[23]);
+ at++;
+ SETFLOAT(at, r_ambi / rad[24]);
+
+ outlet_anything(x->x_early_out, x->x_s_damp, 25, x->x_para_at);
+
+
+ /* encoder-winkel-reihenfolge: index delta phi
+ 0,
+ +1x, +1y, +1z, -1x, -1y, -1z
+ +2x, +2y, +2z, -2x, -2y, -2z
+ +1x+1y, +1x+1z, +1y+1z
+ -1x-1y, -1x-1z, -1y-1z
+ +1x-1y, +1x-1z, +1y-1z
+ -1x+1y, -1x+1z, -1y+1z
+ */
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, early_reflections_3d_calc_elevation(x_180_over_pi, x0, y0, z0));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_azimuth(x_180_over_pi, x0, y0, z0));
+
+ outlet_anything(x->x_direct_out, x->x_s_index_delta_phi, 3, x->x_para_at);
+
+ /* encoder-winkel-reihenfolge: bundle
+ 0,
+ +1x, +1y, +1z, -1x, -1y, -1z
+ +2x, +2y, +2z, -2x, -2y, -2z
+ +1x+1y, +1x+1z, +1y+1z
+ -1x-1y, -1x-1z, -1y-1z
+ +1x-1y, +1x-1z, +1y-1z
+ -1x+1y, -1x+1z, -1y+1z
+ */
+
+ delta[0] = early_reflections_3d_calc_elevation(x_180_over_pi, xp1, y0, z0);
+ phi[0] = early_reflections_3d_calc_azimuth(x_180_over_pi, xp1, y0, z0);
+ delta[1] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yp1, z0);
+ phi[1] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yp1, z0);
+ delta[2] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, y0, zp1);
+ phi[2] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, y0, zp1);
+ delta[3] = early_reflections_3d_calc_elevation(x_180_over_pi, xn1, y0, z0);
+ phi[3] = early_reflections_3d_calc_azimuth(x_180_over_pi, xn1, y0, z0);
+ delta[4] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yn1, z0);
+ phi[4] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yn1, z0);
+ delta[5] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, y0, zn1);
+ phi[5] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, y0, zn1);
+ delta[6] = early_reflections_3d_calc_elevation(x_180_over_pi, xp2, y0, z0);
+ phi[6] = early_reflections_3d_calc_azimuth(x_180_over_pi, xp2, y0, z0);
+ delta[7] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yp2, z0);
+ phi[7] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yp2, z0);
+ delta[8] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, y0, zp2);
+ phi[8] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, y0, zp2);
+ delta[9] = early_reflections_3d_calc_elevation(x_180_over_pi, xn2, y0, z0);
+ phi[9] = early_reflections_3d_calc_azimuth(x_180_over_pi, xn2, y0, z0);
+ delta[10] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yn2, z0);
+ phi[10] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yn2, z0);
+ delta[11] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, y0, zn2);
+ phi[11] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, y0, zn2);
+ delta[12] = early_reflections_3d_calc_elevation(x_180_over_pi, xp1, yp1, z0);
+ phi[12] = early_reflections_3d_calc_azimuth(x_180_over_pi, xp1, yp1, z0);
+ delta[13] = early_reflections_3d_calc_elevation(x_180_over_pi, xp1, y0, zp1);
+ phi[13] = early_reflections_3d_calc_azimuth(x_180_over_pi, xp1, y0, zp1);
+ delta[14] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yp1, zp1);
+ phi[14] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yp1, zp1);
+ delta[15] = early_reflections_3d_calc_elevation(x_180_over_pi, xn1, yn1, z0);
+ phi[15] = early_reflections_3d_calc_azimuth(x_180_over_pi, xn1, yn1, z0);
+ delta[16] = early_reflections_3d_calc_elevation(x_180_over_pi, xn1, y0, zn1);
+ phi[16] = early_reflections_3d_calc_azimuth(x_180_over_pi, xn1, y0, zn1);
+ delta[17] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yn1, zn1);
+ phi[17] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yn1, zn1);
+ delta[18] = early_reflections_3d_calc_elevation(x_180_over_pi, xp1, yn1, z0);
+ phi[18] = early_reflections_3d_calc_azimuth(x_180_over_pi, xp1, yn1, z0);
+ delta[19] = early_reflections_3d_calc_elevation(x_180_over_pi, xp1, y0, zn1);
+ phi[19] = early_reflections_3d_calc_azimuth(x_180_over_pi, xp1, y0, zn1);
+ delta[20] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yp1, zn1);
+ phi[20] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yp1, zn1);
+ delta[21] = early_reflections_3d_calc_elevation(x_180_over_pi, xn1, yp1, z0);
+ phi[21] = early_reflections_3d_calc_azimuth(x_180_over_pi, xn1, yp1, z0);
+ delta[22] = early_reflections_3d_calc_elevation(x_180_over_pi, xn1, y0, zp1);
+ phi[22] = early_reflections_3d_calc_azimuth(x_180_over_pi, xn1, y0, zp1);
+ delta[23] = early_reflections_3d_calc_elevation(x_180_over_pi, x0, yn1, zp1);
+ phi[23] = early_reflections_3d_calc_azimuth(x_180_over_pi, x0, yn1, zp1);
+
+ if(x->x_bundle)
+ {
+ at = x->x_para_at+1;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[0], phi[0]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[1], phi[1]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[2], phi[2]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[3], phi[3]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[4], phi[4]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[5], phi[5]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[6], phi[6]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[7], phi[7]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[8], phi[8]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[9], phi[9]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[10], phi[10]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[11], phi[11]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[12], phi[12]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[13], phi[13]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[14], phi[14]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[15], phi[15]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[16], phi[16]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[17], phi[17]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[18], phi[18]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[19], phi[19]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[20], phi[20]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[21], phi[21]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[22], phi[22]));
+ at++;
+ SETFLOAT(at, early_reflections_3d_calc_bundle_index(delta[23], phi[23]));
+ outlet_anything(x->x_early_out, x->x_s_bundle, 25, x->x_para_at);
+ }
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 1.0f);
+ at++;
+ SETFLOAT(at, delta[0]);
+ at++;
+ SETFLOAT(at, phi[0]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 2.0f);
+ at++;
+ SETFLOAT(at, delta[1]);
+ at++;
+ SETFLOAT(at, phi[1]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 3.0f);
+ at++;
+ SETFLOAT(at, delta[2]);
+ at++;
+ SETFLOAT(at, phi[2]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 4.0f);
+ at++;
+ SETFLOAT(at, delta[3]);
+ at++;
+ SETFLOAT(at, phi[3]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 5.0f);
+ at++;
+ SETFLOAT(at, delta[4]);
+ at++;
+ SETFLOAT(at, phi[4]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 6.0f);
+ at++;
+ SETFLOAT(at, delta[5]);
+ at++;
+ SETFLOAT(at, phi[5]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 7.0f);
+ at++;
+ SETFLOAT(at, delta[6]);
+ at++;
+ SETFLOAT(at, phi[6]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 8.0f);
+ at++;
+ SETFLOAT(at, delta[7]);
+ at++;
+ SETFLOAT(at, phi[7]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 9.0f);
+ at++;
+ SETFLOAT(at, delta[8]);
+ at++;
+ SETFLOAT(at, phi[8]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 10.0f);
+ at++;
+ SETFLOAT(at, delta[9]);
+ at++;
+ SETFLOAT(at, phi[9]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 11.0f);
+ at++;
+ SETFLOAT(at, delta[10]);
+ at++;
+ SETFLOAT(at, phi[10]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 12.0f);
+ at++;
+ SETFLOAT(at, delta[11]);
+ at++;
+ SETFLOAT(at, phi[11]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 13.0f);
+ at++;
+ SETFLOAT(at, delta[12]);
+ at++;
+ SETFLOAT(at, phi[12]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 14.0f);
+ at++;
+ SETFLOAT(at, delta[13]);
+ at++;
+ SETFLOAT(at, phi[13]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 15.0f);
+ at++;
+ SETFLOAT(at, delta[14]);
+ at++;
+ SETFLOAT(at, phi[14]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 16.0f);
+ at++;
+ SETFLOAT(at, delta[15]);
+ at++;
+ SETFLOAT(at, phi[15]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 17.0f);
+ at++;
+ SETFLOAT(at, delta[16]);
+ at++;
+ SETFLOAT(at, phi[16]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 18.0f);
+ at++;
+ SETFLOAT(at, delta[17]);
+ at++;
+ SETFLOAT(at, phi[17]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 19.0f);
+ at++;
+ SETFLOAT(at, delta[18]);
+ at++;
+ SETFLOAT(at, phi[18]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 20.0f);
+ at++;
+ SETFLOAT(at, delta[19]);
+ at++;
+ SETFLOAT(at, phi[19]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 21.0f);
+ at++;
+ SETFLOAT(at, delta[20]);
+ at++;
+ SETFLOAT(at, phi[20]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 22.0f);
+ at++;
+ SETFLOAT(at, delta[21]);
+ at++;
+ SETFLOAT(at, phi[21]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 23.0f);
+ at++;
+ SETFLOAT(at, delta[22]);
+ at++;
+ SETFLOAT(at, phi[22]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+
+ at = x->x_para_at+1;
+ SETFLOAT(at, 24.0f);
+ at++;
+ SETFLOAT(at, delta[23]);
+ at++;
+ SETFLOAT(at, phi[23]);
+ outlet_anything(x->x_early_out, x->x_s_index_delta_phi, 4, x->x_para_at);
+ }
+}
+
+static void early_reflections_3d_dump_para(t_early_reflections_3d *x)
+{
+ int i, n=x->x_n_src;
+
+ post("*******************************************************************************");
+ post("room-dimensions: L_x = %.3f, W_y = %.3f, H_z = %.3f", x->x_room_x, x->x_room_y, x->x_room_z);
+ post("hear-position: x_hear = %.3f, y_hear = %.3f, z_hear = %.3f", x->x_head_x, x->x_head_y, x->x_head_z);
+ for(i=0; i<n; i++)
+ post("source-coordinates: x_src%d = %.3f, y_src%d = %.3f, z_src%d = %.3f",
+ x->x_src_x[i], i+1, x->x_src_y[i], i+1, x->x_src_z[i], i+1);
+ post("ambisonic-radius: %f", x->x_r_ambi);
+ post("sonic-speed: %.3f", x->x_speed);
+ post("order of outputs: direct early rev");
+ post("*******************************************************************************");
+}
+
+static void early_reflections_3d_para(t_early_reflections_3d *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int i, n=x->x_n_src*3 + 7;/* r_ambi + 3*room + 3*head */
+
+ if(argc != n)
+ {
+ post("early_reflections_3d ERROR: para needs 1 r_ambi + 3*room + 3*head +n*3*src");
+ return;
+ }
+
+ x->x_r_ambi = atom_getfloat(argv++);
+ x->x_room_x = atom_getfloat(argv++);
+ x->x_room_y = atom_getfloat(argv++);
+ x->x_room_z = atom_getfloat(argv++);
+ x->x_head_x = atom_getfloat(argv++);
+ x->x_head_y = atom_getfloat(argv++);
+ x->x_head_z = atom_getfloat(argv++);
+ n = x->x_n_src;
+ for(i=0; i<n; i++)
+ {
+ x->x_src_x[i] = atom_getfloat(argv++);
+ x->x_src_y[i] = atom_getfloat(argv++);
+ x->x_src_z[i] = atom_getfloat(argv++);
+ }
+ early_reflections_3d_doit(x);
+}
+
+static void early_reflections_3d_sonic_speed(t_early_reflections_3d *x, t_floatarg speed)
+{
+ if(speed < 300.0f)
+ speed = 300.0f;
+ if(speed > 400.0f)
+ speed = 400.0f;
+ x->x_speed = speed;
+}
+
+static void early_reflections_3d_bundle(t_early_reflections_3d *x, t_floatarg bundle)
+{
+ if(bundle == 0.0f)
+ x->x_bundle = 0;
+ else
+ x->x_bundle = 1;
+}
+
+static void early_reflections_3d_free(t_early_reflections_3d *x)
+{
+}
+
+static void *early_reflections_3d_new(t_floatarg fn_src)
+{
+ int i, n;
+ t_early_reflections_3d *x = (t_early_reflections_3d *)pd_new(early_reflections_3d_class);
+
+ n = (int)fn_src;
+ if(n < 1)
+ n = 1;
+ if(n > 30)
+ n = 30;
+ x->x_n_src = n;
+ x->x_room_x = 12.0f;
+ x->x_room_y = 8.0f;
+ x->x_room_z = 4.0f;
+ x->x_head_x = 0.0f;
+ x->x_head_y = 0.0f;
+ x->x_head_z = 1.7f;
+ for(i=0; i<n; i++)
+ {
+ x->x_src_x[i] = 3.0f;
+ x->x_src_y[i] = 0.5f;
+ x->x_src_z[i] = 2.5f;
+ }
+ x->x_r_ambi = 1.4f;
+ x->x_speed = 340.0f;
+
+ x->x_s_del0 = gensym("del0");
+ x->x_s_del1 = gensym("del1");
+ x->x_s_del2 = gensym("del2");
+ x->x_s_damp = gensym("damp");
+ x->x_s_index_delta_phi = gensym("index_delta_phi");
+ x->x_s_bundle = gensym("bundle");
+ x->x_direct_out = outlet_new(&x->x_obj, &s_list);
+ x->x_early_out = outlet_new(&x->x_obj, &s_list);
+ x->x_rev_out = outlet_new(&x->x_obj, &s_list);
+ x->x_180_over_pi = (t_float)(180.0 / (4.0 * atan(1.0)));
+ x->x_bundle = 0;
+ return (x);
+}
+
+void early_reflections_3d_setup(void)
+{
+ early_reflections_3d_class = class_new(gensym("early_reflections_3d"), (t_newmethod)early_reflections_3d_new, (t_method)early_reflections_3d_free,
+ sizeof(t_early_reflections_3d), 0, A_DEFFLOAT, 0);
+ class_addmethod(early_reflections_3d_class, (t_method)early_reflections_3d_para, gensym("para"), A_GIMME, 0);
+ class_addmethod(early_reflections_3d_class, (t_method)early_reflections_3d_sonic_speed, gensym("sonic_speed"), A_FLOAT, 0);
+ class_addmethod(early_reflections_3d_class, (t_method)early_reflections_3d_bundle, gensym("bundle"), A_FLOAT, 0);
+ class_addmethod(early_reflections_3d_class, (t_method)early_reflections_3d_dump_para, gensym("dump_para"), 0);
+ class_sethelpsymbol(early_reflections_3d_class, gensym("iemhelp2/early_reflections_3d-help"));
+}
diff --git a/src/iem_roomsim.c b/src/iem_roomsim.c
new file mode 100644
index 0000000..2059d6c
--- /dev/null
+++ b/src/iem_roomsim.c
@@ -0,0 +1,34 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_roomsim written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+static t_class *iem_roomsim_class;
+
+static void *iem_roomsim_new(void)
+{
+ t_object *x = (t_object *)pd_new(iem_roomsim_class);
+
+ return (x);
+}
+
+void early_reflections_3d_setup(void);
+void early_reflections_2d_setup(void);
+void cart2del_damp_2d_setup(void);
+void cart2del_damp_3d_setup(void);
+
+/* ------------------------ setup routine ------------------------- */
+
+void iem_roomsim_setup(void)
+{
+ early_reflections_3d_setup();
+ early_reflections_2d_setup();
+ cart2del_damp_2d_setup();
+ cart2del_damp_3d_setup();
+
+ post("iem_roomsim (R-1.16) library loaded! (c) Thomas Musil 05.2005");
+ post(" musil%ciem.at iem KUG Graz Austria", '@');
+}
diff --git a/src/iem_roomsim.dsp b/src/iem_roomsim.dsp
new file mode 100644
index 0000000..83938ce
--- /dev/null
+++ b/src/iem_roomsim.dsp
@@ -0,0 +1,85 @@
+# Microsoft Developer Studio Project File - Name="iem_roomsim" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=iem_roomsim - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "iem_roomsim.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "iem_roomsim.mak" CFG="iem_roomsim - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "iem_roomsim - Win32 Release" (basierend auf "Win32 (x86) External Target")
+!MESSAGE "iem_roomsim - Win32 Debug" (basierend auf "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "iem_roomsim - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f makefile_win"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile_win.exe"
+# PROP BASE Bsc_Name "makefile_win.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f makefile_win"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "iem_roomsim.exe"
+# PROP Bsc_Name "iem_roomsim.bsc"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "iem_roomsim - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f makefile_win"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile_win.exe"
+# PROP BASE Bsc_Name "makefile_win.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f makefile_win"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "iem_roomsim.exe"
+# PROP Bsc_Name "iem_roomsim.bsc"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "iem_roomsim - Win32 Release"
+# Name "iem_roomsim - Win32 Debug"
+
+!IF "$(CFG)" == "iem_roomsim - Win32 Release"
+
+!ELSEIF "$(CFG)" == "iem_roomsim - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\makefile_win
+# End Source File
+# End Target
+# End Project
diff --git a/src/iem_roomsim.dsw b/src/iem_roomsim.dsw
new file mode 100644
index 0000000..823c3cb
--- /dev/null
+++ b/src/iem_roomsim.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "iem_roomsim"=.\iem_roomsim.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/src/iemlib.h b/src/iemlib.h
new file mode 100644
index 0000000..b895ecf
--- /dev/null
+++ b/src/iemlib.h
@@ -0,0 +1,102 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib.h written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+#ifndef __IEMLIB_H__
+#define __IEMLIB_H__
+
+
+#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER)
+#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT)
+#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL)
+#define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR)
+#define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM)
+#define IS_A_SEMI(atom,index) ((atom+index)->a_type == A_SEMI)
+#define IS_A_COMMA(atom,index) ((atom+index)->a_type == A_COMMA)
+
+
+#ifdef NT
+int sys_noloadbang;
+//t_symbol *iemgui_key_sym=0;
+#include <io.h>
+#else
+extern int sys_noloadbang;
+//extern t_symbol *iemgui_key_sym;
+#include <unistd.h>
+#endif
+
+#define DEFDELVS 64
+#define XTRASAMPS 4
+#define SAMPBLK 4
+
+
+#define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */
+
+/* machine-dependent definitions. These ifdefs really
+should have been by CPU type and not by operating system! */
+#ifdef IRIX
+/* big-endian. Most significant byte is at low address in memory */
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#define int32 long /* a data type that has 32 bits */
+#else
+#ifdef MSW
+/* little-endian; most significant byte is at highest address */
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#define int32 long
+#else
+#ifdef __FreeBSD__
+#include <machine/endian.h>
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#else
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#endif /* BYTE_ORDER */
+#include <sys/types.h>
+#define int32 int32_t
+#endif
+#ifdef __linux__
+
+#include <endian.h>
+
+#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN)
+#error No byte order defined
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#else
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#endif /* __BYTE_ORDER */
+
+#include <sys/types.h>
+#define int32 int32_t
+
+#else
+#ifdef __APPLE__
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#define int32 int /* a data type that has 32 bits */
+
+#endif /* __APPLE__ */
+#endif /* __linux__ */
+#endif /* MSW */
+#endif /* SGI */
+
+union tabfudge
+{
+ double tf_d;
+ int32 tf_i[2];
+};
+
+#define IEM_DENORMAL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \
+(((*(unsigned int*)&(f))&0x60000000)==0x60000000))
+/* more stringent test: anything not between 1e-19 and 1e19 in absolute val */
+
+#endif
diff --git a/src/makefile b/src/makefile
new file mode 100644
index 0000000..9efcae6
--- /dev/null
+++ b/src/makefile
@@ -0,0 +1,50 @@
+current: all
+
+.SUFFIXES: .pd_linux
+
+INCLUDE = -I. -I/usr/local/src/pd/src
+
+LDFLAGS = -export-dynamic -shared
+LIB = -ldl -lm -lpthread
+
+#select either the DBG and OPT compiler flags below:
+
+CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \
+ -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \
+ -DDL_OPEN
+
+SYSTEM = $(shell uname -m)
+
+# the sources
+
+SRC = early_reflections_3d.c \
+ early_reflections_2d.c \
+ cart2del_damp_2d.c \
+ cart2del_damp_3d.c \
+ iem_roomsim.c
+
+TARGET = iem_roomsim.pd_linux
+
+
+OBJ = $(SRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+clean:
+ rm ..\$(TARGET)
+ rm *.o
+
+all: $(OBJ)
+ @echo :: $(OBJ)
+ $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB)
+ strip --strip-unneeded $(TARGET)
+ mv $(TARGET) ..
+
+$(OBJ) : %.o : %.c
+ $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c
+
+
+
+
diff --git a/src/makefile_linux b/src/makefile_linux
new file mode 100644
index 0000000..9efcae6
--- /dev/null
+++ b/src/makefile_linux
@@ -0,0 +1,50 @@
+current: all
+
+.SUFFIXES: .pd_linux
+
+INCLUDE = -I. -I/usr/local/src/pd/src
+
+LDFLAGS = -export-dynamic -shared
+LIB = -ldl -lm -lpthread
+
+#select either the DBG and OPT compiler flags below:
+
+CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \
+ -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \
+ -DDL_OPEN
+
+SYSTEM = $(shell uname -m)
+
+# the sources
+
+SRC = early_reflections_3d.c \
+ early_reflections_2d.c \
+ cart2del_damp_2d.c \
+ cart2del_damp_3d.c \
+ iem_roomsim.c
+
+TARGET = iem_roomsim.pd_linux
+
+
+OBJ = $(SRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+clean:
+ rm ..\$(TARGET)
+ rm *.o
+
+all: $(OBJ)
+ @echo :: $(OBJ)
+ $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB)
+ strip --strip-unneeded $(TARGET)
+ mv $(TARGET) ..
+
+$(OBJ) : %.o : %.c
+ $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c
+
+
+
+
diff --git a/src/makefile_win b/src/makefile_win
new file mode 100644
index 0000000..3167d6c
--- /dev/null
+++ b/src/makefile_win
@@ -0,0 +1,41 @@
+
+all: ..\iem_roomsim.dll
+
+VIS_CPP_PATH = "C:\Programme\Microsoft Visual Studio\Vc98"
+
+PD_INST_PATH = "C:\Programme\pd-0.39-2"
+
+PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include
+
+PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -DPA_LITTLE_ENDIAN
+
+PD_WIN_L_FLAGS = /nologo
+
+PD_WIN_LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NODEFAULTLIB:uuid \
+ $(VIS_CPP_PATH)\lib\libc.lib \
+ $(VIS_CPP_PATH)\lib\oldnames.lib \
+ $(VIS_CPP_PATH)\lib\kernel32.lib \
+ $(VIS_CPP_PATH)\lib\wsock32.lib \
+ $(VIS_CPP_PATH)\lib\winmm.lib \
+ $(PD_INST_PATH)\bin\pthreadVC.lib \
+ $(PD_INST_PATH)\bin\pd.lib
+
+
+SRC = early_reflections_3d.c \
+ early_reflections_2d.c \
+ cart2del_damp_2d.c \
+ cart2del_damp_3d.c \
+ iem_roomsim.c
+
+
+OBJ = $(SRC:.c=.obj)
+
+.c.obj:
+ cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c
+
+..\iem_roomsim.dll: $(OBJ)
+ link $(PD_WIN_L_FLAGS) /dll /export:iem_roomsim_setup \
+ /out:..\iem_roomsim.dll $(OBJ) $(PD_WIN_LIB)
+
+clean:
+ del *.obj