aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <martin_pi@users.sourceforge.net>2003-02-17 14:12:16 +0000
committerN.N. <martin_pi@users.sourceforge.net>2003-02-17 14:12:16 +0000
commite7b24dd7da9de84e218f7d7be623f0cf8b9d1b9c (patch)
treed6f37e159464589e9c5c3dea8b38e4d03631794c
This commit was generated by cvs2svn to compensate for changes in r415,svn2git-root
which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/dfx/; revision=416
-rwxr-xr-xCOPYING1
-rw-r--r--README32
-rwxr-xr-xbuffer_override/bufferoverride.hpp227
-rwxr-xr-xbuffer_override/bufferoverrideFormalities.cpp183
-rwxr-xr-xbuffer_override/bufferoverrideProcess.cpp253
-rw-r--r--buffer_override/bufferoverride~.pd64
-rwxr-xr-xbuffer_override/makefile46
-rwxr-xr-xdfx-library/FIRfilter.cpp97
-rwxr-xr-xdfx-library/FIRfilter.h37
-rwxr-xr-xdfx-library/IIRfilter.cpp61
-rwxr-xr-xdfx-library/IIRfilter.h156
-rw-r--r--dfx-library/MultiKick.cpp114
-rw-r--r--dfx-library/MultiKick.hpp42
-rwxr-xr-xdfx-library/TempoRateTable.cpp72
-rwxr-xr-xdfx-library/TempoRateTable.h47
-rwxr-xr-xdfx-library/dfxmisc.cpp77
-rwxr-xr-xdfx-library/dfxmisc.h194
-rwxr-xr-xdfx-library/lfo.cpp178
-rwxr-xr-xdfx-library/lfo.h150
-rwxr-xr-xoriginal/bo2-source.sitbin0 -> 701166 bytes
-rw-r--r--original/polarizer-source.sitbin0 -> 200037 bytes
-rwxr-xr-xoriginal/transverb-source.sitbin0 -> 450907 bytes
-rwxr-xr-xpolarizer/makefile46
-rw-r--r--polarizer/polarizer.cpp112
-rw-r--r--polarizer/polarizer.hpp78
-rw-r--r--polarizer/polarizerBi.cpp165
-rw-r--r--polarizer/polarizer~.pd38
-rwxr-xr-xskidder/ read this.txt28
-rwxr-xr-xskidder/copying341
-rwxr-xr-xskidder/makefile46
-rwxr-xr-xskidder/skidder.cpp374
-rwxr-xr-xskidder/skidder.hpp224
-rw-r--r--skidder/skidder~.pd51
-rwxr-xr-xtransverb/makefile47
-rw-r--r--transverb/prep.i12820
-rw-r--r--transverb/syncgrain.cpp-276
-rwxr-xr-xtransverb/transverb.cpp683
-rw-r--r--transverb/transverb.h263
-rwxr-xr-xtransverb/transverb_safety.cpp744
-rw-r--r--transverb/transverb~.pd65
40 files changed, 18432 insertions, 0 deletions
diff --git a/COPYING b/COPYING
new file mode 100755
index 0000000..a935ae7
--- /dev/null
+++ b/COPYING
@@ -0,0 +1 @@
+ 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. \ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 0000000..4d89c8e
--- /dev/null
+++ b/README
@@ -0,0 +1,32 @@
+
+
+
+ pd_dfx/cvs
+
+
+
+ this is the pd_dfx collection of the super destroy fx vst plugins
+
+
+
+ the original files may be found at
+
+ http://www.smartelectronix.com/~destroyfx/
+
+ files are copyright © 2000,2001 by Marcberg Soft und
+ Hard GmbH, respectively Marc Poirier and Tom Murphy
+
+
+ currently there are only buffer_override, polarizer,
+ transverb and skidder here (and skidder is broken)
+
+
+
+ for comments/whatever mail to
+ martin pi < pi(at)attacksyour.net >
+
+
+
+
+ license is in the file "COPYING" and is GPL-2
+ thanks to tom & marc for the great software they do
diff --git a/buffer_override/bufferoverride.hpp b/buffer_override/bufferoverride.hpp
new file mode 100755
index 0000000..513a678
--- /dev/null
+++ b/buffer_override/bufferoverride.hpp
@@ -0,0 +1,227 @@
+/*------------------- by Marc Poirier ][ March 2001 -------------------*/
+
+
+#ifndef __bufferoverride
+#define __bufferoverride
+
+#include "dfxmisc.h"
+#include "lfo.h"
+#include "TempoRateTable.h"
+
+#include "flext.h"
+
+//-----------------------------------------------------------------------------
+// these are the plugin parameters:
+enum
+{
+ kDivisor,
+ kBuffer,
+ kBufferTempoSync,
+ kBufferInterrupt,
+
+ kDivisorLFOrate,
+ kDivisorLFOdepth,
+ kDivisorLFOshape,
+ kDivisorLFOtempoSync,
+ kBufferLFOrate,
+ kBufferLFOdepth,
+ kBufferLFOshape,
+ kBufferLFOtempoSync,
+
+ kSmooth,
+ kDryWetMix,
+
+ kPitchbend,
+ kMidiMode,
+
+ kTempo,
+
+ NUM_PARAMETERS
+};
+
+//-----------------------------------------------------------------------------
+// constants & macros
+
+#define DIVISOR_MIN 1.92f
+#define DIVISOR_MAX 222.0f
+#define bufferDivisorScaled(A) ( paramRangeSquaredScaled((A), DIVISOR_MIN, DIVISOR_MAX) )
+#define bufferDivisorUnscaled(A) ( paramRangeSquaredUnscaled((A), DIVISOR_MIN, DIVISOR_MAX) )
+
+#define BUFFER_MIN 1.0f
+#define BUFFER_MAX 999.0f
+#define forcedBufferSizeScaled(A) ( paramRangeSquaredScaled((1.0f-(A)), BUFFER_MIN, BUFFER_MAX) )
+#define forcedBufferSizeUnscaled(A) ( 1.0f - paramRangeSquaredUnscaled((A), BUFFER_MIN, BUFFER_MAX) )
+#define forcedBufferSizeSamples(A) ( (long)(forcedBufferSizeScaled((A)) * SAMPLERATE * 0.001f) )
+
+#define TEMPO_MIN 57.0f
+#define TEMPO_MAX 480.0f
+#define tempoScaled(A) ( paramRangeScaled((A), TEMPO_MIN, TEMPO_MAX) )
+#define tempoUnscaled(A) ( paramRangeUnscaled((A), TEMPO_MIN, TEMPO_MAX) )
+
+#define LFO_RATE_MIN 0.03f
+#define LFO_RATE_MAX 21.0f
+#define LFOrateScaled(A) ( paramRangeSquaredScaled((A), LFO_RATE_MIN, LFO_RATE_MAX) )
+#define LFOrateUnscaled(A) ( paramRangeSquaredUnscaled((A), LFO_RATE_MIN, LFO_RATE_MAX) )
+
+#define normalize(f,a,b) ((((f < b) ? f : b) > a) ? f : a)
+
+
+// you need this stuff to get some maximum buffer size & allocate for that
+// this is 42 bpm - should be sufficient
+#define MIN_ALLOWABLE_BPS 0.7f
+
+
+//-----------------------------------------------------------------------------
+class bufferoverrideProgram
+{
+friend class bufferoverride;
+public:
+ bufferoverrideProgram();
+ ~bufferoverrideProgram();
+private:
+ float *param;
+ char *name;
+};
+
+
+//-----------------------------------------------------------------------------
+
+class bufferoverride : public flext_dsp {
+
+ FLEXT_HEADER(bufferoverride, flext_dsp)
+
+public:
+ bufferoverride(int argc, t_atom *argv);
+ ~bufferoverride();
+
+ virtual void m_signal(int, t_sample *const *, t_sample *const *);
+ virtual void m_help();
+
+protected:
+ void doTheProcess(float **inputs, float **outputs, long sampleFrames, bool replacing);
+ void updateBuffer(long samplePos);
+
+ void heedbufferoverrideEvents(long samplePos);
+ float getDivisorParameterFromNote(int currentNote);
+ float getDivisorParameterFromPitchbend(int pitchbendByte);
+
+ void initPresets();
+ void createAudioBuffers();
+
+ // the parameters
+ float fDivisor, fBuffer, fBufferTempoSync, fBufferInterrupt, fSmooth,
+ fDryWetMix, fPitchbend, fMidiMode, fTempo;
+
+ long currentForcedBufferSize; // the size of the larger, imposed buffer
+ // these store the forced buffer
+ float *buffer1;
+
+ long writePos; // the current sample position within the forced buffer
+
+ long minibufferSize; // the current size of the divided "mini" buffer
+ long prevMinibufferSize; // the previous size
+ long readPos; // the current sample position within the minibuffer
+ float currentBufferDivisor; // the current value of the divisor with LFO possibly applied
+
+ float numLFOpointsDivSR; // the number of LFO table points divided by the sampling rate
+
+ float currentTempoBPS; // tempo in beats per second
+ TempoRateTable *tempoRateTable; // a table of tempo rate values
+ long hostCanDoTempo; // my semi-booly dude who knows something about the host's VstTimeInfo implementation
+ bool needResync;
+
+ long SUPER_MAX_BUFFER;
+ float SAMPLERATE;
+
+ long smoothDur, smoothcount; // total duration & sample counter for the minibuffer transition smoothing period
+ float smoothStep; // the gain increment for each sample "step" during the smoothing period
+ float sqrtFadeIn, sqrtFadeOut; // square root of the smoothing gains, for equal power crossfading
+ float smoothFract;
+
+ bool divisorWasChangedByHand; // for MIDI trigger mode - tells us to respect the fDivisor value
+ bool divisorWasChangedByMIDI; // tells the GUI that the divisor displays need updating
+
+ LFO *divisorLFO, *bufferLFO;
+
+ float fadeOutGain, fadeInGain, realFadePart, imaginaryFadePart; // for trig crossfading
+
+
+
+
+
+
+
+ virtual void suspend();
+
+ // flext
+
+ FLEXT_CALLBACK_F(setDivisor)
+ void setDivisor(float f) {
+ fDivisor = bufferDivisorUnscaled(normalize(f,DIVISOR_MIN,DIVISOR_MAX));
+ }
+
+ FLEXT_CALLBACK_F(setBuffer)
+ void setBuffer(float f) {
+ fBuffer = forcedBufferSizeUnscaled(normalize(f,BUFFER_MIN,BUFFER_MAX));
+ }
+
+/* FLEXT_CALLBACK_F(setBufferTempoSync)
+ void setBufferTempoSync(float f) {
+ fBufferTempoSync = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setBufferInterrupt)
+ void setBufferInterrupt(float f) {
+ fBufferInterrupt = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setSmooth)
+ void setSmooth(float f) {
+ fSmooth = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setDryWetMix)
+ void setDryWetMix(float f) {
+ fDryWetMix = normalize(f,0,1);
+ }
+*/
+ FLEXT_CALLBACK_F(setTempo)
+ void setTempo(float f) {
+ fTempo = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setDivisorLFOrate)
+ void setDivisorLFOrate(float f) {
+ divisorLFO->fRate = paramSteppedUnscaled(f, NUM_TEMPO_RATES);
+ }
+
+ FLEXT_CALLBACK_F(setDivisorLFOdepth)
+ void setDivisorLFOdepth(float f) {
+ divisorLFO->fDepth = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setDivisorLFOshape)
+ void setDivisorLFOshape(float f) {
+ divisorLFO->fShape = LFOshapeUnscaled(normalize(f,0,7));
+ }
+
+
+ FLEXT_CALLBACK_F(setBufferLFOrate)
+ void setBufferLFOrate(float f) {
+ bufferLFO->fRate = paramSteppedUnscaled(f, NUM_TEMPO_RATES);
+ }
+
+ FLEXT_CALLBACK_F(setBufferLFOdepth)
+ void setBufferLFOdepth(float f) {
+ bufferLFO->fDepth = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setBufferLFOshape)
+ void setBufferLFOshape(float f) {
+ bufferLFO->fShape = LFOshapeUnscaled(normalize(f,0,7));
+ }
+
+
+};
+
+#endif
diff --git a/buffer_override/bufferoverrideFormalities.cpp b/buffer_override/bufferoverrideFormalities.cpp
new file mode 100755
index 0000000..428a7b5
--- /dev/null
+++ b/buffer_override/bufferoverrideFormalities.cpp
@@ -0,0 +1,183 @@
+/*------------------- by Marc Poirier ][ March 2001 -------------------*/
+
+#ifndef __bufferoverride
+#include "bufferoverride.hpp"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+//-------------------------------------------------------------------------
+// titles of each parameter
+/*
+ fDivisor "buffer divisor"
+ fBuffer "forced buffer size"
+ fBufferTempoSync "forced buffer tempo sync"
+ fBufferInterrupt "stuck buffer"
+ fDivisorLFOrate "divisor LFO rate"
+ fDivisorLFOdepth "divisor LFO depth"
+ fDivisorLFOshape "divisor LFO shape"
+ fDivisorLFOtempoSync "divisor LFO tempo sync"
+ fBufferLFOrate "buffer LFO rate"
+ fBufferLFOdepth "buffer LFO depth"
+ fBufferLFOshape "buffer LFO shape"
+ fBufferLFOtempoSync "buffer LFO tempo sync"
+ fSmooth "smooth"
+ fDryWetMix "dry/wet mix"
+ fPitchbend "pitchbend"
+ fTempo "tempo"
+*/
+
+
+//-----------------------------------------------------------------------------
+// initializations & such
+
+bufferoverride::bufferoverride(int argc, t_atom *argv) {
+
+ buffer1 = NULL;
+
+ SUPER_MAX_BUFFER = (long) ((44100.0f / MIN_ALLOWABLE_BPS) * 4.0f);
+
+ // allocate memory for these structures
+ tempoRateTable = new TempoRateTable;
+ divisorLFO = new LFO;
+ bufferLFO = new LFO;
+
+ suspend();
+ initPresets();
+
+ fTempo = tempoUnscaled(120.0f);
+ currentTempoBPS = tempoScaled(fTempo) / 60.0f;
+
+
+ post("_ ____bufferoverride~ --_ - __ _____");
+
+ SAMPLERATE = (int) Samplerate();
+// blocksize = Blocksize();
+
+/* fTomsound = (float)GetFloat(argv[0]); // creation arguments
+ fQuality = (float)GetFloat(argv[1]); // [ yet they default to reasonable values ]
+ drymix = (float)GetFloat(argv[2]);
+ ireplace = (int)GetFloat(argv[3]);*/
+
+ AddInSignal();
+ AddInFloat(9);
+ AddOutSignal(); // 1 audio out [ == AddOutSignal(1) ]
+
+ SetupInOut(); // set up inlets and outlets.
+ // Must get called once!
+
+ // Now we need to bind the handler function to our
+ // inlets,
+
+/* fDivisor "buffer divisor"
+ fBuffer "forced buffer size"
+ fBufferTempoSync "forced buffer tempo sync"
+ fBufferInterrupt "stuck buffer"
+ fDivisorLFOrate "divisor LFO rate"
+ fDivisorLFOdepth "divisor LFO depth"
+ fDivisorLFOshape "divisor LFO shape"
+ fDivisorLFOtempoSync "divisor LFO tempo sync"
+ fBufferLFOrate "buffer LFO rate"
+ fBufferLFOdepth "buffer LFO depth"
+ fBufferLFOshape "buffer LFO shape"
+ fBufferLFOtempoSync "buffer LFO tempo sync"
+ fSmooth "smooth"
+ fDryWetMix "dry/wet mix"
+ fPitchbend "pitchbend"
+ fTempo "tempo"
+
+*/
+ FLEXT_ADDMETHOD( 1,setDivisor);
+ FLEXT_ADDMETHOD( 2,setBuffer);
+ FLEXT_ADDMETHOD( 3,setTempo);
+ FLEXT_ADDMETHOD( 4,setDivisorLFOrate);
+ FLEXT_ADDMETHOD( 5,setDivisorLFOdepth);
+ FLEXT_ADDMETHOD( 6,setDivisorLFOshape);
+ FLEXT_ADDMETHOD( 7,setBufferLFOrate);
+ FLEXT_ADDMETHOD( 8,setBufferLFOdepth);
+ FLEXT_ADDMETHOD( 9,setBufferLFOshape);
+
+ post("_ ____ ____ _");
+
+}
+
+
+// GIMME class:
+FLEXT_NEW_TILDE_G("bufferoverride~", bufferoverride)
+
+
+//-------------------------------------------------------------------------
+bufferoverride::~bufferoverride() {
+
+ // deallocate the memory from these arrays
+ if (buffer1) delete[] buffer1;
+ if (tempoRateTable) delete tempoRateTable;
+ if (divisorLFO) delete divisorLFO;
+ if (bufferLFO) delete bufferLFO;
+
+
+}
+
+//-------------------------------------------------------------------------
+void bufferoverride::suspend()
+{
+ // setting the values like this will restart the forced buffer in the next process()
+ currentForcedBufferSize = 1;
+ writePos = readPos = 1;
+ minibufferSize = 1;
+ prevMinibufferSize = 0;
+ smoothcount = smoothDur = 0;
+ sqrtFadeIn = sqrtFadeOut = 1.0f;
+
+ divisorLFO->reset();
+ bufferLFO->reset();
+}
+
+//-------------------------------------------------------------------------
+void bufferoverride::createAudioBuffers() {
+
+ // update the sample rate value
+ SAMPLERATE = (float)Samplerate();
+ // just in case the host responds with something wacky
+ if (SAMPLERATE <= 0.0f)
+ SAMPLERATE = 44100.0f;
+ long oldMax = SUPER_MAX_BUFFER;
+ SUPER_MAX_BUFFER = (long) ((SAMPLERATE / MIN_ALLOWABLE_BPS) * 4.0f);
+
+ // if the sampling rate (& therefore the max buffer size) has changed,
+ // then delete & reallocate the buffers according to the sampling rate
+ if (SUPER_MAX_BUFFER != oldMax) {
+ if (buffer1 != NULL)
+ delete[] buffer1;
+ buffer1 = NULL;
+ }
+
+ if (buffer1 == NULL) buffer1 = new float[SUPER_MAX_BUFFER];
+}
+
+
+//-------------------------------------------------------------------------
+void bufferoverride::initPresets()
+{
+
+ fDivisor = bufferDivisorUnscaled(27.0f);
+ fBuffer = forcedBufferSizeUnscaled(81.0f);
+ fBufferTempoSync = 0.0f;
+ fBufferInterrupt = 1.0f;
+ fSmooth = 0.06f;
+ fDryWetMix = 1.0f;
+ fTempo = 0.0f;
+
+ divisorLFO->fRate = paramSteppedUnscaled(6.6f, NUM_TEMPO_RATES);
+ divisorLFO->fDepth = 0.333f;
+ divisorLFO->fShape = LFOshapeUnscaled(kSineLFO);
+ divisorLFO->fTempoSync = 1.0f;
+ bufferLFO->fRate = 0.0f;
+ bufferLFO->fDepth = 0.06f;
+ bufferLFO->fShape = LFOshapeUnscaled(kSawLFO);
+ bufferLFO->fTempoSync = 1.0f;
+}
+
diff --git a/buffer_override/bufferoverrideProcess.cpp b/buffer_override/bufferoverrideProcess.cpp
new file mode 100755
index 0000000..5877020
--- /dev/null
+++ b/buffer_override/bufferoverrideProcess.cpp
@@ -0,0 +1,253 @@
+/*------------------- by Marc Poirier ][ March 2001 -------------------*/
+
+#ifndef __bufferoverride
+#include "bufferoverride.hpp"
+#endif
+
+
+
+//-----------------------------------------------------------------------------
+void bufferoverride::updateBuffer(long samplePos)
+{
+ bool doSmoothing = true; // but in some situations, we shouldn't
+ float divisorLFOvalue, bufferLFOvalue; // the current output values of the LFOs
+ long prevForcedBufferSize; // the previous forced buffer size
+
+
+ readPos = 0; // reset for starting a new minibuffer
+ prevMinibufferSize = minibufferSize;
+ prevForcedBufferSize = currentForcedBufferSize;
+
+ //--------------------------PROCESS THE LFOs----------------------------
+ // update the LFOs' positions to the current position
+ divisorLFO->updatePosition(prevMinibufferSize);
+ bufferLFO->updatePosition(prevMinibufferSize);
+ // Then get the current output values of the LFOs, which also updates their positions once more.
+ // Scale the 0.0 - 1.0 LFO output values to 0.0 - 2.0 (oscillating around 1.0).
+ divisorLFOvalue = processLFOzero2two(divisorLFO);
+ bufferLFOvalue = 2.0f - processLFOzero2two(bufferLFO); // inverting it makes more pitch sense
+ // & then update the stepSize for each LFO, in case the LFO parameters have changed
+ if (onOffTest(divisorLFO->fTempoSync))
+ divisorLFO->stepSize = currentTempoBPS * (tempoRateTable->getScalar(divisorLFO->fRate)) * numLFOpointsDivSR;
+ else
+ divisorLFO->stepSize = LFOrateScaled(divisorLFO->fRate) * numLFOpointsDivSR;
+ if (onOffTest(bufferLFO->fTempoSync))
+ bufferLFO->stepSize = currentTempoBPS * (tempoRateTable->getScalar(bufferLFO->fRate)) * numLFOpointsDivSR;
+ else
+ bufferLFO->stepSize = LFOrateScaled(bufferLFO->fRate) * numLFOpointsDivSR;
+
+ //---------------------------CALCULATE FORCED BUFFER SIZE----------------------------
+ // check if it's the end of this forced buffer
+ if (writePos >= currentForcedBufferSize)
+ {
+ writePos = 0; // start up a new forced buffer
+
+ // check on the previous forced & minibuffers; don't smooth if the last forced buffer wasn't divided
+ if (prevMinibufferSize >= currentForcedBufferSize)
+ doSmoothing = false;
+ else
+ doSmoothing = true;
+
+ // now update the the size of the current force buffer
+ if ( onOffTest(fBufferTempoSync) && // the user wants to do tempo sync / beat division rate
+ (currentTempoBPS > 0.0f) ) // avoid division by zero
+ {
+ currentForcedBufferSize = (long) ( SAMPLERATE / (currentTempoBPS * tempoRateTable->getScalar(fBuffer)) );
+ // set this true so that we make sure to do the measure syncronisation later on
+ }
+ else
+ currentForcedBufferSize = forcedBufferSizeSamples(fBuffer);
+ // apply the buffer LFO to the forced buffer size
+ currentForcedBufferSize = (long) ((float)currentForcedBufferSize * bufferLFOvalue);
+ // really low tempos & tempo rate values can cause huge forced buffer sizes,
+ // so prevent going outside of the allocated buffer space
+ if (currentForcedBufferSize > SUPER_MAX_BUFFER)
+ currentForcedBufferSize = SUPER_MAX_BUFFER;
+ if (currentForcedBufferSize < 2)
+ currentForcedBufferSize = 2;
+
+ // untrue this so that we don't do the measure sync calculations again unnecessarily
+ needResync = false;
+ }
+
+ //-----------------------CALCULATE THE DIVISOR-------------------------
+ currentBufferDivisor = bufferDivisorScaled(fDivisor);
+ // apply the divisor LFO to the divisor value if there's an "active" divisor (i.e. 2 or greater)
+ if (currentBufferDivisor >= 2.0f)
+ {
+ currentBufferDivisor *= divisorLFOvalue;
+ // now it's possible that the LFO could make the divisor less than 2,
+ // which will essentially turn the effect off, so we stop the modulation at 2
+ if (currentBufferDivisor < 2.0f)
+ currentBufferDivisor = 2.0f;
+ }
+
+ //-----------------------CALCULATE THE MINIBUFFER SIZE-------------------------
+ // this is not a new forced buffer starting up
+ if (writePos > 0)
+ {
+ // if it's allowed, update the minibuffer size midway through this forced buffer
+ if (onOffTest(fBufferInterrupt))
+ minibufferSize = (long) ( (float)currentForcedBufferSize / currentBufferDivisor );
+ // if it's the last minibuffer, then fill up the forced buffer to the end
+ // by extending this last minibuffer to fill up the end of the forced buffer
+ long remainingForcedBuffer = currentForcedBufferSize - writePos;
+ if ( (minibufferSize*2) >= remainingForcedBuffer )
+ minibufferSize = remainingForcedBuffer;
+ }
+ // this is a new forced buffer just beginning, act accordingly, do bar sync if necessary
+ else {
+ // because there isn't really any division (given my implementation) when the divisor is < 2
+ if (currentBufferDivisor < 2.0f) minibufferSize = currentForcedBufferSize;
+ else minibufferSize = (long) ( (float)currentForcedBufferSize / currentBufferDivisor );
+ }
+
+ //-----------------------CALCULATE SMOOTHING DURATION-------------------------
+ // no smoothing if the previous forced buffer wasn't divided
+ if (!doSmoothing)
+ smoothcount = smoothDur = 0;
+ else
+ {
+ smoothDur = (long) (fSmooth * (float)minibufferSize);
+ long maxSmoothDur;
+ // if we're just starting a new forced buffer,
+ // then the samples beyond the end of the previous one are not valid
+ if (writePos <= 0)
+ maxSmoothDur = prevForcedBufferSize - prevMinibufferSize;
+ // otherwise just make sure that we don't go outside of the allocated arrays
+ else
+ maxSmoothDur = SUPER_MAX_BUFFER - prevMinibufferSize;
+ if (smoothDur > maxSmoothDur)
+ smoothDur = maxSmoothDur;
+ smoothcount = smoothDur;
+ smoothStep = 1.0f / (float)(smoothDur+1); // the gain increment for each smoothing step
+
+ fadeOutGain = cosf(PI/(float)(4*smoothDur));
+ fadeInGain = sinf(PI/(float)(4*smoothDur));
+ realFadePart = (fadeOutGain * fadeOutGain) - (fadeInGain * fadeInGain); // cosf(3.141592/2/n)
+ imaginaryFadePart = 2.0f * fadeOutGain * fadeInGain; // sinf(3.141592/2/n)
+ }
+}
+
+void bufferoverride::m_signal(int n, float *const *in, float *const *out) {
+ // directly move everything to the vst part
+ doTheProcess((float **)in, (float **)out, (long)n, true);
+} // end m_signal
+
+
+void bufferoverride::m_help() {
+}
+
+//---------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------
+void bufferoverride::doTheProcess(float **inputs, float **outputs, long sampleFrames, bool replacing)
+{
+
+//-------------------------SAFETY CHECK----------------------
+
+ // there must have not been available memory or something (like WaveLab goofing up),
+ // so try to allocate buffers now
+ if ((buffer1 == NULL)) createAudioBuffers();
+
+ // if the creation failed, then abort audio processing
+ if (buffer1 == NULL) return;
+
+
+//-------------------------INITIALIZATIONS----------------------
+ // this is a handy value to have during LFO calculations & wasteful to recalculate at every sample
+ numLFOpointsDivSR = NUM_LFO_POINTS_FLOAT / SAMPLERATE;
+ divisorLFO->pickTheLFOwaveform();
+ bufferLFO->pickTheLFOwaveform();
+
+ // calculate this scaler value to minimize calculations later during processOutput()
+// float inputGain = 1.0f - fDryWetMix;
+// float outputGain = fDryWetMix;
+ float inputGain = sqrtf(1.0f - fDryWetMix);
+ float outputGain = sqrtf(fDryWetMix);
+
+
+//-----------------------TEMPO STUFF---------------------------
+ // figure out the current tempo if we're doing tempo sync
+ if ( onOffTest(fBufferTempoSync) ||
+ (onOffTest(divisorLFO->fTempoSync) || onOffTest(bufferLFO->fTempoSync)) )
+ {
+ // calculate the tempo at the current processing buffer
+ if ( (fTempo > 0.0f) || (hostCanDoTempo != 1) ) // get the tempo from the user parameter
+ {
+ currentTempoBPS = tempoScaled(fTempo) / 60.0f;
+ needResync = false; // we don't want it true if we're not syncing to host tempo
+ }
+ else // get the tempo from the host
+ {
+/* timeInfo = getTimeInfo(kBeatSyncTimeInfoFlags);
+ if (timeInfo)
+ {
+ if (kVstTempoValid & timeInfo->flags)
+ currentTempoBPS = (float)timeInfo->tempo / 60.0f;
+ else
+ currentTempoBPS = tempoScaled(fTempo) / 60.0f;
+// currentTempoBPS = ((float)tempoAt(reportCurrentPosition())) / 600000.0f;
+ // but zero & negative tempos are bad, so get the user tempo value instead if that happens
+ if (currentTempoBPS <= 0.0f)
+ currentTempoBPS = tempoScaled(fTempo) / 60.0f;
+ //
+ // check if audio playback has just restarted & reset buffer stuff if it has (for measure sync)
+ if (timeInfo->flags & kVstTransportChanged)
+ {
+ needResync = true;
+ currentForcedBufferSize = 1;
+ writePos = 1;
+ minibufferSize = 1;
+ prevMinibufferSize = 0;
+ smoothcount = smoothDur = 0;
+ }
+ }
+ else // do the same stuff as above if the timeInfo gets a null pointer
+ {
+*/ currentTempoBPS = tempoScaled(fTempo) / 60.0f;
+ needResync = false; // we don't want it true if we're not syncing to host tempo
+// }
+ }
+ }
+
+
+//-----------------------AUDIO STUFF---------------------------
+ // here we begin the audio output loop, which has two checkpoints at the beginning
+ for (long samplecount = 0; (samplecount < sampleFrames); samplecount++)
+ {
+ // check if it's the end of this minibuffer
+ if (readPos >= minibufferSize)
+ updateBuffer(samplecount);
+
+ // store the latest input samples into the buffers
+ buffer1[writePos] = inputs[0][samplecount];
+
+ // get the current output without any smoothing
+ float out1 = buffer1[readPos];
+
+ // and if smoothing is taking place, get the smoothed audio output
+ if (smoothcount > 0)
+ {
+ out1 = (out1 * fadeInGain) + (buffer1[readPos+prevMinibufferSize] * fadeOutGain);
+
+ smoothcount--;
+
+ fadeInGain = (fadeOutGain * imaginaryFadePart) + (fadeInGain * realFadePart);
+ fadeOutGain = (realFadePart * fadeOutGain) - (imaginaryFadePart * fadeInGain);
+ }
+
+ // write the output samples into the output stream
+ if (replacing)
+ {
+ outputs[0][samplecount] = (out1 * outputGain) + (inputs[0][samplecount] * inputGain);
+ }
+ else
+ {
+ outputs[0][samplecount] += (out1 * outputGain) + (inputs[0][samplecount] * inputGain);
+ }
+
+ // increment the position trackers
+ readPos++;
+ writePos++;
+ }
+}
diff --git a/buffer_override/bufferoverride~.pd b/buffer_override/bufferoverride~.pd
new file mode 100644
index 0000000..abe90d9
--- /dev/null
+++ b/buffer_override/bufferoverride~.pd
@@ -0,0 +1,64 @@
+#N canvas 219 54 847 752 10;
+#X obj 254 503 bufferoverride~;
+#X floatatom 276 285 5 0 0;
+#X floatatom 287 303 5 0 0;
+#X floatatom 322 330 5 0 0;
+#X floatatom 265 267 5 1 3000;
+#X floatatom 367 331 5 0 0;
+#X floatatom 411 332 5 0 0;
+#X floatatom 409 383 5 0 0;
+#X floatatom 452 383 5 0 0;
+#X floatatom 495 383 5 0 0;
+#X obj 226 637 dac~ 1 2;
+#X obj 254 591 *~;
+#X obj 277 591 *~;
+#X obj 332 542 vsl 15 128 0 100 0 0 empty empty volume 0 -8 1 8 -143491
+-262144 -1 4600 1;
+#X obj 254 199 readsf~ 2;
+#X msg 287 160 1;
+#X msg 508 122 0;
+#X msg 291 123 open ../../dresscode/0/3.wav;
+#X obj 393 160 t b;
+#X obj 391 186 delay 100;
+#X obj 321 159 delay 100;
+#X text 546 124 stop this shit;
+#X text 327 264 Divisor :: 1.92-222.0f;
+#X text 334 283 Buffer :: 1.00-999.0f;
+#X text 341 302 Tempo :: 57.00-480.00f;
+#X text 458 332 lfo 1 rate - depth - shape;
+#X text 547 383 lfo 2 rate - depth - shape;
+#X text 491 349 0-21 - 0-1f - 0-7i;
+#X text 590 401 0-21 - 0-1f - 0-7i;
+#X text 390 504 creation arguments > not til noww;
+#X text 29 23 ::- bufferoverrride~ orginally by destroy fx ported by
+martin pi;
+#X text 565 564 there are some values that might get played with in
+future versions not handled in here [ lack of time ] sorry ___ pi;
+#X text 456 586;
+#X text 381 26 more from dfx :: http://smartelectronix.com/~destroyfx
+;
+#X text 473 43 more from pi :: http://attacksyour.net/pi;
+#X connect 0 0 11 0;
+#X connect 0 0 12 0;
+#X connect 1 0 0 2;
+#X connect 2 0 0 3;
+#X connect 3 0 0 4;
+#X connect 4 0 0 1;
+#X connect 5 0 0 5;
+#X connect 6 0 0 6;
+#X connect 7 0 0 7;
+#X connect 8 0 0 8;
+#X connect 9 0 0 9;
+#X connect 11 0 10 0;
+#X connect 12 0 10 1;
+#X connect 13 0 12 1;
+#X connect 13 0 11 1;
+#X connect 14 0 0 0;
+#X connect 14 2 20 0;
+#X connect 15 0 14 0;
+#X connect 16 0 14 0;
+#X connect 17 0 14 0;
+#X connect 17 0 18 0;
+#X connect 18 0 19 0;
+#X connect 19 0 15 0;
+#X connect 20 0 17 0;
diff --git a/buffer_override/makefile b/buffer_override/makefile
new file mode 100755
index 0000000..192f56d
--- /dev/null
+++ b/buffer_override/makefile
@@ -0,0 +1,46 @@
+CXX=g++
+CFLAGS=-O6 -mcpu=pentiumpro -g -ggdb
+FLAGS=-DPD
+
+FLEXTPATH=/usr/local/lib/pd/externs/flext
+DFXINC=../dfx-library
+
+INCLUDES=/usr/local/lib/pd/include $(FLEXTPATH) $(DFXINC)
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+LIBS=m
+
+PDEXTRA=/usr/local/lib/pd/extra
+
+TARGET=bufferoverride~.pd_linux
+
+SRCS=bufferoverrideFormalities.cpp bufferoverrideProcess.cpp $(DFXINC)/lfo.cpp $(DFXINC)/TempoRateTable.cpp
+
+all: $(TARGET)
+
+%.o : %.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(DFXINC)/%.o : $(DFXINC)/%.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+install: $(TARGET)
+ chown root.root $^
+ cp $^ $(PDEXTRA)
+
+.PHONY: clean
+clean:
+ rm -f *.o $(TARGET)
+
+
+
+
+
+
+
+
diff --git a/dfx-library/FIRfilter.cpp b/dfx-library/FIRfilter.cpp
new file mode 100755
index 0000000..d020dc8
--- /dev/null
+++ b/dfx-library/FIRfilter.cpp
@@ -0,0 +1,97 @@
+#ifndef __FIRfilter
+#include "FIRfilter.h"
+#endif
+
+//-----------------------------------------------------------------------------
+// you're supposed to use use an odd number of taps
+void calculateFIRidealLowpassCoefficients(float cutoff, float samplerate,
+ int numTaps, float *coefficients)
+{
+ int middleCoeff;
+ float corner, value;
+
+ // get the cutoff as a ratio of cutoff to Nyquist, scaled from 0 to Pi
+ corner = (cutoff / (samplerate*0.5f)) * PI;
+
+ if (numTaps%2)
+ {
+ middleCoeff = (numTaps-1) / 2;
+ coefficients[middleCoeff] = corner/PI;
+ }
+ else
+ middleCoeff = numTaps/2;
+
+ for (int n=0; n < middleCoeff; n++)
+ {
+ value = (float)n - ((float)(numTaps-1) * 0.5f);
+ coefficients[n] = sinf(value*corner) / (value*PI);
+ coefficients[numTaps-1-n] = coefficients[n];
+ }
+}
+
+//-----------------------------------------------------------------------------
+void applyKaiserWindow(int numTaps, float *coefficients, float attenuation)
+{
+ int halfLength;
+
+
+ // beta is 0 if the attenuation is less than 21 dB
+ float beta = 0.0f;
+ if (attenuation >= 50.0f)
+ beta = 0.1102f * (attenuation - 8.71f);
+ else if ( (attenuation < 50.0f) && (attenuation >= 21.0f) )
+ {
+ beta = 0.5842f * powf( (attenuation - 21.0f), 0.4f);
+ beta += 0.07886f * (attenuation - 21.0f);
+ }
+
+ if (numTaps%2)
+ halfLength = (numTaps+1) / 2;
+ else
+ halfLength = numTaps / 2;
+
+ for (int n=0; n < halfLength; n++)
+ {
+ coefficients[n] *= besselIzero(beta *
+ sqrtf(1.0f - powf( (1.0f-((2.0f*n)/((float)(numTaps-1)))), 2.0f )))
+ / besselIzero(beta);
+ coefficients[numTaps-1-n] = coefficients[n];
+ }
+}
+
+//-----------------------------------------------------------------------------
+float besselIzero(float in)
+{
+ float sum, numerator, denominator, term, halfIn;
+
+ sum = 1.0f;
+ halfIn = in * 0.5f;
+ denominator = 1.0f;
+ numerator = 1.0f;
+ for (int m=1; m <= 32; m++)
+ {
+ numerator *= halfIn;
+ denominator *= (float)m;
+ term = numerator / denominator;
+ sum += term * term;
+ }
+ return sum;
+}
+
+//-----------------------------------------------------------------------------
+float besselIzero2(float in)
+{
+ float sum = 1.0f;
+ float ds = 1.0f;
+ float d = 0.0f;
+
+ do
+ {
+ d += 2.0f;
+ ds *= ( in * in ) / ( d * d );
+ sum += ds;
+ }
+ while ( ds > (1E-7f * sum) );
+
+ return sum;
+}
diff --git a/dfx-library/FIRfilter.h b/dfx-library/FIRfilter.h
new file mode 100755
index 0000000..d0f763b
--- /dev/null
+++ b/dfx-library/FIRfilter.h
@@ -0,0 +1,37 @@
+#ifndef __FIRfilter
+#define __FIRfilter
+
+#include <math.h>
+
+
+#define PI 3.1415926535897932384626433832795f
+#define SHELF_START_FIR 0.333f
+
+
+//-----------------------------------------------------------------------------
+void calculateFIRidealLowpassCoefficients(float cutoff, float samplerate,
+ int numTaps, float *coefficients);
+void applyKaiserWindow(int numTaps, float *coefficients, float attenuation);
+float besselIzero(float in);
+float besselIzero2(float in);
+
+//-----------------------------------------------------------------------------
+inline float processFIRfilter(float *in, int numTaps, float *coefficients,
+ long inPos, long arraySize)
+{
+ float out = 0.0f;
+ if ( (inPos+numTaps) > arraySize )
+ {
+ for (long i=0; i < numTaps; i++)
+ out += in[(inPos+i)%arraySize] * coefficients[i];
+ }
+ else
+ {
+ for (long i=0; i < numTaps; i++)
+ out += in[inPos+i] * coefficients[i];
+ }
+ return out;
+}
+
+
+#endif \ No newline at end of file
diff --git a/dfx-library/IIRfilter.cpp b/dfx-library/IIRfilter.cpp
new file mode 100755
index 0000000..d78bf2f
--- /dev/null
+++ b/dfx-library/IIRfilter.cpp
@@ -0,0 +1,61 @@
+#ifndef __IIRfilter
+#include "IIRfilter.h"
+#endif
+
+#include <math.h>
+
+
+//------------------------------------------------------------------------
+IIRfilter::IIRfilter()
+{
+ reset();
+}
+
+//------------------------------------------------------------------------
+IIRfilter::~IIRfilter() { }
+
+//------------------------------------------------------------------------
+void IIRfilter::calculateLowpassCoefficients(float cutoff, float samplerate)
+{
+ float twoPiFreqDivSR, cosTwoPiFreqDivSR, Q, slopeFactor, coeffScalar;
+
+ Q = 0.5f;
+ twoPiFreqDivSR = 2.0f * PI * cutoff / samplerate; // ¹ ... 0
+ cosTwoPiFreqDivSR = cosf(twoPiFreqDivSR); // 1 ... -1
+ slopeFactor = sinf(twoPiFreqDivSR) / (Q * 2.0f); // 0 ... 1 ... 0
+ coeffScalar = 1.0f / (1.0f + slopeFactor); // 1 ... 0.5 ... 1
+
+ // calculate filter coefficients
+ pInCoeff = (1.0f - cosTwoPiFreqDivSR) * coeffScalar; // 0 ... 2
+ inCoeff = ppInCoeff = pInCoeff * 0.5f; // 0 ... 1
+ pOutCoeff = (-2.0f * cosTwoPiFreqDivSR) * coeffScalar; // -2 ... 2
+ ppOutCoeff = (1.0f - slopeFactor) * coeffScalar; // 1 ... 0 ... 1
+}
+
+//------------------------------------------------------------------------
+void IIRfilter::calculateHighpassCoefficients(float cutoff, float samplerate)
+{
+ float twoPiFreqDivSR, cosTwoPiFreqDivSR, Q, slopeFactor, coeffScalar;
+
+ Q = 0.5f;
+ twoPiFreqDivSR = 2.0f * PI * cutoff / samplerate; // ¹ ... 0
+ cosTwoPiFreqDivSR = cosf(twoPiFreqDivSR); // 1 ... -1
+ slopeFactor = sinf(twoPiFreqDivSR) / (Q * 2.0f); // 0 ... 1 ... 0
+ coeffScalar = 1.0f / (1.0f + slopeFactor); // 1 ... 0.5 ... 1
+
+ // calculate filter coefficients
+ pInCoeff = (-1.0f - cosTwoPiFreqDivSR) * coeffScalar; // 2 ... 0
+ inCoeff = ppInCoeff = pInCoeff * (-0.5f); // -1 ... 0
+ pOutCoeff = (-2.0f * cosTwoPiFreqDivSR) * coeffScalar; // -2 ... 2
+ ppOutCoeff = (1.0f - slopeFactor) * coeffScalar; // 1 ... 0 ... 1
+}
+
+//------------------------------------------------------------------------
+void IIRfilter::copyCoefficients(IIRfilter *source)
+{
+ pOutCoeff = source->pOutCoeff;
+ ppOutCoeff = source->ppOutCoeff;
+ pInCoeff = source->pInCoeff;
+ ppInCoeff = source->ppInCoeff;
+ inCoeff = source->inCoeff;
+}
diff --git a/dfx-library/IIRfilter.h b/dfx-library/IIRfilter.h
new file mode 100755
index 0000000..8729d36
--- /dev/null
+++ b/dfx-library/IIRfilter.h
@@ -0,0 +1,156 @@
+#ifndef __IIRfilter
+#define __IIRfilter
+
+
+#define PI 3.1415926535897932384626433832795f
+#define SHELF_START_IIR 0.333f
+
+class IIRfilter
+{
+public:
+ IIRfilter();
+ ~IIRfilter();
+
+ void calculateLowpassCoefficients(float cutoff, float samplerate);
+ void calculateHighpassCoefficients(float cutoff, float samplerate);
+ void copyCoefficients(IIRfilter *source);
+
+ void reset()
+ {
+ prevIn = prevprevIn = prevOut = prevprevOut = prevprevprevOut = currentOut = 0.0f;
+ }
+
+ float prevIn, prevprevIn, prevOut, prevprevOut, prevprevprevOut, currentOut;
+ float pOutCoeff, ppOutCoeff, pInCoeff, ppInCoeff, inCoeff;
+
+
+#ifdef USING_HERMITE
+ void process(float currentIn)
+#else
+ float process(float currentIn)
+#endif
+ {
+ #ifdef USING_HERMITE
+ // store 4 samples of history if we're preprocessing for Hermite interpolation
+ prevprevprevOut = prevprevOut;
+ #endif
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+
+// currentOut = (currentIn*inCoeff) + (prevIn*pInCoeff) + (prevprevIn*ppInCoeff)
+// - (prevOut*pOutCoeff) - (prevprevOut*ppOutCoeff);
+ currentOut = ((currentIn+prevprevIn)*inCoeff) + (prevIn*pInCoeff)
+ - (prevOut*pOutCoeff) - (prevprevOut*ppOutCoeff);
+
+ prevprevIn = prevIn;
+ prevIn = currentIn;
+
+ #ifndef USING_HERMITE
+ return currentOut;
+ #endif
+ }
+
+#ifdef USING_HERMITE
+// start of pre-Hermite-specific functions
+// there are 4 versions, 3 of which unroll for loops of 2, 3, & 4 iterations
+
+ void processH1(float currentIn)
+ {
+ prevprevprevOut = prevprevOut;
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+ //
+ currentOut = ( (currentIn+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+ //
+ prevprevIn = prevIn;
+ prevIn = currentIn;
+ }
+
+ void processH2(float *in, long inPos, long arraySize)
+ {
+ float in0 = in[inPos];
+ float in1 = in[(inPos+1) % arraySize];
+
+ prevprevprevOut = prevprevOut;
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+ currentOut = ( (in0+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+ //
+ prevprevprevOut = prevprevOut;
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+ currentOut = ( (in1+prevIn) * inCoeff ) + (in0 * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+ //
+ prevprevIn = in0;
+ prevIn = in1;
+ }
+
+ void processH3(float *in, long inPos, long arraySize)
+ {
+ float in0 = in[inPos];
+ float in1 = in[(inPos+1) % arraySize];
+ float in2 = in[(inPos+2) % arraySize];
+
+ prevprevprevOut = ( (in0+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (currentOut * pOutCoeff) - (prevOut * ppOutCoeff);
+ prevprevOut = ((in1+prevIn) * inCoeff) + (in0 * pInCoeff)
+ - (prevprevprevOut * pOutCoeff) - (currentOut * ppOutCoeff);
+ prevOut = ((in2+in0) * inCoeff) + (in1 * pInCoeff)
+ - (prevprevOut * pOutCoeff) - (prevprevprevOut * ppOutCoeff);
+ //
+ currentOut = prevOut;
+ prevOut = prevprevOut;
+ prevprevOut = prevprevprevOut;
+ prevprevprevOut = currentOut;
+ //
+ prevprevIn = in1;
+ prevIn = in2;
+ }
+
+ void processH4(float *in, long inPos, long arraySize)
+ {
+ float in0 = in[inPos];
+ float in1 = in[(inPos+1) % arraySize];
+ float in2 = in[(inPos+2) % arraySize];
+ float in3 = in[(inPos+3) % arraySize];
+
+ prevprevprevOut = ( (in0+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (currentOut * pOutCoeff) - (prevOut * ppOutCoeff);
+ prevprevOut = ((in1+prevIn) * inCoeff) + (in0 * pInCoeff)
+ - (prevprevprevOut * pOutCoeff) - (currentOut * ppOutCoeff);
+ prevOut = ((in2+in0) * inCoeff) + (in1 * pInCoeff)
+ - (prevprevOut * pOutCoeff) - (prevprevprevOut * ppOutCoeff);
+ currentOut = ((in3+in1) * inCoeff) + (in2 * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+ //
+ prevprevIn = in2;
+ prevIn = in3;
+ }
+
+#endif
+// end of USING_HERMITE batch of functions
+
+}; // end of IIRfilter class definition
+
+
+
+// 4-point Hermite spline interpolation for use with IIR filter output histories
+inline float interpolateHermitePostFilter(IIRfilter *filter, double address)
+{
+ long pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+
+ float a = ( (3.0f*(filter->prevprevOut-filter->prevOut)) -
+ filter->prevprevprevOut + filter->currentOut ) * 0.5f;
+ float b = (2.0f*filter->prevOut) + filter->prevprevprevOut -
+ (2.5f*filter->prevprevOut) - (filter->currentOut*0.5f);
+ float c = (filter->prevOut - filter->prevprevprevOut) * 0.5f;
+
+ return (( ((a*posFract)+b) * posFract + c ) * posFract) + filter->prevprevOut;
+}
+
+
+#endif \ No newline at end of file
diff --git a/dfx-library/MultiKick.cpp b/dfx-library/MultiKick.cpp
new file mode 100644
index 0000000..f2b3a97
--- /dev/null
+++ b/dfx-library/MultiKick.cpp
@@ -0,0 +1,114 @@
+/*------------ by Tom Murphy 7 ][ October 2001 ------------*/
+
+#ifndef __MultiKick
+#include "MultiKick.hpp"
+#endif
+
+MultiKick::MultiKick (const CRect &size,
+ CControlListener *listener,
+ long tag,
+ int ns,
+ long heightOfOneImage,
+ CBitmap *background,
+ CPoint &offset) :
+ CControl (size, listener, tag, background),
+ numstates(ns),
+ offset (offset),
+ heightOfOneImage (heightOfOneImage),
+ buttondown(0), obdown(0), actualstate(0), oactualstate(0) {
+setDirty(true); }
+
+MultiKick::~MultiKick () {}
+
+float MultiKick::getValue() {
+ if (numstates == 1)
+ return 0.0f;
+ else if (actualstate >= numstates)
+ return 1.0f;
+ else
+ return ((float)actualstate)/((float)(numstates-1));
+}
+
+void MultiKick::setValue(float f) {
+ actualstate = (int) (f * (numstates-1));
+}
+
+bool MultiKick::isDirty() {
+ return (actualstate == oactualstate ||
+ buttondown == obdown);
+}
+
+void MultiKick::setDirty(const bool val) {
+ if (val) oactualstate = -1;
+ else {
+ oactualstate = actualstate;
+ obdown = buttondown;
+ }
+}
+
+void MultiKick::draw (CDrawContext *pContext) {
+ CPoint where (offset.h, offset.v);
+
+ where.v += heightOfOneImage * ((actualstate<<1) + buttondown);
+
+ if (pBackground) {
+ if (bTransparencyEnabled)
+ pBackground->drawTransparent (pContext, size, where);
+ else
+ pBackground->draw (pContext, size, where);
+ }
+
+ setDirty (false);
+}
+
+//------------------------------------------------------------------------
+void MultiKick::mouse (CDrawContext *pContext, CPoint &where) {
+ if (!bMouseEnabled) { buttondown = 0; return; }
+
+ long button = pContext->getMouseButtons ();
+ if (!(button & kLButton)) {
+ buttondown = 0;
+ return;
+ }
+
+ /* save old value in case the mouse is dragged off while the
+ button is still held down. */
+
+ int entrystate = actualstate;
+
+ if (pContext->getMouseButtons ()) {
+
+ // begin of edit parameter
+ getParent ()->beginEdit (tag);
+ do {
+ if (where.h >= size.left && where.v >= size.top &&
+ where.h <= size.right && where.v <= size.bottom) {
+ actualstate = entrystate + 1;
+ actualstate %= numstates;
+ buttondown = 1 /* 1 */;
+ } else {
+ actualstate = entrystate;
+ buttondown = 0;
+ }
+
+ if (isDirty ()) {
+ listener->valueChanged (pContext, this);
+ }
+
+ pContext->getMouseLocation (where);
+
+ doIdleStuff ();
+ draw(pContext);
+ } while (pContext->getMouseButtons ());
+
+ setDirty(true);
+ // end of edit parameter
+ getParent ()->endEdit (tag);
+ } else {
+ actualstate ++;
+ actualstate %= numstates;
+ }
+ draw(pContext);
+ buttondown = 0;
+ listener->valueChanged (pContext, this);
+}
diff --git a/dfx-library/MultiKick.hpp b/dfx-library/MultiKick.hpp
new file mode 100644
index 0000000..3e3c8b2
--- /dev/null
+++ b/dfx-library/MultiKick.hpp
@@ -0,0 +1,42 @@
+/*------------ by Tom Murphy 7 ][ October 2001 ------------*/
+
+#ifndef __MultiKick
+#define __MultiKick
+
+#ifndef __vstgui__
+#include "vstgui.h"
+#endif
+
+
+/* idea for multikick */
+
+class MultiKick : public CControl {
+public:
+ MultiKick (const CRect &size,
+ CControlListener *listener,
+ long tag,
+ int numstates_,
+ long heightOfOneImage, // pixel
+ CBitmap *background,
+ CPoint &offset);
+ virtual ~MultiKick ();
+
+ virtual void draw (CDrawContext*);
+ virtual void mouse (CDrawContext *pContext, CPoint &where);
+
+ virtual void setValue(float);
+ virtual float getValue();
+ virtual bool isDirty();
+ virtual void setDirty(const bool val = true);
+
+protected:
+ int numstates;
+ CPoint offset;
+ long heightOfOneImage;
+ int buttondown; /* is a button down? */
+ int obdown;
+ int actualstate;
+ int oactualstate;
+
+};
+#endif \ No newline at end of file
diff --git a/dfx-library/TempoRateTable.cpp b/dfx-library/TempoRateTable.cpp
new file mode 100755
index 0000000..bd39c5f
--- /dev/null
+++ b/dfx-library/TempoRateTable.cpp
@@ -0,0 +1,72 @@
+#ifndef __TempoRateTable
+#include "TempoRateTable.h"
+#endif
+
+#include <string.h>
+
+
+//-----------------------------------------------------------------------------
+TempoRateTable::TempoRateTable()
+{
+ int i;
+
+
+ scalars = 0;
+ scalars = new float[NUM_TEMPO_RATES];
+ displays = 0;
+ displays = new char*[NUM_TEMPO_RATES];
+ for (i = 0; i < NUM_TEMPO_RATES; i++)
+ displays[i] = new char[16];
+
+ i = 0;
+#ifdef USE_SLOW_TEMPO_RATES
+ scalars[i] = 1.f/5.f; strcpy(displays[i++], "1/12");
+ scalars[i] = 1.f/6.f; strcpy(displays[i++], "1/8");
+ scalars[i] = 1.f/5.f; strcpy(displays[i++], "1/7");
+#endif
+#ifndef USE_BUFFER_OVERRIDE_TEMPO_RATES
+ scalars[i] = 1.f/6.f; strcpy(displays[i++], "1/6");
+ scalars[i] = 1.f/5.f; strcpy(displays[i++], "1/5");
+#endif
+ scalars[i] = 1.f/4.f; strcpy(displays[i++], "1/4");
+ scalars[i] = 1.f/3.f; strcpy(displays[i++], "1/3");
+ scalars[i] = 1.f/2.f; strcpy(displays[i++], "1/2");
+ scalars[i] = 2.f/3.f; strcpy(displays[i++], "2/3");
+ scalars[i] = 3.f/4.f; strcpy(displays[i++], "3/4");
+ scalars[i] = 1.0f; strcpy(displays[i++], "1");
+ scalars[i] = 2.0f; strcpy(displays[i++], "2");
+ scalars[i] = 3.0f; strcpy(displays[i++], "3");
+ scalars[i] = 4.0f; strcpy(displays[i++], "4");
+ scalars[i] = 5.0f; strcpy(displays[i++], "5");
+ scalars[i] = 6.0f; strcpy(displays[i++], "6");
+ scalars[i] = 7.0f; strcpy(displays[i++], "7");
+ scalars[i] = 8.0f; strcpy(displays[i++], "8");
+ scalars[i] = 12.0f; strcpy(displays[i++], "12");
+ scalars[i] = 16.0f; strcpy(displays[i++], "16");
+ scalars[i] = 24.0f; strcpy(displays[i++], "24");
+ scalars[i] = 32.0f; strcpy(displays[i++], "32");
+ scalars[i] = 48.0f; strcpy(displays[i++], "48");
+ scalars[i] = 64.0f; strcpy(displays[i++], "64");
+ scalars[i] = 96.0f; strcpy(displays[i++], "96");
+#ifndef USE_SLOW_TEMPO_RATES
+ scalars[i] = 333.0f; strcpy(displays[i++], "333");
+#ifndef USE_BUFFER_OVERRIDE_TEMPO_RATES
+ scalars[i] = 3000.0f; strcpy(displays[i++], "infinity");
+#endif
+#endif
+}
+
+//-----------------------------------------------------------------------------
+TempoRateTable::~TempoRateTable()
+{
+ if (scalars)
+ delete[] scalars;
+ for (int i=0; i < NUM_TEMPO_RATES; i++)
+ {
+ if (displays[i])
+ delete[] displays[i];
+ }
+ if (displays)
+ delete[] displays;
+ displays = 0;
+}
diff --git a/dfx-library/TempoRateTable.h b/dfx-library/TempoRateTable.h
new file mode 100755
index 0000000..00f8cc7
--- /dev/null
+++ b/dfx-library/TempoRateTable.h
@@ -0,0 +1,47 @@
+#ifndef __TempoRateTable
+#define __TempoRateTable
+
+
+//--------------------------------------------------------------------------
+// the number of tempo beat division options
+#ifdef USE_SLOW_TEMPO_RATES
+ #define NUM_TEMPO_RATES 25
+#else
+ #ifdef USE_BUFFER_OVERRIDE_TEMPO_RATES
+ #define NUM_TEMPO_RATES 21
+ #else
+ #define NUM_TEMPO_RATES 24
+ #endif
+#endif
+
+
+
+//--------------------------------------------------------------------------
+// this holds the beat scalar values & textual displays for the tempo rates
+class TempoRateTable
+{
+public:
+ TempoRateTable();
+ ~TempoRateTable();
+
+ float getScalar(float paramValue)
+ { return scalars[float2index(paramValue)]; }
+ char * getDisplay(float paramValue)
+ { return displays[float2index(paramValue)]; }
+
+protected:
+ int float2index(float f)
+ {
+ if (f < 0.0f)
+ f = 0.0f;
+ else if (f > 1.0f)
+ f = 1.0f;
+ return (int) (f * ((float)NUM_TEMPO_RATES-0.9f));
+ }
+
+ float *scalars;
+ char **displays;
+};
+
+
+#endif \ No newline at end of file
diff --git a/dfx-library/dfxmisc.cpp b/dfx-library/dfxmisc.cpp
new file mode 100755
index 0000000..9d2d814
--- /dev/null
+++ b/dfx-library/dfxmisc.cpp
@@ -0,0 +1,77 @@
+#ifndef __dfxmisc
+#include "dfxmisc.h"
+#endif
+
+
+/*
+//-----------------------------------------------------------------------------------------
+// the calculates the number of samples until the next musical measure starts
+
+long samplesToNextBar(VstTimeInfo *timeInfo)
+{
+ // default these values to something reasonable in case they are not available from the host
+ double currentBarStartPos = 0.0, currentPPQpos = 0.0, meterNumerator = 4.0;
+ double currentTempoBPS, numPPQ;
+ long numSamples;
+
+
+ // exit immediately if timeInfo got returned NULL - there's nothing we can do in that case
+ if (timeInfo == NULL)
+ return 0;
+ if (kVstTempoValid & timeInfo->flags)
+ currentTempoBPS = timeInfo->tempo / 60.0;
+ // there's no point in going on with this if the host isn't supplying tempo
+ else
+ return 0;
+
+ // get the song beat position of the beginning of the previous measure
+ if (kVstBarsValid & timeInfo->flags)
+ currentBarStartPos = timeInfo->barStartPos;
+
+ // get the song beat position of our precise current location
+ if (kVstPpqPosValid & timeInfo->flags)
+ currentPPQpos = timeInfo->ppqPos;
+
+ // get the numerator of the time signature - this is the number of beats per measure
+ if (kVstTimeSigValid & timeInfo->flags)
+ meterNumerator = (double) timeInfo->timeSigNumerator;
+ // it will screw up the while loop below bigtime if timeSigNumerator isn't a positive number
+ if (meterNumerator <= 0.0)
+ meterNumerator = 4.0;
+
+ // calculate the distance in beats to the upcoming measure beginning point
+ if (currentBarStartPos == currentPPQpos)
+ numPPQ = 0.0;
+ else
+ numPPQ = currentBarStartPos + meterNumerator - currentPPQpos;
+
+ // do this stuff because some hosts (Cubase) give kind of wacky barStartPos sometimes
+ while (numPPQ < 0.0)
+ numPPQ += meterNumerator;
+ while (numPPQ > meterNumerator)
+ numPPQ -= meterNumerator;
+
+ // convert the value for the distance to the next measure from beats to samples
+ numSamples = (long) ( numPPQ * timeInfo->sampleRate / currentTempoBPS );
+
+ // return the number of samples until the next measure
+ if (numSamples < 0) // just protecting again against wacky values
+ return 0;
+ else
+ return numSamples;
+}
+*/
+
+//-----------------------------------------------------------------------------------------
+// computes the principle branch of the Lambert W function
+// { LambertW(x) = W(x), where W(x) * exp(W(x)) = x }
+
+double LambertW(double input)
+{
+ double x = fabs(input);
+
+ if (x <= 500.0)
+ return 0.665 * ( 1.0 + (0.0195 * log(x+1.0)) ) * log(x+1.0) + 0.04;
+ else
+ return log(x-4.0) - ( (1.0 - 1.0/log(x)) * log(log(x)) );
+}
diff --git a/dfx-library/dfxmisc.h b/dfx-library/dfxmisc.h
new file mode 100755
index 0000000..1f70aa2
--- /dev/null
+++ b/dfx-library/dfxmisc.h
@@ -0,0 +1,194 @@
+#ifndef __dfxmisc
+#define __dfxmisc
+
+#include <math.h>
+#include <stdlib.h>
+
+#ifdef WIN32
+/* turn off warnings about default but no cases in switch, etc. */
+ #pragma warning( disable : 4065 57 4200 4244 )
+ #include <windows.h>
+#endif
+
+
+//-----------------------------------------------------------------------------
+// constants & macros
+
+#define DESTROY_FX_RULEZ
+
+#define onOffTest(fvalue) ((fvalue) > 0.5f)
+
+#define paramRangeScaled(value,min,max) ( ((value) * ((max)-(min))) + (min) )
+#define paramRangeUnscaled(value,min,max) ( ((value)-(min)) / ((max)-(min)) )
+#define paramRangeSquaredScaled(value,min,max) ( ((value)*(value) * ((max)-(min))) + (min) )
+#define paramRangeSquaredUnscaled(value,min,max) ( sqrtf(((value)-(min)) / ((max)-(min))) )
+#define paramRangeCubedScaled(value,min,max) ( ((value)*(value)*(value) * ((max)-(min))) + (min) )
+#define paramRangeCubedUnscaled(value,min,max) ( powf(((value)-(min)) / ((max)-(min)), 1.0f/3.0f) )
+#define paramRangePowScaled(value,min,max,power) ( (powf((value),(power)) * ((max)-(min))) + (min) )
+#define paramRangePowUnscaled(value,min,max,power) ( powf(((value)-(min)) / ((max)-(min)), 1.0f/(power)) )
+#define paramRangeExpScaled(value,min,max) ( expf(logf((max)-(min)+1.0f)*(value)) + (min) - 1.0f )
+#define paramRangeExpUnscaled(value,min,max) ( logf(1.0f-(min)+(value)) / logf(1.0f-(min)+(max)) )
+#define paramSteppedScaled(value,numSteps) ( (long)((value) * ((float)(numSteps)-0.01f)) )
+#define paramSteppedUnscaled(step,numSteps) ( (float)(step) / ((float)((numSteps)-1)) )
+#define paramRangeIntScaled(value,min,max) ( (long)((value) * ((float)((max)-(min)+1)-0.01f)) + (min) )
+#define paramRangeIntUnscaled(step,min,max) ( (float)((step)-(min)) / (float)((max)-(min)) )
+// scale logarithmicly from 20 Hz to 20 kHz
+#define paramFrequencyScaled(value) (20.0f * powf(2.0f, (value) * 9.965784284662088765571752446703612804412841796875f))
+#define paramFrequencyUnscaled(value) ( (logf((value)/20.0f)/logf(2.0f)) / 9.965784284662088765571752446703612804412841796875f )
+
+#define dBconvert(fvalue) ( 20.0f * log10f((fvalue)) )
+
+#ifndef PI
+#define PI 3.1415926535897932384626433832795f
+#endif
+#ifndef PId
+#define PId 3.1415926535897932384626433832795
+#endif
+
+// reduces wasteful casting & division
+const float ONE_DIV_RAND_MAX = 1.0f / (float)RAND_MAX;
+#define randFloat() ( (float)rand() * ONE_DIV_RAND_MAX )
+
+#ifndef clip
+#define clip(fvalue) (if (fvalue < -1.0f) fvalue = -1.0f; else if (fvalue > 1.0f) fvalue = 1.0f)
+#endif
+
+#ifndef undenormalize
+#define undenormalize(fvalue) if (fabs(fvalue) < 1.0e-15) fvalue = 0.0
+//#define undenormalize(fvalue) (((*(unsigned int*)&(fvalue))&0x7f800000)==0)?0.0f:(fvalue)
+#endif
+
+//#define kBeatSyncTimeInfoFlags (kVstTempoValid | kVstTransportChanged | kVstBarsValid | kVstPpqPosValid | kVstTimeSigValid)
+#define kBeatSyncTimeInfoFlags 1
+
+/* return the parameter with larger magnitude */
+inline float magmax(float a, float b) {
+ if (fabs(a) > fabs(b)) return a;
+ else return b;
+}
+
+
+//-----------------------------------------------------------------------------
+// function prototypes
+
+//pi
+//long samplesToNextBar(VstTimeInfo *timeInfo);
+
+// pi
+//void processProgramChangeEvents(VstEvents *events, AudioEffectX *effect);
+
+double LambertW(double input);
+
+
+//-----------------------------------------------------------------------------
+// inline functions
+
+//-----------------------------------------------------------------------------
+inline float interpolateHermite(float *data, double address, long arraysize)
+{
+ long pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+
+ long posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ long posPlus1 = (pos+1) % arraysize;
+ long posPlus2 = (pos+2) % arraysize;
+
+ float a = ( (3.0f*(data[pos]-data[posPlus1])) - data[posMinus1] + data[posPlus2] ) * 0.5f;
+ float b = (2.0f*data[posPlus1]) + data[posMinus1] - (2.5f*data[pos]) - (data[posPlus2]*0.5f);
+ float c = (data[posPlus1] - data[posMinus1]) * 0.5f;
+
+ return (( ((a*posFract)+b) * posFract + c ) * posFract) + data[pos];
+}
+
+inline float interpolateLinear(float *data, double address, long arraysize)
+{
+ long pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+ return (data[pos] * (1.0f-posFract)) + (data[(pos+1)%arraysize] * posFract);
+}
+
+inline float interpolateRandom(float randMin, float randMax)
+{
+ float randy = (float)rand() * ONE_DIV_RAND_MAX;
+ return ((randMax-randMin) * randy) + randMin;
+}
+
+inline float interpolateLinear2values(float point1, float point2, double address)
+{
+ float posFract = (float) (address - (double)((long)address));
+ return (point1 * (1.0f-posFract)) + (point2 * posFract);
+}
+
+//-----------------------------------------------------------------------------
+// I found this somewhere on the internet
+/*
+inline float anotherSqrt(float x)
+{
+ float result = 1.0f;
+ float store = 0.0f;
+ while (store != result)
+ {
+ store = result;
+ result = 0.5f * (result + (x / result));
+ }
+}
+*/
+
+
+//-----------------------------------------------------------------------------
+// mutex stuff
+
+#if WIN32
+
+struct dfxmutex {
+ CRITICAL_SECTION c;
+ dfxmutex() { InitializeCriticalSection(&c); }
+ ~dfxmutex() { DeleteCriticalSection(&c); }
+ void grab() { EnterCriticalSection(&c); }
+ void release() { LeaveCriticalSection(&c); }
+};
+
+/*
+#elif MAC
+
+// Multiprocessing Services
+#include <Multiprocessing.h>
+struct dfxmutex {
+ OSStatus initErr, deleteErr, enterErr, exitErr;
+ MPCriticalRegionID c;
+ Duration timeout; // in ms (available constants: kDurationImmediate, kDurationForever, kDurationMillisecond, kDurationMicrosecond)
+ dfxmutex() { initErr = MPCreateCriticalRegion(&c); }
+ ~dfxmutex() { deleteErr = MPDeleteCriticalRegion(c); }
+ void grab () { enterErr = MPEnterCriticalRegion(c, kDurationForever); }
+ void release () { exitErr = MPExitCriticalRegion(c); }
+};
+
+// POSIX
+// can this even work for CFM? perhaps only mach-o
+#include <pthread.h>
+//#include <Carbon/Carbon.h>
+struct dfxmutex {
+ int initErr, deleteErr, enterErr, exitErr;
+ pthread_mutex_t c;
+ dfxmutex() { initErr = pthread_mutex_init(&c, NULL); }
+ ~dfxmutex() { deleteErr = pthread_mutex_destroy(&c); }
+ void grab () { enterErr = pthread_mutex_lock(&c); }
+ void release () { exitErr = pthread_mutex_unlock(&c);
+ //pthread_testcancel();
+ }
+};
+*/
+
+#else
+
+struct dfxmutex {
+ dfxmutex() {}
+ ~dfxmutex() {}
+ void grab () {}
+ void release () {}
+};
+
+#endif
+
+
+#endif
diff --git a/dfx-library/lfo.cpp b/dfx-library/lfo.cpp
new file mode 100755
index 0000000..58a58c3
--- /dev/null
+++ b/dfx-library/lfo.cpp
@@ -0,0 +1,178 @@
+#ifndef __lfo
+#include "lfo.h"
+#endif
+
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+
+//------------------------------------------------------------------------
+LFO::LFO()
+{
+ sineTable = new float[NUM_LFO_POINTS];
+ triangleTable = new float[NUM_LFO_POINTS];
+ squareTable = new float[NUM_LFO_POINTS];
+ sawTable = new float[NUM_LFO_POINTS];
+ reverseSawTable = new float[NUM_LFO_POINTS];
+ thornTable = new float[NUM_LFO_POINTS];
+
+ fillLFOtables();
+ table = sineTable; // just to have it pointing to something at least
+
+ srand((unsigned int)time(NULL)); // sets a seed value for rand() from the system clock
+
+ reset();
+}
+
+//------------------------------------------------------------------------
+LFO::~LFO()
+{
+ if (sineTable)
+ delete[] sineTable;
+ if (triangleTable)
+ delete[] triangleTable;
+ if (squareTable)
+ delete[] squareTable;
+ if (sawTable)
+ delete[] sawTable;
+ if (reverseSawTable)
+ delete[] reverseSawTable;
+ if (thornTable)
+ delete[] thornTable;
+}
+
+//------------------------------------------------------------------------
+void LFO::reset()
+{
+ position = 0.0f;
+ stepSize = 1.0f; // just to avoid anything really screwy
+ oldRandomNumber = (float)rand() / (float)RAND_MAX;
+ randomNumber = (float)rand() / (float)RAND_MAX;
+ smoothSamples = 0;
+ granularityCounter = 0;
+}
+
+//-----------------------------------------------------------------------------------------
+// this function creates tables for mapping out the sine, triangle, & saw LFO shapes
+
+void LFO::fillLFOtables()
+{
+ long i, n;
+
+
+ // fill the sine waveform table (oscillates from 0 to 1 & back to 0)
+ for (i = 0; (i < NUM_LFO_POINTS); i++)
+ sineTable[i] = (sinf( ( ((float)i/(float)NUM_LFO_POINTS)-0.25f ) * 2.0f * PI ) + 1.0f) * 0.5f;
+
+ // fill the triangle waveform table
+ // ramp from 0 to 1 for the first half
+ for (i = 0; (i < NUM_LFO_POINTS/2); i++)
+ triangleTable[i] = (float)i / (float)(NUM_LFO_POINTS/2);
+ // & ramp from 1 to 0 for the second half
+ for (n = 0; (i < NUM_LFO_POINTS); n++)
+ {
+ triangleTable[i] = 1.0f - ((float)n / (float)(NUM_LFO_POINTS/2));
+ i++;
+ }
+
+ // fill the square waveform table
+ // stay at 1 for the first half
+ for (i = 0; (i < NUM_LFO_POINTS/2); i++)
+ squareTable[i] = 1.0f;
+ // & 0 for the second half
+ for (n = 0; (i < NUM_LFO_POINTS); n++)
+ {
+ squareTable[i] = 0.0f;
+ i++;
+ }
+
+ // fill the sawtooth waveform table (ramps from 0 to 1)
+ for (i = 0; (i < NUM_LFO_POINTS); i++)
+ sawTable[i] = (float)i / (float)(NUM_LFO_POINTS-1);
+
+ // fill the reverse sawtooth waveform table (ramps from 1 to 0)
+ for (i = 0; (i < NUM_LFO_POINTS); i++)
+ reverseSawTable[i] = (float)(NUM_LFO_POINTS-i-1) / (float)(NUM_LFO_POINTS-1);
+
+ // fill the thorn waveform table
+ // exponentially slope up from 0 to 1 for the first half
+ for (i = 0; (i < NUM_LFO_POINTS/2); i++)
+ thornTable[i] = powf( ((float)i / (float)(NUM_LFO_POINTS/2)), 2.0f );
+ // & exponentially slope down from 1 to 0 for the second half
+ for (n = 0; (i < NUM_LFO_POINTS); n++)
+ {
+ thornTable[i] = powf( (1.0f - ((float)n / (float)(NUM_LFO_POINTS/2))), 2.0f );
+ i++;
+ }
+}
+
+
+//--------------------------------------------------------------------------------------
+void LFO::getShapeName(char *nameString)
+{
+ switch (LFOshapeScaled(fShape))
+ {
+ case kSineLFO : strcpy(nameString, "sine"); break;
+ case kTriangleLFO : strcpy(nameString, "triangle"); break;
+ case kSquareLFO : strcpy(nameString, "square"); break;
+ case kSawLFO : strcpy(nameString, "sawtooth"); break;
+ case kReverseSawLFO : strcpy(nameString, "reverse sawtooth"); break;
+ case kThornLFO : strcpy(nameString, "thorn"); break;
+ case kRandomLFO : strcpy(nameString, "random"); break;
+ case kRandomInterpolatingLFO : strcpy(nameString, "random interpolating"); break;
+ default : break;
+ }
+}
+
+
+//--------------------------------------------------------------------------------------
+// this function points the LFO table pointers to the correct waveform tables
+
+void LFO::pickTheLFOwaveform()
+{
+ switch (LFOshapeScaled(fShape))
+ {
+ case kSineLFO :
+ table = sineTable;
+ break;
+ case kTriangleLFO :
+ table = triangleTable;
+ break;
+ case kSquareLFO :
+ table = squareTable;
+ break;
+ case kSawLFO :
+ table = sawTable;
+ break;
+ case kReverseSawLFO :
+ table = reverseSawTable;
+ break;
+ case kThornLFO :
+ table = thornTable;
+ break;
+ default :
+ table = sineTable;
+ break;
+ }
+}
+
+//--------------------------------------------------------------------------------------
+// calculates the position within an LFO's cycle needed to sync to the song's beat
+
+void LFO::syncToTheBeat(long samplesToBar)
+{
+ float countdown, cyclesize;
+
+ // calculate how many samples long the LFO cycle is
+ cyclesize = NUM_LFO_POINTS_FLOAT / stepSize;
+ // calculate many more samples it will take for this cycle to coincide with the beat
+ countdown = fmodf( (float)samplesToBar, cyclesize);
+ // & convert that into the correct LFO position according to its table step size
+ position = (cyclesize - countdown) * stepSize;
+ // wrap around the new position if it is beyond the end of the LFO table
+ if (position >= NUM_LFO_POINTS_FLOAT)
+ position = fmodf(position, NUM_LFO_POINTS_FLOAT);
+}
diff --git a/dfx-library/lfo.h b/dfx-library/lfo.h
new file mode 100755
index 0000000..0c743c7
--- /dev/null
+++ b/dfx-library/lfo.h
@@ -0,0 +1,150 @@
+/*------------------- by Marc Poirier ][ January 2002 ------------------*/
+
+#ifndef __lfo
+#define __lfo
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "dfxmisc.h"
+#include "TempoRateTable.h"
+
+
+//-------------------------------------------------------------------------------------
+// these are the 8 LFO waveforms:
+enum
+{
+ kSineLFO,
+ kTriangleLFO,
+ kSquareLFO,
+ kSawLFO,
+ kReverseSawLFO,
+ kThornLFO,
+ kRandomLFO,
+ kRandomInterpolatingLFO,
+
+ numLFOshapes
+};
+
+//-------------------------------------------------------------------------------------
+// constants & macros
+
+#define LFOshapeScaled(A) (paramSteppedScaled((A), numLFOshapes))
+#define LFOshapeUnscaled(A) (paramSteppedUnscaled((A), numLFOshapes))
+
+#define NUM_LFO_POINTS 512
+const float NUM_LFO_POINTS_FLOAT = (float)NUM_LFO_POINTS; // to reduce casting later on
+const float LFO_TABLE_STEP = 1.0f / (float)NUM_LFO_POINTS; // to reduce division & encourage multiplication
+const long SQUARE_HALF_POINT = NUM_LFO_POINTS / 2; // the point in the table when the square waveform drops to zero
+
+#define LFO_SMOOTH_DUR 48
+const float LFO_SMOOTH_STEP = 1.0f / (float)LFO_SMOOTH_DUR;
+
+// this scales the return of processLFO() from 0.0 - 1.0 output to 0.0 - 2.0 (oscillating around 1.0)
+#define processLFOzero2two(A) ( ((A)->processLFO() * 2.0f) - (A)->fDepth + 1.0f );
+
+
+//-----------------------------------------------------------------------------
+class LFO
+{
+public:
+ LFO();
+ ~LFO();
+
+ void reset();
+ void fillLFOtables();
+
+ void pickTheLFOwaveform();
+ void getShapeName(char *nameString);
+
+ void syncToTheBeat(long samplesToBar);
+
+ // the LFO waveform tables
+ float *sineTable, *triangleTable, *squareTable, *sawTable, *reverseSawTable, *thornTable;
+
+ // the following are intended to be used as 0.0 - 1.0 VST parameter values:
+ float fOnOff; // parameter value for turning the LFO on or off
+ float fTempoSync; // parameter value for toggling tempo sync
+ float fRate; // parameter value for LFO rate (in Hz)
+ float fTempoRate; // parameter value for LFO rate (in cycles per beat)
+ float fDepth; // parameter value LFO depth
+ float fShape; // parameter value for LFO shape
+
+ bool onOff; // in case it's easier to have a bool version of fOnOff
+ float position; // this tracks the position in the LFO table
+ float stepSize; // size of the steps through the LFO table
+ float *table; // pointer to the LFO table
+ float randomNumber; // this stores random values for the random LFO waveforms
+ float oldRandomNumber; // this stores previous random values for the random interpolating LFO waveform
+ float cycleRate; // the rate in Hz of the LFO (only used for first layer LFOs)
+ long smoothSamples; // a counter for the position during a smoothing fade
+ long granularityCounter; // a counter for implementing LFO processing on a block basis
+ long granularity; // the number of samples to wait before processing
+
+
+ //--------------------------------------------------------------------------------------
+ // This function wraps around the LFO table position when it passes the cycle end.
+ // It also sets up the smoothing counter if a discontiguous LFO waveform is being used.
+ void updatePosition(long numSteps = 1)
+ {
+ // increment the LFO position tracker
+ position += (stepSize * (float)numSteps);
+
+ if (position >= NUM_LFO_POINTS_FLOAT)
+ {
+ // wrap around the position tracker if it has made it past the end of the LFO table
+ position = fmodf(position, NUM_LFO_POINTS_FLOAT);
+ // get new random LFO values, too
+ oldRandomNumber = randomNumber;
+ randomNumber = (float)rand() / (float)RAND_MAX;
+ // set up the sample smoothing if a discontiguous waveform's cycle just ended
+ switch (LFOshapeScaled(fShape))
+ {
+ case kSquareLFO :
+ case kSawLFO :
+ case kReverseSawLFO :
+ case kRandomLFO :
+ smoothSamples = LFO_SMOOTH_DUR;
+ default:
+ break;
+ }
+ }
+
+ // special check for the square waveform - it also needs smoothing at the half point
+ else if (LFOshapeScaled(fShape) == kSquareLFO)
+ {
+ // check to see if it has just passed the halfway point
+ if ( ((long)position >= SQUARE_HALF_POINT) &&
+ ((long)(position - stepSize) < SQUARE_HALF_POINT) )
+ smoothSamples = LFO_SMOOTH_DUR;
+ }
+ }
+
+ //--------------------------------------------------------------------------------------
+ // this function gets the current 0.0 - 1.0 output value of the LFO & increments its position
+ float processLFO()
+ {
+ float randiScalar, outValue;
+ int shape = LFOshapeScaled(fShape);
+
+ if (shape == kRandomInterpolatingLFO)
+ {
+ // calculate how far into this LFO cycle we are so far, scaled from 0.0 to 1.0
+ randiScalar = position * LFO_TABLE_STEP;
+ // interpolate between the previous random number & the new one
+ outValue = (randomNumber * randiScalar) + (oldRandomNumber * (1.0f-randiScalar));
+ }
+ //
+ else if (shape == kRandomLFO)
+ outValue = randomNumber;
+ //
+ else
+ outValue = table[(long)position];
+
+ return (outValue * fDepth);
+ }
+
+};
+
+
+#endif \ No newline at end of file
diff --git a/original/bo2-source.sit b/original/bo2-source.sit
new file mode 100755
index 0000000..19c30a9
--- /dev/null
+++ b/original/bo2-source.sit
Binary files differ
diff --git a/original/polarizer-source.sit b/original/polarizer-source.sit
new file mode 100644
index 0000000..615ada9
--- /dev/null
+++ b/original/polarizer-source.sit
Binary files differ
diff --git a/original/transverb-source.sit b/original/transverb-source.sit
new file mode 100755
index 0000000..d6d9536
--- /dev/null
+++ b/original/transverb-source.sit
Binary files differ
diff --git a/polarizer/makefile b/polarizer/makefile
new file mode 100755
index 0000000..ba707dd
--- /dev/null
+++ b/polarizer/makefile
@@ -0,0 +1,46 @@
+CXX=g++
+CFLAGS=-O6 -mcpu=pentiumpro -g -ggdb
+FLAGS=-DPD
+
+FLEXTPATH=/usr/local/lib/pd/externs/flext
+#DFXINC=../dfx-library
+
+INCLUDES=/usr/local/lib/pd/include $(FLEXTPATH) #$(DFXINC)
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+LIBS=m
+
+PDEXTRA=/usr/local/lib/pd/extra
+
+TARGET=polarizer~.pd_linux
+
+SRCS=polarizer.cpp
+
+all: $(TARGET)
+
+%.o : %.cpp %.hpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(DFXINC)/%.o : $(DFXINC)/%.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+install: $(TARGET)
+ chown root.root $^
+ cp $^ $(PDEXTRA)
+
+.PHONY: clean
+clean:
+ rm -f *.o $(TARGET)
+
+
+
+
+
+
+
+
diff --git a/polarizer/polarizer.cpp b/polarizer/polarizer.cpp
new file mode 100644
index 0000000..e04f8fe
--- /dev/null
+++ b/polarizer/polarizer.cpp
@@ -0,0 +1,112 @@
+/*---------------------------------------------------------------
+
+ © 2001, Marcberg Soft und Hard GmbH, All Rights Perversed
+
+---------------------------------------------------------------*/
+
+#ifndef __polarizer
+#include "polarizer.hpp"
+#endif
+
+#include <stdio.h>
+
+//-----------------------------------------------------------------------------
+// initializations & such
+
+polarizer::polarizer(int argc, t_atom *argv) {
+
+ fSkip = 0.0f;
+ fAmount = 0.5f;
+ fImplode = 0.0f;
+
+ state = polarized; // the first sample is polarized
+
+ post("_ ____polarize~ ");
+
+ AddInSignal();
+ AddInFloat(3);
+ AddOutSignal();
+ SetupInOut();
+
+ FLEXT_ADDMETHOD( 1,setSkip);
+ FLEXT_ADDMETHOD( 2,setAmount);
+ FLEXT_ADDMETHOD( 3,setImplode);
+
+ post("_ ____ ____ _");
+}
+
+// GIMME class:
+FLEXT_NEW_TILDE_G("polarizer~", polarizer)
+
+//-----------------------------------------------------------------------------------------
+void polarizer::processReplacing(float **inputs, float **outputs, long sampleFrames) {
+ float amp;
+
+ for (long samplecount=0; (samplecount < sampleFrames); samplecount++)
+ {
+ amp = processSampleAmp();
+ outputs[0][samplecount] = processOutValue(amp, inputs[0][samplecount]);
+ }
+}
+
+
+void polarizer::m_signal(int n, float *const *in, float *const *out) {
+
+ // directly move everything to the vst part
+ processReplacing((float **)in, (float **)out,(long)n);
+} // end m_signal
+
+
+
+//-----------------------------------------------------------------------------------------
+// titles of each parameter
+
+void polarizer::m_help() {
+ post(" inlet --- uno ----> ___ _ leap [ ranging from about 1 to 81 ] samples");
+ post(" inlet -- due -- >>>>> ___ _ _ polarize :: 0~1 __ ------ _ amount");
+ post(" inlet ------- >> implode << ------- | triggered madness | burn the speakers");
+}
+
+
+//-----------------------------------------------------------------------------------------
+// this is for getting the scalar value amp for the current sample
+
+float polarizer::processSampleAmp() {
+
+ switch (state)
+ {
+ case unaffected: // nothing much happens in this section
+ if (--unaffectedSamples <= 0) // go to polarized when the leap is done
+ state = polarized;
+ return 1.0f;
+ break;
+ // end unaffected
+
+ case polarized:
+ state = unaffected; // go right back to unaffected
+ // but first figure out how long unaffected will last this time
+ unaffectedSamples = leapScaled(fSkip);
+ return (0.5f - fAmount) * 2.0f; // this is the polarization scalar
+ break;
+ // end polarized
+
+ default : return 1.0f;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+// this is for calculating & sending the current sample output value to the output stream
+
+float polarizer::processOutValue(float amp, float in) {
+ float out = (in * amp); // if implode is off, just do the regular polarizing thing
+
+ if (fImplode >= 1.0f) // if it's on, then implode the audio signal
+ {
+ if (out > 0.0f) // invert the sample between 1 & 0
+ out = 1.0f - out;
+ else // invert the sample between -1 & 0
+ out = -1.0f - out;
+ }
+
+ return out;
+}
diff --git a/polarizer/polarizer.hpp b/polarizer/polarizer.hpp
new file mode 100644
index 0000000..fb0eff4
--- /dev/null
+++ b/polarizer/polarizer.hpp
@@ -0,0 +1,78 @@
+/*---------------------------------------------------------------
+
+ © 2001, Marcberg Soft & Hard GmbH, All Rights Reserved
+
+---------------------------------------------------------------*/
+
+#ifndef __polarizer_H
+#define __polarizer_H
+
+#include <stdlib.h>
+#include <math.h>
+
+#include "flext.h"
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 202)
+#error You need at least flext version 0.2.2
+#endif
+
+#define normalize(f,a,b) ((((f < b) ? f : b) > a) ? f : a)
+
+// these are the 2 states of the process:
+enum {
+ unaffected,
+ polarized
+};
+
+//-----------------------------------------------------------------------------
+// constants
+
+const long SKIPMIN = 1;
+const long SKIPMAX = 81;
+const long SKIPRANGE = SKIPMAX - SKIPMIN;
+
+// this is for converting from parameter entries to the real values
+#define leapScaled(A) ( ((long)(powf((A),1.5f)*SKIPRANGE)) + SKIPMIN )
+
+//-----------------------------------------------------------------------------
+
+class polarizer :
+ public flext_dsp {
+
+ FLEXT_HEADER(polarizer, flext_dsp)
+
+public:
+ polarizer(int argc, t_atom *argv);
+// ~polarizer();
+
+ virtual void processReplacing(float **inputs, float **outputs, long sampleFrames);
+
+ virtual void m_signal(int, t_sample *const *, t_sample *const *);
+ virtual void m_help();
+
+protected:
+ float processSampleAmp();
+ float processOutValue(float amp, float in);
+
+ float fSkip, fAmount, fImplode; // the parameters
+ char *programName;
+ long unaffectedSamples; // sample counter
+ int state; // the state of the process
+
+ FLEXT_CALLBACK_F(setSkip)
+ void setSkip(float f) {
+ fSkip = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setAmount)
+ void setAmount(float f) {
+ fAmount = normalize(f,0,1);
+ }
+
+ FLEXT_CALLBACK_F(setImplode)
+ void setImplode(float f) {
+ fImplode = normalize(f,0,1);
+ }
+};
+
+#endif
diff --git a/polarizer/polarizerBi.cpp b/polarizer/polarizerBi.cpp
new file mode 100644
index 0000000..e270f55
--- /dev/null
+++ b/polarizer/polarizerBi.cpp
@@ -0,0 +1,165 @@
+/*---------------------------------------------------------------
+
+ © 2001, Marcberg Soft und Hard GmbH, All Rights Perversed
+
+---------------------------------------------------------------*/
+
+#ifndef __polarizer
+#include "polarizer.hpp"
+#endif
+
+#include <stdio.h>
+
+//-----------------------------------------------------------------------------------------
+// Destroy FX infos
+
+long Polarizer::getVendorVersion() {
+ return 1; }
+
+bool Polarizer::getErrorText(char *text) {
+ strcpy (text, "We're not gonna to make it."); // max 256 char
+ return true; }
+
+bool Polarizer::getVendorString(char *text) {
+ strcpy (text, "Destroy FX"); // a string identifying the vendor (max 64 char)
+ return true; }
+
+bool Polarizer::getProductString(char *text) {
+ // a string identifying the product name (max 64 char)
+ strcpy (text, "Super Destroy FX bipolar VST plugin pack");
+ return true; }
+
+//-----------------------------------------------------------------------------------------
+Polarizer::~Polarizer()
+{
+ if (programName)
+ delete[] programName;
+}
+
+//-----------------------------------------------------------------------------------------
+void Polarizer::setProgramName(char *name)
+{
+ strcpy(programName, name);
+}
+
+//-----------------------------------------------------------------------------------------
+void Polarizer::getProgramName(char *name)
+{
+ strcpy(name, programName);
+}
+
+//-----------------------------------------------------------------------------------------
+void Polarizer::setParameter(long index, float value)
+{
+ switch (index)
+ {
+ case kSkip : fSkip = value; break;
+ case kAmount : fAmount = value; break;
+ case kImplode : fImplode = value; break;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+float Polarizer::getParameter(long index)
+{
+ switch (index)
+ {
+ default:
+ case kSkip : return fSkip;
+ case kAmount : return fAmount;
+ case kImplode : return fImplode;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+// titles of each parameter
+
+void Polarizer::getParameterName(long index, char *label)
+{
+ switch (index)
+ {
+ case kSkip : strcpy(label, " leap "); break;
+ case kAmount : strcpy(label, "polarize"); break;
+ case kImplode : strcpy(label, "implode"); break;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+// numerical display of each parameter's gradiations
+
+void Polarizer::getParameterDisplay(long index, char *text)
+{
+ switch (index)
+ {
+ case kSkip :
+ sprintf(text, "%ld", leapScaled(fSkip));
+ break;
+ case kAmount :
+ sprintf(text, "%.3f", fAmount);
+ break;
+ case kImplode :
+ if (fImplode >= 0.03f) strcpy(text, "yes");
+ else strcpy(text, "no");
+ break;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+// unit of measure for each parameter
+
+void Polarizer::getParameterLabel(long index, char *label)
+{
+ switch (index)
+ {
+ case kSkip :
+ if (leapScaled(fSkip) == 1) strcpy(label, "sample ");
+ else strcpy(label, "samples");
+ break;
+ case kAmount : strcpy(label, "amount"); break;
+ case kImplode : strcpy(label, " "); break;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+// this is for getting the scalar value amp for the current sample
+
+float Polarizer::processSampleAmp()
+{
+ switch (state)
+ {
+ case unaffected: // nothing much happens in this section
+ if (--unaffectedSamples <= 0) // go to polarized when the leap is done
+ state = polarized;
+ return 1.0f;
+ break;
+ // end unaffected
+
+ case polarized:
+ state = unaffected; // go right back to unaffected
+ // but first figure out how long unaffected will last this time
+ unaffectedSamples = leapScaled(fSkip);
+ return (0.5f - fAmount) * 2.0f; // this is the polarization scalar
+ break;
+ // end polarized
+
+ default : return 1.0f;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+// this is for calculating & sending the current sample output value to the output stream
+
+float Polarizer::processOutValue(float amp, float in)
+{
+ float out = (in * amp); // if implode is off, just do the regular polarizing thing
+
+ if (fImplode >= 0.03f) // if it's on, then implode the audio signal
+ {
+ if (out > 0.0f) // invert the sample between 1 & 0
+ out = 1.0f - out;
+ else // invert the sample between -1 & 0
+ out = -1.0f - out;
+ }
+
+ return out;
+}
diff --git a/polarizer/polarizer~.pd b/polarizer/polarizer~.pd
new file mode 100644
index 0000000..74c42d3
--- /dev/null
+++ b/polarizer/polarizer~.pd
@@ -0,0 +1,38 @@
+#N canvas 576 400 662 501 10;
+#X obj 176 238 polarizer~;
+#X floatatom 255 148 5 0 0;
+#X floatatom 265 169 5 0 0;
+#X floatatom 286 189 5 0 0;
+#X obj 171 125 readsf~ 2;
+#X msg 204 86 1;
+#X msg 425 48 0;
+#X msg 208 49 open ../../dresscode/0/3.wav;
+#X obj 310 86 t b;
+#X obj 308 112 delay 100;
+#X obj 238 85 delay 100;
+#X text 463 50 stop this shit;
+#X text 19 10 ____ _ dfx transverb _ by ____ destroy fx ___ _ and martin
+pi;
+#X obj 176 363 dac~ 1 2;
+#X obj 176 317 *~;
+#X obj 227 317 *~;
+#X obj 282 268 vsl 15 128 0 100 0 0 empty empty volume 0 -8 1 8 -143491
+-262144 -1 8500 1;
+#X connect 0 0 15 0;
+#X connect 0 0 14 0;
+#X connect 1 0 0 1;
+#X connect 2 0 0 2;
+#X connect 3 0 0 3;
+#X connect 4 0 0 0;
+#X connect 4 2 10 0;
+#X connect 5 0 4 0;
+#X connect 6 0 4 0;
+#X connect 7 0 4 0;
+#X connect 7 0 8 0;
+#X connect 8 0 9 0;
+#X connect 9 0 5 0;
+#X connect 10 0 7 0;
+#X connect 14 0 13 0;
+#X connect 15 0 13 1;
+#X connect 16 0 15 1;
+#X connect 16 0 14 1;
diff --git a/skidder/ read this.txt b/skidder/ read this.txt
new file mode 100755
index 0000000..926b6c3
--- /dev/null
+++ b/skidder/ read this.txt
@@ -0,0 +1,28 @@
+These are the source code files files for the Destroy FX VST plugins pack.
+More information about them, as well as ready-to-use plugins, can be found
+at our web page:
+ http://www.smartelectronix.com/~destroyfx/
+Also included in this package are CodeWarrior 6 project files & Visual
+Studio 6 project files which will hopefully make compiling the plugins a
+little easier for you.
+
+All of the plugins use the VST standard, & should be (nearly)
+source-portable to any platform which supports VST. Some advanced
+features may not work on all platforms or in all hosts.
+
+These plugins are Copyright (c) Marc Poirier & Tom Murphy 7. You can use
+them in your music however you like, without royalties. You can also
+modify them to your liking. However, if you distribute them (or
+derivative/modifed versions of them), then you must also distribute the
+source package in order to be in compliance with the license. This
+software is distributed under the terms of the Gnu Public License; see the
+file COPYING for details.
+
+This software comes with no warranty (see the file COPYING).
+
+
+
+
+If you make any nice modifications or fix anything, please let us know:
+ destroyfx@smartelectronix.com
+ pi@attacksyour.net
diff --git a/skidder/copying b/skidder/copying
new file mode 100755
index 0000000..c6cddae
--- /dev/null
+++ b/skidder/copying
@@ -0,0 +1,341 @@
+ 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/skidder/makefile b/skidder/makefile
new file mode 100755
index 0000000..dcecc91
--- /dev/null
+++ b/skidder/makefile
@@ -0,0 +1,46 @@
+CXX=g++-3.0
+CFLAGS=-O6 -mcpu=pentiumpro -g -g
+FLAGS=-DPD
+
+FLEXTPATH=/usr/local/lib/pd/externs/flext
+DFXINC=../dfx-library
+
+INCLUDES=/usr/local/lib/pd/include $(FLEXTPATH) $(DFXINC)
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+LIBS=m
+
+PDEXTRA=/usr/local/lib/pd/extra
+
+TARGET=skidder~.pd_linux
+
+SRCS=skidder.cpp ../dfx-library/TempoRateTable.cpp
+
+all: $(TARGET)
+
+%.o : %.cpp %.hpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(DFXINC)/%.o : $(DFXINC)/%.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+install: $(TARGET)
+ chown root.root $^
+ cp $^ $(PDEXTRA)
+
+.PHONY: clean
+clean:
+ rm -f *.o $(TARGET)
+
+
+
+
+
+
+
+
diff --git a/skidder/skidder.cpp b/skidder/skidder.cpp
new file mode 100755
index 0000000..67f88c8
--- /dev/null
+++ b/skidder/skidder.cpp
@@ -0,0 +1,374 @@
+/*
+ dfx skidder : an effect plugin
+ Copyright (C) 2000, Marc Poirier
+ Copyright (C) 2002, martin pi
+
+ 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
+*/
+
+/*-------------- by Marc Poirier ][ December 2000 -------------*/
+/* pd parts : © 2002, martin pi */
+
+#ifndef __skidder
+#include "skidder.hpp"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+
+
+//-----------------------------------------------------------------------------
+// initializations & such
+
+skidder::skidder(int argc, t_atom *argv) {
+
+ post("_ ____ ---- :: _______ ___ _____ _ skidder~ ");
+
+ tempoRateTable = new TempoRateTable;
+// m_setup(); // initialize a fresh skid cycle
+
+ AddInSignal(2);
+ AddInFloat(6);
+ AddOutSignal(2);
+ SetupInOut();
+
+ fTempo = tempoUnscaled(120.0f);
+ currentTempoBPS = oldTempoBPS = tempoScaled(fTempo) / 60.0f;
+
+ FLEXT_ADDMETHOD( 1, setRate);
+ FLEXT_ADDMETHOD_F(0,"temposync",setTempoSync);
+ FLEXT_ADDMETHOD( 2, setTempoRate);
+ FLEXT_ADDMETHOD_F(0,"rrf",setRateRandFactor);
+ FLEXT_ADDMETHOD( 3, setTempo);
+ FLEXT_ADDMETHOD( 4, setPulsewidth);
+ FLEXT_ADDMETHOD_F(0,"pwrm",setPulsewidthRandMin);
+ FLEXT_ADDMETHOD( 5, setSlope);
+ FLEXT_ADDMETHOD( 6, setFloor);
+ FLEXT_ADDMETHOD_F(0,"frm",setFloorRandMin);
+ FLEXT_ADDMETHOD( 7, setPan);
+ FLEXT_ADDMETHOD_F(0,"noise",setNoise);
+
+ post("_ ____ ____ _");
+
+ srand((unsigned int)time(NULL)); // sets a seed value for rand() from the system clock
+}
+
+
+//-----------------------------------------------------------------------------------------
+// titles of each parameter
+
+
+void skidder::m_help() {
+
+ post(" __ ---- %s %f", "1 rate [ Hz ] ",fRate);
+ post(" __ ---- %s %f", "temposync tempo sync ",fTempoSync);
+ post(" __ ---- %s %f", "2 tempo rate [ cycles/beat ]",fTempoRate);
+ post(" __ ---- %s %f", "rrf rate random factor",fRateRandFactor);
+ post(" __ ---- %s %f", "3 tempo [ bpm ]",fTempo);
+ post(" __ ---- %s %f", "4 pulsewidth [ % of cycle ]",fPulsewidth);
+ post(" __ ---- %s %f", "pwrm pulsewidth random min. [ % of cycle ]",fPulsewidthRandMin);
+ post(" __ ---- %s %f", "5 slope [ ms ]",fSlope);
+ post(" __ ---- %s %f", "6 floor [ dB ]",fFloor);
+ post(" __ ---- %s %f", "frm floor random min. [ dB ]",fFloorRandMin);
+ post(" __ ---- %s %f", "7 stereo spread[ amount ]",fPan);
+ post(" __ ---- %s %f", "noise rupture ",fNoise);
+}
+
+
+
+// GIMME class:
+FLEXT_NEW_TILDE_G("skidder~", skidder)
+
+
+void skidder::m_signal(int n, float *const *in, float *const *out) {
+
+ // directly move everything to the vst part
+ processReplacing((float **)in, (float **)out,(long)n, true);
+} // end m_signal
+
+//-----------------------------------------------------------------------------------------
+// this gets called when the plugin is de-activated
+
+void skidder::m_setup() {
+
+ state = valley;
+ valleySamples = 0;
+ panRander = 0.0f;
+ rms = 0.0f;
+ rmscount = 0;
+ randomFloor = 0.0f;
+ randomGainRange = 1.0f;
+
+ // deallocate the memory from these arrays
+// if (tempoRateTable) delete tempoRateTable;
+
+
+ fRate = rateUnscaled(3.0f); // 0.1304347826087
+ fTempoSync = 0.0f; // default to no tempo sync; "free" control
+ fTempoRate = 0.333f;
+ fRateRandFactor = 0.0f; // default to no randomness
+ fTempo = 0.0f; // default to "auto" (i.e. get it from the host)
+ fPulsewidth = 0.5f;
+ fPulsewidthRandMin = 0.5f;
+ fSlope = 3.0f/SLOPEMAX; // 0.2
+ fFloor = 0.0f;
+ fFloorRandMin = 0.0f;
+ fPan = 0.0f;
+ fNoise = 0.0f;
+
+
+}
+
+//-----------------------------------------------------------------------------------------
+void skidder::processSlopeIn()
+{
+ // dividing the growing slopeDur-slopeSamples by slopeDur makes ascending values
+ if (useRandomFloor)
+ amp = ( ((float)(slopeDur-slopeSamples)) * slopeStep * randomGainRange ) + randomFloor;
+ else
+ amp = ( ((float)(slopeDur-slopeSamples)) * slopeStep * gainRange ) + floor;
+
+ slopeSamples--;
+
+ if (slopeSamples <= 0)
+ {
+ state = plateau;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+void skidder::processPlateau()
+{
+
+ // amp in the plateau is 1.0, i.e. this sample is unaffected
+ amp = 1.0f;
+
+ plateauSamples--;
+
+ if (plateauSamples <= 0)
+ {
+ // average & then sqare the sample squareroots for the RMS value
+ rms = powf((rms/(float)rmscount), 2.0f);
+ // because RMS tends to be < 0.5, thus unfairly limiting rupture's range
+ rms *= 2.0f;
+ // avoids clipping or unexpected values (like wraparound)
+ if ( (rms > 1.0f) || (rms < 0.0f) )
+ rms = 1.0f;
+ rmscount = 0; // reset the RMS counter
+ //
+ // set up the random floor values
+ useRandomFloor = fFloorRandMin < fFloor;
+ randomFloor = ( ((float)rand()*ONE_DIV_RAND_MAX) * gainScaled(fFloor-fFloorRandMin) )
+ + gainScaled(fFloorRandMin);
+ randomGainRange = 1.0f - randomFloor; // the range of the skidding on/off gain
+ //
+ if (slopeDur > 0)
+ {
+ state = slopeOut;
+ slopeSamples = slopeDur; // refill slopeSamples
+ slopeStep = 1.0f / (float)slopeDur; // calculate the fade increment scalar
+ }
+ else
+ state = valley;
+ }
+}
+
+
+//-----------------------------------------------------------------------------------------
+void skidder::processSlopeOut()
+{
+ // dividing the decrementing slopeSamples by slopeDur makes descending values
+ if (useRandomFloor)
+ amp = ( ((float)slopeSamples) * slopeStep * randomGainRange ) + randomFloor;
+ else
+ amp = ( ((float)slopeSamples) * slopeStep * gainRange ) + floor;
+
+ slopeSamples--;
+
+ if (slopeSamples <= 0)
+ {
+ state = valley;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+void skidder::processValley(float SAMPLERATE)
+{
+ float rateRandFactor = rateRandFactorScaled(fRateRandFactor); // stores the real value
+ float cycleRate; // the base current skid rate value
+ float randFloat, randomRate; // the current randomized rate value
+ float fPulsewidthRandomized; // stores the latest randomized pulsewidth 0.0 - 1.0 value
+ bool barSync = false; // true if we need to sync up with the next bar start
+ long countdown;
+
+
+ if (useRandomFloor)
+ amp = randomFloor;
+ else
+ amp = floor;
+
+ valleySamples--;
+
+ if (valleySamples <= 0)
+ {
+ rms = 0.0f; // reset rms now because valley is over
+ //
+ // This is where we figure out how many samples long each
+ // envelope section is for the next skid cycle.
+ //
+ if (onOffTest(fTempoSync)) // the user wants to do tempo sync / beat division rate
+ {
+ cycleRate = currentTempoBPS * (tempoRateTable->getScalar(fTempoRate));
+ // set this true so that we make sure to do the measure syncronisation later on
+ }
+ else
+ cycleRate = rateScaled(fRate);
+ //
+ if (fRateRandFactor > 0.0f)
+ {
+ // get a random value from 0.0 to 1.0
+ randFloat = (float)rand() * ONE_DIV_RAND_MAX;
+ // square-scale the random value & then scale it with the random rate range
+ randomRate = ( randFloat * randFloat *
+ ((cycleRate*rateRandFactor)-(cycleRate/rateRandFactor)) ) +
+ (cycleRate/rateRandFactor);
+ cycleSamples = (long) (SAMPLERATE / randomRate);
+ barSync = false; // we can't do the bar sync if the skids durations are random
+ }
+ else
+ cycleSamples = (long) (SAMPLERATE / cycleRate);
+ //
+ if (fPulsewidth > fPulsewidthRandMin)
+ {
+ fPulsewidthRandomized = ( ((float)rand()*ONE_DIV_RAND_MAX) * (fPulsewidth-fPulsewidthRandMin) ) + fPulsewidthRandMin;
+ pulseSamples = (long) ( ((float)cycleSamples) * pulsewidthScaled(fPulsewidthRandomized) );
+ }
+ else
+ pulseSamples = (long) ( ((float)cycleSamples) * pulsewidthScaled(fPulsewidth) );
+ valleySamples = cycleSamples - pulseSamples;
+ slopeSamples = (long) ((SAMPLERATE/1000.0f)*(fSlope*(SLOPEMAX)));
+ slopeDur = slopeSamples;
+ slopeStep = 1.0f / (float)slopeDur; // calculate the fade increment scalar
+ plateauSamples = pulseSamples - (slopeSamples * 2);
+ if (plateauSamples < 1) // this shrinks the slope to 1/3 of the pulse if the user sets slope too high
+ {
+ slopeSamples = (long) (((float)pulseSamples) / 3.0f);
+ slopeDur = slopeSamples;
+ slopeStep = 1.0f / (float)slopeDur; // calculate the fade increment scalar
+ plateauSamples = pulseSamples - (slopeSamples * 2);
+ }
+
+ // go to slopeIn next if slope is not 0.0, otherwise go to plateau
+ if (slopeDur > 0)
+ state = slopeIn;
+ else
+ state = plateau;
+
+ // this puts random float values from -1.0 to 1.0 into panRander
+ panRander = ( ((float)rand()*ONE_DIV_RAND_MAX) * 2.0f ) - 1.0f;
+
+ } //end of the "valley is over" if-statement
+}
+
+//-----------------------------------------------------------------------------------------
+float skidder::processOutput(float in1, float in2, float pan)
+{
+ // output noise
+ if ( (state == valley) && (fNoise != 0.0f) )
+ // out gets random noise with samples from -1.0 to 1.0 times the random pan times rupture times the RMS scalar
+ return ((((float)rand()*ONE_DIV_RAND_MAX)*2.0f)-1.0f) * pan * fNoise_squared * rms;
+
+ // do regular skidding output
+ else
+ {
+ // only output a bit of the first input
+ if (pan <= 1.0f)
+ return in1 * pan * amp;
+ // output all of the first input & a bit of the second input
+ else
+ return ( in1 + (in2*(pan-1.0f)) ) * amp;
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+void skidder::processReplacing(float **inputs, float **outputs, long sampleFrames, bool replacing) {
+
+ float *in1 = inputs[0];
+ float *in2 = inputs[1];
+ float *out1 = outputs[0];
+ float *out2 = outputs[1];
+
+ float SAMPLERATE = Samplerate();
+ // just in case the host responds with something wacky
+ if (SAMPLERATE <= 0.0f) SAMPLERATE = 44100.0f;
+
+ long samplecount;
+
+
+ floor = gainScaled(fFloor); // the parameter scaled real value
+ gainRange = 1.0f - floor; // the range of the skidding on/off gain
+ useRandomFloor = (fFloorRandMin < fFloor);
+
+ // figure out the current tempo if we're doing tempo sync
+ if (onOffTest(fTempoSync))
+ {
+ // calculate the tempo at the current processing buffer
+ currentTempoBPS = tempoScaled(fTempo) / 60.0f;
+
+ }
+
+ for (samplecount=0; (samplecount < sampleFrames); samplecount++)
+ {
+ switch (state)
+ {
+ case slopeIn:
+ // get the average sqareroot of the current input samples
+ rms += sqrtf( fabsf(((*in1)+(*in2))*0.5f) );
+ rmscount++; // this counter is later used for getting the mean
+ processSlopeIn();
+ break;
+ case plateau:
+ rms += sqrtf( fabsf(((*in1)+(*in2))*0.5f) );
+ rmscount++;
+ processPlateau();
+ break;
+ case slopeOut:
+ processSlopeOut();
+ break;
+ case valley:
+ processValley(SAMPLERATE);
+ break;
+ }
+
+ // ((panRander*fPan)+1.0) ranges from 0.0 to 2.0
+ if (replacing)
+ {
+ *out1 = processOutput( *in1, *in2, ((panRander*fPan)+1.0f) );
+ *out2 = processOutput( *in2, *in1, (2.0f - ((panRander*fPan)+1.0f)) );
+ }
+ else
+ {
+ *out1 += processOutput( *in1, *in2, ((panRander*fPan)+1.0f) );
+ *out2 += processOutput( *in2, *in1, (2.0f - ((panRander*fPan)+1.0f)) );
+ }
+ // move forward in the i/o sample streams
+ in1++;
+ in2++;
+ out1++;
+ out2++;
+ }
+}
diff --git a/skidder/skidder.hpp b/skidder/skidder.hpp
new file mode 100755
index 0000000..2a689e7
--- /dev/null
+++ b/skidder/skidder.hpp
@@ -0,0 +1,224 @@
+/*
+ dfx skidder : an effect plugin
+ Copyright (C) 2000, Marcberg Soft und Hardware GmbH, All Rights Reserved
+ Copyright (C) 2002, martin pi
+
+ 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
+*/
+
+/*---------------------------------------------------------------
+
+ © 2000, Marcberg Soft und Hardware GmbH, All Rights Reserved
+ pd parts : © 2002, martin pi
+
+---------------------------------------------------------------*/
+
+#ifndef __skidder
+#define __skidder
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "dfxmisc.h"
+//#include "vstchunk.h"
+#include "TempoRateTable.h"
+
+#include "flext.h"
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 202)
+#error You need at least flext version 0.2.2
+#endif
+
+
+
+//-----------------------------------------------------------------------------
+// these are the plugin parameters:
+enum
+{
+ kRate,
+ kTempoSync,
+ kTempoRate,
+ kRateRandFactor,
+ kTempo,
+ kPulsewidth,
+ kPulsewidthRandMin,
+ kSlope,
+ kPan,
+ kNoise,
+
+ kFloor,
+ kFloorRandMin,
+
+ NUM_PARAMETERS
+};
+
+//-----------------------------------------------------------------------------
+// these are the 4 states of the process:
+enum
+{
+ slopeIn,
+ plateau,
+ slopeOut,
+ valley
+};
+
+//-----------------------------------------------------------------------------
+// constants & macros
+
+#define RATEMIN 0.3f
+#define RATEMAX 21.0f
+// this is for converting from parameter entries to the real values
+#define rateScaled(A) ( paramRangePowScaled((A), RATEMIN, RATEMAX, 1.65f) )
+#define rateUnscaled(A) ( paramRangePowUnscaled((A), RATEMIN, RATEMAX, 1.65f) )
+
+#define RATE_RAND_FACTOR_MIN 1.0f
+#define RATE_RAND_FACTOR_MAX 9.0f
+#define rateRandFactorScaled(A) ( paramRangeSquaredScaled((A), RATE_RAND_FACTOR_MIN, RATE_RAND_FACTOR_MAX) )
+#define rateRandFactorUnscaled(A) ( paramRangeSquaredUnscaled((A), RATE_RAND_FACTOR_MIN, RATE_RAND_FACTOR_MAX) )
+
+#define PULSEMIN 0.001f
+#define PULSEMAX 0.999f
+#define pulsewidthScaled(A) ( paramRangeScaled((A), PULSEMIN, PULSEMAX) )
+#define pulsewidthUnscaled(A) ( paramRangeUnscaled((A), PULSEMIN, PULSEMAX) )
+
+#define TEMPO_MIN 39.0f
+#define TEMPO_MAX 480.0f
+#define tempoScaled(A) ( paramRangeScaled((A), TEMPO_MIN, TEMPO_MAX) )
+#define tempoUnscaled(A) ( paramRangeUnscaled((A), TEMPO_MIN, TEMPO_MAX) )
+
+#define SLOPEMAX 15.0f
+
+// this is for scaling the slider values of rupture (more emphasis on lower values, dB-style)
+#define fNoise_squared (fNoise*fNoise)
+
+#define gainScaled(A) ((A)*(A)*(A))
+#define normalize(f,a,b) ((((f < b) ? f : b) > a) ? f : a)
+
+
+//-----------------------------------------------------------------------------
+
+class skidder : public flext_dsp {
+
+ FLEXT_HEADER(skidder, flext_dsp)
+
+public:
+ skidder(int argc, t_atom *argv);
+// ~skidder();
+
+ virtual void m_signal(int, t_sample *const *, t_sample *const *);
+ virtual void m_help();
+
+// virtual void process(float **inputs, float **outputs, long sampleFrames);
+ virtual void m_setup();
+
+// virtual void setParameter(long index, float value);
+
+
+protected:
+ void processSlopeIn();
+ void processPlateau();
+ void processSlopeOut();
+ void processValley(float SAMPLERATE);
+ float processOutput(float in1, float in2, float pan);
+ void processReplacing(float **inputs, float **outputs, long sampleFrames, bool replacing);
+
+ // the parameters
+ float fRate, fTempoSync, fTempoRate, fRateRandFactor, fTempo;
+ float fPulsewidth, fPulsewidthRandMin, fSlope, fPan, fNoise, fFloor, fFloorRandMin;
+ float floor, gainRange; // a scaled version of fFloor & the difference between that & 1.0
+
+ float randomFloor, randomGainRange;
+ bool useRandomFloor;
+ float amp; // output sample scalar
+ long cycleSamples, pulseSamples, slopeSamples, slopeDur, plateauSamples, valleySamples; // sample counters
+ float slopeStep; // the scalar for each step of the fade during a slope in or out
+ float panRander; // the actual pan value for each cycle
+ int state; // the state of the process
+ float rms;
+ long rmscount;
+
+ float currentTempoBPS; // tempo in beats per second
+ float oldTempoBPS; // holds the previous value of currentTempoBPS for comparison
+ bool tempoHasChanged; // tells the GUI that the rate random range display needs updating
+ bool mustUpdateTempoHasChanged;
+ TempoRateTable *tempoRateTable; // a table of tempo rate values
+
+
+ FLEXT_CALLBACK_F(setRate)
+ void setRate(float f) {
+ fRate = rateUnscaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setTempoSync)
+ void setTempoSync(float f) {
+ fTempoSync = 1;
+ }
+
+ FLEXT_CALLBACK_F(setTempoRate)
+ void setTempoRate(float f) {
+ fTempoRate = rateUnscaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setRateRandFactor)
+ void setRateRandFactor(float f) {
+ fRateRandFactor = rateRandFactorUnscaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setTempo)
+ void setTempo(float f) {
+ fTempo = tempoUnscaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setPulsewidth)
+ void setPulsewidth(float f) {
+ fPulsewidth = pulsewidthUnscaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setPulsewidthRandMin)
+ void setPulsewidthRandMin(float f) {
+ fPulsewidthRandMin = pulsewidthUnscaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setSlope)
+ void setSlope(float f) {
+ fSlope = f/SLOPEMAX;
+ }
+
+ FLEXT_CALLBACK_F(setFloor)
+ void setFloor(float f) {
+ fFloor = f;
+ }
+
+ FLEXT_CALLBACK_F(setFloorRandMin)
+ void setFloorRandMin(float f) {
+ fFloorRandMin = f;
+ }
+
+ FLEXT_CALLBACK_F(setPan)
+ void setPan(float f) {
+ fPan = f;
+ }
+
+ FLEXT_CALLBACK_F(setNoise)
+ void setNoise(float f) {
+ fNoise = normalize(f,0,1);
+ }
+
+// FLEXT_CALLBACK(m_print)
+
+
+};
+
+#endif
diff --git a/skidder/skidder~.pd b/skidder/skidder~.pd
new file mode 100644
index 0000000..e41e00b
--- /dev/null
+++ b/skidder/skidder~.pd
@@ -0,0 +1,51 @@
+#N canvas 234 140 957 522 10;
+#X obj 335 373 skidder~;
+#X obj 335 105 osc~ 440;
+#X obj 335 400 dac~ 1 2;
+#X msg 135 356 help;
+#X obj 342 133 osc~ 1000;
+#X floatatom 356 212 5 0 0;
+#X floatatom 371 269 5 0 0;
+#X floatatom 386 303 5 0 0;
+#X floatatom 364 250 5 0 0;
+#X floatatom 378 287 5 0 0;
+#X floatatom 349 195 5 0 0;
+#X floatatom 342 234 12 0 0;
+#X msg 209 196 temposync 1;
+#X msg 209 166 rrf 0.1;
+#X msg 209 258 pwrm 50;
+#X msg 209 288 frm 2000;
+#X msg 210 229 noise 0;
+#X msg 432 163 200000;
+#X text 6 4 dfx skidder ___ _;
+#X text 35 19 by destruct fx;
+#X text 35 33 linux port by martin pi;
+#X text 556 5 more from dfx :: http://smartelectronix.com/~destroyfx
+;
+#X text 648 20 more from pi :: http://attacksyour.net/pi;
+#X text 13 465 turn on temposync and frm to make it work in pd ( i
+did not want to change the internals \, so it is a bit trickyy). besides
+this is not finished at all ....;
+#X text 482 421 Skidder turns your sound on & off. While that may not
+sound very rewarding \, you have a great deal of control over the rate
+\, pulsewidth \, on/off slope \, panning width \, etc. You can also
+relinquish some control to randomization. Skidder can also sync with
+your song tempo & can be triggered by MIDI notes.;
+#X connect 0 0 2 0;
+#X connect 0 1 2 1;
+#X connect 1 0 0 0;
+#X connect 3 0 0 0;
+#X connect 4 0 0 1;
+#X connect 5 0 0 3;
+#X connect 6 0 0 5;
+#X connect 7 0 0 7;
+#X connect 8 0 0 4;
+#X connect 9 0 0 6;
+#X connect 10 0 0 2;
+#X connect 11 0 0 1;
+#X connect 12 0 0 0;
+#X connect 13 0 0 0;
+#X connect 14 0 0 0;
+#X connect 15 0 0 0;
+#X connect 16 0 0 0;
+#X connect 17 0 11 0;
diff --git a/transverb/makefile b/transverb/makefile
new file mode 100755
index 0000000..be155ce
--- /dev/null
+++ b/transverb/makefile
@@ -0,0 +1,47 @@
+# change this!!!
+CXX=g++
+CFLAGS=-O6 -mcpu=pentiumpro -g -ggdb
+FLAGS=-DPD
+
+FLEXTPATH=/usr/local/lib/pd/externs/flext
+DFXINC=../dfx-library
+
+INCLUDES=/usr/local/lib/pd/include $(FLEXTPATH) $(DFXINC)
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+LIBS=m
+
+PDEXTRA=/usr/local/lib/pd/extra
+
+TARGET=transverb~.pd_linux
+
+SRCS=transverb.cpp $(DFXINC)/IIRfilter.cpp $(DFXINC)/FIRfilter.cpp
+
+all: $(TARGET)
+
+%.o : %.cpp %.h
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(DFXINC)/%.o : $(DFXINC)/%.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+install: $(TARGET)
+ chown root.root $^
+ cp $^ $(PDEXTRA)
+
+.PHONY: clean
+clean:
+ rm -f *.o $(TARGET)
+
+
+
+
+
+
+
+
diff --git a/transverb/prep.i b/transverb/prep.i
new file mode 100644
index 0000000..c9988fa
--- /dev/null
+++ b/transverb/prep.i
@@ -0,0 +1,12820 @@
+# 1 "transverb.cpp"
+
+
+
+# 1 "/usr/include/string.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/features.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 142 "/usr/include/features.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 208 "/usr/include/features.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/sys/cdefs.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 65 "/usr/include/sys/cdefs.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 283 "/usr/include/features.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/gnu/stubs.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 312 "/usr/include/features.h" 2 3
+
+
+
+
+# 26 "/usr/include/string.h" 2 3
+
+
+extern "C" {
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef unsigned int size_t;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 33 "/usr/include/string.h" 2 3
+
+
+
+
+extern void *memcpy (void *__restrict __dest,
+ __const void *__restrict __src, size_t __n) throw () ;
+
+
+extern void *memmove (void *__dest, __const void *__src, size_t __n)
+ throw () ;
+
+
+
+
+
+extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
+ int __c, size_t __n)
+ throw () ;
+
+
+
+
+extern void *memset (void *__s, int __c, size_t __n) throw () ;
+
+
+extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
+ throw () ;
+
+
+extern void *memchr (__const void *__s, int __c, size_t __n)
+ throw () ;
+
+# 73 "/usr/include/string.h" 3
+
+
+
+
+extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
+ throw () ;
+
+extern char *strncpy (char *__restrict __dest,
+ __const char *__restrict __src, size_t __n) throw () ;
+
+
+extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
+ throw () ;
+
+extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
+ size_t __n) throw () ;
+
+
+extern int strcmp (__const char *__s1, __const char *__s2)
+ throw () ;
+
+extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
+ throw () ;
+
+
+extern int strcoll (__const char *__s1, __const char *__s2)
+ throw () ;
+
+extern size_t strxfrm (char *__restrict __dest,
+ __const char *__restrict __src, size_t __n) throw () ;
+
+# 116 "/usr/include/string.h" 3
+
+
+
+
+extern char *strdup (__const char *__s) throw () ;
+
+
+
+
+
+
+
+
+
+
+# 152 "/usr/include/string.h" 3
+
+
+
+extern char *strchr (__const char *__s, int __c) throw () ;
+
+extern char *strrchr (__const char *__s, int __c) throw () ;
+
+
+
+
+
+
+
+
+
+extern size_t strcspn (__const char *__s, __const char *__reject)
+ throw () ;
+
+
+extern size_t strspn (__const char *__s, __const char *__accept)
+ throw () ;
+
+extern char *strpbrk (__const char *__s, __const char *__accept)
+ throw () ;
+
+extern char *strstr (__const char *__haystack, __const char *__needle)
+ throw () ;
+
+
+
+
+
+
+
+
+extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
+ throw () ;
+
+
+
+extern char *__strtok_r (char *__restrict __s,
+ __const char *__restrict __delim,
+ char **__restrict __save_ptr) throw () ;
+
+extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
+ char **__restrict __save_ptr) throw () ;
+
+
+# 214 "/usr/include/string.h" 3
+
+
+
+
+extern size_t strlen (__const char *__s) throw () ;
+
+
+
+
+
+
+
+
+
+
+extern char *strerror (int __errnum) throw () ;
+
+
+
+extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) throw () ;
+
+
+
+
+extern void __bzero (void *__s, size_t __n) throw () ;
+
+
+
+extern void bcopy (__const void *__src, void *__dest, size_t __n) throw () ;
+
+
+extern void bzero (void *__s, size_t __n) throw () ;
+
+
+extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
+ throw () ;
+
+
+extern char *index (__const char *__s, int __c) throw () ;
+
+
+extern char *rindex (__const char *__s, int __c) throw () ;
+
+
+
+extern int ffs (int __i) throw () __attribute__ ((__const__));
+
+
+
+
+
+
+
+
+
+
+
+
+extern int strcasecmp (__const char *__s1, __const char *__s2)
+ throw () ;
+
+
+extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
+ throw () ;
+
+
+# 289 "/usr/include/string.h" 3
+
+
+
+
+
+extern char *strsep (char **__restrict __stringp,
+ __const char *__restrict __delim) throw () ;
+
+
+# 332 "/usr/include/string.h" 3
+
+
+
+
+# 361 "/usr/include/string.h" 3
+
+
+
+}
+
+
+# 4 "transverb.cpp" 2
+
+# 1 "/usr/include/time.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 38 "/usr/include/time.h" 2 3
+
+
+
+
+# 1 "/usr/include/bits/time.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/types.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 29 "/usr/include/bits/types.h" 2 3
+
+
+
+typedef unsigned char __u_char;
+typedef unsigned short __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long __u_long;
+
+__extension__ typedef unsigned long long int __u_quad_t;
+__extension__ typedef long long int __quad_t;
+# 48 "/usr/include/bits/types.h" 3
+
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+
+typedef __quad_t *__qaddr_t;
+
+typedef __u_quad_t __dev_t;
+typedef __u_int __uid_t;
+typedef __u_int __gid_t;
+typedef __u_long __ino_t;
+typedef __u_int __mode_t;
+typedef __u_int __nlink_t;
+typedef long int __off_t;
+typedef __quad_t __loff_t;
+typedef int __pid_t;
+typedef int __ssize_t;
+typedef __u_long __rlim_t;
+typedef __u_quad_t __rlim64_t;
+typedef __u_int __id_t;
+
+typedef struct
+ {
+ int __val[2];
+ } __fsid_t;
+
+
+typedef int __daddr_t;
+typedef char *__caddr_t;
+typedef long int __time_t;
+typedef unsigned int __useconds_t;
+typedef long int __suseconds_t;
+typedef long int __swblk_t;
+
+typedef long int __clock_t;
+
+
+typedef int __clockid_t;
+
+
+typedef int __timer_t;
+
+
+
+
+
+
+typedef int __key_t;
+
+
+typedef unsigned short int __ipc_pid_t;
+
+
+
+typedef long int __blksize_t;
+
+
+
+
+typedef long int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+
+typedef __u_long __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+
+typedef __u_long __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
+
+typedef __u_quad_t __ino64_t;
+
+
+typedef __loff_t __off64_t;
+
+
+typedef long int __t_scalar_t;
+typedef unsigned long int __t_uscalar_t;
+
+
+typedef int __intptr_t;
+
+
+typedef unsigned int __socklen_t;
+
+
+
+
+# 1 "/usr/include/bits/pthreadtypes.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/sched.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 62 "/usr/include/bits/sched.h" 3
+
+
+
+
+
+
+struct __sched_param
+ {
+ int __sched_priority;
+ };
+
+
+# 23 "/usr/include/bits/pthreadtypes.h" 2 3
+
+
+typedef int __atomic_lock_t;
+
+
+struct _pthread_fastlock
+{
+ long int __status;
+ __atomic_lock_t __spinlock;
+
+};
+
+
+
+typedef struct _pthread_descr_struct *_pthread_descr;
+
+
+
+
+
+typedef struct __pthread_attr_s
+{
+ int __detachstate;
+ int __schedpolicy;
+ struct __sched_param __schedparam;
+ int __inheritsched;
+ int __scope;
+ size_t __guardsize;
+ int __stackaddr_set;
+ void *__stackaddr;
+ size_t __stacksize;
+} pthread_attr_t;
+
+
+
+typedef struct
+{
+ struct _pthread_fastlock __c_lock;
+ _pthread_descr __c_waiting;
+} pthread_cond_t;
+
+
+
+typedef struct
+{
+ int __dummy;
+} pthread_condattr_t;
+
+
+typedef unsigned int pthread_key_t;
+
+
+
+
+
+typedef struct
+{
+ int __m_reserved;
+ int __m_count;
+ _pthread_descr __m_owner;
+ int __m_kind;
+ struct _pthread_fastlock __m_lock;
+} pthread_mutex_t;
+
+
+
+typedef struct
+{
+ int __mutexkind;
+} pthread_mutexattr_t;
+
+
+
+typedef int pthread_once_t;
+
+
+# 119 "/usr/include/bits/pthreadtypes.h" 3
+
+
+# 138 "/usr/include/bits/pthreadtypes.h" 3
+
+
+
+
+typedef unsigned long int pthread_t;
+
+
+# 143 "/usr/include/bits/types.h" 2 3
+
+
+
+
+# 39 "/usr/include/bits/time.h" 2 3
+
+extern long int __sysconf (int);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 73 "/usr/include/bits/time.h" 3
+
+# 42 "/usr/include/time.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef __clock_t clock_t;
+
+
+
+
+
+
+
+
+
+
+typedef __time_t time_t;
+
+
+
+
+
+
+
+
+
+
+
+typedef __clockid_t clockid_t;
+
+
+
+
+
+
+
+
+
+
+
+typedef __timer_t timer_t;
+
+
+
+
+
+
+
+
+
+
+
+struct timespec
+ {
+ __time_t tv_sec;
+ long int tv_nsec;
+ };
+
+
+
+
+
+
+
+struct tm
+{
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+
+
+ long int tm_gmtoff;
+ __const char *tm_zone;
+
+
+
+
+};
+
+
+
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+
+struct sigevent;
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern clock_t clock (void) throw () ;
+
+
+extern time_t time (time_t *__timer) throw () ;
+
+
+extern double difftime (time_t __time1, time_t __time0)
+ throw () __attribute__ ((__const__));
+
+
+extern time_t mktime (struct tm *__tp) throw () ;
+
+
+
+
+
+extern size_t strftime (char *__restrict __s, size_t __maxsize,
+ __const char *__restrict __format,
+ __const struct tm *__restrict __tp) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+extern struct tm *gmtime (__const time_t *__timer) throw () ;
+
+
+
+extern struct tm *localtime (__const time_t *__timer) throw () ;
+
+
+
+
+extern struct tm *gmtime_r (__const time_t *__restrict __timer,
+ struct tm *__restrict __tp) throw () ;
+
+
+
+extern struct tm *localtime_r (__const time_t *__restrict __timer,
+ struct tm *__restrict __tp) throw () ;
+
+
+
+
+extern char *asctime (__const struct tm *__tp) throw () ;
+
+
+extern char *ctime (__const time_t *__timer) throw () ;
+
+
+
+
+
+
+extern char *asctime_r (__const struct tm *__restrict __tp,
+ char *__restrict __buf) throw () ;
+
+
+extern char *ctime_r (__const time_t *__restrict __timer,
+ char *__restrict __buf) throw () ;
+
+
+
+
+extern char *__tzname[2];
+extern int __daylight;
+extern long int __timezone;
+
+
+
+
+extern char *tzname[2];
+
+
+
+extern void tzset (void) throw () ;
+
+
+
+extern int daylight;
+extern long int timezone;
+
+
+
+
+
+extern int stime (__const time_t *__when) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern time_t timegm (struct tm *__tp) throw () ;
+
+
+extern time_t timelocal (struct tm *__tp) throw () ;
+
+
+extern int dysize (int __year) throw () __attribute__ ((__const__));
+
+
+
+
+
+extern int nanosleep (__const struct timespec *__requested_time,
+ struct timespec *__remaining) throw () ;
+
+
+
+extern int clock_getres (clockid_t __clock_id, struct timespec *__res) throw () ;
+
+
+extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) throw () ;
+
+
+extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
+ throw () ;
+
+# 305 "/usr/include/time.h" 3
+
+
+
+
+extern int timer_create (clockid_t __clock_id,
+ struct sigevent *__restrict __evp,
+ timer_t *__restrict __timerid) throw () ;
+
+
+extern int timer_delete (timer_t __timerid) throw () ;
+
+
+extern int timer_settime (timer_t __timerid, int __flags,
+ __const struct itimerspec *__restrict __value,
+ struct itimerspec *__restrict __ovalue) throw () ;
+
+
+extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
+ throw () ;
+
+
+extern int timer_getoverrun (timer_t __timerid) throw () ;
+
+
+
+# 349 "/usr/include/time.h" 3
+
+
+# 359 "/usr/include/time.h" 3
+
+
+
+}
+
+
+
+
+# 5 "transverb.cpp" 2
+
+# 1 "/usr/include/stdlib.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 33 "/usr/include/stdlib.h" 2 3
+
+
+extern "C" {
+
+
+
+
+# 91 "/usr/include/stdlib.h" 3
+
+
+
+typedef struct
+ {
+ int quot;
+ int rem;
+ } div_t;
+
+
+
+typedef struct
+ {
+ long int quot;
+ long int rem;
+ } ldiv_t;
+
+
+
+# 118 "/usr/include/stdlib.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern size_t __ctype_get_mb_cur_max (void) throw () ;
+
+
+
+extern double atof (__const char *__nptr) throw () ;
+
+extern int atoi (__const char *__nptr) throw () ;
+
+extern long int atol (__const char *__nptr) throw () ;
+
+
+
+__extension__ extern long long int atoll (__const char *__nptr)
+ throw () ;
+
+
+
+extern double strtod (__const char *__restrict __nptr,
+ char **__restrict __endptr) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+extern long int strtol (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __base) throw () ;
+
+extern unsigned long int strtoul (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ throw () ;
+
+
+
+__extension__
+extern long long int strtoq (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __base) throw () ;
+
+__extension__
+extern unsigned long long int strtouq (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ throw () ;
+
+
+
+
+
+
+__extension__
+extern long long int strtoll (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __base) throw () ;
+
+__extension__
+extern unsigned long long int strtoull (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ throw () ;
+
+
+
+# 244 "/usr/include/stdlib.h" 3
+
+
+
+
+
+
+extern double __strtod_internal (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __group)
+ throw () ;
+extern float __strtof_internal (__const char *__restrict __nptr,
+ char **__restrict __endptr, int __group)
+ throw () ;
+extern long double __strtold_internal (__const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __group) throw () ;
+
+extern long int __strtol_internal (__const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __base, int __group) throw () ;
+
+
+
+extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __base, int __group) throw () ;
+
+
+
+
+__extension__
+extern long long int __strtoll_internal (__const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __base, int __group) throw () ;
+
+
+
+__extension__
+extern unsigned long long int __strtoull_internal (__const char *
+ __restrict __nptr,
+ char **__restrict __endptr,
+ int __base, int __group)
+ throw () ;
+
+
+
+
+
+
+
+extern __inline double
+strtod (__const char *__restrict __nptr, char **__restrict __endptr) throw ()
+{
+ return __strtod_internal (__nptr, __endptr, 0);
+}
+extern __inline long int
+strtol (__const char *__restrict __nptr, char **__restrict __endptr,
+ int __base) throw ()
+{
+ return __strtol_internal (__nptr, __endptr, __base, 0);
+}
+extern __inline unsigned long int
+strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
+ int __base) throw ()
+{
+ return __strtoul_internal (__nptr, __endptr, __base, 0);
+}
+
+# 322 "/usr/include/stdlib.h" 3
+
+
+
+__extension__ extern __inline long long int
+strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
+ int __base) throw ()
+{
+ return __strtoll_internal (__nptr, __endptr, __base, 0);
+}
+__extension__ extern __inline unsigned long long int
+strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
+ int __base) throw ()
+{
+ return __strtoull_internal (__nptr, __endptr, __base, 0);
+}
+
+
+
+__extension__ extern __inline long long int
+strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
+ int __base) throw ()
+{
+ return __strtoll_internal (__nptr, __endptr, __base, 0);
+}
+__extension__ extern __inline unsigned long long int
+strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
+ int __base) throw ()
+{
+ return __strtoull_internal (__nptr, __endptr, __base, 0);
+}
+
+
+extern __inline double
+atof (__const char *__nptr) throw ()
+{
+ return strtod (__nptr, (char **) __null );
+}
+extern __inline int
+atoi (__const char *__nptr) throw ()
+{
+ return (int) strtol (__nptr, (char **) __null , 10);
+}
+extern __inline long int
+atol (__const char *__nptr) throw ()
+{
+ return strtol (__nptr, (char **) __null , 10);
+}
+
+
+__extension__ extern __inline long long int
+atoll (__const char *__nptr) throw ()
+{
+ return strtoll (__nptr, (char **) __null , 10);
+}
+
+
+
+
+
+
+
+
+extern char *l64a (long int __n) throw () ;
+
+
+extern long int a64l (__const char *__s) throw () ;
+
+
+# 1 "/usr/include/sys/types.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+
+
+typedef __u_char u_char;
+typedef __u_short u_short;
+typedef __u_int u_int;
+typedef __u_long u_long;
+typedef __quad_t quad_t;
+typedef __u_quad_t u_quad_t;
+typedef __fsid_t fsid_t;
+
+
+
+
+typedef __loff_t loff_t;
+
+
+
+typedef __ino_t ino_t;
+
+
+
+
+
+
+
+
+
+
+
+typedef __dev_t dev_t;
+
+
+
+
+typedef __gid_t gid_t;
+
+
+
+
+typedef __mode_t mode_t;
+
+
+
+
+typedef __nlink_t nlink_t;
+
+
+
+
+typedef __uid_t uid_t;
+
+
+
+
+
+typedef __off_t off_t;
+
+
+
+
+
+
+
+
+
+
+
+typedef __pid_t pid_t;
+
+
+
+
+typedef __id_t id_t;
+
+
+
+
+typedef __ssize_t ssize_t;
+
+
+
+
+
+typedef __daddr_t daddr_t;
+typedef __caddr_t caddr_t;
+
+
+
+
+
+typedef __key_t key_t;
+
+
+
+
+
+
+
+
+
+
+
+# 143 "/usr/include/sys/types.h" 3
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 146 "/usr/include/sys/types.h" 2 3
+
+
+
+
+typedef unsigned long int ulong;
+typedef unsigned short int ushort;
+typedef unsigned int uint;
+
+
+
+
+# 180 "/usr/include/sys/types.h" 3
+
+
+
+
+
+
+
+
+
+
+typedef int int8_t __attribute__ ((__mode__ ( __QI__ ))) ;
+typedef int int16_t __attribute__ ((__mode__ ( __HI__ ))) ;
+typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ;
+typedef int int64_t __attribute__ ((__mode__ ( __DI__ ))) ;
+
+
+typedef unsigned int u_int8_t __attribute__ ((__mode__ ( __QI__ ))) ;
+typedef unsigned int u_int16_t __attribute__ ((__mode__ ( __HI__ ))) ;
+typedef unsigned int u_int32_t __attribute__ ((__mode__ ( __SI__ ))) ;
+typedef unsigned int u_int64_t __attribute__ ((__mode__ ( __DI__ ))) ;
+
+typedef int register_t __attribute__ ((__mode__ (__word__)));
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/endian.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/endian.h" 1 3
+
+
+
+
+
+
+
+# 37 "/usr/include/endian.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 212 "/usr/include/sys/types.h" 2 3
+
+
+
+# 1 "/usr/include/sys/select.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/select.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 36 "/usr/include/bits/select.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 56 "/usr/include/bits/select.h" 3
+
+# 72 "/usr/include/bits/select.h" 3
+
+# 31 "/usr/include/sys/select.h" 2 3
+
+
+
+# 1 "/usr/include/bits/sigset.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef int __sig_atomic_t;
+
+
+
+
+typedef struct
+ {
+ unsigned long int __val[(1024 / (8 * sizeof (unsigned long int))) ];
+ } __sigset_t;
+
+
+
+
+
+
+
+
+
+
+# 125 "/usr/include/bits/sigset.h" 3
+
+# 34 "/usr/include/sys/select.h" 2 3
+
+
+
+
+typedef __sigset_t sigset_t;
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/time.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 57 "/usr/include/bits/time.h" 3
+
+
+
+
+
+
+
+
+
+
+struct timeval
+ {
+ __time_t tv_sec;
+ __suseconds_t tv_usec;
+ };
+
+
+# 46 "/usr/include/sys/select.h" 2 3
+
+
+
+typedef __suseconds_t suseconds_t;
+
+
+
+
+
+typedef long int __fd_mask;
+
+
+
+
+
+
+
+typedef struct
+ {
+
+
+
+
+
+
+ __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask)) ];
+
+
+ } fd_set;
+
+
+
+
+
+
+typedef __fd_mask fd_mask;
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+
+
+
+extern int select (int __nfds, fd_set *__restrict __readfds,
+ fd_set *__restrict __writefds,
+ fd_set *__restrict __exceptfds,
+ struct timeval *__restrict __timeout) throw () ;
+
+# 116 "/usr/include/sys/select.h" 3
+
+
+}
+
+
+# 215 "/usr/include/sys/types.h" 2 3
+
+
+
+# 1 "/usr/include/sys/sysmacros.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 47 "/usr/include/sys/sysmacros.h" 3
+
+
+
+# 218 "/usr/include/sys/types.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+typedef __blkcnt_t blkcnt_t;
+
+
+
+typedef __fsblkcnt_t fsblkcnt_t;
+
+
+
+typedef __fsfilcnt_t fsfilcnt_t;
+
+
+# 254 "/usr/include/sys/types.h" 3
+
+
+
+
+
+
+
+
+}
+
+
+# 390 "/usr/include/stdlib.h" 2 3
+
+
+
+
+
+
+
+extern long int random (void) throw () ;
+
+
+extern void srandom (unsigned int __seed) throw () ;
+
+
+
+
+
+extern char *initstate (unsigned int __seed, char *__statebuf,
+ size_t __statelen) throw () ;
+
+
+
+extern char *setstate (char *__statebuf) throw () ;
+
+
+
+
+
+
+
+struct random_data
+ {
+ int32_t *fptr;
+ int32_t *rptr;
+ int32_t *state;
+ int rand_type;
+ int rand_deg;
+ int rand_sep;
+ int32_t *end_ptr;
+ };
+
+extern int random_r (struct random_data *__restrict __buf,
+ int32_t *__restrict __result) throw () ;
+
+extern int srandom_r (unsigned int __seed, struct random_data *__buf) throw () ;
+
+extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
+ size_t __statelen,
+ struct random_data *__restrict __buf) throw () ;
+
+extern int setstate_r (char *__restrict __statebuf,
+ struct random_data *__restrict __buf) throw () ;
+
+
+
+
+
+extern int rand (void) throw () ;
+
+extern void srand (unsigned int __seed) throw () ;
+
+
+
+extern int rand_r (unsigned int *__seed) throw () ;
+
+
+
+
+
+
+
+extern double drand48 (void) throw () ;
+extern double erand48 (unsigned short int __xsubi[3]) throw () ;
+
+
+extern long int lrand48 (void) throw () ;
+extern long int nrand48 (unsigned short int __xsubi[3]) throw () ;
+
+
+extern long int mrand48 (void) throw () ;
+extern long int jrand48 (unsigned short int __xsubi[3]) throw () ;
+
+
+extern void srand48 (long int __seedval) throw () ;
+extern unsigned short int *seed48 (unsigned short int __seed16v[3]) throw () ;
+extern void lcong48 (unsigned short int __param[7]) throw () ;
+
+
+
+
+
+struct drand48_data
+ {
+ unsigned short int __x[3];
+ unsigned short int __old_x[3];
+ unsigned short int __c;
+ unsigned short int __init;
+ unsigned long long int __a;
+ };
+
+
+extern int drand48_r (struct drand48_data *__restrict __buffer,
+ double *__restrict __result) throw () ;
+extern int erand48_r (unsigned short int __xsubi[3],
+ struct drand48_data *__restrict __buffer,
+ double *__restrict __result) throw () ;
+
+
+extern int lrand48_r (struct drand48_data *__restrict __buffer,
+ long int *__restrict __result) throw () ;
+extern int nrand48_r (unsigned short int __xsubi[3],
+ struct drand48_data *__restrict __buffer,
+ long int *__restrict __result) throw () ;
+
+
+extern int mrand48_r (struct drand48_data *__restrict __buffer,
+ long int *__restrict __result) throw () ;
+extern int jrand48_r (unsigned short int __xsubi[3],
+ struct drand48_data *__restrict __buffer,
+ long int *__restrict __result) throw () ;
+
+
+extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
+ throw () ;
+
+extern int seed48_r (unsigned short int __seed16v[3],
+ struct drand48_data *__buffer) throw () ;
+
+extern int lcong48_r (unsigned short int __param[7],
+ struct drand48_data *__buffer) throw () ;
+
+
+
+
+
+
+
+
+extern void *malloc (size_t __size) throw () ;
+
+extern void *calloc (size_t __nmemb, size_t __size)
+ throw () ;
+
+
+
+
+
+extern void *realloc (void *__ptr, size_t __size) throw () ;
+
+extern void free (void *__ptr) throw () ;
+
+
+
+extern void cfree (void *__ptr) throw () ;
+
+
+
+# 1 "/usr/include/alloca.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 25 "/usr/include/alloca.h" 2 3
+
+
+extern "C" {
+
+
+
+
+
+extern void *alloca (size_t __size) throw () ;
+
+
+
+
+
+}
+
+
+# 546 "/usr/include/stdlib.h" 2 3
+
+
+
+
+
+extern void *valloc (size_t __size) throw () ;
+
+
+
+
+
+
+
+
+
+extern void abort (void) throw () __attribute__ ((__noreturn__));
+
+
+
+extern int atexit (void (*__func) (void)) throw () ;
+
+
+
+
+extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
+ throw () ;
+
+
+
+
+
+extern void exit (int __status) throw () __attribute__ ((__noreturn__));
+
+
+
+
+
+
+
+
+
+extern char *getenv (__const char *__name) throw () ;
+
+
+
+extern char *__secure_getenv (__const char *__name) throw () ;
+
+
+
+
+
+extern int putenv (char *__string) throw () ;
+
+
+
+
+
+extern int setenv (__const char *__name, __const char *__value, int __replace)
+ throw () ;
+
+
+extern int unsetenv (__const char *__name) throw () ;
+
+
+
+
+
+
+extern int clearenv (void) throw () ;
+
+
+
+
+
+
+
+
+extern char *mktemp (char *__template) throw () ;
+
+
+
+
+
+
+
+extern int mkstemp (char *__template) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern char *mkdtemp (char *__template) throw () ;
+
+
+
+
+extern int system (__const char *__command) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern char *realpath (__const char *__restrict __name,
+ char *__restrict __resolved) throw () ;
+
+
+
+
+
+
+typedef int (*__compar_fn_t) (__const void *, __const void *);
+
+
+
+
+
+
+
+
+extern void *bsearch (__const void *__key, __const void *__base,
+ size_t __nmemb, size_t __size, __compar_fn_t __compar);
+
+
+
+extern void qsort (void *__base, size_t __nmemb, size_t __size,
+ __compar_fn_t __compar);
+
+
+
+extern int abs (int __x) throw () __attribute__ ((__const__));
+extern long int labs (long int __x) throw () __attribute__ ((__const__));
+
+
+
+
+
+
+
+
+
+extern div_t div (int __numer, int __denom)
+ throw () __attribute__ ((__const__));
+extern ldiv_t ldiv (long int __numer, long int __denom)
+ throw () __attribute__ ((__const__));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign) throw () ;
+
+
+
+
+extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign) throw () ;
+
+
+
+
+extern char *gcvt (double __value, int __ndigit, char *__buf) throw () ;
+
+
+
+
+extern char *qecvt (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign) throw () ;
+extern char *qfcvt (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign) throw () ;
+extern char *qgcvt (long double __value, int __ndigit, char *__buf) throw () ;
+
+
+
+
+extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign, char *__restrict __buf,
+ size_t __len) throw () ;
+extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign, char *__restrict __buf,
+ size_t __len) throw () ;
+
+extern int qecvt_r (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign,
+ char *__restrict __buf, size_t __len) throw () ;
+extern int qfcvt_r (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign,
+ char *__restrict __buf, size_t __len) throw () ;
+
+
+
+
+
+
+extern int mblen (__const char *__s, size_t __n) throw () ;
+
+
+extern int mbtowc (wchar_t *__restrict __pwc,
+ __const char *__restrict __s, size_t __n) throw () ;
+
+
+extern int wctomb (char *__s, wchar_t __wchar) throw () ;
+
+
+
+extern size_t mbstowcs (wchar_t *__restrict __pwcs,
+ __const char *__restrict __s, size_t __n) throw () ;
+
+extern size_t wcstombs (char *__restrict __s,
+ __const wchar_t *__restrict __pwcs, size_t __n)
+ throw () ;
+
+
+
+
+
+
+
+extern int rpmatch (__const char *__response) throw () ;
+
+
+
+# 811 "/usr/include/stdlib.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 842 "/usr/include/stdlib.h" 3
+
+
+# 852 "/usr/include/stdlib.h" 3
+
+
+
+
+
+
+extern int getloadavg (double __loadavg[], int __nelem) throw () ;
+
+
+
+
+
+}
+
+
+# 6 "transverb.cpp" 2
+
+# 1 "/usr/include/stdio.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 34 "/usr/include/stdio.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+typedef struct _IO_FILE FILE;
+
+
+
+
+
+
+
+
+
+typedef struct _IO_FILE __FILE;
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/libio.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/_G_config.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 269 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+typedef unsigned int wint_t;
+
+
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 14 "/usr/include/_G_config.h" 2 3
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/wchar.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 46 "/usr/include/wchar.h" 3
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 190 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 48 "/usr/include/wchar.h" 2 3
+
+
+# 1 "/usr/include/bits/wchar.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 50 "/usr/include/wchar.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef struct
+{
+ int __count;
+ union
+ {
+ wint_t __wch;
+ char __wchb[4];
+ } __value;
+} __mbstate_t;
+
+
+
+
+
+
+# 682 "/usr/include/wchar.h" 3
+
+
+
+# 24 "/usr/include/_G_config.h" 2 3
+
+
+typedef struct
+{
+ __off_t __pos;
+ __mbstate_t __state;
+} _G_fpos_t;
+typedef struct
+{
+ __off64_t __pos;
+ __mbstate_t __state;
+} _G_fpos64_t;
+
+
+
+
+
+
+
+
+# 1 "/usr/include/gconv.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/wchar.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 46 "/usr/include/wchar.h" 3
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 190 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 48 "/usr/include/wchar.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 76 "/usr/include/wchar.h" 3
+
+
+
+
+
+
+# 682 "/usr/include/wchar.h" 3
+
+
+
+# 28 "/usr/include/gconv.h" 2 3
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 269 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 31 "/usr/include/gconv.h" 2 3
+
+
+
+
+
+
+enum
+{
+ __GCONV_OK = 0,
+ __GCONV_NOCONV,
+ __GCONV_NODB,
+ __GCONV_NOMEM,
+
+ __GCONV_EMPTY_INPUT,
+ __GCONV_FULL_OUTPUT,
+ __GCONV_ILLEGAL_INPUT,
+ __GCONV_INCOMPLETE_INPUT,
+
+ __GCONV_ILLEGAL_DESCRIPTOR,
+ __GCONV_INTERNAL_ERROR
+};
+
+
+
+enum
+{
+ __GCONV_IS_LAST = 0x0001,
+ __GCONV_IGNORE_ERRORS = 0x0002
+};
+
+
+
+struct __gconv_step;
+struct __gconv_step_data;
+struct __gconv_loaded_object;
+struct __gconv_trans_data;
+
+
+
+typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
+ __const unsigned char **, __const unsigned char *,
+ unsigned char **, size_t *, int, int);
+
+
+typedef int (*__gconv_init_fct) (struct __gconv_step *);
+typedef void (*__gconv_end_fct) (struct __gconv_step *);
+
+
+
+typedef int (*__gconv_trans_fct) (struct __gconv_step *,
+ struct __gconv_step_data *, void *,
+ __const unsigned char *,
+ __const unsigned char **,
+ __const unsigned char *, unsigned char **,
+ size_t *);
+
+
+typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
+ __const unsigned char *,
+ unsigned char *, unsigned char *);
+
+
+typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
+ size_t *);
+
+
+typedef int (*__gconv_trans_init_fct) (void **, const char *);
+typedef void (*__gconv_trans_end_fct) (void *);
+
+struct __gconv_trans_data
+{
+
+ __gconv_trans_fct __trans_fct;
+ __gconv_trans_context_fct __trans_context_fct;
+ __gconv_trans_end_fct __trans_end_fct;
+ void *__data;
+ struct __gconv_trans_data *__next;
+};
+
+
+
+struct __gconv_step
+{
+ struct __gconv_loaded_object *__shlib_handle;
+ __const char *__modname;
+
+ int __counter;
+
+ char *__from_name;
+ char *__to_name;
+
+ __gconv_fct __fct;
+ __gconv_init_fct __init_fct;
+ __gconv_end_fct __end_fct;
+
+
+
+ int __min_needed_from;
+ int __max_needed_from;
+ int __min_needed_to;
+ int __max_needed_to;
+
+
+ int __stateful;
+
+ void *__data;
+};
+
+
+
+struct __gconv_step_data
+{
+ unsigned char *__outbuf;
+ unsigned char *__outbufend;
+
+
+
+ int __flags;
+
+
+
+ int __invocation_counter;
+
+
+
+ int __internal_use;
+
+ __mbstate_t *__statep;
+ __mbstate_t __state;
+
+
+
+ struct __gconv_trans_data *__trans;
+};
+
+
+
+typedef struct __gconv_info
+{
+ size_t __nsteps;
+ struct __gconv_step *__steps;
+ __extension__ struct __gconv_step_data __data [0] ;
+} *__gconv_t;
+
+
+# 44 "/usr/include/_G_config.h" 2 3
+
+typedef union
+{
+ struct __gconv_info __cd;
+ struct
+ {
+ struct __gconv_info __cd;
+ struct __gconv_step_data __data;
+ } __combined;
+} _G_iconv_t;
+
+typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
+typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 32 "/usr/include/libio.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef void *__gnuc_va_list;
+
+
+
+
+
+# 122 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 209 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stdarg.h" 3
+
+
+
+
+# 53 "/usr/include/libio.h" 2 3
+
+
+
+
+
+
+
+# 72 "/usr/include/libio.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 103 "/usr/include/libio.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+struct _IO_jump_t; struct _IO_FILE;
+
+
+
+
+
+
+
+
+
+typedef void _IO_lock_t;
+
+
+
+
+
+struct _IO_marker {
+ struct _IO_marker *_next;
+ struct _IO_FILE *_sbuf;
+
+
+
+ int _pos;
+# 192 "/usr/include/libio.h" 3
+
+};
+
+
+enum __codecvt_result
+{
+ __codecvt_ok,
+ __codecvt_partial,
+ __codecvt_error,
+ __codecvt_noconv
+};
+
+# 259 "/usr/include/libio.h" 3
+
+
+struct _IO_FILE {
+ int _flags;
+
+
+
+
+ char* _IO_read_ptr;
+ char* _IO_read_end;
+ char* _IO_read_base;
+ char* _IO_write_base;
+ char* _IO_write_ptr;
+ char* _IO_write_end;
+ char* _IO_buf_base;
+ char* _IO_buf_end;
+
+ char *_IO_save_base;
+ char *_IO_backup_base;
+ char *_IO_save_end;
+
+ struct _IO_marker *_markers;
+
+ struct _IO_FILE *_chain;
+
+ int _fileno;
+ int _blksize;
+ __off_t _old_offset;
+
+
+
+ unsigned short _cur_column;
+ signed char _vtable_offset;
+ char _shortbuf[1];
+
+
+
+ _IO_lock_t *_lock;
+
+
+
+
+
+
+
+
+ __off64_t _offset;
+
+
+
+
+
+ void *__pad1;
+ void *__pad2;
+
+ int _mode;
+
+ char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
+
+};
+
+
+
+
+
+struct _IO_FILE_plus;
+
+extern struct _IO_FILE_plus _IO_2_1_stdin_;
+extern struct _IO_FILE_plus _IO_2_1_stdout_;
+extern struct _IO_FILE_plus _IO_2_1_stderr_;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
+
+
+
+
+
+
+
+typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
+ size_t __n);
+
+
+
+
+
+
+
+typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
+
+
+typedef int __io_close_fn (void *__cookie);
+
+
+# 389 "/usr/include/libio.h" 3
+
+
+
+
+extern "C" {
+
+
+extern int __underflow (_IO_FILE *) throw () ;
+extern int __uflow (_IO_FILE *) throw () ;
+extern int __overflow (_IO_FILE *, int) throw () ;
+extern wint_t __wunderflow (_IO_FILE *) throw () ;
+extern wint_t __wuflow (_IO_FILE *) throw () ;
+extern wint_t __woverflow (_IO_FILE *, wint_t ) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int _IO_getc (_IO_FILE *__fp) throw () ;
+extern int _IO_putc (int __c, _IO_FILE *__fp) throw () ;
+extern int _IO_feof (_IO_FILE *__fp) throw () ;
+extern int _IO_ferror (_IO_FILE *__fp) throw () ;
+
+extern int _IO_peekc_locked (_IO_FILE *__fp) throw () ;
+
+
+
+
+
+extern void _IO_flockfile (_IO_FILE *) throw () ;
+extern void _IO_funlockfile (_IO_FILE *) throw () ;
+extern int _IO_ftrylockfile (_IO_FILE *) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
+ __gnuc_va_list , int *__restrict) throw () ;
+extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
+ __gnuc_va_list ) throw () ;
+extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t ) throw () ;
+extern size_t _IO_sgetn (_IO_FILE *, void *, size_t ) throw () ;
+
+extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t , int, int) throw () ;
+extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t , int) throw () ;
+
+extern void _IO_free_backup_area (_IO_FILE *) throw () ;
+
+# 511 "/usr/include/libio.h" 3
+
+
+
+}
+
+
+
+# 65 "/usr/include/stdio.h" 2 3
+
+
+# 76 "/usr/include/stdio.h" 3
+
+
+
+
+typedef _G_fpos_t fpos_t;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/stdio_lim.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 129 "/usr/include/stdio.h" 2 3
+
+
+
+
+extern FILE *stdin;
+extern FILE *stdout;
+extern FILE *stderr;
+
+
+
+
+
+
+extern int remove (__const char *__filename) throw () ;
+
+extern int rename (__const char *__old, __const char *__new) throw () ;
+
+
+
+
+extern FILE *tmpfile (void) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+extern char *tmpnam (char *__s) throw () ;
+
+
+
+
+extern char *tmpnam_r (char *__s) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+extern char *tempnam (__const char *__dir, __const char *__pfx)
+ throw () ;
+
+
+
+
+extern int fclose (FILE *__stream) throw () ;
+
+extern int fflush (FILE *__stream) throw () ;
+
+
+
+extern int fflush_unlocked (FILE *__stream) throw () ;
+
+
+
+
+
+
+
+
+
+
+extern FILE *fopen (__const char *__restrict __filename,
+ __const char *__restrict __modes) throw () ;
+
+extern FILE *freopen (__const char *__restrict __filename,
+ __const char *__restrict __modes,
+ FILE *__restrict __stream) throw () ;
+# 220 "/usr/include/stdio.h" 3
+
+
+
+
+
+
+
+
+
+
+
+extern FILE *fdopen (int __fd, __const char *__modes) throw () ;
+
+
+# 249 "/usr/include/stdio.h" 3
+
+
+
+
+
+extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) throw () ;
+
+
+
+extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
+ int __modes, size_t __n) throw () ;
+
+
+
+
+extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
+ size_t __size) throw () ;
+
+
+extern void setlinebuf (FILE *__stream) throw () ;
+
+
+
+
+extern int fprintf (FILE *__restrict __stream,
+ __const char *__restrict __format, ...) throw () ;
+
+extern int printf (__const char *__restrict __format, ...) throw () ;
+
+extern int sprintf (char *__restrict __s,
+ __const char *__restrict __format, ...) throw () ;
+
+
+extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
+ __gnuc_va_list __arg) throw () ;
+
+extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
+ throw () ;
+
+extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
+ __gnuc_va_list __arg) throw () ;
+
+
+
+extern int snprintf (char *__restrict __s, size_t __maxlen,
+ __const char *__restrict __format, ...)
+ throw () __attribute__ ((__format__ (__printf__, 3, 4)));
+
+extern int vsnprintf (char *__restrict __s, size_t __maxlen,
+ __const char *__restrict __format, __gnuc_va_list __arg)
+ throw () __attribute__ ((__format__ (__printf__, 3, 0)));
+
+
+# 321 "/usr/include/stdio.h" 3
+
+
+
+
+extern int fscanf (FILE *__restrict __stream,
+ __const char *__restrict __format, ...) throw () ;
+
+extern int scanf (__const char *__restrict __format, ...) throw () ;
+
+extern int sscanf (__const char *__restrict __s,
+ __const char *__restrict __format, ...) throw () ;
+
+# 347 "/usr/include/stdio.h" 3
+
+
+
+
+extern int fgetc (FILE *__stream) throw () ;
+extern int getc (FILE *__stream) throw () ;
+
+
+extern int getchar (void) throw () ;
+
+
+
+
+
+
+
+extern int getc_unlocked (FILE *__stream) throw () ;
+extern int getchar_unlocked (void) throw () ;
+
+
+
+
+extern int fgetc_unlocked (FILE *__stream) throw () ;
+
+
+
+
+extern int fputc (int __c, FILE *__stream) throw () ;
+extern int putc (int __c, FILE *__stream) throw () ;
+
+
+extern int putchar (int __c) throw () ;
+
+
+
+
+
+
+
+extern int fputc_unlocked (int __c, FILE *__stream) throw () ;
+
+
+
+
+extern int putc_unlocked (int __c, FILE *__stream) throw () ;
+extern int putchar_unlocked (int __c) throw () ;
+
+
+
+
+
+extern int getw (FILE *__stream) throw () ;
+
+
+extern int putw (int __w, FILE *__stream) throw () ;
+
+
+
+
+extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
+ throw () ;
+
+
+
+
+
+
+
+
+
+extern char *gets (char *__s) throw () ;
+
+
+# 437 "/usr/include/stdio.h" 3
+
+
+
+
+extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
+ throw () ;
+
+
+
+
+
+
+
+
+extern int puts (__const char *__s) throw () ;
+
+
+
+extern int ungetc (int __c, FILE *__stream) throw () ;
+
+
+
+extern size_t fread (void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __stream) throw () ;
+
+extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __s) throw () ;
+
+
+
+extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __stream) throw () ;
+extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __stream) throw () ;
+
+
+
+
+extern int fseek (FILE *__stream, long int __off, int __whence) throw () ;
+
+extern long int ftell (FILE *__stream) throw () ;
+
+extern void rewind (FILE *__stream) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
+ throw () ;
+
+extern int fsetpos (FILE *__stream, __const fpos_t *__pos) throw () ;
+# 520 "/usr/include/stdio.h" 3
+
+
+
+
+
+
+
+
+
+
+
+extern void clearerr (FILE *__stream) throw () ;
+
+extern int feof (FILE *__stream) throw () ;
+
+extern int ferror (FILE *__stream) throw () ;
+
+
+
+extern void clearerr_unlocked (FILE *__stream) throw () ;
+extern int feof_unlocked (FILE *__stream) throw () ;
+extern int ferror_unlocked (FILE *__stream) throw () ;
+
+
+
+
+extern void perror (__const char *__s) throw () ;
+
+
+
+
+extern int sys_nerr;
+extern __const char *__const sys_errlist[];
+
+
+
+
+
+
+
+
+
+extern int fileno (FILE *__stream) throw () ;
+
+
+
+
+extern int fileno_unlocked (FILE *__stream) throw () ;
+
+
+
+
+
+
+extern FILE *popen (__const char *__command, __const char *__modes) throw () ;
+
+
+extern int pclose (FILE *__stream) throw () ;
+
+
+
+
+
+extern char *ctermid (char *__s) throw () ;
+
+
+
+
+
+
+
+
+
+# 602 "/usr/include/stdio.h" 3
+
+
+
+
+
+
+
+extern void flockfile (FILE *__stream) throw () ;
+
+
+
+extern int ftrylockfile (FILE *__stream) throw () ;
+
+
+extern void funlockfile (FILE *__stream) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/stdio.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+inline int
+vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg) throw ()
+{
+ return vfprintf (stdout , __fmt, __arg);
+}
+
+
+inline int
+getchar (void) throw ()
+{
+ return _IO_getc (stdin );
+}
+
+
+
+
+inline int
+getc_unlocked (FILE *__fp) throw ()
+{
+ return (( __fp )->_IO_read_ptr >= ( __fp )->_IO_read_end ? __uflow ( __fp ) : *(unsigned char *) ( __fp )->_IO_read_ptr++) ;
+}
+
+
+inline int
+getchar_unlocked (void) throw ()
+{
+ return (( stdin )->_IO_read_ptr >= ( stdin )->_IO_read_end ? __uflow ( stdin ) : *(unsigned char *) ( stdin )->_IO_read_ptr++) ;
+}
+
+
+
+
+inline int
+putchar (int __c) throw ()
+{
+ return _IO_putc (__c, stdout );
+}
+
+
+
+
+inline int
+fputc_unlocked (int __c, FILE *__stream) throw ()
+{
+ return ((( __stream )->_IO_write_ptr >= ( __stream )->_IO_write_end) ? __overflow ( __stream , (unsigned char) ( __c )) : (unsigned char) (*( __stream )->_IO_write_ptr++ = ( __c ))) ;
+}
+
+
+
+
+
+inline int
+putc_unlocked (int __c, FILE *__stream) throw ()
+{
+ return ((( __stream )->_IO_write_ptr >= ( __stream )->_IO_write_end) ? __overflow ( __stream , (unsigned char) ( __c )) : (unsigned char) (*( __stream )->_IO_write_ptr++ = ( __c ))) ;
+}
+
+
+inline int
+putchar_unlocked (int __c) throw ()
+{
+ return ((( stdout )->_IO_write_ptr >= ( stdout )->_IO_write_end) ? __overflow ( stdout , (unsigned char) ( __c )) : (unsigned char) (*( stdout )->_IO_write_ptr++ = ( __c ))) ;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+inline int
+feof_unlocked (FILE *__stream) throw ()
+{
+ return ((( __stream )->_flags & 0x10 ) != 0) ;
+}
+
+
+inline int
+ferror_unlocked (FILE *__stream) throw ()
+{
+ return ((( __stream )->_flags & 0x20 ) != 0) ;
+}
+
+
+
+
+
+
+
+
+# 150 "/usr/include/bits/stdio.h" 3
+
+
+# 166 "/usr/include/bits/stdio.h" 3
+
+
+
+
+# 630 "/usr/include/stdio.h" 2 3
+
+
+
+}
+
+
+
+
+# 7 "transverb.cpp" 2
+
+# 1 "/usr/include/math.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+# 1 "/usr/include/bits/huge_val.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 81 "/usr/include/bits/huge_val.h" 3
+
+# 33 "/usr/include/math.h" 2 3
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/mathdef.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 41 "/usr/include/bits/mathdef.h" 3
+
+# 40 "/usr/include/math.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/mathcalls.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern double acos (double __x) throw () ; extern double __acos (double __x) throw () ;
+
+extern double asin (double __x) throw () ; extern double __asin (double __x) throw () ;
+
+extern double atan (double __x) throw () ; extern double __atan (double __x) throw () ;
+
+extern double atan2 (double __y, double __x) throw () ; extern double __atan2 (double __y, double __x) throw () ;
+
+
+extern double cos (double __x) throw () ; extern double __cos (double __x) throw () ;
+
+extern double sin (double __x) throw () ; extern double __sin (double __x) throw () ;
+
+extern double tan (double __x) throw () ; extern double __tan (double __x) throw () ;
+
+
+
+
+
+
+
+
+
+
+extern double cosh (double __x) throw () ; extern double __cosh (double __x) throw () ;
+
+extern double sinh (double __x) throw () ; extern double __sinh (double __x) throw () ;
+
+extern double tanh (double __x) throw () ; extern double __tanh (double __x) throw () ;
+
+
+
+extern double acosh (double __x) throw () ; extern double __acosh (double __x) throw () ;
+
+extern double asinh (double __x) throw () ; extern double __asinh (double __x) throw () ;
+
+extern double atanh (double __x) throw () ; extern double __atanh (double __x) throw () ;
+
+
+
+
+
+extern double exp (double __x) throw () ; extern double __exp (double __x) throw () ;
+
+
+
+
+
+
+
+
+
+extern double frexp (double __x, int *__exponent) throw () ; extern double __frexp (double __x, int *__exponent) throw () ;
+
+
+extern double ldexp (double __x, int __exponent) throw () ; extern double __ldexp (double __x, int __exponent) throw () ;
+
+
+extern double log (double __x) throw () ; extern double __log (double __x) throw () ;
+
+
+extern double log10 (double __x) throw () ; extern double __log10 (double __x) throw () ;
+
+
+extern double modf (double __x, double *__iptr) throw () ; extern double __modf (double __x, double *__iptr) throw () ;
+
+
+
+extern double expm1 (double __x) throw () ; extern double __expm1 (double __x) throw () ;
+
+
+extern double log1p (double __x) throw () ; extern double __log1p (double __x) throw () ;
+
+
+extern double logb (double __x) throw () ; extern double __logb (double __x) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern double pow (double __x, double __y) throw () ; extern double __pow (double __x, double __y) throw () ;
+
+
+extern double sqrt (double __x) throw () ; extern double __sqrt (double __x) throw () ;
+
+
+
+extern double hypot (double __x, double __y) throw () ; extern double __hypot (double __x, double __y) throw () ;
+
+
+
+
+extern double cbrt (double __x) throw () ; extern double __cbrt (double __x) throw () ;
+
+
+
+
+
+
+extern double ceil (double __x) throw () ; extern double __ceil (double __x) throw () ;
+
+
+extern double fabs (double __x) throw () __attribute__ ( (__const__) ); extern double __fabs (double __x) throw () __attribute__ ( (__const__) ) ;
+
+
+extern double floor (double __x) throw () ; extern double __floor (double __x) throw () ;
+
+
+extern double fmod (double __x, double __y) throw () ; extern double __fmod (double __x, double __y) throw () ;
+
+
+
+
+extern int __isinf (double __value) throw () __attribute__ ((__const__));
+
+
+extern int __finite (double __value) throw () __attribute__ ((__const__));
+
+
+
+
+extern int isinf (double __value) throw () __attribute__ ((__const__));
+
+
+extern int finite (double __value) throw () __attribute__ ((__const__));
+
+
+extern double drem (double __x, double __y) throw () ; extern double __drem (double __x, double __y) throw () ;
+
+
+
+extern double significand (double __x) throw () ; extern double __significand (double __x) throw () ;
+
+
+
+
+extern double copysign (double __x, double __y) throw () __attribute__ ( (__const__) ); extern double __copysign (double __x, double __y) throw () __attribute__ ( (__const__) ) ;
+
+
+
+
+
+
+
+
+
+extern int __isnan (double __value) throw () __attribute__ ((__const__));
+
+
+
+extern int isnan (double __value) throw () __attribute__ ((__const__));
+
+
+extern double j0 (double ) throw () ; extern double __j0 (double ) throw () ;
+extern double j1 (double ) throw () ; extern double __j1 (double ) throw () ;
+extern double jn (int, double ) throw () ; extern double __jn (int, double ) throw () ;
+extern double y0 (double ) throw () ; extern double __y0 (double ) throw () ;
+extern double y1 (double ) throw () ; extern double __y1 (double ) throw () ;
+extern double yn (int, double ) throw () ; extern double __yn (int, double ) throw () ;
+
+
+
+
+
+extern double erf (double ) throw () ; extern double __erf (double ) throw () ;
+extern double erfc (double ) throw () ; extern double __erfc (double ) throw () ;
+extern double lgamma (double ) throw () ; extern double __lgamma (double ) throw () ;
+
+
+
+
+
+
+
+
+extern double gamma (double ) throw () ; extern double __gamma (double ) throw () ;
+
+
+
+
+
+
+extern double lgamma_r (double , int *__signgamp) throw () ; extern double __lgamma_r (double , int *__signgamp) throw () ;
+
+
+
+
+
+
+extern double rint (double __x) throw () ; extern double __rint (double __x) throw () ;
+
+
+extern double nextafter (double __x, double __y) throw () __attribute__ ( (__const__) ); extern double __nextafter (double __x, double __y) throw () __attribute__ ( (__const__) ) ;
+
+
+
+
+
+extern double remainder (double __x, double __y) throw () ; extern double __remainder (double __x, double __y) throw () ;
+
+
+
+extern double scalb (double __x, double __n) throw () ; extern double __scalb (double __x, double __n) throw () ;
+
+
+
+
+extern double scalbn (double __x, int __n) throw () ; extern double __scalbn (double __x, int __n) throw () ;
+
+
+
+extern int ilogb (double __x) throw () ; extern int __ilogb (double __x) throw () ;
+
+
+# 333 "/usr/include/bits/mathcalls.h" 3
+
+# 63 "/usr/include/math.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/mathcalls.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern float acosf (float __x) throw () ; extern float __acosf (float __x) throw () ;
+
+extern float asinf (float __x) throw () ; extern float __asinf (float __x) throw () ;
+
+extern float atanf (float __x) throw () ; extern float __atanf (float __x) throw () ;
+
+extern float atan2f (float __y, float __x) throw () ; extern float __atan2f (float __y, float __x) throw () ;
+
+
+extern float cosf (float __x) throw () ; extern float __cosf (float __x) throw () ;
+
+extern float sinf (float __x) throw () ; extern float __sinf (float __x) throw () ;
+
+extern float tanf (float __x) throw () ; extern float __tanf (float __x) throw () ;
+
+
+
+
+
+
+
+
+
+
+extern float coshf (float __x) throw () ; extern float __coshf (float __x) throw () ;
+
+extern float sinhf (float __x) throw () ; extern float __sinhf (float __x) throw () ;
+
+extern float tanhf (float __x) throw () ; extern float __tanhf (float __x) throw () ;
+
+
+
+extern float acoshf (float __x) throw () ; extern float __acoshf (float __x) throw () ;
+
+extern float asinhf (float __x) throw () ; extern float __asinhf (float __x) throw () ;
+
+extern float atanhf (float __x) throw () ; extern float __atanhf (float __x) throw () ;
+
+
+
+
+
+extern float expf (float __x) throw () ; extern float __expf (float __x) throw () ;
+
+
+
+
+
+
+
+
+
+extern float frexpf (float __x, int *__exponent) throw () ; extern float __frexpf (float __x, int *__exponent) throw () ;
+
+
+extern float ldexpf (float __x, int __exponent) throw () ; extern float __ldexpf (float __x, int __exponent) throw () ;
+
+
+extern float logf (float __x) throw () ; extern float __logf (float __x) throw () ;
+
+
+extern float log10f (float __x) throw () ; extern float __log10f (float __x) throw () ;
+
+
+extern float modff (float __x, float *__iptr) throw () ; extern float __modff (float __x, float *__iptr) throw () ;
+
+
+
+extern float expm1f (float __x) throw () ; extern float __expm1f (float __x) throw () ;
+
+
+extern float log1pf (float __x) throw () ; extern float __log1pf (float __x) throw () ;
+
+
+extern float logbf (float __x) throw () ; extern float __logbf (float __x) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern float powf (float __x, float __y) throw () ; extern float __powf (float __x, float __y) throw () ;
+
+
+extern float sqrtf (float __x) throw () ; extern float __sqrtf (float __x) throw () ;
+
+
+
+extern float hypotf (float __x, float __y) throw () ; extern float __hypotf (float __x, float __y) throw () ;
+
+
+
+
+extern float cbrtf (float __x) throw () ; extern float __cbrtf (float __x) throw () ;
+
+
+
+
+
+
+extern float ceilf (float __x) throw () ; extern float __ceilf (float __x) throw () ;
+
+
+extern float fabsf (float __x) throw () __attribute__ ( (__const__) ); extern float __fabsf (float __x) throw () __attribute__ ( (__const__) ) ;
+
+
+extern float floorf (float __x) throw () ; extern float __floorf (float __x) throw () ;
+
+
+extern float fmodf (float __x, float __y) throw () ; extern float __fmodf (float __x, float __y) throw () ;
+
+
+
+
+extern int __isinff (float __value) throw () __attribute__ ((__const__));
+
+
+extern int __finitef (float __value) throw () __attribute__ ((__const__));
+
+
+
+
+extern int isinff (float __value) throw () __attribute__ ((__const__));
+
+
+extern int finitef (float __value) throw () __attribute__ ((__const__));
+
+
+extern float dremf (float __x, float __y) throw () ; extern float __dremf (float __x, float __y) throw () ;
+
+
+
+extern float significandf (float __x) throw () ; extern float __significandf (float __x) throw () ;
+
+
+
+
+extern float copysignf (float __x, float __y) throw () __attribute__ ( (__const__) ); extern float __copysignf (float __x, float __y) throw () __attribute__ ( (__const__) ) ;
+
+
+
+
+
+
+
+
+
+extern int __isnanf (float __value) throw () __attribute__ ((__const__));
+
+
+
+extern int isnanf (float __value) throw () __attribute__ ((__const__));
+
+
+extern float j0f (float ) throw () ; extern float __j0f (float ) throw () ;
+extern float j1f (float ) throw () ; extern float __j1f (float ) throw () ;
+extern float jnf (int, float ) throw () ; extern float __jnf (int, float ) throw () ;
+extern float y0f (float ) throw () ; extern float __y0f (float ) throw () ;
+extern float y1f (float ) throw () ; extern float __y1f (float ) throw () ;
+extern float ynf (int, float ) throw () ; extern float __ynf (int, float ) throw () ;
+
+
+
+
+
+extern float erff (float ) throw () ; extern float __erff (float ) throw () ;
+extern float erfcf (float ) throw () ; extern float __erfcf (float ) throw () ;
+extern float lgammaf (float ) throw () ; extern float __lgammaf (float ) throw () ;
+
+
+
+
+
+
+
+
+extern float gammaf (float ) throw () ; extern float __gammaf (float ) throw () ;
+
+
+
+
+
+
+extern float lgammaf_r (float , int *__signgamp) throw () ; extern float __lgammaf_r (float , int *__signgamp) throw () ;
+
+
+
+
+
+
+extern float rintf (float __x) throw () ; extern float __rintf (float __x) throw () ;
+
+
+extern float nextafterf (float __x, float __y) throw () __attribute__ ( (__const__) ); extern float __nextafterf (float __x, float __y) throw () __attribute__ ( (__const__) ) ;
+
+
+
+
+
+extern float remainderf (float __x, float __y) throw () ; extern float __remainderf (float __x, float __y) throw () ;
+
+
+
+extern float scalbf (float __x, float __n) throw () ; extern float __scalbf (float __x, float __n) throw () ;
+
+
+
+
+extern float scalbnf (float __x, int __n) throw () ; extern float __scalbnf (float __x, int __n) throw () ;
+
+
+
+extern int ilogbf (float __x) throw () ; extern int __ilogbf (float __x) throw () ;
+
+
+# 333 "/usr/include/bits/mathcalls.h" 3
+
+# 82 "/usr/include/math.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/mathcalls.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern long double acosl (long double __x) throw () ; extern long double __acosl (long double __x) throw () ;
+
+extern long double asinl (long double __x) throw () ; extern long double __asinl (long double __x) throw () ;
+
+extern long double atanl (long double __x) throw () ; extern long double __atanl (long double __x) throw () ;
+
+extern long double atan2l (long double __y, long double __x) throw () ; extern long double __atan2l (long double __y, long double __x) throw () ;
+
+
+extern long double cosl (long double __x) throw () ; extern long double __cosl (long double __x) throw () ;
+
+extern long double sinl (long double __x) throw () ; extern long double __sinl (long double __x) throw () ;
+
+extern long double tanl (long double __x) throw () ; extern long double __tanl (long double __x) throw () ;
+
+
+
+
+
+
+
+
+
+
+extern long double coshl (long double __x) throw () ; extern long double __coshl (long double __x) throw () ;
+
+extern long double sinhl (long double __x) throw () ; extern long double __sinhl (long double __x) throw () ;
+
+extern long double tanhl (long double __x) throw () ; extern long double __tanhl (long double __x) throw () ;
+
+
+
+extern long double acoshl (long double __x) throw () ; extern long double __acoshl (long double __x) throw () ;
+
+extern long double asinhl (long double __x) throw () ; extern long double __asinhl (long double __x) throw () ;
+
+extern long double atanhl (long double __x) throw () ; extern long double __atanhl (long double __x) throw () ;
+
+
+
+
+
+extern long double expl (long double __x) throw () ; extern long double __expl (long double __x) throw () ;
+
+
+
+
+
+
+
+
+
+extern long double frexpl (long double __x, int *__exponent) throw () ; extern long double __frexpl (long double __x, int *__exponent) throw () ;
+
+
+extern long double ldexpl (long double __x, int __exponent) throw () ; extern long double __ldexpl (long double __x, int __exponent) throw () ;
+
+
+extern long double logl (long double __x) throw () ; extern long double __logl (long double __x) throw () ;
+
+
+extern long double log10l (long double __x) throw () ; extern long double __log10l (long double __x) throw () ;
+
+
+extern long double modfl (long double __x, long double *__iptr) throw () ; extern long double __modfl (long double __x, long double *__iptr) throw () ;
+
+
+
+extern long double expm1l (long double __x) throw () ; extern long double __expm1l (long double __x) throw () ;
+
+
+extern long double log1pl (long double __x) throw () ; extern long double __log1pl (long double __x) throw () ;
+
+
+extern long double logbl (long double __x) throw () ; extern long double __logbl (long double __x) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern long double powl (long double __x, long double __y) throw () ; extern long double __powl (long double __x, long double __y) throw () ;
+
+
+extern long double sqrtl (long double __x) throw () ; extern long double __sqrtl (long double __x) throw () ;
+
+
+
+extern long double hypotl (long double __x, long double __y) throw () ; extern long double __hypotl (long double __x, long double __y) throw () ;
+
+
+
+
+extern long double cbrtl (long double __x) throw () ; extern long double __cbrtl (long double __x) throw () ;
+
+
+
+
+
+
+extern long double ceill (long double __x) throw () ; extern long double __ceill (long double __x) throw () ;
+
+
+extern long double fabsl (long double __x) throw () __attribute__ ( (__const__) ); extern long double __fabsl (long double __x) throw () __attribute__ ( (__const__) ) ;
+
+
+extern long double floorl (long double __x) throw () ; extern long double __floorl (long double __x) throw () ;
+
+
+extern long double fmodl (long double __x, long double __y) throw () ; extern long double __fmodl (long double __x, long double __y) throw () ;
+
+
+
+
+extern int __isinfl (long double __value) throw () __attribute__ ((__const__));
+
+
+extern int __finitel (long double __value) throw () __attribute__ ((__const__));
+
+
+
+
+extern int isinfl (long double __value) throw () __attribute__ ((__const__));
+
+
+extern int finitel (long double __value) throw () __attribute__ ((__const__));
+
+
+extern long double dreml (long double __x, long double __y) throw () ; extern long double __dreml (long double __x, long double __y) throw () ;
+
+
+
+extern long double significandl (long double __x) throw () ; extern long double __significandl (long double __x) throw () ;
+
+
+
+
+extern long double copysignl (long double __x, long double __y) throw () __attribute__ ( (__const__) ); extern long double __copysignl (long double __x, long double __y) throw () __attribute__ ( (__const__) ) ;
+
+
+
+
+
+
+
+
+
+extern int __isnanl (long double __value) throw () __attribute__ ((__const__));
+
+
+
+extern int isnanl (long double __value) throw () __attribute__ ((__const__));
+
+
+extern long double j0l (long double ) throw () ; extern long double __j0l (long double ) throw () ;
+extern long double j1l (long double ) throw () ; extern long double __j1l (long double ) throw () ;
+extern long double jnl (int, long double ) throw () ; extern long double __jnl (int, long double ) throw () ;
+extern long double y0l (long double ) throw () ; extern long double __y0l (long double ) throw () ;
+extern long double y1l (long double ) throw () ; extern long double __y1l (long double ) throw () ;
+extern long double ynl (int, long double ) throw () ; extern long double __ynl (int, long double ) throw () ;
+
+
+
+
+
+extern long double erfl (long double ) throw () ; extern long double __erfl (long double ) throw () ;
+extern long double erfcl (long double ) throw () ; extern long double __erfcl (long double ) throw () ;
+extern long double lgammal (long double ) throw () ; extern long double __lgammal (long double ) throw () ;
+
+
+
+
+
+
+
+
+extern long double gammal (long double ) throw () ; extern long double __gammal (long double ) throw () ;
+
+
+
+
+
+
+extern long double lgammal_r (long double , int *__signgamp) throw () ; extern long double __lgammal_r (long double , int *__signgamp) throw () ;
+
+
+
+
+
+
+extern long double rintl (long double __x) throw () ; extern long double __rintl (long double __x) throw () ;
+
+
+extern long double nextafterl (long double __x, long double __y) throw () __attribute__ ( (__const__) ); extern long double __nextafterl (long double __x, long double __y) throw () __attribute__ ( (__const__) ) ;
+
+
+
+
+
+extern long double remainderl (long double __x, long double __y) throw () ; extern long double __remainderl (long double __x, long double __y) throw () ;
+
+
+
+extern long double scalbl (long double __x, long double __n) throw () ; extern long double __scalbl (long double __x, long double __n) throw () ;
+
+
+
+
+extern long double scalbnl (long double __x, int __n) throw () ; extern long double __scalbnl (long double __x, int __n) throw () ;
+
+
+
+extern int ilogbl (long double __x) throw () ; extern int __ilogbl (long double __x) throw () ;
+
+
+# 333 "/usr/include/bits/mathcalls.h" 3
+
+# 99 "/usr/include/math.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int signgam;
+
+
+
+
+# 236 "/usr/include/math.h" 3
+
+
+
+
+typedef enum
+{
+ _IEEE_ = -1,
+ _SVID_,
+ _XOPEN_,
+ _POSIX_,
+ _ISOC_
+} _LIB_VERSION_TYPE;
+
+
+
+
+extern _LIB_VERSION_TYPE _LIB_VERSION;
+
+
+
+
+
+
+
+
+
+
+struct __exception
+
+
+
+ {
+ int type;
+ char *name;
+ double arg1;
+ double arg2;
+ double retval;
+ };
+
+
+extern int matherr (struct __exception *__exc) throw ();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 338 "/usr/include/math.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/mathinline.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 146 "/usr/include/bits/mathinline.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 252 "/usr/include/bits/mathinline.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+__inline double __sgn ( double ) throw () ; __inline double __sgn ( double __x ) throw () { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0) ; } __inline float __sgnf ( float ) throw () ; __inline float __sgnf ( float __x ) throw () { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0) ; } __inline long double __sgnl ( long double ) throw () ; __inline long double __sgnl ( long double __x ) throw () { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0) ; }
+
+
+
+# 416 "/usr/include/bits/mathinline.h" 3
+
+
+
+
+
+
+
+
+
+__inline double atan2 ( double __y , double __x ) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value ; } __inline float atan2f ( float __y , float __x ) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value ; } __inline long double atan2l ( long double __y , long double __x ) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value ; }
+__inline long double __atan2l ( long double __y , long double __x ) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value ; }
+
+
+__inline double fmod ( double __x , double __y ) throw () { register long double __value; __asm __volatile__ ("1: fprem\n\t" "fnstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value ; } __inline float fmodf ( float __x , float __y ) throw () { register long double __value; __asm __volatile__ ("1: fprem\n\t" "fnstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value ; } __inline long double fmodl ( long double __x , long double __y ) throw () { register long double __value; __asm __volatile__ ("1: fprem\n\t" "fnstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value ; }
+# 438 "/usr/include/bits/mathinline.h" 3
+
+
+__inline double sqrt ( double __x) throw () { register double __result; __asm __volatile__ ( "fsqrt" : "=t" (__result) : "0" (__x) ); return __result; } __inline float sqrtf ( float __x) throw () { register float __result; __asm __volatile__ ( "fsqrt" : "=t" (__result) : "0" (__x) ); return __result; } __inline long double sqrtl ( long double __x) throw () { register long double __result; __asm __volatile__ ( "fsqrt" : "=t" (__result) : "0" (__x) ); return __result; }
+__inline long double __sqrtl ( long double __x) throw () { register long double __result; __asm __volatile__ ( "fsqrt" : "=t" (__result) : "0" (__x) ); return __result; }
+
+
+__inline double fabs ( double __x ) throw () { return __builtin_fabs (__x) ; }
+__inline float fabsf ( float __x ) throw () { return __builtin_fabsf (__x) ; }
+__inline long double fabsl ( long double __x ) throw () { return __builtin_fabsl (__x) ; }
+__inline long double __fabsl ( long double __x ) throw () { return __builtin_fabsl (__x) ; }
+
+
+
+
+
+# 464 "/usr/include/bits/mathinline.h" 3
+
+
+__inline double atan ( double __x) throw () { register double __result; __asm __volatile__ ( "fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)" ); return __result; } __inline float atanf ( float __x) throw () { register float __result; __asm __volatile__ ( "fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)" ); return __result; } __inline long double atanl ( long double __x) throw () { register long double __result; __asm __volatile__ ( "fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)" ); return __result; }
+
+__inline long double __sgn1l ( long double ) throw () ; __inline long double __sgn1l ( long double __x ) throw () { __extension__ union { long double __xld; unsigned int __xi[3]; } __n = { __xld: __x }; __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; __n.__xi[1] = 0x80000000; __n.__xi[0] = 0; return __n.__xld ; }
+
+
+
+
+
+
+
+
+# 490 "/usr/include/bits/mathinline.h" 3
+
+
+__inline double floor ( double __x ) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value ; } __inline float floorf ( float __x ) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value ; } __inline long double floorl ( long double __x ) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value ; }
+# 502 "/usr/include/bits/mathinline.h" 3
+
+__inline double ceil ( double __x ) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value ; } __inline float ceilf ( float __x ) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value ; } __inline long double ceill ( long double __x ) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value ; }
+# 513 "/usr/include/bits/mathinline.h" 3
+
+
+
+
+
+
+
+
+__inline double
+ldexp (double __x, int __y) throw ()
+{
+ register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value ;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+__inline double log1p ( double __x ) throw () { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L ) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value ; } __inline float log1pf ( float __x ) throw () { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L ) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value ; } __inline long double log1pl ( long double __x ) throw () { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L ) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value ; }
+# 550 "/usr/include/bits/mathinline.h" 3
+
+
+
+__inline double asinh ( double __x ) throw () { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)) ; } __inline float asinhf ( float __x ) throw () { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)) ; } __inline long double asinhl ( long double __x ) throw () { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)) ; }
+
+
+
+
+__inline double acosh ( double __x ) throw () { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)) ; } __inline float acoshf ( float __x ) throw () { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)) ; } __inline long double acoshl ( long double __x ) throw () { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)) ; }
+
+
+__inline double atanh ( double __x ) throw () { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x) ; } __inline float atanhf ( float __x ) throw () { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x) ; } __inline long double atanhl ( long double __x ) throw () { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x) ; }
+
+
+
+
+__inline double hypot ( double __x , double __y ) throw () { return __sqrtl (__x * __x + __y * __y) ; } __inline float hypotf ( float __x , float __y ) throw () { return __sqrtl (__x * __x + __y * __y) ; } __inline long double hypotl ( long double __x , long double __y ) throw () { return __sqrtl (__x * __x + __y * __y) ; }
+
+__inline double logb ( double __x ) throw () { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value ; } __inline float logbf ( float __x ) throw () { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value ; } __inline long double logbl ( long double __x ) throw () { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value ; }
+
+
+
+
+
+
+
+
+
+# 647 "/usr/include/bits/mathinline.h" 3
+
+
+
+
+
+__inline double drem ( double __x , double __y ) throw () { register double __value; register int __clobbered; __asm __volatile__ ("1: fprem1\n\t" "fstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value ; } __inline float dremf ( float __x , float __y ) throw () { register double __value; register int __clobbered; __asm __volatile__ ("1: fprem1\n\t" "fstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value ; } __inline long double dreml ( long double __x , long double __y ) throw () { register double __value; register int __clobbered; __asm __volatile__ ("1: fprem1\n\t" "fstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value ; }
+# 662 "/usr/include/bits/mathinline.h" 3
+
+
+
+__inline int
+__finite (double __x) throw ()
+{
+ return (__extension__
+ (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
+ | 0x800fffffu) + 1) >> 31));
+}
+
+
+# 682 "/usr/include/bits/mathinline.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 705 "/usr/include/bits/mathinline.h" 3
+
+
+
+# 350 "/usr/include/math.h" 2 3
+
+
+
+
+# 409 "/usr/include/math.h" 3
+
+
+}
+
+
+
+# 8 "transverb.cpp" 2
+
+
+# 1 "transverb.hpp" 1
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/local/lib/pd/externs/flext/flext.h" 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/local/lib/pd/externs/flext/fldefs.h" 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 26 "/usr/local/lib/pd/externs/flext/flext.h" 2
+
+
+
+# 1 "/usr/local/lib/pd/externs/flext/flclass.h" 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/local/lib/pd/externs/flext/flbase.h" 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/local/lib/pd/externs/flext/flstdc.h" 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+
+
+
+# 1 "/usr/local/include/m_pd.h" 1 3
+
+
+
+
+
+extern "C" {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef int t_int;
+
+
+typedef float t_float;
+typedef float t_floatarg;
+
+typedef struct _symbol
+{
+ char *s_name;
+ struct _class **s_thing;
+ struct _symbol *s_next;
+} t_symbol;
+
+struct _array;
+
+
+
+
+
+
+
+
+
+
+
+typedef struct _gstub
+{
+ union
+ {
+ struct _glist *gs_glist;
+ struct _array *gs_array;
+ } gs_un;
+ int gs_which;
+ int gs_refcount;
+} t_gstub;
+
+typedef struct _gpointer
+{
+ union
+ {
+ struct _scalar *gp_scalar;
+ union word *gp_w;
+ } gp_un;
+ int gp_valid;
+ t_gstub *gp_stub;
+} t_gpointer;
+
+typedef union word
+{
+ t_float w_float;
+ t_symbol *w_symbol;
+ t_gpointer *w_gpointer;
+ struct _array *w_array;
+ struct _glist *w_list;
+ int w_index;
+} t_word;
+
+typedef enum
+{
+ A_NULL,
+ A_FLOAT,
+ A_SYMBOL,
+ A_POINTER,
+ A_SEMI,
+ A_COMMA,
+ A_DEFFLOAT,
+ A_DEFSYM,
+ A_DOLLAR,
+ A_DOLLSYM,
+ A_GIMME,
+ A_CANT
+} t_atomtype;
+
+
+
+typedef struct _atom
+{
+ t_atomtype a_type;
+ union word a_w;
+} t_atom;
+
+struct _class;
+
+
+struct _outlet;
+
+
+struct _inlet;
+
+
+struct _binbuf;
+
+
+struct _clock;
+
+
+struct _outconnect;
+
+
+struct _glist;
+
+
+
+typedef struct _class *t_pd;
+
+typedef struct _gobj
+{
+ t_pd g_pd;
+ struct _gobj *g_next;
+} t_gobj;
+
+typedef struct _scalar
+{
+ t_gobj sc_gobj;
+ t_symbol *sc_template;
+ t_word sc_vec[1];
+} t_scalar;
+
+typedef struct _text
+{
+ t_gobj te_g;
+ struct _binbuf *te_binbuf;
+ struct _outlet *te_outlet;
+ struct _inlet *te_inlet;
+ short te_xpix;
+ short te_ypix;
+ short te_width;
+ unsigned int te_type:2;
+} t_text;
+
+
+
+
+
+
+
+
+
+
+typedef struct _text t_object;
+
+
+
+
+
+
+
+typedef void (*t_method)(void);
+typedef void *(*t_newmethod)( void);
+typedef void (*t_gotfn)(void *x, ...);
+
+
+extern t_pd pd_objectmaker;
+extern t_pd pd_canvasmaker;
+extern t_symbol s_pointer;
+extern t_symbol s_float;
+extern t_symbol s_symbol;
+extern t_symbol s_bang;
+extern t_symbol s_list;
+extern t_symbol s_anything;
+extern t_symbol s_signal;
+extern t_symbol s__N;
+extern t_symbol s__X;
+extern t_symbol s_x;
+extern t_symbol s_y;
+extern t_symbol s_;
+
+
+extern void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv);
+extern void pd_forwardmess(t_pd *x, int argc, t_atom *argv);
+extern t_symbol *gensym(char *s);
+extern t_gotfn getfn(t_pd *x, t_symbol *s);
+extern t_gotfn zgetfn(t_pd *x, t_symbol *s);
+extern void nullfn(void);
+extern void pd_vmess(t_pd *x, t_symbol *s, char *fmt, ...);
+
+
+
+
+
+
+void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv);
+
+
+extern void *getbytes(size_t nbytes);
+extern void *getzbytes(size_t nbytes);
+extern void *copybytes(void *src, size_t nbytes);
+extern void freebytes(void *x, size_t nbytes);
+extern void *resizebytes(void *x, size_t oldsize, size_t newsize);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern t_float atom_getfloat(t_atom *a);
+extern t_int atom_getint(t_atom *a);
+extern t_symbol *atom_getsymbol(t_atom *a);
+extern t_symbol *atom_gensym(t_atom *a);
+extern t_float atom_getfloatarg(int which, int argc, t_atom *argv);
+extern t_int atom_getintarg(int which, int argc, t_atom *argv);
+extern t_symbol *atom_getsymbolarg(int which, int argc, t_atom *argv);
+
+extern void atom_string(t_atom *a, char *buf, unsigned int bufsize);
+
+
+
+extern struct _binbuf *binbuf_new(void);
+extern void binbuf_free(struct _binbuf *x);
+
+extern void binbuf_text(struct _binbuf *x, char *text, size_t size);
+extern void binbuf_gettext(struct _binbuf *x, char **bufp, int *lengthp);
+extern void binbuf_clear(struct _binbuf *x);
+extern void binbuf_add(struct _binbuf *x, int argc, t_atom *argv);
+extern void binbuf_addv(struct _binbuf *x, char *fmt, ...);
+extern void binbuf_addbinbuf(struct _binbuf *x, struct _binbuf *y);
+extern void binbuf_addsemi(struct _binbuf *x);
+extern void binbuf_restore(struct _binbuf *x, int argc, t_atom *argv);
+extern void binbuf_print(struct _binbuf *x);
+extern int binbuf_getnatom(struct _binbuf *x);
+extern t_atom *binbuf_getvec(struct _binbuf *x);
+extern void binbuf_eval(struct _binbuf *x, t_pd *target, int argc, t_atom *argv);
+extern int binbuf_read(struct _binbuf *b, char *filename, char *dirname,
+ int crflag);
+extern int binbuf_read_via_path(struct _binbuf *b, char *filename, char *dirname,
+ int crflag);
+extern int binbuf_write(struct _binbuf *x, char *filename, char *dir,
+ int crflag);
+extern void binbuf_evalfile(t_symbol *name, t_symbol *dir);
+
+
+
+extern struct _clock *clock_new(void *owner, t_method fn);
+extern void clock_set(struct _clock *x, double systime);
+extern void clock_delay(struct _clock *x, double delaytime);
+extern void clock_unset(struct _clock *x);
+extern double clock_getlogicaltime(void);
+extern double clock_getsystime(void);
+extern double clock_gettimesince(double prevsystime);
+extern double clock_getsystimeafter(double delaytime);
+extern void clock_free(struct _clock *x);
+
+
+extern t_pd *pd_new(struct _class *cls);
+extern void pd_free(t_pd *x);
+extern void pd_bind(t_pd *x, t_symbol *s);
+extern void pd_unbind(t_pd *x, t_symbol *s);
+extern t_pd *pd_findbyclass(t_symbol *s, struct _class *c);
+extern void pd_pushsym(t_pd *x);
+extern void pd_popsym(t_pd *x);
+extern t_symbol *pd_getfilename(void);
+extern t_symbol *pd_getdirname(void);
+extern void pd_bang(t_pd *x);
+extern void pd_pointer(t_pd *x, t_gpointer *gp);
+extern void pd_float(t_pd *x, t_float f);
+extern void pd_symbol(t_pd *x, t_symbol *s);
+extern void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv);
+extern void pd_anything(t_pd *x, t_symbol *s, int argc, t_atom *argv);
+
+
+
+extern void gpointer_init(t_gpointer *gp);
+extern void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto);
+extern void gpointer_unset(t_gpointer *gp);
+extern int gpointer_check(const t_gpointer *gp, int headok);
+
+
+struct _inlet;
+
+struct _outlet;
+
+
+extern struct _inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1,
+ t_symbol *s2);
+extern struct _inlet *pointerinlet_new(t_object *owner, t_gpointer *gp);
+extern struct _inlet *floatinlet_new(t_object *owner, t_float *fp);
+extern struct _inlet *symbolinlet_new(t_object *owner, t_symbol **sp);
+extern void inlet_free(struct _inlet *x);
+
+extern struct _outlet *outlet_new(t_object *owner, t_symbol *s);
+extern void outlet_bang(struct _outlet *x);
+extern void outlet_pointer(struct _outlet *x, t_gpointer *gp);
+extern void outlet_float(struct _outlet *x, t_float f);
+extern void outlet_symbol(struct _outlet *x, t_symbol *s);
+extern void outlet_list(struct _outlet *x, t_symbol *s, int argc, t_atom *argv);
+extern void outlet_anything(struct _outlet *x, t_symbol *s, int argc, t_atom *argv);
+extern void outlet_free(struct _outlet *x);
+extern t_object *pd_checkobject(t_pd *x);
+
+
+
+
+extern void glob_setfilename(void *dummy, t_symbol *name, t_symbol *dir);
+
+extern void canvas_setargs(int argc, t_atom *argv);
+extern t_atom *canvas_getarg(int which);
+extern t_symbol *canvas_getcurrentdir(void);
+extern struct _glist *canvas_getcurrent(void);
+extern void canvas_makefilename(struct _glist *c, char *file,
+ char *result,int resultsize);
+extern t_symbol *canvas_getdir(struct _glist *x);
+extern int sys_fontwidth(int fontsize);
+extern int sys_fontheight(int fontsize);
+extern void canvas_dataproperties(struct _glist *x, t_scalar *sc, struct _binbuf *b);
+
+
+
+struct _widgetbehavior;
+
+
+struct _parentwidgetbehavior;
+
+extern struct _parentwidgetbehavior *pd_getparentwidget(t_pd *x);
+
+
+
+
+
+
+
+
+
+
+
+
+extern struct _class *class_new(t_symbol *name, t_newmethod newmethod,
+ t_method freemethod, size_t size, int flags, t_atomtype arg1, ...);
+extern void class_addcreator(t_newmethod newmethod, t_symbol *s,
+ t_atomtype type1, ...);
+extern void class_addmethod(struct _class *c, t_method fn, t_symbol *sel,
+ t_atomtype arg1, ...);
+extern void class_addbang(struct _class *c, t_method fn);
+extern void class_addpointer(struct _class *c, t_method fn);
+extern void class_doaddfloat(struct _class *c, t_method fn);
+extern void class_addsymbol(struct _class *c, t_method fn);
+extern void class_addlist(struct _class *c, t_method fn);
+extern void class_addanything(struct _class *c, t_method fn);
+extern void class_sethelpsymbol(struct _class *c, t_symbol *s);
+extern void class_setwidget(struct _class *c, struct _widgetbehavior *w);
+extern void class_setparentwidget(struct _class *c, struct _parentwidgetbehavior *w);
+extern struct _parentwidgetbehavior *class_parentwidget(struct _class *c);
+extern char *class_getname(struct _class *c);
+extern char *class_gethelpname(struct _class *c);
+extern void class_setdrawcommand(struct _class *c);
+extern int class_isdrawcommand(struct _class *c);
+extern void class_domainsignalin(struct _class *c, int onset);
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern void post(char *fmt, ...);
+extern void startpost(char *fmt, ...);
+extern void poststring(char *s);
+extern void postfloat(float f);
+extern void postatom(int argc, t_atom *argv);
+extern void endpost(void);
+extern void error(char *fmt, ...);
+extern void bug(char *fmt, ...);
+extern void pd_error(void *object, char *fmt, ...);
+extern void sys_logerror(char *object, char *s);
+extern void sys_unixerror(char *object);
+extern void sys_ouch(void);
+
+
+extern char* sys_get_path( void);
+
+extern void sys_addpath(const char* p);
+
+
+
+extern int sys_isreadablefile(const char *name);
+extern void sys_bashfilename(const char *from, char *to);
+extern void sys_unbashfilename(const char *from, char *to);
+extern int open_via_path(const char *name, const char *ext, const char *dir,
+ char *dirresult, char **nameresult, unsigned int size, int bin);
+extern int sys_geteventno(void);
+extern double sys_getrealtime(void);
+
+
+
+typedef float t_sample;
+
+
+
+typedef struct _signal
+{
+ int s_n;
+ t_sample *s_vec;
+ float s_sr;
+ int s_refcount;
+ int s_isborrowed;
+ struct _signal *s_borrowedfrom;
+ struct _signal *s_nextfree;
+ struct _signal *s_nextused;
+} t_signal;
+
+
+typedef t_int *(*t_perfroutine)(t_int *args);
+
+extern t_int *plus_perform(t_int *args);
+extern t_int *zero_perform(t_int *args);
+extern t_int *copy_perform(t_int *args);
+
+extern void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n);
+extern void dsp_add_copy(t_sample *in, t_sample *out, int n);
+extern void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n);
+extern void dsp_add_zero(t_sample *out, int n);
+
+extern int sys_getblksize(void);
+extern float sys_getsr(void);
+extern int sys_get_inchannels(void);
+extern int sys_get_outchannels(void);
+
+extern void dsp_add(t_perfroutine f, int n, ...);
+extern void dsp_addv(t_perfroutine f, int n, t_int *vec);
+extern void pd_fft(float *buf, int npoints, int inverse);
+extern int ilog2(int n);
+
+extern void mayer_fht(float *fz, int n);
+extern void mayer_fft(int n, float *real, float *imag);
+extern void mayer_ifft(int n, float *real, float *imag);
+extern void mayer_realfft(int n, float *real);
+extern void mayer_realifft(int n, float *real);
+
+extern float *cos_table;
+
+
+
+extern int canvas_suspend_dsp(void);
+extern void canvas_resume_dsp(int oldstate);
+extern void canvas_update_dsp(void);
+
+
+typedef struct _resample
+{
+ int method;
+
+ t_int downsample;
+ t_int upsample;
+
+ t_float *s_vec;
+ int s_n;
+
+ t_float *coeffs;
+ int coefsize;
+
+ t_float *buffer;
+ int bufsize;
+} t_resample;
+
+extern void resample_init(t_resample *x);
+extern void resample_free(t_resample *x);
+
+extern void resample_dsp(t_resample *x, t_sample *in, int insize, t_sample *out, int outsize, int method);
+extern void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsize, int method);
+extern void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method);
+
+
+
+extern float mtof(float);
+extern float ftom(float);
+extern float rmstodb(float);
+extern float powtodb(float);
+extern float dbtorms(float);
+extern float dbtopow(float);
+
+extern float q8_sqrt(float);
+extern float q8_rsqrt(float);
+
+extern float qsqrt(float);
+extern float qrsqrt(float);
+
+
+
+
+struct _garray;
+
+
+extern struct _class *garray_class;
+extern int garray_getfloatarray(struct _garray *x, int *size, t_float **vec);
+extern float garray_get(struct _garray *x, t_symbol *s, t_int indx);
+extern void garray_redraw(struct _garray *x);
+extern int garray_npoints(struct _garray *x);
+extern char *garray_vec(struct _garray *x);
+extern void garray_resize(struct _garray *x, t_floatarg f);
+extern void garray_usedindsp(struct _garray *x);
+extern void garray_setsaveit(struct _garray *x, int saveit);
+extern struct _class *scalar_class;
+
+extern t_float *value_get(t_symbol *s);
+extern void value_release(t_symbol *s);
+extern int value_getfloat(t_symbol *s, t_float *f);
+extern int value_setfloat(t_symbol *s, t_float f);
+
+
+extern void sys_vgui(char *fmt, ...);
+extern void sys_gui(char *s);
+
+extern void gfxstub_new(t_pd *owner, void *key, const char *cmd);
+extern void gfxstub_deleteforkey(void *key);
+
+
+
+
+
+typedef struct _class *t_externclass;
+
+extern void c_extern(t_externclass *cls, t_newmethod newroutine,
+ t_method freeroutine, t_symbol *name, size_t size, int tiny, t_atomtype arg1, ...);
+
+extern void c_addmess(t_method fn, t_symbol *sel, t_atomtype arg1, ...);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+# 51 "/usr/local/lib/pd/externs/flext/flstdc.h" 2
+
+
+
+
+}
+
+
+
+
+
+
+typedef t_object t_sigobj;
+typedef t_gpointer *t_ptrtype;
+
+typedef t_float t_flint;
+typedef t_symbol *t_symptr;
+
+
+
+
+
+
+
+# 102 "/usr/local/lib/pd/externs/flext/flstdc.h"
+
+
+
+# 118 "/usr/local/lib/pd/externs/flext/flstdc.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 22 "/usr/local/lib/pd/externs/flext/flbase.h" 2
+
+
+
+class flext_obj;
+
+
+
+
+
+
+
+
+
+
+
+struct flext_hdr
+{
+
+
+
+
+ t_sigobj obj;
+
+
+
+ float defsig;
+
+
+
+
+
+
+
+
+
+
+
+ flext_obj *data;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class flext_obj
+{
+ public:
+
+
+
+
+ void *operator new(size_t bytes);
+ void operator delete(void *blk);
+
+
+ void *operator new[](size_t bytes) { return operator new(bytes); }
+ void operator delete[](void *blk) { operator delete(blk); }
+
+
+
+ static void *NewAligned(size_t bytes,int bitalign = 128);
+ static void FreeAligned(void *blk);
+
+
+
+
+ flext_obj();
+
+
+ virtual ~flext_obj() = 0;
+
+
+ struct _glist *thisCanvas() { return(m_canvas); }
+
+ t_sigobj *thisHdr() { return &x_obj->obj; }
+ const char *thisName() const { return m_name; }
+
+
+ struct _class *thisClass() { return (struct _class *)((t_object *)(x_obj))->te_g.g_pd; }
+
+
+
+
+ protected:
+
+
+ flext_hdr *x_obj;
+
+ private:
+
+
+ struct _glist *m_canvas;
+
+ public:
+
+
+ static void callb_setup(struct _class *) {}
+
+
+
+ static flext_hdr *m_holder;
+ static const char *m_holdname;
+
+
+ const char *m_name;
+
+
+
+
+
+
+# 166 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+};
+
+
+inline void *operator new(size_t, void *location, void *) { return location; }
+
+
+
+
+
+
+
+# 187 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+# 200 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 258 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 320 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 369 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+# 386 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+# 414 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+# 431 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+# 459 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+# 476 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+# 504 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+# 521 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+# 549 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+# 566 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+# 593 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+# 610 "/usr/local/lib/pd/externs/flext/flbase.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 21 "/usr/local/lib/pd/externs/flext/flclass.h" 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class flext_base:
+ public flext_obj
+{
+ public: typedef flext_base thisType; static void callb_free(flext_hdr *hdr) { flext_obj *mydata = ((flext_hdr *)hdr)->data; delete mydata; ((flext_hdr *)hdr)->flext_hdr::~flext_hdr(); } static void callb_setup(struct _class *classPtr) { flext_obj ::callb_setup(classPtr); flext_base :: Setup (classPtr); } protected: static flext_base *thisObject(void *c) { return ( flext_base *)((flext_hdr *)c)->data; }
+
+public:
+
+
+
+
+
+
+
+ static bool compatibility;
+
+
+
+
+
+ virtual void m_help();
+
+
+ virtual void m_loadbang() {}
+
+
+ virtual void m_assist(long ,long ,char * ) {}
+
+
+
+
+
+ virtual bool m_methodmain(int inlet,const t_symbol *s,int argc,t_atom *argv);
+
+
+ virtual bool m_method_(int inlet,const t_symbol *s,int argc,t_atom *argv);
+
+
+
+
+
+ class buffer
+ {
+ public:
+
+
+
+
+ buffer(t_symbol *s = __null ,bool delayed = false);
+
+
+ ~buffer();
+
+
+
+ bool Ok() const { return sym != __null && data != __null ; }
+
+
+
+
+ int Set(t_symbol *s = __null ,bool nameonly = false);
+
+
+
+
+ void Dirty(bool refr = false);
+
+
+ t_symbol *Symbol() const { return sym; }
+
+ const char *Name() const { return sym?sym->s_name:""; }
+
+
+
+
+ t_sample *Data() { return data; }
+
+ int Channels() const { return chns; }
+
+ int Frames() const { return frames; }
+
+
+ void SetRefrIntv(float intv);
+
+ protected:
+ t_symbol *sym;
+ t_sample *data;
+ int chns,frames;
+
+ float interval;
+ bool isdirty,ticking;
+ struct _clock *tick;
+
+ private:
+ static void cb_tick(buffer *b);
+
+ };
+
+
+
+
+
+
+
+
+
+
+ void AddInAnything(int m = 1) { AddInlet(xlet::tp_any,m); }
+
+ void AddInFloat(int m = 1) { AddInlet(xlet::tp_float,m); }
+
+ void AddInInt(int m = 1) { AddInlet(xlet::tp_int,m); }
+
+ void AddInSymbol(int m = 1) { AddInlet(xlet::tp_sym,m); }
+
+ void AddInBang(int m = 1) { AddInlet(xlet::tp_sym,m); }
+
+ void AddInList(int m = 1) { AddInlet(xlet::tp_list,m); }
+
+
+ void AddOutAnything(int m = 1) { AddOutlet(xlet::tp_any,m); }
+
+ void AddOutFloat(int m = 1) { AddOutlet(xlet::tp_float,m); }
+
+ void AddOutInt(int m = 1) { AddOutlet(xlet::tp_int,m); }
+
+ void AddOutSymbol(int m = 1) { AddOutlet(xlet::tp_sym,m); }
+
+ void AddOutBang(int m = 1) { AddOutlet(xlet::tp_sym,m); }
+
+ void AddOutList(int m = 1) { AddOutlet(xlet::tp_list,m); }
+
+
+
+
+
+ bool SetupInOut();
+
+
+ int CntIn() const { return incnt; }
+
+ int CntOut() const { return outcnt; }
+
+ int CntInSig() const { return insigs; }
+
+ int CntOutSig() const { return outsigs; }
+
+
+ class outlet;
+
+
+ outlet *GetOut(int ix) { return (outlets && ix < outcnt)?outlets[ix]: __null ; }
+
+
+
+ void ToOutBang(outlet *o);
+
+ void ToOutBang(int n) { outlet *o = GetOut(n); if(o) ToOutBang(o); }
+
+ void ToOutFloat(outlet *o,float f);
+
+ void ToOutFloat(int n,float f) { outlet *o = GetOut(n); if(o) ToOutFloat(o,f); }
+
+
+
+
+
+ void ToOutInt(outlet *o,int f);
+
+ void ToOutInt(int n,int f) { outlet *o = GetOut(n); if(o) ToOutInt(o,f); }
+
+ void ToOutSymbol(outlet *o,const t_symbol *s);
+
+ void ToOutSymbol(int n,const t_symbol *s) { outlet *o = GetOut(n); if(o) ToOutSymbol(o,const_cast<t_symbol *>(s)); }
+
+ void ToOutList(outlet *o,int argc,t_atom *argv);
+
+ void ToOutList(int n,int argc,t_atom *argv) { outlet *o = GetOut(n); if(o) ToOutList(o,argc,argv); }
+
+ void ToOutAnything(outlet *o,const t_symbol *s,int argc,t_atom *argv);
+
+ void ToOutAnything(int n,const t_symbol *s,int argc,t_atom *argv) { outlet *o = GetOut(n); if(o) ToOutAnything(o,const_cast<t_symbol *>(s),argc,argv); }
+
+
+
+
+ enum metharg {
+ a_null = 0,
+ a_float,a_int,
+ a_symbol,a_pointer,
+ a_gimme,a_xgimme
+ };
+
+ typedef void (*methfun)(struct _class *c);
+
+ void AddMethodDef(int inlet);
+ void AddMethodDef(int inlet,const char *tag);
+ void AddMethod(int inlet,const char *tag,methfun fun,metharg tp,...);
+
+ void AddMethod(int inlet,void (*m)(flext_base *,int argc,t_atom *argv)) { AddMethod(inlet,"list",(methfun)m,a_gimme,a_null); }
+ void AddMethod(int inlet,const char *tag,void (*m)(flext_base *)) { AddMethod(inlet,tag,(methfun)m,a_null); }
+ void AddMethod(int inlet,void (*m)(flext_base *,t_symbol *s,int argc,t_atom *argv)) { AddMethod(inlet,"anything",(methfun)m,a_xgimme,a_null); }
+ void AddMethod(int inlet,void (*m)(flext_base *,t_symbol *s)) { AddMethod(inlet,"symbol",(methfun)m,a_symbol,a_null); }
+ void AddMethod(int inlet,void (*m)(flext_base *,float &)) { AddMethod(inlet,"float",(methfun)m,a_float,a_null); }
+ void AddMethod(int inlet,void (*m)(flext_base *,float &,float &)) { AddMethod(inlet,"list",(methfun)m,a_float,a_float,a_null); }
+ void AddMethod(int inlet,void (*m)(flext_base *,float &,float &,float &)) { AddMethod(inlet,"list",(methfun)m,a_float,a_float,a_float,a_null); }
+
+ void AddMethod(int inlet,void (*m)(flext_base *,int &)) { AddMethod(inlet,"float",(methfun)m,a_int,a_null); }
+
+
+
+ void AddMethod(int inlet,void (*m)(flext_base *,int &,int &)) { AddMethod(inlet,"list",(methfun)m,a_int,a_int,a_null); }
+ void AddMethod(int inlet,void (*m)(flext_base *,int &,int &,int &)) { AddMethod(inlet,"list",(methfun)m,a_int,a_int,a_int,a_null); }
+ void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,int argc,t_atom *argv)) { AddMethod(inlet,tag,(methfun)m,a_gimme,a_null); }
+ void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,t_symbol *s,int argc,t_atom *argv)) { AddMethod(inlet,tag,(methfun)m,a_xgimme,a_null); }
+ void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,t_symbol *s)) { AddMethod(inlet,tag,(methfun)m,a_symbol,a_null); }
+ void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,float &)) { AddMethod(inlet,tag,(methfun)m,a_float,a_null); }
+ void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,int &)) { AddMethod(inlet,tag,(methfun)m,a_int,a_null); }
+
+
+ void SetDist(bool d = true) { distmsgs = d; }
+
+
+
+ static const t_symbol *sym_float;
+ static const t_symbol *sym_symbol;
+ static const t_symbol *sym_bang;
+ static const t_symbol *sym_list;
+ static const t_symbol *sym_anything;
+ static const t_symbol *sym_int;
+ static const t_symbol *sym_pointer;
+
+
+ static const t_symbol *sym_signal;
+
+
+ static const t_symbol *MakeSymbol(const char *s);
+
+
+ static const char *GetString(const t_symbol *s) { return s->s_name; }
+ static const char *GetAString(const t_symbol *s) { return s?s->s_name:""; }
+
+
+
+ static bool IsFloat(const t_atom &a) { return a.a_type == A_FLOAT; }
+ static bool CanbeFloat(const t_atom &a) { return IsFloat(a) || IsInt(a); }
+ static float GetFloat(const t_atom &a) { return a.a_w.w_float; }
+
+ static float GetAFloat(const t_atom &a) { return GetAFlint(a); }
+ static void SetFloat(t_atom &a,float v) { a.a_type = A_FLOAT; a.a_w.w_float = v; }
+
+ static bool IsSymbol(const t_atom &a) { return a.a_type == A_SYMBOL; }
+ static t_symbol *GetSymbol(const t_atom &a) { return a.a_w.w_symbol; }
+ static t_symbol *GetASymbol(const t_atom &a) { return IsSymbol(a)?GetSymbol(a): __null ; }
+ static void SetSymbol(t_atom &a,const t_symbol *s) { a.a_type = A_SYMBOL; a.a_w.w_symbol = const_cast<t_symbol *>(s); }
+
+ static bool IsString(const t_atom &a) { return IsSymbol(a); }
+ static const char *GetString(const t_atom &a) { t_symbol *s = GetSymbol(a); return s?GetString(s): __null ; }
+ static void GetAString(const t_atom &a,char *buf,int szbuf);
+ static void SetString(t_atom &a,const char *c) { SetSymbol(a,gensym(const_cast<char *>(c))); }
+
+ static bool CanbeInt(const t_atom &a) { return IsFloat(a) || IsInt(a); }
+ static float GetAInt(const t_atom &a) { return GetAFlint(a); }
+
+ static bool IsFlint(const t_atom &a) { return IsFloat(a) || IsInt(a); }
+ static float GetAFlint(const t_atom &a) { return IsFloat(a)?GetFloat(a):(IsInt(a)?GetInt(a):0); }
+
+ static bool IsInt(const t_atom &) { return false; }
+ static int GetInt(const t_atom &) { return 0; }
+
+
+ static void SetFlint(t_atom &a,int v) { a.a_type = A_FLOAT; a.a_w.w_float = (float)v; }
+
+ static bool IsPointer(const t_atom &a) { return a.a_type == A_POINTER; }
+ static t_gpointer *GetPointer(const t_atom &a) { return a.a_w.w_gpointer; }
+ static t_gpointer *GetAPointer(const t_atom &a) { return IsPointer(a)?GetPointer(a): __null ; }
+ static void SetPointer(t_atom &a,t_gpointer *p) { a.a_type = A_POINTER; a.a_w.w_gpointer = p; }
+
+# 327 "/usr/local/lib/pd/externs/flext/flclass.h"
+
+
+
+
+
+
+
+
+
+
+protected:
+
+ flext_base();
+ virtual ~flext_base();
+
+
+
+ struct xlet {
+ enum type {
+ tp_none = 0,
+ tp_float, tp_int,tp_sym,tp_list,tp_sig,tp_any
+ };
+
+ xlet(type t): tp(t),nxt(__null ) {}
+ ~xlet();
+
+ type tp;
+ xlet *nxt;
+ };
+
+ unsigned long XletCode(xlet::type tp = xlet::tp_none,...);
+
+ void AddInlets(unsigned long code);
+ void AddInlet(xlet::type tp,int mult = 1) { AddXlet(tp,mult,inlist); }
+ void AddOutlets(unsigned long code);
+ void AddOutlet(xlet::type tp,int mult = 1) { AddXlet(tp,mult,outlist); }
+
+
+
+ class methitem {
+ public:
+ methitem(int inlet,t_symbol *t);
+ ~methitem();
+
+ void SetArgs(methfun fun,int argc,metharg *args);
+
+ t_symbol *tag;
+ int inlet;
+ int argc;
+ metharg *args;
+ methfun fun;
+
+ methitem *nxt;
+ };
+
+ void AddMethItem(methitem *m);
+
+private:
+
+ static void Setup(struct _class *c);
+
+ xlet *inlist,*outlist;
+ int incnt,outcnt,insigs,outsigs;
+ outlet **outlets;
+ bool distmsgs;
+
+ void AddXlet(xlet::type tp,int mult,xlet *&root);
+
+ methitem *mlst;
+
+
+
+ struct px_object;
+ friend struct px_object;
+# 416 "/usr/local/lib/pd/externs/flext/flclass.h"
+
+ static void cb_px_anything(struct _class *c,const t_symbol *s,int argc,t_atom *argv);
+
+ static void cb_px_ft1(struct _class *c,float f);
+ static void cb_px_ft2(struct _class *c,float f);
+ static void cb_px_ft3(struct _class *c,float f);
+ static void cb_px_ft4(struct _class *c,float f);
+ static void cb_px_ft5(struct _class *c,float f);
+ static void cb_px_ft6(struct _class *c,float f);
+ static void cb_px_ft7(struct _class *c,float f);
+ static void cb_px_ft8(struct _class *c,float f);
+ static void cb_px_ft9(struct _class *c,float f);
+
+ px_object **inlets;
+
+
+
+ static void cb_help(struct _class *c);
+
+ static void cb_loadbang(struct _class *c);
+
+
+
+};
+
+
+
+
+
+
+
+
+
+class flext_dsp:
+ public flext_base
+{
+ public: typedef flext_dsp thisType; static void callb_free(flext_hdr *hdr) { flext_obj *mydata = ((flext_hdr *)hdr)->data; delete mydata; ((flext_hdr *)hdr)->flext_hdr::~flext_hdr(); } static void callb_setup(struct _class *classPtr) { flext_base ::callb_setup(classPtr); flext_dsp :: Setup (classPtr); } protected: static flext_dsp *thisObject(void *c) { return ( flext_dsp *)((flext_hdr *)c)->data; }
+
+public:
+
+
+ float Samplerate() const { return srate; }
+
+
+ int Blocksize() const { return blksz; }
+
+
+ int ChannelsIn() const { return chnsin; }
+
+ int ChannelsOut() const { return chnsout; }
+
+
+
+
+
+
+
+
+
+
+ virtual void m_dsp(int n,t_sample *const *insigs,t_sample *const *outsigs);
+
+
+
+
+
+
+
+ virtual void m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs) = 0;
+
+
+
+ virtual void m_enable(bool on);
+
+
+
+
+
+ void AddInSignal(int m = 1) { AddInlet(xlet::tp_sig,m); }
+
+
+ void AddOutSignal(int m = 1) { AddOutlet(xlet::tp_sig,m); }
+
+
+protected:
+
+ flext_dsp();
+ ~flext_dsp();
+
+private:
+
+
+ float srate;
+ int blksz;
+ int chnsin,chnsout;
+
+
+ static void Setup(struct _class *c);
+
+
+
+ static void cb_dsp(struct _class *c,t_signal **s);
+
+ static void cb_enable(struct _class *c,t_flint on);
+ bool dspon;
+
+
+
+
+ static t_int *dspmeth(t_int *w);
+ t_sample **invecs,**outvecs;
+};
+
+
+# 29 "/usr/local/lib/pd/externs/flext/flext.h" 2
+
+
+
+
+
+# 11 "transverb.hpp" 2
+
+# 1 "/usr/include/errno.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+# 1 "/usr/include/bits/errno.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/linux/errno.h" 1 3
+
+
+
+# 1 "/usr/include/asm/errno.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 4 "/usr/include/linux/errno.h" 2 3
+
+
+# 24 "/usr/include/linux/errno.h" 3
+
+
+
+# 25 "/usr/include/bits/errno.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+extern int errno;
+
+
+extern int *__errno_location (void) throw () __attribute__ ((__const__));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 36 "/usr/include/errno.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 12 "transverb.hpp" 2
+
+# 1 "/usr/include/unistd.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/include/bits/posix_opt.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 175 "/usr/include/unistd.h" 2 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 1 3
+
+
+
+
+
+
+
+
+
+# 19 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 61 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 131 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+# 188 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+# 271 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+# 317 "/usr/lib/gcc-lib/i386-linux/2.95.4/include/stddef.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 199 "/usr/include/unistd.h" 2 3
+
+
+# 236 "/usr/include/unistd.h" 3
+
+
+
+
+typedef __intptr_t intptr_t;
+
+
+
+
+
+
+typedef __socklen_t socklen_t;
+
+
+
+
+
+
+
+
+
+
+
+
+extern int access (__const char *__name, int __type) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern __off_t lseek (int __fd, __off_t __offset, int __whence) throw () ;
+# 300 "/usr/include/unistd.h" 3
+
+
+
+
+
+
+extern int close (int __fd) throw () ;
+
+
+
+extern ssize_t read (int __fd, void *__buf, size_t __nbytes) throw () ;
+
+
+extern ssize_t write (int __fd, __const void *__buf, size_t __n) throw () ;
+
+# 347 "/usr/include/unistd.h" 3
+
+
+
+
+
+
+extern int pipe (int __pipedes[2]) throw () ;
+
+
+
+
+
+
+
+
+extern unsigned int alarm (unsigned int __seconds) throw () ;
+
+
+
+
+
+
+
+
+extern unsigned int sleep (unsigned int __seconds) throw () ;
+
+
+
+
+
+
+extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
+ throw () ;
+
+
+
+extern int usleep (__useconds_t __useconds) throw () ;
+
+
+
+
+
+extern int pause (void) throw () ;
+
+
+
+extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
+ throw () ;
+
+
+
+extern int fchown (int __fd, __uid_t __owner, __gid_t __group) throw () ;
+
+
+
+
+extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
+ throw () ;
+
+
+
+
+extern int chdir (__const char *__path) throw () ;
+
+
+
+extern int fchdir (int __fd) throw () ;
+
+
+
+
+
+
+
+
+
+extern char *getcwd (char *__buf, size_t __size) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+extern char *getwd (char *__buf) throw () ;
+
+
+
+
+extern int dup (int __fd) throw () ;
+
+
+extern int dup2 (int __fd, int __fd2) throw () ;
+
+
+extern char **__environ;
+
+
+
+
+
+
+
+extern int execve (__const char *__path, char *__const __argv[],
+ char *__const __envp[]) throw () ;
+
+
+
+
+
+
+
+
+
+
+extern int execv (__const char *__path, char *__const __argv[]) throw () ;
+
+
+
+extern int execle (__const char *__path, __const char *__arg, ...) throw () ;
+
+
+
+extern int execl (__const char *__path, __const char *__arg, ...) throw () ;
+
+
+
+extern int execvp (__const char *__file, char *__const __argv[]) throw () ;
+
+
+
+
+extern int execlp (__const char *__file, __const char *__arg, ...) throw () ;
+
+
+
+
+extern int nice (int __inc) throw () ;
+
+
+
+
+extern void _exit (int __status) __attribute__ ((__noreturn__));
+
+
+
+
+
+# 1 "/usr/include/bits/confname.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum
+ {
+ _PC_LINK_MAX,
+
+ _PC_MAX_CANON,
+
+ _PC_MAX_INPUT,
+
+ _PC_NAME_MAX,
+
+ _PC_PATH_MAX,
+
+ _PC_PIPE_BUF,
+
+ _PC_CHOWN_RESTRICTED,
+
+ _PC_NO_TRUNC,
+
+ _PC_VDISABLE,
+
+ _PC_SYNC_IO,
+
+ _PC_ASYNC_IO,
+
+ _PC_PRIO_IO,
+
+ _PC_SOCK_MAXBUF,
+
+ _PC_FILESIZEBITS,
+
+ _PC_REC_INCR_XFER_SIZE,
+
+ _PC_REC_MAX_XFER_SIZE,
+
+ _PC_REC_MIN_XFER_SIZE,
+
+ _PC_REC_XFER_ALIGN,
+
+ _PC_ALLOC_SIZE_MIN,
+
+ _PC_SYMLINK_MAX
+
+ };
+
+
+enum
+ {
+ _SC_ARG_MAX,
+
+ _SC_CHILD_MAX,
+
+ _SC_CLK_TCK,
+
+ _SC_NGROUPS_MAX,
+
+ _SC_OPEN_MAX,
+
+ _SC_STREAM_MAX,
+
+ _SC_TZNAME_MAX,
+
+ _SC_JOB_CONTROL,
+
+ _SC_SAVED_IDS,
+
+ _SC_REALTIME_SIGNALS,
+
+ _SC_PRIORITY_SCHEDULING,
+
+ _SC_TIMERS,
+
+ _SC_ASYNCHRONOUS_IO,
+
+ _SC_PRIORITIZED_IO,
+
+ _SC_SYNCHRONIZED_IO,
+
+ _SC_FSYNC,
+
+ _SC_MAPPED_FILES,
+
+ _SC_MEMLOCK,
+
+ _SC_MEMLOCK_RANGE,
+
+ _SC_MEMORY_PROTECTION,
+
+ _SC_MESSAGE_PASSING,
+
+ _SC_SEMAPHORES,
+
+ _SC_SHARED_MEMORY_OBJECTS,
+
+ _SC_AIO_LISTIO_MAX,
+
+ _SC_AIO_MAX,
+
+ _SC_AIO_PRIO_DELTA_MAX,
+
+ _SC_DELAYTIMER_MAX,
+
+ _SC_MQ_OPEN_MAX,
+
+ _SC_MQ_PRIO_MAX,
+
+ _SC_VERSION,
+
+ _SC_PAGESIZE,
+
+
+ _SC_RTSIG_MAX,
+
+ _SC_SEM_NSEMS_MAX,
+
+ _SC_SEM_VALUE_MAX,
+
+ _SC_SIGQUEUE_MAX,
+
+ _SC_TIMER_MAX,
+
+
+
+
+ _SC_BC_BASE_MAX,
+
+ _SC_BC_DIM_MAX,
+
+ _SC_BC_SCALE_MAX,
+
+ _SC_BC_STRING_MAX,
+
+ _SC_COLL_WEIGHTS_MAX,
+
+ _SC_EQUIV_CLASS_MAX,
+
+ _SC_EXPR_NEST_MAX,
+
+ _SC_LINE_MAX,
+
+ _SC_RE_DUP_MAX,
+
+ _SC_CHARCLASS_NAME_MAX,
+
+
+ _SC_2_VERSION,
+
+ _SC_2_C_BIND,
+
+ _SC_2_C_DEV,
+
+ _SC_2_FORT_DEV,
+
+ _SC_2_FORT_RUN,
+
+ _SC_2_SW_DEV,
+
+ _SC_2_LOCALEDEF,
+
+
+ _SC_PII,
+
+ _SC_PII_XTI,
+
+ _SC_PII_SOCKET,
+
+ _SC_PII_INTERNET,
+
+ _SC_PII_OSI,
+
+ _SC_POLL,
+
+ _SC_SELECT,
+
+ _SC_UIO_MAXIOV,
+
+ _SC_IOV_MAX = _SC_UIO_MAXIOV ,
+
+ _SC_PII_INTERNET_STREAM,
+
+ _SC_PII_INTERNET_DGRAM,
+
+ _SC_PII_OSI_COTS,
+
+ _SC_PII_OSI_CLTS,
+
+ _SC_PII_OSI_M,
+
+ _SC_T_IOV_MAX,
+
+
+
+ _SC_THREADS,
+
+ _SC_THREAD_SAFE_FUNCTIONS,
+
+ _SC_GETGR_R_SIZE_MAX,
+
+ _SC_GETPW_R_SIZE_MAX,
+
+ _SC_LOGIN_NAME_MAX,
+
+ _SC_TTY_NAME_MAX,
+
+ _SC_THREAD_DESTRUCTOR_ITERATIONS,
+
+ _SC_THREAD_KEYS_MAX,
+
+ _SC_THREAD_STACK_MIN,
+
+ _SC_THREAD_THREADS_MAX,
+
+ _SC_THREAD_ATTR_STACKADDR,
+
+ _SC_THREAD_ATTR_STACKSIZE,
+
+ _SC_THREAD_PRIORITY_SCHEDULING,
+
+ _SC_THREAD_PRIO_INHERIT,
+
+ _SC_THREAD_PRIO_PROTECT,
+
+ _SC_THREAD_PROCESS_SHARED,
+
+
+ _SC_NPROCESSORS_CONF,
+
+ _SC_NPROCESSORS_ONLN,
+
+ _SC_PHYS_PAGES,
+
+ _SC_AVPHYS_PAGES,
+
+ _SC_ATEXIT_MAX,
+
+ _SC_PASS_MAX,
+
+
+ _SC_XOPEN_VERSION,
+
+ _SC_XOPEN_XCU_VERSION,
+
+ _SC_XOPEN_UNIX,
+
+ _SC_XOPEN_CRYPT,
+
+ _SC_XOPEN_ENH_I18N,
+
+ _SC_XOPEN_SHM,
+
+
+ _SC_2_CHAR_TERM,
+
+ _SC_2_C_VERSION,
+
+ _SC_2_UPE,
+
+
+ _SC_XOPEN_XPG2,
+
+ _SC_XOPEN_XPG3,
+
+ _SC_XOPEN_XPG4,
+
+
+ _SC_CHAR_BIT,
+
+ _SC_CHAR_MAX,
+
+ _SC_CHAR_MIN,
+
+ _SC_INT_MAX,
+
+ _SC_INT_MIN,
+
+ _SC_LONG_BIT,
+
+ _SC_WORD_BIT,
+
+ _SC_MB_LEN_MAX,
+
+ _SC_NZERO,
+
+ _SC_SSIZE_MAX,
+
+ _SC_SCHAR_MAX,
+
+ _SC_SCHAR_MIN,
+
+ _SC_SHRT_MAX,
+
+ _SC_SHRT_MIN,
+
+ _SC_UCHAR_MAX,
+
+ _SC_UINT_MAX,
+
+ _SC_ULONG_MAX,
+
+ _SC_USHRT_MAX,
+
+
+ _SC_NL_ARGMAX,
+
+ _SC_NL_LANGMAX,
+
+ _SC_NL_MSGMAX,
+
+ _SC_NL_NMAX,
+
+ _SC_NL_SETMAX,
+
+ _SC_NL_TEXTMAX,
+
+
+ _SC_XBS5_ILP32_OFF32,
+
+ _SC_XBS5_ILP32_OFFBIG,
+
+ _SC_XBS5_LP64_OFF64,
+
+ _SC_XBS5_LPBIG_OFFBIG,
+
+
+ _SC_XOPEN_LEGACY,
+
+ _SC_XOPEN_REALTIME,
+
+ _SC_XOPEN_REALTIME_THREADS,
+
+
+ _SC_ADVISORY_INFO,
+
+ _SC_BARRIERS,
+
+ _SC_BASE,
+
+ _SC_C_LANG_SUPPORT,
+
+ _SC_C_LANG_SUPPORT_R,
+
+ _SC_CLOCK_SELECTION,
+
+ _SC_CPUTIME,
+
+ _SC_THREAD_CPUTIME,
+
+ _SC_DEVICE_IO,
+
+ _SC_DEVICE_SPECIFIC,
+
+ _SC_DEVICE_SPECIFIC_R,
+
+ _SC_FD_MGMT,
+
+ _SC_FIFO,
+
+ _SC_PIPE,
+
+ _SC_FILE_ATTRIBUTES,
+
+ _SC_FILE_LOCKING,
+
+ _SC_FILE_SYSTEM,
+
+ _SC_MONOTONIC_CLOCK,
+
+ _SC_MULTI_PROCESS,
+
+ _SC_SINGLE_PROCESS,
+
+ _SC_NETWORKING,
+
+ _SC_READER_WRITER_LOCKS,
+
+ _SC_SPIN_LOCKS,
+
+ _SC_REGEXP,
+
+ _SC_REGEX_VERSION,
+
+ _SC_SHELL,
+
+ _SC_SIGNALS,
+
+ _SC_SPAWN,
+
+ _SC_SPORADIC_SERVER,
+
+ _SC_THREAD_SPORADIC_SERVER,
+
+ _SC_SYSTEM_DATABASE,
+
+ _SC_SYSTEM_DATABASE_R,
+
+ _SC_TIMEOUTS,
+
+ _SC_TYPED_MEMORY_OBJECTS,
+
+ _SC_USER_GROUPS,
+
+ _SC_USER_GROUPS_R,
+
+ _SC_2_PBS,
+
+ _SC_2_PBS_ACCOUNTING,
+
+ _SC_2_PBS_LOCATE,
+
+ _SC_2_PBS_MESSAGE,
+
+ _SC_2_PBS_TRACK,
+
+ _SC_SYMLOOP_MAX,
+
+ _SC_STREAMS,
+
+ _SC_2_PBS_CHECKPOINT,
+
+
+ _SC_V6_ILP32_OFF32,
+
+ _SC_V6_ILP32_OFFBIG,
+
+ _SC_V6_LP64_OFF64,
+
+ _SC_V6_LPBIG_OFFBIG,
+
+
+ _SC_HOST_NAME_MAX,
+
+ _SC_TRACE,
+
+ _SC_TRACE_EVENT_FILTER,
+
+ _SC_TRACE_INHERIT,
+
+ _SC_TRACE_LOG
+
+ };
+
+
+
+
+
+enum
+ {
+ _CS_PATH,
+
+
+# 492 "/usr/include/bits/confname.h" 3
+
+
+# 527 "/usr/include/bits/confname.h" 3
+
+# 561 "/usr/include/bits/confname.h" 3
+
+
+ _CS_V6_WIDTH_RESTRICTED_ENVS
+
+ };
+
+# 500 "/usr/include/unistd.h" 2 3
+
+
+
+extern long int pathconf (__const char *__path, int __name) throw () ;
+
+
+extern long int fpathconf (int __fd, int __name) throw () ;
+
+
+extern long int sysconf (int __name) throw () __attribute__ ((__const__));
+
+
+
+extern size_t confstr (int __name, char *__buf, size_t __len) throw () ;
+
+
+
+
+extern __pid_t getpid (void) throw () ;
+
+
+extern __pid_t getppid (void) throw () ;
+
+
+
+
+extern __pid_t getpgrp (void) throw () ;
+
+
+
+
+
+
+
+
+
+extern __pid_t __getpgid (__pid_t __pid) throw () ;
+
+
+
+
+
+
+
+
+extern int setpgid (__pid_t __pid, __pid_t __pgid) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int setpgrp (void) throw () ;
+
+# 574 "/usr/include/unistd.h" 3
+
+
+
+
+
+
+extern __pid_t setsid (void) throw () ;
+
+
+
+
+
+
+
+extern __uid_t getuid (void) throw () ;
+
+
+extern __uid_t geteuid (void) throw () ;
+
+
+extern __gid_t getgid (void) throw () ;
+
+
+extern __gid_t getegid (void) throw () ;
+
+
+
+
+extern int getgroups (int __size, __gid_t __list[]) throw () ;
+
+
+
+
+
+
+
+
+
+
+extern int setuid (__uid_t __uid) throw () ;
+
+
+
+
+extern int setreuid (__uid_t __ruid, __uid_t __euid) throw () ;
+
+
+
+
+extern int seteuid (__uid_t __uid) throw () ;
+
+
+
+
+
+
+extern int setgid (__gid_t __gid) throw () ;
+
+
+
+
+extern int setregid (__gid_t __rgid, __gid_t __egid) throw () ;
+
+
+
+
+extern int setegid (__gid_t __gid) throw () ;
+
+
+
+
+
+
+extern __pid_t fork (void) throw () ;
+
+
+
+
+
+
+extern __pid_t vfork (void) throw () ;
+
+
+
+
+
+extern char *ttyname (int __fd) throw () ;
+
+
+
+extern int ttyname_r (int __fd, char *__buf, size_t __buflen) throw () ;
+
+
+
+extern int isatty (int __fd) throw () ;
+
+
+
+
+
+extern int ttyslot (void) throw () ;
+
+
+
+
+extern int link (__const char *__from, __const char *__to) throw () ;
+
+
+
+extern int symlink (__const char *__from, __const char *__to) throw () ;
+
+
+
+
+extern int readlink (__const char *__restrict __path, char *__restrict __buf,
+ size_t __len) throw () ;
+
+
+
+extern int unlink (__const char *__name) throw () ;
+
+
+extern int rmdir (__const char *__path) throw () ;
+
+
+
+extern __pid_t tcgetpgrp (int __fd) throw () ;
+
+
+extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) throw () ;
+
+
+
+extern char *getlogin (void) throw () ;
+
+
+
+
+
+
+
+
+
+extern int setlogin (__const char *__name) throw () ;
+
+
+
+
+
+
+
+
+# 1 "/usr/include/getopt.h" 1 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern "C" {
+
+
+
+
+
+
+
+
+extern char *optarg;
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int optind;
+
+
+
+
+extern int opterr;
+
+
+
+extern int optopt;
+
+# 113 "/usr/include/getopt.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
+
+
+
+
+# 163 "/usr/include/getopt.h" 3
+
+# 172 "/usr/include/getopt.h" 3
+
+
+
+}
+
+
+
+
+
+
+# 726 "/usr/include/unistd.h" 2 3
+
+
+
+
+
+
+
+
+extern int gethostname (char *__name, size_t __len) throw () ;
+
+
+
+
+
+
+extern int sethostname (__const char *__name, size_t __len) throw () ;
+
+
+
+extern int sethostid (long int __id) throw () ;
+
+
+
+
+
+extern int getdomainname (char *__name, size_t __len) throw () ;
+extern int setdomainname (__const char *__name, size_t __len) throw () ;
+
+
+
+
+
+extern int vhangup (void) throw () ;
+
+
+extern int revoke (__const char *__file) throw () ;
+
+
+
+
+
+
+
+extern int profil (unsigned short int *__sample_buffer, size_t __size,
+ size_t __offset, unsigned int __scale) throw () ;
+
+
+
+
+
+extern int acct (__const char *__name) throw () ;
+
+
+
+extern char *getusershell (void) throw () ;
+extern void endusershell (void) throw () ;
+extern void setusershell (void) throw () ;
+
+
+
+
+
+extern int daemon (int __nochdir, int __noclose) throw () ;
+
+
+
+
+
+
+extern int chroot (__const char *__path) throw () ;
+
+
+
+extern char *getpass (__const char *__prompt) throw () ;
+
+
+
+
+
+extern int fsync (int __fd) throw () ;
+
+
+
+
+
+
+extern long int gethostid (void) throw () ;
+
+
+extern void sync (void) throw () ;
+
+
+
+
+extern int getpagesize (void) throw () __attribute__ ((__const__));
+
+
+
+
+extern int truncate (__const char *__file, __off_t __length) throw () ;
+# 834 "/usr/include/unistd.h" 3
+
+
+
+
+
+
+
+extern int ftruncate (int __fd, __off_t __length) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int getdtablesize (void) throw () ;
+
+
+
+
+
+
+
+
+extern int brk (void *__addr) throw () ;
+
+
+
+
+
+extern void *sbrk (intptr_t __delta) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern long int syscall (long int __sysno, ...) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int lockf (int __fd, int __cmd, __off_t __len) throw () ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 933 "/usr/include/unistd.h" 3
+
+
+
+
+
+extern int fdatasync (int __fildes) throw () ;
+
+
+
+
+
+# 959 "/usr/include/unistd.h" 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int pthread_atfork (void (*__prepare) (void),
+ void (*__parent) (void),
+ void (*__child) (void)) throw () ;
+
+
+}
+
+
+# 13 "transverb.hpp" 2
+
+
+
+
+
+
+# 1 "../dfx-library/dfxmisc.h" 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+const float ONE_DIV_RAND_MAX = 1.0f / (float)2147483647 ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+inline float magmax(float a, float b) {
+ if (fabs(a) > fabs(b)) return a;
+ else return b;
+}
+
+
+
+
+
+
+
+
+
+
+
+double LambertW(double input);
+
+
+
+
+
+
+inline float interpolateHermite(float *data, double address, long arraysize)
+{
+ long pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+
+ long posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ long posPlus1 = (pos+1) % arraysize;
+ long posPlus2 = (pos+2) % arraysize;
+
+ float a = ( (3.0f*(data[pos]-data[posPlus1])) - data[posMinus1] + data[posPlus2] ) * 0.5f;
+ float b = (2.0f*data[posPlus1]) + data[posMinus1] - (2.5f*data[pos]) - (data[posPlus2]*0.5f);
+ float c = (data[posPlus1] - data[posMinus1]) * 0.5f;
+
+ return (( ((a*posFract)+b) * posFract + c ) * posFract) + data[pos];
+}
+
+inline float interpolateLinear(float *data, double address, long arraysize)
+{
+ long pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+ return (data[pos] * (1.0f-posFract)) + (data[(pos+1)%arraysize] * posFract);
+}
+
+inline float interpolateRandom(float randMin, float randMax)
+{
+ float randy = (float)rand() * ONE_DIV_RAND_MAX;
+ return ((randMax-randMin) * randy) + randMin;
+}
+
+inline float interpolateLinear2values(float point1, float point2, double address)
+{
+ float posFract = (float) (address - (double)((long)address));
+ return (point1 * (1.0f-posFract)) + (point2 * posFract);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 182 "../dfx-library/dfxmisc.h"
+
+
+struct dfxmutex {
+ dfxmutex() {}
+ ~dfxmutex() {}
+ void grab () {}
+ void release () {}
+};
+
+
+
+
+
+# 19 "transverb.hpp" 2
+
+# 1 "../dfx-library/IIRfilter.h" 1
+
+
+
+
+
+
+
+class IIRfilter
+{
+public:
+ IIRfilter();
+ ~IIRfilter();
+
+ void calculateLowpassCoefficients(float cutoff, float samplerate);
+ void calculateHighpassCoefficients(float cutoff, float samplerate);
+ void copyCoefficients(IIRfilter *source);
+
+ void reset()
+ {
+ prevIn = prevprevIn = prevOut = prevprevOut = prevprevprevOut = currentOut = 0.0f;
+ }
+
+ float prevIn, prevprevIn, prevOut, prevprevOut, prevprevprevOut, currentOut;
+ float pOutCoeff, ppOutCoeff, pInCoeff, ppInCoeff, inCoeff;
+
+
+
+ void process(float currentIn)
+
+
+
+ {
+
+
+ prevprevprevOut = prevprevOut;
+
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+
+
+
+ currentOut = ((currentIn+prevprevIn)*inCoeff) + (prevIn*pInCoeff)
+ - (prevOut*pOutCoeff) - (prevprevOut*ppOutCoeff);
+
+ prevprevIn = prevIn;
+ prevIn = currentIn;
+
+
+
+
+ }
+
+
+
+
+
+ void processH1(float currentIn)
+ {
+ prevprevprevOut = prevprevOut;
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+
+ currentOut = ( (currentIn+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+
+ prevprevIn = prevIn;
+ prevIn = currentIn;
+ }
+
+ void processH2(float *in, long inPos, long arraySize)
+ {
+ float in0 = in[inPos];
+ float in1 = in[(inPos+1) % arraySize];
+
+ prevprevprevOut = prevprevOut;
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+ currentOut = ( (in0+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+
+ prevprevprevOut = prevprevOut;
+ prevprevOut = prevOut;
+ prevOut = currentOut;
+ currentOut = ( (in1+prevIn) * inCoeff ) + (in0 * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+
+ prevprevIn = in0;
+ prevIn = in1;
+ }
+
+ void processH3(float *in, long inPos, long arraySize)
+ {
+ float in0 = in[inPos];
+ float in1 = in[(inPos+1) % arraySize];
+ float in2 = in[(inPos+2) % arraySize];
+
+ prevprevprevOut = ( (in0+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (currentOut * pOutCoeff) - (prevOut * ppOutCoeff);
+ prevprevOut = ((in1+prevIn) * inCoeff) + (in0 * pInCoeff)
+ - (prevprevprevOut * pOutCoeff) - (currentOut * ppOutCoeff);
+ prevOut = ((in2+in0) * inCoeff) + (in1 * pInCoeff)
+ - (prevprevOut * pOutCoeff) - (prevprevprevOut * ppOutCoeff);
+
+ currentOut = prevOut;
+ prevOut = prevprevOut;
+ prevprevOut = prevprevprevOut;
+ prevprevprevOut = currentOut;
+
+ prevprevIn = in1;
+ prevIn = in2;
+ }
+
+ void processH4(float *in, long inPos, long arraySize)
+ {
+ float in0 = in[inPos];
+ float in1 = in[(inPos+1) % arraySize];
+ float in2 = in[(inPos+2) % arraySize];
+ float in3 = in[(inPos+3) % arraySize];
+
+ prevprevprevOut = ( (in0+prevprevIn) * inCoeff ) + (prevIn * pInCoeff)
+ - (currentOut * pOutCoeff) - (prevOut * ppOutCoeff);
+ prevprevOut = ((in1+prevIn) * inCoeff) + (in0 * pInCoeff)
+ - (prevprevprevOut * pOutCoeff) - (currentOut * ppOutCoeff);
+ prevOut = ((in2+in0) * inCoeff) + (in1 * pInCoeff)
+ - (prevprevOut * pOutCoeff) - (prevprevprevOut * ppOutCoeff);
+ currentOut = ((in3+in1) * inCoeff) + (in2 * pInCoeff)
+ - (prevOut * pOutCoeff) - (prevprevOut * ppOutCoeff);
+
+ prevprevIn = in2;
+ prevIn = in3;
+ }
+
+
+
+
+};
+
+
+
+
+inline float interpolateHermitePostFilter(IIRfilter *filter, double address)
+{
+ long pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+
+ float a = ( (3.0f*(filter->prevprevOut-filter->prevOut)) -
+ filter->prevprevprevOut + filter->currentOut ) * 0.5f;
+ float b = (2.0f*filter->prevOut) + filter->prevprevprevOut -
+ (2.5f*filter->prevprevOut) - (filter->currentOut*0.5f);
+ float c = (filter->prevOut - filter->prevprevprevOut) * 0.5f;
+
+ return (( ((a*posFract)+b) * posFract + c ) * posFract) + filter->prevprevOut;
+}
+
+
+
+# 20 "transverb.hpp" 2
+
+
+
+
+
+
+enum
+{
+ kBsize,
+ kSpeed1,
+ kFeed1,
+ kDist1,
+ kSpeed2,
+ kFeed2,
+ kDist2,
+ kDrymix,
+ kMix1,
+ kMix2,
+ kQuality,
+ kTomsound,
+ kSpeed1mode,
+ kSpeed2mode,
+
+ NUM_PARAMS
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum { kFineMode, kSemitoneMode, kOctaveMode, numSpeedModes };
+
+
+
+
+const float RAND_MAX_FLOAT = (float) 2147483647 ;
+
+
+enum { dirtfi, hifi, ultrahifi, numQualities };
+
+enum { useNothing, useHighpass, useLowpassIIR, useLowpassFIR, numFilterModes };
+
+struct param {
+ float * ptr;
+ const char * name;
+ const char * units;
+};
+
+
+class Transverb : public flext_dsp {
+
+ public: typedef Transverb thisType; static void callb_free(flext_hdr *hdr) { flext_obj *mydata = ((flext_hdr *)hdr)->data; delete mydata; ((flext_hdr *)hdr)->flext_hdr::~flext_hdr(); } static void callb_setup(struct _class *classPtr) { flext_dsp ::callb_setup(classPtr); } protected: static Transverb *thisObject(void *c) { return ( Transverb *)((flext_hdr *)c)->data; }
+
+ virtual void processX(float **inputs, float **outputs, long sampleFrames,
+ int replacing);
+ virtual void process(float **inputs, float **outputs, long sampleFrames);
+ virtual void processReplacing(float **inputs, float **outputs,
+ long sampleFrames);
+
+
+
+
+
+
+
+
+
+ virtual void suspend();
+ virtual void resume();
+
+
+ void randomizeParameters(bool writeAutomation = false);
+
+ float fBsize;
+
+public:
+ Transverb (int argc, t_atom *argv);
+ ~Transverb ();
+
+ virtual void m_help()
+ {
+ post("");
+ post("_ _____transverb~ help___ _");
+ post(" f : mix 1");
+ post(" f : speed 1");
+ post(" f : feed 1");
+ post(" f : distortion 1");
+ post(" f : mix 2");
+ post(" f : speed 2");
+ post(" f : feed 2");
+ post(" f : distortion 2");
+ post(" f : dry/wet ratio");
+ post(" f : quality");
+ post("");
+ }
+
+
+
+protected:
+
+ void initPresets();
+ void createAudioBuffers();
+ void clearBuffers();
+
+ virtual void m_signal(int n, float *const *in, float *const *out);
+
+ float drymix;
+ int bsize;
+ float mix1, speed1, feed1, dist1;
+ float mix2, speed2, feed2, dist2;
+ float fQuality, fTomsound;
+ long quality;
+ bool tomsound;
+
+ int writer;
+ double read1, read2;
+
+ int sr; int blocksize;
+
+ float * buf1[2];
+ float * buf2[2];
+ int MAXBUF;
+
+ IIRfilter *filter1, *filter2;
+ bool speed1hasChanged, speed2hasChanged;
+ float fSpeed1mode, fSpeed2mode;
+
+ int smoothcount1[2], smoothcount2[2], smoothdur1[2], smoothdur2[2];
+ float smoothstep1[2], smoothstep2[2], lastr1val[2], lastr2val[2];
+
+ float SAMPLERATE;
+
+ float *firCoefficients1, *firCoefficients2;
+
+
+
+ static void cb_setMix (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setMix (arg1); }
+ void setMix(float f) {
+ drymix = (( f )*( f )) ;
+ }
+
+ static void cb_setBsize (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setBsize (arg1); }
+ void setBsize(float f) {
+ bsize = ( ((int)(( ( (( ( (int)f ) ) * (( 3000.0f )-( 1.0f ))) + ( 1.0f ) ) ) *SAMPLERATE*0.001f) > MAXBUF) ? MAXBUF : (int)(( ( (( ( (int)f ) ) * (( 3000.0f )-( 1.0f ))) + ( 1.0f ) ) ) *SAMPLERATE*0.001f) ) ;
+ writer %= bsize;
+ read1 = fmod(fabs(read1), (double)bsize);
+ read2 = fmod(fabs(read2), (double)bsize);
+ }
+
+ static void cb_setMix1 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setMix1 (arg1); }
+ void setMix1(float f) {
+ mix1 = (( f )*( f )) ;
+ }
+
+ static void cb_setSpeed1 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setSpeed1 (arg1); }
+ void setSpeed1(float f) {
+ speed1 = powf(2.0f, ( ( (( ( f ) ) * (( 6.0f )-( (-3.0f) ))) + ( (-3.0f) ) ) ) );
+ speed1hasChanged = true;
+ }
+
+ static void cb_setFeed1 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setFeed1 (arg1); }
+ void setFeed1(float f) {
+ feed1 = f;
+ }
+
+ static void cb_setDist1 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setDist1 (arg1); }
+ void setDist1(float f) {
+ dist1 = f;
+ read1 = fmod(fabs((double)writer + (double)dist1 *
+ (double)MAXBUF), (double)bsize);
+ }
+
+ static void cb_setMix2 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setMix2 (arg1); }
+ void setMix2(float f) {
+ mix2 = (( f )*( f )) ;
+ }
+
+ static void cb_setSpeed2 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setSpeed2 (arg1); }
+ void setSpeed2(float f) {
+ speed2 = powf(2.0f, ( ( (( ( f ) ) * (( 6.0f )-( (-3.0f) ))) + ( (-3.0f) ) ) ) );
+ speed2hasChanged = true;
+ }
+
+ static void cb_setFeed2 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setFeed2 (arg1); }
+ void setFeed2(float f) {
+ feed2 = f;
+ }
+
+ static void cb_setDist2 (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setDist2 (arg1); }
+ void setDist2(float f) {
+ dist2 = f;
+ read2 = fmod(fabs((double)writer + (double)dist2 *
+ (double)MAXBUF), (double)bsize);
+ }
+
+
+ static void cb_setQuality (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setQuality (arg1); }
+ void setQuality(float f) {
+ fQuality = ( ( (long)(( ( f ) ) * ((float)( numQualities )-0.01f)) ) ) ;
+ }
+
+ static void cb_setTom (flext_base *c, float &arg1) { static_cast<thisType *>(c)-> setTom (arg1); }
+ void setTom(float f) {
+ fTomsound = (f > 0.5f);
+ }
+
+};
+
+
+
+
+
+inline float interpolateHermite (float *data, double address,
+ int arraysize, int danger) {
+ int pos, posMinus1, posPlus1, posPlus2;
+ float posFract, a, b, c;
+
+ pos = (long)address;
+ posFract = (float) (address - (double)pos);
+
+
+
+
+ switch (danger) {
+ case 0:
+ posMinus1 = pos;
+ posPlus1 = (pos+1) % arraysize;
+ posPlus2 = (pos+2) % arraysize;
+ break;
+ case 1:
+ posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ posPlus1 = posPlus2 = pos;
+ break;
+ case 2:
+ posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ posPlus1 = posPlus2 = (pos+1) % arraysize;
+ break;
+ default:
+ posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ posPlus1 = (pos+1) % arraysize;
+ posPlus2 = (pos+2) % arraysize;
+ break;
+ }
+
+ a = ( (3.0f*(data[pos]-data[posPlus1])) -
+ data[posMinus1] + data[posPlus2] ) * 0.5f;
+ b = (2.0f*data[posPlus1]) + data[posMinus1] -
+ (2.5f*data[pos]) - (data[posPlus2]*0.5f);
+ c = (data[posPlus1] - data[posMinus1]) * 0.5f;
+
+ return ( ((a*posFract)+b) * posFract + c ) * posFract + data[pos];
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+inline float interpolateLinear(float *data, double address,
+ int arraysize, int danger) {
+ int posPlus1, pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+
+ if (danger == 1) {
+
+
+ posPlus1 = pos;
+ } else {
+
+ posPlus1 = (pos + 1) % arraysize;
+ }
+ return (data[pos] * (1.0f-posFract)) +
+ (data[posPlus1] * posFract);
+}
+
+
+
+
+# 10 "transverb.cpp" 2
+
+# 1 "../dfx-library/FIRfilter.h" 1
+
+
+
+
+
+
+
+
+
+
+
+void calculateFIRidealLowpassCoefficients(float cutoff, float samplerate,
+ int numTaps, float *coefficients);
+void applyKaiserWindow(int numTaps, float *coefficients, float attenuation);
+float besselIzero(float in);
+float besselIzero2(float in);
+
+
+inline float processFIRfilter(float *in, int numTaps, float *coefficients,
+ long inPos, long arraySize)
+{
+ float out = 0.0f;
+ if ( (inPos+numTaps) > arraySize )
+ {
+ for (long i=0; i < numTaps; i++)
+ out += in[(inPos+i)%arraySize] * coefficients[i];
+ }
+ else
+ {
+ for (long i=0; i < numTaps; i++)
+ out += in[inPos+i] * coefficients[i];
+ }
+ return out;
+}
+
+
+
+# 11 "transverb.cpp" 2
+
+
+
+
+static struct _class * Transverb_class; flext_hdr* class_Transverb (t_symbol *s,int argc,t_atom *argv) { flext_hdr *obj = new (pd_new( Transverb_class ) ,(void *)__null ) flext_hdr; flext_obj::m_holder = obj; flext_obj::m_holdname = "transverb~" ; obj->data = new Transverb (argc,argv); flext_obj::m_holder = __null ; return(obj); } extern "C" void Transverb_tilde_setup () { ((void)0) ; Transverb_class = ::class_new ( gensym( "transverb~" ) , (t_newmethod)class_Transverb , (t_method)& Transverb ::callb_free, sizeof(flext_hdr), 0 , A_GIMME, A_NULL); Transverb ::callb_setup( Transverb_class); }
+
+
+
+Transverb :: Transverb (int argc, t_atom *argv) {
+
+ do { fBsize = ( (2700.0f- 1.0f )/(3000.0f - 1.0f ) ); } while (0) ;
+ do { drymix = ( 1.0f ); } while (0) ;
+ do { mix1 = ( 1.0f ); } while (0) ;
+ do { dist1 = ( 0.90009f ); } while (0) ;
+ do { speed1 = ( (0.0f- (-3.0f) )/(6.0f - (-3.0f) ) ); } while (0) ;
+ do { feed1 = ( 0.0f ); } while (0) ;
+ do { mix2 = ( 0.0f ); } while (0) ;
+ do { dist2 = ( 0.1f ); } while (0) ;
+ do { speed2 = ( (1.0f- (-3.0f) )/(6.0f - (-3.0f) ) ); } while (0) ;
+ do { feed2 = ( 0.0f ); } while (0) ;
+ do { fQuality = ( 1.0f ); } while (0) ;
+ do { fTomsound = ( 0.0f ); } while (0) ;
+ do { fSpeed1mode = ( 0.0f ); } while (0) ;
+ do { fSpeed2mode = ( 0.0f ); } while (0) ;
+
+
+ MAXBUF = (int) (3000.0f * 44.1f);
+ buf1[0] = __null ;
+ buf2[0] = __null ;
+
+ buf1[1] = __null ;
+ buf2[1] = __null ;
+
+ filter1 = new IIRfilter[2 ];
+ filter2 = new IIRfilter[2 ];
+ firCoefficients1 = new float[23 ];
+ firCoefficients2 = new float[23 ];
+ suspend();
+ srand((unsigned int)time(__null ));
+
+ post("_ ____transverb~ with flext");
+
+ sr = (int) Samplerate();
+ blocksize = Blocksize();
+
+
+
+
+
+
+ AddInSignal(2);
+
+ AddInFloat(12);
+ AddOutSignal(2);
+
+ SetupInOut();
+
+
+
+
+ AddMethod( 0 ,cb_setMix ) ;
+ AddMethod( 1 ,cb_setBsize ) ;
+ AddMethod( 2 ,cb_setMix1 ) ;
+ AddMethod( 3 ,cb_setSpeed1 ) ;
+ AddMethod( 4 ,cb_setFeed1 ) ;
+ AddMethod( 5 ,cb_setDist1 ) ;
+ AddMethod( 6 ,cb_setMix2 ) ;
+ AddMethod( 7 ,cb_setSpeed2 ) ;
+ AddMethod( 8 ,cb_setFeed2 ) ;
+ AddMethod( 9 ,cb_setDist2 ) ;
+ AddMethod( 10 ,cb_setQuality ) ;
+ AddMethod( 11 ,cb_setTom ) ;
+
+
+ post("_ ____ ____ _");
+
+}
+
+
+Transverb ::~Transverb () {
+
+ if (buf1[0])
+ free(buf1[0]);
+ if (buf2[0])
+ free(buf2[0]);
+
+ if (buf1[1])
+ free(buf1[1]);
+ if (buf2[1])
+ free(buf2[1]);
+
+ if (filter1)
+ delete[] filter1;
+ if (filter2)
+ delete[] filter2;
+ if (firCoefficients1)
+ delete[] firCoefficients1;
+ if (firCoefficients2)
+ delete[] firCoefficients2;
+
+}
+
+void Transverb ::suspend () {
+
+ clearBuffers();
+ writer = 0;
+ read1 = read2 = 0.0;
+ smoothcount1[0] = smoothcount2[0] = 0;
+ lastr1val[0] = lastr2val[0] = 0.0f;
+ filter1[0].reset();
+ filter2[0].reset();
+
+ smoothcount1[1] = smoothcount2[1] = 0;
+ lastr1val[1] = lastr2val[1] = 0.0f;
+ filter1[1].reset();
+ filter2[1].reset();
+
+ SAMPLERATE = 44100.0f;
+ bsize = ( ((int)(( ( (( ( fBsize ) ) * (( 3000.0f )-( 1.0f ))) + ( 1.0f ) ) ) *SAMPLERATE*0.001f) > MAXBUF) ? MAXBUF : (int)(( ( (( ( fBsize ) ) * (( 3000.0f )-( 1.0f ))) + ( 1.0f ) ) ) *SAMPLERATE*0.001f) ) ;
+ speed1hasChanged = speed2hasChanged = true;
+}
+
+void Transverb ::resume() {
+
+ createAudioBuffers();
+ bsize = ( ((int)(( ( (( ( fBsize ) ) * (( 3000.0f )-( 1.0f ))) + ( 1.0f ) ) ) *SAMPLERATE*0.001f) > MAXBUF) ? MAXBUF : (int)(( ( (( ( fBsize ) ) * (( 3000.0f )-( 1.0f ))) + ( 1.0f ) ) ) *SAMPLERATE*0.001f) ) ;
+}
+
+void Transverb ::createAudioBuffers() {
+
+ SAMPLERATE = 44100.0f;
+
+ long oldmax = MAXBUF;
+ MAXBUF = (int) (3000.0f * 0.001f * SAMPLERATE);
+
+
+
+ if (MAXBUF != oldmax)
+ {
+ if (buf1[0] != __null )
+ free(buf1[0]);
+ buf1[0] = __null ;
+ if (buf2[0] != __null )
+ free(buf2[0]);
+ buf2[0] = __null ;
+
+ if (buf1[1] != __null )
+ free(buf1[1]);
+ buf1[1] = __null ;
+ if (buf2[1] != __null )
+ free(buf2[1]);
+ buf2[1] = __null ;
+
+ }
+ if (buf1[0] == __null )
+ buf1[0] = (float*)malloc(MAXBUF * sizeof (float));
+ if (buf2[0] == __null )
+ buf2[0] = (float*)malloc(MAXBUF * sizeof (float));
+
+ if (buf1[1] == __null )
+ buf1[1] = (float*)malloc(MAXBUF * sizeof (float));
+ if (buf2[1] == __null )
+ buf2[1] = (float*)malloc(MAXBUF * sizeof (float));
+
+}
+
+void Transverb ::clearBuffers() {
+ if ( (buf1[0] != __null ) && (buf2[0] != __null ) ) {
+ for (int j=0; j < MAXBUF; j++) buf1[0][j] = buf2[0][j] = 0.0f;
+ }
+
+ if ( (buf1[1] != __null ) && (buf2[1] != __null ) ) {
+ for (int k=0; k < MAXBUF; k++) buf1[1][k] = buf2[1][k] = 0.0f;
+ }
+
+}
+
+
+
+void Transverb ::randomizeParameters(bool writeAutomation)
+{
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+void Transverb ::m_signal(int n, float *const *in, float *const *out)
+{
+ float *outs = out[0];
+
+
+
+
+ int i = 0;
+ while (n--) {
+ processX((float **)in,(float **)out,(long int)n,0);
+
+ }
+}
+
+
+void Transverb ::processReplacing(float **inputs, float **outputs, long samples) {
+ processX(inputs,outputs,samples, 1);
+}
+
+void Transverb ::process(float **inputs, float **outputs, long samples) {
+ processX(inputs,outputs,samples, 0);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void Transverb ::processX(float **in, float **outputs, long samples,
+ int replacing) {
+
+ int writertemp;
+ double read1temp, read2temp;
+
+ int speed1int, speed2int, read1int, read2int;
+ int lowpass1pos, lowpass2pos;
+ float r1val, r2val;
+ double bsize_float = (double)bsize;
+ int filterMode1, filterMode2;
+ float mug1, mug2;
+ float quietNoise = 1.0e-15f;
+
+
+
+
+ if ( ((buf1[0] == __null ) || (buf2[0] == __null ))
+
+ || ((buf1[1] == __null ) || (buf2[1] == __null ))
+
+ ) createAudioBuffers();
+
+
+ if ( (buf1[0] == __null ) || (buf2[0] == __null ) )
+ return;
+
+ if ( (buf1[1] == __null ) || (buf2[1] == __null ) )
+ return;
+
+
+ SAMPLERATE = 44100.0f;
+
+ filterMode1 = filterMode2 = useNothing;
+ if (quality == ultrahifi)
+ {
+
+ if (speed1 > 1.0f)
+ {
+ filterMode1 = useLowpassIIR;
+ speed1int = (int)speed1;
+
+ if (speed1int >= 5)
+ {
+ filterMode1 = useLowpassFIR;
+ mug1 = powf( (speed1*0.2f), 0.78f );
+
+ if (speed1hasChanged)
+ {
+ calculateFIRidealLowpassCoefficients((SAMPLERATE/speed1)* 0.333f , SAMPLERATE, 23 , firCoefficients1);
+ applyKaiserWindow(23 , firCoefficients1, 60.0f);
+ speed1hasChanged = false;
+ }
+ }
+ else if (speed1hasChanged)
+ {
+ filter1[0].calculateLowpassCoefficients((SAMPLERATE/speed1)* 0.333f , SAMPLERATE);
+
+ filter1[1].copyCoefficients(filter1);
+
+ speed1hasChanged = false;
+ }
+ }
+
+ else
+ {
+ filterMode1 = useHighpass;
+ if (speed1hasChanged)
+ {
+ filter1[0].calculateHighpassCoefficients(33.3f/speed1, SAMPLERATE);
+
+ filter1[1].copyCoefficients(filter1);
+
+ speed1hasChanged = false;
+ }
+ }
+
+
+ if (speed2 > 1.0f)
+ {
+ filterMode2 = useLowpassIIR;
+ speed2int = (int)speed2;
+ if (speed2int >= 5)
+ {
+ filterMode2 = useLowpassFIR;
+ mug2 = powf( (speed2*0.2f), 0.78f );
+ if (speed2hasChanged)
+ {
+ calculateFIRidealLowpassCoefficients((SAMPLERATE/speed2)* 0.333f , SAMPLERATE, 23 , firCoefficients2);
+ applyKaiserWindow(23 , firCoefficients2, 60.0f);
+ speed2hasChanged = false;
+ }
+ }
+ else if (speed2hasChanged)
+ {
+ filter2[0].calculateLowpassCoefficients((SAMPLERATE/speed2)* 0.333f , SAMPLERATE);
+
+ filter2[1].copyCoefficients(filter2);
+
+ speed2hasChanged = false;
+ }
+ }
+
+ else
+ {
+ filterMode2 = useHighpass;
+ if (speed2hasChanged)
+ {
+ filter2[0].calculateHighpassCoefficients(33.3f/speed2, SAMPLERATE);
+
+ filter2[1].copyCoefficients(filter2);
+
+ speed2hasChanged = false;
+ }
+ }
+ }
+
+
+
+ if (!tomsound) {
+
+ read1temp = read1;
+ read2temp = read2;
+ writertemp = writer;
+
+
+ for(int i=0; i < 2 ; i++) {
+ lowpass1pos = (int)read1;
+ lowpass2pos = (int)read2;
+
+ for(long j=0; j < samples; j++) {
+
+ read1int = (int)read1;
+ read2int = (int)read2;
+
+
+ switch(quality)
+ {
+
+ case dirtfi:
+ r1val = buf1[i][read1int];
+ r2val = buf2[i][read2int];
+ break;
+
+ case hifi:
+
+ r1val = interpolateHermite(buf1[i], read1, bsize, writer-read1int);
+ r2val = interpolateHermite(buf2[i], read2, bsize, writer-read2int);
+ break;
+
+
+ case ultrahifi:
+ float lp1, lp2;
+ switch (filterMode1)
+ {
+ case useHighpass:
+ case useLowpassIIR:
+
+ r1val = interpolateHermitePostFilter(&filter1[i], read1);
+ break;
+ case useLowpassFIR:
+
+ lp1 = processFIRfilter(buf1[i], 23 , firCoefficients1,
+ (read1int- 23 +bsize)%bsize, bsize);
+ lp2 = processFIRfilter(buf1[i], 23 , firCoefficients1,
+ (read1int- 23 +1+bsize)%bsize, bsize);
+
+ r1val = interpolateLinear2values(lp1, lp2, read1) * mug1;
+ break;
+ default:
+ r1val = interpolateHermite(buf1[i], read1, bsize, writer-read1int);
+ break;
+ }
+ switch (filterMode2)
+ {
+ case useHighpass:
+ case useLowpassIIR:
+
+ r2val = interpolateHermitePostFilter(&filter2[i], read2);
+ break;
+ case useLowpassFIR:
+
+ lp1 = processFIRfilter(buf2[i], 23 , firCoefficients2,
+ (read2int- 23 +bsize)%bsize, bsize);
+ lp2 = processFIRfilter(buf2[i], 23 , firCoefficients2,
+ (read2int- 23 +1+bsize)%bsize, bsize);
+
+ r2val = interpolateLinear2values(lp1, lp2, read2) * mug2;
+ break;
+ default:
+ r2val = interpolateHermite(buf2[i], read2, bsize, writer-read2int);
+ break;
+ }
+ break;
+
+ default:
+ r1val = buf1[i][read1int];
+ r2val = buf2[i][read2int];
+ break;
+ }
+
+
+
+ if (smoothcount1[i]) {
+ r1val = ( r1val * (1.0f - (smoothstep1[i]*(float)smoothcount1[i])) )
+ + (lastr1val[i] * smoothstep1[i]*(float)smoothcount1[i]);
+ (smoothcount1[i])--;
+ }
+ if (smoothcount2[i]) {
+ r2val = ( r2val * (1.0f - (smoothstep2[i]*(float)smoothcount2[i])) )
+ + (lastr2val[i] * smoothstep2[i]*(float)smoothcount2[i]);
+ (smoothcount2[i])--;
+ }
+
+
+
+
+
+
+
+
+
+ buf1[i][writer] = in[i][j] + (feed1 * r1val * mix1);
+ buf2[i][writer] = in[i][j] + (feed2 * r2val * mix2);
+ if (fabs( buf1[i][writer] ) < 1.0e-15) buf1[i][writer] = 0.0 ;
+ if (fabs( buf2[i][writer] ) < 1.0e-15) buf2[i][writer] = 0.0 ;
+
+
+ if (replacing)
+ outputs[i][j] = (in[i][j]*drymix) + (r1val*mix1) + (r2val*mix2);
+ else
+ outputs[i][j] += (in[i][j]*drymix) + (r1val*mix1) + (r2val*mix2);
+
+
+
+
+
+
+ if ( ( (read1int < writer) &&
+ (((int)(read1+(double)speed1)) >= (writer+1)) ) ||
+ ( (read1int >= writer) &&
+ (((int)(read1+(double)speed1)) <= (writer+1)) ) ) {
+
+
+ if (smoothcount1[i] <= 0) {
+
+ lastr1val[i] = r1val;
+
+ smoothdur1[i] =
+ (42 > (int)(bsize_float/(double)speed1)) ?
+ (int)(bsize_float/(double)speed1) : 42 ;
+ smoothstep1[i] = 1.0f / (float)smoothdur1[i];
+ smoothcount1[i] = smoothdur1[i];
+ }
+ }
+
+
+ if ( ( (read2int < writer) &&
+ (((int)(read2+(double)speed2)) >= (writer+1)) ) ||
+ ( (read2int >= writer) &&
+ (((int)(read2+(double)speed2)) <= (writer+1)) ) ) {
+ if (smoothcount2[i] <= 0) {
+
+ lastr2val[i] = r2val;
+
+ smoothdur2[i] =
+ (42 > (int)(bsize_float/(double)speed2)) ?
+ (int)(bsize_float/(double)speed2) : 42 ;
+ smoothstep2[i] = 1.0f / (float)smoothdur2[i];
+ smoothcount2[i] = smoothdur2[i];
+ }
+ }
+
+
+ writer++;
+ read1 += (double)speed1;
+ read2 += (double)speed2;
+
+
+ writer %= bsize;
+ if (read1 >= bsize_float)
+ read1 = fmod(fabs(read1), bsize_float);
+ if (read2 >= bsize_float)
+ read2 = fmod(fabs(read2), bsize_float);
+
+
+
+
+
+ if (filterMode1 == useLowpassIIR)
+ {
+ int lowpasscount = 0;
+ while (lowpasscount < speed1int)
+ {
+ switch (speed1int - lowpasscount)
+ {
+ case 1:
+ filter1[i].processH1(buf1[i][lowpass1pos]);
+ lowpass1pos = (lowpass1pos + 1) % bsize;
+ lowpasscount++;
+ break;
+ case 2:
+ filter1[i].processH2(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 2) % bsize;
+ lowpasscount += 2;
+ break;
+ case 3:
+ filter1[i].processH3(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 3) % bsize;
+ lowpasscount += 3;
+ break;
+ default:
+ filter1[i].processH4(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 4) % bsize;
+ lowpasscount += 4;
+ break;
+ }
+ }
+ read1int = (int)read1;
+
+ if ( ((lowpass1pos < read1int) && ((lowpass1pos+1) == read1int)) ||
+ ((lowpass1pos == (bsize-1)) && (read1int == 0)) )
+ {
+ filter1[i].processH1(buf1[i][lowpass1pos]);
+ lowpass1pos = (lowpass1pos+1) % bsize;
+ }
+ }
+
+
+ else if (filterMode1 == useHighpass)
+ {
+
+ if ((int)read1 != read1int)
+ filter1[i].process(buf1[i][read1int]);
+ }
+
+
+ if (filterMode2 == useLowpassIIR)
+ {
+ int lowpasscount = 0;
+ while (lowpasscount < speed2int)
+ {
+ switch (speed2int - lowpasscount)
+ {
+ case 1:
+ filter2[i].processH1(buf2[i][lowpass2pos]);
+ lowpass2pos = (lowpass2pos + 1) % bsize;
+ lowpasscount++;
+ break;
+ case 2:
+ filter2[i].processH2(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 2) % bsize;
+ lowpasscount += 2;
+ break;
+ case 3:
+ filter2[i].processH3(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 3) % bsize;
+ lowpasscount += 3;
+ break;
+ default:
+ filter2[i].processH4(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 4) % bsize;
+ lowpasscount += 4;
+ break;
+ }
+ }
+ read2int = (int)read2;
+ if ( ((lowpass2pos < read2int) && ((lowpass2pos+1) == read2int)) ||
+ ((lowpass2pos == (bsize-1)) && (read2int == 0)) )
+ {
+ filter2[i].processH1(buf2[i][lowpass2pos]);
+ lowpass2pos = (lowpass2pos+1) % bsize;
+ }
+ }
+ else if (filterMode2 == useHighpass)
+ {
+ if ((int)read2 != read2int)
+ filter2[i].process(buf2[i][read2int]);
+ }
+ }
+
+
+ if (i == 0) {
+
+ read1 = read1temp;
+ read2 = read2temp;
+ writer = writertemp;
+ }
+
+ }
+ }
+
+
+
+
+
+ else {
+ for(long j=0; j < samples; j++) {
+ for(int i=0; i < 2 ; i++) {
+
+
+
+ switch(quality) {
+ case dirtfi:
+ r1val = mix1 * buf1[i][(int)read1];
+ r2val = mix2 * buf1[i][(int)read2];
+ break;
+ case hifi:
+ case ultrahifi:
+ r1val = mix1 * interpolateHermite(buf1[i], read1, bsize, 333);
+ r2val = mix2 * interpolateHermite(buf1[i], read2, bsize, 333);
+ break;
+ default:
+ r1val = mix1 * buf1[i][(int)read1];
+ r2val = mix2 * buf1[i][(int)read2];
+ break;
+ }
+
+
+
+ buf1[i][writer] =
+ in[i][j] +
+ feed1 * r1val +
+ feed2 * r2val;
+
+
+ writer++;
+ writer %= bsize;
+
+ read1 += (double)speed1;
+ read2 += (double)speed2;
+
+ if (read1 >= bsize_float)
+ read1 = fmod(fabs(read1), bsize_float);
+ if (read2 >= bsize_float)
+ read2 = fmod(fabs(read2), bsize_float);
+
+
+ if (replacing)
+ outputs[i][j] = in[i][j] * drymix + r1val + r2val;
+ else
+ outputs[i][j] += in[i][j] * drymix + r1val + r2val;
+ }
+ }
+ }
+
+}
diff --git a/transverb/syncgrain.cpp- b/transverb/syncgrain.cpp-
new file mode 100644
index 0000000..6903abb
--- /dev/null
+++ b/transverb/syncgrain.cpp-
@@ -0,0 +1,276 @@
+// syncgrain~ - part of a flext tutorial by Frank Barknecht
+//
+// This is a heavily commented port of the syncgrain~ example from the
+// PD-Externals-Howto to illustrate the usage of flext. You can get the
+// original code at http://iem.kug.ac.at/pd/externals-HOWTO/
+
+#include <flext.h>
+#include <errno.h>
+#include <unistd.h>
+#include <SndObj/AudioDefs.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 202)
+#error You need at least flext version 0.2.2
+#endif
+
+
+// A flext dsp external ("tilde object") inherits from the class flext_dsp
+class syncgrain:
+ public flext_dsp
+{
+ // Each external that is written in C++ needs to use #defines
+ // from flbase.h
+ //
+ // The define
+ //
+ // FLEXT_HEADER(NEW_CLASS, PARENT_CLASS)
+ //
+ // should be somewhere in your dsp file.
+ // A good place is here:
+
+ FLEXT_HEADER(syncgrain, flext_dsp)
+
+ public:
+ syncgrain(int argc, t_atom *argv);
+ ~syncgrain()
+ {
+ if (grain) delete grain;
+ if (envtable) delete envtable;
+ if (ftable) delete ftable;
+ if (infile) delete infile;
+ }
+
+ virtual void m_help()
+ {
+ post("");
+ post("_ _____syncgrain~ help___ _");
+ post("_ _____SyncGrain implements synchronous granular synthesis.\n\nThe source sound for the grains is obtained by reading\na function table containing the samples of the source\nwaveform. The grain generator has full control of frequency (grains/sec),\noverall amplitude, grain pitch (a sampling increment)\nand grain size (in millisecs). An extra parameter is the grain\npointer speed (or rate), which controls which position\nthe generator will start reading samples in the table\nfor each successive grain. It is measured in fractions\nof grain size, so a value of 1 will make\neach successive grain read from where the previous\ngrain should finish. A value of 0.5 will make the next\ngrain start at the midway position from the previous\ngrain start and finish, etc. A value of 0 will make\nthe generator read always from the start of the table.\nThis control gives extra flexibility for creating\ntimescale modifications in the resynthesis.\n");
+ post("_ ___help __ _");
+ post("1. inlet: \"set filename\" message to choose grain source. Wav and Riff files are accepted.");
+ post("2. inlet: Grain Frequency in grains per second");
+ post("3. inlet: Amplitude, default starting value is 1");
+ post("4. inlet: Pitch of the grains");
+ post("5. inlet: GrainSize in milli-seconds! Good values are between 10 and 50 msec.");
+ post("6. inlet: PointerRate. Normally 0-1, but have fun with greater or smaller values!");
+ }
+
+ protected:
+ // here we declare the virtual DSP function
+ virtual void m_signal(int n, float *const *in, float *const *out);
+ private:
+ HammingTable *envtable;
+ SyncGrain *grain;
+ SndWave *infile;
+ SndTable *ftable;
+
+ float fr;
+ float amp;
+ float pitch;
+ float grsize;
+ float prate;
+ int olaps;
+
+ // size of grain source table
+ int tablesize;
+ int sr;
+ int blocksize;
+
+
+ FLEXT_CALLBACK_F(setFreq)
+ void setFreq(float f)
+ {
+ fr = f;
+ grain->SetFreq(f);
+ }
+
+ FLEXT_CALLBACK_F(setAmp)
+ void setAmp(float f)
+ {
+ amp = f;
+ grain->SetAmp(f);
+ }
+
+ FLEXT_CALLBACK_F(setPitch)
+ void setPitch(float f)
+ {
+ pitch = f * (float)(tablesize/sr);
+ grain->SetPitch(f);
+ }
+
+ FLEXT_CALLBACK_F(setGrainSize)
+ void setGrainSize(float f)
+ {
+ grsize = f * 0.001;
+ //post("Grainsize now: %f", grsize);
+ grain->SetGrainSize(grsize);
+ }
+
+ FLEXT_CALLBACK_F(setPointerRate)
+ void setPointerRate(float f)
+ {
+ prate = f;
+ grain->SetPointerRate(prate);
+ }
+
+ FLEXT_CALLBACK_G(setFile)
+ int setFile(int argc, t_atom *argv);
+
+
+}; // end of class declaration for syncgrain
+
+// GIMME class:
+FLEXT_NEW_TILDE_G("syncgrain~", syncgrain)
+
+
+// _ ___
+
+syncgrain::syncgrain(int argc, t_atom *argv) :
+// init vars
+fr(0.f), amp(1.f), pitch(1.f), grsize (0.f), prate(1.f), olaps(100)
+{
+
+ post("_ ____syncgrain~ with flext");
+ if (this->grain)
+ {
+ post ("Already there, shouldn't happen!!!");
+ }
+
+ sr = (int) Samplerate();
+ blocksize = Blocksize();
+
+ envtable = new HammingTable();
+ ftable = new SndTable();
+
+ // post("argc: %i", argc);
+ if (argc == 1 && IsSymbol(argv[0]))
+ {
+ char* filename = (char *)GetString(argv[0]);
+ post("Trying to load file '%s'", filename);
+ infile = new SndWave(filename, READ);
+
+ // if Status not SFERROR
+ if (infile && (infile->GetStatus() != SFERROR))
+ {
+ // Status is WAITOPEN, have to wait a bit
+ while (infile->GetStatus() != SFOPEN)
+ {
+ sleep(1);
+ post("Waiting for SndFIO");
+ }
+
+ ftable->SetInput(infile->GetDataFrames(), infile);
+ ftable->MakeTable();
+ tablesize = ftable->GetLen(); // for SndTables
+ grain = new
+ SyncGrain(
+ ftable,
+ envtable,
+ fr,
+ amp,
+ pitch,
+ grsize,
+ prate,
+ 0, 0, 0, 0,
+ olaps,
+ blocksize,
+ sr
+ );
+ post("_ ____Using grain table '%s'", filename);
+ }
+ }
+ else
+ {
+ post("_ ___ Please load a soundfile with \"set filename.wav\"!!");
+ grain = new
+ SyncGrain(
+ ftable, // no ftable yet...
+ envtable,
+ fr,
+ amp,
+ pitch,
+ grsize,
+ prate,
+ 0, 0, 0, 0,
+ olaps,
+ blocksize,
+ sr
+ );
+
+ }
+
+
+
+ // The constructor of your class is responsible for
+ // setting up inlets and outlets and for registering
+ // inlet-methods:
+
+ // AddInSignal();
+ AddInAnything();
+ AddInFloat(5);
+ AddOutSignal(); // 1 audio out [ == AddOutSignal(1) ]
+
+ SetupInOut(); // set up inlets and outlets.
+ // Must get called once!
+
+ // Now we need to bind the handler function to our
+ // inlets,
+ FLEXT_ADDMETHOD_(0,"set",setFile);
+ FLEXT_ADDMETHOD(1,setFreq);
+ FLEXT_ADDMETHOD(2,setAmp);
+ FLEXT_ADDMETHOD(3,setPitch);
+ FLEXT_ADDMETHOD(4,setGrainSize);
+ FLEXT_ADDMETHOD(5,setPointerRate);
+
+
+ // We're done constructing:
+ // post("_ ____ ____ _");
+
+} // end of constructor
+
+
+int syncgrain::setFile(int argc, t_atom *argv)
+{
+ if (argc == 1 && IsSymbol(argv[0]))
+ {
+ if (infile) delete infile;
+ char* filename = (char *)GetString(argv[0]);
+ post("Trying to load file '%s'", filename);
+ infile = new SndWave(filename, READ);
+
+ // if Status not SFERROR
+ if (infile && (infile->GetStatus() != SFERROR))
+ {
+ // Status is WAITOPEN, have to wait a bit
+ while (infile->GetStatus() != SFOPEN)
+ {
+ sleep(1);
+ post("Waiting for SndFIO");
+ }
+
+ ftable->SetInput(infile->GetDataFrames(), infile);
+ ftable->MakeTable();
+ tablesize = ftable->GetLen(); // for SndTables
+
+ grain->SetWaveTable(ftable);
+
+ post("_ ____Using grain table: '%s', size %d", filename, tablesize);
+ }
+
+ }
+ return infile->GetStatus();
+}
+
+
+void syncgrain::m_signal(int n, float *const *in, float *const *out)
+{
+ float *outs = out[0];
+
+ grain->DoProcess();
+
+ // We are now ready for the main signal loop
+ int i = 0;
+ while (n--)
+ {
+ *outs++ = grain->Output(i++);
+ }
+} // end m_signal
diff --git a/transverb/transverb.cpp b/transverb/transverb.cpp
new file mode 100755
index 0000000..bfe2b51
--- /dev/null
+++ b/transverb/transverb.cpp
@@ -0,0 +1,683 @@
+
+/* DFX Transverb transverb by Tom 7 and Marc 3 */
+
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "transverb.h"
+#include "FIRfilter.h"
+
+
+// _ ___
+
+transverb::transverb(int argc, t_atom *argv) {
+
+ fBsize = (2700.0f-BUFFER_MIN)/(BUFFER_MAX-BUFFER_MIN); // "ms"
+ drymix = 0.8f; // "dB"
+
+ fQuality = 1.0f; // "steps 0-2"
+ fTomsound = 0.0f; // "yes / no"
+ fSpeed1mode = 0.0f;
+ fSpeed2mode = 0.0f;
+
+ mix1 = 1.0f; // "dB"
+ dist1 = 0.90009f; // "units"
+ speed1 = (0.0f-SPEED_MIN)/(SPEED_MAX-SPEED_MIN); // "units"
+ feed1 = 0.0f; // "units"
+
+ mix2 = 0.0f; // "dB"
+ dist2 = 0.1f; // "units"
+ speed2 = (1.0f-SPEED_MIN)/(SPEED_MAX-SPEED_MIN); // "units"
+ feed2 = 0.0f; // "units"
+
+ ireplace = 1; // "yes/no"
+
+
+ // default this to something, at least for the sake of getGetTailSize()
+ MAXBUF = (int) (BUFFER_MAX * 44.1f);
+ buf1[0] = NULL;
+ buf2[0] = NULL;
+#ifdef TRANSVERB_STEREO
+ buf1[1] = NULL;
+ buf2[1] = NULL;
+#endif
+ filter1 = new IIRfilter[NUM_CHANNELS];
+ filter2 = new IIRfilter[NUM_CHANNELS];
+ firCoefficients1 = new float[numFIRtaps];
+ firCoefficients2 = new float[numFIRtaps];
+ suspend();
+ srand((unsigned int)time(NULL)); // sets a seed value for rand() from the system clock
+
+ post("_ ____transverb~ ");
+
+ sr = (int) Samplerate();
+ blocksize = Blocksize();
+
+ fTomsound = (float)GetFloat(argv[0]); // creation arguments
+ fQuality = (float)GetFloat(argv[1]); // [ yet they default to reasonable values ]
+ drymix = (float)GetFloat(argv[2]);
+ ireplace = (int)GetFloat(argv[3]);
+
+ post("__ blocksize :: %d",sr);
+ post("_ samplerat :: %d",sr);
+ post("____ _ - tomsound :: %f",fTomsound);
+ post("___ _____ - quality :: %f",fQuality);
+ post("__ - drymix :: %f",drymix);
+ post("______ - replacing :: %d",ireplace);
+
+ AddInSignal();
+ AddInFloat(9);
+ AddOutSignal(); // 1 audio out [ == AddOutSignal(1) ]
+
+ SetupInOut(); // set up inlets and outlets.
+ // Must get called once!
+
+ // Now we need to bind the handler function to our
+ // inlets,
+ FLEXT_ADDMETHOD( 1,setBsize);
+ FLEXT_ADDMETHOD( 2,setMix1);
+ FLEXT_ADDMETHOD( 3,setSpeed1);
+ FLEXT_ADDMETHOD( 4,setFeed1);
+ FLEXT_ADDMETHOD( 5,setDist1);
+ FLEXT_ADDMETHOD( 6,setMix2);
+ FLEXT_ADDMETHOD( 7,setSpeed2);
+ FLEXT_ADDMETHOD( 8,setFeed2);
+ FLEXT_ADDMETHOD( 9,setDist2);
+
+ post("_ ____ ____ _");
+
+} // end of constructor
+
+
+transverb::~transverb() {
+
+ if (buf1[0])
+ free(buf1[0]);
+ if (buf2[0])
+ free(buf2[0]);
+#ifdef TRANSVERB_STEREO
+ if (buf1[1])
+ free(buf1[1]);
+ if (buf2[1])
+ free(buf2[1]);
+#endif
+ if (filter1)
+ delete[] filter1;
+ if (filter2)
+ delete[] filter2;
+ if (firCoefficients1)
+ delete[] firCoefficients1;
+ if (firCoefficients2)
+ delete[] firCoefficients2;
+
+}
+
+// GIMME class:
+FLEXT_NEW_TILDE_G("transverb~", transverb)
+
+
+
+void transverb::suspend () {
+
+ clearBuffers();
+ writer = 0;
+ read1 = read2 = 0.0;
+ smoothcount1[0] = smoothcount2[0] = 0;
+ lastr1val[0] = lastr2val[0] = 0.0f;
+ filter1[0].reset();
+ filter2[0].reset();
+#ifdef TRANSVERB_STEREO
+ smoothcount1[1] = smoothcount2[1] = 0;
+ lastr1val[1] = lastr2val[1] = 0.0f;
+ filter1[1].reset();
+ filter2[1].reset();
+#endif
+ SAMPLERATE = 44100.0f;
+ bsize = bufferScaled(fBsize);
+ speed1hasChanged = speed2hasChanged = true;
+ createAudioBuffers();
+}
+
+void transverb::createAudioBuffers() {
+
+ SAMPLERATE = 44100.0f;
+
+ long oldmax = MAXBUF;
+ MAXBUF = (int) (BUFFER_MAX * 0.001f * SAMPLERATE);
+
+ // if the sampling rate (& therefore the max buffer size) has changed,
+ // then delete & reallocate the buffers according to the sampling rate
+ if (MAXBUF != oldmax)
+ {
+ if (buf1[0] != NULL)
+ free(buf1[0]);
+ buf1[0] = NULL;
+ if (buf2[0] != NULL)
+ free(buf2[0]);
+ buf2[0] = NULL;
+#ifdef TRANSVERB_STEREO
+ if (buf1[1] != NULL)
+ free(buf1[1]);
+ buf1[1] = NULL;
+ if (buf2[1] != NULL)
+ free(buf2[1]);
+ buf2[1] = NULL;
+#endif
+ }
+ if (buf1[0] == NULL)
+ buf1[0] = (float*)malloc(MAXBUF * sizeof (float));
+ if (buf2[0] == NULL)
+ buf2[0] = (float*)malloc(MAXBUF * sizeof (float));
+#ifdef TRANSVERB_STEREO
+ if (buf1[1] == NULL)
+ buf1[1] = (float*)malloc(MAXBUF * sizeof (float));
+ if (buf2[1] == NULL)
+ buf2[1] = (float*)malloc(MAXBUF * sizeof (float));
+#endif
+}
+
+void transverb::clearBuffers() {
+ if ( (buf1[0] != NULL) && (buf2[0] != NULL) ) {
+ for (int j=0; j < MAXBUF; j++) buf1[0][j] = buf2[0][j] = 0.0f;
+ }
+#ifdef TRANSVERB_STEREO
+ if ( (buf1[1] != NULL) && (buf2[1] != NULL) ) {
+ for (int k=0; k < MAXBUF; k++) buf1[1][k] = buf2[1][k] = 0.0f;
+ }
+#endif
+}
+
+
+void transverb::m_signal(int n, float *const *in, float *const *out) {
+
+ float *outs = out[0];
+ float *ins = in[0];
+
+ // directly move everything to the vst part
+ processX((float *)ins, (float *)outs,(long int)n, ireplace);
+} // end m_signal
+
+
+void transverb::m_help() {
+ post("");
+ post("_ _____transverb~ help___ _");
+ post(" af : tomsound _ 0 / 1");
+ post(" af : quality _ 0 1 2");
+ post(" af : add/rep _ 0 / 1");
+ post(" if : buffersize _ 1 ~ 3000");
+ post(" if : mix _ 0 ~ 1");
+ post(" if : speed 1 -3 ~ 6");
+ post(" if : feed 1 0 ~ 1");
+ post(" if : distortion 1");
+ post(" if : mix 2 0 ~ 1");
+ post(" if : speed 2 -3 ~ 6");
+ post(" if : feed 2 0 ~ 1");
+ post(" if : distortion 2");
+// post(" f : dry/wet ratio");
+ post("");
+}
+
+
+
+
+
+
+
+
+
+
+
+
+void transverb::processX(float *in, float *out, long samples, int replacing) {
+ // float these 3 temp variables are for preserving states when looping through channels
+ int writertemp;
+ double read1temp, read2temp;
+ // int versions of these float values, for reducing casting operations
+ int speed1int, speed2int, read1int, read2int;
+ int lowpass1pos, lowpass2pos; // position trackers for the lowpass filters
+ float r1val, r2val; // delay buffer output values
+ double bsize_float = (double)bsize; // cut down on casting
+ int filterMode1, filterMode2; // the type of filtering to use in ultra hi-fi mode
+ float mug1, mug2; // make-up gain for lowpass filtering
+ float quietNoise = 1.0e-15f; // value added into the buffers to prevent denormals
+
+
+ // there must have not been available memory or something (like WaveLab goofing up),
+ // so try to allocate buffers now
+ if ( ((buf1[0] == NULL) || (buf2[0] == NULL))
+ #ifdef TRANSVERB_STEREO
+ || ((buf1[1] == NULL) || (buf2[1] == NULL))
+ #endif
+ ) createAudioBuffers();
+
+ // if the creation failed, then abort audio processing
+ if ( (buf1[0] == NULL) || (buf2[0] == NULL) )
+ return;
+#ifdef TRANSVERB_STEREO
+ if ( (buf1[1] == NULL) || (buf2[1] == NULL) )
+ return;
+#endif
+
+ SAMPLERATE = 44100.0f;
+
+ filterMode1 = filterMode2 = useNothing; // reset these for now
+ if (quality == ultrahifi)
+ {
+ // check to see if we need to lowpass the first delay head & init coefficients if so
+ if (speed1 > 1.0f)
+ {
+ filterMode1 = useLowpassIIR;
+ speed1int = (int)speed1;
+ // it becomes too costly to try to IIR at > 5x speeds, so switch to FIR filtering
+ if (speed1int >= 5)
+ {
+ filterMode1 = useLowpassFIR;
+ mug1 = powf( (speed1*0.2f), 0.78f ); // compensate for gain lost from filtering
+ // update the coefficients only if necessary
+ if (speed1hasChanged)
+ {
+ calculateFIRidealLowpassCoefficients((SAMPLERATE/speed1)*SHELF_START_IIR, SAMPLERATE, numFIRtaps, firCoefficients1);
+ applyKaiserWindow(numFIRtaps, firCoefficients1, 60.0f);
+ speed1hasChanged = false;
+ }
+ }
+ else if (speed1hasChanged)
+ {
+ filter1[0].calculateLowpassCoefficients((SAMPLERATE/speed1)*SHELF_START_IIR, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter1[1].copyCoefficients(filter1);
+ #endif
+ speed1hasChanged = false;
+ }
+ }
+ // we need to highpass the delay head to remove mega sub bass
+ else
+ {
+ filterMode1 = useHighpass;
+ if (speed1hasChanged)
+ {
+ filter1[0].calculateHighpassCoefficients(33.3f/speed1, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter1[1].copyCoefficients(filter1);
+ #endif
+ speed1hasChanged = false;
+ }
+ }
+
+ // check to see if we need to lowpass the second delay head & init coefficients if so
+ if (speed2 > 1.0f)
+ {
+ filterMode2 = useLowpassIIR;
+ speed2int = (int)speed2;
+ if (speed2int >= 5)
+ {
+ filterMode2 = useLowpassFIR;
+ mug2 = powf( (speed2*0.2f), 0.78f ); // compensate for gain lost from filtering
+ if (speed2hasChanged)
+ {
+ calculateFIRidealLowpassCoefficients((SAMPLERATE/speed2)*SHELF_START_IIR, SAMPLERATE, numFIRtaps, firCoefficients2);
+ applyKaiserWindow(numFIRtaps, firCoefficients2, 60.0f);
+ speed2hasChanged = false;
+ }
+ }
+ else if (speed2hasChanged)
+ {
+ filter2[0].calculateLowpassCoefficients((SAMPLERATE/speed2)*SHELF_START_IIR, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter2[1].copyCoefficients(filter2);
+ #endif
+ speed2hasChanged = false;
+ }
+ }
+ // we need to highpass the delay head to remove mega sub bass
+ else
+ {
+ filterMode2 = useHighpass;
+ if (speed2hasChanged)
+ {
+ filter2[0].calculateHighpassCoefficients(33.3f/speed2, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter2[1].copyCoefficients(filter2);
+ #endif
+ speed2hasChanged = false;
+ }
+ }
+ }
+
+ ///////////// M A R C S O U N D //////////////
+ // do it proper
+ if (!tomsound) {
+ // store these so that they can be restored before the next loop iteration
+ read1temp = read1;
+ read2temp = read2;
+ writertemp = writer;
+
+
+ for(int i=0; i < NUM_CHANNELS; i++) { // channels loop
+ lowpass1pos = (int)read1;
+ lowpass2pos = (int)read2;
+
+ for(long j=0; j < samples; j++) { // samples loop
+
+ read1int = (int)read1;
+ read2int = (int)read2;
+
+ /* read from read heads */
+ switch(quality)
+ {
+ // no interpolation or filtering
+ case dirtfi:
+ r1val = buf1[i][read1int];
+ r2val = buf2[i][read2int];
+ break;
+ // spline interpolation, but no filtering
+ case hifi:
+// r1val = interpolateLinear(buf1[i], read1, bsize, writer-read1int);
+ r1val = interpolateHermite(buf1[i], read1, bsize, writer-read1int);
+ r2val = interpolateHermite(buf2[i], read2, bsize, writer-read2int);
+ break;
+ // spline interpolation plus anti-aliasing lowpass filtering for high speeds
+ // or sub-bass-removing highpass filtering for low speeds
+ case ultrahifi:
+ float lp1, lp2;
+ switch (filterMode1)
+ {
+ case useHighpass:
+ case useLowpassIIR:
+ // interpolate the values in the IIR output history
+ r1val = interpolateHermitePostFilter(&filter1[i], read1);
+ break;
+ case useLowpassFIR:
+ // get 2 consecutive FIR output values for linear interpolation
+ lp1 = processFIRfilter(buf1[i], numFIRtaps, firCoefficients1,
+ (read1int-numFIRtaps+bsize)%bsize, bsize);
+ lp2 = processFIRfilter(buf1[i], numFIRtaps, firCoefficients1,
+ (read1int-numFIRtaps+1+bsize)%bsize, bsize);
+ // interpolate output linearly (avoid shit sound) & compensate gain
+ r1val = interpolateLinear2values(lp1, lp2, read1) * mug1;
+ break;
+ default:
+ r1val = interpolateHermite(buf1[i], read1, bsize, writer-read1int);
+ break;
+ }
+ switch (filterMode2)
+ {
+ case useHighpass:
+ case useLowpassIIR:
+ // interpolate the values in the IIR output history
+ r2val = interpolateHermitePostFilter(&filter2[i], read2);
+ break;
+ case useLowpassFIR:
+ // get 2 consecutive FIR output values for linear interpolation
+ lp1 = processFIRfilter(buf2[i], numFIRtaps, firCoefficients2,
+ (read2int-numFIRtaps+bsize)%bsize, bsize);
+ lp2 = processFIRfilter(buf2[i], numFIRtaps, firCoefficients2,
+ (read2int-numFIRtaps+1+bsize)%bsize, bsize);
+ // interpolate output linearly (avoid shit sound) & compensate gain
+ r2val = interpolateLinear2values(lp1, lp2, read2) * mug2;
+ break;
+ default:
+ r2val = interpolateHermite(buf2[i], read2, bsize, writer-read2int);
+ break;
+ }
+ break;
+ // dirt-fi style again for the safety net
+ default:
+ r1val = buf1[i][read1int];
+ r2val = buf2[i][read2int];
+ break;
+ } // end of quality switch
+
+ // crossfade the last stored smoothing sample with
+ // the current sample if smoothing is in progress
+ if (smoothcount1[i]) {
+ r1val = ( r1val * (1.0f - (smoothstep1[i]*(float)smoothcount1[i])) )
+ + (lastr1val[i] * smoothstep1[i]*(float)smoothcount1[i]);
+ (smoothcount1[i])--;
+ }
+ if (smoothcount2[i]) {
+ r2val = ( r2val * (1.0f - (smoothstep2[i]*(float)smoothcount2[i])) )
+ + (lastr2val[i] * smoothstep2[i]*(float)smoothcount2[i]);
+ (smoothcount2[i])--;
+ }
+
+ /* then write into buffer (w/ feedback) */
+
+ // mix very quiet noise (-300 dB) into the input singal
+ // to hopefully avoid any denormal values from IIR filtering
+/* buf1[i][writer] = in[i][j] + (feed1 * r1val * mix1) + quietNoise;
+ buf2[i][writer] = in[i][j] + (feed2 * r2val * mix2) + quietNoise;
+ quietNoise = -quietNoise; // flip its sign
+*/
+ buf1[i][writer] = (*in) + (feed1 * r1val * mix1);
+ buf2[i][writer] = (*in) + (feed2 * r2val * mix2);
+ undenormalize(buf1[i][writer]);
+ undenormalize(buf2[i][writer]);
+
+ /* make output
+ outputs[i][j] = (in[i][j]*drymix) + (r1val*mix1) + (r2val*mix2);
+ outputs[i][j] += (in[i][j]*drymix) + (r1val*mix1) + (r2val*mix2);
+ */
+
+ if (replacing)
+ *out++ = ((*in++)*drymix) + (r1val*mix1) + (r2val*mix2);
+ else
+ *out++ += ((*in++)*drymix) + (r1val*mix1) + (r2val*mix2);
+
+ /* start smoothing stuff if the writer has
+ passed a reader or vice versa.
+ (check the positions before wrapping around the heads)
+ */
+
+ if ( ( (read1int < writer) &&
+ (((int)(read1+(double)speed1)) >= (writer+1)) ) ||
+ ( (read1int >= writer) &&
+ (((int)(read1+(double)speed1)) <= (writer+1)) ) ) {
+ /* check because, at slow speeds,
+ it's possible to go into this twice or more in a row */
+ if (smoothcount1[i] <= 0) {
+ // store the most recent output as the channel 1 smoothing sample
+ lastr1val[i] = r1val;
+ // truncate the smoothing duration if we're using too small of a buffer size
+ smoothdur1[i] =
+ (SMOOTH_DUR > (int)(bsize_float/(double)speed1)) ?
+ (int)(bsize_float/(double)speed1) : SMOOTH_DUR;
+ smoothstep1[i] = 1.0f / (float)smoothdur1[i]; // the scalar step value
+ smoothcount1[i] = smoothdur1[i]; // set the counter to the total duration
+ }
+ }
+
+ // channel 2 smoothing stuff
+ if ( ( (read2int < writer) &&
+ (((int)(read2+(double)speed2)) >= (writer+1)) ) ||
+ ( (read2int >= writer) &&
+ (((int)(read2+(double)speed2)) <= (writer+1)) ) ) {
+ if (smoothcount2[i] <= 0) {
+ // store the most recent output as the channel 2 smoothing sample
+ lastr2val[i] = r2val;
+ // truncate the smoothing duration if we're using too small of a buffer size
+ smoothdur2[i] =
+ (SMOOTH_DUR > (int)(bsize_float/(double)speed2)) ?
+ (int)(bsize_float/(double)speed2) : SMOOTH_DUR;
+ smoothstep2[i] = 1.0f / (float)smoothdur2[i]; // the scalar step value
+ smoothcount2[i] = smoothdur2[i]; // set the counter to the total duration
+ }
+ }
+
+ /* update rw heads */
+ writer++;
+ read1 += (double)speed1;
+ read2 += (double)speed2;
+
+ // wrap around the rw heads if they've gone past the end of the buffer
+ writer %= bsize;
+ if (read1 >= bsize_float)
+ read1 = fmod(fabs(read1), bsize_float);
+ if (read2 >= bsize_float)
+ read2 = fmod(fabs(read2), bsize_float);
+
+ // if we're doing IIR lowpass filtering,
+ // then we probably need to process a few consecutive samples in order
+ // to get the continuous impulse (or whatever you call that),
+ // probably whatever the speed multiplier is, that's how many samples
+ if (filterMode1 == useLowpassIIR)
+ {
+ int lowpasscount = 0;
+ while (lowpasscount < speed1int)
+ {
+ switch (speed1int - lowpasscount)
+ {
+ case 1:
+ filter1[i].processH1(buf1[i][lowpass1pos]);
+ lowpass1pos = (lowpass1pos + 1) % bsize;
+ lowpasscount++;
+ break;
+ case 2:
+ filter1[i].processH2(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 2) % bsize;
+ lowpasscount += 2;
+ break;
+ case 3:
+ filter1[i].processH3(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 3) % bsize;
+ lowpasscount += 3;
+ break;
+ default:
+ filter1[i].processH4(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 4) % bsize;
+ lowpasscount += 4;
+ break;
+ }
+ }
+ read1int = (int)read1;
+ // make sure that we don't need to do one more sample
+ if ( ((lowpass1pos < read1int) && ((lowpass1pos+1) == read1int)) ||
+ ((lowpass1pos == (bsize-1)) && (read1int == 0)) )
+ {
+ filter1[i].processH1(buf1[i][lowpass1pos]);
+ lowpass1pos = (lowpass1pos+1) % bsize;
+ }
+ }
+ // it's simpler for highpassing;
+ // we may not even need to process anything for this sample
+ else if (filterMode1 == useHighpass)
+ {
+ // only if we've traversed to a new integer sample position
+ if ((int)read1 != read1int)
+ filter1[i].process(buf1[i][read1int]);
+ }
+
+ // channel 2 filtering stuff
+ if (filterMode2 == useLowpassIIR)
+ {
+ int lowpasscount = 0;
+ while (lowpasscount < speed2int)
+ {
+ switch (speed2int - lowpasscount)
+ {
+ case 1:
+ filter2[i].processH1(buf2[i][lowpass2pos]);
+ lowpass2pos = (lowpass2pos + 1) % bsize;
+ lowpasscount++;
+ break;
+ case 2:
+ filter2[i].processH2(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 2) % bsize;
+ lowpasscount += 2;
+ break;
+ case 3:
+ filter2[i].processH3(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 3) % bsize;
+ lowpasscount += 3;
+ break;
+ default:
+ filter2[i].processH4(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 4) % bsize;
+ lowpasscount += 4;
+ break;
+ }
+ }
+ read2int = (int)read2;
+ if ( ((lowpass2pos < read2int) && ((lowpass2pos+1) == read2int)) ||
+ ((lowpass2pos == (bsize-1)) && (read2int == 0)) )
+ {
+ filter2[i].processH1(buf2[i][lowpass2pos]);
+ lowpass2pos = (lowpass2pos+1) % bsize;
+ }
+ }
+ else if (filterMode2 == useHighpass)
+ {
+ if ((int)read2 != read2int)
+ filter2[i].process(buf2[i][read2int]);
+ }
+ } /* end of samples loop */
+
+ #ifdef TRANSVERB_STEREO
+ if (i == 0) {
+ // restore these place-holders for the second loop iteration
+ read1 = read1temp;
+ read2 = read2temp;
+ writer = writertemp;
+ }
+ #endif
+ } /* end of channels loop */
+ } /* end of if(TOMSOUND) */
+
+
+
+ ///////////// T O M S O U N D //////////////
+ else {
+ for(long j=0; j < samples; j++) {
+ for(int i=0; i < NUM_CHANNELS; i++) {
+
+ // read from read heads
+
+ switch(quality) {
+ case dirtfi:
+ r1val = mix1 * buf1[i][(int)read1];
+ r2val = mix2 * buf1[i][(int)read2];
+ break;
+ case hifi:
+ case ultrahifi:
+ r1val = mix1 * interpolateHermite(buf1[i], read1, bsize, 333);
+ r2val = mix2 * interpolateHermite(buf1[i], read2, bsize, 333);
+ break;
+ default:
+ r1val = mix1 * buf1[i][(int)read1];
+ r2val = mix2 * buf1[i][(int)read2];
+ break;
+ }
+
+ // then write into buffer (w/ feedback)
+
+ buf1[i][writer] =
+ *in +
+ feed1 * r1val +
+ feed2 * r2val;
+
+ // update rw heads
+
+ writer %= bsize;
+
+ read1 += (double)speed1;
+ read2 += (double)speed2;
+
+ if (read1 >= bsize_float)
+ read1 = fmod(fabs(read1), bsize_float);
+ if (read2 >= bsize_float)
+ read2 = fmod(fabs(read2), bsize_float);
+
+ if (replacing)
+ *out++ = ((*in++)*drymix) + (r1val*mix1) + (r2val*mix2);
+ else
+ *out++ += ((*in++)*drymix) + (r1val*mix1) + (r2val*mix2);
+
+// *out++ += ((*in++)*drymix) + (r1val*mix1) + (r2val*mix2);
+ }
+ }
+ }
+
+}
diff --git a/transverb/transverb.h b/transverb/transverb.h
new file mode 100644
index 0000000..28c7a4b
--- /dev/null
+++ b/transverb/transverb.h
@@ -0,0 +1,263 @@
+#ifndef __TOM7_TRANSVERB_H
+#define __TOM7_TRANSVERB_H
+
+//#define TRANSVERB_STEREO 1
+#define USING_HERMITE 1
+
+/* DFX Transverb transverb by Tom 7 and Marc 3 */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include "flext.h"
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 202)
+#error You need at least flext version 0.2.2
+#endif
+
+#include "dfxmisc.h"
+#include "IIRfilter.h"
+
+
+
+//-----------------------------------------------------------------------------
+// these are the transverb parameters:
+
+#define fsign(f) ((f<0.0f)?-1.0f:1.0f)
+
+#ifdef TRANSVERB_STEREO
+ #define NUM_CHANNELS 2
+#else
+ #define NUM_CHANNELS 1
+#endif
+
+#define BUFFER_MIN 1.0f
+#define BUFFER_MAX 3000.0f
+#define bufferMsScaled(A) ( paramRangeScaled((A), BUFFER_MIN, BUFFER_MAX) )
+#define bufferScaled(A) ( ((int)(bufferMsScaled(A)*SAMPLERATE*0.001f) > MAXBUF) ? MAXBUF : (int)(bufferMsScaled(A)*SAMPLERATE*0.001f) )
+
+#define gainScaled(A) ((A)*(A))
+
+#define SPEED_MIN (-3.0f)
+#define SPEED_MAX 6.0f
+#define speedScaled(A) ( paramRangeScaled((A), SPEED_MIN, SPEED_MAX) )
+#define speedUnscaled(A) ( paramRangeUnscaled((A), SPEED_MIN, SPEED_MAX) )
+// for backwards compatibility with versions 1.0 & 1.0.1
+#define OLD_SPEED_MIN 0.03f
+#define OLD_SPEED_MAX 10.0f
+#define oldSpeedScaled(A) ( paramRangeSquaredScaled((A), OLD_SPEED_MIN, OLD_SPEED_MAX) )
+
+#define qualityScaled(A) ( paramSteppedScaled((A), numQualities) )
+#define qualityUnscaled(A) ( paramSteppedUnscaled((A), numQualities) )
+
+#define SMOOTH_DUR 42
+
+// this is for converting version 1.0 speed parameter valuess to the current format
+//#define newSpeed(A) ((log2f(oldSpeedScaled((A)))-SPEED_MIN) / (SPEED_MAX-SPEED_MIN))
+#define newSpeed(A) (((logf(oldSpeedScaled((A)))/logf(2.0f))-SPEED_MIN) / (SPEED_MAX-SPEED_MIN))
+
+// this stuff is for the speed parameter adjustment mode switch on the GUI
+enum { kFineMode, kSemitoneMode, kOctaveMode, numSpeedModes };
+#define speedModeScaled(A) ( paramSteppedScaled((A), numSpeedModes) )
+
+#define numFIRtaps 23
+
+const float RAND_MAX_FLOAT = (float) RAND_MAX; // reduces wasteful casting
+
+enum { dirtfi, hifi, ultrahifi, numQualities };
+
+enum { useNothing, useHighpass, useLowpassIIR, useLowpassFIR, numFilterModes };
+
+
+class transverb:
+ public flext_dsp {
+
+ FLEXT_HEADER(transverb, flext_dsp)
+
+public:
+ transverb(int argc, t_atom *argv);
+ ~transverb();
+
+
+protected:
+
+ void initPresets();
+ void createAudioBuffers();
+ void clearBuffers();
+
+ virtual void m_signal(int n, float *const *in, float *const *out);
+ virtual void m_help();
+
+ float drymix;
+ int bsize, ireplace;
+ float mix1, speed1, feed1, dist1;
+ float mix2, speed2, feed2, dist2;
+ float fQuality, fTomsound;
+ long quality;
+ bool tomsound;
+
+ int writer;
+ double read1, read2;
+
+ int sr; int blocksize;
+
+ float * buf1[2];
+ float * buf2[2];
+ int MAXBUF; // the size of the audio buffer (dependant on sampling rate)
+
+ IIRfilter *filter1, *filter2;
+ bool speed1hasChanged, speed2hasChanged;
+ float fSpeed1mode, fSpeed2mode;
+
+ int smoothcount1[2], smoothcount2[2], smoothdur1[2], smoothdur2[2];
+ float smoothstep1[2], smoothstep2[2], lastr1val[2], lastr2val[2];
+
+ float SAMPLERATE;
+
+ float fBsize;
+
+ float *firCoefficients1, *firCoefficients2;
+
+ FLEXT_CALLBACK_F(setBsize)
+ void setBsize(float f) {
+ f = (f < 2999) ? f : 2999;
+ f = (f > 0) ? f : 0;
+ bsize = bufferScaled((int)f);
+ writer %= bsize;
+ read1 = fmod(fabs(read1), (double)bsize);
+ read2 = fmod(fabs(read2), (double)bsize);
+ }
+
+ FLEXT_CALLBACK_F(setMix1)
+ void setMix1(float f) {
+ f = (f < 1) ? f : 1;
+ f = (f > 0) ? f : 0;
+ mix1 = gainScaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setSpeed1)
+ void setSpeed1(float f) {
+ f = (f < 6) ? f : 6;
+ f = (f > -3) ? f : -3;
+ speed1 = powf(2.0f, speedScaled(f));
+ speed1hasChanged = true;
+ }
+
+ FLEXT_CALLBACK_F(setFeed1)
+ void setFeed1(float f) {
+ f = (f < 1) ? f : 1;
+ f = (f > 0) ? f : 0;
+ feed1 = f;
+ }
+
+ FLEXT_CALLBACK_F(setDist1)
+ void setDist1(float f) {
+ f = (f < 1) ? f : 1;
+ f = (f > 0) ? f : 0;
+ dist1 = f;
+ read1 = fmod(fabs((double)writer + (double)dist1 *
+ (double)MAXBUF), (double)bsize);
+ }
+
+ FLEXT_CALLBACK_F(setMix2)
+ void setMix2(float f) {
+ f = (f < 1) ? f : 1;
+ f = (f > 0) ? f : 0;
+ mix2 = gainScaled(f);
+ }
+
+ FLEXT_CALLBACK_F(setSpeed2)
+ void setSpeed2(float f) {
+ f = (f < 6) ? f : 6;
+ f = (f > -3) ? f : -3;
+ speed2 = powf(2.0f, speedScaled(f));
+ speed2hasChanged = true;
+ }
+
+ FLEXT_CALLBACK_F(setFeed2)
+ void setFeed2(float f) {
+ f = (f < 1) ? f : 1;
+ f = (f > 0) ? f : 0;
+ feed2 = f;
+ }
+
+ FLEXT_CALLBACK_F(setDist2)
+ void setDist2(float f) {
+ f = (f < 1) ? f : 1;
+ f = (f > 0) ? f : 0;
+ dist2 = f;
+ read2 = fmod(fabs((double)writer + (double)dist2 *
+ (double)MAXBUF), (double)bsize);
+ }
+
+private:
+ // this one does the work
+ virtual void processX(float *in, float *out, long n, int replacing);
+
+ // init would be better name
+ virtual void suspend();
+};
+
+
+inline float interpolateHermite (float *data, double address,
+ int arraysize, int danger) {
+ int pos, posMinus1, posPlus1, posPlus2;
+ float posFract, a, b, c;
+
+ pos = (long)address;
+ posFract = (float) (address - (double)pos);
+
+ // because the readers & writer are not necessarilly aligned,
+ // upcoming or previous samples could be discontiguous, in which case
+ // just "interpolate" with repeated samples
+ switch (danger) {
+ case 0: // the previous sample is bogus
+ posMinus1 = pos;
+ posPlus1 = (pos+1) % arraysize;
+ posPlus2 = (pos+2) % arraysize;
+ break;
+ case 1: // the next 2 samples are bogus
+ posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ posPlus1 = posPlus2 = pos;
+ break;
+ case 2: // the sample 2 steps ahead is bogus
+ posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ posPlus1 = posPlus2 = (pos+1) % arraysize;
+ break;
+ default: // everything's cool
+ posMinus1 = (pos == 0) ? arraysize-1 : pos-1;
+ posPlus1 = (pos+1) % arraysize;
+ posPlus2 = (pos+2) % arraysize;
+ break;
+ }
+
+ a = ( (3.0f*(data[pos]-data[posPlus1])) -
+ data[posMinus1] + data[posPlus2] ) * 0.5f;
+ b = (2.0f*data[posPlus1]) + data[posMinus1] -
+ (2.5f*data[pos]) - (data[posPlus2]*0.5f);
+ c = (data[posPlus1] - data[posMinus1]) * 0.5f;
+
+ return ( ((a*posFract)+b) * posFract + c ) * posFract + data[pos];
+}
+
+inline float interpolateLinear(float *data, double address,
+ int arraysize, int danger) {
+ int posPlus1, pos = (long)address;
+ float posFract = (float) (address - (double)pos);
+
+ if (danger == 1) {
+ /* the upcoming sample is not contiguous because
+ the write head is about to write to it */
+ posPlus1 = pos;
+ } else {
+ // it's all right
+ posPlus1 = (pos + 1) % arraysize;
+ }
+ return (data[pos] * (1.0f-posFract)) +
+ (data[posPlus1] * posFract);
+}
+
+
+
+#endif
diff --git a/transverb/transverb_safety.cpp b/transverb/transverb_safety.cpp
new file mode 100755
index 0000000..cd3e7bc
--- /dev/null
+++ b/transverb/transverb_safety.cpp
@@ -0,0 +1,744 @@
+
+/* DFX Transverb transverb by Tom 7 and Marc 3 */
+
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "transverb.h"
+#include "FIRfilter.h"
+
+
+// _ ___
+
+transverb::transverb(int argc, t_atom *argv) {
+
+ fBsize = (2700.0f-BUFFER_MIN)/(BUFFER_MAX-BUFFER_MIN); // "ms"
+ drymix = 0.5f; // "dB"
+
+ mix1 = 1.0f; // "dB"
+ dist1 = 0.90009f; // "units"
+ speed1 = (0.0f-SPEED_MIN)/(SPEED_MAX-SPEED_MIN); // "units"
+ feed1 = 0.0f; // "units"
+
+ mix2 = 0.0f; // "dB"
+ dist2 = 0.1f; // "units"
+ speed2 = (1.0f-SPEED_MIN)/(SPEED_MAX-SPEED_MIN); // "units"
+ feed2 = 0.0f; // "units"
+
+ fQuality = 1.0f;
+ fTomsound = 0.0f;
+ fSpeed1mode = 0.0f;
+ fSpeed2mode = 0.0f;
+
+ // default this to something, at least for the sake of getGetTailSize()
+ MAXBUF = (int) (BUFFER_MAX * 44.1f);
+ buf1[0] = NULL;
+ buf2[0] = NULL;
+#ifdef TRANSVERB_STEREO
+ buf1[1] = NULL;
+ buf2[1] = NULL;
+#endif
+ filter1 = new IIRfilter[NUM_CHANNELS];
+ filter2 = new IIRfilter[NUM_CHANNELS];
+ firCoefficients1 = new float[numFIRtaps];
+ firCoefficients2 = new float[numFIRtaps];
+ suspend();
+ srand((unsigned int)time(NULL)); // sets a seed value for rand() from the system clock
+
+ post("_ ____transverb~ with flext");
+
+ sr = (int) Samplerate();
+ blocksize = Blocksize();
+
+ post("_ samplerat :: %d",sr);
+
+ // The constructor of your class is responsible for
+ // setting up inlets and outlets and for registering
+ // inlet-methods:
+
+ AddInSignal();
+// AddInAnything();
+ AddInFloat(9);
+ AddOutSignal(); // 1 audio out [ == AddOutSignal(1) ]
+
+ SetupInOut(); // set up inlets and outlets.
+ // Must get called once!
+
+ // Now we need to bind the handler function to our
+ // inlets,
+ FLEXT_ADDMETHOD( 0,setMix);
+ FLEXT_ADDMETHOD( 1,setBsize);
+ FLEXT_ADDMETHOD( 2,setMix1);
+ FLEXT_ADDMETHOD( 3,setSpeed1);
+ FLEXT_ADDMETHOD( 4,setFeed1);
+ FLEXT_ADDMETHOD( 5,setDist1);
+ FLEXT_ADDMETHOD( 6,setMix2);
+ FLEXT_ADDMETHOD( 7,setSpeed2);
+ FLEXT_ADDMETHOD( 8,setFeed2);
+// FLEXT_ADDMETHOD( 9,setDist2);
+// FLEXT_ADDMETHOD(10,setQuality);
+// FLEXT_ADDMETHOD(11,setTom);
+
+ // We're done constructing:
+ post("_ ____ ____ _");
+
+} // end of constructor
+
+
+transverb::~transverb() {
+
+ if (buf1[0])
+ free(buf1[0]);
+ if (buf2[0])
+ free(buf2[0]);
+#ifdef TRANSVERB_STEREO
+ if (buf1[1])
+ free(buf1[1]);
+ if (buf2[1])
+ free(buf2[1]);
+#endif
+ if (filter1)
+ delete[] filter1;
+ if (filter2)
+ delete[] filter2;
+ if (firCoefficients1)
+ delete[] firCoefficients1;
+ if (firCoefficients2)
+ delete[] firCoefficients2;
+
+}
+
+// GIMME class:
+FLEXT_NEW_TILDE_G("transverb~", transverb)
+
+
+
+void transverb::suspend () {
+
+ clearBuffers();
+ writer = 0;
+ read1 = read2 = 0.0;
+ smoothcount1[0] = smoothcount2[0] = 0;
+ lastr1val[0] = lastr2val[0] = 0.0f;
+ filter1[0].reset();
+ filter2[0].reset();
+#ifdef TRANSVERB_STEREO
+ smoothcount1[1] = smoothcount2[1] = 0;
+ lastr1val[1] = lastr2val[1] = 0.0f;
+ filter1[1].reset();
+ filter2[1].reset();
+#endif
+ SAMPLERATE = 44100.0f;
+ bsize = bufferScaled(fBsize);
+ speed1hasChanged = speed2hasChanged = true;
+}
+
+void transverb::resume() {
+
+ createAudioBuffers();
+ bsize = bufferScaled(fBsize);
+}
+
+void transverb::createAudioBuffers() {
+
+ SAMPLERATE = 44100.0f;
+
+ long oldmax = MAXBUF;
+ MAXBUF = (int) (BUFFER_MAX * 0.001f * SAMPLERATE);
+
+ // if the sampling rate (& therefore the max buffer size) has changed,
+ // then delete & reallocate the buffers according to the sampling rate
+ if (MAXBUF != oldmax)
+ {
+ if (buf1[0] != NULL)
+ free(buf1[0]);
+ buf1[0] = NULL;
+ if (buf2[0] != NULL)
+ free(buf2[0]);
+ buf2[0] = NULL;
+#ifdef TRANSVERB_STEREO
+ if (buf1[1] != NULL)
+ free(buf1[1]);
+ buf1[1] = NULL;
+ if (buf2[1] != NULL)
+ free(buf2[1]);
+ buf2[1] = NULL;
+#endif
+ }
+ if (buf1[0] == NULL)
+ buf1[0] = (float*)malloc(MAXBUF * sizeof (float));
+ if (buf2[0] == NULL)
+ buf2[0] = (float*)malloc(MAXBUF * sizeof (float));
+#ifdef TRANSVERB_STEREO
+ if (buf1[1] == NULL)
+ buf1[1] = (float*)malloc(MAXBUF * sizeof (float));
+ if (buf2[1] == NULL)
+ buf2[1] = (float*)malloc(MAXBUF * sizeof (float));
+#endif
+}
+
+void transverb::clearBuffers() {
+ if ( (buf1[0] != NULL) && (buf2[0] != NULL) ) {
+ for (int j=0; j < MAXBUF; j++) buf1[0][j] = buf2[0][j] = 0.0f;
+ }
+#ifdef TRANSVERB_STEREO
+ if ( (buf1[1] != NULL) && (buf2[1] != NULL) ) {
+ for (int k=0; k < MAXBUF; k++) buf1[1][k] = buf2[1][k] = 0.0f;
+ }
+#endif
+}
+
+
+/* this randomizes the values of all of Transverb's parameters, sometimes in smart ways
+void transverb::randomizeParameters(bool writeAutomation) {
+
+ float mixSum, newDrymix, newMix1, newMix2, mixScalar, tempRand;
+
+
+ // randomize the first 7 parameters
+ for (long i=0; (i < kDrymix); i++)
+ {
+ // make slow speeds more probable (for fairer distribution)
+ if ( (i == kSpeed1) || (i == kSpeed1) )
+ {
+ tempRand = (float)rand() / RAND_MAX_FLOAT;
+ if ( tempRand < 0.5f )
+ tempRand *= fabsf(SPEED_MIN/(SPEED_MAX-SPEED_MIN)) * 2.0f;
+ else
+ tempRand = fabsf(SPEED_MIN/(SPEED_MAX-SPEED_MIN)) +
+ ( tempRand * fabsf(SPEED_MAX/(SPEED_MAX-SPEED_MIN)) );
+ setParameter(i, (float)rand()/RAND_MAX_FLOAT);
+ }
+ // make smaller buffer sizes more probable (because they sound better)
+ else if (i == kBsize)
+ {
+ setParameter( i, powf(((float)rand()/RAND_MAX_FLOAT*0.93f)+0.07f, 1.38f) );
+ }
+ else
+ {
+ setParameter(i, (float)rand()/RAND_MAX_FLOAT);
+ }
+ }
+
+ // store the current total gain sum
+ mixSum = gainScaled(drymixParam) +
+ gainScaled(mix1param) +
+ gainScaled(mix2param);
+
+ // randomize the mix parameters
+ drymix = (float)rand() / RAND_MAX_FLOAT;
+ mix1 = (float)rand() / RAND_MAX_FLOAT;
+ mix2 = (float)rand() / RAND_MAX_FLOAT;
+
+ // apply the scalar to the new mix parameter values
+ newDrymix = sqrtf( mixScalar * gainScaled(newDrymix) );
+ newMix1 = sqrtf( mixScalar * gainScaled(newMix1) );
+ newMix2 = sqrtf( mixScalar * gainScaled(newMix2) );
+
+ // clip the the mix values at 1.0 so that we don't get mega-feedback blasts
+ newDrymix = ( newDrymix > 1.0f ? 1.0f : newDrymix );
+ newMix1 = ( newMix1 > 1.0f ? 1.0f : newMix1 );
+ newMix2 = ( newMix2 > 1.0f ? 1.0f : newMix2 );
+
+ setParameter(kDrymix, newDrymix);
+ setParameter(kMix1, newMix1);
+ setParameter(kMix2, newMix2);
+ setParameter( kQuality, (float)(((rand()%5)+1)%3) * 0.5f );
+ setParameter( kTomsound, (float)((rand()%3)%2) );
+
+
+}
+*/
+
+
+void transverb::m_signal(int n, float *const *in, float *const *out)
+{
+ float *outs = out[0];
+
+ // We are now ready for the main signal loop
+ // float **in, float **outputs, long samples, int replacing
+
+ int i = 0;
+// while (n--) {
+ processX((float **)in,(float **)out,(long int)n,0);
+// *outs++ = (i++);
+// }
+} // end m_signal
+
+
+void transverb::processReplacing(float **inputs, float **outputs, long samples) {
+ processX(inputs,outputs,samples, 1);
+}
+
+void transverb::process(float **inputs, float **outputs, long samples) {
+ processX(inputs,outputs,samples, 0);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+void transverb::processX(float **in, float **outputs, long samples,
+ int replacing) {
+ // float these 3 temp variables are for preserving states when looping through channels
+ int writertemp;
+ double read1temp, read2temp;
+ // int versions of these float values, for reducing casting operations
+ int speed1int, speed2int, read1int, read2int;
+ int lowpass1pos, lowpass2pos; // position trackers for the lowpass filters
+ float r1val, r2val; // delay buffer output values
+ double bsize_float = (double)bsize; // cut down on casting
+ int filterMode1, filterMode2; // the type of filtering to use in ultra hi-fi mode
+ float mug1, mug2; // make-up gain for lowpass filtering
+ float quietNoise = 1.0e-15f; // value added into the buffers to prevent denormals
+
+
+ // there must have not been available memory or something (like WaveLab goofing up),
+ // so try to allocate buffers now
+ if ( ((buf1[0] == NULL) || (buf2[0] == NULL))
+ #ifdef TRANSVERB_STEREO
+ || ((buf1[1] == NULL) || (buf2[1] == NULL))
+ #endif
+ ) createAudioBuffers();
+
+ // if the creation failed, then abort audio processing
+ if ( (buf1[0] == NULL) || (buf2[0] == NULL) )
+ return;
+#ifdef TRANSVERB_STEREO
+ if ( (buf1[1] == NULL) || (buf2[1] == NULL) )
+ return;
+#endif
+
+ SAMPLERATE = 44100.0f;
+
+ filterMode1 = filterMode2 = useNothing; // reset these for now
+ if (quality == ultrahifi)
+ {
+ // check to see if we need to lowpass the first delay head & init coefficients if so
+ if (speed1 > 1.0f)
+ {
+ filterMode1 = useLowpassIIR;
+ speed1int = (int)speed1;
+ // it becomes too costly to try to IIR at > 5x speeds, so switch to FIR filtering
+ if (speed1int >= 5)
+ {
+ filterMode1 = useLowpassFIR;
+ mug1 = powf( (speed1*0.2f), 0.78f ); // compensate for gain lost from filtering
+ // update the coefficients only if necessary
+ if (speed1hasChanged)
+ {
+ calculateFIRidealLowpassCoefficients((SAMPLERATE/speed1)*SHELF_START_IIR, SAMPLERATE, numFIRtaps, firCoefficients1);
+ applyKaiserWindow(numFIRtaps, firCoefficients1, 60.0f);
+ speed1hasChanged = false;
+ }
+ }
+ else if (speed1hasChanged)
+ {
+ filter1[0].calculateLowpassCoefficients((SAMPLERATE/speed1)*SHELF_START_IIR, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter1[1].copyCoefficients(filter1);
+ #endif
+ speed1hasChanged = false;
+ }
+ }
+ // we need to highpass the delay head to remove mega sub bass
+ else
+ {
+ filterMode1 = useHighpass;
+ if (speed1hasChanged)
+ {
+ filter1[0].calculateHighpassCoefficients(33.3f/speed1, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter1[1].copyCoefficients(filter1);
+ #endif
+ speed1hasChanged = false;
+ }
+ }
+
+ // check to see if we need to lowpass the second delay head & init coefficients if so
+ if (speed2 > 1.0f)
+ {
+ filterMode2 = useLowpassIIR;
+ speed2int = (int)speed2;
+ if (speed2int >= 5)
+ {
+ filterMode2 = useLowpassFIR;
+ mug2 = powf( (speed2*0.2f), 0.78f ); // compensate for gain lost from filtering
+ if (speed2hasChanged)
+ {
+ calculateFIRidealLowpassCoefficients((SAMPLERATE/speed2)*SHELF_START_IIR, SAMPLERATE, numFIRtaps, firCoefficients2);
+ applyKaiserWindow(numFIRtaps, firCoefficients2, 60.0f);
+ speed2hasChanged = false;
+ }
+ }
+ else if (speed2hasChanged)
+ {
+ filter2[0].calculateLowpassCoefficients((SAMPLERATE/speed2)*SHELF_START_IIR, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter2[1].copyCoefficients(filter2);
+ #endif
+ speed2hasChanged = false;
+ }
+ }
+ // we need to highpass the delay head to remove mega sub bass
+ else
+ {
+ filterMode2 = useHighpass;
+ if (speed2hasChanged)
+ {
+ filter2[0].calculateHighpassCoefficients(33.3f/speed2, SAMPLERATE);
+ #ifdef TRANSVERB_STEREO
+ filter2[1].copyCoefficients(filter2);
+ #endif
+ speed2hasChanged = false;
+ }
+ }
+ }
+
+ ///////////// M A R C S O U N D //////////////
+ // do it proper
+ if (!tomsound) {
+ // store these so that they can be restored before the next loop iteration
+ read1temp = read1;
+ read2temp = read2;
+ writertemp = writer;
+
+
+ for(int i=0; i < NUM_CHANNELS; i++) { // channels loop
+ lowpass1pos = (int)read1;
+ lowpass2pos = (int)read2;
+
+ for(long j=0; j < samples; j++) { // samples loop
+
+ read1int = (int)read1;
+ read2int = (int)read2;
+
+ /* read from read heads */
+ switch(quality)
+ {
+ // no interpolation or filtering
+ case dirtfi:
+ r1val = buf1[i][read1int];
+ r2val = buf2[i][read2int];
+ break;
+ // spline interpolation, but no filtering
+ case hifi:
+// r1val = interpolateLinear(buf1[i], read1, bsize, writer-read1int);
+ r1val = interpolateHermite(buf1[i], read1, bsize, writer-read1int);
+ r2val = interpolateHermite(buf2[i], read2, bsize, writer-read2int);
+ break;
+ // spline interpolation plus anti-aliasing lowpass filtering for high speeds
+ // or sub-bass-removing highpass filtering for low speeds
+ case ultrahifi:
+ float lp1, lp2;
+ switch (filterMode1)
+ {
+ case useHighpass:
+ case useLowpassIIR:
+ // interpolate the values in the IIR output history
+ r1val = interpolateHermitePostFilter(&filter1[i], read1);
+ break;
+ case useLowpassFIR:
+ // get 2 consecutive FIR output values for linear interpolation
+ lp1 = processFIRfilter(buf1[i], numFIRtaps, firCoefficients1,
+ (read1int-numFIRtaps+bsize)%bsize, bsize);
+ lp2 = processFIRfilter(buf1[i], numFIRtaps, firCoefficients1,
+ (read1int-numFIRtaps+1+bsize)%bsize, bsize);
+ // interpolate output linearly (avoid shit sound) & compensate gain
+ r1val = interpolateLinear2values(lp1, lp2, read1) * mug1;
+ break;
+ default:
+ r1val = interpolateHermite(buf1[i], read1, bsize, writer-read1int);
+ break;
+ }
+ switch (filterMode2)
+ {
+ case useHighpass:
+ case useLowpassIIR:
+ // interpolate the values in the IIR output history
+ r2val = interpolateHermitePostFilter(&filter2[i], read2);
+ break;
+ case useLowpassFIR:
+ // get 2 consecutive FIR output values for linear interpolation
+ lp1 = processFIRfilter(buf2[i], numFIRtaps, firCoefficients2,
+ (read2int-numFIRtaps+bsize)%bsize, bsize);
+ lp2 = processFIRfilter(buf2[i], numFIRtaps, firCoefficients2,
+ (read2int-numFIRtaps+1+bsize)%bsize, bsize);
+ // interpolate output linearly (avoid shit sound) & compensate gain
+ r2val = interpolateLinear2values(lp1, lp2, read2) * mug2;
+ break;
+ default:
+ r2val = interpolateHermite(buf2[i], read2, bsize, writer-read2int);
+ break;
+ }
+ break;
+ // dirt-fi style again for the safety net
+ default:
+ r1val = buf1[i][read1int];
+ r2val = buf2[i][read2int];
+ break;
+ } // end of quality switch
+
+ // crossfade the last stored smoothing sample with
+ // the current sample if smoothing is in progress
+ if (smoothcount1[i]) {
+ r1val = ( r1val * (1.0f - (smoothstep1[i]*(float)smoothcount1[i])) )
+ + (lastr1val[i] * smoothstep1[i]*(float)smoothcount1[i]);
+ (smoothcount1[i])--;
+ }
+ if (smoothcount2[i]) {
+ r2val = ( r2val * (1.0f - (smoothstep2[i]*(float)smoothcount2[i])) )
+ + (lastr2val[i] * smoothstep2[i]*(float)smoothcount2[i]);
+ (smoothcount2[i])--;
+ }
+
+ /* then write into buffer (w/ feedback) */
+
+ // mix very quiet noise (-300 dB) into the input singal
+ // to hopefully avoid any denormal values from IIR filtering
+/* buf1[i][writer] = in[i][j] + (feed1 * r1val * mix1) + quietNoise;
+ buf2[i][writer] = in[i][j] + (feed2 * r2val * mix2) + quietNoise;
+ quietNoise = -quietNoise; // flip its sign
+*/
+ buf1[i][writer] = in[i][j] + (feed1 * r1val * mix1);
+ buf2[i][writer] = in[i][j] + (feed2 * r2val * mix2);
+ undenormalize(buf1[i][writer]);
+ undenormalize(buf2[i][writer]);
+
+ /* make output
+ if (replacing)
+ outputs[i][j] = (in[i][j]*drymix) + (r1val*mix1) + (r2val*mix2);
+ else
+ outputs[i][j] += (in[i][j]*drymix) + (r1val*mix1) + (r2val*mix2);
+ */
+
+ *outputs[j] += (*in[j]*drymix) + (r1val*mix1) + (r2val*mix2);
+
+
+ /* start smoothing stuff if the writer has
+ passed a reader or vice versa.
+ (check the positions before wrapping around the heads)
+ */
+
+ if ( ( (read1int < writer) &&
+ (((int)(read1+(double)speed1)) >= (writer+1)) ) ||
+ ( (read1int >= writer) &&
+ (((int)(read1+(double)speed1)) <= (writer+1)) ) ) {
+ /* check because, at slow speeds,
+ it's possible to go into this twice or more in a row */
+ if (smoothcount1[i] <= 0) {
+ // store the most recent output as the channel 1 smoothing sample
+ lastr1val[i] = r1val;
+ // truncate the smoothing duration if we're using too small of a buffer size
+ smoothdur1[i] =
+ (SMOOTH_DUR > (int)(bsize_float/(double)speed1)) ?
+ (int)(bsize_float/(double)speed1) : SMOOTH_DUR;
+ smoothstep1[i] = 1.0f / (float)smoothdur1[i]; // the scalar step value
+ smoothcount1[i] = smoothdur1[i]; // set the counter to the total duration
+ }
+ }
+
+ // channel 2 smoothing stuff
+ if ( ( (read2int < writer) &&
+ (((int)(read2+(double)speed2)) >= (writer+1)) ) ||
+ ( (read2int >= writer) &&
+ (((int)(read2+(double)speed2)) <= (writer+1)) ) ) {
+ if (smoothcount2[i] <= 0) {
+ // store the most recent output as the channel 2 smoothing sample
+ lastr2val[i] = r2val;
+ // truncate the smoothing duration if we're using too small of a buffer size
+ smoothdur2[i] =
+ (SMOOTH_DUR > (int)(bsize_float/(double)speed2)) ?
+ (int)(bsize_float/(double)speed2) : SMOOTH_DUR;
+ smoothstep2[i] = 1.0f / (float)smoothdur2[i]; // the scalar step value
+ smoothcount2[i] = smoothdur2[i]; // set the counter to the total duration
+ }
+ }
+
+ /* update rw heads */
+ writer++;
+ read1 += (double)speed1;
+ read2 += (double)speed2;
+
+ // wrap around the rw heads if they've gone past the end of the buffer
+ writer %= bsize;
+ if (read1 >= bsize_float)
+ read1 = fmod(fabs(read1), bsize_float);
+ if (read2 >= bsize_float)
+ read2 = fmod(fabs(read2), bsize_float);
+
+ // if we're doing IIR lowpass filtering,
+ // then we probably need to process a few consecutive samples in order
+ // to get the continuous impulse (or whatever you call that),
+ // probably whatever the speed multiplier is, that's how many samples
+ if (filterMode1 == useLowpassIIR)
+ {
+ int lowpasscount = 0;
+ while (lowpasscount < speed1int)
+ {
+ switch (speed1int - lowpasscount)
+ {
+ case 1:
+ filter1[i].processH1(buf1[i][lowpass1pos]);
+ lowpass1pos = (lowpass1pos + 1) % bsize;
+ lowpasscount++;
+ break;
+ case 2:
+ filter1[i].processH2(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 2) % bsize;
+ lowpasscount += 2;
+ break;
+ case 3:
+ filter1[i].processH3(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 3) % bsize;
+ lowpasscount += 3;
+ break;
+ default:
+ filter1[i].processH4(buf1[i], lowpass1pos, bsize);
+ lowpass1pos = (lowpass1pos + 4) % bsize;
+ lowpasscount += 4;
+ break;
+ }
+ }
+ read1int = (int)read1;
+ // make sure that we don't need to do one more sample
+ if ( ((lowpass1pos < read1int) && ((lowpass1pos+1) == read1int)) ||
+ ((lowpass1pos == (bsize-1)) && (read1int == 0)) )
+ {
+ filter1[i].processH1(buf1[i][lowpass1pos]);
+ lowpass1pos = (lowpass1pos+1) % bsize;
+ }
+ }
+ // it's simpler for highpassing;
+ // we may not even need to process anything for this sample
+ else if (filterMode1 == useHighpass)
+ {
+ // only if we've traversed to a new integer sample position
+ if ((int)read1 != read1int)
+ filter1[i].process(buf1[i][read1int]);
+ }
+
+ // channel 2 filtering stuff
+ if (filterMode2 == useLowpassIIR)
+ {
+ int lowpasscount = 0;
+ while (lowpasscount < speed2int)
+ {
+ switch (speed2int - lowpasscount)
+ {
+ case 1:
+ filter2[i].processH1(buf2[i][lowpass2pos]);
+ lowpass2pos = (lowpass2pos + 1) % bsize;
+ lowpasscount++;
+ break;
+ case 2:
+ filter2[i].processH2(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 2) % bsize;
+ lowpasscount += 2;
+ break;
+ case 3:
+ filter2[i].processH3(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 3) % bsize;
+ lowpasscount += 3;
+ break;
+ default:
+ filter2[i].processH4(buf2[i], lowpass2pos, bsize);
+ lowpass2pos = (lowpass2pos + 4) % bsize;
+ lowpasscount += 4;
+ break;
+ }
+ }
+ read2int = (int)read2;
+ if ( ((lowpass2pos < read2int) && ((lowpass2pos+1) == read2int)) ||
+ ((lowpass2pos == (bsize-1)) && (read2int == 0)) )
+ {
+ filter2[i].processH1(buf2[i][lowpass2pos]);
+ lowpass2pos = (lowpass2pos+1) % bsize;
+ }
+ }
+ else if (filterMode2 == useHighpass)
+ {
+ if ((int)read2 != read2int)
+ filter2[i].process(buf2[i][read2int]);
+ }
+ } /* end of samples loop */
+
+ #ifdef TRANSVERB_STEREO
+ if (i == 0) {
+ // restore these place-holders for the second loop iteration
+ read1 = read1temp;
+ read2 = read2temp;
+ writer = writertemp;
+ }
+ #endif
+ } /* end of channels loop */
+ } /* end of if(TOMSOUND) */
+
+
+
+
+ ///////////// T O M S O U N D //////////////
+ else {
+ for(long j=0; j < samples; j++) {
+ for(int i=0; i < NUM_CHANNELS; i++) {
+
+ /* read from read heads */
+
+ switch(quality) {
+ case dirtfi:
+ r1val = mix1 * buf1[i][(int)read1];
+ r2val = mix2 * buf1[i][(int)read2];
+ break;
+ case hifi:
+ case ultrahifi:
+ r1val = mix1 * interpolateHermite(buf1[i], read1, bsize, 333);
+ r2val = mix2 * interpolateHermite(buf1[i], read2, bsize, 333);
+ break;
+ default:
+ r1val = mix1 * buf1[i][(int)read1];
+ r2val = mix2 * buf1[i][(int)read2];
+ break;
+ }
+
+ /* then write into buffer (w/ feedback) */
+
+ buf1[i][writer] =
+ in[i][j] +
+ feed1 * r1val +
+ feed2 * r2val;
+
+ /* update rw heads */
+ writer++;
+ writer %= bsize;
+
+ read1 += (double)speed1;
+ read2 += (double)speed2;
+
+ if (read1 >= bsize_float)
+ read1 = fmod(fabs(read1), bsize_float);
+ if (read2 >= bsize_float)
+ read2 = fmod(fabs(read2), bsize_float);
+
+ /* make output */
+ if (replacing)
+ outputs[i][j] = in[i][j] * drymix + r1val + r2val;
+ else
+ outputs[i][j] += in[i][j] * drymix + r1val + r2val;
+ }
+ }
+ }
+
+}
diff --git a/transverb/transverb~.pd b/transverb/transverb~.pd
new file mode 100644
index 0000000..7a4a7e3
--- /dev/null
+++ b/transverb/transverb~.pd
@@ -0,0 +1,65 @@
+#N canvas 246 28 678 727 10;
+#X floatatom 225 223 5 0 1;
+#X floatatom 239 239 5 -3 6;
+#X floatatom 252 255 5 0 1;
+#X floatatom 212 161 5 1 3000;
+#X floatatom 266 271 5 0 1;
+#X floatatom 279 321 5 0 1;
+#X floatatom 293 337 5 -3 6;
+#X floatatom 306 353 5 0 1;
+#X floatatom 320 369 5 0 1;
+#X obj 164 532 dac~ 1 2;
+#X obj 164 486 *~;
+#X obj 215 486 *~;
+#X obj 270 437 vsl 15 128 0 100 0 0 empty empty volume 0 -8 1 8 -143491
+-262144 -1 0 1;
+#X obj 199 93 readsf~ 2;
+#X msg 232 54 1;
+#X msg 453 16 0;
+#X msg 236 17 open ../../dresscode/0/3.wav;
+#X obj 338 54 t b;
+#X obj 336 80 delay 100;
+#X obj 266 53 delay 100;
+#X text 234 203 mix speed feed dist;
+#X text 290 303 mix speed feed dist;
+#X obj 199 393 transverb~ 0 1 0 1;
+#X obj 80 337 *~;
+#X obj 80 277 osc~ 14000;
+#X obj 96 245 osc~ 5;
+#X text 210 138 buffer size 1~3000;
+#X text 288 238 tape 1;
+#X text 340 336 tape 2;
+#X text 13 625 dfx_transverb is originally a VST plugin by destroy
+fx [ http://www.smartelectronix.com/~destroyfx ] ported to linux by
+martin pi 2002;
+#X text 343 393 creation arguments tomsound | quality | drymix | replacing
+;
+#X text 491 18 stop this shit;
+#X text 14 12 ____ _ dfx transverb _ by ____ destroy fx ___ _ and martin
+pi;
+#X connect 0 0 22 2;
+#X connect 1 0 22 3;
+#X connect 2 0 22 4;
+#X connect 3 0 22 1;
+#X connect 4 0 22 5;
+#X connect 5 0 22 6;
+#X connect 6 0 22 7;
+#X connect 7 0 22 8;
+#X connect 8 0 22 9;
+#X connect 10 0 9 0;
+#X connect 11 0 9 1;
+#X connect 12 0 11 1;
+#X connect 12 0 10 1;
+#X connect 13 0 22 0;
+#X connect 13 2 19 0;
+#X connect 14 0 13 0;
+#X connect 15 0 13 0;
+#X connect 16 0 13 0;
+#X connect 16 0 17 0;
+#X connect 17 0 18 0;
+#X connect 18 0 14 0;
+#X connect 19 0 16 0;
+#X connect 22 0 10 0;
+#X connect 22 0 11 0;
+#X connect 24 0 23 0;
+#X connect 25 0 23 1;