aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/xsample
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/xsample')
-rwxr-xr-xexternals/grill/xsample/MPW/MakeAliases1
-rw-r--r--externals/grill/xsample/gpl.txt346
-rw-r--r--externals/grill/xsample/license.txt84
-rw-r--r--externals/grill/xsample/maxmsp/xgroove~.helpbin0 -> 7310 bytes
-rw-r--r--externals/grill/xsample/maxmsp/xplay~.helpbin0 -> 6069 bytes
-rw-r--r--externals/grill/xsample/maxmsp/xrecord~.helpbin0 -> 9541 bytes
-rw-r--r--externals/grill/xsample/pd/xgroove~.help.pd166
-rw-r--r--externals/grill/xsample/pd/xplay~.help.pd57
-rw-r--r--externals/grill/xsample/pd/xrecord~.help.pd136
-rw-r--r--externals/grill/xsample/readme.txt142
-rw-r--r--externals/grill/xsample/source/groove.cpp709
-rw-r--r--externals/grill/xsample/source/inter.ci355
-rw-r--r--externals/grill/xsample/source/inter.cpp95
-rw-r--r--externals/grill/xsample/source/main.cpp203
-rw-r--r--externals/grill/xsample/source/main.h277
-rw-r--r--externals/grill/xsample/source/makefile.bcc74
-rw-r--r--externals/grill/xsample/source/makefile.pd-cygwin89
-rw-r--r--externals/grill/xsample/source/makefile.pd-linux89
-rw-r--r--externals/grill/xsample/source/play.cpp160
-rw-r--r--externals/grill/xsample/source/record.cpp506
-rw-r--r--externals/grill/xsample/source/xsample.cwbin0 -> 105160 bytes
-rw-r--r--externals/grill/xsample/source/xsample.dsp127
-rw-r--r--externals/grill/xsample/source/xsample.mpw129
23 files changed, 3745 insertions, 0 deletions
diff --git a/externals/grill/xsample/MPW/MakeAliases b/externals/grill/xsample/MPW/MakeAliases
new file mode 100755
index 00000000..681b5f17
--- /dev/null
+++ b/externals/grill/xsample/MPW/MakeAliases
@@ -0,0 +1 @@
+(This file must be converted with BinHex 4.0) :!!""8&"-BA"XG#!!!!!MR!!!&83XSIlYqXi!!!!5!*!(!J!!!!S!!!6-!!!!"3! !!!%!!!!iAep338G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rm!!!50!*!&P[rr!!!%d3#3"B$rr`!!"EB8a6PJ!!$rr`#3#[rr!!!!@`# 3"!4Srrm!!!""!*!%))i: \ No newline at end of file
diff --git a/externals/grill/xsample/gpl.txt b/externals/grill/xsample/gpl.txt
new file mode 100644
index 00000000..5ea29a7d
--- /dev/null
+++ b/externals/grill/xsample/gpl.txt
@@ -0,0 +1,346 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
diff --git a/externals/grill/xsample/license.txt b/externals/grill/xsample/license.txt
new file mode 100644
index 00000000..dc45deed
--- /dev/null
+++ b/externals/grill/xsample/license.txt
@@ -0,0 +1,84 @@
+xsample - extended sample objects for Max/MSP and pd (pure data)
+Copyright (C) 2001,2002 Thomas Grill
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+In the official xsample distribution, the GNU General Public License is
+in the file gpl.txt
+
+---------------------------------------------------------
+
+ OTHER COPYRIGHT NOTICES
+
+---------------------------------------------------------
+This package uses the flext C++ layer and some code snippets
+from pd (pure data).
+See the license texts below:
+
+
+--- flext ----------------------------------------------
+flext - C++ layer for Max/MSP and pd (pure data) externals
+Copyright (C) 2001,2002 Thomas Grill
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+In the official flext distribution, the GNU General Public License is
+in the file gpl.txt
+
+
+--- pd (pure data) --------------------------------------
+This software is copyrighted by Miller Puckette and others. The following
+terms apply to all files associated with the software unless explicitly
+disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+RESTRICTED RIGHTS: Use, duplication or disclosure by the government
+is subject to the restrictions as set forth in subparagraph (c) (1) (ii)
+of the Rights in Technical Data and Computer Software Clause as DFARS
+252.227-7013 and FAR 52.227-19.
diff --git a/externals/grill/xsample/maxmsp/xgroove~.help b/externals/grill/xsample/maxmsp/xgroove~.help
new file mode 100644
index 00000000..c26c6eff
--- /dev/null
+++ b/externals/grill/xsample/maxmsp/xgroove~.help
Binary files differ
diff --git a/externals/grill/xsample/maxmsp/xplay~.help b/externals/grill/xsample/maxmsp/xplay~.help
new file mode 100644
index 00000000..cb4f7cad
--- /dev/null
+++ b/externals/grill/xsample/maxmsp/xplay~.help
Binary files differ
diff --git a/externals/grill/xsample/maxmsp/xrecord~.help b/externals/grill/xsample/maxmsp/xrecord~.help
new file mode 100644
index 00000000..a45de207
--- /dev/null
+++ b/externals/grill/xsample/maxmsp/xrecord~.help
Binary files differ
diff --git a/externals/grill/xsample/pd/xgroove~.help.pd b/externals/grill/xsample/pd/xgroove~.help.pd
new file mode 100644
index 00000000..74b9e312
--- /dev/null
+++ b/externals/grill/xsample/pd/xgroove~.help.pd
@@ -0,0 +1,166 @@
+#N canvas 92 110 837 556 12;
+#X obj 258 240 hsl 128 15 0.001 3 1 1 empty empty empty 20 8 0 8 -225271
+-1 -1 0 1;
+#X floatatom 255 261 8 0 0;
+#X floatatom 275 312 8 0 0;
+#X floatatom 350 312 8 0 0;
+#X floatatom 273 372 8 0 0;
+#X floatatom 348 372 8 0 0;
+#X obj 275 419 loadbang;
+#X obj 274 445 metro 30;
+#X obj 250 470 snapshot~;
+#X floatatom 250 494 8 0 0;
+#X msg 258 82 loop \$1;
+#X obj 159 27 bng 15 250 50 0 empty empty empty 20 8 0 8 -258699 -1
+-1;
+#X msg 158 47 stop;
+#N canvas 0 0 450 300 graph7 0;
+#X array buf 300 float 1;
+#A 0 0.841115 0.9094 0.95923 0.989636 0.999991 0.990063 0.960094 0.910649
+0.842757 0.757796 0.65746 0.543816 0.419143 0.285978 0.147021 0.00508036
+-0.136962 -0.276228 -0.409895 -0.535265 -0.649771 -0.751121 -0.83725
+-0.906401 -0.957205 -0.988587 -0.999947 -0.991051 -0.962051 -0.913577
+-0.846573 -0.762418 -0.662823 -0.549777 -0.425604 -0.292801 -0.154064
+-0.0122066 0.129898 0.269372 0.403387 0.529223 0.644347 0.746395 0.833328
+0.903378 0.955105 0.987498 0.99986 0.991967 0.963983 0.91644 0.850346
+0.767009 0.668129 0.555721 0.432034 0.299602 0.161097 0.0193266 -0.122836
+-0.262506 -0.396859 -0.523173 -0.638875 -0.741645 -0.82937 -0.900294
+-0.952984 -0.986339 -0.999729 -0.992844 -0.965842 -0.919283 -0.854067
+-0.771564 -0.673418 -0.561622 -0.438457 -0.306392 -0.168126 -0.0264512
+0.115759 0.255627 0.390308 0.517083 0.633384 0.736837 0.825374 0.89717
+0.95079 0.985156 0.999531 0.993672 0.967666 0.922048 0.857765 0.776069
+0.678665 0.567504 0.444838 0.313167 0.175141 0.0335691 -0.108684 -0.248732
+-0.383745 -0.510974 -0.627851 -0.732014 -0.821324 -0.894008 -0.948562
+-0.983895 -0.999309 -0.994439 -0.96944 -0.924788 -0.861391 -0.780556
+-0.683878 -0.573355 -0.451214 -0.319922 -0.182154 -0.0406903 0.101596
+0.241826 0.37715 0.504839 0.62229 0.727131 0.81725 0.890784 0.946286
+0.982602 0.999003 0.99518 0.971156 0.927473 0.864993 0.784974 0.689065
+0.579174 0.457555 0.326665 0.189149 0.047805 -0.0945095 -0.234908 -0.370551
+-0.498674 -0.616703 -0.722227 -0.813114 -0.887541 -0.943952 -0.981256
+-0.998669 -0.995836 -0.972845 -0.93011 -0.868543 -0.789377 -0.694202
+-0.584975 -0.463879 -0.333389 -0.196144 -0.0549212 0.0874133 0.227976
+0.363918 0.492493 0.611072 0.717282 0.80895 0.88422 0.941593 0.979852
+0.998275 0.996467 0.974453 0.932714 0.872048 0.793723 0.699318 0.590728
+0.47018 0.340094 0.20312 0.0620311 -0.0803164 -0.221037 -0.357277 -0.486275
+-0.605431 -0.712297 -0.804743 -0.880878 -0.939154 -0.97842 -0.99783
+-0.997035 -0.976038 -0.935246 -0.875523 -0.798037 -0.704388 -0.596471
+-0.476452 -0.346789 -0.210093 -0.0691412 0.0732124 0.21408 0.350613
+0.480039 0.599733 0.707289 0.800488 0.87748 0.936691 0.976908 0.997349
+0.997554 0.977556 0.937754 0.87893 0.802314 0.709426 0.602164 0.482708
+0.353456 0.217051 0.0762439 -0.0661074 -0.207122 -0.343933 -0.473779
+-0.594024 -0.702224 -0.796211 -0.87404 -0.934169 -0.975372 -0.996792
+-0.998035 -0.979032 -0.940196 -0.882319 -0.806539 -0.714434 -0.60784
+-0.48893 -0.36012 -0.224 -0.0833475 0.0589955 0.200142 0.337238 0.467489
+0.588274 0.69714 0.791867 0.870566 0.931602 0.973768 0.996211 0.998443
+0.980464 0.9426 0.885637 0.810741 0.719392 0.613481 0.495132 0.366748
+0.230939 0.0904412 -0.0518851 -0.193161 -0.33052 -0.461188 -0.582499
+-0.692013 -0.787507 -0.867028 -0.928998 -0.972125 -0.995556 -0.998827
+-0.98183 -0.944959 -0.888927 -0.81488 -0.724336 -0.619089 -0.501311
+-0.373371;
+#X coords 0 1 299 -1 300 200 1;
+#X restore 521 23 graph;
+#X obj 144 486 dac~;
+#X msg 157 86 reset;
+#X text 290 292 min/max points;
+#X text 289 390 min/max points;
+#X text 323 494 position;
+#X text 181 24 start;
+#X text 198 45 stop;
+#X msg 156 113 help;
+#X text 416 234 speed;
+#X text 337 254 (float or signal);
+#X obj 656 365 table buf2;
+#X floatatom 519 380 8 0 0;
+#X obj 519 353 soundfiler;
+#X msg 158 172 set buf2;
+#X msg 157 144 set buf;
+#X msg 372 82 interp \$1;
+#X msg 240 312 all;
+#X obj 198 341 xgroove~ buf;
+#X text 255 10 looping mode;
+#X text 370 9 interpolation;
+#X msg 20 170 pos 100;
+#X msg 35 199 pos 200;
+#X obj 152 447 *~;
+#X obj 22 242 ramp 10;
+#X msg 10 105 xzone \$1;
+#X obj 13 62 hsl 128 15 0 300 0 0 empty empty empty -2 -6 0 8 -262144
+-1 -1 0 1;
+#X floatatom 10 83 5 0 0;
+#X obj 258 32 vdl 15 0 0 3 empty empty empty 0 -6 0 8 -262144 -1 -1
+1;
+#X text 277 29 once;
+#X text 277 45 forward;
+#X text 277 61 bidir;
+#X obj 372 31 vdl 15 0 0 3 empty empty empty 0 -6 0 8 -262144 -1 -1
+1;
+#X text 391 28 none;
+#X text 391 44 linear;
+#X text 391 60 4-point;
+#X obj 520 299 openpanel;
+#X msg 521 326 read -resize \$1 buf2;
+#X obj 521 275 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 256 134 vdl 15 0 0 4 empty empty empty 0 -6 0 8 -262144 -1 -1
+2;
+#X text 255 113 units;
+#X msg 256 199 units \$1;
+#X obj 364 134 vdl 15 0 0 4 empty empty empty 0 -6 0 8 -262144 -1 -1
+0;
+#X text 363 113 scale mode;
+#X msg 364 199 sclmode \$1;
+#X text 275 131 frames;
+#X text 275 147 buffer sz;
+#X text 275 163 ms;
+#X text 275 178 s;
+#X text 383 147 units in loop;
+#X text 383 163 buffer;
+#X text 383 178 loop;
+#X text 383 131 units in buffer;
+#X obj 524 440 osc~ 1000;
+#X obj 524 498 tabwrite~ buf;
+#X obj 536 467 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X msg 557 468 stop;
+#X connect 0 0 1 0;
+#X connect 1 0 31 0;
+#X connect 2 0 31 1;
+#X connect 3 0 31 2;
+#X connect 6 0 7 0;
+#X connect 7 0 8 0;
+#X connect 8 0 9 0;
+#X connect 10 0 31 0;
+#X connect 11 0 31 0;
+#X connect 12 0 31 0;
+#X connect 15 0 31 0;
+#X connect 21 0 31 0;
+#X connect 26 0 25 0;
+#X connect 27 0 31 0;
+#X connect 28 0 31 0;
+#X connect 29 0 31 0;
+#X connect 30 0 31 0;
+#X connect 31 0 36 1;
+#X connect 31 1 8 0;
+#X connect 31 2 4 0;
+#X connect 31 3 5 0;
+#X connect 34 0 37 0;
+#X connect 35 0 37 0;
+#X connect 36 0 14 0;
+#X connect 36 0 14 1;
+#X connect 37 0 36 0;
+#X connect 37 1 31 0;
+#X connect 38 0 31 0;
+#X connect 39 0 40 0;
+#X connect 40 0 38 0;
+#X connect 41 0 10 0;
+#X connect 45 0 29 0;
+#X connect 49 0 50 0;
+#X connect 50 0 26 0;
+#X connect 51 0 49 0;
+#X connect 52 0 54 0;
+#X connect 54 0 31 0;
+#X connect 55 0 57 0;
+#X connect 57 0 31 0;
+#X connect 66 0 67 0;
+#X connect 68 0 67 0;
+#X connect 69 0 67 0;
diff --git a/externals/grill/xsample/pd/xplay~.help.pd b/externals/grill/xsample/pd/xplay~.help.pd
new file mode 100644
index 00000000..9bca8cbb
--- /dev/null
+++ b/externals/grill/xsample/pd/xplay~.help.pd
@@ -0,0 +1,57 @@
+#N canvas 297 114 616 300 12;
+#X obj 69 252 dac~;
+#X obj 19 54 bng 15 250 50 0 empty empty empty 20 8 0 8 -258699 -1
+-1;
+#X msg 18 74 stop;
+#X msg 16 141 reset;
+#X text 41 51 start;
+#X text 58 72 stop;
+#X obj 125 155 *~ 300;
+#X text 107 176 position signal;
+#X msg 16 115 help;
+#X graph graph7 0 -1 299 1 284 217 584 17;
+#X array buf 300 float 1;
+#A 0 -0.03 -0.03 -0.03 -0.0366667 -0.0433333 -0.05 -0.065 -0.08 -0.085
+-0.09 -0.096 -0.102 -0.108 -0.114 -0.12 -0.1275 -0.135 -0.1425 -0.15
+-0.156 -0.162 -0.168 -0.174 -0.18 -0.186 -0.192 -0.198 -0.204 -0.21
+-0.2175 -0.225 -0.2325 -0.24 -0.246 -0.252 -0.258 -0.264 -0.27 -0.276
+-0.282 -0.288 -0.294 -0.3 -0.305 -0.31 -0.315 -0.32 -0.325 -0.33 -0.335
+-0.34 -0.34375 -0.3475 -0.35125 -0.355 -0.35875 -0.3625 -0.36625 -0.37
+-0.373333 -0.376667 -0.38 -0.383333 -0.386667 -0.39 -0.393333 -0.396667
+-0.4 -0.402 -0.404 -0.406 -0.408 -0.41 -0.4125 -0.415 -0.4175 -0.42
+-0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.42
+-0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.42 -0.4175 -0.415 -0.4125 -0.41
+-0.41 -0.4 -0.39 -0.39 -0.385 -0.38 -0.36 -0.35 -0.34 -0.33 -0.32 -0.31
+-0.3 -0.29 -0.28 -0.27 -0.26 -0.25 -0.2425 -0.235 -0.2275 -0.22 -0.21
+-0.2 -0.19 -0.18 -0.17 -0.16 -0.15 -0.14 -0.132 -0.124 -0.116 -0.108
+-0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.0425 -0.035 -0.0275 -0.02 -0.01
+0 0.01 0.0175 0.025 0.0325 0.04 0.05 0.06 0.07 0.08 0.08875 0.0975
+0.10625 0.115 0.12375 0.1325 0.14125 0.15 0.156 0.162 0.168 0.174 0.18
+0.186 0.192 0.198 0.204 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.278 0.286
+0.294 0.302 0.31 0.318 0.326 0.334 0.342 0.35 0.355556 0.361111 0.366667
+0.372222 0.377778 0.383333 0.388889 0.394444 0.4 0.405714 0.411429
+0.417143 0.45 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46
+0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46 0.46
+0.46 0.46 0.46 0.46 0.46 0.456667 0.453333 0.45 0.45 0.45 0.448333
+0.446667 0.445 0.443333 0.441667 0.44 0.44 0.43625 0.4325 0.42875 0.425
+0.42125 0.4175 0.41375 0.41 0.405 0.4 0.4 0.3925 0.385 0.3775 0.37
+0.37 0.355 0.35 0.34 0.33 0.32 0.31 0.29 0.283333 0.276667 0.27 0.26
+0.25 0.24 0.23 0.22 0.21 0.2 0.19 0.18 0.16 0.15 0.14 0.13 0.12 0.11
+0.105 0.1 0.09 0.075 0.06 0.05 0.04 0.03 0.02 0 -0.02 -0.0266667 -0.0333333
+-0.04 -0.05;
+#X pop;
+#X obj 117 82 hsl 128 15 1 100 1 1 empty empty empty 20 8 0 8 -225271
+-1 -1 11100 1;
+#X obj 77 203 xplay~ buf;
+#X msg 17 168 print;
+#X obj 124 124 phasor~ 100;
+#X connect 1 0 11 0;
+#X connect 2 0 11 0;
+#X connect 3 0 11 0;
+#X connect 6 0 11 0;
+#X connect 8 0 11 0;
+#X connect 10 0 13 0;
+#X connect 11 0 0 0;
+#X connect 11 0 0 1;
+#X connect 12 0 11 0;
+#X connect 13 0 6 0;
diff --git a/externals/grill/xsample/pd/xrecord~.help.pd b/externals/grill/xsample/pd/xrecord~.help.pd
new file mode 100644
index 00000000..5226f539
--- /dev/null
+++ b/externals/grill/xsample/pd/xrecord~.help.pd
@@ -0,0 +1,136 @@
+#N canvas 134 12 855 608 12;
+#X obj 14 15 bng 15 250 50 0 empty empty empty 20 8 0 8 -258699 -1
+-1;
+#X msg 13 35 stop;
+#X floatatom 165 248 5 0 0;
+#X floatatom 219 248 5 0 0;
+#X floatatom 190 170 5 0 0;
+#X floatatom 239 171 5 0 0;
+#N canvas 0 0 450 300 graph7 0;
+#X array buf 10000 float 0;
+#X coords 0 1 9999 -1 200 140 1;
+#X restore 52 431 graph;
+#X obj 91 212 xrecord~ buf;
+#X msg 11 69 reset;
+#X obj 70 287 snapshot~;
+#X floatatom 72 312 7 0 0;
+#X obj 18 220 loadbang;
+#X msg 10 99 help;
+#X obj 175 96 tgl 15 1 empty empty empty 20 8 0 8 -225271 -1 -1 1 1
+;
+#X msg 193 93 loop \$1;
+#X msg 173 36 0;
+#X msg 209 36 200;
+#X msg 172 64 draw \$1;
+#X obj 411 275 bng 15 250 50 0 empty empty empty 20 8 0 8 -258699 -1
+-1;
+#X msg 410 295 stop;
+#X floatatom 565 485 5 0 0;
+#X floatatom 619 485 5 0 0;
+#X floatatom 568 427 5 0 0;
+#X floatatom 617 428 5 0 0;
+#X obj 500 458 xrecord~ buf;
+#X msg 409 334 reset;
+#X obj 500 518 snapshot~;
+#X floatatom 500 548 7 0 0;
+#X obj 411 446 loadbang;
+#X obj 537 242 tgl 15 1 empty empty empty 20 8 0 8 -225271 -1 -1 0
+1;
+#X msg 556 239 loop \$1;
+#X msg 452 206 0;
+#X msg 451 234 draw \$1;
+#X obj 538 265 tgl 15 1 empty empty empty 20 8 0 8 -225271 -1 -1 1
+1;
+#X msg 556 263 sigmode \$1;
+#X msg 409 360 print;
+#X obj 581 353 hsl 128 15 -0.001 1 0 1 empty empty empty 20 8 0 8 -225271
+-1 -1 12700 1;
+#X obj 537 291 tgl 15 0 empty empty empty 20 8 0 8 -225271 -1 -1 0
+1;
+#X msg 557 288 mixmode \$1;
+#X floatatom 629 381 8 0 0;
+#X obj 411 473 metro 30;
+#X obj 18 247 metro 30;
+#X obj 640 21 osc~ 10;
+#X obj 91 133 r~ rec;
+#X obj 482 339 r~ rec;
+#X obj 678 95 s~ rec;
+#X obj 623 48 *~ 1;
+#X obj 622 25 tgl 15 1 empty empty empty 20 8 0 8 -225271 -1 -1 1 1
+;
+#X obj 719 50 *~ 1;
+#X obj 718 27 tgl 15 0 empty empty empty 20 8 0 8 -225271 -1 -1 0 1
+;
+#X obj 736 23 adc~;
+#X text 198 149 min/max position;
+#X text 166 267 min/max position;
+#X text 262 96 looping on/off;
+#X text 237 65 display refresh;
+#X text 52 13 start;
+#X text 53 35 stop;
+#X text 26 270 position signal;
+#X text 619 238 looping on/off;
+#X text 644 264 signal mode on/off;
+#X text 700 381 trigger signal;
+#X text 379 121 <----- message triggered;
+#X text 173 368 signal triggered ------->;
+#X text 493 185 click to activate auto update;
+#X text 432 271 start;
+#X text 450 295 stop;
+#X text 538 307 mix-in by trigger signal on/off;
+#X msg 153 170 all;
+#X msg 488 206 100;
+#X obj 521 426 line~;
+#X msg 520 401 \$1 20;
+#X connect 0 0 7 0;
+#X connect 1 0 7 0;
+#X connect 4 0 7 2;
+#X connect 5 0 7 3;
+#X connect 7 0 9 0;
+#X connect 7 1 2 0;
+#X connect 7 2 3 0;
+#X connect 8 0 7 0;
+#X connect 9 0 10 0;
+#X connect 11 0 41 0;
+#X connect 12 0 7 0;
+#X connect 13 0 14 0;
+#X connect 14 0 7 0;
+#X connect 15 0 17 0;
+#X connect 16 0 17 0;
+#X connect 17 0 7 0;
+#X connect 18 0 24 0;
+#X connect 19 0 24 0;
+#X connect 22 0 24 2;
+#X connect 23 0 24 3;
+#X connect 24 0 26 0;
+#X connect 24 1 20 0;
+#X connect 24 2 21 0;
+#X connect 25 0 24 0;
+#X connect 26 0 27 0;
+#X connect 28 0 40 0;
+#X connect 29 0 30 0;
+#X connect 30 0 24 0;
+#X connect 31 0 32 0;
+#X connect 32 0 24 0;
+#X connect 33 0 34 0;
+#X connect 34 0 24 0;
+#X connect 35 0 24 0;
+#X connect 36 0 39 0;
+#X connect 36 0 70 0;
+#X connect 37 0 38 0;
+#X connect 38 0 24 0;
+#X connect 40 0 26 0;
+#X connect 41 0 9 0;
+#X connect 42 0 46 0;
+#X connect 43 0 7 0;
+#X connect 44 0 24 0;
+#X connect 46 0 45 0;
+#X connect 47 0 46 1;
+#X connect 48 0 45 0;
+#X connect 49 0 48 1;
+#X connect 50 0 48 0;
+#X connect 50 1 48 0;
+#X connect 67 0 7 0;
+#X connect 68 0 32 0;
+#X connect 69 0 24 1;
+#X connect 70 0 69 0;
diff --git a/externals/grill/xsample/readme.txt b/externals/grill/xsample/readme.txt
new file mode 100644
index 00000000..cf678085
--- /dev/null
+++ b/externals/grill/xsample/readme.txt
@@ -0,0 +1,142 @@
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+Donations for further development of the package are highly appreciated.
+
+----------------------------------------------------------------------------
+
+IMPORTANT INFORMATION for all MaxMSP users:
+
+It is advisable to put the xsample shared library file into the "startup" folder. Hence it will be
+loaded at Max startup.
+
+If you want to load the xsample library on demand, please run MakeAliases inside the MPW folder.
+This will create aliases to the several xsample objects contained in the library.
+Move these into the "externals" folder.
+(This latter procedure is only tested for OS 9.2, you may experience problems with other MacOS versions)
+
+----------------------------------------------------------------------------
+
+You will need the flext C++ layer for PD and Max/MSP externals to compile this.
+
+
+Package files:
+- readme.txt: this one
+- gpl.txt,license.txt: GPL license stuff
+- main.h,main.cpp,inter.cpp,inter.ci: base class definition for all the other objects
+- record.cpp: xrecord~
+- play.cpp: xplay~
+- groove.cpp: xgroove~
+
+----------------------------------------------------------------------------
+
+The package should at least compile (and is tested) with the following compilers:
+
+pd - Windows:
+-------------
+o Borland C++ 5.5 (free): edit & run "make -f makefile.bcc"
+
+o Microsoft Visual C++ 6: edit "xsample.dsp" project file
+> due to a compiler bug the optimization using templates is not functional
+
+pd - linux:
+-----------
+o GCC for linux: run "make -f makefile.pd-linux" and as root "make -f makefile.pd-linux install"
+> various versions of GCC die during compile with template optimization turned on
+
+Max/MSP - MacOS:
+----------------
+o Metrowerks CodeWarrior V6: edit "xsample.cw" project file functions
+
+o Apple MPW-PR: edit & use the "flext.mpw" makefile
+
+
+----------------------------------------------------------------------------
+
+Goals/features of the package:
+
+- portable and effective sample recording/playing objects for pd and Max/MSP
+- MSP-like groove~ object for PD
+- message- or signal-triggered recording object with mix-in capability
+- avoid the various bugs of the original MSP2 objects
+- multi-channel capability
+- live update of respective buffer/array content
+- switchable 4-point or linear interpolation for xplay~/xgroove~ object
+- cross-fading loop zone (inside or outside to loop) for xgroove~
+
+----------------------------------------------------------------------------
+
+Version history:
+
+0.2.5:
+- added resources to MaxMSP build
+- xgroove~, xrecord~: introduced a loop/end bang outlet
+- added MaxMSP buffer resize recognition
+- xgroove~: introduced a crossfading loop zone
+- adapted source for flext 0.4.0
+
+0.2.4:
+- according to flext 0.2.3 changed sample type to t_sample (S)
+- xrecord~: fixed mix mode bug
+- fixed argument buffer problem
+
+0.2.3:
+- using flext 0.2.2 - xsample is now a library under MaxMSP
+- cleaner gcc makefile
+- xgroove~, xrecord~: added "all" message to select entire buffer length
+- xgroove~, xplay~: revisited dsp methods, restructured the code, fixed small interpolation bugs
+- xgroove~, xplay~: added linear interpolation (message "interp 2")
+- enabled 0 output channels -> xgroove~: position output only
+- xgroove~: added bidirectional looping (message "loop 2")
+
+0.2.2:
+- using flext 0.2.0
+- xrecord~ for PD: new flext brings better graphics update behavior
+- xrecord~: recording position doesn't jump to start when recording length is reached
+- fixed bug with refresh message (min/max reset)
+- xgroove~: position (by pos message) isn't sample rounded anymore
+- reset/refresh messages readjust dsp routines to current buffer format (e.g. channel count)
+- corrected Max/MSP assist method for multi-channel
+- fixed xplay~ help method
+- changed syntax to x*~ [channels=1] [buffer] for future enhancements (MaxMSP only, warning for old syntax)
+- fixed small bug concerning startup position in xgroove~ and xrecord~
+- fixed deadly bug in xplay~ dsp code (only active with template optimization)
+
+0.2.1:
+- no leftmost float inlet for position setting - use pos method
+- changed dsp handling for flext 0.1.1 conformance
+- workarounds for buggy/incomplete compilers
+- prevent buffer warning message at patcher load (wait for loadbang)
+- fixed bug: current pos is reset when changing min or max points
+
+0.2.0:
+- first version for flext
+
+---------------------------------------------------------------------------
+
+
+TODO list:
+
+general:
+- Documentation and better example patches
+
+- do a smooth (line~) mixin in xrecord~ help patch
+
+features:
+- multi-buffer handling (aka multi-channel for pd)
+- vasp handling
+- performance comparison to respective PD/Max objects
+- anti-alias filter? (possible?)
+
+- delay min/max changes when cur pos in cross-fade zone
+
+tests:
+- reconsider startup sequence of set buffer,set units,set sclmode,set pos/min/max
+
+bugs:
+- PD: problems with timed buffer redrawing (takes a lot of cpu time) - flext bug?
+- Apple MPW doesn't correctly compile template optimization
+- Max help files aren't correctly opened due to xsample objects residing in a library
diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp
new file mode 100644
index 00000000..5c2b056f
--- /dev/null
+++ b/externals/grill/xsample/source/groove.cpp
@@ -0,0 +1,709 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#include "main.h"
+#include <math.h>
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+
+#define XZONE_TABLE 512
+
+
+class xgroove:
+ public xinter
+{
+// FLEXT_HEADER_S(xgroove,xinter,setup)
+ FLEXT_HEADER(xgroove,xinter)
+
+public:
+ xgroove(I argc,t_atom *argv);
+ ~xgroove();
+
+ virtual BL Init();
+
+#ifdef MAXMSP
+ virtual V m_assist(L msg,L arg,C *s);
+#endif
+
+ virtual V m_help();
+ virtual V m_print();
+
+ virtual V m_units(xs_unit mode = xsu__);
+
+ virtual BL m_reset();
+
+ virtual V m_pos(F pos);
+ virtual V m_all();
+ virtual V m_min(F mn);
+ virtual V m_max(F mx);
+
+ V m_xzone(F xz);
+ V m_xsymm(F xz);
+ V m_xshape(I argc = 0,t_atom *argv = NULL);
+ V m_xkeep(BL k);
+
+ enum xs_loop {
+ xsl__ = -1, // don't change
+ xsl_once = 0,xsl_loop,xsl_bidir
+ };
+
+ V m_loop(xs_loop lp = xsl__);
+
+protected:
+
+ xs_loop loopmode;
+ D curpos; // in samples
+ I bidir;
+
+ F _xzone,xzone,xsymm;
+ F znmin,znmax;
+ I xkeep;
+ S **znbuf;
+ S *znpos,*znmul,*znidx;
+ I pblksz;
+
+ outlet *outmin,*outmax; // float outlets
+
+ V outputmin() { ToOutFloat(outmin,curmin*s2u); }
+ V outputmax() { ToOutFloat(outmax,curmax*s2u); }
+
+ inline V setpos(F pos)
+ {
+ if(pos < curmin) pos = curmin;
+ else if(pos > curmax) pos = curmax;
+ curpos = pos;
+ }
+
+private:
+// static V setup(t_class *c);
+
+ virtual V s_dsp();
+
+ DEFSIGFUN(s_pos_off);
+ DEFSIGFUN(s_pos_once);
+ DEFSIGFUN(s_pos_loop);
+ DEFSIGFUN(s_pos_loopzn);
+ DEFSIGFUN(s_pos_bidir);
+
+ DEFSIGCALL(posfun);
+
+ DEFSTCALL(zonefun);
+
+ V do_xzone();
+
+ virtual V m_signal(I n,S *const *in,S *const *out)
+ {
+ bufchk();
+ posfun(n,in,out);
+ }
+
+ FLEXT_CALLBACK_F(m_pos)
+ FLEXT_CALLBACK(m_all)
+ FLEXT_CALLBACK_F(m_min)
+ FLEXT_CALLBACK_F(m_max)
+
+ FLEXT_CALLBACK_F(m_xzone)
+ FLEXT_CALLBACK_F(m_xsymm)
+ FLEXT_CALLBACK_V(m_xshape)
+ FLEXT_CALLBACK_B(m_xkeep)
+
+ FLEXT_CALLBACK_1(m_loop,xs_loop)
+};
+
+
+FLEXT_LIB_DSP_V("xgroove~",xgroove)
+
+/*
+V xgroove::setup(t_class *)
+{
+#ifndef PD
+ post("loaded xgroove~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
+#endif
+}
+*/
+
+xgroove::xgroove(I argc,t_atom *argv):
+ loopmode(xsl_loop),curpos(0),
+ _xzone(0),xzone(0),xsymm(0.5),xkeep(0),pblksz(0),
+ znbuf(NULL),znmul(NULL),znidx(NULL),znpos(NULL),
+ bidir(1)
+{
+ I argi = 0;
+#ifdef MAXMSP
+ if(argc > argi && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ }
+#endif
+
+ if(argc > argi && IsSymbol(argv[argi])) {
+ buf = new buffer(GetSymbol(argv[argi]),true);
+ argi++;
+
+#ifdef MAXMSP
+ // oldstyle command line?
+ if(argi == 1 && argc == 2 && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ post("%s: old style command line detected - please change to '%s [channels] [buffer]'",thisName(),thisName());
+ }
+#endif
+ }
+ else
+ buf = new buffer(NULL,true);
+
+ AddInSignal(); // speed signal
+ AddInFloat(2); // min & max play pos
+ AddOutSignal(outchns); // output
+ AddOutSignal(); // position
+ AddOutFloat(2); // play min & max
+ AddOutBang(); // loop bang
+
+ FLEXT_ADDMETHOD(1,m_min);
+ FLEXT_ADDMETHOD(2,m_max);
+ FLEXT_ADDMETHOD_F(0,"min",m_min);
+ FLEXT_ADDMETHOD_F(0,"max",m_max);
+ FLEXT_ADDMETHOD_F(0,"pos",m_pos);
+ FLEXT_ADDMETHOD_(0,"all",m_all);
+ FLEXT_ADDMETHOD_B(0,"loop",m_loop);
+
+ FLEXT_ADDMETHOD_F(0,"xzone",m_xzone);
+ FLEXT_ADDMETHOD_F(0,"xsymm",m_xsymm);
+ FLEXT_ADDMETHOD_(0,"xshape",m_xshape);
+ FLEXT_ADDMETHOD_B(0,"xkeep",m_xkeep);
+
+ znbuf = new S *[outchns];
+ for(I i = 0; i < outchns; ++i) znbuf[i] = new S[0];
+ znpos = new S[0];
+ znidx = new S[0];
+ m_xshape();
+}
+
+xgroove::~xgroove()
+{
+ if(znbuf) {
+ for(I i = 0; i < outchns; ++i) delete[] znbuf[i];
+ delete[] znbuf;
+ }
+
+ if(znmul) delete[] znmul;
+ if(znpos) delete[] znpos;
+ if(znidx) delete[] znidx;
+}
+
+BL xgroove::Init()
+{
+ if(xinter::Init()) {
+ outmin = GetOut(outchns+1);
+ outmax = GetOut(outchns+2);
+
+ m_reset();
+ return true;
+ }
+ else
+ return false;
+}
+
+V xgroove::m_units(xs_unit mode)
+{
+ xsample::m_units(mode);
+
+ m_sclmode();
+ outputmin();
+ outputmax();
+}
+
+V xgroove::m_min(F mn)
+{
+ xsample::m_min(mn);
+ m_pos(curpos*s2u);
+ do_xzone();
+ outputmin();
+}
+
+V xgroove::m_max(F mx)
+{
+ xsample::m_max(mx);
+ m_pos(curpos*s2u);
+ do_xzone();
+ outputmax();
+}
+
+V xgroove::m_pos(F pos)
+{
+ setpos(pos?pos/s2u:0);
+}
+
+V xgroove::m_all()
+{
+ xsample::m_all();
+ do_xzone();
+ outputmin();
+ outputmax();
+}
+
+BL xgroove::m_reset()
+{
+ curpos = 0;
+ bidir = 1;
+ return xsample::m_reset();
+}
+
+V xgroove::m_xzone(F xz)
+{
+ bufchk();
+ _xzone = xz < 0?0:xz/s2u;
+ do_xzone();
+ s_dsp();
+}
+
+V xgroove::m_xsymm(F xs)
+{
+ if(xs < 0)
+ xsymm = -1;
+ else if(xs <= 1)
+ xsymm = xs;
+ else {
+ post("%s - xsymm value out of range - set to center (0.5)",thisName());
+ xsymm = 0.5;
+ }
+ do_xzone();
+}
+
+V xgroove::m_xshape(I argc,t_atom *argv)
+{
+ const F pi = 3.14159265358979f;
+ I i,sh = 0;
+ F param = 1;
+ if(argc >= 1 && CanbeInt(argv[0])) sh = GetAInt(argv[0]);
+ if(argc >= 2 && CanbeFloat(argv[1])) {
+ param = GetAFloat(argv[1]);
+ // clip to 0..1
+ if(param < 0) param = 0;
+ else if(param > 1) param = 1;
+ }
+
+ if(znmul) delete[] znmul;
+ znmul = new S[XZONE_TABLE+1];
+
+ switch(sh) {
+ case 1:
+ for(i = 0; i <= XZONE_TABLE; ++i)
+ znmul[i] = sin(i*(pi/2./XZONE_TABLE))*param+i*(1./XZONE_TABLE)*(1-param);
+ break;
+ case 0:
+ default:
+ for(i = 0; i <= XZONE_TABLE; ++i)
+ znmul[i] = i*(1./XZONE_TABLE);
+ }
+}
+
+V xgroove::m_xkeep(BL k)
+{
+ xkeep = k;
+ do_xzone();
+}
+
+V xgroove::do_xzone()
+{
+ xzone = _xzone;
+ I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ if(xsymm < 0) {
+ // crossfade zone is inside the loop (-> loop is shorter than nominal!)
+ if(xzone >= plen) xzone = plen-1;
+ znmin = smin+xzone,znmax = smax-xzone;
+ }
+ else {
+ // desired crossfade points
+ znmin = smin+xzone*xsymm,znmax = smax+xzone*(xsymm-1);
+ // extra space at beginning and end
+ F o1 = znmin-xzone,o2 = buf->Frames()-(znmax+xzone);
+
+ if(o1 < 0 || o2 < 0) { // or (o1*o2 < 0)
+ if(o1+o2 < 0) {
+ // must reduce crossfade/loop length
+ if(!xkeep) {
+ // prefer preservation of cross-fade length
+ if(xzone >= plen) // have to reduce cross-fade length
+ xzone = plen-1;
+ znmin = smin+xzone,znmax = smax-xzone;
+ }
+ else {
+ // prefer preservation of loop length
+ znmin += o1,znmax -= o2;
+ xzone = (buf->Frames()-znmax+znmin)/2;
+ }
+ smin = 0,plen = smax = buf->Frames();
+ }
+ else if(o1 < 0) {
+ // min point is out of bounds (but enough space for mere shift)
+ I i1 = (I)o1;
+ smin -= i1,smax -= i1;
+ znmin = smin+xzone*xsymm,znmax = smax+xzone*(xsymm-1);
+ }
+ else /* o2 < 0 */ {
+ // max point is out of bounds (but enough space for mere shift)
+ I i2 = (I)o2;
+ smin += i2,smax += i2;
+ znmin = smin+xzone*xsymm,znmax = smax+xzone*(xsymm-1);
+ }
+ }
+ }
+}
+
+V xgroove::m_loop(xs_loop lp)
+{
+ loopmode = lp;
+ bidir = 1;
+ s_dsp();
+}
+
+
+V xgroove::s_pos_off(I n,S *const *invecs,S *const *outvecs)
+{
+ S *pos = outvecs[outchns];
+
+ const F oscl = scale(curpos);
+ for(I si = 0; si < n; ++si) pos[si] = oscl;
+
+ playfun(n,&pos,outvecs);
+}
+
+V xgroove::s_pos_once(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+
+ if(buf && plen > 0) {
+ register D o = curpos;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ if(o >= smax) { o = smax; lpbang = true; }
+ else if(o < smin) { o = smin; lpbang = true; }
+
+ pos[i] = scale(o);
+ o += spd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ playfun(n,&pos,outvecs);
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+V xgroove::s_pos_loop(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+
+ if(buf && plen > 0) {
+ register D o = curpos;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ // normalize offset
+ if(o >= smax) {
+ o = fmod(o-smin,plen)+smin;
+ lpbang = true;
+ }
+ else if(o < smin) {
+ o = fmod(o-smin,plen)+smax;
+ lpbang = true;
+ }
+
+ pos[i] = scale(o);
+ o += spd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ playfun(n,&pos,outvecs);
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+V xgroove::s_pos_loopzn(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ const F xz = xzone,lmin = znmin,lmax = znmax;
+ const F xf = (F)XZONE_TABLE/xz;
+
+ if(buf && plen > 0) {
+ BL inzn = false;
+ register D o = curpos;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ // normalize offset
+ if(o >= smax) {
+ o = fmod(o-smin,plen)+smin;
+ lpbang = true;
+ }
+ else if(o < smin) {
+ o = fmod(o-smin,plen)+smax;
+ lpbang = true;
+ }
+
+ if(o >= lmax) // in late cross-fade zone
+ o -= lmax-smin;
+
+ if(o < lmin) {
+ // in early cross-fade zone
+ register F inp = o-smin;
+ znidx[i] = inp*xf;
+ znpos[i] = scale(lmax+inp);
+ inzn = true;
+ }
+ else
+ znidx[i] = XZONE_TABLE,znpos[i] = 0;
+
+ pos[i] = scale(o);
+ o += spd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ playfun(n,&pos,outvecs);
+
+ if(inzn) {
+ // only if we were in cross-fade zone
+ playfun(n,&znpos,znbuf);
+
+ for(I i = 0; i < n; ++i) znpos[i] = XZONE_TABLE-znidx[i];
+ zonefun(znmul,0,XZONE_TABLE+1,1,n,1,1,&znidx,&znidx);
+ zonefun(znmul,0,XZONE_TABLE+1,1,n,1,1,&znpos,&znpos);
+
+ for(I o = 0; o < outchns; ++o) {
+ F *ov = outvecs[o],*ob = znbuf[o];
+ for(I i = 0; i < n; ++i,ov++,ob++)
+ *ov = (*ov)*znidx[i]+(*ob)*znpos[i];
+ }
+ }
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+V xgroove::s_pos_bidir(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+
+ if(buf && plen > 0) {
+ register D o = curpos;
+ register F bd = bidir;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ // normalize offset
+ if(o >= smax) {
+ o = smax-fmod(o-smin,plen); // mirror the position at smax
+ bd = -bd;
+ lpbang = true;
+ }
+ else if(o < smin) {
+ o = smin-fmod(o-smin,plen); // mirror the position at smin
+ bd = -bd;
+ lpbang = true;
+ }
+
+ pos[i] = scale(o);
+ o += spd*bd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ bidir = (I)bd;
+ playfun(n,&pos,outvecs);
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+
+V xgroove::s_dsp()
+{
+ if(doplay) {
+ switch(loopmode) {
+ case xsl_once: SETSIGFUN(posfun,SIGFUN(s_pos_once)); break;
+ case xsl_loop:
+ if(xzone > 0) {
+ const I blksz = Blocksize();
+
+ if(pblksz != blksz) {
+ for(I o = 0; o < outchns; ++o) {
+ delete[] znbuf[o];
+ znbuf[o] = new S[blksz];
+ }
+
+ delete[] znpos; znpos = new S[blksz];
+ delete[] znidx; znidx = new S[blksz];
+
+ pblksz = blksz;
+ }
+
+ SETSIGFUN(posfun,SIGFUN(s_pos_loopzn));
+
+ if(interp == xsi_4p)
+ switch(outchns) {
+ case 1: SETSTFUN(zonefun,TMPLSTF(st_play4,1,1)); break;
+ case 2: SETSTFUN(zonefun,TMPLSTF(st_play4,1,2)); break;
+ case 4: SETSTFUN(zonefun,TMPLSTF(st_play4,1,4)); break;
+ default: SETSTFUN(zonefun,TMPLSTF(st_play4,1,-1));
+ }
+ else if(interp == xsi_lin)
+ switch(outchns) {
+ case 1: SETSTFUN(zonefun,TMPLSTF(st_play2,1,1)); break;
+ case 2: SETSTFUN(zonefun,TMPLSTF(st_play2,1,2)); break;
+ case 4: SETSTFUN(zonefun,TMPLSTF(st_play2,1,4)); break;
+ default: SETSTFUN(zonefun,TMPLSTF(st_play2,1,-1));
+ }
+ else
+ switch(outchns) {
+ case 1: SETSTFUN(zonefun,TMPLSTF(st_play1,1,1)); break;
+ case 2: SETSTFUN(zonefun,TMPLSTF(st_play1,1,2)); break;
+ case 4: SETSTFUN(zonefun,TMPLSTF(st_play1,1,4)); break;
+ default: SETSTFUN(zonefun,TMPLSTF(st_play1,1,-1));
+ }
+ }
+ else
+ SETSIGFUN(posfun,SIGFUN(s_pos_loop));
+ break;
+ case xsl_bidir: SETSIGFUN(posfun,SIGFUN(s_pos_bidir)); break;
+ }
+ }
+ else
+ SETSIGFUN(posfun,SIGFUN(s_pos_off));
+ xinter::s_dsp();
+}
+
+
+
+V xgroove::m_help()
+{
+ post("%s - part of xsample objects, version " XSAMPLE_VERSION,thisName());
+#ifdef _DEBUG
+ post("compiled on " __DATE__ " " __TIME__);
+#endif
+ post("(C) Thomas Grill, 2001-2002");
+#ifdef MAXMSP
+ post("Arguments: %s [channels=1] [buffer]",thisName());
+#else
+ post("Arguments: %s [buffer]",thisName());
+#endif
+ post("Inlets: 1:Messages/Speed signal, 2:Min position, 3:Max position");
+ post("Outlets: 1:Audio signal, 2:Position signal, 3:Min position (rounded), 4:Max position (rounded)");
+ post("Methods:");
+ post("\thelp: shows this help");
+ post("\tset [name]: set buffer or reinit");
+ post("\tenable 0/1: turn dsp calculation off/on");
+ post("\treset: reset min/max playing points and playing offset");
+ post("\tprint: print current settings");
+ post("\tloop 0/1/2: sets looping to off/forward/bidirectional");
+ post("\tinterp 0/1/2: set interpolation to off/4-point/linear");
+ post("\tmin {unit}: set minimum playing point");
+ post("\tmax {unit}: set maximum playing point");
+ post("\tall: select entire buffer length");
+ post("\tpos {unit}: set playing position (obeying the current scale mode)");
+ post("\tbang/start: start playing");
+ post("\tstop: stop playing");
+ post("\trefresh: checks buffer and refreshes outlets");
+ post("\tunits 0/1/2/3: set units to frames/buffer size/ms/s");
+ post("\tsclmode 0/1/2/3: set range of position to units/units in loop/buffer/loop");
+ post("\txzone {unit}: length of loop crossfade zone");
+ post("\txsymm -1,0...1: symmetry of crossfade zone inside/outside point");
+ post("\txshape 0/1 [param 0...1]: shape of crossfading (linear/trig)");
+ post("");
+}
+
+V xgroove::m_print()
+{
+ static const C *sclmode_txt[] = {"units","units in loop","buffer","loop"};
+ static const C *interp_txt[] = {"off","4-point","linear"};
+ static const C *loop_txt[] = {"once","looping","bidir"};
+
+ // print all current settings
+ post("%s - current settings:",thisName());
+ post("bufname = '%s', length = %.3f, channels = %i",buf->Name(),(F)(buf->Frames()*s2u),buf->Channels());
+ post("out channels = %i, frames/unit = %.3f, scale mode = %s",outchns,(F)(1./s2u),sclmode_txt[sclmode]);
+ post("loop = %s, interpolation = %s",loop_txt[(I)loopmode],interp_txt[interp >= xsi_none && interp <= xsi_lin?interp:xsi_none]);
+ post("loop crossfade zone = %.3f",(F)(xzone*s2u));
+ post("");
+}
+
+#ifdef MAXMSP
+V xgroove::m_assist(long msg, long arg, char *s)
+{
+ switch(msg) {
+ case 1: //ASSIST_INLET:
+ switch(arg) {
+ case 0:
+ sprintf(s,"Signal of playing speed"); break;
+ case 1:
+ sprintf(s,"Starting point"); break;
+ case 2:
+ sprintf(s,"Ending point"); break;
+ }
+ break;
+ case 2: //ASSIST_OUTLET:
+ if(arg < outchns)
+ sprintf(s,"Audio signal channel %li",arg+1);
+ else
+ switch(arg-outchns) {
+ case 0:
+ sprintf(s,"Position currently played"); break;
+ case 1:
+ sprintf(s,"Starting point (rounded to frame)"); break;
+ case 2:
+ sprintf(s,"Ending point (rounded to frame)"); break;
+ case 3:
+ sprintf(s,"Bang on loop end/rollover"); break;
+ }
+ break;
+ }
+}
+#endif
+
+
+
+
+
diff --git a/externals/grill/xsample/source/inter.ci b/externals/grill/xsample/source/inter.ci
new file mode 100644
index 00000000..2902c386
--- /dev/null
+++ b/externals/grill/xsample/source/inter.ci
@@ -0,0 +1,355 @@
+#ifndef __INTER_H
+#define __INTER_H
+
+TMPLDEF V xinter::st_play0(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+{
+ // stopped
+ SIGCHNS(BCHNS,inchns,OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+
+ for(I ci = 0; ci < outchns; ++ci)
+ for(I si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+TMPLDEF V xinter::st_play1(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+{
+ SIGCHNS(BCHNS,inchns,OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+
+ // no interpolation
+ // ----------------
+
+ for(I i = 0; i < n; ++i,++si) {
+ register const I oint = (I)(*(pos++)/s2u);
+ register const S *fp;
+ if(oint < smin) {
+ // position < 0 ... take only 0th sample
+ fp = bdt+smin*BCHNS;
+ }
+ else if(oint >= smax) {
+ // position > last sample ... take only last sample
+ fp = bdt+(smax-1)*BCHNS;
+ }
+ else {
+ // normal
+ fp = bdt+oint*BCHNS;
+ }
+
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp[ci];
+ }
+
+ // clear rest of output channels (if buffer has less channels)
+ for(I ci = OCHNS; ci < outchns; ++ci)
+ for(si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+TMPLDEF V xinter::st_play2(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+{
+ const I plen = smax-smin; //curlen;
+ if(plen < 2) {
+ st_play1 TMPLCALL (bdt,smin,smax,s2u,n,inchns,outchns,invecs,outvecs);
+ return;
+ }
+
+ SIGCHNS(BCHNS,inchns,OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+
+ // linear interpolation
+ // --------------------
+
+ const I maxo = smax-1; // last sample in buffer
+
+ for(I i = 0; i < n; ++i,++si) {
+ const F o = *(pos++)/s2u;
+ register const I oint = (I)o;
+
+ if(oint < smin) {
+ // position is before first sample -> take the first sample
+ register const S *const fp = bdt+smin*BCHNS;
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp[ci];
+ }
+ else if(oint >= maxo) {
+ // position is past last sample -> take the last sample
+ register const S *const fp = bdt+maxo*BCHNS;
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp[ci];
+ }
+ else {
+ // normal interpolation
+ register const F frac = o-oint;
+ register const S *const fp0 = bdt+oint*BCHNS;
+ register const S *const fp1 = fp0+BCHNS;
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp0[ci]+frac*(fp1[ci]-fp0[ci]);
+ }
+ }
+
+ // clear rest of output channels (if buffer has less channels)
+ for(I ci = OCHNS; ci < outchns; ++ci)
+ for(si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+TMPLDEF V xinter::st_play4(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+{
+ const I plen = smax-smin; //curlen;
+ if(plen < 4) {
+ if(plen < 2) st_play1 TMPLCALL (bdt,smin,smax,s2u,n,inchns,outchns,invecs,outvecs);
+ else st_play2 TMPLCALL (bdt,smin,smax,s2u,n,inchns,outchns,invecs,outvecs);
+ return;
+ }
+
+ SIGCHNS(BCHNS,inchns,OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+
+ // 4-point interpolation
+ // ---------------------
+ const I maxo = smax-1; // last sample in play region
+
+ for(I i = 0; i < n; ++i,++si) {
+ F o = *(pos++)/s2u;
+ register I oint = (I)o,ointm,oint1,oint2;
+
+ if(oint <= smin) {
+ if(oint < smin) oint = smin,o = smin;
+ // position is first simple
+ ointm = smin; // first sample
+ oint1 = oint+1;
+ oint2 = oint1+1;
+ }
+ else if(oint >= maxo-2) {
+ if(oint > maxo) oint = maxo,o = smax;
+ ointm = oint-1;
+ oint1 = oint >= maxo?maxo:oint+1;
+ oint2 = oint1 >= maxo?maxo:oint1+1;
+ }
+ else {
+ ointm = oint-1;
+ oint1 = oint+1;
+ oint2 = oint1+1;
+ }
+
+ register F frac = o-oint;
+
+ register const S *fa = bdt+ointm*BCHNS;
+ register const S *fb = bdt+oint*BCHNS;
+ register const S *fc = bdt+oint1*BCHNS;
+ register const S *fd = bdt+oint2*BCHNS;
+
+ for(I ci = 0; ci < OCHNS; ++ci) {
+ const F cmb = fc[ci]-fb[ci];
+ sig[ci][si] = fb[ci] + frac*(
+ cmb - 0.5f*(frac-1.) * ((fa[ci]-fd[ci]+3.0f*cmb)*frac + (fb[ci]-fa[ci]-cmb))
+ );
+ }
+ }
+
+ // clear rest of output channels (if buffer has less channels)
+ for(I ci = OCHNS; ci < outchns; ++ci)
+ for(si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+#if 0
+
+TMPLDEF V xinter::s_play0(I n,S *const *invecs,S *const *outvecs)
+{
+ // stopped
+ SIGCHNS(BCHNS,buf->Channels(),OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+
+ for(I ci = 0; ci < outchns; ++ci)
+ for(I si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+TMPLDEF V xinter::s_play4(I n,S *const *invecs,S *const *outvecs)
+{
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ if(plen < 4) {
+ if(plen < 2) s_play1 TMPLCALL (n,invecs,outvecs);
+ else s_play2 TMPLCALL (n,invecs,outvecs);
+ return;
+ }
+
+ SIGCHNS(BCHNS,buf->Channels(),OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+ const S *bdt = buf->Data();
+
+ // 4-point interpolation
+ // ---------------------
+ const I maxo = smax-1; // last sample in play region
+
+ for(I i = 0; i < n; ++i,++si) {
+ F o = *(pos++)/s2u;
+ register I oint = (I)o,ointm,oint1,oint2;
+
+ if(oint <= smin) {
+ if(oint < smin) oint = smin,o = smin;
+ // position is first simple
+ ointm = smin; // first sample
+ oint1 = oint+1;
+ oint2 = oint1+1;
+ }
+ else if(oint >= maxo-2) {
+ if(oint > maxo) oint = maxo,o = smax;
+ ointm = oint-1;
+ oint1 = oint >= maxo?maxo:oint+1;
+ oint2 = oint1 >= maxo?maxo:oint1+1;
+ }
+ else {
+ ointm = oint-1;
+ oint1 = oint+1;
+ oint2 = oint1+1;
+ }
+
+ register F frac = o-oint;
+
+ register const S *fa = bdt+ointm*BCHNS;
+ register const S *fb = bdt+oint*BCHNS;
+ register const S *fc = bdt+oint1*BCHNS;
+ register const S *fd = bdt+oint2*BCHNS;
+
+ for(I ci = 0; ci < OCHNS; ++ci) {
+ const F cmb = fc[ci]-fb[ci];
+ sig[ci][si] = fb[ci] + frac*(
+ cmb - 0.5f*(frac-1.) * ((fa[ci]-fd[ci]+3.0f*cmb)*frac + (fb[ci]-fa[ci]-cmb))
+ );
+ }
+ }
+
+ // clear rest of output channels (if buffer has less channels)
+ for(I ci = OCHNS; ci < outchns; ++ci)
+ for(si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+TMPLDEF V xinter::s_play2(I n,S *const *invecs,S *const *outvecs)
+{
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ if(plen < 2) {
+ s_play1 TMPLCALL (n,invecs,outvecs);
+ return;
+ }
+
+ SIGCHNS(BCHNS,buf->Channels(),OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+
+ // linear interpolation
+ // --------------------
+
+ const I maxo = smax-1; // last sample in buffer
+ const S *bdt = buf->Data();
+
+ for(I i = 0; i < n; ++i,++si) {
+ const F o = *(pos++)/s2u;
+ register const I oint = (I)o;
+
+ if(oint < smin) {
+ // position is before first sample -> take the first sample
+ register const S *const fp = bdt+smin*BCHNS;
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp[ci];
+ }
+ else if(oint >= maxo) {
+ // position is past last sample -> take the last sample
+ register const S *const fp = bdt+maxo*BCHNS;
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp[ci];
+ }
+ else {
+ // normal interpolation
+ register const F frac = o-oint;
+ register const S *const fp0 = bdt+oint*BCHNS;
+ register const S *const fp1 = fp0+BCHNS;
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp0[ci]+frac*(fp1[ci]-fp0[ci]);
+ }
+ }
+
+ // clear rest of output channels (if buffer has less channels)
+ for(I ci = OCHNS; ci < outchns; ++ci)
+ for(si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+TMPLDEF V xinter::s_play1(I n,S *const *invecs,S *const *outvecs)
+{
+ SIGCHNS(BCHNS,buf->Channels(),OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+ const I smin = curmin,smax = curmax;
+ const S *bdt = buf->Data();
+
+ // no interpolation
+ // ----------------
+
+ for(I i = 0; i < n; ++i,++si) {
+ register const I oint = (I)(*(pos++)/s2u);
+ register const S *fp;
+ if(oint < smin) {
+ // position < 0 ... take only 0th sample
+ fp = bdt+smin*BCHNS;
+ }
+ else if(oint >= smax) {
+ // position > last sample ... take only last sample
+ fp = bdt+(smax-1)*BCHNS;
+ }
+ else {
+ // normal
+ fp = bdt+oint*BCHNS;
+ }
+
+ for(I ci = 0; ci < OCHNS; ++ci)
+ sig[ci][si] = fp[ci];
+ }
+
+ // clear rest of output channels (if buffer has less channels)
+ for(I ci = OCHNS; ci < outchns; ++ci)
+ for(si = 0; si < n; ++si) sig[ci][si] = 0;
+}
+
+#else
+
+TMPLDEF V xinter::s_play0(I n,S *const *invecs,S *const *outvecs)
+{
+ st_play0 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs);
+}
+
+TMPLDEF V xinter::s_play1(I n,S *const *invecs,S *const *outvecs)
+{
+ st_play1 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs);
+}
+
+TMPLDEF V xinter::s_play2(I n,S *const *invecs,S *const *outvecs)
+{
+ st_play2 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs);
+}
+
+TMPLDEF V xinter::s_play4(I n,S *const *invecs,S *const *outvecs)
+{
+ st_play4 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs);
+}
+
+#endif
+
+
+#endif
diff --git a/externals/grill/xsample/source/inter.cpp b/externals/grill/xsample/source/inter.cpp
new file mode 100644
index 00000000..095fba6f
--- /dev/null
+++ b/externals/grill/xsample/source/inter.cpp
@@ -0,0 +1,95 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#include "main.h"
+#include <math.h>
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+#ifndef TMPLOPT
+#include "inter.ci"
+#endif
+
+
+xinter::xinter():
+ doplay(false),outchns(1),
+ interp(xsi_4p)
+{
+ FLEXT_ADDMETHOD_E(0,"interp",m_interp);
+}
+
+I xinter::m_set(I argc,t_atom *argv)
+{
+ I r = xsample::m_set(argc,argv);
+ if(r < 0) m_reset(); // resets pos/min/max
+ if(r != 0) m_units();
+ return r;
+}
+
+V xinter::m_start()
+{
+ m_refresh();
+ doplay = true;
+ s_dsp();
+}
+
+V xinter::m_stop()
+{
+ doplay = false;
+ s_dsp();
+}
+
+V xinter::s_dsp()
+{
+ if(doplay) {
+ if(interp == xsi_4p)
+ switch(buf->Channels()*1000+outchns) {
+ case 1001: SETSIGFUN(playfun,TMPLFUN(s_play4,1,1)); break;
+ case 1002: SETSIGFUN(playfun,TMPLFUN(s_play4,1,2)); break;
+ case 2001: SETSIGFUN(playfun,TMPLFUN(s_play4,2,1)); break;
+ case 2002: SETSIGFUN(playfun,TMPLFUN(s_play4,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(playfun,TMPLFUN(s_play4,4,-1)); break;
+ case 4004: SETSIGFUN(playfun,TMPLFUN(s_play4,4,4)); break;
+ default: SETSIGFUN(playfun,TMPLFUN(s_play4,-1,-1));
+ }
+ else if(interp == xsi_lin)
+ switch(buf->Channels()*1000+outchns) {
+ case 1001: SETSIGFUN(playfun,TMPLFUN(s_play2,1,1)); break;
+ case 1002: SETSIGFUN(playfun,TMPLFUN(s_play2,1,2)); break;
+ case 2001: SETSIGFUN(playfun,TMPLFUN(s_play2,2,1)); break;
+ case 2002: SETSIGFUN(playfun,TMPLFUN(s_play2,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(playfun,TMPLFUN(s_play2,4,-1)); break;
+ case 4004: SETSIGFUN(playfun,TMPLFUN(s_play2,4,4)); break;
+ default: SETSIGFUN(playfun,TMPLFUN(s_play2,-1,-1));
+ }
+ else
+ switch(buf->Channels()*1000+outchns) {
+ case 1001: SETSIGFUN(playfun,TMPLFUN(s_play1,1,1)); break;
+ case 1002: SETSIGFUN(playfun,TMPLFUN(s_play1,1,2)); break;
+ case 2001: SETSIGFUN(playfun,TMPLFUN(s_play1,2,1)); break;
+ case 2002: SETSIGFUN(playfun,TMPLFUN(s_play1,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(playfun,TMPLFUN(s_play1,4,-1)); break;
+ case 4004: SETSIGFUN(playfun,TMPLFUN(s_play1,4,4)); break;
+ default: SETSIGFUN(playfun,TMPLFUN(s_play1,-1,-1));
+ }
+ }
+ else
+ SETSIGFUN(playfun,TMPLFUN(s_play0,-1,-1));
+}
+
+
diff --git a/externals/grill/xsample/source/main.cpp b/externals/grill/xsample/source/main.cpp
new file mode 100644
index 00000000..410746ff
--- /dev/null
+++ b/externals/grill/xsample/source/main.cpp
@@ -0,0 +1,203 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#include "main.h"
+
+
+// Initialization function for xsample library
+V lib_setup()
+{
+ post("xsample objects, version " XSAMPLE_VERSION ", (C)2001,2002 Thomas Grill");
+ post("xsample: xrecord~, xplay~, xgroove~ - send objects a 'help' message to get assistance");
+ post("");
+
+ // call the objects' setup routines
+ FLEXT_DSP_SETUP(xrecord);
+ FLEXT_DSP_SETUP(xplay);
+ FLEXT_DSP_SETUP(xgroove);
+
+#ifdef MAXMSP
+ // That's not the right place..... (doesn't work)
+ finder_addclass((char *)"MSP Sampling",(char *)"xgroove~");
+ finder_addclass((char *)"MSP Sampling",(char *)"xplay~");
+ finder_addclass((char *)"MSP Sampling",(char *)"xrecord~");
+#endif
+
+}
+
+// setup the library
+FLEXT_LIB_SETUP(xsample,lib_setup)
+
+// ------------------------------
+
+xsample::xsample():
+ buf(NULL),
+#ifdef PD
+ unitmode(xsu_sample), // PD defaults to samples
+#else
+ unitmode(xsu_ms), // Max/MSP defaults to milliseconds
+#endif
+ sclmode(xss_unitsinbuf),
+ curmin(0),curmax(1<<30)
+{
+ FLEXT_ADDBANG(0,m_start);
+ FLEXT_ADDMETHOD_(0,"start",m_start);
+ FLEXT_ADDMETHOD_(0,"stop",m_stop);
+
+ FLEXT_ADDMETHOD_(0,"set",m_set);
+ FLEXT_ADDMETHOD_(0,"print",m_print);
+ FLEXT_ADDMETHOD_(0,"refresh",m_refresh);
+ FLEXT_ADDMETHOD_(0,"reset",m_reset);
+
+ FLEXT_ADDMETHOD_E(0,"units",m_units);
+ FLEXT_ADDMETHOD_E(0,"sclmode",m_sclmode);
+}
+
+xsample::~xsample()
+{
+// m_enable(false); // switch off DSP
+
+ if(buf) delete buf;
+}
+
+
+
+I xsample::m_set(I argc, t_atom *argv)
+{
+ return buf->Set(argc >= 1?GetASymbol(argv[0]):NULL);
+}
+
+BL xsample::m_refresh()
+{
+// bufchk();
+
+ BL ret;
+ if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
+ else ret = false;
+
+ m_min((F)curmin*s2u); // also checks pos
+ m_max((F)curmax*s2u); // also checks pos
+
+ return ret;
+}
+
+BL xsample::m_reset()
+{
+// bufchk();
+
+ BL ret;
+ if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
+ else ret = false;
+
+ m_units();
+ m_sclmode();
+ m_min(0);
+ m_max(buf->Frames()*s2u);
+
+ return ret;
+}
+
+V xsample::m_loadbang()
+{
+ m_reset();
+}
+
+V xsample::m_units(xs_unit mode)
+{
+ bufchk();
+
+ if(mode != xsu__) unitmode = mode;
+ switch(unitmode) {
+ case xsu_sample: // samples
+ s2u = 1;
+ break;
+ case xsu_buffer: // buffer size
+ s2u = 1.f/buf->Frames();
+ break;
+ case xsu_ms: // ms
+ s2u = 1000.f/Samplerate();
+ break;
+ case xsu_s: // s
+ s2u = 1.f/Samplerate();
+ break;
+ default:
+ post("%s: Unknown unit mode",thisName());
+ }
+}
+
+V xsample::m_sclmode(xs_sclmd mode)
+{
+ bufchk();
+
+ if(mode != xss__) sclmode = mode;
+ switch(sclmode) {
+ case 0: // samples/units
+ sclmin = 0; sclmul = s2u;
+ break;
+ case 1: // samples/units from recmin to recmax
+ sclmin = curmin; sclmul = s2u;
+ break;
+ case 2: // unity between 0 and buffer size
+ sclmin = 0; sclmul = buf->Frames()?1.f/buf->Frames():0;
+ break;
+ case 3: // unity between recmin and recmax
+// sclmin = curmin; sclmul = curlen?1.f/curlen:0;
+ sclmin = curmin; sclmul = curmin != curmax?1.f/(curmax-curmin):0;
+ break;
+ default:
+ post("%s: Unknown scale mode",thisName());
+ }
+}
+
+V xsample::m_min(F mn)
+{
+ bufchk();
+
+ mn /= s2u; // conversion to samples
+ if(mn < 0) mn = 0;
+ else if(mn > curmax) mn = (F)curmax;
+ curmin = (I)(mn+.5);
+// curlen = curmax-curmin;
+
+ m_sclmode();
+}
+
+V xsample::m_max(F mx)
+{
+ bufchk();
+
+ mx /= s2u; // conversion to samples
+ if(mx > buf->Frames()) mx = (F)buf->Frames();
+ else if(mx < curmin) mx = (F)curmin;
+ curmax = (I)(mx+.5);
+// curlen = curmax-curmin;
+
+ m_sclmode();
+}
+
+V xsample::m_all()
+{
+ bufchk();
+
+// curlen = (curmax = buf->Frames())-(curmin = 0);
+ curmin = 0; curmax = buf->Frames();
+ m_sclmode();
+}
+
+V xsample::m_dsp(I /*n*/,S *const * /*insigs*/,S *const * /*outsigs*/)
+{
+ // this is hopefully called at change of sample rate ?!
+
+ if(!m_refresh()) s_dsp();
+}
+
+
+
+
diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h
new file mode 100644
index 00000000..db78a630
--- /dev/null
+++ b/externals/grill/xsample/source/main.h
@@ -0,0 +1,277 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#ifndef __XSAMPLE_H
+#define __XSAMPLE_H
+
+#define XSAMPLE_VERSION "0.2.5pre1"
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
+#error You need at least flext version 0.4.0
+#endif
+
+
+// most compilers are somehow broken.....
+// in other words: can't handle all C++ features
+
+#if defined(_MSC_VER)
+// MS VC 6.0 can't handle <int,int> templates?! -> no optimization
+// #define TMPLOPT
+#elif defined(__BORLANDC__)
+// handles all optimizations
+ #define TMPLOPT
+#elif defined(__GNUC__)
+// GNUC 2.95.2 dies at compile with <int,int> templates
+#if __GNUC__ >= 3
+ #define TMPLOPT // only workable with gcc >= 3.0
+#endif
+#elif defined(__MWERKS__)
+// CodeWarrior can't take address of a template member function
+ #define TMPLOPT
+ #define SIGSTATIC
+#elif defined(__MRC__)
+// Apple MPW - MrCpp
+// #define TMPLOPT // template optimation for more speed
+#else
+// another compiler
+// #define TMPLOPT // template optimation for more speed (about 10%)
+ //#define SIGSTATIC // another redirection to avoid addresses of class member functions
+#endif
+
+
+// lazy me
+#define F float
+#define D double
+#define I int
+#define L long
+#define C char
+#define V void
+#define BL bool
+#define S t_sample
+
+
+class xsample:
+ public flext_dsp
+{
+ FLEXT_HEADER(xsample,flext_dsp)
+
+public:
+ xsample();
+ ~xsample();
+
+ enum xs_unit {
+ xsu__ = -1, // don't change
+ xsu_sample = 0,xsu_buffer,xsu_ms,xsu_s
+ };
+
+ enum xs_intp {
+ xsi__ = -1, // don't change
+ xsi_none = 0,xsi_4p,xsi_lin
+ };
+
+ enum xs_sclmd {
+ xss__ = -1, // don't change
+ xss_unitsinbuf = 0,xss_unitsinloop,xss_buffer,xss_loop
+ };
+
+protected:
+ buffer *buf;
+
+ virtual V m_start() = 0;
+ virtual V m_stop() = 0;
+ virtual BL m_reset();
+
+ virtual I m_set(I argc,t_atom *argv);
+ virtual V m_print() = 0;
+ virtual BL m_refresh();
+ virtual V m_loadbang();
+
+ virtual V m_units(xs_unit u = xsu__);
+ virtual V m_sclmode(xs_sclmd u = xss__);
+
+ virtual V m_all();
+ virtual V m_min(F mn);
+ virtual V m_max(F mx);
+
+ virtual V m_dsp(I n,F *const *insigs,F *const *outsigs);
+ virtual V s_dsp() = 0;
+
+ xs_unit unitmode; //iunitmode,ounitmode;
+ xs_sclmd sclmode; //isclmode,osclmode;
+
+ I curmin,curmax; //,curlen; // in samples
+ I sclmin; // in samples
+ F sclmul;
+ F s2u; // sample to unit conversion factor
+
+ inline F scale(F smp) const { return (smp-sclmin)*sclmul; }
+
+ BL bufchk() { if(buf->Update()) { m_refresh(); return true; } return false; }
+
+private:
+
+ FLEXT_CALLBACK(m_start)
+ FLEXT_CALLBACK(m_stop)
+
+ FLEXT_CALLBACK_V(m_set)
+ FLEXT_CALLBACK(m_print)
+ FLEXT_CALLBACK(m_refresh)
+ FLEXT_CALLBACK(m_reset)
+
+ FLEXT_CALLBACK_1(m_units,xs_unit)
+ FLEXT_CALLBACK_1(m_sclmode,xs_sclmd)
+};
+
+
+// defines which are used in the derived classes
+#ifdef SIGSTATIC
+ #ifdef TMPLOPT
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::st_##FUN<BCHNS,IOCHNS>
+ #define TMPLSTF(FUN,BCHNS,IOCHNS) &thisType::FUN<BCHNS,IOCHNS>
+ #define SIGFUN(FUN) &thisType::st_##FUN
+ #define TMPLDEF template <int _BCHNS_,int _IOCHNS_>
+ #define TMPLCALL <_BCHNS_,_IOCHNS_>
+ #else
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::st_##FUN
+ #define TMPLSTF(FUN,BCHNS,IOCHNS) &thisType::FUN
+ #define SIGFUN(FUN) &thisType::st_##FUN
+ #define TMPLDEF
+ #define TMPLCALL
+ #endif
+
+ #define DEFSIGFUN(NAME) \
+ static V st_##NAME(thisType *obj,I n,S *const *in,S *const *out) { obj->NAME (n,in,out); } \
+ V NAME(I n,S *const *in,S *const *out)
+
+ #define TMPLSIGFUN(NAME) \
+ TMPLDEF static V st_##NAME(thisType *obj,I n,S *const *in,S *const *out) { obj->NAME TMPLCALL (n,in,out); } \
+ TMPLDEF V NAME(I n,S *const *in,S *const *out)
+
+ #define TMPLSTFUN(NAME) TMPLDEF static V NAME(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+
+ #define SETSIGFUN(VAR,FUN) v_##VAR = FUN
+
+ #define SETSTFUN(VAR,FUN) VAR = FUN
+
+ #define DEFSIGCALL(NAME) \
+ inline V NAME(I n,S *const *in,S *const *out) { (*v_##NAME)(this,n,in,out); } \
+ V (*v_##NAME)(thisType *obj,I n,S *const *in,S *const *out)
+
+ #define DEFSTCALL(NAME) \
+ V (*NAME)(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+
+#else
+ #ifdef TMPLOPT
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::FUN<BCHNS,IOCHNS>
+ #define SIGFUN(FUN) &thisType::FUN
+ #define TMPLDEF template <int _BCHNS_,int _IOCHNS_>
+ #define TMPLCALL <_BCHNS_,_IOCHNS_>
+ #else
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::FUN
+ #define SIGFUN(FUN) &thisType::FUN
+ #define TMPLDEF
+ #define TMPLCALL
+ #endif
+
+ #define TMPLSTF(FUN,BCHNS,IOCHNS) TMPLFUN(FUN,BCHNS,IOCHNS)
+
+ #define DEFSIGFUN(NAME) V NAME(I n,S *const *in,S *const *out)
+ #define TMPLSIGFUN(NAME) TMPLDEF V NAME(I n,S *const *in,S *const *out)
+ #define TMPLSTFUN(NAME) TMPLDEF static V NAME(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+
+ #define SETSIGFUN(VAR,FUN) v_##VAR = FUN
+
+ #define DEFSIGCALL(NAME) \
+ inline V NAME(I n,S *const *in,S *const *out) { (this->*v_##NAME)(n,in,out); } \
+ V (thisType::*v_##NAME)(I n,S *const *invecs,S *const *outvecs)
+
+ #define SETSTFUN(VAR,FUN) VAR = FUN
+
+ #define DEFSTCALL(NAME) \
+ V (*NAME)(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs)
+#endif
+
+
+
+
+
+#ifndef MIN
+#define MIN(x,y) ((x) < (y)?(x):(y))
+#endif
+
+// in the signal functions
+#ifdef TMPLOPT
+ // optimization by using constants for channel numbers
+ #define SIGCHNS(BCHNS,bchns,IOCHNS,iochns) \
+ const I BCHNS = _BCHNS_ < 0?(bchns):_BCHNS_; \
+ const I IOCHNS = _IOCHNS_ < 0?MIN(iochns,BCHNS):MIN(_IOCHNS_,BCHNS)
+#else
+ // no template optimization
+ #ifdef PD // only mono buffers
+ #define SIGCHNS(BCHNS,bchns,IOCHNS,iochns) \
+ const I BCHNS = 1; \
+ const I IOCHNS = MIN(iochns,BCHNS)
+ #else // MAXMSP
+ #define SIGCHNS(BCHNS,bchns,IOCHNS,iochns) \
+ const I BCHNS = bchns; \
+ const I IOCHNS = MIN(iochns,BCHNS)
+ #endif
+#endif
+
+
+class xinter:
+ public xsample
+{
+ FLEXT_HEADER(xinter,xsample)
+
+public:
+ xinter();
+
+protected:
+ virtual I m_set(I argc,t_atom *argv);
+
+ virtual V m_start();
+ virtual V m_stop();
+
+ V m_interp(xs_intp mode = xsi__) { interp = mode; s_dsp(); }
+
+ I outchns;
+ BL doplay;
+ xs_intp interp;
+
+ TMPLSIGFUN(s_play0);
+ TMPLSIGFUN(s_play1);
+ TMPLSIGFUN(s_play2);
+ TMPLSIGFUN(s_play4);
+
+ TMPLSTFUN(st_play0);
+ TMPLSTFUN(st_play1);
+ TMPLSTFUN(st_play2);
+ TMPLSTFUN(st_play4);
+
+ DEFSIGCALL(playfun);
+
+ virtual V s_dsp();
+
+private:
+
+ FLEXT_CALLBACK_1(m_interp,xs_intp)
+};
+
+#ifdef TMPLOPT
+#include "inter.ci"
+#endif
+
+#endif
+
+
diff --git a/externals/grill/xsample/source/makefile.bcc b/externals/grill/xsample/source/makefile.bcc
new file mode 100644
index 00000000..e9e624b2
--- /dev/null
+++ b/externals/grill/xsample/source/makefile.bcc
@@ -0,0 +1,74 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for BorlandC++
+#
+# usage: make -f makefile.bcc
+#
+# ---------------------------------------------
+
+NAME=xsample
+SETUPFUNCTION=$(NAME)_setup
+
+# where to put the build
+OUTPATH=..\bcc
+
+# flext stuff
+FLEXTPATH=..\..\flext ### EDIT! ##
+TARGET=pdwin
+
+# paths
+BCCPATH=c:\programme\prog\bcc55 ### EDIT! ##
+PDPATH=c:\programme\audio\pd ### EDIT! ##
+
+# includes, libs
+INCPATH=-I$(BCCPATH)\include -I$(PDPATH)\src -I$(FLEXTPATH)\source
+LIBPATH=-L$(BCCPATH)\lib -L$(PDPATH)\lib
+LIBS=cw32.lib import32.lib C0D32.OBJ
+
+# compiler definitions and flags
+DEFS=-DPD -DNT
+CFLAGS=-6 -O2 -OS -ff -tWD
+
+
+# the rest can stay untouched
+# ----------------------------------------------
+
+# all the source files from the package
+SRCS= main.cpp inter.cpp record.cpp play.cpp groove.cpp
+HDRS= main.h inter.ci
+
+OBJS= $(SRCS:.cpp=.obj)
+
+# default target
+all: $(OUTPATH)\$(NAME).dll
+
+# remove build
+clean:
+ -del /s /q $(OUTPATH) > nul
+ rmdir $(OUTPATH)
+
+# ----------------------------------------------
+
+$(SRCS): $(HDRS)
+ -touch $<
+
+.PATH.OBJ=$(OUTPATH)
+
+.cpp.obj:
+ bcc32 -c $(CFLAGS) $(DEFS) $(INCPATH) -n$(OUTPATH) $<
+
+$(OUTPATH):
+ -@if not exist $< mkdir $<
+
+$(OUTPATH)\pd.lib: $(PDPATH)\bin\pd.dll
+ implib -a $@ $**
+
+$(OUTPATH)\$(NAME).def:
+ @echo EXPORTS $(SETUPFUNCTION) = _$(SETUPFUNCTION) > $<
+
+$(OUTPATH)\$(NAME).dll :: $(OUTPATH) $(OUTPATH)\$(NAME).def $(OUTPATH)\pd.lib
+
+$(OUTPATH)\$(NAME).dll :: $(OBJS)
+ ilink32 -C -Tpd $(LIBPATH) $** ,$<,,$(LIBS) $(OUTPATH)\pd.lib $(FLEXTPATH)\pd-bcc\flext-$(TARGET).lib,$(OUTPATH)\$(NAME).def
+
diff --git a/externals/grill/xsample/source/makefile.pd-cygwin b/externals/grill/xsample/source/makefile.pd-cygwin
new file mode 100644
index 00000000..18c53431
--- /dev/null
+++ b/externals/grill/xsample/source/makefile.pd-cygwin
@@ -0,0 +1,89 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for gcc @ linux
+#
+# usage:
+# to build run "make -f makefile.pd-cygwin"
+# to install (as root), do "make -f makefile.pd-cygwin install"
+#
+
+## EDIT ZONE ##################################
+
+# flext path
+FLEXTPATH=../../flext
+
+# pd path
+PDPATH=c:/programme/audio/pd
+
+# where to install
+INSTDIR=c:/programme/audio/pd/extra
+
+###############################################
+
+FLEXTLIB=$(FLEXTPATH)/pd-cygwin/flext.lib
+
+# where to build (temporary)
+TARGDIR=../pd-cygwin
+
+# compiler stuff
+INCLUDES=$(PDPATH)/src
+LIBPATH=$(PDPATH)/bin
+FLAGS=-DPD
+CFLAGS=-O6 -mcpu=pentiumpro -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions
+LIBS=m pd
+
+# ----------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+
+NAME=xsample
+
+# all the source files from the package
+SRCS=main.cpp inter.cpp play.cpp record.cpp groove.cpp
+HDRS=main.h
+
+MAKEFILE=makefile.pd-cygwin
+TARGET=$(TARGDIR)/$(NAME).dll
+
+# default target
+all: $(TARGDIR) $(TARGET)
+
+$(SRCS): $(HDRS) $(MAKEFILE)
+ touch $@
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(TARGDIR)/%.o : %.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $(patsubst %,-L%,$(LIBPATH)) $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+$(INSTDIR):
+ mkdir $(INSTDIR)
+
+install:: $(INSTDIR)
+
+install:: $(TARGET)
+ cp $^ $(INSTDIR)
+ chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^))
+
+.PHONY: clean
+clean:
+ rm -f $(TARGDIR)/*.o $(TARGET)
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/externals/grill/xsample/source/makefile.pd-linux b/externals/grill/xsample/source/makefile.pd-linux
new file mode 100644
index 00000000..863a0068
--- /dev/null
+++ b/externals/grill/xsample/source/makefile.pd-linux
@@ -0,0 +1,89 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for gcc @ linux
+#
+# usage:
+# to build run "make -f makefile.pd-linux"
+# to install (as root), do "make -f makefile.pd-linux install"
+#
+
+## EDIT ZONE ##################################
+
+# flext path
+FLEXTPATH=/usr/local/lib/pd/flext
+
+# pd path
+#PDPATH=/usr/local/lib/pd/include
+
+# where to install
+INSTDIR=/usr/local/lib/pd/extra
+
+###############################################
+
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+# where to build (temporary)
+TARGDIR=../pd-linux
+
+# compiler stuff
+CXX=g++-3.2
+INCLUDES=$(PDPATH)
+FLAGS=-DPD
+CFLAGS=-O6 -mcpu=pentiumpro -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions
+LIBS=m
+
+# ----------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+
+NAME=xsample
+
+# all the source files from the package
+SRCS=main.cpp inter.cpp play.cpp record.cpp groove.cpp
+HDRS=main.h
+
+MAKEFILE=makefile.pd-linux
+TARGET=$(TARGDIR)/$(NAME).pd_linux
+
+# default target
+all: $(TARGDIR) $(TARGET)
+
+$(SRCS): $(HDRS) $(MAKEFILE)
+ touch $@
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(TARGDIR)/%.o : %.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+$(INSTDIR):
+ mkdir $(INSTDIR)
+
+install:: $(INSTDIR)
+
+install:: $(TARGET)
+ cp $^ $(INSTDIR)
+ chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^))
+
+.PHONY: clean
+clean:
+ rm -f $(TARGDIR)/*.o $(TARGET)
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/externals/grill/xsample/source/play.cpp b/externals/grill/xsample/source/play.cpp
new file mode 100644
index 00000000..827d88de
--- /dev/null
+++ b/externals/grill/xsample/source/play.cpp
@@ -0,0 +1,160 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#include "main.h"
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+
+class xplay:
+ public xinter
+{
+// FLEXT_HEADER_S(xplay,xinter,setup)
+ FLEXT_HEADER(xplay,xinter)
+
+public:
+ xplay(I argc, t_atom *argv);
+
+ virtual BL Init();
+
+#ifdef MAXMSP
+ virtual V m_assist(L msg,L arg,C *s);
+#endif
+
+ virtual V m_help();
+ virtual V m_print();
+
+private:
+// static V setup(t_class *c);
+
+ virtual V m_signal(I n,S *const *in,S *const *out)
+ {
+ bufchk();
+ playfun(n,in,out);
+ }
+};
+
+FLEXT_LIB_DSP_V("xplay~",xplay)
+
+/*
+V xplay::setup(t_class *)
+{
+#ifndef PD
+ post("loaded xplay~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
+#endif
+}
+*/
+
+xplay::xplay(I argc, t_atom *argv)
+{
+ I argi = 0;
+#ifdef MAXMSP
+ if(argc > argi && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ }
+#endif
+
+ if(argc > argi && IsSymbol(argv[argi])) {
+ buf = new buffer(GetSymbol(argv[argi]),true);
+ argi++;
+
+#ifdef MAXMSP
+ // oldstyle command line?
+ if(argi == 1 && argc == 2 && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ post("%s: old style command line detected - please change to '%s [channels] [buffer]'",thisName(),thisName());
+ }
+#endif
+ }
+ else
+ buf = new buffer(NULL,true);
+
+ AddInSignal(); // pos signal
+ AddOutSignal(outchns);
+
+ m_reset();
+}
+
+BL xplay::Init()
+{
+ if(xinter::Init()) {
+ m_reset();
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+V xplay::m_help()
+{
+ post("%s - part of xsample objects, version " XSAMPLE_VERSION,thisName());
+#ifdef _DEBUG
+ post("compiled on " __DATE__ " " __TIME__);
+#endif
+ post("(C) Thomas Grill, 2001-2002");
+#ifdef MAXMSP
+ post("Arguments: %s [channels=1] [buffer]",thisName());
+#else
+ post("Arguments: %s [buffer]",thisName());
+#endif
+ post("Inlets: 1:Messages/Position signal");
+ post("Outlets: 1:Audio signal");
+ post("Methods:");
+ post("\thelp: shows this help");
+ post("\tset name: set buffer");
+ post("\tenable 0/1: turn dsp calculation off/on");
+ post("\tprint: print current settings");
+ post("\tbang/start: begin playing");
+ post("\tstop: stop playing");
+ post("\treset: checks buffer");
+ post("\trefresh: checks buffer and refreshes outlets");
+ post("\tunits 0/1/2/3: set units to samples/buffer size/ms/s");
+ post("\tinterp 0/1/2: set interpolation to off/4-point/linear");
+ post("");
+}
+
+V xplay::m_print()
+{
+ const C *interp_txt[] = {"off","4-point","linear"};
+ // print all current settings
+ post("%s - current settings:",thisName());
+ post("bufname = '%s', length = %.3f, channels = %i",buf->Name(),(F)(buf->Frames()*s2u),buf->Channels());
+ post("out channels = %i, samples/unit = %.3f, interpolation = %s",outchns,(F)(1./s2u),interp_txt[interp >= xsi_none && interp <= xsi_lin?interp:xsi_none]);
+ post("");
+}
+
+
+#ifdef MAXMSP
+V xplay::m_assist(L msg,L arg,C *s)
+{
+ switch(msg) {
+ case 1: //ASSIST_INLET:
+ switch(arg) {
+ case 0:
+ sprintf(s,"Messages and Signal of playing position"); break;
+ }
+ break;
+ case 2: //ASSIST_OUTLET:
+ if(arg < outchns)
+ sprintf(s,"Audio signal channel %li",arg+1);
+ break;
+ }
+}
+#endif
+
+
+
+
diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp
new file mode 100644
index 00000000..cc3543a3
--- /dev/null
+++ b/externals/grill/xsample/source/record.cpp
@@ -0,0 +1,506 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#include "main.h"
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+
+class xrecord:
+ public xsample
+{
+// FLEXT_HEADER_S(xrecord,xsample,setup)
+ FLEXT_HEADER(xrecord,xsample)
+
+public:
+ xrecord(I argc,t_atom *argv);
+
+ virtual BL Init();
+
+#ifdef MAXMSP
+ virtual V m_assist(L msg,L arg,C *s);
+#endif
+
+ virtual V m_help();
+ virtual V m_print();
+
+ virtual I m_set(I argc,t_atom *argv);
+
+ virtual V m_pos(F pos);
+ virtual V m_all();
+ virtual V m_start();
+ virtual V m_stop();
+
+ virtual BL m_reset();
+
+ virtual V m_units(xs_unit md = xsu__);
+ virtual V m_min(F mn);
+ virtual V m_max(F mx);
+
+ virtual V m_mixmode(BL mx) { mixmode = mx; }
+ virtual V m_sigmode(BL mode) { /*dorec =*/ sigmode = mode; }
+ virtual V m_loop(BL lp) { doloop = lp; }
+ virtual V m_append(BL app) { if(!(appmode = app)) m_pos(0); }
+
+ virtual V m_draw(I argc,t_atom *argv);
+
+protected:
+ I inchns;
+ BL sigmode,appmode;
+ F drintv;
+
+ BL dorec,doloop,mixmode;
+ L curpos; // in samples
+
+ outlet *outmin,*outmax; // float outlets
+
+ V outputmin() { ToOutFloat(outmin,curmin*s2u); }
+ V outputmax() { ToOutFloat(outmax,curmax*s2u); }
+
+private:
+// static V setup(t_class *c);
+
+ virtual V s_dsp();
+
+ TMPLSIGFUN(s_rec);
+
+ DEFSIGCALL(recfun);
+ virtual V m_signal(I n,S *const *in,S *const *out)
+ {
+ bufchk();
+ recfun(n,in,out);
+ }
+
+ FLEXT_CALLBACK_F(m_pos)
+ FLEXT_CALLBACK(m_all)
+ FLEXT_CALLBACK_F(m_min)
+ FLEXT_CALLBACK_F(m_max)
+
+ FLEXT_CALLBACK_B(m_loop)
+ FLEXT_CALLBACK_B(m_mixmode)
+ FLEXT_CALLBACK_B(m_sigmode)
+ FLEXT_CALLBACK_B(m_append)
+
+ FLEXT_CALLBACK_V(m_draw)
+};
+
+
+FLEXT_LIB_DSP_V("xrecord~",xrecord)
+
+/*
+V xrecord::setup(t_class *)
+{
+#ifndef PD
+ post("loaded xrecord~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
+#endif
+}
+*/
+
+xrecord::xrecord(I argc,t_atom *argv):
+ dorec(false),
+ sigmode(false),mixmode(false),
+ appmode(true),doloop(false),
+ drintv(0),
+ inchns(1)
+{
+ I argi = 0;
+#ifdef MAXMSP
+ if(argc > argi && CanbeInt(argv[argi])) {
+ inchns = GetAInt(argv[argi]);
+ argi++;
+ }
+#endif
+
+ if(argc > argi && IsSymbol(argv[argi])) {
+ buf = new buffer(GetSymbol(argv[argi]),true);
+ argi++;
+
+#ifdef MAXMSP
+ // oldstyle command line?
+ if(argi == 1 && argc == 2 && CanbeInt(argv[argi])) {
+ inchns = GetAInt(argv[argi]);
+ argi++;
+ post("%s: old style command line detected - please change to '%s [channels] [buffer]'",thisName(),thisName());
+ }
+#endif
+ }
+ else
+ buf = new buffer(NULL,true);
+
+ AddInSignal(inchns); // audio signals
+ AddInSignal(); // on/off signal
+ AddInFloat(2); // min & max
+ AddOutSignal(); // pos signal
+ AddOutFloat(2); // min & max
+ AddOutBang(); // loop bang
+
+ FLEXT_ADDMETHOD_F(0,"pos",m_pos);
+ FLEXT_ADDMETHOD(inchns+1,m_min);
+ FLEXT_ADDMETHOD(inchns+2,m_max);
+ FLEXT_ADDMETHOD_F(0,"min",m_min);
+ FLEXT_ADDMETHOD_F(0,"max",m_max);
+ FLEXT_ADDMETHOD_(0,"all",m_all);
+
+ FLEXT_ADDMETHOD_B(0,"loop",m_loop);
+ FLEXT_ADDMETHOD_B(0,"mixmode",m_mixmode);
+ FLEXT_ADDMETHOD_B(0,"sigmode",m_sigmode);
+ FLEXT_ADDMETHOD_B(0,"append",m_append);
+
+ FLEXT_ADDMETHOD_(0,"draw",m_draw);
+}
+
+
+BL xrecord::Init()
+{
+ if(xsample::Init()) {
+ outmin = GetOut(1);
+ outmax = GetOut(2);
+
+ m_reset();
+ return true;
+ }
+ else
+ return false;
+}
+
+V xrecord::m_units(xs_unit mode)
+{
+ xsample::m_units(mode);
+
+ m_sclmode();
+ outputmin();
+ outputmax();
+}
+
+V xrecord::m_min(F mn)
+{
+ xsample::m_min(mn);
+ m_pos(curpos*s2u);
+ outputmin();
+}
+
+V xrecord::m_max(F mx)
+{
+ xsample::m_max(mx);
+ m_pos(curpos*s2u);
+ outputmax();
+}
+
+V xrecord::m_all()
+{
+ xsample::m_all();
+ outputmin();
+ outputmax();
+}
+
+V xrecord::m_pos(F pos)
+{
+ curpos = pos?(L)(pos/s2u+.5):0;
+
+ if(curpos < curmin) curpos = curmin;
+ else if(curpos > curmax) curpos = curmax;
+}
+
+
+I xrecord::m_set(I argc,t_atom *argv)
+{
+ I r = xsample::m_set(argc,argv);
+ if(r < 0) m_reset(); // resets pos/min/max
+ if(r != 0) m_units();
+ return r;
+}
+
+V xrecord::m_start()
+{
+ if(!sigmode && !appmode) m_pos(0);
+ m_refresh();
+ dorec = true;
+ buf->SetRefrIntv(drintv);
+ s_dsp();
+}
+
+V xrecord::m_stop()
+{
+ dorec = false;
+ buf->Dirty(true);
+ buf->SetRefrIntv(0);
+ s_dsp();
+}
+
+BL xrecord::m_reset()
+{
+ curpos = 0;
+ return xsample::m_reset();
+}
+
+V xrecord::m_draw(I argc,t_atom *argv)
+{
+ if(argc >= 1) {
+ drintv = GetInt(argv[0]);
+ if(dorec) buf->SetRefrIntv(drintv);
+ }
+ else
+ buf->Dirty(true);
+}
+
+
+TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs)
+{
+ SIGCHNS(BCHNS,buf->Channels(),ICHNS,inchns);
+
+ const S *const *sig = invecs;
+ register I si = 0;
+ const S *on = invecs[inchns];
+ S *pos = outvecs[0];
+
+ BL lpbang = false;
+ register const F pf = sclmul;
+ register L o = curpos;
+
+ if(o < curmin) o = curmin;
+
+// if(buf && dorec && curlen > 0) {
+ if(buf && dorec && curmax > curmin) {
+ while(n) {
+ L ncur = curmax-o; // at max to buffer or recording end
+
+ if(ncur <= 0) { // end of buffer
+ if(doloop) {
+ o = curmin;
+// ncur = curlen;
+ ncur = curmax-o;
+ }
+ else
+ m_stop(); // loop expired;
+
+ lpbang = true;
+ }
+
+ if(!dorec) break;
+
+ if(ncur > n) ncur = n;
+
+ register I i;
+ register S *bf = buf->Data()+o*BCHNS;
+ register F p = scale(o);
+
+ if(sigmode) {
+ if(appmode) {
+ // append to current position
+
+ if(!mixmode) {
+ for(i = 0; i < ncur; ++i,++si) {
+ if(*(on++) >= 0) {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = sig[ci][si];
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else
+ *(pos++) = p;
+ }
+ }
+ else {
+ for(i = 0; i < ncur; ++i,++si) {
+ register const S g = *(on++);
+ if(g >= 0) {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = bf[ci]*(1.-g)+sig[ci][si]*g;
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else
+ *(pos++) = p;
+ }
+ }
+ }
+ else {
+ // don't append
+ if(!mixmode) {
+ for(i = 0; i < ncur; ++i,++si) {
+ if(*(on++) >= 0)
+ {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = sig[ci][si];
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else {
+ *(pos++) = p = scale(o = 0);
+ bf = buf->Data();
+ }
+ }
+ }
+ else {
+ for(i = 0; i < ncur; ++i,++si) {
+ register const S g = *(on++);
+ if(g >= 0) {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = bf[ci]*(1.-g)+sig[ci][si]*g;
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else {
+ *(pos++) = p = scale(o = 0);
+ bf = buf->Data();
+ }
+ }
+ }
+ }
+ }
+ else {
+ // message mode
+
+ // Altivec optimization for that!
+ if(!mixmode) {
+ for(int ci = 0; ci < ICHNS; ++ci) {
+ register S *b = bf+ci;
+ register const F *s = sig[ci];
+ for(i = 0; i < ncur; ++i,b += BCHNS,++s) *b = *s;
+ }
+ si += ncur;
+ }
+ else {
+ for(i = 0; i < ncur; ++i,++si) {
+ register const S w = *(on++);
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = bf[ci]*(1.-w)+sig[ci][si]*w;
+ bf += BCHNS;
+ }
+ }
+ for(i = 0; i < ncur; ++i) {
+ *(pos++) = p,p += pf,++o;
+ }
+ }
+
+ n -= ncur;
+ }
+ curpos = o;
+
+ buf->Dirty();
+ }
+
+ if(n) {
+ register F p = scale(o);
+ while(n--) *(pos++) = p;
+ }
+
+ if(lpbang) ToOutBang(3);
+}
+
+V xrecord::s_dsp()
+{
+ switch(buf->Channels()*1000+inchns) {
+ case 1001: SETSIGFUN(recfun,TMPLFUN(s_rec,1,1)); break;
+ case 1002: SETSIGFUN(recfun,TMPLFUN(s_rec,1,2)); break;
+ case 2001: SETSIGFUN(recfun,TMPLFUN(s_rec,2,1)); break;
+ case 2002: SETSIGFUN(recfun,TMPLFUN(s_rec,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(recfun,TMPLFUN(s_rec,4,-1)); break;
+ case 4004: SETSIGFUN(recfun,TMPLFUN(s_rec,4,4)); break;
+ default: SETSIGFUN(recfun,TMPLFUN(s_rec,-1,-1)); break;
+ }
+}
+
+
+
+
+V xrecord::m_help()
+{
+ post("%s - part of xsample objects, version " XSAMPLE_VERSION,thisName());
+#ifdef _DEBUG
+ post("compiled on " __DATE__ " " __TIME__);
+#endif
+ post("(C) Thomas Grill, 2001-2002");
+#ifdef MAXMSP
+ post("Arguments: %s [channels=1] [buffer]",thisName());
+#else
+ post("Arguments: %s [buffer]",thisName());
+#endif
+ post("Inlets: 1:Messages/Audio signal, 2:Trigger signal, 3:Min point, 4: Max point");
+ post("Outlets: 1:Position signal, 2:Min point, 3:Max point");
+ post("Methods:");
+ post("\thelp: shows this help");
+ post("\tset [name]: set buffer or reinit");
+ post("\tenable 0/1: turn dsp calculation off/on");
+ post("\treset: reset min/max recording points and recording offset");
+ post("\tprint: print current settings");
+ post("\tsigmode 0/1: specify message or signal triggered recording");
+ post("\tappend 0/1: reset recording position or append to current position");
+ post("\tloop 0/1: switches looping off/on");
+ post("\tmixmode 0/1: specify if audio signal should be mixed in");
+ post("\tmin {unit}: set minimum recording point");
+ post("\tmax {unit}: set maximum recording point");
+ post("\tall: select entire buffer length");
+ post("\tpos {unit}: set recording position (obeying the current scale mode)");
+ post("\tbang/start: start recording");
+ post("\tstop: stop recording");
+ post("\trefresh: checks buffer and refreshes outlets");
+ post("\tunits 0/1/2/3: set units to frames/buffer size/ms/s");
+ post("\tsclmode 0/1/2/3: set range of position to units/units in loop/buffer/loop");
+ post("\tdraw [{float}]: redraw buffer immediately (arg omitted) or periodic (in ms)");
+ post("");
+}
+
+V xrecord::m_print()
+{
+ static const C sclmode_txt[][20] = {"units","units in loop","buffer","loop"};
+
+ // print all current settings
+ post("%s - current settings:",thisName());
+ post("bufname = '%s', length = %.3f, channels = %i",buf->Name(),(F)(buf->Frames()*s2u),buf->Channels());
+ post("in channels = %i, frames/unit = %.3f, scale mode = %s",inchns,(F)(1./s2u),sclmode_txt[sclmode]);
+ post("sigmode = %s, append = %s, loop = %s, mixmode = %s",sigmode?"yes":"no",appmode?"yes":"no",doloop?"yes":"no",mixmode?"yes":"no");
+ post("");
+}
+
+
+#ifdef MAXMSP
+V xrecord::m_assist(L msg,L arg,C *s)
+{
+ switch(msg) {
+ case 1: //ASSIST_INLET:
+ if(arg < inchns) {
+ if(arg)
+ sprintf(s,"Messages and Audio channel 1");
+ else
+ sprintf(s,"Audio channel %li",arg+1);
+ }
+ else
+ switch(arg-inchns) {
+ case 0:
+ sprintf(s,"On/Off/Fade/Mix signal (0..1)"); break;
+ case 1:
+ sprintf(s,"Starting point of recording"); break;
+ case 2:
+ sprintf(s,"Ending point of recording"); break;
+ }
+ break;
+ case 2: //ASSIST_OUTLET:
+ switch(arg) {
+ case 0:
+ sprintf(s,"Current position of recording"); break;
+ case 1:
+ sprintf(s,"Starting point (rounded to frame)"); break;
+ case 2:
+ sprintf(s,"Ending point (rounded to frame)"); break;
+ case 3:
+ sprintf(s,"Bang on loop end/rollover"); break;
+ }
+ break;
+ }
+}
+#endif
+
+
+
diff --git a/externals/grill/xsample/source/xsample.cw b/externals/grill/xsample/source/xsample.cw
new file mode 100644
index 00000000..c9e91616
--- /dev/null
+++ b/externals/grill/xsample/source/xsample.cw
Binary files differ
diff --git a/externals/grill/xsample/source/xsample.dsp b/externals/grill/xsample/source/xsample.dsp
new file mode 100644
index 00000000..6c97b49e
--- /dev/null
+++ b/externals/grill/xsample/source/xsample.dsp
@@ -0,0 +1,127 @@
+# Microsoft Developer Studio Project File - Name="xsample" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xsample - 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 "xsample.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 "xsample.mak" CFG="xsample - Win32 Debug"
+!MESSAGE
+!MESSAGE Fόr die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "xsample - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xsample - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName "xsample"
+# PROP Scc_LocalPath ".."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xsample - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\msvc"
+# PROP Intermediate_Dir "..\msvc"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSAMPLE_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /G6 /W3 /O2 /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "NDEBUG"
+# ADD RSC /l 0xc07 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib /nologo /dll /machine:I386 /libpath:"c:\programme\audio\pd\bin" /libpath:"..\..\flext\pd-msvc\\"
+
+!ELSEIF "$(CFG)" == "xsample - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\msvc-debug"
+# PROP Intermediate_Dir "..\msvc-debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSAMPLE_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "_DEBUG"
+# ADD RSC /l 0xc07 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib pd.lib flext_d-pdwin.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"c:\programme\audio\pd\bin\\" /libpath:"..\..\flext\pd-msvc\\"
+
+!ENDIF
+
+# Begin Target
+
+# Name "xsample - Win32 Release"
+# Name "xsample - Win32 Debug"
+# Begin Group "doc"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\readme.txt
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\groove.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\inter.ci
+# End Source File
+# Begin Source File
+
+SOURCE=.\inter.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\play.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\record.cpp
+# End Source File
+# End Target
+# End Project
diff --git a/externals/grill/xsample/source/xsample.mpw b/externals/grill/xsample/source/xsample.mpw
new file mode 100644
index 00000000..9e6b625e
--- /dev/null
+++ b/externals/grill/xsample/source/xsample.mpw
@@ -0,0 +1,129 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for Apple MPW-PR
+#
+# usage: make -f xsample.mpw
+#
+# ---------------------------------------------
+
+MAKEFILE = xsample.mpw
+€MondoBuild€ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
+
+ObjDir = ::MPW:
+MaxSDK = HD Daten:Prog Stuff:Max/MSP SDK:SDK Examples
+flext = :::flext:
+Includes = -i :,"{flext}","{MaxSDK}:Max Includes","{MaxSDK}:MSP Includes"
+Defines = -d MAXMSP
+
+Sym-PPC = -sym off
+Flags = -bool on -enum int -includes unix -opt speed,unroll,unswitch
+WarnOff = -w 35
+
+PPCCPlusOptions = {Includes} {Sym-PPC} {Defines} {Flags} {WarnOff}
+
+
+### Source Files ###
+
+SrcFiles = main.cpp inter.cpp groove.cpp play.cpp record.cpp
+Headers = main.h
+
+### Object Files ###
+
+Obj-groove = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}groove.cpp.x"
+
+Obj-play = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}play.cpp.x"
+
+Obj-record = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}record.cpp.x"
+
+Obj = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}record.cpp.x" 
+ "{ObjDir}play.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}groove.cpp.x"
+
+
+### Libraries ###
+
+LibFiles-Ext = 
+ "{flext}MPW:flext.o" 
+ "{MaxSDK}:Max Includes:MaxLib" 
+ "{MaxSDK}:MSP Includes:MaxAudioLib"
+
+LibFiles-PPC = 
+ "{SharedLibraries}StdCLib" 
+ "{SharedLibraries}MathLib" 
+ "{PPCLibraries}StdCRuntime.o" 
+ "{PPCLibraries}PPCCRuntime.o" 
+ "{PPCLibraries}MrCPlusLib.o" 
+
+
+### Default Rules ###
+
+{ObjDir} Ÿ :
+
+.cpp.x Ÿ .cpp {€MondoBuild€} {Headers}
+ {PPCCPlus} {depDir}{default}.cpp -o {targDir}{default}.cpp.x {PPCCPlusOptions}
+
+
+### Build Rules ###
+
+all Ÿ Folder {ObjDir}xsample
+single Ÿ Folder {ObjDir}xgroove~ {ObjDir}xplay~ {ObjDir}xrecord~
+
+Folder Ÿ
+ if !`Exists {ObjDir}` ; NewFolder {ObjDir} ; end
+
+{ObjDir}xgroove~ ŸŸ {Obj-groove} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main
+
+{ObjDir}xplay~ ŸŸ {Obj-play} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main
+
+{ObjDir}xrecord~ ŸŸ {Obj-record} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main
+
+{ObjDir}xsample ŸŸ {Obj} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main