Add a modified internal version of libsox 14.4.2 to chromium vcbox directory
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..db177d4
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,28 @@
+# How to Contribute
+
+We'd love to accept your patches and contributions to this project. There are
+just a few small guidelines you need to follow.
+
+## Contributor License Agreement
+
+Contributions to this project must be accompanied by a Contributor License
+Agreement. You (or your employer) retain the copyright to your contribution;
+this simply gives us permission to use and redistribute your contributions as
+part of the project. Head over to <https://cla.developers.google.com/> to see
+your current agreements on file or to sign a new one.
+
+You generally only need to submit a CLA once, so if you've already submitted one
+(even if it was for a different project), you probably don't need to do it
+again.
+
+## Code reviews
+
+All submissions, including submissions by project members, require review. We
+use GitHub pull requests for this purpose. Consult
+[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
+information on using pull requests.
+
+## Community Guidelines
+
+This project follows
+[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7c46c35
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,845 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+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 and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, 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 library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+ 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 Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+ If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be 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.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+ 9. 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 Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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 with
+this License.
+
+ 11. 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 Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser 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 Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+-------------------------------------------------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..cf42297
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,3 @@
+jingmeng@chromium.org
+willhui@chromium.org
+
diff --git a/README.chromium b/README.chromium
new file mode 100644
index 0000000..f2b37ac
--- /dev/null
+++ b/README.chromium
@@ -0,0 +1,52 @@
+Name: sox
+URL: http://sourceforge.net/projects/sox/files/sox/
+Version: 14.4.2
+SoX source code is distributed under two main licenses. The two
+licenses are in the file LICENSE.
+
+sox.c, and thus SoX-the user application, is distributed under the
+GPL, while the files that make up libsox are licensed under the less
+restrictive LGPL.
+
+Note that some of the external packages that can be linked in to libsox
+are GPLed and/or may have licensing problems, so they can be disabled
+at configure time with the relevant--with-* options. If libsox is built
+with such libraries, it must be distributed under the GPL.
+
+Description:
+SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files, and, as an added bonus, SoX can play and record audio files on most platforms.
+Local Modifications:
+- BUILD:
+ - Removed the examples and sox test libraries (not the sox presence tests)
+ - Renamed the sox library to sox_lib
+ - Excluded sox.c from sox_lib (because it should only be in a binary)
+ - Removed -DLADSPA_PATH from sox cc_library
+ - Rewrite includes (by googlify)
+ - Under MSAN, unpoison the output of the fistpl instruction in effects_i_dsp.c
+ - Support seeking on memory buffers (https://sourceforge.net/p/sox/patches/109/)
+ - Add a redistributable_sox_lib
+- Patches applied:
+ - sox-14.4.2-wget_check_certificates.patch: Removed --no-check-certificate
+ flag from wget invocation in formats.c, since it is a security risk.
+ - sox-14.4.2-BUILD.patch: Post googlify-build patch.
+ - sox-14.4.2-sox.c.patch: sox.c diffs.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sox-14.4.2-BUILD.patch b/sox-14.4.2-BUILD.patch
new file mode 100644
index 0000000..3b8718f
--- /dev/null
+++ b/sox-14.4.2-BUILD.patch
@@ -0,0 +1,60 @@
+diff --git a/BUILD.orig b/BUILD
+index a3bb1c1..3c70cde 100644
+--- a/BUILD.orig
++++ b/BUILD
+@@ -18,25 +18,42 @@ package_group(
+ )
+
+ package(
++ default_copts = ["-DDISABLE_GOOGLE_GLOBAL_USING_DECLARATIONS"],
+ default_visibility = [
+ "//third_party/sox:internal",
+ ],
+ )
+
++# In order to comply with the libsox license, you cannot redistribute any
++# non-open source binary that depends on this build target (which statically
++# links libsox into your binary).
+ cc_inc_library(
+- name = "inc",
++ name = "sox",
+ hdrs = ["//third_party/sox/" + sox_version_dir + ":headers"],
+ prefix = sox_version_dir + "/src",
++ visibility = [
++ "//visibility:public",
++ ],
++ deps = [
++ "//third_party/sox/" + sox_version_dir,
++ ],
+ )
+
+-cc_library(
+- name = "sox",
++# If you need to redistribute your binary, depend on 'redistributable-sox'
++# instead of the plain 'sox' target above. This dynamically links against
++# libsox in order to comply with its LGPL license, and excludes any GPL
++# dependencies, such as libmad, from the libsox build. Since it is dynamically
++# linked, you will also need to distribute libsox.so along with your binary.
++cc_inc_library(
++ name = "redistributable-sox",
++ hdrs = ["//third_party/sox/" + sox_version_dir + ":headers"],
++ prefix = sox_version_dir + "/src",
+ visibility = [
+ "//visibility:public",
+ ],
+ deps = [
+- ":inc",
+- "//third_party/sox/" + sox_version_dir,
++ # Uses the libsox.so target to make the build redistributable.
++ "//third_party/sox/" + sox_version_dir + ":libsox.so",
+ ],
+ )
+
+@@ -53,6 +70,7 @@ genrule(
+ "sox_binary",
+ ],
+ cmd = "cp $< $@",
++ compatible_with = ["//buildenv/target:vendor"],
+ executable = 1,
+ visibility = [
+ "//visibility:public",
diff --git a/sox-14.4.2-sox.c.patch b/sox-14.4.2-sox.c.patch
new file mode 100644
index 0000000..9977c3e
--- /dev/null
+++ b/sox-14.4.2-sox.c.patch
@@ -0,0 +1,17 @@
+diff --git a/sox.c.orig b/src/src/sox.c
+index ea1a4de..fef004a 100644
+--- a/sox.c.orig
++++ b/src/src/sox.c
+@@ -2850,6 +2850,7 @@ static sox_bool cmp_comment_text(char const * c1, char const * c2)
+ return c1 && c2 && !strcasecmp(c1, c2);
+ }
+
++#ifndef SOX_NO_MAIN
+ int main(int argc, char **argv)
+ {
+ size_t i;
+@@ -3053,3 +3054,4 @@ int main(int argc, char **argv)
+
+ return 0;
+ }
++#endif
diff --git a/sox-14.4.2-wget_check_certificates.patch b/sox-14.4.2-wget_check_certificates.patch
new file mode 100644
index 0000000..81fb52b
--- /dev/null
+++ b/sox-14.4.2-wget_check_certificates.patch
@@ -0,0 +1,11 @@
+--- src/src/formats.c.orig 2015-02-23 13:37:22.000000000 +0100
++++ src/src/formats.c 2015-02-23 13:37:28.000000000 +0100
+@@ -390,7 +390,7 @@
+ else if (is_url(identifier)) {
+ FILE * f = NULL;
+ #ifdef HAVE_POPEN
+- char const * const command_format = "wget --no-check-certificate -q -O- \"%s\"";
++ char const * const command_format = "wget -q -O- \"%s\"";
+ char * command = lsx_malloc(strlen(command_format) + strlen(identifier));
+ sprintf(command, command_format, identifier);
+ f = popen(command, POPEN_MODE);
diff --git a/src/AUTHORS b/src/AUTHORS
new file mode 100644
index 0000000..e93bb75
--- /dev/null
+++ b/src/AUTHORS
@@ -0,0 +1,8 @@
+SoX is currently maintained by
+
+ Chris Bagwell cbagwell at users.sourceforge.net
+ Rob Sykes robs at users.sourceforge.net
+ Pascal Giard evilynux at users.sourceforge.net
+
+Many people contribute new features and bug fixes to SoX. See the
+ChangeLog file for records of all changes and contributors so far.
diff --git a/src/BUILD b/src/BUILD
new file mode 100644
index 0000000..adb1c0d
--- /dev/null
+++ b/src/BUILD
@@ -0,0 +1,365 @@
+# Description:
+# Sox is a cross-platform sound utility that can convert
+# between various audio formats. Sox can also apply various effects to sound
+# files.
+#
+
+licenses(["restricted"]) # LGPL
+
+exports_files(["LICENSE"])
+
+package(
+ default_hdrs_check = "loose",
+ features = [
+ "-layering_check",
+ "-parse_headers",
+ ],
+)
+
+SOX_INCLUDES = ["includes/third_party/sox/src"]
+
+SOX_LIB_HDRS = [
+ "src/sox.h",
+ "src/util.h",
+]
+
+SOX_LIB_COPTS = [
+ "-w",
+ "-DHAVE_CONFIG_H",
+ # Supported file formats
+ "-DHAVE_FLAC",
+ "-DHAVE_MP3",
+ "-DHAVE_LAME_398",
+ "-DHAVE_LAME_H",
+ "-DHAVE_OGG_VORBIS",
+]
+
+SOX_LIB_SRCS = [
+ "src/8svx.c",
+ "src/adpcm.c",
+ "src/adpcm.h",
+ "src/adpcms.c",
+ "src/adpcms.h",
+ "src/aifc-fmt.c",
+ "src/aiff.c",
+ "src/aiff.h",
+ "src/aiff-fmt.c",
+ "src/al-fmt.c",
+ "src/au.c",
+ "src/avr.c",
+ "src/bend.c",
+ "src/biquad.c",
+ "src/biquad.h",
+ "src/biquads.c",
+ "src/cdr.c",
+ "src/chorus.c",
+ "src/compand.c",
+ "src/compandt.c",
+ "src/compandt.h",
+ "src/contrast.c",
+ "src/cvsd.c",
+ "src/cvsd.h",
+ "src/cvsd-fmt.c",
+ "src/dat.c",
+ "src/dcshift.c",
+ "src/delay.c",
+ "src/dft_filter.c",
+ "src/dft_filter.h",
+ "src/dither.c",
+ "src/dither.h",
+ "src/divide.c",
+ "src/downsample.c",
+ "src/dvms-fmt.c",
+ "src/earwax.c",
+ "src/echo.c",
+ "src/echos.c",
+ "src/effects.c",
+ "src/effects.h",
+ "src/effects_i.c",
+ "src/effects_i_dsp.c",
+ "src/f4-fmt.c",
+ "src/f8-fmt.c",
+ "src/fade.c",
+ "src/fft4g.c",
+ "src/fft4g.h",
+ "src/fir.c",
+ "src/firfit.c",
+ "src/flac.c",
+ "src/flanger.c",
+ "src/formats.c",
+ "src/formats.h",
+ "src/formats_i.c",
+ "src/g711.c",
+ "src/g711.h",
+ "src/g721.c",
+ "src/g723_24.c",
+ "src/g723_40.c",
+ "src/g72x.c",
+ "src/g72x.h",
+ "src/gain.c",
+ "src/getopt.c",
+ "src/gsm.c",
+ "src/gsrt.c",
+ "src/hcom.c",
+ "src/hilbert.c",
+ "src/htk.c",
+ "src/ima-fmt.c",
+ "src/ima_rw.c",
+ "src/ima_rw.h",
+ "src/input.c",
+ "src/la-fmt.c",
+ "src/ladspa.c",
+ "src/libsox.c",
+ "src/libsox_i.c",
+ "src/loudness.c",
+ "src/lpc10.c",
+ "src/lu-fmt.c",
+ "src/maud.c",
+ "src/mcompand.c",
+ "src/mp3.c",
+ "src/noiseprof.c",
+ "src/noisered.c",
+ "src/noisered.h",
+ "src/nulfile.c",
+ "src/oss.c",
+ "src/output.c",
+ "src/overdrive.c",
+ "src/pad.c",
+ "src/phaser.c",
+ "src/prc.c",
+ "src/rate.c",
+ "src/raw.c",
+ "src/raw.h",
+ "src/raw-fmt.c",
+ "src/remix.c",
+ "src/repeat.c",
+ "src/reverb.c",
+ "src/reverse.c",
+ "src/s1-fmt.c",
+ "src/s2-fmt.c",
+ "src/s3-fmt.c",
+ "src/s4-fmt.c",
+ "src/sf.c",
+ "src/silence.c",
+ "src/sinc.c",
+ "src/skeleff.c",
+ "src/skelform.c",
+ "src/smp.c",
+ "src/sounder.c",
+ "src/soundtool.c",
+ "src/sox-fmt.c",
+ "src/sox_i.h",
+ "src/speed.c",
+ "src/sphere.c",
+ "src/splice.c",
+ "src/stat.c",
+ "src/stats.c",
+ "src/stretch.c",
+ "src/swap.c",
+ "src/synth.c",
+ "src/tempo.c",
+ "src/tremolo.c",
+ "src/trim.c",
+ "src/tx16w.c",
+ "src/u1-fmt.c",
+ "src/u2-fmt.c",
+ "src/u3-fmt.c",
+ "src/u4-fmt.c",
+ "src/ul-fmt.c",
+ "src/upsample.c",
+ "src/util.c",
+ "src/vad.c",
+ "src/voc.c",
+ "src/vol.c",
+ "src/vorbis.c",
+ "src/vox.c",
+ "src/vox.h",
+ "src/vox-fmt.c",
+ "src/wav.c",
+ "src/wve.c",
+ "src/xa.c",
+ "src/xmalloc.c",
+ "src/xmalloc.h",
+]
+
+filegroup(
+ name = "headers",
+ srcs = glob(
+ [
+ "src/*.h",
+ ],
+ exclude = ["src/win32-*.h"],
+ ),
+)
+
+cc_library(
+ name = "lpc10",
+ srcs = [
+ "lpc10/analys.c",
+ "lpc10/bsynz.c",
+ "lpc10/chanwr.c",
+ "lpc10/dcbias.c",
+ "lpc10/decode.c",
+ "lpc10/deemp.c",
+ "lpc10/difmag.c",
+ "lpc10/dyptrk.c",
+ "lpc10/encode.c",
+ "lpc10/energy.c",
+ "lpc10/f2c.h",
+ "lpc10/f2clib.c",
+ "lpc10/ham84.c",
+ "lpc10/hp100.c",
+ "lpc10/invert.c",
+ "lpc10/irc2pc.c",
+ "lpc10/ivfilt.c",
+ "lpc10/lpcdec.c",
+ "lpc10/lpcenc.c",
+ "lpc10/lpcini.c",
+ "lpc10/lpfilt.c",
+ "lpc10/median.c",
+ "lpc10/mload.c",
+ "lpc10/onset.c",
+ "lpc10/pitsyn.c",
+ "lpc10/placea.c",
+ "lpc10/placev.c",
+ "lpc10/preemp.c",
+ "lpc10/prepro.c",
+ "lpc10/random.c",
+ "lpc10/rcchk.c",
+ "lpc10/synths.c",
+ "lpc10/tbdm.c",
+ "lpc10/voicin.c",
+ "lpc10/vparms.c",
+ ],
+ hdrs = ["lpc10/lpc10.h"],
+ compatible_with = ["//buildenv/target:vendor"],
+ copts = [
+ "-w",
+ "-DHAVE_CONFIG_H",
+ ],
+ includes = SOX_INCLUDES,
+ linkopts = [
+ "-lm",
+ ],
+)
+
+cc_library(
+ name = "gsm",
+ srcs = [
+ "libgsm/add.c",
+ "libgsm/code.c",
+ "libgsm/decode.c",
+ "libgsm/gsm_create.c",
+ "libgsm/gsm_decode.c",
+ "libgsm/gsm_destroy.c",
+ "libgsm/gsm_encode.c",
+ "libgsm/gsm_option.c",
+ "libgsm/long_term.c",
+ "libgsm/lpc.c",
+ "libgsm/preprocess.c",
+ "libgsm/private.h",
+ "libgsm/rpe.c",
+ "libgsm/short_term.c",
+ "libgsm/table.c",
+ ],
+ hdrs = ["libgsm/gsm.h"],
+ compatible_with = ["//buildenv/target:vendor"],
+ copts = [
+ "-w",
+ "-DFAST",
+ "-DHAVE_CONFIG_H",
+ "-DSASR",
+ "-DWAV49",
+ ],
+ includes = SOX_INCLUDES,
+ linkopts = [
+ "-lm",
+ ],
+)
+
+cc_library(
+ name = "sox_lib",
+ srcs = SOX_LIB_SRCS,
+ hdrs = SOX_LIB_HDRS,
+ compatible_with = ["//buildenv/target:vendor"],
+ copts = SOX_LIB_COPTS + [
+ "-DHAVE_MAD_H", # prefer libmad over lame
+ ],
+ includes = SOX_INCLUDES,
+ deps = [
+ ":gsm",
+ ":lpc10",
+ "//third_party/flac",
+ "//third_party/lame/v3_99_5:lame",
+ "//third_party/libmad",
+ "//third_party/libogg",
+ "//third_party/libvorbis",
+ ],
+)
+
+cc_library(
+ name = "redistributable_sox_lib",
+ srcs = SOX_LIB_SRCS,
+ hdrs = SOX_LIB_HDRS,
+ compatible_with = ["//buildenv/target:vendor"],
+ copts = SOX_LIB_COPTS + ["-DSOX_NO_MAIN"],
+ includes = SOX_INCLUDES,
+ deps = [
+ ":gsm",
+ ":lpc10",
+ "//third_party/flac",
+ "//third_party/lame/v3_99_5:lame",
+ "//third_party/libogg",
+ "//third_party/libvorbis",
+ ],
+)
+
+cc_binary(
+ name = "sox",
+ srcs = [
+ "src/sox.c",
+ ],
+ compatible_with = ["//buildenv/target:vendor"],
+ copts = [
+ "-w",
+ "-DHAVE_CONFIG_H",
+ ],
+ includes = SOX_INCLUDES,
+ visibility = ["//visibility:public"],
+ deps = [
+ ":sox_lib",
+ ],
+)
+
+cc_binary(
+ name = "libsox.so",
+ srcs = [
+ "src/sox.c",
+ ],
+ compatible_with = ["//buildenv/target:vendor"],
+ copts = [
+ "-w",
+ "-DHAVE_CONFIG_H",
+ ],
+ includes = SOX_INCLUDES,
+ linkshared = 1,
+ visibility = ["//visibility:public"],
+ deps = [
+ ":redistributable_sox_lib",
+ ],
+)
+
+cc_library(
+ name = "src",
+ srcs = [
+ "google-sox-14.4.2.c",
+ ],
+ copts = [
+ "-w",
+ "-DHAVE_CONFIG_H",
+ ],
+ includes = SOX_INCLUDES,
+ deps = [
+ ":sox_lib",
+ ],
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..9357cef
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,203 @@
+cmake_minimum_required(VERSION 2.4)
+include(CheckIncludeFiles)
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+
+macro(optional variable header library function source)
+ check_include_files(${header} ${variable}1)
+ if (${variable}1)
+ check_library_exists(${library} ${function} "" ${variable})
+ if (${variable})
+ set(optional_srcs ${optional_srcs} ${source})
+ set(optional_libs ${optional_libs} ${library})
+ endif (${variable})
+ endif (${variable}1)
+endmacro(optional)
+
+macro(optional2 variable header library1 function1 library2 function2 source)
+ check_include_files(${header} ${variable}1)
+ if (${variable}1)
+ check_library_exists(${library1} ${function1} "" ${variable}2)
+ if (${variable}2)
+ check_library_exists(${library2} ${function2} "" ${variable})
+ if (${variable})
+ set(optional_srcs ${optional_srcs} ${source})
+ set(optional_libs ${optional_libs} ${library1} ${library2})
+ endif (${variable})
+ endif (${variable}2)
+ endif (${variable}1)
+endmacro(optional2)
+
+macro(optional3 variable header library1 function1 library2 function2 library3 function3 source)
+ check_include_files(${header} ${variable}1)
+ if (${variable}1)
+ check_library_exists(${library1} ${function1} "" ${variable}2)
+ if (${variable}2)
+ check_library_exists(${library2} ${function2} "" ${variable}3)
+ if (${variable}3)
+ check_library_exists(${library3} ${function3} "" ${variable})
+ if (${variable})
+ set(optional_srcs ${optional_srcs} ${source})
+ set(optional_libs ${optional_libs} ${library1} ${library2} ${library3})
+ endif (${variable})
+ endif (${variable}3)
+ endif (${variable}2)
+ endif (${variable}1)
+endmacro(optional3)
+
+macro(optional4 variable header library1 function1 library2 function2 library3 function3 library4 function4 source)
+ check_include_files(${header} ${variable}1)
+ if (${variable}1)
+ check_library_exists(${library1} ${function1} "" ${variable}2)
+ if (${variable}2)
+ check_library_exists(${library2} ${function2} "" ${variable}3)
+ if (${variable}3)
+ check_library_exists(${library3} ${function3} "" ${variable}4)
+ if (${variable}4)
+ check_library_exists(${library4} ${function4} "" ${variable})
+ if (${variable})
+ set(optional_srcs ${optional_srcs} ${source})
+ set(optional_libs ${optional_libs} ${library1} ${library2} ${library3} ${library4})
+ endif (${variable})
+ endif (${variable}4)
+ endif (${variable}3)
+ endif (${variable}2)
+ endif (${variable}1)
+endmacro(optional4)
+
+project(sox C)
+
+if(CMAKE_COMPILER_IS_GNUCC)
+ add_definitions(-fstack-protector -Wall -W -Wmissing-prototypes -Wstrict-prototypes -pedantic -Wno-format -Wno-long-long)
+endif(CMAKE_COMPILER_IS_GNUCC)
+
+include(TestBigEndian)
+
+check_include_files("byteswap.h" HAVE_BYTESWAP_H)
+check_include_files("inttypes.h" HAVE_INTTYPES_H)
+check_include_files("fenv.h" HAVE_FENV_H)
+check_include_files("glob.h" HAVE_GLOB_H)
+check_include_files("io.h" HAVE_IO_H)
+#check_include_files("ltdl.h" HAVE_LTDL_H) # no plug-ins as yet
+check_include_files("stdint.h" HAVE_STDINT_H)
+check_include_files("string.h" HAVE_STRING_H)
+check_include_files("strings.h" HAVE_STRINGS_H)
+check_include_files("sys/stat.h" HAVE_SYS_STAT_H)
+check_include_files("sys/time.h" HAVE_SYS_TIME_H)
+check_include_files("sys/timeb.h" HAVE_SYS_TIMEB_H)
+check_include_files("sys/types.h" HAVE_SYS_TYPES_H)
+check_include_files("sys/utsname.h" HAVE_SYS_UTSNAME_H)
+check_include_files("termios.h" HAVE_TERMIOS_H)
+check_include_files("unistd.h" HAVE_UNISTD_H)
+
+check_function_exists("fmemopen" HAVE_FMEMOPEN)
+check_function_exists("fseeko" HAVE_FSEEKO)
+check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY)
+check_function_exists("mkstemp" HAVE_MKSTEMP)
+check_function_exists("popen" HAVE_POPEN)
+check_function_exists("strcasecmp" HAVE_STRCASECMP)
+check_function_exists("strrstr" HAVE_STRRSTR)
+check_function_exists("vsnprintf" HAVE_VSNPRINTF)
+
+test_big_endian(WORDS_BIGENDIAN)
+
+optional(NEED_LIBM math.h m pow "")
+if(NEED_LIBM)
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lm)
+ optional(HAVE_LRINT math.h m lrint "")
+else(NEED_LIBM)
+ check_function_exists("lrint" HAVE_LRINT)
+endif(NEED_LIBM)
+optional(EXTERNAL_GSM gsm/gsm.h gsm gsm_create "")
+optional(EXTERNAL_LPC10 lpc10/lpc10.h lpc10 lpc10_create "")
+optional(HAVE_ALSA alsa/asoundlib.h asound snd_pcm_open alsa)
+optional(HAVE_AMRNB amrnb/sp_dec.h amrnb Decoder_Interface_init amr-nb)
+optional(HAVE_AMRWB amrwb/dec.h amrwb D_IF_init amr-wb)
+if(CMAKE_COMPILER_IS_GNUCC)
+ optional(HAVE_GOMP omp.h gomp omp_get_thread_num "")
+ if(HAVE_GOMP)
+ add_definitions(-fopenmp)
+ endif(HAVE_GOMP)
+endif(CMAKE_COMPILER_IS_GNUCC)
+optional(HAVE_ID3TAG id3tag.h id3tag id3_file_open "")
+optional(HAVE_SNDIO sndio.h sndio sio_open sndio)
+optional(HAVE_AO ao/ao.h ao ao_play ao)
+optional(HAVE_FLAC FLAC/all.h FLAC FLAC__stream_encoder_new flac)
+optional(HAVE_MAD_H mad.h mad mad_stream_buffer mp3)
+optional(HAVE_LAME_LAME_H lame/lame.h mp3lame lame_get_lametag_frame mp3)
+if (NOT HAVE_LAME_LAME_H)
+ optional(HAVE_LAME_LAME_H lame.h mp3lame lame_get_lametag_frame mp3)
+endif (NOT HAVE_LAME_LAME_H)
+optional(HAVE_TWOLAME_H twolame.h twolame twolame_init mp3)
+optional(HAVE_MAGIC magic.h magic magic_open "")
+optional2(HAVE_PNG png.h png png_set_rows z uncompress spectrogram)
+if (HAVE_PNG)
+ check_library_exists(z uncompress "" spectrogram1)
+ if (${spectrogram1})
+ set(optional_libs ${optional_libs} z)
+ endif (${spectrogram1})
+endif (HAVE_PNG)
+optional2(HAVE_PULSEAUDIO pulse/simple.h pulse-simple pa_simple_new pulse pa_strerror pulseaudio)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual sndfile)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual caf)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual fap)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual mat4)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual mat5)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual paf)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual pvf)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual sd2)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual w64)
+optional(HAVE_SNDFILE sndfile.h sndfile sf_open_virtual xi)
+optional(HAVE_SPEEXDSP speex/speex_preprocess.h speexdsp speex_preprocess_run speexdsp)
+optional(HAVE_SUN_AUDIOIO_H sun/audioio.h c ioctl sunaudio)
+if (NOT HAVE_SUN_AUDIOIO_H)
+ optional(HAVE_SYS_AUDIOIO_H sys/audioio.h c ioctl sunaudio)
+endif (NOT HAVE_SUN_AUDIOIO_H)
+optional(HAVE_SYS_SOUNDCARD_H sys/soundcard.h c ioctl oss)
+if (NOT HAVE_SYS_SOUNDCARD_H)
+ optional(HAVE_MACHINE_SOUNDCARD_H machine/soundcard.h ossaudio _oss_ioctl oss)
+endif (NOT HAVE_SYS_SOUNDCARD_H)
+optional(HAVE_WAVEAUDIO mmsystem.h winmm waveInGetDevCapsA waveaudio)
+optional4(HAVE_OGG_VORBIS vorbis/codec.h ogg ogg_stream_flush vorbis vorbis_analysis_headerout vorbisfile ov_clear vorbisenc vorbis_encode_init_vbr vorbis)
+optional3(HAVE_OPUS opusfile.h ogg ogg_stream_flush opus opus_encoder_create opusfile op_open_callbacks opus)
+optional(HAVE_WAVPACK wavpack/wavpack.h wavpack WavpackGetSampleRate wavpack)
+
+if (HAVE_LAME_LAME_H OR HAVE_MAD_H)
+ set(HAVE_MP3 1)
+endif (HAVE_LAME_LAME_H OR HAVE_MAD_H)
+
+set(CMAKE_REQUIRED_LIBRARIES mp3lame m)
+check_function_exists("lame_set_VBR_quality" HAVE_LAME_SET_VBR_QUALITY)
+
+if (HAVE_SUN_AUDIOIO_H OR HAVE_SYS_AUDIOIO_H)
+ set(HAVE_SUN_AUDIO 1)
+endif (HAVE_SUN_AUDIOIO_H OR HAVE_SYS_AUDIOIO_H)
+
+if (HAVE_SYS_SOUNDCARD_H OR HAVE_MACHINE_SOUNDCARD_H)
+ set(HAVE_OSS 1)
+endif (HAVE_SYS_SOUNDCARD_H OR HAVE_MACHINE_SOUNDCARD_H)
+
+configure_file(sox.pc.in sox.pc @ONLY)
+install_files(/lib/pkgconfig FILES sox.pc)
+
+subdirs(src)
+
+if (NOT EXTERNAL_GSM)
+ add_subdirectory(libgsm)
+endif (NOT EXTERNAL_GSM)
+
+if (NOT EXTERNAL_LPC10)
+ add_subdirectory(lpc10)
+endif (NOT EXTERNAL_LPC10)
+
+if(APPLE)
+ find_library(COREAUDIO_LIBRARY CoreAudio)
+ mark_as_advanced(COREAUDIO_LIBRARY)
+ if(COREAUDIO_LIBRARY)
+ set(HAVE_COREAUDIO 1)
+ set(optional_srcs ${optional_srcs} coreaudio)
+ endif(COREAUDIO_LIBRARY)
+ set(optional_libs ${optional_libs} ${COREAUDIO_LIBRARY})
+endif(APPLE)
+
+
diff --git a/src/COPYING b/src/COPYING
new file mode 100644
index 0000000..84ac4c8
--- /dev/null
+++ b/src/COPYING
@@ -0,0 +1,11 @@
+SoX source code is distributed under two main licenses. The two
+licenses are in the files LICENSE.GPL and LICENSE.LGPL.
+
+sox.c, and thus SoX-the user application, is distributed under the
+GPL, while the files that make up libsox are licensed under the less
+restrictive LGPL.
+
+Note that some of the external packages that can be linked into libsox
+are GPLed and/or may have licensing problems, so they can be disabled
+at configure time with the relevant--with-* options. If libsox is built
+with such libraries, it must be distributed under the GPL.
diff --git a/src/ChangeLog b/src/ChangeLog
new file mode 100644
index 0000000..809b43f
--- /dev/null
+++ b/src/ChangeLog
@@ -0,0 +1,1759 @@
+Change History
+--------------
+
+This file contains a list of all changes starting after the release of
+sox-11gamma, followed by a list of prior authors and features.
+
+$ox-14.4.2 2015-02-22
+----------
+
+Previously deprecated features that have been removed in this release:
+
+ Deprec- Feature [O(ption)]
+ ated in [F(ormat)] [E(ffect)] Replacement
+ ------- ---------------------- ----------------------
+ 14.3.0 O -1/-2/-3/-4/-8 -b
+ 14.3.0 O -s/-u/-f -e
+ 14.3.0 O -A/-U/-o/-i/-a/-g -e
+ 14.4.0 E swap with parameters remix
+ 14.4.0 E mixer remix
+ 14.4.1 OpenMP < 3.0 OpenMP >= 3.0
+ 14.4.1 F ffmpeg ffmpeg/avconv via pipe
+
+File formats:
+
+ o Add optional support for reading Ogg Opus files. (John Stumpo)
+ o Fix for max size text chunks in aiff files. (cbagwell)
+ o Add reading support for RF64 WAV files. (Dave Lambley)
+ o Work around for libsndfile created RF64 files with invalid
+ sizes. (Dave Lambley)
+ o Detect MS ADPCM WAV files with invalid blocks. (cbagwell)
+ o Detect Sphere files with invalid header sizes. (cbagwell)
+
+Effects:
+
+ o 'Deemph' can now also be used at 48kHz sample rate. (robs)
+ o 'Rate' now much faster in many cases. (robs)
+ o Allow sending spectrograms to stdout. (Ulrich Klauer)
+ o Allow use of Dolph window with spectrograms. (robs)
+ o Allow mixing time and sample-count arguments for the delay
+ effect, and for spectrogram -S and -d. (Ulrich Klauer)
+ o Support multi-channel LADSPA plugins. (Eric Wong)
+ o Support infinite repetition with repeat. (Ulrich Klauer)
+ o Improved pink noise frequency response in synth. (robs)
+ o Extended syntax for specifying audio positions to several
+ effects. (Ulrich Klauer)
+ o Fix integer overflow in mcompand. [3590093] (Guido Aulisi)
+ o Add optional latency compenstation for LADSPA plugins. (Eric Wong)
+
+Other new features:
+
+ o New -p option for soxi to display sample precision. (Ulrich Klauer)
+ o New libsox example6: give explicit output attributes. (robs)
+
+Internal improvements:
+
+ o Speed optimization for effects that operate on channels
+ independently. (Ulrich Klauer)
+ o Fix memory leaks. (Ulrich Klauer)
+ o Most internal symbols (lsx_*) are no longer exported. (Ulrich Klauer)
+
+
+sox-14.4.1 2013-02-01
+----------
+
+Newly deprecated features (to be removed in future):
+
+ Deprec- Feature [O(ption)] Removal
+ ated in [F(ormat)] [E(ffect)] Replacement due after
+ ------- ---------------------- ---------------------- -------
+ 14.4.1 OpenMP < 3.0 OpenMP >= 3.0 14.4.1
+ 14.4.1 F ffmpeg ffmpeg/avconf via pipe 14.4.1
+
+File formats:
+
+ o Fix pipe file-type detection regression. (robs)
+ o MAUD write fixes. [3507927] (Carl Eric Codere and Ulrich Klauer)
+ o Fix crash when seeking within a FLAC file. [3476843] (Eric Wong)
+ o Fix Ogg Vorbis files with certain numbers of channels being
+ truncated. (Ulrich Klauer)
+ o Fix reading 64-bit float WAVs. [3481510] (nu774 and Ulrich Klauer)
+ o Fix potential buffer overrun when writing FLAC files directly via
+ sox_write(). [3474924] (Eric Wong)
+
+Audio device drivers:
+
+ o Check whether pulseaudio is available before choosing it as
+ default. (robs)
+
+Effects:
+
+ o Restore 8 seconds default for spectrogram, if the input length is
+ not known. (Ulrich Klauer)
+ o Set output length for splice to unknown instead of 0. (Ulrich Klauer)
+ o Increase maximum width for spectrograms. (Ulrich Klauer)
+ o Fix memory leaks in LADSPA effect. (Eric Wong)
+ o Fix hang in several effects (rate, tempo, and those based on
+ dft_filter) when processing long files. [3592482, 3594822] (MrMod)
+ o Prevent (m)compand from tampering with their arguments. (Ulrich Klauer)
+
+Other bug fixes:
+
+ o Fix input length calculation for combine methods other than
+ concatenate. (Ulrich Klauer)
+ o Fix to configure.ac to work with Autoconf 2.69. [3600293] (cbagwell)
+ o Use binary mode for pipes on all Windows compilers, rather than
+ MSVC only. [3602130] (Ulrich Klauer)
+
+
+sox-14.4.0 2012-03-04
+----------
+
+Previously deprecated features that have been removed in this release:
+
+ Deprec- Feature [O(ption)]
+ ated in [F(ormat)] [E(ffect)] Replacement
+ ------- ---------------------- ----------------------
+ 14.3.0 O --interactive --no-clobber
+ 14.3.0 E filter ~= sinc
+ 14.3.0 E norm -b, norm -i gain -B, gain -en
+ 14.3.0 PLAY_RATE_ARG SOX_OPTS
+ 14.2.0 E key alias pitch
+ 14.2.0 E pan ~= remix
+ 14.1.0 E resample alias rate
+ 14.1.0 E polyphase alias rate
+ 14.1.0 E rabbit alias rate
+ 14.3.1 F sndfile: sndfile 1.0.11 sndfile > 1.0.11
+ 14.3.0 F flac: libFLAC < 1.1.3 libFLAC >= 1.1.3
+ 14.3.1 F mp3: lame 3.97 lame > 3.97
+
+Newly deprecated features (to be removed in future):
+
+ Deprec- Feature [O(ption)] Removal
+ ated in [F(ormat)] [E(ffect)] Replacement due after
+ ------- ---------------------- ---------------------- -------
+ 14.4.0 E mixer remix 14.4.0 + 1 year
+ 14.4.0 E swap with parameters remix 14.4.0
+
+Previously deprecated features (to be removed in future):
+
+ Deprec- Feature [O(ption)] Removal
+ ated in [F(ormat)] [E(ffect)] Replacement due after
+ ------- ---------------------- ---------------------- -------
+ 14.3.0 O -1/-2/-3/-4/-8 -b 14.4.0
+ 14.3.0 O -s/-u/-f -e 14.4.0
+ 14.3.0 O -A/-U/-o/-i/-a/-g -e 14.4.0
+
+File formats:
+
+ o Mention in man pages that WAV files support floating point encodings.
+ o Add support for floating point encodings in AIFF-C files. (Ulrich Klauer)
+ o Pad WAV data chunk to an even number of bytes (as required by the
+ specification). [3203418] (Ulrich Klauer)
+ o Add optional MP2 write support with twolame library. (Paul Kelly)
+
+Audio device drivers:
+
+ o Give pulseaudio driver higher priority than alsa or oss now that
+ its proven stable and gives user more features; such as per app
+ volume control. (cbagwell)
+ o Fix bug when specifying OSX coreaudio device name. Would only
+ search for first 3 devices. (cbagwell)
+ o Fix sox hangups are exit when using coreaudio. (cbagwell)
+ o Improve buffering in coreaudio driver (Michael Chen)
+ o Support enabling play/rec mode when user invokes sox as either
+ play or play.exe on windows. (cbagwell)
+ o Fix compile of sunaudio driver on OpenBSD (cbagwell)
+
+Effects:
+
+ o Improvements to man pages for tempo effect. Really made in 14.3.2.
+ (Jim Harkins).
+ o New upsample effect. (robs)
+ o Fix to effects pipeline to let fade effect specify time from end of
+ file again. (cbagwell and Thor Andreassen)
+ o Fix man page default error for splice effect. (Ulrich Klauer)
+ o Enable support for --plot option on biquad and fir effects. (Ulrich Klauer)
+ o Effects chain can now be unlimited in length. (Ulrich Klauer)
+ o Fix newfile/restart effects when merging or mixing files. (Ulrich Klauer)
+ o Fix crashes in compand and mcompand effects. [3420893] (Ulrich Klauer)
+ o Let the delay effect gracefully handle the special case that a delay can
+ be more than the input length. [3055399] (Ulrich Klauer)
+ o New hilbert and downsample effects. (Ulrich Klauer)
+ o Fix problem where fade would sometimes fail if specifying a fade-out
+ immediately after a fade-in. (robs)
+ o Stricter syntax checking for several effects (might reveal bugs hidden
+ in existing scripts). (Ulrich Klauer)
+ o Calculate output audio length for most effects. (Ulrich Klauer)
+ o Fix problems with several effects when the buffer size was not evenly
+ divisible by the number of channels. [3420899] (Ulrich Klauer)
+ o Complete rewrite of the trim effect with extended syntax (backwards
+ compatible) and capabilities. [FR 2941349] (Ulrich Klauer)
+ o Fix trim optimization unexpectedly seeking backwards. (Ulrich Klauer)
+ o Prevent samples from getting lost at effects chain transitions in
+ multiple effects chain/multiple output modes. (Ulrich Klauer)
+
+Misc:
+
+ o Minor improvements to the man page. (Ulrich Klauer)
+ o When using pipes (-p) on Windows, set file mode to binary. (cbagwell)
+ o Updated .dat format description in soxformat. (Jan Stary)
+ o Doxygen documentation for libSoX. (Doug Cook)
+
+Other bug fixes:
+
+ o Fix several memory leaks. [3309913] (Jin-Myung Won and Ulrich Klauer)
+ o Fixed crashes in apps that call sox_format_init/quit() multiple times.
+ (cbagwell)
+
+Internal improvements:
+
+ o Added use_threads variable to sox_globals. This should be used to enable
+ or disable use of parallel effects processing instead of directly calling
+ omp_set_num_threads. (Doug Cook)
+ o Fix compiler warnings. (Cristian Morales Vega [P. 3072301], Doug Cook)
+ o Improve large file support by using 64-bit numbers to count
+ samples. (Doug Cook, Thor Andreassen, Ulrich Klauer)
+
+
+sox-14.3.2 2011-02-27
+----------
+
+File formats:
+
+ o Add seek support to mp3 handler for speed improvements. (Pavel Karneliuk)
+ o Fix bug were WavPack header was not updated correctly when closing
+ file. Fixed libsox memory leak when closing WavPack files.
+ (David Bryant)
+ o Fix RIFF chunk length error when writing 24-bit files. (David Bryant)
+ o 24-bit WAV files were leaving channel maps unassigned. Change to use
+ common channel mappings based on channel count. This allows to
+ work more seemlessly with other apps such as WavPack and Foobar2000.
+ (David Bryant)
+ o Fix ffmpeg playback bug caused by alignment requirements on some platforms.
+ Closes bug #3017690. (Reuben Thomas).
+ o Fix memory leak in ffmpeg. (Doug Cook)
+ o Handle 0 length chunks in WAV files gracefully. (Beat Jorg)
+ o When skipping over chunks, account for word alignment. Helps
+ with some Logic Pro generated files. (D Lambley)
+ o Fix incorrect MP3 file length determination with VBR & .5s initial
+ silence. (robs)
+
+Audio device drivers:
+
+ o Fix immediate segfault on OSX while attempting to record. (Adam Fritzler)
+ o Fix segfault on OSX playback for some HW that gives smaller then
+ requested buffers. (cbagwell)
+ o Clean up system resource in coreaudio on close. Allows running
+ back-to-back open()/close()'s without exiting app first. (cbagwell)
+ o Add support for 32-bit samples to OSS driver. (Eric Lammerts)
+ o Add support for 24 and 32-bit samples to waveaudio (Win32) driver.
+ (Doug Cook)
+ o Support specifying audio device other than default on OSX (cbagwell)
+
+Effects:
+
+ o F.R. [3051700] spectrogram -r for `raw' spectrogram, no legend. (robs)
+ o Fix -w option on stats effect. (Ronald Sprouse)
+ o Fix segfault with some ladspa plugins (Thor Andreassen)
+ o Optionally look for png.h in libpng directory to support OpenBSD
+ packaging. Helps enable spectrograph effect. (cbagwell)
+ o libpng15 requires application to include zlib.h header file. (cbagwell)
+ Add this to spectrograph effect. [3184238]
+ o Enable LADSPA effects on all platforms without any external
+ dependencies. Mainly useful for Linux, Windows and OS X which have
+ binaries readily available. (cbagwell)
+ o Support specifying an absolute end location for trim effect instead
+ only an offset from trim begin location. (Ulrich Klauer)
+ o Fix regression where MP3 handler required libmad headers to be installed.
+ (Samuli Suominen)
+ o Allow dynamic loading of lame to be enabled even if lame header files
+ are not installed. (Doug Cook)
+
+Other new features:
+
+ o Soxi now reports duration of AMR files. (robs)
+ o Document the "multiple" combine option in man pages and in
+ usage output (Ulrich Klauer).
+
+Internal improvements:
+
+ o Distribute msvc9 project files that had been in CVS only. (cbagwell)
+ o Add msvc10 project files (also compatible with the Windows SDK 7.1).
+ (Doug Cook)
+ o cmake now compiles waveaudio driver under windows environment. (cbagwell)
+ [3072672]
+
+sox-14.3.1 2010-04-11
+----------
+
+Newly deprecated features (to be removed in future):
+
+ Deprec- Feature [O(ption)] Removal
+ ated in [F(ormat)] [E(ffect)] Replacement due after
+ ------- ---------------------- ---------------------- -------
+ 14.3.1 F mp3: lame 3.97 lame > 3.97 2011-04-11
+ 14.3.1 F sndfile: sndfile 1.0.11 sndfile > 1.0.11 14.3.1
+
+Previously deprecated features (to be removed in future):
+
+ Deprec- Feature [O(ption)] Removal
+ ated in [F(ormat)] [E(ffect)] Replacement due after
+ ------- ---------------------- ---------------------- -------
+ 14.2.0 E key alias pitch 14.3.1
+ 14.2.0 E pan ~= mixer/remix 14.3.1
+ 14.3.0 F flac: libFLAC 1.1.2,3 libFLAC > 1.1.3 14.3.1
+ 14.3.0 PLAY_RATE_ARG SOX_OPTS 14.3.1
+ 14.3.0 E norm -b, norm -i gain -B, gain -en 2010-06-14
+ 14.3.0 E filter ~=sinc 2010-06-14
+ 14.1.0 E resample alias rate 2010-06-14
+ 14.1.0 E polyphase alias rate 2010-06-14
+ 14.1.0 E rabbit alias rate 2010-06-14
+
+LibSoX interface changes:
+
+ o Added new variants of sox_open to allow read/write from/to memory
+ buffers (in POSIX 2008 environment); see example5.c. (robs)
+
+File formats:
+
+ o New Grandstream ring-tone (gsrt) format. (robs)
+ o CVSD encode/decode speed-ups. (Kimberly Rockwell, P. Chaintreuil)
+ o Add ability to select MP3 compression parameters. (Jim Harkins)
+ o Now writes out ID3-tags in MP3 files with lame supports it. (Doug Cook)
+ o Also can write VBR Tag ("XING Header") in MP3 files. (Jim Hark /
+ Doug Cook)
+ o Increase percision of MP3 encoders to use 24-bits instead of
+ 16-bits. (Doug Cook)
+ o Fix failed writing 24-bit PAF files (and possibly other libsndfile
+ based formats). (cbagwell)
+ o Allow libsndfile to be dlopen()'ed at runtime if --enable-dl-sndfile
+ is used. (Doug Cook)
+ o Allow amr-nb/amr-wb to be dlopen()'ed at runtime if
+ --enable-dl-amrwb or --enable-dl-amrnb is used. (Doug Cook)
+ o amrnb and amrwb formats can optionally use opencore-amr libraries.
+ (cbagwell)
+
+Audio device drivers:
+
+ o Add native windows audio driver. (Pavel Karneliuk, Doug Cook)
+ o Add 32-bit support to ALSA driver. (Pavel Hofman)
+ o Make OpenBSD sndio audio driver default over older sunau driver.
+ (cbagwell)
+
+Effects:
+
+ o Fix [2254919] silence doesn't trim digital silence correctly. (robs)
+ o Fix [2859842] stats effect crashes on 64-bit arch. (Ulrich Klauer)
+
+Other new features:
+
+ o Added libSoX example #4: concatenating audio files. (robs)
+ o Show soxi version & usage information when no args given. (robs)
+
+Other bug fixes:
+
+ o Fix build so that grouped files (e.g. play -r 6k "*.vox" plays all
+ at 6k) works. (robs)
+ o Fix build to support auto file type detection with pipes on FreeBSD
+ and elsewhere. (Dan Nelson)
+ o Fix simultaneous play & rec not working. (robs)
+ o Fix multi-threading problems on multi-core Windows OS; also, change
+ default to single-threaded.
+ o Fix mistaken file size with pipe input on Windows. (Doug Cook)
+ o Fix missing documentation for -R (repeatable), and pulseaudio driver.
+ o Fix memory leak of format private data. (Slawomir Testowy)
+
+Internal improvements:
+
+ o Move bit-rot detection support files to sub-directory (could
+ previously cause build problems). (robs)
+ o [2859244] Fixes to improve compatibility with MSVC. (Doug Cook)
+ o Added utilities to help any format handler dlopen() external
+ libraries at run time instead of link time. (Doug Cook)
+ o Compiling with mingw now has feature parity with cygwin. (Doug Cook
+ and cbagwell)
+
+
+
+sox-14.3.0 2009-06-14
+----------
+
+Previously deprecated features that have been removed in this release:
+
+ Deprec- Feature [O(ption)]
+ ated in [F(ormat)] [E(ffect)] Replacement
+ ------- ---------------------- ----------------------
+ 14.1.0 E resample * ~= rate
+ 14.1.0 E polyphase * ~= rate
+ 14.1.0 E rabbit * ~= rate
+ 14.2.0 E dither: RPDF,scaled dither (TPDF only)
+ 14.1.0 F flac: libFLAC 1.1.1 libFLAC > 1.1.1
+
+ * But interface retained as an alias for `rate'.
+
+LibSoX interface changes:
+
+ o sox_format_init() has been supeseded by sox_init().
+ o Removed obsolete error codes (SOX_E...); new sox_strerror()
+ function to convert error codes to text.
+ o Use of sox_effect_options() is now mandatory when initialising an
+ effect (see example0.c for an example of this).
+ o sox_flow_effects() has a new (3rd) parameter: a void pointer
+ `client_data' that is passed as a new (2nd) parameter to the flow
+ callback function. client_data may be NULL.
+
+File formats:
+
+ o Slight improvement to A-law/u-law conversion accuracy: round LSB
+ instead of truncating. (robs)
+ o Fix length in wav header with multi-channel output to pipe. (robs)
+ o Fix [2028181] w64 float format incompatibility. (Tim Munro)
+ o Fix reading AIFF files with pad bytes in COMT chunks. (Joe Holt)
+ o Fix AIFF file length bug to stop reading trash data on files that
+ have extra chunks at end of file. (Joe Holt)
+ o Fix file length being 4 bytes short for AIFF sowt CD tracks. (Joe Holt)
+ o Fix [2404566] segfault when converting from MS ADPCM wav file. (robs)
+ o Fix slight FLAC seek inaccuracy e.g. when using `trim' effect. (robs)
+ o Fix mp3 decode sometimes being up to a block short. (robs)
+ o Fix not outputing GSM-in-wav when input is GSM-in-wav. (robs)
+
+Audio device drivers:
+
+ o New native OpenBSD audio handler for play/recording. (Alexandre Ratchov)
+ o 24-bit support for ALSA handler. (robs)
+ o Warn if ALSA under/overrun. (robs)
+
+Effects:
+
+ o New `stats' effect; multichannel audio statistics. (robs)
+ o New `sinc' FFT filter effect; replacement for `filter'. (robs)
+ o New `fir' filter effect using external coefficients/file. (robs)
+ o New `biquad' filter effect using external coefficients. (robs)
+ o New `overdrive' effect. (robs)
+ o New `vad' Voice Activity Detector effect. (robs)
+ o `synth' enhancements: can now set common parameters for multiple
+ channels, new `pluck' and `tpdf' types, `scientific' note
+ notation, [2778142] just intonation. (robs)
+ o New multi-channel support and revised sizing options for `spectrogram'.
+ N.B. revised options are not directly backwards compatible -- see the
+ man page for details of the new syntax. (robs)
+ o Richer gain/normalise options. (robs)
+ o [2704442] Slight change to `riaa' gain: now norm'd to 0dB @ 1k
+ (previously 19.9dB @ DC). (Glenn Davis)
+ o Fix [2487589] `dither' clipping detection & handling. (robs)
+ o Fix `repeat' sometimes stopping repeating too soon. (robs)
+ o Fix `repeat' sometimes repeating wrong audio segments. (robs)
+ o Fix [2332343] 'silence' segfault with certain lengths. (cbagwell)
+ o Fix `silence' empty output file with A-law input. (robs)
+ o Fix temporary file problems in Windows (cygwin) with normalise and
+ other effects. (robs)
+ o Fix [2779041] spectrogram PNG file is invalid on Windows. (robs)
+ o Fix [2787587] `trim x 0' should produce zero length audio. (robs)
+ o Parallel effects channel processing on some hyper-threading/mult-core
+ architectures. New `--single-threaded' option to disable this. (robs)
+
+Other new features:
+
+ o Added ability to create shared DLL's on cygwin (cbagwell)
+ o New `--guard' & `--norm' options; use temporary files to guard against
+ clipping for many, but not currently all, effects. (robs)
+ o New `--ignore-length' option to ignore length in input file header (for
+ simple encodings & for mp3); instead, read to end of file. (robs)
+ o New `--temp DIRECTORY' option. (robs)
+ o New `--play-rate-arg ARG' option. (robs)
+ o New SOX_OPTS environment variable; can be used to provide default
+ values for above and other options. (robs)
+ o Grouped files, e.g. play -r 6k "*.vox" plays all at 6k. (robs)
+ o Automatically `dither'; new `--no-dither' option to disable this. (robs)
+ o Can now use `v' & `V' keys to adjust volume whilst playing audio (on some
+ systems). (robs)
+ o New bitrate, time in seconds, & total options for soxi; bitrate
+ and file-size display for sox. (robs)
+ o `Magic' (libmagic) file type detection now selected using `--magic'
+ option (where supported).
+ o [2003121] In many cases, no longer need to specify -t when inputing
+ audio from a `pipe'. (robs)
+ o Support more Shoutcast URL variants. (robs)
+ o Added libSoX example #3: playing audio. (robs)
+
+Other bug fixes:
+
+ o Fix [2262177] SoX build could fail with parse /etc/issue error. (robs)
+ o Fix "no handler for detected file type `application/octet-stream;
+ charset=binary'" with raw files when using libmagic. (robs)
+
+Internal improvements:
+
+ o Rationalise use of and make repeatable across different platforms
+ pseudo random number generators. (robs)
+ o Rationalise effects' options interface (getopt compatible). (robs)
+ o Added stub headers to allow test compilation of all sources on
+ linux. (robs)
+
+
+sox-14.2.0 2008-11-09
+----------
+
+Previously deprecated features that have been removed in this release:
+
+ Deprec- Feature [O(ption)]
+ ated in [F(ormat)] [E(ffect)] Replacement
+ ------- ---------------------- ----------------------
+ 14.0.0 E pitch new pitch = old key
+
+File formats:
+
+ o New `.cvu' unfiltered CVSD; supports any bit-rate. (robs)
+ o New `.sox' native format intended for intermediate files. (robs)
+ o Fix WAV write on 64-bit arch. (robs)
+ o Fix writing PRC ADPCM files. (Silas Brown)
+ o Fix problems reading short mp3 files. (robs)
+
+Effects:
+
+ o N.B. Reduced default bandwidth setting for `rate' effect from 99%
+ to 95%; use `rate -s' to be compatible with SoX v14.1.0. (robs)
+ o New options for `rate' effect to configure phase response,
+ band-width and aliasing. (robs)
+ o New options for 'dither' effect: RPDF, TPDF, noise-shaping. (robs)
+ o New `riaa' effect: RIAA vinyl playback EQ. (robs)
+ o New `loudness' effect: gain control with ISO 226 loudness
+ compensation. (robs)
+ o New `bend' effect; pitch bending. (robs)
+ o New -b option for the norm effect; can be used to fix stereo
+ imbalance. (robs)
+ o Wider tempo range for `tempo' effect. (robs)
+ o New --effects-file option to read effects and arguments from
+ a file instead of command line. (cbagwell)
+ o `filter' effect now supports --plot. (robs)
+ o Improved documentation for the `stat' effect. (robs)
+ o Fix broken audio pass-through with noiseprof effect. (robs)
+ o Fix graph legend display when using --plot octave. (robs)
+ o Fix rare crash with `rate' effect. (robs)
+ o Fix [2190767] `norm' under-amplifying in some cases. (George Yohng)
+ o Fix [2007062] Earwax effect can overflow; should clip. (robs)
+ o Fix [2223251] mcompand should use linkwitz-riley. (robs)
+ o Fix `phaser' clicks and overflows. (robs)
+ o Trim will now skip past 2G point correctly. (cbagwell)
+ o Improved handling of speed changes in the effects chain. (robs)
+
+Other new features:
+
+ o New psuedo-effects "newfile" and ":" to allow running
+ multiple effect chains on a single file. newfile will
+ create a new output file when an effect chain terminates.
+ Of most use with trim and silence effects. (cbagwell)
+ o Can now use multiple pipes as inputs to the combiner;
+ see `Special Filenames' in sox(1). (robs)
+ o Display SoX build/run environment information with -V -V. (robs)
+ o Display (with -V) the detected file-type if it differs from the
+ file extension. (robs)
+ o New -t option for soxi; to display the detected file type. (robs)
+ o New -b/--bits, -e/--encoding alternative options for specifying
+ audio encoding parameters. (robs)
+ o [FR 1958680] Support more than 32 input files. (robs)
+ o New native Mac OSX audio handler for playing/recording. (cbagwell)
+
+Other bug fixes:
+
+ o Bump library version because it was not binary compatible with
+ SoX 14.0.1 (Pascal Giard)
+ o Turn off versioning of special libsox_fmt* libraries since thats
+ not really needed. (kwizart)
+ o Fixed crash when running play with no arguments. (Dan Nelson)
+ o Allow libpng to be found with -static option. (cbagwell)
+ o Allow libsamplerate to be found if pkg-config is installed but
+ no samplerate.pc exists. (cbagwell)
+ o [2038855] external lpc10 lib patch. (Oden Eriksson, Mandriva)
+ o Fix memory leaks in effects chain when restarting effects. (cbagwell)
+ o Fixed pkg-config CFLAGS. (evilynux)
+ o Fix sndfile inclusion in build in some circumstances. (robs)
+ o Fix [2026912] Fails on URL-like filenames. (robs)
+ o Always add _LARGEFILE_SUPPORT when off_t is 64bits to work around
+ buggy platforms. Fixes not able to read WAV files. (cbagwell)
+
+Internal improvements:
+
+ o Fixed all compiler warnings (with gcc 4.3.1, 64-bit arch.). (robs)
+ o Updates to internal effects chain API. (cbagwell)
+ o Retire old FFT routines (speeds up `noisered' effect). (robs)
+ o Allow effects to use getopt. (robs)
+ o Use libmagic for mp3. (robs)
+ o Change sox_seek() offset to 64-bit to work with > 2G files (cbagwell)
+ o Merged libsfx back into libsox to align with sox.h API. (cbagwell)
+
+
+sox-14.1.0 2008-7-29
+----------
+
+Previously deprecated features that have been removed in this release:
+
+ Deprec- Feature [O(ption)]
+ ated in [F(ormat)] [E(ffect)] Replacement
+ ------- ---------------------- ----------------------
+ 13.0.0 O -e -n
+ 13.0.0 O -b/-w/-l/-d -1/-2/-4/-8
+ 13.0.0 E avg, pick mixer
+ 13.0.0 E highp, lowp highpass -1, lowpass -1
+ 13.0.0 E mask dither
+ 13.0.0 E vibro ~= tremolo
+ 13.0.0 F auto Becomes internal only
+
+File formats:
+
+ o New option --help-format shows info about supported format(s). (robs)
+ o New WavPack format (includes lossless audio compression, but not
+ guaranteed lossless file compression). (robs)
+ o New htk format. (robs)
+ o Add .f4 & .f8 raw file extensions. (robs)
+ o Writing aiff, aifc & dvms now repeatable with -R. (robs)
+ o Writing hcom no longer fails with unsupported rate--chooses
+ best match. (robs)
+ o Au/snd: added support for 32-bit integer and 64-bit float PCM
+ encoding/decoding; display name of unsupported encoding. (robs)
+ o Can now write .amb (.wav variant) files [FR 1902232]. (robs)
+ o Can now read 2,3(2.6),4 bit ADPCM .voc files [FR 1714991]. (robs)
+ o Can now read some MP3 ID3 tags. (robs)
+ o Can now write Sounder files. (robs)
+ o Can now write DEC-variant au files (with -x). (robs)
+ o Comments support for SoundTool files. (robs)
+ o Fix [1864216] comments mangled when writing ogg-vorbis. (robs)
+ o Fix short noise at end of alsa playback. (Morita Sho/Tim Munro/robs)
+ o Fix wve seek accuracy. (robs)
+ o Fix lpc10 not working. (robs)
+ o Fix [1187257] wav MS-ADPCM block-align size incorrect. (robs)
+ o For wav & au, fix [548256] size in header wrong when piping out. (robs)
+ o Fix IRCAM SF header processing; support all (modern) variants. (robs)
+ o Fix 24-bit read/write on big-endian systems. (robs)
+ o Fix crash trying to open non-existent play-list. (robs)
+ o Fix FLAC read from stdin with libFLAC >= 8. (Patrick Taylor Ramsey/robs)
+ o Fix [1997637] Trim effect loses samples (with wav). (robs)
+
+Effects:
+
+ o New `splice' effect; splice together audio sections. (robs)
+ o New `remix' effect; mixes any number of channels. (robs)
+ o New `norm' (normalise) effect. (robs)
+ o New `delay' effect; delay one or more channels. (robs)
+ o New `contrast' enhancement effect [FR 708923]. (robs)
+ o Improved `rate' resampling effect; resample, polyphase, & rabbit
+ now deprecated. (robs)
+ o New `spectrogram' effect; creates a PNG (if built with PNG lib). (robs)
+ o `synth' can now sweep linearly and squarely (as well as
+ exponentially). (robs)
+ o Can now `fade' out to EOF without giving file-length (if it can
+ be determined from the input file header). (robs)
+ o Fix synth max. level setting for some output encodings. (robs)
+ o Fix crash on 64-bit arch. with tempo & key effects. (Sami Liedes)
+ o `gain' alias for the vol effect. (robs)
+
+Other new features:
+
+ o Now possible to control play-back resampling quality (and hence
+ cpu-load) via the PLAY_RATE_ARG environment variable. (robs)
+ o Command line support for multiple file comments. (robs)
+ o New --combine=mix-power option to mix combine using 1/sqrt(n) scaling
+ instead of 1/n [FR 2012856]. (robs)
+ o New --input-buffer option to specify (only) input buffer size. (robs)
+ o New `soxi' utility to extract/display file header fields. (robs)
+ o Pkg-config support. (Pascal Giard)
+ o Simple VU meter. (robs)
+ o Heuristic to detect when playing an album and set
+ the default replay-gain mode to `album'. (robs)
+ o Better auto-choice of output file format parameters when
+ type is different to that of input file. (robs)
+ o SoX now treats (and displays) encoding size & signal precision
+ separately. (robs)
+ o Default audio devices (sox), and allow environment variables to
+ be used to override the default audio device driver (rec/play)
+ and default audio device (all). (robs)
+ o Simpler file info display for `play'. (robs)
+ o For some file-types, warn if file size seems too short. (robs)
+ o Added auto-detect for caf, sndr, txw & sf files. (robs)
+ o Added example0: simpler example of how to develop applications that
+ use the libSoX effects chain. (robs)
+ o Added example2: simple example of how to develop applications that
+ use libSoX to read an audio file. (robs)
+ o Moved contents of soxexam man page into soxeffect man page. (robs)
+
+Other bug fixes:
+
+ o Fix [1890983] rec shortcut should apply bit depth (8-bit,
+ 16-bit, etc.) to input handler. (robs)
+ o Fix ungraceful handling of out of disc space and other write
+ errors (bug was introduced in 14.0.0). (robs)
+ o Fix endian selection (-B, -L, -x) in some circumstances. (robs)
+ o Fix auto-detect of hcom files. (robs)
+
+Internal improvements:
+
+ o Use FORTIFY_SOURCE with gcc. (robs)
+ o Fixed all compiler warnings (with gcc 4.2.3, 32-bit arch). (robs)
+ o Reimplement (separately) SoundTool & Sounder format handlers. (robs)
+ o Allow formats & effects to have any size of private data. (robs)
+
+
+sox-14.0.1 2008-01-29
+----------
+
+ File formats:
+
+ o Added support for non-standard, non-WAVE_FORMAT_EXTENSIBLE
+ (esp. 24-bit) PCM wav (see wavpcm in soxformat.7 for details). (robs)
+
+ Effects:
+
+ o Reimplemented reverb to be similar to freeverb. (robs)
+
+ Bug fixes:
+
+ o Fix Sndtool read error causing noise at start. (Reynir Stefánsson)
+ o Fix mixer with >4 numbers, and mixer -3 behaving as mixer -4. (robs)
+ o Fix [1748909] sox does not report remaining playtime of mp3s. (robs)
+ o Fix failure to read AIFF files with empty MARK chunk. (robs)
+ o Fix spurious 'Premature EOF' message in some circumstances. (robs)
+ o Switched to 16-bit for libao driver since not all its plugins
+ support it (such as oss, nas, and pulse audio) (Morita Sho)
+ o Stop crash when "rec" is run with no arguments (Morita Sho).
+ o Fix -V (without argument) on non-gnu systems. (robs)
+ o Fix reported (with -V) output audio length in some cases. (robs)
+ o Fix actual FLAC output file audio length in some cases. (robs)
+ o Fix poor 24-bit FLAC compression & support newer versions of
+ libFLAC (1.2.x). (robs)
+ o Fix loss of 1 decoded FLAC block when using "trim 0 ...". (robs)
+ o Fix trim when first effect with IMA-ADPCM input wav file. (robs)
+
+ Internal improvements:
+
+ o Let "make distcheck" run some automated test scripts.
+ o Distribute missing cmake files.
+ o Fix ogg vorbis compile error on some platforms.
+ o Remove unused libltdl that could cause header mismatch with
+ installed libltdl.
+ o Fix AMR detection with --disable-shared. (robs)
+ o Updated configure to support linking to static libraries
+ on mingw for flac, ogg, and libsamplerate libraries.
+ o Added example1: simple example of how to develop applications that
+ use the libSoX effects chain. (robs)
+
+
+sox-14.0.0 2007-09-11
+----------
+
+ File formats:
+
+ o Added ffmpeg support. (Reuben Thomas)
+ o FLAC: added seekable decoding; added seek-table generation. (robs)
+ o Added M3U & PLS playlist formats [FR# 1667341] (Note: SHOUTcast PLS
+ is only partially supported). (robs)
+ o Made format readers and writers into individual modules for easier
+ distribution of differently-licensed code. (Reuben Thomas)
+ o Added libao support. (Reuben Thomas)
+ o Added support for ADPCM-encoded PRC files, based on Danny Smith's
+ rec2wav and sndcmp. (Reuben Thomas)
+ o Added AMR-NB [FR# 728875] & AMR-WB formats (with external libs). (robs)
+ o Added LPC-10 support. (Reuben Thomas)
+
+ Effects:
+
+ o Use LADSPA effects (one input, one output). (Reuben Thomas)
+ o --octave option changed to --plot; can now also use gnuplot to
+ plot effect transfer function. (robs)
+ o Added soft-knee companding. (robs)
+ o Show (with --plot) compand transfer function. (robs)
+ o Allow e.g. "vol 6dB" (as well as "vol 6 dB"). (robs)
+ o Changed deemph filter from 1st order to 2nd order for
+ slightly better accuracy. (robs)
+ o Add option to silence effect to leave periods of silence
+ in and only strip out extra silence. (Mark Schreiber)
+ o synth can now generate any number of channels. (robs)
+ o mixer can now mixdown to mono any number of channels. (robs)
+ o Added oops effect (mixer special case). (robs)
+ o All effects that could only work on mono or stereo audio, now
+ work with any number of channels. (robs)
+ o Added WSOLA-based key and tempo effects. (robs)
+
+ Other new features:
+
+ o Show (with -S) if clipping is occurring. (robs)
+ o Added internet input file support (needs wget). (robs)
+ o Made it possible to build without sound drivers. (Reuben Thomas)
+
+ Bug fixes:
+
+ o Fix (m)compand transfer function non-linearities; fix compand
+ drain volume. (robs)
+ o Fix crash with pan effect. (robs)
+ o Add missing RM define to Makefiles so installs work.
+ (Bug# 1666599) (cbagwell)
+ o Fix I/O performance regression in 13.0.0. (Reuben Thomas)
+ o Fix .lu, .la read regression in 13.0.0 [Bug# 1715076]. (robs)
+ o Fix uncompressed NIST/Sphere read regression in v13 [Bug #1736016].
+ o Fix displayed times when playing a file and using trim. (robs)
+ o Fix CDDA sector duration display for non-CDDA sample rates. (robs)
+ o synth fixes: brown noise; inverted square wave; offset < 0. (robs)
+ o Fix crash when encoding Vorbis or FLAC: with no comment. (robs)
+ o Fix effect drain problems: chorus, echo(s), phaser. (robs)
+ o Fix rabbit responsiveness and memory problems. (Peter Samuelson)
+ o Fix broken stereo audio when recording using ALSA. (robs)
+ o Fix OSS driver on big endian machines that was introduced in
+ last release.
+
+ Internal improvements:
+
+ o Renamed libst to libsox for name recongition and to avoid
+ duplications with other existing libst libraries. (Reuben Thomas)
+ o Moved effects to libsfx. (Reuben Thomas)
+ o Got rid of several hundred compiler warnings. (robs, Reuben Thomas)
+ o Added basic performance testing of I/O. (Reuben Thomas)
+ o Effects chain processing now available in libSoX. (robs)
+ o Added effects-chain buffering for effects that use a window [FR#
+ 1621695]. (robs)
+ o Added cmake build files for Win32. (robs)
+
+
+sox-13.0.0 2007-02-11
+----------
+
+ File formats:
+
+ o Support for .caf, .paf, .fap, .nist, .w64, .nist, Matlab 4.2/5.0
+ (Octave 2.0/2.1), .pvf, .sds, .sd2 and .xi file formats via libsndfile.
+ If available, libsndfile can also be used to handle all the other file
+ formats it understands. (Reuben Thomas)
+ o Add FLAC support (robs)
+ o Support Maxis's XA format. (Dwayne C. Litzenberger)
+ o Add support for 24-bit PCM raw, wav (WAVE_FORMAT_EXTENSIBLE) [FR# 801015],
+ au, aiff, & flac files. (robs)
+ o Add AIFF-C output support. (shashimoto)
+ o New .ima file format for raw IMA ADPCM. (robs)
+ o Allow the rate and number of channels of .au files to be overridden
+ by command-line arguments. (robs)
+ o Add seek support for GSM data in WAV files. Rafal Maszkowski
+ o Allow encoding quality to be specified (FLAC & Ogg, but not
+ MP3 yet). (robs)
+ o Rename -b to -1, -w to -2, -l to -4, -d to -8, and mask to dither.
+ (robs)
+ o New options for specifying endianness (and separate options for
+ nibble & bit reversal) [FR# 1621702]. (robs)
+ o Improved multi-channel file reading; fixes [1599990]. (robs)
+
+ Effects:
+
+ o Equalizer effect (Pascal Giard)
+ o bass and treble altering effects. (robs)
+ o New optional rabbit resample routine, using libsamplerate
+ (aka Secret Rabbit Code). (Reuben Thomas)
+ o Added allpass filter effect. (robs)
+ o Documented the butterworth filter effects; added variable Q. (robs)
+ o "rate" effect made an alias for "resample".
+ o Visualisation of various filters' frequency response via Octave. (robs)
+ o Can now specify width of many 2nd-order filters as: Hz, octaves,
+ or Q. (robs)
+ o Dither/mask amount now specifiable. (robs)
+ o Consistent (and hopefully complete) clipping detection and
+ reporting. (robs)
+ o Allow command-line time parameters of < 1 sec to omit the
+ leading 0. (robs)
+ o Improved synth usage and improved the synth entry in the man-
+ page. (robs)
+ o Higher quality audio speed adjustment; also fixes [1155364]. (robs)
+ o Replacement flanger effect; also fixes [1393245]. (robs)
+ o Added silence padding effect. (robs)
+ o Added ability for noiseprof to use stdout and noisered to use stdin
+ [FR# 1621694]. (Reuben Thomas)
+ o vibro effect name deprecated in favour of tremolo; this effect
+ reimplemented as a special case of synth. (robs)
+
+ Other new features:
+
+ o Remove soxmix. (Reuben Thomas)
+ o Preview mode now removed, as all it did was use rate rather than
+ resample, and rate has been removed.
+ o -V now gives only user-relevant messages, use -V -V to get
+ developer-relevant messages. (robs)
+ o -V output much improved and expanded; now includes display of
+ (auto-)selected effects. (robs)
+ o sox man-page overhaul, new soxexam man-page entries. (robs)
+ o Added command line options for specifying the output file
+ comment. (robs)
+ o Added ability to merge e.g. 2 mono files to 1 stereo file
+ [FR# 1297076]. (robs)
+ o Removed the restrictions whereby multiple input files had to have
+ the same data encoding & size, and in most situations where they
+ had to have the same # of channels, and for play where they had
+ to have the same sampling-rate. (robs)
+ o Options to apply replay-gain on input; enabled by default
+ with `play'. (robs)
+ o Can now use Ctrl-C to skip to next track when playing multiple
+ files (e.g. play *.mp3); Ctrl-C twice to exit. (robs)
+ o Added --interactive option to prompt to overwrite pre-existing
+ output file. (robs)
+ o Added large file support. (Reuben Thomas)
+
+ Bug fixes:
+
+ o Fix writing MP3 files on AMD64 processors.
+ o More fixes to MP3 tag reading. Sometimes tags were
+ detected as valid MP3 frames.
+ o Fix to stop, avoiding a crash, when starting of effects fails.
+ (Reuben Thomas)
+ o Fixed a bug introduced in 12.18.2 that stopped the draining
+ of effects from occuring. This had stopped the reverse effect,
+ among others, from working. (Reuben Thomas)
+ o Several effects are now optimised out in situations where they need
+ do nothing, e.g. changing rate from 8000 to 8000, or changing volume
+ by 0dB [Bug# 1395781]. (robs)
+ o Fix rounding error when reading command-line time
+ parameters. (robs)
+ o Fix nul file hander ignoring other format options if rate
+ option has not been given. (robs)
+ o Fix synth length accuracy. (robs)
+ o Fix broken audio when downmixing with any of the following
+ effects: synth, deemph, vibro. (robs)
+ o Fixed deemph & earwax effects to work with MP3, vorbis,
+ & FLAC. (robs)
+ o Fix wav file handler discarding the last PCM sample in certain
+ circumstances. (robs)
+ o Fix [1627972] AIFF read bug when MARK chunk present. (Richard Fuller)
+ o Fix [1160154] VOX to WAV conversion problem. (robs)
+ o Removed (for output file only) the potentially
+ problematic -v option. Use the vol effect instead. (robs)
+ o Improved the accuracy of integer and floating point PCM
+ conversions. (robs)
+ o Don't go into a loop on zero-padded WAVs. (Jorge Serna)
+ o Fix to AIFF writing to avoid writing invalid files in some situations.
+ (Reuben Thomas)
+ o Fix compander effect bugs: [1613030] Compand fails to compress
+ clipping, [1181423] compand with 0 sec attack/release. (robs)
+
+ Internal improvements:
+
+ o More and better self-tests. (robs)
+ o Build system overhaul to use the full set of GNU autotools.
+ (Reuben Thomas)
+ o Add new getopt1.c to win32 project file.
+ o Remove old, optional rate change and alaw/ulaw conversion code.
+ (Reuben Thomas)
+ o Removed the old internally invoked (but mentioned in the man page)
+ copy effect. (robs)
+
+
+sox-12.18.2 2006-09-03
+-----------
+
+ o Adding in Debian's disk full fix (#313206).
+ o Finally got rid of reference to cleanup() function in
+ library. Applications are now required to detect
+ all failures from return codes and cleanup as they
+ want.
+ o Changed how list of formats and effects are stored internally.
+ Effects libst users only. Dirk
+ o Store effects usage so that its accessable by applications.
+ Dirk
+ o Modify the synth effect to not use SIGINT to stop processing
+ and instead return ST_EOF. This allows exact acount of
+ samples to be written out instead of an approximate amount.
+ o Fix hangup when attempting to write stereo MP3 files.
+ (1512218) Kendrick Shaw
+ o Fix deemph effect would lose stereo separation. (1479249) robs
+ o Adding cross-platform support for getopt_long
+ o Make help screens print much more information and add
+ new --help-effect option. (Originally from Dirk).
+ o Add support for using an external gsm library instead of
+ just the internal one. Vladimir Nadvornik
+ o Updates to nul file handler to prevent crashes during output.
+ Martin Panter (1482869)
+
+
+sox-12.18.1 2006-05-07
+------------
+
+ o The "filter" effect could go into infinite drain mode. Now
+ only drain 1 buffer. noisered as well.
+ o SoX was ignoring user aborts (ctrl-c) if it occured during
+ effect drain operations. This was bad if effects had
+ bugs and stuck in infinite loop.
+ o Stop SoX from crashing when file type could not be auto
+ determined (1417776).
+ o Output filenames with multiple '.' confused SoX. (1417776)
+ Christian Hammer
+ o Moved to a common set of CLIP routines. This fixed clipping
+ bugs in noisered and mcompand.
+ o Stop SoX from crashing on sphere files that contain large text
+ strings. (1430025) Ulf Hamhammar
+ o Fix some overflow crashes in aiff handler. (1430024) Ulf Hamhammar.
+ o Under windows, set piped input/output to binary mode (1417794). Martin
+ Panter
+ o Fixed broken internal version of strdup(). (1417790) Marty
+ o Stop infinite loop when reading MP3's with a tag size of
+ exactly 8192 bytes. (1417511) Hans Fugal
+ o Fix typo in stlib.dsp for loading in Visual Studio 6.
+ o Fixed problems in silence effect related to removing multiple
+ periods of silence from the middle of the sound file.
+ o Reduced the window size greatly on the silence effect to
+ prevent leaving in silence that looked like noise still based
+ on RMS values.
+ o Prevent infinite loop in pitch effect from uninitialize variable.
+ Frank Heckenbach
+ o Prevent crashes when printing error mesages (1447239)
+ o Added makefile and support files to compile using Open Watcom
+ compiler. (1417798) Marty
+ o Stop calling flow() on effects that returned EOF during drain(). Allows
+ two back-to-back reverse effects to work.
+ o Added support for multiple channels in .dat files.
+ (1366634) tomchristie
+
+
+sox-12.17.9 2005-12-05
+-----------
+
+ o Updates to compile under VC6. Jimen Ching
+ o Declare st_signalinfo_t to specifically be signed in case
+ platform does not default ot signed chars. This
+ is required for NetBSD/powerpc.
+ o When seek()ing in AIFF, SMP, and WAV handlers, remaining samples were
+ incorrectly computed based on bytes and not samples. Jukka
+ o Changed noisered effect to just warn during clipping instead
+ of aborting. Ian Turner
+ o Fixed bug were pieces of audio were lost every buffer read
+ when running both -c and -r options together on mono audio.
+ Users probably percieved it as shorter audio files that
+ played with a sped up tempo.
+ Bugfix will also apply to other times when multiple effects
+ are ran on the command line.
+ o Added support for -V option to play/rec scripts.
+ o Fix to silence effect to allow negative periods to be specified
+ (to remove silence from middle of sound file).
+ o Fix swap option handling so that special case of "swap 1 1" will
+ work.
+ o Track length of Ogg Vorbis files on read.
+ o Add support for displaying a status line that tracks progress
+ of read/write routines. Part of information requires read
+ file handlers to be able to determine file length.
+ o Converted alsa driver to use asoundlib instead of directly
+ talking to kernel driver. This also means that device names
+ are now the ALSA logical names instead of /dev type names.
+ o Added ALSA support to play/rec scripts.
+ o Added st_open*, st_read, st_write, st_seek, st_close routines
+ to help simplify developer interface to libst. See libst.3..
+ o Removed st_initformat(), st_copyformat(), and
+ st_checkformat() from library. If your app used those
+ functions then copy them from 12.17.8 source code
+ directly into your application or update to use new
+ routines.
+ o Force word-alignment on AIFF SSND and APPL chunks on input.
+ Matthew Hodgson.
+ o Add fix to WAV handler to only return data in multiples
+ of sample_size*channels to better handle corrupt files.
+ o Fixed bug where "-4" option didn't work with avg
+ effect (Tom Christie).
+ o Fixed fade's fade-out-length to match man page
+ description as noted by Geoff Kuenning. This required
+ updates to the sample crossfade scripts. Also modified fade
+ effect to report when no more samples will be produced to
+ prevent unneeded reading of whole file.
+ o Allow aborting SoX with SIGTERM, along with previous SIGINT.
+ Norman Ramsey.
+
+
+sox-12.17.8 2005-08-22
+-----------
+
+ o noisered effect had compile problems with some compilers.
+ o "-x" option was being ignored since 12.17.7.
+ o Stuart Brady added support for reading and writing RIFX files (big
+ endian RIFF/WAV files). Also added support for auto detecting
+ DEC-style ".sd\0" files.
+ o Gene Mar found typo in polyphase nuttall calculation.
+ o SMP buffer overflow (detected by gcc 4.0). Reported by Marcus Meissner
+ and Matthias Saou.
+ o Fixed URL in manpage to resample overviews.
+ o Fixed WAV handler so that it didn't think WAV chunks with max size
+ were invalid chunks. This allows WAV's to be used in pipes since
+ they have to default to max size.
+ o WAV files with alaw or ulaw data don't need extended format chunks.
+ (Lars Immisch)
+ o In AIFF files, fixed problem were short comments should cause
+ AIFF handler to get confused and become misaligned.
+
+
+sox-12.17.7 2004-12-20
+-----------
+
+ o Christian Weisgerber sent patches to man page fixes
+ and patches for sunaudio driver on openbsd.
+ o Default volume for soxmix wrongly set to 0 instead
+ of 1/#_input_files (float rounding error).
+ o Update to ALSA driver to do a better job of detecting
+ unsupported sample rate/size/encoding and change to
+ a supported one.
+ o Fix bug in alsa writing were last last partial buffer
+ wasn't being flushed.
+ o Guentcho Skordev pointed out ogg vorbis files were using
+ the same value for serial numbers each time.
+ o Changed sox to only read the exact size of a WAV data chunk
+ if cooledit IFF LIST chunk is found at the end of the file.
+ Normally, this isn't done to allow reading > 2gig WAV files.
+ o Modified configure to detect cygwin compiler after detecting
+ gcc compiler (fixes some default CFLAGS options).
+ o Added explicit rule for compile *.o from *.c so that
+ CPPFLAGS is always referenced. Not all platform's default
+ rule includes CPPFLAGS (FreeBSD).
+ o Under linux, add include path to /lib/modules/* so that ALSA
+ include files can be auto detected.
+ o Ian Turner added an effect to remove noise from an audio
+ file by first profiling silent periods of the audio
+ to determine what the noise is (like background hiss on
+ cassette tapes).
+
+
+sox-12.17.6 2004-10-13
+-----------
+
+ o Changed comment code to always use copies of strings to
+ fix bug in WAV handlering freeing argv[] memory.
+ o Use calloc() to create ft_t structures so that all
+ memory is initialized before being referenced.
+ o Fixed VOC EOF bug were it thought there was an extra
+ block when there wasn't.
+ o Restructured directory layout so that source code is in
+ a seperate directory.
+ o Modified SoX to accept multiple input files. Concatenates
+ files together in this case.
+ o Removed map effect so that loops and instr could be removed
+ from effects structures. This makes effects engine stand
+ alone from the rest of the sox package.
+ o Benedikt Zeyen found a bug in synth effect when generating
+ brown noise that could cause clipping.
+ o David Leverton sent another patch to prevent crashes on
+ amd64's when resampling.
+ o Fixed a bug were MP3 files with large ID3v2 tags could
+ cause SoX to stick in a loop forever. Now, it will
+ abort on IDv3 tags larger then 100k. Could still be
+ improved to handle any size.
+ o Changed volume option (-v) so that it tracks the file
+ it was specified. This means that when specified with
+ the input file, it changes volume before effects engine
+ and when specified with output file, its done after effects
+ engine.
+ o Added crossfade_cat.sh script that will concatenate to
+ audio files and do a crossfade between them.
+ o Fixed bug in fade effect were it was impossible to do a
+ fadeout starting from the beginning of the audio file.
+ o Removed rounding error when changing volume of audio with
+ "-v" option. This error caused doing a "-v -1.0" twice
+ to not result in the original file.
+ o Fixed a possible overflow in lots of effects were MIN
+ value was treated as -MAX instead of -MAX-1.
+ o Modifed sox so its OK for effects to not process any
+ input or output bytes as long as they return ST_EOF.
+ o When effects output data and reported ST_EOF at the
+ same time, that buffer was discarded as well as
+ data from any chained effect.
+ o Added patch from Eric Benson that attempts to do a seek()
+ if the first effect is trim. This greatly speeds up
+ processing large files.
+ o Daniel Pouzzner implemented a multi-band compander (using
+ the butterworth filters to split the audio into bands).
+ o Donnie Smith updated the silence effect so that its possible
+ to remove silence from the middle of a sound file by
+ using a negative value for stop_periods.
+ o Changed float routines to only work with normalized values
+ from -1:1.
+ o Modifed .au handler to be able to read and write 32-bit
+ and 64-bit float data. Only tested reading so far.
+ o WAV with GSM data now always pads data to even number of bytes.
+ o Added support for writing 32-bit audio to AIFF.
+
+
+sox-12.17.5 2004-08-15
+-----------
+
+ o Thomas Klausner sent in patches to compile audio drivers under
+ NetBSD.
+ o Rahul Powar pointed out a memory leak in the WAV file handler.
+ It wasn't calling the correct close() function when closing
+ input files.
+ o Modified play.1 man page to not use multiple name lines. This
+ appears to confuse some conversion programs. Updated sox.1
+ man page for typo in reverb option.
+ o Andrew Church fixed problem with header of stereo 8SVX files.
+ o Jimen Ching added support to scan over garbage data at the
+ beginning of MP3 files to find valid frames. This is useful
+ to play WAV and AIFF files that have MP3 data in them until
+ those handlers support it directly. To play those, force
+ sox to use the mp3 handler with the "-t mp3" option.
+ o Added patch from Ulf Harnhammar to wav handler to prevent
+ buffer overflows.
+ o Added patch from Redhat to allow resample to work on certain 64-bit
+ machines (Sam Varshavchik)
+ o Tony Seebregts added a file handler for headerless Dialogic/OKI ADPCM
+ files (VOX files).
+ o Jan Paul Schmidt added a repeat effect to do loops the brute force way.
+ This is also good for file format that don't support loops as well.
+ o Fix for OSS driver in rate tolerance calcs that were off because
+ of type conversion problems. Guenter Geiger.
+ o Allow reading sphere files with headers greater then 256 bytes. Jimen
+ Ching.
+ o Fix for vorbis were comments are displayed in KEY=value format always.
+ Stop printing some info to stdout in case output is a pipe. Guenter
+ Geiger.
+ o J Robert Ray submitted fix for AIFF handler to ignore lowercase
+ chunks that are unknown.
+ o Bugfix for 8-bit voc files. Jimen Ching
+ o General warning cleanups (cbagwell)
+ o Memory leaks in reading WAV files (Ufuk Kayserilioglu)
+ o Rearrange link order of ogg vorbis libraries so that they
+ can be compiled as static. (Christian Weisgerbr)
+
+
+sox-12.17.4 2003-03-22
+-----------
+
+ o Peter Nyhlen fixed a problem with reading Comments in Ogg Vorbis files.
+ o Added install target to allow installing libgsm from main Makefile.
+ Leigh Smith.
+ o Minor updates to sox.c to free unused memory and close all input
+ files during failures.
+ o Pieter Krul added a patch that makes play script look at AUDIODEV
+ environment variable if it exists to find which device to use.
+ This allows scripts to work with Solaris SunRays and is a good idea
+ in general.
+ o Updated config.sub to detect latest supported OS's.
+ o Fabrizio Gennari added support for reading and writing
+ MP3 files using the external libraries libmad and libmp3lame.
+ o Jens Henrik Goebbert sent in several bugfixes for integer overflows
+ in the compand effect.
+ o Dan Dickerman sent in patches for integer overflows in the resample
+ effect.
+ o Jimen Ching sent in a fix for multi-channel sound file processing
+ using the avg effect.
+ o Richards Bannister added patches to clean up prototypes and filter
+ private sizes being to small.
+ o Jimen Ching adds -d option to specify 64bit data size and changed
+ Ulaw/Alaw encoding to default to 8bit data size if not specified.
+ o David Singer pointed out that a MS program creates AIFF files
+ with an invalid length of 0 in its header. Changed SoX to warn the
+ user but continue instead of aborting since SoX can still read
+ the file just fine.
+ o Bert van Leeuwen added a file handler for Psion record.app used
+ for System/Alarms in some Psion devices.
+ o Richard Bannister sent in a patch to make writing vorbis files
+ work with Vorbis 1.0 libraries.
+ o Fixed configure scripts so that they can be ran with the
+ --with-oss-dsp, --with-alsa, and --with-sun-audio options.
+ Was causing compile time problems. Reported by Raul Coronado.
+ o Change Ogg Vorbis support to use VBR encoding to match defaults
+ of oggenc based on suggestion from Christian Weisgerber.
+ o Prints error message now when a channel value of -1 is given.
+ Reported by Pierre Fortin.
+ o Fixed bug were memory could be trashed if a input WAV file contained
+ a comment. Found by Rhys Chard.
+ o Change command line to compile soxmix.o slightly to try and make
+ Forte compiler happy.
+ o Added support for ALSA 0.9 driver. Jimen Ching
+
+
+sox-12.17.3 2001-12-15
+-----------
+
+ o Removed check that prevented pan from being invoked when the
+ input and output channels were the same.
+ o Ciaran Anscomb added a flush to sunaudio driver after changing
+ settings. This is because it can start buffering data as soon
+ as the device is open and the buffered data can be in a
+ wrong format.
+ o trim wasn't accounting for # of channels and was generally broken.
+ o Jeff Bonggren fixed trim bugs were it was failing when triming
+ data that equaled to BUFSIZ. Also, trim now immediately returns
+ ST_EOF when its done instead of requiring an extra call that
+ returns no data.
+ o auto effect wasn't rewinding the file if the file was less then
+ 132 bytes. Changed auto parsing of header to be incremental
+ instead of reading in a large buffer.
+ o William Plant pointed out a bad pointer access in fade effect's
+ parsing of options.
+ o Ken pointed out a problem were private data was not 8-byte aligned
+ and causing crashes on most RISC CPU's. Fixed by going back to
+ old style of declaring private data as type "double" which usually
+ forces strictest alignment.
+ o ima_rw was miscompiling on alpha's because of a header ordering
+ problem.
+ o Erik de Castro Lopo pointed out that when writing 16-bit VOC files
+ the headers did not contain the correct length or encoding type.
+ o Seperated st.h into 2 files. st.h for libst users and st_i.h for
+ internal use.
+ o Added new types used extensively by libst: st_sample_t & st_size_t.
+ This allows for more deterministic behavior on 64-bit machines and
+ also allows sox to possibly work with much larger file sizes.
+ o SoX was some times getting confused and thinking an EOF was an
+ error case when reading audio files. Removed unneeded aborts
+ when EOF was OK.
+ o Silence effect was broken on stereo files. Also, made thresholds
+ relative to original bit percision of audio data. When 16-bit audio
+ is scaled up to 32-bits, a little bit of noise starts to look like a
+ large amplitude of noise. Also, now using RMS values to smooth out
+ clicks. RMS rolling window size is 1/10 of sample rate.
+ o Changed Floats into a type of encoding instead of a size of audio data.
+ o Put a flush at the end of OSS driver so that no old data would be
+ left in internal buffers after changing audio format parameters.
+ o Fixed problem where play script wasn't installed correctly if you
+ build from another directory (pointed out by Mike Castle).
+ o Made GSM support internal to libst (no external library required).
+ o Change configure script to enable ulaw/alaw lookup tables and GSM
+ support by default. Also have Makefile's make use of more configure
+ prefix options to allow for customized installs.
+ o Reverted ulaw/alaw conversion routines back to Sun's versions.
+ o Modified raw file handler to write files in the same generic buffered
+ fashion that was added for reading in 12.17.2. Seems to have
+ speed up some types of writing.
+ o Reading Ogg Vorbis files could get confused of when EOF was reached.
+ o Added uninstall rules to Makefile. Added new ststdint.h to define
+ *int*_t typedefs.
+ o Added internal strcasecmp for OS/2.
+ o Added support for swapping "bit" order (MSB becomes LSB) for raw u-law
+ and A-law data. Some ISDN equipment prefers it this way. Use -x flag
+ or new .la or .lu file extensions.
+ o Annonymous patch submitted to fix types and spelling problems in
+ various files. Also, updated VOC files to have u-law and A-law
+ support as well as able to read in VOC files using a pipe. More
+ examples added to soxexam file.
+
+
+sox-12.17.2 2001-09-15
+-----------
+
+ o Daniel Culbert found and fixed a bug in the polyphase effect
+ that occurs on platforms that rand() can return large values.
+ The bug resulted in polyphase resampling an audio file to a
+ different rate then it said it was.
+ o Stan Seibert contributed a handler for Ogg Vorbis files. It
+ handles all input formats but can only save using default
+ settings.
+ o Darrick Servis has made major cleanups in the code in regards
+ to error conditions. Helps people using libst.
+ o Darrick Servis has added added optional seek functionality sox.
+ Several formats have been modified to make use of this.
+ o Geoff Kuenning rewrote the average effect into a general-purpose
+ parametric mapping from N channels to M channels.
+ o Geoff Kuenning added an optional delay-time parameter to the compander
+ effect to allow companding to effectively operate based on future
+ knowledge.
+ o Geoff Kuenning Added support to fade and trim effect for specifying time
+ in hh:mm:ss.frac format.
+ Fixed a bug that caused integer overflow when large start/stop times
+ were used.
+ o Geoff Kuenning updated play/rec/soxeffect scripts to handle all effects
+ added since 12.17. Spell-checked soxexam.1 file.
+ o Jimen Ching updated ALSA configure support to auto-detect 4.x or 5.x API
+ and compile correctly under those two. All other versions are unsupported.
+ o Merged in the NetBSD package changes into CVS finally.
+ o Removed broken support for non-ANSI compilers.
+ o Makefile now places the correct path to SoX in the play/rec scripts
+ based on configuration script values.
+ o Alexander Pevzner provided a fix for OSS driver for sound being
+ dropped under heavy CPU loads. Moved GETBLKSIZE operation
+ until after setting up the format (SBLive! was modify the block size
+ after changing formats).
+ o With help from David Blythe, updated OSS drivers to use newer format
+ interface. OSS driver will now attempt to detect a valid endian type
+ to use with sound card.
+ o Carsten Borchardt pointed out a bug in lowp filter. Added new
+ nul file handler that reads and writes from/to nothing.
+ Also added new synth effect that creates sounds using a simple
+ synthesizer. Created a testcd.sh that uses two new features
+ to create a test sound CD for testing audio equipment.
+ o Ben Last added a new program that uses libst and will merge two
+ seperate audio files into a single file with multiple channels.
+ This was merged into the standard sox.c file by cbagwell.
+ o Andreas Menke fixed some problems with the speed effect and
+ how effects were drained. Also improved the usage of printf()'s
+ to use stderr.
+ o Corrected AU header length value when comments were less than
+ 4 bytes.
+ o Added support for reading non-standard bit size data from AIFF files.
+ o Ignore unmatched MARK/INSTR chunks in AIFF files now instead of quiting.
+ o Fixed ALAW encoding bug in .au files as pointed out by Bruce Forsberg.
+ o Unified the raw reading functions. Probably slightly faster for
+ most datatypes but was done to fix recording from the OSS driver.
+ Control-C stopped working somewhere during the 12.17 series.
+ o Ford Prefect added a dcshift which can shift the midline amplitude
+ towards the true center. This will allow for a greater range
+ of volume adjustments without clipping audio data.
+ o Heikki Leinonen submitted a silence effect that will trim off
+ silence from the beginning of a file. cbagwell made some modifications
+ to trim off front and back as well as some other tweaks.
+ o Made the "auto" effect the default file handler for input files.
+ Also have auto handler now use file extensions if it can't figure
+ it out.
+
+
+sox-12.17.1 2000-11-19
+-----------
+
+ o Andreas Kies fixed a bug were we were not detecting correctly
+ if an output file was seekable.
+ o Fixed a bug in the mask effect introduced in 12.17. If the libc
+ version of rand() returned more then 15-bit values then it would
+ trash your data. Reported by Friedhel Mehnert.
+ o Added a new fade in/out effect from Ari Moisio.
+ o AIFF files now ignore a MARK chunk if the loop type is NoLoop (0).
+ o Fixed bug were it was impossible to output ADPCM data in wav files.
+ o Fixed bug were rate had to be specified for sphere files (fix from
+ Antti Honkela).
+ o Added small work around to let compile with cygwin's gcc 95.2
+ which also now allows to compile with GSM support under windows.
+ o Removed accessing of sound devices in tests for sound support and
+ instead just look for needed header files. This allows the sound
+ support to be detected even if the device is currently busy or when
+ compiled on a box that doesn't have a sound card but the OS supports
+ it (which is the enviornment of most distributions creating new
+ binaries).
+ o Added support to partially handle AIFC files but only uncompressed
+ versions. This should allow people to work with raw CD audio data
+ on Mac OSX and also gives a basis for adding future support for
+ things like ADPCM processing.
+ o Added new "earwax" effect from Edward Beingessner. It is meant to
+ be used for CD audio played through headphones. It will move the
+ sound stage from left/right to in front of you.
+ o Trim effect did not compute locations as was documented in the
+ man pages. Changed effect so that it computed the time the
+ same way that the fade effect does.
+
+
+sox-12.17 2000-09-08
+---------
+
+ o Sox can now read and write w98 compatible gsm .wav files,
+ if compiled properly with libgsm. Thanks go to Stuart
+ Daines <sjd.u-net.com> for the gsm-wav patches.
+ This is new, and relatively untested. See -g format option.
+ o Sox can now write IMA_ADPCM and ADPCM compressed .wav,
+ this is new, and relatively untested. See -i and -a format
+ options in manpage.
+ o General changes to wav.c for writing additional wav formats.
+ Reading wave headers: more consistency checks.
+ Writing wave headers: fixes for w98.
+ o Speedups to adpcm read routines, new codex versions are
+ now in ima_rw.c and adpcm.c.
+ o Speedups for raw.c, especially for gcc with glibc.
+ o Fixed a segfault problem with ulaw/alaw conversion, where
+ an out-of-range index into the tables could occur.
+ o More detailed output from the stat effect.
+ o Continued rewrite of resample.c, now it is almost as
+ fast with floating arithmetic as the old (buggy) version
+ was with 16-bit integer arithmetic. The older version
+ in sox-12.16 shifted frequencies slightly and was less
+ accurate. (Stan Brooks)
+ o Extensive rewrite of polyphas.c, should be faster and use less memory
+ now. The sox-12.16 polyphase code had some bugs. (Stan Brooks)
+ o New effect 'filter' which is a high-quality DSP lowpass/
+ highpass/bandpass filter using windowed sinc function
+ methods, like polyphase and resample. (Stan Brooks)
+ o Jan Paul Schmidt added new low/high/bandpass and bandlimit
+ filters to sox. They have much better results then the old
+ versions of low/high/bandpass. The new effects are all
+ Butterworth filters.
+ o New data file type supported, -sl or extension .sl for
+ signed 32-bit integers. Some simplification of the raw.c
+ source.
+ o Some test programs and scripts in the test directory, for
+ making gnuplot plots of frequency response, error-levels
+ of rate-conversion and filter effects.
+ o Removed sbdsp code. All modern unixes are support via OSS,
+ ALSA, or sun audio device interfaces.
+ o Added AVR handler from Jan Paul Schmidt.
+ o SoX now waits until the last possible moment before opening
+ the output file. This will allow all input and effect options
+ to be parsed for errors and abort before overwriting any file.
+ o SoX will no longer write to files that exists. This will keep
+ it from deleting files when a user mistakenly types "sox *.wav".
+ o Added new compander effect from Nick Bailey. Nice general purpose
+ filter.
+ o Under Solaris, SoX now checks hardware ability to play stereo/PCM
+ and forces output data to match. Sorry, no SunOS support. I don't
+ have access to one any more.
+ o Fixed array overrun bug in rate effect as pointed out by Ian
+ Donaldson.
+ o Fixed clip24() range as pointed out by Ted Powell.
+ o Fixed possible segfault in echos effect, as pointed out by Zinx
+ Verituse.
+ o Moved most documentation to new "soxexam.1" manual page so that
+ all users on a unix system will have access to important information.
+ This means no more TIPS, CHEATS, or CHEATS.eft files.
+ o Richard Kent fixed a byte alignment problem in aiff comment code.
+ o Loring Holden added support to create missing directories on install
+ and support for installs from outside the source directory.
+ o Fabien COELHO added a pan and volume effect.
+ o Fabien COELHO added a speed effect to sox (like speeding up a tape
+ machine). Also added pitch which changes pitch without effecting
+ duration and stretch which stretch time without effecting pitch.
+ o Leigh Smith updated aiff support to use the COMT check when writing
+ comments instead of the ANNO. It is the prefered method from Apple
+ and newer programs are starting to require it. Also fixed some bugs
+ in how we compute the length of various chunks in output files.
+ o Changed the default block alignement for IMA ADPCM WAV files to use
+ 256 which is what windows programs use. Badly written readers expect
+ 256.
+ o Matthias Nutt helped add support for specifying multiple effects
+ to SoX on the command line.
+ o Curt Zirzow added a trim effect to trim off audio data.
+ o Updated ALSA driver to support new interface. Jimen Ching
+
+
+sox-12.16 1999-07-13
+---------
+
+ o Changed raw data functions to perform I/O operations using block reads.
+ Should improve speeds greatly, especially when filesize is in megs.
+ Got code ready to tweak speed more which also forced me to clean up
+ Endian test code.
+ o Fixed a bug in .au's handling of G.723. It wasn't using the correct
+ number of bits. Added A-law support to .au.
+ o Quoted $filename in play/rec scripts so that files with spaces in
+ their names can be given.
+ o Old OS/2 support didn't work. Replaced with known working EMX
+ GCC compatible code.
+ o ADPCM WAV files were defaulting to 8-bit outputs and thus losing
+ some persision. Now defaults to 16-bit signed uncompressed data.
+ o Fixed a couple cross-platform compiler issues.
+ o Jimen Ching has added support for "configure" in to SOX. Finally,
+ a good solution to cross-platform compiling!
+ o Jimen Ching has added native support for the ALSA driver to play
+ and record audio from. (jching@flex.com)
+ o Minor correction for -r example in manual page.
+ o Renamed sox.sh to soxeffect and rewrote. Symbolic links can be made
+ from this file to the name of a sox effect. It will then run that
+ effect on STDIN and output the results to STDOUT.
+ o Fixed up some makefiles and 16-bit support from patches sent by
+ Mark Morgan Lloyd (markMLl.in@telemetry.co.uk). Also added some
+ nice DOS test bat files from him as well.
+ o Cleaned up some more cross-platform compile problems. In the process
+ got it working with Turbo C again, kinda. It still locks DOS up at times.
+ o Made AIFF handler work with invalid headers that some programs generate.
+ Also fix an Endian bug thats been there for quite a long time (when
+ ran on Intel machines). Made comment lengths even length to make
+ most MacOS programs happy. cbagwell
+ o Resample function was updated by Andreas Wilde
+ (andreas@eakaw2.et.tu-dresden.de) to fix problem were freqs. were
+ off by a factor of 2.
+ o Added an effect that swaps stereo channels. cbagwell
+ o Combined play and rec scripts to a single program to ease mantaince.
+ Also added GNU style long-options (--help). Careful, some options have
+ change (but more logical).
+ o Fixed a very old silly bug were low/high/bandpass filters would
+ add some trash data to the end of the sound file.
+ o "avg" effect wouldn't give error message when you tried to average
+ x number of channels in to the same number of channels.
+ o Fixed core dump when writting AIFF files with no comments.
+ (Olaf Pueschel)
+
+
+sox-12.15 1998-10-01
+---------
+
+ o Juergen Mueller moved Sox forward quite a bit by adding all the
+ most commonly known "Guitar Effects". He enhanced echo support,
+ added chorus, flanger, and reverb effects. He also wrote a very
+ handy CHEAT.eft file for using various effects.
+ o Incorporated Yamaha TX-16W sampler file support provided by
+ Rob Talley (rob@aii.com) and Mark Lakata (lakata@physics.berkeley.edu).
+ o Fixed a small bug in hcom compression, dependent on sign
+ extension. Leigh Smith (leigh@psychokiller.dialix.oz.au).
+ o sox -h now prints out the file formats and effects supported.
+ Leigh Smith and Chris Bagwell.
+ o smp transfers comments more completely. Leigh Smith.
+ o aiff manages markers and loops correctly and produces more
+ verbose output. Leigh Smith.
+ o Added polyphase resampler (kb@ece.cmu.edu). This adds a slightly
+ different resampling algorithm to the mix.
+ o Michael Brown (mjb@pootle.demon.co.uk) sent a patch to stop crashes
+ from happening when reading mono MS ADPCM files.
+ o Fabrice Bellard has added a less buggy 'rate' conversion. I've left
+ the old rate code included but if all goes well this will become
+ the new 'rate'. Please test and let me know how it works. Resample
+ effect needs to be reworked now.
+ o Heiko Eissfeldt: Implemented a simple deemphasis effect for
+ certain audio cd samples.
+ o Matija Nalis (mnalis@public.srce.hr) sent a patch to fix volume adjustment
+ (-v) option of sox.
+ o Fixed typo in optimazation flag in unix makefile, as pointed out by
+ Manoj Kasichainula (manojk@io.com).
+ o Fixed missing ';;' in play script. cbagwell
+ o Fixed bug in determining length of IMA and MS ADPCM WAVE files. cbagwell
+ o Fixed bug in how stereo effects were drained which fixed the
+ "reverse" effect from only saving half of stereo files. cbagwell
+ o Can use "-e" without an effect again.
+ o Added -g and -a options for new style support of GSM and ADPCM. Added
+ error checking to various formats to avoid allowing these types.
+
+
+sox-12.14 1998-05-15
+---------
+
+ o Bumped major version number up and shortened name. The shorter name
+ should help the various distributions using this package.
+ o Added support for MS ADPCM and IMA (or DVI) ADPCM for .wav files.
+ Thanks to Mark Podlipec's xanim for this code (podlipec@ici.net).
+ o Change Lance Norskog's email address to thinman@meer.net. The old
+ one was bouncing.
+ o Added path string to play and rec strings so that it could be run by
+ users without complete paths setup (i.e. Ran by "rc" files during bootup
+ or shutdown)
+ o Fixed -e option from Richard Guenther
+ (richard.guenther@student.uni-tuebingen.de) and fixed a small bug
+ in stat.
+ o Fixed a bug in the mask effect for ULAW/ALAW files.
+ o Fixed a bug in cdr output files that appended trash to end of file.
+ o Guenter Geiger (geiger@iem.mhsg.ac.at) made a rather large patch to
+ allow sox to work on 64-bit alphas. It was done the easiest meathod
+ by changing all long declarations to use a macro that knows to
+ make it 32-bits. Want to port to another 64-bit-but-not-alpha
+ machine? Grep for "alpha" to see changes. There are most likely
+ several bugs left for alphas. Guenter is also supporting this
+ package for the Debian distribution.
+ o Did some major code cleanups to clear out some warning messages
+ during compile. This is to clear up problems I'm finding under
+ both alpha and dos. Some warning messages are actually useful
+ now (pointing out possible data loss). Hopefully, I didn't
+ break anything.
+ o Code clean up allows me to finally compile code under Turbo C
+ again. Too bad the EXE gets a currupted stack somewhere and locks
+ up the system. Anyone want to try it with Borland C for me?
+ If you get a working EXE I would like to start distributing a DOS
+ package like there used to be.
+ o Speaking of cleanups, anyone want to help cleanup the makefiles for
+ various platforms? They are quite outdated right now and it is
+ very obvious that Sox hasn't been able to compile under all the
+ platforms it once did for several releases. Please send in
+ the cleaned-up makefile versions along with what programs you
+ used to compile it with.
+ o There is a known bug in hcom's compress() function. It is allocating
+ memory that can't be free'd under some OS's. It causes a core dump.
+
+
+sox-11gamma-cb3 1997-03-28
+---------------
+
+This release of sox is mainly a bugfix release. The following things
+have changed:
+
+ o Documentation has been updated when it was obviously wrong.
+ Much more work could be done. Man pages were updated to
+ work correctly on Solaris and add some missing info.
+ o Several people sent me patches to fix compiling on Solaris
+ as well as fix a few bugs.
+ o Change USS driver's name to OSS. Man, does that driver
+ like to change names! This could cause problems if you
+ have made your own custom play and rec scripts.
+ o Updated my email address. Sorry if I haven't responded to
+ any emails as I no longer have access to my old address.
+ Please use cbagwell@sprynet.com.
+ o Fixed unix test scripts so that they worked again.
+ o Fixed endian bug in psion .wve code.
+ o Replaced outdated voc info file with detailed format info
+ inside voc code.
+ o Added new sound format, cvsd (Continuously Variable Slope Delta)
+ from Thomas Sailer (sailer@ife.ee.ethz.ch).
+
+
+sox-11gamma-cb2 1996-10-04
+---------------
+
+This release of sox is based on the latest gamma version released
+plus some patches I've made to support the following new features:
+
+I would like to thank everyone that wrote me about the long
+standing bug in Sox that could DELETE your /dev/* file if the
+program was aborted for reason such as invalid audio file. Special
+thanks for Bryan Franklin for sending in a patch when I was
+to busy to even look for it.
+
+ o Better play support for 8-bit stereo voc files. New support
+ for outputing both 8-bit and 16-bit stereo voc files.
+ o Built-in support for playing and recording from Linux /dev/dsp.
+ This is a re-write and seperate module from the previous
+ support included inside the sbdsp module. Also fixes a buffer
+ size bug that showed up when using newer versions of OSS.
+ This driver will work with OSS (and older versions called USS, TASD
+ and Voxware).
+ o Support for audio playing and recording with SunOS /dev/audio.
+ o Fixes a bug were /dev/audio or /dev/dsp could be deleted
+ when playing an invalid format audio file.
+ o Expanded options for play and rec scripts. You can now specify
+ sox effects after the filename and hear them in real time.
+ Please be sure that an older version of sox is not in your path
+ because these script will possibly find it first and
+ incorrectly use it.
+ o Setting play/record volume still requires an external program.
+ If you have one a command line program to do this (such as
+ "mixer" for Linux) then you will want to edit the play and rec
+ to use this. The current support for it is only in example
+ form of how it can be done.
+
+
+List of earlier SoX Contributors
+--------------------------------
+Covering the time from its creation (Jul '91) until sox-11gamma (Feb '95):
+
+ o Lance Norskog thinman at netcom.com
+ Creator & maintenance
+ o Guido Van Rossum guido at cwi.nl
+ AU, AIFF, AUTO, HCOM, reverse, many bug fixes
+ o Jef Poskanzer jef at well.sf.ca.us
+ original code for u-law and delay line
+ o Bill Neisius bill%solaria at hac2arpa.hac.com
+ DOS port, 8SVX, Sounder, Soundtool formats
+ Apollo fixes, stat with auto-picker
+ o Rick Richardson rick at digibd.com
+ WAV and SB driver handlers, fixes
+ o David Champion dgc3 at midway.uchicago.edu
+ Amiga port
+ o Pace Willisson pace at blitz.com
+ Fixes for ESIX
+ o Leigh Smith leigh at psychok.dialix.oz.au
+ SMP and comment movement support.
+ o David Sanderson dws at ssec.wisc.edu
+ AIX3.1 fixes
+ o Glenn Lewis glewis at pcocd2.intel.com
+ AIFF chunking fixes
+ o Brian Campbell brianc at quantum.qnx.com
+ QNX port and 16-bit fixes
+ o Chris Adams gt8741 at prism.gatech.edu
+ DOS port fixes
+ o John Kohl jtkohl at kolvir.elcr.ca.us
+ BSD386 port, VOC stereo support
+ o Ken Kubo ken at hmcvax.claremont.edu
+ VMS port, VOC stereo support
+ o Frank Gadegast phade at cs.tu-berlin.de
+ Microsoft C 7.0 & C Borland 3.0 ports
+ o David Elliot dce at scmc.sony.com
+ CD-R format support
+ o David Sears dns at essnj3.essnjay.com
+ Linux support
+ o Tom Littlejohn tlit at seq1.loc.gov
+ Raw textual data
+ o Boisy G. Pitre boisy at microware.com
+ OS9 port
+ o Sun Microsystems, Guido Van Rossum
+ CCITT G.711, G.721, G.723 implementation
+ o Graeme Gill graeme at labtam.labtam.oz.au
+ A-LAW format, Good .WAV handling, avg channel expansion
+ o Allen Grider grider at hfsi.hfsi.com
+ VOC stereo mode, WAV file handling
+ o Michel Fingerhut Michel.Fingerhut at ircam.fr
+ Upgrade 'sf' format to current IRCAM format. Float file support.
+ o Chris Knight
+ Achimedes Acorn support
+ o Richard Caley R.Caley at ed.ac.uk
+ Psion WVE handler
+ o Lutz Vieweg lkv at mania.RoBIN.de
+ MAUD (Amiga) file handler
+ o Tim Gardner timg at tpi.com
+ Windows NT port for V7
+ o Jimen Ching jiching at wiliki.eng.hawaii.edu
+ Libst porting bugs
+ o Lauren Weinstein lauren at vortex.com
+ DOS porting, scripts, professional use
diff --git a/src/FEATURES.in b/src/FEATURES.in
new file mode 100644
index 0000000..43ab6c6
--- /dev/null
+++ b/src/FEATURES.in
@@ -0,0 +1,145 @@
+The current release handles the following audio file formats:
+(:table border=0:)
+(:cellnr:)
+* Raw files in various binary formats
+* Raw textual data
+* Amiga 8svx files
+* Apple/SGI AIFF files
+* SUN .au files
+** PCM, u-law, A-law
+** G7xx ADPCM files (read only)
+** mutant DEC .au files
+** NeXT .snd files
+* AVR files
+* CDDA (Compact Disc Digital Audio format)
+* CVS and VMS files (continuous variable slope)
+* Grandstream ring-tone files
+* GSM files
+* HTK files
+* LPC-10 files
+* Macintosh HCOM files
+* Amiga MAUD files
+* AMR-WB & AMR-NB (with optional libamrwb & libamrnb libraries)
+* MP2/MP3 (with optional libmad, libtwolame and libmp3lame libraries)
+* Opus files (read only; with optional Opus libraries)
+(:cell:)
+* Ogg Vorbis files (with optional Ogg Vorbis libraries)
+* FLAC files (with optional libFLAC)
+* IRCAM SoundFile files
+* NIST SPHERE files
+* Turtle beach SampleVision files
+* Sounder & Soundtool (DOS) files
+* Yamaha TX-16W sampler files
+* SoundBlaster .VOC files
+* Dialogic/OKI ADPCM files (.VOX)
+* Microsoft .WAV files
+** PCM, floating point
+** u-law, A-law, MS ADPCM, IMA (DMI) ADPCM
+** GSM
+** RIFX (big endian)
+* WavPack files (with optional libwavpack library)
+* Psion (palmtop) A-law WVE files and Record voice notes
+* Maxis XA Audio files
+** EA ADPCM (read support only, for now)
+* Pseudo formats that allow direct playing/recording from most audio devices
+* The "null" pseudo-file that reads and writes from/to nowhere
+(:tableend:)
+
+The audio effects/tools included in this release are as follows:
+
+* Tone/filter effects
+** allpass: RBJ all-pass biquad IIR filter
+** bandpass: RBJ band-pass biquad IIR filter
+** bandreject: RBJ band-reject biquad IIR filter
+** band: SPKit resonator band-pass IIR filter
+** bass: Tone control: RBJ shelving biquad IIR filter
+** equalizer: RBJ peaking equalisation biquad IIR filter
+** firfit+: FFT convolution FIR filter using given freq. response (W.I.P.)
+** highpass: High-pass filter: Single pole or RBJ biquad IIR
+** hilbert: Hilbert transform filter (90 degrees phase shift)
+** lowpass: Low-pass filter: single pole or RBJ biquad IIR
+** sinc: Sinc-windowed low/high-pass/band-pass/reject FIR
+** treble: Tone control: RBJ shelving biquad IIR filter
+
+* Production effects
+** chorus: Make a single instrument sound like many
+** delay: Delay one or more channels
+** echo: Add an echo
+** echos: Add a sequence of echos
+** flanger: Stereo flanger
+** overdrive: Non-linear distortion
+** phaser: Phase shifter
+** repeat: Loop the audio a number of times
+** reverb: Add reverberation
+** reverse: Reverse the audio (to search for Satanic messages ;-)
+** tremolo: Sinusoidal volume modulation
+
+* Volume/level effects
+** compand: Signal level compression/expansion/limiting
+** contrast: Phase contrast volume enhancement
+** dcshift: Apply or remove DC offset
+** fade: Apply a fade-in and/or fade-out to the audio
+** gain: Apply gain or attenuation; normalise/equalise/balance/headroom
+** loudness: Gain control with ISO 226 loudness compensation
+** mcompand: Multi-band compression/expansion/limiting
+** norm: Normalise to 0dB (or other)
+** vol: Adjust audio volume
+
+* Editing effects
+** pad: Pad (usually) the ends of the audio with silence
+** silence: Remove portions of silence from the audio
+** splice: Perform the equivalent of a cross-faded tape splice
+** trim: Cuts portions out of the audio
+** vad: Voice activity detector
+
+* Mixing effects
+** channels: Auto mix or duplicate to change number of channels
+** divide+: Divide sample values by those in the 1st channel (W.I.P.)
+** remix: Produce arbitrarily mixed output channels
+** swap: Swap pairs of channels
+
+* Pitch/tempo effects
+** bend: Bend pitch at given times without changing tempo
+** pitch: Adjust pitch (= key) without changing tempo
+** speed: Adjust pitch & tempo together
+** stretch: Adjust tempo without changing pitch (simple alg.)
+** tempo: Adjust tempo without changing pitch (WSOLA alg.)
+
+* Mastering effects
+** dither: Add dither noise to increase quantisation SNR
+** rate: Change audio sampling rate
+
+* Specialised filters/mixers
+** deemph: ISO 908 CD de-emphasis (shelving) IIR filter
+** earwax: Process CD audio to best effect for headphone use
+** noisered: Filter out noise from the audio
+** oops: Out Of Phase Stereo (or `Karaoke') effect
+** riaa: RIAA vinyl playback equalisation
+
+* Analysis `effects'
+** noiseprof: Produce a DFT profile of the audio (use with noisered)
+** spectrogram: graph signal level vs. frequency & time (needs `libpng')
+** stat: Enumerate audio peak & RMS levels, approx. freq., etc.
+** stats: Multichannel aware `stat'
+
+* Miscellaneous effects
+** ladspa: Apply LADSPA plug-in effects e.g. CMT (Computer Music Toolkit)
+** synth: Synthesise/modulate audio tones or noise signals
+** newfile: Create a new output file when an effects chain ends.
+** restart: Restart 1st effects chain when multiple chains exist.
+
+* Low-level signal processing effects
+** biquad: 2nd-order IIR filter using externally provided coefficients
+** downsample: Reduce sample rate by discarding samples
+** fir: FFT convolution FIR filter using externally provided coefficients
+** upsample: Increase sample rate by zero stuffing
+
+ + Experimental or incomplete effect; may change in future.
+
+Multiple audio files can be combined (and then further processed with
+effects) using any one of the following combiner methods:
+
+* concatenate
+* mix
+* merge: E.g. two mono files to one stereo file
+* sequence: For playing multiple audio files/streams
diff --git a/src/INSTALL b/src/INSTALL
new file mode 100644
index 0000000..b08b1ad
--- /dev/null
+++ b/src/INSTALL
@@ -0,0 +1,350 @@
+ SoX Installation
+ ----------------
+
+SoX should compile and run on any POSIX compatible system (Linux, BSD,
+Solaris, Xcode on Mac OS X, Cygwin on MS-Windows, etc.). Some
+non-POSIX compilers (such as MSVC) are supported via the `CMake' build
+utility. For other compilers/systems, it is often possible to
+manually construct a custom `soxconfig.h' and `Makefile' for that
+system (the minimum requirements are 32-bit CPU, 64-bit FPU, C89
+compiler).
+
+Note that the `play', `rec', and `soxi' programs are in fact just
+copies-of or links-to (depending on OS) `sox'.
+
+SoX optionally makes use of some external libraries to obtain support
+for additional file formats and/or effects. Optional libraries should
+be installed before compiling SoX. The current list of supported
+libraries, where to get them (if not from your OS distribution), and
+their licence types, is as follows:
+
+OpencoreAMR-NB/WB http://sourceforge.net/projects/opencore-amr Apache
+AMR-NB/WB http://www.penguin.cz/~utx/amr See library web page
+AO http://xiph.org/ao GPL
+FLAC http://flac.sourceforge.net BSD
+LADSPA http://www.ladspa.org LGPL + plugins' licence
+Lame MP3 encoder http://lame.sourceforge.net LGPL
+Twolame MP2 enc. http://www.twolame.org LGPL
+libltdl http://www.gnu.org/software/libtool LGPL
+MAD MP3 decoder http://www.underbit.com/products/mad GPL
+MP3 ID3 tags http://www.underbit.com/products/mad GPL
+Magic http://www.darwinsys.com/file BSD
+Ogg Vorbis http://www.vorbis.com BSD
+Opus http://www.opus-codec.org/ BSD
+PNG http://www.libpng.org/pub/png zlib (BSD-like)
+Sndfile http://www.mega-nerd.com/libsndfile LGPL
+WavPack http://www.wavpack.com BSD
+
+
+
+Compiling and installing on a POSIX system
+------------------------------------------
+
+First install any optional libraries that you need for SoX. Some
+libraries may require pkg-config to be installed to be properly
+detected by SoX.
+
+[Only if you're compiling the git sources, first make sure you have
+the GNU autotools installed (automake >= 1.9, autoconf >= 2.62) and
+run
+
+ autoreconf -i
+]
+
+To compile and install SoX (executables, libraries, manual pages) with
+a default configuration for your platform, run the following commands:
+
+ ./configure
+ make -s
+ make install
+
+There should be no errors and few, if any, warnings during the `make
+-s' stage. Any warnings about pointer mismatch or conversion should
+be treated with deep suspicion.
+
+The `make install' command may require `root' priviliges; for example,
+on some systems, the following modification to the command is needed:
+
+ sudo make install
+
+To run a selection of tests on the installed sox executable:
+
+ make installcheck
+
+Optionally, HTML & PDF versions of the manual pages can be built and
+installed as follows:
+
+ make html
+ make install-html
+ make pdf
+ make install-pdf
+
+Again, `root' priviliges may be needed at the install stages.
+
+
+
+Custom build options on a POSIX system
+--------------------------------------
+
+Selection of optional libraries and of other build options can be made
+by adding parameters to the `./configure' command line (above). Run
+
+ ./configure --help
+
+for a complete list of options.
+
+Each optional file-format may be configured to be loaded statically
+(the default) or dynamically. The dynamic option may be useful for
+distribution packaging reasons -- for example, to keep separate `free'
+and `non-free' software.
+
+If you are building SoX for a `distribution' (i.e. the build will be
+used by others), please use --with-distro to identify the distribution
+as this information is useful in helping to diagnose SoX bug reports.
+For example,
+
+ ./configure --with-distro='Super Linux OS 6.1'
+
+If any libraries are installed in a non-standard locations in your
+system then you can use the CPPFLAGS and LDFLAGS variables to allow
+configure to find them. For example:
+
+./configure CPPFLAGS="-I/home/sox/include -I/usr/local/multimedia/include" LDFLAGS="-L/home/sox/lib -L/usr/local/multimedia/lib"
+
+If you are compiling under cygwin and would like to create a static
+sox.exe using mingw libraries then you can use the following:
+
+./configure CC="gcc -mno-cygwin" --disable-shared
+
+The next cygwin example is used to build the cygwin version of SoX that is
+distributed by the project. It tells gcc to prefer static libraries
+over dynamic ones and to use some static libraries compiled manually
+and installed under /usr/local.
+
+./configure LDFLAGS="-static -L/usr/local/lib" CPPFLAGS=-I/usr/local/include
+
+You can run "cygcheck.exe src/sox.exe" after compiling to see which
+dynamic DLL's will be required to be distributed with the cygwin
+executable.
+
+Alternatively, you can make use of the "cygbuild" script distributed
+with SoX source that is used to automate all steps of building
+a win32 package. "osxbuild" script is used to automate all steps
+of building a MacOS X package.
+
+Newer versions of SoX include support for loading libraries for
+file formats at runtime. The main usage of this feature is to
+allow shipping SoX without dependencies on external libraries
+that are not globally used or have redistribution restrictions.
+If you experience problems with this then you may wish to disable
+this feature:
+
+./configure --without-libltdl
+
+Also, the default behavior even when libltdl is used is to link
+all file format handlers into libsox as there is a performance
+hit when dynamically loading external libraries. To force a format
+handler to be built as a dynamically loaded module, pass "dyn" to
+its --with-* option. For example, to build pulseaudio handler as
+an external dynamic library:
+
+./configure --with-pulseaudio=dyn
+
+A subset of external libraries can be configured to be dlopen()'ed
+at run time instead of being linked in. This will allow one to
+distribute a binary with optional features that only require
+a user to install the missing libraries into their system. This
+can be enabled using:
+
+--enable-dl-lame
+--enable-dl-mad
+--enable-dl-sndfile
+--enable-dl-amrnb
+--enable-dl-amrwb
+
+Testing
+-------
+
+N.B.: If SoX is configured and compiled to load some file-formats
+dynamically, then it will not be able to load them when running SoX
+executables from within the source file directory until after SoX has
+been installed (temporarily configuring with --without-libltdl removes
+this restriction).
+
+After successfully compiling SoX, try translating a sound file. You
+should also playback the new file to make sure it sounds like the
+original. You can either use an external program or SoX itself
+if compiled with playback support.
+
+To work with widest range of playback programs, you should chose a
+format that is native to your OS; such as .wav for Windows or .aiff for
+MacOS. In the following example, we'll use .xxx as the extension of
+your preferred format.
+
+ cd src
+ ./sox monkey.wav monkey.xxx
+
+You may have to give the word size and rate for the file. For example,
+this command will make a sound file with a data rate of 12,500 samples
+per second and the data formatted as 2-byte (16-bit) signed integers:
+
+ ./sox monkey.wav -r 12500 -2 -s monkey.xxx
+
+If playback support was compiled in then it can be played like this:
+
+ ./play monkey.xxx
+
+or, equivalently:
+
+ ./sox monkey.xxx -d
+
+If monkey.xxx plays properly (it's a very short monkey screech),
+congratulations! SoX works.
+
+If you're adding new features to SoX or want to perform advance tests
+on a new platform then you can use the scripts "tests.sh" and
+"testall.sh" to stress SoX.
+
+
+
+Compiling using Microsoft's Visual C
+------------------------------------
+
+To compile a full-featured build of SoX with Visual Studio 2008 (msvc9),
+Visual Studio 2010 (msvc10), or the Windows SDK 7.1, you may be able to use the
+preconfigured solution found in the sox\msvc9 (VS2008) or sox\msvc10 (VS2010 or
+Windows SDK 7.1) folder. See sox\msvc9\readme.txt or sox\msvc10\readme.txt for
+details on building using the corresponding Microsoft C compiler. If the
+preconfigured solution doesn't work for you, build with CMake as follows:
+
+o Install cmake (http://www.cmake.org/HTML/Download.html)
+o Install any optional libraries to use with SoX
+o Unpack the SoX sources (...tar.gz) to say c:\sox
+o Type cd c:\sox
+o Type cmake -G "compiler" . (type cmake --help for list of compilers)
+
+This should generate project build files for use with Visual C.
+
+
+
+Appendix: How To Compile SoX with MP3 Support on Win32
+------------------------------------------------------
+
+The solution files in msvc9 and msvc10 will build SoX to dynamically load
+libmad.dll and libmp3lame.dll at runtime.
+
+The following text, untested by the SoX team, was originally written
+by `Enter AG' and released to the public domain. It includes instructions for
+building SoX with MP3 support linked directly into the SoX executable.
+
+= How To Compile Sox with MP3 Support =
+
+== Requirements ==
+
+The following requirements have been tested. Nevertheless, other
+versions may work as well.
+
+o Microsoft Windows (Win32, Win2000, XP, Win2003, Vista, etc.).
+
+o CMake (Cross Platform Make) version 2.4
+ available on [http://www.cmake.org]
+
+o Microsoft Visual Stuio 2008 (earlier versions should also work).
+
+o SoX source distribution version 14.0.1
+ available on [http://sox.sourceforge.net]
+
+o LAME source distribution version 3.97. LAME 3.98 is required for full ID3 tag
+ support. Available on [http://lame.sourceforge.net]
+
+o MAD source distribution version 0.15.1b
+ available on [http://www.underbit.com/products/mad/]
+
+== Compilation Procedure ==
+
+=== Compilation of the LAME libraries ===
+
+o Extract the LAME source distribution and open it as a Visual Studio project
+ using the VS file in the top directory.
+
+o Set the ''libmp3lame'' "Configuration Properties -> C/C++ -> Code Generation
+ -> Runtime Library" to Multi-threaded DLL (/MD).
+
+o Do the same for ''mpglib'' .
+
+o Build ''libmp3lame'' and ''mpglib.''
+
+o Rename the static library libmp3lame.lib to mp3lame.lib.
+
+o Create a folder somewhere with an arbitrary name. We used the name
+ "lameforsox". Create in this folder a new folder called "lame" and copy the
+ lame.h header file into it. Copy mp3lame.lib and mpglib.lib in the lameforsox
+ folder. Now you should have prepared the lame components for further use like
+ this:
+ ...\[somewhere]\lameforsox\
+ mp3lame.lib
+ mpglib.lib
+ \lame\
+ lame.h
+
+=== Compilation of the MAD library ===
+
+o Compile ''libmad'' with the same "Runtime Library" settings as described for
+ LAME (previous section Compilation of the LAME libraries).
+
+o Rename the static library libmad.lib to mad.lib.
+
+=== Compilation of SoX with the LAME and MAD libraries ===
+
+o Open Visual Studio and add in "Tools -> Options -> Projects and Solutions ->
+ VC++ Directories" in the "Include Directories" collection the folder
+ containing the MAD header file mad.h and the folder containing lame/lame.h
+ (...\[somewhere]\lameforsox). Add in the "Library files" collection the
+ folder containing mad.lib and the folder containing the lame libraries
+ mp3lame.lib and mpglib.lib (...\[somewhere]\lameforsox).
+
+o Edit the CMakeLists.txt in the SoX top directory:
+ Add
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} mpglib)
+ after some blank lines beneath the statement
+ if(NEED_LIBM)
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lm)
+ endif(NEED_LIBM)
+
+o Open the windows command line console and change into the SoX top directory.
+
+o Execute cmake like this:
+ cmake.exe ./ -G "Visual Studio 9 2008"
+
+o If the Visual Studio settings are done as described above the following cmake
+ output should appear:
+ ...
+ include files HAVE_MAD_H1 - found
+ mad_stream_buffer in madmad_stream_buffer in mad - found
+ ...
+ include files HAVE_LAME_LAME_H1 - found
+ lame_init in mp3lamelame_init in mp3lame - found
+ ...
+
+o If not check CMakeFiles\CMakeError.log.
+
+o Open Visual Studio and open the SoX solution file in the SoX top directory
+ (sox.sln).
+
+o Rebuild "ALL_BUILD" and confirm all "File Modification Detected" dialogs
+ with "Reload".
+
+o Add in the libsox "Preprocessor Definitions" (right click on libsox ->
+ Properties -> Configuration Properties -> C/C++ -> Preprocessor) HAVE_STRING_H
+ before the first line. Set the "Runtime Library" to Multi-threaded DLL (/MD)
+ as described above.
+
+o Do the same for sox and add in the "Additional Dependencies" (Linker -> Input)
+ after the last line mpglib.lib.
+
+o Now build libsox
+
+o and then sox.
+
+o Sox now prompts "mp3, mp2" in the usage output in the section "SUPPORTED FILE
+ FORMATS".
diff --git a/src/LICENSE b/src/LICENSE
new file mode 100644
index 0000000..84ac4c8
--- /dev/null
+++ b/src/LICENSE
@@ -0,0 +1,11 @@
+SoX source code is distributed under two main licenses. The two
+licenses are in the files LICENSE.GPL and LICENSE.LGPL.
+
+sox.c, and thus SoX-the user application, is distributed under the
+GPL, while the files that make up libsox are licensed under the less
+restrictive LGPL.
+
+Note that some of the external packages that can be linked into libsox
+are GPLed and/or may have licensing problems, so they can be disabled
+at configure time with the relevant--with-* options. If libsox is built
+with such libraries, it must be distributed under the GPL.
diff --git a/src/LICENSE.GPL b/src/LICENSE.GPL
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/src/LICENSE.GPL
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/src/LICENSE.LGPL b/src/LICENSE.LGPL
new file mode 100644
index 0000000..5ab7695
--- /dev/null
+++ b/src/LICENSE.LGPL
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+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 and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, 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 library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+ 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 Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+ If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be 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.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+ 9. 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 Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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 with
+this License.
+
+ 11. 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 Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser 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 Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..12076b1
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,130 @@
+## Process this file with automake to produce Makefile.in
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = lpc10 libgsm src
+DIST_SUBDIRS = lpc10 libgsm src msvc9 msvc10
+
+RM = rm -f
+
+# man pages are not considered to be sources, so need to add "dist_"
+# prefix to ensure they are added to the distribution.
+dist_man_MANS = sox.1 soxi.1 soxformat.7 libsox.3
+EXTRA_DIST = sox.txt soxi.txt soxformat.txt libsox.txt \
+ CMakeLists.txt sox.pc.in LICENSE.GPL LICENSE.LGPL \
+ cygbuild README.win32 README.osx scripts/batch-example.bat \
+ README.sh FEATURES.in
+
+if HAVE_PKGCONFIG
+pkgconfigdir = @PKGCONFIGDIR@
+pkgconfig_DATA = sox.pc
+endif
+
+play.1 rec.1: sox.1
+ $(RM) $@ && $(LN_S) $< $@
+
+README: README.sh FEATURES.in
+ ./README.sh
+
+# Rule for making text man pages. Uses GNU nroff's -c so not portable.
+.1.txt:
+ tbl $(srcdir)/$< | nroff -man -c | sed "s/.//g" > $@
+.3.txt:
+ tbl $(srcdir)/$< | nroff -man -c | sed "s/.//g" > $@
+.7.txt:
+ tbl $(srcdir)/$< | nroff -man -c | sed "s/.//g" > $@
+
+DOCTXT = sox.txt soxi.txt soxformat.txt libsox.txt README
+txt: $(DOCTXT)
+
+# Rule for making PDF man pages
+.1.pdf:
+ pdfroff -t -man -Tps $(srcdir)/$< > $@
+.3.pdf:
+ pdfroff -t -man -Tps $(srcdir)/$< > $@
+.7.pdf:
+ pdfroff -t -man -Tps $(srcdir)/$< > $@
+
+DOCPDF = sox.pdf soxi.pdf soxformat.pdf libsox.pdf
+pdf: $(DOCPDF)
+
+install-pdf: pdf
+ @$(NORMAL_INSTALL)
+ test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
+ @list='$(DOCPDF)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+uninstall-pdf:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DOCPDF)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " $(RM) '$(DESTDIR)$(pdfdir)/$$f'"; \
+ $(RM) "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+distclean-local:
+ $(RM) mingw32-config.cache
+ $(RM) -r -f soxpng
+
+# Rule for making HTML man pages
+#
+# Get rid on unneeded Content-Type, man directory and manpage index in extension.
+# e.g. ../man1/soxi.1.html becomes ../soxi.html
+# Return to Main Contents and link to man2html are also modified.
+FIXHTML = sed 's,<head>,&<link rel="stylesheet" href="http://sox.sourceforge.net/pub/skins/sox/sox.css" type="text/css"></link>,'
+
+.1.html:
+ groff -t -man -Thtml -P -Dsoxpng $(srcdir)/$< | $(FIXHTML) > $@
+.3.html:
+ groff -t -man -Thtml -P -Dsoxpng $(srcdir)/$< | $(FIXHTML) > $@
+.7.html:
+ groff -t -man -Thtml -P -Dsoxpng $(srcdir)/$< | $(FIXHTML) > $@
+
+DOCHTML = sox.html soxi.html soxformat.html libsox.html
+html: $(DOCHTML)
+
+install-html: html
+ @$(NORMAL_INSTALL)
+ test -z "$(htmldir)/soxpng" || $(MKDIR_P) "$(DESTDIR)$(htmldir)/soxpng"
+ @list='$(DOCHTML)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)//$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
+ done; \
+ @for p in soxpng/*; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/soxpng/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/soxpng/$$f"; \
+ done
+
+uninstall-html:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DOCHTML)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " $(RM) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(RM) "$(DESTDIR)$(htmldir)/$$f"; \
+ done; \
+ $(RM) -fr "$(DESTDIR)$(htmldir)/soxpng";
+
+DISTCLEANFILES = $(DOCHTML) $(DOCPDF)
+MAINTAINERCLEANFILES = $(DOCTXT)
+
+install-data-hook:
+ cd $(DESTDIR)$(mandir)/man1 && $(RM) play.1 && $(LN_S) sox.1 play.1
+ cd $(DESTDIR)$(mandir)/man1 && $(RM) rec.1 && $(LN_S) sox.1 rec.1
+ cd $(DESTDIR)$(mandir)/man7 && $(RM) soxeffect.7 && $(LN_S) ../man1/sox.1 soxeffect.7
+
+uninstall-hook:
+ $(RM) $(DESTDIR)$(mandir)/man1/play.1
+ $(RM) $(DESTDIR)$(mandir)/man1/rec.1
+ $(RM) $(DESTDIR)$(mandir)/man7/soxeffect.7
+
+# Automatically update libtool script if it gets out-of-date
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..fef5651
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,1156 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = .
+DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
+ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/sox.pc.in $(dist_man_MANS) COPYING compile \
+ config.guess config.sub depcomp install-sh missing ltmain.sh
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gcc_stack_protect.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/optional-fmt.m4 $(top_srcdir)/m4/sndfile.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/soxconfig.h
+CONFIG_CLEAN_FILES = sox.pc
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
+ "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(pkgconfigdir)"
+man3dir = $(mandir)/man3
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(dist_man_MANS)
+DATA = $(pkgconfig_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+ cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMRNB_CFLAGS = @AMRNB_CFLAGS@
+AMRNB_LIBS = @AMRNB_LIBS@
+AMRWB_CFLAGS = @AMRWB_CFLAGS@
+AMRWB_LIBS = @AMRWB_LIBS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AO_CFLAGS = @AO_CFLAGS@
+AO_LIBS = @AO_LIBS@
+APP_LDFLAGS = @APP_LDFLAGS@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COREAUDIO_CFLAGS = @COREAUDIO_CFLAGS@
+COREAUDIO_LIBS = @COREAUDIO_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTRO = @DISTRO@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLAC_CFLAGS = @FLAC_CFLAGS@
+FLAC_LIBS = @FLAC_LIBS@
+GOMP_LIBS = @GOMP_LIBS@
+GREP = @GREP@
+GSM_CFLAGS = @GSM_CFLAGS@
+GSM_LIBS = @GSM_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LADSPA_PATH = @LADSPA_PATH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGSM_LIBADD = @LIBGSM_LIBADD@
+LIBLPC10_LIBADD = @LIBLPC10_LIBADD@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOLFLAGS = @LIBTOOLFLAGS@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LPC10_CFLAGS = @LPC10_CFLAGS@
+LPC10_LIBS = @LPC10_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAGIC_LIBS = @MAGIC_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MP3_CFLAGS = @MP3_CFLAGS@
+MP3_LIBS = @MP3_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OGG_VORBIS_CFLAGS = @OGG_VORBIS_CFLAGS@
+OGG_VORBIS_LIBS = @OGG_VORBIS_LIBS@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OPUS_CFLAGS = @OPUS_CFLAGS@
+OPUS_LIBS = @OPUS_LIBS@
+OSS_CFLAGS = @OSS_CFLAGS@
+OSS_LIBS = @OSS_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKGCONFIGDIR = @PKGCONFIGDIR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLAYRECLINKS = @PLAYRECLINKS@
+PNG_LIBS = @PNG_LIBS@
+PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
+PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHLIB_VERSION = @SHLIB_VERSION@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+SNDIO_CFLAGS = @SNDIO_CFLAGS@
+SNDIO_LIBS = @SNDIO_LIBS@
+STRIP = @STRIP@
+SUN_AUDIO_CFLAGS = @SUN_AUDIO_CFLAGS@
+SUN_AUDIO_LIBS = @SUN_AUDIO_LIBS@
+SYMLINKS = @SYMLINKS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WAVEAUDIO_CFLAGS = @WAVEAUDIO_CFLAGS@
+WAVEAUDIO_LIBS = @WAVEAUDIO_LIBS@
+WAVPACK_CFLAGS = @WAVPACK_CFLAGS@
+WAVPACK_LIBS = @WAVPACK_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = lpc10 libgsm src
+DIST_SUBDIRS = lpc10 libgsm src msvc9 msvc10
+RM = rm -f
+
+# man pages are not considered to be sources, so need to add "dist_"
+# prefix to ensure they are added to the distribution.
+dist_man_MANS = sox.1 soxi.1 soxformat.7 libsox.3
+EXTRA_DIST = sox.txt soxi.txt soxformat.txt libsox.txt \
+ CMakeLists.txt sox.pc.in LICENSE.GPL LICENSE.LGPL \
+ cygbuild README.win32 README.osx scripts/batch-example.bat \
+ README.sh FEATURES.in
+
+@HAVE_PKGCONFIG_TRUE@pkgconfigdir = @PKGCONFIGDIR@
+@HAVE_PKGCONFIG_TRUE@pkgconfig_DATA = sox.pc
+DOCTXT = sox.txt soxi.txt soxformat.txt libsox.txt README
+DOCPDF = sox.pdf soxi.pdf soxformat.pdf libsox.pdf
+
+# Rule for making HTML man pages
+#
+# Get rid on unneeded Content-Type, man directory and manpage index in extension.
+# e.g. ../man1/soxi.1.html becomes ../soxi.html
+# Return to Main Contents and link to man2html are also modified.
+FIXHTML = sed 's,<head>,&<link rel="stylesheet" href="http://sox.sourceforge.net/pub/skins/sox/sox.css" type="text/css"></link>,'
+DOCHTML = sox.html soxi.html soxformat.html libsox.html
+DISTCLEANFILES = $(DOCHTML) $(DOCPDF)
+MAINTAINERCLEANFILES = $(DOCTXT)
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .1 .3 .7 .html .pdf .txt
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+sox.pc: $(top_builddir)/config.status $(srcdir)/sox.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+install-man1: $(dist_man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(dist_man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+install-man3: $(dist_man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(dist_man_MANS)'; \
+ test -n "$(man3dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.3[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man3:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man3dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.3[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
+install-man7: $(dist_man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(dist_man_MANS)'; \
+ test -n "$(man7dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man7dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man7dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.7[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man7dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man7dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man7dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.7[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man7dir)'; $(am__uninstall_files_from_dir)
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+ -rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__post_remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__post_remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__post_remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__post_remove_distdir)
+
+dist-tarZ: distdir
+ @echo WARNING: "Support for shar distribution archives is" \
+ "deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__post_remove_distdir)
+
+dist-shar: distdir
+ @echo WARNING: "Support for distribution archives compressed with" \
+ "legacy program 'compress' is deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__post_remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__post_remove_distdir)
+
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir)
+ chmod u+w $(distdir)
+ mkdir $(distdir)/_build $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ --srcdir=.. --prefix="$$dc_install_base" \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__post_remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(MANS) $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(pkgconfigdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man install-pkgconfigDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man: install-man1 install-man3 install-man7
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-man uninstall-pkgconfigDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+uninstall-man: uninstall-man1 uninstall-man3 uninstall-man7
+
+.MAKE: $(am__recursive_targets) install-am install-data-am \
+ install-strip uninstall-am
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+ am--refresh check check-am clean clean-cscope clean-generic \
+ clean-libtool cscope cscopelist-am ctags ctags-am dist \
+ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
+ dist-xz dist-zip distcheck distclean distclean-generic \
+ distclean-libtool distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-data-hook install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-man1 \
+ install-man3 install-man7 install-pdf install-pdf-am \
+ install-pkgconfigDATA install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-hook \
+ uninstall-man uninstall-man1 uninstall-man3 uninstall-man7 \
+ uninstall-pkgconfigDATA
+
+
+play.1 rec.1: sox.1
+ $(RM) $@ && $(LN_S) $< $@
+
+README: README.sh FEATURES.in
+ ./README.sh
+
+# Rule for making text man pages. Uses GNU nroff's -c so not portable.
+.1.txt:
+ tbl $(srcdir)/$< | nroff -man -c | sed "s/.//g" > $@
+.3.txt:
+ tbl $(srcdir)/$< | nroff -man -c | sed "s/.//g" > $@
+.7.txt:
+ tbl $(srcdir)/$< | nroff -man -c | sed "s/.//g" > $@
+txt: $(DOCTXT)
+
+# Rule for making PDF man pages
+.1.pdf:
+ pdfroff -t -man -Tps $(srcdir)/$< > $@
+.3.pdf:
+ pdfroff -t -man -Tps $(srcdir)/$< > $@
+.7.pdf:
+ pdfroff -t -man -Tps $(srcdir)/$< > $@
+pdf: $(DOCPDF)
+
+install-pdf: pdf
+ @$(NORMAL_INSTALL)
+ test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
+ @list='$(DOCPDF)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+uninstall-pdf:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DOCPDF)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " $(RM) '$(DESTDIR)$(pdfdir)/$$f'"; \
+ $(RM) "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+distclean-local:
+ $(RM) mingw32-config.cache
+ $(RM) -r -f soxpng
+
+.1.html:
+ groff -t -man -Thtml -P -Dsoxpng $(srcdir)/$< | $(FIXHTML) > $@
+.3.html:
+ groff -t -man -Thtml -P -Dsoxpng $(srcdir)/$< | $(FIXHTML) > $@
+.7.html:
+ groff -t -man -Thtml -P -Dsoxpng $(srcdir)/$< | $(FIXHTML) > $@
+html: $(DOCHTML)
+
+install-html: html
+ @$(NORMAL_INSTALL)
+ test -z "$(htmldir)/soxpng" || $(MKDIR_P) "$(DESTDIR)$(htmldir)/soxpng"
+ @list='$(DOCHTML)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)//$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
+ done; \
+ @for p in soxpng/*; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/soxpng/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/soxpng/$$f"; \
+ done
+
+uninstall-html:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DOCHTML)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " $(RM) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(RM) "$(DESTDIR)$(htmldir)/$$f"; \
+ done; \
+ $(RM) -fr "$(DESTDIR)$(htmldir)/soxpng";
+
+install-data-hook:
+ cd $(DESTDIR)$(mandir)/man1 && $(RM) play.1 && $(LN_S) sox.1 play.1
+ cd $(DESTDIR)$(mandir)/man1 && $(RM) rec.1 && $(LN_S) sox.1 rec.1
+ cd $(DESTDIR)$(mandir)/man7 && $(RM) soxeffect.7 && $(LN_S) ../man1/sox.1 soxeffect.7
+
+uninstall-hook:
+ $(RM) $(DESTDIR)$(mandir)/man1/play.1
+ $(RM) $(DESTDIR)$(mandir)/man1/rec.1
+ $(RM) $(DESTDIR)$(mandir)/man7/soxeffect.7
+
+# Automatically update libtool script if it gets out-of-date
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/NEWS b/src/NEWS
new file mode 100644
index 0000000..aed4683
--- /dev/null
+++ b/src/NEWS
@@ -0,0 +1,11 @@
+Highlights for this maintenance release include:
+
+ o Read support for Ogg Opus files.
+ o Read support for RF64 WAV files.
+ o Deemph can now be used at 48kHz sample rates.
+ o Rate is now much faster in many cases.
+ o Support multi-channel LADSPA plugins and optional latency compensation.
+ o Many other bug fixes.
+
+For an extensive list of changes, see the ChangeLog at
+ http://sourceforge.net/p/sox/code/ci/sox-14.4.2/tree/ChangeLog
diff --git a/src/README b/src/README
new file mode 100644
index 0000000..d50f332
--- /dev/null
+++ b/src/README
@@ -0,0 +1,196 @@
+ SoX: Sound eXchange
+ ===================
+
+SoX (Sound eXchange) is the Swiss Army knife of sound processing tools: it
+can convert sound files between many different file formats & audio devices,
+and can apply many sound effects & transformations, as well as doing basic
+analysis and providing input to more capable analysis and plotting tools.
+
+SoX is licensed under the GNU GPL and GNU LGPL. To be precise, the 'sox'
+and 'soxi' programs are distributed under the GPL, while the library
+'libsox' (in which most of SoX's functionality resides) is dual-licensed.
+Note that some optional components of libsox are GPL only: if you use these,
+you must use libsox under the GPL. See INSTALL for the list of optional
+components and their licences.
+
+If this distribution is of source code (as opposed to pre-built binaries),
+then you will need to compile and install SoX as described in the 'INSTALL'
+file.
+
+Changes between this release and previous releases of SoX can be found in
+the 'ChangeLog' file; a summary of the file formats and effects supported in
+this release can be found below. Detailed documentation for using SoX can
+be found in the distributed 'man' pages:
+
+ o sox(1)
+ o soxi(1)
+ o soxformat(7)
+ o libsox(3)
+
+or in plain text or PDF files for those systems without man.
+
+The majority of SoX features and fixes are contributed by SoX users - thank
+you very much for making SoX a success! There are several new features
+wanted for SoX, listed on the feature request tracker at the SoX project
+home-page:
+
+ http://sourceforge.net/projects/sox
+
+users are encouraged to implement them!
+
+Please submit bug reports, new feature requests, and patches to the relevant
+tracker at the above address, or by email:
+
+ mailto:sox-devel@lists.sourceforge.net
+
+Also accessible via the project home-page is the SoX users' discussion
+mailing list which you can join to discuss all matters SoX with other SoX
+users; the mail address for this list is:
+
+ mailto:sox-users@lists.sourceforge.net
+
+The current release handles the following audio file formats:
+
+
+ o Raw files in various binary formats
+ o Raw textual data
+ o Amiga 8svx files
+ o Apple/SGI AIFF files
+ o SUN .au files
+ o PCM, u-law, A-law
+ o G7xx ADPCM files (read only)
+ o mutant DEC .au files
+ o NeXT .snd files
+ o AVR files
+ o CDDA (Compact Disc Digital Audio format)
+ o CVS and VMS files (continuous variable slope)
+ o Grandstream ring-tone files
+ o GSM files
+ o HTK files
+ o LPC-10 files
+ o Macintosh HCOM files
+ o Amiga MAUD files
+ o AMR-WB & AMR-NB (with optional libamrwb & libamrnb libraries)
+ o MP2/MP3 (with optional libmad, libtwolame and libmp3lame libraries)
+ o Opus files (read only; with optional Opus libraries)
+
+ o Ogg Vorbis files (with optional Ogg Vorbis libraries)
+ o FLAC files (with optional libFLAC)
+ o IRCAM SoundFile files
+ o NIST SPHERE files
+ o Turtle beach SampleVision files
+ o Sounder & Soundtool (DOS) files
+ o Yamaha TX-16W sampler files
+ o SoundBlaster .VOC files
+ o Dialogic/OKI ADPCM files (.VOX)
+ o Microsoft .WAV files
+ o PCM, floating point
+ o u-law, A-law, MS ADPCM, IMA (DMI) ADPCM
+ o GSM
+ o RIFX (big endian)
+ o WavPack files (with optional libwavpack library)
+ o Psion (palmtop) A-law WVE files and Record voice notes
+ o Maxis XA Audio files
+ o EA ADPCM (read support only, for now)
+ o Pseudo formats that allow direct playing/recording from most audio devices
+ o The "null" pseudo-file that reads and writes from/to nowhere
+
+
+The audio effects/tools included in this release are as follows:
+
+ o Tone/filter effects
+ o allpass: RBJ all-pass biquad IIR filter
+ o bandpass: RBJ band-pass biquad IIR filter
+ o bandreject: RBJ band-reject biquad IIR filter
+ o band: SPKit resonator band-pass IIR filter
+ o bass: Tone control: RBJ shelving biquad IIR filter
+ o equalizer: RBJ peaking equalisation biquad IIR filter
+ o firfit+: FFT convolution FIR filter using given freq. response (W.I.P.)
+ o highpass: High-pass filter: Single pole or RBJ biquad IIR
+ o hilbert: Hilbert transform filter (90 degrees phase shift)
+ o lowpass: Low-pass filter: single pole or RBJ biquad IIR
+ o sinc: Sinc-windowed low/high-pass/band-pass/reject FIR
+ o treble: Tone control: RBJ shelving biquad IIR filter
+
+ o Production effects
+ o chorus: Make a single instrument sound like many
+ o delay: Delay one or more channels
+ o echo: Add an echo
+ o echos: Add a sequence of echos
+ o flanger: Stereo flanger
+ o overdrive: Non-linear distortion
+ o phaser: Phase shifter
+ o repeat: Loop the audio a number of times
+ o reverb: Add reverberation
+ o reverse: Reverse the audio (to search for Satanic messages ;-)
+ o tremolo: Sinusoidal volume modulation
+
+ o Volume/level effects
+ o compand: Signal level compression/expansion/limiting
+ o contrast: Phase contrast volume enhancement
+ o dcshift: Apply or remove DC offset
+ o fade: Apply a fade-in and/or fade-out to the audio
+ o gain: Apply gain or attenuation; normalise/equalise/balance/headroom
+ o loudness: Gain control with ISO 226 loudness compensation
+ o mcompand: Multi-band compression/expansion/limiting
+ o norm: Normalise to 0dB (or other)
+ o vol: Adjust audio volume
+
+ o Editing effects
+ o pad: Pad (usually) the ends of the audio with silence
+ o silence: Remove portions of silence from the audio
+ o splice: Perform the equivalent of a cross-faded tape splice
+ o trim: Cuts portions out of the audio
+ o vad: Voice activity detector
+
+ o Mixing effects
+ o channels: Auto mix or duplicate to change number of channels
+ o divide+: Divide sample values by those in the 1st channel (W.I.P.)
+ o remix: Produce arbitrarily mixed output channels
+ o swap: Swap pairs of channels
+
+ o Pitch/tempo effects
+ o bend: Bend pitch at given times without changing tempo
+ o pitch: Adjust pitch (= key) without changing tempo
+ o speed: Adjust pitch & tempo together
+ o stretch: Adjust tempo without changing pitch (simple alg.)
+ o tempo: Adjust tempo without changing pitch (WSOLA alg.)
+
+ o Mastering effects
+ o dither: Add dither noise to increase quantisation SNR
+ o rate: Change audio sampling rate
+
+ o Specialised filters/mixers
+ o deemph: ISO 908 CD de-emphasis (shelving) IIR filter
+ o earwax: Process CD audio to best effect for headphone use
+ o noisered: Filter out noise from the audio
+ o oops: Out Of Phase Stereo (or `Karaoke') effect
+ o riaa: RIAA vinyl playback equalisation
+
+ o Analysis `effects'
+ o noiseprof: Produce a DFT profile of the audio (use with noisered)
+ o spectrogram: graph signal level vs. frequency & time (needs `libpng')
+ o stat: Enumerate audio peak & RMS levels, approx. freq., etc.
+ o stats: Multichannel aware `stat'
+
+ o Miscellaneous effects
+ o ladspa: Apply LADSPA plug-in effects e.g. CMT (Computer Music Toolkit)
+ o synth: Synthesise/modulate audio tones or noise signals
+ o newfile: Create a new output file when an effects chain ends.
+ o restart: Restart 1st effects chain when multiple chains exist.
+
+ o Low-level signal processing effects
+ o biquad: 2nd-order IIR filter using externally provided coefficients
+ o downsample: Reduce sample rate by discarding samples
+ o fir: FFT convolution FIR filter using externally provided coefficients
+ o upsample: Increase sample rate by zero stuffing
+
+ + Experimental or incomplete effect; may change in future.
+
+Multiple audio files can be combined (and then further processed with
+effects) using any one of the following combiner methods:
+
+ o concatenate
+ o mix
+ o merge: E.g. two mono files to one stereo file
+ o sequence: For playing multiple audio files/streams
diff --git a/src/README.osx b/src/README.osx
new file mode 100644
index 0000000..35789e3
--- /dev/null
+++ b/src/README.osx
@@ -0,0 +1,129 @@
+SoX
+---
+
+This file contains information specific to the MacOS X version of SoX.
+Please refer to the README file for general information.
+
+The sox executable can be installed anywhere you desire. It is a
+self-contained statically linked executable.
+
+If the sox executable is invoked with an executable name of soxi, play,
+or rec it will perform the functions of those applications as defined
+in included documents. Symlinks are included with this package
+but you can also make your own.
+
+Acknowledgements
+----------------
+
+The sox exectables included in this package makes use of the following projects:
+
+ SoX - http://sox.sourceforge.net
+
+ FLAC - http://flac.sourceforge.net
+
+ LADSPA - http://www.ladspa.org
+
+ libid3tag - http://www.underbit.com/products/mad
+
+ libltdl - http://www.gnu.org/software/libtool
+
+ libsndfile - http://www.mega-nerd.com/libsndfile
+
+ Ogg Vorbis - http://www.vorbis.com
+
+ PNG - http://www.libpng.org/pub/png
+
+ WavPack - http://www.wavpack.com
+
+Enjoy,
+The SoX Development Team
+
+Appendix - wget Support
+-----------------------
+
+SoX can make use of the wget command line utility to load files over
+the internet or listen to shoutcast streams. It only needs to be
+somewhere in your path to be used by SoX.
+
+Please consult wget's homepage for access to source code as well
+as further instructions on configuring and installing.
+
+http://www.gnu.org/software/wget
+
+Appendix - MP3 Support
+----------------------
+
+SoX contains support for reading and writing MP3 files but does not ship
+with the dylib's that perform decoding and encoding of MP3 data because
+of patent restrictions. For further details, refer to:
+
+http://en.wikipedia.org/wiki/MP3#Licensing_and_patent_issues
+
+MP3 support can be enabled by placing Lame encoding library and/or
+MAD decoding library into a standard library search location such
+as /usr/lib or set LTDL_LIBRARY_PATH to location.
+
+These can be compiled yourself, they may turn up on searches of the internet
+or may be included with other MP3 applications already installed
+on your system. Try searching for libmp3lame.dylib and libmad.dylib.
+
+Obtain the latest Lame and MAD source code from approprate locations.
+
+Lame MP3 encoder http://lame.sourceforge.net
+MAD MP3 decoder http://www.underbit.com/products/mad
+
+If your system is setup to compile software, then the following commands
+can be used. Note: since SoX is distributed as a 32-bit i386 binary,
+the library must match that format as well:
+
+cd lame-398-2
+./configure CFLAGS="-arch i386 -m32" LDFALGS="-arch i386"
+make
+sudo make install
+
+cd libmad-0.15.1b
+./configure CFLAGS="-arch i386 -m32" LDFALGS="-arch i386"
+make
+sudo make install
+
+Appendix - AMR-NB/AMR-WB Support
+--------------------------------
+
+SoX contains support for reading and writing AMR-NB and AMR-WB files but
+does not ship with the DLL's that perform decoding and encoding of AMR
+data because of patent restrictions.
+
+AMR-NB/AMR-WB support can be enabled by placing required libraries
+into a standard library search location such as /usr/lib
+or set LTDL_LIBRARY_PATH to search path.
+
+These can be compiled yourself, they may turn up on searches of the internet
+or may be included with other AMR applications already installed
+on your system. Try searching for libopencore-amrnb.dylib and
+libopencore-amrwb.dylib.
+
+Obtain the latest amrnb and amrwb source code from
+http://sourceforge.net/projects/opencore-amr
+
+cd opencore-amr-0.1.2
+./configure CFLAGS="-arch i386 -m32" LDFALGS="-arch i386"
+make
+sudo make install
+
+If that does not work, then try this:
+
+cd opencore-amr-0.1.2
+./build_osx.sh
+
+Appendix - LADSPA Plugins
+-------------------------
+
+SoX has built in support for LADSPA Plugins. These plugins are
+mostly built for Linux but some are available for OS X.
+The Audacity GUI application has a page that points to a collection
+of OS X LADSPA plugins.
+
+http://audacity.sourceforge.net/download/plugins
+
+SoX will search for these plugins based on LADSPA_PATH
+enviornment variable. See sox.txt for further information.
diff --git a/src/README.sh b/src/README.sh
new file mode 100755
index 0000000..606b67e
--- /dev/null
+++ b/src/README.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+cat > README << .
+ SoX: Sound eXchange
+ ===================
+
+SoX (Sound eXchange) is the Swiss Army knife of sound processing tools: it
+can convert sound files between many different file formats & audio devices,
+and can apply many sound effects & transformations, as well as doing basic
+analysis and providing input to more capable analysis and plotting tools.
+
+SoX is licensed under the GNU GPL and GNU LGPL. To be precise, the 'sox'
+and 'soxi' programs are distributed under the GPL, while the library
+'libsox' (in which most of SoX's functionality resides) is dual-licensed.
+Note that some optional components of libsox are GPL only: if you use these,
+you must use libsox under the GPL. See INSTALL for the list of optional
+components and their licences.
+
+If this distribution is of source code (as opposed to pre-built binaries),
+then you will need to compile and install SoX as described in the 'INSTALL'
+file.
+
+Changes between this release and previous releases of SoX can be found in
+the 'ChangeLog' file; a summary of the file formats and effects supported in
+this release can be found below. Detailed documentation for using SoX can
+be found in the distributed 'man' pages:
+
+ o sox(1)
+ o soxi(1)
+ o soxformat(7)
+ o libsox(3)
+
+or in plain text or PDF files for those systems without man.
+
+The majority of SoX features and fixes are contributed by SoX users - thank
+you very much for making SoX a success! There are several new features
+wanted for SoX, listed on the feature request tracker at the SoX project
+home-page:
+
+ http://sourceforge.net/projects/sox
+
+users are encouraged to implement them!
+
+Please submit bug reports, new feature requests, and patches to the relevant
+tracker at the above address, or by email:
+
+ mailto:sox-devel@lists.sourceforge.net
+
+Also accessible via the project home-page is the SoX users' discussion
+mailing list which you can join to discuss all matters SoX with other SoX
+users; the mail address for this list is:
+
+ mailto:sox-users@lists.sourceforge.net
+
+.
+cat FEATURES.in \
+ | sed "s/!!/ /" \
+ | sed "s/^\*\*/ o /" \
+ | sed "s/^\*/ o /" \
+ | sed "s/(:[a-zA-Z0-9_= -]*:)//g" \
+ >> README
+
+echo version=pmwiki-2.2.0-beta65 ordered=1 urlencoded=1 > Docs.Features
+echo -n text= >> Docs.Features
+cat FEATURES.in|sed "s/%/%25/g"|sed "s/$/%0a/"|tr -d '\n' >> Docs.Features
diff --git a/src/README.win32 b/src/README.win32
new file mode 100644
index 0000000..0ed7815
--- /dev/null
+++ b/src/README.win32
@@ -0,0 +1,167 @@
+SoX
+---
+
+This file contains information specific to the Win32 version of SoX.
+Please refer to the README file for general information.
+
+The binary SOX.EXE can be installed anywhere you desire. The only
+restriction is that the included ZLIB1..DLL and LIBGOMP-1.DLL must be
+located in the same directory as SOX.EXE or somewhere within your PATH.
+
+SoX Helper Applications
+-----------------------
+
+SoX also includes support for SOXI.EXE, PLAY.EXE and REC.EXE and their
+behaviors are documented in included PDF's. They have the same
+install restrictions as SOX.EXE.
+
+SOXI.EXE, PLAY.EXE, and REC.EXE are not distributed with this package to
+reduce size requirements. They are, in fact, only copies of the original
+SOX.EXE binary which changes SOX.EXE's behavior based on the
+executable's filename.
+
+If you wish to make use of these utils then you can create them
+yourself.
+
+copy sox.exe soxi.exe
+copy sox.exe play.exe
+copy sox.exe rec.exe
+
+If you are concerned with disk space, the play and record
+functionality can be equated using the "-d" option with SOX.EXE. soxi
+functionality can be equated using the "--info" option with SOX.EXE. The
+rough syntax is:
+
+play: sox [input files and options] -d [effects]
+rec: sox -d [output file and options] [effects]
+soxi: sox --info [input files and options]
+
+Acknowledgements
+----------------
+
+SOX.EXE included in this package makes use of the following projects.
+See the cygbuild script included with the source code package for
+further information on how it was compiled and packaged.
+
+ SoX - http://sox.sourceforge.net
+
+ FLAC - http://flac.sourceforge.net
+
+ LADSPA - http://www.ladspa.org
+
+ libid3tag - http://www.underbit.com/products/mad
+
+ libsndfile - http://www.mega-nerd.com/libsndfile
+
+ Ogg Vorbis - http://www.vorbis.com
+
+ PNG - http://www.libpng.org/pub/png
+
+ WavPack - http://www.wavpack.com
+
+ wget - http://www.gnu.org/software/wget
+
+Enjoy,
+The SoX Development Team
+
+Appendix - wget Support
+-----------------------
+
+SoX can make use of the wget command line utility to load files over
+the internet. A binary copy of wget has been included with this
+package of SoX for your convience.
+
+For SoX to make use of wget, it must be located either in your PATH or
+within the same directory that SoX is ran from.
+
+Custom configuration of wget can be made by editing the file wget.ini
+contained in the same directory as wget.exe.
+
+Please consult wget's homepage for access to source code as well as
+further instructions on configuring.
+
+http://www.gnu.org/software/wget
+
+Appendix - MP3 Support
+----------------------
+
+SoX contains support for reading and writing MP3 files but does not ship
+with the DLL's that perform decoding and encoding of MP3 data because
+of patent restrictions. For further details, refer to:
+
+http://en.wikipedia.org/wiki/MP3#Licensing_and_patent_issues
+
+MP3 support can be enabled by placing Lame encoding DLL and/or
+MAD decoding DLL into the same directory as SOX.EXE. These
+can be compiled yourself, they may turn up on searches of the internet
+or may be included with other MP3 applications already installed
+on your system. For encoding/writing, try searching for lame-enc.dll,
+libmp3lame-0.dll, libmp3lame.dll, or cygmp3lame-0.dll. For
+decoding/reading, try searching for libmad-0.dll, libmad.dll or cygmad-0.dll.
+
+Instructions are included here for using MSYS to create the DLL's.
+It is assumed you already have MSYS installed on your system
+with a working gcc compiler. The commands are ran from MSYS
+bash shell.
+
+Obtain the latest Lame and MAD source code from approprate locations.
+
+Lame MP3 encoder http://lame.sourceforge.net
+MAD MP3 decoder http://www.underbit.com/products/mad
+
+cd lame-398-2
+./configure --disabled-static --enable-shared
+make
+cp libmp3lame/.libs/libmp3lame-0.dll /path/to/sox
+
+MAD libraries up to 0.15.1b have a bug in configure that will not allow
+building DLL under mingw. This can be resolved by adding LDFLAGS
+to configure and editing the generated Makefile to remove an invalid
+option.
+
+cd libmad-0.15.1b
+./configure --enable-shared --disable-static LDFLAGS="-no-undefined"
+[edit Makefile, search for "-fforce-mem" and delete it.]
+make
+cp libmad-0.dll /path/to/sox/
+
+Appendix - AMR-NB/AMR-WB Support
+--------------------------------
+
+SoX contains support for reading and writing AMR-NB and AMR-WB files but
+does not ship with the DLL's that perform decoding and encoding of AMR
+data because of patent restrictions.
+
+AMR-NB/AMR-WB support can be enabled by placing required DLL's
+into the same directory as SOX.EXE. These can be compiled yourself,
+they may turn up on searches of the internet or may be included with other
+MP3 applications already installed on your system. For AMR-NB support,
+try searching for libamrnb-3.dll, libopencore-amrnb-0.dll, or
+libopencore-amrnb.dll. For AMR-WB support, try searching for libamrwb-3.dll,
+libopencore-amrwb-0.dll, or libopencore-amrwb.dll.
+
+Instructions are included here for using MSYS to create the DLL's.
+It is assumed you already have MSYS installed on your system with
+working gcc compiler. These commands are ran from MSYS bash shell.
+
+Obtain the latest amrnb and amrwb source code from
+http://sourceforge.net/projects/opencore-amr .
+
+cd opencore-amr-0.1.2
+./configure --enable-shared --disable-static LDFLAGS="-no-undefined"
+make
+cp amrnb/.libs/libopencore-amrnb-0.dll /path/to/sox
+cp amrwb/.libs/libopencore-amrwb-0.dll /path/to/sox
+
+Appendix - LADSPA Plugins
+-------------------------
+
+SoX has built in support for LADSPA Plugins. These plugins are
+mostly built for Linux but some are available for Windows.
+The Audacity GUI application has a page that points to a collection
+of Windows LADSPA plugins.
+
+http://audacity.sourceforge.net/download/plugins
+
+SoX will search for these plugins based on LADSPA_PATH
+enviornment variable. See sox.txt for further information.
diff --git a/src/aclocal.m4 b/src/aclocal.m4
new file mode 100644
index 0000000..d3d019b
--- /dev/null
+++ b/src/aclocal.m4
@@ -0,0 +1,1372 @@
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+
+# PKG_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable pkgconfigdir as the location where a module
+# should install pkg-config .pc files. By default the directory is
+# $libdir/pkgconfig, but the default can be changed by passing
+# DIRECTORY. The user can override through the --with-pkgconfigdir
+# parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+ [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_INSTALLDIR
+
+
+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable noarch_pkgconfigdir as the location where a
+# module should install arch-independent pkg-config .pc files. By
+# default the directory is $datadir/pkgconfig, but the default can be
+# changed by passing DIRECTORY. The user can override through the
+# --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+ [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_NOARCH_INSTALLDIR
+
+
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------
+# Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])# PKG_CHECK_VAR
+
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.14'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.14.1], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.14.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "$am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.65])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+ [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+ m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+ m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+])
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+ fi
+fi])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+ [whether $CC understands -c and -o together],
+ [am_cv_prog_cc_c_o],
+ [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+ ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+ [--enable-silent-rules],
+ [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+ [--disable-silent-rules],
+ [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+#
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+ [m4_case([$1],
+ [ustar],
+ [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+ if test $am_uid -le $am_max_uid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi
+ AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+ if test $am_gid -le $am_max_gid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi],
+
+ [pax],
+ [],
+
+ [m4_fatal([Unknown tar format])])
+
+ AC_MSG_CHECKING([how to create a $1 tar archive])
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ AM_RUN_LOG([cat conftest.dir/file])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+ done
+ rm -rf conftest.dir
+
+ AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/gcc_stack_protect.m4])
+m4_include([m4/libtool.m4])
+m4_include([m4/ltoptions.m4])
+m4_include([m4/ltsugar.m4])
+m4_include([m4/ltversion.m4])
+m4_include([m4/lt~obsolete.m4])
+m4_include([m4/optional-fmt.m4])
+m4_include([m4/sndfile.m4])
diff --git a/src/compile b/src/compile
new file mode 100755
index 0000000..531136b
--- /dev/null
+++ b/src/compile
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# 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, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ if test -f "$dir/lib$lib.a"; then
+ found=yes
+ lib=$dir/lib$lib.a
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no '-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # '.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/src/config.guess b/src/config.guess
new file mode 100755
index 0000000..1f5c50c
--- /dev/null
+++ b/src/config.guess
@@ -0,0 +1,1420 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright 1992-2014 Free Software Foundation, Inc.
+
+timestamp='2014-03-23'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright 1992-2014 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval $set_cc_for_build
+ cat <<-EOF > $dummy.c
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ ;;
+esac
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ *:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+ fi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ cris:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ exit ;;
+ crisv32:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ exit ;;
+ frv:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ i*86:Linux:*:*)
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+ ;;
+ openrisc*:Linux:*:*)
+ echo or1k-unknown-linux-${LIBC}
+ exit ;;
+ or32:Linux:*:* | or1k*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-${LIBC}
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
+ esac
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-${LIBC}
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-${LIBC}
+ exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-unknown-linux-${LIBC}
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ tile*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+ exit ;;
+ x86_64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ eval $set_cc_for_build
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # Avoid executing cc on OS X 10.9, as it ships with a stub
+ # that puts up a graphical alert prompting to install
+ # developer tools. Any system running Mac OS X 10.7 or
+ # later (Darwin 11 and later) is required to have a 64-bit
+ # processor. This is not true of the ARM version of Darwin
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
+ fi
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSE-*:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
+esac
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/src/config.sub b/src/config.sub
new file mode 100755
index 0000000..66c5074
--- /dev/null
+++ b/src/config.sub
@@ -0,0 +1,1798 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright 1992-2014 Free Software Foundation, Inc.
+
+timestamp='2014-07-28'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2014 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray | -microblaze*)
+ os=
+ basic_machine=$1
+ ;;
+ -bluegene*)
+ os=-cnk
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
+ | bfin \
+ | c4x | c8051 | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | epiphany \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | k1om \
+ | le32 | le64 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r6 | mipsisa32r6el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r6 | mipsisa64r6el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 | nios2eb | nios2el \
+ | ns16k | ns32k \
+ | open8 | or1k | or1knd | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pyramid \
+ | rl78 | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | we32k \
+ | x86 | xc16x | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
+ ;;
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | aarch64-* | aarch64_be-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | k1om-* \
+ | le32-* | le64-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa32r6-* | mipsisa32r6el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64r6-* | mipsisa64r6el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
+ | or1k*-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pyramid-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
+ | tron-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c54x-*)
+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16 | cr16-*)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ microblaze*)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
+ mingw32)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ os=-moxiebox
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ msys)
+ basic_machine=i686-pc
+ os=-msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc | ppcbe) basic_machine=powerpc-unknown
+ ;;
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tile*)
+ basic_machine=$basic_machine-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* | -plan9* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -nacl*)
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ c8051-*)
+ os=-elf
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/src/configure b/src/configure
new file mode 100755
index 0000000..4407f1b
--- /dev/null
+++ b/src/configure
@@ -0,0 +1,19354 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for SoX 14.4.2.
+#
+# Report bugs to <sox-devel@lists.sourceforge.net>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: sox-devel@lists.sourceforge.net about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+as_awk_strverscmp='
+ # Use only awk features that work with 7th edition Unix awk (1978).
+ # My, what an old awk you have, Mr. Solaris!
+ END {
+ while (length(v1) && length(v2)) {
+ # Set d1 to be the next thing to compare from v1, and likewise for d2.
+ # Normally this is a single character, but if v1 and v2 contain digits,
+ # compare them as integers and fractions as strverscmp does.
+ if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
+ # Split v1 and v2 into their leading digit string components d1 and d2,
+ # and advance v1 and v2 past the leading digit strings.
+ for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
+ for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
+ d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
+ d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
+ if (d1 ~ /^0/) {
+ if (d2 ~ /^0/) {
+ # Compare two fractions.
+ while (d1 ~ /^0/ && d2 ~ /^0/) {
+ d1 = substr(d1, 2); len1--
+ d2 = substr(d2, 2); len2--
+ }
+ if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
+ # The two components differ in length, and the common prefix
+ # contains only leading zeros. Consider the longer to be less.
+ d1 = -len1
+ d2 = -len2
+ } else {
+ # Otherwise, compare as strings.
+ d1 = "x" d1
+ d2 = "x" d2
+ }
+ } else {
+ # A fraction is less than an integer.
+ exit 1
+ }
+ } else {
+ if (d2 ~ /^0/) {
+ # An integer is greater than a fraction.
+ exit 2
+ } else {
+ # Compare two integers.
+ d1 += 0
+ d2 += 0
+ }
+ }
+ } else {
+ # The normal case, without worrying about digits.
+ d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
+ d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
+ }
+ if (d1 < d2) exit 1
+ if (d1 > d2) exit 2
+ }
+ # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
+ # which mishandles some comparisons of empty strings to integers.
+ if (length(v2)) exit 1
+ if (length(v1)) exit 2
+ }
+'
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='SoX'
+PACKAGE_TARNAME='sox'
+PACKAGE_VERSION='14.4.2'
+PACKAGE_STRING='SoX 14.4.2'
+PACKAGE_BUGREPORT='sox-devel@lists.sourceforge.net'
+PACKAGE_URL=''
+
+ac_unique_file="sox.1"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+STATIC_LIBSOX_ONLY_FALSE
+STATIC_LIBSOX_ONLY_TRUE
+PLAYRECLINKS
+SYMLINKS
+LPC10_LIBS
+LPC10_CFLAGS
+STATIC_LPC10_FALSE
+STATIC_LPC10_TRUE
+HAVE_LPC10_FALSE
+HAVE_LPC10_TRUE
+GSM_LIBS
+GSM_CFLAGS
+STATIC_GSM_FALSE
+STATIC_GSM_TRUE
+HAVE_GSM_FALSE
+HAVE_GSM_TRUE
+MP3_LIBS
+MP3_CFLAGS
+STATIC_MP3_FALSE
+STATIC_MP3_TRUE
+HAVE_MP3_FALSE
+HAVE_MP3_TRUE
+SUN_AUDIO_LIBS
+SUN_AUDIO_CFLAGS
+STATIC_SUN_AUDIO_FALSE
+STATIC_SUN_AUDIO_TRUE
+HAVE_SUN_AUDIO_FALSE
+HAVE_SUN_AUDIO_TRUE
+OSS_LIBS
+OSS_CFLAGS
+STATIC_OSS_FALSE
+STATIC_OSS_TRUE
+HAVE_OSS_FALSE
+HAVE_OSS_TRUE
+STATIC_SNDFILE_FALSE
+STATIC_SNDFILE_TRUE
+HAVE_SNDFILE_FALSE
+HAVE_SNDFILE_TRUE
+SNDFILE_LIBS
+SNDFILE_CFLAGS
+WAVEAUDIO_LIBS
+WAVEAUDIO_CFLAGS
+STATIC_WAVEAUDIO_FALSE
+STATIC_WAVEAUDIO_TRUE
+HAVE_WAVEAUDIO_FALSE
+HAVE_WAVEAUDIO_TRUE
+PULSEAUDIO_LIBS
+PULSEAUDIO_CFLAGS
+STATIC_PULSEAUDIO_FALSE
+STATIC_PULSEAUDIO_TRUE
+HAVE_PULSEAUDIO_FALSE
+HAVE_PULSEAUDIO_TRUE
+AO_LIBS
+AO_CFLAGS
+STATIC_AO_FALSE
+STATIC_AO_TRUE
+HAVE_AO_FALSE
+HAVE_AO_TRUE
+ALSA_LIBS
+ALSA_CFLAGS
+STATIC_ALSA_FALSE
+STATIC_ALSA_TRUE
+HAVE_ALSA_FALSE
+HAVE_ALSA_TRUE
+COREAUDIO_LIBS
+COREAUDIO_CFLAGS
+STATIC_COREAUDIO_FALSE
+STATIC_COREAUDIO_TRUE
+HAVE_COREAUDIO_FALSE
+HAVE_COREAUDIO_TRUE
+SNDIO_LIBS
+SNDIO_CFLAGS
+STATIC_SNDIO_FALSE
+STATIC_SNDIO_TRUE
+HAVE_SNDIO_FALSE
+HAVE_SNDIO_TRUE
+WAVPACK_LIBS
+WAVPACK_CFLAGS
+STATIC_WAVPACK_FALSE
+STATIC_WAVPACK_TRUE
+HAVE_WAVPACK_FALSE
+HAVE_WAVPACK_TRUE
+AMRNB_LIBS
+AMRNB_CFLAGS
+STATIC_AMRNB_FALSE
+STATIC_AMRNB_TRUE
+HAVE_AMRNB_FALSE
+HAVE_AMRNB_TRUE
+AMRWB_LIBS
+AMRWB_CFLAGS
+STATIC_AMRWB_FALSE
+STATIC_AMRWB_TRUE
+HAVE_AMRWB_FALSE
+HAVE_AMRWB_TRUE
+FLAC_LIBS
+FLAC_CFLAGS
+STATIC_FLAC_FALSE
+STATIC_FLAC_TRUE
+HAVE_FLAC_FALSE
+HAVE_FLAC_TRUE
+STATIC_OPUS_FALSE
+STATIC_OPUS_TRUE
+HAVE_OPUS_FALSE
+HAVE_OPUS_TRUE
+OPUS_LIBS
+OPUS_CFLAGS
+OGG_VORBIS_LIBS
+OGG_VORBIS_CFLAGS
+STATIC_OGG_VORBIS_FALSE
+STATIC_OGG_VORBIS_TRUE
+HAVE_OGG_VORBIS_FALSE
+HAVE_OGG_VORBIS_TRUE
+LIBLPC10_LIBADD
+EXTERNAL_LPC10_FALSE
+EXTERNAL_LPC10_TRUE
+LIBGSM_LIBADD
+EXTERNAL_GSM_FALSE
+EXTERNAL_GSM_TRUE
+HAVE_ID3TAG_FALSE
+HAVE_ID3TAG_TRUE
+LADSPA_PATH
+PNG_LIBS
+HAVE_PNG_FALSE
+HAVE_PNG_TRUE
+MAGIC_LIBS
+HAVE_MAGIC_FALSE
+HAVE_MAGIC_TRUE
+GOMP_LIBS
+OPENMP_CFLAGS
+LIBLTDL
+HAVE_WIN32_LTDL_FALSE
+HAVE_WIN32_LTDL_TRUE
+HAVE_LIBLTDL_FALSE
+HAVE_LIBLTDL_TRUE
+LIBTOOLFLAGS
+HAVE_DISTRO_FALSE
+HAVE_DISTRO_TRUE
+DISTRO
+WARN_CFLAGS
+APP_LDFLAGS
+HAVE_WIN32_GLOB_FALSE
+HAVE_WIN32_GLOB_TRUE
+PKGCONFIGDIR
+HAVE_PKGCONFIG_FALSE
+HAVE_PKGCONFIG_TRUE
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+LIBTOOL_DEPS
+CPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+LIBTOOL
+OBJDUMP
+DLLTOOL
+AS
+SHLIB_VERSION
+LN_S
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_silent_rules
+enable_dependency_tracking
+with_libltdl
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+with_dyn_default
+with_pkgconfigdir
+enable_debug
+enable_stack_protector
+with_distro
+enable_largefile
+enable_silent_libtool
+enable_openmp
+with_magic
+with_png
+with_ladspa
+with_ladspa_path
+with_mad
+enable_dl_mad
+with_id3tag
+with_lame
+enable_dl_lame
+with_twolame
+enable_dl_twolame
+with_oggvorbis
+with_opus
+with_flac
+enable_dl_amrwb
+with_amrwb
+enable_dl_amrnb
+with_amrnb
+with_wavpack
+with_sndio
+with_coreaudio
+with_alsa
+with_ao
+with_pulseaudio
+with_waveaudio
+enable_dl_sndfile
+with_sndfile
+with_oss
+with_sunaudio
+with_mp3
+with_gsm
+with_lpc10
+enable_symlinks
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+OPUS_CFLAGS
+OPUS_LIBS
+SNDFILE_CFLAGS
+SNDFILE_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures SoX 14.4.2 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/sox]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of SoX 14.4.2:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-silent-rules less verbose build output (undo: "make V=1")
+ --disable-silent-rules verbose build output (undo: "make V=0")
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-debug make a debug build
+ --disable-stack-protector
+ Disable GCC's/libc's stack-smashing protection
+ --disable-largefile omit support for large files
+ --disable-silent-libtool
+ Verbose libtool
+ --disable-openmp do not use OpenMP
+ --enable-dl-mad Dlopen mad instead of linking in.
+ --enable-dl-lame Dlopen lame instead of linking in.
+ --enable-dl-twolame Dlopen twolame instead of linking in.
+ --enable-dl-amrwb Dlopen amrbw instead of linking in.
+ --enable-dl-amrnb Dlopen amrnb instead of linking in.
+ --enable-dl-sndfile Dlopen sndfile instead of linking in.
+ --disable-symlinks Don't make any symlinks to sox.
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --without-libltdl Don't try to use libltdl for external dynamic
+ library support
+ --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-sysroot=DIR Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).
+ --with-dyn-default Default to loading optional formats dynamically
+ --with-pkgconfigdir location to install .pc files or "no" to disable
+ (default=$(libdir)/pkgconfig)
+ --with-distro=distro Provide distribution name
+ --without-magic Don't try to use magic
+ --without-png Don't try to use png
+ --without-ladspa Don't try to use LADSPA
+ --with-ladspa-path Default search path for LADSPA plugins
+ --without-mad Don't try to use MAD (MP3 Audio Decoder)
+ --without-id3tag Don't try to use id3tag
+ --without-lame Don't try to use LAME (LAME Ain't an MP3 Encoder)
+ --without-twolame Don't try to use Twolame (MP2 Audio Encoder)
+ --with-oggvorbis=dyn load oggvorbis dynamically
+ --with-opus=dyn load opus dynamically
+ --with-flac=dyn load flac dynamically
+ --with-amrwb=dyn load amrwb dynamically
+ --with-amrnb=dyn load amrnb dynamically
+ --with-wavpack=dyn load wavpack dynamically
+ --with-sndio=dyn load sndio dynamically
+ --with-coreaudio=dyn load coreaudio dynamically
+ --with-alsa=dyn load alsa dynamically
+ --with-ao=dyn load ao dynamically
+ --with-pulseaudio=dyn load pulseaudio dynamically
+ --with-waveaudio=dyn load waveaudio dynamically
+ --with-sndfile=dyn load sndfile dynamically
+ --with-oss=dyn load oss dynamically
+ --with-sunaudio=dyn load sunaudio dynamically
+ --with-mp3=dyn load mp3 dynamically
+ --with-gsm=dyn load gsm dynamically
+ --with-lpc10=dyn load lpc10 dynamically
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ OPUS_CFLAGS C compiler flags for OPUS, overriding pkg-config
+ OPUS_LIBS linker flags for OPUS, overriding pkg-config
+ SNDFILE_CFLAGS
+ C compiler flags for SNDFILE, overriding pkg-config
+ SNDFILE_LIBS
+ linker flags for SNDFILE, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <sox-devel@lists.sourceforge.net>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+SoX configure 14.4.2
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ---------------------------------------------- ##
+## Report this to sox-devel@lists.sourceforge.net ##
+## ---------------------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by SoX $as_me 14.4.2, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+am__api_version='1.14'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='sox'
+ VERSION='14.4.2'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar pax cpio none'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+ fi
+fi
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=0;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
+
+ac_config_headers="$ac_config_headers src/soxconfig.h"
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+ ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+
+SHLIB_VERSION=3:0:0
+
+
+
+# Check whether --with-libltdl was given.
+if test "${with_libltdl+set}" = set; then :
+ withval=$with_libltdl; with_libltdl=$withval
+else
+ with_libltdl=default
+fi
+
+
+if test "$with_libltdl" = "default"; then
+ if test "$enable_shared" != "no"; then
+ using_libltdl=yes
+ else
+ using_libltdl=no
+ fi
+ with_libltdl="yes"
+else
+ using_libltdl=$with_libltdl
+fi
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in ar
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AR" && break
+ done
+fi
+if test -z "$AR"; then
+ ac_ct_AR=$AR
+ for ac_prog in ar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_AR" && break
+done
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ar_at_file=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+ withval=$with_sysroot;
+else
+ with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+ ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MANIFEST_TOOL"; then
+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+ # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_MANIFEST_TOOL"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
+ MANIFEST_TOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+ fi
+else
+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&5
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&5
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ echo "$RANLIB libconftest.a" >&5
+ $RANLIB libconftest.a 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&5
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+enable_dlopen=yes
+enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
+$as_echo "$AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AS"; then
+ ac_ct_AS=$AS
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AS"; then
+ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AS="as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
+$as_echo "$ac_ct_AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AS" = x; then
+ AS="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AS=$ac_ct_AS
+ fi
+else
+ AS="$ac_cv_prog_AS"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+ ;;
+esac
+
+test -z "$AS" && AS=as
+
+
+
+
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ if test -n "$lt_prog_compiler_pic"; then
+ lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ lt_prog_compiler_wl='-Wl,-Wl,,'
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Intel*\ [CF]*Compiler*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ *Portland\ Group*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ file_list_spec='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+ enable_shared_with_static_runtimes=yes
+ exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ old_postinstall_cmds='chmod 644 $oldlib'
+ postlink_cmds='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ enable_shared_with_static_runtimes=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_irix_exported_symbol=yes
+else
+ lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Add ABI-specific directories to the system library path.
+ sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+
+# Check whether --with-dyn-default was given.
+if test "${with_dyn_default+set}" = set; then :
+ withval=$with_dyn_default; opt_default=dyn
+else
+ opt_default=yes
+fi
+
+
+
+# Check whether --with-pkgconfigdir was given.
+if test "${with_pkgconfigdir+set}" = set; then :
+ withval=$with_pkgconfigdir;
+fi
+
+
+
+
+using_pkgconfig=no
+if test "$with_pkgconfigdir" != "no"; then
+ if test "$with_pkgconfigdir" = ""; then
+ with_pkgconfigdir="\$(libdir)/pkgconfig"
+ fi
+ using_pkgconfig="yes"
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
+fi
+ if test x$using_pkgconfig = xyes; then
+ HAVE_PKGCONFIG_TRUE=
+ HAVE_PKGCONFIG_FALSE='#'
+else
+ HAVE_PKGCONFIG_TRUE='#'
+ HAVE_PKGCONFIG_FALSE=
+fi
+
+PKGCONFIGDIR=$with_pkgconfigdir
+
+
+using_win32_glob="no"
+case $target in
+ *mingw*)
+ using_win32_glob="yes"
+ ;;
+esac
+if test "$using_win32_glob" = yes; then
+
+$as_echo "#define HAVE_WIN32_GLOB_H 1" >>confdefs.h
+
+fi
+ if test x$using_win32_glob = xyes; then
+ HAVE_WIN32_GLOB_TRUE=
+ HAVE_WIN32_GLOB_FALSE='#'
+else
+ HAVE_WIN32_GLOB_TRUE='#'
+ HAVE_WIN32_GLOB_FALSE=
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to make a debug build" >&5
+$as_echo_n "checking whether to make a debug build... " >&6; }
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+ enableval=$enable_debug;
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_debug" >&5
+$as_echo "$enable_debug" >&6; }
+if test "$enable_debug" = "yes"; then
+ CFLAGS="-g"
+ if test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -ggdb"
+ fi
+else
+ enable_debug=no
+fi
+
+# -fstack-protector
+# Check whether --enable-stack-protector was given.
+if test "${enable_stack_protector+set}" = set; then :
+ enableval=$enable_stack_protector; case "${enableval}" in
+ yes) enable_ssp=yes ;;
+ no) enable_ssp=no ;;
+ *) as_fn_error $? "invalid value ${enableval} for --disable-stack-protector" "$LINENO" 5 ;;
+ esac
+else
+ enable_ssp=yes
+fi
+
+
+if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Disabling stack-smashing protection because compiler is not GCC" >&5
+$as_echo "$as_me: Disabling stack-smashing protection because compiler is not GCC" >&6;}
+ enable_ssp=no
+fi
+
+if test x"$enable_ssp" = x"yes"; then
+ # Check for broken ssp in libc: http://www.avahi.org/ticket/105
+ # libc's brokenness will get in the way regardless of whether -lssp is
+ # provided, but provide it anyway (otherwise non-libc ssp would wrongly
+ # break here)
+
+ # Get -lssp if it exists
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libssp exists" >&5
+$as_echo_n "checking whether libssp exists... " >&6; }
+if ${ssp_cv_lib+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ssp_old_libs="$LIBS"
+ LIBS="$LIBS -lssp"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ssp_cv_lib=yes
+else
+ ssp_cv_lib=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$ssp_old_libs"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssp_cv_lib" >&5
+$as_echo "$ssp_cv_lib" >&6; }
+ if test $ssp_cv_lib = yes; then
+ LIBS="$LIBS -lssp"
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stack-smashing protection is available" >&5
+$as_echo_n "checking whether stack-smashing protection is available... " >&6; }
+ ssp_old_cflags="$CFLAGS"
+ ssp_old_ldflags="$LDFLAGS"
+ CFLAGS="$CFLAGS -Werror -fstack-protector-all -fPIC"
+ LDFLAGS="$LDFLAGS -Wl,-z,defs"
+ cat confdefs.h > conftest.c
+ cat >>conftest.c <<_ACEOF
+void test_broken_ssp(c)
+ const char *c;
+{
+ char arr[123], *p; /* beware of possible double-braces if copying this */
+ for (p = arr; *c; ++p) {
+ *p = *c;
+ ++c;
+ }
+}
+_ACEOF
+ rm -f conftest.o
+
+ if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stack-smashing protection is buggy" >&5
+$as_echo_n "checking whether stack-smashing protection is buggy... " >&6; }
+ if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ enable_ssp=no
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+
+ rm -f conftest.c conftest.o conftest.so
+
+ CFLAGS="$ssp_old_cflags"
+ LDFLAGS="$ssp_old_ldflags"
+fi
+
+if test x"$enable_ssp" = x"yes"; then
+ # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
+
+
+ if test "X$CC" != "X"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -fstack-protector" >&5
+$as_echo_n "checking whether ${CC} accepts -fstack-protector... " >&6; }
+if ${ssp_cv_cc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ssp_old_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS -fstack-protector -Werror"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ssp_cv_cc=yes
+else
+ ssp_cv_cc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$ssp_old_cflags"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssp_cv_cc" >&5
+$as_echo "$ssp_cv_cc" >&6; }
+ if test $ssp_cv_cc = yes; then
+ CFLAGS="$CFLAGS -fstack-protector"
+
+$as_echo "#define ENABLE_SSP_CC 1" >>confdefs.h
+
+ fi
+ fi
+
+
+ # XXX: Update the enable_ssp value now for output later?
+fi
+
+if test "$GCC" = "yes"; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking gcc version" >&5
+$as_echo_n "checking gcc version... " >&6; }
+ gccver=`$CC -dumpversion`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gccver" >&5
+$as_echo "$gccver" >&6; }
+
+ CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wstrict-prototypes -pedantic"
+
+ as_arg_v1=$gccver
+as_arg_v2=4.3
+awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
+case $? in #(
+ 1) :
+ WARN_CFLAGS="-Wconversion" ;; #(
+ 0) :
+ WARN_CFLAGS="-Wtraditional-conversion" ;; #(
+ 2) :
+ WARN_CFLAGS="-Wtraditional-conversion" ;; #(
+ *) :
+ ;;
+esac
+ case $target in
+ *linux* | *solaris*)
+ LDFLAGS="$LDFLAGS -Wl,-z,defs"
+ ;;
+ *os2* | *cygwin* | *mingw*)
+ APP_LDFLAGS="-no-undefined"
+ ;;
+ esac
+fi
+
+
+
+
+# Check whether --with-distro was given.
+if test "${with_distro+set}" = set; then :
+ withval=$with_distro;
+fi
+
+if test "x$with_distro" != "x"; then
+ DISTRO="$with_distro"
+
+
+$as_echo "#define HAVE_DISTRO 1" >>confdefs.h
+
+ have_distro=yes
+else
+ DISTRO="not specified!"
+fi
+ if test x$have_distro = xyes; then
+ HAVE_DISTRO_TRUE=
+ HAVE_DISTRO_FALSE='#'
+else
+ HAVE_DISTRO_TRUE='#'
+ HAVE_DISTRO_FALSE=
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_bigendian=unknown
+ # See if we're dealing with a universal compiler.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __APPLE_CC__
+ not a universal capable compiler
+ #endif
+ typedef int dummy;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ # Check for potential -arch flags. It is not universal unless
+ # there are at least two -arch flags with different values.
+ ac_arch=
+ ac_prev=
+ for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+ if test -n "$ac_prev"; then
+ case $ac_word in
+ i?86 | x86_64 | ppc | ppc64)
+ if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+ ac_arch=$ac_word
+ else
+ ac_cv_c_bigendian=universal
+ break
+ fi
+ ;;
+ esac
+ ac_prev=
+ elif test "x$ac_word" = "x-arch"; then
+ ac_prev=arch
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+ && LITTLE_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to _BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # Compile a test program.
+ if test "$cross_compiling" = yes; then :
+ # Try to guess by grepping values from an object file.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+short int ascii_mm[] =
+ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+ short int ascii_ii[] =
+ { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+ int use_ascii (int i) {
+ return ascii_mm[i] + ascii_ii[i];
+ }
+ short int ebcdic_ii[] =
+ { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+ short int ebcdic_mm[] =
+ { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+ int use_ebcdic (int i) {
+ return ebcdic_mm[i] + ebcdic_ii[i];
+ }
+ extern int foo;
+
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+ ac_cv_c_bigendian=yes
+ fi
+ if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_bigendian=no
+else
+ ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+ yes)
+ $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+ no)
+ ;; #(
+ universal)
+
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+ ;; #(
+ *)
+ as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+for ac_header in fcntl.h unistd.h byteswap.h sys/stat.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h termios.h glob.h fenv.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_func in strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5
+$as_echo_n "checking for library containing pow... " >&6; }
+if ${ac_cv_search_pow+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pow ();
+int
+main ()
+{
+return pow ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pow=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_pow+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_pow+:} false; then :
+
+else
+ ac_cv_search_pow=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pow" >&5
+$as_echo "$ac_cv_search_pow" >&6; }
+ac_res=$ac_cv_search_pow
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lrint" >&5
+$as_echo_n "checking for library containing lrint... " >&6; }
+if ${ac_cv_search_lrint+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lrint ();
+int
+main ()
+{
+return lrint ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_lrint=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_lrint+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_lrint+:} false; then :
+
+else
+ ac_cv_search_lrint=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lrint" >&5
+$as_echo "$ac_cv_search_lrint" >&6; }
+ac_res=$ac_cv_search_lrint
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+for ac_func in lrint
+do :
+ ac_fn_c_check_func "$LINENO" "lrint" "ac_cv_func_lrint"
+if test "x$ac_cv_func_lrint" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LRINT 1
+_ACEOF
+
+fi
+done
+
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ if ac_fn_c_try_compile "$LINENO"; then :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_file_offset_bits=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_large_files=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ fi
+
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_source+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h> /* for off_t */
+ #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+ return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_sys_largefile_source=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+ #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+ return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_sys_largefile_source=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_cv_sys_largefile_source=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
+$as_echo "$ac_cv_sys_largefile_source" >&6; }
+case $ac_cv_sys_largefile_source in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
+_ACEOF
+;;
+esac
+rm -rf conftest*
+
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
+
+$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
+
+fi
+
+if test "$ac_cv_sys_file_offset_bits" = "64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Forcing _LARGEFILE_SOURCE to be safe since off_t is 64 bits" >&5
+$as_echo "$as_me: Forcing _LARGEFILE_SOURCE to be safe since off_t is 64 bits" >&6;}
+ $as_echo "#define _LARGEFILE_SOURCE 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libtool should be silenced" >&5
+$as_echo_n "checking whether libtool should be silenced... " >&6; }
+# Check whether --enable-silent-libtool was given.
+if test "${enable_silent_libtool+set}" = set; then :
+ enableval=$enable_silent_libtool;
+else
+ enable_silent_libtool=yes
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_silent_libtool" >&5
+$as_echo "$enable_silent_libtool" >&6; }
+if test "$enable_silent_libtool" = "yes"; then
+ LIBTOOLFLAGS=--silent
+fi
+
+
+using_win32_ltdl="no"
+if test "$using_libltdl" != "no"; then
+ case $target in
+ *mingw*)
+
+$as_echo "#define HAVE_WIN32_LTDL_H 1" >>confdefs.h
+
+ LIBLTDL=""
+ using_win32_ltdl="yes"
+ ;;
+ *)
+ for ac_header in ltdl.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default"
+if test "x$ac_cv_header_ltdl_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LTDL_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lt_dlinit in -lltdl" >&5
+$as_echo_n "checking for lt_dlinit in -lltdl... " >&6; }
+if ${ac_cv_lib_ltdl_lt_dlinit+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lltdl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lt_dlinit ();
+int
+main ()
+{
+return lt_dlinit ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ltdl_lt_dlinit=yes
+else
+ ac_cv_lib_ltdl_lt_dlinit=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ltdl_lt_dlinit" >&5
+$as_echo "$ac_cv_lib_ltdl_lt_dlinit" >&6; }
+if test "x$ac_cv_lib_ltdl_lt_dlinit" = xyes; then :
+ LIBLTDL="$LIBLTDL -lltdl"
+else
+ using_libltdl=no
+fi
+
+else
+ using_libltdl=no
+fi
+
+done
+
+ ;;
+ esac
+fi
+if test "$using_libltdl" = yes; then
+
+$as_echo "#define HAVE_LIBLTDL 1" >>confdefs.h
+
+fi
+ if test x$using_libltdl = xyes -a x$using_win32_ltdl = xno; then
+ HAVE_LIBLTDL_TRUE=
+ HAVE_LIBLTDL_FALSE='#'
+else
+ HAVE_LIBLTDL_TRUE='#'
+ HAVE_LIBLTDL_FALSE=
+fi
+
+ if test x$using_win32_ltdl = xyes; then
+ HAVE_WIN32_LTDL_TRUE=
+ HAVE_WIN32_LTDL_FALSE='#'
+else
+ HAVE_WIN32_LTDL_TRUE='#'
+ HAVE_WIN32_LTDL_FALSE=
+fi
+
+
+
+
+
+ OPENMP_CFLAGS=
+ # Check whether --enable-openmp was given.
+if test "${enable_openmp+set}" = set; then :
+ enableval=$enable_openmp;
+fi
+
+ if test "$enable_openmp" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to support OpenMP" >&5
+$as_echo_n "checking for $CC option to support OpenMP... " >&6; }
+if ${ac_cv_prog_c_openmp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_prog_c_openmp='none needed'
+else
+ ac_cv_prog_c_openmp='unsupported'
+ for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
+ -Popenmp --openmp; do
+ ac_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $ac_option"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_prog_c_openmp=$ac_option
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$ac_save_CFLAGS
+ if test "$ac_cv_prog_c_openmp" != unsupported; then
+ break
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_c_openmp" >&5
+$as_echo "$ac_cv_prog_c_openmp" >&6; }
+ case $ac_cv_prog_c_openmp in #(
+ "none needed" | unsupported)
+ ;; #(
+ *)
+ OPENMP_CFLAGS=$ac_cv_prog_c_openmp ;;
+ esac
+ fi
+
+
+if test "x$OPENMP_CFLAGS" != "x"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtool version" >&5
+$as_echo_n "checking for libtool version... " >&6; }
+ lt_version="`grep '^VERSION' $srcdir/ltmain.sh | sed -e 's/VERSION\=//g;s/ .*//g;s/"//g'`"
+ as_arg_v1=$lt_version
+as_arg_v2=2.4
+awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
+case $? in #(
+ 1) :
+ if test "$GCC" = "yes"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_version, needs OpenMP linker workaround" >&5
+$as_echo "$lt_version, needs OpenMP linker workaround" >&6; }
+ GOMP_LIBS="-lgomp"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_version and not GCC, deactivating OpenMP" >&5
+$as_echo "$lt_version and not GCC, deactivating OpenMP" >&6; }
+ OPENMP_CFLAGS=""
+fi ;; #(
+ 0) :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_version, OK" >&5
+$as_echo "$lt_version, OK" >&6; } ;; #(
+ 2) :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_version, OK" >&5
+$as_echo "$lt_version, OK" >&6; } ;; #(
+ *) :
+ ;;
+esac
+fi
+ CFLAGS="$CFLAGS $OPENMP_CFLAGS"
+
+
+
+# Check whether --with-magic was given.
+if test "${with_magic+set}" = set; then :
+ withval=$with_magic;
+fi
+
+using_magic=no
+if test "$with_magic" != "no"; then
+ using_magic=yes
+ ac_fn_c_check_header_mongrel "$LINENO" "magic.h" "ac_cv_header_magic_h" "$ac_includes_default"
+if test "x$ac_cv_header_magic_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for magic_open in -lmagic" >&5
+$as_echo_n "checking for magic_open in -lmagic... " >&6; }
+if ${ac_cv_lib_magic_magic_open+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmagic $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char magic_open ();
+int
+main ()
+{
+return magic_open ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_magic_magic_open=yes
+else
+ ac_cv_lib_magic_magic_open=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_magic_magic_open" >&5
+$as_echo "$ac_cv_lib_magic_magic_open" >&6; }
+if test "x$ac_cv_lib_magic_magic_open" = xyes; then :
+ MAGIC_LIBS="-lmagic"
+else
+ using_magic=no
+fi
+
+else
+ using_magic=no
+fi
+
+
+ if test "$with_magic" = "yes" -a "$using_magic" = "no"; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find magic
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+fi
+if test "$using_magic" = yes; then
+
+$as_echo "#define HAVE_MAGIC 1" >>confdefs.h
+
+fi
+ if test x$using_magic = xyes; then
+ HAVE_MAGIC_TRUE=
+ HAVE_MAGIC_FALSE='#'
+else
+ HAVE_MAGIC_TRUE='#'
+ HAVE_MAGIC_FALSE=
+fi
+
+
+
+
+
+
+# Check whether --with-png was given.
+if test "${with_png+set}" = set; then :
+ withval=$with_png;
+fi
+
+using_png=no
+if test "$with_png" != "no"; then
+ for ac_header in png.h libpng/png.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ using_png=yes
+fi
+
+done
+
+ if test "$using_png" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_set_rows in -lpng" >&5
+$as_echo_n "checking for png_set_rows in -lpng... " >&6; }
+if ${ac_cv_lib_png_png_set_rows+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng -lz $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char png_set_rows ();
+int
+main ()
+{
+return png_set_rows ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_png_png_set_rows=yes
+else
+ ac_cv_lib_png_png_set_rows=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_set_rows" >&5
+$as_echo "$ac_cv_lib_png_png_set_rows" >&6; }
+if test "x$ac_cv_lib_png_png_set_rows" = xyes; then :
+ PNG_LIBS="$PNG_LIBS -lpng -lz"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_set_rows in -lpng12" >&5
+$as_echo_n "checking for png_set_rows in -lpng12... " >&6; }
+if ${ac_cv_lib_png12_png_set_rows+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng12 -lz $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char png_set_rows ();
+int
+main ()
+{
+return png_set_rows ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_png12_png_set_rows=yes
+else
+ ac_cv_lib_png12_png_set_rows=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png12_png_set_rows" >&5
+$as_echo "$ac_cv_lib_png12_png_set_rows" >&6; }
+if test "x$ac_cv_lib_png12_png_set_rows" = xyes; then :
+ PNG_LIBS="$PNG_LIBS -lpng12 -lz"
+else
+ using_png=no
+fi
+
+fi
+
+ fi
+ if test "$with_png" = "yes" -a "$using_png" = "no"; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find png
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+fi
+if test "$using_png" = yes; then
+
+$as_echo "#define HAVE_PNG 1" >>confdefs.h
+
+fi
+ if test x$using_png = xyes; then
+ HAVE_PNG_TRUE=
+ HAVE_PNG_FALSE='#'
+else
+ HAVE_PNG_TRUE='#'
+ HAVE_PNG_FALSE=
+fi
+
+
+
+
+
+
+# Check whether --with-ladspa was given.
+if test "${with_ladspa+set}" = set; then :
+ withval=$with_ladspa;
+fi
+
+using_ladspa=no
+if test "$with_ladspa" != "no" -a "$using_libltdl" = "yes"; then
+ using_ladspa=yes
+
+$as_echo "#define HAVE_LADSPA_H 1" >>confdefs.h
+
+fi
+LADSPA_PATH=${libdir}/ladspa
+
+# Check whether --with-ladspa-path was given.
+if test "${with_ladspa_path+set}" = set; then :
+ withval=$with_ladspa_path;
+fi
+
+
+
+
+
+
+# Check whether --with-mad was given.
+if test "${with_mad+set}" = set; then :
+ withval=$with_mad;
+fi
+
+using_mad=no
+if test "$with_mad" != "no"; then
+ using_mad=yes
+ for ac_header in mad.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "mad.h" "ac_cv_header_mad_h" "$ac_includes_default"
+if test "x$ac_cv_header_mad_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MAD_H 1
+_ACEOF
+
+else
+ using_mad=no
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to dlopen mad" >&5
+$as_echo_n "checking whether to dlopen mad... " >&6; }
+ # Check whether --enable-dl_mad was given.
+if test "${enable_dl_mad+set}" = set; then :
+ enableval=$enable_dl_mad; enable_dl_mad=$enableval
+else
+ enable_dl_mad=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_dl_mad" >&5
+$as_echo "$enable_dl_mad" >&6; }
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
+
+$as_echo "#define DL_MAD 1" >>confdefs.h
+
+ else
+ enable_dl_mad="no"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mad_stream_buffer in -lmad" >&5
+$as_echo_n "checking for mad_stream_buffer in -lmad... " >&6; }
+if ${ac_cv_lib_mad_mad_stream_buffer+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmad $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char mad_stream_buffer ();
+int
+main ()
+{
+return mad_stream_buffer ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mad_mad_stream_buffer=yes
+else
+ ac_cv_lib_mad_mad_stream_buffer=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mad_mad_stream_buffer" >&5
+$as_echo "$ac_cv_lib_mad_mad_stream_buffer" >&6; }
+if test "x$ac_cv_lib_mad_mad_stream_buffer" = xyes; then :
+ MP3_LIBS="$MP3_LIBS -lmad"
+else
+ using_mad=no
+fi
+
+ if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find libmad
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+
+
+
+
+# Check whether --with-id3tag was given.
+if test "${with_id3tag+set}" = set; then :
+ withval=$with_id3tag;
+fi
+
+using_id3tag=no
+if test "$with_id3tag" != "no"; then
+ using_id3tag=yes
+ ac_fn_c_check_header_mongrel "$LINENO" "id3tag.h" "ac_cv_header_id3tag_h" "$ac_includes_default"
+if test "x$ac_cv_header_id3tag_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for id3_file_open in -lid3tag" >&5
+$as_echo_n "checking for id3_file_open in -lid3tag... " >&6; }
+if ${ac_cv_lib_id3tag_id3_file_open+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lid3tag -lz $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char id3_file_open ();
+int
+main ()
+{
+return id3_file_open ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_id3tag_id3_file_open=yes
+else
+ ac_cv_lib_id3tag_id3_file_open=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_id3tag_id3_file_open" >&5
+$as_echo "$ac_cv_lib_id3tag_id3_file_open" >&6; }
+if test "x$ac_cv_lib_id3tag_id3_file_open" = xyes; then :
+ MP3_LIBS="$MP3_LIBS -lid3tag -lz"
+else
+ using_id3tag=no
+fi
+
+else
+ using_id3tag=no
+fi
+
+
+ if test "$with_id3tag" = "yes" -a "$using_id3tag" = "no"; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find id3tag
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+fi
+if test "$using_id3tag" = yes; then
+
+$as_echo "#define HAVE_ID3TAG 1" >>confdefs.h
+
+fi
+ if test x$using_id3tag = xyes; then
+ HAVE_ID3TAG_TRUE=
+ HAVE_ID3TAG_FALSE='#'
+else
+ HAVE_ID3TAG_TRUE='#'
+ HAVE_ID3TAG_FALSE=
+fi
+
+
+
+
+
+# Check whether --with-lame was given.
+if test "${with_lame+set}" = set; then :
+ withval=$with_lame;
+fi
+
+using_lame=no
+if test "$with_lame" != "no"; then
+ using_lame=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to dlopen lame" >&5
+$as_echo_n "checking whether to dlopen lame... " >&6; }
+ # Check whether --enable-dl_lame was given.
+if test "${enable_dl_lame+set}" = set; then :
+ enableval=$enable_dl_lame; enable_dl_lame=$enableval
+else
+ enable_dl_lame=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_dl_lame" >&5
+$as_echo "$enable_dl_lame" >&6; }
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
+
+$as_echo "#define DL_LAME 1" >>confdefs.h
+
+ else
+ enable_dl_lame="no"
+ for ac_header in lame/lame.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "lame/lame.h" "ac_cv_header_lame_lame_h" "$ac_includes_default"
+if test "x$ac_cv_header_lame_lame_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LAME_LAME_H 1
+_ACEOF
+
+else
+ for ac_header in lame.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "lame.h" "ac_cv_header_lame_h" "$ac_includes_default"
+if test "x$ac_cv_header_lame_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LAME_H 1
+_ACEOF
+
+else
+ using_lame=no
+fi
+
+done
+
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lame_get_lametag_frame in -lmp3lame" >&5
+$as_echo_n "checking for lame_get_lametag_frame in -lmp3lame... " >&6; }
+if ${ac_cv_lib_mp3lame_lame_get_lametag_frame+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmp3lame $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lame_get_lametag_frame ();
+int
+main ()
+{
+return lame_get_lametag_frame ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mp3lame_lame_get_lametag_frame=yes
+else
+ ac_cv_lib_mp3lame_lame_get_lametag_frame=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mp3lame_lame_get_lametag_frame" >&5
+$as_echo "$ac_cv_lib_mp3lame_lame_get_lametag_frame" >&6; }
+if test "x$ac_cv_lib_mp3lame_lame_get_lametag_frame" = xyes; then :
+ MP3_LIBS="$MP3_LIBS -lmp3lame"
+else
+ using_lame=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for id3tag_set_fieldvalue in -lmp3lame" >&5
+$as_echo_n "checking for id3tag_set_fieldvalue in -lmp3lame... " >&6; }
+if ${ac_cv_lib_mp3lame_id3tag_set_fieldvalue+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmp3lame $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char id3tag_set_fieldvalue ();
+int
+main ()
+{
+return id3tag_set_fieldvalue ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mp3lame_id3tag_set_fieldvalue=yes
+else
+ ac_cv_lib_mp3lame_id3tag_set_fieldvalue=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mp3lame_id3tag_set_fieldvalue" >&5
+$as_echo "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" >&6; }
+if test "x$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = xyes; then :
+ using_lame=$using_lame
+fi
+
+ if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
+
+$as_echo "#define HAVE_LAME_ID3TAG 1" >>confdefs.h
+
+ fi
+ if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find LAME
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+
+
+
+
+# Check whether --with-twolame was given.
+if test "${with_twolame+set}" = set; then :
+ withval=$with_twolame;
+fi
+
+using_twolame=no
+if test "$with_twolame" != "no"; then
+ using_twolame=yes
+ for ac_header in twolame.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "twolame.h" "ac_cv_header_twolame_h" "$ac_includes_default"
+if test "x$ac_cv_header_twolame_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_TWOLAME_H 1
+_ACEOF
+
+else
+ using_twolame=no
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to dlopen twolame" >&5
+$as_echo_n "checking whether to dlopen twolame... " >&6; }
+ # Check whether --enable-dl_twolame was given.
+if test "${enable_dl_twolame+set}" = set; then :
+ enableval=$enable_dl_twolame; enable_dl_twolame=$enableval
+else
+ enable_dl_twolame=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_dl_twolame" >&5
+$as_echo "$enable_dl_twolame" >&6; }
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_twolame" = "xyes"; then
+
+$as_echo "#define DL_TWOLAME 1" >>confdefs.h
+
+ else
+ enable_dl_twolame="no"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for twolame_init in -ltwolame" >&5
+$as_echo_n "checking for twolame_init in -ltwolame... " >&6; }
+if ${ac_cv_lib_twolame_twolame_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltwolame $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char twolame_init ();
+int
+main ()
+{
+return twolame_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_twolame_twolame_init=yes
+else
+ ac_cv_lib_twolame_twolame_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_twolame_twolame_init" >&5
+$as_echo "$ac_cv_lib_twolame_twolame_init" >&6; }
+if test "x$ac_cv_lib_twolame_twolame_init" = xyes; then :
+ MP3_LIBS="$MP3_LIBS -ltwolame"
+else
+ using_twolame=no
+fi
+
+ if test "$with_twolame" = "yes" -a "$using_twolame" = "no"; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find libtwolame
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+
+# Check for libgsm
+found_libgsm=yes
+for ac_header in gsm/gsm.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "gsm/gsm.h" "ac_cv_header_gsm_gsm_h" "$ac_includes_default"
+if test "x$ac_cv_header_gsm_gsm_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GSM_GSM_H 1
+_ACEOF
+
+else
+ for ac_header in gsm.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "gsm.h" "ac_cv_header_gsm_h" "$ac_includes_default"
+if test "x$ac_cv_header_gsm_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GSM_H 1
+_ACEOF
+
+else
+ found_libgsm=no
+fi
+
+done
+
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gsm_create in -lgsm" >&5
+$as_echo_n "checking for gsm_create in -lgsm... " >&6; }
+if ${ac_cv_lib_gsm_gsm_create+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgsm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gsm_create ();
+int
+main ()
+{
+return gsm_create ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_gsm_gsm_create=yes
+else
+ ac_cv_lib_gsm_gsm_create=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gsm_gsm_create" >&5
+$as_echo "$ac_cv_lib_gsm_gsm_create" >&6; }
+if test "x$ac_cv_lib_gsm_gsm_create" = xyes; then :
+ GSM_LIBS="$GSM_LIBS -lgsm"
+else
+ found_libgsm=no
+fi
+
+if test "$found_libgsm" = yes; then
+
+$as_echo "#define EXTERNAL_GSM 1" >>confdefs.h
+
+else
+ LIBGSM_LIBADD=../libgsm/libgsm.la
+fi
+ if test x$found_libgsm = xyes; then
+ EXTERNAL_GSM_TRUE=
+ EXTERNAL_GSM_FALSE='#'
+else
+ EXTERNAL_GSM_TRUE='#'
+ EXTERNAL_GSM_FALSE=
+fi
+
+
+
+
+
+# Check for liblpc10
+found_liblpc10=yes
+for ac_header in lpc10.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "lpc10.h" "ac_cv_header_lpc10_h" "$ac_includes_default"
+if test "x$ac_cv_header_lpc10_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LPC10_H 1
+_ACEOF
+
+else
+ for ac_header in lpc10.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "lpc10.h" "ac_cv_header_lpc10_h" "$ac_includes_default"
+if test "x$ac_cv_header_lpc10_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LPC10_H 1
+_ACEOF
+
+else
+ found_liblpc10=no
+fi
+
+done
+
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for create_lpc10_encoder_state in -llpc10" >&5
+$as_echo_n "checking for create_lpc10_encoder_state in -llpc10... " >&6; }
+if ${ac_cv_lib_lpc10_create_lpc10_encoder_state+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-llpc10 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char create_lpc10_encoder_state ();
+int
+main ()
+{
+return create_lpc10_encoder_state ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_lpc10_create_lpc10_encoder_state=yes
+else
+ ac_cv_lib_lpc10_create_lpc10_encoder_state=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lpc10_create_lpc10_encoder_state" >&5
+$as_echo "$ac_cv_lib_lpc10_create_lpc10_encoder_state" >&6; }
+if test "x$ac_cv_lib_lpc10_create_lpc10_encoder_state" = xyes; then :
+ LPC10_LIBS="$LPC10_LIBS -llpc10"
+else
+ found_liblpc10=no
+fi
+
+if test "$found_liblpc10" = yes; then
+
+$as_echo "#define EXTERNAL_LPC10 1" >>confdefs.h
+
+else
+ LIBLPC10_LIBADD=../lpc10/liblpc10.la
+fi
+ if test x$found_liblpc10 = xyes; then
+ EXTERNAL_LPC10_TRUE=
+ EXTERNAL_LPC10_FALSE='#'
+else
+ EXTERNAL_LPC10_TRUE='#'
+ EXTERNAL_LPC10_FALSE=
+fi
+
+
+
+
+
+# Check for Ogg Vorbis
+
+# Check whether --with-oggvorbis was given.
+if test "${with_oggvorbis+set}" = set; then :
+ withval=$with_oggvorbis;
+fi
+
+ using_oggvorbis=$with_oggvorbis
+ if test "_$with_oggvorbis" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load oggvorbis dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_oggvorbis" = _; then
+ using_oggvorbis=$opt_default
+ elif test "_$with_oggvorbis" != _yes -a "_$with_oggvorbis" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-oggvorbis=$with_oggvorbis
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_oggvorbis != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "vorbis/codec.h" "ac_cv_header_vorbis_codec_h" "$ac_includes_default"
+if test "x$ac_cv_header_vorbis_codec_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ogg_packet_clear in -logg" >&5
+$as_echo_n "checking for ogg_packet_clear in -logg... " >&6; }
+if ${ac_cv_lib_ogg_ogg_packet_clear+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-logg $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ogg_packet_clear ();
+int
+main ()
+{
+return ogg_packet_clear ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ogg_ogg_packet_clear=yes
+else
+ ac_cv_lib_ogg_ogg_packet_clear=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ogg_ogg_packet_clear" >&5
+$as_echo "$ac_cv_lib_ogg_ogg_packet_clear" >&6; }
+if test "x$ac_cv_lib_ogg_ogg_packet_clear" = xyes; then :
+ OGG_VORBIS_LIBS="$OGG_VORBIS_LIBS -logg"
+else
+ using_oggvorbis=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vorbis_analysis_headerout in -lvorbis" >&5
+$as_echo_n "checking for vorbis_analysis_headerout in -lvorbis... " >&6; }
+if ${ac_cv_lib_vorbis_vorbis_analysis_headerout+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvorbis $OGG_VORBIS_LIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char vorbis_analysis_headerout ();
+int
+main ()
+{
+return vorbis_analysis_headerout ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_vorbis_vorbis_analysis_headerout=yes
+else
+ ac_cv_lib_vorbis_vorbis_analysis_headerout=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vorbis_vorbis_analysis_headerout" >&5
+$as_echo "$ac_cv_lib_vorbis_vorbis_analysis_headerout" >&6; }
+if test "x$ac_cv_lib_vorbis_vorbis_analysis_headerout" = xyes; then :
+ OGG_VORBIS_LIBS="-lvorbis $OGG_VORBIS_LIBS"
+else
+ using_oggvorbis=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ov_clear in -lvorbisfile" >&5
+$as_echo_n "checking for ov_clear in -lvorbisfile... " >&6; }
+if ${ac_cv_lib_vorbisfile_ov_clear+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvorbisfile $OGG_VORBIS_LIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ov_clear ();
+int
+main ()
+{
+return ov_clear ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_vorbisfile_ov_clear=yes
+else
+ ac_cv_lib_vorbisfile_ov_clear=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vorbisfile_ov_clear" >&5
+$as_echo "$ac_cv_lib_vorbisfile_ov_clear" >&6; }
+if test "x$ac_cv_lib_vorbisfile_ov_clear" = xyes; then :
+ OGG_VORBIS_LIBS="-lvorbisfile $OGG_VORBIS_LIBS"
+else
+ using_oggvorbis=no
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vorbis_encode_init_vbr in -lvorbisenc" >&5
+$as_echo_n "checking for vorbis_encode_init_vbr in -lvorbisenc... " >&6; }
+if ${ac_cv_lib_vorbisenc_vorbis_encode_init_vbr+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvorbisenc $OGG_VORBIS_LIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char vorbis_encode_init_vbr ();
+int
+main ()
+{
+return vorbis_encode_init_vbr ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_vorbisenc_vorbis_encode_init_vbr=yes
+else
+ ac_cv_lib_vorbisenc_vorbis_encode_init_vbr=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_vorbisenc_vorbis_encode_init_vbr" >&5
+$as_echo "$ac_cv_lib_vorbisenc_vorbis_encode_init_vbr" >&6; }
+if test "x$ac_cv_lib_vorbisenc_vorbis_encode_init_vbr" = xyes; then :
+ OGG_VORBIS_LIBS="-lvorbisenc $OGG_VORBIS_LIBS"
+else
+ using_oggvorbis=no
+fi
+
+else
+ using_oggvorbis=no
+fi
+
+
+ if test _$with_oggvorbis != _ -a $using_oggvorbis = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find oggvorbis
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_oggvorbis" != no; then
+
+$as_echo "#define HAVE_OGG_VORBIS 1" >>confdefs.h
+
+ if test "$using_oggvorbis" = yes; then
+
+$as_echo "#define STATIC_OGG_VORBIS 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_oggvorbis != no; then
+ HAVE_OGG_VORBIS_TRUE=
+ HAVE_OGG_VORBIS_FALSE='#'
+else
+ HAVE_OGG_VORBIS_TRUE='#'
+ HAVE_OGG_VORBIS_FALSE=
+fi
+
+ if test $using_oggvorbis = yes; then
+ STATIC_OGG_VORBIS_TRUE=
+ STATIC_OGG_VORBIS_FALSE='#'
+else
+ STATIC_OGG_VORBIS_TRUE='#'
+ STATIC_OGG_VORBIS_FALSE=
+fi
+
+
+
+
+
+# Check for Opus
+
+# Check whether --with-opus was given.
+if test "${with_opus+set}" = set; then :
+ withval=$with_opus;
+fi
+
+ using_opus=$with_opus
+ if test "_$with_opus" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load opus dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_opus" = _; then
+ using_opus=$opt_default
+ elif test "_$with_opus" != _yes -a "_$with_opus" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-opus=$with_opus
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_opus != _no; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPUS" >&5
+$as_echo_n "checking for OPUS... " >&6; }
+
+if test -n "$OPUS_CFLAGS"; then
+ pkg_cv_OPUS_CFLAGS="$OPUS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"opusfile\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "opusfile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_OPUS_CFLAGS=`$PKG_CONFIG --cflags "opusfile" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$OPUS_LIBS"; then
+ pkg_cv_OPUS_LIBS="$OPUS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"opusfile\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "opusfile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_OPUS_LIBS=`$PKG_CONFIG --libs "opusfile" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ OPUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "opusfile" 2>&1`
+ else
+ OPUS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "opusfile" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$OPUS_PKG_ERRORS" >&5
+
+ using_opus=no
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ using_opus=no
+else
+ OPUS_CFLAGS=$pkg_cv_OPUS_CFLAGS
+ OPUS_LIBS=$pkg_cv_OPUS_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+ if test _$with_opus != _ -a $using_opus = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find opus
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_opus" != no; then
+
+$as_echo "#define HAVE_OPUS 1" >>confdefs.h
+
+ if test "$using_opus" = yes; then
+
+$as_echo "#define STATIC_OPUS 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_opus != no; then
+ HAVE_OPUS_TRUE=
+ HAVE_OPUS_FALSE='#'
+else
+ HAVE_OPUS_TRUE='#'
+ HAVE_OPUS_FALSE=
+fi
+
+ if test $using_opus = yes; then
+ STATIC_OPUS_TRUE=
+ STATIC_OPUS_FALSE='#'
+else
+ STATIC_OPUS_TRUE='#'
+ STATIC_OPUS_FALSE=
+fi
+
+
+
+
+if test "$GCC" = "yes"; then
+ OPUS_CFLAGS="$OPUS_CFLAGS -Wno-long-long"
+fi
+
+
+# Check for FLAC libraries
+# Note passing in OGG_VORBIS_LIBS. That is because FLAC has optional
+# support for OGG and if OGG libraries are found on this
+# system then its highly likely to be compiled into FLAC
+# and will require these at link time.
+case $target in
+ *mingw*)
+ FLAC_LIBS="-lwsock32"
+ ;;
+esac
+
+# Check whether --with-flac was given.
+if test "${with_flac+set}" = set; then :
+ withval=$with_flac;
+fi
+
+ using_flac=$with_flac
+ if test "_$with_flac" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load flac dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_flac" = _; then
+ using_flac=$opt_default
+ elif test "_$with_flac" != _yes -a "_$with_flac" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-flac=$with_flac
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_flac != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "FLAC/all.h" "ac_cv_header_FLAC_all_h" "$ac_includes_default"
+if test "x$ac_cv_header_FLAC_all_h" = xyes; then :
+ ac_fn_c_check_decl "$LINENO" "FLAC_API_VERSION_CURRENT" "ac_cv_have_decl_FLAC_API_VERSION_CURRENT" "#include <FLAC/all.h>
+"
+if test "x$ac_cv_have_decl_FLAC_API_VERSION_CURRENT" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FLAC__stream_encoder_new in -lFLAC" >&5
+$as_echo_n "checking for FLAC__stream_encoder_new in -lFLAC... " >&6; }
+if ${ac_cv_lib_FLAC_FLAC__stream_encoder_new+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lFLAC $FLAC_LIBS $OGG_VORBIS_LIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char FLAC__stream_encoder_new ();
+int
+main ()
+{
+return FLAC__stream_encoder_new ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_FLAC_FLAC__stream_encoder_new=yes
+else
+ ac_cv_lib_FLAC_FLAC__stream_encoder_new=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_FLAC_FLAC__stream_encoder_new" >&5
+$as_echo "$ac_cv_lib_FLAC_FLAC__stream_encoder_new" >&6; }
+if test "x$ac_cv_lib_FLAC_FLAC__stream_encoder_new" = xyes; then :
+ FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_VORBIS_LIBS"
+else
+ using_flac=no
+fi
+
+else
+ using_flac=no
+fi
+
+else
+ using_flac=no
+fi
+
+
+ if test _$with_flac != _ -a $using_flac = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find flac
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_flac" != no; then
+
+$as_echo "#define HAVE_FLAC 1" >>confdefs.h
+
+ if test "$using_flac" = yes; then
+
+$as_echo "#define STATIC_FLAC 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_flac != no; then
+ HAVE_FLAC_TRUE=
+ HAVE_FLAC_FALSE='#'
+else
+ HAVE_FLAC_TRUE='#'
+ HAVE_FLAC_FALSE=
+fi
+
+ if test $using_flac = yes; then
+ STATIC_FLAC_TRUE=
+ STATIC_FLAC_FALSE='#'
+else
+ STATIC_FLAC_TRUE='#'
+ STATIC_FLAC_FALSE=
+fi
+
+
+
+
+
+
+ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
+tmp_using_amrwb=$opt_default
+for ac_header in opencore-amrwb/dec_if.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "opencore-amrwb/dec_if.h" "ac_cv_header_opencore_amrwb_dec_if_h" "$ac_includes_default"
+if test "x$ac_cv_header_opencore_amrwb_dec_if_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_OPENCORE_AMRWB_DEC_IF_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for D_IF_init in -lopencore-amrwb" >&5
+$as_echo_n "checking for D_IF_init in -lopencore-amrwb... " >&6; }
+if ${ac_cv_lib_opencore_amrwb_D_IF_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lopencore-amrwb $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char D_IF_init ();
+int
+main ()
+{
+return D_IF_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_opencore_amrwb_D_IF_init=yes
+else
+ ac_cv_lib_opencore_amrwb_D_IF_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opencore_amrwb_D_IF_init" >&5
+$as_echo "$ac_cv_lib_opencore_amrwb_D_IF_init" >&6; }
+if test "x$ac_cv_lib_opencore_amrwb_D_IF_init" = xyes; then :
+ AMRWB_LIBS="$AMRWB_LIBS -lopencore-amrwb"
+else
+ tmp_using_amrwb=no
+fi
+
+else
+ for ac_header in amrwb/dec.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "amrwb/dec.h" "ac_cv_header_amrwb_dec_h" "$ac_includes_default"
+if test "x$ac_cv_header_amrwb_dec_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_AMRWB_DEC_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for D_IF_init in -lamrwb" >&5
+$as_echo_n "checking for D_IF_init in -lamrwb... " >&6; }
+if ${ac_cv_lib_amrwb_D_IF_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lamrwb $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char D_IF_init ();
+int
+main ()
+{
+return D_IF_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_amrwb_D_IF_init=yes
+else
+ ac_cv_lib_amrwb_D_IF_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_amrwb_D_IF_init" >&5
+$as_echo "$ac_cv_lib_amrwb_D_IF_init" >&6; }
+if test "x$ac_cv_lib_amrwb_D_IF_init" = xyes; then :
+ AMRWB_LIBS="$AMRWB_LIBS -lamrwb"
+else
+ tmp_using_amrwb=no
+fi
+
+else
+ tmp_using_amrwb=no
+fi
+
+done
+
+fi
+
+done
+
+# Check whether --enable-dl_amrwb was given.
+if test "${enable_dl_amrwb+set}" = set; then :
+ enableval=$enable_dl_amrwb; enable_dl_amrwb=$enableval
+else
+ enable_dl_amrwb=no
+fi
+
+if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then
+
+$as_echo "#define DL_AMRWB 1" >>confdefs.h
+
+ AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"
+ tmp_using_amrwb=yes
+else
+ enable_dl_amrwb="no"
+fi
+
+# Check whether --with-amrwb was given.
+if test "${with_amrwb+set}" = set; then :
+ withval=$with_amrwb;
+fi
+
+ using_amrwb=$with_amrwb
+ if test "_$with_amrwb" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load amrwb dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_amrwb" = _; then
+ using_amrwb=$opt_default
+ elif test "_$with_amrwb" != _yes -a "_$with_amrwb" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-amrwb=$with_amrwb
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_amrwb != _no; then
+ using_amrwb=$tmp_using_amrwb
+ if test _$with_amrwb != _ -a $using_amrwb = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find amrwb
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_amrwb" != no; then
+
+$as_echo "#define HAVE_AMRWB 1" >>confdefs.h
+
+ if test "$using_amrwb" = yes; then
+
+$as_echo "#define STATIC_AMRWB 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_amrwb != no; then
+ HAVE_AMRWB_TRUE=
+ HAVE_AMRWB_FALSE='#'
+else
+ HAVE_AMRWB_TRUE='#'
+ HAVE_AMRWB_FALSE=
+fi
+
+ if test $using_amrwb = yes; then
+ STATIC_AMRWB_TRUE=
+ STATIC_AMRWB_FALSE='#'
+else
+ STATIC_AMRWB_TRUE='#'
+ STATIC_AMRWB_FALSE=
+fi
+
+
+
+
+
+ac_sox_save_AMRNB_LIBS="$AMRNB_LIBS"
+tmp_using_amrnb=$opt_default
+for ac_header in opencore-amrnb/interf_dec.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "opencore-amrnb/interf_dec.h" "ac_cv_header_opencore_amrnb_interf_dec_h" "$ac_includes_default"
+if test "x$ac_cv_header_opencore_amrnb_interf_dec_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_OPENCORE_AMRNB_INTERF_DEC_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Decoder_Interface_init in -lopencore-amrnb" >&5
+$as_echo_n "checking for Decoder_Interface_init in -lopencore-amrnb... " >&6; }
+if ${ac_cv_lib_opencore_amrnb_Decoder_Interface_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lopencore-amrnb $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char Decoder_Interface_init ();
+int
+main ()
+{
+return Decoder_Interface_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_opencore_amrnb_Decoder_Interface_init=yes
+else
+ ac_cv_lib_opencore_amrnb_Decoder_Interface_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opencore_amrnb_Decoder_Interface_init" >&5
+$as_echo "$ac_cv_lib_opencore_amrnb_Decoder_Interface_init" >&6; }
+if test "x$ac_cv_lib_opencore_amrnb_Decoder_Interface_init" = xyes; then :
+ AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb"
+else
+ tmp_using_amrnb=no
+fi
+
+else
+ ac_fn_c_check_header_mongrel "$LINENO" "amrnb/sp_dec.h" "ac_cv_header_amrnb_sp_dec_h" "$ac_includes_default"
+if test "x$ac_cv_header_amrnb_sp_dec_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Decoder_Interface_init in -lamrnb" >&5
+$as_echo_n "checking for Decoder_Interface_init in -lamrnb... " >&6; }
+if ${ac_cv_lib_amrnb_Decoder_Interface_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lamrnb $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char Decoder_Interface_init ();
+int
+main ()
+{
+return Decoder_Interface_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_amrnb_Decoder_Interface_init=yes
+else
+ ac_cv_lib_amrnb_Decoder_Interface_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_amrnb_Decoder_Interface_init" >&5
+$as_echo "$ac_cv_lib_amrnb_Decoder_Interface_init" >&6; }
+if test "x$ac_cv_lib_amrnb_Decoder_Interface_init" = xyes; then :
+ AMRNB_LIBS="$AMRNB_LIBS -lamrnb"
+else
+ tmp_using_amrnb=no
+fi
+
+else
+ tmp_using_amrnb=no
+fi
+
+
+fi
+
+done
+
+# Check whether --enable-dl_amrnb was given.
+if test "${enable_dl_amrnb+set}" = set; then :
+ enableval=$enable_dl_amrnb; enable_dl_amrnb=$enableval
+else
+ enable_dl_amrnb=no
+fi
+
+if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then
+
+$as_echo "#define DL_AMRNB 1" >>confdefs.h
+
+ AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
+ tmp_using_amrnb=yes
+else
+ enable_dl_amrnb="no"
+fi
+
+# Check whether --with-amrnb was given.
+if test "${with_amrnb+set}" = set; then :
+ withval=$with_amrnb;
+fi
+
+ using_amrnb=$with_amrnb
+ if test "_$with_amrnb" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load amrnb dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_amrnb" = _; then
+ using_amrnb=$opt_default
+ elif test "_$with_amrnb" != _yes -a "_$with_amrnb" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-amrnb=$with_amrnb
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_amrnb != _no; then
+ using_amrnb=$tmp_using_amrnb
+ if test _$with_amrnb != _ -a $using_amrnb = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find amrnb
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_amrnb" != no; then
+
+$as_echo "#define HAVE_AMRNB 1" >>confdefs.h
+
+ if test "$using_amrnb" = yes; then
+
+$as_echo "#define STATIC_AMRNB 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_amrnb != no; then
+ HAVE_AMRNB_TRUE=
+ HAVE_AMRNB_FALSE='#'
+else
+ HAVE_AMRNB_TRUE='#'
+ HAVE_AMRNB_FALSE=
+fi
+
+ if test $using_amrnb = yes; then
+ STATIC_AMRNB_TRUE=
+ STATIC_AMRNB_FALSE='#'
+else
+ STATIC_AMRNB_TRUE='#'
+ STATIC_AMRNB_FALSE=
+fi
+
+
+
+
+
+
+
+# Check whether --with-wavpack was given.
+if test "${with_wavpack+set}" = set; then :
+ withval=$with_wavpack;
+fi
+
+ using_wavpack=$with_wavpack
+ if test "_$with_wavpack" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load wavpack dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_wavpack" = _; then
+ using_wavpack=$opt_default
+ elif test "_$with_wavpack" != _yes -a "_$with_wavpack" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-wavpack=$with_wavpack
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_wavpack != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "wavpack/wavpack.h" "ac_cv_header_wavpack_wavpack_h" "$ac_includes_default"
+if test "x$ac_cv_header_wavpack_wavpack_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for WavpackGetSampleRate in -lwavpack" >&5
+$as_echo_n "checking for WavpackGetSampleRate in -lwavpack... " >&6; }
+if ${ac_cv_lib_wavpack_WavpackGetSampleRate+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lwavpack $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char WavpackGetSampleRate ();
+int
+main ()
+{
+return WavpackGetSampleRate ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_wavpack_WavpackGetSampleRate=yes
+else
+ ac_cv_lib_wavpack_WavpackGetSampleRate=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wavpack_WavpackGetSampleRate" >&5
+$as_echo "$ac_cv_lib_wavpack_WavpackGetSampleRate" >&6; }
+if test "x$ac_cv_lib_wavpack_WavpackGetSampleRate" = xyes; then :
+ WAVPACK_LIBS="$WAVPACK_LIBS -lwavpack"
+else
+ using_wavpack=no
+fi
+
+else
+ using_wavpack=no
+fi
+
+
+ if test _$with_wavpack != _ -a $using_wavpack = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find wavpack
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_wavpack" != no; then
+
+$as_echo "#define HAVE_WAVPACK 1" >>confdefs.h
+
+ if test "$using_wavpack" = yes; then
+
+$as_echo "#define STATIC_WAVPACK 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_wavpack != no; then
+ HAVE_WAVPACK_TRUE=
+ HAVE_WAVPACK_FALSE='#'
+else
+ HAVE_WAVPACK_TRUE='#'
+ HAVE_WAVPACK_FALSE=
+fi
+
+ if test $using_wavpack = yes; then
+ STATIC_WAVPACK_TRUE=
+ STATIC_WAVPACK_FALSE='#'
+else
+ STATIC_WAVPACK_TRUE='#'
+ STATIC_WAVPACK_FALSE=
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-sndio was given.
+if test "${with_sndio+set}" = set; then :
+ withval=$with_sndio;
+fi
+
+ using_sndio=$with_sndio
+ if test "_$with_sndio" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load sndio dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_sndio" = _; then
+ using_sndio=$opt_default
+ elif test "_$with_sndio" != _yes -a "_$with_sndio" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-sndio=$with_sndio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_sndio != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default"
+if test "x$ac_cv_header_sndio_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5
+$as_echo_n "checking for sio_open in -lsndio... " >&6; }
+if ${ac_cv_lib_sndio_sio_open+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsndio $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sio_open ();
+int
+main ()
+{
+return sio_open ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_sndio_sio_open=yes
+else
+ ac_cv_lib_sndio_sio_open=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5
+$as_echo "$ac_cv_lib_sndio_sio_open" >&6; }
+if test "x$ac_cv_lib_sndio_sio_open" = xyes; then :
+ SNDIO_LIBS="$SNDIO_LIBS -lsndio"
+else
+ using_sndio=no
+fi
+
+else
+ using_sndio=no
+fi
+
+
+ if test _$with_sndio != _ -a $using_sndio = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find sndio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_sndio" != no; then
+
+$as_echo "#define HAVE_SNDIO 1" >>confdefs.h
+
+ if test "$using_sndio" = yes; then
+
+$as_echo "#define STATIC_SNDIO 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_sndio != no; then
+ HAVE_SNDIO_TRUE=
+ HAVE_SNDIO_FALSE='#'
+else
+ HAVE_SNDIO_TRUE='#'
+ HAVE_SNDIO_FALSE=
+fi
+
+ if test $using_sndio = yes; then
+ STATIC_SNDIO_TRUE=
+ STATIC_SNDIO_FALSE='#'
+else
+ STATIC_SNDIO_TRUE='#'
+ STATIC_SNDIO_FALSE=
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-coreaudio was given.
+if test "${with_coreaudio+set}" = set; then :
+ withval=$with_coreaudio;
+fi
+
+ using_coreaudio=$with_coreaudio
+ if test "_$with_coreaudio" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load coreaudio dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_coreaudio" = _; then
+ using_coreaudio=$opt_default
+ elif test "_$with_coreaudio" != _yes -a "_$with_coreaudio" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-coreaudio=$with_coreaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_coreaudio != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "CoreAudio/CoreAudio.h" "ac_cv_header_CoreAudio_CoreAudio_h" "$ac_includes_default"
+if test "x$ac_cv_header_CoreAudio_CoreAudio_h" = xyes; then :
+ COREAUDIO_LIBS="$COREAUDIO_LIBS -Wl,-framework,CoreAudio"
+else
+ using_coreaudio=no
+fi
+
+
+ if test _$with_coreaudio != _ -a $using_coreaudio = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find coreaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_coreaudio" != no; then
+
+$as_echo "#define HAVE_COREAUDIO 1" >>confdefs.h
+
+ if test "$using_coreaudio" = yes; then
+
+$as_echo "#define STATIC_COREAUDIO 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_coreaudio != no; then
+ HAVE_COREAUDIO_TRUE=
+ HAVE_COREAUDIO_FALSE='#'
+else
+ HAVE_COREAUDIO_TRUE='#'
+ HAVE_COREAUDIO_FALSE=
+fi
+
+ if test $using_coreaudio = yes; then
+ STATIC_COREAUDIO_TRUE=
+ STATIC_COREAUDIO_FALSE='#'
+else
+ STATIC_COREAUDIO_TRUE='#'
+ STATIC_COREAUDIO_FALSE=
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-alsa was given.
+if test "${with_alsa+set}" = set; then :
+ withval=$with_alsa;
+fi
+
+ using_alsa=$with_alsa
+ if test "_$with_alsa" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load alsa dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_alsa" = _; then
+ using_alsa=$opt_default
+ elif test "_$with_alsa" != _yes -a "_$with_alsa" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-alsa=$with_alsa
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_alsa != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_pcm_open in -lasound" >&5
+$as_echo_n "checking for snd_pcm_open in -lasound... " >&6; }
+if ${ac_cv_lib_asound_snd_pcm_open+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lasound $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char snd_pcm_open ();
+int
+main ()
+{
+return snd_pcm_open ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_asound_snd_pcm_open=yes
+else
+ ac_cv_lib_asound_snd_pcm_open=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_pcm_open" >&5
+$as_echo "$ac_cv_lib_asound_snd_pcm_open" >&6; }
+if test "x$ac_cv_lib_asound_snd_pcm_open" = xyes; then :
+ ALSA_LIBS="$ALSA_LIBS -lasound"
+else
+ using_alsa=no
+fi
+
+else
+ using_alsa=no
+fi
+
+
+ if test _$with_alsa != _ -a $using_alsa = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find alsa
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_alsa" != no; then
+
+$as_echo "#define HAVE_ALSA 1" >>confdefs.h
+
+ if test "$using_alsa" = yes; then
+
+$as_echo "#define STATIC_ALSA 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_alsa != no; then
+ HAVE_ALSA_TRUE=
+ HAVE_ALSA_FALSE='#'
+else
+ HAVE_ALSA_TRUE='#'
+ HAVE_ALSA_FALSE=
+fi
+
+ if test $using_alsa = yes; then
+ STATIC_ALSA_TRUE=
+ STATIC_ALSA_FALSE='#'
+else
+ STATIC_ALSA_TRUE='#'
+ STATIC_ALSA_FALSE=
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-ao was given.
+if test "${with_ao+set}" = set; then :
+ withval=$with_ao;
+fi
+
+ using_ao=$with_ao
+ if test "_$with_ao" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load ao dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_ao" = _; then
+ using_ao=$opt_default
+ elif test "_$with_ao" != _yes -a "_$with_ao" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-ao=$with_ao
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_ao != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "ao/ao.h" "ac_cv_header_ao_ao_h" "$ac_includes_default"
+if test "x$ac_cv_header_ao_ao_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ao_play in -lao" >&5
+$as_echo_n "checking for ao_play in -lao... " >&6; }
+if ${ac_cv_lib_ao_ao_play+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lao $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ao_play ();
+int
+main ()
+{
+return ao_play ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ao_ao_play=yes
+else
+ ac_cv_lib_ao_ao_play=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ao_ao_play" >&5
+$as_echo "$ac_cv_lib_ao_ao_play" >&6; }
+if test "x$ac_cv_lib_ao_ao_play" = xyes; then :
+ AO_LIBS="$AO_LIBS -lao"
+else
+ using_ao=no
+fi
+
+else
+ using_ao=no
+fi
+
+
+ if test _$with_ao != _ -a $using_ao = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find ao
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_ao" != no; then
+
+$as_echo "#define HAVE_AO 1" >>confdefs.h
+
+ if test "$using_ao" = yes; then
+
+$as_echo "#define STATIC_AO 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_ao != no; then
+ HAVE_AO_TRUE=
+ HAVE_AO_FALSE='#'
+else
+ HAVE_AO_TRUE='#'
+ HAVE_AO_FALSE=
+fi
+
+ if test $using_ao = yes; then
+ STATIC_AO_TRUE=
+ STATIC_AO_FALSE='#'
+else
+ STATIC_AO_TRUE='#'
+ STATIC_AO_FALSE=
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-pulseaudio was given.
+if test "${with_pulseaudio+set}" = set; then :
+ withval=$with_pulseaudio;
+fi
+
+ using_pulseaudio=$with_pulseaudio
+ if test "_$with_pulseaudio" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load pulseaudio dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_pulseaudio" = _; then
+ using_pulseaudio=$opt_default
+ elif test "_$with_pulseaudio" != _yes -a "_$with_pulseaudio" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-pulseaudio=$with_pulseaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_pulseaudio != _no; then
+ ac_fn_c_check_header_mongrel "$LINENO" "pulse/simple.h" "ac_cv_header_pulse_simple_h" "$ac_includes_default"
+if test "x$ac_cv_header_pulse_simple_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pa_simple_new in -lpulse" >&5
+$as_echo_n "checking for pa_simple_new in -lpulse... " >&6; }
+if ${ac_cv_lib_pulse_pa_simple_new+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpulse "-lpulse-simple" $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pa_simple_new ();
+int
+main ()
+{
+return pa_simple_new ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_pulse_pa_simple_new=yes
+else
+ ac_cv_lib_pulse_pa_simple_new=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pulse_pa_simple_new" >&5
+$as_echo "$ac_cv_lib_pulse_pa_simple_new" >&6; }
+if test "x$ac_cv_lib_pulse_pa_simple_new" = xyes; then :
+ PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS -lpulse -lpulse-simple"
+else
+ using_pulseaudio=no
+fi
+
+else
+ using_pulseaudio=no
+fi
+
+
+ if test _$with_pulseaudio != _ -a $using_pulseaudio = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find pulseaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_pulseaudio" != no; then
+
+$as_echo "#define HAVE_PULSEAUDIO 1" >>confdefs.h
+
+ if test "$using_pulseaudio" = yes; then
+
+$as_echo "#define STATIC_PULSEAUDIO 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_pulseaudio != no; then
+ HAVE_PULSEAUDIO_TRUE=
+ HAVE_PULSEAUDIO_FALSE='#'
+else
+ HAVE_PULSEAUDIO_TRUE='#'
+ HAVE_PULSEAUDIO_FALSE=
+fi
+
+ if test $using_pulseaudio = yes; then
+ STATIC_PULSEAUDIO_TRUE=
+ STATIC_PULSEAUDIO_FALSE='#'
+else
+ STATIC_PULSEAUDIO_TRUE='#'
+ STATIC_PULSEAUDIO_FALSE=
+fi
+
+
+
+
+
+
+
+# Check whether --with-waveaudio was given.
+if test "${with_waveaudio+set}" = set; then :
+ withval=$with_waveaudio;
+fi
+
+ using_waveaudio=$with_waveaudio
+ if test "_$with_waveaudio" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load waveaudio dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_waveaudio" = _; then
+ using_waveaudio=$opt_default
+ elif test "_$with_waveaudio" != _yes -a "_$with_waveaudio" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-waveaudio=$with_waveaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_waveaudio != _no; then
+ ac_fn_c_check_header_compile "$LINENO" "mmsystem.h" "ac_cv_header_mmsystem_h" "#include <windows.h>
+"
+if test "x$ac_cv_header_mmsystem_h" = xyes; then :
+ WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"
+else
+ using_waveaudio=no
+fi
+
+
+ if test _$with_waveaudio != _ -a $using_waveaudio = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find waveaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_waveaudio" != no; then
+
+$as_echo "#define HAVE_WAVEAUDIO 1" >>confdefs.h
+
+ if test "$using_waveaudio" = yes; then
+
+$as_echo "#define STATIC_WAVEAUDIO 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_waveaudio != no; then
+ HAVE_WAVEAUDIO_TRUE=
+ HAVE_WAVEAUDIO_FALSE='#'
+else
+ HAVE_WAVEAUDIO_TRUE='#'
+ HAVE_WAVEAUDIO_FALSE=
+fi
+
+ if test $using_waveaudio = yes; then
+ STATIC_WAVEAUDIO_TRUE=
+ STATIC_WAVEAUDIO_FALSE='#'
+else
+ STATIC_WAVEAUDIO_TRUE='#'
+ STATIC_WAVEAUDIO_FALSE=
+fi
+
+
+
+
+
+ac_sox_save_SNDFILE_LIBS="$SNDFILE_LIBS"
+# Step 1: Use pkg-config if available
+# PKG_CHECK_MODULES available
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SNDFILE" >&5
+$as_echo_n "checking for SNDFILE... " >&6; }
+
+if test -n "$SNDFILE_CFLAGS"; then
+ pkg_cv_SNDFILE_CFLAGS="$SNDFILE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndfile\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "sndfile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_SNDFILE_CFLAGS=`$PKG_CONFIG --cflags "sndfile" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$SNDFILE_LIBS"; then
+ pkg_cv_SNDFILE_LIBS="$SNDFILE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndfile\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "sndfile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_SNDFILE_LIBS=`$PKG_CONFIG --libs "sndfile" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ SNDFILE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sndfile" 2>&1`
+ else
+ SNDFILE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sndfile" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$SNDFILE_PKG_ERRORS" >&5
+
+ have_sndfile="no"
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ have_sndfile="no"
+else
+ SNDFILE_CFLAGS=$pkg_cv_SNDFILE_CFLAGS
+ SNDFILE_LIBS=$pkg_cv_SNDFILE_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ have_sndfile="maybe"
+fi
+
+# Step 3: Even if pkg-config says its not installed, user may have
+# manually installed libraries with no -kg-config support.
+if test "$have_sndfile" = "no"
+then
+ # As a last resort, just hope that header and ilbrary can
+ # be found in default paths and that it doesn't need
+ # to link against any other libraries.
+ SNDFILE_LIBS="-lsndfile $SNDFILE_LIBS"
+ have_sndfile="maybe"
+fi
+
+# Even if pkg-config or similar told us how to find library,
+# do a safety check.
+if test "$have_sndfile" != "no"
+then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $SNDFILE_CFLAGS"
+ LIBS="$LIBS $SNDFILE_LIBS"
+ ac_fn_c_check_header_mongrel "$LINENO" "sndfile.h" "ac_cv_header_sndfile_h" "$ac_includes_default"
+if test "x$ac_cv_header_sndfile_h" = xyes; then :
+
+
+$as_echo "#define HAVE_SNDFILE_H 1" >>confdefs.h
+
+ ac_fn_c_check_func "$LINENO" "sf_open_virtual" "ac_cv_func_sf_open_virtual"
+if test "x$ac_cv_func_sf_open_virtual" = xyes; then :
+
+ tmp_using_sndfile=$opt_default
+ have_sndfile="yes"
+
+fi
+
+ ac_fn_c_check_decl "$LINENO" "SF_FORMAT_OGG" "ac_cv_have_decl_SF_FORMAT_OGG" "#include <sndfile.h>
+"
+if test "x$ac_cv_have_decl_SF_FORMAT_OGG" = xyes; then :
+
+$as_echo "#define HAVE_SNDFILE_1_0_18 1" >>confdefs.h
+
+fi
+
+ ac_fn_c_check_decl "$LINENO" "SFC_SET_SCALE_INT_FLOAT_WRITE" "ac_cv_have_decl_SFC_SET_SCALE_INT_FLOAT_WRITE" "#include <sndfile.h>
+"
+if test "x$ac_cv_have_decl_SFC_SET_SCALE_INT_FLOAT_WRITE" = xyes; then :
+
+$as_echo "#define HAVE_SFC_SET_SCALE_INT_FLOAT_WRITE 1" >>confdefs.h
+
+fi
+
+
+fi
+
+
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+fi
+
+if test "$have_sndfile" != "yes"
+then
+ tmp_using_sndfile=no
+fi
+
+# Check whether --enable-dl_sndfile was given.
+if test "${enable_dl_sndfile+set}" = set; then :
+ enableval=$enable_dl_sndfile; enable_dl_sndfile=$enableval
+else
+ enable_dl_sndfile=no
+fi
+
+if test "x$using_sndfile" = "xyes"; then
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
+
+$as_echo "#define DL_SNDFILE 1" >>confdefs.h
+
+ SNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
+ else
+ enable_dl_sndfile="no"
+ fi
+fi
+
+# Check whether --with-sndfile was given.
+if test "${with_sndfile+set}" = set; then :
+ withval=$with_sndfile;
+fi
+
+ using_sndfile=$with_sndfile
+ if test "_$with_sndfile" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load sndfile dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_sndfile" = _; then
+ using_sndfile=$opt_default
+ elif test "_$with_sndfile" != _yes -a "_$with_sndfile" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-sndfile=$with_sndfile
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_sndfile != _no; then
+ using_sndfile=$tmp_using_sndfile
+ if test _$with_sndfile != _ -a $using_sndfile = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find sndfile
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_sndfile" != no; then
+
+$as_echo "#define HAVE_SNDFILE 1" >>confdefs.h
+
+ if test "$using_sndfile" = yes; then
+
+$as_echo "#define STATIC_SNDFILE 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_sndfile != no; then
+ HAVE_SNDFILE_TRUE=
+ HAVE_SNDFILE_FALSE='#'
+else
+ HAVE_SNDFILE_TRUE='#'
+ HAVE_SNDFILE_FALSE=
+fi
+
+ if test $using_sndfile = yes; then
+ STATIC_SNDFILE_TRUE=
+ STATIC_SNDFILE_FALSE='#'
+else
+ STATIC_SNDFILE_TRUE='#'
+ STATIC_SNDFILE_FALSE=
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-oss was given.
+if test "${with_oss+set}" = set; then :
+ withval=$with_oss;
+fi
+
+ using_oss=$with_oss
+ if test "_$with_oss" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load oss dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_oss" = _; then
+ using_oss=$opt_default
+ elif test "_$with_oss" != _yes -a "_$with_oss" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-oss=$with_oss
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_oss != _no; then
+ for ac_header in sys/soundcard.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_soundcard_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_SOUNDCARD_H 1
+_ACEOF
+
+else
+ for ac_header in machine/soundcard.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "machine/soundcard.h" "ac_cv_header_machine_soundcard_h" "$ac_includes_default"
+if test "x$ac_cv_header_machine_soundcard_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MACHINE_SOUNDCARD_H 1
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _oss_ioctl in -lossaudio" >&5
+$as_echo_n "checking for _oss_ioctl in -lossaudio... " >&6; }
+if ${ac_cv_lib_ossaudio__oss_ioctl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lossaudio $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _oss_ioctl ();
+int
+main ()
+{
+return _oss_ioctl ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ossaudio__oss_ioctl=yes
+else
+ ac_cv_lib_ossaudio__oss_ioctl=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ossaudio__oss_ioctl" >&5
+$as_echo "$ac_cv_lib_ossaudio__oss_ioctl" >&6; }
+if test "x$ac_cv_lib_ossaudio__oss_ioctl" = xyes; then :
+ OSS_LIBS="$OSS_LIBS -lossaudio"
+fi
+
+else
+ using_oss=no
+fi
+
+done
+
+fi
+
+done
+
+ if test _$with_oss != _ -a $using_oss = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find oss
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_oss" != no; then
+
+$as_echo "#define HAVE_OSS 1" >>confdefs.h
+
+ if test "$using_oss" = yes; then
+
+$as_echo "#define STATIC_OSS 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_oss != no; then
+ HAVE_OSS_TRUE=
+ HAVE_OSS_FALSE='#'
+else
+ HAVE_OSS_TRUE='#'
+ HAVE_OSS_FALSE=
+fi
+
+ if test $using_oss = yes; then
+ STATIC_OSS_TRUE=
+ STATIC_OSS_FALSE='#'
+else
+ STATIC_OSS_TRUE='#'
+ STATIC_OSS_FALSE=
+fi
+
+
+
+
+
+
+
+
+# Check whether --with-sunaudio was given.
+if test "${with_sunaudio+set}" = set; then :
+ withval=$with_sunaudio;
+fi
+
+ using_sunaudio=$with_sunaudio
+ if test "_$with_sunaudio" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load sunaudio dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_sunaudio" = _; then
+ using_sunaudio=$opt_default
+ elif test "_$with_sunaudio" != _yes -a "_$with_sunaudio" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-sunaudio=$with_sunaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_sunaudio != _no; then
+ for ac_header in sys/audioio.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/audioio.h" "ac_cv_header_sys_audioio_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_audioio_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_AUDIOIO_H 1
+_ACEOF
+
+else
+ for ac_header in sun/audioio.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sun/audioio.h" "ac_cv_header_sun_audioio_h" "$ac_includes_default"
+if test "x$ac_cv_header_sun_audioio_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SUN_AUDIOIO_H 1
+_ACEOF
+
+else
+ using_sunaudio=no
+fi
+
+done
+
+fi
+
+done
+
+ if test _$with_sunaudio != _ -a $using_sunaudio = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find sunaudio
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_sunaudio" != no; then
+
+$as_echo "#define HAVE_SUN_AUDIO 1" >>confdefs.h
+
+ if test "$using_sunaudio" = yes; then
+
+$as_echo "#define STATIC_SUN_AUDIO 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_sunaudio != no; then
+ HAVE_SUN_AUDIO_TRUE=
+ HAVE_SUN_AUDIO_FALSE='#'
+else
+ HAVE_SUN_AUDIO_TRUE='#'
+ HAVE_SUN_AUDIO_FALSE=
+fi
+
+ if test $using_sunaudio = yes; then
+ STATIC_SUN_AUDIO_TRUE=
+ STATIC_SUN_AUDIO_FALSE='#'
+else
+ STATIC_SUN_AUDIO_TRUE='#'
+ STATIC_SUN_AUDIO_FALSE=
+fi
+
+
+
+
+
+
+
+# MP2/MP3 format depends on libmad || LAME || twolame
+
+# Check whether --with-mp3 was given.
+if test "${with_mp3+set}" = set; then :
+ withval=$with_mp3;
+fi
+
+ using_mp3=$with_mp3
+ if test "_$with_mp3" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load mp3 dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_mp3" = _; then
+ using_mp3=$opt_default
+ elif test "_$with_mp3" != _yes -a "_$with_mp3" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-mp3=$with_mp3
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_mp3 != _no; then
+
+ if test "$using_mad" != yes -a "$using_lame" != yes -a "$using_twolame" != yes; then
+ using_mp3=no
+ fi
+ if test _$with_mp3 != _ -a $using_mp3 = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find mp3
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_mp3" != no; then
+
+$as_echo "#define HAVE_MP3 1" >>confdefs.h
+
+ if test "$using_mp3" = yes; then
+
+$as_echo "#define STATIC_MP3 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_mp3 != no; then
+ HAVE_MP3_TRUE=
+ HAVE_MP3_FALSE='#'
+else
+ HAVE_MP3_TRUE='#'
+ HAVE_MP3_FALSE=
+fi
+
+ if test $using_mp3 = yes; then
+ STATIC_MP3_TRUE=
+ STATIC_MP3_FALSE='#'
+else
+ STATIC_MP3_TRUE='#'
+ STATIC_MP3_FALSE=
+fi
+
+
+
+
+
+
+
+# GSM format depends on libgsm
+# No need to check; GSM is always found
+
+# Check whether --with-gsm was given.
+if test "${with_gsm+set}" = set; then :
+ withval=$with_gsm;
+fi
+
+ using_gsm=$with_gsm
+ if test "_$with_gsm" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load gsm dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_gsm" = _; then
+ using_gsm=$opt_default
+ elif test "_$with_gsm" != _yes -a "_$with_gsm" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-gsm=$with_gsm
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_gsm != _no; then
+
+ if test _$with_gsm != _ -a $using_gsm = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find gsm
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_gsm" != no; then
+
+$as_echo "#define HAVE_GSM 1" >>confdefs.h
+
+ if test "$using_gsm" = yes; then
+
+$as_echo "#define STATIC_GSM 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_gsm != no; then
+ HAVE_GSM_TRUE=
+ HAVE_GSM_FALSE='#'
+else
+ HAVE_GSM_TRUE='#'
+ HAVE_GSM_FALSE=
+fi
+
+ if test $using_gsm = yes; then
+ STATIC_GSM_TRUE=
+ STATIC_GSM_FALSE='#'
+else
+ STATIC_GSM_TRUE='#'
+ STATIC_GSM_FALSE=
+fi
+
+
+
+
+
+
+
+# LPC10 format depends on liblpc10
+# No need to check; LPC10 is always found
+
+# Check whether --with-lpc10 was given.
+if test "${with_lpc10+set}" = set; then :
+ withval=$with_lpc10;
+fi
+
+ using_lpc10=$with_lpc10
+ if test "_$with_lpc10" = _dyn; then
+ if test $using_libltdl != yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "not using libltdl; cannot load lpc10 dynamically
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ elif test "_$with_lpc10" = _; then
+ using_lpc10=$opt_default
+ elif test "_$with_lpc10" != _yes -a "_$with_lpc10" != _no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "invalid selection --with-lpc10=$with_lpc10
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ if test _$with_lpc10 != _no; then
+
+ if test _$with_lpc10 != _ -a $using_lpc10 = no; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot find lpc10
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+ if test "$using_lpc10" != no; then
+
+$as_echo "#define HAVE_LPC10 1" >>confdefs.h
+
+ if test "$using_lpc10" = yes; then
+
+$as_echo "#define STATIC_LPC10 1" >>confdefs.h
+
+ fi
+ fi
+ if test $using_lpc10 != no; then
+ HAVE_LPC10_TRUE=
+ HAVE_LPC10_FALSE='#'
+else
+ HAVE_LPC10_TRUE='#'
+ HAVE_LPC10_FALSE=
+fi
+
+ if test $using_lpc10 = yes; then
+ STATIC_LPC10_TRUE=
+ STATIC_LPC10_FALSE='#'
+else
+ STATIC_LPC10_TRUE='#'
+ STATIC_LPC10_FALSE=
+fi
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable symlinks" >&5
+$as_echo_n "checking whether to enable symlinks... " >&6; }
+# Check whether --enable-symlinks was given.
+if test "${enable_symlinks+set}" = set; then :
+ enableval=$enable_symlinks;
+else
+ enable_symlinks=yes
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_symlinks" >&5
+$as_echo "$enable_symlinks" >&6; }
+
+enable_playrec_symlinks=no
+if test "$enable_symlinks" = "yes"; then
+ SYMLINKS=yes
+ if test false \
+ -o "$enable_alsa" = yes \
+ -o "$enable_ao" = yes \
+ -o "$enable_coreaudio" = yes \
+ -o "$enable_oss" = yes \
+ -o "$enable_pulseaudio" = yes \
+ -o "$enable_sndio" = yes \
+ ; then
+ PLAYRECLINKS=yes
+ enable_playrec_symlinks=yes
+ fi
+fi
+
+
+
+ if test "$enable_shared" = "no" -a "$enable_static" = "yes"; then
+ STATIC_LIBSOX_ONLY_TRUE=
+ STATIC_LIBSOX_ONLY_FALSE='#'
+else
+ STATIC_LIBSOX_ONLY_TRUE='#'
+ STATIC_LIBSOX_ONLY_FALSE=
+fi
+
+
+ac_config_files="$ac_config_files Makefile src/Makefile libgsm/Makefile lpc10/Makefile msvc9/Makefile msvc10/Makefile sox.pc"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_PKGCONFIG_TRUE}" && test -z "${HAVE_PKGCONFIG_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_PKGCONFIG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_WIN32_GLOB_TRUE}" && test -z "${HAVE_WIN32_GLOB_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_WIN32_GLOB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_DISTRO_TRUE}" && test -z "${HAVE_DISTRO_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_DISTRO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+if test -z "${HAVE_LIBLTDL_TRUE}" && test -z "${HAVE_LIBLTDL_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_LIBLTDL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_WIN32_LTDL_TRUE}" && test -z "${HAVE_WIN32_LTDL_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_WIN32_LTDL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_MAGIC_TRUE}" && test -z "${HAVE_MAGIC_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_MAGIC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_PNG_TRUE}" && test -z "${HAVE_PNG_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_PNG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_ID3TAG_TRUE}" && test -z "${HAVE_ID3TAG_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_ID3TAG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${EXTERNAL_GSM_TRUE}" && test -z "${EXTERNAL_GSM_FALSE}"; then
+ as_fn_error $? "conditional \"EXTERNAL_GSM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${EXTERNAL_LPC10_TRUE}" && test -z "${EXTERNAL_LPC10_FALSE}"; then
+ as_fn_error $? "conditional \"EXTERNAL_LPC10\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_OGG_VORBIS_TRUE}" && test -z "${HAVE_OGG_VORBIS_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_OGG_VORBIS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_OGG_VORBIS_TRUE}" && test -z "${STATIC_OGG_VORBIS_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_OGG_VORBIS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_OPUS_TRUE}" && test -z "${HAVE_OPUS_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_OPUS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_OPUS_TRUE}" && test -z "${STATIC_OPUS_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_OPUS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_FLAC_TRUE}" && test -z "${HAVE_FLAC_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_FLAC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_FLAC_TRUE}" && test -z "${STATIC_FLAC_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_FLAC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_AMRWB_TRUE}" && test -z "${HAVE_AMRWB_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_AMRWB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_AMRWB_TRUE}" && test -z "${STATIC_AMRWB_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_AMRWB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_AMRNB_TRUE}" && test -z "${HAVE_AMRNB_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_AMRNB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_AMRNB_TRUE}" && test -z "${STATIC_AMRNB_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_AMRNB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_WAVPACK_TRUE}" && test -z "${HAVE_WAVPACK_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_WAVPACK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_WAVPACK_TRUE}" && test -z "${STATIC_WAVPACK_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_WAVPACK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_SNDIO_TRUE}" && test -z "${HAVE_SNDIO_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_SNDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_SNDIO_TRUE}" && test -z "${STATIC_SNDIO_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_SNDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_COREAUDIO_TRUE}" && test -z "${HAVE_COREAUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_COREAUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_COREAUDIO_TRUE}" && test -z "${STATIC_COREAUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_COREAUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_ALSA_TRUE}" && test -z "${HAVE_ALSA_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_ALSA\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_ALSA_TRUE}" && test -z "${STATIC_ALSA_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_ALSA\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_AO_TRUE}" && test -z "${HAVE_AO_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_AO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_AO_TRUE}" && test -z "${STATIC_AO_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_AO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_PULSEAUDIO_TRUE}" && test -z "${HAVE_PULSEAUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_PULSEAUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_PULSEAUDIO_TRUE}" && test -z "${STATIC_PULSEAUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_PULSEAUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_WAVEAUDIO_TRUE}" && test -z "${HAVE_WAVEAUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_WAVEAUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_WAVEAUDIO_TRUE}" && test -z "${STATIC_WAVEAUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_WAVEAUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_SNDFILE_TRUE}" && test -z "${HAVE_SNDFILE_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_SNDFILE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_SNDFILE_TRUE}" && test -z "${STATIC_SNDFILE_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_SNDFILE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_OSS_TRUE}" && test -z "${HAVE_OSS_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_OSS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_OSS_TRUE}" && test -z "${STATIC_OSS_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_OSS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_SUN_AUDIO_TRUE}" && test -z "${HAVE_SUN_AUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_SUN_AUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_SUN_AUDIO_TRUE}" && test -z "${STATIC_SUN_AUDIO_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_SUN_AUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_MP3_TRUE}" && test -z "${HAVE_MP3_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_MP3\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_MP3_TRUE}" && test -z "${STATIC_MP3_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_MP3\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_GSM_TRUE}" && test -z "${HAVE_GSM_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_GSM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_GSM_TRUE}" && test -z "${STATIC_GSM_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_GSM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_LPC10_TRUE}" && test -z "${HAVE_LPC10_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_LPC10\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_LPC10_TRUE}" && test -z "${STATIC_LPC10_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_LPC10\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${STATIC_LIBSOX_ONLY_TRUE}" && test -z "${STATIC_LIBSOX_ONLY_FALSE}"; then
+ as_fn_error $? "conditional \"STATIC_LIBSOX_ONLY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by SoX $as_me 14.4.2, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <sox-devel@lists.sourceforge.net>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+SoX config.status 14.4.2
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in AS \
+DLLTOOL \
+OBJDUMP \
+SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "src/soxconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS src/soxconfig.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "libgsm/Makefile") CONFIG_FILES="$CONFIG_FILES libgsm/Makefile" ;;
+ "lpc10/Makefile") CONFIG_FILES="$CONFIG_FILES lpc10/Makefile" ;;
+ "msvc9/Makefile") CONFIG_FILES="$CONFIG_FILES msvc9/Makefile" ;;
+ "msvc10/Makefile") CONFIG_FILES="$CONFIG_FILES msvc10/Makefile" ;;
+ "sox.pc") CONFIG_FILES="$CONFIG_FILES sox.pc" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "$am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Assembler program.
+AS=$lt_AS
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Object dumper program.
+OBJDUMP=$lt_OBJDUMP
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ if test x"$xsi_shell" = xyes; then
+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\ # positional parameters, so assign one to ordinary parameter first.\
+\ func_stripname_result=${3}\
+\ func_stripname_result=${func_stripname_result#"${1}"}\
+\ func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\ func_split_long_opt_name=${1%%=*}\
+\ func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\ func_split_short_opt_arg=${1#??}\
+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\ case ${1} in\
+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\ *) func_lo2o_result=${1} ;;\
+\ esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+ func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+ func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+ func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+ eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\ func_quote_for_eval "${2}"\
+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+if test "$using_gsm" != "no"; then
+ if test "$found_libgsm" = "yes"; then
+ gsm_option="(external)"
+ else
+ gsm_option="(in-tree)"
+ fi
+fi
+
+if test "$using_lpc10" != "no"; then
+ if test "$found_liblpc10" = "yes"; then
+ lpc10_option="(external)"
+ else
+ lpc10_option="(in-tree)"
+ fi
+fi
+
+if test "$using_pkgconfig" = "no"; then
+ pkgconfig_option="disabled"
+else
+ pkgconfig_option="$with_pkgconfigdir"
+fi
+
+# Report configuration.
+echo
+echo "BUILD OPTIONS"
+echo "Debugging build............$enable_debug"
+echo "Distro name ...............$DISTRO"
+echo "Dynamic loading support....$using_libltdl"
+echo "Pkg-config location........$pkgconfig_option"
+echo "Play and rec symlinks......$enable_playrec_symlinks"
+echo "Symlinks enabled...........$enable_symlinks"
+echo
+echo "OPTIONAL DEVICE DRIVERS"
+echo "ao (Xiph)..................$using_ao"
+echo "alsa (Linux)...............$using_alsa"
+echo "coreaudio (Mac OS X).......$using_coreaudio"
+echo "sndio (OpenBSD)............$using_sndio"
+echo "oss........................$using_oss"
+echo "pulseaudio.................$using_pulseaudio"
+echo "sunaudio...................$using_sunaudio"
+echo "waveaudio (MS-Windows).....$using_waveaudio"
+echo
+echo "OPTIONAL FILE FORMATS"
+echo "amrnb......................$using_amrnb"
+if test "x$using_amrnb" = "xyes"; then
+echo " dlopen amrnb..............$enable_dl_amrnb"
+fi
+echo "amrwb......................$using_amrwb"
+if test "x$using_amrwb" = "xyes"; then
+echo " dlopen amrwb..............$enable_dl_amrwb"
+fi
+echo "flac.......................$using_flac"
+echo "gsm........................$using_gsm $gsm_option"
+echo "lpc10......................$using_lpc10 $lpc10_option"
+echo "mp2/mp3....................$using_mp3"
+echo " id3tag....................$using_id3tag"
+echo " lame......................$using_lame"
+if test "x$using_lame" = "xyes"; then
+if test "x$enable_dl_lame" != "xyes"; then
+echo " lame id3tag...............$ac_cv_lib_mp3lame_id3tag_set_fieldvalue"
+fi
+echo " dlopen lame...............$enable_dl_lame"
+fi
+echo " mad.......................$using_mad"
+if test "x$using_mad" = "xyes"; then
+echo " dlopen mad................$enable_dl_mad"
+fi
+echo " twolame...................$using_twolame"
+if test "x$using_twolame" = "xyes"; then
+echo " dlopen twolame............$enable_dl_twolame"
+fi
+echo "oggvorbis..................$using_oggvorbis"
+echo "opus.......................$using_opus"
+echo "sndfile....................$using_sndfile"
+if test "x$using_sndfile" = "xyes"; then
+echo " dlopen sndfile............$enable_dl_sndfile"
+fi
+echo "wavpack....................$using_wavpack"
+echo
+echo "OTHER OPTIONS"
+echo "ladspa effects.............$using_ladspa"
+echo "magic support..............$using_magic"
+echo "png support................$using_png"
+if test "x$OPENMP_CFLAGS" = "x"; then
+echo "OpenMP support.............no"
+else
+echo "OpenMP support.............yes, $OPENMP_CFLAGS"
+fi
+echo
+echo "Configure finished. Do 'make -s && make install' to compile and install SoX."
+echo
diff --git a/src/configure.ac b/src/configure.ac
new file mode 100644
index 0000000..e2113fb
--- /dev/null
+++ b/src/configure.ac
@@ -0,0 +1,766 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.62)
+
+AC_INIT(SoX, 14.4.2, sox-devel@lists.sourceforge.net)
+
+AC_CONFIG_MACRO_DIR([m4])
+
+dnl Find target architecture
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
+
+dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
+AC_CONFIG_HEADERS([src/soxconfig.h])
+
+dnl Check we have the right srcdir
+AC_CONFIG_SRCDIR(sox.1)
+
+dnl Checks for programs.
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_INSTALL
+AC_PROG_LN_S
+
+dnl Increase version when binary compatibility with previous version is broken
+SHLIB_VERSION=3:0:0
+AC_SUBST(SHLIB_VERSION)
+
+AC_ARG_WITH(libltdl,
+ AS_HELP_STRING([--without-libltdl],
+ [Don't try to use libltdl for external dynamic library support]),
+ with_libltdl=$withval, with_libltdl=default)
+
+if test "$with_libltdl" = "default"; then
+ dnl Default to no libltdl support when building only static libraries
+ if test "$enable_shared" != "no"; then
+ using_libltdl=yes
+ else
+ using_libltdl=no
+ fi
+ with_libltdl="yes"
+else
+ using_libltdl=$with_libltdl
+fi
+
+LT_INIT([dlopen win32-dll])
+AC_SUBST(LIBTOOL_DEPS)
+
+AC_ARG_WITH(dyn-default,AS_HELP_STRING([--with-dyn-default],[Default to loading optional formats dynamically]),opt_default=dyn,opt_default=yes)
+
+AC_ARG_WITH(pkgconfigdir,
+ AS_HELP_STRING([--with-pkgconfigdir],
+ [location to install .pc files or "no" to disable (default=$(libdir)/pkgconfig)]))
+
+m4_ifndef([PKG_PROG_PKG_CONFIG], with_pkgconfigdir="no")
+
+using_pkgconfig=no
+if test "$with_pkgconfigdir" != "no"; then
+ if test "$with_pkgconfigdir" = ""; then
+ with_pkgconfigdir="\$(libdir)/pkgconfig"
+ fi
+ using_pkgconfig="yes"
+ PKG_PROG_PKG_CONFIG
+fi
+AM_CONDITIONAL(HAVE_PKGCONFIG, test x$using_pkgconfig = xyes)
+AC_SUBST(PKGCONFIGDIR, $with_pkgconfigdir)
+
+using_win32_glob="no"
+case $target in
+ *mingw*)
+ using_win32_glob="yes"
+ ;;
+esac
+if test "$using_win32_glob" = yes; then
+ AC_DEFINE([HAVE_WIN32_GLOB_H], 1, [Define to 1 to use win32 glob])
+fi
+AM_CONDITIONAL(HAVE_WIN32_GLOB, test x$using_win32_glob = xyes)
+
+dnl Debugging
+AC_MSG_CHECKING([whether to make a debug build])
+AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [make a debug build]))
+AC_MSG_RESULT($enable_debug)
+if test "$enable_debug" = "yes"; then
+ CFLAGS="-g"
+ if test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -ggdb"
+ fi
+else
+ enable_debug=no
+fi
+
+# -fstack-protector
+AC_ARG_ENABLE([stack-protector],
+ [AS_HELP_STRING([--disable-stack-protector],
+ [Disable GCC's/libc's stack-smashing protection])],
+ [case "${enableval}" in
+ yes) enable_ssp=yes ;;
+ no) enable_ssp=no ;;
+ *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
+ esac],
+ [enable_ssp=yes])
+
+if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
+ AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
+ enable_ssp=no
+fi
+
+if test x"$enable_ssp" = x"yes"; then
+ # Check for broken ssp in libc: http://www.avahi.org/ticket/105
+ # libc's brokenness will get in the way regardless of whether -lssp is
+ # provided, but provide it anyway (otherwise non-libc ssp would wrongly
+ # break here)
+
+ # Get -lssp if it exists
+ GCC_STACK_PROTECT_LIB
+
+ AC_MSG_CHECKING([whether stack-smashing protection is available])
+ ssp_old_cflags="$CFLAGS"
+ ssp_old_ldflags="$LDFLAGS"
+ CFLAGS="$CFLAGS -Werror -fstack-protector-all -fPIC"
+ LDFLAGS="$LDFLAGS -Wl,-z,defs"
+ cat confdefs.h > conftest.c
+ cat >>conftest.c <<_ACEOF
+void test_broken_ssp(c)
+ const char *c;
+{
+ char arr[[123]], *p; /* beware of possible double-braces if copying this */
+ for (p = arr; *c; ++p) {
+ *p = *c;
+ ++c;
+ }
+}
+_ACEOF
+ rm -f conftest.o
+
+ if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
+ AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([whether stack-smashing protection is buggy])
+ if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
+ AC_MSG_RESULT([no])
+ else
+ AC_MSG_RESULT([yes])
+ enable_ssp=no
+ fi
+ else
+ AC_MSG_RESULT([no])
+ fi
+
+ rm -f conftest.c conftest.o conftest.so
+
+ CFLAGS="$ssp_old_cflags"
+ LDFLAGS="$ssp_old_ldflags"
+fi
+
+if test x"$enable_ssp" = x"yes"; then
+ # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
+ GCC_STACK_PROTECT_CC
+
+ # XXX: Update the enable_ssp value now for output later?
+fi
+
+dnl Extra CFLAGS if we have gcc
+if test "$GCC" = "yes"; then
+
+ AC_MSG_CHECKING([gcc version])
+ gccver=`$CC -dumpversion`
+ AC_MSG_RESULT($gccver)
+
+ CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wstrict-prototypes -pedantic"
+
+ AS_VERSION_COMPARE([$gccver], [4.3],
+ [WARN_CFLAGS="-Wconversion"],
+ [WARN_CFLAGS="-Wtraditional-conversion"],
+ [WARN_CFLAGS="-Wtraditional-conversion"])
+ dnl Define stricter policy on GNU/Linux, all symbols must be resolved
+ case $target in
+ *linux* | *solaris*)
+ LDFLAGS="$LDFLAGS -Wl,-z,defs"
+ ;;
+ *os2* | *cygwin* | *mingw*)
+ APP_LDFLAGS="-no-undefined"
+ ;;
+ esac
+fi
+AC_SUBST(APP_LDFLAGS)
+AC_SUBST(WARN_CFLAGS)
+
+AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=distro], [Provide distribution name]))
+if test "x$with_distro" != "x"; then
+ DISTRO="$with_distro"
+ AC_SUBST(DISTRO)
+ AC_DEFINE(HAVE_DISTRO, 1, [1 if DISTRO is defined])
+ have_distro=yes
+else
+ DISTRO="not specified!"
+fi
+AM_CONDITIONAL(HAVE_DISTRO, test x$have_distro = xyes)
+
+dnl Check for system dependent features.
+AC_C_BIGENDIAN
+AC_C_INLINE
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h unistd.h byteswap.h sys/stat.h sys/time.h sys/timeb.h sys/types.h sys/utsname.h termios.h glob.h fenv.h)
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(strcasecmp strdup popen vsnprintf gettimeofday mkstemp fmemopen)
+
+dnl Check if math library is needed.
+AC_SEARCH_LIBS([pow], [m])
+AC_SEARCH_LIBS([lrint], [m])
+AC_CHECK_FUNCS([lrint])
+
+dnl Large File Support
+AC_SYS_LARGEFILE
+AC_FUNC_FSEEKO
+if test "$ac_cv_sys_file_offset_bits" = "64"; then
+ dnl This is either a 64-bit platform or a 32-bit platform
+ dnl that supports large files.
+ dnl There are to many broken glibc+kernel's out there that
+ dnl detect 64-bit off_t on 32-bit system and require
+ dnl _LARGEFILE_SOURCE to make fseeko() go into 64-bit mode.
+ dnl Force defining _LARGEFILE_SOURCE always. My assumption
+ dnl is its harmlessly ignored on 64-bit platforms and platforms
+ dnl that chose other solutions.
+ AC_MSG_NOTICE(Forcing _LARGEFILE_SOURCE to be safe since off_t is 64 bits)
+ AC_DEFINE(_LARGEFILE_SOURCE, 1)
+fi
+
+dnl Allow libtool to be silenced
+AC_MSG_CHECKING([whether libtool should be silenced])
+AC_ARG_ENABLE(silent-libtool,
+ AS_HELP_STRING([--disable-silent-libtool], [Verbose libtool]),,enable_silent_libtool=yes)
+AC_MSG_RESULT($enable_silent_libtool)
+if test "$enable_silent_libtool" = "yes"; then
+ LIBTOOLFLAGS=--silent
+fi
+AC_SUBST(LIBTOOLFLAGS)
+
+dnl Check if ltdl should be enabled.
+using_win32_ltdl="no"
+if test "$using_libltdl" != "no"; then
+ case $target in
+ *mingw*)
+ AC_DEFINE([HAVE_WIN32_LTDL_H], 1, [Define to 1 to use internal win32 ltdl])
+ LIBLTDL=""
+ using_win32_ltdl="yes"
+ ;;
+ *)
+ AC_CHECK_HEADERS(ltdl.h,
+ AC_CHECK_LIB(ltdl, lt_dlinit, LIBLTDL="$LIBLTDL -lltdl",
+ using_libltdl=no), using_libltdl=no)
+ ;;
+ esac
+fi
+if test "$using_libltdl" = yes; then
+ AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have libltdl])
+fi
+AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes -a x$using_win32_ltdl = xno)
+AM_CONDITIONAL(HAVE_WIN32_LTDL, test x$using_win32_ltdl = xyes)
+AC_SUBST(LIBLTDL)
+
+
+dnl Check for OpenMP
+AC_OPENMP
+if test "x$OPENMP_CFLAGS" != "x"; then dnl Old libtool workaround start
+ AC_MSG_CHECKING([for libtool version])
+ lt_version="`grep '^VERSION' $srcdir/ltmain.sh | sed -e 's/VERSION\=//g;s/ .*//g;s/"//g'`"
+ AS_VERSION_COMPARE([$lt_version], [2.4],
+ [AS_IF([test "$GCC" = "yes"],
+ [AC_MSG_RESULT([$lt_version, needs OpenMP linker workaround])
+ GOMP_LIBS="-lgomp"],
+ [AC_MSG_RESULT([$lt_version and not GCC, deactivating OpenMP])
+ OPENMP_CFLAGS=""])],
+ [AC_MSG_RESULT([$lt_version, OK])],
+ [AC_MSG_RESULT([$lt_version, OK])])
+fi
+AC_SUBST(GOMP_LIBS) dnl Old libtool workaround end.
+ dnl Only necessary if libtool version < 2.4, as older
+ dnl versions don't pass on "-fopenmp" to the linker.
+ dnl One day, replace with LT_PREREQ([2.4]) above.
+CFLAGS="$CFLAGS $OPENMP_CFLAGS"
+
+
+dnl Check for magic library
+AC_ARG_WITH(magic,
+ AS_HELP_STRING([--without-magic],
+ [Don't try to use magic]))
+using_magic=no
+if test "$with_magic" != "no"; then
+ using_magic=yes
+ AC_CHECK_HEADER(magic.h,
+ [AC_CHECK_LIB(magic, magic_open, MAGIC_LIBS="-lmagic",using_magic=no)],
+ using_magic=no)
+ if test "$with_magic" = "yes" -a "$using_magic" = "no"; then
+ AC_MSG_FAILURE([cannot find magic])
+ fi
+fi
+if test "$using_magic" = yes; then
+ AC_DEFINE(HAVE_MAGIC, 1, [Define to 1 if you have magic.])
+fi
+AM_CONDITIONAL(HAVE_MAGIC, test x$using_magic = xyes)
+AC_SUBST(MAGIC_LIBS)
+
+
+
+dnl Check for png libraries
+AC_ARG_WITH(png,
+ AS_HELP_STRING([--without-png],
+ [Don't try to use png]))
+using_png=no
+if test "$with_png" != "no"; then
+ AC_CHECK_HEADERS(png.h libpng/png.h,using_png=yes)
+ if test "$using_png" = "yes"; then
+ AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz",
+ [AC_CHECK_LIB(png12, png_set_rows,
+ PNG_LIBS="$PNG_LIBS -lpng12 -lz",
+ using_png=no, -lz)], -lz)
+ fi
+ if test "$with_png" = "yes" -a "$using_png" = "no"; then
+ AC_MSG_FAILURE([cannot find png])
+ fi
+fi
+if test "$using_png" = yes; then
+ AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have PNG.])
+fi
+AM_CONDITIONAL(HAVE_PNG, test x$using_png = xyes)
+AC_SUBST(PNG_LIBS)
+
+
+
+dnl Test for LADSPA
+AC_ARG_WITH(ladspa,
+ AS_HELP_STRING([--without-ladspa], [Don't try to use LADSPA]))
+using_ladspa=no
+if test "$with_ladspa" != "no" -a "$using_libltdl" = "yes"; then
+ using_ladspa=yes
+ AC_DEFINE(HAVE_LADSPA_H, 1, [1 if should enable LADSPA])
+fi
+LADSPA_PATH=${libdir}/ladspa
+AC_ARG_WITH(ladspa-path,
+ AS_HELP_STRING([--with-ladspa-path], [Default search path for LADSPA plugins]))
+AC_SUBST(LADSPA_PATH)
+
+
+
+dnl Check for MAD libraries
+AC_ARG_WITH(mad,
+ AS_HELP_STRING([--without-mad],
+ [Don't try to use MAD (MP3 Audio Decoder)]))
+using_mad=no
+if test "$with_mad" != "no"; then
+ using_mad=yes
+ AC_CHECK_HEADERS(mad.h,, using_mad=no)
+ AC_MSG_CHECKING([whether to dlopen mad])
+ AC_ARG_ENABLE(dl_mad,
+ AS_HELP_STRING([--enable-dl-mad], [Dlopen mad instead of linking in.]),
+ enable_dl_mad=$enableval, enable_dl_mad=no)
+ AC_MSG_RESULT($enable_dl_mad)
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
+ AC_DEFINE(DL_MAD, 1, [Define to dlopen() mad.])
+ else
+ enable_dl_mad="no"
+ AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
+ if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
+ AC_MSG_FAILURE([cannot find libmad])
+ fi
+ fi
+fi
+
+
+
+dnl Check for id3tag libraries
+AC_ARG_WITH(id3tag,
+ AS_HELP_STRING([--without-id3tag],
+ [Don't try to use id3tag]))
+using_id3tag=no
+if test "$with_id3tag" != "no"; then
+ using_id3tag=yes
+ AC_CHECK_HEADER(id3tag.h,
+ [AC_CHECK_LIB(id3tag, id3_file_open, MP3_LIBS="$MP3_LIBS -lid3tag -lz",using_id3tag=no, -lz)],
+ using_id3tag=no)
+ if test "$with_id3tag" = "yes" -a "$using_id3tag" = "no"; then
+ AC_MSG_FAILURE([cannot find id3tag])
+ fi
+fi
+if test "$using_id3tag" = yes; then
+ AC_DEFINE(HAVE_ID3TAG, 1, [Define to 1 if you have id3tag.])
+fi
+AM_CONDITIONAL(HAVE_ID3TAG, test x$using_id3tag = xyes)
+
+
+
+dnl Check for LAME library.
+AC_ARG_WITH(lame,
+ AS_HELP_STRING([--without-lame],
+ [Don't try to use LAME (LAME Ain't an MP3 Encoder)]))
+using_lame=no
+if test "$with_lame" != "no"; then
+ using_lame=yes
+ AC_MSG_CHECKING([whether to dlopen lame])
+ AC_ARG_ENABLE(dl_lame,
+ AS_HELP_STRING([--enable-dl-lame], [Dlopen lame instead of linking in.]),
+ enable_dl_lame=$enableval, enable_dl_lame=no)
+ AC_MSG_RESULT($enable_dl_lame)
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
+ AC_DEFINE(DL_LAME, 1, [Define to dlopen() lame.])
+ else
+ enable_dl_lame="no"
+ AC_CHECK_HEADERS(lame/lame.h,,
+ [AC_CHECK_HEADERS(lame.h, [], using_lame=no)])
+ AC_CHECK_LIB(mp3lame, lame_get_lametag_frame, MP3_LIBS="$MP3_LIBS -lmp3lame", using_lame=no)
+ AC_CHECK_LIB(mp3lame, id3tag_set_fieldvalue, using_lame=$using_lame)
+ if test "$ac_cv_lib_mp3lame_id3tag_set_fieldvalue" = yes; then
+ AC_DEFINE(HAVE_LAME_ID3TAG, 1, [Define to 1 if lame supports optional ID3 tags.])
+ fi
+ if test "$with_lame" = "yes" -a "$using_lame" = "no"; then
+ AC_MSG_FAILURE([cannot find LAME])
+ fi
+ fi
+fi
+
+
+
+dnl Check for Twolame library
+AC_ARG_WITH(twolame,
+ AS_HELP_STRING([--without-twolame],
+ [Don't try to use Twolame (MP2 Audio Encoder)]))
+using_twolame=no
+if test "$with_twolame" != "no"; then
+ using_twolame=yes
+ AC_CHECK_HEADERS(twolame.h,, using_twolame=no)
+ AC_MSG_CHECKING([whether to dlopen twolame])
+ AC_ARG_ENABLE(dl_twolame,
+ AS_HELP_STRING([--enable-dl-twolame], [Dlopen twolame instead of linking in.]),
+ enable_dl_twolame=$enableval, enable_dl_twolame=no)
+ AC_MSG_RESULT($enable_dl_twolame)
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_twolame" = "xyes"; then
+ AC_DEFINE(DL_TWOLAME, 1, [Define to dlopen() libtwolame.])
+ else
+ enable_dl_twolame="no"
+ AC_CHECK_LIB(twolame, twolame_init, MP3_LIBS="$MP3_LIBS -ltwolame",using_twolame=no)
+ if test "$with_twolame" = "yes" -a "$using_twolame" = "no"; then
+ AC_MSG_FAILURE([cannot find libtwolame])
+ fi
+ fi
+fi
+
+# Check for libgsm
+found_libgsm=yes
+AC_CHECK_HEADERS(gsm/gsm.h, ,
+ [AC_CHECK_HEADERS(gsm.h, ,found_libgsm=no)])
+ AC_CHECK_LIB(gsm, gsm_create, GSM_LIBS="$GSM_LIBS -lgsm", found_libgsm=no)
+if test "$found_libgsm" = yes; then
+ AC_DEFINE(EXTERNAL_GSM, 1, [Define if you are using an external GSM library])
+else
+ LIBGSM_LIBADD=../libgsm/libgsm.la
+fi
+AM_CONDITIONAL(EXTERNAL_GSM, test x$found_libgsm = xyes)
+AC_SUBST(LIBGSM_LIBADD)
+
+
+
+# Check for liblpc10
+found_liblpc10=yes
+AC_CHECK_HEADERS(lpc10.h, ,
+ [AC_CHECK_HEADERS(lpc10.h, ,found_liblpc10=no)])
+ AC_CHECK_LIB(lpc10, create_lpc10_encoder_state, LPC10_LIBS="$LPC10_LIBS -llpc10", found_liblpc10=no)
+if test "$found_liblpc10" = yes; then
+ AC_DEFINE(EXTERNAL_LPC10, 1, [Define if you are using an external LPC10 library])
+else
+ LIBLPC10_LIBADD=../lpc10/liblpc10.la
+fi
+AM_CONDITIONAL(EXTERNAL_LPC10, test x$found_liblpc10 = xyes)
+AC_SUBST(LIBLPC10_LIBADD)
+
+
+
+# Check for Ogg Vorbis
+AC_OPTIONAL_FORMAT(oggvorbis, OGG_VORBIS, [AC_CHECK_HEADER(vorbis/codec.h,
+ [AC_CHECK_LIB(ogg, ogg_packet_clear, OGG_VORBIS_LIBS="$OGG_VORBIS_LIBS -logg", using_oggvorbis=no)
+ AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, OGG_VORBIS_LIBS="-lvorbis $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
+ AC_CHECK_LIB(vorbisfile, ov_clear, OGG_VORBIS_LIBS="-lvorbisfile $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)
+ AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr, OGG_VORBIS_LIBS="-lvorbisenc $OGG_VORBIS_LIBS", using_oggvorbis=no, $OGG_VORBIS_LIBS)],
+ using_oggvorbis=no)])
+
+# Check for Opus
+AC_OPTIONAL_FORMAT(opus, OPUS,
+ [PKG_CHECK_MODULES(OPUS, [opusfile], [], using_opus=no)],
+ using_opus=no)
+if test "$GCC" = "yes"; then
+ OPUS_CFLAGS="$OPUS_CFLAGS -Wno-long-long"
+fi
+
+
+# Check for FLAC libraries
+# Note passing in OGG_VORBIS_LIBS. That is because FLAC has optional
+# support for OGG and if OGG libraries are found on this
+# system then its highly likely to be compiled into FLAC
+# and will require these at link time.
+case $target in
+ *mingw*)
+ FLAC_LIBS="-lwsock32"
+ ;;
+esac
+AC_OPTIONAL_FORMAT(flac, FLAC, [AC_CHECK_HEADER(FLAC/all.h, [AC_CHECK_DECL(FLAC_API_VERSION_CURRENT, [AC_CHECK_LIB(FLAC, FLAC__stream_encoder_new, FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_VORBIS_LIBS",using_flac=no, $FLAC_LIBS $OGG_VORBIS_LIBS)], using_flac=no, [#include <FLAC/all.h>])], using_flac=no)], using_flac=no)
+
+
+dnl When enable_dl_amrbw, do not let add libraries to be linked in
+dnl since they will be dlopen()'ed instead.
+ac_sox_save_AMRWB_LIBS="$AMRWB_LIBS"
+tmp_using_amrwb=$opt_default
+AC_CHECK_HEADERS(opencore-amrwb/dec_if.h,
+ [AC_CHECK_LIB(opencore-amrwb, D_IF_init,
+ AMRWB_LIBS="$AMRWB_LIBS -lopencore-amrwb", tmp_using_amrwb=no)],
+ [AC_CHECK_HEADERS(amrwb/dec.h,
+ [AC_CHECK_LIB(amrwb, D_IF_init,
+ AMRWB_LIBS="$AMRWB_LIBS -lamrwb",tmp_using_amrwb=no)],
+ tmp_using_amrwb=no)])
+AC_ARG_ENABLE(dl_amrwb,
+ AS_HELP_STRING([--enable-dl-amrwb],
+ [Dlopen amrbw instead of linking in.]),
+ enable_dl_amrwb=$enableval, enable_dl_amrwb=no)
+if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrwb" = "xyes"; then
+ AC_DEFINE(DL_AMRWB, 1, [Define to dlopen() amrwb.])
+ dnl When enable_dl_amrwb, do not let SOX_PATH_AMRWB add libraries
+ dnl to be linked in (since they will be dlopen()'ed instead).
+ AMRWB_LIBS="$ac_sox_save_AMRWB_LIBS"
+ dnl Force to using regardless if headers or libraries were found.
+ tmp_using_amrwb=yes
+else
+ enable_dl_amrwb="no"
+fi
+AC_OPTIONAL_FORMAT(amrwb, AMRWB, [using_amrwb=$tmp_using_amrwb])
+
+dnl When enable_dl_amrnb, do not let add libraries to be linked in
+dnl since they will be dlopen()'ed instead.
+ac_sox_save_AMRNB_LIBS="$AMRNB_LIBS"
+tmp_using_amrnb=$opt_default
+AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h,
+ [AC_CHECK_LIB(opencore-amrnb, Decoder_Interface_init,
+ AMRNB_LIBS="$AMRNB_LIBS -lopencore-amrnb", tmp_using_amrnb=no)],
+ [AC_CHECK_HEADER(amrnb/sp_dec.h,
+ [AC_CHECK_LIB(amrnb, Decoder_Interface_init,
+ AMRNB_LIBS="$AMRNB_LIBS -lamrnb", tmp_using_amrnb=no)],
+ tmp_using_amrnb=no)])
+AC_ARG_ENABLE(dl_amrnb,
+ AS_HELP_STRING([--enable-dl-amrnb],
+ [Dlopen amrnb instead of linking in.]),
+ enable_dl_amrnb=$enableval, enable_dl_amrnb=no)
+if test "x$using_libltdl" = "xyes" -a "x$enable_dl_amrnb" = "xyes"; then
+ AC_DEFINE(DL_AMRNB, 1, [Define to dlopen() amrnb.])
+ dnl When enable_dl_amrnb, do not let SOX_PATH_AMRNB add libraries
+ dnl to be linked in (since they will be dlopen()'ed instead).
+ AMRNB_LIBS="$ac_sox_save_AMRNB_LIBS"
+ dnl Force to using regardless if headers or libraries were found.
+ tmp_using_amrnb=yes
+else
+ enable_dl_amrnb="no"
+fi
+AC_OPTIONAL_FORMAT(amrnb, AMRNB, [using_amrnb=$tmp_using_amrnb])
+
+
+AC_OPTIONAL_FORMAT(wavpack, WAVPACK, [AC_CHECK_HEADER(wavpack/wavpack.h, [AC_CHECK_LIB(wavpack, WavpackGetSampleRate, WAVPACK_LIBS="$WAVPACK_LIBS -lwavpack",using_wavpack=no)], using_wavpack=no)])
+
+
+
+AC_OPTIONAL_FORMAT(sndio, SNDIO, [AC_CHECK_HEADER(sndio.h, [AC_CHECK_LIB(sndio, sio_open, SNDIO_LIBS="$SNDIO_LIBS -lsndio",using_sndio=no)], using_sndio=no)])
+
+
+
+AC_OPTIONAL_FORMAT(coreaudio, COREAUDIO, [AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [COREAUDIO_LIBS="$COREAUDIO_LIBS -Wl,-framework,CoreAudio"], using_coreaudio=no)])
+
+
+
+AC_OPTIONAL_FORMAT(alsa, ALSA, [AC_CHECK_HEADER(alsa/asoundlib.h, [AC_CHECK_LIB(asound, snd_pcm_open, ALSA_LIBS="$ALSA_LIBS -lasound",using_alsa=no)], using_alsa=no)])
+
+
+
+AC_OPTIONAL_FORMAT(ao, AO, [AC_CHECK_HEADER(ao/ao.h, [AC_CHECK_LIB(ao, ao_play, AO_LIBS="$AO_LIBS -lao",using_ao=no)], using_ao=no)])
+
+
+
+AC_OPTIONAL_FORMAT(pulseaudio, PULSEAUDIO, [AC_CHECK_HEADER(pulse/simple.h, [AC_CHECK_LIB(pulse, pa_simple_new, PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS -lpulse -lpulse-simple",using_pulseaudio=no,"-lpulse-simple")], using_pulseaudio=no)])
+
+
+AC_OPTIONAL_FORMAT(waveaudio, WAVEAUDIO, [AC_CHECK_HEADER(mmsystem.h, [WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"], using_waveaudio=no, [[#include <windows.h>]])])
+
+dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
+dnl to be linked in (since they will be dlopen()'ed instead).
+ac_sox_save_SNDFILE_LIBS="$SNDFILE_LIBS"
+SOX_PATH_SNDFILE(tmp_using_sndfile=$opt_default, tmp_using_sndfile=no)
+AC_ARG_ENABLE(dl_sndfile,
+ AS_HELP_STRING([--enable-dl-sndfile],
+ [Dlopen sndfile instead of linking in.]),
+ enable_dl_sndfile=$enableval, enable_dl_sndfile=no)
+if test "x$using_sndfile" = "xyes"; then
+ if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
+ AC_DEFINE(DL_SNDFILE, 1, [Define to dlopen() sndfile.])
+ dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
+ dnl to be linked in (since they will be dlopen()'ed instead).
+ SNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
+ else
+ enable_dl_sndfile="no"
+ fi
+fi
+AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [using_sndfile=$tmp_using_sndfile])
+
+
+
+AC_OPTIONAL_FORMAT(oss, OSS, [AC_CHECK_HEADERS(sys/soundcard.h,,
+ [AC_CHECK_HEADERS(machine/soundcard.h,
+ [AC_CHECK_LIB(ossaudio, _oss_ioctl, OSS_LIBS="$OSS_LIBS -lossaudio")],
+ using_oss=no)])])
+
+
+
+AC_OPTIONAL_FORMAT(sunaudio, SUN_AUDIO, [AC_CHECK_HEADERS(sys/audioio.h,,
+ [AC_CHECK_HEADERS(sun/audioio.h,, using_sunaudio=no)])])
+
+
+
+# MP2/MP3 format depends on libmad || LAME || twolame
+AC_OPTIONAL_FORMAT(mp3, MP3, [
+ if test "$using_mad" != yes -a "$using_lame" != yes -a "$using_twolame" != yes; then
+ using_mp3=no
+ fi])
+
+
+
+# GSM format depends on libgsm
+# No need to check; GSM is always found
+AC_OPTIONAL_FORMAT(gsm, GSM)
+
+
+
+# LPC10 format depends on liblpc10
+# No need to check; LPC10 is always found
+AC_OPTIONAL_FORMAT(lpc10, LPC10)
+
+
+
+dnl Check if we want to disable all symlinks
+AC_MSG_CHECKING([whether to enable symlinks])
+AC_ARG_ENABLE(symlinks,
+ AS_HELP_STRING([--disable-symlinks], [Don't make any symlinks to sox.]),,enable_symlinks=yes)
+AC_MSG_RESULT($enable_symlinks)
+
+enable_playrec_symlinks=no
+if test "$enable_symlinks" = "yes"; then
+ SYMLINKS=yes
+ if test false \
+ -o "$enable_alsa" = yes \
+ -o "$enable_ao" = yes \
+ -o "$enable_coreaudio" = yes \
+ -o "$enable_oss" = yes \
+ -o "$enable_pulseaudio" = yes \
+ -o "$enable_sndio" = yes \
+ ; then
+ PLAYRECLINKS=yes
+ enable_playrec_symlinks=yes
+ fi
+fi
+AC_SUBST(SYMLINKS)
+AC_SUBST(PLAYRECLINKS)
+
+AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
+
+dnl Generate output files.
+AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile lpc10/Makefile msvc9/Makefile msvc10/Makefile sox.pc)
+AC_OUTPUT
+
+if test "$using_gsm" != "no"; then
+ if test "$found_libgsm" = "yes"; then
+ gsm_option="(external)"
+ else
+ gsm_option="(in-tree)"
+ fi
+fi
+
+if test "$using_lpc10" != "no"; then
+ if test "$found_liblpc10" = "yes"; then
+ lpc10_option="(external)"
+ else
+ lpc10_option="(in-tree)"
+ fi
+fi
+
+if test "$using_pkgconfig" = "no"; then
+ pkgconfig_option="disabled"
+else
+ pkgconfig_option="$with_pkgconfigdir"
+fi
+
+# Report configuration.
+echo
+echo "BUILD OPTIONS"
+echo "Debugging build............$enable_debug"
+echo "Distro name ...............$DISTRO"
+echo "Dynamic loading support....$using_libltdl"
+echo "Pkg-config location........$pkgconfig_option"
+echo "Play and rec symlinks......$enable_playrec_symlinks"
+echo "Symlinks enabled...........$enable_symlinks"
+echo
+echo "OPTIONAL DEVICE DRIVERS"
+echo "ao (Xiph)..................$using_ao"
+echo "alsa (Linux)...............$using_alsa"
+echo "coreaudio (Mac OS X).......$using_coreaudio"
+echo "sndio (OpenBSD)............$using_sndio"
+echo "oss........................$using_oss"
+echo "pulseaudio.................$using_pulseaudio"
+echo "sunaudio...................$using_sunaudio"
+echo "waveaudio (MS-Windows).....$using_waveaudio"
+echo
+echo "OPTIONAL FILE FORMATS"
+echo "amrnb......................$using_amrnb"
+if test "x$using_amrnb" = "xyes"; then
+echo " dlopen amrnb..............$enable_dl_amrnb"
+fi
+echo "amrwb......................$using_amrwb"
+if test "x$using_amrwb" = "xyes"; then
+echo " dlopen amrwb..............$enable_dl_amrwb"
+fi
+echo "flac.......................$using_flac"
+echo "gsm........................$using_gsm $gsm_option"
+echo "lpc10......................$using_lpc10 $lpc10_option"
+echo "mp2/mp3....................$using_mp3"
+echo " id3tag....................$using_id3tag"
+echo " lame......................$using_lame"
+if test "x$using_lame" = "xyes"; then
+if test "x$enable_dl_lame" != "xyes"; then
+echo " lame id3tag...............$ac_cv_lib_mp3lame_id3tag_set_fieldvalue"
+fi
+echo " dlopen lame...............$enable_dl_lame"
+fi
+echo " mad.......................$using_mad"
+if test "x$using_mad" = "xyes"; then
+echo " dlopen mad................$enable_dl_mad"
+fi
+echo " twolame...................$using_twolame"
+if test "x$using_twolame" = "xyes"; then
+echo " dlopen twolame............$enable_dl_twolame"
+fi
+echo "oggvorbis..................$using_oggvorbis"
+echo "opus.......................$using_opus"
+echo "sndfile....................$using_sndfile"
+if test "x$using_sndfile" = "xyes"; then
+echo " dlopen sndfile............$enable_dl_sndfile"
+fi
+echo "wavpack....................$using_wavpack"
+echo
+echo "OTHER OPTIONS"
+echo "ladspa effects.............$using_ladspa"
+echo "magic support..............$using_magic"
+echo "png support................$using_png"
+if test "x$OPENMP_CFLAGS" = "x"; then
+echo "OpenMP support.............no"
+else
+echo "OpenMP support.............yes, $OPENMP_CFLAGS"
+fi
+echo
+echo "Configure finished. Do 'make -s && make install' to compile and install SoX."
+echo
diff --git a/src/cygbuild b/src/cygbuild
new file mode 100755
index 0000000..4fc602b
--- /dev/null
+++ b/src/cygbuild
@@ -0,0 +1,123 @@
+#!/bin/sh
+#
+# This script will automates the steps used to producing a static win32
+# package of SoX.
+#
+# It requires cygwin with gcc and zip packages installed. Also, it
+# requires to already have several external libraries already installed
+# under /usr/local.
+#
+# And last, it will optional package a wget compiled with VC++ instead
+# of cygwin version (which has no DLL's to distribute) if found
+# in wget-1.11.4 directory. If not found, it will distribute the
+# cygwin version and various DLL's it requires.
+#
+# Various notes:
+#
+# Script makes use of "-static" option to tell compiler to prefer static
+# external libraries so that we do not need to distribute DLL's.
+#
+# Libtool will get confused with this flag for external libraries
+# that have a libtool lib*.la file and support shared libraries as
+# well as static libraries (but usually only if that library
+# further depends on other external libraries with lib*.la files).
+# Libtool may ignore -static option or it may link first external
+# library as static but other dependent libraries as shared (usually
+# because it follows $dependency_libs and that ignores -static option).
+#
+# Work arounds include to only install static libraries, delete the lib*.la
+# file, or edit the lib*.la file and set dlnames and library_names variables
+# to empty string ("").
+#
+# The following command lines were used to generate the static external
+# libraries SoX ships with.
+#
+# libpng.la will have libtool issue because depends on libz
+# which has a libz.la file. Must edit libpng.la to
+# prevent needing to distribute cygzlib1.dll.
+# cd libpng-1.2.41
+# ./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../wavpack-4.60.1
+# ./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../flac-1.2.1
+# ./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../libogg-1.1.3
+# ./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../libvorbis-1.2.0
+# ./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../libsndfile-1.0.20
+# ./configure --disable-shared --enable-static;make;sudo make install
+#
+# cd ../libid3tag-0.15.1b
+# ./configure --disable-shared --enable-static;make;sudo make install
+#
+# To get MP3 header files used to enable MP3 support (no libraries used):
+#
+# cd ../libmad
+# ./configure --enable-shared --disable-static;make;sudo make install
+
+[ ! -x configure ] && autoreconf -i
+
+# Some versions of autoconf (2.63?) seem to get easily confused about
+# CPP variable. If you see warning messages about header files
+# rejected by preprocessor then its most likely from that.
+# Force the value of CPP=cpp works around that bug.
+# static versions of libsndfile do not advertise when they have
+# FLAC or ogg vorbis support. Need to force the link ourselves.
+if [ $# -ne 0 -o ! -r Makefile ]; then
+ ./configure \
+ --disable-shared \
+ --with-libltdl \
+ --enable-dl-lame --enable-dl-mad --enable-dl-amrnb --enable-dl-amrwb \
+ CC=gcc CPP=cpp\
+ CPPFLAGS=-I/usr/local/include \
+ LDFLAGS="-L/usr/local/lib" \
+ SNDFILE_LIBS="-lsndfile -lFLAC -lvorbisenc -lvorbisfile -lvorbis -logg" \
+ $*
+fi
+
+make -s all pdf txt || exit 1
+
+dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2`
+rm -rf $dir $dir-cygwin32.zip
+mkdir -p $dir
+
+for f in ChangeLog LICENSE.GPL README README.win32; do
+ cp -p $f $dir/$f.txt
+ unix2dos $dir/$f.txt
+done
+
+binaries=src/sox
+
+[ ! -r "../wget-1.11.4/wget.exe" -a -r /usr/bin/wget ] && binaries+=" /usr/bin/wget"
+
+binaries=$(for f in `cygcheck $binaries|dos2unix`
+ do cygpath -u $f; done|sort|uniq|grep -v ^/cygdrive/)
+
+cp -p \
+ $binaries \
+ sox.pdf \
+ soxformat.pdf \
+ soxi.pdf \
+ scripts/batch-example.bat \
+ $dir
+
+unix2dos $dir/batch-example.bat
+
+if test -r "../wget-1.11.4/wget.exe"; then
+ cp ../wget-1.11.4/wget.exe $dir
+ cp ../wget-1.11.4/wget.ini $dir
+else
+ if test -r /usr/bin/wget -a -r /etc/wgetrc; then
+ cp -p /etc/wgetrc $dir/wget.ini
+ chmod +r $dir/wget.ini
+ fi
+fi
+
+zip -r $dir-cygwin32.zip $dir
+rm -rf $dir
diff --git a/src/depcomp b/src/depcomp
new file mode 100755
index 0000000..4ebd5b3
--- /dev/null
+++ b/src/depcomp
@@ -0,0 +1,791 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2013-05-30.07; # UTC
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+
+# 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, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputting dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'. Note that this directory component will
+# be either empty or ending with a '/' character. This is deliberate.
+set_dir_from ()
+{
+ case $1 in
+ */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+ *) dir=;;
+ esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+ base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+ echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+ # If the compiler actually managed to produce a dependency file,
+ # post-process it.
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependency.h'.
+ # Do two passes, one to just change these to
+ # $object: dependency.h
+ # and one to simply output
+ # dependency.h:
+ # which is needed to avoid the deleted-header problem.
+ { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+ } > "$depfile"
+ rm -f "$tmpdepfile"
+ else
+ make_dummy_depfile
+ fi
+}
+
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say). Also, it might not be
+## supported by the other compilers which use the 'gcc' depmode.
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The second -e expression handles DOS-style file names with drive
+ # letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+## Some versions of gcc put a space before the ':'. On the theory
+## that the space means something, we add a space to the output as
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like '#:fec' to the end of the
+ # dependency line.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+ | tr "$nl" ' ' >> "$depfile"
+ echo >> "$depfile"
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ make_dummy_depfile
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts '$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ set_dir_from "$object"
+ set_base_from "$object"
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ aix_post_process_depfile
+ ;;
+
+tcc)
+ # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+ # FIXME: That version still under development at the moment of writing.
+ # Make that this statement remains true also for stable, released
+ # versions.
+ # It will wrap lines (doesn't matter whether long or short) with a
+ # trailing '\', as in:
+ #
+ # foo.o : \
+ # foo.c \
+ # foo.h \
+ #
+ # It will put a trailing '\' even on the last line, and will use leading
+ # spaces rather than leading tabs (at least since its commit 0394caf7
+ # "Emit spaces for -MD").
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+ # We have to change lines of the first kind to '$object: \'.
+ sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+ # And for each line of the second kind, we have to emit a 'dep.h:'
+ # dummy dependency, to avoid the deleted-header problem.
+ sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file. A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+ # Portland's C compiler understands '-MD'.
+ # Will always output deps to 'file.d' where file is the root name of the
+ # source file under compilation, even if file resides in a subdirectory.
+ # The object file name does not affect the name of the '.d' file.
+ # pgcc 10.2 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using '\' :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+ set_dir_from "$object"
+ # Use the source, not the object, to determine the base name, since
+ # that's sadly what pgcc will do too.
+ set_base_from "$source"
+ tmpdepfile=$base.d
+
+ # For projects that build the same source file twice into different object
+ # files, the pgcc approach of using the *source* file root name can cause
+ # problems in parallel builds. Use a locking strategy to avoid stomping on
+ # the same $tmpdepfile.
+ lockdir=$base.d-lock
+ trap "
+ echo '$0: caught signal, cleaning up...' >&2
+ rmdir '$lockdir'
+ exit 1
+ " 1 2 13 15
+ numtries=100
+ i=$numtries
+ while test $i -gt 0; do
+ # mkdir is a portable test-and-set.
+ if mkdir "$lockdir" 2>/dev/null; then
+ # This process acquired the lock.
+ "$@" -MD
+ stat=$?
+ # Release the lock.
+ rmdir "$lockdir"
+ break
+ else
+ # If the lock is being held by a different process, wait
+ # until the winning process is done or we timeout.
+ while test -d "$lockdir" && test $i -gt 0; do
+ sleep 1
+ i=`expr $i - 1`
+ done
+ fi
+ i=`expr $i - 1`
+ done
+ trap - 1 2 13 15
+ if test $i -le 0; then
+ echo "$0: failed to acquire lock after $numtries attempts" >&2
+ echo "$0: check lockdir '$lockdir'" >&2
+ exit 1
+ fi
+
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ set_dir_from "$object"
+ set_base_from "$object"
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add 'dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ make_dummy_depfile
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ set_dir_from "$object"
+ set_base_from "$object"
+
+ if test "$libtool" = yes; then
+ # Libtool generates 2 separate objects for the 2 libraries. These
+ # two compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir$base.o.d # libtool 1.5
+ tmpdepfile2=$dir.libs/$base.o.d # Likewise.
+ tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ # Same post-processing that is required for AIX mode.
+ aix_post_process_depfile
+ ;;
+
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/'"$tab"'/
+ G
+ p
+}' >> "$depfile"
+ echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for ':'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+ "$@" $dashmflag |
+ sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this sed invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process the last invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed '1,2d' "$tmpdepfile" \
+ | tr ' ' "$nl" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E \
+ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ | sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/src/google-sox-14.4.2.c b/src/google-sox-14.4.2.c
new file mode 100644
index 0000000..7152b4f
--- /dev/null
+++ b/src/google-sox-14.4.2.c
@@ -0,0 +1,19 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// File automatically generated for library 'sox'.
+
+// Function that allows to check the version of the library.
+const char* google_sox() {
+ return "14.4.2";
+}
diff --git a/src/google-sox-presence_test.cc b/src/google-sox-presence_test.cc
new file mode 100644
index 0000000..fcfa07d
--- /dev/null
+++ b/src/google-sox-presence_test.cc
@@ -0,0 +1,24 @@
+// Copyright 2019 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Tests sox-14.4.2 presence and version
+
+#include "base/logging.h"
+#include "testing/base/public/gunit.h"
+
+extern "C" const char* google_sox();
+
+TEST(Sox, Presence) {
+ ASSERT_EQ(string("14.4.2"), google_sox());
+}
diff --git a/src/install-sh b/src/install-sh
new file mode 100755
index 0000000..377bb86
--- /dev/null
+++ b/src/install-sh
@@ -0,0 +1,527 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-11-20.07; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/src/libgsm/CMakeLists.txt b/src/libgsm/CMakeLists.txt
new file mode 100644
index 0000000..3422285
--- /dev/null
+++ b/src/libgsm/CMakeLists.txt
@@ -0,0 +1 @@
+add_library(gsm add code decode gsm_create gsm_decode gsm_destroy gsm_encode gsm_option long_term lpc preprocess rpe short_term table)
diff --git a/src/libgsm/Makefile.am b/src/libgsm/Makefile.am
new file mode 100644
index 0000000..7f7e176
--- /dev/null
+++ b/src/libgsm/Makefile.am
@@ -0,0 +1,41 @@
+SASR = -DSASR
+######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
+
+MULHACK = -DUSE_FLOAT_MUL
+######### Define this if your host multiplies floats faster than integers,
+######### e.g. on a SPARCstation.
+
+FAST = -DFAST
+######### Define together with USE_FLOAT_MUL to enable the GSM library's
+######### approximation option for incorrect, but good-enough results.
+
+# LTP_CUT = -DLTP_CUT
+LTP_CUT =
+######### Define to enable the GSM library's long-term correlation
+######### approximation option---faster, but worse; works for
+######### both integer and floating point multiplications.
+######### This flag is still in the experimental stage.
+
+WAV49 = -DWAV49
+#WAV49 =
+######### Define to enable the GSM library's option to pack GSM frames
+######### in the style used by the WAV #49 format. If you want to write
+######### a tool that produces .WAV files which contain GSM-encoded data,
+######### define this, and read about the GSM_OPT_WAV49 option in the
+######### manual page on gsm_option(3).
+
+AM_CFLAGS = $(SASR) $(MULHAC) $(FAST) $(LTP_CUT) $(WAV49)
+
+if EXTERNAL_GSM
+EXTRA_DIST = add.c code.c decode.c long_term.c lpc.c preprocess.c \
+ rpe.c gsm_destroy.c gsm_decode.c gsm_encode.c gsm_create.c \
+ gsm_option.c short_term.c table.c private.h gsm.h CMakeLists.txt \
+ aliases.h
+else
+noinst_LTLIBRARIES = libgsm.la
+noinst_HEADERS = gsm.h
+libgsm_la_SOURCES = add.c code.c decode.c long_term.c lpc.c preprocess.c \
+ rpe.c gsm_destroy.c gsm_decode.c gsm_encode.c gsm_create.c \
+ gsm_option.c short_term.c table.c private.h aliases.h
+EXTRA_DIST = CMakeLists.txt
+endif
diff --git a/src/libgsm/Makefile.in b/src/libgsm/Makefile.in
new file mode 100644
index 0000000..356eb9f
--- /dev/null
+++ b/src/libgsm/Makefile.in
@@ -0,0 +1,692 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = libgsm
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/depcomp $(am__noinst_HEADERS_DIST)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gcc_stack_protect.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/optional-fmt.m4 $(top_srcdir)/m4/sndfile.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/soxconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libgsm_la_LIBADD =
+am__libgsm_la_SOURCES_DIST = add.c code.c decode.c long_term.c lpc.c \
+ preprocess.c rpe.c gsm_destroy.c gsm_decode.c gsm_encode.c \
+ gsm_create.c gsm_option.c short_term.c table.c private.h \
+ aliases.h
+@EXTERNAL_GSM_FALSE@am_libgsm_la_OBJECTS = add.lo code.lo decode.lo \
+@EXTERNAL_GSM_FALSE@ long_term.lo lpc.lo preprocess.lo rpe.lo \
+@EXTERNAL_GSM_FALSE@ gsm_destroy.lo gsm_decode.lo gsm_encode.lo \
+@EXTERNAL_GSM_FALSE@ gsm_create.lo gsm_option.lo short_term.lo \
+@EXTERNAL_GSM_FALSE@ table.lo
+libgsm_la_OBJECTS = $(am_libgsm_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+@EXTERNAL_GSM_FALSE@am_libgsm_la_rpath =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libgsm_la_SOURCES)
+DIST_SOURCES = $(am__libgsm_la_SOURCES_DIST)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__noinst_HEADERS_DIST = gsm.h
+HEADERS = $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMRNB_CFLAGS = @AMRNB_CFLAGS@
+AMRNB_LIBS = @AMRNB_LIBS@
+AMRWB_CFLAGS = @AMRWB_CFLAGS@
+AMRWB_LIBS = @AMRWB_LIBS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AO_CFLAGS = @AO_CFLAGS@
+AO_LIBS = @AO_LIBS@
+APP_LDFLAGS = @APP_LDFLAGS@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COREAUDIO_CFLAGS = @COREAUDIO_CFLAGS@
+COREAUDIO_LIBS = @COREAUDIO_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTRO = @DISTRO@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLAC_CFLAGS = @FLAC_CFLAGS@
+FLAC_LIBS = @FLAC_LIBS@
+GOMP_LIBS = @GOMP_LIBS@
+GREP = @GREP@
+GSM_CFLAGS = @GSM_CFLAGS@
+GSM_LIBS = @GSM_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LADSPA_PATH = @LADSPA_PATH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGSM_LIBADD = @LIBGSM_LIBADD@
+LIBLPC10_LIBADD = @LIBLPC10_LIBADD@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOLFLAGS = @LIBTOOLFLAGS@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LPC10_CFLAGS = @LPC10_CFLAGS@
+LPC10_LIBS = @LPC10_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAGIC_LIBS = @MAGIC_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MP3_CFLAGS = @MP3_CFLAGS@
+MP3_LIBS = @MP3_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OGG_VORBIS_CFLAGS = @OGG_VORBIS_CFLAGS@
+OGG_VORBIS_LIBS = @OGG_VORBIS_LIBS@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OPUS_CFLAGS = @OPUS_CFLAGS@
+OPUS_LIBS = @OPUS_LIBS@
+OSS_CFLAGS = @OSS_CFLAGS@
+OSS_LIBS = @OSS_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKGCONFIGDIR = @PKGCONFIGDIR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLAYRECLINKS = @PLAYRECLINKS@
+PNG_LIBS = @PNG_LIBS@
+PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
+PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHLIB_VERSION = @SHLIB_VERSION@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+SNDIO_CFLAGS = @SNDIO_CFLAGS@
+SNDIO_LIBS = @SNDIO_LIBS@
+STRIP = @STRIP@
+SUN_AUDIO_CFLAGS = @SUN_AUDIO_CFLAGS@
+SUN_AUDIO_LIBS = @SUN_AUDIO_LIBS@
+SYMLINKS = @SYMLINKS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WAVEAUDIO_CFLAGS = @WAVEAUDIO_CFLAGS@
+WAVEAUDIO_LIBS = @WAVEAUDIO_LIBS@
+WAVPACK_CFLAGS = @WAVPACK_CFLAGS@
+WAVPACK_LIBS = @WAVPACK_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SASR = -DSASR
+######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
+MULHACK = -DUSE_FLOAT_MUL
+######### Define this if your host multiplies floats faster than integers,
+######### e.g. on a SPARCstation.
+FAST = -DFAST
+######### Define together with USE_FLOAT_MUL to enable the GSM library's
+######### approximation option for incorrect, but good-enough results.
+
+# LTP_CUT = -DLTP_CUT
+LTP_CUT =
+######### Define to enable the GSM library's long-term correlation
+######### approximation option---faster, but worse; works for
+######### both integer and floating point multiplications.
+######### This flag is still in the experimental stage.
+WAV49 = -DWAV49
+#WAV49 =
+######### Define to enable the GSM library's option to pack GSM frames
+######### in the style used by the WAV #49 format. If you want to write
+######### a tool that produces .WAV files which contain GSM-encoded data,
+######### define this, and read about the GSM_OPT_WAV49 option in the
+######### manual page on gsm_option(3).
+AM_CFLAGS = $(SASR) $(MULHAC) $(FAST) $(LTP_CUT) $(WAV49)
+@EXTERNAL_GSM_FALSE@EXTRA_DIST = CMakeLists.txt
+@EXTERNAL_GSM_TRUE@EXTRA_DIST = add.c code.c decode.c long_term.c lpc.c preprocess.c \
+@EXTERNAL_GSM_TRUE@ rpe.c gsm_destroy.c gsm_decode.c gsm_encode.c gsm_create.c \
+@EXTERNAL_GSM_TRUE@ gsm_option.c short_term.c table.c private.h gsm.h CMakeLists.txt \
+@EXTERNAL_GSM_TRUE@ aliases.h
+
+@EXTERNAL_GSM_FALSE@noinst_LTLIBRARIES = libgsm.la
+@EXTERNAL_GSM_FALSE@noinst_HEADERS = gsm.h
+@EXTERNAL_GSM_FALSE@libgsm_la_SOURCES = add.c code.c decode.c long_term.c lpc.c preprocess.c \
+@EXTERNAL_GSM_FALSE@ rpe.c gsm_destroy.c gsm_decode.c gsm_encode.c gsm_create.c \
+@EXTERNAL_GSM_FALSE@ gsm_option.c short_term.c table.c private.h aliases.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libgsm/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libgsm/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libgsm.la: $(libgsm_la_OBJECTS) $(libgsm_la_DEPENDENCIES) $(EXTRA_libgsm_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libgsm_la_rpath) $(libgsm_la_OBJECTS) $(libgsm_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/code.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_create.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_decode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_destroy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_encode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_option.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_term.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preprocess.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpe.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/short_term.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
+ ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/libgsm/add.c b/src/libgsm/add.c
new file mode 100644
index 0000000..20691cf
--- /dev/null
+++ b/src/libgsm/add.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/add.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $ */
+
+/*
+ * See private.h for the more commonly used macro versions.
+ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+#include "third_party/sox/src/libgsm/gsm.h"
+
+#define saturate(x) \
+ ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
+
+word gsm_add (word a, word b)
+{
+ longword sum = (longword)a + (longword)b;
+ return saturate(sum);
+}
+
+word gsm_sub (word a, word b)
+{
+ longword diff = (longword)a - (longword)b;
+ return saturate(diff);
+}
+
+word gsm_mult (word a, word b)
+{
+ if (a == MIN_WORD && b == MIN_WORD) return MAX_WORD;
+ else return SASR( (longword)a * (longword)b, 15 );
+}
+
+word gsm_mult_r (word a, word b)
+{
+ if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD;
+ else {
+ longword prod = (longword)a * (longword)b + 16384;
+ prod >>= 15;
+ return prod & 0xFFFF;
+ }
+}
+
+word gsm_abs (word a)
+{
+ return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a;
+}
+
+longword gsm_L_mult (word a, word b)
+{
+ assert( a != MIN_WORD || b != MIN_WORD );
+ return ((longword)a * (longword)b) << 1;
+}
+
+longword gsm_L_add (longword a, longword b)
+{
+ if (a < 0) {
+ if (b >= 0) return a + b;
+ else {
+ ulongword A = (ulongword)-(a + 1) + (ulongword)-(b + 1);
+ return A >= MAX_LONGWORD ? MIN_LONGWORD :-(longword)A-2;
+ }
+ }
+ else if (b <= 0) return a + b;
+ else {
+ ulongword A = (ulongword)a + (ulongword)b;
+ return A > MAX_LONGWORD ? MAX_LONGWORD : A;
+ }
+}
+
+longword gsm_L_sub (longword a, longword b)
+{
+ if (a >= 0) {
+ if (b >= 0) return a - b;
+ else {
+ /* a>=0, b<0 */
+
+ ulongword A = (ulongword)a + -(b + 1);
+ return A >= MAX_LONGWORD ? MAX_LONGWORD : (A + 1);
+ }
+ }
+ else if (b <= 0) return a - b;
+ else {
+ /* a<0, b>0 */
+
+ ulongword A = (ulongword)-(a + 1) + b;
+ return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1;
+ }
+}
+
+static unsigned char const bitoff[ 256 ] = {
+ 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+word gsm_norm (longword a )
+/*
+ * the number of left shifts needed to normalize the 32 bit
+ * variable L_var1 for positive values on the interval
+ *
+ * with minimum of
+ * minimum of 1073741824 (01000000000000000000000000000000) and
+ * maximum of 2147483647 (01111111111111111111111111111111)
+ *
+ *
+ * and for negative values on the interval with
+ * minimum of -2147483648 (-10000000000000000000000000000000) and
+ * maximum of -1073741824 ( -1000000000000000000000000000000).
+ *
+ * in order to normalize the result, the following
+ * operation must be done: L_norm_var1 = L_var1 << norm( L_var1 );
+ *
+ * (That's 'ffs', only from the left, not the right..)
+ */
+{
+ assert(a != 0);
+
+ if (a < 0) {
+ if (a <= -1073741824) return 0;
+ a = ~a;
+ }
+
+ return a & 0xffff0000
+ ? ( a & 0xff000000
+ ? -1 + bitoff[ 0xFF & (a >> 24) ]
+ : 7 + bitoff[ 0xFF & (a >> 16) ] )
+ : ( a & 0xff00
+ ? 15 + bitoff[ 0xFF & (a >> 8) ]
+ : 23 + bitoff[ 0xFF & a ] );
+}
+
+longword gsm_L_asl (longword a, int n)
+{
+ if (n >= 32) return 0;
+ if (n <= -32) return -(a < 0);
+ if (n < 0) return gsm_L_asr(a, -n);
+ return a << n;
+}
+
+word gsm_asl (word a, int n)
+{
+ if (n >= 16) return 0;
+ if (n <= -16) return -(a < 0);
+ if (n < 0) return gsm_asr(a, -n);
+ return a << n;
+}
+
+longword gsm_L_asr (longword a, int n)
+{
+ if (n >= 32) return -(a < 0);
+ if (n <= -32) return 0;
+ if (n < 0) return a << -n;
+
+# ifdef SASR
+ return a >> n;
+# else
+ if (a >= 0) return a >> n;
+ else return -(longword)( -(ulongword)a >> n );
+# endif
+}
+
+word gsm_asr (word a, int n)
+{
+ if (n >= 16) return -(a < 0);
+ if (n <= -16) return 0;
+ if (n < 0) return a << -n;
+
+# ifdef SASR
+ return a >> n;
+# else
+ if (a >= 0) return a >> n;
+ else return -(word)( -(uword)a >> n );
+# endif
+}
+
+/*
+ * (From p. 46, end of section 4.2.5)
+ *
+ * NOTE: The following lines gives [sic] one correct implementation
+ * of the div(num, denum) arithmetic operation. Compute div
+ * which is the integer division of num by denum: with denum
+ * >= num > 0
+ */
+
+word gsm_div (word num, word denum)
+{
+ longword L_num = num;
+ longword L_denum = denum;
+ word div = 0;
+ int k = 15;
+
+ /* The parameter num sometimes becomes zero.
+ * Although this is explicitly guarded against in 4.2.5,
+ * we assume that the result should then be zero as well.
+ */
+
+ /* assert(num != 0); */
+
+ assert(num >= 0 && denum >= num);
+ if (num == 0)
+ return 0;
+
+ while (k--) {
+ div <<= 1;
+ L_num <<= 1;
+
+ if (L_num >= L_denum) {
+ L_num -= L_denum;
+ div++;
+ }
+ }
+
+ return div;
+}
diff --git a/src/libgsm/aliases.h b/src/libgsm/aliases.h
new file mode 100644
index 0000000..c768c75
--- /dev/null
+++ b/src/libgsm/aliases.h
@@ -0,0 +1,40 @@
+#define gsm_add lsx_gsm_add
+#define gsm_sub lsx_gsm_sub
+#define gsm_mult lsx_gsm_mult
+#define gsm_mult_r lsx_gsm_mult_r
+#define gsm_abs lsx_gsm_abs
+#define gsm_L_mult lsx_gsm_L_mult
+#define gsm_L_add lsx_gsm_L_add
+#define gsm_L_sub lsx_gsm_L_sub
+#define gsm_norm lsx_gsm_norm
+#define gsm_L_asl lsx_gsm_L_asl
+#define gsm_L_asr lsx_gsm_L_asr
+#define gsm_asl lsx_gsm_asl
+#define gsm_asr lsx_gsm_asr
+#define gsm_div lsx_gsm_div
+#define Gsm_Coder lsx_Gsm_Coder
+#define Gsm_Decoder lsx_Gsm_Decoder
+#define gsm_create lsx_gsm_create
+#define gsm_decode lsx_gsm_decode
+#define gsm_destroy lsx_gsm_destroy
+#define gsm_encode lsx_gsm_encode
+#define gsm_option lsx_gsm_option
+#define Gsm_Long_Term_Predictor lsx_Gsm_Long_Term_Predictor
+#define Gsm_Long_Term_Synthesis_Filtering lsx_Gsm_Long_Term_Synthesis_Filtering
+#define Gsm_LPC_Analysis lsx_Gsm_LPC_Analysis
+#define Gsm_Preprocess lsx_Gsm_Preprocess
+#define Gsm_RPE_Encoding lsx_Gsm_RPE_Encoding
+#define Gsm_RPE_Decoding lsx_Gsm_RPE_Decoding
+#define Gsm_Short_Term_Analysis_Filter lsx_Gsm_Short_Term_Analysis_Filter
+#define Gsm_Short_Term_Synthesis_Filter lsx_Gsm_Short_Term_Synthesis_Filter
+#define gsm_A lsx_gsm_A
+#define gsm_B lsx_gsm_B
+#define gsm_MIC lsx_gsm_MIC
+#define gsm_MAC lsx_gsm_MAC
+#define gsm_INVA lsx_gsm_INVA
+#define gsm_DLB lsx_gsm_DLB
+#define gsm_QLB lsx_gsm_QLB
+#define gsm_H lsx_gsm_H
+#define gsm_NRFAC lsx_gsm_NRFAC
+#define gsm_FAC lsx_gsm_FAC
+
diff --git a/src/libgsm/code.c b/src/libgsm/code.c
new file mode 100644
index 0000000..c1978ae
--- /dev/null
+++ b/src/libgsm/code.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/code.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/*
+ * 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
+ */
+
+void Gsm_Coder (
+
+ struct gsm_state * S,
+
+ word * s, /* [0..159] samples IN */
+
+/*
+ * The RPE-LTD coder works on a frame by frame basis. The length of
+ * the frame is equal to 160 samples. Some computations are done
+ * once per frame to produce at the output of the coder the
+ * LARc[1..8] parameters which are the coded LAR coefficients and
+ * also to realize the inverse filtering operation for the entire
+ * frame (160 samples of signal d[0..159]). These parts produce at
+ * the output of the coder:
+ */
+
+ word * LARc, /* [0..7] LAR coefficients OUT */
+
+/*
+ * Procedure 4.2.11 to 4.2.18 are to be executed four times per
+ * frame. That means once for each sub-segment RPE-LTP analysis of
+ * 40 samples. These parts produce at the output of the coder:
+ */
+
+ word * Nc, /* [0..3] LTP lag OUT */
+ word * bc, /* [0..3] coded LTP gain OUT */
+ word * Mc, /* [0..3] RPE grid selection OUT */
+ word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
+ word * xMc /* [13*4] normalized RPE samples OUT */
+)
+{
+ int k;
+ word * dp = S->dp0 + 120; /* [ -120...-1 ] */
+ word * dpp = dp; /* [ 0...39 ] */
+
+ static word e[50];
+
+ word so[160];
+
+ Gsm_Preprocess (S, s, so);
+ Gsm_LPC_Analysis (S, so, LARc);
+ Gsm_Short_Term_Analysis_Filter (S, LARc, so);
+
+ for (k = 0; k <= 3; k++, xMc += 13) {
+
+ Gsm_Long_Term_Predictor ( S,
+ so+k*40, /* d [0..39] IN */
+ dp, /* dp [-120..-1] IN */
+ e + 5, /* e [0..39] OUT */
+ dpp, /* dpp [0..39] OUT */
+ Nc++,
+ bc++);
+
+ Gsm_RPE_Encoding ( S,
+ e + 5, /* e ][0..39][ IN/OUT */
+ xmaxc++, Mc++, xMc );
+ /*
+ * Gsm_Update_of_reconstructed_short_time_residual_signal
+ * ( dpp, e + 5, dp );
+ */
+
+ { register int i;
+ register longword ltmp;
+ for (i = 0; i <= 39; i++)
+ dp[ i ] = GSM_ADD( e[5 + i], dpp[i] );
+ }
+ dp += 40;
+ dpp += 40;
+
+ }
+ (void)memcpy( (char *)S->dp0, (char *)(S->dp0 + 160),
+ 120 * sizeof(*S->dp0) );
+}
diff --git a/src/libgsm/decode.c b/src/libgsm/decode.c
new file mode 100644
index 0000000..645c2f1
--- /dev/null
+++ b/src/libgsm/decode.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/decode.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $ */
+
+#include <stdio.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/*
+ * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
+ */
+
+static void Postprocessing (
+ struct gsm_state * S,
+ register word * s)
+{
+ register int k;
+ register word msr = S->msr;
+ register longword ltmp; /* for GSM_ADD */
+ register word tmp;
+
+ for (k = 160; k--; s++) {
+ tmp = GSM_MULT_R( msr, 28180 );
+ msr = GSM_ADD(*s, tmp); /* Deemphasis */
+ *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
+ }
+ S->msr = msr;
+}
+
+void Gsm_Decoder (
+ struct gsm_state * S,
+
+ word * LARcr, /* [0..7] IN */
+
+ word * Ncr, /* [0..3] IN */
+ word * bcr, /* [0..3] IN */
+ word * Mcr, /* [0..3] IN */
+ word * xmaxcr, /* [0..3] IN */
+ word * xMcr, /* [0..13*4] IN */
+
+ word * s) /* [0..159] OUT */
+{
+ int j, k;
+ word erp[40], wt[160];
+ word * drp = S->dp0 + 120;
+
+ for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
+
+ Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
+ Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
+
+ for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
+ }
+
+ Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
+ Postprocessing(S, s);
+}
diff --git a/src/libgsm/gsm.h b/src/libgsm/gsm.h
new file mode 100644
index 0000000..037d42b
--- /dev/null
+++ b/src/libgsm/gsm.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/*$Header: /cvsroot/sox/sox/libgsm/gsm.h,v 1.2 2008/03/21 13:34:21 robs Exp $*/
+
+#ifndef GSM_H
+#define GSM_H
+
+#include "third_party/sox/src/libgsm/aliases.h"
+
+#ifdef __cplusplus
+# define NeedFunctionPrototypes 1
+#endif
+
+#if __STDC__
+# define NeedFunctionPrototypes 1
+#endif
+
+#ifdef _NO_PROTO
+# undef NeedFunctionPrototypes
+#endif
+
+#ifdef NeedFunctionPrototypes
+# include <stdio.h> /* for FILE * */
+#endif
+
+#undef GSM_P
+#if NeedFunctionPrototypes
+# define GSM_P( protos ) protos
+#else
+# define GSM_P( protos ) ( /* protos */ )
+#endif
+
+/*
+ * Interface
+ */
+
+typedef struct gsm_state * gsm;
+typedef short gsm_signal; /* signed 16 bit */
+typedef unsigned char gsm_byte;
+typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */
+
+#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */
+
+#define GSM_PATCHLEVEL 10
+#define GSM_MINOR 0
+#define GSM_MAJOR 1
+
+#define GSM_OPT_VERBOSE 1
+#define GSM_OPT_FAST 2
+#define GSM_OPT_LTP_CUT 3
+#define GSM_OPT_WAV49 4
+#define GSM_OPT_FRAME_INDEX 5
+#define GSM_OPT_FRAME_CHAIN 6
+
+extern gsm gsm_create GSM_P((void));
+extern void gsm_destroy GSM_P((gsm));
+
+extern int gsm_option GSM_P((gsm, int, int *));
+
+extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *));
+extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *));
+
+#undef GSM_P
+
+#endif /* GSM_H */
diff --git a/src/libgsm/gsm_create.c b/src/libgsm/gsm_create.c
new file mode 100644
index 0000000..a6d79f3
--- /dev/null
+++ b/src/libgsm/gsm_create.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+static char const ident[] = "$Header: /cvsroot/sox/sox/libgsm/gsm_create.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $";
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "third_party/sox/src/libgsm/gsm.h"
+#include "third_party/sox/src/libgsm/private.h"
+
+gsm gsm_create ()
+{
+ gsm r;
+
+ r = (gsm)malloc(sizeof(struct gsm_state));
+ if (!r) return r;
+
+ memset((char *)r, 0, sizeof(*r));
+ r->nrp = 40;
+
+ return r;
+}
diff --git a/src/libgsm/gsm_decode.c b/src/libgsm/gsm_decode.c
new file mode 100644
index 0000000..a05b091
--- /dev/null
+++ b/src/libgsm/gsm_decode.c
@@ -0,0 +1,360 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/gsm_decode.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $ */
+
+#include "third_party/sox/src/libgsm/private.h"
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+int gsm_decode (gsm s, gsm_byte * c, gsm_signal * target)
+{
+ word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
+
+#ifdef WAV49
+ if (s->wav_fmt) {
+
+ uword sr = 0;
+
+ s->frame_index = !s->frame_index;
+ if (s->frame_index) {
+
+ sr = *c++;
+ LARc[0] = sr & 0x3f; sr >>= 6;
+ sr |= (uword)*c++ << 2;
+ LARc[1] = sr & 0x3f; sr >>= 6;
+ sr |= (uword)*c++ << 4;
+ LARc[2] = sr & 0x1f; sr >>= 5;
+ LARc[3] = sr & 0x1f; sr >>= 5;
+ sr |= (uword)*c++ << 2;
+ LARc[4] = sr & 0xf; sr >>= 4;
+ LARc[5] = sr & 0xf; sr >>= 4;
+ sr |= (uword)*c++ << 2; /* 5 */
+ LARc[6] = sr & 0x7; sr >>= 3;
+ LARc[7] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4;
+ Nc[0] = sr & 0x7f; sr >>= 7;
+ bc[0] = sr & 0x3; sr >>= 2;
+ Mc[0] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[0] = sr & 0x3f; sr >>= 6;
+ xmc[0] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[1] = sr & 0x7; sr >>= 3;
+ xmc[2] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[3] = sr & 0x7; sr >>= 3;
+ xmc[4] = sr & 0x7; sr >>= 3;
+ xmc[5] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1; /* 10 */
+ xmc[6] = sr & 0x7; sr >>= 3;
+ xmc[7] = sr & 0x7; sr >>= 3;
+ xmc[8] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[9] = sr & 0x7; sr >>= 3;
+ xmc[10] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[11] = sr & 0x7; sr >>= 3;
+ xmc[12] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4;
+ Nc[1] = sr & 0x7f; sr >>= 7;
+ bc[1] = sr & 0x3; sr >>= 2;
+ Mc[1] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[1] = sr & 0x3f; sr >>= 6;
+ xmc[13] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 15 */
+ xmc[14] = sr & 0x7; sr >>= 3;
+ xmc[15] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[16] = sr & 0x7; sr >>= 3;
+ xmc[17] = sr & 0x7; sr >>= 3;
+ xmc[18] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[19] = sr & 0x7; sr >>= 3;
+ xmc[20] = sr & 0x7; sr >>= 3;
+ xmc[21] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[22] = sr & 0x7; sr >>= 3;
+ xmc[23] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[24] = sr & 0x7; sr >>= 3;
+ xmc[25] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4; /* 20 */
+ Nc[2] = sr & 0x7f; sr >>= 7;
+ bc[2] = sr & 0x3; sr >>= 2;
+ Mc[2] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[2] = sr & 0x3f; sr >>= 6;
+ xmc[26] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[27] = sr & 0x7; sr >>= 3;
+ xmc[28] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[29] = sr & 0x7; sr >>= 3;
+ xmc[30] = sr & 0x7; sr >>= 3;
+ xmc[31] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[32] = sr & 0x7; sr >>= 3;
+ xmc[33] = sr & 0x7; sr >>= 3;
+ xmc[34] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 25 */
+ xmc[35] = sr & 0x7; sr >>= 3;
+ xmc[36] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[37] = sr & 0x7; sr >>= 3;
+ xmc[38] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 4;
+ Nc[3] = sr & 0x7f; sr >>= 7;
+ bc[3] = sr & 0x3; sr >>= 2;
+ Mc[3] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 1;
+ xmaxc[3] = sr & 0x3f; sr >>= 6;
+ xmc[39] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[40] = sr & 0x7; sr >>= 3;
+ xmc[41] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2; /* 30 */
+ xmc[42] = sr & 0x7; sr >>= 3;
+ xmc[43] = sr & 0x7; sr >>= 3;
+ xmc[44] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[45] = sr & 0x7; sr >>= 3;
+ xmc[46] = sr & 0x7; sr >>= 3;
+ xmc[47] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[48] = sr & 0x7; sr >>= 3;
+ xmc[49] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[50] = sr & 0x7; sr >>= 3;
+ xmc[51] = sr & 0x7; sr >>= 3;
+
+ s->frame_chain = sr & 0xf;
+ }
+ else {
+ sr = s->frame_chain;
+ sr |= (uword)*c++ << 4; /* 1 */
+ LARc[0] = sr & 0x3f; sr >>= 6;
+ LARc[1] = sr & 0x3f; sr >>= 6;
+ sr = *c++;
+ LARc[2] = sr & 0x1f; sr >>= 5;
+ sr |= (uword)*c++ << 3;
+ LARc[3] = sr & 0x1f; sr >>= 5;
+ LARc[4] = sr & 0xf; sr >>= 4;
+ sr |= (uword)*c++ << 2;
+ LARc[5] = sr & 0xf; sr >>= 4;
+ LARc[6] = sr & 0x7; sr >>= 3;
+ LARc[7] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 5 */
+ Nc[0] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1;
+ bc[0] = sr & 0x3; sr >>= 2;
+ Mc[0] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[0] = sr & 0x3f; sr >>= 6;
+ xmc[0] = sr & 0x7; sr >>= 3;
+ xmc[1] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[2] = sr & 0x7; sr >>= 3;
+ xmc[3] = sr & 0x7; sr >>= 3;
+ xmc[4] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[5] = sr & 0x7; sr >>= 3;
+ xmc[6] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2; /* 10 */
+ xmc[7] = sr & 0x7; sr >>= 3;
+ xmc[8] = sr & 0x7; sr >>= 3;
+ xmc[9] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[10] = sr & 0x7; sr >>= 3;
+ xmc[11] = sr & 0x7; sr >>= 3;
+ xmc[12] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ Nc[1] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1;
+ bc[1] = sr & 0x3; sr >>= 2;
+ Mc[1] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[1] = sr & 0x3f; sr >>= 6;
+ xmc[13] = sr & 0x7; sr >>= 3;
+ xmc[14] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1; /* 15 */
+ xmc[15] = sr & 0x7; sr >>= 3;
+ xmc[16] = sr & 0x7; sr >>= 3;
+ xmc[17] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[18] = sr & 0x7; sr >>= 3;
+ xmc[19] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[20] = sr & 0x7; sr >>= 3;
+ xmc[21] = sr & 0x7; sr >>= 3;
+ xmc[22] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[23] = sr & 0x7; sr >>= 3;
+ xmc[24] = sr & 0x7; sr >>= 3;
+ xmc[25] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ Nc[2] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1; /* 20 */
+ bc[2] = sr & 0x3; sr >>= 2;
+ Mc[2] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[2] = sr & 0x3f; sr >>= 6;
+ xmc[26] = sr & 0x7; sr >>= 3;
+ xmc[27] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[28] = sr & 0x7; sr >>= 3;
+ xmc[29] = sr & 0x7; sr >>= 3;
+ xmc[30] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ xmc[31] = sr & 0x7; sr >>= 3;
+ xmc[32] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[33] = sr & 0x7; sr >>= 3;
+ xmc[34] = sr & 0x7; sr >>= 3;
+ xmc[35] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1; /* 25 */
+ xmc[36] = sr & 0x7; sr >>= 3;
+ xmc[37] = sr & 0x7; sr >>= 3;
+ xmc[38] = sr & 0x7; sr >>= 3;
+ sr = *c++;
+ Nc[3] = sr & 0x7f; sr >>= 7;
+ sr |= (uword)*c++ << 1;
+ bc[3] = sr & 0x3; sr >>= 2;
+ Mc[3] = sr & 0x3; sr >>= 2;
+ sr |= (uword)*c++ << 5;
+ xmaxc[3] = sr & 0x3f; sr >>= 6;
+ xmc[39] = sr & 0x7; sr >>= 3;
+ xmc[40] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[41] = sr & 0x7; sr >>= 3;
+ xmc[42] = sr & 0x7; sr >>= 3;
+ xmc[43] = sr & 0x7; sr >>= 3;
+ sr = *c++; /* 30 */
+ xmc[44] = sr & 0x7; sr >>= 3;
+ xmc[45] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 2;
+ xmc[46] = sr & 0x7; sr >>= 3;
+ xmc[47] = sr & 0x7; sr >>= 3;
+ xmc[48] = sr & 0x7; sr >>= 3;
+ sr |= (uword)*c++ << 1;
+ xmc[49] = sr & 0x7; sr >>= 3;
+ xmc[50] = sr & 0x7; sr >>= 3;
+ xmc[51] = sr & 0x7; sr >>= 3;
+ }
+ }
+ else
+#endif
+ {
+ /* GSM_MAGIC = (*c >> 4) & 0xF; */
+
+ if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
+
+ LARc[0] = (*c++ & 0xF) << 2; /* 1 */
+ LARc[0] |= (*c >> 6) & 0x3;
+ LARc[1] = *c++ & 0x3F;
+ LARc[2] = (*c >> 3) & 0x1F;
+ LARc[3] = (*c++ & 0x7) << 2;
+ LARc[3] |= (*c >> 6) & 0x3;
+ LARc[4] = (*c >> 2) & 0xF;
+ LARc[5] = (*c++ & 0x3) << 2;
+ LARc[5] |= (*c >> 6) & 0x3;
+ LARc[6] = (*c >> 3) & 0x7;
+ LARc[7] = *c++ & 0x7;
+ Nc[0] = (*c >> 1) & 0x7F;
+ bc[0] = (*c++ & 0x1) << 1;
+ bc[0] |= (*c >> 7) & 0x1;
+ Mc[0] = (*c >> 5) & 0x3;
+ xmaxc[0] = (*c++ & 0x1F) << 1;
+ xmaxc[0] |= (*c >> 7) & 0x1;
+ xmc[0] = (*c >> 4) & 0x7;
+ xmc[1] = (*c >> 1) & 0x7;
+ xmc[2] = (*c++ & 0x1) << 2;
+ xmc[2] |= (*c >> 6) & 0x3;
+ xmc[3] = (*c >> 3) & 0x7;
+ xmc[4] = *c++ & 0x7;
+ xmc[5] = (*c >> 5) & 0x7;
+ xmc[6] = (*c >> 2) & 0x7;
+ xmc[7] = (*c++ & 0x3) << 1; /* 10 */
+ xmc[7] |= (*c >> 7) & 0x1;
+ xmc[8] = (*c >> 4) & 0x7;
+ xmc[9] = (*c >> 1) & 0x7;
+ xmc[10] = (*c++ & 0x1) << 2;
+ xmc[10] |= (*c >> 6) & 0x3;
+ xmc[11] = (*c >> 3) & 0x7;
+ xmc[12] = *c++ & 0x7;
+ Nc[1] = (*c >> 1) & 0x7F;
+ bc[1] = (*c++ & 0x1) << 1;
+ bc[1] |= (*c >> 7) & 0x1;
+ Mc[1] = (*c >> 5) & 0x3;
+ xmaxc[1] = (*c++ & 0x1F) << 1;
+ xmaxc[1] |= (*c >> 7) & 0x1;
+ xmc[13] = (*c >> 4) & 0x7;
+ xmc[14] = (*c >> 1) & 0x7;
+ xmc[15] = (*c++ & 0x1) << 2;
+ xmc[15] |= (*c >> 6) & 0x3;
+ xmc[16] = (*c >> 3) & 0x7;
+ xmc[17] = *c++ & 0x7;
+ xmc[18] = (*c >> 5) & 0x7;
+ xmc[19] = (*c >> 2) & 0x7;
+ xmc[20] = (*c++ & 0x3) << 1;
+ xmc[20] |= (*c >> 7) & 0x1;
+ xmc[21] = (*c >> 4) & 0x7;
+ xmc[22] = (*c >> 1) & 0x7;
+ xmc[23] = (*c++ & 0x1) << 2;
+ xmc[23] |= (*c >> 6) & 0x3;
+ xmc[24] = (*c >> 3) & 0x7;
+ xmc[25] = *c++ & 0x7;
+ Nc[2] = (*c >> 1) & 0x7F;
+ bc[2] = (*c++ & 0x1) << 1; /* 20 */
+ bc[2] |= (*c >> 7) & 0x1;
+ Mc[2] = (*c >> 5) & 0x3;
+ xmaxc[2] = (*c++ & 0x1F) << 1;
+ xmaxc[2] |= (*c >> 7) & 0x1;
+ xmc[26] = (*c >> 4) & 0x7;
+ xmc[27] = (*c >> 1) & 0x7;
+ xmc[28] = (*c++ & 0x1) << 2;
+ xmc[28] |= (*c >> 6) & 0x3;
+ xmc[29] = (*c >> 3) & 0x7;
+ xmc[30] = *c++ & 0x7;
+ xmc[31] = (*c >> 5) & 0x7;
+ xmc[32] = (*c >> 2) & 0x7;
+ xmc[33] = (*c++ & 0x3) << 1;
+ xmc[33] |= (*c >> 7) & 0x1;
+ xmc[34] = (*c >> 4) & 0x7;
+ xmc[35] = (*c >> 1) & 0x7;
+ xmc[36] = (*c++ & 0x1) << 2;
+ xmc[36] |= (*c >> 6) & 0x3;
+ xmc[37] = (*c >> 3) & 0x7;
+ xmc[38] = *c++ & 0x7;
+ Nc[3] = (*c >> 1) & 0x7F;
+ bc[3] = (*c++ & 0x1) << 1;
+ bc[3] |= (*c >> 7) & 0x1;
+ Mc[3] = (*c >> 5) & 0x3;
+ xmaxc[3] = (*c++ & 0x1F) << 1;
+ xmaxc[3] |= (*c >> 7) & 0x1;
+ xmc[39] = (*c >> 4) & 0x7;
+ xmc[40] = (*c >> 1) & 0x7;
+ xmc[41] = (*c++ & 0x1) << 2;
+ xmc[41] |= (*c >> 6) & 0x3;
+ xmc[42] = (*c >> 3) & 0x7;
+ xmc[43] = *c++ & 0x7; /* 30 */
+ xmc[44] = (*c >> 5) & 0x7;
+ xmc[45] = (*c >> 2) & 0x7;
+ xmc[46] = (*c++ & 0x3) << 1;
+ xmc[46] |= (*c >> 7) & 0x1;
+ xmc[47] = (*c >> 4) & 0x7;
+ xmc[48] = (*c >> 1) & 0x7;
+ xmc[49] = (*c++ & 0x1) << 2;
+ xmc[49] |= (*c >> 6) & 0x3;
+ xmc[50] = (*c >> 3) & 0x7;
+ xmc[51] = *c & 0x7; /* 33 */
+ }
+
+ Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target);
+
+ return 0;
+}
diff --git a/src/libgsm/gsm_destroy.c b/src/libgsm/gsm_destroy.c
new file mode 100644
index 0000000..971aa15
--- /dev/null
+++ b/src/libgsm/gsm_destroy.c
@@ -0,0 +1,16 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/gsm_destroy.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $ */
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+# include <stdlib.h>
+
+void gsm_destroy (gsm S)
+{
+ if (S) free((char *)S);
+}
diff --git a/src/libgsm/gsm_encode.c b/src/libgsm/gsm_encode.c
new file mode 100644
index 0000000..e5efac1
--- /dev/null
+++ b/src/libgsm/gsm_encode.c
@@ -0,0 +1,450 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/gsm_encode.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $ */
+
+#include "third_party/sox/src/libgsm/private.h"
+#include "third_party/sox/src/libgsm/gsm.h"
+
+void gsm_encode (gsm s, gsm_signal * source, gsm_byte * c)
+{
+ word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
+
+ Gsm_Coder(s, source, LARc, Nc, bc, Mc, xmaxc, xmc);
+
+
+ /* variable size
+
+ GSM_MAGIC 4
+
+ LARc[0] 6
+ LARc[1] 6
+ LARc[2] 5
+ LARc[3] 5
+ LARc[4] 4
+ LARc[5] 4
+ LARc[6] 3
+ LARc[7] 3
+
+ Nc[0] 7
+ bc[0] 2
+ Mc[0] 2
+ xmaxc[0] 6
+ xmc[0] 3
+ xmc[1] 3
+ xmc[2] 3
+ xmc[3] 3
+ xmc[4] 3
+ xmc[5] 3
+ xmc[6] 3
+ xmc[7] 3
+ xmc[8] 3
+ xmc[9] 3
+ xmc[10] 3
+ xmc[11] 3
+ xmc[12] 3
+
+ Nc[1] 7
+ bc[1] 2
+ Mc[1] 2
+ xmaxc[1] 6
+ xmc[13] 3
+ xmc[14] 3
+ xmc[15] 3
+ xmc[16] 3
+ xmc[17] 3
+ xmc[18] 3
+ xmc[19] 3
+ xmc[20] 3
+ xmc[21] 3
+ xmc[22] 3
+ xmc[23] 3
+ xmc[24] 3
+ xmc[25] 3
+
+ Nc[2] 7
+ bc[2] 2
+ Mc[2] 2
+ xmaxc[2] 6
+ xmc[26] 3
+ xmc[27] 3
+ xmc[28] 3
+ xmc[29] 3
+ xmc[30] 3
+ xmc[31] 3
+ xmc[32] 3
+ xmc[33] 3
+ xmc[34] 3
+ xmc[35] 3
+ xmc[36] 3
+ xmc[37] 3
+ xmc[38] 3
+
+ Nc[3] 7
+ bc[3] 2
+ Mc[3] 2
+ xmaxc[3] 6
+ xmc[39] 3
+ xmc[40] 3
+ xmc[41] 3
+ xmc[42] 3
+ xmc[43] 3
+ xmc[44] 3
+ xmc[45] 3
+ xmc[46] 3
+ xmc[47] 3
+ xmc[48] 3
+ xmc[49] 3
+ xmc[50] 3
+ xmc[51] 3
+ */
+
+#ifdef WAV49
+
+ if (s->wav_fmt) {
+ s->frame_index = !s->frame_index;
+ if (s->frame_index) {
+
+ uword sr;
+
+ sr = 0;
+ sr = sr >> 6 | LARc[0] << 10;
+ sr = sr >> 6 | LARc[1] << 10;
+ *c++ = sr >> 4;
+ sr = sr >> 5 | LARc[2] << 11;
+ *c++ = sr >> 7;
+ sr = sr >> 5 | LARc[3] << 11;
+ sr = sr >> 4 | LARc[4] << 12;
+ *c++ = sr >> 6;
+ sr = sr >> 4 | LARc[5] << 12;
+ sr = sr >> 3 | LARc[6] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | LARc[7] << 13;
+ sr = sr >> 7 | Nc[0] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[0] << 14;
+ sr = sr >> 2 | Mc[0] << 14;
+ sr = sr >> 6 | xmaxc[0] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[0] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[1] << 13;
+ sr = sr >> 3 | xmc[2] << 13;
+ sr = sr >> 3 | xmc[3] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[4] << 13;
+ sr = sr >> 3 | xmc[5] << 13;
+ sr = sr >> 3 | xmc[6] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[7] << 13;
+ sr = sr >> 3 | xmc[8] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[9] << 13;
+ sr = sr >> 3 | xmc[10] << 13;
+ sr = sr >> 3 | xmc[11] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[12] << 13;
+ sr = sr >> 7 | Nc[1] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[1] << 14;
+ sr = sr >> 2 | Mc[1] << 14;
+ sr = sr >> 6 | xmaxc[1] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[13] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[14] << 13;
+ sr = sr >> 3 | xmc[15] << 13;
+ sr = sr >> 3 | xmc[16] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[17] << 13;
+ sr = sr >> 3 | xmc[18] << 13;
+ sr = sr >> 3 | xmc[19] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[20] << 13;
+ sr = sr >> 3 | xmc[21] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[22] << 13;
+ sr = sr >> 3 | xmc[23] << 13;
+ sr = sr >> 3 | xmc[24] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[25] << 13;
+ sr = sr >> 7 | Nc[2] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[2] << 14;
+ sr = sr >> 2 | Mc[2] << 14;
+ sr = sr >> 6 | xmaxc[2] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[26] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[27] << 13;
+ sr = sr >> 3 | xmc[28] << 13;
+ sr = sr >> 3 | xmc[29] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[30] << 13;
+ sr = sr >> 3 | xmc[31] << 13;
+ sr = sr >> 3 | xmc[32] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[33] << 13;
+ sr = sr >> 3 | xmc[34] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[35] << 13;
+ sr = sr >> 3 | xmc[36] << 13;
+ sr = sr >> 3 | xmc[37] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[38] << 13;
+ sr = sr >> 7 | Nc[3] << 9;
+ *c++ = sr >> 5;
+ sr = sr >> 2 | bc[3] << 14;
+ sr = sr >> 2 | Mc[3] << 14;
+ sr = sr >> 6 | xmaxc[3] << 10;
+ *c++ = sr >> 3;
+ sr = sr >> 3 | xmc[39] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[40] << 13;
+ sr = sr >> 3 | xmc[41] << 13;
+ sr = sr >> 3 | xmc[42] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[43] << 13;
+ sr = sr >> 3 | xmc[44] << 13;
+ sr = sr >> 3 | xmc[45] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[46] << 13;
+ sr = sr >> 3 | xmc[47] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[48] << 13;
+ sr = sr >> 3 | xmc[49] << 13;
+ sr = sr >> 3 | xmc[50] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[51] << 13;
+ sr = sr >> 4;
+ *c = sr >> 8;
+ s->frame_chain = *c;
+ }
+ else {
+ uword sr;
+
+ sr = 0;
+ sr = sr >> 4 | s->frame_chain << 12;
+ sr = sr >> 6 | LARc[0] << 10;
+ *c++ = sr >> 6;
+ sr = sr >> 6 | LARc[1] << 10;
+ *c++ = sr >> 8;
+ sr = sr >> 5 | LARc[2] << 11;
+ sr = sr >> 5 | LARc[3] << 11;
+ *c++ = sr >> 6;
+ sr = sr >> 4 | LARc[4] << 12;
+ sr = sr >> 4 | LARc[5] << 12;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | LARc[6] << 13;
+ sr = sr >> 3 | LARc[7] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[0] << 9;
+ sr = sr >> 2 | bc[0] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[0] << 14;
+ sr = sr >> 6 | xmaxc[0] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[0] << 13;
+ sr = sr >> 3 | xmc[1] << 13;
+ sr = sr >> 3 | xmc[2] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[3] << 13;
+ sr = sr >> 3 | xmc[4] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[5] << 13;
+ sr = sr >> 3 | xmc[6] << 13;
+ sr = sr >> 3 | xmc[7] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[8] << 13;
+ sr = sr >> 3 | xmc[9] << 13;
+ sr = sr >> 3 | xmc[10] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[11] << 13;
+ sr = sr >> 3 | xmc[12] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[1] << 9;
+ sr = sr >> 2 | bc[1] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[1] << 14;
+ sr = sr >> 6 | xmaxc[1] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[13] << 13;
+ sr = sr >> 3 | xmc[14] << 13;
+ sr = sr >> 3 | xmc[15] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[16] << 13;
+ sr = sr >> 3 | xmc[17] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[18] << 13;
+ sr = sr >> 3 | xmc[19] << 13;
+ sr = sr >> 3 | xmc[20] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[21] << 13;
+ sr = sr >> 3 | xmc[22] << 13;
+ sr = sr >> 3 | xmc[23] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[24] << 13;
+ sr = sr >> 3 | xmc[25] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[2] << 9;
+ sr = sr >> 2 | bc[2] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[2] << 14;
+ sr = sr >> 6 | xmaxc[2] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[26] << 13;
+ sr = sr >> 3 | xmc[27] << 13;
+ sr = sr >> 3 | xmc[28] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[29] << 13;
+ sr = sr >> 3 | xmc[30] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[31] << 13;
+ sr = sr >> 3 | xmc[32] << 13;
+ sr = sr >> 3 | xmc[33] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[34] << 13;
+ sr = sr >> 3 | xmc[35] << 13;
+ sr = sr >> 3 | xmc[36] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[37] << 13;
+ sr = sr >> 3 | xmc[38] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 7 | Nc[3] << 9;
+ sr = sr >> 2 | bc[3] << 14;
+ *c++ = sr >> 7;
+ sr = sr >> 2 | Mc[3] << 14;
+ sr = sr >> 6 | xmaxc[3] << 10;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[39] << 13;
+ sr = sr >> 3 | xmc[40] << 13;
+ sr = sr >> 3 | xmc[41] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[42] << 13;
+ sr = sr >> 3 | xmc[43] << 13;
+ *c++ = sr >> 8;
+ sr = sr >> 3 | xmc[44] << 13;
+ sr = sr >> 3 | xmc[45] << 13;
+ sr = sr >> 3 | xmc[46] << 13;
+ *c++ = sr >> 7;
+ sr = sr >> 3 | xmc[47] << 13;
+ sr = sr >> 3 | xmc[48] << 13;
+ sr = sr >> 3 | xmc[49] << 13;
+ *c++ = sr >> 6;
+ sr = sr >> 3 | xmc[50] << 13;
+ sr = sr >> 3 | xmc[51] << 13;
+ *c++ = sr >> 8;
+ }
+ }
+
+ else
+
+#endif /* WAV49 */
+ {
+
+ *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */
+ | ((LARc[0] >> 2) & 0xF);
+ *c++ = ((LARc[0] & 0x3) << 6)
+ | (LARc[1] & 0x3F);
+ *c++ = ((LARc[2] & 0x1F) << 3)
+ | ((LARc[3] >> 2) & 0x7);
+ *c++ = ((LARc[3] & 0x3) << 6)
+ | ((LARc[4] & 0xF) << 2)
+ | ((LARc[5] >> 2) & 0x3);
+ *c++ = ((LARc[5] & 0x3) << 6)
+ | ((LARc[6] & 0x7) << 3)
+ | (LARc[7] & 0x7);
+ *c++ = ((Nc[0] & 0x7F) << 1)
+ | ((bc[0] >> 1) & 0x1);
+ *c++ = ((bc[0] & 0x1) << 7)
+ | ((Mc[0] & 0x3) << 5)
+ | ((xmaxc[0] >> 1) & 0x1F);
+ *c++ = ((xmaxc[0] & 0x1) << 7)
+ | ((xmc[0] & 0x7) << 4)
+ | ((xmc[1] & 0x7) << 1)
+ | ((xmc[2] >> 2) & 0x1);
+ *c++ = ((xmc[2] & 0x3) << 6)
+ | ((xmc[3] & 0x7) << 3)
+ | (xmc[4] & 0x7);
+ *c++ = ((xmc[5] & 0x7) << 5) /* 10 */
+ | ((xmc[6] & 0x7) << 2)
+ | ((xmc[7] >> 1) & 0x3);
+ *c++ = ((xmc[7] & 0x1) << 7)
+ | ((xmc[8] & 0x7) << 4)
+ | ((xmc[9] & 0x7) << 1)
+ | ((xmc[10] >> 2) & 0x1);
+ *c++ = ((xmc[10] & 0x3) << 6)
+ | ((xmc[11] & 0x7) << 3)
+ | (xmc[12] & 0x7);
+ *c++ = ((Nc[1] & 0x7F) << 1)
+ | ((bc[1] >> 1) & 0x1);
+ *c++ = ((bc[1] & 0x1) << 7)
+ | ((Mc[1] & 0x3) << 5)
+ | ((xmaxc[1] >> 1) & 0x1F);
+ *c++ = ((xmaxc[1] & 0x1) << 7)
+ | ((xmc[13] & 0x7) << 4)
+ | ((xmc[14] & 0x7) << 1)
+ | ((xmc[15] >> 2) & 0x1);
+ *c++ = ((xmc[15] & 0x3) << 6)
+ | ((xmc[16] & 0x7) << 3)
+ | (xmc[17] & 0x7);
+ *c++ = ((xmc[18] & 0x7) << 5)
+ | ((xmc[19] & 0x7) << 2)
+ | ((xmc[20] >> 1) & 0x3);
+ *c++ = ((xmc[20] & 0x1) << 7)
+ | ((xmc[21] & 0x7) << 4)
+ | ((xmc[22] & 0x7) << 1)
+ | ((xmc[23] >> 2) & 0x1);
+ *c++ = ((xmc[23] & 0x3) << 6)
+ | ((xmc[24] & 0x7) << 3)
+ | (xmc[25] & 0x7);
+ *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */
+ | ((bc[2] >> 1) & 0x1);
+ *c++ = ((bc[2] & 0x1) << 7)
+ | ((Mc[2] & 0x3) << 5)
+ | ((xmaxc[2] >> 1) & 0x1F);
+ *c++ = ((xmaxc[2] & 0x1) << 7)
+ | ((xmc[26] & 0x7) << 4)
+ | ((xmc[27] & 0x7) << 1)
+ | ((xmc[28] >> 2) & 0x1);
+ *c++ = ((xmc[28] & 0x3) << 6)
+ | ((xmc[29] & 0x7) << 3)
+ | (xmc[30] & 0x7);
+ *c++ = ((xmc[31] & 0x7) << 5)
+ | ((xmc[32] & 0x7) << 2)
+ | ((xmc[33] >> 1) & 0x3);
+ *c++ = ((xmc[33] & 0x1) << 7)
+ | ((xmc[34] & 0x7) << 4)
+ | ((xmc[35] & 0x7) << 1)
+ | ((xmc[36] >> 2) & 0x1);
+ *c++ = ((xmc[36] & 0x3) << 6)
+ | ((xmc[37] & 0x7) << 3)
+ | (xmc[38] & 0x7);
+ *c++ = ((Nc[3] & 0x7F) << 1)
+ | ((bc[3] >> 1) & 0x1);
+ *c++ = ((bc[3] & 0x1) << 7)
+ | ((Mc[3] & 0x3) << 5)
+ | ((xmaxc[3] >> 1) & 0x1F);
+ *c++ = ((xmaxc[3] & 0x1) << 7)
+ | ((xmc[39] & 0x7) << 4)
+ | ((xmc[40] & 0x7) << 1)
+ | ((xmc[41] >> 2) & 0x1);
+ *c++ = ((xmc[41] & 0x3) << 6) /* 30 */
+ | ((xmc[42] & 0x7) << 3)
+ | (xmc[43] & 0x7);
+ *c++ = ((xmc[44] & 0x7) << 5)
+ | ((xmc[45] & 0x7) << 2)
+ | ((xmc[46] >> 1) & 0x3);
+ *c++ = ((xmc[46] & 0x1) << 7)
+ | ((xmc[47] & 0x7) << 4)
+ | ((xmc[48] & 0x7) << 1)
+ | ((xmc[49] >> 2) & 0x1);
+ *c++ = ((xmc[49] & 0x3) << 6)
+ | ((xmc[50] & 0x7) << 3)
+ | (xmc[51] & 0x7);
+
+ }
+}
diff --git a/src/libgsm/gsm_option.c b/src/libgsm/gsm_option.c
new file mode 100644
index 0000000..6b9ec1c
--- /dev/null
+++ b/src/libgsm/gsm_option.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/gsm_option.c,v 1.2 2008/02/16 18:30:03 robs Exp $ */
+
+#include "third_party/sox/src/libgsm/private.h"
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+int gsm_option (gsm r, int opt, int * val)
+{
+ int result = -1;
+
+ switch (opt) {
+ case GSM_OPT_LTP_CUT:
+#ifdef LTP_CUT
+ result = r->ltp_cut;
+ if (val) r->ltp_cut = *val;
+#endif
+ break;
+
+ case GSM_OPT_VERBOSE:
+#ifndef NDEBUG
+ result = r->verbose;
+ if (val) r->verbose = *val;
+#endif
+ break;
+
+ case GSM_OPT_FAST:
+
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+ result = r->fast;
+ if (val) r->fast = !!*val;
+#endif
+ break;
+
+ case GSM_OPT_FRAME_CHAIN:
+
+#ifdef WAV49
+ result = r->frame_chain;
+ if (val) r->frame_chain = *val;
+#endif
+ break;
+
+ case GSM_OPT_FRAME_INDEX:
+
+#ifdef WAV49
+ result = r->frame_index;
+ if (val) r->frame_index = *val;
+#endif
+ break;
+
+ case GSM_OPT_WAV49:
+
+#ifdef WAV49
+ result = r->wav_fmt;
+ if (val) r->wav_fmt = !!*val;
+#endif
+ break;
+
+ default:
+ (void)r, (void)val;
+ break;
+ }
+ return result;
+}
diff --git a/src/libgsm/long_term.c b/src/libgsm/long_term.c
new file mode 100644
index 0000000..e5679ab
--- /dev/null
+++ b/src/libgsm/long_term.c
@@ -0,0 +1,949 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/long_term.c,v 1.2 2007/11/04 16:32:36 robs Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/*
+ * 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION
+ */
+
+
+/*
+ * This module computes the LTP gain (bc) and the LTP lag (Nc)
+ * for the long term analysis filter. This is done by calculating a
+ * maximum of the cross-correlation function between the current
+ * sub-segment short term residual signal d[0..39] (output of
+ * the short term analysis filter; for simplification the index
+ * of this array begins at 0 and ends at 39 for each sub-segment of the
+ * RPE-LTP analysis) and the previous reconstructed short term
+ * residual signal dp[ -120 .. -1 ]. A dynamic scaling must be
+ * performed to avoid overflow.
+ */
+
+ /* The next procedure exists in six versions. First two integer
+ * version (if USE_FLOAT_MUL is not defined); then four floating
+ * point versions, twice with proper scaling (USE_FLOAT_MUL defined),
+ * once without (USE_FLOAT_MUL and FAST defined, and fast run-time
+ * option used). Every pair has first a Cut version (see the -C
+ * option to toast or the LTP_CUT option to gsm_option()), then the
+ * uncut one. (For a detailed explanation of why this is altogether
+ * a bad idea, see Henry Spencer and Geoff Collyer, ``#ifdef Considered
+ * Harmful''.)
+ */
+
+#ifndef USE_FLOAT_MUL
+
+#ifdef LTP_CUT
+
+static void Cut_Calculation_of_the_LTP_parameters (
+
+ struct gsm_state * st,
+
+ register word * d, /* [0..39] IN */
+ register word * dp, /* [-120..-1] IN */
+ word * bc_out, /* OUT */
+ word * Nc_out /* OUT */
+)
+{
+ register int k, lambda;
+ word Nc, bc;
+ word wt[40];
+
+ longword L_result;
+ longword L_max, L_power;
+ word R, S, dmax, scal, best_k;
+ word ltp_cut;
+
+ register word temp, wt_k;
+
+ /* Search of the optimum scaling of d[0..39].
+ */
+ dmax = 0;
+ for (k = 0; k <= 39; k++) {
+ temp = d[k];
+ temp = GSM_ABS( temp );
+ if (temp > dmax) {
+ dmax = temp;
+ best_k = k;
+ }
+ }
+ temp = 0;
+ if (dmax == 0) scal = 0;
+ else {
+ assert(dmax > 0);
+ temp = gsm_norm( (longword)dmax << 16 );
+ }
+ if (temp > 6) scal = 0;
+ else scal = 6 - temp;
+ assert(scal >= 0);
+
+ /* Search for the maximum cross-correlation and coding of the LTP lag
+ */
+ L_max = 0;
+ Nc = 40; /* index for the maximum cross-correlation */
+ wt_k = SASR(d[best_k], scal);
+
+ for (lambda = 40; lambda <= 120; lambda++) {
+ L_result = (longword)wt_k * dp[best_k - lambda];
+ if (L_result > L_max) {
+ Nc = lambda;
+ L_max = L_result;
+ }
+ }
+ *Nc_out = Nc;
+ L_max <<= 1;
+
+ /* Rescaling of L_max
+ */
+ assert(scal <= 100 && scal >= -100);
+ L_max = L_max >> (6 - scal); /* sub(6, scal) */
+
+ assert( Nc <= 120 && Nc >= 40);
+
+ /* Compute the power of the reconstructed short term residual
+ * signal dp[..]
+ */
+ L_power = 0;
+ for (k = 0; k <= 39; k++) {
+
+ register longword L_temp;
+
+ L_temp = SASR( dp[k - Nc], 3 );
+ L_power += L_temp * L_temp;
+ }
+ L_power <<= 1; /* from L_MULT */
+
+ /* Normalization of L_max and L_power
+ */
+
+ if (L_max <= 0) {
+ *bc_out = 0;
+ return;
+ }
+ if (L_max >= L_power) {
+ *bc_out = 3;
+ return;
+ }
+
+ temp = gsm_norm( L_power );
+
+ R = SASR( L_max << temp, 16 );
+ S = SASR( L_power << temp, 16 );
+
+ /* Coding of the LTP gain
+ */
+
+ /* Table 4.3a must be used to obtain the level DLB[i] for the
+ * quantization of the LTP gain b to get the coded version bc.
+ */
+ for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
+ *bc_out = bc;
+}
+
+#endif /* LTP_CUT */
+
+static void Calculation_of_the_LTP_parameters (
+ register word * d, /* [0..39] IN */
+ register word * dp, /* [-120..-1] IN */
+ word * bc_out, /* OUT */
+ word * Nc_out /* OUT */
+)
+{
+ register int k, lambda;
+ word Nc, bc;
+ word wt[40];
+
+ longword L_max, L_power;
+ word R, S, dmax, scal;
+ register word temp;
+
+ /* Search of the optimum scaling of d[0..39].
+ */
+ dmax = 0;
+
+ for (k = 0; k <= 39; k++) {
+ temp = d[k];
+ temp = GSM_ABS( temp );
+ if (temp > dmax) dmax = temp;
+ }
+
+ temp = 0;
+ if (dmax == 0) scal = 0;
+ else {
+ assert(dmax > 0);
+ temp = gsm_norm( (longword)dmax << 16 );
+ }
+
+ if (temp > 6) scal = 0;
+ else scal = 6 - temp;
+
+ assert(scal >= 0);
+
+ /* Initialization of a working array wt
+ */
+
+ for (k = 0; k <= 39; k++) wt[k] = SASR( d[k], scal );
+
+ /* Search for the maximum cross-correlation and coding of the LTP lag
+ */
+ L_max = 0;
+ Nc = 40; /* index for the maximum cross-correlation */
+
+ for (lambda = 40; lambda <= 120; lambda++) {
+
+# undef STEP
+# define STEP(k) (longword)wt[k] * dp[k - lambda]
+
+ register longword L_result;
+
+ L_result = STEP(0) ; L_result += STEP(1) ;
+ L_result += STEP(2) ; L_result += STEP(3) ;
+ L_result += STEP(4) ; L_result += STEP(5) ;
+ L_result += STEP(6) ; L_result += STEP(7) ;
+ L_result += STEP(8) ; L_result += STEP(9) ;
+ L_result += STEP(10) ; L_result += STEP(11) ;
+ L_result += STEP(12) ; L_result += STEP(13) ;
+ L_result += STEP(14) ; L_result += STEP(15) ;
+ L_result += STEP(16) ; L_result += STEP(17) ;
+ L_result += STEP(18) ; L_result += STEP(19) ;
+ L_result += STEP(20) ; L_result += STEP(21) ;
+ L_result += STEP(22) ; L_result += STEP(23) ;
+ L_result += STEP(24) ; L_result += STEP(25) ;
+ L_result += STEP(26) ; L_result += STEP(27) ;
+ L_result += STEP(28) ; L_result += STEP(29) ;
+ L_result += STEP(30) ; L_result += STEP(31) ;
+ L_result += STEP(32) ; L_result += STEP(33) ;
+ L_result += STEP(34) ; L_result += STEP(35) ;
+ L_result += STEP(36) ; L_result += STEP(37) ;
+ L_result += STEP(38) ; L_result += STEP(39) ;
+
+ if (L_result > L_max) {
+
+ Nc = lambda;
+ L_max = L_result;
+ }
+ }
+
+ *Nc_out = Nc;
+
+ L_max <<= 1;
+
+ /* Rescaling of L_max
+ */
+ assert(scal <= 100 && scal >= -100);
+ L_max = L_max >> (6 - scal); /* sub(6, scal) */
+
+ assert( Nc <= 120 && Nc >= 40);
+
+ /* Compute the power of the reconstructed short term residual
+ * signal dp[..]
+ */
+ L_power = 0;
+ for (k = 0; k <= 39; k++) {
+
+ register longword L_temp;
+
+ L_temp = SASR( dp[k - Nc], 3 );
+ L_power += L_temp * L_temp;
+ }
+ L_power <<= 1; /* from L_MULT */
+
+ /* Normalization of L_max and L_power
+ */
+
+ if (L_max <= 0) {
+ *bc_out = 0;
+ return;
+ }
+ if (L_max >= L_power) {
+ *bc_out = 3;
+ return;
+ }
+
+ temp = gsm_norm( L_power );
+
+ R = SASR( L_max << temp, 16 );
+ S = SASR( L_power << temp, 16 );
+
+ /* Coding of the LTP gain
+ */
+
+ /* Table 4.3a must be used to obtain the level DLB[i] for the
+ * quantization of the LTP gain b to get the coded version bc.
+ */
+ for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
+ *bc_out = bc;
+}
+
+#else /* USE_FLOAT_MUL */
+
+#ifdef LTP_CUT
+
+static void Cut_Calculation_of_the_LTP_parameters (
+ struct gsm_state * st, /* IN */
+ register word * d, /* [0..39] IN */
+ register word * dp, /* [-120..-1] IN */
+ word * bc_out, /* OUT */
+ word * Nc_out /* OUT */
+)
+{
+ register int k, lambda;
+ word Nc, bc;
+ word ltp_cut;
+
+ float wt_float[40];
+ float dp_float_base[120], * dp_float = dp_float_base + 120;
+
+ longword L_max, L_power;
+ word R, S, dmax, scal;
+ register word temp;
+
+ /* Search of the optimum scaling of d[0..39].
+ */
+ dmax = 0;
+
+ for (k = 0; k <= 39; k++) {
+ temp = d[k];
+ temp = GSM_ABS( temp );
+ if (temp > dmax) dmax = temp;
+ }
+
+ temp = 0;
+ if (dmax == 0) scal = 0;
+ else {
+ assert(dmax > 0);
+ temp = gsm_norm( (longword)dmax << 16 );
+ }
+
+ if (temp > 6) scal = 0;
+ else scal = 6 - temp;
+
+ assert(scal >= 0);
+ ltp_cut = (longword)SASR(dmax, scal) * st->ltp_cut / 100;
+
+
+ /* Initialization of a working array wt
+ */
+
+ for (k = 0; k < 40; k++) {
+ register word w = SASR( d[k], scal );
+ if (w < 0 ? w > -ltp_cut : w < ltp_cut) {
+ wt_float[k] = 0.0;
+ }
+ else {
+ wt_float[k] = w;
+ }
+ }
+ for (k = -120; k < 0; k++) dp_float[k] = dp[k];
+
+ /* Search for the maximum cross-correlation and coding of the LTP lag
+ */
+ L_max = 0;
+ Nc = 40; /* index for the maximum cross-correlation */
+
+ for (lambda = 40; lambda <= 120; lambda += 9) {
+
+ /* Calculate L_result for l = lambda .. lambda + 9.
+ */
+ register float *lp = dp_float - lambda;
+
+ register float W;
+ register float a = lp[-8], b = lp[-7], c = lp[-6],
+ d = lp[-5], e = lp[-4], f = lp[-3],
+ g = lp[-2], h = lp[-1];
+ register float E;
+ register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
+ S5 = 0, S6 = 0, S7 = 0, S8 = 0;
+
+# undef STEP
+# define STEP(K, a, b, c, d, e, f, g, h) \
+ if ((W = wt_float[K]) != 0.0) { \
+ E = W * a; S8 += E; \
+ E = W * b; S7 += E; \
+ E = W * c; S6 += E; \
+ E = W * d; S5 += E; \
+ E = W * e; S4 += E; \
+ E = W * f; S3 += E; \
+ E = W * g; S2 += E; \
+ E = W * h; S1 += E; \
+ a = lp[K]; \
+ E = W * a; S0 += E; } else (a = lp[K])
+
+# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
+# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
+# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
+# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
+# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
+# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
+# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
+# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
+
+ STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
+ STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
+
+ STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
+ STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
+
+ STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
+ STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
+
+ STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
+ STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
+
+ STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
+ STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
+
+ if (S0 > L_max) { L_max = S0; Nc = lambda; }
+ if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
+ if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
+ if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
+ if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
+ if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
+ if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
+ if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
+ if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
+
+ }
+ *Nc_out = Nc;
+
+ L_max <<= 1;
+
+ /* Rescaling of L_max
+ */
+ assert(scal <= 100 && scal >= -100);
+ L_max = L_max >> (6 - scal); /* sub(6, scal) */
+
+ assert( Nc <= 120 && Nc >= 40);
+
+ /* Compute the power of the reconstructed short term residual
+ * signal dp[..]
+ */
+ L_power = 0;
+ for (k = 0; k <= 39; k++) {
+
+ register longword L_temp;
+
+ L_temp = SASR( dp[k - Nc], 3 );
+ L_power += L_temp * L_temp;
+ }
+ L_power <<= 1; /* from L_MULT */
+
+ /* Normalization of L_max and L_power
+ */
+
+ if (L_max <= 0) {
+ *bc_out = 0;
+ return;
+ }
+ if (L_max >= L_power) {
+ *bc_out = 3;
+ return;
+ }
+
+ temp = gsm_norm( L_power );
+
+ R = SASR( L_max << temp, 16 );
+ S = SASR( L_power << temp, 16 );
+
+ /* Coding of the LTP gain
+ */
+
+ /* Table 4.3a must be used to obtain the level DLB[i] for the
+ * quantization of the LTP gain b to get the coded version bc.
+ */
+ for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
+ *bc_out = bc;
+}
+
+#endif /* LTP_CUT */
+
+static void Calculation_of_the_LTP_parameters (
+ register word * d, /* [0..39] IN */
+ register word * dp, /* [-120..-1] IN */
+ word * bc_out, /* OUT */
+ word * Nc_out /* OUT */
+)
+{
+ register int k, lambda;
+ word Nc, bc;
+
+ float wt_float[40];
+ float dp_float_base[120], * dp_float = dp_float_base + 120;
+
+ longword L_max, L_power;
+ word R, S, dmax, scal;
+ register word temp;
+
+ /* Search of the optimum scaling of d[0..39].
+ */
+ dmax = 0;
+
+ for (k = 0; k <= 39; k++) {
+ temp = d[k];
+ temp = GSM_ABS( temp );
+ if (temp > dmax) dmax = temp;
+ }
+
+ temp = 0;
+ if (dmax == 0) scal = 0;
+ else {
+ assert(dmax > 0);
+ temp = gsm_norm( (longword)dmax << 16 );
+ }
+
+ if (temp > 6) scal = 0;
+ else scal = 6 - temp;
+
+ assert(scal >= 0);
+
+ /* Initialization of a working array wt
+ */
+
+ for (k = 0; k < 40; k++) wt_float[k] = SASR( d[k], scal );
+ for (k = -120; k < 0; k++) dp_float[k] = dp[k];
+
+ /* Search for the maximum cross-correlation and coding of the LTP lag
+ */
+ L_max = 0;
+ Nc = 40; /* index for the maximum cross-correlation */
+
+ for (lambda = 40; lambda <= 120; lambda += 9) {
+
+ /* Calculate L_result for l = lambda .. lambda + 9.
+ */
+ register float *lp = dp_float - lambda;
+
+ register float W;
+ register float a = lp[-8], b = lp[-7], c = lp[-6],
+ d = lp[-5], e = lp[-4], f = lp[-3],
+ g = lp[-2], h = lp[-1];
+ register float E;
+ register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
+ S5 = 0, S6 = 0, S7 = 0, S8 = 0;
+
+# undef STEP
+# define STEP(K, a, b, c, d, e, f, g, h) \
+ W = wt_float[K]; \
+ E = W * a; S8 += E; \
+ E = W * b; S7 += E; \
+ E = W * c; S6 += E; \
+ E = W * d; S5 += E; \
+ E = W * e; S4 += E; \
+ E = W * f; S3 += E; \
+ E = W * g; S2 += E; \
+ E = W * h; S1 += E; \
+ a = lp[K]; \
+ E = W * a; S0 += E
+
+# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
+# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
+# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
+# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
+# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
+# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
+# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
+# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
+
+ STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
+ STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
+
+ STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
+ STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
+
+ STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
+ STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
+
+ STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
+ STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
+
+ STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
+ STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
+
+ if (S0 > L_max) { L_max = S0; Nc = lambda; }
+ if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
+ if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
+ if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
+ if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
+ if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
+ if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
+ if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
+ if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
+ }
+ *Nc_out = Nc;
+
+ L_max <<= 1;
+
+ /* Rescaling of L_max
+ */
+ assert(scal <= 100 && scal >= -100);
+ L_max = L_max >> (6 - scal); /* sub(6, scal) */
+
+ assert( Nc <= 120 && Nc >= 40);
+
+ /* Compute the power of the reconstructed short term residual
+ * signal dp[..]
+ */
+ L_power = 0;
+ for (k = 0; k <= 39; k++) {
+
+ register longword L_temp;
+
+ L_temp = SASR( dp[k - Nc], 3 );
+ L_power += L_temp * L_temp;
+ }
+ L_power <<= 1; /* from L_MULT */
+
+ /* Normalization of L_max and L_power
+ */
+
+ if (L_max <= 0) {
+ *bc_out = 0;
+ return;
+ }
+ if (L_max >= L_power) {
+ *bc_out = 3;
+ return;
+ }
+
+ temp = gsm_norm( L_power );
+
+ R = SASR( L_max << temp, 16 );
+ S = SASR( L_power << temp, 16 );
+
+ /* Coding of the LTP gain
+ */
+
+ /* Table 4.3a must be used to obtain the level DLB[i] for the
+ * quantization of the LTP gain b to get the coded version bc.
+ */
+ for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
+ *bc_out = bc;
+}
+
+#ifdef FAST
+#ifdef LTP_CUT
+
+static void Cut_Fast_Calculation_of_the_LTP_parameters (
+ struct gsm_state * st, /* IN */
+ register word * d, /* [0..39] IN */
+ register word * dp, /* [-120..-1] IN */
+ word * bc_out, /* OUT */
+ word * Nc_out /* OUT */
+)
+{
+ register int k, lambda;
+ register float wt_float;
+ word Nc, bc;
+ word wt_max, best_k, ltp_cut;
+
+ float dp_float_base[120], * dp_float = dp_float_base + 120;
+
+ register float L_result, L_max, L_power;
+
+ wt_max = 0;
+
+ for (k = 0; k < 40; ++k) {
+ if ( d[k] > wt_max) wt_max = d[best_k = k];
+ else if (-d[k] > wt_max) wt_max = -d[best_k = k];
+ }
+
+ assert(wt_max >= 0);
+ wt_float = (float)wt_max;
+
+ for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k];
+
+ /* Search for the maximum cross-correlation and coding of the LTP lag
+ */
+ L_max = 0;
+ Nc = 40; /* index for the maximum cross-correlation */
+
+ for (lambda = 40; lambda <= 120; lambda++) {
+ L_result = wt_float * dp_float[best_k - lambda];
+ if (L_result > L_max) {
+ Nc = lambda;
+ L_max = L_result;
+ }
+ }
+
+ *Nc_out = Nc;
+ if (L_max <= 0.) {
+ *bc_out = 0;
+ return;
+ }
+
+ /* Compute the power of the reconstructed short term residual
+ * signal dp[..]
+ */
+ dp_float -= Nc;
+ L_power = 0;
+ for (k = 0; k < 40; ++k) {
+ register float f = dp_float[k];
+ L_power += f * f;
+ }
+
+ if (L_max >= L_power) {
+ *bc_out = 3;
+ return;
+ }
+
+ /* Coding of the LTP gain
+ * Table 4.3a must be used to obtain the level DLB[i] for the
+ * quantization of the LTP gain b to get the coded version bc.
+ */
+ lambda = L_max / L_power * 32768.;
+ for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break;
+ *bc_out = bc;
+}
+
+#endif /* LTP_CUT */
+
+static void Fast_Calculation_of_the_LTP_parameters (
+ register word * d, /* [0..39] IN */
+ register word * dp, /* [-120..-1] IN */
+ word * bc_out, /* OUT */
+ word * Nc_out /* OUT */
+)
+{
+ register int k, lambda;
+ word Nc, bc;
+
+ float wt_float[40];
+ float dp_float_base[120], * dp_float = dp_float_base + 120;
+
+ register float L_max, L_power;
+
+ for (k = 0; k < 40; ++k) wt_float[k] = (float)d[k];
+ for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k];
+
+ /* Search for the maximum cross-correlation and coding of the LTP lag
+ */
+ L_max = 0;
+ Nc = 40; /* index for the maximum cross-correlation */
+
+ for (lambda = 40; lambda <= 120; lambda += 9) {
+
+ /* Calculate L_result for l = lambda .. lambda + 9.
+ */
+ register float *lp = dp_float - lambda;
+
+ register float W;
+ register float a = lp[-8], b = lp[-7], c = lp[-6],
+ d = lp[-5], e = lp[-4], f = lp[-3],
+ g = lp[-2], h = lp[-1];
+ register float E;
+ register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
+ S5 = 0, S6 = 0, S7 = 0, S8 = 0;
+
+# undef STEP
+# define STEP(K, a, b, c, d, e, f, g, h) \
+ W = wt_float[K]; \
+ E = W * a; S8 += E; \
+ E = W * b; S7 += E; \
+ E = W * c; S6 += E; \
+ E = W * d; S5 += E; \
+ E = W * e; S4 += E; \
+ E = W * f; S3 += E; \
+ E = W * g; S2 += E; \
+ E = W * h; S1 += E; \
+ a = lp[K]; \
+ E = W * a; S0 += E
+
+# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
+# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
+# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
+# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
+# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
+# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
+# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
+# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
+
+ STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
+ STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
+
+ STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
+ STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
+
+ STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
+ STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
+
+ STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
+ STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
+
+ STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
+ STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
+
+ if (S0 > L_max) { L_max = S0; Nc = lambda; }
+ if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
+ if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
+ if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
+ if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
+ if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
+ if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
+ if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
+ if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
+ }
+ *Nc_out = Nc;
+
+ if (L_max <= 0.) {
+ *bc_out = 0;
+ return;
+ }
+
+ /* Compute the power of the reconstructed short term residual
+ * signal dp[..]
+ */
+ dp_float -= Nc;
+ L_power = 0;
+ for (k = 0; k < 40; ++k) {
+ register float f = dp_float[k];
+ L_power += f * f;
+ }
+
+ if (L_max >= L_power) {
+ *bc_out = 3;
+ return;
+ }
+
+ /* Coding of the LTP gain
+ * Table 4.3a must be used to obtain the level DLB[i] for the
+ * quantization of the LTP gain b to get the coded version bc.
+ */
+ lambda = L_max / L_power * 32768.;
+ for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break;
+ *bc_out = bc;
+}
+
+#endif /* FAST */
+#endif /* USE_FLOAT_MUL */
+
+
+/* 4.2.12 */
+
+static void Long_term_analysis_filtering (
+ word bc, /* IN */
+ word Nc, /* IN */
+ register word * dp, /* previous d [-120..-1] IN */
+ register word * d, /* d [0..39] IN */
+ register word * dpp, /* estimate [0..39] OUT */
+ register word * e /* long term res. signal [0..39] OUT */
+)
+/*
+ * In this part, we have to decode the bc parameter to compute
+ * the samples of the estimate dpp[0..39]. The decoding of bc needs the
+ * use of table 4.3b. The long term residual signal e[0..39]
+ * is then calculated to be fed to the RPE encoding section.
+ */
+{
+ register int k;
+ register longword ltmp;
+
+# undef STEP
+# define STEP(BP) \
+ for (k = 0; k <= 39; k++) { \
+ dpp[k] = GSM_MULT_R( BP, dp[k - Nc]); \
+ e[k] = GSM_SUB( d[k], dpp[k] ); \
+ }
+
+ switch (bc) {
+ case 0: STEP( 3277 ); break;
+ case 1: STEP( 11469 ); break;
+ case 2: STEP( 21299 ); break;
+ case 3: STEP( 32767 ); break;
+ }
+}
+
+void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */
+
+ struct gsm_state * S,
+
+ word * d, /* [0..39] residual signal IN */
+ word * dp, /* [-120..-1] d' IN */
+
+ word * e, /* [0..39] OUT */
+ word * dpp, /* [0..39] OUT */
+ word * Nc, /* correlation lag OUT */
+ word * bc /* gain factor OUT */
+)
+{
+ (void)S; /* Denotes intentionally unused */
+
+ assert( d ); assert( dp ); assert( e );
+ assert( dpp); assert( Nc ); assert( bc );
+
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+ if (S->fast)
+#if defined (LTP_CUT)
+ if (S->ltp_cut)
+ Cut_Fast_Calculation_of_the_LTP_parameters(S,
+ d, dp, bc, Nc);
+ else
+#endif /* LTP_CUT */
+ Fast_Calculation_of_the_LTP_parameters(d, dp, bc, Nc );
+ else
+#endif /* FAST & USE_FLOAT_MUL */
+#ifdef LTP_CUT
+ if (S->ltp_cut)
+ Cut_Calculation_of_the_LTP_parameters(S, d, dp, bc, Nc);
+ else
+#endif
+ Calculation_of_the_LTP_parameters(d, dp, bc, Nc);
+
+ Long_term_analysis_filtering( *bc, *Nc, dp, d, dpp, e );
+}
+
+/* 4.3.2 */
+void Gsm_Long_Term_Synthesis_Filtering (
+ struct gsm_state * S,
+
+ word Ncr,
+ word bcr,
+ register word * erp, /* [0..39] IN */
+ register word * drp /* [-120..-1] IN, [-120..40] OUT */
+)
+/*
+ * This procedure uses the bcr and Ncr parameter to realize the
+ * long term synthesis filtering. The decoding of bcr needs
+ * table 4.3b.
+ */
+{
+ register longword ltmp; /* for ADD */
+ register int k;
+ word brp, drpp, Nr;
+
+ /* Check the limits of Nr.
+ */
+ Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr;
+ S->nrp = Nr;
+ assert(Nr >= 40 && Nr <= 120);
+
+ /* Decoding of the LTP gain bcr
+ */
+ brp = gsm_QLB[ bcr ];
+
+ /* Computation of the reconstructed short term residual
+ * signal drp[0..39]
+ */
+ assert(brp != MIN_WORD);
+
+ for (k = 0; k <= 39; k++) {
+ drpp = GSM_MULT_R( brp, drp[ k - Nr ] );
+ drp[k] = GSM_ADD( erp[k], drpp );
+ }
+
+ /*
+ * Update of the reconstructed short term residual signal
+ * drp[ -1..-120 ]
+ */
+
+ for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ];
+}
diff --git a/src/libgsm/lpc.c b/src/libgsm/lpc.c
new file mode 100644
index 0000000..67249b7
--- /dev/null
+++ b/src/libgsm/lpc.c
@@ -0,0 +1,339 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/lpc.c,v 1.2 2007/11/04 16:32:36 robs Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/*
+ * 4.2.4 .. 4.2.7 LPC ANALYSIS SECTION
+ */
+
+/* 4.2.4 */
+
+
+static void Autocorrelation (
+ word * s, /* [0..159] IN/OUT */
+ longword * L_ACF) /* [0..8] OUT */
+/*
+ * The goal is to compute the array L_ACF[k]. The signal s[i] must
+ * be scaled in order to avoid an overflow situation.
+ */
+{
+ register int k, i;
+
+ word temp, smax, scalauto;
+
+#ifdef USE_FLOAT_MUL
+ float float_s[160];
+#endif
+
+ /* Dynamic scaling of the array s[0..159]
+ */
+
+ /* Search for the maximum.
+ */
+ smax = 0;
+ for (k = 0; k <= 159; k++) {
+ temp = GSM_ABS( s[k] );
+ if (temp > smax) smax = temp;
+ }
+
+ /* Computation of the scaling factor.
+ */
+ if (smax == 0) scalauto = 0;
+ else {
+ assert(smax > 0);
+ scalauto = 4 - gsm_norm( (longword)smax << 16 );/* sub(4,..) */
+ }
+
+ /* Scaling of the array s[0...159]
+ */
+
+ if (scalauto > 0) {
+
+# ifdef USE_FLOAT_MUL
+# define SCALE(n) \
+ case n: for (k = 0; k <= 159; k++) \
+ float_s[k] = (float) \
+ (s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\
+ break;
+# else
+# define SCALE(n) \
+ case n: for (k = 0; k <= 159; k++) \
+ s[k] = GSM_MULT_R( s[k], 16384 >> (n-1) );\
+ break;
+# endif /* USE_FLOAT_MUL */
+
+ switch (scalauto) {
+ SCALE(1)
+ SCALE(2)
+ SCALE(3)
+ SCALE(4)
+ }
+# undef SCALE
+ }
+# ifdef USE_FLOAT_MUL
+ else for (k = 0; k <= 159; k++) float_s[k] = (float) s[k];
+# endif
+
+ /* Compute the L_ACF[..].
+ */
+ {
+# ifdef USE_FLOAT_MUL
+ register float * sp = float_s;
+ register float sl = *sp;
+
+# define STEP(k) L_ACF[k] += (longword)(sl * sp[ -(k) ]);
+# else
+ word * sp = s;
+ word sl = *sp;
+
+# define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]);
+# endif
+
+# define NEXTI sl = *++sp
+
+
+ for (k = 9; k--; L_ACF[k] = 0) ;
+
+ STEP (0);
+ NEXTI;
+ STEP(0); STEP(1);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6);
+ NEXTI;
+ STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); STEP(7);
+
+ for (i = 8; i <= 159; i++) {
+
+ NEXTI;
+
+ STEP(0);
+ STEP(1); STEP(2); STEP(3); STEP(4);
+ STEP(5); STEP(6); STEP(7); STEP(8);
+ }
+
+ for (k = 9; k--; L_ACF[k] <<= 1) ;
+
+ }
+ /* Rescaling of the array s[0..159]
+ */
+ if (scalauto > 0) {
+ assert(scalauto <= 4);
+ for (k = 160; k--; *s++ <<= scalauto) ;
+ }
+}
+
+#if defined(USE_FLOAT_MUL) && defined(FAST)
+
+static void Fast_Autocorrelation (
+ word * s, /* [0..159] IN/OUT */
+ longword * L_ACF) /* [0..8] OUT */
+{
+ register int k, i;
+ float f_L_ACF[9];
+ float scale;
+
+ float s_f[160];
+ register float *sf = s_f;
+
+ for (i = 0; i < 160; ++i) sf[i] = s[i];
+ for (k = 0; k <= 8; k++) {
+ register float L_temp2 = 0;
+ register float *sfl = sf - k;
+ for (i = k; i < 160; ++i) L_temp2 += sf[i] * sfl[i];
+ f_L_ACF[k] = L_temp2;
+ }
+ scale = MAX_LONGWORD / f_L_ACF[0];
+
+ for (k = 0; k <= 8; k++) {
+ L_ACF[k] = f_L_ACF[k] * scale;
+ }
+}
+#endif /* defined (USE_FLOAT_MUL) && defined (FAST) */
+
+/* 4.2.5 */
+
+static void Reflection_coefficients (
+ longword * L_ACF, /* 0...8 IN */
+ register word * r /* 0...7 OUT */
+)
+{
+ register int i, m, n;
+ register word temp;
+ register longword ltmp;
+ word ACF[9]; /* 0..8 */
+ word P[ 9]; /* 0..8 */
+ word K[ 9]; /* 2..8 */
+
+ /* Schur recursion with 16 bits arithmetic.
+ */
+
+ if (L_ACF[0] == 0) {
+ for (i = 8; i--; *r++ = 0) ;
+ return;
+ }
+
+ assert( L_ACF[0] != 0 );
+ temp = gsm_norm( L_ACF[0] );
+
+ assert(temp >= 0 && temp < 32);
+
+ /* ? overflow ? */
+ for (i = 0; i <= 8; i++) ACF[i] = SASR( L_ACF[i] << temp, 16 );
+
+ /* Initialize array P[..] and K[..] for the recursion.
+ */
+
+ for (i = 1; i <= 7; i++) K[ i ] = ACF[ i ];
+ for (i = 0; i <= 8; i++) P[ i ] = ACF[ i ];
+
+ /* Compute reflection coefficients
+ */
+ for (n = 1; n <= 8; n++, r++) {
+
+ temp = P[1];
+ temp = GSM_ABS(temp);
+ if (P[0] < temp) {
+ for (i = n; i <= 8; i++) *r++ = 0;
+ return;
+ }
+
+ *r = gsm_div( temp, P[0] );
+
+ assert(*r >= 0);
+ if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */
+ assert (*r != MIN_WORD);
+ if (n == 8) return;
+
+ /* Schur recursion
+ */
+ temp = GSM_MULT_R( P[1], *r );
+ P[0] = GSM_ADD( P[0], temp );
+
+ for (m = 1; m <= 8 - n; m++) {
+ temp = GSM_MULT_R( K[ m ], *r );
+ P[m] = GSM_ADD( P[ m+1 ], temp );
+
+ temp = GSM_MULT_R( P[ m+1 ], *r );
+ K[m] = GSM_ADD( K[ m ], temp );
+ }
+ }
+}
+
+/* 4.2.6 */
+
+static void Transformation_to_Log_Area_Ratios (
+ register word * r /* 0..7 IN/OUT */
+)
+/*
+ * The following scaling for r[..] and LAR[..] has been used:
+ *
+ * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1.
+ * LAR[..] = integer( real_LAR[..] * 16384 );
+ * with -1.625 <= real_LAR <= 1.625
+ */
+{
+ register word temp;
+ register int i;
+
+
+ /* Computation of the LAR[0..7] from the r[0..7]
+ */
+ for (i = 1; i <= 8; i++, r++) {
+
+ temp = *r;
+ temp = GSM_ABS(temp);
+ assert(temp >= 0);
+
+ if (temp < 22118) {
+ temp >>= 1;
+ } else if (temp < 31130) {
+ assert( temp >= 11059 );
+ temp -= 11059;
+ } else {
+ assert( temp >= 26112 );
+ temp -= 26112;
+ temp <<= 2;
+ }
+
+ *r = *r < 0 ? -temp : temp;
+ assert( *r != MIN_WORD );
+ }
+}
+
+/* 4.2.7 */
+
+static void Quantization_and_coding (
+ register word * LAR /* [0..7] IN/OUT */
+)
+{
+ register word temp;
+ longword ltmp;
+
+
+ /* This procedure needs four tables; the following equations
+ * give the optimum scaling for the constants:
+ *
+ * A[0..7] = integer( real_A[0..7] * 1024 )
+ * B[0..7] = integer( real_B[0..7] * 512 )
+ * MAC[0..7] = maximum of the LARc[0..7]
+ * MIC[0..7] = minimum of the LARc[0..7]
+ */
+
+# undef STEP
+# define STEP( A, B, MAC, MIC ) \
+ temp = GSM_MULT( A, *LAR ); \
+ temp = GSM_ADD( temp, B ); \
+ temp = GSM_ADD( temp, 256 ); \
+ temp = SASR( temp, 9 ); \
+ *LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \
+ LAR++;
+
+ STEP( 20480, 0, 31, -32 );
+ STEP( 20480, 0, 31, -32 );
+ STEP( 20480, 2048, 15, -16 );
+ STEP( 20480, -2560, 15, -16 );
+
+ STEP( 13964, 94, 7, -8 );
+ STEP( 15360, -1792, 7, -8 );
+ STEP( 8534, -341, 3, -4 );
+ STEP( 9036, -1144, 3, -4 );
+
+# undef STEP
+}
+
+void Gsm_LPC_Analysis (
+ struct gsm_state *S,
+ word * s, /* 0..159 signals IN/OUT */
+ word * LARc) /* 0..7 LARc's OUT */
+{
+ longword L_ACF[9];
+ (void)S; /* Denotes intentionally unused */
+
+#if defined(USE_FLOAT_MUL) && defined(FAST)
+ if (S->fast) Fast_Autocorrelation (s, L_ACF );
+ else
+#endif
+ Autocorrelation (s, L_ACF );
+ Reflection_coefficients (L_ACF, LARc );
+ Transformation_to_Log_Area_Ratios (LARc);
+ Quantization_and_coding (LARc);
+}
diff --git a/src/libgsm/preprocess.c b/src/libgsm/preprocess.c
new file mode 100644
index 0000000..7854777
--- /dev/null
+++ b/src/libgsm/preprocess.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/preprocess.c,v 1.1 2007/09/06 16:50:55 cbagwell Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION
+ *
+ * After A-law to linear conversion (or directly from the
+ * Ato D converter) the following scaling is assumed for
+ * input to the RPE-LTP algorithm:
+ *
+ * in: 0.1.....................12
+ * S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.*
+ *
+ * Where S is the sign bit, v a valid bit, and * a "don't care" bit.
+ * The original signal is called sop[..]
+ *
+ * out: 0.1................... 12
+ * S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0
+ */
+
+
+void Gsm_Preprocess (
+ struct gsm_state * S,
+ word * s,
+ word * so ) /* [0..159] IN/OUT */
+{
+
+ word z1 = S->z1;
+ longword L_z2 = S->L_z2;
+ word mp = S->mp;
+
+ word s1;
+ longword L_s2;
+
+ longword L_temp;
+
+ word msp, lsp;
+ word SO;
+
+ longword ltmp; /* for ADD */
+ ulongword utmp; /* for L_ADD */
+
+ register int k = 160;
+
+ while (k--) {
+
+ /* 4.2.1 Downscaling of the input signal
+ */
+ SO = SASR( *s, 3 ) << 2;
+ s++;
+
+ assert (SO >= -0x4000); /* downscaled by */
+ assert (SO <= 0x3FFC); /* previous routine. */
+
+
+ /* 4.2.2 Offset compensation
+ *
+ * This part implements a high-pass filter and requires extended
+ * arithmetic precision for the recursive part of this filter.
+ * The input of this procedure is the array so[0...159] and the
+ * output the array sof[ 0...159 ].
+ */
+ /* Compute the non-recursive part
+ */
+
+ s1 = SO - z1; /* s1 = gsm_sub( *so, z1 ); */
+ z1 = SO;
+
+ assert(s1 != MIN_WORD);
+
+ /* Compute the recursive part
+ */
+ L_s2 = s1;
+ L_s2 <<= 15;
+
+ /* Execution of a 31 bv 16 bits multiplication
+ */
+
+ msp = SASR( L_z2, 15 );
+ lsp = L_z2-((longword)msp<<15); /* gsm_L_sub(L_z2,(msp<<15)); */
+
+ L_s2 += GSM_MULT_R( lsp, 32735 );
+ L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/
+ L_z2 = GSM_L_ADD( L_temp, L_s2 );
+
+ /* Compute sof[k] with rounding
+ */
+ L_temp = GSM_L_ADD( L_z2, 16384 );
+
+ /* 4.2.3 Preemphasis
+ */
+
+ msp = GSM_MULT_R( mp, -28180 );
+ mp = SASR( L_temp, 15 );
+ *so++ = GSM_ADD( mp, msp );
+ }
+
+ S->z1 = z1;
+ S->L_z2 = L_z2;
+ S->mp = mp;
+}
diff --git a/src/libgsm/private.h b/src/libgsm/private.h
new file mode 100644
index 0000000..77372df
--- /dev/null
+++ b/src/libgsm/private.h
@@ -0,0 +1,265 @@
+#include "third_party/sox/src/libgsm/aliases.h"
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/*$Header: /cvsroot/sox/sox/libgsm/private.h,v 1.3 2008/03/21 13:34:21 robs Exp $*/
+
+#ifndef PRIVATE_H
+#define PRIVATE_H
+
+typedef short word; /* 16 bit signed int */
+typedef long longword; /* 32 bit signed int */
+
+typedef unsigned short uword; /* unsigned word */
+typedef unsigned long ulongword; /* unsigned longword */
+
+struct gsm_state {
+
+ word dp0[ 280 ];
+
+ word z1; /* preprocessing.c, Offset_com. */
+ longword L_z2; /* Offset_com. */
+ int mp; /* Preemphasis */
+
+ word u[8]; /* short_term_aly_filter.c */
+ word LARpp[2][8]; /* */
+ word j; /* */
+
+ word ltp_cut; /* long_term.c, LTP crosscorr. */
+ word nrp; /* 40 */ /* long_term.c, synthesis */
+ word v[9]; /* short_term.c, synthesis */
+ word msr; /* decoder.c, Postprocessing */
+
+ char verbose; /* only used if !NDEBUG */
+ char fast; /* only used if FAST */
+
+ char wav_fmt; /* only used if WAV49 defined */
+ unsigned char frame_index; /* odd/even chaining */
+ unsigned char frame_chain; /* half-byte to carry forward */
+};
+
+
+#define MIN_WORD (-32767 - 1)
+#define MAX_WORD 32767
+
+#define MIN_LONGWORD (-2147483647 - 1)
+#define MAX_LONGWORD 2147483647
+
+#ifdef SASR /* flag: >> is a signed arithmetic shift right */
+#undef SASR
+#define SASR(x, by) ((x) >> (by))
+#else
+#define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by))))
+#endif /* SASR */
+
+/*
+ * Prototypes from add.c
+ */
+extern word gsm_mult (word a, word b);
+extern longword gsm_L_mult (word a, word b);
+extern word gsm_mult_r (word a, word b);
+
+extern word gsm_div (word num, word denum);
+
+extern word gsm_add ( word a, word b );
+extern longword gsm_L_add ( longword a, longword b );
+
+extern word gsm_sub (word a, word b);
+extern longword gsm_L_sub (longword a, longword b);
+
+extern word gsm_abs (word a);
+
+extern word gsm_norm ( longword a );
+
+extern longword gsm_L_asl (longword a, int n);
+extern word gsm_asl (word a, int n);
+
+extern longword gsm_L_asr (longword a, int n);
+extern word gsm_asr (word a, int n);
+
+/*
+ * Inlined functions from add.h
+ */
+
+/*
+ * #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \
+ * (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15))
+ */
+#define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \
+ (SASR( ((longword)(a) * (longword)(b) + 16384), 15 ))
+
+# define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \
+ (SASR( ((longword)(a) * (longword)(b)), 15 ))
+
+# define GSM_L_MULT(a, b) /* word a, word b */ \
+ (((longword)(a) * (longword)(b)) << 1)
+
+# define GSM_L_ADD(a, b) \
+ ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \
+ : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
+ >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \
+ : ((b) <= 0 ? (a) + (b) \
+ : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
+ ? MAX_LONGWORD : (longword)utmp))
+
+/*
+ * # define GSM_ADD(a, b) \
+ * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \
+ * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
+ */
+/* Nonportable, but faster: */
+
+#define GSM_ADD(a, b) \
+ ((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
+ MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp)
+
+# define GSM_SUB(a, b) \
+ ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \
+ ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
+
+# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a))
+
+/* Use these if necessary:
+
+# define GSM_MULT_R(a, b) gsm_mult_r(a, b)
+# define GSM_MULT(a, b) gsm_mult(a, b)
+# define GSM_L_MULT(a, b) gsm_L_mult(a, b)
+
+# define GSM_L_ADD(a, b) gsm_L_add(a, b)
+# define GSM_ADD(a, b) gsm_add(a, b)
+# define GSM_SUB(a, b) gsm_sub(a, b)
+
+# define GSM_ABS(a) gsm_abs(a)
+
+*/
+
+/*
+ * More prototypes from implementations..
+ */
+extern void Gsm_Coder (
+ struct gsm_state * S,
+ word * s, /* [0..159] samples IN */
+ word * LARc, /* [0..7] LAR coefficients OUT */
+ word * Nc, /* [0..3] LTP lag OUT */
+ word * bc, /* [0..3] coded LTP gain OUT */
+ word * Mc, /* [0..3] RPE grid selection OUT */
+ word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
+ word * xMc /* [13*4] normalized RPE samples OUT */);
+
+extern void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */
+ struct gsm_state * S,
+ word * d, /* [0..39] residual signal IN */
+ word * dp, /* [-120..-1] d' IN */
+ word * e, /* [0..40] OUT */
+ word * dpp, /* [0..40] OUT */
+ word * Nc, /* correlation lag OUT */
+ word * bc /* gain factor OUT */);
+
+extern void Gsm_LPC_Analysis (
+ struct gsm_state * S,
+ word * s, /* 0..159 signals IN/OUT */
+ word * LARc); /* 0..7 LARc's OUT */
+
+extern void Gsm_Preprocess (
+ struct gsm_state * S,
+ word * s, word * so);
+
+extern void Gsm_Encoding (
+ struct gsm_state * S,
+ word * e,
+ word * ep,
+ word * xmaxc,
+ word * Mc,
+ word * xMc);
+
+extern void Gsm_Short_Term_Analysis_Filter (
+ struct gsm_state * S,
+ word * LARc, /* coded log area ratio [0..7] IN */
+ word * d /* st res. signal [0..159] IN/OUT */);
+
+extern void Gsm_Decoder (
+ struct gsm_state * S,
+ word * LARcr, /* [0..7] IN */
+ word * Ncr, /* [0..3] IN */
+ word * bcr, /* [0..3] IN */
+ word * Mcr, /* [0..3] IN */
+ word * xmaxcr, /* [0..3] IN */
+ word * xMcr, /* [0..13*4] IN */
+ word * s); /* [0..159] OUT */
+
+extern void Gsm_Decoding (
+ struct gsm_state * S,
+ word xmaxcr,
+ word Mcr,
+ word * xMcr, /* [0..12] IN */
+ word * erp); /* [0..39] OUT */
+
+extern void Gsm_Long_Term_Synthesis_Filtering (
+ struct gsm_state* S,
+ word Ncr,
+ word bcr,
+ word * erp, /* [0..39] IN */
+ word * drp); /* [-120..-1] IN, [0..40] OUT */
+
+void Gsm_RPE_Decoding (
+ struct gsm_state *S,
+ word xmaxcr,
+ word Mcr,
+ word * xMcr, /* [0..12], 3 bits IN */
+ word * erp); /* [0..39] OUT */
+
+void Gsm_RPE_Encoding (
+ struct gsm_state * S,
+ word * e, /* -5..-1][0..39][40..44 IN/OUT */
+ word * xmaxc, /* OUT */
+ word * Mc, /* OUT */
+ word * xMc); /* [0..12] OUT */
+
+extern void Gsm_Short_Term_Synthesis_Filter (
+ struct gsm_state * S,
+ word * LARcr, /* log area ratios [0..7] IN */
+ word * drp, /* received d [0...39] IN */
+ word * s); /* signal s [0..159] OUT */
+
+extern void Gsm_Update_of_reconstructed_short_time_residual_signal (
+ word * dpp, /* [0...39] IN */
+ word * ep, /* [0...39] IN */
+ word * dp); /* [-120...-1] IN/OUT */
+
+/*
+ * Tables from table.c
+ */
+#ifndef GSM_TABLE_C
+
+extern word gsm_A[8], gsm_B[8], gsm_MIC[8], gsm_MAC[8];
+extern word gsm_INVA[8];
+extern word gsm_DLB[4], gsm_QLB[4];
+extern word gsm_H[11];
+extern word gsm_NRFAC[8];
+extern word gsm_FAC[8];
+
+#endif /* GSM_TABLE_C */
+
+/*
+ * Debugging
+ */
+#ifdef NDEBUG
+
+# define gsm_debug_words(a, b, c, d) /* nil */
+# define gsm_debug_longwords(a, b, c, d) /* nil */
+# define gsm_debug_word(a, b) /* nil */
+# define gsm_debug_longword(a, b) /* nil */
+
+#else /* !NDEBUG => DEBUG */
+
+ extern void gsm_debug_words (char * name, int, int, word *);
+ extern void gsm_debug_longwords (char * name, int, int, longword *);
+ extern void gsm_debug_longword (char * name, longword);
+ extern void gsm_debug_word (char * name, word);
+
+#endif /* !NDEBUG */
+
+#endif /* PRIVATE_H */
diff --git a/src/libgsm/rpe.c b/src/libgsm/rpe.c
new file mode 100644
index 0000000..cb5415e
--- /dev/null
+++ b/src/libgsm/rpe.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/rpe.c,v 1.2 2007/11/04 16:32:36 robs Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/* 4.2.13 .. 4.2.17 RPE ENCODING SECTION
+ */
+
+/* 4.2.13 */
+
+static void Weighting_filter (
+ register word * e, /* signal [-5..0.39.44] IN */
+ word * x /* signal [0..39] OUT */
+)
+/*
+ * The coefficients of the weighting filter are stored in a table
+ * (see table 4.4). The following scaling is used:
+ *
+ * H[0..10] = integer( real_H[ 0..10] * 8192 );
+ */
+{
+ /* word wt[ 50 ]; */
+
+ register longword L_result;
+ register int k /* , i */ ;
+
+ /* Initialization of a temporary working array wt[0...49]
+ */
+
+ /* for (k = 0; k <= 4; k++) wt[k] = 0;
+ * for (k = 5; k <= 44; k++) wt[k] = *e++;
+ * for (k = 45; k <= 49; k++) wt[k] = 0;
+ *
+ * (e[-5..-1] and e[40..44] are allocated by the caller,
+ * are initially zero and are not written anywhere.)
+ */
+ e -= 5;
+
+ /* Compute the signal x[0..39]
+ */
+ for (k = 0; k <= 39; k++) {
+
+ L_result = 8192 >> 1;
+
+ /* for (i = 0; i <= 10; i++) {
+ * L_temp = GSM_L_MULT( wt[k+i], gsm_H[i] );
+ * L_result = GSM_L_ADD( L_result, L_temp );
+ * }
+ */
+
+#undef STEP
+#define STEP( i, H ) (e[ k + i ] * (longword)H)
+
+ /* Every one of these multiplications is done twice --
+ * but I don't see an elegant way to optimize this.
+ * Do you?
+ */
+
+#ifdef STUPID_COMPILER
+ L_result += STEP( 0, -134 ) ;
+ L_result += STEP( 1, -374 ) ;
+ /* + STEP( 2, 0 ) */
+ L_result += STEP( 3, 2054 ) ;
+ L_result += STEP( 4, 5741 ) ;
+ L_result += STEP( 5, 8192 ) ;
+ L_result += STEP( 6, 5741 ) ;
+ L_result += STEP( 7, 2054 ) ;
+ /* + STEP( 8, 0 ) */
+ L_result += STEP( 9, -374 ) ;
+ L_result += STEP( 10, -134 ) ;
+#else
+ L_result +=
+ STEP( 0, -134 )
+ + STEP( 1, -374 )
+ /* + STEP( 2, 0 ) */
+ + STEP( 3, 2054 )
+ + STEP( 4, 5741 )
+ + STEP( 5, 8192 )
+ + STEP( 6, 5741 )
+ + STEP( 7, 2054 )
+ /* + STEP( 8, 0 ) */
+ + STEP( 9, -374 )
+ + STEP(10, -134 )
+ ;
+#endif
+
+ /* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x2) *)
+ * L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x4) *)
+ *
+ * x[k] = SASR( L_result, 16 );
+ */
+
+ /* 2 adds vs. >>16 => 14, minus one shift to compensate for
+ * those we lost when replacing L_MULT by '*'.
+ */
+
+ L_result = SASR( L_result, 13 );
+ x[k] = ( L_result < MIN_WORD ? MIN_WORD
+ : (L_result > MAX_WORD ? MAX_WORD : L_result ));
+ }
+}
+
+/* 4.2.14 */
+
+static void RPE_grid_selection (
+ word * x, /* [0..39] IN */
+ word * xM, /* [0..12] OUT */
+ word * Mc_out /* OUT */
+)
+/*
+ * The signal x[0..39] is used to select the RPE grid which is
+ * represented by Mc.
+ */
+{
+ /* register word temp1; */
+ register int /* m, */ i;
+ register longword L_result, L_temp;
+ longword EM; /* xxx should be L_EM? */
+ word Mc;
+
+ longword L_common_0_3;
+
+ EM = 0;
+ Mc = 0;
+
+ /* for (m = 0; m <= 3; m++) {
+ * L_result = 0;
+ *
+ *
+ * for (i = 0; i <= 12; i++) {
+ *
+ * temp1 = SASR( x[m + 3*i], 2 );
+ *
+ * assert(temp1 != MIN_WORD);
+ *
+ * L_temp = GSM_L_MULT( temp1, temp1 );
+ * L_result = GSM_L_ADD( L_temp, L_result );
+ * }
+ *
+ * if (L_result > EM) {
+ * Mc = m;
+ * EM = L_result;
+ * }
+ * }
+ */
+
+#undef STEP
+#define STEP( m, i ) L_temp = SASR( x[m + 3 * i], 2 ); \
+ L_result += L_temp * L_temp;
+
+ /* common part of 0 and 3 */
+
+ L_result = 0;
+ STEP( 0, 1 ); STEP( 0, 2 ); STEP( 0, 3 ); STEP( 0, 4 );
+ STEP( 0, 5 ); STEP( 0, 6 ); STEP( 0, 7 ); STEP( 0, 8 );
+ STEP( 0, 9 ); STEP( 0, 10); STEP( 0, 11); STEP( 0, 12);
+ L_common_0_3 = L_result;
+
+ /* i = 0 */
+
+ STEP( 0, 0 );
+ L_result <<= 1; /* implicit in L_MULT */
+ EM = L_result;
+
+ /* i = 1 */
+
+ L_result = 0;
+ STEP( 1, 0 );
+ STEP( 1, 1 ); STEP( 1, 2 ); STEP( 1, 3 ); STEP( 1, 4 );
+ STEP( 1, 5 ); STEP( 1, 6 ); STEP( 1, 7 ); STEP( 1, 8 );
+ STEP( 1, 9 ); STEP( 1, 10); STEP( 1, 11); STEP( 1, 12);
+ L_result <<= 1;
+ if (L_result > EM) {
+ Mc = 1;
+ EM = L_result;
+ }
+
+ /* i = 2 */
+
+ L_result = 0;
+ STEP( 2, 0 );
+ STEP( 2, 1 ); STEP( 2, 2 ); STEP( 2, 3 ); STEP( 2, 4 );
+ STEP( 2, 5 ); STEP( 2, 6 ); STEP( 2, 7 ); STEP( 2, 8 );
+ STEP( 2, 9 ); STEP( 2, 10); STEP( 2, 11); STEP( 2, 12);
+ L_result <<= 1;
+ if (L_result > EM) {
+ Mc = 2;
+ EM = L_result;
+ }
+
+ /* i = 3 */
+
+ L_result = L_common_0_3;
+ STEP( 3, 12 );
+ L_result <<= 1;
+ if (L_result > EM) {
+ Mc = 3;
+ EM = L_result;
+ }
+
+ /**/
+
+ /* Down-sampling by a factor 3 to get the selected xM[0..12]
+ * RPE sequence.
+ */
+ for (i = 0; i <= 12; i ++) xM[i] = x[Mc + 3*i];
+ *Mc_out = Mc;
+}
+
+/* 4.12.15 */
+
+static void APCM_quantization_xmaxc_to_exp_mant (
+ word xmaxc, /* IN */
+ word * exp_out, /* OUT */
+ word * mant_out ) /* OUT */
+{
+ word exp, mant;
+
+ /* Compute exponent and mantissa of the decoded version of xmaxc
+ */
+
+ exp = 0;
+ if (xmaxc > 15) exp = SASR(xmaxc, 3) - 1;
+ mant = xmaxc - (exp << 3);
+
+ if (mant == 0) {
+ exp = -4;
+ mant = 7;
+ }
+ else {
+ while (mant <= 7) {
+ mant = mant << 1 | 1;
+ exp--;
+ }
+ mant -= 8;
+ }
+
+ assert( exp >= -4 && exp <= 6 );
+ assert( mant >= 0 && mant <= 7 );
+
+ *exp_out = exp;
+ *mant_out = mant;
+}
+
+static void APCM_quantization (
+ word * xM, /* [0..12] IN */
+
+ word * xMc, /* [0..12] OUT */
+ word * mant_out, /* OUT */
+ word * exp_out, /* OUT */
+ word * xmaxc_out /* OUT */
+)
+{
+ int i, itest;
+
+ word xmax, xmaxc, temp, temp1, temp2;
+ word exp, mant;
+
+
+ /* Find the maximum absolute value xmax of xM[0..12].
+ */
+
+ xmax = 0;
+ for (i = 0; i <= 12; i++) {
+ temp = xM[i];
+ temp = GSM_ABS(temp);
+ if (temp > xmax) xmax = temp;
+ }
+
+ /* Qantizing and coding of xmax to get xmaxc.
+ */
+
+ exp = 0;
+ temp = SASR( xmax, 9 );
+ itest = 0;
+
+ for (i = 0; i <= 5; i++) {
+
+ itest |= (temp <= 0);
+ temp = SASR( temp, 1 );
+
+ assert(exp <= 5);
+ if (itest == 0) exp++; /* exp = add (exp, 1) */
+ }
+
+ assert(exp <= 6 && exp >= 0);
+ temp = exp + 5;
+
+ assert(temp <= 11 && temp >= 0);
+ xmaxc = gsm_add( SASR(xmax, temp), exp << 3 );
+
+ /* Quantizing and coding of the xM[0..12] RPE sequence
+ * to get the xMc[0..12]
+ */
+
+ APCM_quantization_xmaxc_to_exp_mant( xmaxc, &exp, &mant );
+
+ /* This computation uses the fact that the decoded version of xmaxc
+ * can be calculated by using the exponent and the mantissa part of
+ * xmaxc (logarithmic table).
+ * So, this method avoids any division and uses only a scaling
+ * of the RPE samples by a function of the exponent. A direct
+ * multiplication by the inverse of the mantissa (NRFAC[0..7]
+ * found in table 4.5) gives the 3 bit coded version xMc[0..12]
+ * of the RPE samples.
+ */
+
+
+ /* Direct computation of xMc[0..12] using table 4.5
+ */
+
+ assert( exp <= 4096 && exp >= -4096);
+ assert( mant >= 0 && mant <= 7 );
+
+ temp1 = 6 - exp; /* normalization by the exponent */
+ temp2 = gsm_NRFAC[ mant ]; /* inverse mantissa */
+
+ for (i = 0; i <= 12; i++) {
+
+ assert(temp1 >= 0 && temp1 < 16);
+
+ temp = xM[i] << temp1;
+ temp = GSM_MULT( temp, temp2 );
+ temp = SASR(temp, 12);
+ xMc[i] = temp + 4; /* see note below */
+ }
+
+ /* NOTE: This equation is used to make all the xMc[i] positive.
+ */
+
+ *mant_out = mant;
+ *exp_out = exp;
+ *xmaxc_out = xmaxc;
+}
+
+/* 4.2.16 */
+
+static void APCM_inverse_quantization (
+ register word * xMc, /* [0..12] IN */
+ word mant,
+ word exp,
+ register word * xMp) /* [0..12] OUT */
+/*
+ * This part is for decoding the RPE sequence of coded xMc[0..12]
+ * samples to obtain the xMp[0..12] array. Table 4.6 is used to get
+ * the mantissa of xmaxc (FAC[0..7]).
+ */
+{
+ int i;
+ word temp, temp1, temp2, temp3;
+ longword ltmp;
+
+ assert( mant >= 0 && mant <= 7 );
+
+ temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */
+ temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */
+ temp3 = gsm_asl( 1, gsm_sub( temp2, 1 ));
+
+ for (i = 13; i--;) {
+
+ assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */
+
+ /* temp = gsm_sub( *xMc++ << 1, 7 ); */
+ temp = (*xMc++ << 1) - 7; /* restore sign */
+ assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */
+
+ temp <<= 12; /* 16 bit signed */
+ temp = GSM_MULT_R( temp1, temp );
+ temp = GSM_ADD( temp, temp3 );
+ *xMp++ = gsm_asr( temp, temp2 );
+ }
+}
+
+/* 4.2.17 */
+
+static void RPE_grid_positioning (
+ word Mc, /* grid position IN */
+ register word * xMp, /* [0..12] IN */
+ register word * ep /* [0..39] OUT */
+)
+/*
+ * This procedure computes the reconstructed long term residual signal
+ * ep[0..39] for the LTP analysis filter. The inputs are the Mc
+ * which is the grid position selection and the xMp[0..12] decoded
+ * RPE samples which are upsampled by a factor of 3 by inserting zero
+ * values.
+ */
+{
+ int i = 13;
+
+ assert(0 <= Mc && Mc <= 3);
+
+ switch (Mc) {
+ case 3: *ep++ = 0;
+ case 2: do {
+ *ep++ = 0;
+ case 1: *ep++ = 0;
+ case 0: *ep++ = *xMp++;
+ } while (--i);
+ }
+ while (++Mc < 4) *ep++ = 0;
+
+ /*
+
+ int i, k;
+ for (k = 0; k <= 39; k++) ep[k] = 0;
+ for (i = 0; i <= 12; i++) {
+ ep[ Mc + (3*i) ] = xMp[i];
+ }
+ */
+}
+
+/* 4.2.18 */
+
+/* This procedure adds the reconstructed long term residual signal
+ * ep[0..39] to the estimated signal dpp[0..39] from the long term
+ * analysis filter to compute the reconstructed short term residual
+ * signal dp[-40..-1]; also the reconstructed short term residual
+ * array dp[-120..-41] is updated.
+ */
+
+#if 0 /* Has been inlined in code.c */
+void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp),
+ word * dpp, /* [0...39] IN */
+ word * ep, /* [0...39] IN */
+ word * dp) /* [-120...-1] IN/OUT */
+{
+ int k;
+
+ for (k = 0; k <= 79; k++)
+ dp[ -120 + k ] = dp[ -80 + k ];
+
+ for (k = 0; k <= 39; k++)
+ dp[ -40 + k ] = gsm_add( ep[k], dpp[k] );
+}
+#endif /* Has been inlined in code.c */
+
+void Gsm_RPE_Encoding (
+
+ struct gsm_state * S,
+
+ word * e, /* -5..-1][0..39][40..44 IN/OUT */
+ word * xmaxc, /* OUT */
+ word * Mc, /* OUT */
+ word * xMc) /* [0..12] OUT */
+{
+ word x[40];
+ word xM[13], xMp[13];
+ word mant, exp;
+
+ (void)S; /* Denotes intentionally unused */
+ Weighting_filter(e, x);
+ RPE_grid_selection(x, xM, Mc);
+
+ APCM_quantization( xM, xMc, &mant, &exp, xmaxc);
+ APCM_inverse_quantization( xMc, mant, exp, xMp);
+
+ RPE_grid_positioning( *Mc, xMp, e );
+
+}
+
+void Gsm_RPE_Decoding (
+ struct gsm_state * S,
+
+ word xmaxcr,
+ word Mcr,
+ word * xMcr, /* [0..12], 3 bits IN */
+ word * erp /* [0..39] OUT */
+)
+{
+ word exp, mant;
+ word xMp[ 13 ];
+
+ (void)S; /* Denotes intentionally unused */
+ APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &exp, &mant );
+ APCM_inverse_quantization( xMcr, mant, exp, xMp );
+ RPE_grid_positioning( Mcr, xMp, erp );
+
+}
diff --git a/src/libgsm/short_term.c b/src/libgsm/short_term.c
new file mode 100644
index 0000000..062f341
--- /dev/null
+++ b/src/libgsm/short_term.c
@@ -0,0 +1,428 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/short_term.c,v 1.1 2007/09/06 16:50:56 cbagwell Exp $ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "third_party/sox/src/libgsm/private.h"
+
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/*
+ * SHORT TERM ANALYSIS FILTERING SECTION
+ */
+
+/* 4.2.8 */
+
+static void Decoding_of_the_coded_Log_Area_Ratios (
+ word * LARc, /* coded log area ratio [0..7] IN */
+ word * LARpp) /* out: decoded .. */
+{
+ register word temp1 /* , temp2 */;
+ register long ltmp; /* for GSM_ADD */
+
+ /* This procedure requires for efficient implementation
+ * two tables.
+ *
+ * INVA[1..8] = integer( (32768 * 8) / real_A[1..8])
+ * MIC[1..8] = minimum value of the LARc[1..8]
+ */
+
+ /* Compute the LARpp[1..8]
+ */
+
+ /* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) {
+ *
+ * temp1 = GSM_ADD( *LARc, *MIC ) << 10;
+ * temp2 = *B << 1;
+ * temp1 = GSM_SUB( temp1, temp2 );
+ *
+ * assert(*INVA != MIN_WORD);
+ *
+ * temp1 = GSM_MULT_R( *INVA, temp1 );
+ * *LARpp = GSM_ADD( temp1, temp1 );
+ * }
+ */
+
+#undef STEP
+#define STEP( B, MIC, INVA ) \
+ temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
+ temp1 = GSM_SUB( temp1, B << 1 ); \
+ temp1 = GSM_MULT_R( INVA, temp1 ); \
+ *LARpp++ = GSM_ADD( temp1, temp1 );
+
+ STEP( 0, -32, 13107 );
+ STEP( 0, -32, 13107 );
+ STEP( 2048, -16, 13107 );
+ STEP( -2560, -16, 13107 );
+
+ STEP( 94, -8, 19223 );
+ STEP( -1792, -8, 17476 );
+ STEP( -341, -4, 31454 );
+ STEP( -1144, -4, 29708 );
+
+ /* NOTE: the addition of *MIC is used to restore
+ * the sign of *LARc.
+ */
+}
+
+/* 4.2.9 */
+/* Computation of the quantized reflection coefficients
+ */
+
+/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8]
+ */
+
+/*
+ * Within each frame of 160 analyzed speech samples the short term
+ * analysis and synthesis filters operate with four different sets of
+ * coefficients, derived from the previous set of decoded LARs(LARpp(j-1))
+ * and the actual set of decoded LARs (LARpp(j))
+ *
+ * (Initial value: LARpp(j-1)[1..8] = 0.)
+ */
+
+static void Coefficients_0_12 (
+ register word * LARpp_j_1,
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+ register longword ltmp;
+
+ for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) {
+ *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
+ *LARp = GSM_ADD( *LARp, SASR( *LARpp_j_1, 1));
+ }
+}
+
+static void Coefficients_13_26 (
+ register word * LARpp_j_1,
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+ register longword ltmp;
+ for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
+ *LARp = GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 ));
+ }
+}
+
+static void Coefficients_27_39 (
+ register word * LARpp_j_1,
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+ register longword ltmp;
+
+ for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
+ *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
+ *LARp = GSM_ADD( *LARp, SASR( *LARpp_j, 1 ));
+ }
+}
+
+
+static void Coefficients_40_159 (
+ register word * LARpp_j,
+ register word * LARp)
+{
+ register int i;
+
+ for (i = 1; i <= 8; i++, LARp++, LARpp_j++)
+ *LARp = *LARpp_j;
+}
+
+/* 4.2.9.2 */
+
+static void LARp_to_rp (
+ register word * LARp) /* [0..7] IN/OUT */
+/*
+ * The input of this procedure is the interpolated LARp[0..7] array.
+ * The reflection coefficients, rp[i], are used in the analysis
+ * filter and in the synthesis filter.
+ */
+{
+ register int i;
+ register word temp;
+ register longword ltmp;
+
+ for (i = 1; i <= 8; i++, LARp++) {
+
+ /* temp = GSM_ABS( *LARp );
+ *
+ * if (temp < 11059) temp <<= 1;
+ * else if (temp < 20070) temp += 11059;
+ * else temp = GSM_ADD( temp >> 2, 26112 );
+ *
+ * *LARp = *LARp < 0 ? -temp : temp;
+ */
+
+ if (*LARp < 0) {
+ temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp);
+ *LARp = - ((temp < 11059) ? temp << 1
+ : ((temp < 20070) ? temp + 11059
+ : GSM_ADD( temp >> 2, 26112 )));
+ } else {
+ temp = *LARp;
+ *LARp = (temp < 11059) ? temp << 1
+ : ((temp < 20070) ? temp + 11059
+ : GSM_ADD( temp >> 2, 26112 ));
+ }
+ }
+}
+
+
+/* 4.2.10 */
+static void Short_term_analysis_filtering (
+ struct gsm_state * S,
+ register word * rp, /* [0..7] IN */
+ register int k_n, /* k_end - k_start */
+ register word * s /* [0..n-1] IN/OUT */
+)
+/*
+ * This procedure computes the short term residual signal d[..] to be fed
+ * to the RPE-LTP loop from the s[..] signal and from the local rp[..]
+ * array (quantized reflection coefficients). As the call of this
+ * procedure can be done in many ways (see the interpolation of the LAR
+ * coefficient), it is assumed that the computation begins with index
+ * k_start (for arrays d[..] and s[..]) and stops with index k_end
+ * (k_start and k_end are defined in 4.2.9.1). This procedure also
+ * needs to keep the array u[0..7] in memory for each call.
+ */
+{
+ register word * u = S->u;
+ register int i;
+ register word di, zzz, ui, sav, rpi;
+ register longword ltmp;
+
+ for (; k_n--; s++) {
+
+ di = sav = *s;
+
+ for (i = 0; i < 8; i++) { /* YYY */
+
+ ui = u[i];
+ rpi = rp[i];
+ u[i] = sav;
+
+ zzz = GSM_MULT_R(rpi, di);
+ sav = GSM_ADD( ui, zzz);
+
+ zzz = GSM_MULT_R(rpi, ui);
+ di = GSM_ADD( di, zzz );
+ }
+
+ *s = di;
+ }
+}
+
+#if defined(USE_FLOAT_MUL) && defined(FAST)
+
+static void Fast_Short_term_analysis_filtering (
+ struct gsm_state * S,
+ register word * rp, /* [0..7] IN */
+ register int k_n, /* k_end - k_start */
+ register word * s /* [0..n-1] IN/OUT */
+)
+{
+ register word * u = S->u;
+ register int i;
+
+ float uf[8],
+ rpf[8];
+
+ register float scalef = 3.0517578125e-5;
+ register float sav, di, temp;
+
+ for (i = 0; i < 8; ++i) {
+ uf[i] = u[i];
+ rpf[i] = rp[i] * scalef;
+ }
+ for (; k_n--; s++) {
+ sav = di = *s;
+ for (i = 0; i < 8; ++i) {
+ register float rpfi = rpf[i];
+ register float ufi = uf[i];
+
+ uf[i] = sav;
+ temp = rpfi * di + ufi;
+ di += rpfi * ufi;
+ sav = temp;
+ }
+ *s = di;
+ }
+ for (i = 0; i < 8; ++i) u[i] = uf[i];
+}
+#endif /* ! (defined (USE_FLOAT_MUL) && defined (FAST)) */
+
+static void Short_term_synthesis_filtering (
+ struct gsm_state * S,
+ register word * rrp, /* [0..7] IN */
+ register int k, /* k_end - k_start */
+ register word * wt, /* [0..k-1] IN */
+ register word * sr /* [0..k-1] OUT */
+)
+{
+ register word * v = S->v;
+ register int i;
+ register word sri, tmp1, tmp2;
+ register longword ltmp; /* for GSM_ADD & GSM_SUB */
+
+ while (k--) {
+ sri = *wt++;
+ for (i = 8; i--;) {
+
+ /* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) );
+ */
+ tmp1 = rrp[i];
+ tmp2 = v[i];
+ tmp2 = ( tmp1 == MIN_WORD && tmp2 == MIN_WORD
+ ? MAX_WORD
+ : 0x0FFFF & (( (longword)tmp1 * (longword)tmp2
+ + 16384) >> 15)) ;
+
+ sri = GSM_SUB( sri, tmp2 );
+
+ /* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) );
+ */
+ tmp1 = ( tmp1 == MIN_WORD && sri == MIN_WORD
+ ? MAX_WORD
+ : 0x0FFFF & (( (longword)tmp1 * (longword)sri
+ + 16384) >> 15)) ;
+
+ v[i+1] = GSM_ADD( v[i], tmp1);
+ }
+ *sr++ = v[0] = sri;
+ }
+}
+
+
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+
+static void Fast_Short_term_synthesis_filtering (
+ struct gsm_state * S,
+ register word * rrp, /* [0..7] IN */
+ register int k, /* k_end - k_start */
+ register word * wt, /* [0..k-1] IN */
+ register word * sr /* [0..k-1] OUT */
+)
+{
+ register word * v = S->v;
+ register int i;
+
+ float va[9], rrpa[8];
+ register float scalef = 3.0517578125e-5, temp;
+
+ for (i = 0; i < 8; ++i) {
+ va[i] = v[i];
+ rrpa[i] = (float)rrp[i] * scalef;
+ }
+ while (k--) {
+ register float sri = *wt++;
+ for (i = 8; i--;) {
+ sri -= rrpa[i] * va[i];
+ if (sri < -32768.) sri = -32768.;
+ else if (sri > 32767.) sri = 32767.;
+
+ temp = va[i] + rrpa[i] * sri;
+ if (temp < -32768.) temp = -32768.;
+ else if (temp > 32767.) temp = 32767.;
+ va[i+1] = temp;
+ }
+ *sr++ = va[0] = sri;
+ }
+ for (i = 0; i < 9; ++i) v[i] = va[i];
+}
+
+#endif /* defined(FAST) && defined(USE_FLOAT_MUL) */
+
+void Gsm_Short_Term_Analysis_Filter (
+
+ struct gsm_state * S,
+
+ word * LARc, /* coded log area ratio [0..7] IN */
+ word * s /* signal [0..159] IN/OUT */
+)
+{
+ word * LARpp_j = S->LARpp[ S->j ];
+ word * LARpp_j_1 = S->LARpp[ S->j ^= 1 ];
+
+ word LARp[8];
+
+#undef FILTER
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+# define FILTER (* (S->fast \
+ ? Fast_Short_term_analysis_filtering \
+ : Short_term_analysis_filtering ))
+
+#else
+# define FILTER Short_term_analysis_filtering
+#endif
+
+ Decoding_of_the_coded_Log_Area_Ratios( LARc, LARpp_j );
+
+ Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, s);
+
+ Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 14, s + 13);
+
+ Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, s + 27);
+
+ Coefficients_40_159( LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 120, s + 40);
+}
+
+void Gsm_Short_Term_Synthesis_Filter (
+ struct gsm_state * S,
+
+ word * LARcr, /* received log area ratios [0..7] IN */
+ word * wt, /* received d [0..159] IN */
+
+ word * s /* signal s [0..159] OUT */
+)
+{
+ word * LARpp_j = S->LARpp[ S->j ];
+ word * LARpp_j_1 = S->LARpp[ S->j ^=1 ];
+
+ word LARp[8];
+
+#undef FILTER
+#if defined(FAST) && defined(USE_FLOAT_MUL)
+
+# define FILTER (* (S->fast \
+ ? Fast_Short_term_synthesis_filtering \
+ : Short_term_synthesis_filtering ))
+#else
+# define FILTER Short_term_synthesis_filtering
+#endif
+
+ Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j );
+
+ Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, wt, s );
+
+ Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 14, wt + 13, s + 13 );
+
+ Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
+ LARp_to_rp( LARp );
+ FILTER( S, LARp, 13, wt + 27, s + 27 );
+
+ Coefficients_40_159( LARpp_j, LARp );
+ LARp_to_rp( LARp );
+ FILTER(S, LARp, 120, wt + 40, s + 40);
+}
diff --git a/src/libgsm/table.c b/src/libgsm/table.c
new file mode 100644
index 0000000..dfcbcc9
--- /dev/null
+++ b/src/libgsm/table.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+ * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/libgsm/table.c,v 1.1 2007/09/06 16:50:56 cbagwell Exp $ */
+
+/* Most of these tables are inlined at their point of use.
+ */
+
+/* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP
+ * CODER AND DECODER
+ *
+ * (Most of them inlined, so watch out.)
+ */
+
+#define GSM_TABLE_C
+#include "third_party/sox/src/libgsm/private.h"
+#include "third_party/sox/src/libgsm/gsm.h"
+
+/* Table 4.1 Quantization of the Log.-Area Ratios
+ */
+/* i 1 2 3 4 5 6 7 8 */
+word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036};
+word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144};
+word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 };
+word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 };
+
+
+/* Table 4.2 Tabulation of 1/A[1..8]
+ */
+word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 };
+
+
+/* Table 4.3a Decision level of the LTP gain quantizer
+ */
+/* bc 0 1 2 3 */
+word gsm_DLB[4] = { 6554, 16384, 26214, 32767 };
+
+
+/* Table 4.3b Quantization levels of the LTP gain quantizer
+ */
+/* bc 0 1 2 3 */
+word gsm_QLB[4] = { 3277, 11469, 21299, 32767 };
+
+
+/* Table 4.4 Coefficients of the weighting filter
+ */
+/* i 0 1 2 3 4 5 6 7 8 9 10 */
+word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 };
+
+
+/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax
+ */
+/* i 0 1 2 3 4 5 6 7 */
+word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 };
+
+
+/* Table 4.6 Normalized direct mantissa used to compute xM/xmax
+ */
+/* i 0 1 2 3 4 5 6 7 */
+word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };
diff --git a/src/libsox.3 b/src/libsox.3
new file mode 100644
index 0000000..1233bc7
--- /dev/null
+++ b/src/libsox.3
@@ -0,0 +1,387 @@
+'\" t
+'\" The line above instructs most `man' programs to invoke tbl
+'\"
+'\" Separate paragraphs; not the same as PP which resets indent level.
+.de SP
+.if t .sp .5
+.if n .sp
+..
+'\"
+'\" Replacement em-dash for nroff (default is too short).
+.ie n .ds m " -
+.el .ds m \(em
+'\"
+'\" Placeholder macro for if longer nroff arrow is needed.
+.ds RA \(->
+'\"
+'\" Decimal point set slightly raised
+.if t .ds d \v'-.15m'.\v'+.15m'
+.if n .ds d .
+'\"
+'\" Enclosure macro for examples
+.de EX
+.SP
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.SP
+.fi
+..
+.TH SoX 3 "February 19, 2011" "libsox" "Sound eXchange"
+.SH NAME
+libsox \- SoX, an audio file-format and effect library
+.SH SYNOPSIS
+.nf
+.B #include <sox.h>
+.P
+.B int sox_format_init(void);
+.P
+.B void sox_format_quit(void);
+.P
+.B sox_format_t sox_open_read(const char *\fIpath\fB, const sox_signalinfo_t *\fIinfo\fB, const char *\fIfiletype\fB);
+.P
+.B sox_format_t sox_open_write(sox_bool (*\fIoverwrite_permitted\fB)(const char *\fIfilename\fB), const char *\fIpath\fB, const sox_signalinfo_t *\fIinfo\fB, const char *\fIfiletype\fB, const char *\fIcomment\fB, sox_size_t \fIlength\fB, const sox_instrinfo_t *\fIinstr\fB, const sox_loopinfo_t *\fIloops\fB);
+.P
+.B sox_size_t sox_read(sox_format_t \fIft\fB, sox_ssample_t *\fIbuf\fB, sox_size_t \fIlen\fB);
+.P
+.B sox_size_t sox_write(sox_format_t \fIft\fB, sox_ssample_t *\fIbuf\fB, sox_size_t \fIlen\fB);
+.P
+.B int sox_close(sox_format_t \fIft\fB);
+.P
+.B int sox_seek(sox_format_t \fIft\fB, sox_size_t \fIoffset\fB, int \fIwhence\fB);
+.P
+.B sox_effect_handler_t const *sox_find_effect(char const *\fIname\fB);
+.P
+.B sox_effect_t *sox_create_effect(sox_effect_handler_t const *\fIeh\fB);
+.P
+.B int sox_effect_options(sox_effect_t *\fIeffp\fB, int \fIargc\fB, char * const \fIargv[]\fB);
+.P
+.B sox_effects_chain_t *sox_create_effects_chain(sox_encodinginfo_t const *\fIin_enc\fB, sox_encodinginfo_t const *\fIout_enc\fB);
+.P
+.B void sox_delete_effects_chain(sox_effects_chain_t *\fIecp\fB);
+.P
+.B int sox_add_effect(sox_effects_chaint_t *\fIchain\fB, sox_effect_t*\fIeffp\fB, sox_signalinfo_t *\fIin\fB, sox_signalinfo_t const *\fIout\fB);
+.P
+.B cc \fIfile.c\fB -o \fIfile \fB-lsox
+.fi
+.SH DESCRIPTION
+.I libsox
+is a library of sound sample file format readers/writers and sound
+effects processors. It is mainly developed for use by SoX but is
+useful for any sound application.
+.P
+\fBsox_format_init\fR function performs some required initialization
+related to all file format handlers. If compiled with dynamic
+library support then this will detect and initialize all external
+libraries. This should be called before any other file operations
+are performed.
+.P
+\fBsox_format_quit\fR function performs some required cleanup
+related to all file format handlers.
+.P
+\fBsox_open_input\fR function opens the file for reading whose name is
+the string pointed to by \fIpath\fR and associates an sox_format_t with it. If
+\fIinfo\fR is non-NULL then it will be used to specify the data format
+of the input file. This is normally only needed for headerless audio
+files since the information is not stored in the file. If
+\fIfiletype\fR is non-NULL then it will be used to specify the file
+type. If this is not specified then the file type is attempted to be
+derived by looking at the file header and/or the filename extension. A
+special name of "-" can be used to read data from stdin.
+.P
+\fBsox_open_output\fR function opens the file for writing whose name is
+the string pointed to by \fIpath\fR and associates an sox_format_t with it. If
+\fIinfo\fR is non-NULL then it will be used to specify the data format
+of the output file. Since most file formats can write data in
+different data formats, this generally has to be specified. The info
+structure from the input format handler can be specified to copy data
+over in the same format. If \fIcomment\fR is non-NULL, it will be
+written in the file header for formats that support comments. If
+\fIfiletype\fR is non-NULL then it will be used to specify the file
+type. If this is not specified then the file type is attempted to be
+derived by looking at the filename extension. A special name of "-"
+can be used to write data to stdout.
+.P
+The function \fBsox_read\fR reads \fIlen\fR samples in to \fIbuf\fR
+using the format handler specified by \fIft\fR. All data read is
+converted to 32-bit signed samples before being placed in to
+\fIbuf\fR. The value of \fIlen\fR is specified in total samples. If
+its value is not evenly divisable by the number of channels, undefined
+behavior will occur.
+.P
+The function \fBsox_write\fR writes \fIlen\fR samples from \fIbuf\fR
+using the format handler specified by \fIft\fR. Data in \fIbuf\fR must
+be 32-bit signed samples and will be converted during the write
+process. The value of \fIlen\fR is specified in total samples. If its
+value is not evenly divisable by the number of channels, undefined
+behavior will occur.
+.P
+The \fBsox_close\fR function dissociates the named \fIsox_format_t\fR from its
+underlying file or set of functions. If the format handler was being
+used for output, any buffered data is written first.
+.P
+The function \fBsox_find_effect\fR finds effect \fIname\fR, returning
+a pointer to its \fIsox_effect_handler_t\fR if it exists, and NULL
+otherwise.
+.P
+The function \fBsox_create_effect\fR instantiates an effect into a
+\fIsox_effect_t\fR given a \fIsox_effect_handler_t *\fR. Any missing
+methods are automatically set to the corresponding \fBnothing\fR
+method.
+.P
+The function \fBsox_effect_options\fR allows passing options into the effect to control its behavior. It will return SOX_EOF if there were any invalid options passed in. On success, the \fIeffp->in_signal\fR will optional contain the rate and channel count it requires input data from and \fIeffp->out_signal\fR will optionally contain the rate and channel count it outputs in. When present, this information should be used to make sure appropriate effects are placed in the effects chain to handle any needed conversions.
+.P
+Passing in options is currently only supported when they are passed in before the effect is ever started. The behavior is undefined if its called once the effect is started.
+.P
+\fBsox_create_effects_chain\fR will instantiate an effects chain that
+effects can be added to. \fIin_enc\fR and \fIout_enc\fR are the
+signal encoding of the input and output of the chain respectively.
+The pointers to \fIin_enc\fR and \fIout_enc\fR
+are stored internally and so their memory should not be freed. Also,
+it is OK if their values change over time to reflect new input or
+output encodings as they are referenced only as effects
+start up or are restarted.
+.P
+\fBsox_delete_effects_chain\fR will release any resources reserved during
+the creation of the chain. This will also call \fBsox_delete_effects\fR
+if any effects are still in the chain.
+.P
+\fBsox_add_effect\fR adds an effect to the chain. \fIin\fR specifies the input
+signal info for this effect. \fIout\fR is a suggestion
+as to what the output signal should be but depending on the effects
+given options and on \fIin\fR the effect can choose to do differently.
+Whatever output rate and channels the effect does produce are written
+back to \fIin\fR. It is meant that \fIin\fR be stored and passed to each
+new call to \fBsox_add_effect\fR so that changes will be propagated to each new effect.
+.P
+SoX includes skeleton C files to assist you in writing new
+formats (skelform.c) and effects (skeleff.c). Note that new formats
+can often just deal with the header and then use raw.c's routines
+for reading and writing.
+
+example0.c and example1.c are a good starting point to see how
+to write applications using libsox. sox.c itself is also a good
+reference.
+
+.SH RETURN VALUE
+Upon successful completion \fBsox_open_input\fR and
+\fBsox_open_output\fR return an \fIsox_format_t\fR (which is a pointer).
+Otherwise, NULL is returned. TODO: Need a way to return reason for
+failures. Currently, relies on \fBsox_warn\fR to print information.
+.P
+\fBsox_read\fR and \fBsox_write\fR return the number of samples
+successfully read or written. If an error occurs, or the end-of-file
+is reached, the return value is a short item count or SOX_EOF. TODO:
+\fBsox_read\fR does not distiguish between end-of-file and error. Need
+an feof() and ferror() concept to determine which occured.
+.P
+Upon successful completion \fBsox_close\fR returns 0. Otherwise, SOX_EOF
+is returned. In either case, any further access (including another
+call to \fBsox_close\fR()) to the handler results in undefined
+behavior. TODO: Need a way to return reason for failures. Currently,
+relies on sox_warn to print information.
+.P
+Upon successful completion \fBsox_seek\fR returns 0. Otherwise, SOX_EOF
+is returned. TODO Need to set a global error and implement sox_tell.
+.SH ERRORS
+TODO
+.SH INTERNALS
+SoX's formats and effects operate with an internal sample format of
+signed 32-bit integer. The data processing routines are called with
+buffers of these samples, and buffer sizes which refer to the number
+of samples processed, not the number of bytes. File readers translate
+the input samples to signed 32-bit integers and return the number of
+samples read. For example, data in linear signed byte format is
+left-shifted 24 bits.
+.P
+Representing samples as integers can cause problems when processing the audio.
+For example, if an effect to
+mix down left and right channels into one monophonic channel
+were to use the line
+.EX
+ *obuf++ = (*ibuf++ + *ibuf++)/2;
+.EE
+distortion might occur since
+the intermediate addition can overflow 32 bits.
+The line
+.EX
+ *obuf++ = *ibuf++/2 + *ibuf++/2;
+.EE
+would get round the overflow problem (at the expense of the least significant
+bit).
+.P
+Stereo data is stored with the left and right speaker data in
+successive samples.
+Quadraphonic data is stored in this order:
+left front, right front, left rear, right rear.
+.SH FORMATS
+A
+.I format
+is responsible for translating between sound sample files
+and an internal buffer. The internal buffer is store in signed longs
+with a fixed sampling rate. The
+.I format
+operates from two data structures:
+a format structure, and a private structure.
+.P
+The format structure contains a list of control parameters for
+the sample: sampling rate, data size (8, 16, or 32 bits),
+encoding (unsigned, signed, floating point, etc.), number of sound channels.
+It also contains other state information: whether the sample file
+needs to be byte-swapped, whether sox_seek() will work, its suffix,
+its file stream pointer, its
+.I format
+pointer, and the
+.I private
+structure for the
+.I format .
+.P
+The
+.I private
+area is just a preallocated data array for the
+.I format
+to use however it wishes.
+It should have a defined data structure
+and cast the array to that structure.
+See voc.c for the use of a private data area.
+Voc.c has to track the number of samples it
+writes and when finishing, seek back to the beginning of the file
+and write it out.
+The private area is not very large.
+The ``echo'' effect has to malloc() a much larger area for its
+delay line buffers.
+.P
+A
+.I format
+has 6 routines:
+.TP 20
+startread
+Set up the format parameters, or read in
+a data header, or do what needs to be done.
+.TP 20
+read
+Given a buffer and a length:
+read up to that many samples,
+transform them into signed long integers,
+and copy them into the buffer.
+Return the number of samples actually read.
+.TP 20
+stopread
+Do what needs to be done.
+.TP 20
+startwrite
+Set up the format parameters, or write out
+a data header, or do what needs to be done.
+.TP 20
+write
+Given a buffer and a length:
+copy that many samples out of the buffer,
+convert them from signed longs to the appropriate
+data, and write them to the file.
+If it can't write out all the samples,
+fail.
+.TP 20
+stopwrite
+Fix up any file header, or do what needs to be done.
+.SH EFFECTS
+Each effect runs with one input and one output stream.
+An effect's implementation comprises six functions that may be called
+to the follow flow diagram:
+.EX
+LOOP (invocations with different parameters)
+ getopts
+ LOOP (invocations with the same parameters)
+ LOOP (channels)
+ start
+ LOOP (whilst there is input audio to process)
+ LOOP (channels)
+ flow
+ LOOP (whilst there is output audio to generate)
+ LOOP (channels)
+ drain
+ LOOP (channels)
+ stop
+ kill
+.EE
+Notes: For some effects, some of the functions may not be needed and can
+be NULL. An effect that is marked `MCHAN' does not use the LOOP
+(channels) lines and must therefore perform multiple channel processing
+inside the affected functions. Multiple effect instances may be
+processed (according to the above flow diagram) in parallel.
+.TP 20
+getopts
+is called with a character string argument list for the effect.
+.TP 20
+start
+is called with the signal parameters for the input and output
+streams.
+.TP 20
+flow
+is called with input and output data buffers,
+and (by reference) the input and output data buffer sizes.
+It processes the input buffer into the output buffer,
+and sets the size variables to the numbers of samples
+actually processed.
+It is under no obligation to read from the input buffer or
+write to the output buffer during the same call. If the
+call returns SOX_EOF then this should be used as an indication
+that this effect will no longer read any data and can be used
+to switch to drain mode sooner.
+.TP 20
+drain
+is called after there are no more input data samples.
+If the effect wishes to generate more data samples
+it copies the generated data into a given buffer
+and returns the number of samples generated.
+If it fills the buffer, it will be called again, etc.
+The echo effect uses this to fade away.
+.TP 20
+stop
+is called when there are no more input samples and no more output
+samples to process.
+It is typically used to release or close resources (e.g. allocated
+memory or temporary files) that were set-up in
+.IR start .
+See echo.c for an example.
+.TP 20
+kill
+is called to allow resources allocated by
+.I getopts
+to be released.
+See pad.c for an example.
+.SH LINKING
+The method of linking against libsox depends on how SoX was
+built on your system. For a static build, just link against the
+libraries as normal. For a dynamic build, you should use libtool to
+link with the correct linker flags. See the libtool manual for
+details; basically, you use it as:
+.EX
+ libtool \-\-mode=link gcc \-o prog /path/to/libsox.la
+.EE
+.SH BUGS
+This manual page is both incomplete and out of date.
+.SH SEE ALSO
+.BR sox (1),
+.BR soxformat (7)
+.SP
+example*.c in the SoX source distribution.
+.SH LICENSE
+Copyright 1998\-2011 by Chris Bagwell and SoX Contributors.
+.br
+Copyright 1991 Lance Norskog and Sundry Contributors.
+.SP
+This library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1, or (at your option)
+any later version.
+.SP
+This library 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 Lesser General Public License for more details.
+.SH AUTHORS
+Chris Bagwell (cbagwell@users.sourceforge.net).
+Other authors and contributors are listed in the ChangeLog file that
+is distributed with the source code.
diff --git a/src/libsox.txt b/src/libsox.txt
new file mode 100644
index 0000000..dc627fc
--- /dev/null
+++ b/src/libsox.txt
@@ -0,0 +1,327 @@
+SoX(3) Sound eXchange SoX(3)
+
+
+
+NAME
+ libsox - SoX, an audio file-format and effect library
+
+SYNOPSIS
+ #include <sox.h>
+
+ int sox_format_init(void);
+
+ void sox_format_quit(void);
+
+ sox_format_t sox_open_read(const char *path, const sox_signalinfo_t *info, const char *filetype);
+
+ sox_format_t sox_open_write(sox_bool (*overwrite_permitted)(const char *filename), const char *path, const sox_signalinfo_t *info, const char *filetype, const char *comment, sox_size_t length, const sox_instrinfo_t *instr, const sox_loopinfo_t *loops);
+
+ sox_size_t sox_read(sox_format_t ft, sox_ssample_t *buf, sox_size_t len);
+
+ sox_size_t sox_write(sox_format_t ft, sox_ssample_t *buf, sox_size_t len);
+
+ int sox_close(sox_format_t ft);
+
+ int sox_seek(sox_format_t ft, sox_size_t offset, int whence);
+
+ sox_effect_handler_t const *sox_find_effect(char const *name);
+
+ sox_effect_t *sox_create_effect(sox_effect_handler_t const *eh);
+
+ int sox_effect_options(sox_effect_t *effp, int argc, char * const argv[]);
+
+ sox_effects_chain_t *sox_create_effects_chain(sox_encodinginfo_t const *in_enc, sox_encodinginfo_t const *out_enc);
+
+ void sox_delete_effects_chain(sox_effects_chain_t *ecp);
+
+ int sox_add_effect(sox_effects_chaint_t *chain, sox_effect_t*effp, sox_signalinfo_t *in, sox_signalinfo_t const *out);
+
+ cc file.c -o file -lsox
+
+DESCRIPTION
+ libsox is a library of sound sample file format readers/writers and
+ sound effects processors. It is mainly developed for use by SoX but is
+ useful for any sound application.
+
+ sox_format_init function performs some required initialization related
+ to all file format handlers. If compiled with dynamic library support
+ then this will detect and initialize all external libraries. This
+ should be called before any other file operations are performed.
+
+ sox_format_quit function performs some required cleanup related to all
+ file format handlers.
+
+ sox_open_input function opens the file for reading whose name is the
+ string pointed to by path and associates an sox_format_t with it. If
+ info is non-NULL then it will be used to specify the data format of the
+ input file. This is normally only needed for headerless audio files
+ since the information is not stored in the file. If filetype is non-
+ NULL then it will be used to specify the file type. If this is not
+ specified then the file type is attempted to be derived by looking at
+ the file header and/or the filename extension. A special name of "-"
+ can be used to read data from stdin.
+
+ sox_open_output function opens the file for writing whose name is the
+ string pointed to by path and associates an sox_format_t with it. If
+ info is non-NULL then it will be used to specify the data format of the
+ output file. Since most file formats can write data in different data
+ formats, this generally has to be specified. The info structure from
+ the input format handler can be specified to copy data over in the same
+ format. If comment is non-NULL, it will be written in the file header
+ for formats that support comments. If filetype is non-NULL then it will
+ be used to specify the file type. If this is not specified then the
+ file type is attempted to be derived by looking at the filename exten‐
+ sion. A special name of "-" can be used to write data to stdout.
+
+ The function sox_read reads len samples in to buf using the format han‐
+ dler specified by ft. All data read is converted to 32-bit signed sam‐
+ ples before being placed in to buf. The value of len is specified in
+ total samples. If its value is not evenly divisable by the number of
+ channels, undefined behavior will occur.
+
+ The function sox_write writes len samples from buf using the format
+ handler specified by ft. Data in buf must be 32-bit signed samples and
+ will be converted during the write process. The value of len is speci‐
+ fied in total samples. If its value is not evenly divisable by the num‐
+ ber of channels, undefined behavior will occur.
+
+ The sox_close function dissociates the named sox_format_t from its
+ underlying file or set of functions. If the format handler was being
+ used for output, any buffered data is written first.
+
+ The function sox_find_effect finds effect name, returning a pointer to
+ its sox_effect_handler_t if it exists, and NULL otherwise.
+
+ The function sox_create_effect instantiates an effect into a
+ sox_effect_t given a sox_effect_handler_t *. Any missing methods are
+ automatically set to the corresponding nothing method.
+
+ The function sox_effect_options allows passing options into the effect
+ to control its behavior. It will return SOX_EOF if there were any
+ invalid options passed in. On success, the effp->in_signal will
+ optional contain the rate and channel count it requires input data from
+ and effp->out_signal will optionally contain the rate and channel count
+ it outputs in. When present, this information should be used to make
+ sure appropriate effects are placed in the effects chain to handle any
+ needed conversions.
+
+ Passing in options is currently only supported when they are passed in
+ before the effect is ever started. The behavior is undefined if its
+ called once the effect is started.
+
+ sox_create_effects_chain will instantiate an effects chain that effects
+ can be added to. in_enc and out_enc are the signal encoding of the
+ input and output of the chain respectively. The pointers to in_enc and
+ out_enc are stored internally and so their memory should not be freed.
+ Also, it is OK if their values change over time to reflect new input or
+ output encodings as they are referenced only as effects start up or are
+ restarted.
+
+ sox_delete_effects_chain will release any resources reserved during the
+ creation of the chain. This will also call sox_delete_effects if any
+ effects are still in the chain.
+
+ sox_add_effect adds an effect to the chain. in specifies the input
+ signal info for this effect. out is a suggestion as to what the output
+ signal should be but depending on the effects given options and on in
+ the effect can choose to do differently. Whatever output rate and
+ channels the effect does produce are written back to in. It is meant
+ that in be stored and passed to each new call to sox_add_effect so that
+ changes will be propagated to each new effect.
+
+ SoX includes skeleton C files to assist you in writing new formats
+ (skelform.c) and effects (skeleff.c). Note that new formats can often
+ just deal with the header and then use raw.c's routines for reading and
+ writing.
+
+ example0.c and example1.c are a good starting point to see how to write
+ applications using libsox. sox.c itself is also a good reference.
+
+
+RETURN VALUE
+ Upon successful completion sox_open_input and sox_open_output return an
+ sox_format_t (which is a pointer). Otherwise, NULL is returned. TODO:
+ Need a way to return reason for failures. Currently, relies on sox_warn
+ to print information.
+
+ sox_read and sox_write return the number of samples successfully read
+ or written. If an error occurs, or the end-of-file is reached, the
+ return value is a short item count or SOX_EOF. TODO: sox_read does not
+ distiguish between end-of-file and error. Need an feof() and ferror()
+ concept to determine which occured.
+
+ Upon successful completion sox_close returns 0. Otherwise, SOX_EOF is
+ returned. In either case, any further access (including another call to
+ sox_close()) to the handler results in undefined behavior. TODO: Need a
+ way to return reason for failures. Currently, relies on sox_warn to
+ print information.
+
+ Upon successful completion sox_seek returns 0. Otherwise, SOX_EOF is
+ returned. TODO Need to set a global error and implement sox_tell.
+
+ERRORS
+ TODO
+
+INTERNALS
+ SoX's formats and effects operate with an internal sample format of
+ signed 32-bit integer. The data processing routines are called with
+ buffers of these samples, and buffer sizes which refer to the number of
+ samples processed, not the number of bytes. File readers translate the
+ input samples to signed 32-bit integers and return the number of sam‐
+ ples read. For example, data in linear signed byte format is left-
+ shifted 24 bits.
+
+ Representing samples as integers can cause problems when processing the
+ audio. For example, if an effect to mix down left and right channels
+ into one monophonic channel were to use the line
+ *obuf++ = (*ibuf++ + *ibuf++)/2;
+ distortion might occur since the intermediate addition can overflow 32
+ bits. The line
+ *obuf++ = *ibuf++/2 + *ibuf++/2;
+ would get round the overflow problem (at the expense of the least sig‐
+ nificant bit).
+
+ Stereo data is stored with the left and right speaker data in succes‐
+ sive samples. Quadraphonic data is stored in this order: left front,
+ right front, left rear, right rear.
+
+FORMATS
+ A format is responsible for translating between sound sample files and
+ an internal buffer. The internal buffer is store in signed longs with
+ a fixed sampling rate. The format operates from two data structures: a
+ format structure, and a private structure.
+
+ The format structure contains a list of control parameters for the sam‐
+ ple: sampling rate, data size (8, 16, or 32 bits), encoding (unsigned,
+ signed, floating point, etc.), number of sound channels. It also con‐
+ tains other state information: whether the sample file needs to be
+ byte-swapped, whether sox_seek() will work, its suffix, its file stream
+ pointer, its format pointer, and the private structure for the format .
+
+ The private area is just a preallocated data array for the format to
+ use however it wishes. It should have a defined data structure and
+ cast the array to that structure. See voc.c for the use of a private
+ data area. Voc.c has to track the number of samples it writes and when
+ finishing, seek back to the beginning of the file and write it out.
+ The private area is not very large. The ``echo'' effect has to mal‐
+ loc() a much larger area for its delay line buffers.
+
+ A format has 6 routines:
+
+ startread Set up the format parameters, or read in a data
+ header, or do what needs to be done.
+
+ read Given a buffer and a length: read up to that many
+ samples, transform them into signed long integers,
+ and copy them into the buffer. Return the number
+ of samples actually read.
+
+ stopread Do what needs to be done.
+
+ startwrite Set up the format parameters, or write out a data
+ header, or do what needs to be done.
+
+ write Given a buffer and a length: copy that many samples
+ out of the buffer, convert them from signed longs
+ to the appropriate data, and write them to the
+ file. If it can't write out all the samples, fail.
+
+ stopwrite Fix up any file header, or do what needs to be
+ done.
+
+EFFECTS
+ Each effect runs with one input and one output stream. An effect's
+ implementation comprises six functions that may be called to the follow
+ flow diagram:
+ LOOP (invocations with different parameters)
+ getopts
+ LOOP (invocations with the same parameters)
+ LOOP (channels)
+ start
+ LOOP (whilst there is input audio to process)
+ LOOP (channels)
+ flow
+ LOOP (whilst there is output audio to generate)
+ LOOP (channels)
+ drain
+ LOOP (channels)
+ stop
+ kill
+ Notes: For some effects, some of the functions may not be needed and
+ can be NULL. An effect that is marked `MCHAN' does not use the LOOP
+ (channels) lines and must therefore perform multiple channel processing
+ inside the affected functions. Multiple effect instances may be pro‐
+ cessed (according to the above flow diagram) in parallel.
+
+ getopts is called with a character string argument list for
+ the effect.
+
+ start is called with the signal parameters for the input
+ and output streams.
+
+ flow is called with input and output data buffers, and
+ (by reference) the input and output data buffer
+ sizes. It processes the input buffer into the out‐
+ put buffer, and sets the size variables to the num‐
+ bers of samples actually processed. It is under no
+ obligation to read from the input buffer or write
+ to the output buffer during the same call. If the
+ call returns SOX_EOF then this should be used as an
+ indication that this effect will no longer read any
+ data and can be used to switch to drain mode
+ sooner.
+
+ drain is called after there are no more input data sam‐
+ ples. If the effect wishes to generate more data
+ samples it copies the generated data into a given
+ buffer and returns the number of samples generated.
+ If it fills the buffer, it will be called again,
+ etc. The echo effect uses this to fade away.
+
+ stop is called when there are no more input samples and
+ no more output samples to process. It is typically
+ used to release or close resources (e.g. allocated
+ memory or temporary files) that were set-up in
+ start. See echo.c for an example.
+
+ kill is called to allow resources allocated by getopts
+ to be released. See pad.c for an example.
+
+LINKING
+ The method of linking against libsox depends on how SoX was built on
+ your system. For a static build, just link against the libraries as
+ normal. For a dynamic build, you should use libtool to link with the
+ correct linker flags. See the libtool manual for details; basically,
+ you use it as:
+ libtool --mode=link gcc -o prog /path/to/libsox.la
+
+BUGS
+ This manual page is both incomplete and out of date.
+
+SEE ALSO
+ sox(1), soxformat(7)
+
+ example*.c in the SoX source distribution.
+
+LICENSE
+ Copyright 1998-2011 by Chris Bagwell and SoX Contributors.
+ Copyright 1991 Lance Norskog and Sundry Contributors.
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MER‐
+ CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
+ General Public License for more details.
+
+AUTHORS
+ Chris Bagwell (cbagwell@users.sourceforge.net). Other authors and con‐
+ tributors are listed in the ChangeLog file that is distributed with the
+ source code.
+
+
+
+libsox February 19, 2011 SoX(3)
diff --git a/src/lpc10/CMakeLists.txt b/src/lpc10/CMakeLists.txt
new file mode 100644
index 0000000..cb8b459
--- /dev/null
+++ b/src/lpc10/CMakeLists.txt
@@ -0,0 +1,4 @@
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+add_library(lpc10 analys bsynz chanwr dcbias decode deemp difmag dyptrk encode energy f2clib ham84 hp100 invert irc2pc ivfilt lpcdec lpcenc lpcini lpfilt median mload onset pitsyn placea placev preemp prepro random rcchk synths tbdm voicin vparms)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
diff --git a/src/lpc10/Makefile.am b/src/lpc10/Makefile.am
new file mode 100644
index 0000000..634ac12
--- /dev/null
+++ b/src/lpc10/Makefile.am
@@ -0,0 +1,20 @@
+if EXTERNAL_LPC10
+EXTRA_DIST = analys.c bsynz.c chanwr.c dcbias.c \
+ decode.c deemp.c difmag.c dyptrk.c encode.c energy.c f2c.h f2clib.c \
+ ham84.c hp100.c invert.c irc2pc.c ivfilt.c lpcdec.c lpcenc.c lpcini.c \
+ lpfilt.c median.c mload.c onset.c pitsyn.c placea.c placev.c preemp.c \
+ prepro.c random.c rcchk.c synths.c tbdm.c voicin.c vparms.c lpc10.h CMakeLists.txt
+else
+noinst_LTLIBRARIES = liblpc10.la
+noinst_HEADERS = lpc10.h
+liblpc10_la_SOURCES = analys.c bsynz.c chanwr.c dcbias.c \
+ decode.c deemp.c difmag.c dyptrk.c encode.c energy.c f2c.h f2clib.c \
+ ham84.c hp100.c invert.c irc2pc.c ivfilt.c lpcdec.c lpcenc.c lpcini.c \
+ lpfilt.c median.c mload.c onset.c pitsyn.c placea.c placev.c preemp.c \
+ prepro.c random.c rcchk.c synths.c tbdm.c voicin.c vparms.c
+AM_CPPFLAGS=-I../src
+if HAVE_LIBLTDL
+AM_LDFLAGS=-avoid-version -module
+endif
+EXTRA_DIST = CMakeLists.txt
+endif
diff --git a/src/lpc10/Makefile.in b/src/lpc10/Makefile.in
new file mode 100644
index 0000000..770b548
--- /dev/null
+++ b/src/lpc10/Makefile.in
@@ -0,0 +1,700 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = lpc10
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/depcomp $(am__noinst_HEADERS_DIST) README
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gcc_stack_protect.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/optional-fmt.m4 $(top_srcdir)/m4/sndfile.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/soxconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+liblpc10_la_LIBADD =
+am__liblpc10_la_SOURCES_DIST = analys.c bsynz.c chanwr.c dcbias.c \
+ decode.c deemp.c difmag.c dyptrk.c encode.c energy.c f2c.h \
+ f2clib.c ham84.c hp100.c invert.c irc2pc.c ivfilt.c lpcdec.c \
+ lpcenc.c lpcini.c lpfilt.c median.c mload.c onset.c pitsyn.c \
+ placea.c placev.c preemp.c prepro.c random.c rcchk.c synths.c \
+ tbdm.c voicin.c vparms.c
+@EXTERNAL_LPC10_FALSE@am_liblpc10_la_OBJECTS = analys.lo bsynz.lo \
+@EXTERNAL_LPC10_FALSE@ chanwr.lo dcbias.lo decode.lo deemp.lo \
+@EXTERNAL_LPC10_FALSE@ difmag.lo dyptrk.lo encode.lo energy.lo \
+@EXTERNAL_LPC10_FALSE@ f2clib.lo ham84.lo hp100.lo invert.lo \
+@EXTERNAL_LPC10_FALSE@ irc2pc.lo ivfilt.lo lpcdec.lo lpcenc.lo \
+@EXTERNAL_LPC10_FALSE@ lpcini.lo lpfilt.lo median.lo mload.lo \
+@EXTERNAL_LPC10_FALSE@ onset.lo pitsyn.lo placea.lo placev.lo \
+@EXTERNAL_LPC10_FALSE@ preemp.lo prepro.lo random.lo rcchk.lo \
+@EXTERNAL_LPC10_FALSE@ synths.lo tbdm.lo voicin.lo vparms.lo
+liblpc10_la_OBJECTS = $(am_liblpc10_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+@EXTERNAL_LPC10_FALSE@am_liblpc10_la_rpath =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(liblpc10_la_SOURCES)
+DIST_SOURCES = $(am__liblpc10_la_SOURCES_DIST)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__noinst_HEADERS_DIST = lpc10.h
+HEADERS = $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMRNB_CFLAGS = @AMRNB_CFLAGS@
+AMRNB_LIBS = @AMRNB_LIBS@
+AMRWB_CFLAGS = @AMRWB_CFLAGS@
+AMRWB_LIBS = @AMRWB_LIBS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AO_CFLAGS = @AO_CFLAGS@
+AO_LIBS = @AO_LIBS@
+APP_LDFLAGS = @APP_LDFLAGS@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COREAUDIO_CFLAGS = @COREAUDIO_CFLAGS@
+COREAUDIO_LIBS = @COREAUDIO_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTRO = @DISTRO@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLAC_CFLAGS = @FLAC_CFLAGS@
+FLAC_LIBS = @FLAC_LIBS@
+GOMP_LIBS = @GOMP_LIBS@
+GREP = @GREP@
+GSM_CFLAGS = @GSM_CFLAGS@
+GSM_LIBS = @GSM_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LADSPA_PATH = @LADSPA_PATH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGSM_LIBADD = @LIBGSM_LIBADD@
+LIBLPC10_LIBADD = @LIBLPC10_LIBADD@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOLFLAGS = @LIBTOOLFLAGS@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LPC10_CFLAGS = @LPC10_CFLAGS@
+LPC10_LIBS = @LPC10_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAGIC_LIBS = @MAGIC_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MP3_CFLAGS = @MP3_CFLAGS@
+MP3_LIBS = @MP3_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OGG_VORBIS_CFLAGS = @OGG_VORBIS_CFLAGS@
+OGG_VORBIS_LIBS = @OGG_VORBIS_LIBS@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OPUS_CFLAGS = @OPUS_CFLAGS@
+OPUS_LIBS = @OPUS_LIBS@
+OSS_CFLAGS = @OSS_CFLAGS@
+OSS_LIBS = @OSS_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKGCONFIGDIR = @PKGCONFIGDIR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLAYRECLINKS = @PLAYRECLINKS@
+PNG_LIBS = @PNG_LIBS@
+PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
+PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHLIB_VERSION = @SHLIB_VERSION@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+SNDIO_CFLAGS = @SNDIO_CFLAGS@
+SNDIO_LIBS = @SNDIO_LIBS@
+STRIP = @STRIP@
+SUN_AUDIO_CFLAGS = @SUN_AUDIO_CFLAGS@
+SUN_AUDIO_LIBS = @SUN_AUDIO_LIBS@
+SYMLINKS = @SYMLINKS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WAVEAUDIO_CFLAGS = @WAVEAUDIO_CFLAGS@
+WAVEAUDIO_LIBS = @WAVEAUDIO_LIBS@
+WAVPACK_CFLAGS = @WAVPACK_CFLAGS@
+WAVPACK_LIBS = @WAVPACK_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+@EXTERNAL_LPC10_FALSE@EXTRA_DIST = CMakeLists.txt
+@EXTERNAL_LPC10_TRUE@EXTRA_DIST = analys.c bsynz.c chanwr.c dcbias.c \
+@EXTERNAL_LPC10_TRUE@ decode.c deemp.c difmag.c dyptrk.c encode.c energy.c f2c.h f2clib.c \
+@EXTERNAL_LPC10_TRUE@ ham84.c hp100.c invert.c irc2pc.c ivfilt.c lpcdec.c lpcenc.c lpcini.c \
+@EXTERNAL_LPC10_TRUE@ lpfilt.c median.c mload.c onset.c pitsyn.c placea.c placev.c preemp.c \
+@EXTERNAL_LPC10_TRUE@ prepro.c random.c rcchk.c synths.c tbdm.c voicin.c vparms.c lpc10.h CMakeLists.txt
+
+@EXTERNAL_LPC10_FALSE@noinst_LTLIBRARIES = liblpc10.la
+@EXTERNAL_LPC10_FALSE@noinst_HEADERS = lpc10.h
+@EXTERNAL_LPC10_FALSE@liblpc10_la_SOURCES = analys.c bsynz.c chanwr.c dcbias.c \
+@EXTERNAL_LPC10_FALSE@ decode.c deemp.c difmag.c dyptrk.c encode.c energy.c f2c.h f2clib.c \
+@EXTERNAL_LPC10_FALSE@ ham84.c hp100.c invert.c irc2pc.c ivfilt.c lpcdec.c lpcenc.c lpcini.c \
+@EXTERNAL_LPC10_FALSE@ lpfilt.c median.c mload.c onset.c pitsyn.c placea.c placev.c preemp.c \
+@EXTERNAL_LPC10_FALSE@ prepro.c random.c rcchk.c synths.c tbdm.c voicin.c vparms.c
+
+@EXTERNAL_LPC10_FALSE@AM_CPPFLAGS = -I../src
+@EXTERNAL_LPC10_FALSE@@HAVE_LIBLTDL_TRUE@AM_LDFLAGS = -avoid-version -module
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lpc10/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu lpc10/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+liblpc10.la: $(liblpc10_la_OBJECTS) $(liblpc10_la_DEPENDENCIES) $(EXTRA_liblpc10_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_liblpc10_la_rpath) $(liblpc10_la_OBJECTS) $(liblpc10_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/analys.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsynz.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chanwr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcbias.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deemp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/difmag.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dyptrk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/energy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f2clib.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ham84.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hp100.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/invert.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc2pc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ivfilt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpcdec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpcenc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpcini.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpfilt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/median.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mload.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/onset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pitsyn.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/placea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/placev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preemp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prepro.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rcchk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synths.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbdm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/voicin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vparms.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
+ ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/lpc10/README b/src/lpc10/README
new file mode 100644
index 0000000..417c4cd
--- /dev/null
+++ b/src/lpc10/README
@@ -0,0 +1,47 @@
+Sun Jul 7 15:35:44 CDT 1996
+Andy Fingerhut (jaf@arl.wustl.edu)
+
+Before you can make any of the programs in this directory, you must
+change to the lpc10 directory and make the LPC-10 library. See the
+README file there, and be especially sure to read the notes there
+about possible modifications you will need to make to the file lpc10.h
+in this directory.
+
+I've made up a Unix makefile for the programs nuke and unnuke, called
+makefile.unx. I don't know how to create a makefile for Microsoft C.
+Feel free to send me one if you create one that works.
+
+The files in this directory are just some simple main programs that
+call the routines create_lpc10_encoder_state(), lpc10_encode(),
+create_lpc10_decoder_state(), and lpc10_decode(). Those four routines
+are defined in source files within the subdirectory lpc10, and are all
+that any application ever needs to use to compress and decompress
+speech with the LPC-10 coder. The main programs in this directory are
+just intended as examples of how to use these routines.
+
+Optionally, an application could also use the routines
+init_lpc10_encoder_state() or init_lpc10_decoder_state() to
+reinitialize a state struct that was created by one of the create
+functions mentioned above. This could be useful between talk spurts,
+for example, to flush out any possible remaining garbage state that
+could occur because some data was lost. This shouldn't be necessary,
+since any old bad state should be flushed out or decay within a few
+frame times anyway (frame time = 22.5 ms). I have heard lost packets
+(or maybe they were garbled?) produce interesting audio artifacts in
+the application Nautilus.
+
+
+Tue Aug 20 15:49:04 CDT 1996
+Andy Fingerhut (jaf@arl.wustl.edu)
+
+I have just completed making many changes to the C source code that
+allow multiple audio streams to be compressed or decompressed in an
+interleaved fashion. This is useful, for example, for some Internet
+MBONE audio tools that can receive compressed audio from multiple
+sources simultaneously. See one or more of the following
+demonstration programs for examples of the calling sequence:
+
+nuke - compressing one audio stream
+nuke2 - compressing two audio streams, alternating one frame from each
+unnuke - decompressing one audio stream
+unnuke2 - decompressing two audio streams, alternating one frame from each
diff --git a/src/lpc10/analys.c b/src/lpc10/analys.c
new file mode 100644
index 0000000..57388e8
--- /dev/null
+++ b/src/lpc10/analys.c
@@ -0,0 +1,495 @@
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+int analys_(real *speech, integer *voice, integer *pitch, real *rms, real *rc, struct lpc10_encoder_state *st);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* Table of constant values */
+
+static integer c__10 = 10;
+static integer c__181 = 181;
+static integer c__720 = 720;
+static integer c__3 = 3;
+static integer c__90 = 90;
+static integer c__156 = 156;
+static integer c__307 = 307;
+static integer c__462 = 462;
+static integer c__312 = 312;
+static integer c__60 = 60;
+static integer c__1 = 1;
+
+/* ****************************************************************** */
+
+/* ANALYS Version 55 */
+
+/* Revision 1.9 1996/05/23 19:41:07 jaf */
+/* Commented out some unnecessary lines that were reading uninitialized */
+/* values. */
+
+/* Revision 1.8 1996/03/27 23:57:55 jaf */
+/* Added some comments about which indices of the local buffers INBUF, */
+/* LPBUF, etc., get read or modified by some of the subroutine calls. I */
+/* just did this while trying to figure out the discrepancy between the */
+/* embedded code compiled with all local variables implicitly saved, and */
+/* without. */
+
+/* I added some debugging write statements in hopes of finding a problem. */
+/* None of them ever printed anything while running with the long input */
+/* speech file dam9.spd provided in the distribution. */
+
+/* Revision 1.7 1996/03/27 18:06:20 jaf */
+/* Commented out access to MAXOSP, which is just a debugging variable */
+/* that was defined in the COMMON block CONTRL in contrl.fh. */
+
+/* Revision 1.6 1996/03/26 19:31:33 jaf */
+/* Commented out trace statements. */
+
+/* Revision 1.5 1996/03/21 15:19:35 jaf */
+/* Added comments for ENTRY PITDEC. */
+
+/* Revision 1.4 1996/03/19 20:54:27 jaf */
+/* Added a line to INITANALYS. See comments there. */
+
+/* Revision 1.3 1996/03/19 20:52:49 jaf */
+/* Rearranged the order of the local variables quite a bit, to separate */
+/* them into groups of "constants", "locals that don't need to be saved */
+/* from one call to the next", and "local that do need to be saved from */
+/* one call to the next". */
+
+/* Several locals in the last set should have been given initial values, */
+/* but weren't. I gave them all initial values of 0. */
+
+/* Added a separate ENTRY INITANALYS that initializes all local state */
+/* that should be, and also calls the corresponding entries of the */
+/* subroutines called by ANALYS that also have local state. */
+
+/* There used to be DATA statements in ANALYS. I got rid of most of */
+/* them, and added a local logical variable FIRST that calls the entry */
+/* INITANALYS on the first call to ANALYS. This is just so that one need */
+/* not remember to call INITANALYS first in order for the state to be */
+/* initialized. */
+
+/* Revision 1.2 1996/03/11 23:29:32 jaf */
+/* Added several comments with my own personal questions about the */
+/* Fortran 77 meaning of the parameters passed to the subroutine PREEMP. */
+
+/* Revision 1.1 1996/02/07 14:42:29 jaf */
+/* Initial revision */
+
+
+/* ****************************************************************** */
+
+/* SUBROUTINE ANALYS */
+
+/* Input: */
+/* SPEECH */
+/* Indices 1 through LFRAME read. */
+/* Output: */
+/* VOICE */
+/* Indices 1 through 2 written. */
+/* PITCH */
+/* Written in subroutine DYPTRK, and then perhaps read and written */
+/* some more. */
+/* RMS */
+/* Written. */
+/* RC */
+/* Indices 1 through ORDER written (ORDER defined in contrl.fh). */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITANALYS. */
+
+
+/* ENTRY PITDEC */
+
+/* Input: */
+/* PITCH - Encoded pitch index */
+/* Output: */
+/* PTAU - Decoded pitch period */
+
+/* This entry has no local state. It accesses a "constant" array */
+/* declared in ANALYS. */
+
+/* Subroutine */ int analys_(real *speech, integer *voice, integer
+ *pitch, real *rms, real *rc, struct lpc10_encoder_state *st)
+{
+ /* Initialized data */
+
+ static integer tau[60] = { 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
+ 35,36,37,38,39,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,
+ 74,76,78,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,
+ 140,144,148,152,156 };
+ static integer buflim[4] = { 181,720,25,720 };
+ static real precoef = .9375f;
+
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ real amdf[60];
+ integer half;
+ real abuf[156];
+ real *bias;
+ extern /* Subroutine */ int tbdm_(real *, integer *, integer *, integer *,
+ real *, integer *, integer *, integer *);
+ integer *awin;
+ integer midx, ewin[6] /* was [2][3] */;
+ real ivrc[2], temp;
+ real *zpre;
+ integer *vwin;
+ integer i__, j, lanal;
+ extern /* Subroutine */ int rcchk_(integer *, real *, real *), mload_(
+ integer *, integer *, integer *, real *, real *, real *);
+ real *inbuf, *pebuf;
+ real *lpbuf, *ivbuf;
+ real *rcbuf;
+ integer *osbuf;
+ extern /* Subroutine */ int onset_(real *, integer *, integer *, integer *
+ , integer *, integer *, integer *, struct lpc10_encoder_state *);
+ integer *osptr;
+ extern int placea_(integer *, integer *
+ , integer *, integer *, integer *, integer *, integer *, integer *
+ , integer *), dcbias_(integer *, real *, real *), placev_(integer
+ *, integer *, integer *, integer *, integer *, integer *, integer
+ *, integer *, integer *, integer *, integer *);
+ integer ipitch;
+ integer *obound;
+ extern /* Subroutine */ int preemp_(real *, real *, integer *, real *,
+ real *), voicin_(integer *, real *, real *, integer *, integer *,
+ real *, real *, integer *, real *, integer *, integer *, integer *,
+ struct lpc10_encoder_state *);
+ integer *voibuf;
+ integer mintau;
+ real *rmsbuf;
+ extern /* Subroutine */ int lpfilt_(real *, real *, integer *, integer *),
+ ivfilt_(real *, real *, integer *, integer *, real *), energy_(
+ integer *, real *, real *), invert_(integer *, real *, real *,
+ real *);
+ integer minptr, maxptr;
+ extern /* Subroutine */ int dyptrk_(real *, integer *, integer *, integer
+ *, integer *, integer *, struct lpc10_encoder_state *);
+ real phi[100] /* was [10][10] */, psi[10];
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Arguments to entry PITDEC (below) */
+/* Parameters/constants */
+/* Constants */
+/* NF = Number of frames */
+/* AF = Frame in which analysis is done */
+/* OSLEN = Length of the onset buffer */
+/* LTAU = Number of pitch lags */
+/* SBUFL, SBUFH = Start and end index of speech buffers */
+/* LBUFL, LBUFH = Start and end index of LPF speech buffer */
+/* MINWIN, MAXWIN = Min and Max length of voicing (and analysis) windows
+*/
+/* PWLEN, PWINH, PWINL = Length, upper and lower limits of pitch window
+ */
+/* DVWINL, DVWINH = Default lower and upper limits of voicing window */
+/* The tables TAU and BUFLIM, and the variable PRECOEF, are not */
+/* Fortran PARAMETER's, but they are initialized with DATA */
+/* statements, and never modified. Thus, they need not have SAVE */
+/* statements for them to keep their values from one invocation to
+*/
+/* the next. */
+/* Local variables that need not be saved */
+/* Local state */
+/* Data Buffers */
+/* INBUF Raw speech (with DC bias removed each frame) */
+/* PEBUF Preemphasized speech */
+/* LPBUF Low pass speech buffer */
+/* IVBUF Inverse filtered speech */
+/* OSBUF Indexes of onsets in speech buffers */
+/* VWIN Voicing window indices */
+/* AWIN Analysis window indices */
+/* EWIN Energy window indices */
+/* VOIBUF Voicing decisions on windows in VWIN */
+/* RMSBUF RMS energy */
+/* RCBUF Reflection Coefficients */
+
+/* Pitch is handled separately from the above parameters. */
+/* The following variables deal with pitch: */
+/* MIDX Encoded initial pitch estimate for analysis frame */
+/* IPITCH Initial pitch computed for frame AF (decoded from MIDX) */
+/* PITCH The encoded pitch value (index into TAU) for the present */
+/* frame (delayed and smoothed by Dyptrack) */
+ /* Parameter adjustments */
+ if (speech) {
+ --speech;
+ }
+ if (voice) {
+ --voice;
+ }
+ if (rc) {
+ --rc;
+ }
+
+ /* Function Body */
+
+/* Calculations are done on future frame due to requirements */
+/* of the pitch tracker. Delay RMS and RC's 2 frames to give */
+/* current frame parameters on return. */
+/* Update all buffers */
+
+ inbuf = &(st->inbuf[0]);
+ pebuf = &(st->pebuf[0]);
+ lpbuf = &(st->lpbuf[0]);
+ ivbuf = &(st->ivbuf[0]);
+ bias = &(st->bias);
+ osbuf = &(st->osbuf[0]);
+ osptr = &(st->osptr);
+ obound = &(st->obound[0]);
+ vwin = &(st->vwin[0]);
+ awin = &(st->awin[0]);
+ voibuf = &(st->voibuf[0]);
+ rmsbuf = &(st->rmsbuf[0]);
+ rcbuf = &(st->rcbuf[0]);
+ zpre = &(st->zpre);
+
+ i__1 = 720 - contrl_1.lframe;
+ for (i__ = 181; i__ <= i__1; ++i__) {
+ inbuf[i__ - 181] = inbuf[contrl_1.lframe + i__ - 181];
+ pebuf[i__ - 181] = pebuf[contrl_1.lframe + i__ - 181];
+ }
+ i__1 = 540 - contrl_1.lframe;
+ for (i__ = 229; i__ <= i__1; ++i__) {
+ ivbuf[i__ - 229] = ivbuf[contrl_1.lframe + i__ - 229];
+ }
+ i__1 = 720 - contrl_1.lframe;
+ for (i__ = 25; i__ <= i__1; ++i__) {
+ lpbuf[i__ - 25] = lpbuf[contrl_1.lframe + i__ - 25];
+ }
+ j = 1;
+ i__1 = (*osptr) - 1;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ if (osbuf[i__ - 1] > contrl_1.lframe) {
+ osbuf[j - 1] = osbuf[i__ - 1] - contrl_1.lframe;
+ ++j;
+ }
+ }
+ *osptr = j;
+ voibuf[0] = voibuf[2];
+ voibuf[1] = voibuf[3];
+ for (i__ = 1; i__ <= 2; ++i__) {
+ vwin[(i__ << 1) - 2] = vwin[((i__ + 1) << 1) - 2] - contrl_1.lframe;
+ vwin[(i__ << 1) - 1] = vwin[((i__ + 1) << 1) - 1] - contrl_1.lframe;
+ awin[(i__ << 1) - 2] = awin[((i__ + 1) << 1) - 2] - contrl_1.lframe;
+ awin[(i__ << 1) - 1] = awin[((i__ + 1) << 1) - 1] - contrl_1.lframe;
+/* EWIN(*,J) is unused for J .NE. AF, so the following shift is
+*/
+/* unnecessary. It also causes error messages when the C versio
+n */
+/* of the code created from this by f2c is run with Purify. It
+*/
+/* correctly complains that uninitialized memory is being read.
+*/
+/* EWIN(1,I) = EWIN(1,I+1) - LFRAME */
+/* EWIN(2,I) = EWIN(2,I+1) - LFRAME */
+ obound[i__ - 1] = obound[i__];
+ voibuf[i__ * 2] = voibuf[(i__ + 1) * 2];
+ voibuf[(i__ << 1) + 1] = voibuf[((i__ + 1) << 1) + 1];
+ rmsbuf[i__ - 1] = rmsbuf[i__];
+ i__1 = contrl_1.order;
+ for (j = 1; j <= i__1; ++j) {
+ rcbuf[j + i__ * 10 - 11] = rcbuf[j + (i__ + 1) * 10 - 11];
+ }
+ }
+/* Copy input speech, scale to sign+12 bit integers */
+/* Remove long term DC bias. */
+/* If the average value in the frame was over 1/4096 (after current
+*/
+/* BIAS correction), then subtract that much more from samples in */
+/* next frame. If the average value in the frame was under */
+/* -1/4096, add 1/4096 more to samples in next frame. In all other
+*/
+/* cases, keep BIAS the same. */
+ temp = 0.f;
+ i__1 = contrl_1.lframe;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ inbuf[720 - contrl_1.lframe + i__ - 181] = speech[i__] * 4096.f -
+ (*bias);
+ temp += inbuf[720 - contrl_1.lframe + i__ - 181];
+ }
+ if (temp > (real) contrl_1.lframe) {
+ *bias += 1;
+ }
+ if (temp < (real) (-contrl_1.lframe)) {
+ *bias += -1;
+ }
+/* Place Voicing Window */
+ i__ = 721 - contrl_1.lframe;
+ preemp_(&inbuf[i__ - 181], &pebuf[i__ - 181], &contrl_1.lframe, &precoef,
+ zpre);
+ onset_(pebuf, osbuf, osptr, &c__10, &c__181, &c__720, &contrl_1.lframe, st);
+
+/* MAXOSP is just a debugging variable. */
+
+/* MAXOSP = MAX( MAXOSP, OSPTR ) */
+
+ placev_(osbuf, osptr, &c__10, &obound[2], vwin, &c__3, &contrl_1.lframe,
+ &c__90, &c__156, &c__307, &c__462);
+/* The Pitch Extraction algorithm estimates the pitch for a frame
+*/
+/* of speech by locating the minimum of the average magnitude difference
+ */
+/* function (AMDF). The AMDF operates on low-pass, inverse filtered */
+/* speech. (The low-pass filter is an 800 Hz, 19 tap, equiripple, FIR
+*/
+/* filter and the inverse filter is a 2nd-order LPC filter.) The pitch
+*/
+/* estimate is later refined by dynamic programming (DYPTRK). However,
+*/
+/* since some of DYPTRK's parameters are a function of the voicing */
+/* decisions, a voicing decision must precede the final pitch estimation.
+*/
+/* See subroutines LPFILT, IVFILT, and TBDM. */
+/* LPFILT reads indices LBUFH-LFRAME-29 = 511 through LBUFH = 720 */
+/* of INBUF, and writes indices LBUFH+1-LFRAME = 541 through LBUFH
+*/
+/* = 720 of LPBUF. */
+ lpfilt_(&inbuf[228], &lpbuf[384], &c__312, &contrl_1.lframe);
+/* IVFILT reads indices (PWINH-LFRAME-7) = 353 through PWINH = 540
+*/
+/* of LPBUF, and writes indices (PWINH-LFRAME+1) = 361 through */
+/* PWINH = 540 of IVBUF. */
+ ivfilt_(&lpbuf[204], ivbuf, &c__312, &contrl_1.lframe, ivrc);
+/* TBDM reads indices PWINL = 229 through */
+/* (PWINL-1)+MAXWIN+(TAU(LTAU)-TAU(1))/2 = 452 of IVBUF, and writes
+*/
+/* indices 1 through LTAU = 60 of AMDF. */
+ tbdm_(ivbuf, &c__156, tau, &c__60, amdf, &minptr, &maxptr, &mintau);
+/* Voicing decisions are made for each half frame of input speech.
+*/
+/* An initial voicing classification is made for each half of the */
+/* analysis frame, and the voicing decisions for the present frame */
+/* are finalized. See subroutine VOICIN. */
+/* The voicing detector (VOICIN) classifies the input signal as */
+/* unvoiced (including silence) or voiced using the AMDF windowed */
+/* maximum-to-minimum ratio, the zero crossing rate, energy measures, */
+/* reflection coefficients, and prediction gains. */
+/* The pitch and voicing rules apply smoothing and isolated */
+/* corrections to the pitch and voicing estimates and, in the process,
+*/
+/* introduce two frames of delay into the corrected pitch estimates and
+*/
+/* voicing decisions. */
+ for (half = 1; half <= 2; ++half) {
+ voicin_(&vwin[4], inbuf, lpbuf, buflim, &half, &amdf[minptr - 1], &
+ amdf[maxptr - 1], &mintau, ivrc, obound, voibuf, &c__3, st);
+ }
+/* Find the minimum cost pitch decision over several frames */
+/* given the current voicing decision and the AMDF array */
+ dyptrk_(amdf, &c__60, &minptr, &voibuf[7], pitch, &midx, st);
+ ipitch = tau[midx - 1];
+/* Place spectrum analysis and energy windows */
+ placea_(&ipitch, voibuf, &obound[2], &c__3, vwin, awin, ewin, &
+ contrl_1.lframe, &c__156);
+/* Remove short term DC bias over the analysis window, Put result in ABUF
+*/
+ lanal = awin[5] + 1 - awin[4];
+ dcbias_(&lanal, &pebuf[awin[4] - 181], abuf);
+/* ABUF(1:LANAL) is now defined. It is equal to */
+/* PEBUF(AWIN(1,AF):AWIN(2,AF)) corrected for short term DC bias. */
+/* Compute RMS over integer number of pitch periods within the */
+/* analysis window. */
+/* Note that in a hardware implementation this computation may be */
+/* simplified by using diagonal elements of PHI computed by MLOAD. */
+ i__1 = ewin[5] - ewin[4] + 1;
+ energy_(&i__1, &abuf[ewin[4] - awin[4]], &rmsbuf[2]);
+/* Matrix load and invert, check RC's for stability */
+ mload_(&contrl_1.order, &c__1, &lanal, abuf, phi, psi);
+ invert_(&contrl_1.order, phi, psi, &rcbuf[20]);
+ rcchk_(&contrl_1.order, &rcbuf[10], &rcbuf[20]);
+/* Set return parameters */
+ voice[1] = voibuf[2];
+ voice[2] = voibuf[3];
+ *rms = rmsbuf[0];
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ rc[i__] = rcbuf[i__ - 1];
+ }
+ return 0;
+} /* analys_ */
diff --git a/src/lpc10/bsynz.c b/src/lpc10/bsynz.c
new file mode 100644
index 0000000..b14932a
--- /dev/null
+++ b/src/lpc10/bsynz.c
@@ -0,0 +1,344 @@
+/*
+ * Revision 1.2 1996/08/20 20:18:55 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:58 jaf
+ * Initial revision
+ *
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+int bsynz_(real *coef, integer *ip, integer *iv, real *sout, real *rms, real *ratio, real *g2pass, struct lpc10_decoder_state *st);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* ***************************************************************** */
+
+/* BSYNZ Version 54 */
+
+/*
+ * Revision 1.2 1996/08/20 20:18:55 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:58 jaf
+ * Initial revision
+ * */
+/* Revision 1.4 1996/03/27 18:11:22 jaf */
+/* Changed the range of NOISE printed out in the debugging statements, */
+/* even though they are commented out. I didn't discover this until I */
+/* tried comparing two different versions of the LPC-10 coder, each with */
+/* full tracing enabled. */
+
+/* Revision 1.3 1996/03/26 19:33:23 jaf */
+/* Commented out trace statements. */
+
+/* Revision 1.2 1996/03/20 17:12:54 jaf */
+/* Added comments about which indices of array arguments are read or */
+/* written. */
+
+/* Rearranged local variable declarations to indicate which need to be */
+/* saved from one invocation to the next. Added entry INITBSYNZ to */
+/* reinitialize the local state variables, if desired. */
+
+/* Revision 1.1 1996/02/07 14:43:15 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Synthesize One Pitch Epoch */
+
+/* Input: */
+/* COEF - Predictor coefficients */
+/* Indices 1 through ORDER read. */
+/* IP - Pitch period (number of samples to synthesize) */
+/* IV - Voicing for the current epoch */
+/* RMS - Energy for the current epoch */
+/* RATIO - Energy slope for plosives */
+/* G2PASS- Sharpening factor for 2 pass synthesis */
+/* Output: */
+/* SOUT - Synthesized speech */
+/* Indices 1 through IP written. */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITBSYNZ. */
+
+/* Subroutine */ int bsynz_(real *coef, integer *ip, integer *iv,
+ real *sout, real *rms, real *ratio, real *g2pass,
+ struct lpc10_decoder_state *st)
+{
+ /* Initialized data */
+
+ integer *ipo;
+ real *rmso;
+ static integer kexc[25] = { 8,-16,26,-48,86,-162,294,-502,718,-728,184,
+ 672,-610,-672,184,728,718,502,294,162,86,48,26,16,8 };
+ real *exc;
+ real *exc2;
+ real *lpi1;
+ real *lpi2;
+ real *lpi3;
+ real *hpi1;
+ real *hpi2;
+ real *hpi3;
+
+ /* System generated locals */
+ integer i__1, i__2;
+ real r__1, r__2;
+
+ /* Builtin functions */
+ double sqrt(doublereal);
+
+ /* Local variables */
+ real gain, xssq;
+ integer i__, j, k;
+ real noise[166], pulse;
+ integer px;
+ real sscale;
+ extern integer random_(struct lpc10_decoder_state *);
+ real xy, sum, ssq;
+ real lpi0, hpi0;
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Function return value definitions */
+/* Parameters/constants */
+/* KEXC is not a Fortran PARAMETER, but it is an array initialized
+*/
+/* with a DATA statement that is never modified. */
+/* Local variables that need not be saved */
+/* NOISE is declared with range (1:MAXPIT+MAXORD), but only indices
+*/
+/* ORDER+1 through ORDER+IP are ever used, and I think that IP */
+/* .LE. MAXPIT. Why not declare it to be in the range (1:MAXPIT) */
+/* and use that range? */
+/* Local state */
+/* I believe that only indices 1 through ORDER of EXC need to be */
+/* saved from one invocation to the next, but we may as well save */
+/* the whole array. */
+/* None of these local variables were given initial values in the */
+/* original code. I'm guessing that 0 is a reasonable initial */
+/* value for all of them. */
+ /* Parameter adjustments */
+ if (coef) {
+ --coef;
+ }
+ if (sout) {
+ --sout;
+ }
+
+ /* Function Body */
+ ipo = &(st->ipo);
+ exc = &(st->exc[0]);
+ exc2 = &(st->exc2[0]);
+ lpi1 = &(st->lpi1);
+ lpi2 = &(st->lpi2);
+ lpi3 = &(st->lpi3);
+ hpi1 = &(st->hpi1);
+ hpi2 = &(st->hpi2);
+ hpi3 = &(st->hpi3);
+ rmso = &(st->rmso_bsynz);
+
+/* MAXPIT+MAXORD=166 */
+/* Calculate history scale factor XY and scale filter state */
+/* Computing MIN */
+ r__1 = *rmso / (*rms + 1e-6f);
+ xy = min(r__1,8.f);
+ *rmso = *rms;
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ exc2[i__ - 1] = exc2[*ipo + i__ - 1] * xy;
+ }
+ *ipo = *ip;
+ if (*iv == 0) {
+/* Generate white noise for unvoiced */
+ i__1 = *ip;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ exc[contrl_1.order + i__ - 1] = (real) (random_(st) / 64);
+ }
+/* Impulse doublet excitation for plosives */
+/* (RANDOM()+32768) is in the range 0 to 2**16-1. Therefore the
+ */
+/* following expression should be evaluated using integers with
+at */
+/* least 32 bits (16 isn't enough), and PX should be in the rang
+e */
+/* ORDER+1+0 through ORDER+1+(IP-2) .EQ. ORDER+IP-1. */
+ px = (random_(st) + 32768) * (*ip - 1) / 65536 + contrl_1.order + 1;
+ r__1 = *ratio / 4 * 1.f;
+ pulse = r__1 * 342;
+ if (pulse > 2e3f) {
+ pulse = 2e3f;
+ }
+ exc[px - 1] += pulse;
+ exc[px] -= pulse;
+/* Load voiced excitation */
+ } else {
+ sscale = sqrt((real) (*ip)) / 6.928f;
+ i__1 = *ip;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ exc[contrl_1.order + i__ - 1] = 0.f;
+ if (i__ <= 25) {
+ exc[contrl_1.order + i__ - 1] = sscale * kexc[i__ - 1];
+ }
+ lpi0 = exc[contrl_1.order + i__ - 1];
+ r__2 = exc[contrl_1.order + i__ - 1] * .125f + *lpi1 * .75f;
+ r__1 = r__2 + *lpi2 * .125f;
+ exc[contrl_1.order + i__ - 1] = r__1 + *lpi3 * 0.f;
+ *lpi3 = *lpi2;
+ *lpi2 = *lpi1;
+ *lpi1 = lpi0;
+ }
+ i__1 = *ip;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ noise[contrl_1.order + i__ - 1] = random_(st) * 1.f / 64;
+ hpi0 = noise[contrl_1.order + i__ - 1];
+ r__2 = noise[contrl_1.order + i__ - 1] * -.125f + *hpi1 * .25f;
+ r__1 = r__2 + *hpi2 * -.125f;
+ noise[contrl_1.order + i__ - 1] = r__1 + *hpi3 * 0.f;
+ *hpi3 = *hpi2;
+ *hpi2 = *hpi1;
+ *hpi1 = hpi0;
+ }
+ i__1 = *ip;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ exc[contrl_1.order + i__ - 1] += noise[contrl_1.order + i__ - 1];
+ }
+ }
+/* Synthesis filters: */
+/* Modify the excitation with all-zero filter 1 + G*SUM */
+ xssq = 0.f;
+ i__1 = *ip;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ k = contrl_1.order + i__;
+ sum = 0.f;
+ i__2 = contrl_1.order;
+ for (j = 1; j <= i__2; ++j) {
+ sum += coef[j] * exc[k - j - 1];
+ }
+ sum *= *g2pass;
+ exc2[k - 1] = sum + exc[k - 1];
+ }
+/* Synthesize using the all pole filter 1 / (1 - SUM) */
+ i__1 = *ip;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ k = contrl_1.order + i__;
+ sum = 0.f;
+ i__2 = contrl_1.order;
+ for (j = 1; j <= i__2; ++j) {
+ sum += coef[j] * exc2[k - j - 1];
+ }
+ exc2[k - 1] = sum + exc2[k - 1];
+ xssq += exc2[k - 1] * exc2[k - 1];
+ }
+/* Save filter history for next epoch */
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ exc[i__ - 1] = exc[*ip + i__ - 1];
+ exc2[i__ - 1] = exc2[*ip + i__ - 1];
+ }
+/* Apply gain to match RMS */
+ r__1 = *rms * *rms;
+ ssq = r__1 * *ip;
+ gain = sqrt(ssq / xssq);
+ i__1 = *ip;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ sout[i__] = gain * exc2[contrl_1.order + i__ - 1];
+ }
+ return 0;
+} /* bsynz_ */
diff --git a/src/lpc10/chanwr.c b/src/lpc10/chanwr.c
new file mode 100644
index 0000000..50121c4
--- /dev/null
+++ b/src/lpc10/chanwr.c
@@ -0,0 +1,210 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:20:24 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Revision 1.1 1996/08/19 22:40:31 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+int chanwr_(integer *order, integer *ipitv, integer *irms, integer *irc, integer *ibits, struct lpc10_encoder_state *st);
+int chanrd_(integer *order, integer *ipitv, integer *irms, integer *irc, integer *ibits);
+
+/* *********************************************************************** */
+
+/* CHANL Version 49 */
+
+/*
+ * Revision 1.2 1996/08/20 20:20:24 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Revision 1.1 1996/08/19 22:40:31 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/21 15:14:57 jaf */
+/* Added comments about which indices of argument arrays are read or */
+/* written, and about the one bit of local state in CHANWR. CHANRD */
+/* has no local state. */
+
+/* Revision 1.2 1996/03/13 18:55:10 jaf */
+/* Comments added explaining which of the local variables of this */
+/* subroutine need to be saved from one invocation to the next, and which */
+/* do not. */
+
+/* Revision 1.1 1996/02/07 14:43:31 jaf */
+/* Initial revision */
+
+
+/* *********************************************************************** */
+
+/* CHANWR: */
+/* Place quantized parameters into bitstream */
+
+/* Input: */
+/* ORDER - Number of reflection coefficients (not really variable) */
+/* IPITV - Quantized pitch/voicing parameter */
+/* IRMS - Quantized energy parameter */
+/* IRC - Quantized reflection coefficients */
+/* Indices 1 through ORDER read. */
+/* Output: */
+/* IBITS - Serial bitstream */
+/* Indices 1 through 54 written. */
+/* Bit 54, the SYNC bit, alternates from one call to the next. */
+
+/* Subroutine CHANWR maintains one bit of local state from one call to */
+/* the next, in the variable ISYNC. I believe that this one bit is only */
+/* intended to allow a receiver to resynchronize its interpretation of */
+/* the bit stream, by looking for which of the 54 bits alternates every */
+/* frame time. This is just a simple framing mechanism that is not */
+/* useful when other, higher overhead framing mechanisms are used to */
+/* transmit the coded frames. */
+
+/* I'm not going to make an entry to reinitialize this bit, since it */
+/* doesn't help a receiver much to know whether the first sync bit is a 0 */
+/* or a 1. It needs to examine several frames in sequence to have */
+/* reasonably good assurance that its framing is correct. */
+
+
+/* CHANRD: */
+/* Reconstruct parameters from bitstream */
+
+/* Input: */
+/* ORDER - Number of reflection coefficients (not really variable) */
+/* IBITS - Serial bitstream */
+/* Indices 1 through 53 read (SYNC bit is ignored). */
+/* Output: */
+/* IPITV - Quantized pitch/voicing parameter */
+/* IRMS - Quantized energy parameter */
+/* IRC - Quantized reflection coefficients */
+/* Indices 1 through ORDER written */
+
+/* Entry CHANRD has no local state. */
+
+
+
+/* IBITS is 54 bits of LPC data ordered as follows: */
+/* R1-0, R2-0, R3-0, P-0, A-0, */
+/* R1-1, R2-1, R3-1, P-1, A-1, */
+/* R1-2, R4-0, R3-2, A-2, P-2, R4-1, */
+/* R1-3, R2-2, R3-3, R4-2, A-3, */
+/* R1-4, R2-3, R3-4, R4-3, A-4, */
+/* P-3, R2-4, R7-0, R8-0, P-4, R4-4, */
+/* R5-0, R6-0, R7-1,R10-0, R8-1, */
+/* R5-1, R6-1, R7-2, R9-0, P-5, */
+/* R5-2, R6-2,R10-1, R8-2, P-6, R9-1, */
+/* R5-3, R6-3, R7-3, R9-2, R8-3, SYNC */
+static int chanwr_0_(int n__, integer *order, integer *ipitv,
+ integer *irms, integer *irc, integer *ibits,
+ struct lpc10_encoder_state *st)
+{
+ /* Initialized data */
+
+ integer *isync;
+ static integer bit[10] = { 2,4,8,8,8,8,16,16,16,16 };
+ static integer iblist[53] = { 13,12,11,1,2,13,12,11,1,2,13,10,11,2,1,10,
+ 13,12,11,10,2,13,12,11,10,2,1,12,7,6,1,10,9,8,7,4,6,9,8,7,5,1,9,8,
+ 4,6,1,5,9,8,7,5,6 };
+
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ integer itab[13], i__;
+
+/* Arguments */
+/* Parameters/constants */
+/* These arrays are not Fortran PARAMETER's, but they are defined */
+/* by DATA statements below, and their contents are never altered.
+*/
+/* Local variables that need not be saved */
+/* Local state */
+/* ISYNC is only used by CHANWR, not by ENTRY CHANRD. */
+
+ /* Parameter adjustments */
+ --irc;
+ --ibits;
+
+ /* Function Body */
+ switch(n__) {
+ case 1: goto L_chanrd;
+ }
+
+ isync = &(st->isync);
+
+/* ***********************************************************************
+ */
+/* Place quantized parameters into bitstream */
+/* ***********************************************************************
+ */
+/* Place parameters into ITAB */
+ itab[0] = *ipitv;
+ itab[1] = *irms;
+ itab[2] = 0;
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ itab[i__ + 2] = irc[*order + 1 - i__] & 32767;
+ }
+/* Put 54 bits into IBITS array */
+ for (i__ = 1; i__ <= 53; ++i__) {
+ ibits[i__] = itab[iblist[i__ - 1] - 1] & 1;
+ itab[iblist[i__ - 1] - 1] /= 2;
+ }
+ ibits[54] = *isync & 1;
+ *isync = 1 - *isync;
+ return 0;
+/* ***********************************************************************
+ */
+/* Reconstruct parameters from bitstream */
+/* ***********************************************************************
+ */
+
+L_chanrd:
+/* Reconstruct ITAB */
+ for (i__ = 1; i__ <= 13; ++i__) {
+ itab[i__ - 1] = 0;
+ }
+ for (i__ = 1; i__ <= 53; ++i__) {
+ itab[iblist[54 - i__ - 1] - 1] = (itab[iblist[54 - i__ - 1] - 1] << 1)
+ + ibits[54 - i__];
+ }
+/* Sign extend RC's */
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ if ((itab[i__ + 2] & bit[i__ - 1]) != 0) {
+ itab[i__ + 2] -= bit[i__ - 1] << 1;
+ }
+ }
+/* Restore variables */
+ *ipitv = itab[0];
+ *irms = itab[1];
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ irc[i__] = itab[*order + 4 - i__ - 1];
+ }
+ return 0;
+} /* chanwr_ */
+
+/* Subroutine */ int chanwr_(integer *order, integer *ipitv, integer *irms,
+ integer *irc, integer *ibits, struct lpc10_encoder_state *st)
+{
+ return chanwr_0_(0, order, ipitv, irms, irc, ibits, st);
+ }
+
+/* Subroutine */ int chanrd_(integer *order, integer *ipitv, integer *irms,
+ integer *irc, integer *ibits)
+{
+ return chanwr_0_(1, order, ipitv, irms, irc, ibits, 0);
+ }
diff --git a/src/lpc10/dcbias.c b/src/lpc10/dcbias.c
new file mode 100644
index 0000000..9eeaf3c
--- /dev/null
+++ b/src/lpc10/dcbias.c
@@ -0,0 +1,80 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:40:23 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int dcbias_(integer *len, real *speech, real *sigout);
+
+/* ********************************************************************* */
+
+/* DCBIAS Version 50 */
+
+/*
+ * Revision 1.1 1996/08/19 22:40:23 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/18 21:19:22 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 16:44:53 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:44:21 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Calculate and remove DC bias from buffer. */
+
+/* Input: */
+/* LEN - Length of speech buffers */
+/* SPEECH - Input speech buffer */
+/* Indices 1 through LEN read. */
+/* Output: */
+/* SIGOUT - Output speech buffer */
+/* Indices 1 through LEN written */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int dcbias_(integer *len, real *speech, real *sigout)
+{
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ real bias;
+ integer i__;
+
+/* Arguments */
+/* Local variables that need not be saved */
+ /* Parameter adjustments */
+ --sigout;
+ --speech;
+
+ /* Function Body */
+ bias = 0.f;
+ i__1 = *len;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ bias += speech[i__];
+ }
+ bias /= *len;
+ i__1 = *len;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ sigout[i__] = speech[i__] - bias;
+ }
+ return 0;
+} /* dcbias_ */
+
diff --git a/src/lpc10/decode.c b/src/lpc10/decode.c
new file mode 100644
index 0000000..dde0bbf
--- /dev/null
+++ b/src/lpc10/decode.c
@@ -0,0 +1,515 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:22:39 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:38 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int decode_(integer *ipitv, integer *irms, integer *irc, integer *voice, integer *pitch, real *rms, real *rc, struct lpc10_decoder_state *st);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* Table of constant values */
+
+static integer c__2 = 2;
+
+/* ***************************************************************** */
+
+/* DECODE Version 54 */
+
+/*
+ * Revision 1.2 1996/08/20 20:22:39 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:38 jaf
+ * Initial revision
+ * */
+/* Revision 1.5 1996/05/23 20:06:03 jaf */
+/* Assigned PITCH a "default" value on the first call, since otherwise it */
+/* would be left uninitialized. */
+
+/* Revision 1.4 1996/03/26 19:35:18 jaf */
+/* Commented out trace statements. */
+
+/* Revision 1.3 1996/03/21 21:10:50 jaf */
+/* Added entry INITDECODE to reinitialize the local state of subroutine */
+/* DECODE. */
+
+/* Revision 1.2 1996/03/21 21:04:50 jaf */
+/* Determined which local variables should be saved from one invocation */
+/* to the next, and guessed initial values for some that should have been */
+/* saved, but weren't given initial values. Many of the arrays are */
+/* "constants", and many local variables are only used if the "global" */
+/* variable CORRP is .TRUE. */
+
+/* Added comments explaining which indices of array arguments are read or */
+/* written. */
+
+/* Revision 1.1 1996/02/12 03:21:10 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* This subroutine provides error correction and decoding */
+/* for all LPC parameters */
+
+/* Input: */
+/* IPITV - Index value of pitch */
+/* IRMS - Coded Energy */
+/* CORRP - Error correction: */
+/* If FALSE, parameters are decoded directly with no delay. If TRUE, */
+/* most important parameter bits are protected by Hamming code and */
+/* median smoothed. This requires an additional frame of delay. */
+/* Input/Output: */
+/* IRC - Coded Reflection Coefficients */
+/* Indices 1 through ORDER always read, then written. */
+/* Output: */
+/* VOICE - Half frame voicing decisions */
+/* Indices 1 through 2 written. */
+/* PITCH - Decoded pitch */
+/* RMS - Energy */
+/* RC - Reflection coefficients */
+/* Indices 1 through ORDER written. */
+
+/* NOTE: Zero RC's should be done more directly, but this would affect */
+/* coded parameter printout. */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITDECODE. */
+
+/* Subroutine */ int decode_(integer *ipitv, integer *irms,
+ integer *irc, integer *voice, integer *pitch, real *rms, real *rc,
+ struct lpc10_decoder_state *st)
+{
+ /* Initialized data */
+
+ logical *first;
+ static integer ethrs = 2048;
+ static integer ethrs1 = 128;
+ static integer ethrs2 = 1024;
+ static integer ethrs3 = 2048;
+ static integer ivtab[32] = { 24960,24960,24960,24960,25480,25480,25483,
+ 25480,16640,1560,1560,1560,16640,1816,1563,1560,24960,24960,24859,
+ 24856,26001,25881,25915,25913,1560,1560,7800,3640,1561,1561,3643,
+ 3641 };
+ static real corth[32] /* was [4][8] */ = { 32767.f,10.f,5.f,0.f,
+ 32767.f,8.f,4.f,0.f,32.f,6.4f,3.2f,0.f,32.f,6.4f,3.2f,0.f,32.f,
+ 11.2f,6.4f,0.f,32.f,11.2f,6.4f,0.f,16.f,5.6f,3.2f,0.f,16.f,5.6f,
+ 3.2f,0.f };
+ static integer detau[128] = { 0,0,0,3,0,3,3,31,0,3,3,21,3,3,29,30,0,3,3,
+ 20,3,25,27,26,3,23,58,22,3,24,28,3,0,3,3,3,3,39,33,32,3,37,35,36,
+ 3,38,34,3,3,42,46,44,50,40,48,3,54,3,56,3,52,3,3,1,0,3,3,108,3,78,
+ 100,104,3,84,92,88,156,80,96,3,3,74,70,72,66,76,68,3,62,3,60,3,64,
+ 3,3,1,3,116,132,112,148,152,3,3,140,3,136,3,144,3,3,1,124,120,128,
+ 3,3,3,3,1,3,3,3,1,3,1,1,1 };
+ static integer rmst[64] = { 1024,936,856,784,718,656,600,550,502,460,420,
+ 384,352,328,294,270,246,226,206,188,172,158,144,132,120,110,102,
+ 92,84,78,70,64,60,54,50,46,42,38,34,32,30,26,24,22,20,18,17,16,15,
+ 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
+ static integer detab7[32] = { 4,11,18,25,32,39,46,53,60,66,72,77,82,87,92,
+ 96,101,104,108,111,114,115,117,119,121,122,123,124,125,126,127,
+ 127 };
+ static real descl[8] = { .6953f,.625f,.5781f,.5469f,.5312f,.5391f,.4688f,
+ .3828f };
+ integer *ivp2h;
+ static integer deadd[8] = { 1152,-2816,-1536,-3584,-1280,-2432,768,-1920 }
+ ;
+ static integer qb[8] = { 511,511,1023,1023,1023,1023,2047,4095 };
+ static integer nbit[10] = { 8,8,5,5,4,4,4,4,3,2 };
+ static integer zrc[10] = { 0,0,0,0,0,3,0,2,0,0 };
+ static integer bit[5] = { 2,4,8,16,32 };
+ integer *iovoic;
+ integer *iavgp;
+ integer *iptold;
+ integer *erate;
+ integer *drc;
+ integer *dpit;
+ integer *drms;
+
+ /* System generated locals */
+ integer i__1, i__2;
+
+ /* Builtin functions */
+ integer pow_ii(integer *, integer *);
+
+ /* Local variables */
+ extern /* Subroutine */ int ham84_(integer *, integer *, integer *);
+ integer ipit, iout, i__, icorf, index, ivoic, ixcor, i1, i2, i4;
+ extern integer median_(integer *, integer *, integer *);
+ integer ishift, errcnt, lsb;
+
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Arguments */
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is */
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Function return value definitions */
+
+/* Parameters/constants */
+
+/* The variables below that are not Fortran PARAMETER's are */
+/* initialized with DATA statements, and then never modified. */
+/* The following are used regardless of CORRP's value. */
+
+/* DETAU, NBIT, QB, DEADD, DETAB7, RMST, DESCL */
+
+/* The following are used only if CORRP is .TRUE. */
+
+/* ETHRS, ETHRS1, ETHRS2, ETHRS3, IVTAB, BIT, CORTH, ZRC */
+
+/* Local variables that need not be saved */
+
+/* The following are used regardless of CORRP's value */
+/* The following are used only if CORRP is .TRUE. */
+
+/* Local state */
+
+/* The following are used regardless of CORRP's value */
+/* The following are used only if CORRP is .TRUE. */
+/* I am guessing the initial values for IVP2H, IOVOIC, DRC, DPIT, */
+/* and DRMS. They should be checked to see if they are reasonable.
+*/
+/* I'm also guessing for ERATE, but I think 0 is the right initial
+*/
+/* value. */
+ /* Parameter adjustments */
+ if (irc) {
+ --irc;
+ }
+ if (voice) {
+ --voice;
+ }
+ if (rc) {
+ --rc;
+ }
+
+ /* Function Body */
+
+ iptold = &(st->iptold);
+ first = &(st->first);
+ ivp2h = &(st->ivp2h);
+ iovoic = &(st->iovoic);
+ iavgp = &(st->iavgp);
+ erate = &(st->erate);
+ drc = &(st->drc[0]);
+ dpit = &(st->dpit[0]);
+ drms = &(st->drms[0]);
+
+/* DATA statements for "constants" defined above. */
+/* IF (LISTL.GE.3) WRITE(FDEBUG,800) IPITV,IRMS,(IRC(J),J=1,ORDER) */
+/* 800 FORMAT(1X,' <<ERRCOR IN>>',T32,6X,I6,I5,T50,10I8) */
+/* If no error correction, do pitch and voicing then jump to decode */
+ i4 = detau[*ipitv];
+ if (! contrl_1.corrp) {
+ voice[1] = 1;
+ voice[2] = 1;
+ if (*ipitv <= 1) {
+ voice[1] = 0;
+ }
+ if (*ipitv == 0 || *ipitv == 2) {
+ voice[2] = 0;
+ }
+ *pitch = i4;
+ if (*pitch <= 4) {
+ *pitch = *iptold;
+ }
+ if (voice[1] == 1 && voice[2] == 1) {
+ *iptold = *pitch;
+ }
+ if (voice[1] != voice[2]) {
+ *pitch = *iptold;
+ }
+ goto L900;
+ }
+/* Do error correction pitch and voicing */
+ if (i4 > 4) {
+ dpit[0] = i4;
+ ivoic = 2;
+ *iavgp = (*iavgp * 15 + i4 + 8) / 16;
+ } else {
+ ivoic = i4;
+ dpit[0] = *iavgp;
+ }
+ drms[0] = *irms;
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ drc[i__ * 3 - 3] = irc[i__];
+ }
+/* Determine index to IVTAB from V/UV decision */
+/* If error rate is high then use alternate table */
+ index = (*ivp2h << 4) + (*iovoic << 2) + ivoic + 1;
+ i1 = ivtab[index - 1];
+ ipit = i1 & 3;
+ icorf = i1 / 8;
+ if (*erate < ethrs) {
+ icorf /= 64;
+ }
+/* Determine error rate: 4=high 1=low */
+ ixcor = 4;
+ if (*erate < ethrs3) {
+ ixcor = 3;
+ }
+ if (*erate < ethrs2) {
+ ixcor = 2;
+ }
+ if (*erate < ethrs1) {
+ ixcor = 1;
+ }
+/* Voice/unvoice decision determined from bits 0 and 1 of IVTAB */
+ voice[1] = icorf / 2 & 1;
+ voice[2] = icorf & 1;
+/* Skip decoding on first frame because present data not yet available */
+ if (*first) {
+ *first = FALSE_;
+/* Assign PITCH a "default" value on the first call, since */
+/* otherwise it would be left uninitialized. The two lines
+*/
+/* below were copied from above, since it seemed like a */
+/* reasonable thing to do for the first call. */
+ *pitch = i4;
+ if (*pitch <= 4) {
+ *pitch = *iptold;
+ }
+ goto L500;
+ }
+/* If bit 4 of ICORF is set then correct RMS and RC(1) - RC(4). */
+/* Determine error rate and correct errors using a Hamming 8,4 code */
+/* during transition or unvoiced frame. If IOUT is negative, */
+/* more than 1 error occurred, use previous frame's parameters. */
+ if ((icorf & bit[3]) != 0) {
+ errcnt = 0;
+ lsb = drms[1] & 1;
+ index = (drc[22] << 4) + drms[1] / 2;
+ ham84_(&index, &iout, &errcnt);
+ drms[1] = drms[2];
+ if (iout >= 0) {
+ drms[1] = (iout << 1) + lsb;
+ }
+ for (i__ = 1; i__ <= 4; ++i__) {
+ if (i__ == 1) {
+ i1 = ((drc[25] & 7) << 1) + (drc[28] & 1);
+ } else {
+ i1 = drc[(9 - i__) * 3 - 2] & 15;
+ }
+ i2 = drc[(5 - i__) * 3 - 2] & 31;
+ lsb = i2 & 1;
+ index = (i1 << 4) + i2 / 2;
+ ham84_(&index, &iout, &errcnt);
+ if (iout >= 0) {
+ iout = (iout << 1) + lsb;
+ if ((iout & 16) == 16) {
+ iout += -32;
+ }
+ } else {
+ iout = drc[(5 - i__) * 3 - 1];
+ }
+ drc[(5 - i__) * 3 - 2] = iout;
+ }
+/* Determine error rate */
+ *erate = *erate * .96875f + errcnt * 102;
+ }
+/* Get unsmoothed RMS, RC's, and PITCH */
+ *irms = drms[1];
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ irc[i__] = drc[i__ * 3 - 2];
+ }
+ if (ipit == 1) {
+ dpit[1] = dpit[2];
+ }
+ if (ipit == 3) {
+ dpit[1] = dpit[0];
+ }
+ *pitch = dpit[1];
+/* If bit 2 of ICORF is set then smooth RMS and RC's, */
+ if ((icorf & bit[1]) != 0) {
+ if ((i__1 = drms[1] - drms[0], (real) abs(i__1)) >= corth[ixcor + 3]
+ && (i__2 = drms[1] - drms[2], (real) abs(i__2)) >= corth[
+ ixcor + 3]) {
+ *irms = median_(&drms[2], &drms[1], drms);
+ }
+ for (i__ = 1; i__ <= 6; ++i__) {
+ if ((i__1 = drc[i__ * 3 - 2] - drc[i__ * 3 - 3], (real) abs(i__1))
+ >= corth[ixcor + ((i__ + 2) << 2) - 5] && (i__2 = drc[i__ *
+ 3 - 2] - drc[i__ * 3 - 1], (real) abs(i__2)) >= corth[
+ ixcor + ((i__ + 2) << 2) - 5]) {
+ irc[i__] = median_(&drc[i__ * 3 - 1], &drc[i__ * 3 - 2], &drc[
+ i__ * 3 - 3]);
+ }
+ }
+ }
+/* If bit 3 of ICORF is set then smooth pitch */
+ if ((icorf & bit[2]) != 0) {
+ if ((i__1 = dpit[1] - dpit[0], (real) abs(i__1)) >= corth[ixcor - 1]
+ && (i__2 = dpit[1] - dpit[2], (real) abs(i__2)) >= corth[
+ ixcor - 1]) {
+ *pitch = median_(&dpit[2], &dpit[1], dpit);
+ }
+ }
+/* If bit 5 of ICORF is set then RC(5) - RC(10) are loaded with */
+/* values so that after quantization bias is removed in decode */
+/* the values will be zero. */
+L500:
+ if ((icorf & bit[4]) != 0) {
+ i__1 = contrl_1.order;
+ for (i__ = 5; i__ <= i__1; ++i__) {
+ irc[i__] = zrc[i__ - 1];
+ }
+ }
+/* House keeping - one frame delay */
+ *iovoic = ivoic;
+ *ivp2h = voice[2];
+ dpit[2] = dpit[1];
+ dpit[1] = dpit[0];
+ drms[2] = drms[1];
+ drms[1] = drms[0];
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ drc[i__ * 3 - 1] = drc[i__ * 3 - 2];
+ drc[i__ * 3 - 2] = drc[i__ * 3 - 3];
+ }
+L900:
+/* IF (LISTL.GE.3)WRITE(FDEBUG,801)VOICE,PITCH,IRMS,(IRC(J),J=1,ORDER) */
+/* 801 FORMAT(1X,'<<ERRCOR OUT>>',T32,2I3,I6,I5,T50,10I8) */
+/* Decode RMS */
+ *irms = rmst[(31 - *irms) * 2];
+/* Decode RC(1) and RC(2) from log-area-ratios */
+/* Protect from illegal coded value (-16) caused by bit errors */
+ for (i__ = 1; i__ <= 2; ++i__) {
+ i2 = irc[i__];
+ i1 = 0;
+ if (i2 < 0) {
+ i1 = 1;
+ i2 = -i2;
+ if (i2 > 15) {
+ i2 = 0;
+ }
+ }
+ i2 = detab7[i2 * 2];
+ if (i1 == 1) {
+ i2 = -i2;
+ }
+ ishift = 15 - nbit[i__ - 1];
+ irc[i__] = i2 * pow_ii(&c__2, &ishift);
+ }
+/* Decode RC(3)-RC(10) to sign plus 14 bits */
+ i__1 = contrl_1.order;
+ for (i__ = 3; i__ <= i__1; ++i__) {
+ i2 = irc[i__];
+ ishift = 15 - nbit[i__ - 1];
+ i2 *= pow_ii(&c__2, &ishift);
+ i2 += qb[i__ - 3];
+ irc[i__] = i2 * descl[i__ - 3] + deadd[i__ - 3];
+ }
+/* IF (LISTL.GE.3) WRITE(FDEBUG,811) IRMS, (IRC(I),I=1,ORDER) */
+/* 811 FORMAT(1X,'<<DECODE OUT>>',T45,I4,1X,10I8) */
+/* Scale RMS and RC's to reals */
+ *rms = (real) (*irms);
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ rc[i__] = irc[i__] / 16384.f;
+ }
+ return 0;
+} /* decode_ */
diff --git a/src/lpc10/deemp.c b/src/lpc10/deemp.c
new file mode 100644
index 0000000..4c19d12
--- /dev/null
+++ b/src/lpc10/deemp.c
@@ -0,0 +1,127 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:23:46 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:34 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int deemp_(real *x, integer *n, struct lpc10_decoder_state *st);
+
+/* ***************************************************************** */
+
+/* DEEMP Version 48 */
+
+/*
+ * Revision 1.2 1996/08/20 20:23:46 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:34 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/20 15:54:37 jaf */
+/* Added comments about which indices of array arguments are read or */
+/* written. */
+
+/* Added entry INITDEEMP to reinitialize the local state variables, if */
+/* desired. */
+
+/* Revision 1.2 1996/03/14 22:11:13 jaf */
+/* Comments added explaining which of the local variables of this */
+/* subroutine need to be saved from one invocation to the next, and which */
+/* do not. */
+
+/* Revision 1.1 1996/02/07 14:44:53 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* De-Emphasize output speech with 1 / ( 1 - .75z**-1 ) */
+/* cascaded with 200 Hz high pass filter */
+/* ( 1 - 1.9998z**-1 + z**-2 ) / ( 1 - 1.75z**-1 + .78z**-2 ) */
+
+/* WARNING! The coefficients above may be out of date with the code */
+/* below. Either that, or some kind of transformation was performed */
+/* on the coefficients above to create the code below. */
+
+/* Input: */
+/* N - Number of samples */
+/* Input/Output: */
+/* X - Speech */
+/* Indices 1 through N are read before being written. */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITDEEMP. */
+
+/* Subroutine */ int deemp_(real *x, integer *n, struct lpc10_decoder_state *st)
+{
+ /* Initialized data */
+
+ real *dei1;
+ real *dei2;
+ real *deo1;
+ real *deo2;
+ real *deo3;
+
+ /* System generated locals */
+ integer i__1;
+ real r__1;
+
+ /* Local variables */
+ integer k;
+ real dei0;
+
+/* Arguments */
+/* Local variables that need not be saved */
+/* Local state */
+/* All of the locals saved below were not given explicit initial */
+/* values in the original code. I think 0 is a safe choice. */
+ /* Parameter adjustments */
+ if (x) {
+ --x;
+ }
+
+ /* Function Body */
+
+ dei1 = &(st->dei1);
+ dei2 = &(st->dei2);
+ deo1 = &(st->deo1);
+ deo2 = &(st->deo2);
+ deo3 = &(st->deo3);
+
+ i__1 = *n;
+ for (k = 1; k <= i__1; ++k) {
+ dei0 = x[k];
+ r__1 = x[k] - *dei1 * 1.9998f + *dei2;
+ x[k] = r__1 + *deo1 * 2.5f - *deo2 * 2.0925f + *deo3 * .585f;
+ *dei2 = *dei1;
+ *dei1 = dei0;
+ *deo3 = *deo2;
+ *deo2 = *deo1;
+ *deo1 = x[k];
+ }
+ return 0;
+} /* deemp_ */
diff --git a/src/lpc10/difmag.c b/src/lpc10/difmag.c
new file mode 100644
index 0000000..8a30034
--- /dev/null
+++ b/src/lpc10/difmag.c
@@ -0,0 +1,106 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:32:31 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int difmag_(real *speech, integer *lpita, integer *tau, integer *ltau, integer *maxlag, real *amdf, integer *minptr, integer *maxptr);
+
+/* ********************************************************************** */
+
+/* DIFMAG Version 49 */
+
+/*
+ * Revision 1.1 1996/08/19 22:32:31 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/15 23:09:39 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 14:41:31 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:45:04 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Compute Average Magnitude Difference Function */
+
+/* Inputs: */
+/* SPEECH - Low pass filtered speech */
+/* Indices MIN_N1 through MAX_N1+LPITA-1 are read, where */
+/* MIN_N1 = (MAXLAG - MAX_TAU)/2+1 MAX_TAU = max of TAU(I) for I=1,LTAU
+*/
+/* MAX_N1 = (MAXLAG - MIN_TAU)/2+1 MIN_TAU = min of TAU(I) for I=1,LTAU
+*/
+/* LPITA - Length of speech buffer */
+/* TAU - Table of lags */
+/* Indices 1 through LTAU read. */
+/* LTAU - Number of lag values to compute */
+/* MAXLAG - Maximum possible lag value */
+/* Outputs: */
+/* (All of these outputs are also read, but only after being written.) */
+/* AMDF - Average Magnitude Difference for each lag in TAU */
+/* Indices 1 through LTAU written */
+/* MINPTR - Index of minimum AMDF value */
+/* MAXPTR - Index of maximum AMDF value */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int difmag_(real *speech, integer *lpita, integer *tau,
+ integer *ltau, integer *maxlag, real *amdf, integer *minptr, integer *
+ maxptr)
+{
+ /* System generated locals */
+ integer i__1, i__2;
+ real r__1;
+
+ /* Local variables */
+ integer i__, j, n1, n2;
+ real sum;
+
+/* Arguments */
+/* Local variables that need not be saved */
+/* Local state */
+/* None */
+ /* Parameter adjustments */
+ --amdf;
+ --tau;
+ --speech;
+
+ /* Function Body */
+ *minptr = 1;
+ *maxptr = 1;
+ i__1 = *ltau;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ n1 = (*maxlag - tau[i__]) / 2 + 1;
+ n2 = n1 + *lpita - 1;
+ sum = 0.f;
+ i__2 = n2;
+ for (j = n1; j <= i__2; j += 4) {
+ sum += (r__1 = speech[j] - speech[j + tau[i__]], abs(r__1));
+ }
+ amdf[i__] = sum;
+ if (amdf[i__] < amdf[*minptr]) {
+ *minptr = i__;
+ }
+ if (amdf[i__] > amdf[*maxptr]) {
+ *maxptr = i__;
+ }
+ }
+ return 0;
+} /* difmag_ */
+
diff --git a/src/lpc10/dyptrk.c b/src/lpc10/dyptrk.c
new file mode 100644
index 0000000..aa2f238
--- /dev/null
+++ b/src/lpc10/dyptrk.c
@@ -0,0 +1,342 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:25:29 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:26 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int dyptrk_(real *amdf, integer *ltau, integer *minptr, integer *voice, integer *pitch, integer *midx, struct lpc10_encoder_state *st);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* ********************************************************************* */
+
+/* DYPTRK Version 52 */
+
+/*
+ * Revision 1.2 1996/08/20 20:25:29 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:26 jaf
+ * Initial revision
+ * */
+/* Revision 1.5 1996/03/26 19:35:35 jaf */
+/* Commented out trace statements. */
+
+/* Revision 1.4 1996/03/19 18:03:22 jaf */
+/* Replaced the initialization "DATA P/60*DEPTH*0/" with "DATA P/120*0/", */
+/* because apparently Fortran (or at least f2c) can't handle expressions */
+/* like that. */
+
+/* Revision 1.3 1996/03/19 17:38:32 jaf */
+/* Added comments about the local variables that should be saved from one */
+/* invocation to the next. None of them were given initial values in the */
+/* original code, but from my testing, it appears that initializing them */
+/* all to 0 works. */
+
+/* Added entry INITDYPTRK to reinitialize these local variables. */
+
+/* Revision 1.2 1996/03/13 16:32:17 jaf */
+/* Comments added explaining which of the local variables of this */
+/* subroutine need to be saved from one invocation to the next, and which */
+/* do not. */
+
+/* WARNING! Some of them that should are never given initial values in */
+/* this code. Hopefully, Fortran 77 defines initial values for them, but */
+/* even so, giving them explicit initial values is preferable. */
+
+/* Revision 1.1 1996/02/07 14:45:14 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Dynamic Pitch Tracker */
+
+/* Input: */
+/* AMDF - Average Magnitude Difference Function array */
+/* Indices 1 through LTAU read, and MINPTR */
+/* LTAU - Number of lags in AMDF */
+/* MINPTR - Location of minimum AMDF value */
+/* VOICE - Voicing decision */
+/* Output: */
+/* PITCH - Smoothed pitch value, 2 frames delayed */
+/* MIDX - Initial estimate of current frame pitch */
+/* Compile time constant: */
+/* DEPTH - Number of frames to trace back */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITDYPTRK. */
+
+/* Subroutine */ int dyptrk_(real *amdf, integer *ltau, integer *
+ minptr, integer *voice, integer *pitch, integer *midx,
+ struct lpc10_encoder_state *st)
+{
+ /* Initialized data */
+
+ real *s;
+ integer *p;
+ integer *ipoint;
+ real *alphax;
+
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ integer pbar;
+ real sbar;
+ integer iptr, i__, j;
+ real alpha, minsc, maxsc;
+
+/* Arguments */
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Parameters/constants */
+/* Local variables that need not be saved */
+/* Note that PATH is only used for debugging purposes, and can be */
+/* removed. */
+/* Local state */
+/* It would be a bit more "general" to define S(LTAU), if Fortran */
+/* allows the argument of a function to be used as the dimension of
+*/
+/* a local array variable. */
+/* IPOINT is always in the range 0 to DEPTH-1. */
+/* WARNING! */
+
+/* In the original version of this subroutine, IPOINT, ALPHAX, */
+/* every element of S, and potentially any element of P with the */
+/* second index value .NE. IPTR were read without being given */
+/* initial values (all indices of P with second index equal to */
+/* IPTR are all written before being read in this subroutine). */
+
+/* From examining the code carefully, it appears that all of these
+*/
+/* should be saved from one invocation to the next. */
+
+/* I've run lpcsim with the "-l 6" option to see all of the */
+/* debugging information that is printed out by this subroutine */
+/* below, and it appears that S, P, IPOINT, and ALPHAX are all */
+/* initialized to 0 (these initial values would likely be different
+*/
+/* on different platforms, compilers, etc.). Given that the output
+*/
+/* of the coder sounds reasonable, I'm going to initialize these */
+/* variables to 0 explicitly. */
+
+ s = &(st->s[0]);
+ p = &(st->p[0]);
+ ipoint = &(st->ipoint);
+ alphax = &(st->alphax);
+
+
+ /* Parameter adjustments */
+ if (amdf) {
+ --amdf;
+ }
+
+ /* Function Body */
+
+/* Calculate the confidence factor ALPHA, used as a threshold slope in
+*/
+/* SEESAW. If unvoiced, set high slope so that every point in P array
+*/
+/* is marked as a potential pitch frequency. A scaled up version (ALPHAX
+)*/
+/* is used to maintain arithmetic precision. */
+ if (*voice == 1) {
+ *alphax = *alphax * .75f + amdf[*minptr] / 2.f;
+ } else {
+ *alphax *= .984375f;
+ }
+ alpha = *alphax / 16;
+ if (*voice == 0 && *alphax < 128.f) {
+ alpha = 8.f;
+ }
+/* SEESAW: Construct a pitch pointer array and intermediate winner functio
+n*/
+/* Left to right pass: */
+ iptr = *ipoint + 1;
+ p[iptr * 60 - 60] = 1;
+ i__ = 1;
+ pbar = 1;
+ sbar = s[0];
+ i__1 = *ltau;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ sbar += alpha;
+ if (sbar < s[i__ - 1]) {
+ s[i__ - 1] = sbar;
+ p[i__ + iptr * 60 - 61] = pbar;
+ } else {
+ sbar = s[i__ - 1];
+ p[i__ + iptr * 60 - 61] = i__;
+ pbar = i__;
+ }
+ }
+/* Right to left pass: */
+ i__ = pbar - 1;
+ sbar = s[i__];
+ while(i__ >= 1) {
+ sbar += alpha;
+ if (sbar < s[i__ - 1]) {
+ s[i__ - 1] = sbar;
+ p[i__ + iptr * 60 - 61] = pbar;
+ } else {
+ pbar = p[i__ + iptr * 60 - 61];
+ i__ = pbar;
+ sbar = s[i__ - 1];
+ }
+ --i__;
+ }
+/* Update S using AMDF */
+/* Find maximum, minimum, and location of minimum */
+ s[0] += amdf[1] / 2;
+ minsc = s[0];
+ maxsc = minsc;
+ *midx = 1;
+ i__1 = *ltau;
+ for (i__ = 2; i__ <= i__1; ++i__) {
+ s[i__ - 1] += amdf[i__] / 2;
+ if (s[i__ - 1] > maxsc) {
+ maxsc = s[i__ - 1];
+ }
+ if (s[i__ - 1] < minsc) {
+ *midx = i__;
+ minsc = s[i__ - 1];
+ }
+ }
+/* Subtract MINSC from S to prevent overflow */
+ i__1 = *ltau;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ s[i__ - 1] -= minsc;
+ }
+ maxsc -= minsc;
+/* Use higher octave pitch if significant null there */
+ j = 0;
+ for (i__ = 20; i__ <= 40; i__ += 10) {
+ if (*midx > i__) {
+ if (s[*midx - i__ - 1] < maxsc / 4) {
+ j = i__;
+ }
+ }
+ }
+ *midx -= j;
+/* TRACE: look back two frames to find minimum cost pitch estimate */
+ j = *ipoint;
+ *pitch = *midx;
+ for (i__ = 1; i__ <= 2; ++i__) {
+ j = j % 2 + 1;
+ *pitch = p[*pitch + j * 60 - 61];
+ }
+
+/* The following statement subtracts one from IPOINT, mod DEPTH. I
+*/
+/* think the author chose to add DEPTH-1, instead of subtracting 1,
+*/
+/* because then it will work even if MOD doesn't work as desired on
+*/
+/* negative arguments. */
+
+ *ipoint = (*ipoint + 1) % 2;
+ return 0;
+} /* dyptrk_ */
diff --git a/src/lpc10/encode.c b/src/lpc10/encode.c
new file mode 100644
index 0000000..6b87776
--- /dev/null
+++ b/src/lpc10/encode.c
@@ -0,0 +1,294 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:32:21 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int encode_(integer *voice, integer *pitch, real *rms, real *rc, integer *ipitch, integer *irms, integer *irc);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* Table of constant values */
+
+static integer c__2 = 2;
+
+/* ***************************************************************** */
+
+/* ENCODE Version 54 */
+
+/*
+ * Revision 1.1 1996/08/19 22:32:21 jaf
+ * Initial revision
+ * */
+/* Revision 1.5 1996/03/26 19:35:50 jaf */
+/* Commented out trace statements. */
+
+/* Revision 1.4 1996/03/21 00:26:29 jaf */
+/* Added the comment that this subroutine has no local state. */
+
+/* In the last check-in, I forgot to mention that I had added comments */
+/* explaining which indices of array arguments are read or written. */
+
+/* Revision 1.3 1996/03/21 00:22:39 jaf */
+/* Added comments explaining that all local arrays are effectively */
+/* constants. */
+
+/* Revision 1.2 1996/03/13 18:48:33 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:45:29 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Quantize LPC parameters for transmission */
+
+/* INPUTS: */
+/* VOICE - Half frame voicing decisions */
+/* Indices 1 through 2 read. */
+/* PITCH - Pitch */
+/* RMS - Energy */
+/* RC - Reflection coefficients */
+/* Indices 1 through ORDER read. */
+/* CORRP - Error Correction: TRUE = yes, FALSE = none */
+/* (this is defined in file control.fh) */
+/* OUTPUTS: */
+/* IPITCH - Coded pitch and voicing */
+/* IRMS - Quantized energy */
+/* IRC - Quantized reflection coefficients */
+/* Indices 1 through MAX(ORDER,2) written. */
+/* If CORRP is .TRUE., then indices 1 through 10 written */
+/* for unvoiced frames. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int encode_(integer *voice, integer *pitch, real *rms, real *
+ rc, integer *ipitch, integer *irms, integer *irc)
+{
+ /* Initialized data */
+
+ static integer enctab[16] = { 0,7,11,12,13,10,6,1,14,9,5,2,3,4,8,15 };
+ static integer entau[60] = { 19,11,27,25,29,21,23,22,30,14,15,7,39,38,46,
+ 42,43,41,45,37,53,49,51,50,54,52,60,56,58,26,90,88,92,84,86,82,83,
+ 81,85,69,77,73,75,74,78,70,71,67,99,97,113,112,114,98,106,104,108,
+ 100,101,76 };
+ static integer enadd[8] = { 1920,-768,2432,1280,3584,1536,2816,-1152 };
+ static real enscl[8] = { .0204f,.0167f,.0145f,.0147f,.0143f,.0135f,.0125f,
+ .0112f };
+ static integer enbits[8] = { 6,5,4,4,4,4,3,3 };
+ static integer entab6[64] = { 0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,
+ 3,3,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6,7,7,7,7,7,8,8,8,8,9,9,
+ 9,10,10,11,11,12,13,14,15 };
+ static integer rmst[64] = { 1024,936,856,784,718,656,600,550,502,460,420,
+ 384,352,328,294,270,246,226,206,188,172,158,144,132,120,110,102,
+ 92,84,78,70,64,60,54,50,46,42,38,34,32,30,26,24,22,20,18,17,16,15,
+ 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
+
+ /* System generated locals */
+ integer i__1, i__2;
+
+ /* Builtin functions */
+ integer pow_ii(integer *, integer *);
+
+ /* Local variables */
+ integer idel, nbit, i__, j, i2, i3, mrk;
+
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Arguments */
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Parameters/constants */
+/* These arrays are not Fortran PARAMETER's, but they are defined */
+/* by DATA statements below, and their contents are never altered.
+*/
+/* Local variables that need not be saved */
+ /* Parameter adjustments */
+ --irc;
+ --rc;
+ --voice;
+
+ /* Function Body */
+/* Scale RMS and RC's to integers */
+ *irms = *rms;
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ irc[i__] = rc[i__] * 32768.f;
+ }
+/* IF(LISTL.GE.3)WRITE(FDEBUG,800)VOICE,PITCH,IRMS,(IRC(I),I=1,ORDER) */
+/* 800 FORMAT(1X,/,' <<ENCODE IN>>',T32,2I3,I6,I5,T50,10I8) */
+/* Encode pitch and voicing */
+ if (voice[1] != 0 && voice[2] != 0) {
+ *ipitch = entau[*pitch - 1];
+ } else {
+ if (contrl_1.corrp) {
+ *ipitch = 0;
+ if (voice[1] != voice[2]) {
+ *ipitch = 127;
+ }
+ } else {
+ *ipitch = (voice[1] << 1) + voice[2];
+ }
+ }
+/* Encode RMS by binary table search */
+ j = 32;
+ idel = 16;
+ *irms = min(*irms,1023);
+ while(idel > 0) {
+ if (*irms > rmst[j - 1]) {
+ j -= idel;
+ }
+ if (*irms < rmst[j - 1]) {
+ j += idel;
+ }
+ idel /= 2;
+ }
+ if (*irms > rmst[j - 1]) {
+ --j;
+ }
+ *irms = 31 - j / 2;
+/* Encode RC(1) and (2) as log-area-ratios */
+ for (i__ = 1; i__ <= 2; ++i__) {
+ i2 = irc[i__];
+ mrk = 0;
+ if (i2 < 0) {
+ i2 = -i2;
+ mrk = 1;
+ }
+ i2 /= 512;
+ i2 = min(i2,63);
+ i2 = entab6[i2];
+ if (mrk != 0) {
+ i2 = -i2;
+ }
+ irc[i__] = i2;
+ }
+/* Encode RC(3) - (10) linearly, remove bias then scale */
+ i__1 = contrl_1.order;
+ for (i__ = 3; i__ <= i__1; ++i__) {
+ i2 = irc[i__] / 2;
+ i2 = (i2 + enadd[contrl_1.order + 1 - i__ - 1]) * enscl[
+ contrl_1.order + 1 - i__ - 1];
+/* Computing MIN */
+ i__2 = max(i2,-127);
+ i2 = min(i__2,127);
+ nbit = enbits[contrl_1.order + 1 - i__ - 1];
+ i3 = 0;
+ if (i2 < 0) {
+ i3 = -1;
+ }
+ i2 /= pow_ii(&c__2, &nbit);
+ if (i3 == -1) {
+ --i2;
+ }
+ irc[i__] = i2;
+ }
+/* Protect the most significant bits of the most */
+/* important parameters during non-voiced frames. */
+/* RC(1) - RC(4) are protected using 20 parity bits */
+/* replacing RC(5) - RC(10). */
+ if (contrl_1.corrp) {
+ if (*ipitch == 0 || *ipitch == 127) {
+ irc[5] = enctab[(irc[1] & 30) / 2];
+ irc[6] = enctab[(irc[2] & 30) / 2];
+ irc[7] = enctab[(irc[3] & 30) / 2];
+ irc[8] = enctab[(*irms & 30) / 2];
+ irc[9] = enctab[(irc[4] & 30) / 2] / 2;
+ irc[10] = enctab[(irc[4] & 30) / 2] & 1;
+ }
+ }
+/* IF(LISTL.GE.3)WRITE(FDEBUG,801)VOICE,IPITCH,IRMS,(IRC(J),J=1,ORDER) */
+/* 801 FORMAT(1X,'<<ENCODE OUT>>',T32,2I3,I6,I5,T50,10I8) */
+ return 0;
+} /* encode_ */
+
diff --git a/src/lpc10/energy.c b/src/lpc10/energy.c
new file mode 100644
index 0000000..fd553c6
--- /dev/null
+++ b/src/lpc10/energy.c
@@ -0,0 +1,76 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:32:17 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int energy_(integer *len, real *speech, real *rms);
+
+/* ********************************************************************* */
+
+/* ENERGY Version 50 */
+
+/*
+ * Revision 1.1 1996/08/19 22:32:17 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/18 21:17:41 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 16:46:02 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:45:40 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Compute RMS energy. */
+
+/* Input: */
+/* LEN - Length of speech buffer */
+/* SPEECH - Speech buffer */
+/* Indices 1 through LEN read. */
+/* Output: */
+/* RMS - Root Mean Square energy */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int energy_(integer *len, real *speech, real *rms)
+{
+ /* System generated locals */
+ integer i__1;
+
+ /* Builtin functions */
+ double sqrt(doublereal);
+
+ /* Local variables */
+ integer i__;
+
+/* Arguments */
+/* Local variables that need not be saved */
+ /* Parameter adjustments */
+ --speech;
+
+ /* Function Body */
+ *rms = 0.f;
+ i__1 = *len;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ *rms += speech[i__] * speech[i__];
+ }
+ *rms = sqrt(*rms / *len);
+ return 0;
+} /* energy_ */
+
diff --git a/src/lpc10/f2c.h b/src/lpc10/f2c.h
new file mode 100644
index 0000000..9a66a51
--- /dev/null
+++ b/src/lpc10/f2c.h
@@ -0,0 +1,215 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:26:28 jaf
+ * Any typedef defining a type that was used in lpc10_encoder_state or
+ * lpc10_decoder_state struct's was commented out here and added to
+ * lpc10.h.
+ *
+ * Revision 1.1 1996/08/19 22:32:13 jaf
+ * Initial revision
+ *
+
+*/
+
+/*
+ * f2c.h
+ *
+ * SCCS ID: @(#)f2c.h 1.2 96/05/19
+ */
+
+/* f2c.h -- Standard Fortran to C header file */
+
+/** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
+
+ - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
+
+#ifndef F2C_INCLUDE
+#define F2C_INCLUDE
+
+#include "third_party/sox/src/lpc10/lpc10.h"
+
+/*typedef long int integer;*/
+/*typedef INT32 integer;*/
+/*typedef short int shortint;*/
+/*typedef INT16 shortint;*/
+/*typedef float real;*/
+/* doublereal only used for function arguments to sqrt, exp, etc. */
+typedef double doublereal;
+/* 32 bits seems wasteful, but there really aren't that many logical
+ * variables around, and making them 32 bits could avoid word
+ * alignment problems, perhaps. */
+/*typedef long int logical;*/
+/*typedef INT32 logical;*/
+/* The following types are not used in the translated C code for the
+ * LPC-10 coder, but they might be needed by the definitions down
+ * below, so they don't cause compilation errors. */
+typedef char *address;
+typedef struct { real r, i; } complex;
+typedef struct { doublereal r, i; } doublecomplex;
+typedef short int shortlogical;
+typedef char logical1;
+typedef char integer1;
+/* typedef long long longint; */ /* system-dependent */
+
+#define TRUE_ (1)
+#define FALSE_ (0)
+
+/* Extern is for use with -E */
+#ifndef Extern
+#define Extern extern
+#endif
+
+/* I/O stuff */
+
+#ifdef f2c_i2
+/* for -i2 */
+typedef short flag;
+typedef short ftnlen;
+typedef short ftnint;
+#else
+typedef long int flag;
+typedef long int ftnlen;
+typedef long int ftnint;
+#endif
+
+/*external read, write*/
+typedef struct
+{ flag cierr;
+ ftnint ciunit;
+ flag ciend;
+ char *cifmt;
+ ftnint cirec;
+} cilist;
+
+/*internal read, write*/
+typedef struct
+{ flag icierr;
+ char *iciunit;
+ flag iciend;
+ char *icifmt;
+ ftnint icirlen;
+ ftnint icirnum;
+} icilist;
+
+/*open*/
+typedef struct
+{ flag oerr;
+ ftnint ounit;
+ char *ofnm;
+ ftnlen ofnmlen;
+ char *osta;
+ char *oacc;
+ char *ofm;
+ ftnint orl;
+ char *oblnk;
+} olist;
+
+/*close*/
+typedef struct
+{ flag cerr;
+ ftnint cunit;
+ char *csta;
+} cllist;
+
+/*rewind, backspace, endfile*/
+typedef struct
+{ flag aerr;
+ ftnint aunit;
+} alist;
+
+/* inquire */
+typedef struct
+{ flag inerr;
+ ftnint inunit;
+ char *infile;
+ ftnlen infilen;
+ ftnint *inex; /*parameters in standard's order*/
+ ftnint *inopen;
+ ftnint *innum;
+ ftnint *innamed;
+ char *inname;
+ ftnlen innamlen;
+ char *inacc;
+ ftnlen inacclen;
+ char *inseq;
+ ftnlen inseqlen;
+ char *indir;
+ ftnlen indirlen;
+ char *infmt;
+ ftnlen infmtlen;
+ char *inform;
+ ftnint informlen;
+ char *inunf;
+ ftnlen inunflen;
+ ftnint *inrecl;
+ ftnint *innrec;
+ char *inblank;
+ ftnlen inblanklen;
+} inlist;
+
+#define VOID void
+
+union Multitype { /* for multiple entry points */
+ integer1 g;
+ shortint h;
+ integer i;
+ /* longint j; */
+ real r;
+ doublereal d;
+ complex c;
+ doublecomplex z;
+ };
+
+typedef union Multitype Multitype;
+
+/*typedef long int Long;*/ /* No longer used; formerly in Namelist */
+
+struct Vardesc { /* for Namelist */
+ char *name;
+ char *addr;
+ ftnlen *dims;
+ int type;
+ };
+typedef struct Vardesc Vardesc;
+
+struct Namelist {
+ char *name;
+ Vardesc **vars;
+ int nvars;
+ };
+typedef struct Namelist Namelist;
+
+#define abs(x) ((x) >= 0 ? (x) : -(x))
+#define dabs(x) (doublereal)abs(x)
+#ifndef min
+#define min(a,b) ((a) <= (b) ? (a) : (b))
+#endif
+#ifndef max
+#define max(a,b) ((a) >= (b) ? (a) : (b))
+#endif
+#define dmin(a,b) (doublereal)min(a,b)
+#define dmax(a,b) (doublereal)max(a,b)
+
+/* undef any lower-case symbols that your C compiler predefines, e.g.: */
+
+#ifndef Skip_f2c_Undefs
+#undef cray
+#undef gcos
+#undef mc68010
+#undef mc68020
+#undef mips
+#undef pdp11
+#undef sgi
+#undef sparc
+#undef sun
+#undef sun2
+#undef sun3
+#undef sun4
+#undef u370
+#undef u3b
+#undef u3b2
+#undef u3b5
+#undef unix
+#undef vax
+#endif
+#endif
diff --git a/src/lpc10/f2clib.c b/src/lpc10/f2clib.c
new file mode 100644
index 0000000..277bec9
--- /dev/null
+++ b/src/lpc10/f2clib.c
@@ -0,0 +1,78 @@
+/*
+
+$Log: f2clib.c,v $
+Revision 1.2 2007/04/18 13:59:59 rrt
+Remove $Log tokens and associated log messages (in many files, several
+copies of every log message were being written) and lots of warnings.
+
+Revision 1.1 2007/04/16 21:57:06 rrt
+LPC-10 support, documentation still to come; I wanted to land the code
+before 14.0.0 went into test, and I'll be busy tomorrow.
+
+Not highly tested either, but it's just a format, doesn't interfere
+with anything else, and I'll get on that case before we go stable.
+
+ * Revision 1.1 1996/08/19 22:32:10 jaf
+ * Initial revision
+ *
+
+*/
+
+/*
+ * f2clib.c
+ *
+ * SCCS ID: @(#)f2clib.c 1.2 96/05/19
+ */
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+integer pow_ii(integer *ap, integer *bp);
+
+integer pow_ii(integer *ap, integer *bp)
+{
+ integer pow, x, n;
+ unsigned long u;
+
+ x = *ap;
+ n = *bp;
+
+ if (n <= 0) {
+ if (n == 0 || x == 1)
+ return 1;
+ if (x != -1)
+ return x == 0 ? 1/x : 0;
+ n = -n;
+ }
+ u = n;
+ for(pow = 1; ; )
+ {
+ if(u & 01)
+ pow *= x;
+ if(u >>= 1)
+ x *= x;
+ else
+ break;
+ }
+ return(pow);
+ }
+
+
+double r_sign(real *a, real *b);
+
+double r_sign(real *a, real *b)
+{
+double x;
+x = (*a >= 0 ? *a : - *a);
+return( *b >= 0 ? x : -x);
+}
+
+
+integer i_nint(real *x);
+
+#undef abs
+#include "math.h"
+integer i_nint(real *x)
+{
+return( (*x)>=0 ?
+ floor(*x + .5) : -floor(.5 - *x) );
+}
diff --git a/src/lpc10/ham84.c b/src/lpc10/ham84.c
new file mode 100644
index 0000000..ddbfb2b
--- /dev/null
+++ b/src/lpc10/ham84.c
@@ -0,0 +1,99 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:32:07 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int ham84_(integer *input, integer *output, integer *errcnt);
+
+/* ***************************************************************** */
+
+/* HAM84 Version 45G */
+
+/*
+ * Revision 1.1 1996/08/19 22:32:07 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/21 15:26:00 jaf */
+/* Put comment header in standard form. */
+
+/* Revision 1.2 1996/03/13 22:00:13 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:47:04 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Hamming 8,4 Decoder - can correct 1 out of seven bits */
+/* and can detect up to two errors. */
+
+/* Input: */
+/* INPUT - Seven bit data word, 4 bits parameter and */
+/* 4 bits parity information */
+/* Input/Output: */
+/* ERRCNT - Sums errors detected by Hamming code */
+/* Output: */
+/* OUTPUT - 4 corrected parameter bits */
+
+/* This subroutine is entered with an eight bit word in INPUT. The 8th */
+/* bit is parity and is stripped off. The remaining 7 bits address the */
+/* hamming 8,4 table and the output OUTPUT from the table gives the 4 */
+/* bits of corrected data. If bit 4 is set, no error was detected. */
+/* ERRCNT is the number of errors counted. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int ham84_(integer *input, integer *output, integer *errcnt)
+{
+ /* Initialized data */
+
+ static integer dactab[128] = { 16,0,0,3,0,5,14,7,0,9,14,11,14,13,30,14,0,
+ 9,2,7,4,7,7,23,9,25,10,9,12,9,14,7,0,5,2,11,5,21,6,5,8,11,11,27,
+ 12,5,14,11,2,1,18,2,12,5,2,7,12,9,2,11,28,12,12,15,0,3,3,19,4,13,
+ 6,3,8,13,10,3,13,29,14,13,4,1,10,3,20,4,4,7,10,9,26,10,4,13,10,15,
+ 8,1,6,3,6,5,22,6,24,8,8,11,8,13,6,15,1,17,2,1,4,1,6,15,8,1,10,15,
+ 12,15,15,31 };
+
+ integer i__, j, parity;
+
+/* Arguments */
+/* Parameters/constants */
+/* Local variables that need not be saved */
+/* Determine parity of input word */
+ parity = *input & 255;
+ parity ^= parity / 16;
+ parity ^= parity / 4;
+ parity ^= parity / 2;
+ parity &= 1;
+ i__ = dactab[*input & 127];
+ *output = i__ & 15;
+ j = i__ & 16;
+ if (j != 0) {
+/* No errors detected in seven bits */
+ if (parity != 0) {
+ ++(*errcnt);
+ }
+ } else {
+/* One or two errors detected */
+ ++(*errcnt);
+ if (parity == 0) {
+/* Two errors detected */
+ ++(*errcnt);
+ *output = -1;
+ }
+ }
+ return 0;
+} /* ham84_ */
+
diff --git a/src/lpc10/hp100.c b/src/lpc10/hp100.c
new file mode 100644
index 0000000..5c1a5bb
--- /dev/null
+++ b/src/lpc10/hp100.c
@@ -0,0 +1,107 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:28:05 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:32:04 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int hp100_(real *speech, integer *start, integer *end,
+ struct lpc10_encoder_state *st);
+extern int inithp100_(void);
+
+/* ********************************************************************* */
+
+/* HP100 Version 55 */
+
+/* ********************************************************************* */
+
+/* 100 Hz High Pass Filter */
+
+/* Jan 92 - corrected typo (1.937148 to 1.935715), */
+/* rounded coefficients to 7 places, */
+/* corrected and merged gain (.97466**4), */
+/* merged numerator into first two sections. */
+
+/* Input: */
+/* start, end - Range of samples to filter */
+/* Input/Output: */
+/* speech(end) - Speech data. */
+/* Indices start through end are read and modified. */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITHP100. */
+/* Subroutine */ int hp100_(real *speech, integer *start, integer *end,
+ struct lpc10_encoder_state *st)
+{
+ /* Temporary local copies of variables in lpc10_encoder_state.
+ I've only created these because it might cause the loop below
+ to execute a bit faster to access local variables, rather than
+ variables in the lpc10_encoder_state structure. It is just a
+ guess that it will be faster. */
+
+ real z11;
+ real z21;
+ real z12;
+ real z22;
+
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ integer i__;
+ real si, err;
+
+/* Arguments */
+/* Local variables that need not be saved */
+/* Local state */
+ /* Parameter adjustments */
+ if (speech) {
+ --speech;
+ }
+
+ /* Function Body */
+
+ z11 = st->z11;
+ z21 = st->z21;
+ z12 = st->z12;
+ z22 = st->z22;
+
+ i__1 = *end;
+ for (i__ = *start; i__ <= i__1; ++i__) {
+ si = speech[i__];
+ err = si + z11 * 1.859076f - z21 * .8648249f;
+ si = err - z11 * 2.f + z21;
+ z21 = z11;
+ z11 = err;
+ err = si + z12 * 1.935715f - z22 * .9417004f;
+ si = err - z12 * 2.f + z22;
+ z22 = z12;
+ z12 = err;
+ speech[i__] = si * .902428f;
+ }
+
+ st->z11 = z11;
+ st->z21 = z21;
+ st->z12 = z12;
+ st->z22 = z22;
+
+ return 0;
+} /* hp100_ */
diff --git a/src/lpc10/invert.c b/src/lpc10/invert.c
new file mode 100644
index 0000000..54176d8
--- /dev/null
+++ b/src/lpc10/invert.c
@@ -0,0 +1,141 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:32:00 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int invert_(integer *order, real *phi, real *psi, real *rc);
+
+/* **************************************************************** */
+
+/* INVERT Version 45G */
+
+/*
+ * Revision 1.1 1996/08/19 22:32:00 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/18 20:52:47 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 16:51:32 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Eliminated a comment from the original, describing a local array X */
+/* that appeared nowhere in the code. */
+
+/* Revision 1.1 1996/02/07 14:47:20 jaf */
+/* Initial revision */
+
+
+/* **************************************************************** */
+
+/* Invert a covariance matrix using Choleski decomposition method. */
+
+/* Input: */
+/* ORDER - Analysis order */
+/* PHI(ORDER,ORDER) - Covariance matrix */
+/* Indices (I,J) read, where ORDER .GE. I .GE. J .GE. 1.*/
+/* All other indices untouched. */
+/* PSI(ORDER) - Column vector to be predicted */
+/* Indices 1 through ORDER read. */
+/* Output: */
+/* RC(ORDER) - Pseudo reflection coefficients */
+/* Indices 1 through ORDER written, and then possibly read.
+*/
+/* Internal: */
+/* V(ORDER,ORDER) - Temporary matrix */
+/* Same indices written as read from PHI. */
+/* Many indices may be read and written again after */
+/* initially being copied from PHI, but all indices */
+/* are written before being read. */
+
+/* NOTE: Temporary matrix V is not needed and may be replaced */
+/* by PHI if the original PHI values do not need to be preserved. */
+
+/* Subroutine */ int invert_(integer *order, real *phi, real *psi, real *rc)
+{
+ /* System generated locals */
+ integer phi_dim1, phi_offset, i__1, i__2, i__3;
+ real r__1, r__2;
+
+ /* Local variables */
+ real save;
+ integer i__, j, k;
+ real v[100] /* was [10][10] */;
+
+/* Arguments */
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Parameters/constants */
+/* Local variables that need not be saved */
+/* Decompose PHI into V * D * V' where V is a triangular matrix whose */
+/* main diagonal elements are all 1, V' is the transpose of V, and */
+/* D is a vector. Here D(n) is stored in location V(n,n). */
+ /* Parameter adjustments */
+ --rc;
+ --psi;
+ phi_dim1 = *order;
+ phi_offset = phi_dim1 + 1;
+ phi -= phi_offset;
+
+ /* Function Body */
+ i__1 = *order;
+ for (j = 1; j <= i__1; ++j) {
+ i__2 = *order;
+ for (i__ = j; i__ <= i__2; ++i__) {
+ v[i__ + j * 10 - 11] = phi[i__ + j * phi_dim1];
+ }
+ i__2 = j - 1;
+ for (k = 1; k <= i__2; ++k) {
+ save = v[j + k * 10 - 11] * v[k + k * 10 - 11];
+ i__3 = *order;
+ for (i__ = j; i__ <= i__3; ++i__) {
+ v[i__ + j * 10 - 11] -= v[i__ + k * 10 - 11] * save;
+ }
+ }
+/* Compute intermediate results, which are similar to RC's */
+ if ((r__1 = v[j + j * 10 - 11], abs(r__1)) < 1e-10f) {
+ goto L100;
+ }
+ rc[j] = psi[j];
+ i__2 = j - 1;
+ for (k = 1; k <= i__2; ++k) {
+ rc[j] -= rc[k] * v[j + k * 10 - 11];
+ }
+ v[j + j * 10 - 11] = 1.f / v[j + j * 10 - 11];
+ rc[j] *= v[j + j * 10 - 11];
+/* Computing MAX */
+/* Computing MIN */
+ r__2 = rc[j];
+ r__1 = min(r__2,.999f);
+ rc[j] = max(r__1,-.999f);
+ }
+ return 0;
+/* Zero out higher order RC's if algorithm terminated early */
+L100:
+ i__1 = *order;
+ for (i__ = j; i__ <= i__1; ++i__) {
+ rc[i__] = 0.f;
+ }
+/* Back substitute for PC's (if needed) */
+/* 110 DO J = ORDER,1,-1 */
+/* PC(J) = RC(J) */
+/* DO I = 1,J-1 */
+/* PC(J) = PC(J) - PC(I)*V(J,I) */
+/* END DO */
+/* END DO */
+ return 0;
+} /* invert_ */
+
diff --git a/src/lpc10/irc2pc.c b/src/lpc10/irc2pc.c
new file mode 100644
index 0000000..0b2fc58
--- /dev/null
+++ b/src/lpc10/irc2pc.c
@@ -0,0 +1,98 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:31:56 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int irc2pc_(real *rc, real *pc, integer *order, real *gprime, real *g2pass);
+
+/* ***************************************************************** */
+
+/* IRC2PC Version 48 */
+
+/*
+ * Revision 1.1 1996/08/19 22:31:56 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/20 15:47:19 jaf */
+/* Added comments about which indices of array arguments are read or */
+/* written. */
+
+/* Revision 1.2 1996/03/14 16:59:04 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:47:27 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Convert Reflection Coefficients to Predictor Coeficients */
+
+/* Inputs: */
+/* RC - Reflection coefficients */
+/* Indices 1 through ORDER read. */
+/* ORDER - Number of RC's */
+/* GPRIME - Excitation modification gain */
+/* Outputs: */
+/* PC - Predictor coefficients */
+/* Indices 1 through ORDER written. */
+/* Indices 1 through ORDER-1 are read after being written. */
+/* G2PASS - Excitation modification sharpening factor */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int irc2pc_(real *rc, real *pc, integer *order, real *gprime,
+ real *g2pass)
+{
+ /* System generated locals */
+ integer i__1, i__2;
+
+ /* Builtin functions */
+ double sqrt(doublereal);
+
+ /* Local variables */
+ real temp[10];
+ integer i__, j;
+
+/* Arguments */
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Local variables that need not be saved */
+ /* Parameter adjustments */
+ --pc;
+ --rc;
+
+ /* Function Body */
+ *g2pass = 1.f;
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ *g2pass *= 1.f - rc[i__] * rc[i__];
+ }
+ *g2pass = *gprime * sqrt(*g2pass);
+ pc[1] = rc[1];
+ i__1 = *order;
+ for (i__ = 2; i__ <= i__1; ++i__) {
+ i__2 = i__ - 1;
+ for (j = 1; j <= i__2; ++j) {
+ temp[j - 1] = pc[j] - rc[i__] * pc[i__ - j];
+ }
+ i__2 = i__ - 1;
+ for (j = 1; j <= i__2; ++j) {
+ pc[j] = temp[j - 1];
+ }
+ pc[i__] = rc[i__];
+ }
+ return 0;
+} /* irc2pc_ */
+
diff --git a/src/lpc10/ivfilt.c b/src/lpc10/ivfilt.c
new file mode 100644
index 0000000..6f6d04d
--- /dev/null
+++ b/src/lpc10/ivfilt.c
@@ -0,0 +1,103 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:31:53 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *nsamp, real *ivrc);
+
+/* ********************************************************************* */
+
+/* IVFILT Version 48 */
+
+/*
+ * Revision 1.1 1996/08/19 22:31:53 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/15 21:36:29 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 00:01:00 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:47:34 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* 2nd order inverse filter, speech is decimated 4:1 */
+
+/* Input: */
+/* LEN - Length of speech buffers */
+/* NSAMP - Number of samples to filter */
+/* LPBUF - Low pass filtered speech buffer */
+/* Indices LEN-NSAMP-7 through LEN read. */
+/* Output: */
+/* IVBUF - Inverse filtered speech buffer */
+/* Indices LEN-NSAMP+1 through LEN written. */
+/* IVRC - Inverse filter reflection coefficients (for voicing) */
+/* Indices 1 and 2 both written (also read, but only after writing).
+*/
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *
+ nsamp, real *ivrc)
+{
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ integer i__, j, k;
+ real r__[3], pc1, pc2;
+
+/* Arguments */
+/* Local variables that need not be saved */
+/* Local state */
+/* None */
+/* Calculate Autocorrelations */
+ /* Parameter adjustments */
+ --ivbuf;
+ --lpbuf;
+ --ivrc;
+
+ /* Function Body */
+ for (i__ = 1; i__ <= 3; ++i__) {
+ r__[i__ - 1] = 0.f;
+ k = (i__ - 1) << 2;
+ i__1 = *len;
+ for (j = (i__ << 2) + *len - *nsamp; j <= i__1; j += 2) {
+ r__[i__ - 1] += lpbuf[j] * lpbuf[j - k];
+ }
+ }
+/* Calculate predictor coefficients */
+ pc1 = 0.f;
+ pc2 = 0.f;
+ ivrc[1] = 0.f;
+ ivrc[2] = 0.f;
+ if (r__[0] > 1e-10f) {
+ ivrc[1] = r__[1] / r__[0];
+ ivrc[2] = (r__[2] - ivrc[1] * r__[1]) / (r__[0] - ivrc[1] * r__[1]);
+ pc1 = ivrc[1] - ivrc[1] * ivrc[2];
+ pc2 = ivrc[2];
+ }
+/* Inverse filter LPBUF into IVBUF */
+ i__1 = *len;
+ for (i__ = *len + 1 - *nsamp; i__ <= i__1; ++i__) {
+ ivbuf[i__] = lpbuf[i__] - pc1 * lpbuf[i__ - 4] - pc2 * lpbuf[i__ - 8];
+ }
+ return 0;
+} /* ivfilt_ */
+
diff --git a/src/lpc10/lpc10.h b/src/lpc10/lpc10.h
new file mode 100644
index 0000000..34f9878
--- /dev/null
+++ b/src/lpc10/lpc10.h
@@ -0,0 +1,277 @@
+/*
+
+$Log: lpc10.h,v $
+Revision 1.3 2008/03/21 13:34:21 robs
+fix (I hope) [1913986] Error during make of static sox
+
+Revision 1.2 2007/12/26 16:12:42 robs
+support out-of-source-build
+
+Revision 1.1 2007/04/16 21:57:22 rrt
+LPC-10 support, documentation still to come; I wanted to land the code
+before 14.0.0 went into test, and I'll be busy tomorrow.
+
+Not highly tested either, but it's just a format, doesn't interfere
+with anything else, and I'll get on that case before we go stable.
+
+ * Revision 1.1 1996/08/19 22:47:31 jaf
+ * Initial revision
+ *
+
+*/
+
+#ifndef __LPC10_H__
+#define __LPC10_H__
+
+#include <limits.h>
+
+/* aliases */
+#define analys_ lsx_lpc10_analys_
+#define bsynz_ lsx_lpc10_bsynz_
+#define chanrd_ lsx_lpc10_chanrd_
+#define chanwr_ lsx_lpc10_chanwr_
+#define contrl_ lsx_lpc10_contrl_
+#define create_lpc10_decoder_state lsx_lpc10_create_decoder_state
+#define create_lpc10_encoder_state lsx_lpc10_create_encoder_state
+#define dcbias_ lsx_lpc10_dcbias_
+#define decode_ lsx_lpc10_decode_
+#define deemp_ lsx_lpc10_deemp_
+#define difmag_ lsx_lpc10_difmag_
+#define dyptrk_ lsx_lpc10_dyptrk_
+#define encode_ lsx_lpc10_encode_
+#define energy_ lsx_lpc10_energy_
+#define ham84_ lsx_lpc10_ham84_
+#define hp100_ lsx_lpc10_hp100_
+#define i_nint lsx_lpc10_i_nint
+#define init_lpc10_decoder_state lsx_lpc10_init_decoder_state
+#define init_lpc10_encoder_state lsx_lpc10_init_encoder_state
+#define invert_ lsx_lpc10_invert_
+#define irc2pc_ lsx_lpc10_irc2pc_
+#define ivfilt_ lsx_lpc10_ivfilt_
+#define lpc10_decode lsx_lpc10_decode
+#define lpc10_encode lsx_lpc10_encode
+#define lpcini_ lsx_lpc10_lpcini_
+#define lpfilt_ lsx_lpc10_lpfilt_
+#define median_ lsx_lpc10_median_
+#define mload_ lsx_lpc10_mload_
+#define onset_ lsx_lpc10_onset_
+#define pitsyn_ lsx_lpc10_pitsyn_
+#define placea_ lsx_lpc10_placea_
+#define placev_ lsx_lpc10_placev_
+#define pow_ii lsx_lpc10_pow_ii
+#define preemp_ lsx_lpc10_preemp_
+#define prepro_ lsx_lpc10_prepro_
+#define random_ lsx_lpc10_random_
+#define rcchk_ lsx_lpc10_rcchk_
+#define r_sign lsx_lpc10_r_sign
+#define synths_ lsx_lpc10_synths_
+#define tbdm_ lsx_lpc10_tbdm_
+#define voicin_ lsx_lpc10_voicin_
+#define vparms_ lsx_lpc10_vparms_
+
+#define LPC10_SAMPLES_PER_FRAME 180
+#define LPC10_BITS_IN_COMPRESSED_FRAME 54
+
+
+#if defined(SHRT_MAX) && defined(SHRT_MIN) && SHRT_MAX==32767 && SHRT_MIN==(-32768)
+typedef short INT16;
+#elif defined(INT_MAX) && defined(INT_MIN) && INT_MAX==32767 && INT_MIN==(-32768)
+typedef int INT16;
+#else
+#error Unable to determine an appropriate definition for INT16.
+#endif
+
+#if defined(INT_MAX) && defined(INT_MIN) && INT_MAX==2147483647 && INT_MIN==(-2147483647-1)
+typedef int INT32;
+#elif defined(LONG_MAX) && defined(LONG_MIN) && LONG_MAX==2147483647 && LONG_MIN==(-2147483647-1)
+typedef long INT32;
+#else
+#error Unable to determine an appropriate definition for INT32.
+#endif
+
+
+/* The initial values for every member of this structure is 0, except
+ where noted in comments. */
+
+/* These two lines are copied from f2c.h. There should be a more
+ elegant way of doing this than having the same declarations in two
+ files. */
+
+typedef float real;
+typedef INT32 integer;
+typedef INT32 logical;
+typedef INT16 shortint;
+
+struct lpc10_encoder_state {
+ /* State used only by function hp100 */
+ real z11;
+ real z21;
+ real z12;
+ real z22;
+
+ /* State used by function analys */
+ real inbuf[540], pebuf[540];
+ real lpbuf[696], ivbuf[312];
+ real bias;
+ integer osbuf[10]; /* no initial value necessary */
+ integer osptr; /* initial value 1 */
+ integer obound[3];
+ integer vwin[6] /* was [2][3] */; /* initial value vwin[4] = 307; vwin[5] = 462; */
+ integer awin[6] /* was [2][3] */; /* initial value awin[4] = 307; awin[5] = 462; */
+ integer voibuf[8] /* was [2][4] */;
+ real rmsbuf[3];
+ real rcbuf[30] /* was [10][3] */;
+ real zpre;
+
+
+ /* State used by function onset */
+ real n;
+ real d__; /* initial value 1.f */
+ real fpc; /* no initial value necessary */
+ real l2buf[16];
+ real l2sum1;
+ integer l2ptr1; /* initial value 1 */
+ integer l2ptr2; /* initial value 9 */
+ integer lasti; /* no initial value necessary */
+ logical hyst; /* initial value FALSE_ */
+
+ /* State used by function voicin */
+ real dither; /* initial value 20.f */
+ real snr;
+ real maxmin;
+ real voice[6] /* was [2][3] */; /* initial value is probably unnecessary */
+ integer lbve, lbue, fbve, fbue;
+ integer ofbue, sfbue;
+ integer olbue, slbue;
+ /* Initial values:
+ lbve = 3000;
+ fbve = 3000;
+ fbue = 187;
+ ofbue = 187;
+ sfbue = 187;
+ lbue = 93;
+ olbue = 93;
+ slbue = 93;
+ snr = (real) (fbve / fbue << 6);
+ */
+
+ /* State used by function dyptrk */
+ real s[60];
+ integer p[120] /* was [60][2] */;
+ integer ipoint;
+ real alphax;
+
+ /* State used by function chanwr */
+ integer isync;
+
+};
+
+
+struct lpc10_decoder_state {
+
+ /* State used by function decode */
+ integer iptold; /* initial value 60 */
+ logical first; /* initial value TRUE_ */
+ integer ivp2h;
+ integer iovoic;
+ integer iavgp; /* initial value 60 */
+ integer erate;
+ integer drc[30] /* was [3][10] */;
+ integer dpit[3];
+ integer drms[3];
+
+ /* State used by function synths */
+ real buf[360];
+ integer buflen; /* initial value 180 */
+
+ /* State used by function pitsyn */
+ integer ivoico; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ integer ipito; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ real rmso; /* initial value 1.f */
+ real rco[10]; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ integer jsamp; /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ logical first_pitsyn; /* initial value TRUE_ */
+
+ /* State used by function bsynz */
+ integer ipo;
+ real exc[166];
+ real exc2[166];
+ real lpi1;
+ real lpi2;
+ real lpi3;
+ real hpi1;
+ real hpi2;
+ real hpi3;
+ real rmso_bsynz;
+
+ /* State used by function random */
+ integer j; /* initial value 2 */
+ integer k; /* initial value 5 */
+ shortint y[5]; /* initial value { -21161,-8478,30892,-10216,16950 } */
+
+ /* State used by function deemp */
+ real dei1;
+ real dei2;
+ real deo1;
+ real deo2;
+ real deo3;
+
+};
+
+
+
+/*
+
+ Calling sequence:
+
+ Call create_lpc10_encoder_state(), which returns a pointer to an
+ already initialized lpc10_encoder_state structure.
+
+ lpc10_encode reads indices 0 through (LPC10_SAMPLES_PER_FRAME-1) of
+ array speech[], and writes indices 0 through
+ (LPC10_BITS_IN_COMPRESSED_FRAME-1) of array bits[], and both reads
+ and writes the lpc10_encoder_state structure contents. The
+ lpc10_encoder_state structure should *not* be initialized for every
+ frame of encoded speech. Once at the beginning of execution, done
+ automatically for you by create_lpc10_encoder_state(), is enough.
+
+ init_lpc10_encoder_state() reinitializes the lpc10_encoder_state
+ structure. This might be useful if you are finished processing one
+ sound sample, and want to reuse the same lpc10_encoder_state
+ structure to process another sound sample. There might be other
+ uses as well.
+
+ Note that the comments in the lpc10/lpcenc.c file imply that indices
+ 1 through 180 of array speech[] are read. These comments were
+ written for the Fortran version of the code, before it was
+ automatically converted to C by the conversion program f2c. f2c
+ seems to use the convention that the pointers to arrays passed as
+ function arguments point to the first index used in the Fortran
+ code, whatever index that might be (usually 1), and then it modifies
+ the pointer inside of the function, like so:
+
+ if (speech) {
+ --speech;
+ }
+
+ So that the code can access the first value at index 1 and the last
+ at index 180. This makes the translated C code "closer" to the
+ original Fortran code.
+
+ The calling sequence for the decoder is similar to the encoder. The
+ only significant difference is that the array bits[] is read
+ (indices 0 through (LPC10_BITS_IN_COMPRESSED_FRAME-1)), and the
+ array speech[] is written (indices 0 through
+ (LPC10_SAMPLES_PER_FRAME-1)).
+
+ */
+
+struct lpc10_encoder_state * create_lpc10_encoder_state (void);
+void init_lpc10_encoder_state (struct lpc10_encoder_state *st);
+int lpc10_encode (real *speech, INT32 *bits, struct lpc10_encoder_state *st);
+
+struct lpc10_decoder_state * create_lpc10_decoder_state (void);
+void init_lpc10_decoder_state (struct lpc10_decoder_state *st);
+int lpc10_decode (INT32 *bits, real *speech, struct lpc10_decoder_state *st);
+
+#endif /* __LPC10_H__ */
diff --git a/src/lpc10/lpcdec.c b/src/lpc10/lpcdec.c
new file mode 100644
index 0000000..5440c04
--- /dev/null
+++ b/src/lpc10/lpcdec.c
@@ -0,0 +1,190 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:30:11 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Changed name of function from lpcenc_ to lpc10_encode, simply to make
+ * all lpc10 functions have more consistent naming with each other.
+ *
+ * Revision 1.1 1996/08/19 22:31:48 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int lpcdec_(integer *bits, real *speech);
+extern int initlpcdec_(void);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* Table of constant values */
+
+static integer c__10 = 10;
+
+/* ***************************************************************** */
+
+/*
+ * Revision 1.2 1996/08/20 20:30:11 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Changed name of function from lpcenc_ to lpc10_encode, simply to make
+ * all lpc10 functions have more consistent naming with each other.
+ *
+ * Revision 1.1 1996/08/19 22:31:48 jaf
+ * Initial revision
+ * */
+/* Revision 1.1 1996/03/28 00:03:00 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Decode 54 bits to one frame of 180 speech samples. */
+
+/* Input: */
+/* BITS - 54 encoded bits, stored 1 per array element. */
+/* Indices 1 through 53 read (SYNC bit ignored). */
+/* Output: */
+/* SPEECH - Speech encoded as real values in the range [-1,+1]. */
+/* Indices 1 through 180 written. */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITLPCDEC. */
+
+/* Subroutine */ int lpc10_decode(integer *bits, real *speech,
+ struct lpc10_decoder_state *st)
+{
+ integer irms, voice[2], pitch, ipitv;
+ extern /* Subroutine */ int decode_(integer *, integer *, integer *,
+ integer *, integer *, real *, real *, struct lpc10_decoder_state *);
+ real rc[10];
+ extern /* Subroutine */ int chanrd_(integer *, integer *, integer *,
+ integer *, integer *), synths_(integer *,
+ integer *, real *, real *, real *, integer *,
+ struct lpc10_decoder_state *);
+ integer irc[10], len;
+ real rms;
+
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Arguments */
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Local variables that need not be saved */
+/* Uncoded speech parameters */
+/* Coded speech parameters */
+/* Others */
+/* Local state */
+/* None */
+ /* Parameter adjustments */
+ if (bits) {
+ --bits;
+ }
+ if (speech) {
+ --speech;
+ }
+
+ /* Function Body */
+
+ chanrd_(&c__10, &ipitv, &irms, irc, &bits[1]);
+ decode_(&ipitv, &irms, irc, voice, &pitch, &rms, rc, st);
+ synths_(voice, &pitch, &rms, rc, &speech[1], &len, st);
+ return 0;
+} /* lpcdec_ */
diff --git a/src/lpc10/lpcenc.c b/src/lpc10/lpcenc.c
new file mode 100644
index 0000000..ae9007f
--- /dev/null
+++ b/src/lpc10/lpcenc.c
@@ -0,0 +1,112 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:31:21 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Changed name of function from lpcenc_ to lpc10_encode, simply to make
+ * all lpc10 functions have more consistent naming with each other.
+ *
+ * Revision 1.1 1996/08/19 22:31:44 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int lpcenc_(real *speech, integer *bits);
+extern int initlpcenc_(void);
+
+/* Table of constant values */
+
+static integer c__180 = 180;
+static integer c__10 = 10;
+
+/* ***************************************************************** */
+
+/*
+ * Revision 1.2 1996/08/20 20:31:21 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Changed name of function from lpcenc_ to lpc10_encode, simply to make
+ * all lpc10 functions have more consistent naming with each other.
+ *
+ * Revision 1.1 1996/08/19 22:31:44 jaf
+ * Initial revision
+ * */
+/* Revision 1.2 1996/03/28 00:01:22 jaf */
+/* Commented out some trace statements. */
+
+/* Revision 1.1 1996/03/28 00:00:27 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Encode one frame of 180 speech samples to 54 bits. */
+
+/* Input: */
+/* SPEECH - Speech encoded as real values in the range [-1,+1]. */
+/* Indices 1 through 180 read, and modified (by PREPRO). */
+/* Output: */
+/* BITS - 54 encoded bits, stored 1 per array element. */
+/* Indices 1 through 54 written. */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITLPCENC. */
+
+/* Subroutine */ int lpc10_encode(real *speech, integer *bits,
+ struct lpc10_encoder_state *st)
+{
+ integer irms, voice[2], pitch, ipitv;
+ real rc[10];
+ extern /* Subroutine */ int encode_(integer *, integer *, real *, real *,
+ integer *, integer *, integer *), chanwr_(integer *, integer *,
+ integer *, integer *, integer *, struct lpc10_encoder_state *),
+ analys_(real *, integer *,
+ integer *, real *, real *, struct lpc10_encoder_state *),
+ prepro_(real *, integer *, struct lpc10_encoder_state *);
+ integer irc[10];
+ real rms;
+
+/* Arguments */
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Local variables that need not be saved */
+/* Uncoded speech parameters */
+/* Coded speech parameters */
+/* Local state */
+/* None */
+ /* Parameter adjustments */
+ if (speech) {
+ --speech;
+ }
+ if (bits) {
+ --bits;
+ }
+
+ /* Function Body */
+ prepro_(&speech[1], &c__180, st);
+ analys_(&speech[1], voice, &pitch, &rms, rc, st);
+ encode_(voice, &pitch, &rms, rc, &ipitv, &irms, irc);
+ chanwr_(&c__10, &ipitv, &irms, irc, &bits[1], st);
+ return 0;
+} /* lpcenc_ */
diff --git a/src/lpc10/lpcini.c b/src/lpc10/lpcini.c
new file mode 100644
index 0000000..ccd2729
--- /dev/null
+++ b/src/lpc10/lpcini.c
@@ -0,0 +1,330 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:35:41 jaf
+ * Added functions for allocating and initializing lpc10_encoder_state
+ * and lpc10_decoder_state structures.
+ *
+ * Revision 1.1 1996/08/19 22:31:40 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include <stdlib.h>
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int lpcini_(void);
+
+/* Common Block Declarations */
+
+struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* ***************************************************************** */
+
+/*
+ * Revision 1.2 1996/08/20 20:35:41 jaf
+ * Added functions for allocating and initializing lpc10_encoder_state
+ * and lpc10_decoder_state structures.
+ *
+ * Revision 1.1 1996/08/19 22:31:40 jaf
+ * Initial revision
+ * */
+/* Revision 1.1 1996/03/28 00:04:05 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Initialize COMMON block variables used by LPC-10 encoder and decoder, */
+/* and call initialization routines for both of them. */
+
+/* Subroutine */ int lpcini_(void)
+{
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+ contrl_1.order = 10;
+ contrl_1.lframe = 180;
+ contrl_1.corrp = TRUE_;
+ return 0;
+} /* lpcini_ */
+
+
+
+/* Allocate memory for, and initialize, the state that needs to be
+ kept from encoding one frame to the next for a single
+ LPC-10-compressed audio stream. Return 0 if malloc fails,
+ otherwise return pointer to new structure. */
+
+struct lpc10_encoder_state *
+create_lpc10_encoder_state(void)
+{
+ struct lpc10_encoder_state *st;
+
+ st = (struct lpc10_encoder_state *)
+ malloc((unsigned) sizeof (struct lpc10_encoder_state));
+ if (st != 0) {
+ init_lpc10_encoder_state(st);
+ }
+ return (st);
+}
+
+
+
+void init_lpc10_encoder_state(struct lpc10_encoder_state *st)
+{
+ int i;
+
+ lpcini_();
+
+ /* State used only by function hp100 */
+ st->z11 = 0.0f;
+ st->z21 = 0.0f;
+ st->z12 = 0.0f;
+ st->z22 = 0.0f;
+
+ /* State used by function analys */
+ for (i = 0; i < 540; i++) {
+ st->inbuf[i] = 0.0f;
+ st->pebuf[i] = 0.0f;
+ }
+ for (i = 0; i < 696; i++) {
+ st->lpbuf[i] = 0.0f;
+ }
+ for (i = 0; i < 312; i++) {
+ st->ivbuf[i] = 0.0f;
+ }
+ st->bias = 0.0f;
+ /* integer osbuf[10]; no initial value necessary */
+ st->osptr = 1;
+ for (i = 0; i < 3; i++) {
+ st->obound[i] = 0;
+ }
+ st->vwin[4] = 307;
+ st->vwin[5] = 462;
+ st->awin[4] = 307;
+ st->awin[5] = 462;
+ for (i = 0; i < 8; i++) {
+ st->voibuf[i] = 0;
+ }
+ for (i = 0; i < 3; i++) {
+ st->rmsbuf[i] = 0.0f;
+ }
+ for (i = 0; i < 30; i++) {
+ st->rcbuf[i] = 0.0f;
+ }
+ st->zpre = 0.0f;
+
+
+ /* State used by function onset */
+ st->n = 0.0f;
+ st->d__ = 1.0f;
+ /* real fpc; no initial value necessary */
+ for (i = 0; i < 16; i++) {
+ st->l2buf[i] = 0.0f;
+ }
+ st->l2sum1 = 0.0f;
+ st->l2ptr1 = 1;
+ st->l2ptr2 = 9;
+ /* integer lasti; no initial value necessary */
+ st->hyst = FALSE_;
+
+ /* State used by function voicin */
+ st->dither = 20.0f;
+ st->maxmin = 0.0f;
+ for (i = 0; i < 6; i++) {
+ st->voice[i] = 0.0f;
+ }
+ st->lbve = 3000;
+ st->fbve = 3000;
+ st->fbue = 187;
+ st->ofbue = 187;
+ st->sfbue = 187;
+ st->lbue = 93;
+ st->olbue = 93;
+ st->slbue = 93;
+ st->snr = (real) (st->fbve / st->fbue << 6);
+
+ /* State used by function dyptrk */
+ for (i = 0; i < 60; i++) {
+ st->s[i] = 0.0f;
+ }
+ for (i = 0; i < 120; i++) {
+ st->p[i] = 0;
+ }
+ st->ipoint = 0;
+ st->alphax = 0.0f;
+
+ /* State used by function chanwr */
+ st->isync = 0;
+
+}
+
+
+
+/* Allocate memory for, and initialize, the state that needs to be
+ kept from decoding one frame to the next for a single
+ LPC-10-compressed audio stream. Return 0 if malloc fails,
+ otherwise return pointer to new structure. */
+
+struct lpc10_decoder_state *
+create_lpc10_decoder_state(void)
+{
+ struct lpc10_decoder_state *st;
+
+ st = (struct lpc10_decoder_state *)
+ malloc((unsigned) sizeof (struct lpc10_decoder_state));
+ if (st != 0) {
+ init_lpc10_decoder_state(st);
+ }
+ return (st);
+}
+
+
+
+void init_lpc10_decoder_state(struct lpc10_decoder_state *st)
+{
+ int i;
+
+ lpcini_();
+
+ /* State used by function decode */
+ st->iptold = 60;
+ st->first = TRUE_;
+ st->ivp2h = 0;
+ st->iovoic = 0;
+ st->iavgp = 60;
+ st->erate = 0;
+ for (i = 0; i < 30; i++) {
+ st->drc[i] = 0;
+ }
+ for (i = 0; i < 3; i++) {
+ st->dpit[i] = 0;
+ st->drms[i] = 0;
+ }
+
+ /* State used by function synths */
+ for (i = 0; i < 360; i++) {
+ st->buf[i] = 0.0f;
+ }
+ st->buflen = 180;
+
+ /* State used by function pitsyn */
+ /* ivoico; no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ /* ipito; no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ st->rmso = 1.0f;
+ /* rco[10]; no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ /* integer jsamp; no initial value necessary as long as first_pitsyn is initially TRUE_ */
+ st->first_pitsyn = TRUE_;
+
+ /* State used by function bsynz */
+ st->ipo = 0;
+ for (i = 0; i < 166; i++) {
+ st->exc[i] = 0.0f;
+ st->exc2[i] = 0.0f;
+ }
+ st->lpi1 = 0.0f;
+ st->lpi2 = 0.0f;
+ st->lpi3 = 0.0f;
+ st->hpi1 = 0.0f;
+ st->hpi2 = 0.0f;
+ st->hpi3 = 0.0f;
+ st->rmso_bsynz = 0.0f;
+
+ /* State used by function random */
+ st->j = 2;
+ st->k = 5;
+ st->y[0] = (shortint) -21161;
+ st->y[1] = (shortint) -8478;
+ st->y[2] = (shortint) 30892;
+ st->y[3] = (shortint) -10216;
+ st->y[4] = (shortint) 16950;
+
+ /* State used by function deemp */
+ st->dei1 = 0.0f;
+ st->dei2 = 0.0f;
+ st->deo1 = 0.0f;
+ st->deo2 = 0.0f;
+ st->deo3 = 0.0f;
+}
diff --git a/src/lpc10/lpfilt.c b/src/lpc10/lpfilt.c
new file mode 100644
index 0000000..3bda37c
--- /dev/null
+++ b/src/lpc10/lpfilt.c
@@ -0,0 +1,98 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:31:35 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *nsamp);
+
+/* *********************************************************************** */
+
+/* LPFILT Version 55 */
+
+/*
+ * Revision 1.1 1996/08/19 22:31:35 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/15 16:53:49 jaf */
+/* Just put comment header in standard form. */
+
+/* Revision 1.2 1996/03/12 23:58:06 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:47:44 jaf */
+/* Initial revision */
+
+
+/* *********************************************************************** */
+
+/* 31 Point Equiripple FIR Low-Pass Filter */
+/* Linear phase, delay = 15 samples */
+
+/* Passband: ripple = 0.25 dB, cutoff = 800 Hz */
+/* Stopband: atten. = 40. dB, cutoff = 1240 Hz */
+
+/* Inputs: */
+/* LEN - Length of speech buffers */
+/* NSAMP - Number of samples to filter */
+/* INBUF - Input speech buffer */
+/* Indices len-nsamp-29 through len are read. */
+/* Output: */
+/* LPBUF - Low passed speech buffer (must be different array than INBUF) */
+/* Indices len+1-nsamp through len are written. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *
+ nsamp)
+{
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ integer j;
+ real t;
+
+/* Arguments */
+/* Parameters/constants */
+/* Local variables that need not be saved */
+/* Local state */
+/* None */
+ /* Parameter adjustments */
+ --lpbuf;
+ --inbuf;
+
+ /* Function Body */
+ i__1 = *len;
+ for (j = *len + 1 - *nsamp; j <= i__1; ++j) {
+ t = (inbuf[j] + inbuf[j - 30]) * -.0097201988f;
+ t += (inbuf[j - 1] + inbuf[j - 29]) * -.0105179986f;
+ t += (inbuf[j - 2] + inbuf[j - 28]) * -.0083479648f;
+ t += (inbuf[j - 3] + inbuf[j - 27]) * 5.860774e-4f;
+ t += (inbuf[j - 4] + inbuf[j - 26]) * .0130892089f;
+ t += (inbuf[j - 5] + inbuf[j - 25]) * .0217052232f;
+ t += (inbuf[j - 6] + inbuf[j - 24]) * .0184161253f;
+ t += (inbuf[j - 7] + inbuf[j - 23]) * 3.39723e-4f;
+ t += (inbuf[j - 8] + inbuf[j - 22]) * -.0260797087f;
+ t += (inbuf[j - 9] + inbuf[j - 21]) * -.0455563702f;
+ t += (inbuf[j - 10] + inbuf[j - 20]) * -.040306855f;
+ t += (inbuf[j - 11] + inbuf[j - 19]) * 5.029835e-4f;
+ t += (inbuf[j - 12] + inbuf[j - 18]) * .0729262903f;
+ t += (inbuf[j - 13] + inbuf[j - 17]) * .1572008878f;
+ t += (inbuf[j - 14] + inbuf[j - 16]) * .2247288674f;
+ t += inbuf[j - 15] * .250535965f;
+ lpbuf[j] = t;
+ }
+ return 0;
+} /* lpfilt_ */
+
diff --git a/src/lpc10/median.c b/src/lpc10/median.c
new file mode 100644
index 0000000..0241b1e
--- /dev/null
+++ b/src/lpc10/median.c
@@ -0,0 +1,62 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:31:31 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern integer median_(integer *d1, integer *d2, integer *d3);
+
+/* ********************************************************************* */
+
+/* MEDIAN Version 45G */
+
+/*
+ * Revision 1.1 1996/08/19 22:31:31 jaf
+ * Initial revision
+ * */
+/* Revision 1.2 1996/03/14 22:30:22 jaf */
+/* Just rearranged the comments and local variable declarations a bit. */
+
+/* Revision 1.1 1996/02/07 14:47:53 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Find median of three values */
+
+/* Input: */
+/* D1,D2,D3 - Three input values */
+/* Output: */
+/* MEDIAN - Median value */
+
+integer median_(integer *d1, integer *d2, integer *d3)
+{
+ /* System generated locals */
+ integer ret_val;
+
+/* Arguments */
+ ret_val = *d2;
+ if (*d2 > *d1 && *d2 > *d3) {
+ ret_val = *d1;
+ if (*d3 > *d1) {
+ ret_val = *d3;
+ }
+ } else if (*d2 < *d1 && *d2 < *d3) {
+ ret_val = *d1;
+ if (*d3 < *d1) {
+ ret_val = *d3;
+ }
+ }
+ return ret_val;
+} /* median_ */
+
diff --git a/src/lpc10/mload.c b/src/lpc10/mload.c
new file mode 100644
index 0000000..9fb95fa
--- /dev/null
+++ b/src/lpc10/mload.c
@@ -0,0 +1,136 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:31:25 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int mload_(integer *order, integer *awins, integer *awinf, real *speech, real *phi, real *psi);
+
+/* ***************************************************************** */
+
+/* MLOAD Version 48 */
+
+/*
+ * Revision 1.1 1996/08/19 22:31:25 jaf
+ * Initial revision
+ * */
+/* Revision 1.5 1996/03/27 23:59:51 jaf */
+/* Added some more accurate comments about which indices of the argument */
+/* array SPEECH are read. I thought that this might be the cause of a */
+/* problem I've been having, but it isn't. */
+
+/* Revision 1.4 1996/03/26 19:16:53 jaf */
+/* Commented out the code at the end that copied the lower triangular */
+/* half of PHI into the upper triangular half (making the resulting */
+/* matrix symmetric). The upper triangular half was never used by later */
+/* code in subroutine ANALYS. */
+
+/* Revision 1.3 1996/03/18 21:16:00 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 16:47:41 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:48:01 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Load a covariance matrix. */
+
+/* Input: */
+/* ORDER - Analysis order */
+/* AWINS - Analysis window start */
+/* AWINF - Analysis window finish */
+/* SPEECH(AWINF) - Speech buffer */
+/* Indices MIN(AWINS, AWINF-(ORDER-1)) through */
+/* MAX(AWINF, AWINS+(ORDER-1)) read. */
+/* As long as (AWINF-AWINS) .GE. (ORDER-1), */
+/* this is just indices AWINS through AWINF. */
+/* Output: */
+/* PHI(ORDER,ORDER) - Covariance matrix */
+/* Lower triangular half and diagonal written, and read.*/
+/* Upper triangular half untouched. */
+/* PSI(ORDER) - Prediction vector */
+/* Indices 1 through ORDER written, */
+/* and most are read after that. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int mload_(integer *order, integer *awins, integer *awinf,
+ real *speech, real *phi, real *psi)
+{
+ /* System generated locals */
+ integer phi_dim1, phi_offset, i__1, i__2;
+
+ /* Local variables */
+ integer c__, i__, r__, start;
+
+/* Arguments */
+/* Local variables that need not be saved */
+/* Load first column of triangular covariance matrix PHI */
+ /* Parameter adjustments */
+ --psi;
+ phi_dim1 = *order;
+ phi_offset = phi_dim1 + 1;
+ phi -= phi_offset;
+ --speech;
+
+ /* Function Body */
+ start = *awins + *order;
+ i__1 = *order;
+ for (r__ = 1; r__ <= i__1; ++r__) {
+ phi[r__ + phi_dim1] = 0.f;
+ i__2 = *awinf;
+ for (i__ = start; i__ <= i__2; ++i__) {
+ phi[r__ + phi_dim1] += speech[i__ - 1] * speech[i__ - r__];
+ }
+ }
+/* Load last element of vector PSI */
+ psi[*order] = 0.f;
+ i__1 = *awinf;
+ for (i__ = start; i__ <= i__1; ++i__) {
+ psi[*order] += speech[i__] * speech[i__ - *order];
+ }
+/* End correct to get additional columns of PHI */
+ i__1 = *order;
+ for (r__ = 2; r__ <= i__1; ++r__) {
+ i__2 = r__;
+ for (c__ = 2; c__ <= i__2; ++c__) {
+ phi[r__ + c__ * phi_dim1] = phi[r__ - 1 + (c__ - 1) * phi_dim1] -
+ speech[*awinf + 1 - r__] * speech[*awinf + 1 - c__] +
+ speech[start - r__] * speech[start - c__];
+ }
+ }
+/* End correct to get additional elements of PSI */
+ i__1 = *order - 1;
+ for (c__ = 1; c__ <= i__1; ++c__) {
+ psi[c__] = phi[c__ + 1 + phi_dim1] - speech[start - 1] * speech[start
+ - 1 - c__] + speech[*awinf] * speech[*awinf - c__];
+ }
+/* Copy lower triangular section into upper (why bother?) */
+/* I'm commenting this out, since the upper triangular half of PHI
+*/
+/* is never used by later code, unless a sufficiently high level of
+*/
+/* tracing is turned on. */
+/* DO R = 1,ORDER */
+/* DO C = 1,R-1 */
+/* PHI(C,R) = PHI(R,C) */
+/* END DO */
+/* END DO */
+ return 0;
+} /* mload_ */
+
diff --git a/src/lpc10/onset.c b/src/lpc10/onset.c
new file mode 100644
index 0000000..1a370af
--- /dev/null
+++ b/src/lpc10/onset.c
@@ -0,0 +1,263 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:37:55 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:31:18 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int onset_(real *pebuf, integer *osbuf, integer *osptr, integer *oslen, integer *sbufl, integer *sbufh, integer *lframe, struct lpc10_encoder_state *st);
+
+/* Table of constant values */
+
+static real c_b2 = 1.f;
+
+/* ****************************************************************** */
+
+/* ONSET Version 49 */
+
+/* Revision 1.2 1996/08/20 20:37:55 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:31:18 jaf
+ * Initial revision
+ * */
+/* Revision 1.5 1996/03/15 16:41:01 jaf */
+/* Just rearranged INITONSET assignment orders to be consistent with */
+/* order of DATA statements in ONSET. */
+
+/* Revision 1.4 1996/03/15 15:48:27 jaf */
+/* Changed some comments, and only reordered the DATA statements (their */
+/* meaning wasn't changed). */
+
+/* Revision 1.3 1996/03/14 23:53:06 jaf */
+/* Added an entry INITONSET that reinitializes the local state variables */
+/* of subroutine ONSET. */
+
+/* Rearranged quite a few comments, adding more explaining which */
+/* arguments were inputs, and how the modified ones can be changed. */
+
+/* Revision 1.2 1996/03/12 23:53:00 jaf */
+/* Lots of comments added about the local state of this subroutine that */
+/* must be saved from one invocation to the next. */
+
+/* One constant 180 replaced with LFRAME, which should be "more general", */
+/* even though it would probably require many more changes than this to */
+/* get this coder to work for other frame sizes. */
+
+/* Revision 1.1 1996/02/07 14:48:09 jaf */
+/* Initial revision */
+
+
+/* ****************************************************************** */
+
+/* Floating point version */
+
+
+/* Detection of onsets in (or slightly preceding) the futuremost frame */
+/* of speech. */
+
+
+/* Input: */
+/* PEBUF(SBUFL:SBUFH) - Preemphasized speech */
+/* Indices SBUFH-LFRAME through SBUFH are read. */
+/* OSLEN - Maximum number of onsets that can be stored in OSBUF. */
+/* SBUFL, SBUFH - Range of PEBUF */
+/* LFRAME - length of a frame, in samples */
+/* Input/Output: */
+/* OSBUF(OSLEN) - Buffer which holds sorted indexes of onsets */
+/* Indices A through B are modified, where A */
+/* is the original value of OSPTR, and B is the final */
+/* value of OSPTR-1. B is at most OSLEN. */
+/* OSPTR - Free pointer into OSBUF */
+/* Initial value should be .LE. OSLEN+1. */
+/* If so, final value grows by one for each new onset */
+/* found, and final value will be .LE. OSLEN+1. */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this subroutine, or */
+/* reinitialize its state for any other reason, call the ENTRY INITONSET. */
+
+/* Subroutine */ int onset_(real *pebuf, integer *osbuf, integer *
+ osptr, integer *oslen, integer *sbufl, integer *sbufh, integer *
+ lframe, struct lpc10_encoder_state *st)
+{
+ /* Initialized data */
+
+ real *n;
+ real *d__;
+ real *l2buf;
+ real *l2sum1;
+ integer *l2ptr1;
+ integer *l2ptr2;
+ logical *hyst;
+
+ /* System generated locals */
+ integer pebuf_offset, i__1;
+ real r__1;
+
+ /* Builtin functions */
+ double r_sign(real *, real *);
+
+ /* Local variables */
+ integer i__;
+ integer *lasti;
+ real l2sum2;
+ real *fpc;
+
+/* Arguments */
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Parameters/constants */
+/* Parameters for onset detection algorithm: */
+/* L2 Threshold for filtered slope of FPC (function of L2WID!) */
+/* L2LAG Lag due to both filters which compute filtered slope of FPC */
+/* L2WID Width of the filter which computes the slope of FPC */
+/* OSHYST The number of samples of slope(FPC) which must be below */
+/* the threshold before a new onset may be declared. */
+/* Local variables that need not be saved */
+/* Local state */
+/* Variables */
+/* N, D Numerator and denominator of prediction filters */
+/* FPC Current prediction coefs */
+/* L2BUF, L2SUM1, L2SUM2 State of slope filter */
+/* The only "significant" change I've made is to change L2SUM2 out
+*/
+/* of the list of local variables that need to be saved, since it */
+/* didn't need to be. */
+/* L2SUM1 need not be, but avoiding saving it would require a small
+*/
+/* change to the body of the code. See comments below for an */
+/* example of how the code could be changed to avoid saving L2SUM1.
+*/
+/* FPC and LASTI are saved from one invocation to the next, but */
+/* they are not given initial values. This is acceptable, because
+*/
+/* FPC will be assigned a value the first time that this function */
+/* is called after D is initialized to 1, since the formula to */
+/* change D will not change it to 0 in one step, and the IF (D */
+/* .NE. 0) statement will execute its THEN part, initializing FPC.
+*/
+
+/* LASTI's value will not be used until HYST is .TRUE., and */
+/* whenever HYST is changed from its initial value of .FALSE., */
+/* LASTI is assigned a value. */
+/* In a C version of this coder, it would be nice if all of these */
+/* saved things, in this and all other subroutines, could be stored
+*/
+/* in a single struct lpc10_coder_state_t, initialized with a call
+*/
+/* to a function like lpc10_init(&lpc10_coder_state). In this way,
+*/
+/* a program that used these functions could conveniently alternate
+*/
+/* coding more than one distinct audio stream. */
+
+ n = &(st->n);
+ d__ = &(st->d__);
+ fpc = &(st->fpc);
+ l2buf = &(st->l2buf[0]);
+ l2sum1 = &(st->l2sum1);
+ l2ptr1 = &(st->l2ptr1);
+ l2ptr2 = &(st->l2ptr2);
+ lasti = &(st->lasti);
+ hyst = &(st->hyst);
+
+ /* Parameter adjustments */
+ if (osbuf) {
+ --osbuf;
+ }
+ if (pebuf) {
+ pebuf_offset = *sbufl;
+ pebuf -= pebuf_offset;
+ }
+
+ /* Function Body */
+
+/* The following line subtracted a hard-coded "180" from LASTI, */
+/* instead of using a variable like LFRAME or a constant like */
+/* MAXFRM. I changed it to LFRAME, for "generality". */
+ if (*hyst) {
+ *lasti -= *lframe;
+ }
+ i__1 = *sbufh;
+ for (i__ = *sbufh - *lframe + 1; i__ <= i__1; ++i__) {
+/* Compute FPC; Use old FPC on divide by zero; Clamp FPC to +/- 1.
+*/
+ *n = (pebuf[i__] * pebuf[i__ - 1] + (*n) * 63.f) / 64.f;
+/* Computing 2nd power */
+ r__1 = pebuf[i__ - 1];
+ *d__ = (r__1 * r__1 + (*d__) * 63.f) / 64.f;
+ if ((*d__) != 0.f) {
+ if (abs(*n) > (*d__)) {
+ *fpc = r_sign(&c_b2, n);
+ } else {
+ *fpc = (*n) / (*d__);
+ }
+ }
+/* Filter FPC */
+/* In order to allow L2SUM1 not to be saved from one invocation
+of */
+/* this subroutine to the next, one could change the sequence of
+ */
+/* assignments below, up to the IF statement, to the following.
+ In */
+/* addition, the initial value of L2PTR2 should be changed to */
+/* L2WID/2 instead of L2WID/2+1. */
+
+/* L2SUM1 = L2BUF(L2PTR2) */
+/* L2PTR2 = MOD(L2PTR2,L2WID)+1 */
+/* L2SUM1 = L2SUM1 - L2BUF(L2PTR2) + FPC */
+/* L2BUF(L2PTR2) = L2SUM1 */
+
+/* * The following lines didn't change from the original: */
+/* L2SUM2 = L2BUF(L2PTR1) */
+/* L2BUF(L2PTR1) = FPC */
+/* L2PTR1 = MOD(L2PTR1,L2WID)+1 */
+
+ l2sum2 = l2buf[*l2ptr1 - 1];
+ *l2sum1 = *l2sum1 - l2buf[*l2ptr2 - 1] + *fpc;
+ l2buf[*l2ptr2 - 1] = *l2sum1;
+ l2buf[*l2ptr1 - 1] = *fpc;
+ *l2ptr1 = *l2ptr1 % 16 + 1;
+ *l2ptr2 = *l2ptr2 % 16 + 1;
+ if ((r__1 = *l2sum1 - l2sum2, abs(r__1)) > 1.7f) {
+ if (! (*hyst)) {
+/* Ignore if buffer full */
+ if (*osptr <= *oslen) {
+ osbuf[*osptr] = i__ - 9;
+ ++(*osptr);
+ }
+ *hyst = TRUE_;
+ }
+ *lasti = i__;
+/* After one onset detection, at least OSHYST sample times m
+ust go */
+/* by before another is allowed to occur. */
+ } else if ((*hyst) && i__ - *lasti >= 10) {
+ *hyst = FALSE_;
+ }
+ }
+ return 0;
+} /* onset_ */
diff --git a/src/lpc10/pitsyn.c b/src/lpc10/pitsyn.c
new file mode 100644
index 0000000..b998790
--- /dev/null
+++ b/src/lpc10/pitsyn.c
@@ -0,0 +1,514 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:40:12 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:31:12 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int pitsyn_(integer *order, integer *voice, integer *pitch, real *rms, real *rc, integer *lframe, integer *ivuv, integer *ipiti, real *rmsi, real *rci, integer *nout, real *ratio, struct lpc10_decoder_state *st);
+
+/* ***************************************************************** */
+
+/* PITSYN Version 53 */
+
+/*
+ * Revision 1.2 1996/08/20 20:40:12 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:31:12 jaf
+ * Initial revision
+ * */
+/* Revision 1.2 1996/03/25 18:49:07 jaf */
+/* Added commments about which indices of array arguments are read or */
+/* written. */
+
+/* Rearranged local variable declarations to indicate which need to be */
+/* saved from one invocation to the next. Added entry INITPITSYN to */
+/* reinitialize local state variables, if desired. */
+
+/* Added lots of comments about proving that the maximum number of pitch */
+/* periods (NOUT) that can be returned is 16. The call to STOP that */
+/* could happen if NOUT got too large was removed as a result. */
+
+/* Also proved that the total number of samples returned from N calls, */
+/* each with identical values of LFRAME, will always be in the range */
+/* N*LFRAME-MAXPIT+1 to N*LFRAME. */
+
+/* Revision 1.1 1996/02/07 14:48:18 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* Synthesize a single pitch epoch */
+
+/* Input: */
+/* ORDER - Synthesis order (number of RC's) */
+/* VOICE - Half frame voicing decisions */
+/* Indices 1 through 2 read. */
+/* LFRAME - Length of speech buffer */
+/* Input/Output: */
+/* PITCH - Pitch */
+/* This value should be in the range MINPIT (20) to MAXPIT */
+/* (156), inclusive. */
+/* PITCH can be modified under some conditions. */
+/* RMS - Energy (can be modified) */
+/* RMS is changed to 1 if the value passed in is less than 1. */
+/* RC - Reflection coefficients */
+/* Indices 1 through ORDER can be temporarily overwritten with */
+/* RCO, and then replaced with original values, under some */
+/* conditions. */
+/* Output: */
+/* IVUV - Pitch epoch voicing decisions */
+/* Indices (I) of IVUV, IPITI, and RMSI are written, */
+/* and indices (J,I) of RCI are written, */
+/* where I ranges from 1 to NOUT, and J ranges from 1 to ORDER. */
+/* IPITI - Pitch epoch length */
+/* RMSI - Pitch epoch energy */
+/* RCI - Pitch epoch RC's */
+/* NOUT - Number of pitch periods in this frame */
+/* This is at least 0, at least 1 if MAXPIT .LT. LFRAME (this */
+/* is currently true on every call), and can never be more than */
+/* (LFRAME+MAXPIT-1)/PITCH, which is currently 16 with */
+/* LFRAME=180, MAXPIT=156, and PITCH .GE. 20, as SYNTHS */
+/* guarantees when it calls this subroutine. */
+/* RATIO - Previous to present energy ratio */
+/* Always assigned a value. */
+
+/* Subroutine */ int pitsyn_(integer *order, integer *voice,
+ integer *pitch, real *rms, real *rc, integer *lframe, integer *ivuv,
+ integer *ipiti, real *rmsi, real *rci, integer *nout, real *ratio,
+ struct lpc10_decoder_state *st)
+{
+ /* Initialized data */
+
+ real *rmso;
+ logical *first;
+
+ /* System generated locals */
+ integer rci_dim1 = 0, rci_offset, i__1, i__2;
+ real r__1;
+
+ /* Builtin functions */
+ double log(doublereal), exp(doublereal);
+
+ /* Local variables */
+ real alrn, alro, yarc[10], prop;
+ integer i__, j, vflag, jused, lsamp;
+ integer *jsamp;
+ real slope;
+ integer *ipito;
+ real uvpit;
+ integer ip, nl, ivoice;
+ integer *ivoico;
+ integer istart;
+ real *rco;
+ real xxy;
+
+/* Arguments */
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Local variables that need not be saved */
+/* LSAMP is initialized in the IF (FIRST) THEN clause, but it is */
+/* not used the first time through, and it is given a value before
+*/
+/* use whenever FIRST is .FALSE., so it appears unnecessary to */
+/* assign it a value when FIRST is .TRUE. */
+/* Local state */
+/* FIRST - .TRUE. only on first call to PITSYN. */
+/* IVOICO - Previous VOICE(2) value. */
+/* IPITO - Previous PITCH value. */
+/* RMSO - Previous RMS value. */
+/* RCO - Previous RC values. */
+
+/* JSAMP - If this routine is called N times with identical values of */
+/* LFRAME, then the total length of all pitch periods returned */
+/* is always N*LFRAME-JSAMP, and JSAMP is always in the range 0
+*/
+/* to MAXPIT-1 (see below for why this is so). Thus JSAMP is */
+/* the number of samples "left over" from the previous call to */
+/* PITSYN, that haven't been "used" in a pitch period returned */
+/* from this subroutine. Every time this subroutine is called,
+*/
+/* it returns pitch periods with a total length of at most */
+/* LFRAME+JSAMP. */
+
+/* IVOICO, IPITO, RCO, and JSAMP need not be assigned an initial value */
+/* with a DATA statement, because they are always initialized on the */
+/* first call to PITSYN. */
+
+/* FIRST and RMSO should be initialized with DATA statements, because */
+/* even on the first call, they are used before being initialized. */
+ /* Parameter adjustments */
+ if (rc) {
+ --rc;
+ }
+ if (rci) {
+ rci_dim1 = *order;
+ rci_offset = rci_dim1 + 1;
+ rci -= rci_offset;
+ }
+ if (voice) {
+ --voice;
+ }
+ if (ivuv) {
+ --ivuv;
+ }
+ if (ipiti) {
+ --ipiti;
+ }
+ if (rmsi) {
+ --rmsi;
+ }
+
+ /* Function Body */
+ ivoico = &(st->ivoico);
+ ipito = &(st->ipito);
+ rmso = &(st->rmso);
+ rco = &(st->rco[0]);
+ jsamp = &(st->jsamp);
+ first = &(st->first_pitsyn);
+
+ if (*rms < 1.f) {
+ *rms = 1.f;
+ }
+ if (*rmso < 1.f) {
+ *rmso = 1.f;
+ }
+ uvpit = 0.f;
+ *ratio = *rms / (*rmso + 8.f);
+ if (*first) {
+ lsamp = 0;
+ ivoice = voice[2];
+ if (ivoice == 0) {
+ *pitch = *lframe / 4;
+ }
+ *nout = *lframe / *pitch;
+ *jsamp = *lframe - *nout * *pitch;
+
+/* SYNTHS only calls this subroutine with PITCH in the range
+20 */
+/* to 156. LFRAME = MAXFRM = 180, so NOUT is somewhere in th
+e */
+/* range 1 to 9. */
+
+/* JSAMP is "LFRAME mod PITCH", so it is in the range 0 to */
+/* (PITCH-1), or 0 to MAXPIT-1=155, after the first call. */
+
+ i__1 = *nout;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ i__2 = *order;
+ for (j = 1; j <= i__2; ++j) {
+ rci[j + i__ * rci_dim1] = rc[j];
+ }
+ ivuv[i__] = ivoice;
+ ipiti[i__] = *pitch;
+ rmsi[i__] = *rms;
+ }
+ *first = FALSE_;
+ } else {
+ vflag = 0;
+ lsamp = *lframe + *jsamp;
+ slope = (*pitch - *ipito) / (real) lsamp;
+ *nout = 0;
+ jused = 0;
+ istart = 1;
+ if (voice[1] == *ivoico && voice[2] == voice[1]) {
+ if (voice[2] == 0) {
+/* SSUV - - 0 , 0 , 0 */
+ *pitch = *lframe / 4;
+ *ipito = *pitch;
+ if (*ratio > 8.f) {
+ *rmso = *rms;
+ }
+ }
+/* SSVC - - 1 , 1 , 1 */
+ slope = (*pitch - *ipito) / (real) lsamp;
+ ivoice = voice[2];
+ } else {
+ if (*ivoico != 1) {
+ if (*ivoico == voice[1]) {
+/* UV2VC2 - - 0 , 0 , 1 */
+ nl = lsamp - *lframe / 4;
+ } else {
+/* UV2VC1 - - 0 , 1 , 1 */
+ nl = lsamp - *lframe * 3 / 4;
+ }
+ ipiti[1] = nl / 2;
+ ipiti[2] = nl - ipiti[1];
+ ivuv[1] = 0;
+ ivuv[2] = 0;
+ rmsi[1] = *rmso;
+ rmsi[2] = *rmso;
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ rci[i__ + rci_dim1] = rco[i__ - 1];
+ rci[i__ + (rci_dim1 << 1)] = rco[i__ - 1];
+ rco[i__ - 1] = rc[i__];
+ }
+ slope = 0.f;
+ *nout = 2;
+ *ipito = *pitch;
+ jused = nl;
+ istart = nl + 1;
+ ivoice = 1;
+ } else {
+ if (*ivoico != voice[1]) {
+/* VC2UV1 - - 1 , 0 , 0 */
+ lsamp = *lframe / 4 + *jsamp;
+ } else {
+/* VC2UV2 - - 1 , 1 , 0 */
+ lsamp = *lframe * 3 / 4 + *jsamp;
+ }
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ yarc[i__ - 1] = rc[i__];
+ rc[i__] = rco[i__ - 1];
+ }
+ ivoice = 1;
+ slope = 0.f;
+ vflag = 1;
+ }
+ }
+/* Here is the value of most variables that are used below, depending
+on */
+/* the values of IVOICO, VOICE(1), and VOICE(2). VOICE(1) and VOICE(2
+) */
+/* are input arguments, and IVOICO is the value of VOICE(2) on the */
+/* previous call (see notes for the IF (NOUT .NE. 0) statement near th
+e */
+/* end). Each of these three values is either 0 or 1. These three */
+/* values below are given as 3-bit long strings, in the order IVOICO,
+*/
+/* VOICE(1), and VOICE(2). It appears that the code above assumes tha
+t */
+/* the bit sequences 010 and 101 never occur, but I wonder whether a
+*/
+/* large enough number of bit errors in the channel could cause such a
+ */
+/* thing to happen, and if so, could that cause NOUT to ever go over 1
+1? */
+
+/* Note that all of the 180 values in the table are really LFRAME, but
+ */
+/* 180 has fewer characters, and it makes the table a little more */
+/* concrete. If LFRAME is ever changed, keep this in mind. Similarly
+, */
+/* 135's are 3*LFRAME/4, and 45's are LFRAME/4. If LFRAME is not a */
+/* multiple of 4, then the 135 for NL-JSAMP is actually LFRAME-LFRAME/
+4, */
+/* and the 45 for NL-JSAMP is actually LFRAME-3*LFRAME/4. */
+
+/* Note that LSAMP-JSAMP is given as the variable. This was just for
+*/
+/* brevity, to avoid adding "+JSAMP" to all of the column entries. */
+/* Similarly for NL-JSAMP. */
+
+/* Variable | 000 001 011,010 111 110 100,101 */
+/* ------------+-------------------------------------------------- */
+/* ISTART | 1 NL+1 NL+1 1 1 1 */
+/* LSAMP-JSAMP | 180 180 180 180 135 45 */
+/* IPITO | 45 PITCH PITCH oldPITCH oldPITCH oldPITCH */
+/* SLOPE | 0 0 0 seebelow 0 0 */
+/* JUSED | 0 NL NL 0 0 0 */
+/* PITCH | 45 PITCH PITCH PITCH PITCH PITCH */
+/* NL-JSAMP | -- 135 45 -- -- -- */
+/* VFLAG | 0 0 0 0 1 1 */
+/* NOUT | 0 2 2 0 0 0 */
+/* IVOICE | 0 1 1 1 1 1 */
+
+/* while_loop | once once once once twice twice */
+
+/* ISTART | -- -- -- -- JUSED+1 JUSED+1 */
+/* LSAMP-JSAMP | -- -- -- -- 180 180 */
+/* IPITO | -- -- -- -- oldPITCH oldPITCH */
+/* SLOPE | -- -- -- -- 0 0 */
+/* JUSED | -- -- -- -- ?? ?? */
+/* PITCH | -- -- -- -- PITCH PITCH */
+/* NL-JSAMP | -- -- -- -- -- -- */
+/* VFLAG | -- -- -- -- 0 0 */
+/* NOUT | -- -- -- -- ?? ?? */
+/* IVOICE | -- -- -- -- 0 0 */
+
+
+/* UVPIT is always 0.0 on the first pass through the DO WHILE (.TRUE.)
+ */
+/* loop below. */
+
+/* The only possible non-0 value of SLOPE (in column 111) is */
+/* (PITCH-IPITO)/FLOAT(LSAMP) */
+
+/* Column 101 is identical to 100. Any good properties we can prove
+*/
+/* for 100 will also hold for 101. Similarly for 010 and 011. */
+
+/* SYNTHS calls this subroutine with PITCH restricted to the range 20
+to */
+/* 156. IPITO is similarly restricted to this range, after the first
+*/
+/* call. IP below is also restricted to this range, given the */
+/* definitions of IPITO, SLOPE, UVPIT, and that I is in the range ISTA
+RT */
+/* to LSAMP. */
+
+ while(TRUE_) {
+
+/* JUSED is the total length of all pitch periods curr
+ently */
+/* in the output arrays, in samples. */
+
+/* An invariant of the DO I = ISTART,LSAMP loop below,
+ under */
+/* the condition that IP is always in the range 1 thro
+ugh */
+/* MAXPIT, is: */
+
+/* (I - MAXPIT) .LE. JUSED .LE. (I-1) */
+
+/* Note that the final value of I is LSAMP+1, so that
+after */
+/* the DO loop is complete, we know: */
+
+/* (LSAMP - MAXPIT + 1) .LE. JUSED .LE. LSAMP */
+
+ i__1 = lsamp;
+ for (i__ = istart; i__ <= i__1; ++i__) {
+ r__1 = *ipito + slope * i__;
+ ip = r__1 + .5f;
+ if (uvpit != 0.f) {
+ ip = uvpit;
+ }
+ if (ip <= i__ - jused) {
+ ++(*nout);
+
+/* The following check is no longer nece
+ssary, now that */
+/* we can prove that NOUT will never go
+over 16. */
+
+/* IF (NOUT .GT. 16) STOP 'PITSYN: too many epochs'
+*/
+
+ ipiti[*nout] = ip;
+ *pitch = ip;
+ ivuv[*nout] = ivoice;
+ jused += ip;
+ prop = (jused - ip / 2) / (real) lsamp;
+ i__2 = *order;
+ for (j = 1; j <= i__2; ++j) {
+ alro = log((rco[j - 1] + 1) / (1 - rco[j - 1]));
+ alrn = log((rc[j] + 1) / (1 - rc[j]));
+ xxy = alro + prop * (alrn - alro);
+ xxy = exp(xxy);
+ rci[j + *nout * rci_dim1] = (xxy - 1) / (xxy + 1);
+ }
+ rmsi[*nout] = log(*rmso) + prop * (log(*rms) - log(*rmso));
+ rmsi[*nout] = exp(rmsi[*nout]);
+ }
+ }
+ if (vflag != 1) {
+ goto L100;
+ }
+
+/* I want to prove what range UVPIT must lie in after
+the */
+/* assignments to it below. To do this, I must determ
+ine */
+/* what range (LSAMP-ISTART) must lie in, after the */
+/* assignments to ISTART and LSAMP below. */
+
+/* Let oldLSAMP be the value of LSAMP at this point in
+ the */
+/* execution. This is 135+JSAMP in state 110, or 45+J
+SAMP in */
+/* states 100 or 101. */
+
+/* Given the loop invariant on JUSED above, we know th
+at: */
+
+/* (oldLSAMP - MAXPIT + 1) .LE. JUSED .LE. oldLSAMP */
+
+/* ISTART is one more than this. */
+
+/* Let newLSAMP be the value assigned to LSAMP below.
+ This */
+/* is 180+JSAMP. Thus (newLSAMP-oldLSAMP) is either 4
+5 or */
+/* 135, depending on the state. */
+
+/* Thus, the range of newLSAMP-ISTART is: */
+
+/* (newLSAMP-(oldLSAMP+1)) .LE. newLSAMP-ISTART */
+/* .LE. (newLSAMP-(oldLSAMP - MAXPIT + 2)) */
+
+/* or: */
+
+/* 46 .LE. newLSAMP-ISTART .LE. 133+MAXPIT .EQ. 289 */
+
+/* Therefore, UVPIT is in the range 23 to 144 after th
+e first */
+/* assignment to UVPIT below, and after the conditiona
+l */
+/* assignment, it is in the range 23 to 90. */
+
+/* The important thing is that it is in the range 20 t
+o 156, */
+/* so that in the loop above, IP is always in this ran
+ge. */
+
+ vflag = 0;
+ istart = jused + 1;
+ lsamp = *lframe + *jsamp;
+ slope = 0.f;
+ ivoice = 0;
+ uvpit = (real) ((lsamp - istart) / 2);
+ if (uvpit > 90.f) {
+ uvpit /= 2;
+ }
+ *rmso = *rms;
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ rc[i__] = yarc[i__ - 1];
+ rco[i__ - 1] = yarc[i__ - 1];
+ }
+ }
+L100:
+ *jsamp = lsamp - jused;
+ }
+/* Given that the maximum pitch period MAXPIT .LT. LFRAME (this is
+*/
+/* currently true on every call, since SYNTHS always sets */
+/* LFRAME=180), NOUT will always be .GE. 1 at this point. */
+ if (*nout != 0) {
+ *ivoico = voice[2];
+ *ipito = *pitch;
+ *rmso = *rms;
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ rco[i__ - 1] = rc[i__];
+ }
+ }
+ return 0;
+} /* pitsyn_ */
diff --git a/src/lpc10/placea.c b/src/lpc10/placea.c
new file mode 100644
index 0000000..8eb3f49
--- /dev/null
+++ b/src/lpc10/placea.c
@@ -0,0 +1,214 @@
+/*
+
+$Log: placea.c,v $
+Revision 1.2 2007/04/18 14:00:38 rrt
+Remove $Log tokens and associated log messages (in many files, several
+copies of every log message were being written) and lots of warnings.
+
+Revision 1.1 2007/04/16 21:57:47 rrt
+LPC-10 support, documentation still to come; I wanted to land the code
+before 14.0.0 went into test, and I'll be busy tomorrow.
+
+Not highly tested either, but it's just a format, doesn't interfere
+with anything else, and I'll get on that case before we go stable.
+
+ * Revision 1.1 1996/08/19 22:31:07 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int placea_(integer *ipitch, integer *voibuf, integer *obound, integer *af, integer *vwin, integer *awin, integer *ewin, integer *lframe, integer *maxwin);
+
+/* *********************************************************************** */
+
+/* PLACEA Version 48 */
+
+/* Revision 1.1 1996/08/19 22:31:07 jaf
+ * Initial revision
+ * */
+/* Revision 1.5 1996/03/19 20:41:55 jaf */
+/* Added some conditions satisfied by the output values in EWIN. */
+
+/* Revision 1.4 1996/03/19 20:24:17 jaf */
+/* Added some conditions satisfied by the output values in AWIN. */
+
+/* Revision 1.3 1996/03/18 21:40:04 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 16:43:09 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:48:31 jaf */
+/* Initial revision */
+
+
+/* *********************************************************************** */
+/* Input: */
+/* IPITCH */
+/* VOIBUF */
+/* Indices (2,AF-2), (1,AF-1), (2,AF-1), (1,AF), and (2,AF) read.*/
+/* All other indices untouched. */
+/* OBOUND */
+/* AF */
+/* VWIN */
+/* Indices (1,AF) and (2,AF) read. */
+/* All other indices untouched. */
+/* LFRAME */
+/* MAXWIN */
+/* Input/Output: */
+/* AWIN */
+/* Index (1,AF-1) read. */
+/* Indices (1,AF) and (2,AF) written, and then read. */
+/* All other indices untouched. */
+/* In all cases (except possibly one), the final values will */
+/* satisfy the condition: AWIN(2,AF)-AWIN(1,AF)+1 = MAXWIN. */
+/* In that other case, */
+/* AWIN(1,AF)=VWIN(1,AF) and AWIN(2,AF)=VWIN(2,AF). */
+/* Output: */
+/* EWIN */
+/* Indices (1,AF) and (2,AF) written. */
+/* All other indices untouched. */
+/* In all cases, the final values will satisfy the condition: */
+/* AWIN(1,AF) .LE. EWIN(1,AF) .LE. EWIN(2,AF) .LE. AWIN(2,AF) */
+/* In other words, the energy window is a sub-window of */
+/* the analysis window. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int placea_(integer *ipitch, integer *voibuf, integer *
+ obound, integer *af, integer *vwin, integer *awin, integer *ewin,
+ integer *lframe, integer *maxwin)
+{
+ /* System generated locals */
+ real r__1;
+
+ /* Builtin functions */
+ integer i_nint(real *);
+
+ /* Local variables */
+ logical allv, winv;
+ integer i__, j, k, l, hrange;
+ logical ephase;
+ integer lrange;
+
+/* Arguments */
+/* Local variables that need not be saved */
+ /* Parameter adjustments */
+ ewin -= 3;
+ awin -= 3;
+ vwin -= 3;
+ --voibuf;
+
+ /* Function Body */
+ lrange = (*af - 2) * *lframe + 1;
+ hrange = *af * *lframe;
+/* Place the Analysis window based on the voicing window */
+/* placement, onsets, tentative voicing decision, and pitch. */
+
+/* Case 1: Sustained Voiced Speech */
+/* If the five most recent voicing decisions are */
+/* voiced, then the window is placed phase-synchronously with the */
+/* previous window, as close to the present voicing window if possible.
+*/
+/* If onsets bound the voicing window, then preference is given to */
+/* a phase-synchronous placement which does not overlap these onsets. */
+
+/* Case 2: Voiced Transition */
+/* If at least one voicing decision in AF is voicied, and there are no
+*/
+/* onsets, then the window is placed as in case 1. */
+
+/* Case 3: Unvoiced Speech or Onsets */
+/* If both voicing decisions in AF are unvoiced, or there are onsets, */
+/* then the window is placed coincident with the voicing window. */
+
+/* Note: During phase-synchronous placement of windows, the length */
+/* is not altered from MAXWIN, since this would defeat the purpose */
+/* of phase-synchronous placement. */
+/* Check for case 1 and case 2 */
+ allv = voibuf[((*af - 2) << 1) + 2] == 1;
+ allv = allv && voibuf[((*af - 1) << 1) + 1] == 1;
+ allv = allv && voibuf[((*af - 1) << 1) + 2] == 1;
+ allv = allv && voibuf[(*af << 1) + 1] == 1;
+ allv = allv && voibuf[(*af << 1) + 2] == 1;
+ winv = voibuf[(*af << 1) + 1] == 1 || voibuf[(*af << 1) + 2] == 1;
+ if (allv || (winv && *obound == 0)) {
+/* APHASE: Phase synchronous window placement. */
+/* Get minimum lower index of the window. */
+ i__ = (lrange + *ipitch - 1 - awin[((*af - 1) << 1) + 1]) / *ipitch;
+ i__ *= *ipitch;
+ i__ += awin[((*af - 1) << 1) + 1];
+/* L = the actual length of this frame's analysis window. */
+ l = *maxwin;
+/* Calculate the location where a perfectly centered window would star
+t. */
+ k = (vwin[(*af << 1) + 1] + vwin[(*af << 1) + 2] + 1 - l) / 2;
+/* Choose the actual location to be the pitch multiple closest to this
+. */
+ r__1 = (real) (k - i__) / *ipitch;
+ awin[(*af << 1) + 1] = i__ + i_nint(&r__1) * *ipitch;
+ awin[(*af << 1) + 2] = awin[(*af << 1) + 1] + l - 1;
+/* If there is an onset bounding the right of the voicing window and t
+he */
+/* analysis window overlaps that, then move the analysis window backwa
+rd */
+/* to avoid this onset. */
+ if (*obound >= 2 && awin[(*af << 1) + 2] > vwin[(*af << 1) + 2]) {
+ awin[(*af << 1) + 1] -= *ipitch;
+ awin[(*af << 1) + 2] -= *ipitch;
+ }
+/* Similarly for the left of the voicing window. */
+ if ((*obound == 1 || *obound == 3) && awin[(*af << 1) + 1] < vwin[(*
+ af << 1) + 1]) {
+ awin[(*af << 1) + 1] += *ipitch;
+ awin[(*af << 1) + 2] += *ipitch;
+ }
+/* If this placement puts the analysis window above HRANGE, then */
+/* move it backward an integer number of pitch periods. */
+ while(awin[(*af << 1) + 2] > hrange) {
+ awin[(*af << 1) + 1] -= *ipitch;
+ awin[(*af << 1) + 2] -= *ipitch;
+ }
+/* Similarly if the placement puts the analysis window below LRANGE.
+*/
+ while(awin[(*af << 1) + 1] < lrange) {
+ awin[(*af << 1) + 1] += *ipitch;
+ awin[(*af << 1) + 2] += *ipitch;
+ }
+/* Make Energy window be phase-synchronous. */
+ ephase = TRUE_;
+/* Case 3 */
+ } else {
+ awin[(*af << 1) + 1] = vwin[(*af << 1) + 1];
+ awin[(*af << 1) + 2] = vwin[(*af << 1) + 2];
+ ephase = FALSE_;
+ }
+/* RMS is computed over an integer number of pitch periods in the analysis
+ */
+/*window. When it is not placed phase-synchronously, it is placed as clos
+e*/
+/* as possible to onsets. */
+ j = (awin[(*af << 1) + 2] - awin[(*af << 1) + 1] + 1) / *ipitch * *ipitch;
+ if (j == 0 || ! winv) {
+ ewin[(*af << 1) + 1] = vwin[(*af << 1) + 1];
+ ewin[(*af << 1) + 2] = vwin[(*af << 1) + 2];
+ } else if (! ephase && *obound == 2) {
+ ewin[(*af << 1) + 1] = awin[(*af << 1) + 2] - j + 1;
+ ewin[(*af << 1) + 2] = awin[(*af << 1) + 2];
+ } else {
+ ewin[(*af << 1) + 1] = awin[(*af << 1) + 1];
+ ewin[(*af << 1) + 2] = awin[(*af << 1) + 1] + j - 1;
+ }
+ return 0;
+} /* placea_ */
+
diff --git a/src/lpc10/placev.c b/src/lpc10/placev.c
new file mode 100644
index 0000000..db032e3
--- /dev/null
+++ b/src/lpc10/placev.c
@@ -0,0 +1,244 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:31:02 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int placev_(integer *osbuf, integer *osptr, integer *oslen, integer *obound, integer *vwin, integer *af, integer *lframe, integer *minwin, integer *maxwin, integer *dvwinl, integer *dvwinh);
+
+/* ****************************************************************** */
+
+/* PLACEV Version 48 */
+
+/*
+ * Revision 1.1 1996/08/19 22:31:02 jaf
+ * Initial revision
+ * */
+/* Revision 1.6 1996/03/19 20:42:19 jaf */
+/* Added some conditions satisfied by the output values in VWIN. */
+
+/* Revision 1.5 1996/03/19 18:37:56 jaf */
+/* Strengthened the specification of which indices of VWIN are read and */
+/* written. */
+
+/* Revision 1.4 1996/03/15 16:38:33 jaf */
+/* One tiny comment added. */
+
+/* Revision 1.3 1996/03/15 16:36:13 jaf */
+/* Added comments giving In/Out status of arguments. */
+
+/* Revision 1.2 1996/03/12 23:56:01 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:48:39 jaf */
+/* Initial revision */
+
+
+/* ****************************************************************** */
+
+/* Input: */
+/* OSBUF Buffer which holds sorted indexes of onsets */
+/* I believe that only indices 1 through OSPTR-1 can be read. */
+/* OSLEN */
+/* OSPTR Free pointer into OSBUF */
+/* AF */
+/* LFRAME */
+/* MINWIN */
+/* MAXWIN */
+/* DVWINL */
+/* DVWINH (This argument is never used. Should it be?) */
+/* Input/Output: */
+/* VWIN Buffer of Voicing Window Positions (Modified) */
+/* Index (2,AF-1) is read. */
+/* Indices (1,AF) and (2,AF) are written, */
+/* and then possibly read. */
+/* All other indices are unused. */
+/* In all cases, the final values will satsify the condition:*/
+/* VWIN(2,AF)-VWIN(1,AF)+1 .LE. MAXWIN */
+/* I'm not certain yet, but they may also satisfy: */
+/* MINWIN .LE. VWIN(2,AF)-VWIN(1,AF)+1 */
+/* Output: */
+/* OBOUND This variable is set by this procedure and used */
+/* in placing analysis windows (PLACEA). Bit 1 */
+/* indicates whether an onset bounds the left side */
+/* of the voicing window, and bit 2 indicates whether */
+/* an onset bounds the right side of the voicing window. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int placev_(integer *osbuf, integer *osptr, integer *oslen,
+ integer *obound, integer *vwin, integer *af, integer *lframe, integer
+ *minwin, integer *maxwin, integer *dvwinl, integer *dvwinh)
+{
+ /* System generated locals */
+ integer i__1, i__2;
+
+ /* Local variables */
+ logical crit;
+ integer i__, q, osptr1, hrange, lrange;
+
+/* Arguments */
+/* Local variables that need not be saved */
+/* Variables */
+/* LRANGE, HRANGE Range in which window is placed */
+/* OSPTR1 OSPTR excluding samples in 3F */
+/* Local state */
+/* None */
+/* Voicing Window Placement */
+
+/* __________________ __________________ ______________ */
+/* | | | */
+/* | 1F | 2F | 3F ... */
+/* |__________________|__________________|______________ */
+
+/* Previous | */
+/* Window | */
+/* ...________| */
+
+/* | | */
+/* ------>| This window's placement range |<------ */
+/* | | */
+
+/* There are three cases. Note that these are different from those */
+/* given in the LPC-10e phase 1 report. */
+
+/* 1. If there are no onsets in this range, then the voicing window */
+/* is centered in the pitch window. If such a placement is not within
+*/
+/* the window's placement range, then the window is placed in the left-
+*/
+/* most portion of the placement range. Its length is always MAXWIN. */
+
+/* 2. If the first onset is in 2F and there is sufficient room to place
+ */
+/* the window immediately before this onset, then the window is placed
+*/
+/* there, and its length is set to the maximum possible under these */
+/* constraints. */
+
+/* "Critical Region Exception": If there is another onset in 2F */
+/* such that a window can be placed between the two onsets, the */
+/* window is placed there (ie, as in case 3). */
+
+/* 3. Otherwise, the window is placed immediately after the onset. The
+ */
+/* window's length */
+/* is the longest length that can fit in the range under these constraint
+s,*/
+/* except that the window may be shortened even further to avoid overlapp
+ing*/
+/* other onsets in the placement range. In any case, the window's length
+*/
+/* is at least MINWIN. */
+
+/* Note that the values of MINWIN and LFRAME must be chosen such */
+/* that case 2 = false implies case 3 = true. This means that */
+/* MINWIN <= LFRAME/2. If this were not the case, then a fourth case */
+/* would have to be added for when the window cannot fit either before
+*/
+/* or after the onset. */
+
+/* Note also that onsets which weren't in 2F last time may be in 1F this
+ */
+/* time, due to the filter delays in computing onsets. The result is tha
+t*/
+/* occasionally a voicing window will overlap that onset. The only way
+*/
+/* to circumvent this problem is to add more delay in processing input
+*/
+/* speech. In the trade-off between delay and window-placement, window
+*/
+/* placement lost. */
+/* Compute the placement range */
+ /* Parameter adjustments */
+ (void)oslen;
+ (void)dvwinh;
+ --osbuf;
+ vwin -= 3;
+
+ /* Function Body */
+/* Computing MAX */
+ i__1 = vwin[((*af - 1) << 1) + 2] + 1, i__2 = (*af - 2) * *lframe + 1;
+ lrange = max(i__1,i__2);
+ hrange = *af * *lframe;
+/* Compute OSPTR1, so the following code only looks at relevant onsets. */
+ for (osptr1 = *osptr - 1; osptr1 >= 1; --osptr1) {
+ if (osbuf[osptr1] <= hrange) {
+ goto L90;
+ }
+ }
+L90:
+ ++osptr1;
+/* Check for case 1 first (fast case): */
+ if (osptr1 <= 1 || osbuf[osptr1 - 1] < lrange) {
+/* Computing MAX */
+ i__1 = vwin[((*af - 1) << 1) + 2] + 1;
+ vwin[(*af << 1) + 1] = max(i__1,*dvwinl);
+ vwin[(*af << 1) + 2] = vwin[(*af << 1) + 1] + *maxwin - 1;
+ *obound = 0;
+ } else {
+/* Search backward in OSBUF for first onset in range. */
+/* This code relies on the above check being performed first. */
+ for (q = osptr1 - 1; q >= 1; --q) {
+ if (osbuf[q] < lrange) {
+ goto L100;
+ }
+ }
+L100:
+ ++q;
+/* Check for case 2 (placement before onset): */
+/* Check for critical region exception: */
+ i__1 = osptr1 - 1;
+ for (i__ = q + 1; i__ <= i__1; ++i__) {
+ if (osbuf[i__] - osbuf[q] >= *minwin) {
+ crit = TRUE_;
+ goto L105;
+ }
+ }
+ crit = FALSE_;
+L105:
+/* Computing MAX */
+ i__1 = (*af - 1) * *lframe, i__2 = lrange + *minwin - 1;
+ if (! crit && osbuf[q] > max(i__1,i__2)) {
+ vwin[(*af << 1) + 2] = osbuf[q] - 1;
+/* Computing MAX */
+ i__1 = lrange, i__2 = vwin[(*af << 1) + 2] - *maxwin + 1;
+ vwin[(*af << 1) + 1] = max(i__1,i__2);
+ *obound = 2;
+/* Case 3 (placement after onset) */
+ } else {
+ vwin[(*af << 1) + 1] = osbuf[q];
+L110:
+ ++q;
+ if (q >= osptr1) {
+ goto L120;
+ }
+ if (osbuf[q] > vwin[(*af << 1) + 1] + *maxwin) {
+ goto L120;
+ }
+ if (osbuf[q] < vwin[(*af << 1) + 1] + *minwin) {
+ goto L110;
+ }
+ vwin[(*af << 1) + 2] = osbuf[q] - 1;
+ *obound = 3;
+ return 0;
+L120:
+/* Computing MIN */
+ i__1 = vwin[(*af << 1) + 1] + *maxwin - 1;
+ vwin[(*af << 1) + 2] = min(i__1,hrange);
+ *obound = 1;
+ }
+ }
+ return 0;
+} /* placev_ */
+
diff --git a/src/lpc10/preemp.c b/src/lpc10/preemp.c
new file mode 100644
index 0000000..1e69a25
--- /dev/null
+++ b/src/lpc10/preemp.c
@@ -0,0 +1,117 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:30:58 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int preemp_(real *inbuf, real *pebuf, integer *nsamp, real *coef, real *z__);
+
+/* ******************************************************************* */
+
+/* PREEMP Version 55 */
+
+/*
+ * Revision 1.1 1996/08/19 22:30:58 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/14 23:16:29 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/11 23:23:34 jaf */
+/* Added a bunch of comments to an otherwise simple subroutine. */
+
+/* Revision 1.1 1996/02/07 14:48:48 jaf */
+/* Initial revision */
+
+
+/* ******************************************************************* */
+
+/* Preemphasize speech with a single-zero filter. */
+/* (When coef = .9375, preemphasis is as in LPC43.) */
+
+/* Inputs: */
+/* NSAMP - Number of samples to filter */
+/* INBUF - Input speech buffer */
+/* Indices 1 through NSAMP are read. */
+/* COEF - Preemphasis coefficient */
+/* Input/Output: */
+/* Z - Filter state */
+/* Output: */
+/* PEBUF - Preemphasized speech buffer (can be equal to INBUF) */
+/* Indices 1 through NSAMP are modified. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int preemp_(real *inbuf, real *pebuf, integer *nsamp, real *
+ coef, real *z__)
+{
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ real temp;
+ integer i__;
+
+/* Arguments */
+/* Local variables */
+
+/* None of these need to have their values saved from one */
+/* invocation to the next. */
+
+/* Logically, this subroutine computes the output sequence */
+/* pebuf(1:nsamp) defined by: */
+
+/* pebuf(i) = inbuf(i) - coef * inbuf(i-1) */
+
+/* where inbuf(0) is defined by the value of z given as input to */
+/* this subroutine. */
+
+/* What is this filter's frequency response and phase response? */
+
+/* Why is this filter applied to the speech? */
+
+/* Could it be more efficient to apply multiple filters */
+/* simultaneously, by combining them into one equivalent filter? */
+
+/* Are there ever cases when "factoring" one high-order filter into
+*/
+/* multiple smaller-order filter actually reduces the number of */
+/* arithmetic operations needed to perform them? */
+/* When I first read this subroutine, I didn't understand why the */
+/* variable temp was used. It seemed that the statements in the do
+*/
+/* loop could be replaced with the following: */
+
+/* pebuf(i) = inbuf(i) - coef * z */
+/* z = inbuf(i) */
+
+/* The reason for temp is so that even if pebuf and inbuf are the */
+/* same arrays in memory (i.e., they are aliased), then this */
+/* subroutine will still work correctly. I didn't realize this */
+/* until seeing the comment after PEBUF above that says "(can be */
+/* equal to INBUF)". */
+ /* Parameter adjustments */
+ --pebuf;
+ --inbuf;
+
+ /* Function Body */
+ i__1 = *nsamp;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ temp = inbuf[i__] - *coef * *z__;
+ *z__ = inbuf[i__];
+ pebuf[i__] = temp;
+/* L10: */
+ }
+ return 0;
+} /* preemp_ */
+
diff --git a/src/lpc10/prepro.c b/src/lpc10/prepro.c
new file mode 100644
index 0000000..0e74bb6
--- /dev/null
+++ b/src/lpc10/prepro.c
@@ -0,0 +1,88 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:40:51 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:54 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int prepro_(real *speech, integer *length,
+ struct lpc10_encoder_state *st);
+
+/* Table of constant values */
+
+static integer c__1 = 1;
+
+/* ********************************************************************* */
+
+/* PREPRO Version 48 */
+
+/*
+ * Revision 1.2 1996/08/20 20:40:51 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:54 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/14 23:22:56 jaf */
+/* Added comments about when INITPREPRO should be used. */
+
+/* Revision 1.2 1996/03/14 23:09:27 jaf */
+/* Added an entry named INITPREPRO that initializes the local state of */
+/* this subroutine, and those it calls (if any). */
+
+/* Revision 1.1 1996/02/07 14:48:54 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Pre-process input speech: */
+
+/* Inputs: */
+/* LENGTH - Number of SPEECH samples */
+/* Input/Output: */
+/* SPEECH(LENGTH) - Speech data. */
+/* Indices 1 through LENGTH are read and modified. */
+
+/* This subroutine has no local state maintained from one call to the */
+/* next, but HP100 does. If you want to switch to using a new audio */
+/* stream for this filter, or reinitialize its state for any other */
+/* reason, call the ENTRY INITPREPRO. */
+
+/* Subroutine */ int prepro_(real *speech, integer *length,
+ struct lpc10_encoder_state *st)
+{
+ extern /* Subroutine */ int hp100_(real *, integer *, integer *, struct lpc10_encoder_state *);
+
+/* Arguments */
+/* High Pass Filter at 100 Hz */
+ /* Parameter adjustments */
+ if (speech) {
+ --speech;
+ }
+
+ /* Function Body */
+ hp100_(&speech[1], &c__1, length, st);
+ return 0;
+} /* prepro_ */
diff --git a/src/lpc10/random.c b/src/lpc10/random.c
new file mode 100644
index 0000000..b460422
--- /dev/null
+++ b/src/lpc10/random.c
@@ -0,0 +1,98 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:41:32 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:49 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern integer random_(struct lpc10_decoder_state *st);
+
+/* ********************************************************************** */
+
+/* RANDOM Version 49 */
+
+/*
+ * Revision 1.2 1996/08/20 20:41:32 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:49 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/20 16:13:54 jaf */
+/* Rearranged comments a little bit, and added comments explaining that */
+/* even though there is local state here, there is no need to create an */
+/* ENTRY for reinitializing it. */
+
+/* Revision 1.2 1996/03/14 22:25:29 jaf */
+/* Just rearranged the comments and local variable declarations a bit. */
+
+/* Revision 1.1 1996/02/07 14:49:01 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Pseudo random number generator based on Knuth, Vol 2, p. 27. */
+
+/* Function Return: */
+/* RANDOM - Integer variable, uniformly distributed over -32768 to 32767 */
+
+/* This subroutine maintains local state from one call to the next. */
+/* In the context of the LPC10 coder, there is no reason to reinitialize */
+/* this local state when switching between audio streams, because its */
+/* results are only used to generate noise for unvoiced frames. */
+
+integer random_(struct lpc10_decoder_state *st)
+{
+ /* Initialized data */
+
+ integer *j;
+ integer *k;
+ shortint *y;
+
+ /* System generated locals */
+ integer ret_val;
+
+/* Parameters/constants */
+/* Local state */
+/* The following is a 16 bit 2's complement addition, */
+/* with overflow checking disabled */
+
+ j = &(st->j);
+ k = &(st->k);
+ y = &(st->y[0]);
+
+ y[*k - 1] += y[*j - 1];
+ ret_val = y[*k - 1];
+ --(*k);
+ if (*k <= 0) {
+ *k = 5;
+ }
+ --(*j);
+ if (*j <= 0) {
+ *j = 5;
+ }
+ return ret_val;
+} /* random_ */
+
diff --git a/src/lpc10/rcchk.c b/src/lpc10/rcchk.c
new file mode 100644
index 0000000..860fec1
--- /dev/null
+++ b/src/lpc10/rcchk.c
@@ -0,0 +1,92 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:30:41 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int rcchk_(integer *order, real *rc1f, real *rc2f);
+
+/* ********************************************************************* */
+
+/* RCCHK Version 45G */
+
+/*
+ * Revision 1.1 1996/08/19 22:30:41 jaf
+ * Initial revision
+ * */
+/* Revision 1.4 1996/03/27 18:13:47 jaf */
+/* Commented out a call to subroutine ERROR. */
+
+/* Revision 1.3 1996/03/18 15:48:53 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 16:55:22 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:49:08 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Check RC's, repeat previous frame's RC's if unstable */
+
+/* Input: */
+/* ORDER - Number of RC's */
+/* RC1F - Previous frame's RC's */
+/* Indices 1 through ORDER may be read. */
+/* Input/Output: */
+/* RC2F - Present frame's RC's */
+/* Indices 1 through ORDER may be read, and written. */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int rcchk_(integer *order, real *rc1f, real *rc2f)
+{
+ /* System generated locals */
+ integer i__1;
+ real r__1;
+
+ /* Local variables */
+ integer i__;
+
+/* Arguments */
+/* Local variables that need not be saved */
+ /* Parameter adjustments */
+ --rc2f;
+ --rc1f;
+
+ /* Function Body */
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ if ((r__1 = rc2f[i__], abs(r__1)) > .99f) {
+ goto L10;
+ }
+ }
+ return 0;
+/* Note: In version embedded in other software, all calls to ERROR
+*/
+/* should probably be removed. */
+L10:
+
+/* This call to ERROR is only needed for debugging purposes. */
+
+/* CALL ERROR('RCCHK',2,I) */
+ i__1 = *order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ rc2f[i__] = rc1f[i__];
+ }
+ return 0;
+} /* rcchk_ */
+
diff --git a/src/lpc10/synths.c b/src/lpc10/synths.c
new file mode 100644
index 0000000..3ecb3bc
--- /dev/null
+++ b/src/lpc10/synths.c
@@ -0,0 +1,313 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:42:59 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:33 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int synths_(integer *voice, integer *pitch, real *rms, real *rc, real *speech, integer *k, struct lpc10_decoder_state *st);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/* Table of constant values */
+
+static real c_b2 = .7f;
+
+/* ***************************************************************** */
+
+/* SYNTHS Version 54 */
+
+/*
+ * Revision 1.2 1996/08/20 20:42:59 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_decoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_decoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:33 jaf
+ * Initial revision
+ * */
+/* Revision 1.5 1996/03/26 19:31:58 jaf */
+/* Commented out trace statements. */
+
+/* Revision 1.4 1996/03/25 19:41:01 jaf */
+/* Changed so that MAXFRM samples are always returned in the output array */
+/* SPEECH. */
+
+/* This required delaying the returned samples by MAXFRM sample times, */
+/* and remembering any "left over" samples returned by PITSYN from one */
+/* call of SYNTHS to the next. */
+
+/* Changed size of SPEECH from 2*MAXFRM to MAXFRM. Removed local */
+/* variable SOUT. Added local state variables BUF and BUFLEN. */
+
+/* Revision 1.3 1996/03/25 19:20:10 jaf */
+/* Added comments about the range of possible return values for argument */
+/* K, and increased the size of the arrays filled in by PITSYN from 11 to */
+/* 16, as has been already done inside of PITSYN. */
+
+/* Revision 1.2 1996/03/22 00:18:18 jaf */
+/* Added comments explaining meanings of input and output parameters, and */
+/* indicating which array indices can be read or written. */
+
+/* Added entry INITSYNTHS, which does nothing except call the */
+/* corresponding initialization entries for subroutines PITSYN, BSYNZ, */
+/* and DEEMP. */
+
+/* Revision 1.1 1996/02/07 14:49:44 jaf */
+/* Initial revision */
+
+
+/* ***************************************************************** */
+
+/* The note below is from the distributed version of the LPC10 coder. */
+/* The version of the code below has been modified so that SYNTHS always */
+/* has a constant frame length output of MAXFRM. */
+
+/* Also, BSYNZ and DEEMP need not be modified to work on variable */
+/* positions within an array. It is only necessary to pass the first */
+/* index desired as the array argument. What actually gets passed is the */
+/* address of that array position, which the subroutine treats as the */
+/* first index of the array. */
+
+/* This technique is used in subroutine ANALYS when calling PREEMP, so it */
+/* appears that multiple people wrote different parts of this LPC10 code, */
+/* and that they didn't necessarily have equivalent knowledge of Fortran */
+/* (not surprising). */
+
+/* NOTE: There is excessive buffering here, BSYNZ and DEEMP should be */
+/* changed to operate on variable positions within SOUT. Also, */
+/* the output length parameter is bogus, and PITSYN should be */
+/* rewritten to allow a constant frame length output. */
+
+/* Input: */
+/* VOICE - Half frame voicing decisions */
+/* Indices 1 through 2 read. */
+/* Input/Output: */
+/* PITCH - Pitch */
+/* PITCH is restricted to range 20 to 156, inclusive, */
+/* before calling subroutine PITSYN, and then PITSYN */
+/* can modify it further under some conditions. */
+/* RMS - Energy */
+/* Only use is for debugging, and passed to PITSYN. */
+/* See comments there for how it can be modified. */
+/* RC - Reflection coefficients */
+/* Indices 1 through ORDER restricted to range -.99 to .99, */
+/* before calling subroutine PITSYN, and then PITSYN */
+/* can modify it further under some conditions. */
+/* Output: */
+/* SPEECH - Synthesized speech samples. */
+/* Indices 1 through the final value of K are written. */
+/* K - Number of samples placed into array SPEECH. */
+/* This is always MAXFRM. */
+
+/* Subroutine */ int synths_(integer *voice, integer *pitch, real *
+ rms, real *rc, real *speech, integer *k, struct lpc10_decoder_state *st)
+{
+ /* Initialized data */
+
+ real *buf;
+ integer *buflen;
+
+ /* System generated locals */
+ integer i__1;
+ real r__1, r__2;
+
+ /* Local variables */
+ real rmsi[16];
+ integer nout, ivuv[16], i__, j;
+ extern /* Subroutine */ int deemp_(real *, integer *, struct lpc10_decoder_state *);
+ real ratio;
+ integer ipiti[16];
+ extern int bsynz_(real *, integer *,
+ integer *, real *, real *, real *, real *, struct lpc10_decoder_state *), irc2pc_(real *, real *
+ , integer *, real *, real *);
+ real g2pass;
+ real pc[10];
+ extern /* Subroutine */ int pitsyn_(integer *, integer *, integer *, real
+ *, real *, integer *, integer *, integer *, real *, real *,
+ integer *, real *, struct lpc10_decoder_state *);
+ real rci[160] /* was [10][16] */;
+
+/* LPC Configuration parameters: */
+/* Frame size, Prediction order, Pitch period */
+/* Arguments */
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Parameters/constants */
+/* Local variables that need not be saved */
+/* Local state */
+/* BUF is a buffer of speech samples that would have been returned
+*/
+/* by the older version of SYNTHS, but the newer version doesn't, */
+/* so that the newer version can always return MAXFRM samples on */
+/* every call. This has the effect of delaying the return of */
+/* samples for one additional frame time. */
+
+/* Indices 1 through BUFLEN contain samples that are left over from
+*/
+/* the last call to SYNTHS. Given the way that PITSYN works, */
+/* BUFLEN should always be in the range MAXFRM-MAXPIT+1 through */
+/* MAXFRM, inclusive, after a call to SYNTHS is complete. */
+
+/* On the first call to SYNTHS (or the first call after */
+/* reinitializing with the entry INITSYNTHS), BUFLEN is MAXFRM, and
+*/
+/* a frame of silence is always returned. */
+ /* Parameter adjustments */
+ if (voice) {
+ --voice;
+ }
+ if (rc) {
+ --rc;
+ }
+ if (speech) {
+ --speech;
+ }
+
+ /* Function Body */
+ buf = &(st->buf[0]);
+ buflen = &(st->buflen);
+
+/* Computing MAX */
+ i__1 = min(*pitch,156);
+ *pitch = max(i__1,20);
+ i__1 = contrl_1.order;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+/* Computing MAX */
+/* Computing MIN */
+ r__2 = rc[i__];
+ r__1 = min(r__2,.99f);
+ rc[i__] = max(r__1,-.99f);
+ }
+ pitsyn_(&contrl_1.order, &voice[1], pitch, rms, &rc[1], &contrl_1.lframe,
+ ivuv, ipiti, rmsi, rci, &nout, &ratio, st);
+ if (nout > 0) {
+ i__1 = nout;
+ for (j = 1; j <= i__1; ++j) {
+
+/* Add synthesized speech for pitch period J to the en
+d of */
+/* BUF. */
+
+ irc2pc_(&rci[j * 10 - 10], pc, &contrl_1.order, &c_b2, &g2pass);
+ bsynz_(pc, &ipiti[j - 1], &ivuv[j - 1], &buf[*buflen], &rmsi[j - 1]
+ , &ratio, &g2pass, st);
+ deemp_(&buf[*buflen], &ipiti[j - 1], st);
+ *buflen += ipiti[j - 1];
+ }
+
+/* Copy first MAXFRM samples from BUF to output array SPEECH
+*/
+/* (scaling them), and then remove them from the beginning of
+ */
+/* BUF. */
+
+ for (i__ = 1; i__ <= 180; ++i__) {
+ speech[i__] = buf[i__ - 1] / 4096.f;
+ }
+ *k = 180;
+ *buflen += -180;
+ i__1 = *buflen;
+ for (i__ = 1; i__ <= i__1; ++i__) {
+ buf[i__ - 1] = buf[i__ + 179];
+ }
+ }
+ return 0;
+} /* synths_ */
diff --git a/src/lpc10/tbdm.c b/src/lpc10/tbdm.c
new file mode 100644
index 0000000..b724ede
--- /dev/null
+++ b/src/lpc10/tbdm.c
@@ -0,0 +1,160 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:30:26 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int tbdm_(real *speech, integer *lpita, integer *tau, integer *ltau, real *amdf, integer *minptr, integer *maxptr, integer *mintau);
+
+/* ********************************************************************** */
+
+/* TBDM Version 49 */
+
+/*
+ * Revision 1.1 1996/08/19 22:30:26 jaf
+ * Initial revision
+ * */
+/* Revision 1.3 1996/03/18 22:14:00 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 14:48:37 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:49:54 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/*TURBO DIFMAG: Compute High Resolution Average Magnitude Difference Function
+*/
+
+/* Note: There are several constants in here that appear to depend on a */
+/* particular TAU table. That's not a problem for the LPC10 coder, but */
+/* watch out if you change the contents of TAU in the subroutine ANALYS. */
+
+/* Input: */
+/* SPEECH - Low pass filtered speech */
+/* Indices 1 through MAX+LPITA-1 are read, where: */
+/* MAX = (TAU(LTAU)-TAU(1))/2+1 */
+/* (If TAU(1) .LT. 39, then larger indices could be read */
+/* by the last call to DIFMAG below.) */
+/* LPITA - Length of speech buffer */
+/* TAU - Table of lags, sorted in increasing order. */
+/* Indices 1 through LTAU read. */
+/* LTAU - Number of lag values to compute */
+/* Output: */
+/* AMDF - Average Magnitude Difference for each lag in TAU */
+/* Indices 1 through LTAU written, and several might then be read.*/
+/* MINPTR - Index of minimum AMDF value */
+/* MAXPTR - Index of maximum AMDF value within +/- 1/2 octave of min */
+/* MINTAU - Lag corresponding to minimum AMDF value */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int tbdm_(real *speech, integer *lpita, integer *tau,
+ integer *ltau, real *amdf, integer *minptr, integer *maxptr, integer *
+ mintau)
+{
+ /* System generated locals */
+ integer i__1, i__2, i__3, i__4;
+
+ /* Local variables */
+ real amdf2[6];
+ integer minp2, ltau2, maxp2, i__;
+ extern /* Subroutine */ int difmag_(real *, integer *, integer *, integer
+ *, integer *, real *, integer *, integer *);
+ integer minamd, ptr, tau2[6];
+
+/* Arguments */
+/* REAL SPEECH(LPITA+TAU(LTAU)), AMDF(LTAU) */
+/* Stupid TOAST doesn't understand expressions */
+/* Local variables that need not be saved */
+/* Local state */
+/* None */
+/* Compute full AMDF using log spaced lags, find coarse minimum */
+ /* Parameter adjustments */
+ --speech;
+ --amdf;
+ --tau;
+
+ /* Function Body */
+ difmag_(&speech[1], lpita, &tau[1], ltau, &tau[*ltau], &amdf[1], minptr,
+ maxptr);
+ *mintau = tau[*minptr];
+ minamd = amdf[*minptr];
+/* Build table containing all lags within +/- 3 of the AMDF minimum */
+/* excluding all that have already been computed */
+ ltau2 = 0;
+ ptr = *minptr - 2;
+/* Computing MAX */
+ i__1 = *mintau - 3;
+/* Computing MIN */
+ i__3 = *mintau + 3, i__4 = tau[*ltau] - 1;
+ i__2 = min(i__3,i__4);
+ for (i__ = max(i__1,41); i__ <= i__2; ++i__) {
+ while(tau[ptr] < i__) {
+ ++ptr;
+ }
+ if (tau[ptr] != i__) {
+ ++ltau2;
+ tau2[ltau2 - 1] = i__;
+ }
+ }
+/* Compute AMDF of the new lags, if there are any, and choose one */
+/* if it is better than the coarse minimum */
+ if (ltau2 > 0) {
+ difmag_(&speech[1], lpita, tau2, <au2, &tau[*ltau], amdf2, &minp2, &
+ maxp2);
+ if (amdf2[minp2 - 1] < (real) minamd) {
+ *mintau = tau2[minp2 - 1];
+ minamd = amdf2[minp2 - 1];
+ }
+ }
+/* Check one octave up, if there are any lags not yet computed */
+ if (*mintau >= 80) {
+ i__ = *mintau / 2;
+ if ((i__ & 1) == 0) {
+ ltau2 = 2;
+ tau2[0] = i__ - 1;
+ tau2[1] = i__ + 1;
+ } else {
+ ltau2 = 1;
+ tau2[0] = i__;
+ }
+ difmag_(&speech[1], lpita, tau2, <au2, &tau[*ltau], amdf2, &minp2, &
+ maxp2);
+ if (amdf2[minp2 - 1] < (real) minamd) {
+ *mintau = tau2[minp2 - 1];
+ minamd = amdf2[minp2 - 1];
+ *minptr += -20;
+ }
+ }
+/* Force minimum of the AMDF array to the high resolution minimum */
+ amdf[*minptr] = (real) minamd;
+/* Find maximum of AMDF within 1/2 octave of minimum */
+/* Computing MAX */
+ i__2 = *minptr - 5;
+ *maxptr = max(i__2,1);
+/* Computing MIN */
+ i__1 = *minptr + 5;
+ i__2 = min(i__1,*ltau);
+ for (i__ = *maxptr + 1; i__ <= i__2; ++i__) {
+ if (amdf[i__] > amdf[*maxptr]) {
+ *maxptr = i__;
+ }
+ }
+ return 0;
+} /* tbdm_ */
+
diff --git a/src/lpc10/voicin.c b/src/lpc10/voicin.c
new file mode 100644
index 0000000..09f3d4e
--- /dev/null
+++ b/src/lpc10/voicin.c
@@ -0,0 +1,715 @@
+/*
+
+ * Revision 1.2 1996/08/20 20:45:00 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:14 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int voicin_(integer *vwin, real *inbuf, real *lpbuf, integer *buflim, integer *half, real *minamd, real *maxamd, integer *mintau, real *ivrc, integer *obound, integer *voibuf, integer *af, struct lpc10_encoder_state *st);
+
+/* Common Block Declarations */
+
+extern struct {
+ integer order, lframe;
+ logical corrp;
+} contrl_;
+
+#define contrl_1 contrl_
+
+/****************************************************************************/
+
+/* VOICIN Version 52 */
+
+/*
+ * Revision 1.2 1996/08/20 20:45:00 jaf
+ * Removed all static local variables that were SAVE'd in the Fortran
+ * code, and put them in struct lpc10_encoder_state that is passed as an
+ * argument.
+ *
+ * Removed init function, since all initialization is now done in
+ * init_lpc10_encoder_state().
+ *
+ * Revision 1.1 1996/08/19 22:30:14 jaf
+ * Initial revision
+ * */
+/* Revision 1.10 1996/03/29 17:59:14 jaf */
+/* Avoided using VALUE(9), although it shouldn't affect the function of */
+/* the code at all, because it was always multiplied by VDC(9,SNRL), */
+/* which is 0 for all values of SNRL. Still, if VALUE(9) had an initial */
+/* value of IEEE NaN, it might cause trouble (I don't know how IEEE */
+/* defines Nan * 0. It should either be NaN or 0.) */
+
+/* Revision 1.9 1996/03/29 17:54:46 jaf */
+/* Added a few comments about the accesses made to argument array VOIBUF */
+/* and the local saved array VOICE. */
+
+/* Revision 1.8 1996/03/27 18:19:54 jaf */
+/* Added an assignment to VSTATE that does not affect the function of the */
+/* program at all. The only reason I put it in was so that the tracing */
+/* statements at the end, when enabled, will print a consistent value for */
+/* VSTATE when HALF .EQ. 1, rather than a garbage value that could change */
+/* from one call to the next. */
+
+/* Revision 1.7 1996/03/26 20:00:06 jaf */
+/* Removed the inclusion of the file "vcomm.fh", and put its contents */
+/* into this file. It was included nowhere else but here. */
+
+/* Revision 1.6 1996/03/26 19:38:09 jaf */
+/* Commented out trace statements. */
+
+/* Revision 1.5 1996/03/19 20:43:45 jaf */
+/* Added comments about which indices of OBOUND and VOIBUF can be */
+/* accessed, and whether they are read or written. VOIBUF is fairly */
+/* messy. */
+
+/* Revision 1.4 1996/03/19 15:00:58 jaf */
+/* Moved the DATA statements for the *VDC* variables later, as it is */
+/* apparently illegal to have DATA statements before local variable */
+/* declarations. */
+
+/* Revision 1.3 1996/03/19 00:10:49 jaf */
+/* Heavily commented the local variables that are saved from one */
+/* invocation to the next, and how the local variable FIRST is used to */
+/* avoid the need to assign most of them initial values with DATA */
+/* statements. */
+
+/* A few should be initialized, but aren't. I've guessed initial values */
+/* for two of these, SFBUE and SLBUE, and I've convinced myself that for */
+/* VOICE, the effects of uninitialized values will die out after 2 or 3 */
+/* frame times. It would still be good to choose initial values for */
+/* these, but I don't know what reasonable values would be (0 comes to */
+/* mind). */
+
+/* Revision 1.2 1996/03/13 16:09:28 jaf */
+/* Comments added explaining which of the local variables of this */
+/* subroutine need to be saved from one invocation to the next, and which */
+/* do not. */
+
+/* WARNING! Some of them that should are never given initial values in */
+/* this code. Hopefully, Fortran 77 defines initial values for them, but */
+/* even so, giving them explicit initial values is preferable. */
+
+/* WARNING! VALUE(9) is used, but never assigned a value. It should */
+/* probably be eliminated from the code. */
+
+/* Revision 1.1 1996/02/07 14:50:28 jaf */
+/* Initial revision */
+
+
+/****************************************************************************/
+
+/* Voicing Detection (VOICIN) makes voicing decisions for each half */
+/* frame of input speech. Tentative voicing decisions are made two frames*/
+/* in the future (2F) for each half frame. These decisions are carried */
+/* through one frame in the future (1F) to the present (P) frame where */
+/* they are examined and smoothed, resulting in the final voicing */
+/* decisions for each half frame. */
+/* The voicing parameter (signal measurement) column vector (VALUE) */
+/* is based on a rectangular window of speech samples determined by the */
+/* window placement algorithm. The voicing parameter vector contains the*/
+/* AMDF windowed maximum-to-minimum ratio, the zero crossing rate, energy*/
+/* measures, reflection coefficients, and prediction gains. The voicing */
+/* window is placed to avoid contamination of the voicing parameter vector*/
+/* with speech onsets. */
+/* The input signal is then classified as unvoiced (including */
+/* silence) or voiced. This decision is made by a linear discriminant */
+/* function consisting of a dot product of the voicing decision */
+/* coefficient (VDC) row vector with the measurement column vector */
+/* (VALUE). The VDC vector is 2-dimensional, each row vector is optimized*/
+/* for a particular signal-to-noise ratio (SNR). So, before the dot */
+/* product is performed, the SNR is estimated to select the appropriate */
+/* VDC vector. */
+/* The smoothing algorithm is a modified median smoother. The */
+/* voicing discriminant function is used by the smoother to determine how*/
+/* strongly voiced or unvoiced a signal is. The smoothing is further */
+/* modified if a speech onset and a voicing decision transition occur */
+/* within one half frame. In this case, the voicing decision transition */
+/* is extended to the speech onset. For transmission purposes, there are*/
+/* constraints on the duration and transition of voicing decisions. The */
+/* smoother takes these constraints into account. */
+/* Finally, the energy estimates are updated along with the dither */
+/* threshold used to calculate the zero crossing rate (ZC). */
+
+/* Inputs: */
+/* VWIN - Voicing window limits */
+/* The indices read of arrays VWIN, INBUF, LPBUF, and BUFLIM */
+/* are the same as those read by subroutine VPARMS. */
+/* INBUF - Input speech buffer */
+/* LPBUF - Low-pass filtered speech buffer */
+/* BUFLIM - INBUF and LPBUF limits */
+/* HALF - Present analysis half frame number */
+/* MINAMD - Minimum value of the AMDF */
+/* MAXAMD - Maximum value of the AMDF */
+/* MINTAU - Pointer to the lag of the minimum AMDF value */
+/* IVRC(2) - Inverse filter's RC's */
+/* Only index 2 of array IVRC read under normal operation. */
+/* (Index 1 is also read when debugging is turned on.) */
+/* OBOUND - Onset boundary descriptions */
+/* Indices 1 through 3 read if (HALF .NE. 1), otherwise untouched.
+*/
+/* AF - The analysis frame number */
+/* Output: */
+/* VOIBUF(2,0:AF) - Buffer of voicing decisions */
+/* Index (HALF,3) written. */
+/* If (HALF .EQ. 1), skip down to "Read (HALF,3)" below. */
+/* Indices (1,2), (2,1), (1,2), and (2,2) read. */
+/* One of the following is then done: */
+/* read (1,3) and possibly write (1,2) */
+/* read (1,3) and write (1,2) or (2,2) */
+/* write (2,1) */
+/* write (2,1) or (1,2) */
+/* read (1,0) and (1,3) and then write (2,2) or (1,1) */
+/* no reads or writes on VOIBUF */
+/* Finally, read (HALF,3) */
+/* Internal: */
+/* QS - Ratio of preemphasized to full-band energies */
+/* RC1 - First reflection coefficient */
+/* AR_B - Product of the causal forward and reverse pitch prediction gain
+s*/
+/* AR_F - Product of the noncausal forward and rev. pitch prediction gain
+s*/
+/* ZC - Zero crossing rate */
+/* DITHER - Zero crossing threshold level */
+/* MAXMIN - AMDF's 1 octave windowed maximum-to-minimum ratio */
+/* MINPTR - Location of minimum AMDF value */
+/* NVDC - Number of elements in each VDC vector */
+/* NVDCL - Number of VDC vectors */
+/* VDCL - SNR values corresponding to the set of VDC's */
+/* VDC - 2-D voicing decision coefficient vector */
+/* VALUE(9) - Voicing Parameters */
+/* VOICE(2,3)- History of LDA results */
+/* On every call when (HALF .EQ. 1), VOICE(*,I+1) is */
+/* shifted back to VOICE(*,I), for I=1,2. */
+/* VOICE(HALF,3) is written on every call. */
+/* Depending on several conditions, one or more of */
+/* (1,1), (1,2), (2,1), and (2,2) might then be read. */
+/* LBE - Ratio of low-band instantaneous to average energies */
+/* FBE - Ratio of full-band instantaneous to average energies */
+/* LBVE - Low band voiced energy */
+/* LBUE - Low band unvoiced energy */
+/* FBVE - Full band voiced energy */
+/* FBUE - Full band unvoiced energy */
+/* OFBUE - Previous full-band unvoiced energy */
+/* OLBUE - Previous low-band unvoiced energy */
+/* REF - Reference energy for initialization and DITHER threshold */
+/* SNR - Estimate of signal-to-noise ratio */
+/* SNR2 - Estimate of low-band signal-to-noise ratio */
+/* SNRL - SNR level number */
+/* OT - Onset transition present */
+/* VSTATE - Decimal interpretation of binary voicing classifications */
+/* FIRST - First call flag */
+
+/* This subroutine maintains local state from one call to the next. If */
+/* you want to switch to using a new audio stream for this filter, or */
+/* reinitialize its state for any other reason, call the ENTRY */
+/* INITVOICIN. */
+
+/* Subroutine */ int voicin_(integer *vwin, real *inbuf, real *
+ lpbuf, integer *buflim, integer *half, real *minamd, real *maxamd,
+ integer *mintau, real *ivrc, integer *obound, integer *voibuf,
+ integer *af, struct lpc10_encoder_state *st)
+{
+ /* Initialized data */
+
+ real *dither;
+ static real vdc[100] /* was [10][10] */ = { 0.f,1714.f,-110.f,
+ 334.f,-4096.f,-654.f,3752.f,3769.f,0.f,1181.f,0.f,874.f,-97.f,
+ 300.f,-4096.f,-1021.f,2451.f,2527.f,0.f,-500.f,0.f,510.f,-70.f,
+ 250.f,-4096.f,-1270.f,2194.f,2491.f,0.f,-1500.f,0.f,500.f,-10.f,
+ 200.f,-4096.f,-1300.f,2e3f,2e3f,0.f,-2e3f,0.f,500.f,0.f,0.f,
+ -4096.f,-1300.f,2e3f,2e3f,0.f,-2500.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
+ 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
+ 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
+ 0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f };
+ static integer nvdcl = 5;
+ static real vdcl[10] = { 600.f,450.f,300.f,200.f,0.f,0.f,0.f,0.f,0.f,0.f }
+ ;
+
+ /* System generated locals */
+ integer inbuf_offset = 0, lpbuf_offset = 0, i__1, i__2;
+ real r__1, r__2;
+
+ /* Builtin functions */
+ integer i_nint(real *);
+ double sqrt(doublereal);
+
+ /* Local variables */
+ real ar_b__, ar_f__;
+ integer *lbve, *lbue, *fbve, *fbue;
+ integer snrl, i__;
+ integer *ofbue, *sfbue;
+ real *voice;
+ integer *olbue, *slbue;
+ real value[9];
+ integer zc;
+ logical ot;
+ real qs;
+ real *maxmin;
+ integer vstate;
+ real rc1;
+ extern /* Subroutine */ int vparms_(integer *, real *, real *, integer *,
+ integer *, real *, integer *, integer *, integer *, integer *,
+ real *, real *, real *, real *);
+ integer fbe, lbe;
+ real *snr;
+ real snr2;
+
+ (void)af;
+/* Global Variables: */
+/* Arguments */
+
+/* LPC Processing control variables: */
+
+/* *** Read-only: initialized in setup */
+
+/* Files for Speech, Parameter, and Bitstream Input & Output, */
+/* and message and debug outputs. */
+
+/* Here are the only files which use these variables: */
+
+/* lpcsim.f setup.f trans.f error.f vqsetup.f */
+
+/* Many files which use fdebug are not listed, since it is only used in */
+/* those other files conditionally, to print trace statements. */
+/* integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* LPC order, Frame size, Quantization rate, Bits per frame, */
+/* Error correction */
+/* Subroutine SETUP is the only place where order is assigned a value, */
+/* and that value is 10. It could increase efficiency 1% or so to */
+/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as
+*/
+/* a variable in a COMMON block, since it is used in many places in the */
+/* core of the coding and decoding routines. Actually, I take that back.
+*/
+/* At least when compiling with f2c, the upper bound of DO loops is */
+/* stored in a local variable before the DO loop begins, and then that is
+*/
+/* compared against on each iteration. */
+/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
+/* Similarly for quant, which is given a value of 2400 in SETUP. quant */
+/* is used in only a few places, and never in the core coding and */
+/* decoding routines, so it could be eliminated entirely. */
+/* nbits is similar to quant, and is given a value of 54 in SETUP. */
+/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
+/* subroutines ENCODE and DECODE. It doesn't affect the speed of the */
+/* coder significantly whether it is .TRUE. or .FALSE., or whether it is
+*/
+/* a constant or a variable, since it is only examined once per frame. */
+/* Leaving it as a variable that is set to .TRUE. seems like a good */
+/* idea, since it does enable some error-correction capability for */
+/* unvoiced frames, with no change in the coding rate, and no noticeable
+*/
+/* quality difference in the decoded speech. */
+/* integer quant, nbits */
+/* *** Read/write: variables for debugging, not needed for LPC algorithm
+*/
+
+/* Current frame, Unstable frames, Output clip count, Max onset buffer,
+*/
+/* Debug listing detail level, Line count on listing page */
+
+/* nframe is not needed for an embedded LPC10 at all. */
+/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
+/* ERROR, which is only called from RCCHK. When LPC10 is embedded into */
+/* an application, I would recommend removing the call to ERROR in RCCHK,
+*/
+/* and remove ERROR and nunsfm completely. */
+/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in
+*/
+/* sread.f. When LPC10 is embedded into an application, one might want */
+/* to cause it to be incremented in a routine that takes the output of */
+/* SYNTHS and sends it to an audio device. It could be optionally */
+/* displayed, for those that might want to know what it is. */
+/* maxosp is never initialized to 0 in SETUP, although it probably should
+*/
+/* be, and it is updated in subroutine ANALYS. I doubt that its value */
+/* would be of much interest to an application in which LPC10 is */
+/* embedded. */
+/* listl and lincnt are not needed for an embedded LPC10 at all. */
+/* integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
+/* common /contrl/ quant, nbits */
+/* common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
+/* Parameters/constants */
+/* Voicing coefficient and Linear Discriminant Analysis variables:
+*/
+/* Max number of VDC's and VDC levels */
+/* The following are not Fortran PARAMETER's, but they are */
+/* initialized with DATA statements, and never modified. */
+/* Actual number of VDC's and levels */
+/* Local variables that need not be saved */
+/* Note: */
+
+/* VALUE(1) through VALUE(8) are assigned values, but VALUE(9) */
+/* never is. Yet VALUE(9) is read in the loop that begins "DO I =
+*/
+/* 1, 9" below. I believe that this doesn't cause any problems in
+*/
+/* this subroutine, because all VDC(9,*) array elements are 0, and
+*/
+/* this is what is multiplied by VALUE(9) in all cases. Still, it
+*/
+/* would save a multiplication to change the loop to "DO I = 1, 8".
+*/
+/* Local state */
+/* WARNING! */
+
+/* VOICE, SFBUE, and SLBUE should be saved from one invocation to */
+/* the next, but they are never given an initial value. */
+
+/* Does Fortran 77 specify some default initial value, like 0, or */
+/* is it undefined? If it is undefined, then this code should be */
+/* corrected to specify an initial value. */
+
+/* For VOICE, note that it is "shifted" in the statement that */
+/* begins "IF (HALF .EQ. 1) THEN" below. Also, uninitialized */
+/* values in the VOICE array can only affect entries in the VOIBUF
+*/
+/* array that are for the same frame, or for an older frame. Thus
+*/
+/* the effects of uninitialized values in VOICE cannot linger on */
+/* for more than 2 or 3 frame times. */
+
+/* For SFBUE and SLBUE, the effects of uninitialized values can */
+/* linger on for many frame times, because their previous values */
+/* are exponentially decayed. Thus it is more important to choose
+*/
+/* initial values for these variables. I would guess that a */
+/* reasonable initial value for SFBUE is REF/16, the same as used */
+/* for FBUE and OFBUE. Similarly, SLBUE can be initialized to */
+/* REF/32, the same as for LBUE and OLBUE. */
+
+/* These guessed initial values should be validated by re-running */
+/* the modified program on some audio samples. */
+
+/* Declare and initialize filters: */
+
+ dither = (&st->dither);
+ snr = (&st->snr);
+ maxmin = (&st->maxmin);
+ voice = (&st->voice[0]);
+ lbve = (&st->lbve);
+ lbue = (&st->lbue);
+ fbve = (&st->fbve);
+ fbue = (&st->fbue);
+ ofbue = (&st->ofbue);
+ olbue = (&st->olbue);
+ sfbue = (&st->sfbue);
+ slbue = (&st->slbue);
+
+ /* Parameter adjustments */
+ if (vwin) {
+ --vwin;
+ }
+ if (buflim) {
+ --buflim;
+ }
+ if (inbuf) {
+ inbuf_offset = buflim[1];
+ inbuf -= inbuf_offset;
+ }
+ if (lpbuf) {
+ lpbuf_offset = buflim[3];
+ lpbuf -= lpbuf_offset;
+ }
+ if (ivrc) {
+ --ivrc;
+ }
+ if (obound) {
+ --obound;
+ }
+ if (voibuf) {
+ --voibuf;
+ }
+
+ /* Function Body */
+
+/* The following variables are saved from one invocation to the */
+/* next, but are not initialized with DATA statements. This is */
+/* acceptable, because FIRST is initialized ot .TRUE., and the */
+/* first time that this subroutine is then called, they are all */
+/* given initial values. */
+
+/* SNR */
+/* LBVE, LBUE, FBVE, FBUE, OFBUE, OLBUE */
+
+/* MAXMIN is initialized on the first call, assuming that HALF */
+/* .EQ. 1 on first call. This is how ANALYS calls this subroutine.
+*/
+
+/* Voicing Decision Parameter vector (* denotes zero coefficient): */
+
+/* * MAXMIN */
+/* LBE/LBVE */
+/* ZC */
+/* RC1 */
+/* QS */
+/* IVRC2 */
+/* aR_B */
+/* aR_F */
+/* * LOG(LBE/LBVE) */
+/* Define 2-D voicing decision coefficient vector according to the voicin
+g*/
+/* parameter order above. Each row (VDC vector) is optimized for a speci
+fic*/
+/* SNR. The last element of the vector is the constant. */
+/* E ZC RC1 Qs IVRC2 aRb aRf c */
+
+/* The VOICE array contains the result of the linear discriminant functio
+n*/
+/* (analog values). The VOIBUF array contains the hard-limited binary
+*/
+/* voicing decisions. The VOICE and VOIBUF arrays, according to FORTRAN
+ */
+/* memory allocation, are addressed as: */
+
+/* (half-frame number, future-frame number) */
+
+/* | Past | Present | Future1 | Future2 | */
+/* | 1,0 | 2,0 | 1,1 | 2,1 | 1,2 | 2,2 | 1,3 | 2,3 | ---> time */
+
+/* Update linear discriminant function history each frame: */
+ if (*half == 1) {
+ voice[0] = voice[2];
+ voice[1] = voice[3];
+ voice[2] = voice[4];
+ voice[3] = voice[5];
+ *maxmin = *maxamd / max(*minamd,1.f);
+ }
+/* Calculate voicing parameters twice per frame: */
+ vparms_(&vwin[1], &inbuf[inbuf_offset], &lpbuf[lpbuf_offset], &buflim[1],
+ half, dither, mintau, &zc, &lbe, &fbe, &qs, &rc1, &ar_b__, &
+ ar_f__);
+/* Estimate signal-to-noise ratio to select the appropriate VDC vector.
+*/
+/* The SNR is estimated as the running average of the ratio of the */
+/* running average full-band voiced energy to the running average */
+/* full-band unvoiced energy. SNR filter has gain of 63. */
+ r__1 = (*snr + *fbve / (real) max(*fbue,1)) * 63 / 64.f;
+ *snr = (real) i_nint(&r__1);
+ snr2 = *snr * *fbue / max(*lbue,1);
+/* Quantize SNR to SNRL according to VDCL thresholds. */
+ snrl = 1;
+ i__1 = nvdcl - 1;
+ for (snrl = 1; snrl <= i__1; ++snrl) {
+ if (snr2 > vdcl[snrl - 1]) {
+ goto L69;
+ }
+ }
+/* (Note: SNRL = NVDCL here) */
+L69:
+/* Linear discriminant voicing parameters: */
+ value[0] = *maxmin;
+ value[1] = (real) lbe / max(*lbve,1);
+ value[2] = (real) zc;
+ value[3] = rc1;
+ value[4] = qs;
+ value[5] = ivrc[2];
+ value[6] = ar_b__;
+ value[7] = ar_f__;
+/* Evaluation of linear discriminant function: */
+ voice[*half + 3] = vdc[snrl * 10 - 1];
+ for (i__ = 1; i__ <= 8; ++i__) {
+ voice[*half + 3] += vdc[i__ + snrl * 10 - 11] * value[i__ - 1];
+ }
+/* Classify as voiced if discriminant > 0, otherwise unvoiced */
+/* Voicing decision for current half-frame: 1 = Voiced; 0 = Unvoiced */
+ if (voice[*half + 3] > 0.f) {
+ voibuf[*half + 6] = 1;
+ } else {
+ voibuf[*half + 6] = 0;
+ }
+/* Skip voicing decision smoothing in first half-frame: */
+/* Give a value to VSTATE, so that trace statements below will print
+*/
+/* a consistent value from one call to the next when HALF .EQ. 1. */
+/* The value of VSTATE is not used for any other purpose when this is
+*/
+/* true. */
+ vstate = -1;
+ if (*half == 1) {
+ goto L99;
+ }
+/* Voicing decision smoothing rules (override of linear combination): */
+
+/* Unvoiced half-frames: At least two in a row. */
+/* -------------------- */
+
+/* Voiced half-frames: At least two in a row in one frame. */
+/* ------------------- Otherwise at least three in a row. */
+/* (Due to the way transition frames are encoded) */
+
+/* In many cases, the discriminant function determines how to smooth. */
+/* In the following chart, the decisions marked with a * may be overridden
+.*/
+
+/* Voicing override of transitions at onsets: */
+/* If a V/UV or UV/V voicing decision transition occurs within one-half
+*/
+/* frame of an onset bounding a voicing window, then the transition is */
+/* moved to occur at the onset. */
+
+/* P 1F */
+/* ----- ----- */
+/* 0 0 0 0 */
+/* 0 0 0* 1 (If there is an onset there) */
+/* 0 0 1* 0* (Based on 2F and discriminant distance) */
+/* 0 0 1 1 */
+/* 0 1* 0 0 (Always) */
+/* 0 1* 0* 1 (Based on discriminant distance) */
+/* 0* 1 1 0* (Based on past, 2F, and discriminant distance) */
+/* 0 1* 1 1 (If there is an onset there) */
+/* 1 0* 0 0 (If there is an onset there) */
+/* 1 0 0 1 */
+/* 1 0* 1* 0 (Based on discriminant distance) */
+/* 1 0* 1 1 (Always) */
+/* 1 1 0 0 */
+/* 1 1 0* 1* (Based on 2F and discriminant distance) */
+/* 1 1 1* 0 (If there is an onset there) */
+/* 1 1 1 1 */
+
+/* Determine if there is an onset transition between P and 1F. */
+/* OT (Onset Transition) is true if there is an onset between */
+/* P and 1F but not after 1F. */
+ ot = ((obound[1] & 2) != 0 || obound[2] == 1) && (obound[3] & 1) == 0;
+/* Multi-way dispatch on voicing decision history: */
+ vstate = (voibuf[3] << 3) + (voibuf[4] << 2) + (voibuf[5] << 1) + voibuf[
+ 6];
+ switch (vstate + 1) {
+ case 1: goto L99;
+ case 2: goto L1;
+ case 3: goto L2;
+ case 4: goto L99;
+ case 5: goto L4;
+ case 6: goto L5;
+ case 7: goto L6;
+ case 8: goto L7;
+ case 9: goto L8;
+ case 10: goto L99;
+ case 11: goto L10;
+ case 12: goto L11;
+ case 13: goto L99;
+ case 14: goto L13;
+ case 15: goto L14;
+ case 16: goto L99;
+ }
+L1:
+ if (ot && voibuf[7] == 1) {
+ voibuf[5] = 1;
+ }
+ goto L99;
+L2:
+ if (voibuf[7] == 0 || voice[2] < -voice[3]) {
+ voibuf[5] = 0;
+ } else {
+ voibuf[6] = 1;
+ }
+ goto L99;
+L4:
+ voibuf[4] = 0;
+ goto L99;
+L5:
+ if (voice[1] < -voice[2]) {
+ voibuf[4] = 0;
+ } else {
+ voibuf[5] = 1;
+ }
+ goto L99;
+/* VOIBUF(2,0) must be 0 */
+L6:
+ if (voibuf[1] == 1 || voibuf[7] == 1 || voice[3] > voice[0]) {
+ voibuf[6] = 1;
+ } else {
+ voibuf[3] = 1;
+ }
+ goto L99;
+L7:
+ if (ot) {
+ voibuf[4] = 0;
+ }
+ goto L99;
+L8:
+ if (ot) {
+ voibuf[4] = 1;
+ }
+ goto L99;
+L10:
+ if (voice[2] < -voice[1]) {
+ voibuf[5] = 0;
+ } else {
+ voibuf[4] = 1;
+ }
+ goto L99;
+L11:
+ voibuf[4] = 1;
+ goto L99;
+L13:
+ if (voibuf[7] == 0 && voice[3] < -voice[2]) {
+ voibuf[6] = 0;
+ } else {
+ voibuf[5] = 1;
+ }
+ goto L99;
+L14:
+ if (ot && voibuf[7] == 0) {
+ voibuf[5] = 0;
+ }
+/* GOTO 99 */
+L99:
+/* Now update parameters: */
+/* ---------------------- */
+
+/* During unvoiced half-frames, update the low band and full band unvoice
+d*/
+/* energy estimates (LBUE and FBUE) and also the zero crossing */
+/* threshold (DITHER). (The input to the unvoiced energy filters is */
+/* restricted to be less than 10dB above the previous inputs of the */
+/* filters.) */
+/* During voiced half-frames, update the low-pass (LBVE) and all-pass */
+/* (FBVE) voiced energy estimates. */
+ if (voibuf[*half + 6] == 0) {
+/* Computing MIN */
+ i__1 = fbe, i__2 = *ofbue * 3;
+ r__1 = (*sfbue * 63 + (min(i__1,i__2) << 3)) / 64.f;
+ *sfbue = i_nint(&r__1);
+ *fbue = *sfbue / 8;
+ *ofbue = fbe;
+/* Computing MIN */
+ i__1 = lbe, i__2 = *olbue * 3;
+ r__1 = (*slbue * 63 + (min(i__1,i__2) << 3)) / 64.f;
+ *slbue = i_nint(&r__1);
+ *lbue = *slbue / 8;
+ *olbue = lbe;
+ } else {
+ r__1 = (*lbve * 63 + lbe) / 64.f;
+ *lbve = i_nint(&r__1);
+ r__1 = (*fbve * 63 + fbe) / 64.f;
+ *fbve = i_nint(&r__1);
+ }
+/* Set dither threshold to yield proper zero crossing rates in the */
+/* presence of low frequency noise and low level signal input. */
+/* NOTE: The divisor is a function of REF, the expected energies. */
+/* Computing MIN */
+/* Computing MAX */
+ r__2 = sqrt((real) (*lbue * *lbve)) * 64 / 3000;
+ r__1 = max(r__2,1.f);
+ *dither = min(r__1,20.f);
+/* Voicing decisions are returned in VOIBUF. */
+ return 0;
+} /* voicin_ */
diff --git a/src/lpc10/vparms.c b/src/lpc10/vparms.c
new file mode 100644
index 0000000..573209b
--- /dev/null
+++ b/src/lpc10/vparms.c
@@ -0,0 +1,228 @@
+/*
+
+ * Revision 1.1 1996/08/19 22:30:04 jaf
+ * Initial revision
+ *
+
+*/
+
+/* -- translated by f2c (version 19951025).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "third_party/sox/src/lpc10/f2c.h"
+
+extern int vparms_(integer *vwin, real *inbuf, real *lpbuf, integer *buflim, integer *half, real *dither, integer *mintau, integer *zc, integer *lbe, integer *fbe, real *qs, real *rc1, real *ar_b__, real *ar_f__);
+
+/* Table of constant values */
+
+static real c_b2 = 1.f;
+
+/* ********************************************************************* */
+
+/* VPARMS Version 50 */
+
+/*
+ * Revision 1.1 1996/08/19 22:30:04 jaf
+ * Initial revision
+ * */
+/* Revision 1.6 1996/03/29 18:01:16 jaf */
+/* Added some more comments about the range of INBUF and LPBUF that can */
+/* be read. Note that it is possible for index VWIN(2)+1 to be read from */
+/* INBUF, which might be outside of its defined range, although that will */
+/* require more careful checking. */
+
+/* Revision 1.5 1996/03/19 00:02:02 jaf */
+/* I just noticed that the argument DITHER is modified inside of this */
+/* subroutine. Comments were added explaining the possible final values. */
+
+/* Revision 1.4 1996/03/18 22:22:59 jaf */
+/* Finishing the job I said I did with the last check-in comments. */
+
+/* Revision 1.3 1996/03/18 22:22:17 jaf */
+/* Just added a few comments about which array indices of the arguments */
+/* are used, and mentioning that this subroutine has no local state. */
+
+/* Revision 1.2 1996/03/13 15:02:58 jaf */
+/* Comments added explaining that none of the local variables of this */
+/* subroutine need to be saved from one invocation to the next. */
+
+/* Revision 1.1 1996/02/07 14:50:42 jaf */
+/* Initial revision */
+
+
+/* ********************************************************************* */
+
+/* Calculate voicing parameters: */
+
+/* Input: */
+/* VWIN - Voicing window limits */
+/* Indices 1 through 2 read. */
+/* INBUF - Input speech buffer */
+/* Indices START-1 through STOP read, */
+/* where START and STOP are defined in the code (only written once).
+*/
+/* Note that STOP can be as large as VWIN(2)+1 ! */
+/* LPBUF - Low pass filtered speech */
+/* Indices START-MINTAU through STOP+MINTAU read, */
+/* where START and STOP are defined in the code (only written once).
+*/
+/* BUFLIM - Array bounds for INBUF and LPBUF */
+/* Indices 1 through 4 read. */
+/* HALF - Half frame (1 or 2) */
+/* MINTAU - Lag corresponding to minimum AMDF value (pitch estimate) */
+/* Input/Output: */
+/* DITHER - Zero crossing threshold */
+/* The resulting value might be the negation of the input */
+/* value. It might always be the same as the input value, */
+/* if the DO loop below always executes an even number of times. */
+/* Output: (all of them are written on every call) */
+/* ZC - Zero crossing rate */
+/* LBE - Low band energy (sum of magnitudes - SM) */
+/* FBE - Full band energy (SM) */
+/* QS - Ratio of 6 dB/oct preemphasized energy to full band energy */
+/* RC1 - First reflection coefficient */
+/* AR_B - Product of the causal forward and reverse pitch */
+/* prediction gains */
+/* AR_F - Product of the noncausal forward and reverse pitch */
+/* prediction gains */
+/* Internal: */
+/* OLDSGN - Previous sign of dithered signal */
+/* VLEN - Length of voicing window */
+/* START - Lower address of current half of voicing window */
+/* STOP - Upper address of current half of voicing window */
+/* E_0 - Energy of LPF speech (sum of squares - SS) */
+/* E_B - Energy of LPF speech backward one pitch period (SS) */
+/* E_F - Energy of LPF speech forward one pitch period (SS) */
+/* R_B - Autocovariance of LPF speech backward one pitch period */
+/* R_F - Autocovariance of LPF speech forward one pitch period */
+/* LP_RMS - Energy of LPF speech (sum of magnitudes - SM) */
+/* AP_RMS - Energy of all-pass speech (SM) */
+/* E_PRE - Energy of 6dB preemphasized speech (SM) */
+/* E0AP - Energy of all-pass speech (SS) */
+
+/* This subroutine has no local state. */
+
+/* Subroutine */ int vparms_(integer *vwin, real *inbuf, real *lpbuf, integer
+ *buflim, integer *half, real *dither, integer *mintau, integer *zc,
+ integer *lbe, integer *fbe, real *qs, real *rc1, real *ar_b__, real *
+ ar_f__)
+{
+ /* System generated locals */
+ integer inbuf_offset, lpbuf_offset, i__1;
+ real r__1, r__2;
+
+ /* Builtin functions */
+ double r_sign(real *, real *);
+ integer i_nint(real *);
+
+ /* Local variables */
+ integer vlen, stop, i__;
+ real e_pre__;
+ integer start;
+ real ap_rms__, e_0__, oldsgn, lp_rms__, e_b__, e_f__, r_b__, r_f__, e0ap;
+
+/* Arguments */
+/* Local variables that need not be saved */
+/* Calculate zero crossings (ZC) and several energy and correlation */
+/* measures on low band and full band speech. Each measure is taken */
+/* over either the first or the second half of the voicing window, */
+/* depending on the variable HALF. */
+ /* Parameter adjustments */
+ --vwin;
+ --buflim;
+ lpbuf_offset = buflim[3];
+ lpbuf -= lpbuf_offset;
+ inbuf_offset = buflim[1];
+ inbuf -= inbuf_offset;
+
+ /* Function Body */
+ lp_rms__ = 0.f;
+ ap_rms__ = 0.f;
+ e_pre__ = 0.f;
+ e0ap = 0.f;
+ *rc1 = 0.f;
+ e_0__ = 0.f;
+ e_b__ = 0.f;
+ e_f__ = 0.f;
+ r_f__ = 0.f;
+ r_b__ = 0.f;
+ *zc = 0;
+ vlen = vwin[2] - vwin[1] + 1;
+ start = vwin[1] + (*half - 1) * vlen / 2 + 1;
+ stop = start + vlen / 2 - 1;
+
+/* I'll use the symbol HVL in the table below to represent the value */
+/* VLEN/2. Note that if VLEN is odd, then HVL should be rounded down, */
+/* i.e., HVL = (VLEN-1)/2. */
+
+/* HALF START STOP */
+
+/* 1 VWIN(1)+1 VWIN(1)+HVL */
+/* 2 VWIN(1)+HVL+1 VWIN(1)+2*HVL */
+
+/* Note that if VLEN is even and HALF is 2, then STOP will be */
+/* VWIN(1)+VLEN = VWIN(2)+1. That could be bad, if that index of INBUF */
+/* is undefined. */
+
+ r__1 = inbuf[start - 1] - *dither;
+ oldsgn = r_sign(&c_b2, &r__1);
+ i__1 = stop;
+ for (i__ = start; i__ <= i__1; ++i__) {
+ lp_rms__ += (r__1 = lpbuf[i__], abs(r__1));
+ ap_rms__ += (r__1 = inbuf[i__], abs(r__1));
+ e_pre__ += (r__1 = inbuf[i__] - inbuf[i__ - 1], abs(r__1));
+/* Computing 2nd power */
+ r__1 = inbuf[i__];
+ e0ap += r__1 * r__1;
+ *rc1 += inbuf[i__] * inbuf[i__ - 1];
+/* Computing 2nd power */
+ r__1 = lpbuf[i__];
+ e_0__ += r__1 * r__1;
+/* Computing 2nd power */
+ r__1 = lpbuf[i__ - *mintau];
+ e_b__ += r__1 * r__1;
+/* Computing 2nd power */
+ r__1 = lpbuf[i__ + *mintau];
+ e_f__ += r__1 * r__1;
+ r_f__ += lpbuf[i__] * lpbuf[i__ + *mintau];
+ r_b__ += lpbuf[i__] * lpbuf[i__ - *mintau];
+ r__1 = inbuf[i__] + *dither;
+ if (r_sign(&c_b2, &r__1) != oldsgn) {
+ ++(*zc);
+ oldsgn = -oldsgn;
+ }
+ *dither = -(*dither);
+ }
+/* Normalized short-term autocovariance coefficient at unit sample delay
+ */
+ *rc1 /= max(e0ap,1.f);
+/* Ratio of the energy of the first difference signal (6 dB/oct preemphas
+is)*/
+/* to the energy of the full band signal */
+/* Computing MAX */
+ r__1 = ap_rms__ * 2.f;
+ *qs = e_pre__ / max(r__1,1.f);
+/* aR_b is the product of the forward and reverse prediction gains, */
+/* looking backward in time (the causal case). */
+ *ar_b__ = r_b__ / max(e_b__,1.f) * (r_b__ / max(e_0__,1.f));
+/* aR_f is the same as aR_b, but looking forward in time (non causal case
+).*/
+ *ar_f__ = r_f__ / max(e_f__,1.f) * (r_f__ / max(e_0__,1.f));
+/* Normalize ZC, LBE, and FBE to old fixed window length of 180. */
+/* (The fraction 90/VLEN has a range of .58 to 1) */
+ r__2 = (real) (*zc << 1);
+ r__1 = r__2 * (90.f / vlen);
+ *zc = i_nint(&r__1);
+/* Computing MIN */
+ r__1 = lp_rms__ / 4 * (90.f / vlen);
+ i__1 = i_nint(&r__1);
+ *lbe = min(i__1,32767);
+/* Computing MIN */
+ r__1 = ap_rms__ / 4 * (90.f / vlen);
+ i__1 = i_nint(&r__1);
+ *fbe = min(i__1,32767);
+ return 0;
+} /* vparms_ */
+
diff --git a/src/ltmain.sh b/src/ltmain.sh
new file mode 100644
index 0000000..63ae69d
--- /dev/null
+++ b/src/ltmain.sh
@@ -0,0 +1,9655 @@
+
+# libtool (GNU libtool) 2.4.2
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions. There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+# --config show all configuration variables
+# --debug enable verbose shell tracing
+# -n, --dry-run display commands without modifying any files
+# --features display basic configuration information and exit
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --no-quiet, --no-silent
+# print informational messages (default)
+# --no-warn don't display warning messages
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print more informational messages than default
+# --no-verbose don't print the extra informational messages
+# --version print version information
+# -h, --help, --help-all print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+# clean remove files from the build directory
+# compile compile a source file into a libtool object
+# execute automatically set library path, then run a program
+# finish complete the installation of libtool libraries
+# install install libraries or executables
+# link create a library or an executable
+# uninstall remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE. When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.4.2
+# automake: $automake_version
+# autoconf: $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION=2.4.2
+TIMESTAMP=""
+package_revision=1.3337
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+ fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+ s@/\./@/@g
+ t dotsl
+ s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+# value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+ # Start from root dir and reassemble the path.
+ func_normal_abspath_result=
+ func_normal_abspath_tpath=$1
+ func_normal_abspath_altnamespace=
+ case $func_normal_abspath_tpath in
+ "")
+ # Empty path, that just means $cwd.
+ func_stripname '' '/' "`pwd`"
+ func_normal_abspath_result=$func_stripname_result
+ return
+ ;;
+ # The next three entries are used to spot a run of precisely
+ # two leading slashes without using negated character classes;
+ # we take advantage of case's first-match behaviour.
+ ///*)
+ # Unusual form of absolute path, do nothing.
+ ;;
+ //*)
+ # Not necessarily an ordinary path; POSIX reserves leading '//'
+ # and for example Cygwin uses it to access remote file shares
+ # over CIFS/SMB, so we conserve a leading double slash if found.
+ func_normal_abspath_altnamespace=/
+ ;;
+ /*)
+ # Absolute path, do nothing.
+ ;;
+ *)
+ # Relative path, prepend $cwd.
+ func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+ ;;
+ esac
+ # Cancel out all the simple stuff to save iterations. We also want
+ # the path to end with a slash for ease of parsing, so make sure
+ # there is one (and only one) here.
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+ while :; do
+ # Processed it all yet?
+ if test "$func_normal_abspath_tpath" = / ; then
+ # If we ascended to the root using ".." the result may be empty now.
+ if test -z "$func_normal_abspath_result" ; then
+ func_normal_abspath_result=/
+ fi
+ break
+ fi
+ func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcar"`
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcdr"`
+ # Figure out what to do with it
+ case $func_normal_abspath_tcomponent in
+ "")
+ # Trailing empty path component, ignore it.
+ ;;
+ ..)
+ # Parent dir; strip last assembled component from result.
+ func_dirname "$func_normal_abspath_result"
+ func_normal_abspath_result=$func_dirname_result
+ ;;
+ *)
+ # Actual path component, append it.
+ func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+ ;;
+ esac
+ done
+ # Restore leading double-slash if one was found on entry.
+ func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+# value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+ func_relative_path_result=
+ func_normal_abspath "$1"
+ func_relative_path_tlibdir=$func_normal_abspath_result
+ func_normal_abspath "$2"
+ func_relative_path_tbindir=$func_normal_abspath_result
+
+ # Ascend the tree starting from libdir
+ while :; do
+ # check if we have found a prefix of bindir
+ case $func_relative_path_tbindir in
+ $func_relative_path_tlibdir)
+ # found an exact match
+ func_relative_path_tcancelled=
+ break
+ ;;
+ $func_relative_path_tlibdir*)
+ # found a matching prefix
+ func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+ func_relative_path_tcancelled=$func_stripname_result
+ if test -z "$func_relative_path_result"; then
+ func_relative_path_result=.
+ fi
+ break
+ ;;
+ *)
+ func_dirname $func_relative_path_tlibdir
+ func_relative_path_tlibdir=${func_dirname_result}
+ if test "x$func_relative_path_tlibdir" = x ; then
+ # Have to descend all the way to the root!
+ func_relative_path_result=../$func_relative_path_result
+ func_relative_path_tcancelled=$func_relative_path_tbindir
+ break
+ fi
+ func_relative_path_result=../$func_relative_path_result
+ ;;
+ esac
+ done
+
+ # Now calculate path; take care to avoid doubling-up slashes.
+ func_stripname '' '/' "$func_relative_path_result"
+ func_relative_path_result=$func_stripname_result
+ func_stripname '/' '/' "$func_relative_path_tcancelled"
+ if test "x$func_stripname_result" != x ; then
+ func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+ fi
+
+ # Normalisation. If bindir is libdir, return empty string,
+ # else relative path ending with a slash; either way, target
+ # file name can be directly appended.
+ if test ! -z "$func_relative_path_result"; then
+ func_stripname './' '' "$func_relative_path_result/"
+ func_relative_path_result=$func_stripname_result
+ fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+ [\\/]*|[A-Za-z]:\\*) ;;
+ *[\\/]*)
+ progdir=$func_dirname_result
+ progdir=`cd "$progdir" && pwd`
+ progpath="$progdir/$progname"
+ ;;
+ *)
+ save_IFS="$IFS"
+ IFS=${PATH_SEPARATOR-:}
+ for progdir in $PATH; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ IFS="$save_IFS"
+ test -n "$progdir" || progdir=`pwd`
+ progpath="$progdir/$progname"
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes. A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+ s/$bs4/&\\
+/g
+ s/^$bs2$dollar/$bs&/
+ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+ s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_echo ${1+"$@"}
+
+ # A bug in bash halts the script if the last line of a function
+ # fails when set -e is in force, so we need another command to
+ # work around that:
+ :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+ $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+ # bash bug again:
+ :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information." ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+ my_directory_path="$1"
+ my_dir_list=
+
+ if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+ # Protect directory names starting with `-'
+ case $my_directory_path in
+ -*) my_directory_path="./$my_directory_path" ;;
+ esac
+
+ # While some portion of DIR does not yet exist...
+ while test ! -d "$my_directory_path"; do
+ # ...make a list in topmost first order. Use a colon delimited
+ # list incase some portion of path contains whitespace.
+ my_dir_list="$my_directory_path:$my_dir_list"
+
+ # If the last portion added has no slash in it, the list is done
+ case $my_directory_path in */*) ;; *) break ;; esac
+
+ # ...otherwise throw away the child directory and loop
+ my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+ done
+ my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+ save_mkdir_p_IFS="$IFS"; IFS=':'
+ for my_dir in $my_dir_list; do
+ IFS="$save_mkdir_p_IFS"
+ # mkdir can fail with a `File exist' error if two processes
+ # try to create one of the directories concurrently. Don't
+ # stop in that case!
+ $MKDIR "$my_dir" 2>/dev/null || :
+ done
+ IFS="$save_mkdir_p_IFS"
+
+ # Bail out if we (or some other process) failed to create a directory.
+ test -d "$my_directory_path" || \
+ func_fatal_error "Failed to create \`$1'"
+ fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$opt_dry_run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $MKDIR "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || \
+ func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+ fi
+
+ $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+ case $1 in
+ *[\\\`\"\$]*)
+ func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+ *)
+ func_quote_for_eval_unquoted_result="$1" ;;
+ esac
+
+ case $func_quote_for_eval_unquoted_result in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+ ;;
+ *)
+ func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+ esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+ case $1 in
+ *[\\\`\"]*)
+ my_arg=`$ECHO "$1" | $SED \
+ -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+ *)
+ my_arg="$1" ;;
+ esac
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$my_cmd"
+ my_status=$?
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it. Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$lt_user_locale
+ $my_cmd"
+ my_status=$?
+ eval "$lt_safe_locale"
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result. All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+ case $1 in
+ [0-9]* | *[!a-zA-Z0-9_]*)
+ func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+ ;;
+ * )
+ func_tr_sh_result=$1
+ ;;
+ esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $opt_debug
+
+ $SED -n '/(C)/!b go
+ :more
+ /\./!{
+ N
+ s/\n# / /
+ b more
+ }
+ :go
+ /^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/^# *.*--help/ {
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
+ }' < "$progpath"
+ echo
+ $ECHO "run \`$progname --help | more' for full usage"
+ exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/# Report bugs to/ {
+ :print
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$host*'"$host"'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+ p
+ d
+ }
+ /^# .* home page:/b print
+ /^# General help using/b print
+ ' < "$progpath"
+ ret=$?
+ if test -z "$1"; then
+ exit $ret
+ fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ $opt_debug
+
+ func_error "missing argument for $1."
+ exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+ my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+ my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+ func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+ func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+ my_sed_long_arg='1s/^--[^=]*=//'
+
+ func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+ func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+ func_quote_for_eval "${2}"
+ eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+ func_error ${1+"$@"}
+ func_error "See the $PACKAGE documentation for more information."
+ func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+ re_begincf='^# ### BEGIN LIBTOOL'
+ re_endcf='^# ### END LIBTOOL'
+
+ # Default configuration.
+ $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+ done
+
+ exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+
+ exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+ # Global variable:
+ tagname="$1"
+
+ re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+ re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+ sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+ # Validate tagname.
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ func_fatal_error "invalid tag name: $tagname"
+ ;;
+ esac
+
+ # Don't test for the "default" C tag, as we know it's
+ # there but not specially marked.
+ case $tagname in
+ CC) ;;
+ *)
+ if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+ taglist="$taglist $tagname"
+
+ # Evaluate the configuration. Be careful to quote the path
+ # and the sed script, to avoid splitting on whitespace, but
+ # also don't use non-portable quotes within backquotes within
+ # quotes we have to do it in 2 steps:
+ extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+ eval "$extractedcf"
+ else
+ func_error "ignoring unknown tag $tagname"
+ fi
+ ;;
+ esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+ if test "$package_revision" != "$macro_revision"; then
+ if test "$VERSION" != "$macro_version"; then
+ if test -z "$macro_version"; then
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ fi
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+ fi
+
+ exit $EXIT_MISMATCH
+ fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
+ ;;
+compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
+ ;;
+execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
+ ;;
+finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
+ ;;
+install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
+ ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly. This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+ # this just eases exit handling
+ while test $# -gt 0; do
+ opt="$1"
+ shift
+ case $opt in
+ --debug|-x) opt_debug='set -x'
+ func_echo "enabling shell trace mode"
+ $opt_debug
+ ;;
+ --dry-run|--dryrun|-n)
+ opt_dry_run=:
+ ;;
+ --config)
+ opt_config=:
+func_config
+ ;;
+ --dlopen|-dlopen)
+ optarg="$1"
+ opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+ shift
+ ;;
+ --preserve-dup-deps)
+ opt_preserve_dup_deps=:
+ ;;
+ --features)
+ opt_features=:
+func_features
+ ;;
+ --finish)
+ opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+ ;;
+ --help)
+ opt_help=:
+ ;;
+ --help-all)
+ opt_help_all=:
+opt_help=': help-all'
+ ;;
+ --mode)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_mode="$optarg"
+case $optarg in
+ # Valid mode arguments:
+ clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+esac
+ shift
+ ;;
+ --no-silent|--no-quiet)
+ opt_silent=false
+func_append preserve_args " $opt"
+ ;;
+ --no-warning|--no-warn)
+ opt_warning=false
+func_append preserve_args " $opt"
+ ;;
+ --no-verbose)
+ opt_verbose=false
+func_append preserve_args " $opt"
+ ;;
+ --silent|--quiet)
+ opt_silent=:
+func_append preserve_args " $opt"
+ opt_verbose=false
+ ;;
+ --verbose|-v)
+ opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+ ;;
+ --tag)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+
+ # Separate optargs to long options:
+ --*=*)
+ func_split_long_opt "$opt"
+ set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ # Separate non-argument short options:
+ -\?*|-h*|-n*|-v*)
+ func_split_short_opt "$opt"
+ set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+ *) set dummy "$opt" ${1+"$@"}; shift; break ;;
+ esac
+ done
+
+ # Validate options:
+
+ # save first non-option argument
+ if test "$#" -gt 0; then
+ nonopt="$opt"
+ shift
+ fi
+
+ # preserve --debug
+ test "$opt_debug" = : || func_append preserve_args " --debug"
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
+ *)
+ opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+ ;;
+ esac
+
+ $opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
+ fi
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+ func_error "unrecognized option \`-dlopen'"
+ $ECHO "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$progname --help --mode=$opt_mode' for more information."
+ }
+
+
+ # Bail if the options were screwed
+ $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+## Main. ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+ test -f "$1" &&
+ $SED -e 4q "$1" 2>/dev/null \
+ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs. To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway. Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+ lalib_p=no
+ if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+ for lalib_p_l in 1 2 3 4
+ do
+ read lalib_p_line
+ case "$lalib_p_line" in
+ \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+ esac
+ done
+ exec 0<&5 5<&-
+ fi
+ test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+ func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+ func_ltwrapper_exec_suffix=
+ case $1 in
+ *.exe) ;;
+ *) func_ltwrapper_exec_suffix=.exe ;;
+ esac
+ $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+ func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+ $opt_debug
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+ eval cmd=\"$cmd\"
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot. Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+ func_resolve_sysroot_result=$1
+ case $func_resolve_sysroot_result in
+ =*)
+ func_stripname '=' '' "$func_resolve_sysroot_result"
+ func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+ ;;
+ esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+ case "$lt_sysroot:$1" in
+ ?*:"$lt_sysroot"*)
+ func_stripname "$lt_sysroot" '' "$1"
+ func_replace_sysroot_result="=$func_stripname_result"
+ ;;
+ *)
+ # Including no sysroot.
+ func_replace_sysroot_result=$1
+ ;;
+ esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ $opt_debug
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case "$@ " in
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ func_echo "unable to infer tagged configuration"
+ func_fatal_error "specify a tag with \`--tag'"
+# else
+# func_verbose "using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+ $MV "${write_libobj}T" "${write_libobj}"
+ }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+ $opt_debug
+ func_convert_core_file_wine_to_w32_result="$1"
+ if test -n "$1"; then
+ # Unfortunately, winepath does not exit with a non-zero error code, so we
+ # are forced to check the contents of stdout. On the other hand, if the
+ # command is not found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both error code of
+ # zero AND non-empty stdout, which explains the odd construction:
+ func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+ func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ func_convert_core_file_wine_to_w32_result=
+ fi
+ fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+ $opt_debug
+ # unfortunately, winepath doesn't convert paths, only file names
+ func_convert_core_path_wine_to_w32_result=""
+ if test -n "$1"; then
+ oldIFS=$IFS
+ IFS=:
+ for func_convert_core_path_wine_to_w32_f in $1; do
+ IFS=$oldIFS
+ func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+ if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+ if test -z "$func_convert_core_path_wine_to_w32_result"; then
+ func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+ else
+ func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+ fi
+ fi
+ done
+ IFS=$oldIFS
+ fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+ $opt_debug
+ if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+ func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+ if test "$?" -ne 0; then
+ # on failure, ensure result is empty
+ func_cygpath_result=
+ fi
+ else
+ func_cygpath_result=
+ func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+ fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format. Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+ $opt_debug
+ # awkward: cmd appends spaces to result
+ func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+ $opt_debug
+ if test -z "$2" && test -n "$1" ; then
+ func_error "Could not determine host file name corresponding to"
+ func_error " \`$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_file_result="$1"
+ fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+ $opt_debug
+ if test -z "$4" && test -n "$3"; then
+ func_error "Could not determine the host path corresponding to"
+ func_error " \`$3'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This is a deliberately simplistic "conversion" and
+ # should not be "improved". See libtool.info.
+ if test "x$1" != "x$2"; then
+ lt_replace_pathsep_chars="s|$1|$2|g"
+ func_to_host_path_result=`echo "$3" |
+ $SED -e "$lt_replace_pathsep_chars"`
+ else
+ func_to_host_path_result="$3"
+ fi
+ fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+ $opt_debug
+ case $4 in
+ $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+ ;;
+ esac
+ case $4 in
+ $2 ) func_append func_to_host_path_result "$3"
+ ;;
+ esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+ $opt_debug
+ $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result. If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+ $opt_debug
+ case ,$2, in
+ *,"$to_tool_file_cmd",*)
+ func_to_tool_file_result=$1
+ ;;
+ *)
+ $to_tool_file_cmd "$1"
+ func_to_tool_file_result=$func_to_host_file_result
+ ;;
+ esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+ func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+ # LT_CYGPATH in this case.
+ func_to_host_file_result=`cygpath -m "$1"`
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format. Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_file_wine_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_msys_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+ func_convert_core_file_wine_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format. If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+# file name conversion function : func_convert_file_X_to_Y ()
+# path conversion function : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same. If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+ $opt_debug
+ if test -z "$to_host_path_cmd"; then
+ func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+ to_host_path_cmd="func_convert_path_${func_stripname_result}"
+ fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+ $opt_debug
+ func_init_to_host_path_cmd
+ $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+ func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from ARG. MSYS
+ # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+ # and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format. Requires a wine environment and
+# a working winepath. Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+ $opt_debug
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+ pie_flag=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ test -n "$libobj" && \
+ func_fatal_error "you cannot specify \`-o' more than once"
+ arg_mode=target
+ continue
+ ;;
+
+ -pie | -fpie | -fPIE)
+ func_append pie_flag " $arg"
+ continue
+ ;;
+
+ -shared | -static | -prefer-pic | -prefer-non-pic)
+ func_append later " $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+ func_append_quoted lastarg "$arg"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$lastarg"
+ lastarg=$func_stripname_result
+
+ # Add the arguments to base_compile.
+ func_append base_compile " $lastarg"
+ continue
+ ;;
+
+ *)
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ func_append_quoted base_compile "$lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ func_fatal_error "you must specify an argument for -Xcompile"
+ ;;
+ target)
+ func_fatal_error "you must specify a target with \`-o'"
+ ;;
+ *)
+ # Get the name of the library object.
+ test -z "$libobj" && {
+ func_basename "$srcfile"
+ libobj="$func_basename_result"
+ }
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ case $libobj in
+ *.[cCFSifmso] | \
+ *.ada | *.adb | *.ads | *.asm | \
+ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+ func_xform "$libobj"
+ libobj=$func_xform_result
+ ;;
+ esac
+
+ case $libobj in
+ *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+ *)
+ func_fatal_error "cannot determine name of library object from \`$libobj'"
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ continue
+ ;;
+
+ -static)
+ build_libtool_libs=no
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ func_quote_for_eval "$libobj"
+ test "X$libobj" != "X$func_quote_for_eval_result" \
+ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && func_warning "libobj name \`$libobj' may not contain shell special characters."
+ func_dirname_and_basename "$obj" "/" ""
+ objname="$func_basename_result"
+ xdir="$func_dirname_result"
+ lobj=${xdir}$objdir/$objname
+
+ test -z "$base_compile" && \
+ func_fatal_help "you must specify a compilation command"
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2* | cegcc*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+ func_append removelist " $output_obj"
+ $ECHO "$srcfile" > "$lockfile"
+ fi
+
+ $opt_dry_run || $RM $removelist
+ func_append removelist " $lockfile"
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+ func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+ srcfile=$func_to_tool_file_result
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ func_mkdir_p "$xdir$objdir"
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ func_append command " -o $lobj"
+ fi
+
+ func_show_eval_locale "$command" \
+ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ func_show_eval '$MV "$output_obj" "$lobj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile$pie_flag"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ func_append command " -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ func_append command "$suppress_output"
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ func_show_eval '$MV "$output_obj" "$obj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+ fi
+
+ $opt_dry_run || {
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ removelist=$lockfile
+ $RM "$lockfile"
+ fi
+ }
+
+ exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+ test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+ # We need to display help for each of the modes.
+ case $opt_mode in
+ "")
+ # Generic help is extracted from the usage comments
+ # at the start of this file.
+ func_help
+ ;;
+
+ clean)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ compile)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -no-suppress do not suppress compiler output for multiple passes
+ -prefer-pic try to build PIC objects only
+ -prefer-non-pic try to build non-PIC objects only
+ -shared do not build a \`.o' file suitable for static linking
+ -static only build a \`.o' file suitable for static linking
+ -Wc,FLAG pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+ execute)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+ finish)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+ install)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+ -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+ link)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -bindir BINDIR specify path to binaries directory (for systems where
+ libraries must be found in the PATH setting at runtime)
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -shared only do dynamic linking of libtool libraries
+ -shrext SUFFIX override the standard shared library file extension
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+ -weak LIBNAME declare that the target provides the LIBNAME interface
+ -Wc,FLAG
+ -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
+ -Wl,FLAG
+ -Xlinker FLAG pass linker-specific FLAG directly to the linker
+ -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+ uninstall)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ *)
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+ ;;
+ esac
+
+ echo
+ $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+ if test "$opt_help" = :; then
+ func_mode_help
+ else
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ func_mode_help
+ done
+ } | sed -n '1p; 2,$s/^Usage:/ or: /p'
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ echo
+ func_mode_help
+ done
+ } |
+ sed '1d
+ /^When reporting/,/^Report/{
+ H
+ d
+ }
+ $x
+ /information about other modes/d
+ /more detailed .*MODE/d
+ s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+ fi
+ exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+ $opt_debug
+ # The first argument is the command name.
+ cmd="$nonopt"
+ test -z "$cmd" && \
+ func_fatal_help "you must specify a COMMAND"
+
+ # Handle -dlopen flags immediately.
+ for file in $opt_dlopen; do
+ test -f "$file" \
+ || func_fatal_help "\`$file' is not a file"
+
+ dir=
+ case $file in
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+ func_source "$file"
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && \
+ func_warning "\`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+
+ if test -f "$dir/$objdir/$dlname"; then
+ func_append dir "/$objdir"
+ else
+ if test ! -f "$dir/$dlname"; then
+ func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ ;;
+
+ *)
+ func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -* | *.la | *.lo ) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if func_ltwrapper_script_p "$file"; then
+ func_source "$file"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ elif func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ func_source "$func_ltwrapper_scriptname_result"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ func_append_quoted args "$file"
+ done
+
+ if test "X$opt_dry_run" = Xfalse; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+ echo "export $shlibpath_var"
+ fi
+ $ECHO "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+ $opt_debug
+ libs=
+ libdirs=
+ admincmds=
+
+ for opt in "$nonopt" ${1+"$@"}
+ do
+ if test -d "$opt"; then
+ func_append libdirs " $opt"
+
+ elif test -f "$opt"; then
+ if func_lalib_unsafe_p "$opt"; then
+ func_append libs " $opt"
+ else
+ func_warning "\`$opt' is not a valid libtool archive"
+ fi
+
+ else
+ func_fatal_error "invalid argument \`$opt'"
+ fi
+ done
+
+ if test -n "$libs"; then
+ if test -n "$lt_sysroot"; then
+ sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+ sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+ else
+ sysroot_cmd=
+ fi
+
+ # Remove sysroot references
+ if $opt_dry_run; then
+ for lib in $libs; do
+ echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+ done
+ else
+ tmpdir=`func_mktempdir`
+ for lib in $libs; do
+ sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+ > $tmpdir/tmp-la
+ mv -f $tmpdir/tmp-la $lib
+ done
+ ${RM}r "$tmpdir"
+ fi
+ fi
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $opt_dry_run || eval "$cmds" || func_append admincmds "
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ $opt_silent && exit $EXIT_SUCCESS
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $ECHO " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $ECHO " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $ECHO " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+
+ echo "See any operating system documentation about shared libraries for"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ echo "pages."
+ ;;
+ *)
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ echo "----------------------------------------------------------------------"
+ fi
+ exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+ $opt_debug
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ case $nonopt in *shtool*) :;; *) false;; esac; then
+ # Aesthetically quote it.
+ func_quote_for_eval "$nonopt"
+ install_prog="$func_quote_for_eval_result "
+ arg=$1
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ func_quote_for_eval "$arg"
+ func_append install_prog "$func_quote_for_eval_result"
+ install_shared_prog=$install_prog
+ case " $install_prog " in
+ *[\\\ /]cp\ *) install_cp=: ;;
+ *) install_cp=false ;;
+ esac
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ no_mode=:
+ for arg
+ do
+ arg2=
+ if test -n "$dest"; then
+ func_append files " $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ if $install_cp; then :; else
+ prev=$arg
+ fi
+ ;;
+ -g | -m | -o)
+ prev=$arg
+ ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ if test "x$prev" = x-m && test -n "$install_override_mode"; then
+ arg2=$install_override_mode
+ no_mode=false
+ fi
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ func_quote_for_eval "$arg"
+ func_append install_prog " $func_quote_for_eval_result"
+ if test -n "$arg2"; then
+ func_quote_for_eval "$arg2"
+ fi
+ func_append install_shared_prog " $func_quote_for_eval_result"
+ done
+
+ test -z "$install_prog" && \
+ func_fatal_help "you must specify an install program"
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prev' option requires an argument"
+
+ if test -n "$install_override_mode" && $no_mode; then
+ if $install_cp; then :; else
+ func_quote_for_eval "$install_override_mode"
+ func_append install_shared_prog " -m $func_quote_for_eval_result"
+ fi
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ func_fatal_help "no file or destination specified"
+ else
+ func_fatal_help "you must specify a destination"
+ fi
+ fi
+
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$dest"
+ dest=$func_stripname_result
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ func_dirname_and_basename "$dest" "" "."
+ destdir="$func_dirname_result"
+ destname="$func_basename_result"
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files; shift
+ test "$#" -gt 1 && \
+ func_fatal_help "\`$dest' is not a directory"
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ func_fatal_help "\`$destdir' must be an absolute directory name"
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ func_append staticlibs " $file"
+ ;;
+
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$file' is not a valid libtool archive"
+
+ library_names=
+ old_library=
+ relink_command=
+ func_source "$file"
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append current_libdirs " $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append future_libdirs " $libdir" ;;
+ esac
+ fi
+
+ func_dirname "$file" "/" ""
+ dir="$func_dirname_result"
+ func_append dir "$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ test "$inst_prefix_dir" = "$destdir" && \
+ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ func_warning "relinking \`$file'"
+ func_show_eval "$relink_command" \
+ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names; shift
+ if test -n "$1"; then
+ realname="$1"
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+ 'exit $?'
+ tstripme="$stripme"
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $realname in
+ *.dll.a)
+ tstripme=""
+ ;;
+ esac
+ ;;
+ esac
+ if test -n "$tstripme" && test -n "$striplib"; then
+ func_show_eval "$striplib $destdir/$realname" 'exit $?'
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ test "$linkname" != "$realname" \
+ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+ fi
+
+ # Install the pseudo-library for information purposes.
+ func_basename "$file"
+ name="$func_basename_result"
+ instname="$dir/$name"i
+ func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ func_lo2o "$destfile"
+ staticdest=$func_lo2o_result
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ func_fatal_help "cannot copy a libtool object to \`$destfile'"
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ test -n "$destfile" && \
+ func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ func_lo2o "$file"
+ staticobj=$func_lo2o_result
+ func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin* | *mingw*)
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ wrapper=$func_ltwrapper_scriptname_result
+ else
+ func_stripname '' '.exe' "$file"
+ wrapper=$func_stripname_result
+ fi
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if func_ltwrapper_script_p "$wrapper"; then
+ notinst_deplibs=
+ relink_command=
+
+ func_source "$wrapper"
+
+ # Check the variables that should have been set.
+ test -z "$generated_by_libtool_version" && \
+ func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ func_source "$wrapper"
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ $opt_dry_run || {
+ if test "$finalize" = yes; then
+ tmpdir=`func_mktempdir`
+ func_basename "$file$stripped_ext"
+ file="$func_basename_result"
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $opt_silent || {
+ func_quote_for_expand "$relink_command"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ if eval "$relink_command"; then :
+ else
+ func_error "error: relink \`$file' with the above command before installing it"
+ $opt_dry_run || ${RM}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ func_warning "cannot relink \`$file'"
+ fi
+ }
+ else
+ # Install the binary that we compiled earlier.
+ file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ func_stripname '' '.exe' "$destfile"
+ destfile=$func_stripname_result
+ ;;
+ esac
+ ;;
+ esac
+ func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+ $opt_dry_run || if test -n "$outputname"; then
+ ${RM}r "$tmpdir"
+ fi
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ func_basename "$file"
+ name="$func_basename_result"
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+
+ func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+ fi
+
+ # Do each command in the postinstall commands.
+ func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+ done
+
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+ $opt_debug
+ my_outputname="$1"
+ my_originator="$2"
+ my_pic_p="${3-no}"
+ my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+ my_dlsyms=
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ my_dlsyms="${my_outputname}S.c"
+ else
+ func_error "not configured to extract global symbols from dlpreopened files"
+ fi
+ fi
+
+ if test -n "$my_dlsyms"; then
+ case $my_dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${my_outputname}.nm"
+
+ func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+ # Parse the name list into a source file.
+ func_verbose "creating $output_objdir/$my_dlsyms"
+
+ $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ func_verbose "generating symbol list for \`$output'"
+
+ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ for progfile in $progfiles; do
+ func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+ func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+ $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ fi
+ fi
+
+ for dlprefile in $dlprefiles; do
+ func_verbose "extracting global C symbols from \`$dlprefile'"
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ # if an import library, we need to obtain dlname
+ if func_win32_import_lib_p "$dlprefile"; then
+ func_tr_sh "$dlprefile"
+ eval "curr_lafile=\$libfile_$func_tr_sh_result"
+ dlprefile_dlbasename=""
+ if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+ # Use subshell, to avoid clobbering current variable values
+ dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+ if test -n "$dlprefile_dlname" ; then
+ func_basename "$dlprefile_dlname"
+ dlprefile_dlbasename="$func_basename_result"
+ else
+ # no lafile. user explicitly requested -dlpreopen <import library>.
+ $sharedlib_from_linklib_cmd "$dlprefile"
+ dlprefile_dlbasename=$sharedlib_from_linklib_result
+ fi
+ fi
+ $opt_dry_run || {
+ if test -n "$dlprefile_dlbasename" ; then
+ eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+ else
+ func_warning "Could not compute DLL name from $name"
+ eval '$ECHO ": $name " >> "$nlist"'
+ fi
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+ $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+ }
+ else # not an import lib
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ fi
+ ;;
+ *)
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ ;;
+ esac
+ done
+
+ $opt_dry_run || {
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $MV "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if $GREP -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ $GREP -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ fi
+
+ echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols. */
+typedef struct {
+ const char *name;
+ void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+ { \"$my_originator\", (void *) 0 },"
+
+ case $need_lib_prefix in
+ no)
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ *)
+ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ esac
+ echo >> "$output_objdir/$my_dlsyms" "\
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ } # !$opt_dry_run
+
+ pic_flag_for_symtable=
+ case "$compile_command " in
+ *" -static "*) ;;
+ *)
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+ *-*-hpux*)
+ pic_flag_for_symtable=" $pic_flag" ;;
+ *)
+ if test "X$my_pic_p" != Xno; then
+ pic_flag_for_symtable=" $pic_flag"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ symtab_cflags=
+ for arg in $LTCFLAGS; do
+ case $arg in
+ -pie | -fpie | -fPIE) ;;
+ *) func_append symtab_cflags " $arg" ;;
+ esac
+ done
+
+ # Now compile the dynamic symbol file.
+ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+ # Clean up the generated files.
+ func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+ # Transform the symbol file into the correct name.
+ symfileobj="$output_objdir/${my_outputname}S.$objext"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ if test -f "$output_objdir/$my_outputname.def"; then
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ else
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ fi
+ ;;
+ *)
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ ;;
+ esac
+ ;;
+ *)
+ func_fatal_error "unknown suffix for \`$my_dlsyms'"
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+ fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+ $opt_debug
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+ $opt_debug
+ sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+ $opt_debug
+ match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+ $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+ $SED '/^Contents of section '"$match_literal"':/{
+ # Place marker at beginning of archive member dllname section
+ s/.*/====MARK====/
+ p
+ d
+ }
+ # These lines can sometimes be longer than 43 characters, but
+ # are always uninteresting
+ /:[ ]*file format pe[i]\{,1\}-/d
+ /^In archive [^:]*:/d
+ # Ensure marker is printed
+ /^====MARK====/p
+ # Remove all lines with less than 43 characters
+ /^.\{43\}/!d
+ # From remaining lines, remove first 43 characters
+ s/^.\{43\}//' |
+ $SED -n '
+ # Join marker and all lines until next marker into a single line
+ /^====MARK====/ b para
+ H
+ $ b para
+ b
+ :para
+ x
+ s/\n//g
+ # Remove the marker
+ s/^====MARK====//
+ # Remove trailing dots and whitespace
+ s/[\. \t]*$//
+ # Print
+ /./p' |
+ # we now have a list, one entry per line, of the stringified
+ # contents of the appropriate section of all members of the
+ # archive which possess that section. Heuristic: eliminate
+ # all those which have a first or second character that is
+ # a '.' (that is, objdump's representation of an unprintable
+ # character.) This should work for all archives with less than
+ # 0x302f exports -- but will fail for DLLs whose name actually
+ # begins with a literal '.' or a single character followed by
+ # a '.'.
+ #
+ # Of those that remain, print the first one.
+ $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+ test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+ test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+ $opt_debug
+ if func_cygming_gnu_implib_p "$1" ; then
+ # binutils import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+ elif func_cygming_ms_implib_p "$1" ; then
+ # ms-generated import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+ else
+ # unknown
+ sharedlib_from_linklib_result=""
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ $opt_debug
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ if test "$lock_old_archive_extraction" = yes; then
+ lockfile=$f_ex_an_ar_oldlib.lock
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ fi
+ func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+ 'stat=$?; rm -f "$lockfile"; exit $stat'
+ if test "$lock_old_archive_extraction" = yes; then
+ $opt_dry_run || rm -f "$lockfile"
+ fi
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+ fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ $opt_debug
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ func_basename "$my_xlib"
+ my_xlib="$func_basename_result"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ func_arith $extracted_serial + 1
+ extracted_serial=$func_arith_result
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ func_mkdir_p "$my_xdir"
+
+ case $host in
+ *-darwin*)
+ func_verbose "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ $opt_dry_run || {
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`basename "$darwin_archive"`
+ darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ $LIPO -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ $RM -rf unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd $darwin_orig_dir
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ } # !$opt_dry_run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+ done
+
+ func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable. Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take. If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory. This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+ func_emit_wrapper_arg1=${1-no}
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='$macro_version'
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$ECHO are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ file=\"\$0\""
+
+ qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+ $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+ ECHO=\"$qECHO\"
+ fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+ lt_script_arg0=\$0
+ shift
+ for lt_opt
+ do
+ case \"\$lt_opt\" in
+ --lt-debug) lt_option_debug=1 ;;
+ --lt-dump-script)
+ lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+ test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+ lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+ cat \"\$lt_dump_D/\$lt_dump_F\"
+ exit 0
+ ;;
+ --lt-*)
+ \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+
+ # Print the debug banner immediately:
+ if test -n \"\$lt_option_debug\"; then
+ echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+ fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+ lt_dump_args_N=1;
+ for lt_arg
+ do
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+ lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+ done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2* | *-cegcc*)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+ case \" \$* \" in
+ *\\ --lt-*)
+ for lt_wr_arg
+ do
+ case \$lt_wr_arg in
+ --lt-*) ;;
+ *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+ esac
+ shift
+ done ;;
+ esac
+ func_exec_program_core \${1+\"\$@\"}
+}
+
+ # Parse options
+ func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+ done
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" ||
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $MKDIR \"\$progdir\"
+ else
+ $RM \"\$progdir/\$file\"
+ fi"
+
+ $ECHO "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $ECHO \"\$relink_command_output\" >&2
+ $RM \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $RM \"\$progdir/\$program\";
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $RM \"\$progdir/\$file\"
+ fi"
+ else
+ $ECHO "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # fixup the dll searchpath if we need to.
+ #
+ # Fix the DLL searchpath if we need to. Do this before prepending
+ # to shlibpath, because on Windows, both are PATH and uninstalled
+ # libraries must come first.
+ if test -n "$dllsearchpath"; then
+ $ECHO "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $ECHO "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ $ECHO "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+ func_exec_program \${1+\"\$@\"}
+ fi
+ else
+ # The program doesn't exist.
+ \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+ \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+ cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+*/
+EOF
+ cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+# include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+# define _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+ cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ func_to_host_path "$temp_rpath"
+ cat <<EOF
+const char * LIB_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * LIB_PATH_VALUE = "";
+EOF
+ fi
+
+ if test -n "$dllsearchpath"; then
+ func_to_host_path "$dllsearchpath:"
+ cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE = "";
+EOF
+ fi
+
+ if test "$fast_install" = yes; then
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+ else
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+ fi
+
+
+ cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int newargc;
+ char *tmp_pathspec;
+ char *actual_cwrapper_path;
+ char *actual_cwrapper_name;
+ char *target_name;
+ char *lt_argv_zero;
+ intptr_t rval = 127;
+
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ newargz = XMALLOC (char *, argc + 1);
+
+ /* very simple arg parsing; don't want to rely on getopt
+ * also, copy all non cwrapper options to newargz, except
+ * argz[0], which is handled differently
+ */
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], dumpscript_opt) == 0)
+ {
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<"EOF"
+ lt_dump_script (stdout);
+ return 0;
+ }
+ if (strcmp (argv[i], debug_opt) == 0)
+ {
+ lt_debug = 1;
+ continue;
+ }
+ if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal (__FILE__, __LINE__,
+ "unrecognized %s option: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+EOF
+ cat <<EOF
+ /* The GNU banner must be the first non-error debug message */
+ lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+ cat <<"EOF"
+ lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+ tmp_pathspec = find_executable (argv[0]);
+ if (tmp_pathspec == NULL)
+ lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (before symlink chase) at: %s\n",
+ tmp_pathspec);
+
+ actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (after symlink chase) at: %s\n",
+ actual_cwrapper_path);
+ XFREE (tmp_pathspec);
+
+ actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+ strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+ /* wrapper name transforms */
+ strendzap (actual_cwrapper_name, ".exe");
+ tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+ XFREE (actual_cwrapper_name);
+ actual_cwrapper_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ /* target_name transforms -- use actual target program name; might have lt- prefix */
+ target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+ strendzap (target_name, ".exe");
+ tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+ XFREE (target_name);
+ target_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) libtool target name: %s\n",
+ target_name);
+EOF
+
+ cat <<EOF
+ newargz[0] =
+ XMALLOC (char, (strlen (actual_cwrapper_path) +
+ strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+ strcpy (newargz[0], actual_cwrapper_path);
+ strcat (newargz[0], "$objdir");
+ strcat (newargz[0], "/");
+EOF
+
+ cat <<"EOF"
+ /* stop here, and copy so we don't have to do this twice */
+ tmp_pathspec = xstrdup (newargz[0]);
+
+ /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+ strcat (newargz[0], actual_cwrapper_name);
+
+ /* DO want the lt- prefix here if it exists, so use target_name */
+ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+ XFREE (tmp_pathspec);
+ tmp_pathspec = NULL;
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ {
+ char* p;
+ while ((p = strchr (newargz[0], '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ }
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+ XFREE (target_name);
+ XFREE (actual_cwrapper_path);
+ XFREE (actual_cwrapper_name);
+
+ lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+ lt_setenv ("DUALCASE", "1"); /* for MSK sh */
+ /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
+ be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+ because on Windows, both *_VARNAMEs are PATH but uninstalled
+ libraries must come first. */
+ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+ lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+ nonnull (lt_argv_zero));
+ for (i = 0; i < newargc; i++)
+ {
+ lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+ i, nonnull (newargz[i]));
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ /* execv doesn't actually work on mingw as expected on unix */
+ newargz = prepare_spawn (newargz);
+ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+ if (rval == -1)
+ {
+ /* failed to start process */
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) failed to launch target \"%s\": %s\n",
+ lt_argv_zero, nonnull (strerror (errno)));
+ return 127;
+ }
+ return rval;
+EOF
+ ;;
+ *)
+ cat <<"EOF"
+ execv (lt_argv_zero, newargz);
+ return rval; /* =127, but avoids unused variable warning */
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+ void *p = (void *) malloc (num);
+ if (!p)
+ lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+ string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable (const char *path)
+{
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0)
+ && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ return 1;
+ else
+ return 0;
+}
+
+int
+make_executable (const char *path)
+{
+ int rval = 0;
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if (stat (path, &st) >= 0)
+ {
+ rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+ }
+ return rval;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise
+ Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+ int has_slash = 0;
+ const char *p;
+ const char *p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char *concat_name;
+
+ lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+ nonempty (wrapper));
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char *path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char *q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR (*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name =
+ XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name =
+ XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+ return xstrdup (pathspec);
+#else
+ char buf[LT_PATHMAX];
+ struct stat s;
+ char *tmp_pathspec = xstrdup (pathspec);
+ char *p;
+ int has_symlinks = 0;
+ while (strlen (tmp_pathspec) && !has_symlinks)
+ {
+ lt_debugprintf (__FILE__, __LINE__,
+ "checking path component for symlinks: %s\n",
+ tmp_pathspec);
+ if (lstat (tmp_pathspec, &s) == 0)
+ {
+ if (S_ISLNK (s.st_mode) != 0)
+ {
+ has_symlinks = 1;
+ break;
+ }
+
+ /* search backwards for last DIR_SEPARATOR */
+ p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+ while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ p--;
+ if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ {
+ /* no more DIR_SEPARATORS left */
+ break;
+ }
+ *p = '\0';
+ }
+ else
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "error accessing file \"%s\": %s",
+ tmp_pathspec, nonnull (strerror (errno)));
+ }
+ }
+ XFREE (tmp_pathspec);
+
+ if (!has_symlinks)
+ {
+ return xstrdup (pathspec);
+ }
+
+ tmp_pathspec = realpath (pathspec, buf);
+ if (tmp_pathspec == 0)
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "could not follow symlinks for %s", pathspec);
+ }
+ return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert (str != NULL);
+ assert (pat != NULL);
+
+ len = strlen (str);
+ patlen = strlen (pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp (str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ if (lt_debug)
+ {
+ (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+ int line, const char *mode,
+ const char *message, va_list ap)
+{
+ fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+ va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+ return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+ return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_setenv) setting '%s' to '%s'\n",
+ nonnull (name), nonnull (value));
+ {
+#ifdef HAVE_SETENV
+ /* always make a copy, for consistency with !HAVE_SETENV */
+ char *str = xstrdup (value);
+ setenv (name, str, 1);
+#else
+ int len = strlen (name) + 1 + strlen (value) + 1;
+ char *str = XMALLOC (char, len);
+ sprintf (str, "%s=%s", name, value);
+ if (putenv (str) != EXIT_SUCCESS)
+ {
+ XFREE (str);
+ }
+#endif
+ }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+ char *new_value;
+ if (orig_value && *orig_value)
+ {
+ int orig_value_len = strlen (orig_value);
+ int add_len = strlen (add);
+ new_value = XMALLOC (char, add_len + orig_value_len + 1);
+ if (to_end)
+ {
+ strcpy (new_value, orig_value);
+ strcpy (new_value + orig_value_len, add);
+ }
+ else
+ {
+ strcpy (new_value, add);
+ strcpy (new_value + add_len, orig_value);
+ }
+ }
+ else
+ {
+ new_value = xstrdup (add);
+ }
+ return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ /* some systems can't cope with a ':'-terminated path #' */
+ int len = strlen (new_value);
+ while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+ {
+ new_value[len-1] = '\0';
+ }
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+EOF
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+ Note that spawn() does not by itself call the command interpreter
+ (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+ ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&v);
+ v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+ }) ? "cmd.exe" : "command.com").
+ Instead it simply concatenates the arguments, separated by ' ', and calls
+ CreateProcess(). We must quote the arguments since Win32 CreateProcess()
+ interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+ special way:
+ - Space and tab are interpreted as delimiters. They are not treated as
+ delimiters if they are surrounded by double quotes: "...".
+ - Unescaped double quotes are removed from the input. Their only effect is
+ that within double quotes, space and tab are treated like normal
+ characters.
+ - Backslashes not followed by double quotes are not special.
+ - But 2*n+1 backslashes followed by a double quote become
+ n backslashes followed by a double quote (n >= 0):
+ \" -> "
+ \\\" -> \"
+ \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+ size_t argc;
+ char **new_argv;
+ size_t i;
+
+ /* Count number of arguments. */
+ for (argc = 0; argv[argc] != NULL; argc++)
+ ;
+
+ /* Allocate new argument vector. */
+ new_argv = XMALLOC (char *, argc + 1);
+
+ /* Put quoted arguments into the new argument vector. */
+ for (i = 0; i < argc; i++)
+ {
+ const char *string = argv[i];
+
+ if (string[0] == '\0')
+ new_argv[i] = xstrdup ("\"\"");
+ else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+ {
+ int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+ size_t length;
+ unsigned int backslashes;
+ const char *s;
+ char *quoted_string;
+ char *p;
+
+ length = 0;
+ backslashes = 0;
+ if (quote_around)
+ length++;
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ length += backslashes + 1;
+ length++;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ length += backslashes + 1;
+
+ quoted_string = XMALLOC (char, length + 1);
+
+ p = quoted_string;
+ backslashes = 0;
+ if (quote_around)
+ *p++ = '"';
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ {
+ unsigned int j;
+ for (j = backslashes + 1; j > 0; j--)
+ *p++ = '\\';
+ }
+ *p++ = c;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ {
+ unsigned int j;
+ for (j = backslashes; j > 0; j--)
+ *p++ = '\\';
+ *p++ = '"';
+ }
+ *p = '\0';
+
+ new_argv[i] = quoted_string;
+ }
+ else
+ new_argv[i] = (char *) string;
+ }
+ new_argv[argc] = NULL;
+
+ return new_argv;
+}
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+ func_emit_wrapper yes |
+ $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/ fputs ("\1", f);/p
+g
+D'
+ cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+ $opt_debug
+ case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+ *import*) : ;;
+ *) false ;;
+ esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+ $opt_debug
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args=$nonopt
+ base_compile="$nonopt $@"
+ compile_command=$nonopt
+ finalize_command=$nonopt
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+ new_inherited_linker_flags=
+
+ avoid_version=no
+ bindir=
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+ weak_libs=
+ single_module="${wl}-single_module"
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ break
+ ;;
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ func_warning "complete static linking is impossible in this configuration"
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ -static)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ func_quote_for_eval "$arg"
+ qarg=$func_quote_for_eval_unquoted_result
+ func_append libtool_args " $func_quote_for_eval_result"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ func_append compile_command " @OUTPUT@"
+ func_append finalize_command " @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ bindir)
+ bindir="$arg"
+ prev=
+ continue
+ ;;
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ func_append compile_command " @SYMFILE@"
+ func_append finalize_command " @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ func_append dlfiles " $arg"
+ else
+ func_append dlprefiles " $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ test -f "$arg" \
+ || func_fatal_error "symbol file \`$arg' does not exist"
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ framework)
+ case $host in
+ *-*-darwin*)
+ case "$deplibs " in
+ *" $qarg.ltframework "*) ;;
+ *) func_append deplibs " $qarg.ltframework" # this is fixed later
+ ;;
+ esac
+ ;;
+ esac
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat "$save_arg"`
+ do
+# func_append moreargs " $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ done
+ else
+ func_fatal_error "link input file \`$arg' does not exist"
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) func_append rpath " $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) func_append xrpath " $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ weak)
+ func_append weak_libs " $arg"
+ prev=
+ continue
+ ;;
+ xcclinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xcompiler)
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xlinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $wl$qarg"
+ prev=
+ func_append compile_command " $wl$qarg"
+ func_append finalize_command " $wl$qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ # See comment for -static flag below, for more details.
+ func_append compile_command " $link_static_flag"
+ func_append finalize_command " $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -bindir)
+ prev=bindir
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ func_fatal_error "more than one -exported-symbols argument is not allowed"
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework)
+ prev=framework
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ func_stripname "-L" '' "$arg"
+ if test -z "$func_stripname_result"; then
+ if test "$#" -gt 0; then
+ func_fatal_error "require no space between \`-L' and \`$1'"
+ else
+ func_fatal_error "need path for \`-L' option"
+ fi
+ fi
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "* | *" $arg "*)
+ # Will only happen for absolute or sysroot arguments
+ ;;
+ *)
+ # Preserve sysroot, but never include relative directories
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+ *) func_append deplibs " -L$dir" ;;
+ esac
+ func_append lib_search_path " $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ ::) dllsearchpath=$dir;;
+ *) func_append dllsearchpath ":$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ func_append deplibs " System.ltframework"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ func_append deplibs " $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ # Darwin uses the -arch flag to determine output architecture.
+ -model|-arch|-isysroot|--sysroot)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ case "$new_inherited_linker_flags " in
+ *" $arg "*) ;;
+ * ) func_append new_inherited_linker_flags " $arg" ;;
+ esac
+ continue
+ ;;
+
+ -multi_module)
+ single_module="${wl}-multi_module"
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # and Darwin in order for the loader to find any dlls it needs.
+ func_warning "\`-no-install' is ignored for $host"
+ func_warning "assuming \`-no-fast-install' instead"
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ func_stripname '-R' '' "$arg"
+ dir=$func_stripname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$dir"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ continue
+ ;;
+
+ -shared)
+ # The effects of -shared are defined in a previous loop.
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -static | -static-libtool-libs)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -weak)
+ prev=weak
+ continue
+ ;;
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $func_quote_for_eval_result"
+ func_append compiler_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $wl$func_quote_for_eval_result"
+ func_append compiler_flags " $wl$func_quote_for_eval_result"
+ func_append linker_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # -msg_* for osf cc
+ -msg_*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ # Flags to be passed through unchanged, with rationale:
+ # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
+ # -r[0-9][0-9]* specify processor for the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+ # +DA*, +DD* enable 64-bit mode for the HP compiler
+ # -q* compiler args for the IBM compiler
+ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+ # -F/path path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
+ # @file GCC response files
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ func_append compiler_flags " $arg"
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ *.$objext)
+ # A standard object.
+ func_append objs " $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ func_append deplibs " $arg"
+ func_append old_deplibs " $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ func_resolve_sysroot "$arg"
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ func_append dlfiles " $func_resolve_sysroot_result"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ func_append dlprefiles " $func_resolve_sysroot_result"
+ prev=
+ else
+ func_append deplibs " $func_resolve_sysroot_result"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+ done # argument parsing loop
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prevarg' option requires an argument"
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ func_basename "$output"
+ outputname="$func_basename_result"
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
+ func_to_tool_file "$output_objdir/"
+ tool_output_objdir=$func_to_tool_file_result
+ # Create the object directory.
+ func_mkdir_p "$output_objdir"
+
+ # Determine the type of output
+ case $output in
+ "")
+ func_fatal_help "you must specify an output file"
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if $opt_preserve_dup_deps ; then
+ case "$libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append libs " $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if $opt_duplicate_compiler_generated_deps; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+ esac
+ func_append pre_post_deps " $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+
+ case $linkmode in
+ lib)
+ passes="conv dlpreopen link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+
+ for pass in $passes; do
+ # The preopen pass in lib mode reverses $deplibs; put it back here
+ # so that -L comes before libs that need it for instance...
+ if test "$linkmode,$pass" = "lib,link"; then
+ ## FIXME: Find the place where the list is rebuilt in the wrong
+ ## order, and fix it there properly
+ tmp_deplibs=
+ for deplib in $deplibs; do
+ tmp_deplibs="$deplib $tmp_deplibs"
+ done
+ deplibs="$tmp_deplibs"
+ fi
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ if test "$linkmode,$pass" = "lib,dlpreopen"; then
+ # Collect and forward deplibs of preopened libtool libs
+ for lib in $dlprefiles; do
+ # Ignore non-libtool-libs
+ dependency_libs=
+ func_resolve_sysroot "$lib"
+ case $lib in
+ *.la) func_source "$func_resolve_sysroot_result" ;;
+ esac
+
+ # Collect preopened libtool deplibs, except any this library
+ # has declared as weak libs
+ for deplib in $dependency_libs; do
+ func_basename "$deplib"
+ deplib_base=$func_basename_result
+ case " $weak_libs " in
+ *" $deplib_base "*) ;;
+ *) func_append deplibs " $deplib" ;;
+ esac
+ done
+ done
+ libs="$dlprefiles"
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append compiler_flags " $deplib"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ func_warning "\`-l' is ignored for archives/objects"
+ continue
+ fi
+ func_stripname '-l' '' "$deplib"
+ name=$func_stripname_result
+ if test "$linkmode" = lib; then
+ searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+ else
+ searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+ fi
+ for searchdir in $searchdirs; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if func_lalib_p "$lib"; then
+ library_names=
+ old_library=
+ func_source "$lib"
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ *.ltframework)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ *)
+ func_warning "\`-L' is ignored for archives/objects"
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ func_stripname '-R' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ lib=$func_resolve_sysroot_result
+ ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ # Linking convenience modules into shared libraries is allowed,
+ # but linking other static libraries is non-portable.
+ case " $dlpreconveniencelibs " in
+ *" $deplib "*) ;;
+ *)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ echo
+ $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because the file extensions .$libext of this argument makes me believe"
+ echo "*** that it is just a static archive that I should not use here."
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the"
+ $ECHO "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ ;;
+ esac
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ func_append newdlprefiles " $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append newdlfiles " $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+ fi
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$lib" \
+ || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ inherited_linker_flags=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ func_source "$lib"
+
+ # Convert "-framework foo" to "foo.ltframework"
+ if test -n "$inherited_linker_flags"; then
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+ case " $new_inherited_linker_flags " in
+ *" $tmp_inherited_linker_flag "*) ;;
+ *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+ esac
+ done
+ fi
+ dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && func_append dlfiles " $dlopen"
+ test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ func_append convenience " $ladir/$objdir/$old_library"
+ func_append old_convenience " $ladir/$objdir/$old_library"
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ func_fatal_error "\`$lib' is not a convenience library"
+ fi
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ if test -n "$old_library" &&
+ { test "$prefer_static_libs" = yes ||
+ test "$prefer_static_libs,$installed" = "built,no"; }; then
+ linklib=$old_library
+ else
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ fi
+ if test -z "$linklib"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ func_append dlprefiles " $lib $dependency_libs"
+ else
+ func_append newdlfiles " $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ func_warning "cannot determine absolute directory name of \`$ladir'"
+ func_warning "passing it literally to the linker, although it might fail"
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ func_basename "$lib"
+ laname="$func_basename_result"
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ func_warning "library \`$lib' was moved."
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$lt_sysroot$libdir"
+ absdir="$lt_sysroot$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ fi
+ fi # $installed = yes
+ func_stripname 'lib' '.la' "$laname"
+ name=$func_stripname_result
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir" && test "$linkmode" = prog; then
+ func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+ fi
+ case "$host" in
+ # special handling for platforms with PE-DLLs.
+ *cygwin* | *mingw* | *cegcc* )
+ # Linker will automatically link against shared library if both
+ # static and shared are present. Therefore, ensure we extract
+ # symbols from the import library if a shared library is present
+ # (otherwise, the dlopen module name will be incorrect). We do
+ # this by putting the import library name into $newdlprefiles.
+ # We recover the dlopen module name by 'saving' the la file
+ # name in a special purpose variable, and (later) extracting the
+ # dlname from the la file.
+ if test -n "$dlname"; then
+ func_tr_sh "$dir/$linklib"
+ eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+ func_append newdlprefiles " $dir/$linklib"
+ else
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ fi
+ ;;
+ * )
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ func_append newdlprefiles " $dir/$dlname"
+ else
+ func_append newdlprefiles " $dir/$linklib"
+ fi
+ ;;
+ esac
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ func_append newlib_search_path " $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath:" in
+ *"$absdir:"*) ;;
+ *) func_append temp_rpath "$absdir:" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ case $host in
+ *cygwin* | *mingw* | *cegcc*)
+ # No point in relinking DLLs because paths are not encoded
+ func_append notinst_deplibs " $lib"
+ need_relink=no
+ ;;
+ *)
+ if test "$installed" = no; then
+ func_append notinst_deplibs " $lib"
+ need_relink=yes
+ fi
+ ;;
+ esac
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on some
+ # systems (darwin). Don't bleat about dlopened modules though!
+ dlopenmodule=""
+ for dlpremoduletest in $dlprefiles; do
+ if test "X$dlpremoduletest" = "X$lib"; then
+ dlopenmodule="$dlpremoduletest"
+ break
+ fi
+ done
+ if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+ echo
+ if test "$linkmode" = prog; then
+ $ECHO "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $ECHO "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw* | *cegcc*)
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ func_basename "$soroot"
+ soname="$func_basename_result"
+ func_stripname 'lib' '.dll' "$soname"
+ newlib=libimp-$func_stripname_result.a
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ func_verbose "extracting exported symbol list from \`$soname'"
+ func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ func_verbose "generating import library for \`$soname'"
+ func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$opt_mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a (non-dlopened) module then we can not
+ # link against it, someone is ignoring the earlier warnings
+ if /usr/bin/file -L $add 2> /dev/null |
+ $GREP ": [^:]* bundle" >/dev/null ; then
+ if test "X$dlopenmodule" != "X$lib"; then
+ $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ echo
+ echo "*** And there doesn't seem to be a static archive available"
+ echo "*** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ elif test -n "$old_library"; then
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$absdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ func_fatal_configuration "unsupported hardcode properties"
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) func_append compile_shlibpath "$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes &&
+ test "$hardcode_minus_L" != yes &&
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$opt_mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ echo
+ $ECHO "*** Warning: This system can not link to static lib archive $lib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ echo "*** But as you try to build a module library, libtool will still create "
+ echo "*** a static module, that should work as long as the dlopening application"
+ echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) func_stripname '-R' '' "$libdir"
+ temp_xrpath=$func_stripname_result
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) func_append xrpath " $temp_xrpath";;
+ esac;;
+ *) func_append temp_deplibs " $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ func_append newlib_search_path " $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result";;
+ *) func_resolve_sysroot "$deplib" ;;
+ esac
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $func_resolve_sysroot_result "*)
+ func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+ esac
+ fi
+ func_append tmp_libs " $func_resolve_sysroot_result"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ path=
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ deplib=$func_resolve_sysroot_result
+ func_dirname "$deplib" "" "."
+ dir=$func_dirname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ func_warning "cannot determine absolute directory name of \`$dir'"
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if $GREP "^installed=no" $deplib > /dev/null; then
+ case $host in
+ *-*-darwin*)
+ depdepl=
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ if test -z "$darwin_install_name"; then
+ darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ fi
+ func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+ path=
+ fi
+ fi
+ ;;
+ *)
+ path="-L$absdir/$objdir"
+ ;;
+ esac
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+ func_warning "\`$deplib' seems to be moved"
+
+ path="-L$absdir"
+ fi
+ ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ if test "$pass" = link; then
+ if test "$linkmode" = "prog"; then
+ compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+ finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ fi
+ fi
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) func_append lib_search_path " $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ func_append tmp_libs " $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ fi
+ if test "$linkmode" = prog || test "$linkmode" = lib; then
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for archives"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for archives" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for archives"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for archives"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for archives"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for archives"
+
+ test -n "$export_symbols$export_symbols_regex" && \
+ func_warning "\`-export-symbols' is ignored for archives"
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ func_append objs "$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ test "$module" = no && \
+ func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+ $ECHO "*** objects $objs is not portable!"
+ func_append libobjs " $objs"
+ fi
+ fi
+
+ test "$dlself" != no && \
+ func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+ set dummy $rpath
+ shift
+ test "$#" -gt 1 && \
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for convenience libraries"
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ shift
+ IFS="$save_ifs"
+
+ test -n "$7" && \
+ func_fatal_help "too many parameters to \`-version-info'"
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$1"
+ number_minor="$2"
+ number_revision="$3"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ # correct linux to gnu/linux during the next big refactor
+ darwin|linux|osf|windows|none)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|qnx|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_minor"
+ lt_irix_increment=no
+ ;;
+ esac
+ ;;
+ no)
+ current="$1"
+ revision="$2"
+ age="$3"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "CURRENT \`$current' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "REVISION \`$revision' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "AGE \`$age' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ func_error "AGE \`$age' is greater than the current interface number \`$current'"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ func_arith $current + 1
+ minor_current=$func_arith_result
+ xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ irix | nonstopux)
+ if test "X$lt_irix_increment" = "Xno"; then
+ func_arith $current - $age
+ else
+ func_arith $current - $age + 1
+ fi
+ major=$func_arith_result
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ func_arith $revision - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux) # correct to gnu/linux during the next big refactor
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ func_arith $current - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ func_append verstring ":${current}.0"
+ ;;
+
+ qnx)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+
+ *)
+ func_fatal_configuration "unknown library version type \`$version_type'"
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ func_warning "undefined symbols not allowed in $host shared libraries"
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ fi
+
+ func_generate_dlsyms "$libname" "$libname" "yes"
+ func_append libobjs " $symfileobj"
+ test "X$libobjs" = "X " && libobjs=
+
+ if test "$opt_mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$ECHO "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext | *.gcno)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ func_append removelist " $p"
+ ;;
+ *) ;;
+ esac
+ done
+ test -n "$removelist" && \
+ func_show_eval "${RM}r \$removelist"
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ func_append oldlibs " $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ #for path in $notinst_path; do
+ # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+ # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+ #done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ func_replace_sysroot "$libdir"
+ func_append temp_xrpath " -R$func_replace_sysroot_result"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) func_append dlfiles " $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) func_append dlprefiles " $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ func_append deplibs " System.ltframework"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ func_append deplibs " -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $opt_dry_run || $RM conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which I believe you do not have"
+ echo "*** because a test_compile did reveal that the linker did not use it for"
+ echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because a test_compile did reveal that the linker did not use this one"
+ echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method; shift
+ file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ if test -n "$file_magic_glob"; then
+ libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+ else
+ libnameglob=$libname
+ fi
+ test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ if test "$want_nocaseglob" = yes; then
+ shopt -s nocaseglob
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ $nocaseglob
+ else
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ fi
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null |
+ $GREP " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+ $EGREP "$match_pattern_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+ done
+ fi
+ case $tmp_deplibs in
+ *[!\ \ ]*)
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ ;;
+ esac
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library with the System framework
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ case $host in
+ *-*-darwin*)
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Remove ${wl} instances when linking with ld.
+ # FIXME: should test the right _cmds variable.
+ case $archive_cmds in
+ *\$LD\ *) wl= ;;
+ esac
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append dep_rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ func_append linknames " $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ test "X$libobjs" = "X " && libobjs=
+
+ delfiles=
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+ export_symbols="$output_objdir/$libname.uexp"
+ func_append delfiles " $export_symbols"
+ fi
+
+ orig_export_symbols=
+ case $host_os in
+ cygwin* | mingw* | cegcc*)
+ if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+ # exporting using user supplied symfile
+ if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ # and it's NOT already a .def file. Must figure out
+ # which of the given symbols are data symbols and tag
+ # them as such. So, trigger use of export_symbols_cmds.
+ # export_symbols gets reassigned inside the "prepare
+ # the list of exported symbols" if statement, so the
+ # include_expsyms logic still works.
+ orig_export_symbols="$export_symbols"
+ export_symbols=
+ always_export_symbols=yes
+ fi
+ fi
+ ;;
+ esac
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd1 in $cmds; do
+ IFS="$save_ifs"
+ # Take the normal branch if the nm_file_list_spec branch
+ # doesn't work or if tool conversion is not needed.
+ case $nm_file_list_spec~$to_tool_file_cmd in
+ *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+ try_normal_branch=yes
+ eval cmd=\"$cmd1\"
+ func_len " $cmd"
+ len=$func_len_result
+ ;;
+ *)
+ try_normal_branch=no
+ ;;
+ esac
+ if test "$try_normal_branch" = yes \
+ && { test "$len" -lt "$max_cmd_len" \
+ || test "$max_cmd_len" -le -1; }
+ then
+ func_show_eval "$cmd" 'exit $?'
+ skipped_export=false
+ elif test -n "$nm_file_list_spec"; then
+ func_basename "$output"
+ output_la=$func_basename_result
+ save_libobjs=$libobjs
+ save_output=$output
+ output=${output_objdir}/${output_la}.nm
+ func_to_tool_file "$output"
+ libobjs=$nm_file_list_spec$func_to_tool_file_result
+ func_append delfiles " $output"
+ func_verbose "creating $NM input file list: $output"
+ for obj in $save_libobjs; do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > "$output"
+ eval cmd=\"$cmd1\"
+ func_show_eval "$cmd" 'exit $?'
+ output=$save_output
+ libobjs=$save_libobjs
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ func_verbose "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ func_append tmp_deplibs " $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec" &&
+ test "$compiler_needs_object" = yes &&
+ test -z "$libobjs"; then
+ # extract the archives, so we have objects to list.
+ # TODO: could optimize this to just extract one archive.
+ whole_archive_flag_spec=
+ fi
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ else
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ func_append linker_flags " $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ func_len " $test_cmds" &&
+ len=$func_len_result &&
+ test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise
+ # or, if using GNU ld and skipped_export is not :, use a linker
+ # script.
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ func_basename "$output"
+ output_la=$func_basename_result
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ last_robj=
+ k=1
+
+ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+ output=${output_objdir}/${output_la}.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ echo 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ echo ')' >> $output
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$func_to_tool_file_result
+ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+ set x $save_libobjs
+ shift
+ firstobj=
+ if test "$compiler_needs_object" = yes; then
+ firstobj="$1 "
+ shift
+ fi
+ for obj
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+ eval test_cmds=\"$reload_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ if test "X$objlist" = X ||
+ test "$len" -lt "$max_cmd_len"; then
+ func_append objlist " $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ reload_objs=$objlist
+ eval concat_cmds=\"$reload_cmds\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+ k=$func_arith_result
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=" $obj"
+ func_len " $last_robj"
+ func_arith $len0 + $func_len_result
+ len=$func_arith_result
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+ fi
+ func_append delfiles " $output"
+
+ else
+ output=
+ fi
+
+ if ${skipped_export-false}; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+ fi
+ fi
+
+ test -n "$save_libobjs" &&
+ func_verbose "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+
+ if ${skipped_export-false}; then
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+ fi
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+ fi
+
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+ eval cmds=\"\$cmds~\$RM $delfiles\"
+ fi
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for objects"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for objects" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for objects"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for objects"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for objects"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for objects"
+
+ case $output in
+ *.lo)
+ test -n "$objs$old_deplibs" && \
+ func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+ libobj=$output
+ func_lo2o "$libobj"
+ obj=$func_lo2o_result
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $opt_dry_run || $RM $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec and hope we can get by with
+ # turning comma into space..
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # If we're not building shared, we need to use non_pic_objs
+ test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+ fi
+
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result.exe;;
+ esac
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for programs"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for programs"
+
+ test "$preload" = yes \
+ && test "$dlopen_support" = unknown \
+ && test "$dlopen_self" = unknown \
+ && test "$dlopen_self_static" = unknown && \
+ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ case $host in
+ *-*-darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ # But is supposedly fixed on 10.4 or later (yay!).
+ if test "$tagname" = CXX ; then
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[0123])
+ func_append compile_command " ${wl}-bind_at_load"
+ func_append finalize_command " ${wl}-bind_at_load"
+ ;;
+ esac
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ func_append compile_command " $compile_deplibs"
+ func_append finalize_command " $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ ::) dllsearchpath=$libdir;;
+ *) func_append dllsearchpath ":$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ fi
+
+ func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+ # template prelinking step
+ if test -n "$prelink_cmds"; then
+ func_execute_cmds "$prelink_cmds" 'exit $?'
+ fi
+
+ wrappers_required=yes
+ case $host in
+ *cegcc* | *mingw32ce*)
+ # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
+ *cygwin* | *mingw* )
+ if test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ *)
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ esac
+ if test "$wrappers_required" = no; then
+ # Replace the output file specification.
+ compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Delete the generated files.
+ if test -f "$output_objdir/${outputname}S.${objext}"; then
+ func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $opt_dry_run || $RM $output
+ # Link the executable and exit
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ func_warning "this platform does not like uninstalled shared libraries"
+ func_warning "\`$output' will be relinked during installation"
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output_objdir/$outputname"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Now create the wrapper script.
+ func_verbose "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if not in dry run mode.
+ $opt_dry_run || {
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ func_stripname '' '.exe' "$outputname"
+ outputname=$func_stripname_result ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ func_dirname_and_basename "$output" "" "."
+ output_name=$func_basename_result
+ output_path=$func_dirname_result
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $RM $cwrappersource $cwrapper
+ trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_cwrapperexe_src > $cwrappersource
+
+ # The wrapper executable is built using the $host compiler,
+ # because it contains $host paths and files. If cross-
+ # compiling, it, like the target executable, must be
+ # executed on the $host or under an emulation environment.
+ $opt_dry_run || {
+ $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+ $STRIP $cwrapper
+ }
+
+ # Now, create the wrapper script for func_source use:
+ func_ltwrapper_scriptname $cwrapper
+ $RM $func_ltwrapper_scriptname_result
+ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+ $opt_dry_run || {
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
+ }
+ ;;
+ * )
+ $RM $output
+ trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_wrapper no > $output
+ chmod +x $output
+ ;;
+ esac
+ }
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save $symfileobj"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ if test "$preload" = yes && test -f "$symfileobj"; then
+ func_append oldobjs " $symfileobj"
+ fi
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $addlibs
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ func_basename "$obj"
+ $ECHO "$func_basename_result"
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ echo "copying selected object files to avoid basename conflicts..."
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+ func_mkdir_p "$gentop"
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ func_basename "$obj"
+ objbase="$func_basename_result"
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ func_arith $counter + 1
+ counter=$func_arith_result
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ func_append oldobjs " $gentop/$newobj"
+ ;;
+ *) func_append oldobjs " $obj" ;;
+ esac
+ done
+ fi
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+ eval cmds=\"$old_archive_cmds\"
+
+ func_len " $cmds"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ elif test -n "$archiver_list_spec"; then
+ func_verbose "using command file archive linking..."
+ for obj in $oldobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > $output_objdir/$libname.libcmd
+ func_to_tool_file "$output_objdir/$libname.libcmd"
+ oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ func_verbose "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+ oldobjs=
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ eval test_cmds=\"$old_archive_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+ for obj in $save_oldobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ func_append objlist " $obj"
+ if test "$len" -lt "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ len=$len0
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ func_execute_cmds "$cmds" 'exit $?'
+ done
+
+ test -n "$generated" && \
+ func_show_eval "${RM}r$generated"
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ func_verbose "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+ # Only create the output if not a dry run.
+ $opt_dry_run || {
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ func_basename "$deplib"
+ name="$func_basename_result"
+ func_resolve_sysroot "$deplib"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ -L*)
+ func_stripname -L '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -L$func_replace_sysroot_result"
+ ;;
+ -R*)
+ func_stripname -R '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -R$func_replace_sysroot_result"
+ ;;
+ *) func_append newdependency_libs " $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+
+ for lib in $dlfiles; do
+ case $lib in
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ *) func_append newdlfiles " $lib" ;;
+ esac
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ *.la)
+ # Only pass preopened files to the pseudo-archive (for
+ # eventual linking with the app. that links it) if we
+ # didn't already link the preopened objects directly into
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ esac
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlfiles " $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlprefiles " $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $RM $output
+ # place dlname in correct position for cygwin
+ # In fact, it would be nice if we could use this code for all target
+ # systems that can't hard-code library paths into their executables
+ # and that have no shared library path variable independent of PATH,
+ # but it turns out we can't easily determine that from inspecting
+ # libtool variables, so we have to hard-code the OSs to which it
+ # applies here; at the moment, that means platforms that use the PE
+ # object format with DLL files. See the long comment at the top of
+ # tests/bindir.at for full details.
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+ # If a -bindir argument was supplied, place the dll there.
+ if test "x$bindir" != x ;
+ then
+ func_relative_path "$install_libdir" "$bindir"
+ tdlname=$func_relative_path_result$dlname
+ else
+ # Otherwise fall back on heuristic.
+ tdlname=../bin/$dlname
+ fi
+ ;;
+ esac
+ $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $ECHO >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ }
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+ func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+ $opt_debug
+ RM="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) func_append RM " $arg"; rmforce=yes ;;
+ -*) func_append RM " $arg" ;;
+ *) func_append files " $arg" ;;
+ esac
+ done
+
+ test -z "$RM" && \
+ func_fatal_help "you must specify an RM program"
+
+ rmdirs=
+
+ for file in $files; do
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ if test "X$dir" = X.; then
+ odir="$objdir"
+ else
+ odir="$dir/$objdir"
+ fi
+ func_basename "$file"
+ name="$func_basename_result"
+ test "$opt_mode" = uninstall && odir="$dir"
+
+ # Remember odir for removal later, being careful to avoid duplicates
+ if test "$opt_mode" = clean; then
+ case " $rmdirs " in
+ *" $odir "*) ;;
+ *) func_append rmdirs " $odir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if { test -L "$file"; } >/dev/null 2>&1 ||
+ { test -h "$file"; } >/dev/null 2>&1 ||
+ test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if func_lalib_p "$file"; then
+ func_source $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ func_append rmfiles " $odir/$n"
+ done
+ test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+ case "$opt_mode" in
+ clean)
+ case " $library_names " in
+ *" $dlname "*) ;;
+ *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+ esac
+ test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if func_lalib_p "$file"; then
+
+ # Read the .lo file
+ func_source $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" &&
+ test "$pic_object" != none; then
+ func_append rmfiles " $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" &&
+ test "$non_pic_object" != none; then
+ func_append rmfiles " $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$opt_mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ func_stripname '' '.exe' "$name"
+ noexename=$func_stripname_result
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ func_append rmfiles " $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if func_ltwrapper_p "$file"; then
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ relink_command=
+ func_source $func_ltwrapper_scriptname_result
+ func_append rmfiles " $func_ltwrapper_scriptname_result"
+ else
+ relink_command=
+ func_source $dir/$noexename
+ fi
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ func_append rmfiles " $odir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ func_append rmfiles " $odir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ func_show_eval "$RM $rmfiles" 'exit_status=1'
+ done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ func_show_eval "rmdir $dir >/dev/null 2>&1"
+ fi
+ done
+
+ exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+ func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+ help="$generic_help"
+ func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+ eval exec "$exec_cmd"
+ exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/src/m4/gcc_stack_protect.m4 b/src/m4/gcc_stack_protect.m4
new file mode 100644
index 0000000..2246849
--- /dev/null
+++ b/src/m4/gcc_stack_protect.m4
@@ -0,0 +1,99 @@
+dnl
+dnl Useful macros for autoconf to check for ssp-patched gcc
+dnl 1.0 - September 2003 - Tiago Sousa <mirage@kaotik.org>
+dnl 1.1 - August 2006 - Ted Percival <ted@midg3t.net>
+dnl * Stricter language checking (C or C++)
+dnl * Adds GCC_STACK_PROTECT_LIB to add -lssp to LDFLAGS as necessary
+dnl * Caches all results
+dnl * Uses macros to ensure correct ouput in quiet/silent mode
+dnl 1.2 - April 2007 - Ted Percival <ted@midg3t.net>
+dnl * Added GCC_STACK_PROTECTOR macro for simpler (one-line) invocation
+dnl * GCC_STACK_PROTECT_LIB now adds -lssp to LIBS rather than LDFLAGS
+dnl
+dnl About ssp:
+dnl GCC extension for protecting applications from stack-smashing attacks
+dnl http://www.research.ibm.com/trl/projects/security/ssp/
+dnl
+dnl Usage:
+dnl Most people will simply call GCC_STACK_PROTECTOR.
+dnl If you only use one of C or C++, you can save time by only calling the
+dnl macro appropriate for that language. In that case you should also call
+dnl GCC_STACK_PROTECT_LIB first.
+dnl
+dnl GCC_STACK_PROTECTOR
+dnl Tries to turn on stack protection for C and C++ by calling the following
+dnl three macros with the right languages.
+dnl
+dnl GCC_STACK_PROTECT_CC
+dnl checks -fstack-protector with the C compiler, if it exists then updates
+dnl CFLAGS and defines ENABLE_SSP_CC
+dnl
+dnl GCC_STACK_PROTECT_CXX
+dnl checks -fstack-protector with the C++ compiler, if it exists then updates
+dnl CXXFLAGS and defines ENABLE_SSP_CXX
+dnl
+dnl GCC_STACK_PROTECT_LIB
+dnl adds -lssp to LIBS if it is available
+dnl ssp is usually provided as part of libc, but was previously a separate lib
+dnl It does not hurt to add -lssp even if libc provides SSP - in that case
+dnl libssp will simply be ignored.
+dnl
+
+AC_DEFUN([GCC_STACK_PROTECT_LIB],[
+ AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib,
+ [ssp_old_libs="$LIBS"
+ LIBS="$LIBS -lssp"
+ AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no)
+ LIBS="$ssp_old_libs"
+ ])
+ if test $ssp_cv_lib = yes; then
+ LIBS="$LIBS -lssp"
+ fi
+])
+
+AC_DEFUN([GCC_STACK_PROTECT_CC],[
+ AC_LANG_ASSERT(C)
+ if test "X$CC" != "X"; then
+ AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector],
+ ssp_cv_cc,
+ [ssp_old_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS -fstack-protector -Werror"
+ AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
+ CFLAGS="$ssp_old_cflags"
+ ])
+ if test $ssp_cv_cc = yes; then
+ CFLAGS="$CFLAGS -fstack-protector"
+ AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
+ fi
+ fi
+])
+
+AC_DEFUN([GCC_STACK_PROTECT_CXX],[
+ AC_LANG_ASSERT(C++)
+ if test "X$CXX" != "X"; then
+ AC_CACHE_CHECK([whether ${CXX} accepts -fstack-protector],
+ ssp_cv_cxx,
+ [ssp_old_cxxflags="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fstack-protector -Werror"
+ AC_TRY_COMPILE(,, ssp_cv_cxx=yes, ssp_cv_cxx=no)
+ CXXFLAGS="$ssp_old_cxxflags"
+ ])
+ if test $ssp_cv_cxx = yes; then
+ CXXFLAGS="$CXXFLAGS -fstack-protector"
+ AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.])
+ fi
+ fi
+])
+
+AC_DEFUN([GCC_STACK_PROTECTOR],[
+ GCC_STACK_PROTECT_LIB
+
+ AC_LANG_PUSH([C])
+ GCC_STACK_PROTECT_CC
+ AC_LANG_POP([C])
+
+ AC_LANG_PUSH([C++])
+ GCC_STACK_PROTECT_CXX
+ AC_LANG_POP([C++])
+])
+
diff --git a/src/m4/libtool.m4 b/src/m4/libtool.m4
new file mode 100644
index 0000000..f12cfdf
--- /dev/null
+++ b/src/m4/libtool.m4
@@ -0,0 +1,7992 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+ [m4_default([$3],
+ [m4_fatal([Libtool version $1 or higher is required],
+ 63)])],
+ [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+ *\ * | *\ *)
+ AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ _LT_PATH_MAGIC
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+ [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME. Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+ [m4_ifval([$1], [$1], [$2])])
+ lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+ m4_ifval([$4],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+ lt_dict_add_subkey([lt_decl_dict], [$2],
+ [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+ [0], [m4_fatal([$0: too few arguments: $#])],
+ [1], [m4_fatal([$0: too few arguments: $#: $1])],
+ [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+ [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+ [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_if([$2], [],
+ m4_quote(lt_decl_varnames),
+ m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+ lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'. VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly. In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+ [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+# # Some comment about what VAR is for.
+# visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+ [description])))[]dnl
+m4_pushdef([_libtool_name],
+ m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+ [0], [_libtool_name=[$]$1],
+ [1], [_libtool_name=$lt_[]$1],
+ [2], [_libtool_name=$lt_[]$1],
+ [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+ m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'. Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+ dnl If the libtool generation code has been placed in $CONFIG_LT,
+ dnl instead of duplicating it all over again into config.status,
+ dnl then we will have config.status run $CONFIG_LT later, so it
+ dnl needs to know what name is stored there:
+ [AC_CONFIG_COMMANDS([libtool],
+ [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+ dnl If the libtool generation code is destined for config.status,
+ dnl expand the accumulated commands and init code now:
+ [AC_CONFIG_COMMANDS([libtool],
+ [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable. If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins. After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script. The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+ echo
+ AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+ case $[1] in
+ --version | --v* | -V )
+ echo "$lt_cl_version"; exit 0 ;;
+ --help | --h* | -h )
+ echo "$lt_cl_help"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --quiet | --q* | --silent | --s* | -q )
+ lt_cl_silent=: ;;
+
+ -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+ *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+ esac
+ shift
+done
+
+if $lt_cl_silent; then
+ exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure. Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars. Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+ m4_if(_LT_TAG, [C], [
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+ _LT_PROG_LTMAIN
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ _LT_PROG_REPLACE_SHELLFNS
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+# autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+ [C], [_LT_LANG(C)],
+ [C++], [_LT_LANG(CXX)],
+ [Go], [_LT_LANG(GO)],
+ [Java], [_LT_LANG(GCJ)],
+ [Fortran 77], [_LT_LANG(F77)],
+ [Fortran], [_LT_LANG(FC)],
+ [Windows Resource], [_LT_LANG(RC)],
+ [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+ [_LT_LANG($1)],
+ [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+ [LT_SUPPORTED_TAG([$1])dnl
+ m4_append([_LT_TAGS], [$1 ])dnl
+ m4_define([_LT_LANG_]$1[_enabled], [])dnl
+ _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_GO. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC], [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+ fi
+fi
+if test -z "$GOC"; then
+ AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [LT_LANG(CXX)],
+ [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [LT_LANG(F77)],
+ [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+ [LT_LANG(FC)],
+ [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [m4_ifdef([AC_PROG_GCJ],
+ [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([A][M_PROG_GCJ],
+ [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([LT_PROG_GCJ],
+ [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+ [LT_LANG(GO)],
+ [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+ [LT_LANG(RC)],
+ [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+ AC_CHECK_TOOL([LIPO], [lipo], [:])
+ AC_CHECK_TOOL([OTOOL], [otool], [:])
+ AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+ _LT_DECL([], [DSYMUTIL], [1],
+ [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+ _LT_DECL([], [NMEDIT], [1],
+ [Tool to change global to local symbols on Mac OS X])
+ _LT_DECL([], [LIPO], [1],
+ [Tool to manipulate fat objects and archives on Mac OS X])
+ _LT_DECL([], [OTOOL], [1],
+ [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+ _LT_DECL([], [OTOOL64], [1],
+ [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi])
+
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+
+ AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+ [lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+ echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+ $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+ echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+ $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+ [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ m4_if([$1], [CXX],
+[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+],[])
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+ lt_aix_libpath_sed='[
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }]'
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi],[])
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+ fi
+ ])
+ aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+case "$ECHO" in
+ printf*) AC_MSG_RESULT([printf]) ;;
+ print*) AC_MSG_RESULT([print -r]) ;;
+ *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test "X`printf %s $ECHO`" = "X$ECHO" \
+ || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[ --with-sysroot[=DIR] Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted. We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ AC_MSG_RESULT([${with_sysroot}])
+ AC_MSG_ERROR([The sysroot must be an absolute path.])
+ ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AS_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+ [lt_cv_ar_at_file=no
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+ ])
+ ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+ [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+ [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+ [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$5], , :, [$5])
+else
+ m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$4], , :, [$4])
+else
+ m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+ [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}]
+_LT_EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+ [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+ [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+ [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+ [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+ [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+ [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+ test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+ test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+ test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+ [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+ [], [
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[[4-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[23]].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+ [lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [lt_cv_shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+ ])
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Add ABI-specific directories to the system library path.
+ sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+ [Variables whose values should be saved in libtool wrapper scripts and
+ restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+ [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+ [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+ [[List of archive names. First name is the real one, the rest are links.
+ The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+ [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+ [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+ [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+ [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+ [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+ [[As "finish_cmds", except a single script fragment to be evaled but
+ not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+ [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+ [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+ [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="m4_if([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+ [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+ [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+ [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+ [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+ [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+ AC_SUBST([DUMPBIN])
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+ [lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+ [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+ [lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+ esac
+
+ _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+ [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK ['"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx]"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT@&t@_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+ [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+ [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+ [lt_cv_sys_global_symbol_to_c_name_address], [1],
+ [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+ [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+ [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+ [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+ if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ *Intel*\ [[CF]]*Compiler*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ *Portland\ Group*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+ [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+ [Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+ [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ case $host_os in
+ aix[[4-9]]*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ case $cc_basename in
+ cl*)
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+ ;;
+ esac
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+], [
+ runpath_var=
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(archive_cmds, $1)=
+ _LT_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_TAGVAR(compiler_needs_object, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(hardcode_automatic, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(inherit_rpath, $1)=no
+ _LT_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_TAGVAR(module_cmds, $1)=
+ _LT_TAGVAR(module_expsym_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+ *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
+ xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[[45]]*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ m4_if($1, [], [
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ _LT_LINKER_OPTION([if $CC understands -b],
+ _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+ [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+ [lt_cv_irix_exported_symbol],
+ [save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+ [C++], [[int foo (void) { return 0; }]],
+ [Fortran 77], [[
+ subroutine foo
+ end]],
+ [Fortran], [[
+ subroutine foo
+ end]])])],
+ [lt_cv_irix_exported_symbol=yes],
+ [lt_cv_irix_exported_symbol=no])
+ LDFLAGS="$save_LDFLAGS"])
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+ [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+ [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+ [$RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ ])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+ [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+ [enable_shared_with_static_runtimes], [0],
+ [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+ [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+ [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+ [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+ [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+ [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+ [Commands used to build a loadable module if different from building
+ a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+ [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+ [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+ [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+ [Flag to hardcode $libdir into a binary during linking.
+ This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+ [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary and the resulting library dependency is
+ "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+ library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+ [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+ [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+ [Set to "yes" if building a shared library automatically hardcodes DIR
+ into the library and all subsequent libraries and executables linked
+ against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+ [Set to yes if linker adds runtime paths of dependent libraries
+ to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+ [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+ [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+ [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+ [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+ [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+ [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+ [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+ [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+ LT_SYS_DLOPEN_SELF
+ _LT_CMD_STRIPLIB
+
+ # Report which library types will actually be built
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+else
+ _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_CFLAGS=$CFLAGS
+ lt_save_LD=$LD
+ lt_save_GCC=$GCC
+ GCC=$GXX
+ lt_save_with_gnu_ld=$with_gnu_ld
+ lt_save_path_LD=$lt_cv_path_LD
+ if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+ else
+ $as_unset lt_cv_prog_gnu_ld
+ fi
+ if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+ else
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ CFLAGS=$CXXFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+ else
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ LT_PATH_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+ $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $GXX,$cc_basename in
+ ,cl* | no,cl*)
+ # Native MSVC
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ func_to_tool_file "$lt_outputfile"~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # g++
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ freebsd-elf*)
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ hpux9*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+
+ *nto* | *qnx*)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+ '"$_LT_TAGVAR(old_archive_cmds, $1)"
+ _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+ '"$_LT_TAGVAR(reload_cmds, $1)"
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+ test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+ _LT_TAGVAR(GCC, $1)="$GXX"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ with_gnu_ld=$lt_save_with_gnu_ld
+ lt_cv_path_LDCXX=$lt_cv_path_LD
+ lt_cv_path_LD=$lt_save_path_LD
+ lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case ${prev}${p} in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ fi
+
+ # Expand the sysroot to ease extracting the directories later.
+ if test -z "$prev"; then
+ case $p in
+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+ esac
+ fi
+ case $p in
+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+ esac
+ if test "$pre_test_object_deps_done" = no; then
+ case ${prev} in
+ -L | -R)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+ _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ prev=
+ ;;
+
+ *.lto.$objext) ;; # Ignore GCC LTO objects
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+ _LT_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+ _LT_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_TAGVAR(predep_objects,$1)=
+ _LT_TAGVAR(postdep_objects,$1)=
+ _LT_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+ [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+ [Dependencies to place before and after the objects being linked to
+ create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+ [The library search path used internally by the compiler when linking
+ a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${F77-"f77"}
+ CFLAGS=$FFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+ GCC=$G77
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$G77"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+ CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${FC-"f95"}
+ CFLAGS=$FCFLAGS
+ compiler=$CC
+ GCC=$ac_cv_fc_compiler_gnu
+
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+ :
+ _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+ [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+ func_split_long_opt_name=${1%%=*}
+ func_split_long_opt_arg=${1#*=}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+ func_split_short_opt_arg=${1#??}
+ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
+
+ _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
+
+ _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+ func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+ eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+ [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+ [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/src/m4/ltoptions.m4 b/src/m4/ltoptions.m4
new file mode 100644
index 0000000..5d9acd8
--- /dev/null
+++ b/src/m4/ltoptions.m4
@@ -0,0 +1,384 @@
+# Helper functions for option handling. -*- Autoconf -*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it. Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+ _LT_MANGLE_DEFUN([$1], [$2]),
+ [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+ [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME. If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+ dnl
+ dnl Simply set some default values (i.e off) if boolean options were not
+ dnl specified:
+ _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+ ])
+ _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+ ])
+ dnl
+ dnl If no reference was made to various pairs of opposing options, then
+ dnl we run the default mode handler for the pair. For example, if neither
+ dnl `shared' nor `disable-shared' was passed, we enable building of shared
+ dnl archives by default:
+ _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+ _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+ [_LT_ENABLE_FAST_INSTALL])
+ ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS], [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+ _LT_DECL([build_libtool_libs], [enable_shared], [0],
+ [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+ _LT_DECL([build_old_libs], [enable_static], [0],
+ [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+ [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+ [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+ [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+ [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+ [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+ [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+ [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+ [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/src/m4/ltsugar.m4 b/src/m4/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/src/m4/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+ [$#], [2], [[$2]],
+ [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+ [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+ m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [lt_append([$1], [$2], [$3])$4],
+ [$5])],
+ [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+ m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+ m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+ [$5],
+ [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+ [lt_join(m4_quote(m4_default([$4], [[, ]])),
+ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+ [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/src/m4/ltversion.m4 b/src/m4/ltversion.m4
new file mode 100644
index 0000000..07a8602
--- /dev/null
+++ b/src/m4/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers -*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/src/m4/lt~obsolete.m4 b/src/m4/lt~obsolete.m4
new file mode 100644
index 0000000..c573da9
--- /dev/null
+++ b/src/m4/lt~obsolete.m4
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else. This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
diff --git a/src/m4/optional-fmt.m4 b/src/m4/optional-fmt.m4
new file mode 100644
index 0000000..d0623c8
--- /dev/null
+++ b/src/m4/optional-fmt.m4
@@ -0,0 +1,49 @@
+dnl SoX autoconf macro: optional format (c) 2009 robs@users.sourceforge.net
+dnl
+dnl This program is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the
+dnl Free Software Foundation; either version 2 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+dnl Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License along
+dnl with this program; if not, write to the Free Software Foundation, Inc.,
+dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl $1 package name e.g. flac
+dnl $2 package name in conditionals e.g. FLAC
+dnl $3 using check
+
+AC_DEFUN([AC_OPTIONAL_FORMAT],
+ [AC_ARG_WITH($1, AC_HELP_STRING([--with-$1=dyn], [load $1 dynamically]))
+ using_$1=$with_$1
+ if test "_$with_$1" = _dyn; then
+ if test $using_libltdl != yes; then
+ AC_MSG_FAILURE([not using libltdl; cannot load $1 dynamically])
+ fi
+ elif test "_$with_$1" = _; then
+ using_$1=$opt_default
+ elif test "_$with_$1" != _yes -a "_$with_$1" != _no; then
+ AC_MSG_FAILURE([invalid selection --with-$1=$with_$1])
+ fi
+ if test _$with_$1 != _no; then
+ $3
+ if test _$with_$1 != _ -a $using_$1 = no; then
+ AC_MSG_FAILURE([cannot find $1])
+ fi
+ fi
+ if test "$using_$1" != no; then
+ AC_DEFINE(HAVE_$2, 1, [Define to 1 if you have $1.])
+ if test "$using_$1" = yes; then
+ AC_DEFINE(STATIC_$2, 1, [Define to 1 if you have static $1.])
+ fi
+ fi
+ AM_CONDITIONAL(HAVE_$2, test $using_$1 != no)
+ AM_CONDITIONAL(STATIC_$2, test $using_$1 = yes)
+ AC_SUBST($2_CFLAGS)
+ AC_SUBST($2_LIBS)]
+)
diff --git a/src/m4/sndfile.m4 b/src/m4/sndfile.m4
new file mode 100644
index 0000000..8724d69
--- /dev/null
+++ b/src/m4/sndfile.m4
@@ -0,0 +1,67 @@
+dnl SOX_PATH_SNDFILE
+dnl Based off of shout.m4 from xiph package.
+dnl cbagwell@users.sourceforge.net 1-3-2007
+dnl
+dnl Original Authors:
+dnl Jack Moffitt <jack@icecast.org> 08-06-2001
+dnl Rewritten for libshout 2
+dnl Brendan Cully <brendan@xiph.org> 20030612
+dnl
+# SOX_PATH_SNDFILE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+# Test for libsndfile, and define SNDFILE_CFLAGS and SNDFILE_LIBS
+AC_DEFUN([SOX_PATH_SNDFILE],
+[dnl
+# Step 1: Use pkg-config if available
+m4_ifdef([PKG_CHECK_MODULES],
+ [# PKG_CHECK_MODULES available
+ PKG_CHECK_MODULES(SNDFILE, sndfile, have_sndfile="maybe",
+ have_sndfile="no")],
+ [# Step 2: use pkg-config manually if available
+ AC_PATH_PROG([PKGCONFIG], [pkg-config], [none])
+ if test "$PKGCONFIG" != "none" && `$PKGCONFIG --exists sndfile`
+ then
+ SNDFILE_CFLAGS=`$PKGCONFIG --cflags sndfile`" $ac_save_SNDFILE_CFLAGS $SNDFILE_CFLAGS"
+ SNDFILE_LIBS=`$PKGCONFIG --libs sndfile`" $ac_save_SNDFILE_LIBS $SNDFILE_LIBS"
+ have_sndfile="maybe"
+ else
+ have_sndfile="no"
+ fi
+ ])
+
+# Step 3: Even if pkg-config says its not installed, user may have
+# manually installed libraries with no -kg-config support.
+if test "$have_sndfile" = "no"
+then
+ # As a last resort, just hope that header and ilbrary can
+ # be found in default paths and that it doesn't need
+ # to link against any other libraries.
+ SNDFILE_LIBS="-lsndfile $SNDFILE_LIBS"
+ have_sndfile="maybe"
+fi
+
+# Even if pkg-config or similar told us how to find library,
+# do a safety check.
+if test "$have_sndfile" != "no"
+then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $SNDFILE_CFLAGS"
+ LIBS="$LIBS $SNDFILE_LIBS"
+ AC_CHECK_HEADER([sndfile.h], [
+ AC_DEFINE([HAVE_SNDFILE_H], 1, [Define if you have <sndfile.h>])
+ AC_CHECK_FUNC([sf_open_virtual], [
+ ifelse([$1], , :, [$1])
+ have_sndfile="yes"
+ ])
+ AC_CHECK_DECL([SF_FORMAT_OGG], AC_DEFINE([HAVE_SNDFILE_1_0_18], 1, [Define if you have libsndfile >= 1.0.18]),, [#include <sndfile.h>])
+ AC_CHECK_DECL([SFC_SET_SCALE_INT_FLOAT_WRITE], AC_DEFINE([HAVE_SFC_SET_SCALE_INT_FLOAT_WRITE], 1, [Define if you have libsndfile with SFC_SFC_SET_SCALE_INT_FLOAT_WRITE]),, [#include <sndfile.h>])
+ ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+fi
+
+if test "$have_sndfile" != "yes"
+then
+ ifelse([$2], , :, [$2])
+fi
+])dnl SOX_PATH_SNDFILE
diff --git a/src/missing b/src/missing
new file mode 100755
index 0000000..db98974
--- /dev/null
+++ b/src/missing
@@ -0,0 +1,215 @@
+#! /bin/sh
+# Common wrapper for a few potentially missing GNU programs.
+
+scriptversion=2013-10-28.13; # UTC
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# 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, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+fi
+
+case $1 in
+
+ --is-lightweight)
+ # Used by our autoconf macros to check whether the available missing
+ # script is modern enough.
+ exit 0
+ ;;
+
+ --run)
+ # Back-compat with the calling convention used by older automake.
+ shift
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal autoconf autoheader autom4te automake makeinfo
+ bison yacc flex lex help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch. This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+ msg="probably too old"
+elif test $st -eq 127; then
+ # Program was missing.
+ msg="missing on your system"
+else
+ # Program was found and executed, but failed. Give up.
+ exit $st
+fi
+
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+ case $1 in
+ aclocal|automake)
+ echo "The '$1' program is part of the GNU Automake package:"
+ echo "<$gnu_software_URL/automake>"
+ echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/autoconf>"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ autoconf|autom4te|autoheader)
+ echo "The '$1' program is part of the GNU Autoconf package:"
+ echo "<$gnu_software_URL/autoconf/>"
+ echo "It also requires GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ esac
+}
+
+give_advice ()
+{
+ # Normalize program name to check for.
+ normalized_program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+ printf '%s\n' "'$1' is $msg."
+
+ configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+ case $normalized_program in
+ autoconf*)
+ echo "You should only need it if you modified 'configure.ac',"
+ echo "or m4 files included by it."
+ program_details 'autoconf'
+ ;;
+ autoheader*)
+ echo "You should only need it if you modified 'acconfig.h' or"
+ echo "$configure_deps."
+ program_details 'autoheader'
+ ;;
+ automake*)
+ echo "You should only need it if you modified 'Makefile.am' or"
+ echo "$configure_deps."
+ program_details 'automake'
+ ;;
+ aclocal*)
+ echo "You should only need it if you modified 'acinclude.m4' or"
+ echo "$configure_deps."
+ program_details 'aclocal'
+ ;;
+ autom4te*)
+ echo "You might have modified some maintainer files that require"
+ echo "the 'autom4te' program to be rebuilt."
+ program_details 'autom4te'
+ ;;
+ bison*|yacc*)
+ echo "You should only need it if you modified a '.y' file."
+ echo "You may want to install the GNU Bison package:"
+ echo "<$gnu_software_URL/bison/>"
+ ;;
+ lex*|flex*)
+ echo "You should only need it if you modified a '.l' file."
+ echo "You may want to install the Fast Lexical Analyzer package:"
+ echo "<$flex_URL>"
+ ;;
+ help2man*)
+ echo "You should only need it if you modified a dependency" \
+ "of a man page."
+ echo "You may want to install the GNU Help2man package:"
+ echo "<$gnu_software_URL/help2man/>"
+ ;;
+ makeinfo*)
+ echo "You should only need it if you modified a '.texi' file, or"
+ echo "any other file indirectly affecting the aspect of the manual."
+ echo "You might want to install the Texinfo package:"
+ echo "<$gnu_software_URL/texinfo/>"
+ echo "The spurious makeinfo call might also be the consequence of"
+ echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+ echo "want to install GNU make:"
+ echo "<$gnu_software_URL/make/>"
+ ;;
+ *)
+ echo "You might have modified some files without having the proper"
+ echo "tools for further handling them. Check the 'README' file, it"
+ echo "often tells you about the needed prerequisites for installing"
+ echo "this package. You may also peek at any GNU archive site, in"
+ echo "case some other package contains this missing '$1' program."
+ ;;
+ esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+ -e '2,$s/^/ /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/src/scripts/batch-example.bat b/src/scripts/batch-example.bat
new file mode 100644
index 0000000..65d8876
--- /dev/null
+++ b/src/scripts/batch-example.bat
@@ -0,0 +1,14 @@
+rem Example of how to do batch processing with SoX on MS-Windows.
+rem
+rem Place this file in the same folder as sox.exe (& rename it as appropriate).
+rem You can then drag and drop a selection of files onto the batch file (or
+rem onto a `short-cut' to it).
+rem
+rem In this example, the converted files end up in a folder called `converted',
+rem but this, of course, can be changed, as can the parameters to the sox
+rem command.
+
+cd %~dp0
+mkdir converted
+FOR %%A IN (%*) DO sox %%A "converted/%%~nxA" rate -v 44100
+pause
diff --git a/src/sox.1 b/src/sox.1
new file mode 100644
index 0000000..2c4ca47
--- /dev/null
+++ b/src/sox.1
@@ -0,0 +1,4255 @@
+'\" t
+'\" The line above instructs most `man' programs to invoke tbl
+'\"
+'\" Separate paragraphs; not the same as PP which resets indent level.
+.de SP
+.if t .sp .5
+.if n .sp
+..
+'\"
+'\" Replacement em-dash for nroff (default is too short).
+.ie n .ds m " -
+.el .ds m \(em
+'\"
+'\" Placeholder macro for if longer nroff arrow is needed.
+.ds RA \(->
+'\"
+'\" Decimal point set slightly raised
+.if t .ds d \v'-.15m'.\v'+.15m'
+.if n .ds d .
+'\"
+'\" Enclosure macro for examples
+.de EX
+.SP
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.SP
+.fi
+..
+.TH SoX 1 "December 31, 2014" "sox" "Sound eXchange"
+.SH NAME
+SoX \- Sound eXchange, the Swiss Army knife of audio manipulation
+.SH SYNOPSIS
+.nf
+\fBsox\fR [\fIglobal-options\fR] [\fIformat-options\fR] \fIinfile1\fR
+ [[\fIformat-options\fR] \fIinfile2\fR] ... [\fIformat-options\fR] \fIoutfile\fR
+ [\fIeffect\fR [\fIeffect-options\fR]] ...
+.SP
+\fBplay\fR [\fIglobal-options\fR] [\fIformat-options\fR] \fIinfile1\fR
+ [[\fIformat-options\fR] \fIinfile2\fR] ... [\fIformat-options\fR]
+ [\fIeffect\fR [\fIeffect-options\fR]] ...
+.SP
+\fBrec\fR [\fIglobal-options\fR] [\fIformat-options\fR] \fIoutfile\fR
+ [\fIeffect\fR [\fIeffect-options\fR]] ...
+.fi
+.SH DESCRIPTION
+.SS Introduction
+SoX reads and writes audio files in most popular formats and can
+optionally apply effects to them. It can combine multiple input
+sources, synthesise audio, and, on many systems, act as a general
+purpose audio player or a multi-track audio recorder. It also has
+limited ability to split the input into multiple output files.
+.SP
+All SoX functionality is available using just the \fBsox\fR command.
+To simplify playing and recording audio, if SoX is invoked as
+\fBplay\fR, the output file is automatically set to be the default sound
+device, and if invoked as \fBrec\fR, the default sound device is used as an
+input source.
+Additionally, the
+.BR soxi (1)
+command provides a convenient way to just query audio file header information.
+.SP
+The heart of SoX is a library called libSoX. Those interested in
+extending SoX or using it in other programs should refer to the libSoX
+manual page:
+.BR libsox (3).
+.SP
+SoX is a command-line audio processing tool, particularly suited to making
+quick, simple edits and to batch processing.
+If you need an interactive, graphical audio editor, use
+.BR audacity (1).
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+The overall SoX processing chain can be summarised as follows:
+.TS
+center;
+l.
+Input(s) \*(RA Combiner \*(RA Effects \*(RA Output(s)
+.TE
+.DT
+.SP
+Note however, that on the SoX command line, the positions of the
+Output(s) and the Effects are swapped w.r.t. the logical flow just
+shown. Note also that whilst options pertaining to files are placed
+before their respective file name, the opposite is true for effects.
+To show how this works in practice, here is a selection of examples of
+how SoX might be used. The simple
+.EX
+ sox recital.au recital.wav
+.EE
+translates an audio file in Sun AU format to a Microsoft WAV file, whilst
+.EX
+ sox recital.au \-b 16 recital.wav channels 1 rate 16k fade 3 norm
+.EE
+performs the same format translation, but also applies four effects
+(down-mix to one channel, sample rate change, fade-in, nomalize),
+and stores the result at a bit-depth of 16.
+.EX
+ sox \-r 16k \-e signed \-b 8 \-c 1 voice-memo.raw voice-memo.wav
+.EE
+converts `raw' (a.k.a. `headerless') audio to a self-describing file format,
+.EX
+ sox slow.aiff fixed.aiff speed 1.027
+.EE
+adjusts audio speed,
+.EX
+ sox short.wav long.wav longer.wav
+.EE
+concatenates two audio files, and
+.EX
+ sox \-m music.mp3 voice.wav mixed.flac
+.EE
+mixes together two audio files.
+.EX
+ play \(dqThe Moonbeams/Greatest/*.ogg\(dq bass +3
+.EE
+plays a collection of audio files whilst applying a bass boosting effect,
+.EX
+ play \-n \-c1 synth sin %\-12 sin %\-9 sin %\-5 sin %\-2 fade h 0.1 1 0.1
+.EE
+plays a synthesised `A minor seventh' chord with a pipe-organ sound,
+.EX
+ rec \-c 2 radio.aiff trim 0 30:00
+.EE
+records half an hour of stereo audio, and
+.EX
+ play \-q take1.aiff & rec \-M take1.aiff take1\-dub.aiff
+.EE
+(with POSIX shell and where supported by hardware)
+records a new track in a multi-track recording. Finally,
+.EX
+.ne 3
+ rec \-r 44100 \-b 16 \-e signed-integer \-p \\
+ silence 1 0.50 0.1% 1 10:00 0.1% | \\
+ sox \-p song.ogg silence 1 0.50 0.1% 1 2.0 0.1% : \\
+ newfile : restart
+.EE
+records a stream of audio such as LP/cassette and splits in to multiple
+audio files at points with 2 seconds of silence. Also, it does not start
+recording until it detects audio is playing and stops after it sees
+10 minutes of silence.
+.SP
+N.B. The above is just an overview of SoX's capabilities; detailed
+explanations of how to use \fIall\fR SoX parameters, file formats, and
+effects can be found below in this manual, in
+.BR soxformat (7),
+and in
+.BR soxi (1).
+.SS File Format Types
+SoX can work with `self-describing' and `raw' audio files.
+`self-describing' formats (e.g. WAV, FLAC, MP3) have a header that
+completely describes the signal and encoding attributes of the audio
+data that follows. `raw' or `headerless' formats do not contain this
+information, so the audio characteristics of these must be described
+on the SoX command line or inferred from those of the input file.
+.SP
+The following four characteristics are used to describe the format of
+audio data such that it can be processed with SoX:
+.TP
+sample rate
+The sample rate in samples per second (`Hertz' or `Hz').
+Digital telephony traditionally uses a sample rate of 8000\ Hz (8\ kHz),
+though these days, 16 and even 32\ kHz are becoming more common. Audio
+Compact Discs use 44100\ Hz (44\*d1\ kHz). Digital Audio Tape and many
+computer systems use 48\ kHz. Professional audio systems often use 96
+kHz.
+.TP
+sample size
+The number of bits used to store each sample. Today, 16-bit is
+commonly used. 8-bit was popular in the early days of computer
+audio. 24-bit is used in the professional audio arena. Other sizes are
+also used.
+.TP
+data encoding
+The way in which each audio sample is represented (or `encoded'). Some
+encodings have variants with different byte-orderings or bit-orderings.
+Some compress the audio data so that the stored audio data takes up less
+space (i.e. disk space or transmission bandwidth) than the other format
+parameters and the number of samples would imply. Commonly-used
+encoding types include floating-point, \(*m-law, ADPCM, signed-integer
+PCM, MP3, and FLAC.
+.TP
+channels
+The number of audio channels contained in the file. One (`mono') and
+two (`stereo') are widely used. `Surround sound' audio typically
+contains six or more channels.
+.PP
+The term `bit-rate' is a measure of the amount of storage occupied by an
+encoded audio signal over a unit of time. It can depend on all of the
+above and is typically denoted as a number of kilo-bits per second
+(kbps). An A-law telephony signal has a bit-rate of 64 kbps. MP3-encoded
+stereo music typically has a bit-rate of 128\-196 kbps. FLAC-encoded
+stereo music typically has a bit-rate of 550\-760 kbps.
+.SP
+Most self-describing formats also allow textual `comments' to be
+embedded in the file that can be used to describe the audio in some way,
+e.g. for music, the title, the author, etc.
+.SP
+One important use of audio file comments is to convey `Replay Gain'
+information. SoX supports applying Replay Gain information (for certain
+input file formats only; currently, at least FLAC and Ogg Vorbis), but not
+generating it. Note that by default, SoX copies input file comments
+to output files that support comments, so output files may contain
+Replay Gain information if some was present in the input file. In this
+case, if anything other than a simple format conversion was performed
+then the output file Replay Gain information is likely to be incorrect
+and so should be recalculated using a tool that supports this (not SoX).
+.SP
+The
+.BR soxi (1)
+command can be used to display information from audio file headers.
+.SS Determining & Setting The File Format
+There are several mechanisms available for SoX to use to determine or set the
+format characteristics of an audio file. Depending on the circumstances,
+individual characteristics may be determined or set using different mechanisms.
+.SP
+To determine the format of an input file, SoX will use, in order of
+precedence and as given or available:
+.IP 1. 4
+Command-line format options.
+.IP 2. 4
+The contents of the file header.
+.IP 3. 4
+The filename extension.
+.PP
+To set the output file format, SoX will use, in order of
+precedence and as given or available:
+.IP 1. 4
+Command-line format options.
+.IP 2. 4
+The filename extension.
+.IP 3. 4
+The input file format characteristics, or the closest
+that is supported by the output file type.
+.PP
+For all files, SoX will exit with an error
+if the file type cannot be determined. Command-line format options may
+need to be added or changed to resolve the problem.
+.SS Playing & Recording Audio
+The
+.B play
+and
+.B rec
+commands are provided so that basic playing and
+recording is as simple as
+.EX
+ play existing-file.wav
+.EE
+and
+.EX
+ rec new-file.wav
+.EE
+These two commands are functionally equivalent to
+.EX
+ sox existing-file.wav \-d
+.EE
+and
+.EX
+ sox \-d new-file.wav
+.EE
+Of course, further options and effects (as described below) can be
+added to the commands in either form.
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+Some systems provide more than one type of (SoX-compatible) audio
+driver, e.g. ALSA & OSS, or SUNAU & AO.
+Systems can also have more than one audio device (a.k.a. `sound card').
+If more than one audio driver has been
+built-in to SoX, and the default selected by SoX when recording or playing
+is not the one that is wanted, then the
+.B AUDIODRIVER
+environment variable can be used to override the default. For example
+(on many systems):
+.EX
+ set AUDIODRIVER=oss
+ play ...
+.EE
+The
+.B AUDIODEV
+environment variable can be used to override the default audio device,
+e.g.
+.EX
+ set AUDIODEV=/dev/dsp2
+ play ...
+ sox ... \-t oss
+.EE
+or
+.EX
+ set AUDIODEV=hw:soundwave,1,2
+ play ...
+ sox ... \-t alsa
+.EE
+Note that the way of setting environment variables varies from system
+to system\*mfor some specific examples, see `SOX_OPTS' below.
+.SP
+When playing a file with a sample rate that is not supported by the
+audio output device, SoX will automatically invoke the \fBrate\fR effect
+to perform the necessary sample rate conversion. For
+compatibility with old hardware, the
+default \fBrate\fR quality level is set to `low'. This
+can be changed by explicitly specifying the \fBrate\fR
+effect with a different quality level, e.g.
+.EX
+ play ... rate \-m
+.EE
+or by using the
+.B \-\-play\-rate\-arg
+option (see below).
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+On some systems, SoX allows audio playback volume to be adjusted whilst
+using
+.BR play .
+Where supported, this is achieved by tapping the `v' & `V' keys during
+playback.
+.SP
+To help with setting a suitable recording level, SoX includes a peak-level
+meter which can be invoked (before making the actual recording) as follows:
+.EX
+ rec \-n
+.EE
+The recording level should be adjusted (using the system-provided mixer
+program, not SoX) so that the meter is \fIat most occasionally\fR full
+scale, and never `in the red' (an exclamation mark is shown).
+See also \fB\-S\fR below.
+.SS Accuracy
+Many file formats that compress audio discard some of the audio signal
+information whilst doing so. Converting to such a format and then converting
+back again will not produce an exact copy of the original audio. This
+is the case for many formats used in telephony (e.g. A-law, GSM) where
+low signal bandwidth is more important than high audio fidelity, and for
+many formats used in portable music players (e.g. MP3, Vorbis) where
+adequate fidelity can be retained even with the large compression ratios
+that are needed to make portable players practical.
+.SP
+Formats that discard audio signal information are called `lossy'.
+Formats that do not are called `lossless'. The term `quality' is used as a
+measure of how closely the original audio signal can be reproduced when
+using a lossy format.
+.SP
+Audio file conversion with SoX is lossless when it can be, i.e. when not
+using lossy compression, when not reducing the sampling rate or number
+of channels, and when the number of bits used in the destination format
+is not less than in the source format. E.g. converting from an 8-bit
+PCM format to a 16-bit PCM format is lossless but converting from an
+8-bit PCM format to (8-bit) A-law isn't.
+.SP
+.B N.B.
+SoX converts all audio files to an internal uncompressed
+format before performing any audio processing. This means that
+manipulating a file that is stored in a lossy format can cause further
+losses in audio fidelity. E.g. with
+.EX
+ sox long.mp3 short.mp3 trim 10
+.EE
+SoX first decompresses the input MP3 file, then applies the
+.B trim
+effect, and finally creates the output MP3 file by re-compressing the
+audio\*mwith a possible reduction in fidelity above that which
+occurred when the input file was created.
+Hence, if what is ultimately desired is lossily compressed audio, it is
+highly recommended to perform all audio processing using lossless file
+formats and then convert to the lossy format only at the final stage.
+.SP
+.B N.B.
+Applying multiple effects with a single SoX invocation will,
+in general, produce more accurate results than those produced using
+multiple SoX invocations.
+.SS Dithering
+Dithering is a technique used to maximise the dynamic range of audio
+stored at a particular bit-depth. Any distortion introduced by
+quantisation is decorrelated by adding a small amount of white noise
+to the signal. In most cases, SoX can determine whether the selected
+processing requires dither and will add it during output formatting if
+appropriate.
+.SP
+Specifically, by default, SoX automatically adds TPDF dither
+when the output bit-depth is less than 24 and any
+of the following are true:
+.IP \(bu 4
+bit-depth reduction has been specified explicitly using a command-line
+option
+.IP \(bu 4
+the output file format supports only bit-depths lower than that of the
+input file format
+.IP \(bu 4
+an effect has increased effective bit-depth within the internal
+processing chain
+.PP
+For example, adjusting volume with
+.B vol 0.25
+requires two additional bits in which to losslessly store its results
+(since 0\*d25 decimal equals 0\*d01 binary). So if the input file
+bit-depth is 16, then SoX's internal representation will utilise 18
+bits after processing this volume change. In order to store the
+output at the same depth as the input, dithering is used to remove the
+additional bits.
+.SP
+Use the
+.B \-V
+option to see what processing SoX has automatically added. The
+.B \-D
+option may be given to override automatic dithering. To invoke
+dithering manually (e.g. to select a noise-shaping curve), see the
+.B dither
+effect.
+.SS Clipping
+Clipping is distortion that occurs when an audio signal level (or
+`volume') exceeds the range of the chosen representation. In most
+cases, clipping is undesirable and so should be corrected by adjusting
+the level prior to the point (in the processing chain) at which it
+occurs.
+.SP
+In SoX, clipping could occur, as you might expect, when using the
+.B vol
+or
+.B gain
+effects to increase the audio volume. Clipping could also occur with many
+other effects, when converting one format to another, and even when
+simply playing the audio.
+.SP
+Playing an audio file often involves resampling, and processing by
+analogue components can introduce a small DC offset and/or
+amplification, all of which can produce distortion if the audio signal
+level was initially too close to the clipping point.
+.SP
+For these reasons, it is usual to make sure that an audio
+file's signal level has some `headroom', i.e. it does not exceed a particular
+level below the maximum possible level for the given representation.
+Some standards bodies recommend as much as 9dB headroom, but in most cases,
+3dB (\(~~ 70% linear) is enough. Note that this wisdom
+seems to have been lost in modern music production; in fact, many CDs,
+MP3s, etc. are now mastered at levels \fIabove\fR 0dBFS i.e. the
+audio is clipped as delivered.
+.SP
+SoX's
+.B stat
+and
+.B stats
+effects can assist in determining the signal level in an audio file. The
+.B gain
+or
+.B vol
+effect can be used to prevent clipping, e.g.
+.EX
+ sox dull.wav bright.wav gain \-6 treble +6
+.EE
+guarantees that the treble boost will not clip.
+.SP
+If clipping occurs at any point during processing,
+SoX will display a warning message to that effect.
+.SP
+See also
+.B \-G
+and the
+.B gain
+and
+.B norm
+effects.
+.SS Input File Combining
+SoX's input combiner can be configured (see OPTIONS below) to
+combine multiple files using any of the
+following methods: `concatenate', `sequence', `mix', `mix-power',
+`merge', or `multiply'.
+The default method is `sequence' for
+.BR play ,
+and `concatenate' for
+.B rec
+and
+.BR sox .
+.SP
+For all methods other than `sequence', multiple input files must have
+the same sampling rate. If necessary, separate SoX invocations can be
+used to make sampling rate adjustments prior to combining.
+.SP
+If the `concatenate' combining method is selected (usually, this will be
+by default) then the input files must also have the same number of
+channels. The audio from each input will be concatenated in the order
+given to form the output file.
+.SP
+The `sequence' combining method is selected automatically for
+.BR play .
+It is similar to `concatenate' in that the audio from each input file is
+sent serially to the output file. However, here the output file may be
+closed and reopened at the corresponding transition between input
+files. This may be just what is needed when sending different types of
+audio to an output device, but is not generally useful when the output is a
+normal file.
+.SP
+If either the `mix' or `mix-power' combining method is selected then two or
+more input files must be given and will be mixed together to form the
+output file. The number of channels in each input file need not be the
+same, but SoX will issue a warning if they are not and some
+channels in the output file will not contain audio from every input
+file. A mixed audio file cannot be un-mixed without reference to the
+original input files.
+.SP
+If the `merge' combining method is selected then two or
+more input files must be given and will be merged together to form the
+output file. The number of channels in each input file need not be the
+same. A merged audio file comprises all of the channels from all of the
+input files. Un-merging is possible using multiple
+invocations of SoX with the
+.B remix
+effect.
+For example, two mono files could be merged to form one stereo file. The
+first and second mono files would become the left and right channels of
+the stereo file.
+.SP
+The `multiply' combining method multiplies the sample values of
+corresponding channels (treated as numbers in the interval \-1 to +1).
+If the number of channels in the input files is not the same, the
+missing channels are considered to contain all zero.
+.SP
+When combining input files, SoX applies any specified effects
+(including, for example, the
+.B vol
+volume adjustment effect) after the audio has been combined. However, it
+is often useful to be able to set the volume of (i.e. `balance') the
+inputs individually, before combining takes place.
+.SP
+For all combining methods, input
+file volume adjustments can be made manually using the
+.B \-v
+option (below) which can be given for one or more input files. If it is
+given for only some of the input files then the others receive no volume
+adjustment. In some circumstances, automatic volume
+adjustments may be applied (see below).
+.SP
+The \fB\-V\fR option (below) can be used to show the input file volume
+adjustments that have been selected (either manually or automatically).
+.SP
+There are some special considerations that need to made when mixing
+input files:
+.SP
+Unlike the other methods, `mix' combining has the
+potential to cause clipping in the combiner if no balancing is
+performed. In this case, if manual volume adjustments are not given,
+SoX will try to ensure that clipping does not occur by automatically
+adjusting the
+volume (amplitude) of each input signal by a factor of \(S1/\s-2n\s+2,
+where n is the number of input files. If this results in audio that is
+too quiet or otherwise unbalanced then the input file volumes can be
+set manually as described above. Using the
+.B norm
+effect on the mix is another alternative.
+.SP
+If mixed audio seems loud enough at some points but
+too quiet in others then dynamic range compression should be applied to
+correct this\*msee the
+.B compand
+effect.
+.SP
+With the `mix-power' combine method, the
+mixed volume is approximately equal to that of one of the input signals.
+This is achieved by balancing using a factor of
+\(S1/\s-2\(srn\s+2 instead of \(S1/\s-2n\s+2.
+Note that this balancing factor does not guarantee that clipping will not occur,
+but the number of clips will usually be low and the resultant
+distortion is generally imperceptible.
+.SS Output Files
+SoX's default behaviour is to take one or more input files and
+write them to a single output file.
+
+This behaviour can be changed by specifying the pseudo-effect `newfile'
+within the effects list. SoX will then enter multiple output mode.
+
+In multiple output mode, a new file is created when the effects
+prior to the `newfile' indicate they are done.
+The effects chain listed after `newfile'
+is then started up and its output is saved to the new file.
+
+In multiple output mode, a unique number will automatically be appended
+to the end of all filenames. If the filename has an extension
+then the number is inserted before the extension. This behaviour can
+be customized by placing a %n anywhere in the filename where the
+number should be substituted. An optional number can be placed after
+the % to indicate a minimum fixed width for the number.
+
+Multiple output mode is not very useful unless an effect that will
+stop the effects chain early is
+specified before the `newfile'. If end of file is
+reached before the effects chain stops itself then no new file
+will be created as it would be empty.
+
+The following is an example of splitting the first 60 seconds of an input
+file into two 30 second files and ignoring the rest.
+.EX
+ sox song.wav ringtone%1n.wav trim 0 30 : newfile : trim 0 30
+.SS Stopping SoX
+Usually SoX will complete its processing and exit automatically once
+it has read all available audio data from the input files.
+.SP
+If desired, it can be terminated earlier by sending an
+interrupt signal to the process (usually by pressing the
+keyboard interrupt key which is normally Ctrl-C). This is a natural requirement
+in some circumstances, e.g. when using SoX to make a recording. Note
+that when using SoX to play multiple files, Ctrl-C behaves slightly
+differently: pressing it once causes SoX to skip to the next file;
+pressing it twice in quick succession causes SoX to exit.
+.SP
+Another option to stop processing early is to use an effect that
+has a time period or sample count to determine the stopping
+point. The trim effect is an example of this. Once all
+effects chains have stopped then SoX will also stop.
+.SH FILENAMES
+Filenames can be simple file names, absolute or relative path names,
+or URLs (input files only). Note that URL support requires that
+.BR wget (1)
+is available.
+.SP
+Note:
+Giving SoX an input or output filename that is the same as a SoX
+effect-name will not work since SoX will treat it as an effect
+specification. The only work-around to this is to avoid such
+filenames. This is generally not difficult since most audio
+filenames have a filename `extension', whilst effect-names do not.
+.SS Special Filenames
+The following special filenames may be used in certain circumstances
+in place of a normal filename on the command line:
+.TP
+\fB\-\fR
+SoX can be used in simple pipeline operations by using the special
+filename `\-' which,
+if used as an input filename, will cause
+SoX will read audio data from `standard input' (stdin),
+and which,
+if used as the output filename, will cause
+SoX will send audio data to `standard output' (stdout).
+Note that when using this option for the output file, and sometimes
+when using it for an input file, the file-type (see
+.B \-t
+below) must also be given.
+.TP
+\fB\(dq\^|\^\fIprogram \fR[\fIoptions\fR] ...\fB\(dq\fR
+This can be used in place of an input filename to specify the
+the given program's standard output (stdout) be used as an input file.
+Unlike
+.B \-
+(above), this can be used for several inputs to one SoX command. For
+example, if `genw' generates mono WAV formatted signals to its
+standard output, then the following command makes a stereo file
+from two generated signals:
+.EX
+ sox \-M "|genw \-\-imd \-" "|genw \-\-thd \-" out.wav
+.EE
+For headerless (raw) audio,
+.B \-t
+(and perhaps other format options) will need to be given, preceding the input
+command.
+.TP
+\fB\(dq\fIwildcard-filename\fB\(dq\fR
+Specifies that filename `globbing' (wild-card matching) should be performed
+by SoX instead of by the shell. This allows a single set of file options to be
+applied to a group of files. For example, if the current directory contains
+three `vox' files, file1.vox, file2.vox, and file3.vox, then
+.EX
+ play \-\-rate 6k *.vox
+.EE
+will be expanded by the `shell' (in most environments) to
+.EX
+ play \-\-rate 6k file1.vox file2.vox file3.vox
+.EE
+which will treat only the first vox file as having a sample rate of 6k.
+With
+.EX
+ play \-\-rate 6k "*.vox"
+.EE
+the given sample rate option will be applied to all three vox files.
+.TP
+\fB\-p\fR, \fB\-\-sox\-pipe\fR
+This can be used in place of an output filename to specify that
+the SoX command should be used as in input pipe to another SoX command.
+For example, the command:
+.EX
+ play "|sox \-n \-p synth 2" "|sox \-n \-p synth 2 tremolo 10" stat
+.EE
+plays two `files' in succession, each with different effects.
+.SP
+.B \-p
+is in fact an alias for `\fB\-t sox \-\fR'.
+.TP
+\fB\-d\fR, \fB\-\-default\-device\fR
+This can be used in place of an input or output filename to specify that
+the default audio device (if one has been built into SoX) is to be used.
+This is akin to invoking
+.B rec
+or
+.B play
+(as described above).
+.TP
+\fB\-n\fR, \fB\-\-null\fR
+This can be used in place of an input or output filename to specify that
+a `null file' is to be used. Note that here, `null file' refers to a
+SoX-specific mechanism and is not related to any operating-system
+mechanism with a similar name.
+.SP
+Using a null file to input audio is equivalent to
+using a normal audio file that contains an infinite amount
+of silence, and as such is not generally useful unless used
+with an effect that specifies a finite time length
+(such as \fBtrim\fR or \fBsynth\fR).
+.SP
+Using a null file to output audio amounts to discarding the audio
+and is useful mainly with effects that produce information about the
+audio instead of affecting it (such as \fBnoiseprof\fR or \fBstat\fR).
+.SP
+The sampling rate associated with a null file
+is by default 48\ kHz, but, as with a normal
+file, this can be overridden if desired using command-line format
+options (see below).
+.SS Supported File & Audio Device Types
+See
+.BR soxformat (7)
+for a list and description of the supported file formats and audio device
+drivers.
+.SH OPTIONS
+.SS Global Options
+These options can be specified on the command line at any point
+before the first effect name.
+.SP
+The
+.B SOX_OPTS
+environment variable can be used to provide alternative default values for
+SoX's global options.
+For example:
+.EX
+ SOX_OPTS="\-\-buffer 20000 \-\-play\-rate\-arg \-hs \-\-temp /mnt/temp"
+.EE
+Note that setting SOX_OPTS can potentially create unwanted changes in
+the behaviour of scripts or other programs that invoke SoX. SOX_OPTS
+might best be used for things (such as in the given example) that reflect the
+environment in which SoX is being run. Enabling options such as
+.B \-\-no\-clobber
+as default might be handled better using a shell alias
+since a shell alias will not affect operation in scripts etc.
+.SP
+One way to ensure that a script cannot be affected by SOX_OPTS is to
+clear SOX_OPTS at the start of the script, but this of course loses
+the benefit of SOX_OPTS carrying some system-wide default options. An
+alternative approach is to explicitly invoke SoX with default
+option values, e.g.
+.EX
+ SOX_OPTS="\-V \-\-no-clobber"
+ ...
+ sox \-V2 \-\-clobber $input $output ...
+.EE
+Note that the way to set environment variables varies from system
+to system. Here are some examples:
+.SP
+Unix bash:
+.EX
+ export SOX_OPTS="\-V \-\-no-clobber"
+.EE
+Unix csh:
+.EX
+ setenv SOX_OPTS "\-V \-\-no-clobber"
+.EE
+MS-DOS/MS-Windows:
+.EX
+ set SOX_OPTS=\-V \-\-no-clobber
+.EE
+MS-Windows GUI: via Control Panel : System : Advanced : Environment
+Variables
+.SP
+Mac OS X GUI: Refer to Apple's Technical Q&A QA1067 document.
+.TP
+\fB\-\-buffer\fR \fBBYTES\fR, \fB\-\-input\-buffer\fR \fBBYTES\fR
+Set the size in bytes of the buffers used for processing audio (default 8192).
+.B \-\-buffer
+applies to input, effects, and output processing;
+.B \-\-input\-buffer
+applies only to input processing (for which it overrides
+.B \-\-buffer
+if both are given).
+.SP
+Be aware that large values for
+.B \-\-buffer
+will cause SoX to be become slow to respond to requests to terminate or to skip
+the current input file.
+.TP
+\fB\-\-clobber\fR
+Don't prompt before overwriting an existing file with the same name as that
+given for the output file. This is the default behaviour.
+.TP
+\fB\-\-combine concatenate\fR\^|\^\fBmerge\fR\^|\^\fBmix\fR\^|\^\fBmix\-power\fR\^|\^\fBmultiply\fR\^|\^\fBsequence\fR
+Select the input file combining method;
+for some of these, short options are available:
+.B \-m
+selects `mix',
+.B \-M
+selects `merge', and
+.B \-T
+selects `multiply'.
+.SP
+See \fBInput File Combining\fR above for a description of the different
+combining methods.
+.TP
+\fB\-D\fR, \fB\-\-no\-dither\fR
+Disable automatic dither\*msee `Dithering' above. An example of why this
+might occasionally be useful is if a file has been converted from 16 to
+24 bit with the intention of doing some processing on it, but in fact
+no processing is needed after all and the original 16 bit file has
+been lost, then, strictly speaking, no dither is needed if converting the
+file back to 16 bit. See also the
+.B stats
+effect for how to determine the actual bit depth of the audio within a
+file.
+.TP
+\fB\-\-effects\-file \fIFILENAME\fR
+Use FILENAME to obtain all effects and their arguments.
+The file is parsed as if the values were specified on the
+command line. A new line can be used in place of the special \fB:\fR
+marker to separate effect chains. For convenience, such markers at the
+end of the file are normally ignored; if you want to specify an empty
+last effects chain, use an explicit \fB:\fR by itself on the last line
+of the file. This option causes any effects specified on the command
+line to be discarded.
+.TP
+\fB\-G\fR, \fB\-\-guard\fR
+Automatically invoke the
+.B gain
+effect to guard against clipping. E.g.
+.EX
+ sox \-G infile \-b 16 outfile rate 44100 dither \-s
+.EE
+is shorthand for
+.EX
+ sox infile \-b 16 outfile gain \-h rate 44100 gain \-rh dither \-s
+.EE
+See also
+.BR \-V,
+.BR \-\-norm,
+and the
+.B gain
+effect.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Show version number and usage information.
+.TP
+\fB\-\-help\-effect \fINAME\fR
+Show usage information on the specified effect. The name
+\fBall\fR can be used to show usage on all effects.
+.TP
+\fB\-\-help\-format \fINAME\fR
+Show information about the specified file format. The name
+\fBall\fR can be used to show information on all formats.
+.TP
+\fB\-\-i\fR, \fB\-\-info\fR
+Only if given as the first parameter to
+.BR sox ,
+behave as
+.BR soxi (1).
+.TP
+\fB\-m\fR\^|\^\fB\-M\fR
+Equivalent to \fB\-\-combine mix\fR and \fB\-\-combine merge\fR, respectively.
+.TP
+.B \-\-magic
+If SoX has been built with the optional `libmagic' library then this
+option can be given to enable its use in helping to detect audio file types.
+.TP
+\fB\-\-multi\-threaded\fR | \fB\-\-single\-threaded\fR
+By default, SoX is `single threaded'.
+If the \fB\-\-multi\-threaded\fR option is given however then SoX
+will process audio channels for most multi-channel
+effects in parallel on hyper-threading/multi-core architectures. This
+may reduce processing time, though sometimes it may be necessary to use
+this option in conjunction with a larger buffer size than is the default
+to gain any benefit from multi-threaded processing
+(e.g. 131072; see \fB\-\-buffer\fR above).
+.TP
+\fB\-\-no\-clobber\fR
+Prompt before overwriting an existing file with the same name as that
+given for the output file.
+.SP
+.B N.B.
+Unintentionally overwriting a file is easier than you might think, for
+example, if you accidentally enter
+.EX
+ sox file1 file2 effect1 effect2 ...
+.EE
+when what you really meant was
+.EX
+ play file1 file2 effect1 effect2 ...
+.EE
+then, without this option, file2 will be overwritten. Hence, using
+this option is recommended. SOX_OPTS (above), a `shell'
+alias, script, or batch file may be an appropriate way of permanently
+enabling it.
+.TP
+\fB\-\-norm\fR[\fB=\fIdB-level\fR]
+Automatically invoke the
+.B gain
+effect to guard against clipping and to normalise the audio. E.g.
+.EX
+ sox \-\-norm infile \-b 16 outfile rate 44100 dither \-s
+.EE
+is shorthand for
+.EX
+ sox infile \-b 16 outfile gain \-h rate 44100 gain \-nh dither \-s
+.EE
+Optionally, the audio can be normalized to a given level (usually)
+below 0 dBFS:
+.EX
+ sox \-\-norm=\-3 infile outfile
+.EE
+.SP
+See also
+.BR \-V,
+.BR \-G,
+and the
+.B gain
+effect.
+.TP
+\fB\-\-play\-rate\-arg ARG\fR
+Selects a quality option to be used when the `rate' effect is automatically
+invoked whilst playing audio. This option is typically set via the
+.B SOX_OPTS
+environment variable (see above).
+.TP
+\fB\-\-plot gnuplot\fR\^|\^\fBoctave\fR\^|\^\fBoff\fR
+If not set to
+.B off
+(the default if
+.B \-\-plot
+is not given), run in a mode that can be used, in conjunction with the
+gnuplot program or the GNU Octave program, to assist with the selection
+and configuration of many of the transfer-function based effects.
+For the first given effect that supports the selected plotting program,
+SoX will output commands to plot the effect's transfer function, and
+then exit without actually processing any audio. E.g.
+.EX
+ sox \-\-plot octave input-file \-n highpass 1320 > highpass.plt
+ octave highpass.plt
+.EE
+.TP
+\fB\-q\fR, \fB\-\-no\-show\-progress\fR
+Run in quiet mode when SoX wouldn't otherwise do so.
+This is the opposite of the \fB\-S\fR option.
+.TP
+\fB\-R\fR
+Run in `repeatable' mode. When this option is given, where
+applicable, SoX will embed a fixed time-stamp in the output file (e.g.
+\fBAIFF\fR) and will `seed' pseudo random number generators (e.g.
+\fBdither\fR) with a fixed number, thus ensuring that successive SoX
+invocations with the same inputs and the same parameters yield the
+same output.
+.TP
+\fB\-\-replay\-gain track\fR\^|\^\fBalbum\fR\^|\^\fBoff\fR
+Select whether or not to apply replay-gain adjustment to input files.
+The default is
+.B off
+for
+.B sox
+and
+.BR rec ,
+.B album
+for
+.B play
+where (at least) the first two input files are tagged with the same Artist and
+Album names, and
+.B track
+for
+.B play
+otherwise.
+.TP
+\fB\-S\fR, \fB\-\-show\-progress\fR
+Display input file format/header information, and processing progress as
+input file(s) percentage complete, elapsed time, and remaining time (if
+known; shown in brackets), and the number of samples written to the
+output file. Also shown is a peak-level meter, and an indication if
+clipping has occurred. The peak-level meter shows up to two channels
+and is calibrated for digital audio as follows (right channel shown):
+.ne 8
+.TS
+center;
+cI lI cI lI
+c l c l.
+dB FSD Display dB FSD Display
+\-25 \- \-11 ====
+\-23 T{
+=
+T} \-9 ====\-
+\-21 =\- \-7 =====
+\-19 == \-5 =====\-
+\-17 ==\- \-3 ======
+\-15 === \-1 =====!
+\-13 ===\-
+.TE
+.DT
+.SP
+A three-second peak-held value of headroom in dBs will be shown to the right
+of the meter if this is below 6dB.
+.SP
+This option is enabled by default when using
+SoX to play or record audio.
+.TP
+\fB\-T\fR\fR
+Equivalent to \fB\-\-combine multiply\fR.
+.TP
+\fB\-\-temp\fI DIRECTORY\fR
+Specify that any temporary files should be created in the given
+.IR DIRECTORY .
+This can be useful if there are permission or free-space problems with the
+default location. In this case, using `\fB\-\-temp .\fR' (to use the
+current directory) is often a good solution.
+.TP
+\fB\-\-version\fR
+Show SoX's version number and exit.
+.IP \fB\-V\fR[\fIlevel\fR]
+Set verbosity. This is particularly useful for seeing how any automatic
+effects have been invoked by SoX.
+.SP
+SoX displays messages on the console (stderr) according to the following
+verbosity levels:
+.IP
+.RS
+.IP 0
+No messages are shown at all; use the exit status to determine
+if an error has occurred.
+.IP 1
+Only error messages are shown. These are generated if
+SoX cannot complete the requested commands.
+.IP 2
+Warning messages are also shown. These are generated if
+SoX can complete the requested commands,
+but not exactly according to the requested command parameters,
+or if clipping occurs.
+.IP 3
+Descriptions of
+SoX's processing phases are also shown.
+Useful for seeing exactly how
+SoX is processing your audio.
+.IP "4 and above"
+Messages to help with debugging
+SoX are also shown.
+.RE
+.IP
+By default, the verbosity level is set to 2 (shows errors and
+warnings). Each occurrence of the \fB\-V\fR option increases the
+verbosity level by 1. Alternatively, the verbosity level can be set
+to an absolute number by specifying it immediately after the
+.BR \-V ,
+e.g.
+.B \-V0
+sets it to 0.
+.IP
+.SS Input File Options
+These options apply only to input files and may precede only input
+filenames on the command line.
+.TP
+\fB\-\-ignore\-length\fR
+Override an (incorrect) audio length given in an audio file's header. If
+this option is given then SoX will keep reading audio until it reaches
+the end of the input file.
+.TP
+\fB\-v\fR, \fB\-\-volume\fR \fIFACTOR\fR
+Intended for use when combining multiple input files, this option
+adjusts the volume of the file that follows it on the command line by a
+factor of \fIFACTOR\fR. This allows it to be `balanced' w.r.t. the other
+input files. This is a linear (amplitude) adjustment, so a number less
+than 1 decreases the volume and a number greater than 1 increases it. If a
+negative number is given then in addition to the volume adjustment,
+the audio signal will be inverted.
+.SP
+See also the
+.BR norm ,
+.BR vol ,
+and
+.B gain
+effects, and see \fBInput File Balancing\fR above.
+.SS Input & Output File Format Options
+These options apply to the input or output file whose name they
+immediately precede on the command line and are used mainly when
+working with headerless file formats or when specifying a format
+for the output file that is different to that of the input file.
+.TP
+\fB\-b\fR \fIBITS\fR, \fB\-\-bits\fR \fIBITS\fR
+The number of bits (a.k.a. bit-depth or sometimes word-length) in each
+encoded sample. Not applicable to complex encodings such as MP3 or GSM.
+Not necessary with encodings that have a fixed number of bits, e.g.
+A/\(*m-law, ADPCM.
+.SP
+For an input file, the most common use for this option is to inform
+SoX of the number of bits per sample in a `raw' (`headerless') audio
+file. For example
+.EX
+ sox \-r 16k \-e signed \-b 8 input.raw output.wav
+.EE
+converts a particular `raw' file to a self-describing `WAV' file.
+.SP
+For an output file, this option can be used (perhaps along with
+.BR \-e )
+to set the output encoding size. By default (i.e. if this option is
+not given), the output encoding size will (providing it is supported
+by the output file type) be set to the input encoding size. For
+example
+.EX
+ sox input.cdda \-b 24 output.wav
+.EE
+converts raw CD digital audio (16-bit, signed-integer) to a
+24-bit (signed-integer) `WAV' file.
+.TP
+\fB\-c\fR \fICHANNELS\fR, \fB\-\-channels\fR \fICHANNELS\fR
+The number of audio channels in the audio file. This can be any number
+greater than zero.
+.SP
+For an input file, the most common use for this option is to inform
+SoX of the number of channels in a `raw' (`headerless') audio file.
+Occasionally, it may be useful to use this option with a `headered'
+file, in order to override the (presumably incorrect) value in the
+header\*mnote that this is only supported with certain file types.
+Examples:
+.EX
+ sox \-r 48k \-e float \-b 32 \-c 2 input.raw output.wav
+.EE
+converts a particular `raw' file to a self-describing `WAV' file.
+.EX
+ play \-c 1 music.wav
+.EE
+interprets the file data as belonging to a single channel regardless
+of what is indicated in the file header. Note that if the file does
+in fact have two channels, this will result in the file playing at
+half speed.
+.SP
+For an output file, this option provides a shorthand for specifying
+that the
+.B channels
+effect should be invoked in order to change (if necessary) the number
+of channels in the audio signal to the number given. For
+example, the following two commands are equivalent:
+.EX
+.ne 2
+ sox input.wav \-c 1 output.wav bass \-b 24
+ sox input.wav output.wav bass \-b 24 channels 1
+.EE
+though the second form is more flexible as it allows the effects to
+be ordered arbitrarily.
+.TP
+\fB\-e \fIENCODING\fR, \fB\-\-encoding\fR \fIENCODING\fR
+The audio encoding type. Sometimes needed with file-types that
+support more than one encoding type. For example, with raw, WAV, or
+AU (but not, for example, with MP3 or FLAC).
+The available encoding types are as follows:
+.RS
+.IP \fBsigned-integer\fR
+PCM data stored as signed (`two's complement') integers. Commonly used
+with a 16 or 24 \-bit encoding size.
+A value of 0 represents minimum signal power.
+.IP \fBunsigned-integer\fR
+PCM data stored as unsigned integers. Commonly used
+with an 8-bit encoding size. A value of 0 represents maximum signal
+power.
+.IP \fBfloating-point\fR
+PCM data stored as IEEE 753 single precision (32-bit) or double
+precision (64-bit) floating-point (`real') numbers.
+A value of 0 represents minimum signal power.
+.IP \fBa-law\fR
+International telephony standard for logarithmic encoding to 8 bits per
+sample. It has a precision equivalent to roughly 13-bit PCM and is
+sometimes encoded with reversed bit-ordering (see the
+.B \-X
+option).
+.IP \fBu-law,\ mu-law\fR
+North American telephony standard for logarithmic encoding to 8 bits per
+sample. A.k.a. \(*m-law. It has a precision equivalent to roughly
+14-bit PCM and is
+sometimes encoded with reversed bit-ordering (see the
+.B \-X
+option).
+.IP \fBoki-adpcm\fR
+OKI (a.k.a. VOX, Dialogic, or Intel) 4-bit ADPCM;
+it has a precision equivalent to roughly 12-bit PCM.
+ADPCM is a form of audio compression that has a good
+compromise between audio quality and encoding/decoding speed.
+.IP \fBima-adpcm\fR
+IMA (a.k.a. DVI) 4-bit ADPCM;
+it has a precision equivalent to roughly 13-bit PCM.
+.IP \fBms-adpcm\fR
+Microsoft 4-bit ADPCM; it has a precision equivalent to roughly 14-bit
+PCM.
+.IP \fBgsm-full-rate\fR
+GSM is currently used for the vast majority of the world's digital
+wireless telephone calls. It utilises several audio
+formats with different bit-rates and associated speech quality.
+SoX has support for GSM's original 13kbps `Full Rate' audio format.
+It is usually CPU-intensive to work with GSM audio.
+.RE
+.TP
+\
+Encoding names can be abbreviated where this would not be ambiguous;
+e.g. `unsigned-integer' can be given as `un', but not `u' (ambiguous
+with `u-law').
+.SP
+For an input file, the most common use for this option is to inform
+SoX of the encoding of a `raw' (`headerless') audio
+file (see the examples in
+.B \-b
+and
+.B \-c
+above).
+.SP
+For an output file, this option can be used (perhaps along with
+.BR \-b )
+to set the output encoding type For example
+.EX
+ sox input.cdda \-e float output1.wav
+
+ sox input.cdda \-b 64 \-e float output2.wav
+.EE
+convert raw CD digital audio (16-bit, signed-integer) to
+floating-point `WAV' files (single & double precision respectively).
+.SP
+By default (i.e. if this option is not given), the output encoding
+type will (providing it is supported by the output file type) be set
+to the input encoding type.
+.TP
+\fB\-\-no\-glob\fR
+Specifies that filename `globbing' (wild-card matching) should not be
+performed by SoX on the following filename. For example, if the current
+directory contains the two files `five-seconds.wav' and `five*.wav', then
+.EX
+ play \-\-no\-glob "five*.wav"
+.EE
+can be used to play just the single file `five*.wav'.
+.TP
+\fB\-r, \fB\-\-rate\fR \fIRATE\fR[\fBk\fR]
+Gives the sample rate in Hz (or kHz if appended with `k') of the file.
+.SP
+For an input file, the most common use for this option is to inform
+SoX of the sample rate of a `raw' (`headerless') audio file (see the
+examples in
+.B \-b
+and
+.B \-c
+above).
+Occasionally it may be useful to use this option with a `headered'
+file, in order to override the (presumably incorrect) value in the
+header\*mnote that this is only supported with certain file types.
+For example, if audio was recorded with a sample-rate of say 48k from
+a source that played back a little, say 1\*d5%, too slowly, then
+.EX
+ sox \-r 48720 input.wav output.wav
+.EE
+effectively corrects the speed by changing only the file header (but see
+also the
+.B speed
+effect for the more usual solution to this problem).
+.SP
+For an output file, this option provides a shorthand for specifying
+that the
+.B rate
+effect should be invoked in order to change (if necessary) the sample
+rate of the audio signal to the given value. For example, the
+following two commands are equivalent:
+.EX
+.ne 2
+ sox input.wav \-r 48k output.wav bass \-b 24
+ sox input.wav output.wav bass \-b 24 rate 48k
+.EE
+though the second form is more flexible as it allows
+.B rate
+options to be given, and allows the effects to be ordered arbitrarily.
+.TP
+\fB\-t\fR, \fB\-\-type\fR \fIFILE-TYPE\fR
+Gives the type of the audio file. For both input and output files,
+this option is commonly used to inform SoX of the type a `headerless'
+audio file (e.g. raw, mp3) where the actual/desired type cannot be
+determined from a given filename extension. For example:
+.EX
+ another-command | sox \-t mp3 \- output.wav
+
+ sox input.wav \-t raw output.bin
+.EE
+It can also be used to override the type implied by an input filename
+extension, but if overriding with a type that has a header, SoX will
+exit with an appropriate error message if such a header is not
+actually present.
+.SP
+See
+.BR soxformat (7)
+for a list of supported file types.
+.PP
+\fB\-L\fR, \fB\-\-endian little\fR
+.br
+\fB\-B\fR, \fB\-\-endian big\fR
+.br
+\fB\-x\fR, \fB\-\-endian swap\fR
+.if t .sp -.5
+.if n .sp -1
+.TP
+\
+These options specify whether the byte-order of the audio data is,
+respectively, `little endian', `big endian', or the opposite to that of
+the system on which SoX is being used. Endianness applies only to data
+encoded as floating-point, or as signed or unsigned integers of 16 or
+more bits. It is often necessary to specify one of these options for
+headerless files, and sometimes necessary for (otherwise)
+self-describing files. A given endian-setting option may be ignored
+for an input file whose header contains a specific endianness
+identifier, or for an output file that is actually an audio device.
+.SP
+.B N.B.
+Unlike other format characteristics, the endianness (byte, nibble, &
+bit ordering) of the input file is not automatically used for the output
+file; so, for example, when the following is run on a little-endian system:
+.EX
+ sox \-B audio.s16 trimmed.s16 trim 2
+.EE
+trimmed.s16 will be created as little-endian;
+.EX
+ sox \-B audio.s16 \-B trimmed.s16 trim 2
+.EE
+must be used to preserve big-endianness in the output file.
+.SP
+The
+.B \-V
+option can be used to check the selected orderings.
+.TP
+\fB\-N\fR, \fB\-\-reverse\-nibbles\fR
+Specifies that the nibble ordering (i.e. the 2 halves of a byte) of the samples should be reversed;
+sometimes useful with ADPCM-based formats.
+.SP
+.B N.B.
+See also N.B. in section on
+.B \-x
+above.
+.TP
+\fB\-X\fR, \fB\-\-reverse\-bits\fR
+Specifies that the bit ordering of the samples should be reversed;
+sometimes useful with a few (mostly headerless) formats.
+.SP
+.B N.B.
+See also N.B. in section on
+.B \-x
+above.
+.SS Output File Format Options
+These options apply only to the output file and may precede only the output
+filename on the command line.
+.TP
+\fB\-\-add\-comment \fITEXT\fR
+Append a comment in the output file header (where applicable).
+.TP
+\fB\-\-comment \fITEXT\fR
+Specify the comment text to store in the output file header (where
+applicable).
+.SP
+SoX will provide a default comment if this option (or
+.BR \-\-comment\-file )
+is not given. To specify that no comment should be stored in the output file,
+use
+.B "\-\-comment \(dq\(dq" .
+.TP
+\fB\-\-comment\-file \fIFILENAME\fR
+Specify a file containing the comment text to store in the output
+file header (where applicable).
+.TP
+\fB\-C\fR, \fB\-\-compression\fR \fIFACTOR\fR
+The compression factor for variably compressing output file formats. If
+this option is not given then a default compression factor will apply.
+The compression factor is interpreted differently for different
+compressing file formats. See the description of the file formats that
+use this option in
+.BR soxformat (7)
+for more information.
+.SH EFFECTS
+In addition to converting, playing and recording audio files, SoX can
+be used to invoke a number of audio `effects'. Multiple effects may
+be applied by specifying them one after another at the end of the SoX
+command line, forming an `effects chain'.
+Note that applying multiple effects in real-time (i.e. when playing audio)
+is likely to require a high performance computer. Stopping other applications
+may alleviate performance issues should they occur.
+.SP
+Some of the SoX effects are primarily intended to be applied to a single
+instrument or `voice'. To facilitate this, the \fBremix\fR effect and
+the global SoX option \fB\-M\fR can be used to isolate then recombine
+tracks from a multi-track recording.
+.SS Multiple Effects Chains
+A single effects chain is made up of one or more effects. Audio from
+the input runs through the chain until either the end of the input file
+is reached or an effect in the chain requests to terminate the chain.
+.SP
+SoX supports running multiple effects chains over the input audio.
+In this case, when one chain indicates it is done processing audio,
+the audio data is then sent through the next effects chain. This
+continues until either no more effects chains exist or the input has
+reached the end of the file.
+.SP
+An effects chain is terminated by placing a
+.B :
+(colon) after an effect. Any following effects are a part of a new effects chain.
+.SP
+It is important to place the effect that will stop the chain
+as the first effect in the chain. This is because any samples
+that are buffered by effects to the left of the terminating effect
+will be discarded. The amount of samples discarded is related to the
+.B \-\-buffer
+option and it should be kept small, relative to the sample rate, if
+the terminating effect cannot be first. Further information on
+stopping effects can be found in the
+.B Stopping SoX
+section.
+.SP
+There are a few pseudo-effects that aid using multiple effects chains.
+These include
+.B newfile
+which will start writing to a new output file before moving to the
+next effects chain and
+.B restart
+which will move back to the first effects chain. Pseudo-effects
+must be specified as the first effect in a chain and as the only
+effect in a chain (they must have a
+.B :
+before and after they are specified).
+.SP
+The following is an example of multiple effects chains. It will split the
+input file into multiple files of 30 seconds in length. Each output filename
+will have unique number in its name as documented in the
+.B Output Files
+section.
+.EX
+ sox infile.wav output.wav trim 0 30 : newfile : restart
+.EE
+.SS Common Notation And Parameters
+In the descriptions that follow,
+brackets [ ] are used to denote parameters that are optional, braces
+{ } to denote those that are both optional and repeatable,
+and angle brackets < > to denote those that are repeatable but not
+optional.
+Where applicable, default values for optional parameters are shown in parenthesis ( ).
+.SP
+The following parameters are used with, and have the same meaning for,
+several effects:
+.TP
+\fIcenter\fR[\fBk\fR]
+See
+.IR frequency .
+.TP
+\fIfrequency\fR[\fBk\fR]
+A frequency in Hz, or, if appended with `k', kHz.
+.TP
+\fIgain\fR
+A power gain in dB.
+Zero gives no gain; less than zero gives an attenuation.
+.TP
+\fIposition\fR
+A position within the audio stream; the syntax is
+[\fB=\fR\^|\^\fB+\fR\^|\^\fB\-\fR]\fItimespec\fR, where \fItimespec\fR is a
+time specification (see below). The optional first character indicates
+whether the \fItimespec\fR is to be interpreted relative to the start
+(\fB=\fR) or end (\fB\-\fR) of audio, or to the previous \fIposition\fR if
+the effect accepts multiple position arguments (\fB+\fR). The audio length
+must be known for end-relative locations to work; some effects do accept
+\fB\-0\fR for end-of-audio, though, even if the length is unknown. Which of
+\fB=\fR, \fB+\fR, \fB\-\fR is the default depends on the effect and is shown
+in its syntax as, e.g., \fIposition(+)\fR.
+.SP
+Examples: \fB=2:00\fR (two minutes into the audio stream), \fB\-100s\fR (one
+hundred samples before the end of audio), \fB+0:12+10s\fR (twelve seconds
+and ten samples after the previous position), \fB\-0.5+1s\fR (one sample less
+than half a second before the end of audio).
+.TP
+\fIwidth\fR[\fBh\fR\^|\^\fBk\fR\^|\^\fBo\fR\^|\^\fBq\fR]
+Used to specify the band-width of a filter. A number of different
+methods to specify the width are available (though not all for every effect).
+One of the characters shown may be appended to select the desired method
+as follows:
+.ne 5
+.TS
+center;
+cI cI lI
+cB c l.
+\ Method Notes
+h Hz \
+k kHz \
+o Octaves \
+q Q-factor See [2]
+.TE
+.DT
+.SP
+For each effect that uses this parameter, the default method (i.e. if no
+character is appended) is the one that it listed first in the first line of
+the effect's description.
+.PP
+Most effects that expect an audio position or duration in a parameter,
+i.e. a \fBtime specification\fR, accept either of the following two forms:
+.TP
+[[\fIhours\fB:\fR]\fIminutes\fB:\fR]\fIseconds\fR[\fB.\fIfrac\fR][\fBt\fR]
+A specification of `1:30\*d5' corresponds to one minute, thirty and
+\(12 seconds. The \fBt\fR suffix is entirely optional (however, see the
+\fBsilence\fR effect for an exception).
+Note that the component values do not have to be normalized; e.g.,
+`1:23:45', `83:45', `79:0285', `1:0:1425', `1::1425' and `5025' all are
+legal and equivalent to each other.
+.TP
+\fIsamples\fBs\fR
+Specifies the number of samples directly, as in `8000s'. For large sample
+counts, \fIe notation\fR is supported: `1.7e6s' is the same as `1700000s'.
+.PP
+Time specifications can also be chained with \fB+\fR or \fB\-\fR into a new
+time specification where the right part is added to or subtracted from the
+left, respectively: `3:00\-200s' means two hundred samples less than three
+minutes.
+.SP
+To see if SoX has support for an optional effect, enter
+.B sox \-h
+and look for its name under the list: `EFFECTS'.
+.SS Supported Effects
+Note: a categorised list of the effects can be found in the
+accompanying `README' file.
+.TP
+\fBallpass\fR \fIfrequency\fR[\fBk\fR]\fI width\fR[\fBh\fR\^|\^\fBk\fR\^|\^\fBo\fR\^|\^\fBq\fR]
+Apply a two-pole all-pass filter with central frequency (in Hz)
+\fIfrequency\fR, and filter-width \fIwidth\fR.
+An all-pass filter changes the
+audio's frequency to phase relationship without changing its frequency
+to amplitude relationship. The filter is described in detail in [1].
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.TP
+\fBband\fR [\fB\-n\fR] \fIcenter\fR[\fBk\fR]\fR [\fIwidth\fR[\fBh\fR\^|\^\fBk\fR\^|\^\fBo\fR\^|\^\fBq\fR]]
+Apply a band-pass filter.
+The frequency response drops logarithmically
+around the
+.I center
+frequency.
+The
+.I width
+parameter gives the slope of the drop.
+The frequencies at
+.I center
++
+.I width
+and
+.I center
+\-
+.I width
+will be half of their original amplitudes.
+.B band
+defaults to a mode oriented to pitched audio,
+i.e. voice, singing, or instrumental music.
+The \fB\-n\fR (for noise) option uses the alternate mode
+for un-pitched audio (e.g. percussion).
+.B Warning:
+\fB\-n\fR introduces a power-gain of about 11dB in the filter, so beware
+of output clipping.
+.B band
+introduces noise in the shape of the filter,
+i.e. peaking at the
+.I center
+frequency and settling around it.
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.SP
+See also \fBsinc\fR for a bandpass filter with steeper shoulders.
+.TP
+\fBbandpass\fR\^|\^\fBbandreject\fR [\fB\-c\fR] \fIfrequency\fR[\fBk\fR]\fI width\fR[\fBh\fR\^|\^\fBk\fR\^|\^\fBo\fR\^|\^\fBq\fR]
+Apply a two-pole Butterworth band-pass or band-reject filter with
+central frequency \fIfrequency\fR, and (3dB-point) band-width
+\fIwidth\fR. The
+.B \-c
+option applies only to
+.B bandpass
+and selects a constant skirt gain (peak gain = Q) instead of the
+default: constant 0dB peak gain.
+The filters roll off at 6dB per octave (20dB per decade)
+and are described in detail in [1].
+.SP
+These effects support the \fB\-\-plot\fR global option.
+.SP
+See also \fBsinc\fR for a bandpass filter with steeper shoulders.
+.TP
+\fBbandreject \fIfrequency\fR[\fBk\fR]\fI width\fR[\fBh\fR\^|\^\fBk\fR\^|\^\fBo\fR\^|\^\fBq\fR]
+Apply a band-reject filter.
+See the description of the \fBbandpass\fR effect for details.
+.TP
+\fBbass\fR\^|\^\fBtreble \fIgain\fR [\fIfrequency\fR[\fBk\fR]\fR [\fIwidth\fR[\fBs\fR\^|\^\fBh\fR\^|\^\fBk\fR\^|\^\fBo\fR\^|\^\fBq\fR]]]
+Boost or cut the bass (lower) or treble (upper) frequencies of the audio
+using a two-pole shelving filter with a response similar to that
+of a standard hi-fi's tone-controls. This is also
+known as shelving equalisation (EQ).
+.SP
+\fIgain\fR gives the gain at 0\ Hz (for \fBbass\fR), or whichever is
+the lower of \(ap22\ kHz and the Nyquist frequency (for \fBtreble\fR). Its
+useful range is about \-20 (for a large cut) to +20 (for a large
+boost).
+Beware of
+.B Clipping
+when using a positive \fIgain\fR.
+.SP
+If desired, the filter can be fine-tuned using the following
+optional parameters:
+.SP
+\fIfrequency\fR sets the filter's central frequency and so can be
+used to extend or reduce the frequency range to be boosted or
+cut. The default value is 100\ Hz (for \fBbass\fR) or 3\ kHz (for
+\fBtreble\fR).
+.SP
+\fIwidth\fR
+determines how
+steep is the filter's shelf transition. In addition to the common
+width specification methods described above,
+`slope' (the default, or if appended with `\fBs\fR') may be used.
+The useful range of `slope' is
+about 0\*d3, for a gentle slope, to 1 (the maximum), for a steep slope; the
+default value is 0\*d5.
+.SP
+The filters are described in detail in [1].
+.SP
+These effects support the \fB\-\-plot\fR global option.
+.SP
+See also \fBequalizer\fR for a peaking equalisation effect.
+.TP
+\fBbend\fR [\fB\-f \fIframe-rate\fR(25)] [\fB\-o \fIover-sample\fR(16)] { \fIstart-position(+)\fB,\fIcents\fB,\fIend-position(+)\fR }
+Changes pitch by specified amounts at specified times.
+Each given triple: \fIstart-position\fB,\fIcents\fB,\fIend-position\fR
+specifies one bend.
+\fIcents\fR is the number of cents (100 cents = 1 semitone) by which to
+bend the pitch. The other values specify the points in time at which to start
+and end bending the pitch, respectively.
+.SP
+The pitch-bending algorithm utilises the Discrete Fourier Transform (DFT)
+at a particular frame rate and over-sampling rate.
+The
+.B \-f
+and
+.B \-o
+parameters may be used to adjust these parameters and thus control the
+smoothness of the changes in pitch.
+.SP
+For example, an initial tone is generated, then bent three times, yielding
+four different notes in total:
+.EX
+.ne 2
+ play \-n synth 2.5 sin 667 gain 1 \\
+ bend .35,180,.25 .15,740,.53 0,\-520,.3
+.EE
+Here, the first bend runs from 0.35 to 0.6, and the second one from 0.75
+to 1.28 seconds.
+Note that the clipping that is produced in this example is deliberate;
+to remove it, use
+.B gain\ \-5
+in place of
+.BR gain\ 1 .
+.SP
+See also \fBpitch\fR.
+.TP
+\fBbiquad \fIb0 b1 b2 a0 a1 a2\fR
+Apply a biquad IIR filter with the given coefficients. Where b* and a* are
+the numerator and denominator coefficients respectively.
+.SP
+See http://en.wikipedia.org/wiki/Digital_biquad_filter (where a0 = 1).
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.TP
+\fBchannels \fICHANNELS\fR
+Invoke a simple algorithm to change the number of channels in
+the audio signal to the given number
+.IR CHANNELS :
+mixing if decreasing the number of channels or duplicating if
+increasing the number of channels.
+.SP
+The
+.B channels
+effect is invoked automatically if SoX's \fB\-c\fR option specifies a
+number of channels that is different to that of the input file(s).
+Alternatively, if this effect is given explicitly, then SoX's
+.B \-c
+option need not be given. For example, the following two commands are
+equivalent:
+.EX
+.ne 2
+ sox input.wav \-c 1 output.wav bass \-b 24
+ sox input.wav output.wav bass \-b 24 channels 1
+.EE
+though the second form is more flexible as it allows the effects to
+be ordered arbitrarily.
+.SP
+See also
+.B remix
+for an effect that allows channels to be mixed/selected arbitrarily.
+.TP
+\fBchorus \fIgain-in gain-out\fR <\fIdelay decay speed depth \fB\-s\fR\^|\^\fB\-t\fR>
+Add a chorus effect to the audio. This can make a single vocal sound
+like a chorus, but can also be applied to instrumentation.
+.SP
+Chorus resembles an echo effect with a short delay, but
+whereas with echo the delay is constant, with chorus, it
+is varied using sinusoidal or triangular modulation. The modulation
+depth defines the range the modulated delay is played before or after the
+delay. Hence the delayed sound will sound slower or faster, that is the delayed
+sound tuned around the original one, like in a chorus where some vocals are
+slightly off key.
+See [3] for more discussion of the chorus effect.
+.SP
+Each four-tuple parameter
+delay/decay/speed/depth gives the delay in milliseconds
+and the decay (relative to gain-in) with a modulation
+speed in Hz using depth in milliseconds.
+The modulation is either sinusoidal (\fB\-s\fR) or triangular
+(\fB\-t\fR). Gain-out is the volume of the output.
+.SP
+A typical delay is around 40ms to 60ms; the modulation speed is best
+near 0\*d25Hz and the modulation depth around 2ms.
+For example, a single delay:
+.EX
+ play guitar1.wav chorus 0.7 0.9 55 0.4 0.25 2 \-t
+.EE
+Two delays of the original samples:
+.EX
+.ne 2
+ play guitar1.wav chorus 0.6 0.9 50 0.4 0.25 2 \-t \\
+ 60 0.32 0.4 1.3 \-s
+.EE
+A fuller sounding chorus (with three additional delays):
+.EX
+.ne 2
+ play guitar1.wav chorus 0.5 0.9 50 0.4 0.25 2 \-t \\
+ 60 0.32 0.4 2.3 \-t 40 0.3 0.3 1.3 \-s
+.EE
+.TP
+\fBcompand \fIattack1\fB,\fIdecay1\fR{\fB,\fIattack2\fB,\fIdecay2\fR}
+[\fIsoft-knee-dB\fB:\fR]\fIin-dB1\fR[\fB,\fIout-dB1\fR]{\fB,\fIin-dB2\fB,\fIout-dB2\fR}
+.br
+[\fIgain\fR [\fIinitial-volume-dB\fR [\fIdelay\fR]]]
+.SP
+Compand (compress or expand) the dynamic range of the audio.
+.SP
+The
+.I attack
+and
+.I decay
+parameters (in seconds) determine the time over which the
+instantaneous level of the input signal is averaged to determine its
+volume; attacks refer to increases in volume and decays refer to
+decreases.
+For most situations, the attack time (response to the music getting
+louder) should be shorter than the decay time because the human ear is more
+sensitive to sudden loud music than sudden soft music.
+Where more than one pair of attack/decay parameters are
+specified, each input channel is companded separately and the number of
+pairs must agree with the number of input channels.
+Typical values are
+.B 0\*d3,0\*d8
+seconds.
+.SP
+The second parameter is a list of points on the compander's transfer
+function specified in dB relative to the maximum possible signal
+amplitude. The input values must be in a strictly increasing order but
+the transfer function does not have to be monotonically rising. If
+omitted, the value of
+.I out-dB1
+defaults to the same value as
+.IR in-dB1 ;
+levels below
+.I in-dB1
+are not companded (but may have gain applied to them).
+The point \fB0,0\fR is assumed but may be overridden (by
+\fB0,\fIout-dBn\fR).
+If the list is preceded by a
+.I soft-knee-dB
+value, then the points at where adjacent line segments on the
+transfer function meet will be rounded by the amount given.
+Typical values for the transfer function are
+.BR 6:\-70,\-60,\-20 .
+.SP
+The third (optional) parameter is an additional gain in dB to be applied
+at all points on the transfer function and allows easy adjustment
+of the overall gain.
+.SP
+The fourth (optional) parameter is an initial level to be assumed for
+each channel when companding starts. This permits the user to supply a
+nominal level initially, so that, for example, a very large gain is not
+applied to initial signal levels before the companding action has begun
+to operate: it is quite probable that in such an event, the output would
+be severely clipped while the compander gain properly adjusts itself.
+A typical value (for audio which is initially quiet) is
+.B \-90
+dB.
+.SP
+The fifth (optional) parameter is a delay in seconds. The input signal
+is analysed immediately to control the compander, but it is delayed
+before being fed to the volume adjuster. Specifying a delay
+approximately equal to the attack/decay times allows the compander to
+effectively operate in a `predictive' rather than a reactive mode.
+A typical value is
+.B 0\*d2
+seconds.
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+The following example might be used to make a piece of music with both
+quiet and loud passages suitable for listening to in a noisy environment
+such as a moving vehicle:
+.EX
+ sox asz.wav asz-car.wav compand 0.3,1 6:\-70,\-60,\-20 \-5 \-90 0.2
+.EE
+The transfer function (`6:\-70,...') says that very soft sounds (below
+\-70dB) will remain unchanged. This will stop the compander from
+boosting the volume on `silent' passages such as between movements.
+However, sounds in the range \-60dB to 0dB (maximum
+volume) will be boosted so that the 60dB dynamic range of the
+original music will be compressed 3-to-1 into a 20dB range, which is
+wide enough to enjoy the music but narrow enough to get around the
+road noise. The `6:' selects 6dB soft-knee companding.
+The \-5 (dB) output gain is needed to avoid clipping (the number is
+inexact, and was derived by experimentation).
+The \-90 (dB) for the initial volume will work fine for a clip that starts
+with near silence, and the delay of 0\*d2 (seconds) has the effect of causing
+the compander to react a bit more quickly to sudden volume changes.
+.SP
+In the next example, compand is being used as a noise-gate for when the
+noise is at a lower level than the signal:
+.EX
+ play infile compand .1,.2 \-inf,\-50.1,\-inf,\-50,\-50 0 \-90 .1
+.EE
+Here is another noise-gate, this time for when the
+noise is at a higher level than the signal (making it, in some ways,
+similar to squelch):
+.EX
+ play infile compand .1,.1 \-45.1,\-45,\-inf,0,\-inf 45 \-90 .1
+.EE
+This effect supports the \fB\-\-plot\fR global option (for the transfer function).
+.SP
+See also
+.B mcompand
+for a multiple-band companding effect.
+.TP
+\fBcontrast \fR[\fIenhancement-amount\fR(75)]
+Comparable with compression, this effect modifies an audio signal to
+make it sound louder.
+.I enhancement-amount
+controls the amount of the enhancement and is a number in the range 0\-100.
+Note that
+.I enhancement-amount
+= 0 still gives a significant contrast enhancement.
+.SP
+See also the
+.B compand
+and
+.B mcompand
+effects.
+.TP
+\fBdcshift \fIshift\fR [\fIlimitergain\fR]
+Apply a DC shift to the audio. This can be useful to remove a DC
+offset (caused perhaps by a hardware problem in the recording chain)
+from the audio. The effect of a DC offset is reduced headroom and
+hence volume.
+The
+.B stat
+or
+.B stats
+effect can be used to determine if a signal has a DC offset.
+.SP
+The given \fIdcshift\fR value is a floating point number in the range
+of \(+-2 that indicates the amount to shift the audio (which is in the
+range of \(+-1).
+.SP
+An optional
+.I limitergain
+can be specified as well. It should have a value much less than 1
+(e.g. 0\*d05 or 0\*d02) and is used only on peaks to prevent clipping.
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+An alternative approach to removing a DC offset (albeit with a short delay)
+is to use the
+.B highpass
+filter effect at a frequency of say 10Hz, as illustrated in the following
+example:
+.EX
+ sox \-n dc.wav synth 5 sin %0 50
+ sox dc.wav fixed.wav highpass 10
+.EE
+.TP
+\fBdeemph\fR
+Apply Compact Disc (IEC 60908) de-emphasis (a treble attenuation shelving
+filter).
+.SP
+Pre-emphasis was applied in the mastering of some CDs issued in the early
+1980s. These included many classical music albums, as well as now
+sought-after issues of albums by The Beatles, Pink Floyd and others.
+Pre-emphasis should be removed at playback time by a de-emphasis
+filter in the playback device. However, not all modern CD players have
+this filter, and very few PC CD drives have it; playing pre-emphasised
+audio without the correct de-emphasis filter results in audio that sounds harsh
+and is far from what its creators intended.
+.SP
+With the
+.B deemph
+effect, it is possible to apply the necessary de-emphasis to audio that
+has been extracted from a pre-emphasised CD, and then either burn the
+de-emphasised audio to a new CD (which will then play correctly on any
+CD player), or simply play the correctly de-emphasised audio files on the
+PC. For example:
+.EX
+ sox track1.wav track1\-deemph.wav deemph
+.EE
+and then burn track1-deemph.wav to CD, or
+.EX
+ play track1\-deemph.wav
+.EE
+or simply
+.EX
+ play track1.wav deemph
+.EE
+The de-emphasis filter is implemented as a biquad and requires the input
+audio sample rate to be either 44.1kHz or 48kHz. Maximum deviation
+from the ideal response is only 0\*d06dB (up to 20kHz).
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.SP
+See also the \fBbass\fR and \fBtreble\fR shelving equalisation effects.
+.TP
+\fBdelay\fR {\fIposition(=)\fR}
+Delay one or more audio channels such that they start at the given
+\fIposition\fR.
+For example,
+.B delay 1\*d5 +1 3000s
+delays the first channel by 1\*d5 seconds, the second channel by 2\*d5
+seconds (one second more than the previous channel), the third channel
+by 3000 samples, and leaves any other channels that may be
+present un-delayed.
+The following (one long) command plays a chime sound:
+.EX
+.ne 3
+ play \-n synth \-j 3 sin %3 sin %\-2 sin %\-5 sin %\-9 \\
+ sin %\-14 sin %\-21 fade h .01 2 1.5 delay \\
+ 1.3 1 .76 .54 .27 remix \- fade h 0 2.7 2.5 norm \-1
+.EE
+and this plays a guitar chord:
+.EX
+.ne 2
+ play \-n synth pl G2 pl B2 pl D3 pl G3 pl D4 pl G4 \\
+ delay 0 .05 .1 .15 .2 .25 remix \- fade 0 4 .1 norm \-1
+.EE
+.TP
+\fBdither\fR [\fB\-S\fR\^|\^\fB\-s\fR\^|\^\fB\-f \fIfilter\fR] [\fB\-a\fR] [\fB\-p \fIprecision\fR]
+Apply dithering to the audio.
+Dithering deliberately adds a small amount of noise to the signal in
+order to mask audible quantization effects that can occur if the output
+sample size is less than 24 bits. With no options, this effect will
+add triangular (TPDF) white noise. Noise-shaping (only for certain
+sample rates) can be selected with
+.BR \-s .
+With the
+.B \-f
+option, it is possible to select a particular noise-shaping filter from
+the following list: lipshitz, f-weighted, modified-e-weighted,
+improved-e-weighted, gesemann, shibata, low-shibata, high-shibata. Note
+that most filter types are available only with 44100Hz sample rate. The
+filter types are distinguished by the following properties: audibility
+of noise, level of (inaudible, but in some circumstances, otherwise
+problematic) shaped high frequency noise, and processing speed.
+.br
+See http://sox.sourceforge.net/SoX/NoiseShaping for graphs of the different
+noise-shaping curves.
+.SP
+The
+.B \-S
+option selects a slightly `sloped' TPDF, biased towards higher
+frequencies. It can be used at any sampling rate but below \(~~22k,
+plain TPDF is probably better, and above \(~~ 37k, noise-shaping
+(if available) is probably better.
+.SP
+The
+.B \-a
+option enables a mode where dithering (and noise-shaping if applicable)
+are automatically enabled only when needed. The most likely use for
+this is when applying fade in or out to an already dithered file, so
+that the redithering applies only to the faded portions. However, auto
+dithering is not fool-proof, so the fades should be carefully checked
+for any noise modulation; if this occurs, then either re-dither the whole
+file, or use
+.BR trim ,
+.BR fade ,
+and concatencate.
+.SP
+The
+.B \-p
+option allows overriding the target precision.
+.SP
+If the SoX global option
+.B \-R
+option is not given, then the pseudo-random number generator used to
+generate the white noise will be `reseeded', i.e. the generated noise
+will be different between invocations.
+.SP
+This effect should not be followed by any other effect that
+affects the audio.
+.SP
+See also the `Dithering' section above.
+.TP
+\fBdownsample\fR [\fIfactor\fR(2)]
+Downsample the signal by an integer factor: Only the first out of
+each \fIfactor\fR samples is retained, the others are discarded.
+.SP
+No decimation filter is applied. If the input is not a properly
+bandlimited baseband signal, aliasing will occur. This may be
+desirable, e.g., for frequency translation.
+.SP
+For a general resampling effect with anti-aliasing, see \fBrate\fR. See
+also \fBupsample\fR.
+.TP
+\fBearwax\fR
+Makes audio easier to listen to on headphones.
+Adds `cues' to 44\*d1kHz stereo (i.e. audio CD format) audio so that
+when listened to on headphones the stereo image is
+moved from inside
+your head (standard for headphones) to outside and in front of the
+listener (standard for speakers).
+.TP
+\fBecho \fIgain-in gain-out\fR <\fIdelay decay\fR>
+Add echoing to the audio.
+Echoes are reflected sound and can occur naturally amongst mountains
+(and sometimes large buildings) when talking or shouting; digital echo
+effects emulate this behaviour and are often used to help fill
+out the sound of a single instrument or vocal. The time difference
+between the original signal and the reflection is the `delay' (time),
+and the loudness of the reflected signal is the `decay'. Multiple echoes
+can have different delays and decays.
+.SP
+Each given
+.I "delay decay"
+pair gives the delay in milliseconds
+and the decay (relative to gain-in) of that echo.
+Gain-out is the volume of the output.
+For example:
+This will make it sound as if there are twice as many instruments as are
+actually playing:
+.EX
+ play lead.aiff echo 0.8 0.88 60 0.4
+.EE
+If the delay is very short, then it sound like a (metallic) robot playing
+music:
+.EX
+ play lead.aiff echo 0.8 0.88 6 0.4
+.EE
+A longer delay will sound like an open air concert in the mountains:
+.EX
+ play lead.aiff echo 0.8 0.9 1000 0.3
+.EE
+One mountain more, and:
+.EX
+ play lead.aiff echo 0.8 0.9 1000 0.3 1800 0.25
+.EE
+.TP
+\fBechos \fIgain-in gain-out\fR <\fIdelay decay\fR>
+Add a sequence of echoes to the audio.
+Each
+.I "delay decay"
+pair gives the delay in milliseconds
+and the decay (relative to gain-in) of that echo.
+Gain-out is the volume of the output.
+.SP
+Like the echo effect, echos stand for `ECHO in Sequel', that is the first echos
+takes the input, the second the input and the first echos, the third the input
+and the first and the second echos, ... and so on.
+Care should be taken using many echos; a single echos
+has the same effect as a single echo.
+.SP
+The sample will be bounced twice in symmetric echos:
+.EX
+ play lead.aiff echos 0.8 0.7 700 0.25 700 0.3
+.EE
+The sample will be bounced twice in asymmetric echos:
+.EX
+ play lead.aiff echos 0.8 0.7 700 0.25 900 0.3
+.EE
+The sample will sound as if played in a garage:
+.EX
+ play lead.aiff echos 0.8 0.7 40 0.25 63 0.3
+.EE
+.TP
+\fBequalizer \fIfrequency\fR[\fBk\fR]\fI width\fR[\fBq\fR\^|\^\fBo\fR\^|\^\fBh\fR\^|\^\fBk\fR] \fIgain\fR
+Apply a two-pole peaking equalisation (EQ) filter.
+With this filter, the signal-level at and around a selected frequency
+can be increased or decreased, whilst (unlike band-pass and band-reject
+filters) that at all other frequencies is unchanged.
+.SP
+\fIfrequency\fR gives the filter's central frequency in Hz,
+\fIwidth\fR, the band-width,
+and \fIgain\fR the required gain
+or attenuation in dB.
+Beware of
+.B Clipping
+when using a positive \fIgain\fR.
+.SP
+In order to produce complex equalisation curves, this effect
+can be given several times, each with a different central frequency.
+.SP
+The filter is described in detail in [1].
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.SP
+See also \fBbass\fR and \fBtreble\fR for shelving equalisation effects.
+.TP
+\fBfade\fR [\fItype\fR] \fIfade-in-length\fR [\fIstop-position(=)\fR [\fIfade-out-length\fR]]
+Apply a fade effect to the beginning, end, or both of the audio.
+.SP
+An optional \fItype\fR can be specified to select the shape of the fade
+curve:
+\fBq\fR for quarter of a sine wave, \fBh\fR for half a sine
+wave, \fBt\fR for linear (`triangular') slope, \fBl\fR for logarithmic,
+and \fBp\fR for inverted parabola. The default is logarithmic.
+.SP
+A fade-in starts from the first sample and ramps the signal level from 0
+to full volume over the time given as \fIfade-in-length\fR. Specify 0 if
+no fade-in is wanted.
+.SP
+For fade-outs, the audio will be truncated at
+.I stop-position
+and the signal level will be ramped from full volume down to 0 over an
+interval of \fIfade-out-length\fR before the \fIstop-position\fR. If
+.I fade-out-length
+is not specified, it defaults to the same value as
+\fIfade-in-length\fR.
+No fade-out is performed if
+.I stop-position
+is not specified.
+If the audio length can be determined from the input file header and any
+previous effects, then \fB\-0\fR (or, for historical reasons, \fB0\fR) may
+be specified for
+.I stop-position
+to indicate the usual case of a fade-out that ends at the end of the input
+audio stream.
+.SP
+Any time specification may be used for \fIfade-in-length\fR and
+\fIfade-out-length\fR.
+.SP
+See also the
+.B splice
+effect.
+.TP
+\fBfir\fR [\fIcoefs-file\fR\^|\^\fIcoefs\fR]
+Use SoX's FFT convolution engine with given FIR filter
+coefficients.
+If a single argument is given then this is treated as the name of a file
+containing the filter coefficients (white-space separated; may contain
+`#' comments). If the given filename is `\-', or if no argument is
+given, then the coefficients are read from the `standard input' (stdin);
+otherwise, coefficients may be given on the command line.
+Examples:
+.EX
+ sox infile outfile fir 0.0195 \-0.082 0.234 0.891 \-0.145 0.043
+.EE
+.EX
+ sox infile outfile fir coefs.txt
+.EE
+with coefs.txt containing
+.EX
+ # HP filter
+ # freq=10000
+ 1.2311233052619888e\-01
+ \-4.4777096106211783e\-01
+ 5.1031563346705155e\-01
+ \-6.6502926320995331e\-02
+ ...
+.EE
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.TP
+\fBflanger\fR [\fIdelay depth regen width speed shape phase interp\fR]
+Apply a flanging effect to the audio.
+See [3] for a detailed description of flanging.
+.SP
+All parameters are optional (right to left).
+.ne 15
+.TS
+center;
+cI cI cI lI
+cI c c l.
+\ Range Default Description
+delay 0 \- 30 0 Base delay in milliseconds.
+depth 0 \- 10 2 Added swept delay in milliseconds.
+regen \-95 \- 95 0 T{
+.na
+Percentage regeneration (delayed signal feedback).
+T}
+width 0 \- 100 71 T{
+.na
+Percentage of delayed signal mixed with original.
+T}
+speed 0\*d1 \- 10 0\*d5 Sweeps per second (Hz).
+shape \ sin Swept wave shape: \fBsine\fR\^|\^\fBtriangle\fR.
+phase 0 \- 100 25 T{
+.na
+Swept wave percentage phase-shift for multi-channel (e.g. stereo) flange;
+0 = 100 = same phase on each channel.
+T}
+interp \ lin T{
+.na
+Digital delay-line interpolation: \fBlinear\fR\^|\^\fBquadratic\fR.
+T}
+.TE
+.DT
+.TP
+\fBgain \fR[\fB\-e\fR\^|\^\fB\-B\fR\^|\^\fB\-b\fR\^|\^\fB\-r\fR] [\fB\-n\fR] [\fB\-l\fR\^|\^\fB\-h\fR] [\fIgain-dB\fR]
+Apply amplification or attenuation to the audio signal, or, in some
+cases, to some of its channels.
+Note that use of any of
+.BR \-e ,
+.BR \-B ,
+.BR \-b ,
+.BR \-r ,
+or
+.B \-n
+requires temporary file space to store the audio to be processed, so may
+be unsuitable for use with `streamed' audio.
+.SP
+Without other options,
+.I gain-dB
+is used to adjust the signal power level by the given number of dB:
+positive amplifies (beware of Clipping), negative attenuates. With
+other options, the
+.I gain-dB
+amplification or attenuation is (logically) applied after the processing due to those options.
+.SP
+Given the
+.B \-e
+option, the levels of the audio channels of a multi-channel file are `equalised', i.e.
+gain is applied to all channels other than that with the highest peak
+level, such that all channels attain the same peak level
+(but, without also giving
+.BR \-n ,
+the audio is not `normalised').
+.SP
+The
+.B \-B
+(balance) option is similar to
+.BR \-e ,
+but with
+.BR \-B,
+the RMS level is used instead of the peak level.
+.B \-B
+might be used to correct stereo imbalance caused by an imperfect record
+turntable cartridge. Note
+that unlike
+.BR \-e ,
+.B \-B
+might cause some clipping.
+.SP
+.B \-b
+is similar to
+.B \-B
+but has clipping protection, i.e. if necessary to prevent clipping
+whilst balancing, attenuation is applied to all channels.
+Note, however, that in conjunction with
+.BR \-n ,
+.B \-B
+and
+.B \-b
+are synonymous.
+.SP
+The
+.B \-r
+option is used in conjunction with a prior invocation of
+.B gain
+with the
+.B \-h
+option\*msee below for details.
+.SP
+The
+.B \-n
+option normalises the audio to 0dB FSD; it is often used in conjunction with a negative
+.I gain-dB
+to the effect that the audio is normalised to a given level below 0dB.
+For example,
+.EX
+ sox infile outfile gain \-n
+.EE
+normalises to 0dB, and
+.EX
+ sox infile outfile gain \-n \-3
+.EE
+normalises to \-3dB.
+.SP
+The
+.B \-l
+option invokes a simple limiter, e.g.
+.EX
+ sox infile outfile gain \-l 6
+.EE
+will apply 6dB of gain but never clip. Note that limiting more than a
+few dBs more than occasionally (in a piece of audio) is not recommended
+as it can cause audible distortion.
+See the
+.B compand
+effect for a more capable limiter.
+.SP
+The
+.B \-h
+option is used to apply gain to provide head-room for subsequent
+processing. For example, with
+.EX
+ sox infile outfile gain \-h bass +6
+.EE
+6dB of attenuation will be applied prior to the bass boosting effect
+thus ensuring that it will not clip. Of course, with bass, it is
+obvious how much headroom will be needed, but with other effects (e.g.
+rate, dither) it is not always as clear. Another advantage of using
+\fBgain \-h\fR rather than an explicit attenuation, is that if the
+headroom is not used by subsequent effects, it can be reclaimed with
+\fBgain \-r\fR, for example:
+.EX
+ sox infile outfile gain \-h bass +6 rate 44100 gain \-r
+.EE
+The above effects chain guarantees never to clip nor amplify;
+it attenuates if necessary to prevent clipping, but by only as
+much as is needed to do so.
+.SP
+Output formatting (dithering and bit-depth reduction) also requires
+headroom (which cannot be `reclaimed'), e.g.
+.EX
+ sox infile outfile gain \-h bass +6 rate 44100 gain \-rh dither
+.EE
+Here, the second
+.B gain
+invocation, reclaims as much of the headroom as it can from the
+preceding effects, but retains as much headroom as is needed for
+subsequent processing.
+The SoX global option
+.B \-G
+can be given to automatically invoke \fBgain \-h\fR and \fBgain \-r\fR.
+.SP
+See also the
+.B norm
+and
+.B vol
+effects.
+.TP
+\fBhighpass\fR\^|\^\fBlowpass\fR [\fB\-1\fR|\fB\-2\fR] \fIfrequency\fR[\fBk\fR]\fR [\fRwidth\fR[\fBq\fR\^|\^\fBo\fR\^|\^\fBh\fR\^|\^\fBk\fR]]
+Apply a high-pass or low-pass filter with 3dB point \fIfrequency\fR.
+The filter can be either single-pole (with
+.BR \-1 ),
+or double-pole (the default, or with
+.BR \-2 ).
+.I width
+applies only to double-pole filters;
+the default is Q = 0\*d707 and gives a Butterworth response. The filters
+roll off at 6dB per pole per octave (20dB per pole per decade). The
+double-pole filters are described in detail in [1].
+.SP
+These effects support the \fB\-\-plot\fR global option.
+.SP
+See also \fBsinc\fR for filters with a steeper roll-off.
+.TP
+\fBhilbert\fR [\fB\-n \fItaps\fR]
+Apply an odd-tap Hilbert transform filter, phase-shifting the signal
+by 90 degrees.
+.SP
+This is used in many matrix coding schemes and for analytic signal
+generation. The process is often written as a multiplication by \fIi\fR
+(or \fIj\fR), the imaginary unit.
+.SP
+An odd-tap Hilbert transform filter has a bandpass characteristic,
+attenuating the lowest and highest frequencies. Its bandwidth can be
+controlled by the number of filter taps, which can be specified with
+\fB\-n\fR. By default, the number of taps is chosen for a cutoff
+frequency of about 75 Hz.
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.TP
+\fBladspa\fR [\fB-l\fR\^|\^\fB-r\fR] \fImodule\fR [\fIplugin\fR] [\fIargument\fR ...]
+Apply a LADSPA [5] (Linux Audio Developer's Simple Plugin API) plugin.
+Despite the name, LADSPA is not Linux-specific, and a wide range of
+effects is available as LADSPA plugins, such as cmt [6] (the Computer
+Music Toolkit) and Steve Harris's plugin collection [7]. The first
+argument is the plugin module, the second the name of the plugin (a
+module can contain more than one plugin), and any other arguments are
+for the control ports of the plugin. Missing arguments are supplied by
+default values if possible.
+.SP
+Normally, the number of input ports of the plugin must match the number
+of input channels, and the number of output ports determines the output
+channel count. However, the
+.B \-r
+(replicate) option allows cloning a mono plugin to handle multi-channel
+input.
+.SP
+Some plugins introduce latency which SoX may optionally compensate for.
+The
+.B \-l
+(latency compensation) option automatically compensates for latency
+as reported by the plugin via an output control port named "latency".
+.SP
+If found, the environment variable LADSPA_PATH will be used as search
+path for plugins.
+.TP
+\fBloudness\fR [\fIgain\fR [\fIreference\fR]]
+Loudness control\*msimilar to the
+.B gain
+effect, but provides equalisation for the human auditory system. See
+http://en.wikipedia.org/wiki/Loudness for a detailed description of
+loudness. The gain is adjusted by the given
+.I gain
+parameter (usually negative) and the signal equalised according to ISO
+226 w.r.t. a reference level of 65dB, though an alternative
+.I reference
+level may be given if the original audio has been equalised for some
+other optimal level.
+A default gain of \-10dB is used if a
+.I gain
+value is not given.
+.SP
+See also the
+.B gain
+effect.
+.TP
+\fBlowpass\fR [\fB\-1\fR|\fB\-2\fR] \fIfrequency\fR[\fBk\fR]\fR [\fRwidth\fR[\fBq\fR\^|\^\fBo\fR\^|\^\fBh\fR\^|\^\fBk\fR]]
+Apply a low-pass filter.
+See the description of the \fBhighpass\fR effect for details.
+.TP
+\fBmcompand\fR \(dq\fIattack1\fB,\fIdecay1\fR{\fB,\fIattack2\fB,\fIdecay2\fR}
+[\fIsoft-knee-dB\fB:\fR]\fIin-dB1\fR[\fB,\fIout-dB1\fR]{\fB,\fIin-dB2\fB,\fIout-dB2\fR}
+.br
+[\fIgain\fR [\fIinitial-volume-dB\fR [\fIdelay\fR]]]\(dq {\fIcrossover-freq\fR[\fBk\fR] \(dqattack1,...\(dq}
+.SP
+The multi-band compander is similar to the single-band compander but the
+audio is first divided into bands using Linkwitz-Riley cross-over filters
+and a separately specifiable compander run on each band. See the
+\fBcompand\fR effect for the definition of its parameters. Compand
+parameters are specified between double quotes and the crossover
+frequency for that band is given by \fIcrossover-freq\fR; these can be
+repeated to create multiple bands.
+.SP
+For example, the following (one long) command shows how multi-band
+companding is typically used in FM radio:
+.EX
+.ne 8
+ play track1.wav gain \-3 sinc 8000\- 29 100 mcompand \\
+ \(dq0.005,0.1 \-47,\-40,\-34,\-34,\-17,\-33\(dq 100 \\
+ \(dq0.003,0.05 \-47,\-40,\-34,\-34,\-17,\-33\(dq 400 \\
+ \(dq0.000625,0.0125 \-47,\-40,\-34,\-34,\-15,\-33\(dq 1600 \\
+ \(dq0.0001,0.025 \-47,\-40,\-34,\-34,\-31,\-31,\-0,\-30\(dq 6400 \\
+ \(dq0,0.025 \-38,\-31,\-28,\-28,\-0,\-25\(dq \\
+ gain 15 highpass 22 highpass 22 sinc \-n 255 \-b 16 \-17500 \\
+ gain 9 lowpass \-1 17801
+.EE
+The audio file is played with a simulated FM radio sound (or broadcast
+signal condition if the lowpass filter at the end is skipped).
+Note that the pipeline is set up with US-style 75us pre-emphasis.
+.SP
+See also
+.B compand
+for a single-band companding effect.
+.TP
+\fBnoiseprof\fR [\fIprofile-file\fR]
+Calculate a profile of the audio for use in noise reduction. See the
+description of the \fBnoisered\fR effect for details.
+.TP
+\fBnoisered\fR [\fIprofile-file\fR [\fIamount\fR]]
+Reduce noise in the audio signal by profiling and filtering. This
+effect is moderately effective at removing consistent background noise
+such as hiss or hum. To use it, first run SoX with the \fBnoiseprof\fR
+effect on a section of audio that ideally would contain silence but in
+fact contains noise\*msuch sections are typically found at the beginning
+or the end of a recording. \fBnoiseprof\fR will write out a noise
+profile to \fIprofile-file\fR, or to stdout if no \fIprofile-file\fR or
+if `\-' is given. E.g.
+.EX
+ sox speech.wav \-n trim 0 1.5 noiseprof speech.noise-profile
+.EE
+To actually remove the noise, run SoX again, this time with the \fBnoisered\fR
+effect;
+.B noisered
+will reduce noise according to a noise profile (which was generated by
+.BR noiseprof ),
+from
+.IR profile-file ,
+or from stdin if no \fIprofile-file\fR or if `\-' is given. E.g.
+.EX
+ sox speech.wav cleaned.wav noisered speech.noise-profile 0.3
+.EE
+How much noise should be removed is specified by
+.IR amount \*ma
+number between 0 and 1 with a default of 0\*d5. Higher numbers will
+remove more noise but present a greater likelihood of removing wanted
+components of the audio signal. Before replacing an original recording
+with a noise-reduced version, experiment with different
+.I amount
+values to find the optimal one for your audio; use headphones to check
+that you are happy with the results, paying particular attention to quieter
+sections of the audio.
+.SP
+On most systems, the two stages\*mprofiling and reduction\*mcan be combined
+using a pipe, e.g.
+.EX
+ sox noisy.wav \-n trim 0 1 noiseprof | play noisy.wav noisered
+.EE
+.TP
+\fBnorm\fR [\fIdB-level\fR]
+Normalise the audio.
+.B norm
+is just an alias for \fBgain \-n\fR; see the
+.B gain
+effect for details.
+.TP
+\fBoops\fR
+Out Of Phase Stereo effect.
+Mixes stereo to twin-mono where each mono channel contains the
+difference between the left and right stereo channels.
+This is sometimes known as the `karaoke' effect as it often has the effect
+of removing most or all of the vocals from a recording.
+It is equivalent to \fBremix 1,2i 1,2i\fR.
+.TP
+\fBoverdrive\fR [\fIgain\fR(20) [\fIcolour\fR(20)]]
+Non linear distortion.
+The \fIcolour\fR parameter controls the amount of even harmonic content
+in the over-driven output.
+.TP
+\fBpad\fR { \fIlength\fR[\fB@\fIposition(=)\fR] }
+Pad the audio with silence, at the beginning, the end, or any
+specified points through the audio.
+.I length
+is the amount of silence to insert and
+.I position
+the position in the input audio stream at which to insert it.
+Any number of lengths and positions may be specified, provided that
+a specified position is not less that the previous one, and any time
+specification may be used for them.
+.I position
+is optional for the first and last lengths specified and
+if omitted correspond to the beginning and the end of the audio respectively.
+For example,
+.B pad 1\*d5 1\*d5
+adds 1\*d5 seconds of silence padding at each end of the audio, whilst
+.B pad 4000s@3:00
+inserts 4000 samples of silence 3 minutes into the audio.
+If silence is wanted only at the end of the audio, specify either the end
+position or specify a zero-length pad at the start.
+.SP
+See also
+.B delay
+for an effect that can add silence at the beginning of
+the audio on a channel-by-channel basis.
+.TP
+\fBphaser \fIgain-in gain-out delay decay speed\fR [\fB\-s\fR\^|\^\fB\-t\fR]
+Add a phasing effect to the audio.
+See [3] for a detailed description of phasing.
+.SP
+delay/decay/speed gives the delay in milliseconds
+and the decay (relative to gain-in) with a modulation
+speed in Hz.
+The modulation is either sinusoidal (\fB\-s\fR) \*mpreferable for multiple
+instruments, or triangular
+(\fB\-t\fR) \*mgives single instruments a sharper phasing effect.
+The decay should be less than 0\*d5 to avoid
+feedback, and usually no less than 0\*d1. Gain-out is the volume of the output.
+.SP
+For example:
+.EX
+ play snare.flac phaser 0.8 0.74 3 0.4 0.5 \-t
+.EE
+Gentler:
+.EX
+ play snare.flac phaser 0.9 0.85 4 0.23 1.3 \-s
+.EE
+A popular sound:
+.EX
+ play snare.flac phaser 0.89 0.85 1 0.24 2 \-t
+.EE
+More severe:
+.EX
+ play snare.flac phaser 0.6 0.66 3 0.6 2 \-t
+.EE
+.TP
+\fBpitch \fR[\fB\-q\fR] \fIshift\fR [\fIsegment\fR [\fIsearch\fR [\fIoverlap\fR]]]
+Change the audio pitch (but not tempo).
+.SP
+.I shift
+gives the pitch shift as positive or negative `cents' (i.e. 100ths of a
+semitone). See the
+.B tempo
+effect for a description of the other parameters.
+.SP
+See also the \fBbend\fR, \fBspeed\fR,
+and
+.B tempo
+effects.
+.TP
+\fBrate\fR [\fB\-q\fR\^|\^\fB\-l\fR\^|\^\fB\-m\fR\^|\^\fB\-h\fR\^|\^\fB\-v\fR] [override-options] \fIRATE\fR[\fBk\fR]
+Change the audio sampling rate (i.e. resample the audio) to any given
+.I RATE
+(even non-integer if this is supported by the output file format)
+using a quality level defined as follows:
+.ne 10
+.TS
+center;
+cI cI2w9 cI2w6 cIw6 lIw17
+cB c c c l.
+\ Quality T{
+.na
+Band-width
+T} Rej dB T{
+.na
+Typical Use
+T}
+\-q T{
+.na
+quick
+T} n/a T{
+.na
+\(~=30 @ \ Fs/4
+T} T{
+.na
+playback on ancient hardware
+T}
+\-l low 80% 100 T{
+.na
+playback on old hardware
+T}
+\-m medium 95% 100 T{
+.na
+audio playback
+T}
+\-h high 95% 125 T{
+.na
+16-bit mastering (use with dither)
+T}
+\-v T{
+.na
+very high
+T} 95% 175 24-bit mastering
+.TE
+.DT
+.SP
+where
+.I Band-width
+is the percentage of the audio frequency band that is preserved and
+.I Rej dB
+is the level of noise rejection. Increasing levels of resampling
+quality come at the expense of increasing amounts of time to process the
+audio. If no quality option is given, the quality level used is `high'
+(but see `Playing & Recording Audio' above regarding playback).
+.SP
+The `quick' algorithm uses cubic interpolation; all others use
+band-limited interpolation. By default, all algorithms have
+a `linear' phase response; for `medium', `high' and
+`very high', the phase response is configurable (see below).
+.SP
+The
+.B rate
+effect is invoked automatically if SoX's \fB\-r\fR option specifies a
+rate that is different to that of the input file(s). Alternatively, if
+this effect is given explicitly, then SoX's
+.B \-r
+option need not be given. For example, the following two commands are
+equivalent:
+.EX
+.ne 2
+ sox input.wav \-r 48k output.wav bass \-b 24
+ sox input.wav output.wav bass \-b 24 rate 48k
+.EE
+though the second command is more flexible as it allows
+.B rate
+options to be given, and allows the effects to be ordered arbitrarily.
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+Warning: technically detailed discussion follows.
+.SP
+The simple quality selection described above provides settings that
+satisfy the needs of the vast majority of resampling tasks.
+Occasionally, however, it may be desirable to fine-tune the resampler's
+filter response; this can be achieved using
+.IR override\ options ,
+as detailed in the following table:
+.ne 6
+.TS
+center;
+lB lw52.
+\-M/\-I/\-L Phase response = minimum/intermediate/linear
+\-s Steep filter (band-width = 99%)
+\-a Allow aliasing/imaging above the pass-band
+\-b\ 74\-99\*d7 Any band-width %
+\-p\ 0\-100 T{
+.na
+Any phase response (0 = minimum, 25 = intermediate, 50 = linear, 100 = maximum)
+T}
+.TE
+.DT
+.SP
+N.B. Override options cannot be used with the `quick' or `low'
+quality algorithms.
+.SP
+All resamplers use filters that can sometimes create `echo' (a.k.a.
+`ringing') artefacts with transient signals such as those that occur
+with `finger snaps' or other highly percussive sounds. Such artefacts are
+much more noticeable to the human ear if they occur before the transient
+(`pre-echo') than if they occur after it (`post-echo'). Note that
+frequency of any such artefacts is related to the smaller of the
+original and new sampling rates but that if this is at least 44\*d1kHz,
+then the artefacts will lie outside the range of human hearing.
+.SP
+A phase response setting may be used to control the distribution of any
+transient echo between
+`pre' and `post': with minimum phase, there is no pre-echo but the
+longest post-echo; with linear phase, pre and post echo are in equal
+amounts (in signal terms, but not audibility terms); the intermediate
+phase setting attempts to find the best compromise by selecting a small
+length (and level) of pre-echo and a medium lengthed post-echo.
+.SP
+Minimum, intermediate, or linear phase response is selected using the
+.BR \-M ,
+.BR \-I ,
+or
+.B \-L
+option; a custom phase response can be created with the
+.B \-p
+option. Note that phase responses between `linear' and `maximum'
+(greater than 50) are rarely useful.
+.SP
+A resampler's band-width setting determines how much of the frequency
+content of the original signal (w.r.t. the original sample rate when
+up-sampling, or the new sample rate when down-sampling) is preserved
+during conversion. The term `pass-band' is used to refer to all frequencies
+up to the band-width point (e.g. for 44\*d1kHz sampling rate, and a
+resampling band-width of 95%, the pass-band represents frequencies from
+0Hz (D.C.) to circa 21kHz). Increasing the resampler's band-width
+results in a slower conversion and can increase transient echo
+artefacts (and vice versa).
+.SP
+The
+.B \-s
+`steep filter' option changes resampling band-width from the default 95%
+(based on the 3dB point), to 99%. The
+.B \-b
+option allows the band-width to be set to any value in the range
+74\-99\*d7 %, but note that band-width values greater than 99% are not
+recommended for normal use as they can cause excessive transient echo.
+.SP
+If the
+.B \-a
+option is given, then aliasing/imaging above the pass-band is allowed. For
+example, with 44\*d1kHz sampling rate, and a
+resampling band-width of 95%, this means that frequency content above
+21kHz can be distorted; however, since this is above the pass-band (i.e.
+above the highest frequency of interest/audibility), this may not be a
+problem. The benefits of allowing aliasing/imaging are reduced processing time,
+and reduced (by almost half) transient echo artefacts.
+Note that if this option is given, then
+the minimum band-width allowable with
+.B \-b
+increases to 85%.
+.SP
+Examples:
+.EX
+ sox input.wav \-b 16 output.wav rate \-s \-a 44100 dither \-s
+.EE
+default (high) quality resampling; overrides: steep filter, allow
+aliasing; to 44\*d1kHz sample rate; noise-shaped dither to 16-bit WAV
+file.
+.EX
+ sox input.wav \-b 24 output.aiff rate \-v \-I \-b 90 48k
+.EE
+very high quality resampling; overrides: intermediate phase, band-width 90%;
+to 48k sample rate; store output to 24-bit AIFF file.
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+The
+.B pitch
+and
+.B speed
+effects use the
+.B rate
+effect at their core.
+.TP
+\fBremix\fR [\fB\-a\fR\^|\^\fB\-m\fR\^|\^\fB\-p\fR] <\fIout-spec\fR>
+\fIout-spec\fR = \fIin-spec\fR{\fB,\fIin-spec\fR} | \fB0\fR
+.br
+\fIin-spec\fR = [\fIin-chan\fR]\^[\fB\-\fR[\fIin-chan2\fR]]\^[\fIvol-spec\fR]
+.br
+\fIvol-spec\fR = \fBp\fR\^|\^\fBi\fR\^|\^\fBv\^\fR[\fIvolume\fR]
+.br
+.SP
+Select and mix input audio channels into output audio channels. Each output
+channel is specified, in turn, by a given \fIout-spec\fR: a list of
+contributing input channels and volume specifications.
+.SP
+Note that this effect operates on the audio
+.I channels
+within the SoX effects processing chain; it should not be confused with the
+.B \-m
+global option (where multiple
+.I files
+are mix-combined before entering the effects chain).
+.SP
+An
+.I out-spec
+contains comma-separated input channel-numbers and hyphen-delimited
+channel-number ranges; alternatively,
+.B 0
+may be given to create a silent output channel. For example,
+.EX
+ sox input.wav output.wav remix 6 7 8 0
+.EE
+creates an output file with four channels, where channels 1, 2, and 3 are
+copies of channels 6, 7, and 8 in the input file, and channel 4 is silent.
+Whereas
+.EX
+ sox input.wav output.wav remix 1\-3,7 3
+.EE
+creates a (somewhat bizarre) stereo output file where the left channel
+is a mix-down of input channels 1, 2, 3, and 7, and the right channel is
+a copy of input channel 3.
+.SP
+Where a range of channels is specified, the channel numbers to the left and
+right of the hyphen are optional and default to 1 and to the number of input
+channels respectively. Thus
+.EX
+ sox input.wav output.wav remix \-
+.EE
+performs a mix-down of all input channels to mono.
+.SP
+By default, where an output channel is mixed from multiple (n) input
+channels, each input channel will be scaled by a factor of \(S1/\s-2n\s+2.
+Custom mixing volumes can be set by following a given input channel or range
+of input channels with a \fIvol-spec\fR (volume specification).
+This is one of the letters \fBp\fR, \fBi\fR, or \fBv\fR,
+followed by a volume number, the meaning of which depends on the given
+letter and is defined as follows:
+.TS
+center;
+lI lI lI
+c l l.
+Letter Volume number Notes
+p power adjust in dB 0 = no change
+i power adjust in dB T{
+.na
+As `p', but invert the audio
+T}
+v voltage multiplier T{
+.na
+1 = no change, 0\*d5 \(~= 6dB attenuation, 2 \(~= 6dB gain, \-1 = invert
+T}
+.TE
+.DT
+.SP
+If an
+.I out-spec
+includes at least one
+.I vol-spec
+then, by default, \(S1/\s-2n\s+2 scaling is not applied to any other channels in the
+same out-spec (though may be in other out-specs).
+The \-a (automatic)
+option however, can be given to retain the automatic scaling in this
+case. For example,
+.EX
+ sox input.wav output.wav remix 1,2 3,4v0.8
+.EE
+results in channel level multipliers of 0\*d5,0\*d5 1,0\*d8, whereas
+.EX
+ sox input.wav output.wav remix \-a 1,2 3,4v0.8
+.EE
+results in channel level multipliers of 0\*d5,0\*d5 0\*d5,0\*d8.
+.SP
+The \-m (manual) option disables all automatic volume adjustments, so
+.EX
+ sox input.wav output.wav remix \-m 1,2 3,4v0.8
+.EE
+results in channel level multipliers of 1,1 1,0\*d8.
+.SP
+The volume number is optional and omitting it corresponds to no volume
+change; however, the only case in which this is useful is in conjunction
+with
+.BR i .
+For example, if
+.I input.wav
+is stereo, then
+.EX
+ sox input.wav output.wav remix 1,2i
+.EE
+is a mono equivalent of the
+.B oops
+effect.
+.SP
+If the \fB\-p\fR option is given, then any automatic \(S1/\s-2n\s+2 scaling
+is replaced by \(S1/\s-2\(srn\s+2 (`power') scaling; this gives a louder mix
+but one that might occasionally clip.
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+One use of the
+.B remix
+effect is to split an audio file into a set of files, each containing
+one of the constituent channels (in order to perform subsequent
+processing on individual audio channels). Where more than a few
+channels are involved, a script such as the following (Bourne shell
+script) is useful:
+.EX
+#!/bin/sh
+chans=\`soxi \-c "$1"\`
+while [ $chans \-ge 1 ]; do
+ chans0=\`printf %02i $chans\` # 2 digits hence up to 99 chans
+ out=\`echo "$1"|sed "s/\\(.*\\)\\.\\(.*\\)/\\1\-$chans0.\\2/"\`
+ sox "$1" "$out" remix $chans
+ chans=\`expr $chans \- 1\`
+done
+.EE
+If a file
+.I input.wav
+containing six audio channels were given, the script would produce six
+output files:
+.IR input-01.wav ,
+\fIinput-02.wav\fR, ...,
+.IR input-06.wav .
+.SP
+See also the \fBswap\fR effect.
+.TP
+\fBrepeat\fR [\fIcount\fR(1)|\fB\-\fR]
+Repeat the entire audio \fIcount\fR times, or once if \fIcount\fR is not given.
+The special value \fB\-\fR requests infinite repetition.
+Requires temporary file space to store the audio to be repeated.
+Note that repeating once yields two copies: the original audio and the
+repeated audio.
+.TP
+\fBreverb\fR [\fB\-w\fR|\fB\-\-wet-only\fR] [\fIreverberance\fR (50%) [\fIHF-damping\fR (50%)
+[\fIroom-scale\fR (100%) [\fIstereo-depth\fR (100%)
+.br
+[\fIpre-delay\fR (0ms) [\fIwet-gain\fR (0dB)]]]]]]
+.SP
+Add reverberation to the audio using the `freeverb' algorithm. A
+reverberation effect is sometimes desirable for concert halls that are too
+small or contain so many people that the hall's natural reverberance is
+diminished. Applying a small amount of stereo reverb to a (dry) mono signal
+will usually make it sound more natural. See [3] for a detailed description
+of reverberation.
+.SP
+Note that this effect
+increases both the volume and the length of the audio, so to prevent clipping
+in these domains, a typical invocation might be:
+.EX
+ play dry.wav gain \-3 pad 0 3 reverb
+.EE
+The
+.B \-w
+option can be given to select only the `wet' signal, thus allowing it to be
+processed further, independently of the `dry' signal. E.g.
+.EX
+ play \-m voice.wav "|sox voice.wav \-p reverse reverb \-w reverse"
+.EE
+for a reverse reverb effect.
+.TP
+\fBreverse\fR
+Reverse the audio completely.
+Requires temporary file space to store the audio to be reversed.
+.TP
+\fBriaa\fR
+Apply RIAA vinyl playback equalisation.
+The sampling rate must be one of: 44\*d1, 48, 88\*d2, 96 kHz.
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.TP
+\fBsilence \fR[\fB\-l\fR] \fIabove-periods\fR [\fIduration threshold\fR[\fBd\fR\^|\^\fB%\fR]
+[\fIbelow-periods duration threshold\fR[\fBd\fR\^|\^\fB%\fR]]
+.SP
+Removes silence from the beginning, middle, or end of the audio.
+`Silence' is determined by a specified threshold.
+.SP
+The \fIabove-periods\fR value is used to indicate if audio should be
+trimmed at the beginning of the audio. A value of zero indicates no
+silence should be trimmed from the beginning. When specifying a
+non-zero \fIabove-periods\fR, it trims audio up until it finds
+non-silence. Normally, when trimming silence from beginning of audio
+the \fIabove-periods\fR will be 1 but it can be increased to higher
+values to trim all audio up to a specific count of non-silence
+periods. For example, if you had an audio file with two songs that
+each contained 2 seconds of silence before the song, you could specify
+an \fIabove-period\fR of 2 to strip out both silence periods and the
+first song.
+.SP
+When \fIabove-periods\fR is non-zero, you must also specify a
+\fIduration\fR and \fIthreshold\fR. \fIduration\fR indicates the
+amount of time that non-silence must be detected before it stops
+trimming audio. By increasing the duration, burst of noise can be
+treated as silence and trimmed off.
+.SP
+\fIthreshold\fR is used to indicate what sample value you should treat as
+silence. For digital audio, a value of 0 may be fine but for audio
+recorded from analog, you may wish to increase the value to account
+for background noise.
+.SP
+When optionally trimming silence from the end of the audio, you specify
+a \fIbelow-periods\fR count. In this case, \fIbelow-period\fR means
+to remove all audio after silence is detected.
+Normally, this will be a value 1 of but it can
+be increased to skip over periods of silence that are wanted. For example,
+if you have a song with 2 seconds of silence in the middle and 2 second
+at the end, you could set below-period to a value of 2 to skip over the
+silence in the middle of the audio.
+.SP
+For \fIbelow-periods\fR, \fIduration\fR specifies a period of silence
+that must exist before audio is not copied any more. By specifying
+a higher duration, silence that is wanted can be left in the audio.
+For example, if you have a song with an expected 1 second of silence
+in the middle and 2 seconds of silence at the end, a duration of 2
+seconds could be used to skip over the middle silence.
+.SP
+Unfortunately, you must know the length of the silence at the
+end of your audio file to trim off silence reliably. A workaround is
+to use the \fBsilence\fR effect in combination with the \fBreverse\fR effect.
+By first reversing the audio, you can use the \fIabove-periods\fR
+to reliably trim all audio from what looks like the front of the file.
+Then reverse the file again to get back to normal.
+.SP
+To remove silence from the middle of a file, specify a
+\fIbelow-periods\fR that is negative. This value is then
+treated as a positive value and is also used to indicate that the
+effect should restart processing as specified by the
+\fIabove-periods\fR, making it suitable for removing periods of
+silence in the middle of the audio.
+.SP
+The option
+.B \-l
+indicates that \fIbelow-periods\fR \fIduration\fR length of audio
+should be left intact at the beginning of each period of silence.
+For example, if you want to remove long pauses between words
+but do not want to remove the pauses completely.
+.SP
+\fIduration\fR is a time specification with the peculiarity that a bare
+number is interpreted as a sample count, not as a number of seconds.
+For specifying seconds, either use the \fBt\fR suffix (as in `2t') or
+specify minutes, too (as in `0:02').
+.SP
+\fIthreshold\fR numbers may be suffixed with
+.B d
+to indicate the value is in decibels, or
+.B %
+to indicate a percentage of maximum value of the sample value
+(\fB0%\fR specifies pure digital silence).
+.SP
+The following example shows how this effect can be used to start a recording
+that does not contain the delay at the start which usually occurs between
+`pressing the record button' and the start of the performance:
+.EX
+ rec \fIparameters filename other-effects\fR silence 1 5 2%
+.EE
+.na
+.TP
+\fBsinc\fR [\fB\-a\fI att\fR\^|\^\fB\-b\fI beta\fR] [\fB\-p\fI phase\fR\^|\^\fB\-M\fR\^|\^\fB\-I\fR\^|\^\fB\-L\fR] \:[\fB\-t\fI tbw\fR\^|\^\fB\-n\fI taps\fR] [\fIfreqHP\fR]\:[\fB\-\fIfreqLP\fR [\fB\-t\fR tbw\^|\^\fB\-n\fR taps]]
+.ad
+Apply a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject filter
+to the signal.
+The \fIfreqHP\fR and \fIfreqLP\fR parameters give the frequencies of the
+6dB points of a high-pass and low-pass filter that may be invoked
+individually, or together. If both are
+given, then \fIfreqHP\fR less than \fIfreqLP\fR creates a band-pass filter,
+\fIfreqHP\fR greater than \fIfreqLP\fR creates a band-reject filter.
+For example, the invocations
+.EX
+ sinc 3k
+ sinc -4k
+ sinc 3k-4k
+ sinc 4k-3k
+.EE
+create a high-pass, low-pass, band-pass, and band-reject filter
+respectively.
+.SP
+The default stop-band attenuation of 120dB can be overridden with
+\fB\-a\fR; alternatively, the kaiser-window `beta' parameter can be
+given directly with \fB\-b\fR.
+.SP
+The default transition band-width of 5% of the total band can be
+overridden with \fB\-t\fR (and \fItbw\fR in Hertz); alternatively, the
+number of filter taps can be given directly with \fB\-n\fR.
+.SP
+If both \fIfreqHP\fR and \fIfreqLP\fR are given, then a \fB\-t\fR or
+\fB\-n\fR option given to the left of the frequencies applies to both
+frequencies; one of these options given to the right of the frequencies
+applies only to \fIfreqLP\fR.
+.SP
+The
+.BR \-p ,
+.BR \-M ,
+.BR \-I ,
+and
+.B \-L
+options control the filter's phase response; see the \fBrate\fR effect
+for details.
+.SP
+This effect supports the \fB\-\-plot\fR global option.
+.TP
+\fBspectrogram \fR[\fIoptions\fR]
+Create a spectrogram of the audio; the audio is passed unmodified
+through the SoX processing chain. This effect is optional\*mtype
+\fBsox \-\-help\fR and check the list of supported effects to see if
+it has been included.
+.SP
+The spectrogram is rendered in a Portable Network Graphic (PNG) file,
+and shows time in the X-axis, frequency in the Y-axis, and audio
+signal magnitude in the Z-axis. Z-axis values are represented by the
+colour (or optionally the intensity) of the pixels in the X-Y plane.
+If the audio signal contains multiple channels then these are shown
+from top to bottom starting from channel 1 (which is the left channel
+for stereo audio).
+.SP
+For example, if `my.wav' is a stereo file, then with
+.EX
+ sox my.wav \-n spectrogram
+.EE
+a spectrogram of the entire file will be created in the file
+`spectrogram.png'. More often though, analysis of a smaller portion
+of the audio is required; e.g. with
+.EX
+ sox my.wav \-n remix 2 trim 20 30 spectrogram
+.EE
+the spectrogram shows information only from the second (right)
+channel, and of thirty seconds of audio starting from twenty seconds
+in. To analyse a small portion of the frequency domain, the
+.B rate
+effect may be used, e.g.
+.EX
+ sox my.wav \-n rate 6k spectrogram
+.EE
+allows detailed analysis of frequencies up to 3kHz (half the sampling
+rate) i.e. where the human auditory system is most sensitive.
+With
+.EX
+ sox my.wav \-n trim 0 10 spectrogram \-x 600 \-y 200 \-z 100
+.EE
+the given options control the size of the spectrogram's X, Y & Z axes
+(in this case, the spectrogram area of the produced image will be 600
+by 200 pixels in size and the Z-axis range will be 100 dB). Note that
+the produced image includes axes legends etc. and so will be a little
+larger than the specified spectrogram size. In this example:
+.EX
+ sox \-n \-n synth 6 tri 10k:14k spectrogram \-z 100 \-w kaiser
+.EE
+an analysis `window' with high dynamic range is selected to best
+display the spectrogram of a swept triangular wave. For a smilar
+example, append the following to the `chime' command in the
+description of the
+.B delay
+effect (above):
+.EX
+ rate 2k spectrogram \-X 200 \-Z \-10 \-w kaiser
+.EE
+Options are also available to control the appearance (colour-set,
+brightness, contrast, etc.) and filename of the spectrogram; e.g. with
+.EX
+ sox my.wav \-n spectrogram \-m \-l \-o print.png
+.EE
+a spectrogram is created suitable for printing on a `black and white'
+printer.
+.SP
+.I Options:
+.RS
+.IP \fB\-x\ \fInum\fR
+Change the (maximum) width (X-axis) of the spectrogram from its default
+value of 800 pixels to a given number between 100 and 200000.
+See also \fB\-X\fR and \fB\-d\fR.
+.IP \fB\-X\ \fInum\fR
+X-axis pixels/second; the default is auto-calculated to fit the given
+or known audio duration to the X-axis size, or 100 otherwise. If
+given in conjunction with \fB\-d\fR, this option affects the width of
+the spectrogram; otherwise, it affects the duration of the
+spectrogram.
+.I num
+can be from 1 (low time resolution) to 5000 (high time resolution)
+and need not be an integer. SoX
+may make a slight adjustment to the given number for processing
+quantisation reasons; if so, SoX will report the actual number used
+(viewable when the SoX global option
+.B \-V
+is in effect).
+See also \fB\-x\fR and \fB\-d\fR.
+.IP \fB\-y\ \fInum\fR
+Sets the Y-axis size in pixels (per channel); this is the number of
+frequency `bins' used in the Fourier analysis that produces the
+spectrogram. N.B. it can be slow to produce the spectrogram if this
+number is not one more than a power of two (e.g. 129). By default the
+Y-axis size is chosen automatically (depending on the number of
+channels). See
+.B \-Y
+for alternative way of setting spectrogram height.
+.IP \fB\-Y\ \fInum\fR
+Sets the target total height of the spectrogram(s). The default value
+is 550 pixels. Using this option (and by default), SoX will choose a
+height for individual spectrogram channels that is one more than a
+power of two, so the actual total height may fall short of the given
+number. However, there is also a minimum height per channel so if
+there are many channels, the number may be exceeded.
+See
+.B \-y
+for alternative way of setting spectrogram height.
+.IP \fB\-z\ \fInum\fR
+Z-axis (colour) range in dB, default 120. This sets the dynamic-range
+of the spectrogram to be \-\fInum\fR\ dBFS to 0\ dBFS.
+.I Num
+may range from 20 to 180. Decreasing dynamic-range effectively
+increases the `contrast' of the spectrogram display, and vice versa.
+.IP \fB\-Z\ \fInum\fR
+Sets the upper limit of the Z-axis in dBFS.
+A negative
+.I num
+effectively increases the `brightness' of the spectrogram display,
+and vice versa.
+.IP \fB\-q\ \fInum\fR
+Sets the Z-axis quantisation, i.e. the number of different colours (or
+intensities) in which to render Z-axis
+values. A small number (e.g. 4) will give a `poster'-like effect making
+it easier to discern magnitude bands of similar level. Small numbers
+also usually
+result in small PNG files. The number given specifies the number of
+colours to use inside the Z-axis range; two colours are reserved to
+represent out-of-range values.
+.IP \fB\-w\ \fIname\fR
+Window: Hann (default), Hamming, Bartlett, Rectangular, Kaiser or Dolph. The
+spectrogram is produced using the Discrete Fourier Transform (DFT)
+algorithm. A significant parameter to this algorithm is the choice of
+`window function'. By default, SoX uses the Hann window which has good
+all-round frequency-resolution and dynamic-range properties. For better
+frequency resolution (but lower dynamic-range), select a Hamming window;
+for higher dynamic-range (but poorer frequency-resolution), select a
+Dolph window. Kaiser, Bartlett and Rectangular windows are also available.
+.IP \fB\-W\ \fInum\fR
+Window adjustment parameter. This can be used to make small
+adjustments to the Kaiser or Dolph window shape. A positive number (up to
+ten) increases its dynamic range, a negative number decreases it.
+.IP \fB\-s\fR
+Allow slack overlapping of DFT windows.
+This can, in some cases, increase image sharpness and give greater adherence
+to the
+.B \-x
+value, but at the expense of a little spectral loss.
+.IP \fB\-m\fR
+Creates a monochrome spectrogram (the default is colour).
+.IP \fB\-h\fR
+Selects a high-colour palette\*mless visually pleasing than the default
+colour palette, but it may make it easier to differentiate different levels.
+If this option is used in conjunction with
+.BR \-m ,
+the result will be a hybrid monochrome/colour palette.
+.IP \fB\-p\ \fInum\fR
+Permute the colours in a colour or hybrid palette.
+The
+.I num
+parameter, from 1 (the default) to 6, selects the permutation.
+.IP \fB\-l\fR
+Creates a `printer friendly' spectrogram with a light background (the
+default has a dark background).
+.IP \fB\-a\fR
+Suppress the display of the axis lines. This is sometimes useful in
+helping to discern artefacts at the spectrogram edges.
+.IP \fB\-r\fR
+Raw spectrogram: suppress the display of axes and legends.
+.IP \fB\-A\fR
+Selects an alternative, fixed colour-set. This is provided only for
+compatibility with spectrograms produced by another package. It should
+not normally be used as it has some problems, not least, a lack of
+differentiation at the bottom end which results in masking of low-level
+artefacts.
+.IP \fB\-t\ \fItext\fR
+Set the image title\*mtext to display above the spectrogram.
+.IP \fB\-c\ \fItext\fR
+Set (or clear) the image comment\*mtext to display below and to the
+left of the spectrogram.
+.IP \fB\-o\ \fIfile\fR
+Name of the spectrogram output PNG file, default `spectrogram.png'.
+If `-' is given, the spectrogram will be sent to standard output
+(stdout).
+.RE
+.TP
+\
+.I Advanced Options:
+.br
+In order to process a smaller section of audio without affecting other
+effects or the output signal (unlike when the
+.B trim
+effect is used), the following options may be used.
+.RS
+.IP \fB\-d\ \fIduration\fR
+This option sets the X-axis resolution such that audio with the given
+.I duration
+(a time specification) fits the selected (or default) X-axis width. For
+example,
+.EX
+ sox input.mp3 output.wav \-n spectrogram \-d 1:00 stats
+.EE
+creates a spectrogram showing the first minute of the audio, whilst
+.EE
+the
+.B stats
+effect is applied to the entire audio signal.
+.SP
+See also
+.B \-X
+for an alternative way of setting the X-axis resolution.
+.IP \fB\-S\ \fIposition(=)\fR
+Start the spectrogram at the given point in the audio stream. For
+example
+.EX
+ sox input.aiff output.wav spectrogram \-S 1:00
+.EE
+creates a spectrogram showing all but the first minute of the audio
+(the output file, however, receives the entire audio stream).
+.RE
+.TP
+\
+For the ability to perform off-line processing of spectral data, see the
+.B stat
+effect.
+.TP
+\fBspeed \fIfactor\fR[\fBc\fR]
+Adjust the audio speed (pitch and tempo together). \fIfactor\fR
+is either the ratio of the new speed to the old speed: greater
+than 1 speeds up, less than 1 slows down, or, if appended with the
+letter
+`c', the number of cents (i.e. 100ths of a semitone) by
+which the pitch (and tempo) should be adjusted: greater than 0
+increases, less than 0 decreases.
+.SP
+Technically, the speed effect only changes the sample rate information,
+leaving the samples themselves untouched. The \fBrate\fR effect is invoked
+automatically to resample to the output sample rate, using its default
+quality/speed. For higher quality or higher speed
+resampling, in addition to the \fBspeed\fR effect, specify
+the \fBrate\fR effect with the desired quality option.
+.SP
+See also the \fBbend\fR, \fBpitch\fR,
+and
+.B tempo
+effects.
+.TP
+\fBsplice \fR [\fB\-h\fR\^|\^\fB\-t\fR\^|\^\fB\-q\fR] { \fIposition(=)\fR[\fB,\fIexcess\fR[\fB,\fIleeway\fR]] }
+Splice together audio sections. This effect provides two things over
+simple audio concatenation: a (usually short) cross-fade is applied at
+the join, and a wave similarity comparison is made to help determine the
+best place at which to make the join.
+.SP
+One of the options
+.BR \-h ,
+.BR \-t ,
+or
+.B \-q
+may be given to select the fade envelope as half-cosine wave (the default),
+triangular (a.k.a. linear), or quarter-cosine wave respectively.
+.TS
+center;
+cI lI lI lI
+cB l l l.
+Type Audio Fade level Transitions
+t correlated constant gain abrupt
+h correlated constant gain smooth
+q uncorrelated constant power smooth
+.TE
+.DT
+.SP
+To perform a splice, first use the
+.B trim
+effect to select the audio sections to be joined together. As when
+performing a tape splice, the end of the section to be spliced onto
+should be trimmed with a small
+.I excess
+(default 0\*d005 seconds) of audio after the ideal joining point. The
+beginning of the audio section to splice on should be trimmed with the
+same
+.IR excess
+(before the ideal joining point), plus an additional
+.I leeway
+(default 0\*d005 seconds). Any time specification may be used for these
+parameters. SoX should then be invoked with the two
+audio sections as input files and the
+.B splice
+effect given with the position at which to perform the splice\*mthis is
+length of the first audio section (including the excess).
+.SP
+The following diagram uses the tape analogy to illustrate the splice
+operation. The effect simulates the diagonal cuts and joins the two pieces:
+.EX
+
+ length1 excess
+ -----------><--->
+ _________ : : _________________
+ \\ : : :\\ `
+ \\ : : : \\ `
+ \\: : : \\ `
+ * : : * - - *
+ \\ : : :\\ `
+ \\ : : : \\ `
+ _______________\\: : : \\_____`____
+ : : : :
+ <---> <----->
+ excess leeway
+
+.EE
+where * indicates the joining points.
+.SP
+For example, a long song begins with two verses which start (as
+determined e.g. by using the
+.B play
+command with the
+.B trim
+(\fIstart\fR) effect) at times 0:30\*d125 and 1:03\*d432.
+The following commands cut out the first verse:
+.EX
+ sox too-long.wav part1.wav trim 0 30.130
+.EE
+(5 ms excess, after the first verse starts)
+.EX
+ sox too-long.wav part2.wav trim 1:03.422
+.EE
+(5 ms excess plus 5 ms leeway, before the second verse starts)
+.EX
+ sox part1.wav part2.wav just-right.wav splice 30.130
+.EE
+For another example, the SoX command
+.EX
+ play "|sox \-n \-p synth 1 sin %1" "|sox \-n \-p synth 1 sin %3"
+.EE
+generates and plays two notes, but there is a nasty click at the
+transition; the click can be removed by splicing instead of
+concatenating the audio, i.e. by appending \fBsplice 1\fR to the
+command. (Clicks at the beginning and end of the audio can be removed by
+\fIpreceding\fR the splice effect with \fBfade q .01 2 .01\fR).
+.SP
+Provided your arithmetic is good enough, multiple splices can be
+performed with a single
+.B splice
+invocation. For example:
+.EX
+#!/bin/sh
+# Audio Copy and Paste Over
+# acpo infile copy-start copy-stop paste-over-start outfile
+# No chained time specifications allowed for the parameters
+# (i.e. such that contain +/\-).
+e=0.005 # Using default excess
+l=$e # and leeway.
+sox "$1" piece.wav trim $2\-$e\-$l =$3+$e
+sox "$1" part1.wav trim 0 $4+$e
+sox "$1" part2.wav trim $4+$3\-$2\-$e\-$l
+sox part1.wav piece.wav part2.wav "$5" \\
+ splice $4+$e +$3\-$2+$e+$l+$e
+.EE
+In the above Bourne shell script,
+two splices are used to `copy and paste' audio.
+.TS
+center;
+c8 c8 c.
+* * *
+.TE
+.DT
+.SP
+It is also possible to use this effect to perform general cross-fades,
+e.g. to join two songs. In this case,
+.I excess
+would typically be an number of seconds, the
+.B \-q
+option would typically be given (to select an `equal power' cross-fade), and
+.I leeway
+should be zero (which is the default if
+.B \-q
+is given). For example, if f1.wav and f2.wav are audio files
+to be cross-faded, then
+.EX
+ sox f1.wav f2.wav out.wav splice \-q $(soxi \-D f1.wav),3
+.EE
+cross-fades the files where the point of equal loudness is 3 seconds
+before the end of f1.wav, i.e. the total length of the cross-fade is
+2 \(mu 3 = 6 seconds (Note: the $(...) notation is POSIX shell).
+.TP
+\fBstat\fR [\fB\-s \fIscale\fR] [\fB\-rms\fR] [\fB\-freq\fR] [\fB\-v\fR] [\fB\-d\fR]
+Display time and frequency domain statistical information about the audio.
+Audio is passed unmodified through the SoX processing chain.
+.SP
+The information is output to the `standard error' (stderr) stream and is
+calculated, where
+.I n
+is the duration of the audio in samples,
+.I c
+is the number of audio channels,
+.I r
+is the audio sample rate, and
+.I x\s-2\dk\u\s0
+represents the PCM value (in the range \-1 to +1 by default) of each successive
+sample in the audio,
+as follows:
+.TS
+center;
+lI l l.
+Samples read \fIn\fR\^\(mu\^\fIc\fR \
+Length (seconds) \fIn\fR\^\(di\^\fIr\fR
+Scaled by \ See \-s below.
+Maximum amplitude max(\fIx\s-2\dk\u\s0\fR) T{
+The maximum sample value in the audio; usually this will be a positive number.
+T}
+Minimum amplitude min(\fIx\s-2\dk\u\s0\fR) T{
+The minimum sample value in the audio; usually this will be a negative number.
+T}
+Midline amplitude \(12\^min(\fIx\s-2\dk\u\s0\fR)\^+\^\(12\^max(\fIx\s-2\dk\u\s0\fR)
+Mean norm \(S1/\s-2n\s+2\^\(*S\^\^\(br\^\fIx\s-2\dk\u\s0\fR\^\(br\^ T{
+The average of the absolute value of each sample in the audio.
+T}
+Mean amplitude \(S1/\s-2n\s+2\^\(*S\^\fIx\s-2\dk\u\s0\fR T{
+The average of each sample in the audio. If this figure is non-zero, then it indicates the
+presence of a D.C. offset (which could be removed using the
+.B dcshift
+effect).
+T}
+RMS amplitude \(sr(\(S1/\s-2n\s+2\^\(*S\^\fIx\s-2\dk\u\s0\fR\(S2) T{
+The level of a D.C. signal that would have the same power
+as the audio's average power.
+T}
+Maximum delta max(\^\(br\^\fIx\s-2\dk\u\s0\fR\^\-\^\fIx\s-2\dk\-1\u\s0\fR\^\(br\^)
+Minimum delta min(\^\(br\^\fIx\s-2\dk\u\s0\fR\^\-\^\fIx\s-2\dk\-1\u\s0\fR\^\(br\^)
+Mean delta \(S1/\s-2n\-1\s+2\^\(*S\^\^\(br\^\fIx\s-2\dk\u\s0\fR\^\-\^\fIx\s-2\dk\-1\u\s0\fR\^\(br\^
+RMS delta \(sr(\(S1/\s-2n\-1\s+2\^\(*S\^(\fIx\s-2\dk\u\s0\fR\^\-\^\fIx\s-2\dk\-1\u\s0\fR)\(S2)
+Rough frequency \ In Hz.
+Volume Adjustment \ T{
+The parameter to the
+.B vol
+effect which would make the audio as loud as possible without clipping.
+Note: See the discussion on
+.B Clipping
+above for reasons why it is rarely a good idea actually to do this.
+T}
+.TE
+.DT
+.SP
+Note that the delta measurements are not applicable for multi-channel audio.
+.SP
+The
+.B \-s
+option can be used to scale the input data by a given factor.
+The default value of
+.I scale
+is 2147483647 (i.e. the maximum value of a 32-bit signed integer).
+Internal effects
+always work with signed long PCM data and so the value should relate to this
+fact.
+.SP
+The
+.B \-rms
+option will convert all output average values to `root mean square'
+format.
+.SP
+The
+.B \-v
+option displays only the `Volume Adjustment' value.
+.SP
+The
+.B \-freq
+option calculates the input's power spectrum (4096 point DFT) instead of the
+statistics listed above. This should only be used with a single channel
+audio file.
+.SP
+The
+.B \-d
+option
+displays a hex dump of the 32-bit signed PCM data
+audio in SoX's internal buffer.
+This is mainly used to help track down endian problems that
+sometimes occur in cross-platform versions of SoX.
+.SP
+See also the
+.B stats
+effect.
+.TP
+\fBstats\fR [\fB\-b \fIbits\fR\^|\^\fB\-x \fIbits\fR\^|\^\fB\-s \fIscale\fR] [\fB\-w \fIwindow-time\fR]
+Display time domain statistical information about the audio channels;
+audio is passed unmodified through the SoX processing chain.
+Statistics are calculated and displayed for each audio channel and,
+where applicable, an overall figure is also given.
+.SP
+For example, for a typical well-mastered stereo music file:
+.TS
+center;
+l.
+.ft CW
+ Overall Left Right
+DC offset 0.000803 \-0.000391 0.000803
+Min level \-0.750977 \-0.750977 \-0.653412
+Max level 0.708801 0.708801 0.653534
+Pk lev dB \-2.49 \-2.49 \-3.69
+RMS lev dB \-19.41 \-19.13 \-19.71
+RMS Pk dB \-13.82 \-13.82 \-14.38
+RMS Tr dB \-85.25 \-85.25 \-82.66
+Crest factor \- 6.79 6.32
+Flat factor 0.00 0.00 0.00
+Pk count 2 2 2
+Bit-depth 16/16 16/16 16/16
+Num samples 7.72M
+Length s 174.973
+Scale max 1.000000
+Window s 0.050
+.ft R
+.TE
+.DT
+.SP
+.IR DC\ offset ,
+.IR Min\ level ,
+and
+.I Max\ level
+are shown, by default, in the range \(+-1.
+If the
+.B \-b
+(bits) options is given, then these three measurements will be scaled to a signed integer
+with the given number of bits; for example, for 16 bits, the scale would be \-32768 to +32767.
+The
+.B \-x
+option behaves the same way as
+.B \-b
+except that the signed integer values are displayed in hexadecimal.
+The
+.B \-s
+option scales the three measurements by a given floating-point number.
+.SP
+.I Pk\ lev\ dB
+and
+.I RMS\ lev\ dB
+are standard peak and RMS level measured in dBFS.
+.I RMS\ Pk\ dB
+and
+.I RMS\ Tr\ dB
+are peak and trough values for RMS level measured over a short window (default 50ms).
+.SP
+.I Crest\ factor
+is the standard ratio of peak to RMS level (note: not in dB).
+.SP
+.I Flat\ factor
+is a measure of the flatness (i.e. consecutive samples with the same value) of the signal at
+its peak levels (i.e. either
+.IR Min\ level ,
+or
+.IR Max\ level ).
+.I Pk\ count
+is the number of occasions (not the number of samples) that the signal attained either
+.IR Min\ level ,
+or
+.IR Max\ level .
+.SP
+The right-hand
+.I Bit-depth
+figure is the standard definition of bit-depth i.e. bits less
+significant than the given number are fixed at zero. The left-hand
+figure is the number of most significant bits that are fixed at zero (or
+one for negative numbers) subtracted from the right-hand figure (the
+number subtracted is directly related to
+.IR Pk\ lev\ dB ).
+.SP
+For multi-channel audio, an overall figure for each of the above
+measurements is given and derived from the channel figures as follows:
+.IR DC\ offset :
+maximum magnitude;
+.IR Max\ level ,
+.IR Pk\ lev\ dB ,
+.IR RMS\ Pk\ dB ,
+.IR Bit-depth :
+maximum;
+.IR Min\ level ,
+.IR RMS\ Tr\ dB :
+minimum;
+.IR RMS\ lev\ dB ,
+.IR Flat\ factor ,
+.IR Pk\ count :
+average;
+.IR Crest\ factor :
+not applicable.
+.SP
+.I Length\ s
+is the duration in seconds of the audio, and
+.I Num\ samples
+is equal to the sample-rate multiplied by
+.IR Length .
+.I Scale\ Max
+is the scaling applied to the first three measurements;
+specifically, it is the maximum value that could apply to
+.IR Max\ level .
+.I Window\ s
+is the length of the window used for the peak and trough RMS measurements.
+.SP
+See also the
+.B stat
+effect.
+.TP
+\fBswap\fR
+Swap stereo channels. If the input is not stereo, pairs of channels are
+swapped, and a possible odd last channel passed through. E.g., for seven
+channels, the output order will be 2, 1, 4, 3, 6, 5, 7.
+.SP
+See also
+.B remix
+for an effect that allows arbitrary channel selection and ordering
+(and mixing).
+.TP
+\fBstretch \fIfactor\fR [\fIwindow fade shift fading\fR]
+Change the audio duration (but not its pitch).
+This effect is broadly equivalent to the
+.B tempo
+effect with (\fIfactor\fR inverted and)
+.I search
+set to zero, so in general, its results are comparatively poor;
+it is retained as it can sometimes out-perform
+.B tempo
+for small
+.IR factor s.
+.SP
+.I factor
+of stretching: >1 lengthen, <1 shorten duration.
+.I window
+size is in ms. Default is 20ms. The
+.I fade
+option, can be `lin'.
+.I shift
+ratio, in [0 1]. Default depends on stretch factor. 1
+to shorten, 0\*d8 to lengthen. The
+.I fading
+ratio, in [0 0\*d5]. The amount of a fade's default depends on
+.I factor
+and \fIshift\fR.
+.SP
+See also the
+.B tempo
+effect.
+.na
+.TP
+\fBsynth\fR [\fB\-j \fIKEY\fR] [\fB\-n\fR] [\fIlen\fR [\fIoff\fR [\fIph\fR [\fIp1\fR [\fIp2\fR [\fIp3\fR]]]]]] {[\fItype\fR] [\fIcombine\fR] \:[[\fB%\fR]\fIfreq\fR[\fBk\fR][\fB:\fR\^|\^\fB+\fR\^|\^\fB/\fR\^|\^\fB\-\fR[\fB%\fR]\fIfreq2\fR[\fBk\fR]]] [\fIoff\fR [\fIph\fR [\fIp1\fR [\fIp2\fR [\fIp3\fR]]]]]}
+.ad
+This effect can be used to generate fixed or swept frequency audio tones
+with various wave shapes, or to generate wide-band noise of various
+`colours'.
+Multiple synth effects can be cascaded to produce more complex
+waveforms; at each stage it is possible to choose whether the generated
+waveform will be mixed with, or modulated onto
+the output from the previous stage.
+Audio for each channel in a multi-channel audio file can be synthesised
+independently.
+.SP
+Though this effect is used to generate audio, an input file must still
+be given, the characteristics of which will be used to set the
+synthesised audio length, the number of channels, and the sampling rate;
+however, since the input file's audio is not normally needed, a `null
+file' (with the special name \fB\-n\fR) is often given instead (and the
+length specified as a parameter to \fBsynth\fR or by another given
+effect that has an associated length).
+.SP
+For example, the following produces a 3 second, 48kHz,
+audio file containing a sine-wave swept from 300 to 3300\ Hz:
+.EX
+ sox \-n output.wav synth 3 sine 300\-3300
+.EE
+and this produces an 8\ kHz version:
+.EX
+ sox \-r 8000 \-n output.wav synth 3 sine 300\-3300
+.EE
+Multiple channels can be synthesised by specifying the set of
+parameters shown between braces multiple times;
+the following puts the swept tone in the left channel and adds `brown'
+noise in the right:
+.EX
+ sox \-n output.wav synth 3 sine 300\-3300 brownnoise
+.EE
+The following example shows how two synth effects can be cascaded
+to create a more complex waveform:
+.EX
+.ne 2
+ play \-n synth 0.5 sine 200\-500 synth 0.5 sine fmod 700\-100
+.EE
+Frequencies can also be given in `scientific' note notation, or, by
+prefixing a `%' character, as a number of semitones relative to
+`middle A' (440\ Hz). For example, the following could be used to
+help tune a guitar's low `E' string:
+.EX
+ play \-n synth 4 pluck %\-29
+.EE
+or with a (Bourne shell) loop, the whole guitar:
+.EX
+.ne 2
+ for n in E2 A2 D3 G3 B3 E4; do
+ play \-n synth 4 pluck $n repeat 2; done
+.EE
+See the
+.B delay
+effect (above) and the reference to `SoX scripting examples' (below)
+for more
+.B synth
+examples.
+.SP
+.B N.B.
+This effect generates audio at maximum volume (0dBFS), which means that there
+is a high chance of clipping when using the audio subsequently, so
+in many cases, you will want to follow this effect with the \fBgain\fR
+effect to prevent this from happening. (See also
+.B Clipping
+above.)
+Note that, by default, the
+.B synth
+effect incorporates the functionality of \fBgain \-h\fR (see the
+.B gain
+effect for details);
+.BR synth 's
+.B \-n
+option may be given to disable this behaviour.
+.SP
+A detailed description of each
+.B synth
+parameter follows:
+.SP
+\fIlen\fR is the length of audio to synthesise (any time specification);
+a value of 0 indicated to use the input length, which is also the default.
+.SP
+\fItype\fR is one of sine, square, triangle, sawtooth, trapezium, exp,
+[white]noise, tpdfnoise, pinknoise, brownnoise, pluck; default=sine.
+.SP
+\fIcombine\fR is one of create, mix, amod (amplitude modulation), fmod
+(frequency modulation); default=create.
+.SP
+\fIfreq\fR/\fIfreq2\fR are the frequencies at the beginning/end of
+synthesis in Hz or, if preceded with `%', semitones relative to A
+(440\ Hz); alternatively, `scientific' note notation (e.g. E2) may
+be used. The default frequency is 440Hz. By default, the tuning used
+with the note notations is `equal temperament'; the
+.B \-j
+.I KEY
+option selects `just intonation', where
+.I KEY
+is an integer number of semitones relative to A (so for example, \-9
+or 3 selects the key of C), or a note in scientific notation.
+.SP
+If
+.I freq2
+is given, then
+.I len
+must also have been given and the generated tone will be swept between
+the given frequencies. The two given frequencies must be separated by
+one of the characters `:', `+', `/', or `\-'. This character is used to
+specify the sweep function as follows:
+.RS
+.IP \fB:\fR
+Linear: the tone will change by a fixed number of hertz per second.
+.IP \fB+\fR
+Square: a second-order function is used to change the tone.
+.IP \fB/\fR
+Exponential: the tone will change by a fixed number of semitones per second.
+.IP \fB\-\fR
+Exponential: as `/', but initial phase always zero, and stepped (less
+smooth) frequency changes.
+.RE
+.TP
+\
+Not used for noise.
+.SP
+\fIoff\fR is the bias (DC-offset) of the signal in percent; default=0.
+.SP
+\fIph\fR is the phase shift in percentage of 1 cycle; default=0. Not
+used for noise.
+.SP
+\fIp1\fR is the percentage of each cycle that is `on' (square), or
+`rising' (triangle, exp, trapezium); default=50 (square, triangle, exp),
+default=10 (trapezium), or sustain (pluck); default=40.
+.SP
+\fIp2\fR (trapezium): the percentage through each cycle at which `falling'
+begins; default=50. exp: the amplitude in multiples of 2dB; default=50,
+or tone-1 (pluck); default=20.
+.SP
+\fIp3\fR (trapezium): the percentage through each cycle at which `falling'
+ends; default=60, or tone-2 (pluck); default=90.
+.TP
+\fBtempo \fR[\fB\-q\fR] [\fB\-m\fR\^|\^\fB\-s\fR\^|\^\fB\-l\fR] \fIfactor\fR [\fIsegment\fR [\fIsearch\fR [\fIoverlap\fR]]]
+Change the audio playback speed but not its pitch. This effect uses the
+WSOLA algorithm. The audio is chopped up into segments which are then
+shifted in the time domain and overlapped (cross-faded) at points where
+their waveforms are most similar as determined by measurement of `least
+squares'.
+.SP
+By default, linear searches are used to find the best overlapping
+points. If the optional
+.B \-q
+parameter is given, tree searches are used instead. This makes the effect
+work more quickly, but the result may not sound as good. However, if you
+must improve the processing speed, this generally reduces the sound quality
+less than reducing the search or overlap values.
+.SP
+The
+.B \-m
+option is used to optimize default values of segment, search and
+overlap for music processing.
+.SP
+The
+.B \-s
+option is used to optimize default values of segment, search and
+overlap for speech processing.
+.SP
+The
+.B \-l
+option is used to optimize default values of segment, search and
+overlap for `linear' processing that tends to cause more
+noticeable distortion but may be useful when factor is close to 1.
+.SP
+If \-m, \-s, or \-l is specified, the default value of segment will be
+calculated based on factor, while default search and overlap values are
+based on segment. Any values you provide still override these default
+values.
+.SP
+.I factor
+gives the ratio of new tempo to the old tempo, so e.g. 1.1 speeds up the
+tempo by 10%, and 0.9 slows it down by 10%.
+.SP
+The optional
+.I segment
+parameter selects the algorithm's segment size in milliseconds. If no other
+flags are specified, the default value is 82 and is typically suited to
+making small changes to the tempo of music. For larger changes (e.g. a factor
+of 2), 41\ ms may give a better result. The \-m, \-s, and \-l flags will cause
+the segment default to be automatically adjusted based on factor.
+For example using \-s (for speech) with a tempo of 1.25 will calculate a
+default segment value of 32.
+.SP
+The optional
+.I search
+parameter gives the audio length in milliseconds over which
+the algorithm will search for overlapping points. If no other
+flags are specified, the default value is 14.68. Larger values use
+more processing time and may or may not produce better results.
+A practical maximum is half the value of segment. Search
+can be reduced to cut processing time at the risk of degrading output
+quality. The \-m, \-s, and \-l flags will cause
+the search default to be automatically adjusted based on segment.
+.SP
+The optional
+.I overlap
+parameter gives the segment overlap length in milliseconds.
+Default value is 12, but \-m, \-s, or \-l flags automatically
+adjust overlap based on segment size. Increasing overlap increases
+processing time and may increase quality. A practical maximum for overlap
+is the value of search, with overlap typically being (at least) a little
+smaller then search.
+.SP
+See also
+.B speed
+for an effect that changes tempo and pitch together,
+.B pitch
+and \fBbend\fR for effects that change pitch only, and
+.B stretch
+for an effect that changes tempo using a different algorithm.
+.TP
+\fBtreble \fIgain\fR [\fIfrequency\fR[\fBk\fR]\fR [\fIwidth\fR[\fBs\fR\^|\^\fBh\fR\^|\^\fBk\fR\^|\^\fBo\fR\^|\^\fBq\fR]]]
+Apply a treble tone-control effect.
+See the description of the \fBbass\fR effect for details.
+.TP
+\fBtremolo \fIspeed\fR [\fIdepth\fR]
+Apply a tremolo (low frequency amplitude modulation) effect to the audio.
+The tremolo frequency in Hz is given by
+.IR speed ,
+and the depth as a percentage by
+.I depth
+(default 40).
+.TP
+\fBtrim\fR {\fIposition(+)\fR}
+Cuts portions out of the audio. Any number of \fIposition\fRs may be
+given; audio is not sent to the output until the first \fIposition\fR
+is reached. The effect then alternates between copying and discarding
+audio at each \fIposition\fR. Using a value of 0 for the first \fIposition\fR
+parameter allows copying from the beginning of the audio.
+.SP
+For example,
+.EX
+ sox infile outfile trim 0 10
+.EE
+will copy the first ten seconds, while
+.EX
+ play infile trim 12:34 =15:00 -2:00
+.EE
+and
+.EX
+ play infile trim 12:34 2:26 -2:00
+.EE
+will both play from 12 minutes 34 seconds into the audio up to 15 minutes into
+the audio (i.e. 2 minutes and 26 seconds long), then resume playing two
+minutes before the end of audio.
+.TP
+\fBupsample\fR [\fIfactor\fR]
+Upsample the signal by an integer factor: \fIfactor\fR\-1 zero-value
+samples are inserted between each pair of input samples. As a result, the
+original spectrum is replicated into the new frequency space (imaging) and
+attenuated. This attenuation can be compensated for by adding
+\fBvol \fIfactor\fR after any further processing. The upsample effect is
+typically used in combination with filtering effects.
+.SP
+For a general resampling effect with anti-imaging, see \fBrate\fR. See
+also \fBdownsample\fR.
+.TP
+\fBvad \fR[\fIoptions\fR]
+Voice Activity Detector. Attempts to trim silence and quiet
+background sounds from the ends of (fairly high resolution
+i.e. 16-bit, 44\-48kHz) recordings of speech. The algorithm currently
+uses a simple cepstral power measurement to detect voice, so may be
+fooled by other things, especially music. The effect can trim only
+from the front of the audio, so in order to trim from the back, the
+.B reverse
+effect must also be used. E.g.
+.EX
+ play speech.wav norm vad
+.EE
+to trim from the front,
+.EX
+ play speech.wav norm reverse vad reverse
+.EE
+to trim from the back, and
+.EX
+ play speech.wav norm vad reverse vad reverse
+.EE
+to trim from both ends. The use of the
+.B norm
+effect is recommended, but remember that neither
+.B reverse
+nor
+.B norm
+is suitable for use with streamed audio.
+.SP
+.I Options:
+.br
+Default values are shown in parenthesis.
+.RS
+.IP \fB\-t\ \fInum\fR\ (7)
+The measurement level used to trigger activity detection. This might
+need to be changed depending on the noise level, signal level and
+other charactistics of the input audio.
+.IP \fB\-T\ \fInum\fR\ (0.25)
+The time constant (in seconds) used to help ignore short bursts of
+sound.
+.IP \fB\-s\ \fInum\fR\ (1)
+The amount of audio (in seconds) to search for quieter/shorter bursts
+of audio to include prior to the detected trigger point.
+.IP \fB\-g\ \fInum\fR\ (0.25)
+Allowed gap (in seconds) between quieter/shorter bursts of audio to
+include prior to the detected trigger point.
+.IP \fB\-p\ \fInum\fR\ (0)
+The amount of audio (in seconds) to preserve before the trigger point
+and any found quieter/shorter bursts.
+.RE
+.TP
+\
+.I Advanced Options:
+.br
+These allow fine tuning of the algorithm's internal parameters.
+.RS
+.IP \fB\-b\ \fInum\fR
+The algorithm (internally) uses adaptive noise estimation/reduction in
+order to detect the start of the wanted audio. This option sets the
+time for the initial noise estimate.
+.IP \fB\-N\ \fInum\fR
+Time constant used by the adaptive noise estimator for when the noise
+level is increasing.
+.IP \fB\-n\ \fInum\fR
+Time constant used by the adaptive noise estimator for when the noise
+level is decreasing.
+.IP \fB\-r\ \fInum\fR
+Amount of noise reduction to use in the detection algorithm (e.g. 0,
+0.5, ...).
+.IP \fB\-f\ \fInum\fR
+Frequency of the algorithm's processing/measurements.
+.IP \fB\-m\ \fInum\fR
+Measurement duration; by default, twice the measurement period; i.e.
+with overlap.
+.IP \fB\-M\ \fInum\fR
+Time constant used to smooth spectral measurements.
+.IP \fB\-h\ \fInum\fR
+`Brick-wall' frequency of high-pass filter applied at the input to the
+detector algorithm.
+.IP \fB\-l\ \fInum\fR
+`Brick-wall' frequency of low-pass filter applied at the input to the
+detector algorithm.
+.IP \fB\-H\ \fInum\fR
+`Brick-wall' frequency of high-pass lifter used in the detector
+algorithm.
+.IP \fB\-L\ \fInum\fR
+`Brick-wall' frequency of low-pass lifter used in the detector
+algorithm.
+.RE
+.TP
+\
+See also the
+.B silence
+effect.
+.TP
+\fBvol \fIgain\fR [\fItype\fR [\fIlimitergain\fR]]
+Apply an amplification or an attenuation to the audio signal.
+Unlike the
+.B \-v
+option (which is used for balancing multiple input files as they enter the
+SoX effects processing chain),
+.B vol
+is an effect like any other so can be applied anywhere, and several times
+if necessary, during the processing chain.
+.SP
+The amount to change the volume is given by
+.I gain
+which is interpreted, according to the given \fItype\fR, as follows: if
+.I type
+is \fBamplitude\fR (or is omitted), then
+.I gain
+is an amplitude (i.e. voltage or linear) ratio,
+if \fBpower\fR, then a power (i.e. wattage or voltage-squared) ratio,
+and if \fBdB\fR, then a power change in dB.
+.SP
+When
+.I type
+is \fBamplitude\fR or \fBpower\fR, a
+.I gain
+of 1 leaves the volume unchanged,
+less than 1 decreases it,
+and greater than 1 increases it;
+a negative
+.I gain
+inverts the audio signal in addition to adjusting its volume.
+.SP
+When
+.I type
+is \fBdB\fR, a
+.I gain
+of 0 leaves the volume unchanged,
+less than 0 decreases it,
+and greater than 0 increases it.
+.SP
+See [4]
+for a detailed discussion on electrical (and hence audio signal)
+voltage and power ratios.
+.SP
+Beware of
+.B Clipping
+when the increasing the volume.
+.SP
+The
+.I gain
+and the
+.I type
+parameters can be concatenated if desired, e.g.
+.BR "vol 10dB" .
+.SP
+An optional \fIlimitergain\fR value can be specified and should be a
+value much less
+than 1 (e.g. 0\*d05 or 0\*d02) and is used only on peaks to prevent clipping.
+Not specifying this parameter will cause no limiter to be used. In verbose
+mode, this effect will display the percentage of the audio that needed to be
+limited.
+.SP
+See also
+.B gain
+for a volume-changing effect with different capabilities, and
+.B compand
+for a dynamic-range compression/expansion/limiting effect.
+.SH DIAGNOSTICS
+Exit status is 0 for no error, 1 if there is a problem with the
+command-line parameters, or 2 if an error occurs during file processing.
+.SH BUGS
+Please report any bugs found in this version of SoX to the mailing list
+(sox-users@lists.sourceforge.net).
+.SH SEE ALSO
+.BR soxi (1),
+.BR soxformat (7),
+.BR libsox (3)
+.br
+.BR audacity (1),
+.BR gnuplot (1),
+.BR octave (1),
+.BR wget (1)
+.br
+The SoX web site at http://sox.sourceforge.net
+.br
+SoX scripting examples at http://sox.sourceforge.net/Docs/Scripts
+.SS References
+.TP
+[1]
+R. Bristow-Johnson,
+.IR "Cookbook formulae for audio EQ biquad filter coefficients" ,
+http://musicdsp.org/files/Audio-EQ-Cookbook.txt
+.TP
+[2]
+Wikipedia,
+.IR "Q-factor" ,
+http://en.wikipedia.org/wiki/Q_factor
+.TP
+[3]
+Scott Lehman,
+.IR "Effects Explained" ,
+http://harmony-central.com/Effects/effects-explained.html
+.TP
+[4]
+Wikipedia,
+.IR "Decibel" ,
+http://en.wikipedia.org/wiki/Decibel
+.TP
+[5]
+Richard Furse,
+.IR "Linux Audio Developer's Simple Plugin API" ,
+http://www.ladspa.org
+.TP
+[6]
+Richard Furse,
+.IR "Computer Music Toolkit" ,
+http://www.ladspa.org/cmt
+.TP
+[7]
+Steve Harris,
+.IR "LADSPA plugins" ,
+http://plugin.org.uk
+.SH LICENSE
+Copyright 1998\-2013 Chris Bagwell and SoX Contributors.
+.br
+Copyright 1991 Lance Norskog and Sundry Contributors.
+.SP
+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, or (at your option)
+any later version.
+.SP
+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.
+.SH AUTHORS
+Chris Bagwell (cbagwell@users.sourceforge.net).
+Other authors and contributors are listed in the ChangeLog file that
+is distributed with the source code.
diff --git a/src/sox.pc.in b/src/sox.pc.in
new file mode 100644
index 0000000..ea57b2b
--- /dev/null
+++ b/src/sox.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: SoX
+Description: Audio file format and effects library
+Version: @VERSION@
+URL: http://sox.sourceforge.net
+Libs: -L${libdir} -lsox
+Libs.private: @LIBS@
+Cflags: -I${includedir}
diff --git a/src/sox.txt b/src/sox.txt
new file mode 100644
index 0000000..2e7bcde
--- /dev/null
+++ b/src/sox.txt
@@ -0,0 +1,3258 @@
+SoX(1) Sound eXchange SoX(1)
+
+
+
+NAME
+ SoX - Sound eXchange, the Swiss Army knife of audio manipulation
+
+SYNOPSIS
+ sox [global-options] [format-options] infile1
+ [[format-options] infile2] ... [format-options] outfile
+ [effect [effect-options]] ...
+
+ play [global-options] [format-options] infile1
+ [[format-options] infile2] ... [format-options]
+ [effect [effect-options]] ...
+
+ rec [global-options] [format-options] outfile
+ [effect [effect-options]] ...
+
+DESCRIPTION
+ Introduction
+ SoX reads and writes audio files in most popular formats and can
+ optionally apply effects to them. It can combine multiple input
+ sources, synthesise audio, and, on many systems, act as a general pur‐
+ pose audio player or a multi-track audio recorder. It also has limited
+ ability to split the input into multiple output files.
+
+ All SoX functionality is available using just the sox command. To sim‐
+ plify playing and recording audio, if SoX is invoked as play, the out‐
+ put file is automatically set to be the default sound device, and if
+ invoked as rec, the default sound device is used as an input source.
+ Additionally, the soxi(1) command provides a convenient way to just
+ query audio file header information.
+
+ The heart of SoX is a library called libSoX. Those interested in
+ extending SoX or using it in other programs should refer to the libSoX
+ manual page: libsox(3).
+
+ SoX is a command-line audio processing tool, particularly suited to
+ making quick, simple edits and to batch processing. If you need an
+ interactive, graphical audio editor, use audacity(1).
+
+ * * *
+
+ The overall SoX processing chain can be summarised as follows:
+
+ Input(s) → Combiner → Effects → Output(s)
+
+ Note however, that on the SoX command line, the positions of the Out‐
+ put(s) and the Effects are swapped w.r.t. the logical flow just shown.
+ Note also that whilst options pertaining to files are placed before
+ their respective file name, the opposite is true for effects. To show
+ how this works in practice, here is a selection of examples of how SoX
+ might be used. The simple
+ sox recital.au recital.wav
+ translates an audio file in Sun AU format to a Microsoft WAV file,
+ whilst
+ sox recital.au -b 16 recital.wav channels 1 rate 16k fade 3 norm
+ performs the same format translation, but also applies four effects
+ (down-mix to one channel, sample rate change, fade-in, nomalize), and
+ stores the result at a bit-depth of 16.
+ sox -r 16k -e signed -b 8 -c 1 voice-memo.raw voice-memo.wav
+ converts `raw' (a.k.a. `headerless') audio to a self-describing file
+ format,
+ sox slow.aiff fixed.aiff speed 1.027
+ adjusts audio speed,
+ sox short.wav long.wav longer.wav
+ concatenates two audio files, and
+ sox -m music.mp3 voice.wav mixed.flac
+ mixes together two audio files.
+ play "The Moonbeams/Greatest/*.ogg" bass +3
+ plays a collection of audio files whilst applying a bass boosting
+ effect,
+ play -n -c1 synth sin %-12 sin %-9 sin %-5 sin %-2 fade h 0.1 1 0.1
+ plays a synthesised `A minor seventh' chord with a pipe-organ sound,
+ rec -c 2 radio.aiff trim 0 30:00
+ records half an hour of stereo audio, and
+ play -q take1.aiff & rec -M take1.aiff take1-dub.aiff
+ (with POSIX shell and where supported by hardware) records a new track
+ in a multi-track recording. Finally,
+ rec -r 44100 -b 16 -e signed-integer -p \
+ silence 1 0.50 0.1% 1 10:00 0.1% | \
+ sox -p song.ogg silence 1 0.50 0.1% 1 2.0 0.1% : \
+ newfile : restart
+ records a stream of audio such as LP/cassette and splits in to multiple
+ audio files at points with 2 seconds of silence. Also, it does not
+ start recording until it detects audio is playing and stops after it
+ sees 10 minutes of silence.
+
+ N.B. The above is just an overview of SoX's capabilities; detailed
+ explanations of how to use all SoX parameters, file formats, and
+ effects can be found below in this manual, in soxformat(7), and in
+ soxi(1).
+
+ File Format Types
+ SoX can work with `self-describing' and `raw' audio files. `self-
+ describing' formats (e.g. WAV, FLAC, MP3) have a header that completely
+ describes the signal and encoding attributes of the audio data that
+ follows. `raw' or `headerless' formats do not contain this information,
+ so the audio characteristics of these must be described on the SoX com‐
+ mand line or inferred from those of the input file.
+
+ The following four characteristics are used to describe the format of
+ audio data such that it can be processed with SoX:
+
+ sample rate
+ The sample rate in samples per second (`Hertz' or `Hz'). Digi‐
+ tal telephony traditionally uses a sample rate of 8000 Hz
+ (8 kHz), though these days, 16 and even 32 kHz are becoming more
+ common. Audio Compact Discs use 44100 Hz (44.1 kHz). Digital
+ Audio Tape and many computer systems use 48 kHz. Professional
+ audio systems often use 96 kHz.
+
+ sample size
+ The number of bits used to store each sample. Today, 16-bit is
+ commonly used. 8-bit was popular in the early days of computer
+ audio. 24-bit is used in the professional audio arena. Other
+ sizes are also used.
+
+ data encoding
+ The way in which each audio sample is represented (or
+ `encoded'). Some encodings have variants with different byte-
+ orderings or bit-orderings. Some compress the audio data so
+ that the stored audio data takes up less space (i.e. disk space
+ or transmission bandwidth) than the other format parameters and
+ the number of samples would imply. Commonly-used encoding types
+ include floating-point, μ-law, ADPCM, signed-integer PCM, MP3,
+ and FLAC.
+
+ channels
+ The number of audio channels contained in the file. One
+ (`mono') and two (`stereo') are widely used. `Surround sound'
+ audio typically contains six or more channels.
+
+ The term `bit-rate' is a measure of the amount of storage occupied by
+ an encoded audio signal over a unit of time. It can depend on all of
+ the above and is typically denoted as a number of kilo-bits per second
+ (kbps). An A-law telephony signal has a bit-rate of 64 kbps.
+ MP3-encoded stereo music typically has a bit-rate of 128-196 kbps.
+ FLAC-encoded stereo music typically has a bit-rate of 550-760 kbps.
+
+ Most self-describing formats also allow textual `comments' to be embed‐
+ ded in the file that can be used to describe the audio in some way,
+ e.g. for music, the title, the author, etc.
+
+ One important use of audio file comments is to convey `Replay Gain'
+ information. SoX supports applying Replay Gain information (for cer‐
+ tain input file formats only; currently, at least FLAC and Ogg Vorbis),
+ but not generating it. Note that by default, SoX copies input file
+ comments to output files that support comments, so output files may
+ contain Replay Gain information if some was present in the input file.
+ In this case, if anything other than a simple format conversion was
+ performed then the output file Replay Gain information is likely to be
+ incorrect and so should be recalculated using a tool that supports this
+ (not SoX).
+
+ The soxi(1) command can be used to display information from audio file
+ headers.
+
+ Determining & Setting The File Format
+ There are several mechanisms available for SoX to use to determine or
+ set the format characteristics of an audio file. Depending on the cir‐
+ cumstances, individual characteristics may be determined or set using
+ different mechanisms.
+
+ To determine the format of an input file, SoX will use, in order of
+ precedence and as given or available:
+
+ 1. Command-line format options.
+
+ 2. The contents of the file header.
+
+ 3. The filename extension.
+
+ To set the output file format, SoX will use, in order of precedence and
+ as given or available:
+
+ 1. Command-line format options.
+
+ 2. The filename extension.
+
+ 3. The input file format characteristics, or the closest that is sup‐
+ ported by the output file type.
+
+ For all files, SoX will exit with an error if the file type cannot be
+ determined. Command-line format options may need to be added or changed
+ to resolve the problem.
+
+ Playing & Recording Audio
+ The play and rec commands are provided so that basic playing and
+ recording is as simple as
+ play existing-file.wav
+ and
+ rec new-file.wav
+ These two commands are functionally equivalent to
+ sox existing-file.wav -d
+ and
+ sox -d new-file.wav
+ Of course, further options and effects (as described below) can be
+ added to the commands in either form.
+
+ * * *
+
+ Some systems provide more than one type of (SoX-compatible) audio
+ driver, e.g. ALSA & OSS, or SUNAU & AO. Systems can also have more
+ than one audio device (a.k.a. `sound card'). If more than one audio
+ driver has been built-in to SoX, and the default selected by SoX when
+ recording or playing is not the one that is wanted, then the AUDIO‐
+ DRIVER environment variable can be used to override the default. For
+ example (on many systems):
+ set AUDIODRIVER=oss
+ play ...
+ The AUDIODEV environment variable can be used to override the default
+ audio device, e.g.
+ set AUDIODEV=/dev/dsp2
+ play ...
+ sox ... -t oss
+ or
+ set AUDIODEV=hw:soundwave,1,2
+ play ...
+ sox ... -t alsa
+ Note that the way of setting environment variables varies from system
+ to system - for some specific examples, see `SOX_OPTS' below.
+
+ When playing a file with a sample rate that is not supported by the
+ audio output device, SoX will automatically invoke the rate effect to
+ perform the necessary sample rate conversion. For compatibility with
+ old hardware, the default rate quality level is set to `low'. This can
+ be changed by explicitly specifying the rate effect with a different
+ quality level, e.g.
+ play ... rate -m
+ or by using the --play-rate-arg option (see below).
+
+ * * *
+
+ On some systems, SoX allows audio playback volume to be adjusted whilst
+ using play. Where supported, this is achieved by tapping the `v' & `V'
+ keys during playback.
+
+ To help with setting a suitable recording level, SoX includes a peak-
+ level meter which can be invoked (before making the actual recording)
+ as follows:
+ rec -n
+ The recording level should be adjusted (using the system-provided mixer
+ program, not SoX) so that the meter is at most occasionally full scale,
+ and never `in the red' (an exclamation mark is shown). See also -S
+ below.
+
+ Accuracy
+ Many file formats that compress audio discard some of the audio signal
+ information whilst doing so. Converting to such a format and then con‐
+ verting back again will not produce an exact copy of the original
+ audio. This is the case for many formats used in telephony (e.g. A-
+ law, GSM) where low signal bandwidth is more important than high audio
+ fidelity, and for many formats used in portable music players (e.g.
+ MP3, Vorbis) where adequate fidelity can be retained even with the
+ large compression ratios that are needed to make portable players prac‐
+ tical.
+
+ Formats that discard audio signal information are called `lossy'. For‐
+ mats that do not are called `lossless'. The term `quality' is used as
+ a measure of how closely the original audio signal can be reproduced
+ when using a lossy format.
+
+ Audio file conversion with SoX is lossless when it can be, i.e. when
+ not using lossy compression, when not reducing the sampling rate or
+ number of channels, and when the number of bits used in the destination
+ format is not less than in the source format. E.g. converting from an
+ 8-bit PCM format to a 16-bit PCM format is lossless but converting from
+ an 8-bit PCM format to (8-bit) A-law isn't.
+
+ N.B. SoX converts all audio files to an internal uncompressed format
+ before performing any audio processing. This means that manipulating a
+ file that is stored in a lossy format can cause further losses in audio
+ fidelity. E.g. with
+ sox long.mp3 short.mp3 trim 10
+ SoX first decompresses the input MP3 file, then applies the trim
+ effect, and finally creates the output MP3 file by re-compressing the
+ audio - with a possible reduction in fidelity above that which occurred
+ when the input file was created. Hence, if what is ultimately desired
+ is lossily compressed audio, it is highly recommended to perform all
+ audio processing using lossless file formats and then convert to the
+ lossy format only at the final stage.
+
+ N.B. Applying multiple effects with a single SoX invocation will, in
+ general, produce more accurate results than those produced using multi‐
+ ple SoX invocations.
+
+ Dithering
+ Dithering is a technique used to maximise the dynamic range of audio
+ stored at a particular bit-depth. Any distortion introduced by quanti‐
+ sation is decorrelated by adding a small amount of white noise to the
+ signal. In most cases, SoX can determine whether the selected process‐
+ ing requires dither and will add it during output formatting if appro‐
+ priate.
+
+ Specifically, by default, SoX automatically adds TPDF dither when the
+ output bit-depth is less than 24 and any of the following are true:
+
+ · bit-depth reduction has been specified explicitly using a command-
+ line option
+
+ · the output file format supports only bit-depths lower than that of
+ the input file format
+
+ · an effect has increased effective bit-depth within the internal
+ processing chain
+
+ For example, adjusting volume with vol 0.25 requires two additional
+ bits in which to losslessly store its results (since 0.25 decimal
+ equals 0.01 binary). So if the input file bit-depth is 16, then SoX's
+ internal representation will utilise 18 bits after processing this vol‐
+ ume change. In order to store the output at the same depth as the
+ input, dithering is used to remove the additional bits.
+
+ Use the -V option to see what processing SoX has automatically added.
+ The -D option may be given to override automatic dithering. To invoke
+ dithering manually (e.g. to select a noise-shaping curve), see the
+ dither effect.
+
+ Clipping
+ Clipping is distortion that occurs when an audio signal level (or `vol‐
+ ume') exceeds the range of the chosen representation. In most cases,
+ clipping is undesirable and so should be corrected by adjusting the
+ level prior to the point (in the processing chain) at which it occurs.
+
+ In SoX, clipping could occur, as you might expect, when using the vol
+ or gain effects to increase the audio volume. Clipping could also occur
+ with many other effects, when converting one format to another, and
+ even when simply playing the audio.
+
+ Playing an audio file often involves resampling, and processing by ana‐
+ logue components can introduce a small DC offset and/or amplification,
+ all of which can produce distortion if the audio signal level was ini‐
+ tially too close to the clipping point.
+
+ For these reasons, it is usual to make sure that an audio file's signal
+ level has some `headroom', i.e. it does not exceed a particular level
+ below the maximum possible level for the given representation. Some
+ standards bodies recommend as much as 9dB headroom, but in most cases,
+ 3dB (≈ 70% linear) is enough. Note that this wisdom seems to have been
+ lost in modern music production; in fact, many CDs, MP3s, etc. are now
+ mastered at levels above 0dBFS i.e. the audio is clipped as delivered.
+
+ SoX's stat and stats effects can assist in determining the signal level
+ in an audio file. The gain or vol effect can be used to prevent clip‐
+ ping, e.g.
+ sox dull.wav bright.wav gain -6 treble +6
+ guarantees that the treble boost will not clip.
+
+ If clipping occurs at any point during processing, SoX will display a
+ warning message to that effect.
+
+ See also -G and the gain and norm effects.
+
+ Input File Combining
+ SoX's input combiner can be configured (see OPTIONS below) to combine
+ multiple files using any of the following methods: `concatenate',
+ `sequence', `mix', `mix-power', `merge', or `multiply'. The default
+ method is `sequence' for play, and `concatenate' for rec and sox.
+
+ For all methods other than `sequence', multiple input files must have
+ the same sampling rate. If necessary, separate SoX invocations can be
+ used to make sampling rate adjustments prior to combining.
+
+ If the `concatenate' combining method is selected (usually, this will
+ be by default) then the input files must also have the same number of
+ channels. The audio from each input will be concatenated in the order
+ given to form the output file.
+
+ The `sequence' combining method is selected automatically for play. It
+ is similar to `concatenate' in that the audio from each input file is
+ sent serially to the output file. However, here the output file may be
+ closed and reopened at the corresponding transition between input
+ files. This may be just what is needed when sending different types of
+ audio to an output device, but is not generally useful when the output
+ is a normal file.
+
+ If either the `mix' or `mix-power' combining method is selected then
+ two or more input files must be given and will be mixed together to
+ form the output file. The number of channels in each input file need
+ not be the same, but SoX will issue a warning if they are not and some
+ channels in the output file will not contain audio from every input
+ file. A mixed audio file cannot be un-mixed without reference to the
+ original input files.
+
+ If the `merge' combining method is selected then two or more input
+ files must be given and will be merged together to form the output
+ file. The number of channels in each input file need not be the same.
+ A merged audio file comprises all of the channels from all of the input
+ files. Un-merging is possible using multiple invocations of SoX with
+ the remix effect. For example, two mono files could be merged to form
+ one stereo file. The first and second mono files would become the left
+ and right channels of the stereo file.
+
+ The `multiply' combining method multiplies the sample values of corre‐
+ sponding channels (treated as numbers in the interval -1 to +1). If
+ the number of channels in the input files is not the same, the missing
+ channels are considered to contain all zero.
+
+ When combining input files, SoX applies any specified effects (includ‐
+ ing, for example, the vol volume adjustment effect) after the audio has
+ been combined. However, it is often useful to be able to set the volume
+ of (i.e. `balance') the inputs individually, before combining takes
+ place.
+
+ For all combining methods, input file volume adjustments can be made
+ manually using the -v option (below) which can be given for one or more
+ input files. If it is given for only some of the input files then the
+ others receive no volume adjustment. In some circumstances, automatic
+ volume adjustments may be applied (see below).
+
+ The -V option (below) can be used to show the input file volume adjust‐
+ ments that have been selected (either manually or automatically).
+
+ There are some special considerations that need to made when mixing
+ input files:
+
+ Unlike the other methods, `mix' combining has the potential to cause
+ clipping in the combiner if no balancing is performed. In this case,
+ if manual volume adjustments are not given, SoX will try to ensure that
+ clipping does not occur by automatically adjusting the volume (ampli‐
+ tude) of each input signal by a factor of ¹/n, where n is the number of
+ input files. If this results in audio that is too quiet or otherwise
+ unbalanced then the input file volumes can be set manually as described
+ above. Using the norm effect on the mix is another alternative.
+
+ If mixed audio seems loud enough at some points but too quiet in others
+ then dynamic range compression should be applied to correct this - see
+ the compand effect.
+
+ With the `mix-power' combine method, the mixed volume is approximately
+ equal to that of one of the input signals. This is achieved by balanc‐
+ ing using a factor of ¹/√n instead of ¹/n. Note that this balancing
+ factor does not guarantee that clipping will not occur, but the number
+ of clips will usually be low and the resultant distortion is generally
+ imperceptible.
+
+ Output Files
+ SoX's default behaviour is to take one or more input files and write
+ them to a single output file.
+
+ This behaviour can be changed by specifying the pseudo-effect `newfile'
+ within the effects list. SoX will then enter multiple output mode.
+
+ In multiple output mode, a new file is created when the effects prior
+ to the `newfile' indicate they are done. The effects chain listed
+ after `newfile' is then started up and its output is saved to the new
+ file.
+
+ In multiple output mode, a unique number will automatically be appended
+ to the end of all filenames. If the filename has an extension then the
+ number is inserted before the extension. This behaviour can be custom‐
+ ized by placing a %n anywhere in the filename where the number should
+ be substituted. An optional number can be placed after the % to indi‐
+ cate a minimum fixed width for the number.
+
+ Multiple output mode is not very useful unless an effect that will stop
+ the effects chain early is specified before the `newfile'. If end of
+ file is reached before the effects chain stops itself then no new file
+ will be created as it would be empty.
+
+ The following is an example of splitting the first 60 seconds of an
+ input file into two 30 second files and ignoring the rest.
+ sox song.wav ringtone%1n.wav trim 0 30 : newfile : trim 0 30
+
+ Stopping SoX
+ Usually SoX will complete its processing and exit automatically once it
+ has read all available audio data from the input files.
+
+ If desired, it can be terminated earlier by sending an interrupt signal
+ to the process (usually by pressing the keyboard interrupt key which is
+ normally Ctrl-C). This is a natural requirement in some circumstances,
+ e.g. when using SoX to make a recording. Note that when using SoX to
+ play multiple files, Ctrl-C behaves slightly differently: pressing it
+ once causes SoX to skip to the next file; pressing it twice in quick
+ succession causes SoX to exit.
+
+ Another option to stop processing early is to use an effect that has a
+ time period or sample count to determine the stopping point. The trim
+ effect is an example of this. Once all effects chains have stopped
+ then SoX will also stop.
+
+FILENAMES
+ Filenames can be simple file names, absolute or relative path names, or
+ URLs (input files only). Note that URL support requires that wget(1)
+ is available.
+
+ Note: Giving SoX an input or output filename that is the same as a SoX
+ effect-name will not work since SoX will treat it as an effect
+ specification. The only work-around to this is to avoid such
+ filenames. This is generally not difficult since most audio filenames
+ have a filename `extension', whilst effect-names do not.
+
+ Special Filenames
+ The following special filenames may be used in certain circumstances in
+ place of a normal filename on the command line:
+
+ - SoX can be used in simple pipeline operations by using the
+ special filename `-' which, if used as an input filename, will
+ cause SoX will read audio data from `standard input' (stdin),
+ and which, if used as the output filename, will cause SoX will
+ send audio data to `standard output' (stdout). Note that when
+ using this option for the output file, and sometimes when using
+ it for an input file, the file-type (see -t below) must also be
+ given.
+
+ "|program [options] ..."
+ This can be used in place of an input filename to specify the
+ the given program's standard output (stdout) be used as an input
+ file. Unlike - (above), this can be used for several inputs to
+ one SoX command. For example, if `genw' generates mono WAV
+ formatted signals to its standard output, then the following
+ command makes a stereo file from two generated signals:
+ sox -M "|genw --imd -" "|genw --thd -" out.wav
+ For headerless (raw) audio, -t (and perhaps other format
+ options) will need to be given, preceding the input command.
+
+ "wildcard-filename"
+ Specifies that filename `globbing' (wild-card matching) should
+ be performed by SoX instead of by the shell. This allows a sin‐
+ gle set of file options to be applied to a group of files. For
+ example, if the current directory contains three `vox' files,
+ file1.vox, file2.vox, and file3.vox, then
+ play --rate 6k *.vox
+ will be expanded by the `shell' (in most environments) to
+ play --rate 6k file1.vox file2.vox file3.vox
+ which will treat only the first vox file as having a sample rate
+ of 6k. With
+ play --rate 6k "*.vox"
+ the given sample rate option will be applied to all three vox
+ files.
+
+ -p, --sox-pipe
+ This can be used in place of an output filename to specify that
+ the SoX command should be used as in input pipe to another SoX
+ command. For example, the command:
+ play "|sox -n -p synth 2" "|sox -n -p synth 2 tremolo 10" stat
+ plays two `files' in succession, each with different effects.
+
+ -p is in fact an alias for `-t sox -'.
+
+ -d, --default-device
+ This can be used in place of an input or output filename to
+ specify that the default audio device (if one has been built
+ into SoX) is to be used. This is akin to invoking rec or play
+ (as described above).
+
+ -n, --null
+ This can be used in place of an input or output filename to
+ specify that a `null file' is to be used. Note that here, `null
+ file' refers to a SoX-specific mechanism and is not related to
+ any operating-system mechanism with a similar name.
+
+ Using a null file to input audio is equivalent to using a normal
+ audio file that contains an infinite amount of silence, and as
+ such is not generally useful unless used with an effect that
+ specifies a finite time length (such as trim or synth).
+
+ Using a null file to output audio amounts to discarding the
+ audio and is useful mainly with effects that produce information
+ about the audio instead of affecting it (such as noiseprof or
+ stat).
+
+ The sampling rate associated with a null file is by default
+ 48 kHz, but, as with a normal file, this can be overridden if
+ desired using command-line format options (see below).
+
+ Supported File & Audio Device Types
+ See soxformat(7) for a list and description of the supported file for‐
+ mats and audio device drivers.
+
+OPTIONS
+ Global Options
+ These options can be specified on the command line at any point before
+ the first effect name.
+
+ The SOX_OPTS environment variable can be used to provide alternative
+ default values for SoX's global options. For example:
+ SOX_OPTS="--buffer 20000 --play-rate-arg -hs --temp /mnt/temp"
+ Note that setting SOX_OPTS can potentially create unwanted changes in
+ the behaviour of scripts or other programs that invoke SoX. SOX_OPTS
+ might best be used for things (such as in the given example) that
+ reflect the environment in which SoX is being run. Enabling options
+ such as --no-clobber as default might be handled better using a shell
+ alias since a shell alias will not affect operation in scripts etc.
+
+ One way to ensure that a script cannot be affected by SOX_OPTS is to
+ clear SOX_OPTS at the start of the script, but this of course loses the
+ benefit of SOX_OPTS carrying some system-wide default options. An
+ alternative approach is to explicitly invoke SoX with default option
+ values, e.g.
+ SOX_OPTS="-V --no-clobber"
+ ...
+ sox -V2 --clobber $input $output ...
+ Note that the way to set environment variables varies from system to
+ system. Here are some examples:
+
+ Unix bash:
+ export SOX_OPTS="-V --no-clobber"
+ Unix csh:
+ setenv SOX_OPTS "-V --no-clobber"
+ MS-DOS/MS-Windows:
+ set SOX_OPTS=-V --no-clobber
+ MS-Windows GUI: via Control Panel : System : Advanced : Environment
+ Variables
+
+ Mac OS X GUI: Refer to Apple's Technical Q&A QA1067 document.
+
+ --buffer BYTES, --input-buffer BYTES
+ Set the size in bytes of the buffers used for processing audio
+ (default 8192). --buffer applies to input, effects, and output
+ processing; --input-buffer applies only to input processing (for
+ which it overrides --buffer if both are given).
+
+ Be aware that large values for --buffer will cause SoX to be
+ become slow to respond to requests to terminate or to skip the
+ current input file.
+
+ --clobber
+ Don't prompt before overwriting an existing file with the same
+ name as that given for the output file. This is the default be‐
+ haviour.
+
+ --combine concatenate|merge|mix|mix-power|multiply|sequence
+ Select the input file combining method; for some of these, short
+ options are available: -m selects `mix', -M selects `merge', and
+ -T selects `multiply'.
+
+ See Input File Combining above for a description of the differ‐
+ ent combining methods.
+
+ -D, --no-dither
+ Disable automatic dither - see `Dithering' above. An example of
+ why this might occasionally be useful is if a file has been con‐
+ verted from 16 to 24 bit with the intention of doing some pro‐
+ cessing on it, but in fact no processing is needed after all and
+ the original 16 bit file has been lost, then, strictly speaking,
+ no dither is needed if converting the file back to 16 bit. See
+ also the stats effect for how to determine the actual bit depth
+ of the audio within a file.
+
+ --effects-file FILENAME
+ Use FILENAME to obtain all effects and their arguments. The
+ file is parsed as if the values were specified on the command
+ line. A new line can be used in place of the special : marker
+ to separate effect chains. For convenience, such markers at the
+ end of the file are normally ignored; if you want to specify an
+ empty last effects chain, use an explicit : by itself on the
+ last line of the file. This option causes any effects specified
+ on the command line to be discarded.
+
+ -G, --guard
+ Automatically invoke the gain effect to guard against clipping.
+ E.g.
+ sox -G infile -b 16 outfile rate 44100 dither -s
+ is shorthand for
+ sox infile -b 16 outfile gain -h rate 44100 gain -rh dither -s
+ See also -V, --norm, and the gain effect.
+
+ -h, --help
+ Show version number and usage information.
+
+ --help-effect NAME
+ Show usage information on the specified effect. The name all
+ can be used to show usage on all effects.
+
+ --help-format NAME
+ Show information about the specified file format. The name all
+ can be used to show information on all formats.
+
+ --i, --info
+ Only if given as the first parameter to sox, behave as soxi(1).
+
+ -m|-M Equivalent to --combine mix and --combine merge, respectively.
+
+ --magic
+ If SoX has been built with the optional `libmagic' library then
+ this option can be given to enable its use in helping to detect
+ audio file types.
+
+ --multi-threaded | --single-threaded
+ By default, SoX is `single threaded'. If the --multi-threaded
+ option is given however then SoX will process audio channels for
+ most multi-channel effects in parallel on hyper-threading/multi-
+ core architectures. This may reduce processing time, though
+ sometimes it may be necessary to use this option in conjunction
+ with a larger buffer size than is the default to gain any bene‐
+ fit from multi-threaded processing (e.g. 131072; see --buffer
+ above).
+
+ --no-clobber
+ Prompt before overwriting an existing file with the same name as
+ that given for the output file.
+
+ N.B. Unintentionally overwriting a file is easier than you
+ might think, for example, if you accidentally enter
+ sox file1 file2 effect1 effect2 ...
+ when what you really meant was
+ play file1 file2 effect1 effect2 ...
+ then, without this option, file2 will be overwritten. Hence,
+ using this option is recommended. SOX_OPTS (above), a `shell'
+ alias, script, or batch file may be an appropriate way of perma‐
+ nently enabling it.
+
+ --norm[=dB-level]
+ Automatically invoke the gain effect to guard against clipping
+ and to normalise the audio. E.g.
+ sox --norm infile -b 16 outfile rate 44100 dither -s
+ is shorthand for
+ sox infile -b 16 outfile gain -h rate 44100 gain -nh dither -s
+ Optionally, the audio can be normalized to a given level (usu‐
+ ally) below 0 dBFS:
+ sox --norm=-3 infile outfile
+
+ See also -V, -G, and the gain effect.
+
+ --play-rate-arg ARG
+ Selects a quality option to be used when the `rate' effect is
+ automatically invoked whilst playing audio. This option is typ‐
+ ically set via the SOX_OPTS environment variable (see above).
+
+ --plot gnuplot|octave|off
+ If not set to off (the default if --plot is not given), run in a
+ mode that can be used, in conjunction with the gnuplot program
+ or the GNU Octave program, to assist with the selection and con‐
+ figuration of many of the transfer-function based effects. For
+ the first given effect that supports the selected plotting pro‐
+ gram, SoX will output commands to plot the effect's transfer
+ function, and then exit without actually processing any audio.
+ E.g.
+ sox --plot octave input-file -n highpass 1320 > highpass.plt
+ octave highpass.plt
+
+ -q, --no-show-progress
+ Run in quiet mode when SoX wouldn't otherwise do so. This is
+ the opposite of the -S option.
+
+ -R Run in `repeatable' mode. When this option is given, where
+ applicable, SoX will embed a fixed time-stamp in the output file
+ (e.g. AIFF) and will `seed' pseudo random number generators
+ (e.g. dither) with a fixed number, thus ensuring that succes‐
+ sive SoX invocations with the same inputs and the same parame‐
+ ters yield the same output.
+
+ --replay-gain track|album|off
+ Select whether or not to apply replay-gain adjustment to input
+ files. The default is off for sox and rec, album for play where
+ (at least) the first two input files are tagged with the same
+ Artist and Album names, and track for play otherwise.
+
+ -S, --show-progress
+ Display input file format/header information, and processing
+ progress as input file(s) percentage complete, elapsed time, and
+ remaining time (if known; shown in brackets), and the number of
+ samples written to the output file. Also shown is a peak-level
+ meter, and an indication if clipping has occurred. The peak-
+ level meter shows up to two channels and is calibrated for digi‐
+ tal audio as follows (right channel shown):
+
+ dB FSD Display dB FSD Display
+ -25 - -11 ====
+ -23 = -9 ====-
+ -21 =- -7 =====
+ -19 == -5 =====-
+ -17 ==- -3 ======
+ -15 === -1 =====!
+ -13 ===-
+
+ A three-second peak-held value of headroom in dBs will be shown
+ to the right of the meter if this is below 6dB.
+
+ This option is enabled by default when using SoX to play or
+ record audio.
+
+ -T Equivalent to --combine multiply.
+
+ --temp DIRECTORY
+ Specify that any temporary files should be created in the given
+ DIRECTORY. This can be useful if there are permission or free-
+ space problems with the default location. In this case, using
+ `--temp .' (to use the current directory) is often a good solu‐
+ tion.
+
+ --version
+ Show SoX's version number and exit.
+
+ -V[level]
+ Set verbosity. This is particularly useful for seeing how any
+ automatic effects have been invoked by SoX.
+
+ SoX displays messages on the console (stderr) according to the
+ following verbosity levels:
+
+ 0 No messages are shown at all; use the exit status to
+ determine if an error has occurred.
+
+ 1 Only error messages are shown. These are generated if
+ SoX cannot complete the requested commands.
+
+ 2 Warning messages are also shown. These are generated if
+ SoX can complete the requested commands, but not exactly
+ according to the requested command parameters, or if
+ clipping occurs.
+
+ 3 Descriptions of SoX's processing phases are also shown.
+ Useful for seeing exactly how SoX is processing your
+ audio.
+
+ 4 and above
+ Messages to help with debugging SoX are also shown.
+
+ By default, the verbosity level is set to 2 (shows errors and
+ warnings). Each occurrence of the -V option increases the ver‐
+ bosity level by 1. Alternatively, the verbosity level can be
+ set to an absolute number by specifying it immediately after the
+ -V, e.g. -V0 sets it to 0.
+
+ Input File Options
+ These options apply only to input files and may precede only input
+ filenames on the command line.
+
+ --ignore-length
+ Override an (incorrect) audio length given in an audio file's
+ header. If this option is given then SoX will keep reading audio
+ until it reaches the end of the input file.
+
+ -v, --volume FACTOR
+ Intended for use when combining multiple input files, this
+ option adjusts the volume of the file that follows it on the
+ command line by a factor of FACTOR. This allows it to be `bal‐
+ anced' w.r.t. the other input files. This is a linear (ampli‐
+ tude) adjustment, so a number less than 1 decreases the volume
+ and a number greater than 1 increases it. If a negative number
+ is given then in addition to the volume adjustment, the audio
+ signal will be inverted.
+
+ See also the norm, vol, and gain effects, and see Input File
+ Balancing above.
+
+ Input & Output File Format Options
+ These options apply to the input or output file whose name they immedi‐
+ ately precede on the command line and are used mainly when working with
+ headerless file formats or when specifying a format for the output file
+ that is different to that of the input file.
+
+ -b BITS, --bits BITS
+ The number of bits (a.k.a. bit-depth or sometimes word-length)
+ in each encoded sample. Not applicable to complex encodings
+ such as MP3 or GSM. Not necessary with encodings that have a
+ fixed number of bits, e.g. A/μ-law, ADPCM.
+
+ For an input file, the most common use for this option is to
+ inform SoX of the number of bits per sample in a `raw' (`header‐
+ less') audio file. For example
+ sox -r 16k -e signed -b 8 input.raw output.wav
+ converts a particular `raw' file to a self-describing `WAV'
+ file.
+
+ For an output file, this option can be used (perhaps along with
+ -e) to set the output encoding size. By default (i.e. if this
+ option is not given), the output encoding size will (providing
+ it is supported by the output file type) be set to the input
+ encoding size. For example
+ sox input.cdda -b 24 output.wav
+ converts raw CD digital audio (16-bit, signed-integer) to a
+ 24-bit (signed-integer) `WAV' file.
+
+ -c CHANNELS, --channels CHANNELS
+ The number of audio channels in the audio file. This can be any
+ number greater than zero.
+
+ For an input file, the most common use for this option is to
+ inform SoX of the number of channels in a `raw' (`headerless')
+ audio file. Occasionally, it may be useful to use this option
+ with a `headered' file, in order to override the (presumably
+ incorrect) value in the header - note that this is only sup‐
+ ported with certain file types. Examples:
+ sox -r 48k -e float -b 32 -c 2 input.raw output.wav
+ converts a particular `raw' file to a self-describing `WAV'
+ file.
+ play -c 1 music.wav
+ interprets the file data as belonging to a single channel
+ regardless of what is indicated in the file header. Note that
+ if the file does in fact have two channels, this will result in
+ the file playing at half speed.
+
+ For an output file, this option provides a shorthand for speci‐
+ fying that the channels effect should be invoked in order to
+ change (if necessary) the number of channels in the audio signal
+ to the number given. For example, the following two commands
+ are equivalent:
+ sox input.wav -c 1 output.wav bass -b 24
+ sox input.wav output.wav bass -b 24 channels 1
+ though the second form is more flexible as it allows the effects
+ to be ordered arbitrarily.
+
+ -e ENCODING, --encoding ENCODING
+ The audio encoding type. Sometimes needed with file-types that
+ support more than one encoding type. For example, with raw, WAV,
+ or AU (but not, for example, with MP3 or FLAC). The available
+ encoding types are as follows:
+
+ signed-integer
+ PCM data stored as signed (`two's complement') integers.
+ Commonly used with a 16 or 24 -bit encoding size. A
+ value of 0 represents minimum signal power.
+
+ unsigned-integer
+ PCM data stored as unsigned integers. Commonly used with
+ an 8-bit encoding size. A value of 0 represents maximum
+ signal power.
+
+ floating-point
+ PCM data stored as IEEE 753 single precision (32-bit) or
+ double precision (64-bit) floating-point (`real') num‐
+ bers. A value of 0 represents minimum signal power.
+
+ a-law International telephony standard for logarithmic encoding
+ to 8 bits per sample. It has a precision equivalent to
+ roughly 13-bit PCM and is sometimes encoded with reversed
+ bit-ordering (see the -X option).
+
+ u-law, mu-law
+ North American telephony standard for logarithmic encod‐
+ ing to 8 bits per sample. A.k.a. μ-law. It has a preci‐
+ sion equivalent to roughly 14-bit PCM and is sometimes
+ encoded with reversed bit-ordering (see the -X option).
+
+ oki-adpcm
+ OKI (a.k.a. VOX, Dialogic, or Intel) 4-bit ADPCM; it has
+ a precision equivalent to roughly 12-bit PCM. ADPCM is a
+ form of audio compression that has a good compromise
+ between audio quality and encoding/decoding speed.
+
+ ima-adpcm
+ IMA (a.k.a. DVI) 4-bit ADPCM; it has a precision equiva‐
+ lent to roughly 13-bit PCM.
+
+ ms-adpcm
+ Microsoft 4-bit ADPCM; it has a precision equivalent to
+ roughly 14-bit PCM.
+
+ gsm-full-rate
+ GSM is currently used for the vast majority of the
+ world's digital wireless telephone calls. It utilises
+ several audio formats with different bit-rates and asso‐
+ ciated speech quality. SoX has support for GSM's origi‐
+ nal 13kbps `Full Rate' audio format. It is usually CPU-
+ intensive to work with GSM audio.
+
+ Encoding names can be abbreviated where this would not be
+ ambiguous; e.g. `unsigned-integer' can be given as `un', but not
+ `u' (ambiguous with `u-law').
+
+ For an input file, the most common use for this option is to
+ inform SoX of the encoding of a `raw' (`headerless') audio file
+ (see the examples in -b and -c above).
+
+ For an output file, this option can be used (perhaps along with
+ -b) to set the output encoding type For example
+ sox input.cdda -e float output1.wav
+
+ sox input.cdda -b 64 -e float output2.wav
+ convert raw CD digital audio (16-bit, signed-integer) to float‐
+ ing-point `WAV' files (single & double precision respectively).
+
+ By default (i.e. if this option is not given), the output encod‐
+ ing type will (providing it is supported by the output file
+ type) be set to the input encoding type.
+
+ --no-glob
+ Specifies that filename `globbing' (wild-card matching) should
+ not be performed by SoX on the following filename. For example,
+ if the current directory contains the two files `five-sec‐
+ onds.wav' and `five*.wav', then
+ play --no-glob "five*.wav"
+ can be used to play just the single file `five*.wav'.
+
+ -r, --rate RATE[k]
+ Gives the sample rate in Hz (or kHz if appended with `k') of the
+ file.
+
+ For an input file, the most common use for this option is to
+ inform SoX of the sample rate of a `raw' (`headerless') audio
+ file (see the examples in -b and -c above). Occasionally it may
+ be useful to use this option with a `headered' file, in order to
+ override the (presumably incorrect) value in the header - note
+ that this is only supported with certain file types. For exam‐
+ ple, if audio was recorded with a sample-rate of say 48k from a
+ source that played back a little, say 1.5%, too slowly, then
+ sox -r 48720 input.wav output.wav
+ effectively corrects the speed by changing only the file header
+ (but see also the speed effect for the more usual solution to
+ this problem).
+
+ For an output file, this option provides a shorthand for speci‐
+ fying that the rate effect should be invoked in order to change
+ (if necessary) the sample rate of the audio signal to the given
+ value. For example, the following two commands are equivalent:
+ sox input.wav -r 48k output.wav bass -b 24
+ sox input.wav output.wav bass -b 24 rate 48k
+ though the second form is more flexible as it allows rate
+ options to be given, and allows the effects to be ordered arbi‐
+ trarily.
+
+ -t, --type FILE-TYPE
+ Gives the type of the audio file. For both input and output
+ files, this option is commonly used to inform SoX of the type a
+ `headerless' audio file (e.g. raw, mp3) where the actual/desired
+ type cannot be determined from a given filename extension. For
+ example:
+ another-command | sox -t mp3 - output.wav
+
+ sox input.wav -t raw output.bin
+ It can also be used to override the type implied by an input
+ filename extension, but if overriding with a type that has a
+ header, SoX will exit with an appropriate error message if such
+ a header is not actually present.
+
+ See soxformat(7) for a list of supported file types.
+
+ -L, --endian little
+ -B, --endian big
+ -x, --endian swap
+ These options specify whether the byte-order of the audio data
+ is, respectively, `little endian', `big endian', or the opposite
+ to that of the system on which SoX is being used. Endianness
+ applies only to data encoded as floating-point, or as signed or
+ unsigned integers of 16 or more bits. It is often necessary to
+ specify one of these options for headerless files, and sometimes
+ necessary for (otherwise) self-describing files. A given
+ endian-setting option may be ignored for an input file whose
+ header contains a specific endianness identifier, or for an out‐
+ put file that is actually an audio device.
+
+ N.B. Unlike other format characteristics, the endianness (byte,
+ nibble, & bit ordering) of the input file is not automatically
+ used for the output file; so, for example, when the following is
+ run on a little-endian system:
+ sox -B audio.s16 trimmed.s16 trim 2
+ trimmed.s16 will be created as little-endian;
+ sox -B audio.s16 -B trimmed.s16 trim 2
+ must be used to preserve big-endianness in the output file.
+
+ The -V option can be used to check the selected orderings.
+
+ -N, --reverse-nibbles
+ Specifies that the nibble ordering (i.e. the 2 halves of a byte)
+ of the samples should be reversed; sometimes useful with ADPCM-
+ based formats.
+
+ N.B. See also N.B. in section on -x above.
+
+ -X, --reverse-bits
+ Specifies that the bit ordering of the samples should be
+ reversed; sometimes useful with a few (mostly headerless) for‐
+ mats.
+
+ N.B. See also N.B. in section on -x above.
+
+ Output File Format Options
+ These options apply only to the output file and may precede only the
+ output filename on the command line.
+
+ --add-comment TEXT
+ Append a comment in the output file header (where applicable).
+
+ --comment TEXT
+ Specify the comment text to store in the output file header
+ (where applicable).
+
+ SoX will provide a default comment if this option (or --com‐
+ ment-file) is not given. To specify that no comment should be
+ stored in the output file, use --comment "" .
+
+ --comment-file FILENAME
+ Specify a file containing the comment text to store in the out‐
+ put file header (where applicable).
+
+ -C, --compression FACTOR
+ The compression factor for variably compressing output file for‐
+ mats. If this option is not given then a default compression
+ factor will apply. The compression factor is interpreted dif‐
+ ferently for different compressing file formats. See the
+ description of the file formats that use this option in soxfor‐
+ mat(7) for more information.
+
+EFFECTS
+ In addition to converting, playing and recording audio files, SoX can
+ be used to invoke a number of audio `effects'. Multiple effects may be
+ applied by specifying them one after another at the end of the SoX com‐
+ mand line, forming an `effects chain'. Note that applying multiple
+ effects in real-time (i.e. when playing audio) is likely to require a
+ high performance computer. Stopping other applications may alleviate
+ performance issues should they occur.
+
+ Some of the SoX effects are primarily intended to be applied to a sin‐
+ gle instrument or `voice'. To facilitate this, the remix effect and
+ the global SoX option -M can be used to isolate then recombine tracks
+ from a multi-track recording.
+
+ Multiple Effects Chains
+ A single effects chain is made up of one or more effects. Audio from
+ the input runs through the chain until either the end of the input file
+ is reached or an effect in the chain requests to terminate the chain.
+
+ SoX supports running multiple effects chains over the input audio. In
+ this case, when one chain indicates it is done processing audio, the
+ audio data is then sent through the next effects chain. This continues
+ until either no more effects chains exist or the input has reached the
+ end of the file.
+
+ An effects chain is terminated by placing a : (colon) after an effect.
+ Any following effects are a part of a new effects chain.
+
+ It is important to place the effect that will stop the chain as the
+ first effect in the chain. This is because any samples that are
+ buffered by effects to the left of the terminating effect will be dis‐
+ carded. The amount of samples discarded is related to the --buffer
+ option and it should be kept small, relative to the sample rate, if the
+ terminating effect cannot be first. Further information on stopping
+ effects can be found in the Stopping SoX section.
+
+ There are a few pseudo-effects that aid using multiple effects chains.
+ These include newfile which will start writing to a new output file
+ before moving to the next effects chain and restart which will move
+ back to the first effects chain. Pseudo-effects must be specified as
+ the first effect in a chain and as the only effect in a chain (they
+ must have a : before and after they are specified).
+
+ The following is an example of multiple effects chains. It will split
+ the input file into multiple files of 30 seconds in length. Each out‐
+ put filename will have unique number in its name as documented in the
+ Output Files section.
+ sox infile.wav output.wav trim 0 30 : newfile : restart
+
+ Common Notation And Parameters
+ In the descriptions that follow, brackets [ ] are used to denote param‐
+ eters that are optional, braces { } to denote those that are both
+ optional and repeatable, and angle brackets < > to denote those that
+ are repeatable but not optional. Where applicable, default values for
+ optional parameters are shown in parenthesis ( ).
+
+ The following parameters are used with, and have the same meaning for,
+ several effects:
+
+ center[k]
+ See frequency.
+
+ frequency[k]
+ A frequency in Hz, or, if appended with `k', kHz.
+
+ gain A power gain in dB. Zero gives no gain; less than zero gives an
+ attenuation.
+
+ position
+ A position within the audio stream; the syntax is [=|+|-]time‐
+ spec, where timespec is a time specification (see below). The
+ optional first character indicates whether the timespec is to be
+ interpreted relative to the start (=) or end (-) of audio, or to
+ the previous position if the effect accepts multiple position
+ arguments (+). The audio length must be known for end-relative
+ locations to work; some effects do accept -0 for end-of-audio,
+ though, even if the length is unknown. Which of =, +, - is the
+ default depends on the effect and is shown in its syntax as,
+ e.g., position(+).
+
+ Examples: =2:00 (two minutes into the audio stream), -100s (one
+ hundred samples before the end of audio), +0:12+10s (twelve sec‐
+ onds and ten samples after the previous position), -0.5+1s (one
+ sample less than half a second before the end of audio).
+
+ width[h|k|o|q]
+ Used to specify the band-width of a filter. A number of differ‐
+ ent methods to specify the width are available (though not all
+ for every effect). One of the characters shown may be appended
+ to select the desired method as follows:
+
+ Method Notes
+ h Hz
+ k kHz
+ o Octaves
+ q Q-factor See [2]
+
+ For each effect that uses this parameter, the default method
+ (i.e. if no character is appended) is the one that it listed
+ first in the first line of the effect's description.
+
+ Most effects that expect an audio position or duration in a parameter,
+ i.e. a time specification, accept either of the following two forms:
+
+ [[hours:]minutes:]seconds[.frac][t]
+ A specification of `1:30.5' corresponds to one minute, thirty
+ and ½ seconds. The t suffix is entirely optional (however, see
+ the silence effect for an exception). Note that the component
+ values do not have to be normalized; e.g., `1:23:45', `83:45',
+ `79:0285', `1:0:1425', `1::1425' and `5025' all are legal and
+ equivalent to each other.
+
+ sampless
+ Specifies the number of samples directly, as in `8000s'. For
+ large sample counts, e notation is supported: `1.7e6s' is the
+ same as `1700000s'.
+
+ Time specifications can also be chained with + or - into a new time
+ specification where the right part is added to or subtracted from the
+ left, respectively: `3:00-200s' means two hundred samples less than
+ three minutes.
+
+ To see if SoX has support for an optional effect, enter sox -h and look
+ for its name under the list: `EFFECTS'.
+
+ Supported Effects
+ Note: a categorised list of the effects can be found in the accompany‐
+ ing `README' file.
+
+ allpass frequency[k] width[h|k|o|q]
+ Apply a two-pole all-pass filter with central frequency (in Hz)
+ frequency, and filter-width width. An all-pass filter changes
+ the audio's frequency to phase relationship without changing its
+ frequency to amplitude relationship. The filter is described in
+ detail in [1].
+
+ This effect supports the --plot global option.
+
+ band [-n] center[k] [width[h|k|o|q]]
+ Apply a band-pass filter. The frequency response drops loga‐
+ rithmically around the center frequency. The width parameter
+ gives the slope of the drop. The frequencies at center + width
+ and center - width will be half of their original amplitudes.
+ band defaults to a mode oriented to pitched audio, i.e. voice,
+ singing, or instrumental music. The -n (for noise) option uses
+ the alternate mode for un-pitched audio (e.g. percussion).
+ Warning: -n introduces a power-gain of about 11dB in the filter,
+ so beware of output clipping. band introduces noise in the
+ shape of the filter, i.e. peaking at the center frequency and
+ settling around it.
+
+ This effect supports the --plot global option.
+
+ See also sinc for a bandpass filter with steeper shoulders.
+
+ bandpass|bandreject [-c] frequency[k] width[h|k|o|q]
+ Apply a two-pole Butterworth band-pass or band-reject filter
+ with central frequency frequency, and (3dB-point) band-width
+ width. The -c option applies only to bandpass and selects a
+ constant skirt gain (peak gain = Q) instead of the default: con‐
+ stant 0dB peak gain. The filters roll off at 6dB per octave
+ (20dB per decade) and are described in detail in [1].
+
+ These effects support the --plot global option.
+
+ See also sinc for a bandpass filter with steeper shoulders.
+
+ bandreject frequency[k] width[h|k|o|q]
+ Apply a band-reject filter. See the description of the bandpass
+ effect for details.
+
+ bass|treble gain [frequency[k] [width[s|h|k|o|q]]]
+ Boost or cut the bass (lower) or treble (upper) frequencies of
+ the audio using a two-pole shelving filter with a response simi‐
+ lar to that of a standard hi-fi's tone-controls. This is also
+ known as shelving equalisation (EQ).
+
+ gain gives the gain at 0 Hz (for bass), or whichever is the
+ lower of ∼22 kHz and the Nyquist frequency (for treble). Its
+ useful range is about -20 (for a large cut) to +20 (for a large
+ boost). Beware of Clipping when using a positive gain.
+
+ If desired, the filter can be fine-tuned using the following
+ optional parameters:
+
+ frequency sets the filter's central frequency and so can be used
+ to extend or reduce the frequency range to be boosted or cut.
+ The default value is 100 Hz (for bass) or 3 kHz (for treble).
+
+ width determines how steep is the filter's shelf transition. In
+ addition to the common width specification methods described
+ above, `slope' (the default, or if appended with `s') may be
+ used. The useful range of `slope' is about 0.3, for a gentle
+ slope, to 1 (the maximum), for a steep slope; the default value
+ is 0.5.
+
+ The filters are described in detail in [1].
+
+ These effects support the --plot global option.
+
+ See also equalizer for a peaking equalisation effect.
+
+ bend [-f frame-rate(25)] [-o over-sample(16)] { start-posi‐
+ tion(+),cents,end-position(+) }
+ Changes pitch by specified amounts at specified times. Each
+ given triple: start-position,cents,end-position specifies one
+ bend. cents is the number of cents (100 cents = 1 semitone) by
+ which to bend the pitch. The other values specify the points in
+ time at which to start and end bending the pitch, respectively.
+
+ The pitch-bending algorithm utilises the Discrete Fourier Trans‐
+ form (DFT) at a particular frame rate and over-sampling rate.
+ The -f and -o parameters may be used to adjust these parameters
+ and thus control the smoothness of the changes in pitch.
+
+ For example, an initial tone is generated, then bent three
+ times, yielding four different notes in total:
+ play -n synth 2.5 sin 667 gain 1 \
+ bend .35,180,.25 .15,740,.53 0,-520,.3
+ Here, the first bend runs from 0.35 to 0.6, and the second one
+ from 0.75 to 1.28 seconds. Note that the clipping that is pro‐
+ duced in this example is deliberate; to remove it, use gain -5
+ in place of gain 1.
+
+ See also pitch.
+
+ biquad b0 b1 b2 a0 a1 a2
+ Apply a biquad IIR filter with the given coefficients. Where b*
+ and a* are the numerator and denominator coefficients respec‐
+ tively.
+
+ See http://en.wikipedia.org/wiki/Digital_biquad_filter (where a0
+ = 1).
+
+ This effect supports the --plot global option.
+
+ channels CHANNELS
+ Invoke a simple algorithm to change the number of channels in
+ the audio signal to the given number CHANNELS: mixing if
+ decreasing the number of channels or duplicating if increasing
+ the number of channels.
+
+ The channels effect is invoked automatically if SoX's -c option
+ specifies a number of channels that is different to that of the
+ input file(s). Alternatively, if this effect is given explic‐
+ itly, then SoX's -c option need not be given. For example, the
+ following two commands are equivalent:
+ sox input.wav -c 1 output.wav bass -b 24
+ sox input.wav output.wav bass -b 24 channels 1
+ though the second form is more flexible as it allows the effects
+ to be ordered arbitrarily.
+
+ See also remix for an effect that allows channels to be
+ mixed/selected arbitrarily.
+
+ chorus gain-in gain-out <delay decay speed depth -s|-t>
+ Add a chorus effect to the audio. This can make a single vocal
+ sound like a chorus, but can also be applied to instrumentation.
+
+ Chorus resembles an echo effect with a short delay, but whereas
+ with echo the delay is constant, with chorus, it is varied using
+ sinusoidal or triangular modulation. The modulation depth
+ defines the range the modulated delay is played before or after
+ the delay. Hence the delayed sound will sound slower or faster,
+ that is the delayed sound tuned around the original one, like in
+ a chorus where some vocals are slightly off key. See [3] for
+ more discussion of the chorus effect.
+
+ Each four-tuple parameter delay/decay/speed/depth gives the
+ delay in milliseconds and the decay (relative to gain-in) with a
+ modulation speed in Hz using depth in milliseconds. The modula‐
+ tion is either sinusoidal (-s) or triangular (-t). Gain-out is
+ the volume of the output.
+
+ A typical delay is around 40ms to 60ms; the modulation speed is
+ best near 0.25Hz and the modulation depth around 2ms. For exam‐
+ ple, a single delay:
+ play guitar1.wav chorus 0.7 0.9 55 0.4 0.25 2 -t
+ Two delays of the original samples:
+ play guitar1.wav chorus 0.6 0.9 50 0.4 0.25 2 -t \
+ 60 0.32 0.4 1.3 -s
+ A fuller sounding chorus (with three additional delays):
+ play guitar1.wav chorus 0.5 0.9 50 0.4 0.25 2 -t \
+ 60 0.32 0.4 2.3 -t 40 0.3 0.3 1.3 -s
+
+ compand attack1,decay1{,attack2,decay2}
+ [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2}
+ [gain [initial-volume-dB [delay]]]
+
+ Compand (compress or expand) the dynamic range of the audio.
+
+ The attack and decay parameters (in seconds) determine the time
+ over which the instantaneous level of the input signal is aver‐
+ aged to determine its volume; attacks refer to increases in vol‐
+ ume and decays refer to decreases. For most situations, the
+ attack time (response to the music getting louder) should be
+ shorter than the decay time because the human ear is more sensi‐
+ tive to sudden loud music than sudden soft music. Where more
+ than one pair of attack/decay parameters are specified, each
+ input channel is companded separately and the number of pairs
+ must agree with the number of input channels. Typical values
+ are 0.3,0.8 seconds.
+
+ The second parameter is a list of points on the compander's
+ transfer function specified in dB relative to the maximum possi‐
+ ble signal amplitude. The input values must be in a strictly
+ increasing order but the transfer function does not have to be
+ monotonically rising. If omitted, the value of out-dB1 defaults
+ to the same value as in-dB1; levels below in-dB1 are not com‐
+ panded (but may have gain applied to them). The point 0,0 is
+ assumed but may be overridden (by 0,out-dBn). If the list is
+ preceded by a soft-knee-dB value, then the points at where adja‐
+ cent line segments on the transfer function meet will be rounded
+ by the amount given. Typical values for the transfer function
+ are 6:-70,-60,-20.
+
+ The third (optional) parameter is an additional gain in dB to be
+ applied at all points on the transfer function and allows easy
+ adjustment of the overall gain.
+
+ The fourth (optional) parameter is an initial level to be
+ assumed for each channel when companding starts. This permits
+ the user to supply a nominal level initially, so that, for exam‐
+ ple, a very large gain is not applied to initial signal levels
+ before the companding action has begun to operate: it is quite
+ probable that in such an event, the output would be severely
+ clipped while the compander gain properly adjusts itself. A
+ typical value (for audio which is initially quiet) is -90 dB.
+
+ The fifth (optional) parameter is a delay in seconds. The input
+ signal is analysed immediately to control the compander, but it
+ is delayed before being fed to the volume adjuster. Specifying
+ a delay approximately equal to the attack/decay times allows the
+ compander to effectively operate in a `predictive' rather than a
+ reactive mode. A typical value is 0.2 seconds.
+
+ * * *
+
+ The following example might be used to make a piece of music
+ with both quiet and loud passages suitable for listening to in a
+ noisy environment such as a moving vehicle:
+ sox asz.wav asz-car.wav compand 0.3,1 6:-70,-60,-20 -5 -90 0.2
+ The transfer function (`6:-70,...') says that very soft sounds
+ (below -70dB) will remain unchanged. This will stop the compan‐
+ der from boosting the volume on `silent' passages such as
+ between movements. However, sounds in the range -60dB to 0dB
+ (maximum volume) will be boosted so that the 60dB dynamic range
+ of the original music will be compressed 3-to-1 into a 20dB
+ range, which is wide enough to enjoy the music but narrow enough
+ to get around the road noise. The `6:' selects 6dB soft-knee
+ companding. The -5 (dB) output gain is needed to avoid clipping
+ (the number is inexact, and was derived by experimentation).
+ The -90 (dB) for the initial volume will work fine for a clip
+ that starts with near silence, and the delay of 0.2 (seconds)
+ has the effect of causing the compander to react a bit more
+ quickly to sudden volume changes.
+
+ In the next example, compand is being used as a noise-gate for
+ when the noise is at a lower level than the signal:
+ play infile compand .1,.2 -inf,-50.1,-inf,-50,-50 0 -90 .1
+ Here is another noise-gate, this time for when the noise is at a
+ higher level than the signal (making it, in some ways, similar
+ to squelch):
+ play infile compand .1,.1 -45.1,-45,-inf,0,-inf 45 -90 .1
+ This effect supports the --plot global option (for the transfer
+ function).
+
+ See also mcompand for a multiple-band companding effect.
+
+ contrast [enhancement-amount(75)]
+ Comparable with compression, this effect modifies an audio sig‐
+ nal to make it sound louder. enhancement-amount controls the
+ amount of the enhancement and is a number in the range 0-100.
+ Note that enhancement-amount = 0 still gives a significant con‐
+ trast enhancement.
+
+ See also the compand and mcompand effects.
+
+ dcshift shift [limitergain]
+ Apply a DC shift to the audio. This can be useful to remove a
+ DC offset (caused perhaps by a hardware problem in the recording
+ chain) from the audio. The effect of a DC offset is reduced
+ headroom and hence volume. The stat or stats effect can be used
+ to determine if a signal has a DC offset.
+
+ The given dcshift value is a floating point number in the range
+ of ±2 that indicates the amount to shift the audio (which is in
+ the range of ±1).
+
+ An optional limitergain can be specified as well. It should
+ have a value much less than 1 (e.g. 0.05 or 0.02) and is used
+ only on peaks to prevent clipping.
+
+ * * *
+
+ An alternative approach to removing a DC offset (albeit with a
+ short delay) is to use the highpass filter effect at a frequency
+ of say 10Hz, as illustrated in the following example:
+ sox -n dc.wav synth 5 sin %0 50
+ sox dc.wav fixed.wav highpass 10
+
+ deemph Apply Compact Disc (IEC 60908) de-emphasis (a treble attenuation
+ shelving filter).
+
+ Pre-emphasis was applied in the mastering of some CDs issued in
+ the early 1980s. These included many classical music albums, as
+ well as now sought-after issues of albums by The Beatles, Pink
+ Floyd and others. Pre-emphasis should be removed at playback
+ time by a de-emphasis filter in the playback device. However,
+ not all modern CD players have this filter, and very few PC CD
+ drives have it; playing pre-emphasised audio without the correct
+ de-emphasis filter results in audio that sounds harsh and is far
+ from what its creators intended.
+
+ With the deemph effect, it is possible to apply the necessary
+ de-emphasis to audio that has been extracted from a pre-empha‐
+ sised CD, and then either burn the de-emphasised audio to a new
+ CD (which will then play correctly on any CD player), or simply
+ play the correctly de-emphasised audio files on the PC. For
+ example:
+ sox track1.wav track1-deemph.wav deemph
+ and then burn track1-deemph.wav to CD, or
+ play track1-deemph.wav
+ or simply
+ play track1.wav deemph
+ The de-emphasis filter is implemented as a biquad and requires
+ the input audio sample rate to be either 44.1kHz or 48kHz. Max‐
+ imum deviation from the ideal response is only 0.06dB (up to
+ 20kHz).
+
+ This effect supports the --plot global option.
+
+ See also the bass and treble shelving equalisation effects.
+
+ delay {position(=)}
+ Delay one or more audio channels such that they start at the
+ given position. For example, delay 1.5 +1 3000s delays the
+ first channel by 1.5 seconds, the second channel by 2.5 seconds
+ (one second more than the previous channel), the third channel
+ by 3000 samples, and leaves any other channels that may be
+ present un-delayed. The following (one long) command plays a
+ chime sound:
+ play -n synth -j 3 sin %3 sin %-2 sin %-5 sin %-9 \
+ sin %-14 sin %-21 fade h .01 2 1.5 delay \
+ 1.3 1 .76 .54 .27 remix - fade h 0 2.7 2.5 norm -1
+ and this plays a guitar chord:
+ play -n synth pl G2 pl B2 pl D3 pl G3 pl D4 pl G4 \
+ delay 0 .05 .1 .15 .2 .25 remix - fade 0 4 .1 norm -1
+
+ dither [-S|-s|-f filter] [-a] [-p precision]
+ Apply dithering to the audio. Dithering deliberately adds a
+ small amount of noise to the signal in order to mask audible
+ quantization effects that can occur if the output sample size is
+ less than 24 bits. With no options, this effect will add trian‐
+ gular (TPDF) white noise. Noise-shaping (only for certain sam‐
+ ple rates) can be selected with -s. With the -f option, it is
+ possible to select a particular noise-shaping filter from the
+ following list: lipshitz, f-weighted, modified-e-weighted,
+ improved-e-weighted, gesemann, shibata, low-shibata, high-shi‐
+ bata. Note that most filter types are available only with
+ 44100Hz sample rate. The filter types are distinguished by the
+ following properties: audibility of noise, level of (inaudible,
+ but in some circumstances, otherwise problematic) shaped high
+ frequency noise, and processing speed.
+ See http://sox.sourceforge.net/SoX/NoiseShaping for graphs of
+ the different noise-shaping curves.
+
+ The -S option selects a slightly `sloped' TPDF, biased towards
+ higher frequencies. It can be used at any sampling rate but
+ below ≈22k, plain TPDF is probably better, and above ≈ 37k,
+ noise-shaping (if available) is probably better.
+
+ The -a option enables a mode where dithering (and noise-shaping
+ if applicable) are automatically enabled only when needed. The
+ most likely use for this is when applying fade in or out to an
+ already dithered file, so that the redithering applies only to
+ the faded portions. However, auto dithering is not fool-proof,
+ so the fades should be carefully checked for any noise modula‐
+ tion; if this occurs, then either re-dither the whole file, or
+ use trim, fade, and concatencate.
+
+ The -p option allows overriding the target precision.
+
+ If the SoX global option -R option is not given, then the
+ pseudo-random number generator used to generate the white noise
+ will be `reseeded', i.e. the generated noise will be different
+ between invocations.
+
+ This effect should not be followed by any other effect that
+ affects the audio.
+
+ See also the `Dithering' section above.
+
+ downsample [factor(2)]
+ Downsample the signal by an integer factor: Only the first out
+ of each factor samples is retained, the others are discarded.
+
+ No decimation filter is applied. If the input is not a properly
+ bandlimited baseband signal, aliasing will occur. This may be
+ desirable, e.g., for frequency translation.
+
+ For a general resampling effect with anti-aliasing, see rate.
+ See also upsample.
+
+ earwax Makes audio easier to listen to on headphones. Adds `cues' to
+ 44.1kHz stereo (i.e. audio CD format) audio so that when lis‐
+ tened to on headphones the stereo image is moved from inside
+ your head (standard for headphones) to outside and in front of
+ the listener (standard for speakers).
+
+ echo gain-in gain-out <delay decay>
+ Add echoing to the audio. Echoes are reflected sound and can
+ occur naturally amongst mountains (and sometimes large build‐
+ ings) when talking or shouting; digital echo effects emulate
+ this behaviour and are often used to help fill out the sound of
+ a single instrument or vocal. The time difference between the
+ original signal and the reflection is the `delay' (time), and
+ the loudness of the reflected signal is the `decay'. Multiple
+ echoes can have different delays and decays.
+
+ Each given delay decay pair gives the delay in milliseconds and
+ the decay (relative to gain-in) of that echo. Gain-out is the
+ volume of the output. For example: This will make it sound as
+ if there are twice as many instruments as are actually playing:
+ play lead.aiff echo 0.8 0.88 60 0.4
+ If the delay is very short, then it sound like a (metallic) ro‐
+ bot playing music:
+ play lead.aiff echo 0.8 0.88 6 0.4
+ A longer delay will sound like an open air concert in the moun‐
+ tains:
+ play lead.aiff echo 0.8 0.9 1000 0.3
+ One mountain more, and:
+ play lead.aiff echo 0.8 0.9 1000 0.3 1800 0.25
+
+ echos gain-in gain-out <delay decay>
+ Add a sequence of echoes to the audio. Each delay decay pair
+ gives the delay in milliseconds and the decay (relative to gain-
+ in) of that echo. Gain-out is the volume of the output.
+
+ Like the echo effect, echos stand for `ECHO in Sequel', that is
+ the first echos takes the input, the second the input and the
+ first echos, the third the input and the first and the second
+ echos, ... and so on. Care should be taken using many echos; a
+ single echos has the same effect as a single echo.
+
+ The sample will be bounced twice in symmetric echos:
+ play lead.aiff echos 0.8 0.7 700 0.25 700 0.3
+ The sample will be bounced twice in asymmetric echos:
+ play lead.aiff echos 0.8 0.7 700 0.25 900 0.3
+ The sample will sound as if played in a garage:
+ play lead.aiff echos 0.8 0.7 40 0.25 63 0.3
+
+ equalizer frequency[k] width[q|o|h|k] gain
+ Apply a two-pole peaking equalisation (EQ) filter. With this
+ filter, the signal-level at and around a selected frequency can
+ be increased or decreased, whilst (unlike band-pass and band-
+ reject filters) that at all other frequencies is unchanged.
+
+ frequency gives the filter's central frequency in Hz, width, the
+ band-width, and gain the required gain or attenuation in dB.
+ Beware of Clipping when using a positive gain.
+
+ In order to produce complex equalisation curves, this effect can
+ be given several times, each with a different central frequency.
+
+ The filter is described in detail in [1].
+
+ This effect supports the --plot global option.
+
+ See also bass and treble for shelving equalisation effects.
+
+ fade [type] fade-in-length [stop-position(=) [fade-out-length]]
+ Apply a fade effect to the beginning, end, or both of the audio.
+
+ An optional type can be specified to select the shape of the
+ fade curve: q for quarter of a sine wave, h for half a sine
+ wave, t for linear (`triangular') slope, l for logarithmic, and
+ p for inverted parabola. The default is logarithmic.
+
+ A fade-in starts from the first sample and ramps the signal
+ level from 0 to full volume over the time given as fade-in-
+ length. Specify 0 if no fade-in is wanted.
+
+ For fade-outs, the audio will be truncated at stop-position and
+ the signal level will be ramped from full volume down to 0 over
+ an interval of fade-out-length before the stop-position. If
+ fade-out-length is not specified, it defaults to the same value
+ as fade-in-length. No fade-out is performed if stop-position is
+ not specified. If the audio length can be determined from the
+ input file header and any previous effects, then -0 (or, for
+ historical reasons, 0) may be specified for stop-position to
+ indicate the usual case of a fade-out that ends at the end of
+ the input audio stream.
+
+ Any time specification may be used for fade-in-length and fade-
+ out-length.
+
+ See also the splice effect.
+
+ fir [coefs-file|coefs]
+ Use SoX's FFT convolution engine with given FIR filter coeffi‐
+ cients. If a single argument is given then this is treated as
+ the name of a file containing the filter coefficients (white-
+ space separated; may contain `#' comments). If the given file‐
+ name is `-', or if no argument is given, then the coefficients
+ are read from the `standard input' (stdin); otherwise, coeffi‐
+ cients may be given on the command line. Examples:
+ sox infile outfile fir 0.0195 -0.082 0.234 0.891 -0.145 0.043
+ sox infile outfile fir coefs.txt
+ with coefs.txt containing
+ # HP filter
+ # freq=10000
+ 1.2311233052619888e-01
+ -4.4777096106211783e-01
+ 5.1031563346705155e-01
+ -6.6502926320995331e-02
+ ...
+
+ This effect supports the --plot global option.
+
+ flanger [delay depth regen width speed shape phase interp]
+ Apply a flanging effect to the audio. See [3] for a detailed
+ description of flanging.
+
+ All parameters are optional (right to left).
+
+ Range Default Description
+ delay 0 - 30 0 Base delay in milliseconds.
+ depth 0 - 10 2 Added swept delay in milliseconds.
+ regen -95 - 95 0 Percentage regeneration (delayed
+ signal feedback).
+ width 0 - 100 71 Percentage of delayed signal mixed
+ with original.
+ speed 0.1 - 10 0.5 Sweeps per second (Hz).
+ shape sin Swept wave shape: sine|triangle.
+ phase 0 - 100 25 Swept wave percentage phase-shift
+ for multi-channel (e.g. stereo)
+ flange; 0 = 100 = same phase on
+ each channel.
+ interp lin Digital delay-line interpolation:
+ linear|quadratic.
+
+ gain [-e|-B|-b|-r] [-n] [-l|-h] [gain-dB]
+ Apply amplification or attenuation to the audio signal, or, in
+ some cases, to some of its channels. Note that use of any of
+ -e, -B, -b, -r, or -n requires temporary file space to store the
+ audio to be processed, so may be unsuitable for use with
+ `streamed' audio.
+
+ Without other options, gain-dB is used to adjust the signal
+ power level by the given number of dB: positive amplifies
+ (beware of Clipping), negative attenuates. With other options,
+ the gain-dB amplification or attenuation is (logically) applied
+ after the processing due to those options.
+
+ Given the -e option, the levels of the audio channels of a
+ multi-channel file are `equalised', i.e. gain is applied to all
+ channels other than that with the highest peak level, such that
+ all channels attain the same peak level (but, without also giv‐
+ ing -n, the audio is not `normalised').
+
+ The -B (balance) option is similar to -e, but with -B, the RMS
+ level is used instead of the peak level. -B might be used to
+ correct stereo imbalance caused by an imperfect record turntable
+ cartridge. Note that unlike -e, -B might cause some clipping.
+
+ -b is similar to -B but has clipping protection, i.e. if neces‐
+ sary to prevent clipping whilst balancing, attenuation is
+ applied to all channels. Note, however, that in conjunction
+ with -n, -B and -b are synonymous.
+
+ The -r option is used in conjunction with a prior invocation of
+ gain with the -h option - see below for details.
+
+ The -n option normalises the audio to 0dB FSD; it is often used
+ in conjunction with a negative gain-dB to the effect that the
+ audio is normalised to a given level below 0dB. For example,
+ sox infile outfile gain -n
+ normalises to 0dB, and
+ sox infile outfile gain -n -3
+ normalises to -3dB.
+
+ The -l option invokes a simple limiter, e.g.
+ sox infile outfile gain -l 6
+ will apply 6dB of gain but never clip. Note that limiting more
+ than a few dBs more than occasionally (in a piece of audio) is
+ not recommended as it can cause audible distortion. See the
+ compand effect for a more capable limiter.
+
+ The -h option is used to apply gain to provide head-room for
+ subsequent processing. For example, with
+ sox infile outfile gain -h bass +6
+ 6dB of attenuation will be applied prior to the bass boosting
+ effect thus ensuring that it will not clip. Of course, with
+ bass, it is obvious how much headroom will be needed, but with
+ other effects (e.g. rate, dither) it is not always as clear.
+ Another advantage of using gain -h rather than an explicit
+ attenuation, is that if the headroom is not used by subsequent
+ effects, it can be reclaimed with gain -r, for example:
+ sox infile outfile gain -h bass +6 rate 44100 gain -r
+ The above effects chain guarantees never to clip nor amplify; it
+ attenuates if necessary to prevent clipping, but by only as much
+ as is needed to do so.
+
+ Output formatting (dithering and bit-depth reduction) also
+ requires headroom (which cannot be `reclaimed'), e.g.
+ sox infile outfile gain -h bass +6 rate 44100 gain -rh dither
+ Here, the second gain invocation, reclaims as much of the head‐
+ room as it can from the preceding effects, but retains as much
+ headroom as is needed for subsequent processing. The SoX global
+ option -G can be given to automatically invoke gain -h and gain
+ -r.
+
+ See also the norm and vol effects.
+
+ highpass|lowpass [-1|-2] frequency[k] [width[q|o|h|k]]
+ Apply a high-pass or low-pass filter with 3dB point frequency.
+ The filter can be either single-pole (with -1), or double-pole
+ (the default, or with -2). width applies only to double-pole
+ filters; the default is Q = 0.707 and gives a Butterworth
+ response. The filters roll off at 6dB per pole per octave (20dB
+ per pole per decade). The double-pole filters are described in
+ detail in [1].
+
+ These effects support the --plot global option.
+
+ See also sinc for filters with a steeper roll-off.
+
+ hilbert [-n taps]
+ Apply an odd-tap Hilbert transform filter, phase-shifting the
+ signal by 90 degrees.
+
+ This is used in many matrix coding schemes and for analytic sig‐
+ nal generation. The process is often written as a multiplica‐
+ tion by i (or j), the imaginary unit.
+
+ An odd-tap Hilbert transform filter has a bandpass characteris‐
+ tic, attenuating the lowest and highest frequencies. Its band‐
+ width can be controlled by the number of filter taps, which can
+ be specified with -n. By default, the number of taps is chosen
+ for a cutoff frequency of about 75 Hz.
+
+ This effect supports the --plot global option.
+
+ ladspa [-l|-r] module [plugin] [argument ...]
+ Apply a LADSPA [5] (Linux Audio Developer's Simple Plugin API)
+ plugin. Despite the name, LADSPA is not Linux-specific, and a
+ wide range of effects is available as LADSPA plugins, such as
+ cmt [6] (the Computer Music Toolkit) and Steve Harris's plugin
+ collection [7]. The first argument is the plugin module, the
+ second the name of the plugin (a module can contain more than
+ one plugin), and any other arguments are for the control ports
+ of the plugin. Missing arguments are supplied by default values
+ if possible.
+
+ Normally, the number of input ports of the plugin must match the
+ number of input channels, and the number of output ports deter‐
+ mines the output channel count. However, the -r (replicate)
+ option allows cloning a mono plugin to handle multi-channel
+ input.
+
+ Some plugins introduce latency which SoX may optionally compen‐
+ sate for. The -l (latency compensation) option automatically
+ compensates for latency as reported by the plugin via an output
+ control port named "latency".
+
+ If found, the environment variable LADSPA_PATH will be used as
+ search path for plugins.
+
+ loudness [gain [reference]]
+ Loudness control - similar to the gain effect, but provides
+ equalisation for the human auditory system. See
+ http://en.wikipedia.org/wiki/Loudness for a detailed description
+ of loudness. The gain is adjusted by the given gain parameter
+ (usually negative) and the signal equalised according to ISO 226
+ w.r.t. a reference level of 65dB, though an alternative refer‐
+ ence level may be given if the original audio has been equalised
+ for some other optimal level. A default gain of -10dB is used
+ if a gain value is not given.
+
+ See also the gain effect.
+
+ lowpass [-1|-2] frequency[k] [width[q|o|h|k]]
+ Apply a low-pass filter. See the description of the highpass
+ effect for details.
+
+ mcompand "attack1,decay1{,attack2,decay2}
+ [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2}
+ [gain [initial-volume-dB [delay]]]" {crossover-freq[k]
+ "attack1,..."}
+
+ The multi-band compander is similar to the single-band compander
+ but the audio is first divided into bands using Linkwitz-Riley
+ cross-over filters and a separately specifiable compander run on
+ each band. See the compand effect for the definition of its
+ parameters. Compand parameters are specified between double
+ quotes and the crossover frequency for that band is given by
+ crossover-freq; these can be repeated to create multiple bands.
+
+ For example, the following (one long) command shows how multi-
+ band companding is typically used in FM radio:
+ play track1.wav gain -3 sinc 8000- 29 100 mcompand \
+ "0.005,0.1 -47,-40,-34,-34,-17,-33" 100 \
+ "0.003,0.05 -47,-40,-34,-34,-17,-33" 400 \
+ "0.000625,0.0125 -47,-40,-34,-34,-15,-33" 1600 \
+ "0.0001,0.025 -47,-40,-34,-34,-31,-31,-0,-30" 6400 \
+ "0,0.025 -38,-31,-28,-28,-0,-25" \
+ gain 15 highpass 22 highpass 22 sinc -n 255 -b 16 -17500 \
+ gain 9 lowpass -1 17801
+ The audio file is played with a simulated FM radio sound (or
+ broadcast signal condition if the lowpass filter at the end is
+ skipped). Note that the pipeline is set up with US-style 75us
+ pre-emphasis.
+
+ See also compand for a single-band companding effect.
+
+ noiseprof [profile-file]
+ Calculate a profile of the audio for use in noise reduction.
+ See the description of the noisered effect for details.
+
+ noisered [profile-file [amount]]
+ Reduce noise in the audio signal by profiling and filtering.
+ This effect is moderately effective at removing consistent back‐
+ ground noise such as hiss or hum. To use it, first run SoX with
+ the noiseprof effect on a section of audio that ideally would
+ contain silence but in fact contains noise - such sections are
+ typically found at the beginning or the end of a recording.
+ noiseprof will write out a noise profile to profile-file, or to
+ stdout if no profile-file or if `-' is given. E.g.
+ sox speech.wav -n trim 0 1.5 noiseprof speech.noise-profile
+ To actually remove the noise, run SoX again, this time with the
+ noisered effect; noisered will reduce noise according to a noise
+ profile (which was generated by noiseprof), from profile-file,
+ or from stdin if no profile-file or if `-' is given. E.g.
+ sox speech.wav cleaned.wav noisered speech.noise-profile 0.3
+ How much noise should be removed is specified by amount-a number
+ between 0 and 1 with a default of 0.5. Higher numbers will
+ remove more noise but present a greater likelihood of removing
+ wanted components of the audio signal. Before replacing an
+ original recording with a noise-reduced version, experiment with
+ different amount values to find the optimal one for your audio;
+ use headphones to check that you are happy with the results,
+ paying particular attention to quieter sections of the audio.
+
+ On most systems, the two stages - profiling and reduction - can
+ be combined using a pipe, e.g.
+ sox noisy.wav -n trim 0 1 noiseprof | play noisy.wav noisered
+
+ norm [dB-level]
+ Normalise the audio. norm is just an alias for gain -n; see the
+ gain effect for details.
+
+ oops Out Of Phase Stereo effect. Mixes stereo to twin-mono where
+ each mono channel contains the difference between the left and
+ right stereo channels. This is sometimes known as the `karaoke'
+ effect as it often has the effect of removing most or all of the
+ vocals from a recording. It is equivalent to remix 1,2i 1,2i.
+
+ overdrive [gain(20) [colour(20)]]
+ Non linear distortion. The colour parameter controls the amount
+ of even harmonic content in the over-driven output.
+
+ pad { length[@position(=)] }
+ Pad the audio with silence, at the beginning, the end, or any
+ specified points through the audio. length is the amount of
+ silence to insert and position the position in the input audio
+ stream at which to insert it. Any number of lengths and posi‐
+ tions may be specified, provided that a specified position is
+ not less that the previous one, and any time specification may
+ be used for them. position is optional for the first and last
+ lengths specified and if omitted correspond to the beginning and
+ the end of the audio respectively. For example, pad 1.5 1.5
+ adds 1.5 seconds of silence padding at each end of the audio,
+ whilst pad 4000s@3:00 inserts 4000 samples of silence 3 minutes
+ into the audio. If silence is wanted only at the end of the
+ audio, specify either the end position or specify a zero-length
+ pad at the start.
+
+ See also delay for an effect that can add silence at the begin‐
+ ning of the audio on a channel-by-channel basis.
+
+ phaser gain-in gain-out delay decay speed [-s|-t]
+ Add a phasing effect to the audio. See [3] for a detailed
+ description of phasing.
+
+ delay/decay/speed gives the delay in milliseconds and the decay
+ (relative to gain-in) with a modulation speed in Hz. The modu‐
+ lation is either sinusoidal (-s) - preferable for multiple
+ instruments, or triangular (-t) - gives single instruments a
+ sharper phasing effect. The decay should be less than 0.5 to
+ avoid feedback, and usually no less than 0.1. Gain-out is the
+ volume of the output.
+
+ For example:
+ play snare.flac phaser 0.8 0.74 3 0.4 0.5 -t
+ Gentler:
+ play snare.flac phaser 0.9 0.85 4 0.23 1.3 -s
+ A popular sound:
+ play snare.flac phaser 0.89 0.85 1 0.24 2 -t
+ More severe:
+ play snare.flac phaser 0.6 0.66 3 0.6 2 -t
+
+ pitch [-q] shift [segment [search [overlap]]]
+ Change the audio pitch (but not tempo).
+
+ shift gives the pitch shift as positive or negative `cents'
+ (i.e. 100ths of a semitone). See the tempo effect for a
+ description of the other parameters.
+
+ See also the bend, speed, and tempo effects.
+
+ rate [-q|-l|-m|-h|-v] [override-options] RATE[k]
+ Change the audio sampling rate (i.e. resample the audio) to any
+ given RATE (even non-integer if this is supported by the output
+ file format) using a quality level defined as follows:
+
+ Quality Band- Rej dB Typical Use
+ width
+ -q quick n/a ≈30 @ playback on
+ Fs/4 ancient hardware
+ -l low 80% 100 playback on old
+ hardware
+ -m medium 95% 100 audio playback
+
+
+ -h high 95% 125 16-bit mastering
+ (use with dither)
+ -v very high 95% 175 24-bit mastering
+
+ where Band-width is the percentage of the audio frequency band
+ that is preserved and Rej dB is the level of noise rejection.
+ Increasing levels of resampling quality come at the expense of
+ increasing amounts of time to process the audio. If no quality
+ option is given, the quality level used is `high' (but see
+ `Playing & Recording Audio' above regarding playback).
+
+ The `quick' algorithm uses cubic interpolation; all others use
+ band-limited interpolation. By default, all algorithms have a
+ `linear' phase response; for `medium', `high' and `very high',
+ the phase response is configurable (see below).
+
+ The rate effect is invoked automatically if SoX's -r option
+ specifies a rate that is different to that of the input file(s).
+ Alternatively, if this effect is given explicitly, then SoX's -r
+ option need not be given. For example, the following two com‐
+ mands are equivalent:
+ sox input.wav -r 48k output.wav bass -b 24
+ sox input.wav output.wav bass -b 24 rate 48k
+ though the second command is more flexible as it allows rate
+ options to be given, and allows the effects to be ordered arbi‐
+ trarily.
+
+ * * *
+
+ Warning: technically detailed discussion follows.
+
+ The simple quality selection described above provides settings
+ that satisfy the needs of the vast majority of resampling tasks.
+ Occasionally, however, it may be desirable to fine-tune the
+ resampler's filter response; this can be achieved using over‐
+ ride options, as detailed in the following table:
+
+ -M/-I/-L Phase response = minimum/intermediate/linear
+ -s Steep filter (band-width = 99%)
+ -a Allow aliasing/imaging above the pass-band
+ -b 74-99.7 Any band-width %
+ -p 0-100 Any phase response (0 = minimum, 25 = intermediate,
+ 50 = linear, 100 = maximum)
+
+ N.B. Override options cannot be used with the `quick' or `low'
+ quality algorithms.
+
+ All resamplers use filters that can sometimes create `echo'
+ (a.k.a. `ringing') artefacts with transient signals such as
+ those that occur with `finger snaps' or other highly percussive
+ sounds. Such artefacts are much more noticeable to the human
+ ear if they occur before the transient (`pre-echo') than if they
+ occur after it (`post-echo'). Note that frequency of any such
+ artefacts is related to the smaller of the original and new sam‐
+ pling rates but that if this is at least 44.1kHz, then the arte‐
+ facts will lie outside the range of human hearing.
+
+ A phase response setting may be used to control the distribution
+ of any transient echo between `pre' and `post': with minimum
+ phase, there is no pre-echo but the longest post-echo; with lin‐
+ ear phase, pre and post echo are in equal amounts (in signal
+ terms, but not audibility terms); the intermediate phase setting
+ attempts to find the best compromise by selecting a small length
+ (and level) of pre-echo and a medium lengthed post-echo.
+
+ Minimum, intermediate, or linear phase response is selected
+ using the -M, -I, or -L option; a custom phase response can be
+ created with the -p option. Note that phase responses between
+ `linear' and `maximum' (greater than 50) are rarely useful.
+
+ A resampler's band-width setting determines how much of the fre‐
+ quency content of the original signal (w.r.t. the original sam‐
+ ple rate when up-sampling, or the new sample rate when down-sam‐
+ pling) is preserved during conversion. The term `pass-band' is
+ used to refer to all frequencies up to the band-width point
+ (e.g. for 44.1kHz sampling rate, and a resampling band-width of
+ 95%, the pass-band represents frequencies from 0Hz (D.C.) to
+ circa 21kHz). Increasing the resampler's band-width results in
+ a slower conversion and can increase transient echo artefacts
+ (and vice versa).
+
+ The -s `steep filter' option changes resampling band-width from
+ the default 95% (based on the 3dB point), to 99%. The -b option
+ allows the band-width to be set to any value in the range
+ 74-99.7 %, but note that band-width values greater than 99% are
+ not recommended for normal use as they can cause excessive tran‐
+ sient echo.
+
+ If the -a option is given, then aliasing/imaging above the pass-
+ band is allowed. For example, with 44.1kHz sampling rate, and a
+ resampling band-width of 95%, this means that frequency content
+ above 21kHz can be distorted; however, since this is above the
+ pass-band (i.e. above the highest frequency of interest/audi‐
+ bility), this may not be a problem. The benefits of allowing
+ aliasing/imaging are reduced processing time, and reduced (by
+ almost half) transient echo artefacts. Note that if this option
+ is given, then the minimum band-width allowable with -b
+ increases to 85%.
+
+ Examples:
+ sox input.wav -b 16 output.wav rate -s -a 44100 dither -s
+ default (high) quality resampling; overrides: steep filter,
+ allow aliasing; to 44.1kHz sample rate; noise-shaped dither to
+ 16-bit WAV file.
+ sox input.wav -b 24 output.aiff rate -v -I -b 90 48k
+ very high quality resampling; overrides: intermediate phase,
+ band-width 90%; to 48k sample rate; store output to 24-bit AIFF
+ file.
+
+ * * *
+
+ The pitch and speed effects use the rate effect at their core.
+
+ remix [-a|-m|-p] <out-spec>
+ out-spec = in-spec{,in-spec} | 0
+ in-spec = [in-chan][-[in-chan2]][vol-spec]
+ vol-spec = p|i|v[volume]
+
+ Select and mix input audio channels into output audio channels.
+ Each output channel is specified, in turn, by a given out-spec:
+ a list of contributing input channels and volume specifications.
+
+ Note that this effect operates on the audio channels within the
+ SoX effects processing chain; it should not be confused with the
+ -m global option (where multiple files are mix-combined before
+ entering the effects chain).
+
+ An out-spec contains comma-separated input channel-numbers and
+ hyphen-delimited channel-number ranges; alternatively, 0 may be
+ given to create a silent output channel. For example,
+ sox input.wav output.wav remix 6 7 8 0
+ creates an output file with four channels, where channels 1, 2,
+ and 3 are copies of channels 6, 7, and 8 in the input file, and
+ channel 4 is silent. Whereas
+ sox input.wav output.wav remix 1-3,7 3
+ creates a (somewhat bizarre) stereo output file where the left
+ channel is a mix-down of input channels 1, 2, 3, and 7, and the
+ right channel is a copy of input channel 3.
+
+ Where a range of channels is specified, the channel numbers to
+ the left and right of the hyphen are optional and default to 1
+ and to the number of input channels respectively. Thus
+ sox input.wav output.wav remix -
+ performs a mix-down of all input channels to mono.
+
+ By default, where an output channel is mixed from multiple (n)
+ input channels, each input channel will be scaled by a factor of
+ ¹/n. Custom mixing volumes can be set by following a given
+ input channel or range of input channels with a vol-spec (volume
+ specification). This is one of the letters p, i, or v, followed
+ by a volume number, the meaning of which depends on the given
+ letter and is defined as follows:
+
+ Letter Volume number Notes
+ p power adjust in dB 0 = no change
+
+ i power adjust in dB As `p', but invert
+ the audio
+ v voltage multiplier 1 = no change, 0.5
+ ≈ 6dB attenuation,
+ 2 ≈ 6dB gain, -1 =
+ invert
+
+ If an out-spec includes at least one vol-spec then, by default,
+ ¹/n scaling is not applied to any other channels in the same
+ out-spec (though may be in other out-specs). The -a (automatic)
+ option however, can be given to retain the automatic scaling in
+ this case. For example,
+ sox input.wav output.wav remix 1,2 3,4v0.8
+ results in channel level multipliers of 0.5,0.5 1,0.8, whereas
+ sox input.wav output.wav remix -a 1,2 3,4v0.8
+ results in channel level multipliers of 0.5,0.5 0.5,0.8.
+
+ The -m (manual) option disables all automatic volume adjust‐
+ ments, so
+ sox input.wav output.wav remix -m 1,2 3,4v0.8
+ results in channel level multipliers of 1,1 1,0.8.
+
+ The volume number is optional and omitting it corresponds to no
+ volume change; however, the only case in which this is useful is
+ in conjunction with i. For example, if input.wav is stereo,
+ then
+ sox input.wav output.wav remix 1,2i
+ is a mono equivalent of the oops effect.
+
+ If the -p option is given, then any automatic ¹/n scaling is
+ replaced by ¹/√n (`power') scaling; this gives a louder mix but
+ one that might occasionally clip.
+
+ * * *
+
+ One use of the remix effect is to split an audio file into a set
+ of files, each containing one of the constituent channels (in
+ order to perform subsequent processing on individual audio chan‐
+ nels). Where more than a few channels are involved, a script
+ such as the following (Bourne shell script) is useful:
+ #!/bin/sh
+ chans=`soxi -c "$1"`
+ while [ $chans -ge 1 ]; do
+ chans0=`printf %02i $chans` # 2 digits hence up to 99 chans
+ out=`echo "$1"|sed "s/\(.*\)\.\(.*\)/\1-$chans0.\2/"`
+ sox "$1" "$out" remix $chans
+ chans=`expr $chans - 1`
+ done
+ If a file input.wav containing six audio channels were given,
+ the script would produce six output files: input-01.wav,
+ input-02.wav, ..., input-06.wav.
+
+ See also the swap effect.
+
+ repeat [count(1)|-]
+ Repeat the entire audio count times, or once if count is not
+ given. The special value - requests infinite repetition.
+ Requires temporary file space to store the audio to be repeated.
+ Note that repeating once yields two copies: the original audio
+ and the repeated audio.
+
+ reverb [-w|--wet-only] [reverberance (50%) [HF-damping (50%)
+ [room-scale (100%) [stereo-depth (100%)
+ [pre-delay (0ms) [wet-gain (0dB)]]]]]]
+
+ Add reverberation to the audio using the `freeverb' algorithm.
+ A reverberation effect is sometimes desirable for concert halls
+ that are too small or contain so many people that the hall's
+ natural reverberance is diminished. Applying a small amount of
+ stereo reverb to a (dry) mono signal will usually make it sound
+ more natural. See [3] for a detailed description of reverbera‐
+ tion.
+
+ Note that this effect increases both the volume and the length
+ of the audio, so to prevent clipping in these domains, a typical
+ invocation might be:
+ play dry.wav gain -3 pad 0 3 reverb
+ The -w option can be given to select only the `wet' signal, thus
+ allowing it to be processed further, independently of the `dry'
+ signal. E.g.
+ play -m voice.wav "|sox voice.wav -p reverse reverb -w reverse"
+ for a reverse reverb effect.
+
+ reverse
+ Reverse the audio completely. Requires temporary file space to
+ store the audio to be reversed.
+
+ riaa Apply RIAA vinyl playback equalisation. The sampling rate must
+ be one of: 44.1, 48, 88.2, 96 kHz.
+
+ This effect supports the --plot global option.
+
+ silence [-l] above-periods [duration threshold[d|%]
+ [below-periods duration threshold[d|%]]
+
+ Removes silence from the beginning, middle, or end of the audio.
+ `Silence' is determined by a specified threshold.
+
+ The above-periods value is used to indicate if audio should be
+ trimmed at the beginning of the audio. A value of zero indicates
+ no silence should be trimmed from the beginning. When specifying
+ a non-zero above-periods, it trims audio up until it finds non-
+ silence. Normally, when trimming silence from beginning of audio
+ the above-periods will be 1 but it can be increased to higher
+ values to trim all audio up to a specific count of non-silence
+ periods. For example, if you had an audio file with two songs
+ that each contained 2 seconds of silence before the song, you
+ could specify an above-period of 2 to strip out both silence
+ periods and the first song.
+
+ When above-periods is non-zero, you must also specify a duration
+ and threshold. duration indicates the amount of time that non-
+ silence must be detected before it stops trimming audio. By
+ increasing the duration, burst of noise can be treated as
+ silence and trimmed off.
+
+ threshold is used to indicate what sample value you should treat
+ as silence. For digital audio, a value of 0 may be fine but for
+ audio recorded from analog, you may wish to increase the value
+ to account for background noise.
+
+ When optionally trimming silence from the end of the audio, you
+ specify a below-periods count. In this case, below-period means
+ to remove all audio after silence is detected. Normally, this
+ will be a value 1 of but it can be increased to skip over peri‐
+ ods of silence that are wanted. For example, if you have a song
+ with 2 seconds of silence in the middle and 2 second at the end,
+ you could set below-period to a value of 2 to skip over the
+ silence in the middle of the audio.
+
+ For below-periods, duration specifies a period of silence that
+ must exist before audio is not copied any more. By specifying a
+ higher duration, silence that is wanted can be left in the
+ audio. For example, if you have a song with an expected 1 sec‐
+ ond of silence in the middle and 2 seconds of silence at the
+ end, a duration of 2 seconds could be used to skip over the mid‐
+ dle silence.
+
+ Unfortunately, you must know the length of the silence at the
+ end of your audio file to trim off silence reliably. A work‐
+ around is to use the silence effect in combination with the
+ reverse effect. By first reversing the audio, you can use the
+ above-periods to reliably trim all audio from what looks like
+ the front of the file. Then reverse the file again to get back
+ to normal.
+
+ To remove silence from the middle of a file, specify a below-
+ periods that is negative. This value is then treated as a posi‐
+ tive value and is also used to indicate that the effect should
+ restart processing as specified by the above-periods, making it
+ suitable for removing periods of silence in the middle of the
+ audio.
+
+ The option -l indicates that below-periods duration length of
+ audio should be left intact at the beginning of each period of
+ silence. For example, if you want to remove long pauses between
+ words but do not want to remove the pauses completely.
+
+ duration is a time specification with the peculiarity that a
+ bare number is interpreted as a sample count, not as a number of
+ seconds. For specifying seconds, either use the t suffix (as in
+ `2t') or specify minutes, too (as in `0:02').
+
+ threshold numbers may be suffixed with d to indicate the value
+ is in decibels, or % to indicate a percentage of maximum value
+ of the sample value (0% specifies pure digital silence).
+
+ The following example shows how this effect can be used to start
+ a recording that does not contain the delay at the start which
+ usually occurs between `pressing the record button' and the
+ start of the performance:
+ rec parameters filename other-effects silence 1 5 2%
+
+ sinc [-a att|-b beta] [-p phase|-M|-I|-L] [-t tbw|-n taps] [freqHP]
+ [-freqLP [-t tbw|-n taps]]
+ Apply a sinc kaiser-windowed low-pass, high-pass, band-pass, or
+ band-reject filter to the signal. The freqHP and freqLP parame‐
+ ters give the frequencies of the 6dB points of a high-pass and
+ low-pass filter that may be invoked individually, or together.
+ If both are given, then freqHP less than freqLP creates a band-
+ pass filter, freqHP greater than freqLP creates a band-reject
+ filter. For example, the invocations
+ sinc 3k
+ sinc -4k
+ sinc 3k-4k
+ sinc 4k-3k
+ create a high-pass, low-pass, band-pass, and band-reject filter
+ respectively.
+
+ The default stop-band attenuation of 120dB can be overridden
+ with -a; alternatively, the kaiser-window `beta' parameter can
+ be given directly with -b.
+
+ The default transition band-width of 5% of the total band can be
+ overridden with -t (and tbw in Hertz); alternatively, the number
+ of filter taps can be given directly with -n.
+
+ If both freqHP and freqLP are given, then a -t or -n option
+ given to the left of the frequencies applies to both frequen‐
+ cies; one of these options given to the right of the frequencies
+ applies only to freqLP.
+
+ The -p, -M, -I, and -L options control the filter's phase
+ response; see the rate effect for details.
+
+ This effect supports the --plot global option.
+
+ spectrogram [options]
+ Create a spectrogram of the audio; the audio is passed unmodi‐
+ fied through the SoX processing chain. This effect is optional
+ - type sox --help and check the list of supported effects to see
+ if it has been included.
+
+ The spectrogram is rendered in a Portable Network Graphic (PNG)
+ file, and shows time in the X-axis, frequency in the Y-axis, and
+ audio signal magnitude in the Z-axis. Z-axis values are repre‐
+ sented by the colour (or optionally the intensity) of the pixels
+ in the X-Y plane. If the audio signal contains multiple chan‐
+ nels then these are shown from top to bottom starting from chan‐
+ nel 1 (which is the left channel for stereo audio).
+
+ For example, if `my.wav' is a stereo file, then with
+ sox my.wav -n spectrogram
+ a spectrogram of the entire file will be created in the file
+ `spectrogram.png'. More often though, analysis of a smaller
+ portion of the audio is required; e.g. with
+ sox my.wav -n remix 2 trim 20 30 spectrogram
+ the spectrogram shows information only from the second (right)
+ channel, and of thirty seconds of audio starting from twenty
+ seconds in. To analyse a small portion of the frequency domain,
+ the rate effect may be used, e.g.
+ sox my.wav -n rate 6k spectrogram
+ allows detailed analysis of frequencies up to 3kHz (half the
+ sampling rate) i.e. where the human auditory system is most sen‐
+ sitive. With
+ sox my.wav -n trim 0 10 spectrogram -x 600 -y 200 -z 100
+ the given options control the size of the spectrogram's X, Y & Z
+ axes (in this case, the spectrogram area of the produced image
+ will be 600 by 200 pixels in size and the Z-axis range will be
+ 100 dB). Note that the produced image includes axes legends
+ etc. and so will be a little larger than the specified spectro‐
+ gram size. In this example:
+ sox -n -n synth 6 tri 10k:14k spectrogram -z 100 -w kaiser
+ an analysis `window' with high dynamic range is selected to best
+ display the spectrogram of a swept triangular wave. For a smi‐
+ lar example, append the following to the `chime' command in the
+ description of the delay effect (above):
+ rate 2k spectrogram -X 200 -Z -10 -w kaiser
+ Options are also available to control the appearance (colour-
+ set, brightness, contrast, etc.) and filename of the spectro‐
+ gram; e.g. with
+ sox my.wav -n spectrogram -m -l -o print.png
+ a spectrogram is created suitable for printing on a `black and
+ white' printer.
+
+ Options:
+
+ -x num Change the (maximum) width (X-axis) of the spectrogram
+ from its default value of 800 pixels to a given number
+ between 100 and 200000. See also -X and -d.
+
+ -X num X-axis pixels/second; the default is auto-calculated to
+ fit the given or known audio duration to the X-axis size,
+ or 100 otherwise. If given in conjunction with -d, this
+ option affects the width of the spectrogram; otherwise,
+ it affects the duration of the spectrogram. num can be
+ from 1 (low time resolution) to 5000 (high time resolu‐
+ tion) and need not be an integer. SoX may make a slight
+ adjustment to the given number for processing quantisa‐
+ tion reasons; if so, SoX will report the actual number
+ used (viewable when the SoX global option -V is in
+ effect). See also -x and -d.
+
+ -y num Sets the Y-axis size in pixels (per channel); this is the
+ number of frequency `bins' used in the Fourier analysis
+ that produces the spectrogram. N.B. it can be slow to
+ produce the spectrogram if this number is not one more
+ than a power of two (e.g. 129). By default the Y-axis
+ size is chosen automatically (depending on the number of
+ channels). See -Y for alternative way of setting spec‐
+ trogram height.
+
+ -Y num Sets the target total height of the spectrogram(s). The
+ default value is 550 pixels. Using this option (and by
+ default), SoX will choose a height for individual spec‐
+ trogram channels that is one more than a power of two, so
+ the actual total height may fall short of the given num‐
+ ber. However, there is also a minimum height per channel
+ so if there are many channels, the number may be
+ exceeded. See -y for alternative way of setting spectro‐
+ gram height.
+
+ -z num Z-axis (colour) range in dB, default 120. This sets the
+ dynamic-range of the spectrogram to be -num dBFS to
+ 0 dBFS. Num may range from 20 to 180. Decreasing
+ dynamic-range effectively increases the `contrast' of the
+ spectrogram display, and vice versa.
+
+ -Z num Sets the upper limit of the Z-axis in dBFS. A negative
+ num effectively increases the `brightness' of the spec‐
+ trogram display, and vice versa.
+
+ -q num Sets the Z-axis quantisation, i.e. the number of differ‐
+ ent colours (or intensities) in which to render Z-axis
+ values. A small number (e.g. 4) will give a
+ `poster'-like effect making it easier to discern magni‐
+ tude bands of similar level. Small numbers also usually
+ result in small PNG files. The number given specifies
+ the number of colours to use inside the Z-axis range; two
+ colours are reserved to represent out-of-range values.
+
+ -w name
+ Window: Hann (default), Hamming, Bartlett, Rectangular,
+ Kaiser or Dolph. The spectrogram is produced using the
+ Discrete Fourier Transform (DFT) algorithm. A signifi‐
+ cant parameter to this algorithm is the choice of `window
+ function'. By default, SoX uses the Hann window which
+ has good all-round frequency-resolution and dynamic-range
+ properties. For better frequency resolution (but lower
+ dynamic-range), select a Hamming window; for higher
+ dynamic-range (but poorer frequency-resolution), select a
+ Dolph window. Kaiser, Bartlett and Rectangular windows
+ are also available.
+
+ -W num Window adjustment parameter. This can be used to make
+ small adjustments to the Kaiser or Dolph window shape. A
+ positive number (up to ten) increases its dynamic range,
+ a negative number decreases it.
+
+ -s Allow slack overlapping of DFT windows. This can, in
+ some cases, increase image sharpness and give greater
+ adherence to the -x value, but at the expense of a little
+ spectral loss.
+
+ -m Creates a monochrome spectrogram (the default is colour).
+
+ -h Selects a high-colour palette - less visually pleasing
+ than the default colour palette, but it may make it eas‐
+ ier to differentiate different levels. If this option is
+ used in conjunction with -m, the result will be a hybrid
+ monochrome/colour palette.
+
+ -p num Permute the colours in a colour or hybrid palette. The
+ num parameter, from 1 (the default) to 6, selects the
+ permutation.
+
+ -l Creates a `printer friendly' spectrogram with a light
+ background (the default has a dark background).
+
+ -a Suppress the display of the axis lines. This is some‐
+ times useful in helping to discern artefacts at the spec‐
+ trogram edges.
+
+ -r Raw spectrogram: suppress the display of axes and leg‐
+ ends.
+
+ -A Selects an alternative, fixed colour-set. This is pro‐
+ vided only for compatibility with spectrograms produced
+ by another package. It should not normally be used as it
+ has some problems, not least, a lack of differentiation
+ at the bottom end which results in masking of low-level
+ artefacts.
+
+ -t text
+ Set the image title - text to display above the spectro‐
+ gram.
+
+ -c text
+ Set (or clear) the image comment - text to display below
+ and to the left of the spectrogram.
+
+ -o file
+ Name of the spectrogram output PNG file, default `spec‐
+ trogram.png'. If `-' is given, the spectrogram will be
+ sent to standard output (stdout).
+
+ Advanced Options:
+ In order to process a smaller section of audio without affecting
+ other effects or the output signal (unlike when the trim effect
+ is used), the following options may be used.
+
+ -d duration
+ This option sets the X-axis resolution such that audio
+ with the given duration (a time specification) fits the
+ selected (or default) X-axis width. For example,
+ sox input.mp3 output.wav -n spectrogram -d 1:00 stats
+ creates a spectrogram showing the first minute of the
+ audio, whilst
+ the stats effect is applied to the entire audio signal.
+
+ See also -X for an alternative way of setting the X-axis
+ resolution.
+
+ -S position(=)
+ Start the spectrogram at the given point in the audio
+ stream. For example
+ sox input.aiff output.wav spectrogram -S 1:00
+ creates a spectrogram showing all but the first minute of
+ the audio (the output file, however, receives the entire
+ audio stream).
+
+ For the ability to perform off-line processing of spectral data,
+ see the stat effect.
+
+ speed factor[c]
+ Adjust the audio speed (pitch and tempo together). factor is
+ either the ratio of the new speed to the old speed: greater than
+ 1 speeds up, less than 1 slows down, or, if appended with the
+ letter `c', the number of cents (i.e. 100ths of a semitone) by
+ which the pitch (and tempo) should be adjusted: greater than 0
+ increases, less than 0 decreases.
+
+ Technically, the speed effect only changes the sample rate
+ information, leaving the samples themselves untouched. The rate
+ effect is invoked automatically to resample to the output sample
+ rate, using its default quality/speed. For higher quality or
+ higher speed resampling, in addition to the speed effect, spec‐
+ ify the rate effect with the desired quality option.
+
+ See also the bend, pitch, and tempo effects.
+
+ splice [-h|-t|-q] { position(=)[,excess[,leeway]] }
+ Splice together audio sections. This effect provides two things
+ over simple audio concatenation: a (usually short) cross-fade is
+ applied at the join, and a wave similarity comparison is made to
+ help determine the best place at which to make the join.
+
+ One of the options -h, -t, or -q may be given to select the fade
+ envelope as half-cosine wave (the default), triangular (a.k.a.
+ linear), or quarter-cosine wave respectively.
+
+ Type Audio Fade level Transitions
+ t correlated constant gain abrupt
+ h correlated constant gain smooth
+ q uncorrelated constant power smooth
+
+ To perform a splice, first use the trim effect to select the
+ audio sections to be joined together. As when performing a tape
+ splice, the end of the section to be spliced onto should be
+ trimmed with a small excess (default 0.005 seconds) of audio
+ after the ideal joining point. The beginning of the audio sec‐
+ tion to splice on should be trimmed with the same excess (before
+ the ideal joining point), plus an additional leeway (default
+ 0.005 seconds). Any time specification may be used for these
+ parameters. SoX should then be invoked with the two audio sec‐
+ tions as input files and the splice effect given with the posi‐
+ tion at which to perform the splice - this is length of the
+ first audio section (including the excess).
+
+ The following diagram uses the tape analogy to illustrate the
+ splice operation. The effect simulates the diagonal cuts and
+ joins the two pieces:
+
+ length1 excess
+ -----------><--->
+ _________ : : _________________
+ \ : : :\ `
+ \ : : : \ `
+ \: : : \ `
+ * : : * - - *
+ \ : : :\ `
+ \ : : : \ `
+ _______________\: : : \_____`____
+ : : : :
+ <---> <----->
+ excess leeway
+
+ where * indicates the joining points.
+
+ For example, a long song begins with two verses which start (as
+ determined e.g. by using the play command with the trim (start)
+ effect) at times 0:30.125 and 1:03.432. The following commands
+ cut out the first verse:
+ sox too-long.wav part1.wav trim 0 30.130
+ (5 ms excess, after the first verse starts)
+ sox too-long.wav part2.wav trim 1:03.422
+ (5 ms excess plus 5 ms leeway, before the second verse starts)
+ sox part1.wav part2.wav just-right.wav splice 30.130
+ For another example, the SoX command
+ play "|sox -n -p synth 1 sin %1" "|sox -n -p synth 1 sin %3"
+ generates and plays two notes, but there is a nasty click at the
+ transition; the click can be removed by splicing instead of con‐
+ catenating the audio, i.e. by appending splice 1 to the command.
+ (Clicks at the beginning and end of the audio can be removed by
+ preceding the splice effect with fade q .01 2 .01).
+
+ Provided your arithmetic is good enough, multiple splices can be
+ performed with a single splice invocation. For example:
+ #!/bin/sh
+ # Audio Copy and Paste Over
+ # acpo infile copy-start copy-stop paste-over-start outfile
+ # No chained time specifications allowed for the parameters
+ # (i.e. such that contain +/-).
+ e=0.005 # Using default excess
+ l=$e # and leeway.
+ sox "$1" piece.wav trim $2-$e-$l =$3+$e
+ sox "$1" part1.wav trim 0 $4+$e
+ sox "$1" part2.wav trim $4+$3-$2-$e-$l
+ sox part1.wav piece.wav part2.wav "$5" \
+ splice $4+$e +$3-$2+$e+$l+$e
+ In the above Bourne shell script, two splices are used to `copy
+ and paste' audio.
+
+ * * *
+
+ It is also possible to use this effect to perform general cross-
+ fades, e.g. to join two songs. In this case, excess would typi‐
+ cally be an number of seconds, the -q option would typically be
+ given (to select an `equal power' cross-fade), and leeway should
+ be zero (which is the default if -q is given). For example, if
+ f1.wav and f2.wav are audio files to be cross-faded, then
+ sox f1.wav f2.wav out.wav splice -q $(soxi -D f1.wav),3
+ cross-fades the files where the point of equal loudness is 3
+ seconds before the end of f1.wav, i.e. the total length of the
+ cross-fade is 2 × 3 = 6 seconds (Note: the $(...) notation is
+ POSIX shell).
+
+ stat [-s scale] [-rms] [-freq] [-v] [-d]
+ Display time and frequency domain statistical information about
+ the audio. Audio is passed unmodified through the SoX process‐
+ ing chain.
+
+ The information is output to the `standard error' (stderr)
+ stream and is calculated, where n is the duration of the audio
+ in samples, c is the number of audio channels, r is the audio
+ sample rate, and xk represents the PCM value (in the range -1 to
+ +1 by default) of each successive sample in the audio, as fol‐
+ lows:
+
+ Samples read n×c
+ Length (seconds) n÷r
+ Scaled by See -s below.
+ Maximum amplitude max(xk) The maximum sample
+ value in the audio;
+ usually this will
+ be a positive num‐
+ ber.
+ Minimum amplitude min(xk) The minimum sample
+ value in the audio;
+ usually this will
+ be a negative num‐
+ ber.
+ Midline amplitude ½min(xk)+½max(xk)
+ Mean norm ¹/nΣ│xk│ The average of the
+ absolute value of
+ each sample in the
+ audio.
+ Mean amplitude ¹/nΣxk The average of each
+ sample in the
+ audio. If this
+ figure is non-zero,
+ then it indicates
+ the presence of a
+ D.C. offset (which
+ could be removed
+ using the dcshift
+ effect).
+
+
+
+ RMS amplitude √(¹/nΣxk²) The level of a D.C.
+ signal that would
+ have the same power
+ as the audio's
+ average power.
+ Maximum delta max(│xk-xk-1│)
+ Minimum delta min(│xk-xk-1│)
+ Mean delta ¹/n-1Σ│xk-xk-1│
+ RMS delta √(¹/n-1Σ(xk-xk-1)²)
+ Rough frequency In Hz.
+ Volume Adjustment The parameter to
+ the vol effect
+ which would make
+ the audio as loud
+ as possible without
+ clipping. Note:
+ See the discussion
+ on Clipping above
+ for reasons why it
+ is rarely a good
+ idea actually to do
+ this.
+
+ Note that the delta measurements are not applicable for multi-
+ channel audio.
+
+ The -s option can be used to scale the input data by a given
+ factor. The default value of scale is 2147483647 (i.e. the max‐
+ imum value of a 32-bit signed integer). Internal effects always
+ work with signed long PCM data and so the value should relate to
+ this fact.
+
+ The -rms option will convert all output average values to `root
+ mean square' format.
+
+ The -v option displays only the `Volume Adjustment' value.
+
+ The -freq option calculates the input's power spectrum (4096
+ point DFT) instead of the statistics listed above. This should
+ only be used with a single channel audio file.
+
+ The -d option displays a hex dump of the 32-bit signed PCM data
+ audio in SoX's internal buffer. This is mainly used to help
+ track down endian problems that sometimes occur in cross-plat‐
+ form versions of SoX.
+
+ See also the stats effect.
+
+ stats [-b bits|-x bits|-s scale] [-w window-time]
+ Display time domain statistical information about the audio
+ channels; audio is passed unmodified through the SoX processing
+ chain. Statistics are calculated and displayed for each audio
+ channel and, where applicable, an overall figure is also given.
+
+ For example, for a typical well-mastered stereo music file:
+
+ Overall Left Right
+ DC offset 0.000803 -0.000391 0.000803
+ Min level -0.750977 -0.750977 -0.653412
+ Max level 0.708801 0.708801 0.653534
+ Pk lev dB -2.49 -2.49 -3.69
+ RMS lev dB -19.41 -19.13 -19.71
+ RMS Pk dB -13.82 -13.82 -14.38
+ RMS Tr dB -85.25 -85.25 -82.66
+ Crest factor - 6.79 6.32
+ Flat factor 0.00 0.00 0.00
+ Pk count 2 2 2
+ Bit-depth 16/16 16/16 16/16
+ Num samples 7.72M
+ Length s 174.973
+ Scale max 1.000000
+ Window s 0.050
+
+ DC offset, Min level, and Max level are shown, by default, in
+ the range ±1. If the -b (bits) options is given, then these
+ three measurements will be scaled to a signed integer with the
+ given number of bits; for example, for 16 bits, the scale would
+ be -32768 to +32767. The -x option behaves the same way as -b
+ except that the signed integer values are displayed in hexadeci‐
+ mal. The -s option scales the three measurements by a given
+ floating-point number.
+
+ Pk lev dB and RMS lev dB are standard peak and RMS level mea‐
+ sured in dBFS. RMS Pk dB and RMS Tr dB are peak and trough val‐
+ ues for RMS level measured over a short window (default 50ms).
+
+ Crest factor is the standard ratio of peak to RMS level (note:
+ not in dB).
+
+ Flat factor is a measure of the flatness (i.e. consecutive sam‐
+ ples with the same value) of the signal at its peak levels (i.e.
+ either Min level, or Max level). Pk count is the number of
+ occasions (not the number of samples) that the signal attained
+ either Min level, or Max level.
+
+ The right-hand Bit-depth figure is the standard definition of
+ bit-depth i.e. bits less significant than the given number are
+ fixed at zero. The left-hand figure is the number of most sig‐
+ nificant bits that are fixed at zero (or one for negative num‐
+ bers) subtracted from the right-hand figure (the number sub‐
+ tracted is directly related to Pk lev dB).
+
+ For multi-channel audio, an overall figure for each of the above
+ measurements is given and derived from the channel figures as
+ follows: DC offset: maximum magnitude; Max level, Pk lev dB,
+ RMS Pk dB, Bit-depth: maximum; Min level, RMS Tr dB: minimum;
+ RMS lev dB, Flat factor, Pk count: average; Crest factor: not
+ applicable.
+
+ Length s is the duration in seconds of the audio, and Num sam‐
+ ples is equal to the sample-rate multiplied by Length.
+ Scale Max is the scaling applied to the first three measure‐
+ ments; specifically, it is the maximum value that could apply to
+ Max level. Window s is the length of the window used for the
+ peak and trough RMS measurements.
+
+ See also the stat effect.
+
+ swap Swap stereo channels. If the input is not stereo, pairs of
+ channels are swapped, and a possible odd last channel passed
+ through. E.g., for seven channels, the output order will be 2,
+ 1, 4, 3, 6, 5, 7.
+
+ See also remix for an effect that allows arbitrary channel
+ selection and ordering (and mixing).
+
+ stretch factor [window fade shift fading]
+ Change the audio duration (but not its pitch). This effect is
+ broadly equivalent to the tempo effect with (factor inverted
+ and) search set to zero, so in general, its results are compara‐
+ tively poor; it is retained as it can sometimes out-perform
+ tempo for small factors.
+
+ factor of stretching: >1 lengthen, <1 shorten duration. window
+ size is in ms. Default is 20ms. The fade option, can be `lin'.
+ shift ratio, in [0 1]. Default depends on stretch factor. 1 to
+ shorten, 0.8 to lengthen. The fading ratio, in [0 0.5]. The
+ amount of a fade's default depends on factor and shift.
+
+ See also the tempo effect.
+
+ synth [-j KEY] [-n] [len [off [ph [p1 [p2 [p3]]]]]] {[type] [combine]
+ [[%]freq[k][:|+|/|-[%]freq2[k]]] [off [ph [p1 [p2 [p3]]]]]}
+ This effect can be used to generate fixed or swept frequency
+ audio tones with various wave shapes, or to generate wide-band
+ noise of various `colours'. Multiple synth effects can be cas‐
+ caded to produce more complex waveforms; at each stage it is
+ possible to choose whether the generated waveform will be mixed
+ with, or modulated onto the output from the previous stage.
+ Audio for each channel in a multi-channel audio file can be syn‐
+ thesised independently.
+
+ Though this effect is used to generate audio, an input file must
+ still be given, the characteristics of which will be used to set
+ the synthesised audio length, the number of channels, and the
+ sampling rate; however, since the input file's audio is not nor‐
+ mally needed, a `null file' (with the special name -n) is often
+ given instead (and the length specified as a parameter to synth
+ or by another given effect that has an associated length).
+
+ For example, the following produces a 3 second, 48kHz, audio
+ file containing a sine-wave swept from 300 to 3300 Hz:
+ sox -n output.wav synth 3 sine 300-3300
+ and this produces an 8 kHz version:
+ sox -r 8000 -n output.wav synth 3 sine 300-3300
+ Multiple channels can be synthesised by specifying the set of
+ parameters shown between braces multiple times; the following
+ puts the swept tone in the left channel and adds `brown' noise
+ in the right:
+ sox -n output.wav synth 3 sine 300-3300 brownnoise
+ The following example shows how two synth effects can be cas‐
+ caded to create a more complex waveform:
+ play -n synth 0.5 sine 200-500 synth 0.5 sine fmod 700-100
+ Frequencies can also be given in `scientific' note notation, or,
+ by prefixing a `%' character, as a number of semitones relative
+ to `middle A' (440 Hz). For example, the following could be
+ used to help tune a guitar's low `E' string:
+ play -n synth 4 pluck %-29
+ or with a (Bourne shell) loop, the whole guitar:
+ for n in E2 A2 D3 G3 B3 E4; do
+ play -n synth 4 pluck $n repeat 2; done
+ See the delay effect (above) and the reference to `SoX scripting
+ examples' (below) for more synth examples.
+
+ N.B. This effect generates audio at maximum volume (0dBFS),
+ which means that there is a high chance of clipping when using
+ the audio subsequently, so in many cases, you will want to fol‐
+ low this effect with the gain effect to prevent this from hap‐
+ pening. (See also Clipping above.) Note that, by default, the
+ synth effect incorporates the functionality of gain -h (see the
+ gain effect for details); synth's -n option may be given to dis‐
+ able this behaviour.
+
+ A detailed description of each synth parameter follows:
+
+ len is the length of audio to synthesise (any time specifica‐
+ tion); a value of 0 indicated to use the input length, which is
+ also the default.
+
+ type is one of sine, square, triangle, sawtooth, trapezium, exp,
+ [white]noise, tpdfnoise, pinknoise, brownnoise, pluck;
+ default=sine.
+
+ combine is one of create, mix, amod (amplitude modulation), fmod
+ (frequency modulation); default=create.
+
+ freq/freq2 are the frequencies at the beginning/end of synthesis
+ in Hz or, if preceded with `%', semitones relative to A
+ (440 Hz); alternatively, `scientific' note notation (e.g. E2)
+ may be used. The default frequency is 440Hz. By default, the
+ tuning used with the note notations is `equal temperament'; the
+ -j KEY option selects `just intonation', where KEY is an integer
+ number of semitones relative to A (so for example, -9 or 3
+ selects the key of C), or a note in scientific notation.
+
+ If freq2 is given, then len must also have been given and the
+ generated tone will be swept between the given frequencies. The
+ two given frequencies must be separated by one of the characters
+ `:', `+', `/', or `-'. This character is used to specify the
+ sweep function as follows:
+
+ : Linear: the tone will change by a fixed number of hertz
+ per second.
+
+ + Square: a second-order function is used to change the
+ tone.
+
+ / Exponential: the tone will change by a fixed number of
+ semitones per second.
+
+ - Exponential: as `/', but initial phase always zero, and
+ stepped (less smooth) frequency changes.
+
+ Not used for noise.
+
+ off is the bias (DC-offset) of the signal in percent; default=0.
+
+ ph is the phase shift in percentage of 1 cycle; default=0. Not
+ used for noise.
+
+ p1 is the percentage of each cycle that is `on' (square), or
+ `rising' (triangle, exp, trapezium); default=50 (square, trian‐
+ gle, exp), default=10 (trapezium), or sustain (pluck);
+ default=40.
+
+ p2 (trapezium): the percentage through each cycle at which
+ `falling' begins; default=50. exp: the amplitude in multiples of
+ 2dB; default=50, or tone-1 (pluck); default=20.
+
+ p3 (trapezium): the percentage through each cycle at which
+ `falling' ends; default=60, or tone-2 (pluck); default=90.
+
+ tempo [-q] [-m|-s|-l] factor [segment [search [overlap]]]
+ Change the audio playback speed but not its pitch. This effect
+ uses the WSOLA algorithm. The audio is chopped up into segments
+ which are then shifted in the time domain and overlapped (cross-
+ faded) at points where their waveforms are most similar as
+ determined by measurement of `least squares'.
+
+ By default, linear searches are used to find the best overlap‐
+ ping points. If the optional -q parameter is given, tree
+ searches are used instead. This makes the effect work more
+ quickly, but the result may not sound as good. However, if you
+ must improve the processing speed, this generally reduces the
+ sound quality less than reducing the search or overlap values.
+
+ The -m option is used to optimize default values of segment,
+ search and overlap for music processing.
+
+ The -s option is used to optimize default values of segment,
+ search and overlap for speech processing.
+
+ The -l option is used to optimize default values of segment,
+ search and overlap for `linear' processing that tends to cause
+ more noticeable distortion but may be useful when factor is
+ close to 1.
+
+ If -m, -s, or -l is specified, the default value of segment will
+ be calculated based on factor, while default search and overlap
+ values are based on segment. Any values you provide still over‐
+ ride these default values.
+
+ factor gives the ratio of new tempo to the old tempo, so e.g.
+ 1.1 speeds up the tempo by 10%, and 0.9 slows it down by 10%.
+
+ The optional segment parameter selects the algorithm's segment
+ size in milliseconds. If no other flags are specified, the
+ default value is 82 and is typically suited to making small
+ changes to the tempo of music. For larger changes (e.g. a factor
+ of 2), 41 ms may give a better result. The -m, -s, and -l flags
+ will cause the segment default to be automatically adjusted
+ based on factor. For example using -s (for speech) with a tempo
+ of 1.25 will calculate a default segment value of 32.
+
+ The optional search parameter gives the audio length in mil‐
+ liseconds over which the algorithm will search for overlapping
+ points. If no other flags are specified, the default value is
+ 14.68. Larger values use more processing time and may or may
+ not produce better results. A practical maximum is half the
+ value of segment. Search can be reduced to cut processing time
+ at the risk of degrading output quality. The -m, -s, and -l
+ flags will cause the search default to be automatically adjusted
+ based on segment.
+
+ The optional overlap parameter gives the segment overlap length
+ in milliseconds. Default value is 12, but -m, -s, or -l flags
+ automatically adjust overlap based on segment size. Increasing
+ overlap increases processing time and may increase quality. A
+ practical maximum for overlap is the value of search, with over‐
+ lap typically being (at least) a little smaller then search.
+
+ See also speed for an effect that changes tempo and pitch
+ together, pitch and bend for effects that change pitch only, and
+ stretch for an effect that changes tempo using a different algo‐
+ rithm.
+
+ treble gain [frequency[k] [width[s|h|k|o|q]]]
+ Apply a treble tone-control effect. See the description of the
+ bass effect for details.
+
+ tremolo speed [depth]
+ Apply a tremolo (low frequency amplitude modulation) effect to
+ the audio. The tremolo frequency in Hz is given by speed, and
+ the depth as a percentage by depth (default 40).
+
+ trim {position(+)}
+ Cuts portions out of the audio. Any number of positions may be
+ given; audio is not sent to the output until the first position
+ is reached. The effect then alternates between copying and dis‐
+ carding audio at each position. Using a value of 0 for the
+ first position parameter allows copying from the beginning of
+ the audio.
+
+ For example,
+ sox infile outfile trim 0 10
+ will copy the first ten seconds, while
+ play infile trim 12:34 =15:00 -2:00
+ and
+ play infile trim 12:34 2:26 -2:00
+ will both play from 12 minutes 34 seconds into the audio up to
+ 15 minutes into the audio (i.e. 2 minutes and 26 seconds long),
+ then resume playing two minutes before the end of audio.
+
+ upsample [factor]
+ Upsample the signal by an integer factor: factor-1 zero-value
+ samples are inserted between each pair of input samples. As a
+ result, the original spectrum is replicated into the new fre‐
+ quency space (imaging) and attenuated. This attenuation can be
+ compensated for by adding vol factor after any further process‐
+ ing. The upsample effect is typically used in combination with
+ filtering effects.
+
+ For a general resampling effect with anti-imaging, see rate.
+ See also downsample.
+
+ vad [options]
+ Voice Activity Detector. Attempts to trim silence and quiet
+ background sounds from the ends of (fairly high resolution i.e.
+ 16-bit, 44-48kHz) recordings of speech. The algorithm currently
+ uses a simple cepstral power measurement to detect voice, so may
+ be fooled by other things, especially music. The effect can
+ trim only from the front of the audio, so in order to trim from
+ the back, the reverse effect must also be used. E.g.
+ play speech.wav norm vad
+ to trim from the front,
+ play speech.wav norm reverse vad reverse
+ to trim from the back, and
+ play speech.wav norm vad reverse vad reverse
+ to trim from both ends. The use of the norm effect is recom‐
+ mended, but remember that neither reverse nor norm is suitable
+ for use with streamed audio.
+
+ Options:
+ Default values are shown in parenthesis.
+
+ -t num (7)
+ The measurement level used to trigger activity detection.
+ This might need to be changed depending on the noise
+ level, signal level and other charactistics of the input
+ audio.
+
+ -T num (0.25)
+ The time constant (in seconds) used to help ignore short
+ bursts of sound.
+
+ -s num (1)
+ The amount of audio (in seconds) to search for qui‐
+ eter/shorter bursts of audio to include prior to the
+ detected trigger point.
+
+ -g num (0.25)
+ Allowed gap (in seconds) between quieter/shorter bursts
+ of audio to include prior to the detected trigger point.
+
+ -p num (0)
+ The amount of audio (in seconds) to preserve before the
+ trigger point and any found quieter/shorter bursts.
+
+ Advanced Options:
+ These allow fine tuning of the algorithm's internal parameters.
+
+ -b num The algorithm (internally) uses adaptive noise estima‐
+ tion/reduction in order to detect the start of the wanted
+ audio. This option sets the time for the initial noise
+ estimate.
+
+ -N num Time constant used by the adaptive noise estimator for
+ when the noise level is increasing.
+
+ -n num Time constant used by the adaptive noise estimator for
+ when the noise level is decreasing.
+
+ -r num Amount of noise reduction to use in the detection algo‐
+ rithm (e.g. 0, 0.5, ...).
+
+ -f num Frequency of the algorithm's processing/measurements.
+
+ -m num Measurement duration; by default, twice the measurement
+ period; i.e. with overlap.
+
+ -M num Time constant used to smooth spectral measurements.
+
+ -h num `Brick-wall' frequency of high-pass filter applied at the
+ input to the detector algorithm.
+
+ -l num `Brick-wall' frequency of low-pass filter applied at the
+ input to the detector algorithm.
+
+ -H num `Brick-wall' frequency of high-pass lifter used in the
+ detector algorithm.
+
+ -L num `Brick-wall' frequency of low-pass lifter used in the
+ detector algorithm.
+
+ See also the silence effect.
+
+ vol gain [type [limitergain]]
+ Apply an amplification or an attenuation to the audio signal.
+ Unlike the -v option (which is used for balancing multiple input
+ files as they enter the SoX effects processing chain), vol is an
+ effect like any other so can be applied anywhere, and several
+ times if necessary, during the processing chain.
+
+ The amount to change the volume is given by gain which is inter‐
+ preted, according to the given type, as follows: if type is
+ amplitude (or is omitted), then gain is an amplitude (i.e. volt‐
+ age or linear) ratio, if power, then a power (i.e. wattage or
+ voltage-squared) ratio, and if dB, then a power change in dB.
+
+ When type is amplitude or power, a gain of 1 leaves the volume
+ unchanged, less than 1 decreases it, and greater than 1
+ increases it; a negative gain inverts the audio signal in addi‐
+ tion to adjusting its volume.
+
+ When type is dB, a gain of 0 leaves the volume unchanged, less
+ than 0 decreases it, and greater than 0 increases it.
+
+ See [4] for a detailed discussion on electrical (and hence audio
+ signal) voltage and power ratios.
+
+ Beware of Clipping when the increasing the volume.
+
+ The gain and the type parameters can be concatenated if desired,
+ e.g. vol 10dB.
+
+ An optional limitergain value can be specified and should be a
+ value much less than 1 (e.g. 0.05 or 0.02) and is used only on
+ peaks to prevent clipping. Not specifying this parameter will
+ cause no limiter to be used. In verbose mode, this effect will
+ display the percentage of the audio that needed to be limited.
+
+ See also gain for a volume-changing effect with different capa‐
+ bilities, and compand for a dynamic-range compression/expan‐
+ sion/limiting effect.
+
+DIAGNOSTICS
+ Exit status is 0 for no error, 1 if there is a problem with the com‐
+ mand-line parameters, or 2 if an error occurs during file processing.
+
+BUGS
+ Please report any bugs found in this version of SoX to the mailing list
+ (sox-users@lists.sourceforge.net).
+
+SEE ALSO
+ soxi(1), soxformat(7), libsox(3)
+ audacity(1), gnuplot(1), octave(1), wget(1)
+ The SoX web site at http://sox.sourceforge.net
+ SoX scripting examples at http://sox.sourceforge.net/Docs/Scripts
+
+ References
+ [1] R. Bristow-Johnson, Cookbook formulae for audio EQ biquad filter
+ coefficients, http://musicdsp.org/files/Audio-EQ-Cookbook.txt
+
+ [2] Wikipedia, Q-factor, http://en.wikipedia.org/wiki/Q_factor
+
+ [3] Scott Lehman, Effects Explained, http://harmony-cen‐
+ tral.com/Effects/effects-explained.html
+
+ [4] Wikipedia, Decibel, http://en.wikipedia.org/wiki/Decibel
+
+ [5] Richard Furse, Linux Audio Developer's Simple Plugin API,
+ http://www.ladspa.org
+
+ [6] Richard Furse, Computer Music Toolkit, http://www.ladspa.org/cmt
+
+ [7] Steve Harris, LADSPA plugins, http://plugin.org.uk
+
+LICENSE
+ Copyright 1998-2013 Chris Bagwell and SoX Contributors.
+ Copyright 1991 Lance Norskog and Sundry Contributors.
+
+ 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, 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 MER‐
+ CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ Public License for more details.
+
+AUTHORS
+ Chris Bagwell (cbagwell@users.sourceforge.net). Other authors and con‐
+ tributors are listed in the ChangeLog file that is distributed with the
+ source code.
+
+
+
+sox December 31, 2014 SoX(1)
diff --git a/src/soxformat.7 b/src/soxformat.7
new file mode 100644
index 0000000..5e53b9f
--- /dev/null
+++ b/src/soxformat.7
@@ -0,0 +1,817 @@
+'\" t
+'\" The line above instructs most `man' programs to invoke tbl
+'\"
+'\" Separate paragraphs; not the same as PP which resets indent level.
+.de SP
+.if t .sp .5
+.if n .sp
+..
+'\"
+'\" Replacement em-dash for nroff (default is too short).
+.ie n .ds m " -
+.el .ds m \(em
+'\"
+'\" Placeholder macro for if longer nroff arrow is needed.
+.ds RA \(->
+'\"
+'\" Decimal point set slightly raised
+.if t .ds d \v'-.15m'.\v'+.15m'
+.if n .ds d .
+'\"
+'\" Enclosure macro for examples
+.de EX
+.SP
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.SP
+.fi
+..
+.TH SoX 7 "December 31, 2014" "soxformat" "Sound eXchange"
+.SH NAME
+SoX \- Sound eXchange, the Swiss Army knife of audio manipulation
+.SH DESCRIPTION
+This manual describes SoX supported file formats and audio device types;
+the SoX manual set starts with
+.BR sox (1).
+.SP
+Format types that can SoX can determine by a filename
+extension are listed with their names preceded by a dot.
+Format types that are optionally built into SoX
+are marked `(optional)'.
+.SP
+Format types that can be handled by an
+external library via an optional pseudo file type (currently
+.BR sndfile )
+are marked e.g. `(also with \fB\-t sndfile\fR)'. This might be
+useful if you have a file that doesn't work with SoX's default format
+readers and writers, and there's an external reader or writer for that
+format.
+.SP
+To see if SoX has support for an optional format or device, enter
+.B sox \-h
+and look for its name under the list:
+`AUDIO FILE FORMATS' or `AUDIO DEVICE DRIVERS'.
+.SS SOX FORMATS & DEVICE DRIVERS
+\&\fB.raw\fR (also with \fB\-t sndfile\fR),
+\&\fB.f32\fR, \fB.f64\fR,
+\&\fB.s8\fR, \fB.s16\fR, \fB.s24\fR, \fB.s32\fR,
+.br
+\&\fB.u8\fR, \fB.u16\fR, \fB.u24\fR, \fB.u32\fR,
+\&\fB.ul\fR, \fB.al\fR, \fB.lu\fR, \fB.la\fR
+.if t .sp -.5
+.if n .sp -1
+.TP
+\
+Raw (headerless) audio files. For
+.BR raw ,
+the sample rate and the data encoding must be given using command-line
+format options; for the other listed types, the sample rate defaults to
+8kHz (but may be overridden), and the data encoding is defined by the
+given suffix. Thus \fBf32\fR and \fBf64\fR indicate files encoded as 32
+and 64-bit (IEEE single and double precision) floating point PCM
+respectively; \fBs8\fR, \fBs16\fR, \fBs24\fR, and \fBs32\fR indicate 8,
+16, 24, and 32-bit signed integer PCM respectively; \fBu8\fR, \fBu16\fR,
+\fBu24\fR, and \fBu32\fR indicate 8, 16, 24, and 32-bit unsigned integer
+PCM respectively; \fBul\fR indicates `\(*m-law' (8-bit), \fBal\fR
+indicates `A-law' (8-bit), and \fBlu\fR and \fBla\fR are inverse bit
+order `\(*m-law' and inverse bit order `A-law' respectively. For all raw
+formats, the number of channels defaults to 1 (but may be overridden).
+.SP
+Headerless audio files on a SPARC computer are likely to be of format
+\fBul\fR; on a Mac, they're likely to be \fBu8\fR but with a
+sample rate of 11025 or 22050\ Hz.
+.SP
+See
+.B .ima
+and
+.B .vox
+for raw ADPCM formats, and
+.B .cdda
+for raw CD digital audio.
+.PP
+\&\fB.f4\fR, \fB.f8\fR,
+\&\fB.s1\fR, \fB.s2\fR, \fB.s3\fR, \fB.s4\fR,
+.br
+\&\fB.u1\fR, \fB.u2\fR, \fB.u3\fR, \fB.u4\fR,
+\&\fB.sb\fR, \fB.sw\fR, \fB.sl\fR, \fB.ub\fR, \fB.uw\fR
+.if t .sp -.5
+.if n .sp -1
+.TP
+\
+Deprecated aliases for
+\fBf32\fR, \fBf64\fR, \fBs8\fR, \fBs16\fR, \fBs24\fR, \fBs32\fR,
+.br
+\fBu8\fR, \fBu16\fR, \fBu24\fR, \fBu32\fR,
+\fBs8\fR, \fBs16\fR, \fBs32\fR, \fBu8\fR, and \fBu16\fR
+respectively.
+.TP
+\&\fB.8svx\fR (also with \fB\-t sndfile\fR)
+Amiga 8SVX musical instrument description format.
+.TP
+\&\fB.aiff\fR, \fB.aif\fR (also with \fB\-t sndfile\fR)
+AIFF files as used on old Apple Macs, Apple IIc/IIgs and SGI.
+SoX's AIFF support does not include multiple audio chunks,
+or the 8SVX musical instrument description format.
+AIFF files are multimedia archives and
+can have multiple audio and picture chunks\*m
+you may need a separate archiver to work with them.
+With Mac OS X, AIFF has been superseded by CAF.
+.TP
+\&\fB.aiffc\fR, \fB.aifc\fR (also with \fB\-t sndfile\fR)
+AIFF-C is a format based on AIFF that was created to allow
+handling compressed audio. It can also handle little
+endian uncompressed linear data that is often referred to
+as
+.B sowt
+encoding. This encoding has also become the defacto format produced by modern
+Macs as well as iTunes on any platform. AIFF-C files produced
+by other applications typically have the file extension .aif and
+require looking at its header to detect the true format.
+The
+.B sowt
+encoding is the only encoding that SoX can handle with this format.
+.SP
+AIFF-C is defined in DAVIC 1.4 Part 9 Annex B.
+This format is referred from ARIB STD-B24, which is specified for
+Japanese data broadcasting. Any private chunks are not supported.
+.TP
+\fBalsa\fR (optional)
+Advanced Linux Sound Architecture device driver; supports both playing and
+recording audio. ALSA is only used in Linux-based operating systems, though
+these often support OSS (see below) as well. Examples:
+.EX
+ sox infile \-t alsa
+ sox infile \-t alsa default
+ sox infile \-t alsa plughw:0,0
+ sox \-b 16 \-t alsa hw:1 outfile
+.EE
+See also
+.BR play (1),
+.BR rec (1),
+and
+.BR sox (1)
+.BR \-d .
+.TP
+.B .amb
+Ambisonic B-Format: a specialisation of
+.B .wav
+with between 3 and 16 channels of audio for use with an Ambisonic decoder.
+See http://www.ambisonia.com/Members/mleese/file-format-for-b-format for
+details. It is up to the user to get the channels together in the right
+order and at the correct amplitude.
+.TP
+\&\fB.amr\-nb\fR (optional)
+Adaptive Multi Rate\*mNarrow Band speech codec; a lossy format used in 3rd
+generation mobile telephony and defined in 3GPP TS 26.071 et al.
+.SP
+AMR-NB audio has a fixed sampling rate of 8 kHz and supports encoding
+to the following bit-rates (as selected by the
+.B \-C
+option): 0 = 4\*d75 kbit/s, 1 = 5\*d15 kbit/s, 2 = 5\*d9 kbit/s, 3 =
+6\*d7 kbit/s, 4 = 7\*d4 kbit/s 5 = 7\*d95 kbit/s, 6 = 10\*d2
+kbit/s, 7 = 12\*d2 kbit/s.
+.TP
+\&\fB.amr\-wb\fR (optional)
+Adaptive Multi Rate\*mWide Band speech codec; a lossy format used in 3rd
+generation mobile telephony and defined in 3GPP TS 26.171 et al.
+.SP
+AMR-WB audio has a fixed sampling rate of 16 kHz and supports encoding
+to the following bit-rates (as selected by the
+.B \-C
+option): 0 = 6\*d6 kbit/s, 1 = 8\*d85 kbit/s, 2 = 12\*d65 kbit/s, 3 =
+14\*d25 kbit/s, 4 = 15\*d85 kbit/s 5 = 18\*d25 kbit/s, 6 = 19\*d85
+kbit/s, 7 = 23\*d05 kbit/s, 8 = 23\*d85 kbit/s.
+.TP
+\fBao\fR (optional)
+Xiph.org's Audio Output device driver; works only for playing audio. It
+supports a wide range of devices and sound systems\*msee its documentation
+for the full range. For the most part, SoX's use of libao cannot be
+configured directly; instead, libao configuration files must be used.
+.SP
+The filename specified is used to determine which libao plugin to
+use. Normally, you should specify `default' as the filename. If that
+doesn't give the desired behavior then you can specify the short name
+for a given plugin (such as \fBpulse\fR for pulse audio plugin).
+Examples:
+.EX
+ sox infile \-t ao
+ sox infile \-t ao default
+ sox infile \-t ao pulse
+.EE
+See also
+.BR play (1)
+and
+.BR sox (1)
+.BR \-d .
+.TP
+\&\fB.au\fR, \fB.snd\fR (also with \fB\-t sndfile\fR)
+Sun Microsystems AU files.
+There are many types of AU file;
+DEC has invented its own with a different magic number
+and byte order. To write a DEC file, use the
+.B \-L
+option with the output file options.
+.SP
+Some .au files are known to have invalid AU headers; these
+are probably original Sun \(*m-law 8000\ Hz files and
+can be dealt with using the
+.B .ul
+format (see below).
+.SP
+It is possible to override AU file header information
+with the
+.B \-r
+and
+.B \-c
+options, in which case SoX will issue a warning to that effect.
+.TP
+.B .avr
+Audio Visual Research format;
+used by a number of commercial packages
+on the Mac.
+.TP
+\&\fB.caf\fR (optional)
+Apple's Core Audio File format.
+.TP
+\&\fB.cdda\fR, \fB.cdr\fR
+`Red Book' Compact Disc Digital Audio (raw audio). CDDA has two audio
+channels formatted as 16-bit signed integers (big endian)at a sample
+rate of 44\*d1\ kHz. The number of (stereo) samples in each CDDA
+track is always a multiple of 588.
+.TP
+\fBcoreaudio\fR (optional)
+Mac OSX CoreAudio device driver: supports both playing and recording
+audio. If a filename is not specific or if the name is "default" then
+the default audio device is selected. Any other name will be used
+to select a specific device. The valid names can be seen in the
+System Preferences->Sound menu and then under the Output and Input tabs.
+
+Examples:
+.EX
+ sox infile \-t coreaudio
+ sox infile \-t coreaudio default
+ sox infile \-t coreaudio "Internal Speakers"
+.EE
+See also
+.BR play (1),
+.BR rec (1),
+and
+.BR sox (1)
+.BR \-d .
+.TP
+\&\fB.cvsd\fR, \fB.cvs\fR
+Continuously Variable Slope Delta modulation.
+A headerless format used to compress speech audio for applications such as voice mail.
+This format is sometimes used with bit-reversed samples\*mthe
+.B \-X
+format option can be used to set the bit-order.
+.TP
+\&\fB.cvu\fR
+Continuously Variable Slope Delta modulation (unfiltered).
+This is an alternative handler for CVSD that is unfiltered but can
+be used with any bit-rate. E.g.
+.EX
+ sox infile outfile.cvu rate 28k
+ play \-r 28k outfile.cvu sinc \-3.4k
+.EE
+.TP
+.B .dat
+Text Data files.
+These files contain a textual representation of the
+sample data. There is one line at the beginning
+that contains the sample rate, and one line that
+contains the number of channels.
+Subsequent lines contain two or more numeric data intems:
+the time since the beginning of the first sample and the sample value
+for each channel.
+.SP
+Values are normalized so that the maximum and minimum
+are 1 and \-1. This file format can be used to
+create data files for external programs such as
+FFT analysers or graph routines. SoX can also convert
+a file in this format back into one of the other file
+formats.
+.SP
+Example containing only 2 stereo samples of silence:
+.SP
+.EX
+ ; Sample Rate 8012
+ ; Channels 2
+ 0 0 0
+ 0.00012481278 0 0
+.EE
+.TP
+\&\fB.dvms\fR, \fB.vms\fR
+Used in Germany to compress speech audio for voice mail.
+A self-describing variant of
+.BR cvsd .
+.TP
+\&\fB.fap\fR (optional)
+See
+.BR .paf .
+.TP
+\&\fB.flac\fR (optional; also with \fB\-t sndfile\fR)
+Xiph.org's Free Lossless Audio CODEC compressed audio.
+FLAC is an open, patent-free CODEC designed for compressing
+music. It is similar to MP3 and Ogg Vorbis, but lossless,
+meaning that audio is compressed in FLAC without any loss in
+quality.
+.SP
+SoX can read native FLAC files (.flac) but not Ogg FLAC files (.ogg).
+[But see
+.B .ogg
+below for information relating to support for Ogg
+Vorbis files.]
+.SP
+SoX can write native FLAC files according to a given or default
+compression level. 8 is the default compression level and gives the
+best (but slowest) compression; 0 gives the least (but fastest)
+compression. The compression level is selected using the
+.B \-C
+option [see
+.BR sox (1)]
+with a whole number from 0 to 8.
+.TP
+.B .fssd
+An alias for the
+.B .u8
+format.
+.TP
+.B .gsrt
+Grandstream ring-tone files.
+Whilst this file format can contain A-Law, \(*m-law, GSM, G.722,
+G.723, G.726, G.728, or iLBC encoded audio, SoX supports reading and
+writing only A-Law and \(*m-law. E.g.
+.EX
+ sox music.wav \-t gsrt ring.bin
+ play ring.bin
+.EE
+.TP
+\&\fB.gsm\fR (optional; also with \fB\-t sndfile\fR)
+GSM 06.10 Lossy Speech Compression.
+A lossy format for compressing speech which is used in the
+Global Standard for Mobile telecommunications (GSM). It's good
+for its purpose, shrinking audio data size, but it will introduce
+lots of noise when a given audio signal is encoded and decoded
+multiple times. This format is used by some voice mail applications.
+It is rather CPU intensive.
+.TP
+.B .hcom
+Macintosh HCOM files.
+These are Mac FSSD files with Huffman compression.
+.TP
+.B .htk
+Single channel 16-bit PCM format used by HTK,
+a toolkit for building Hidden Markov Model speech processing tools.
+.TP
+\&\fB.ircam\fR (also with \fB\-t sndfile\fR)
+Another name for
+.BR .sf .
+.TP
+\&\fB.ima\fR (also with \fB\-t sndfile\fR)
+A headerless file of IMA ADPCM audio data. IMA ADPCM claims 16-bit precision
+packed into only 4 bits, but in fact sounds no better than
+.BR .vox .
+.TP
+\&\fB.lpc\fR, \fB.lpc10\fR
+LPC-10 is a compression scheme for speech developed in the United
+States. See http://www.arl.wustl.edu/~jaf/lpc/ for details. There is
+no associated file format, so SoX's implementation is headerless.
+.TP
+\&\fB.mat\fR, \fB.mat4\fR, \fB.mat5\fR (optional)
+Matlab 4.2/5.0 (respectively GNU Octave 2.0/2.1) format (.mat is the same as .mat4).
+.TP
+.B .m3u
+A
+.I playlist
+format; contains a list of audio files.
+SoX can read, but not write this file format.
+See [1] for details of this format.
+.TP
+.B .maud
+An IFF-conforming audio file type, registered by
+MS MacroSystem Computer GmbH, published along
+with the `Toccata' sound-card on the Amiga.
+Allows 8bit linear, 16bit linear, A-Law, \(*m-law
+in mono and stereo.
+.TP
+\&\fB.mp3\fR, \fB.mp2\fR (optional read, optional write)
+MP3 compressed audio; MP3 (MPEG Layer 3) is a part of the patent-encumbered
+MPEG standards for audio and video compression. It is a lossy
+compression format that achieves good compression rates with little
+quality loss.
+.SP
+Because MP3 is patented, SoX cannot be distributed with MP3 support without
+incurring the patent holder's fees. Users who require SoX with MP3 support
+must currently compile and build SoX with the MP3 libraries (LAME & MAD)
+from source code, or, in some cases, obtain pre-built dynamically loadable
+libraries.
+.SP
+When reading MP3 files, up to 28 bits of precision is stored although
+only 16 bits is reported to user. This is to allow default behavior
+of writing 16 bit output files. A user can specify a higher precision
+for the output file to prevent lossing this extra information. MP3
+output files will use up to 24 bits of precision while encoding.
+.SP
+MP3 compression parameters can be selected using SoX's \fB\-C\fR option
+as follows
+(note that the current syntax is subject to change):
+.SP
+The primary parameter to the LAME encoder is the bit rate. If the
+value of the \fB\-C\fR value is a positive integer, it's taken as
+the bitrate in kbps (e.g. if you specify 128, it uses 128 kbps).
+.SP
+The second most important parameter is probably "quality" (really
+performance), which allows balancing encoding speed vs. quality.
+In LAME, 0 specifies highest quality but is very slow, while
+9 selects poor quality, but is fast. (5 is the default and 2 is
+recommended as a good trade-off for high quality encodes.)
+.SP
+Because the \fB\-C\fR value is a float, the fractional part is used
+to select quality. 128.2 selects 128 kbps encoding with a quality
+of 2. There is one problem with this approach. We need 128 to specify
+128 kbps encoding with default quality, so 0 means use default. Instead
+of 0 you have to use .01 (or .99) to specify the highest quality
+(128.01 or 128.99).
+.SP
+LAME uses bitrate to specify a constant bitrate, but higher quality
+can be achieved using Variable Bit Rate (VBR). VBR quality (really
+size) is selected using a number from 0 to 9. Use a value of 0 for high
+quality, larger files, and 9 for smaller files of lower quality. 4 is
+the default.
+.SP
+In order to squeeze the selection of VBR into the the \fB\-C\fR value
+float we use negative numbers to select VRR. -4.2 would select default
+VBR encoding (size) with high quality (speed). One special case is 0,
+which is a valid VBR encoding parameter but not a valid bitrate.
+Compression value of 0 is always treated as a high quality vbr, as a
+result both -0.2 and 0.2 are treated as highest quality VBR (size) and
+high quality (speed).
+.SP
+See also
+.B Ogg Vorbis
+for a similar format.
+.TP
+\&\fB.nist\fR (also with \fB\-t sndfile\fR)
+See \fB.sph\fR.
+.TP
+\&\fB.ogg\fR, \fB.vorbis\fR (optional)
+Xiph.org's Ogg Vorbis compressed audio; an open, patent-free CODEC designed
+for music and streaming audio. It is a lossy compression format (similar to
+MP3, VQF & AAC) that achieves good compression rates with a minimum amount
+of quality loss.
+.SP
+SoX can decode all types of Ogg Vorbis files, and can encode at different
+compression levels/qualities given as a number from \-1 (highest
+compression/lowest quality) to 10 (lowest compression, highest quality).
+By default the encoding quality level is 3 (which gives an encoded rate
+of approx. 112kbps), but this can be changed using the
+.B \-C
+option (see above) with a number from \-1 to 10; fractional numbers (e.g.
+3\*d6) are also allowed.
+Decoding is somewhat CPU intensive and encoding is very CPU intensive.
+.SP
+See also
+.B .mp3
+for a similar format.
+.TP
+\&\fB.opus\fR (optional)
+Xiph.org's Opus compressed audio; an open, lossy, low-latency codec
+offering a wide range of compression rates. It uses the Ogg container.
+.SP
+SoX can only read Opus files, not write them.
+.TP
+\fBoss\fR (optional)
+Open Sound System /dev/dsp device driver; supports both playing and
+recording audio. OSS support is available in Unix-like operating systems,
+sometimes together with alternative sound systems (such as ALSA). Examples:
+.EX
+ sox infile \-t oss
+ sox infile \-t oss /dev/dsp
+ sox \-b 16 \-t oss /dev/dsp outfile
+.EE
+See also
+.BR play (1),
+.BR rec (1),
+and
+.BR sox (1)
+.BR \-d .
+.TP
+\&\fB.paf\fR, \fB.fap\fR (optional)
+Ensoniq PARIS file format (big and little-endian respectively).
+.TP
+.B .pls
+A
+.I playlist
+format; contains a list of audio files.
+SoX can read, but not write this file format.
+See [2] for details of this format.
+.SP
+Note: SoX support for SHOUTcast PLS relies on
+.BR wget (1)
+and is only partially supported: it's necessary to
+specify the audio type manually, e.g.
+.EX
+ play \-t mp3 \(dqhttp://a.server/pls?rn=265&file=filename.pls\(dq
+.EE
+and SoX does not know about alternative servers\*mhit Ctrl-C twice in
+quick succession to quit.
+.TP
+.B .prc
+Psion Record. Used in Psion EPOC PDAs (Series 5, Revo and similar) for
+System alarms and recordings made by the built-in Record application.
+When writing, SoX defaults to A-law, which is recommended; if you must
+use ADPCM, then use the \fB\-e ima-adpcm\fR switch. The sound quality is poor
+because Psion Record seems to insist on frames of 800 samples or
+fewer, so that the ADPCM CODEC has to be reset at every 800 frames,
+which causes the sound to glitch every tenth of a second.
+.TP
+\fBpulseaudio\fR (optional)
+PulseAudio driver; supports both playing and recording of audio.
+PulseAudio is a cross platform networked sound server.
+If a file name is specified with this driver, it is ignored. Examples:
+.EX
+ sox infile \-t pulseaudio
+ sox infile \-t pulseaudio default
+.EE
+See also
+.BR play (1),
+.BR rec (1),
+and
+.BR sox (1)
+.BR \-d .
+.TP
+\&\fB.pvf\fR (optional)
+Portable Voice Format.
+.TP
+\&\fB.sd2\fR (optional)
+Sound Designer 2 format.
+.TP
+\&\fB.sds\fR (optional)
+MIDI Sample Dump Standard.
+.TP
+\&\fB.sf\fR (also with \fB\-t sndfile\fR)
+IRCAM SDIF (Institut de Recherche et Coordination Acoustique/Musique
+Sound Description Interchange Format). Used by academic music software
+such as the CSound package, and the MixView sound sample editor.
+.TP
+\&\fB.sln\fR
+Asterisk PBX `signed linear' 8khz, 16-bit signed integer, little-endian
+raw format.
+.TP
+\&\fB.sph\fR, \fB.nist\fR (also with \fB\-t sndfile\fR)
+SPHERE (SPeech HEader Resources) is a file format defined by NIST
+(National Institute of Standards and Technology) and is used with
+speech audio. SoX can read these files when they contain
+\(*m-law and PCM data. It will ignore any header information that
+says the data is compressed using \fIshorten\fR compression and
+will treat the data as either \(*m-law or PCM. This will allow SoX
+and the command line \fIshorten\fR program to be run together using
+pipes to encompasses the data and then pass the result to SoX for processing.
+.TP
+.B .smp
+Turtle Beach SampleVision files.
+SMP files are for use with the PC-DOS package SampleVision by Turtle Beach
+Softworks. This package is for communication to several MIDI samplers. All
+sample rates are supported by the package, although not all are supported by
+the samplers themselves. Currently loop points are ignored.
+.TP
+.B .snd
+See
+.BR .au ,
+.B .sndr
+and
+.BR .sndt .
+.TP
+\fBsndfile\fR (optional)
+This is a pseudo-type that forces libsndfile to be used. For writing files, the
+actual file type is then taken from the output file name; for reading
+them, it is deduced from the file.
+.TP
+\fBsndio\fR (optional)
+OpenBSD audio device driver; supports both playing and recording audio.
+.EX
+ sox infile \-t sndio
+.EE
+See also
+.BR play (1),
+.BR rec (1),
+and
+.BR sox (1)
+.BR \-d .
+.TP
+.B .sndr
+Sounder files.
+An MS-DOS/Windows format from the early '90s.
+Sounder files usually have the extension `.SND'.
+.TP
+.B .sndt
+SoundTool files.
+An MS-DOS/Windows format from the early '90s.
+SoundTool files usually have the extension `.SND'.
+.TP
+.B .sou
+An alias for the
+.B .u8
+raw format.
+.TP
+.B .sox
+SoX's native uncompressed PCM format, intended for storing (or piping)
+audio at intermediate processing points (i.e. between SoX invocations).
+It has much in common with the popular WAV, AIFF, and AU uncompressed PCM
+formats, but has the following specific characteristics: the PCM samples
+are always stored as 32 bit signed integers, the samples are stored (by
+default) as `native endian', and the number of samples in the file is
+recorded as a 64-bit integer. Comments are also supported.
+.SP
+See `Special Filenames' in
+.BR sox (1)
+for examples of using the
+.B .sox
+format with `pipes'.
+.TP
+\fBsunau\fR (optional)
+Sun /dev/audio device driver; supports both playing and
+recording audio. For example:
+.EX
+ sox infile \-t sunau /dev/audio
+.EE
+or
+.EX
+ sox infile \-t sunau \-e mu-law \-c 1 /dev/audio
+.EE
+for older sun equipment.
+.SP
+See also
+.BR play (1),
+.BR rec (1),
+and
+.BR sox (1)
+.BR \-d .
+.TP
+.B .txw
+Yamaha TX-16W sampler.
+A file format from a Yamaha sampling keyboard which wrote IBM-PC
+format 3\*d5\(dq floppies. Handles reading of files which do not have
+the sample rate field set to one of the expected by looking at some
+other bytes in the attack/loop length fields, and defaulting to
+33\ kHz if the sample rate is still unknown.
+.TP
+.B .vms
+See
+.BR .dvms .
+.TP
+\&\fB.voc\fR (also with \fB\-t sndfile\fR)
+Sound Blaster VOC files.
+VOC files are multi-part and contain silence parts, looping, and
+different sample rates for different chunks.
+On input, the silence parts are filled out, loops are rejected,
+and sample data with a new sample rate is rejected.
+Silence with a different sample rate is generated appropriately.
+On output, silence is not detected, nor are impossible sample rates.
+SoX supports reading (but not writing) VOC files with multiple
+blocks, and files containing \(*m-law, A-law, and 2/3/4-bit ADPCM samples.
+.TP
+.B .vorbis
+See
+.BR .ogg .
+.TP
+\&\fB.vox\fR (also with \fB\-t sndfile\fR)
+A headerless file of Dialogic/OKI ADPCM audio data commonly comes with the
+extension .vox. This ADPCM data has 12-bit precision packed into only 4-bits.
+.SP
+Note: some early Dialogic hardware does not always reset the ADPCM
+encoder at the start of each vox file. This can result in clipping
+and/or DC offset problems when it comes to decoding the audio. Whilst
+little can be done about the clipping, a DC offset can be removed by
+passing the decoded audio through a high-pass filter, e.g.:
+.EX
+ sox input.vox output.wav highpass 10
+.EE
+.TP
+\&\fB.w64\fR (optional)
+Sonic Foundry's 64-bit RIFF/WAV format.
+.TP
+\&\fB.wav\fR (also with \fB\-t sndfile\fR)
+Microsoft .WAV RIFF files.
+This is the native audio file format of Windows, and widely used for uncompressed audio.
+.SP
+Normally \fB.wav\fR files have all formatting information
+in their headers, and so do not need any format options
+specified for an input file. If any are, they will
+override the file header, and you will be warned to this effect.
+You had better know what you are doing! Output format
+options will cause a format conversion, and the \fB.wav\fR
+will written appropriately.
+.SP
+SoX can read and write linear PCM, floating point, \(*m-law, A-law, MS ADPCM, and IMA (or DVI) ADPCM encoded samples.
+WAV files can also contain audio encoded in many other ways (not currently
+supported with SoX) e.g. MP3; in some cases such a file can still be
+read by SoX by overriding the file type, e.g.
+.EX
+ play \-t mp3 mp3\-encoded.wav
+.EE
+Big endian versions of RIFF files, called RIFX, are also supported.
+To write a RIFX file, use the
+.B \-B
+option with the output file options.
+.TP
+\fBwaveaudio\fR (optional)
+MS-Windows native audio device driver. Examples:
+.EX
+ sox infile \-t waveaudio
+ sox infile \-t waveaudio default
+ sox infile \-t waveaudio 1
+ sox infile \-t waveaudio "High Definition Audio Device ("
+.EE
+If the device name is omitted, \fB-1\fR, or \fBdefault\fR, then you
+get the `Microsoft Wave Mapper' device. Wave Mapper means `use the
+system default audio devices'. You can control what `default' means
+via the OS Control Panel.
+.SP
+If the device name given is some other number, you get that audio
+device by index; so recording with device name \fB0\fR would get the
+first input device (perhaps the microphone), \fB1\fR would get the
+second (perhaps line in), etc. Playback using \fB0\fR will get the
+first output device (usually the only audio device).
+.SP
+If the device name given is something other than a number, SoX tries
+to match it (maximum 31 characters) against the names of the available
+devices.
+.SP
+See also
+.BR play (1),
+.BR rec (1),
+and
+.BR sox (1)
+.BR \-d .
+.TP
+.B .wavpcm
+A non-standard, but widely used, variant of
+.BR .wav .
+Some applications cannot read a standard WAV file header for PCM-encoded
+data with sample-size greater than 16-bits or with more than two
+channels, but can read a non-standard
+WAV header. It is likely that such applications will eventually be
+updated to support the standard header, but in the mean time, this SoX
+format can be used to create files with the non-standard header that
+should work with these applications. (Note that SoX will automatically
+detect and read WAV files with the non-standard header.)
+.SP
+The most common use of this file-type is likely to be along the following
+lines:
+.EX
+ sox infile.any \-t wavpcm \-e signed-integer outfile.wav
+.EE
+.TP
+\&\fB.wv\fR (optional)
+WavPack lossless audio compression. Note that, when converting
+.B .wav
+to this format and back again,
+the RIFF header is not necessarily preserved losslessly (though the audio is).
+.TP
+\&\fB.wve\fR (also with \fB\-t sndfile\fR)
+Psion 8-bit A-law. Used on Psion SIBO PDAs (Series 3 and similar).
+This format is deprecated in SoX, but will continue to be used in
+libsndfile.
+.TP
+.B .xa
+Maxis XA files.
+These are 16-bit ADPCM audio files used by Maxis games. Writing .xa files is
+currently not supported, although adding write support should not be very
+difficult.
+.TP
+\&\fB.xi\fR (optional)
+Fasttracker 2 Extended Instrument format.
+.SH SEE ALSO
+.BR sox (1),
+.BR soxi (1),
+.BR libsox (3),
+.BR octave (1),
+.BR wget (1)
+.SP
+The SoX web page at http://sox.sourceforge.net
+.br
+SoX scripting examples at http://sox.sourceforge.net/Docs/Scripts
+.SS References
+.TP
+[1]
+Wikipedia,
+.IR "M3U" ,
+http://en.wikipedia.org/wiki/M3U
+.TP
+[2]
+Wikipedia,
+.IR "PLS" ,
+http://en.wikipedia.org/wiki/PLS_(file_format)
+.SH LICENSE
+Copyright 1998\-2013 Chris Bagwell and SoX Contributors.
+.br
+Copyright 1991 Lance Norskog and Sundry Contributors.
+.SH AUTHORS
+Chris Bagwell (cbagwell@users.sourceforge.net).
+Other authors and contributors are listed in the ChangeLog file that
+is distributed with the source code.
diff --git a/src/soxformat.txt b/src/soxformat.txt
new file mode 100644
index 0000000..094ea1b
--- /dev/null
+++ b/src/soxformat.txt
@@ -0,0 +1,624 @@
+SoX(7) Sound eXchange SoX(7)
+
+
+
+NAME
+ SoX - Sound eXchange, the Swiss Army knife of audio manipulation
+
+DESCRIPTION
+ This manual describes SoX supported file formats and audio device
+ types; the SoX manual set starts with sox(1).
+
+ Format types that can SoX can determine by a filename extension are
+ listed with their names preceded by a dot. Format types that are
+ optionally built into SoX are marked `(optional)'.
+
+ Format types that can be handled by an external library via an optional
+ pseudo file type (currently sndfile) are marked e.g. `(also with -t
+ sndfile)'. This might be useful if you have a file that doesn't work
+ with SoX's default format readers and writers, and there's an external
+ reader or writer for that format.
+
+ To see if SoX has support for an optional format or device, enter sox
+ -h and look for its name under the list: `AUDIO FILE FORMATS' or `AUDIO
+ DEVICE DRIVERS'.
+
+ SOX FORMATS & DEVICE DRIVERS
+ .raw (also with -t sndfile), .f32, .f64, .s8, .s16, .s24, .s32,
+ .u8, .u16, .u24, .u32, .ul, .al, .lu, .la
+ Raw (headerless) audio files. For raw, the sample rate and the
+ data encoding must be given using command-line format options;
+ for the other listed types, the sample rate defaults to 8kHz
+ (but may be overridden), and the data encoding is defined by the
+ given suffix. Thus f32 and f64 indicate files encoded as 32 and
+ 64-bit (IEEE single and double precision) floating point PCM
+ respectively; s8, s16, s24, and s32 indicate 8, 16, 24, and
+ 32-bit signed integer PCM respectively; u8, u16, u24, and u32
+ indicate 8, 16, 24, and 32-bit unsigned integer PCM respec‐
+ tively; ul indicates `μ-law' (8-bit), al indicates `A-law'
+ (8-bit), and lu and la are inverse bit order `μ-law' and inverse
+ bit order `A-law' respectively. For all raw formats, the number
+ of channels defaults to 1 (but may be overridden).
+
+ Headerless audio files on a SPARC computer are likely to be of
+ format ul; on a Mac, they're likely to be u8 but with a sample
+ rate of 11025 or 22050 Hz.
+
+ See .ima and .vox for raw ADPCM formats, and .cdda for raw CD
+ digital audio.
+
+ .f4, .f8, .s1, .s2, .s3, .s4,
+ .u1, .u2, .u3, .u4, .sb, .sw, .sl, .ub, .uw
+ Deprecated aliases for f32, f64, s8, s16, s24, s32,
+ u8, u16, u24, u32, s8, s16, s32, u8, and u16 respectively.
+
+ .8svx (also with -t sndfile)
+ Amiga 8SVX musical instrument description format.
+
+ .aiff, .aif (also with -t sndfile)
+ AIFF files as used on old Apple Macs, Apple IIc/IIgs and SGI.
+ SoX's AIFF support does not include multiple audio chunks, or
+ the 8SVX musical instrument description format. AIFF files are
+ multimedia archives and can have multiple audio and picture
+ chunks - you may need a separate archiver to work with them.
+ With Mac OS X, AIFF has been superseded by CAF.
+
+ .aiffc, .aifc (also with -t sndfile)
+ AIFF-C is a format based on AIFF that was created to allow han‐
+ dling compressed audio. It can also handle little endian uncom‐
+ pressed linear data that is often referred to as sowt encoding.
+ This encoding has also become the defacto format produced by
+ modern Macs as well as iTunes on any platform. AIFF-C files
+ produced by other applications typically have the file extension
+ .aif and require looking at its header to detect the true for‐
+ mat. The sowt encoding is the only encoding that SoX can handle
+ with this format.
+
+ AIFF-C is defined in DAVIC 1.4 Part 9 Annex B. This format is
+ referred from ARIB STD-B24, which is specified for Japanese data
+ broadcasting. Any private chunks are not supported.
+
+ alsa (optional)
+ Advanced Linux Sound Architecture device driver; supports both
+ playing and recording audio. ALSA is only used in Linux-based
+ operating systems, though these often support OSS (see below) as
+ well. Examples:
+ sox infile -t alsa
+ sox infile -t alsa default
+ sox infile -t alsa plughw:0,0
+ sox -b 16 -t alsa hw:1 outfile
+ See also play(1), rec(1), and sox(1) -d.
+
+ .amb Ambisonic B-Format: a specialisation of .wav with between 3 and
+ 16 channels of audio for use with an Ambisonic decoder. See
+ http://www.ambisonia.com/Members/mleese/file-format-for-b-format
+ for details. It is up to the user to get the channels together
+ in the right order and at the correct amplitude.
+
+ .amr-nb (optional)
+ Adaptive Multi Rate - Narrow Band speech codec; a lossy format
+ used in 3rd generation mobile telephony and defined in 3GPP TS
+ 26.071 et al.
+
+ AMR-NB audio has a fixed sampling rate of 8 kHz and supports
+ encoding to the following bit-rates (as selected by the -C
+ option): 0 = 4.75 kbit/s, 1 = 5.15 kbit/s, 2 = 5.9 kbit/s, 3 =
+ 6.7 kbit/s, 4 = 7.4 kbit/s 5 = 7.95 kbit/s, 6 = 10.2 kbit/s, 7 =
+ 12.2 kbit/s.
+
+ .amr-wb (optional)
+ Adaptive Multi Rate - Wide Band speech codec; a lossy format
+ used in 3rd generation mobile telephony and defined in 3GPP TS
+ 26.171 et al.
+
+ AMR-WB audio has a fixed sampling rate of 16 kHz and supports
+ encoding to the following bit-rates (as selected by the -C
+ option): 0 = 6.6 kbit/s, 1 = 8.85 kbit/s, 2 = 12.65 kbit/s, 3 =
+ 14.25 kbit/s, 4 = 15.85 kbit/s 5 = 18.25 kbit/s, 6 = 19.85
+ kbit/s, 7 = 23.05 kbit/s, 8 = 23.85 kbit/s.
+
+ ao (optional)
+ Xiph.org's Audio Output device driver; works only for playing
+ audio. It supports a wide range of devices and sound systems -
+ see its documentation for the full range. For the most part,
+ SoX's use of libao cannot be configured directly; instead, libao
+ configuration files must be used.
+
+ The filename specified is used to determine which libao plugin
+ to use. Normally, you should specify `default' as the filename.
+ If that doesn't give the desired behavior then you can specify
+ the short name for a given plugin (such as pulse for pulse audio
+ plugin). Examples:
+ sox infile -t ao
+ sox infile -t ao default
+ sox infile -t ao pulse
+ See also play(1) and sox(1) -d.
+
+ .au, .snd (also with -t sndfile)
+ Sun Microsystems AU files. There are many types of AU file; DEC
+ has invented its own with a different magic number and byte
+ order. To write a DEC file, use the -L option with the output
+ file options.
+
+ Some .au files are known to have invalid AU headers; these are
+ probably original Sun μ-law 8000 Hz files and can be dealt with
+ using the .ul format (see below).
+
+ It is possible to override AU file header information with the
+ -r and -c options, in which case SoX will issue a warning to
+ that effect.
+
+ .avr Audio Visual Research format; used by a number of commercial
+ packages on the Mac.
+
+ .caf (optional)
+ Apple's Core Audio File format.
+
+ .cdda, .cdr
+ `Red Book' Compact Disc Digital Audio (raw audio). CDDA has two
+ audio channels formatted as 16-bit signed integers (big
+ endian)at a sample rate of 44.1 kHz. The number of (stereo)
+ samples in each CDDA track is always a multiple of 588.
+
+ coreaudio (optional)
+ Mac OSX CoreAudio device driver: supports both playing and
+ recording audio. If a filename is not specific or if the name
+ is "default" then the default audio device is selected. Any
+ other name will be used to select a specific device. The valid
+ names can be seen in the System Preferences->Sound menu and then
+ under the Output and Input tabs.
+
+ Examples:
+ sox infile -t coreaudio
+ sox infile -t coreaudio default
+ sox infile -t coreaudio "Internal Speakers"
+ See also play(1), rec(1), and sox(1) -d.
+
+ .cvsd, .cvs
+ Continuously Variable Slope Delta modulation. A headerless for‐
+ mat used to compress speech audio for applications such as voice
+ mail. This format is sometimes used with bit-reversed samples -
+ the -X format option can be used to set the bit-order.
+
+ .cvu Continuously Variable Slope Delta modulation (unfiltered). This
+ is an alternative handler for CVSD that is unfiltered but can be
+ used with any bit-rate. E.g.
+ sox infile outfile.cvu rate 28k
+ play -r 28k outfile.cvu sinc -3.4k
+
+ .dat Text Data files. These files contain a textual representation
+ of the sample data. There is one line at the beginning that
+ contains the sample rate, and one line that contains the number
+ of channels. Subsequent lines contain two or more numeric data
+ intems: the time since the beginning of the first sample and the
+ sample value for each channel.
+
+ Values are normalized so that the maximum and minimum are 1 and
+ -1. This file format can be used to create data files for
+ external programs such as FFT analysers or graph routines. SoX
+ can also convert a file in this format back into one of the
+ other file formats.
+
+ Example containing only 2 stereo samples of silence:
+
+ ; Sample Rate 8012
+ ; Channels 2
+ 0 0 0
+ 0.00012481278 0 0
+
+ .dvms, .vms
+ Used in Germany to compress speech audio for voice mail. A
+ self-describing variant of cvsd.
+
+ .fap (optional)
+ See .paf.
+
+ .flac (optional; also with -t sndfile)
+ Xiph.org's Free Lossless Audio CODEC compressed audio. FLAC is
+ an open, patent-free CODEC designed for compressing music. It
+ is similar to MP3 and Ogg Vorbis, but lossless, meaning that
+ audio is compressed in FLAC without any loss in quality.
+
+ SoX can read native FLAC files (.flac) but not Ogg FLAC files
+ (.ogg). [But see .ogg below for information relating to support
+ for Ogg Vorbis files.]
+
+ SoX can write native FLAC files according to a given or default
+ compression level. 8 is the default compression level and gives
+ the best (but slowest) compression; 0 gives the least (but
+ fastest) compression. The compression level is selected using
+ the -C option [see sox(1)] with a whole number from 0 to 8.
+
+ .fssd An alias for the .u8 format.
+
+ .gsrt Grandstream ring-tone files. Whilst this file format can con‐
+ tain A-Law, μ-law, GSM, G.722, G.723, G.726, G.728, or iLBC
+ encoded audio, SoX supports reading and writing only A-Law and
+ μ-law. E.g.
+ sox music.wav -t gsrt ring.bin
+ play ring.bin
+
+ .gsm (optional; also with -t sndfile)
+ GSM 06.10 Lossy Speech Compression. A lossy format for com‐
+ pressing speech which is used in the Global Standard for Mobile
+ telecommunications (GSM). It's good for its purpose, shrinking
+ audio data size, but it will introduce lots of noise when a
+ given audio signal is encoded and decoded multiple times. This
+ format is used by some voice mail applications. It is rather
+ CPU intensive.
+
+ .hcom Macintosh HCOM files. These are Mac FSSD files with Huffman
+ compression.
+
+ .htk Single channel 16-bit PCM format used by HTK, a toolkit for
+ building Hidden Markov Model speech processing tools.
+
+ .ircam (also with -t sndfile)
+ Another name for .sf.
+
+ .ima (also with -t sndfile)
+ A headerless file of IMA ADPCM audio data. IMA ADPCM claims
+ 16-bit precision packed into only 4 bits, but in fact sounds no
+ better than .vox.
+
+ .lpc, .lpc10
+ LPC-10 is a compression scheme for speech developed in the
+ United States. See http://www.arl.wustl.edu/~jaf/lpc/ for
+ details. There is no associated file format, so SoX's implemen‐
+ tation is headerless.
+
+ .mat, .mat4, .mat5 (optional)
+ Matlab 4.2/5.0 (respectively GNU Octave 2.0/2.1) format (.mat is
+ the same as .mat4).
+
+ .m3u A playlist format; contains a list of audio files. SoX can
+ read, but not write this file format. See [1] for details of
+ this format.
+
+ .maud An IFF-conforming audio file type, registered by MS MacroSystem
+ Computer GmbH, published along with the `Toccata' sound-card on
+ the Amiga. Allows 8bit linear, 16bit linear, A-Law, μ-law in
+ mono and stereo.
+
+ .mp3, .mp2 (optional read, optional write)
+ MP3 compressed audio; MP3 (MPEG Layer 3) is a part of the
+ patent-encumbered MPEG standards for audio and video compres‐
+ sion. It is a lossy compression format that achieves good com‐
+ pression rates with little quality loss.
+
+ Because MP3 is patented, SoX cannot be distributed with MP3 sup‐
+ port without incurring the patent holder's fees. Users who
+ require SoX with MP3 support must currently compile and build
+ SoX with the MP3 libraries (LAME & MAD) from source code, or, in
+ some cases, obtain pre-built dynamically loadable libraries.
+
+ When reading MP3 files, up to 28 bits of precision is stored
+ although only 16 bits is reported to user. This is to allow
+ default behavior of writing 16 bit output files. A user can
+ specify a higher precision for the output file to prevent loss‐
+ ing this extra information. MP3 output files will use up to 24
+ bits of precision while encoding.
+
+ MP3 compression parameters can be selected using SoX's -C option
+ as follows (note that the current syntax is subject to change):
+
+ The primary parameter to the LAME encoder is the bit rate. If
+ the value of the -C value is a positive integer, it's taken as
+ the bitrate in kbps (e.g. if you specify 128, it uses 128 kbps).
+
+ The second most important parameter is probably "quality"
+ (really performance), which allows balancing encoding speed vs.
+ quality. In LAME, 0 specifies highest quality but is very slow,
+ while 9 selects poor quality, but is fast. (5 is the default and
+ 2 is recommended as a good trade-off for high quality encodes.)
+
+ Because the -C value is a float, the fractional part is used to
+ select quality. 128.2 selects 128 kbps encoding with a quality
+ of 2. There is one problem with this approach. We need 128 to
+ specify 128 kbps encoding with default quality, so 0 means use
+ default. Instead of 0 you have to use .01 (or .99) to specify
+ the highest quality (128.01 or 128.99).
+
+ LAME uses bitrate to specify a constant bitrate, but higher
+ quality can be achieved using Variable Bit Rate (VBR). VBR qual‐
+ ity (really size) is selected using a number from 0 to 9. Use a
+ value of 0 for high quality, larger files, and 9 for smaller
+ files of lower quality. 4 is the default.
+
+ In order to squeeze the selection of VBR into the the -C value
+ float we use negative numbers to select VRR. -4.2 would select
+ default VBR encoding (size) with high quality (speed). One spe‐
+ cial case is 0, which is a valid VBR encoding parameter but not
+ a valid bitrate. Compression value of 0 is always treated as a
+ high quality vbr, as a result both -0.2 and 0.2 are treated as
+ highest quality VBR (size) and high quality (speed).
+
+ See also Ogg Vorbis for a similar format.
+
+ .nist (also with -t sndfile)
+ See .sph.
+
+ .ogg, .vorbis (optional)
+ Xiph.org's Ogg Vorbis compressed audio; an open, patent-free
+ CODEC designed for music and streaming audio. It is a lossy
+ compression format (similar to MP3, VQF & AAC) that achieves
+ good compression rates with a minimum amount of quality loss.
+
+ SoX can decode all types of Ogg Vorbis files, and can encode at
+ different compression levels/qualities given as a number from -1
+ (highest compression/lowest quality) to 10 (lowest compression,
+ highest quality). By default the encoding quality level is 3
+ (which gives an encoded rate of approx. 112kbps), but this can
+ be changed using the -C option (see above) with a number from -1
+ to 10; fractional numbers (e.g. 3.6) are also allowed. Decod‐
+ ing is somewhat CPU intensive and encoding is very CPU inten‐
+ sive.
+
+ See also .mp3 for a similar format.
+
+ .opus (optional)
+ Xiph.org's Opus compressed audio; an open, lossy, low-latency
+ codec offering a wide range of compression rates. It uses the
+ Ogg container.
+
+ SoX can only read Opus files, not write them.
+
+ oss (optional)
+ Open Sound System /dev/dsp device driver; supports both playing
+ and recording audio. OSS support is available in Unix-like
+ operating systems, sometimes together with alternative sound
+ systems (such as ALSA). Examples:
+ sox infile -t oss
+ sox infile -t oss /dev/dsp
+ sox -b 16 -t oss /dev/dsp outfile
+ See also play(1), rec(1), and sox(1) -d.
+
+ .paf, .fap (optional)
+ Ensoniq PARIS file format (big and little-endian respectively).
+
+ .pls A playlist format; contains a list of audio files. SoX can
+ read, but not write this file format. See [2] for details of
+ this format.
+
+ Note: SoX support for SHOUTcast PLS relies on wget(1) and is
+ only partially supported: it's necessary to specify the audio
+ type manually, e.g.
+ play -t mp3 "http://a.server/pls?rn=265&file=filename.pls"
+ and SoX does not know about alternative servers - hit Ctrl-C
+ twice in quick succession to quit.
+
+ .prc Psion Record. Used in Psion EPOC PDAs (Series 5, Revo and simi‐
+ lar) for System alarms and recordings made by the built-in
+ Record application. When writing, SoX defaults to A-law, which
+ is recommended; if you must use ADPCM, then use the -e ima-adpcm
+ switch. The sound quality is poor because Psion Record seems to
+ insist on frames of 800 samples or fewer, so that the ADPCM
+ CODEC has to be reset at every 800 frames, which causes the
+ sound to glitch every tenth of a second.
+
+ pulseaudio (optional)
+ PulseAudio driver; supports both playing and recording of audio.
+ PulseAudio is a cross platform networked sound server. If a
+ file name is specified with this driver, it is ignored. Exam‐
+ ples:
+ sox infile -t pulseaudio
+ sox infile -t pulseaudio default
+ See also play(1), rec(1), and sox(1) -d.
+
+ .pvf (optional)
+ Portable Voice Format.
+
+ .sd2 (optional)
+ Sound Designer 2 format.
+
+ .sds (optional)
+ MIDI Sample Dump Standard.
+
+ .sf (also with -t sndfile)
+ IRCAM SDIF (Institut de Recherche et Coordination Acous‐
+ tique/Musique Sound Description Interchange Format). Used by
+ academic music software such as the CSound package, and the
+ MixView sound sample editor.
+
+ .sln Asterisk PBX `signed linear' 8khz, 16-bit signed integer, lit‐
+ tle-endian raw format.
+
+ .sph, .nist (also with -t sndfile)
+ SPHERE (SPeech HEader Resources) is a file format defined by
+ NIST (National Institute of Standards and Technology) and is
+ used with speech audio. SoX can read these files when they con‐
+ tain μ-law and PCM data. It will ignore any header information
+ that says the data is compressed using shorten compression and
+ will treat the data as either μ-law or PCM. This will allow SoX
+ and the command line shorten program to be run together using
+ pipes to encompasses the data and then pass the result to SoX
+ for processing.
+
+ .smp Turtle Beach SampleVision files. SMP files are for use with the
+ PC-DOS package SampleVision by Turtle Beach Softworks. This
+ package is for communication to several MIDI samplers. All sam‐
+ ple rates are supported by the package, although not all are
+ supported by the samplers themselves. Currently loop points are
+ ignored.
+
+ .snd See .au, .sndr and .sndt.
+
+ sndfile (optional)
+ This is a pseudo-type that forces libsndfile to be used. For
+ writing files, the actual file type is then taken from the out‐
+ put file name; for reading them, it is deduced from the file.
+
+ sndio (optional)
+ OpenBSD audio device driver; supports both playing and recording
+ audio.
+ sox infile -t sndio
+ See also play(1), rec(1), and sox(1) -d.
+
+ .sndr Sounder files. An MS-DOS/Windows format from the early '90s.
+ Sounder files usually have the extension `.SND'.
+
+ .sndt SoundTool files. An MS-DOS/Windows format from the early '90s.
+ SoundTool files usually have the extension `.SND'.
+
+ .sou An alias for the .u8 raw format.
+
+ .sox SoX's native uncompressed PCM format, intended for storing (or
+ piping) audio at intermediate processing points (i.e. between
+ SoX invocations). It has much in common with the popular WAV,
+ AIFF, and AU uncompressed PCM formats, but has the following
+ specific characteristics: the PCM samples are always stored as
+ 32 bit signed integers, the samples are stored (by default) as
+ `native endian', and the number of samples in the file is
+ recorded as a 64-bit integer. Comments are also supported.
+
+ See `Special Filenames' in sox(1) for examples of using the .sox
+ format with `pipes'.
+
+ sunau (optional)
+ Sun /dev/audio device driver; supports both playing and record‐
+ ing audio. For example:
+ sox infile -t sunau /dev/audio
+ or
+ sox infile -t sunau -e mu-law -c 1 /dev/audio
+ for older sun equipment.
+
+ See also play(1), rec(1), and sox(1) -d.
+
+ .txw Yamaha TX-16W sampler. A file format from a Yamaha sampling
+ keyboard which wrote IBM-PC format 3.5" floppies. Handles read‐
+ ing of files which do not have the sample rate field set to one
+ of the expected by looking at some other bytes in the
+ attack/loop length fields, and defaulting to 33 kHz if the sam‐
+ ple rate is still unknown.
+
+ .vms See .dvms.
+
+ .voc (also with -t sndfile)
+ Sound Blaster VOC files. VOC files are multi-part and contain
+ silence parts, looping, and different sample rates for different
+ chunks. On input, the silence parts are filled out, loops are
+ rejected, and sample data with a new sample rate is rejected.
+ Silence with a different sample rate is generated appropriately.
+ On output, silence is not detected, nor are impossible sample
+ rates. SoX supports reading (but not writing) VOC files with
+ multiple blocks, and files containing μ-law, A-law, and
+ 2/3/4-bit ADPCM samples.
+
+ .vorbis
+ See .ogg.
+
+ .vox (also with -t sndfile)
+ A headerless file of Dialogic/OKI ADPCM audio data commonly
+ comes with the extension .vox. This ADPCM data has 12-bit pre‐
+ cision packed into only 4-bits.
+
+ Note: some early Dialogic hardware does not always reset the
+ ADPCM encoder at the start of each vox file. This can result in
+ clipping and/or DC offset problems when it comes to decoding the
+ audio. Whilst little can be done about the clipping, a DC off‐
+ set can be removed by passing the decoded audio through a high-
+ pass filter, e.g.:
+ sox input.vox output.wav highpass 10
+
+ .w64 (optional)
+ Sonic Foundry's 64-bit RIFF/WAV format.
+
+ .wav (also with -t sndfile)
+ Microsoft .WAV RIFF files. This is the native audio file format
+ of Windows, and widely used for uncompressed audio.
+
+ Normally .wav files have all formatting information in their
+ headers, and so do not need any format options specified for an
+ input file. If any are, they will override the file header, and
+ you will be warned to this effect. You had better know what you
+ are doing! Output format options will cause a format conversion,
+ and the .wav will written appropriately.
+
+ SoX can read and write linear PCM, floating point, μ-law, A-law,
+ MS ADPCM, and IMA (or DVI) ADPCM encoded samples. WAV files can
+ also contain audio encoded in many other ways (not currently
+ supported with SoX) e.g. MP3; in some cases such a file can
+ still be read by SoX by overriding the file type, e.g.
+ play -t mp3 mp3-encoded.wav
+ Big endian versions of RIFF files, called RIFX, are also sup‐
+ ported. To write a RIFX file, use the -B option with the output
+ file options.
+
+ waveaudio (optional)
+ MS-Windows native audio device driver. Examples:
+ sox infile -t waveaudio
+ sox infile -t waveaudio default
+ sox infile -t waveaudio 1
+ sox infile -t waveaudio "High Definition Audio Device ("
+ If the device name is omitted, -1, or default, then you get the
+ `Microsoft Wave Mapper' device. Wave Mapper means `use the sys‐
+ tem default audio devices'. You can control what `default'
+ means via the OS Control Panel.
+
+ If the device name given is some other number, you get that
+ audio device by index; so recording with device name 0 would get
+ the first input device (perhaps the microphone), 1 would get the
+ second (perhaps line in), etc. Playback using 0 will get the
+ first output device (usually the only audio device).
+
+ If the device name given is something other than a number, SoX
+ tries to match it (maximum 31 characters) against the names of
+ the available devices.
+
+ See also play(1), rec(1), and sox(1) -d.
+
+ .wavpcm
+ A non-standard, but widely used, variant of .wav. Some applica‐
+ tions cannot read a standard WAV file header for PCM-encoded
+ data with sample-size greater than 16-bits or with more than two
+ channels, but can read a non-standard WAV header. It is likely
+ that such applications will eventually be updated to support the
+ standard header, but in the mean time, this SoX format can be
+ used to create files with the non-standard header that should
+ work with these applications. (Note that SoX will automatically
+ detect and read WAV files with the non-standard header.)
+
+ The most common use of this file-type is likely to be along the
+ following lines:
+ sox infile.any -t wavpcm -e signed-integer outfile.wav
+
+ .wv (optional)
+ WavPack lossless audio compression. Note that, when converting
+ .wav to this format and back again, the RIFF header is not nec‐
+ essarily preserved losslessly (though the audio is).
+
+ .wve (also with -t sndfile)
+ Psion 8-bit A-law. Used on Psion SIBO PDAs (Series 3 and simi‐
+ lar). This format is deprecated in SoX, but will continue to be
+ used in libsndfile.
+
+ .xa Maxis XA files. These are 16-bit ADPCM audio files used by
+ Maxis games. Writing .xa files is currently not supported,
+ although adding write support should not be very difficult.
+
+ .xi (optional)
+ Fasttracker 2 Extended Instrument format.
+
+SEE ALSO
+ sox(1), soxi(1), libsox(3), octave(1), wget(1)
+
+ The SoX web page at http://sox.sourceforge.net
+ SoX scripting examples at http://sox.sourceforge.net/Docs/Scripts
+
+ References
+ [1] Wikipedia, M3U, http://en.wikipedia.org/wiki/M3U
+
+ [2] Wikipedia, PLS, http://en.wikipedia.org/wiki/PLS_(file_format)
+
+LICENSE
+ Copyright 1998-2013 Chris Bagwell and SoX Contributors.
+ Copyright 1991 Lance Norskog and Sundry Contributors.
+
+AUTHORS
+ Chris Bagwell (cbagwell@users.sourceforge.net). Other authors and con‐
+ tributors are listed in the ChangeLog file that is distributed with the
+ source code.
+
+
+
+soxformat December 31, 2014 SoX(7)
diff --git a/src/soxi.1 b/src/soxi.1
new file mode 100644
index 0000000..5c48452
--- /dev/null
+++ b/src/soxi.1
@@ -0,0 +1,123 @@
+'\" t
+'\" The line above instructs most `man' programs to invoke tbl
+'\"
+'\" Separate paragraphs; not the same as PP which resets indent level.
+.de SP
+.if t .sp .5
+.if n .sp
+..
+'\"
+'\" Replacement em-dash for nroff (default is too short).
+.ie n .ds m " -
+.el .ds m \(em
+'\"
+'\" Placeholder macro for if longer nroff arrow is needed.
+.ds RA \(->
+'\"
+'\" Decimal point set slightly raised
+.if t .ds d \v'-.15m'.\v'+.15m'
+.if n .ds d .
+'\"
+'\" Enclosure macro for examples
+.de EX
+.SP
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.SP
+.fi
+..
+.TH SoXI 1 "February 1, 2013" "soxi" "Sound eXchange"
+.SH NAME
+SoXI \- Sound eXchange Information, display sound file metadata
+.SH SYNOPSIS
+\fBsoxi\fR [\fB\-V\fR[\fIlevel\fR]] [\fB\-T\fR] [\fB\-t\fR\^|\^\fB\-r\fR\^|\^\fB\-c\fR\^|\^\fB\-s\fR\^|\^\fB\-d\fR\^|\^\fB\-D\fR\^|\^\fB\-b\fR\^|\^\fB\-B\fR\^|\^\fB\-p\fR\^|\^\fB\-e\fR\^|\^\fB\-a\fR] \fIinfile1\fR ...
+.SH DESCRIPTION
+Displays information from the header of a given audio file or files.
+Supported audio file types are listed and described in
+.BR soxformat (7).
+Note however, that
+.B soxi
+is intended for use only with audio files with a self-describing header.
+.SP
+By default, as much information as is available is shown.
+An option may be given to select just a single piece of information
+(perhaps for use in a script or batch-file).
+.SH OPTIONS
+.TP
+\fB\-V\fR
+Set verbosity. See
+.BR sox (1)
+for details.
+.TP
+\fB\-T\fR
+Used with multiple files; changes the behaviour of
+.BR \-s ,
+.B \-d
+and
+.B \-D
+to display the total across all given files.
+Note that when used with
+.B \-s
+with files with different sampling rates, this is of questionable value.
+.TP
+\fB\-t\fR
+Show detected file-type.
+.TP
+\fB\-r\fR
+Show sample-rate.
+.TP
+\fB\-c\fR
+Show number of channels.
+.TP
+\fB\-s\fR
+Show number of samples (0 if unavailable).
+.TP
+\fB\-d\fR
+Show duration in hours, minutes and seconds (0 if unavailable).
+Equivalent to number of samples divided by the sample-rate.
+.TP
+\fB\-D\fR
+Show duration in seconds (0 if unavailable).
+.TP
+\fB\-b\fR
+Show number of bits per sample (0 if not applicable).
+.TP
+\fB\-B\fR
+Show the bitrate averaged over the whole file (0 if unavailable).
+.TP
+\fB\-p\fR
+Show estimated sample precision in bits.
+.TP
+\fB\-e\fR
+Show the name of the audio encoding.
+.TP
+\fB\-a\fR
+Show file comments (annotations) if available.
+.SH BUGS
+Please report any bugs found in this version of SoX to the mailing list
+(sox-users@lists.sourceforge.net).
+.SH SEE ALSO
+.BR sox (1),
+.BR soxformat (7),
+.BR libsox (3)
+.SP
+The SoX web site at http://sox.sourceforge.net
+.SH LICENSE
+Copyright 2008\-2013 by Chris Bagwell and SoX Contributors.
+.SP
+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, or (at your option)
+any later version.
+.SP
+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.
+.SH AUTHORS
+Chris Bagwell (cbagwell@users.sourceforge.net).
+Other authors and contributors are listed in the ChangeLog file that
+is distributed with the source code.
diff --git a/src/soxi.txt b/src/soxi.txt
new file mode 100644
index 0000000..9164d01
--- /dev/null
+++ b/src/soxi.txt
@@ -0,0 +1,82 @@
+SoXI(1) Sound eXchange SoXI(1)
+
+
+
+NAME
+ SoXI - Sound eXchange Information, display sound file metadata
+
+SYNOPSIS
+ soxi [-V[level]] [-T] [-t|-r|-c|-s|-d|-D|-b|-B|-p|-e|-a] infile1 ...
+
+DESCRIPTION
+ Displays information from the header of a given audio file or files.
+ Supported audio file types are listed and described in soxformat(7).
+ Note however, that soxi is intended for use only with audio files with
+ a self-describing header.
+
+ By default, as much information as is available is shown. An option
+ may be given to select just a single piece of information (perhaps for
+ use in a script or batch-file).
+
+OPTIONS
+ -V Set verbosity. See sox(1) for details.
+
+ -T Used with multiple files; changes the behaviour of -s, -d and -D
+ to display the total across all given files. Note that when
+ used with -s with files with different sampling rates, this is
+ of questionable value.
+
+ -t Show detected file-type.
+
+ -r Show sample-rate.
+
+ -c Show number of channels.
+
+ -s Show number of samples (0 if unavailable).
+
+ -d Show duration in hours, minutes and seconds (0 if unavailable).
+ Equivalent to number of samples divided by the sample-rate.
+
+ -D Show duration in seconds (0 if unavailable).
+
+ -b Show number of bits per sample (0 if not applicable).
+
+ -B Show the bitrate averaged over the whole file (0 if unavail‐
+ able).
+
+ -p Show estimated sample precision in bits.
+
+ -e Show the name of the audio encoding.
+
+ -a Show file comments (annotations) if available.
+
+BUGS
+ Please report any bugs found in this version of SoX to the mailing list
+ (sox-users@lists.sourceforge.net).
+
+SEE ALSO
+ sox(1), soxformat(7), libsox(3)
+
+ The SoX web site at http://sox.sourceforge.net
+
+LICENSE
+ Copyright 2008-2013 by Chris Bagwell and SoX Contributors.
+
+ 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, 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 MER‐
+ CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ Public License for more details.
+
+AUTHORS
+ Chris Bagwell (cbagwell@users.sourceforge.net). Other authors and con‐
+ tributors are listed in the ChangeLog file that is distributed with the
+ source code.
+
+
+
+soxi February 1, 2013 SoXI(1)
diff --git a/src/src/8svx.c b/src/src/8svx.c
new file mode 100644
index 0000000..3f0a080
--- /dev/null
+++ b/src/src/8svx.c
@@ -0,0 +1,342 @@
+/* Amiga 8SVX format handler: W V Neisius, February 1992 */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define BUFLEN 512
+
+/* Private data used by writer */
+typedef struct{
+ uint32_t nsamples;
+ uint32_t left;
+ off_t ch0_pos;
+ sox_uint8_t buf[4][BUFLEN];
+ FILE* tmp[4];
+} priv_t;
+
+static void svxwriteheader(sox_format_t *, size_t);
+
+/*======================================================================*/
+/* 8SVXSTARTREAD */
+/*======================================================================*/
+
+static int startread(sox_format_t * ft)
+{
+ priv_t * p = (priv_t * ) ft->priv;
+
+ char buf[12];
+ char *chunk_buf;
+
+ uint32_t totalsize;
+ uint32_t chunksize;
+
+ uint32_t channels;
+ unsigned short rate;
+
+ if (! ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EINVAL,"8svx input file must be a file, not a pipe");
+ return (SOX_EOF);
+ }
+ rate = 0;
+ channels = 1;
+
+ /* read FORM chunk */
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || strncmp(buf, "FORM", (size_t)4) != 0)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "Header did not begin with magic word `FORM'");
+ return(SOX_EOF);
+ }
+ lsx_readdw(ft, &totalsize);
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || strncmp(buf, "8SVX", (size_t)4) != 0)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "'FORM' chunk does not specify `8SVX' as type");
+ return(SOX_EOF);
+ }
+
+ /* read chunks until 'BODY' (or end) */
+ while (lsx_reads(ft, buf, (size_t)4) == SOX_SUCCESS && strncmp(buf,"BODY",(size_t)4) != 0) {
+ if (strncmp(buf,"VHDR",(size_t)4) == 0) {
+ lsx_readdw(ft, &chunksize);
+ if (chunksize != 20)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "VHDR chunk has bad size");
+ return(SOX_EOF);
+ }
+ lsx_seeki(ft,(off_t)12,SEEK_CUR);
+ lsx_readw(ft, &rate);
+ lsx_seeki(ft,(off_t)1,SEEK_CUR);
+ lsx_readbuf(ft, buf,(size_t)1);
+ if (buf[0] != 0)
+ {
+ lsx_fail_errno(ft, SOX_EFMT, "Unsupported data compression");
+ return(SOX_EOF);
+ }
+ lsx_seeki(ft,(off_t)4,SEEK_CUR);
+ continue;
+ }
+
+ if (strncmp(buf,"ANNO",(size_t)4) == 0) {
+ lsx_readdw(ft, &chunksize);
+ if (chunksize & 1)
+ chunksize++;
+ chunk_buf = lsx_malloc(chunksize + (size_t)2);
+ if (lsx_readbuf(ft, chunk_buf,(size_t)chunksize)
+ != chunksize)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "Couldn't read all of header");
+ return(SOX_EOF);
+ }
+ chunk_buf[chunksize] = '\0';
+ lsx_debug("%s",chunk_buf);
+ free(chunk_buf);
+
+ continue;
+ }
+
+ if (strncmp(buf,"NAME",(size_t)4) == 0) {
+ lsx_readdw(ft, &chunksize);
+ if (chunksize & 1)
+ chunksize++;
+ chunk_buf = lsx_malloc(chunksize + (size_t)1);
+ if (lsx_readbuf(ft, chunk_buf,(size_t)chunksize)
+ != chunksize)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "Couldn't read all of header");
+ return(SOX_EOF);
+ }
+ chunk_buf[chunksize] = '\0';
+ lsx_debug("%s",chunk_buf);
+ free(chunk_buf);
+
+ continue;
+ }
+
+ if (strncmp(buf,"CHAN",(size_t)4) == 0) {
+ lsx_readdw(ft, &chunksize);
+ if (chunksize != 4)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "Couldn't read all of header");
+ return(SOX_EOF);
+ }
+ lsx_readdw(ft, &channels);
+ channels = (channels & 0x01) +
+ ((channels & 0x02) >> 1) +
+ ((channels & 0x04) >> 2) +
+ ((channels & 0x08) >> 3);
+
+ continue;
+ }
+
+ /* some other kind of chunk */
+ lsx_readdw(ft, &chunksize);
+ if (chunksize & 1)
+ chunksize++;
+ lsx_seeki(ft,(off_t)chunksize,SEEK_CUR);
+ continue;
+
+ }
+
+ if (rate == 0)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "Invalid sample rate");
+ return(SOX_EOF);
+ }
+ if (strncmp(buf,"BODY",(size_t)4) != 0)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "BODY chunk not found");
+ return(SOX_EOF);
+ }
+ lsx_readdw(ft, &(p->nsamples));
+ p->left = p->nsamples;
+ p->ch0_pos = lsx_tell(ft);
+
+ ft->signal.length = p->nsamples;
+ ft->signal.channels = channels;
+ ft->signal.rate = rate;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ ft->encoding.bits_per_sample = 8;
+
+ return(SOX_SUCCESS);
+}
+
+/*======================================================================*/
+/* 8SVXREAD */
+/*======================================================================*/
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t nsamp)
+{
+ size_t done = 0;
+
+ priv_t * p = (priv_t * ) ft->priv;
+ size_t frames = nsamp / ft->signal.channels;
+ unsigned width = p->nsamples / ft->signal.channels;
+
+ if (p->left < frames)
+ frames = p->left;
+
+ while (done != frames) {
+ size_t chunk = frames - done;
+ size_t i;
+ unsigned ch;
+
+ if (chunk > BUFLEN)
+ chunk = BUFLEN;
+
+ for (ch = 0; ch != ft->signal.channels; ch++) {
+ if (lsx_seeki(ft, p->ch0_pos + ch * width, SEEK_SET) ||
+ chunk != lsx_readbuf(ft, p->buf[ch], chunk))
+ return done * ft->signal.channels;
+ }
+
+ for (i = 0; i != chunk; i++) {
+ for (ch = 0; ch != ft->signal.channels; ch++) {
+ /* scale signed up to long's range */
+ *buf++ = SOX_SIGNED_8BIT_TO_SAMPLE(p->buf[ch][i], dummy);
+ }
+ }
+
+ done += chunk;
+ p->left -= chunk * ft->signal.channels;
+ p->ch0_pos += chunk;
+ }
+ return done * ft->signal.channels;
+}
+
+/*======================================================================*/
+/* 8SVXSTARTWRITE */
+/*======================================================================*/
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * p = (priv_t * ) ft->priv;
+ size_t i;
+
+ /* open channel output files */
+ for (i = 0; i < ft->signal.channels; i++) {
+ if ((p->tmp[i] = lsx_tmpfile()) == NULL)
+ {
+ lsx_fail_errno(ft,errno,"Can't open channel output file");
+ return(SOX_EOF);
+ }
+ }
+
+ p->nsamples = 0;
+ return(SOX_SUCCESS);
+}
+
+/*======================================================================*/
+/* 8SVXWRITE */
+/*======================================================================*/
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * p = (priv_t * ) ft->priv;
+ SOX_SAMPLE_LOCALS;
+
+ unsigned char datum;
+ size_t done = 0, i;
+
+ p->nsamples += len;
+
+ while(done < len) {
+ for (i = 0; i < ft->signal.channels; i++) {
+ datum = SOX_SAMPLE_TO_SIGNED_8BIT(*buf++, ft->clips);
+ putc(datum, p->tmp[i]);
+ }
+ done += ft->signal.channels;
+ }
+ return (done);
+}
+
+/*======================================================================*/
+/* 8SVXSTOPWRITE */
+/*======================================================================*/
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * p = (priv_t * ) ft->priv;
+
+ size_t i, len;
+ char svxbuf[512];
+
+ svxwriteheader(ft, (size_t) p->nsamples);
+
+ /* append all channel pieces to channel 0 */
+ /* close temp files */
+ for (i = 0; i < ft->signal.channels; i++) {
+ if (fseeko(p->tmp[i], (off_t)0, 0))
+ {
+ lsx_fail_errno (ft,errno,"Can't rewind channel output file %lu",(unsigned long)i);
+ return(SOX_EOF);
+ }
+ while (!feof(p->tmp[i])) {
+ len = fread(svxbuf, (size_t) 1, (size_t) 512, p->tmp[i]);
+ if (lsx_writebuf(ft, svxbuf, len) != len) {
+ lsx_fail_errno (ft,errno,"Can't write channel output file %lu",(unsigned long)i);
+ return SOX_EOF;
+ }
+ }
+ fclose (p->tmp[i]);
+ }
+
+ /* add a pad byte if BODY size is odd */
+ if(p->nsamples % 2 != 0)
+ lsx_writeb(ft, '\0');
+
+ return(SOX_SUCCESS);
+}
+
+/*======================================================================*/
+/* 8SVXWRITEHEADER */
+/*======================================================================*/
+#define SVXHEADERSIZE 100
+static void svxwriteheader(sox_format_t * ft, size_t nsamples)
+{
+ size_t formsize = nsamples + SVXHEADERSIZE - 8;
+
+ /* FORM size must be even */
+ if(formsize % 2 != 0) formsize++;
+
+ lsx_writes(ft, "FORM");
+ lsx_writedw(ft, (unsigned) formsize); /* size of file */
+ lsx_writes(ft, "8SVX"); /* File type */
+
+ lsx_writes(ft, "VHDR");
+ lsx_writedw(ft, 20); /* number of bytes to follow */
+ lsx_writedw(ft, (unsigned) nsamples/ft->signal.channels); /* samples, 1-shot */
+ lsx_writedw(ft, 0); /* samples, repeat */
+ lsx_writedw(ft, 0); /* samples per repeat cycle */
+ lsx_writew(ft, min(65535, (unsigned)(ft->signal.rate + .5)));
+ lsx_writeb(ft,1); /* number of octabes */
+ lsx_writeb(ft,0); /* data compression (none) */
+ lsx_writew(ft,1); lsx_writew(ft,0); /* volume */
+
+ lsx_writes(ft, "ANNO");
+ lsx_writedw(ft, 32); /* length of block */
+ lsx_writes(ft, "File created by Sound Exchange ");
+
+ lsx_writes(ft, "CHAN");
+ lsx_writedw(ft, 4);
+ lsx_writedw(ft, (ft->signal.channels == 2) ? 6u :
+ (ft->signal.channels == 4) ? 15u : 2u);
+
+ lsx_writes(ft, "BODY");
+ lsx_writedw(ft, (unsigned) nsamples); /* samples in file */
+}
+
+LSX_FORMAT_HANDLER(svx)
+{
+ static char const * const names[] = {"8svx", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 8, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Amiga audio format (a subformat of the Interchange File Format)",
+ names, SOX_FILE_BIG_END|SOX_FILE_MONO|SOX_FILE_STEREO|SOX_FILE_QUAD,
+ startread, read_samples, NULL,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/CMakeLists.txt b/src/src/CMakeLists.txt
new file mode 100644
index 0000000..bde10d6
--- /dev/null
+++ b/src/src/CMakeLists.txt
@@ -0,0 +1,174 @@
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}config.h)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+if(CMAKE_COMPILER_IS_GNUCC)
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+ OUTPUT_VARIABLE ver)
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" major "${ver}")
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" minor "${ver}")
+ math(EXPR ver "100 * ${major} + ${minor}")
+ if(${ver} LESS 403)
+ add_definitions(-Wconversion)
+ else(${ver} LESS 403)
+ add_definitions(-Wtraditional-conversion)
+ endif(${ver} LESS 403)
+ #add_definitions(-Werror)
+endif(CMAKE_COMPILER_IS_GNUCC)
+
+if (NOT EXTERNAL_GSM)
+ set(optional_libs ${optional_libs} gsm)
+endif (NOT EXTERNAL_GSM)
+
+set(effects_srcs
+ bend
+ biquad
+ biquads
+ chorus
+ compand
+ compandt
+ contrast
+ dcshift
+ delay
+ dft_filter
+ dither
+ divide
+ downsample
+ earwax
+ echo
+ echos
+ fade
+ fft4g
+ fir
+ firfit
+ flanger
+ gain
+ hilbert
+ input
+ loudness
+ mcompand
+ noiseprof
+ noisered
+ output
+ overdrive
+ pad
+ phaser
+ rate
+ remix
+ repeat
+ reverb
+ reverse
+ silence
+ sinc
+ skeleff
+ speed
+ splice
+ stat
+ stats
+ stretch
+ swap
+ synth
+ tempo
+ tremolo
+ trim
+ upsample
+ vad
+ vol
+)
+set(formats_srcs
+ 8svx
+ adpcm
+ adpcms
+ aifc-fmt
+ aiff
+ aiff-fmt
+ al-fmt
+ au
+ avr
+ cdr
+ cvsd
+ cvsd-fmt
+ dat
+ dvms-fmt
+ f4-fmt
+ f8-fmt
+ g711
+ g721
+ g723_24
+ g723_40
+ g72x
+ gsm
+ gsrt
+ hcom
+ htk
+ ima-fmt
+ ima_rw
+ la-fmt
+ lpc10
+ lu-fmt
+ maud
+ nulfile
+ prc
+ raw
+ raw-fmt
+ s1-fmt
+ s2-fmt
+ s3-fmt
+ s4-fmt
+ sf
+ skelform
+ smp
+ sounder
+ soundtool
+ sox-fmt
+ sphere
+ tx16w
+ u1-fmt
+ u2-fmt
+ u3-fmt
+ u4-fmt
+ ul-fmt
+ voc
+ vox
+ vox-fmt
+ wav
+ wve
+ xa
+)
+
+# Uncomment for bit-rot detection on linux
+#set(formats_srcs ${formats_srcs} coreaudio sndio sunaudio waveaudio)
+#add_definitions(-Ibit-rot)
+
+add_library(lib${PROJECT_NAME}
+ effects formats_i libsox_i
+ effects_i ${formats_srcs} ${optional_srcs}
+ effects_i_dsp getopt
+ ${effects_srcs} util
+ formats libsox xmalloc
+)
+add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c)
+target_link_libraries(${PROJECT_NAME} lib${PROJECT_NAME} lpc10 ${optional_libs})
+add_executable(sox_sample_test sox_sample_test.c)
+add_executable(example0 example0.c)
+target_link_libraries(example0 lib${PROJECT_NAME} lpc10 ${optional_libs})
+add_executable(example1 example1.c)
+target_link_libraries(example1 lib${PROJECT_NAME} lpc10 ${optional_libs})
+add_executable(example2 example2.c)
+target_link_libraries(example2 lib${PROJECT_NAME} lpc10 ${optional_libs})
+add_executable(example3 example3.c)
+target_link_libraries(example3 lib${PROJECT_NAME} lpc10 ${optional_libs})
+add_executable(example4 example4.c)
+target_link_libraries(example4 lib${PROJECT_NAME} lpc10 ${optional_libs})
+add_executable(example5 example5.c)
+target_link_libraries(example5 lib${PROJECT_NAME} lpc10 ${optional_libs})
+add_executable(example6 example6.c)
+target_link_libraries(example6 lib${PROJECT_NAME} lpc10 ${optional_libs})
+find_program(LN ln)
+if (LN)
+ add_custom_target(rec ALL ${LN} -sf sox rec DEPENDS sox)
+ add_custom_target(play ALL ${LN} -sf sox play DEPENDS sox)
+ add_custom_target(soxi ALL ${LN} -sf sox soxi DEPENDS sox)
+endif (LN)
+find_program(CTAGS NAMES exuberant-ctags ctags)
+add_custom_target(tags ${CTAGS} --recurse --extra=fq ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/src/src/Makefile.am b/src/src/Makefile.am
new file mode 100644
index 0000000..7cceaaf
--- /dev/null
+++ b/src/src/Makefile.am
@@ -0,0 +1,199 @@
+## Process this file with automake to produce Makefile.in
+
+RM = rm -f
+
+AM_CPPFLAGS = -DLADSPA_PATH="\"@LADSPA_PATH@\""
+AM_CFLAGS = @WARN_CFLAGS@ #-Werror
+
+if HAVE_LIBLTDL
+# This is being used as a short cut to turn off versioning of ALL dynamic
+# fmt libraries. If any fmt ever needs to add a specific LDFLAGS
+# then it will need to also add -avoid-version because AM_LDFLAGS
+# is ignored when you specify a more specific one.
+# We want to version libsox and we are OK because they
+# have a more specific LDFLAGS that includes -version-info.
+AM_LDFLAGS = -avoid-version -module
+AM_CPPFLAGS += -DPKGLIBDIR="\"$(pkglibdir)\""
+endif
+if HAVE_WIN32_LTDL
+# Must match line above.
+AM_LDFLAGS = -avoid-version -module
+AM_CPPFLAGS += -DPKGLIBDIR="\"$(pkglibdir)\""
+endif
+
+# Pass flags from --enable-silent-libtool
+LIBTOOL = @LIBTOOL@ @LIBTOOLFLAGS@
+
+if HAVE_DISTRO
+AM_CPPFLAGS += -DDISTRO="\"@DISTRO@\""
+endif
+
+
+
+#########################
+# SoX - the application #
+#########################
+
+bin_PROGRAMS = sox
+EXTRA_PROGRAMS = example0 example1 example2 example3 example4 example5 example6 sox_sample_test
+lib_LTLIBRARIES = libsox.la
+include_HEADERS = sox.h
+sox_SOURCES = sox.c
+if HAVE_WIN32_GLOB
+sox_SOURCES += win32-glob.c win32-glob.h
+endif
+sox_LDADD = libsox.la
+example0_SOURCES = example0.c
+example1_SOURCES = example1.c
+example2_SOURCES = example2.c
+example3_SOURCES = example3.c
+example4_SOURCES = example4.c
+example5_SOURCES = example5.c
+example6_SOURCES = example6.c
+sox_sample_test_SOURCES = sox_sample_test.c sox_sample_test.h
+
+
+
+######################################################
+# libsox - file format, effects, and utility library #
+######################################################
+
+# Format handlers and utils source
+libsox_la_SOURCES = adpcms.c adpcms.h aiff.c aiff.h cvsd.c cvsd.h cvsdfilt.h \
+ g711.c g711.h g721.c g723_24.c g723_40.c g72x.c g72x.h vox.c vox.h \
+ raw.c raw.h formats.c formats.h formats_i.c sox_i.h skelform.c \
+ xmalloc.c xmalloc.h getopt.c \
+ util.c util.h libsox.c libsox_i.c sox-fmt.c soxomp.h
+
+# Effects source
+libsox_la_SOURCES += \
+ band.h bend.c biquad.c biquad.h biquads.c chorus.c compand.c \
+ compandt.c compandt.h contrast.c dcshift.c delay.c dft_filter.c \
+ dft_filter.h dither.c dither.h divide.c downsample.c earwax.c \
+ echo.c echos.c effects.c effects.h effects_i.c effects_i_dsp.c \
+ fade.c fft4g.c fft4g.h fifo.h fir.c firfit.c flanger.c gain.c \
+ hilbert.c input.c ladspa.h ladspa.c loudness.c mcompand.c \
+ mcompand_xover.h noiseprof.c noisered.c \
+ noisered.h output.c overdrive.c pad.c phaser.c rate.c \
+ rate_filters.h rate_half_fir.h rate_poly_fir0.h rate_poly_fir.h \
+ remix.c repeat.c reverb.c reverse.c silence.c sinc.c skeleff.c \
+ speed.c splice.c stat.c stats.c stretch.c swap.c \
+ synth.c tempo.c tremolo.c trim.c upsample.c vad.c vol.c \
+ ignore-warning.h
+if HAVE_PNG
+ libsox_la_SOURCES += spectrogram.c
+endif
+
+# Libraries required by libsox for file handlers, effects, or utils;
+# regardless if libltdl is used or not.
+libsox_la_LIBADD = @PNG_LIBS@
+if HAVE_MAGIC
+libsox_la_LIBADD += @MAGIC_LIBS@
+endif
+
+libsox_la_LIBADD += @GOMP_LIBS@
+
+libsox_la_CFLAGS = @WARN_CFLAGS@
+libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \
+ -export-symbols-regex '^(sox_.*|lsx_(check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|fail_errno|filelength|find_(enum_(text|value)|file_extension)|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$'
+
+if HAVE_WIN32_LTDL
+ libsox_la_SOURCES += win32-ltdl.c win32-ltdl.h
+endif
+
+if HAVE_LIBLTDL
+ libsox_la_CFLAGS += $(LTDLINCL)
+ libsox_la_LDFLAGS += $(LIBLTDL)
+endif
+
+
+
+#########################
+# libsox - File Formats #
+#########################
+
+# Uncomment for bit-rot detection on linux
+#libsox_la_SOURCES += coreaudio.c sndio.c sunaudio.c
+#libsox_la_CFLAGS += -Ibit-rot
+
+libsox_la_SOURCES += raw-fmt.c s1-fmt.c s2-fmt.c s3-fmt.c \
+ s4-fmt.c u1-fmt.c u2-fmt.c u3-fmt.c u4-fmt.c al-fmt.c la-fmt.c ul-fmt.c \
+ lu-fmt.c 8svx.c aiff-fmt.c aifc-fmt.c au.c avr.c cdr.c cvsd-fmt.c \
+ dvms-fmt.c dat.c hcom.c htk.c maud.c prc.c sf.c smp.c \
+ sounder.c soundtool.c sphere.c tx16w.c voc.c vox-fmt.c ima-fmt.c adpcm.c adpcm.h \
+ ima_rw.c ima_rw.h wav.c wve.c xa.c nulfile.c f4-fmt.c f8-fmt.c gsrt.c
+
+libsox_la_LIBADD += @GSM_LIBS@ @LIBGSM_LIBADD@
+libsox_la_LIBADD += @LPC10_LIBS@ @LIBLPC10_LIBADD@
+
+pkglib_LTLIBRARIES =
+
+include optional-fmts.am
+
+
+
+# example programs will need same link options as sox does.
+example0_LDADD = ${sox_LDADD}
+example1_LDADD = ${sox_LDADD}
+example2_LDADD = ${sox_LDADD}
+example3_LDADD = ${sox_LDADD}
+example4_LDADD = ${sox_LDADD}
+example5_LDADD = ${sox_LDADD}
+example6_LDADD = ${sox_LDADD}
+
+EXTRA_DIST = monkey.wav optional-fmts.am \
+ CMakeLists.txt soxconfig.h.cmake \
+ tests.sh testall.sh tests.bat testall.bat test-comments
+
+all: sox$(EXEEXT) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT) sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT)
+
+play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT): sox$(EXEEXT)
+ if test "$(PLAYRECLINKS)" = "yes"; then \
+ test -f sox$(EXEEXT) && ( $(RM) $@ && $(LN_S) sox$(EXEEXT) $@ ) || $(LN_S) sox $@; \
+ fi
+
+install-exec-hook:
+ if test "$(PLAYRECLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) play$(EXEEXT) rec$(EXEEXT); $(LN_S) sox$(EXEEXT) play$(EXEEXT); $(LN_S) sox$(EXEEXT) rec$(EXEEXT); \
+ fi
+ if test "$(SYMLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); $(LN_S) sox$(EXEEXT) soxi$(EXEEXT); \
+ fi
+
+uninstall-hook:
+ if test "$(PLAYRECLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) play$(EXTEXT) rec$(EXEEXT); \
+ fi
+ if test "$(SYMLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); \
+ fi
+
+clean-local:
+ $(RM) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT)
+ $(RM) sox_sample_test$(EXEEXT)
+ $(RM) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT)
+
+distclean-local:
+
+loc:
+ sloccount \
+ $(include_HEADERS) \
+ $(sox_SOURCES) \
+ $(example0_SOURCES) \
+ $(example1_SOURCES) \
+ $(example2_SOURCES) \
+ $(example3_SOURCES) \
+ $(example4_SOURCES) \
+ $(example5_SOURCES) \
+ $(example6_SOURCES) \
+ $(sox_sample_test_SOURCES) \
+ $(libsox_la_SOURCES)
+
+
+# Ideally we would use the "check" target so that "make distcheck"
+# would run the test suite, but an uninstalled libltdl build cannot
+# currently load its formats and effects, so the checks would fail.
+installcheck:
+ $(srcdir)/tests.sh --bindir=${bindir} --builddir=${builddir} --srcdir=${srcdir}
+ $(srcdir)/testall.sh --bindir=${bindir} --srcdir=${srcdir}
+
diff --git a/src/src/Makefile.in b/src/src/Makefile.in
new file mode 100644
index 0000000..529717e
--- /dev/null
+++ b/src/src/Makefile.in
@@ -0,0 +1,3076 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+@HAVE_LIBLTDL_TRUE@am__append_1 = -DPKGLIBDIR="\"$(pkglibdir)\""
+@HAVE_WIN32_LTDL_TRUE@am__append_2 = -DPKGLIBDIR="\"$(pkglibdir)\""
+@HAVE_DISTRO_TRUE@am__append_3 = -DDISTRO="\"@DISTRO@\""
+bin_PROGRAMS = sox$(EXEEXT)
+EXTRA_PROGRAMS = example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) \
+ example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) \
+ example6$(EXEEXT) sox_sample_test$(EXEEXT)
+@HAVE_WIN32_GLOB_TRUE@am__append_4 = win32-glob.c win32-glob.h
+@HAVE_PNG_TRUE@am__append_5 = spectrogram.c
+@HAVE_MAGIC_TRUE@am__append_6 = @MAGIC_LIBS@
+@HAVE_WIN32_LTDL_TRUE@am__append_7 = win32-ltdl.c win32-ltdl.h
+@HAVE_LIBLTDL_TRUE@am__append_8 = $(LTDLINCL)
+@HAVE_LIBLTDL_TRUE@am__append_9 = $(LIBLTDL)
+DIST_COMMON = $(srcdir)/optional-fmts.am $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.am $(srcdir)/soxconfig.h.in \
+ $(top_srcdir)/depcomp $(include_HEADERS)
+@HAVE_ALSA_TRUE@@STATIC_ALSA_TRUE@am__append_10 = alsa.c
+@HAVE_ALSA_TRUE@@STATIC_ALSA_TRUE@@STATIC_LIBSOX_ONLY_TRUE@am__append_11 = @ALSA_LIBS@
+@HAVE_ALSA_TRUE@@STATIC_ALSA_TRUE@@STATIC_LIBSOX_ONLY_FALSE@am__append_12 = @ALSA_LIBS@
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@am__append_13 = libsox_fmt_alsa.la
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_TRUE@am__append_14 = amr-nb.c amr.h
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_TRUE@@STATIC_LIBSOX_ONLY_TRUE@am__append_15 = @AMRNB_LIBS@
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_TRUE@@STATIC_LIBSOX_ONLY_FALSE@am__append_16 = @AMRNB_LIBS@
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@am__append_17 = libsox_fmt_amr_nb.la
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_TRUE@am__append_18 = amr-wb.c amr.h
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_TRUE@@STATIC_LIBSOX_ONLY_TRUE@am__append_19 = @AMRWB_LIBS@
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_TRUE@@STATIC_LIBSOX_ONLY_FALSE@am__append_20 = @AMRWB_LIBS@
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@am__append_21 = libsox_fmt_amr_wb.la
+@HAVE_AO_TRUE@@STATIC_AO_TRUE@am__append_22 = ao.c
+@HAVE_AO_TRUE@@STATIC_AO_TRUE@@STATIC_LIBSOX_ONLY_TRUE@am__append_23 = @AO_LIBS@
+@HAVE_AO_TRUE@@STATIC_AO_TRUE@@STATIC_LIBSOX_ONLY_FALSE@am__append_24 = @AO_LIBS@
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@am__append_25 = libsox_fmt_ao.la
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_TRUE@am__append_26 = coreaudio.c
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_TRUE@@STATIC_LIBSOX_ONLY_TRUE@am__append_27 = @COREAUDIO_LIBS@
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_TRUE@@STATIC_LIBSOX_ONLY_FALSE@am__append_28 = @COREAUDIO_LIBS@
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@am__append_29 = libsox_fmt_coreaudio.la
+@HAVE_FLAC_TRUE@@STATIC_FLAC_TRUE@am__append_30 = flac.c
+@HAVE_FLAC_TRUE@@STATIC_FLAC_TRUE@@STATIC_LIBSOX_ONLY_TRUE@am__append_31 = @FLAC_LIBS@
+@HAVE_FLAC_TRUE@@STATIC_FLAC_TRUE@@STATIC_LIBSOX_ONLY_FALSE@am__append_32 = @FLAC_LIBS@
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@am__append_33 = libsox_fmt_flac.la
+@HAVE_GSM_TRUE@@STATIC_GSM_TRUE@am__append_34 = gsm.c
+@HAVE_GSM_TRUE@@STATIC_GSM_TRUE@@STATIC_LIBSOX_ONLY_TRUE@am__append_35 = @GSM_LIBS@
+@HAVE_GSM_TRUE@@STATIC_GSM_TRUE@@STATIC_LIBSOX_ONLY_FALSE@am__append_36 = @GSM_LIBS@
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@am__append_37 = libsox_fmt_gsm.la
+@HAVE_LPC10_TRUE@@STATIC_LPC10_TRUE@am__append_38 = lpc10.c
+@HAVE_LPC10_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_LPC10_TRUE@am__append_39 = @LPC10_LIBS@
+@HAVE_LPC10_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_LPC10_TRUE@am__append_40 = @LPC10_LIBS@
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@am__append_41 = libsox_fmt_lpc10.la
+@HAVE_MP3_TRUE@@STATIC_MP3_TRUE@am__append_42 = mp3.c mp3-util.h
+@HAVE_MP3_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_MP3_TRUE@am__append_43 = @MP3_LIBS@
+@HAVE_MP3_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_MP3_TRUE@am__append_44 = @MP3_LIBS@
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@am__append_45 = libsox_fmt_mp3.la
+@HAVE_OPUS_TRUE@@STATIC_OPUS_TRUE@am__append_46 = opus.c
+@HAVE_OPUS_TRUE@@STATIC_OPUS_TRUE@am__append_47 = @OPUS_CFLAGS@
+@HAVE_OPUS_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_OPUS_TRUE@am__append_48 = @OPUS_LIBS@
+@HAVE_OPUS_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_OPUS_TRUE@am__append_49 = @OPUS_LIBS@
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@am__append_50 = libsox_fmt_opus.la
+@HAVE_OSS_TRUE@@STATIC_OSS_TRUE@am__append_51 = oss.c
+@HAVE_OSS_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_OSS_TRUE@am__append_52 = @OSS_LIBS@
+@HAVE_OSS_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_OSS_TRUE@am__append_53 = @OSS_LIBS@
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@am__append_54 = libsox_fmt_oss.la
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_TRUE@am__append_55 = pulseaudio.c
+@HAVE_PULSEAUDIO_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_PULSEAUDIO_TRUE@am__append_56 = @PULSEAUDIO_LIBS@
+@HAVE_PULSEAUDIO_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_PULSEAUDIO_TRUE@am__append_57 = @PULSEAUDIO_LIBS@
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@am__append_58 = libsox_fmt_pulseaudio.la
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_TRUE@am__append_59 = waveaudio.c
+@HAVE_WAVEAUDIO_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_WAVEAUDIO_TRUE@am__append_60 = @WAVEAUDIO_LIBS@
+@HAVE_WAVEAUDIO_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_WAVEAUDIO_TRUE@am__append_61 = @WAVEAUDIO_LIBS@
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@am__append_62 = libsox_fmt_waveaudio.la
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_TRUE@am__append_63 = sndio.c
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_TRUE@am__append_64 = @SNDIO_LIBS@
+@HAVE_SNDIO_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_SNDIO_TRUE@am__append_65 = @SNDIO_LIBS@
+@HAVE_SNDIO_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_SNDIO_TRUE@am__append_66 = @SNDIO_LIBS@
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@am__append_67 = libsox_fmt_sndio.la
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_TRUE@am__append_68 = sunaudio.c
+@HAVE_SUN_AUDIO_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_SUN_AUDIO_TRUE@am__append_69 = @SUN_AUDIO_LIBS@
+@HAVE_SUN_AUDIO_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_SUN_AUDIO_TRUE@am__append_70 = @SUN_AUDIO_LIBS@
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@am__append_71 = libsox_fmt_sunau.la
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_TRUE@am__append_72 = vorbis.c
+@HAVE_OGG_VORBIS_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_OGG_VORBIS_TRUE@am__append_73 = @OGG_VORBIS_LIBS@
+@HAVE_OGG_VORBIS_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_OGG_VORBIS_TRUE@am__append_74 = @OGG_VORBIS_LIBS@
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@am__append_75 = libsox_fmt_vorbis.la
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_TRUE@am__append_76 = wavpack.c
+@HAVE_WAVPACK_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_WAVPACK_TRUE@am__append_77 = @WAVPACK_LIBS@
+@HAVE_WAVPACK_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_WAVPACK_TRUE@am__append_78 = @WAVPACK_LIBS@
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@am__append_79 = libsox_fmt_wavpack.la
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@am__append_80 = sndfile.c caf.c mat4.c mat5.c paf.c fap.c w64.c xi.c pvf.c sd2.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@am__append_81 = @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_LIBSOX_ONLY_TRUE@@STATIC_SNDFILE_TRUE@am__append_82 = @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_LIBSOX_ONLY_FALSE@@STATIC_SNDFILE_TRUE@am__append_83 = @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am__append_84 = libsox_fmt_sndfile.la libsox_fmt_caf.la libsox_fmt_mat4.la libsox_fmt_mat5.la libsox_fmt_paf.la libsox_fmt_fap.la libsox_fmt_w64.la libsox_fmt_xi.la libsox_fmt_pvf.la libsox_fmt_sd2.la
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gcc_stack_protect.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/optional-fmt.m4 $(top_srcdir)/m4/sndfile.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = soxconfig.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkglibdir)" \
+ "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES) $(pkglib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libsox_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__libsox_la_SOURCES_DIST = adpcms.c adpcms.h aiff.c aiff.h cvsd.c \
+ cvsd.h cvsdfilt.h g711.c g711.h g721.c g723_24.c g723_40.c \
+ g72x.c g72x.h vox.c vox.h raw.c raw.h formats.c formats.h \
+ formats_i.c sox_i.h skelform.c xmalloc.c xmalloc.h getopt.c \
+ util.c util.h libsox.c libsox_i.c sox-fmt.c soxomp.h band.h \
+ bend.c biquad.c biquad.h biquads.c chorus.c compand.c \
+ compandt.c compandt.h contrast.c dcshift.c delay.c \
+ dft_filter.c dft_filter.h dither.c dither.h divide.c \
+ downsample.c earwax.c echo.c echos.c effects.c effects.h \
+ effects_i.c effects_i_dsp.c fade.c fft4g.c fft4g.h fifo.h \
+ fir.c firfit.c flanger.c gain.c hilbert.c input.c ladspa.h \
+ ladspa.c loudness.c mcompand.c mcompand_xover.h noiseprof.c \
+ noisered.c noisered.h output.c overdrive.c pad.c phaser.c \
+ rate.c rate_filters.h rate_half_fir.h rate_poly_fir0.h \
+ rate_poly_fir.h remix.c repeat.c reverb.c reverse.c silence.c \
+ sinc.c skeleff.c speed.c splice.c stat.c stats.c stretch.c \
+ swap.c synth.c tempo.c tremolo.c trim.c upsample.c vad.c vol.c \
+ ignore-warning.h spectrogram.c win32-ltdl.c win32-ltdl.h \
+ raw-fmt.c s1-fmt.c s2-fmt.c s3-fmt.c s4-fmt.c u1-fmt.c \
+ u2-fmt.c u3-fmt.c u4-fmt.c al-fmt.c la-fmt.c ul-fmt.c lu-fmt.c \
+ 8svx.c aiff-fmt.c aifc-fmt.c au.c avr.c cdr.c cvsd-fmt.c \
+ dvms-fmt.c dat.c hcom.c htk.c maud.c prc.c sf.c smp.c \
+ sounder.c soundtool.c sphere.c tx16w.c voc.c vox-fmt.c \
+ ima-fmt.c adpcm.c adpcm.h ima_rw.c ima_rw.h wav.c wve.c xa.c \
+ nulfile.c f4-fmt.c f8-fmt.c gsrt.c alsa.c amr-nb.c amr.h \
+ amr-wb.c ao.c coreaudio.c flac.c gsm.c lpc10.c mp3.c \
+ mp3-util.h opus.c oss.c pulseaudio.c waveaudio.c sndio.c \
+ sunaudio.c vorbis.c wavpack.c sndfile.c caf.c mat4.c mat5.c \
+ paf.c fap.c w64.c xi.c pvf.c sd2.c
+@HAVE_PNG_TRUE@am__objects_1 = libsox_la-spectrogram.lo
+@HAVE_WIN32_LTDL_TRUE@am__objects_2 = libsox_la-win32-ltdl.lo
+@HAVE_ALSA_TRUE@@STATIC_ALSA_TRUE@am__objects_3 = libsox_la-alsa.lo
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_TRUE@am__objects_4 = \
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_TRUE@ libsox_la-amr-nb.lo
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_TRUE@am__objects_5 = \
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_TRUE@ libsox_la-amr-wb.lo
+@HAVE_AO_TRUE@@STATIC_AO_TRUE@am__objects_6 = libsox_la-ao.lo
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_TRUE@am__objects_7 = libsox_la-coreaudio.lo
+@HAVE_FLAC_TRUE@@STATIC_FLAC_TRUE@am__objects_8 = libsox_la-flac.lo
+@HAVE_GSM_TRUE@@STATIC_GSM_TRUE@am__objects_9 = libsox_la-gsm.lo
+@HAVE_LPC10_TRUE@@STATIC_LPC10_TRUE@am__objects_10 = \
+@HAVE_LPC10_TRUE@@STATIC_LPC10_TRUE@ libsox_la-lpc10.lo
+@HAVE_MP3_TRUE@@STATIC_MP3_TRUE@am__objects_11 = libsox_la-mp3.lo
+@HAVE_OPUS_TRUE@@STATIC_OPUS_TRUE@am__objects_12 = libsox_la-opus.lo
+@HAVE_OSS_TRUE@@STATIC_OSS_TRUE@am__objects_13 = libsox_la-oss.lo
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_TRUE@am__objects_14 = libsox_la-pulseaudio.lo
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_TRUE@am__objects_15 = libsox_la-waveaudio.lo
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_TRUE@am__objects_16 = \
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_TRUE@ libsox_la-sndio.lo
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_TRUE@am__objects_17 = libsox_la-sunaudio.lo
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_TRUE@am__objects_18 = libsox_la-vorbis.lo
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_TRUE@am__objects_19 = \
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_TRUE@ libsox_la-wavpack.lo
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@am__objects_20 = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-sndfile.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-caf.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-mat4.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-mat5.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-paf.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-fap.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-w64.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-xi.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-pvf.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_TRUE@ libsox_la-sd2.lo
+am_libsox_la_OBJECTS = libsox_la-adpcms.lo libsox_la-aiff.lo \
+ libsox_la-cvsd.lo libsox_la-g711.lo libsox_la-g721.lo \
+ libsox_la-g723_24.lo libsox_la-g723_40.lo libsox_la-g72x.lo \
+ libsox_la-vox.lo libsox_la-raw.lo libsox_la-formats.lo \
+ libsox_la-formats_i.lo libsox_la-skelform.lo \
+ libsox_la-xmalloc.lo libsox_la-getopt.lo libsox_la-util.lo \
+ libsox_la-libsox.lo libsox_la-libsox_i.lo libsox_la-sox-fmt.lo \
+ libsox_la-bend.lo libsox_la-biquad.lo libsox_la-biquads.lo \
+ libsox_la-chorus.lo libsox_la-compand.lo libsox_la-compandt.lo \
+ libsox_la-contrast.lo libsox_la-dcshift.lo libsox_la-delay.lo \
+ libsox_la-dft_filter.lo libsox_la-dither.lo \
+ libsox_la-divide.lo libsox_la-downsample.lo \
+ libsox_la-earwax.lo libsox_la-echo.lo libsox_la-echos.lo \
+ libsox_la-effects.lo libsox_la-effects_i.lo \
+ libsox_la-effects_i_dsp.lo libsox_la-fade.lo \
+ libsox_la-fft4g.lo libsox_la-fir.lo libsox_la-firfit.lo \
+ libsox_la-flanger.lo libsox_la-gain.lo libsox_la-hilbert.lo \
+ libsox_la-input.lo libsox_la-ladspa.lo libsox_la-loudness.lo \
+ libsox_la-mcompand.lo libsox_la-noiseprof.lo \
+ libsox_la-noisered.lo libsox_la-output.lo \
+ libsox_la-overdrive.lo libsox_la-pad.lo libsox_la-phaser.lo \
+ libsox_la-rate.lo libsox_la-remix.lo libsox_la-repeat.lo \
+ libsox_la-reverb.lo libsox_la-reverse.lo libsox_la-silence.lo \
+ libsox_la-sinc.lo libsox_la-skeleff.lo libsox_la-speed.lo \
+ libsox_la-splice.lo libsox_la-stat.lo libsox_la-stats.lo \
+ libsox_la-stretch.lo libsox_la-swap.lo libsox_la-synth.lo \
+ libsox_la-tempo.lo libsox_la-tremolo.lo libsox_la-trim.lo \
+ libsox_la-upsample.lo libsox_la-vad.lo libsox_la-vol.lo \
+ $(am__objects_1) $(am__objects_2) libsox_la-raw-fmt.lo \
+ libsox_la-s1-fmt.lo libsox_la-s2-fmt.lo libsox_la-s3-fmt.lo \
+ libsox_la-s4-fmt.lo libsox_la-u1-fmt.lo libsox_la-u2-fmt.lo \
+ libsox_la-u3-fmt.lo libsox_la-u4-fmt.lo libsox_la-al-fmt.lo \
+ libsox_la-la-fmt.lo libsox_la-ul-fmt.lo libsox_la-lu-fmt.lo \
+ libsox_la-8svx.lo libsox_la-aiff-fmt.lo libsox_la-aifc-fmt.lo \
+ libsox_la-au.lo libsox_la-avr.lo libsox_la-cdr.lo \
+ libsox_la-cvsd-fmt.lo libsox_la-dvms-fmt.lo libsox_la-dat.lo \
+ libsox_la-hcom.lo libsox_la-htk.lo libsox_la-maud.lo \
+ libsox_la-prc.lo libsox_la-sf.lo libsox_la-smp.lo \
+ libsox_la-sounder.lo libsox_la-soundtool.lo \
+ libsox_la-sphere.lo libsox_la-tx16w.lo libsox_la-voc.lo \
+ libsox_la-vox-fmt.lo libsox_la-ima-fmt.lo libsox_la-adpcm.lo \
+ libsox_la-ima_rw.lo libsox_la-wav.lo libsox_la-wve.lo \
+ libsox_la-xa.lo libsox_la-nulfile.lo libsox_la-f4-fmt.lo \
+ libsox_la-f8-fmt.lo libsox_la-gsrt.lo $(am__objects_3) \
+ $(am__objects_4) $(am__objects_5) $(am__objects_6) \
+ $(am__objects_7) $(am__objects_8) $(am__objects_9) \
+ $(am__objects_10) $(am__objects_11) $(am__objects_12) \
+ $(am__objects_13) $(am__objects_14) $(am__objects_15) \
+ $(am__objects_16) $(am__objects_17) $(am__objects_18) \
+ $(am__objects_19) $(am__objects_20)
+libsox_la_OBJECTS = $(am_libsox_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libsox_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libsox_la_CFLAGS) \
+ $(CFLAGS) $(libsox_la_LDFLAGS) $(LDFLAGS) -o $@
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@libsox_fmt_alsa_la_DEPENDENCIES = \
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@ libsox.la
+am__libsox_fmt_alsa_la_SOURCES_DIST = alsa.c
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@am_libsox_fmt_alsa_la_OBJECTS = \
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@ alsa.lo
+libsox_fmt_alsa_la_OBJECTS = $(am_libsox_fmt_alsa_la_OBJECTS)
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@am_libsox_fmt_alsa_la_rpath = \
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@ -rpath $(pkglibdir)
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@libsox_fmt_amr_nb_la_DEPENDENCIES = \
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@ libsox.la
+am__libsox_fmt_amr_nb_la_SOURCES_DIST = amr-nb.c amr.h
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@am_libsox_fmt_amr_nb_la_OBJECTS = \
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@ amr-nb.lo
+libsox_fmt_amr_nb_la_OBJECTS = $(am_libsox_fmt_amr_nb_la_OBJECTS)
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@am_libsox_fmt_amr_nb_la_rpath = \
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@ -rpath $(pkglibdir)
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@libsox_fmt_amr_wb_la_DEPENDENCIES = \
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@ libsox.la
+am__libsox_fmt_amr_wb_la_SOURCES_DIST = amr-wb.c amr.h
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@am_libsox_fmt_amr_wb_la_OBJECTS = \
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@ amr-wb.lo
+libsox_fmt_amr_wb_la_OBJECTS = $(am_libsox_fmt_amr_wb_la_OBJECTS)
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@am_libsox_fmt_amr_wb_la_rpath = \
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@ -rpath $(pkglibdir)
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@libsox_fmt_ao_la_DEPENDENCIES = \
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@ libsox.la
+am__libsox_fmt_ao_la_SOURCES_DIST = ao.c
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@am_libsox_fmt_ao_la_OBJECTS = ao.lo
+libsox_fmt_ao_la_OBJECTS = $(am_libsox_fmt_ao_la_OBJECTS)
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@am_libsox_fmt_ao_la_rpath = -rpath \
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@ $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_caf_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_caf_la_SOURCES_DIST = caf.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_caf_la_OBJECTS = libsox_fmt_caf_la-caf.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox_fmt_caf_la-sndfile.lo
+libsox_fmt_caf_la_OBJECTS = $(am_libsox_fmt_caf_la_OBJECTS)
+libsox_fmt_caf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_caf_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_caf_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@libsox_fmt_coreaudio_la_DEPENDENCIES = \
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@ libsox.la
+am__libsox_fmt_coreaudio_la_SOURCES_DIST = coreaudio.c
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@am_libsox_fmt_coreaudio_la_OBJECTS = \
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@ coreaudio.lo
+libsox_fmt_coreaudio_la_OBJECTS = \
+ $(am_libsox_fmt_coreaudio_la_OBJECTS)
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@am_libsox_fmt_coreaudio_la_rpath = \
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@ -rpath \
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@ $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_fap_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_fap_la_SOURCES_DIST = fap.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_fap_la_OBJECTS = libsox_fmt_fap_la-fap.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox_fmt_fap_la-sndfile.lo
+libsox_fmt_fap_la_OBJECTS = $(am_libsox_fmt_fap_la_OBJECTS)
+libsox_fmt_fap_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_fap_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_fap_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@libsox_fmt_flac_la_DEPENDENCIES = \
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@ libsox.la
+am__libsox_fmt_flac_la_SOURCES_DIST = flac.c
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@am_libsox_fmt_flac_la_OBJECTS = \
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@ flac.lo
+libsox_fmt_flac_la_OBJECTS = $(am_libsox_fmt_flac_la_OBJECTS)
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@am_libsox_fmt_flac_la_rpath = \
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@ -rpath $(pkglibdir)
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@libsox_fmt_gsm_la_DEPENDENCIES = \
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@ libsox.la
+am__libsox_fmt_gsm_la_SOURCES_DIST = gsm.c
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@am_libsox_fmt_gsm_la_OBJECTS = \
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@ gsm.lo
+libsox_fmt_gsm_la_OBJECTS = $(am_libsox_fmt_gsm_la_OBJECTS)
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@am_libsox_fmt_gsm_la_rpath = -rpath \
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@ $(pkglibdir)
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@libsox_fmt_lpc10_la_DEPENDENCIES = \
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@ libsox.la
+am__libsox_fmt_lpc10_la_SOURCES_DIST = lpc10.c
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@am_libsox_fmt_lpc10_la_OBJECTS = \
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@ lpc10.lo
+libsox_fmt_lpc10_la_OBJECTS = $(am_libsox_fmt_lpc10_la_OBJECTS)
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@am_libsox_fmt_lpc10_la_rpath = \
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@ -rpath $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat4_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_mat4_la_SOURCES_DIST = mat4.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_mat4_la_OBJECTS = libsox_fmt_mat4_la-mat4.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox_fmt_mat4_la-sndfile.lo
+libsox_fmt_mat4_la_OBJECTS = $(am_libsox_fmt_mat4_la_OBJECTS)
+libsox_fmt_mat4_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_mat4_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_mat4_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat5_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_mat5_la_SOURCES_DIST = mat5.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_mat5_la_OBJECTS = libsox_fmt_mat5_la-mat5.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox_fmt_mat5_la-sndfile.lo
+libsox_fmt_mat5_la_OBJECTS = $(am_libsox_fmt_mat5_la_OBJECTS)
+libsox_fmt_mat5_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_mat5_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_mat5_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@libsox_fmt_mp3_la_DEPENDENCIES = \
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@ libsox.la
+am__libsox_fmt_mp3_la_SOURCES_DIST = mp3.c mp3-util.h
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@am_libsox_fmt_mp3_la_OBJECTS = \
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@ mp3.lo
+libsox_fmt_mp3_la_OBJECTS = $(am_libsox_fmt_mp3_la_OBJECTS)
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@am_libsox_fmt_mp3_la_rpath = -rpath \
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@ $(pkglibdir)
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@libsox_fmt_opus_la_DEPENDENCIES = \
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@ libsox.la
+am__libsox_fmt_opus_la_SOURCES_DIST = opus.c
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@am_libsox_fmt_opus_la_OBJECTS = \
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@ libsox_fmt_opus_la-opus.lo
+libsox_fmt_opus_la_OBJECTS = $(am_libsox_fmt_opus_la_OBJECTS)
+libsox_fmt_opus_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_opus_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@am_libsox_fmt_opus_la_rpath = \
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@ -rpath $(pkglibdir)
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@libsox_fmt_oss_la_DEPENDENCIES = \
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@ libsox.la
+am__libsox_fmt_oss_la_SOURCES_DIST = oss.c
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@am_libsox_fmt_oss_la_OBJECTS = \
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@ oss.lo
+libsox_fmt_oss_la_OBJECTS = $(am_libsox_fmt_oss_la_OBJECTS)
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@am_libsox_fmt_oss_la_rpath = -rpath \
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@ $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_paf_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_paf_la_SOURCES_DIST = paf.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_paf_la_OBJECTS = libsox_fmt_paf_la-paf.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox_fmt_paf_la-sndfile.lo
+libsox_fmt_paf_la_OBJECTS = $(am_libsox_fmt_paf_la_OBJECTS)
+libsox_fmt_paf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_paf_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_paf_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@libsox_fmt_pulseaudio_la_DEPENDENCIES = \
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@ libsox.la
+am__libsox_fmt_pulseaudio_la_SOURCES_DIST = pulseaudio.c
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@am_libsox_fmt_pulseaudio_la_OBJECTS = \
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@ pulseaudio.lo
+libsox_fmt_pulseaudio_la_OBJECTS = \
+ $(am_libsox_fmt_pulseaudio_la_OBJECTS)
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@am_libsox_fmt_pulseaudio_la_rpath = \
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@ -rpath \
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@ $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_pvf_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_pvf_la_SOURCES_DIST = pvf.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_pvf_la_OBJECTS = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ pvf.lo sndfile.lo
+libsox_fmt_pvf_la_OBJECTS = $(am_libsox_fmt_pvf_la_OBJECTS)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_pvf_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sd2_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_sd2_la_SOURCES_DIST = sd2.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_sd2_la_OBJECTS = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ sd2.lo sndfile.lo
+libsox_fmt_sd2_la_OBJECTS = $(am_libsox_fmt_sd2_la_OBJECTS)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_sd2_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sndfile_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_sndfile_la_SOURCES_DIST = sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_sndfile_la_OBJECTS = libsox_fmt_sndfile_la-sndfile.lo
+libsox_fmt_sndfile_la_OBJECTS = $(am_libsox_fmt_sndfile_la_OBJECTS)
+libsox_fmt_sndfile_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_sndfile_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_sndfile_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@libsox_fmt_sndio_la_DEPENDENCIES = \
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@ libsox.la
+am__libsox_fmt_sndio_la_SOURCES_DIST = sndio.c
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@am_libsox_fmt_sndio_la_OBJECTS = \
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@ sndio.lo
+libsox_fmt_sndio_la_OBJECTS = $(am_libsox_fmt_sndio_la_OBJECTS)
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@am_libsox_fmt_sndio_la_rpath = \
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@ -rpath $(pkglibdir)
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@libsox_fmt_sunau_la_DEPENDENCIES = \
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@ libsox.la
+am__libsox_fmt_sunau_la_SOURCES_DIST = sunaudio.c
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@am_libsox_fmt_sunau_la_OBJECTS = \
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@ sunaudio.lo
+libsox_fmt_sunau_la_OBJECTS = $(am_libsox_fmt_sunau_la_OBJECTS)
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@am_libsox_fmt_sunau_la_rpath = \
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@ -rpath \
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@ $(pkglibdir)
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@libsox_fmt_vorbis_la_DEPENDENCIES = \
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@ libsox.la
+am__libsox_fmt_vorbis_la_SOURCES_DIST = vorbis.c
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@am_libsox_fmt_vorbis_la_OBJECTS = \
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@ vorbis.lo
+libsox_fmt_vorbis_la_OBJECTS = $(am_libsox_fmt_vorbis_la_OBJECTS)
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@am_libsox_fmt_vorbis_la_rpath = \
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@ -rpath \
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@ $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_w64_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_w64_la_SOURCES_DIST = w64.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_w64_la_OBJECTS = libsox_fmt_w64_la-w64.lo \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox_fmt_w64_la-sndfile.lo
+libsox_fmt_w64_la_OBJECTS = $(am_libsox_fmt_w64_la_OBJECTS)
+libsox_fmt_w64_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libsox_fmt_w64_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_w64_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@libsox_fmt_waveaudio_la_DEPENDENCIES = \
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@ libsox.la
+am__libsox_fmt_waveaudio_la_SOURCES_DIST = waveaudio.c
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@am_libsox_fmt_waveaudio_la_OBJECTS = \
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@ waveaudio.lo
+libsox_fmt_waveaudio_la_OBJECTS = \
+ $(am_libsox_fmt_waveaudio_la_OBJECTS)
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@am_libsox_fmt_waveaudio_la_rpath = \
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@ -rpath \
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@ $(pkglibdir)
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@libsox_fmt_wavpack_la_DEPENDENCIES = \
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@ libsox.la
+am__libsox_fmt_wavpack_la_SOURCES_DIST = wavpack.c
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@am_libsox_fmt_wavpack_la_OBJECTS = \
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@ wavpack.lo
+libsox_fmt_wavpack_la_OBJECTS = $(am_libsox_fmt_wavpack_la_OBJECTS)
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@am_libsox_fmt_wavpack_la_rpath = \
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@ -rpath $(pkglibdir)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_xi_la_DEPENDENCIES = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ libsox.la
+am__libsox_fmt_xi_la_SOURCES_DIST = xi.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_xi_la_OBJECTS = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ xi.lo sndfile.lo
+libsox_fmt_xi_la_OBJECTS = $(am_libsox_fmt_xi_la_OBJECTS)
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@am_libsox_fmt_xi_la_rpath = \
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@ -rpath $(pkglibdir)
+PROGRAMS = $(bin_PROGRAMS)
+am_example0_OBJECTS = example0.$(OBJEXT)
+example0_OBJECTS = $(am_example0_OBJECTS)
+am__DEPENDENCIES_2 = libsox.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+example0_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_example1_OBJECTS = example1.$(OBJEXT)
+example1_OBJECTS = $(am_example1_OBJECTS)
+example1_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_example2_OBJECTS = example2.$(OBJEXT)
+example2_OBJECTS = $(am_example2_OBJECTS)
+example2_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_example3_OBJECTS = example3.$(OBJEXT)
+example3_OBJECTS = $(am_example3_OBJECTS)
+example3_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_example4_OBJECTS = example4.$(OBJEXT)
+example4_OBJECTS = $(am_example4_OBJECTS)
+example4_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_example5_OBJECTS = example5.$(OBJEXT)
+example5_OBJECTS = $(am_example5_OBJECTS)
+example5_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am_example6_OBJECTS = example6.$(OBJEXT)
+example6_OBJECTS = $(am_example6_OBJECTS)
+example6_DEPENDENCIES = $(am__DEPENDENCIES_2)
+am__sox_SOURCES_DIST = sox.c win32-glob.c win32-glob.h
+@HAVE_WIN32_GLOB_TRUE@am__objects_21 = win32-glob.$(OBJEXT)
+am_sox_OBJECTS = sox.$(OBJEXT) $(am__objects_21)
+sox_OBJECTS = $(am_sox_OBJECTS)
+sox_DEPENDENCIES = libsox.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_sox_sample_test_OBJECTS = sox_sample_test.$(OBJEXT)
+sox_sample_test_OBJECTS = $(am_sox_sample_test_OBJECTS)
+sox_sample_test_LDADD = $(LDADD)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libsox_la_SOURCES) $(libsox_fmt_alsa_la_SOURCES) \
+ $(libsox_fmt_amr_nb_la_SOURCES) \
+ $(libsox_fmt_amr_wb_la_SOURCES) $(libsox_fmt_ao_la_SOURCES) \
+ $(libsox_fmt_caf_la_SOURCES) \
+ $(libsox_fmt_coreaudio_la_SOURCES) \
+ $(libsox_fmt_fap_la_SOURCES) $(libsox_fmt_flac_la_SOURCES) \
+ $(libsox_fmt_gsm_la_SOURCES) $(libsox_fmt_lpc10_la_SOURCES) \
+ $(libsox_fmt_mat4_la_SOURCES) $(libsox_fmt_mat5_la_SOURCES) \
+ $(libsox_fmt_mp3_la_SOURCES) $(libsox_fmt_opus_la_SOURCES) \
+ $(libsox_fmt_oss_la_SOURCES) $(libsox_fmt_paf_la_SOURCES) \
+ $(libsox_fmt_pulseaudio_la_SOURCES) \
+ $(libsox_fmt_pvf_la_SOURCES) $(libsox_fmt_sd2_la_SOURCES) \
+ $(libsox_fmt_sndfile_la_SOURCES) \
+ $(libsox_fmt_sndio_la_SOURCES) $(libsox_fmt_sunau_la_SOURCES) \
+ $(libsox_fmt_vorbis_la_SOURCES) $(libsox_fmt_w64_la_SOURCES) \
+ $(libsox_fmt_waveaudio_la_SOURCES) \
+ $(libsox_fmt_wavpack_la_SOURCES) $(libsox_fmt_xi_la_SOURCES) \
+ $(example0_SOURCES) $(example1_SOURCES) $(example2_SOURCES) \
+ $(example3_SOURCES) $(example4_SOURCES) $(example5_SOURCES) \
+ $(example6_SOURCES) $(sox_SOURCES) $(sox_sample_test_SOURCES)
+DIST_SOURCES = $(am__libsox_la_SOURCES_DIST) \
+ $(am__libsox_fmt_alsa_la_SOURCES_DIST) \
+ $(am__libsox_fmt_amr_nb_la_SOURCES_DIST) \
+ $(am__libsox_fmt_amr_wb_la_SOURCES_DIST) \
+ $(am__libsox_fmt_ao_la_SOURCES_DIST) \
+ $(am__libsox_fmt_caf_la_SOURCES_DIST) \
+ $(am__libsox_fmt_coreaudio_la_SOURCES_DIST) \
+ $(am__libsox_fmt_fap_la_SOURCES_DIST) \
+ $(am__libsox_fmt_flac_la_SOURCES_DIST) \
+ $(am__libsox_fmt_gsm_la_SOURCES_DIST) \
+ $(am__libsox_fmt_lpc10_la_SOURCES_DIST) \
+ $(am__libsox_fmt_mat4_la_SOURCES_DIST) \
+ $(am__libsox_fmt_mat5_la_SOURCES_DIST) \
+ $(am__libsox_fmt_mp3_la_SOURCES_DIST) \
+ $(am__libsox_fmt_opus_la_SOURCES_DIST) \
+ $(am__libsox_fmt_oss_la_SOURCES_DIST) \
+ $(am__libsox_fmt_paf_la_SOURCES_DIST) \
+ $(am__libsox_fmt_pulseaudio_la_SOURCES_DIST) \
+ $(am__libsox_fmt_pvf_la_SOURCES_DIST) \
+ $(am__libsox_fmt_sd2_la_SOURCES_DIST) \
+ $(am__libsox_fmt_sndfile_la_SOURCES_DIST) \
+ $(am__libsox_fmt_sndio_la_SOURCES_DIST) \
+ $(am__libsox_fmt_sunau_la_SOURCES_DIST) \
+ $(am__libsox_fmt_vorbis_la_SOURCES_DIST) \
+ $(am__libsox_fmt_w64_la_SOURCES_DIST) \
+ $(am__libsox_fmt_waveaudio_la_SOURCES_DIST) \
+ $(am__libsox_fmt_wavpack_la_SOURCES_DIST) \
+ $(am__libsox_fmt_xi_la_SOURCES_DIST) $(example0_SOURCES) \
+ $(example1_SOURCES) $(example2_SOURCES) $(example3_SOURCES) \
+ $(example4_SOURCES) $(example5_SOURCES) $(example6_SOURCES) \
+ $(am__sox_SOURCES_DIST) $(sox_sample_test_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(include_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)soxconfig.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMRNB_CFLAGS = @AMRNB_CFLAGS@
+AMRNB_LIBS = @AMRNB_LIBS@
+AMRWB_CFLAGS = @AMRWB_CFLAGS@
+AMRWB_LIBS = @AMRWB_LIBS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AO_CFLAGS = @AO_CFLAGS@
+AO_LIBS = @AO_LIBS@
+APP_LDFLAGS = @APP_LDFLAGS@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COREAUDIO_CFLAGS = @COREAUDIO_CFLAGS@
+COREAUDIO_LIBS = @COREAUDIO_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTRO = @DISTRO@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FLAC_CFLAGS = @FLAC_CFLAGS@
+FLAC_LIBS = @FLAC_LIBS@
+GOMP_LIBS = @GOMP_LIBS@
+GREP = @GREP@
+GSM_CFLAGS = @GSM_CFLAGS@
+GSM_LIBS = @GSM_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LADSPA_PATH = @LADSPA_PATH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGSM_LIBADD = @LIBGSM_LIBADD@
+LIBLPC10_LIBADD = @LIBLPC10_LIBADD@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+
+# Pass flags from --enable-silent-libtool
+LIBTOOL = @LIBTOOL@ @LIBTOOLFLAGS@
+LIBTOOLFLAGS = @LIBTOOLFLAGS@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LPC10_CFLAGS = @LPC10_CFLAGS@
+LPC10_LIBS = @LPC10_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAGIC_LIBS = @MAGIC_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MP3_CFLAGS = @MP3_CFLAGS@
+MP3_LIBS = @MP3_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OGG_VORBIS_CFLAGS = @OGG_VORBIS_CFLAGS@
+OGG_VORBIS_LIBS = @OGG_VORBIS_LIBS@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+OPUS_CFLAGS = @OPUS_CFLAGS@
+OPUS_LIBS = @OPUS_LIBS@
+OSS_CFLAGS = @OSS_CFLAGS@
+OSS_LIBS = @OSS_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKGCONFIGDIR = @PKGCONFIGDIR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PLAYRECLINKS = @PLAYRECLINKS@
+PNG_LIBS = @PNG_LIBS@
+PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
+PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHLIB_VERSION = @SHLIB_VERSION@
+SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
+SNDFILE_LIBS = @SNDFILE_LIBS@
+SNDIO_CFLAGS = @SNDIO_CFLAGS@
+SNDIO_LIBS = @SNDIO_LIBS@
+STRIP = @STRIP@
+SUN_AUDIO_CFLAGS = @SUN_AUDIO_CFLAGS@
+SUN_AUDIO_LIBS = @SUN_AUDIO_LIBS@
+SYMLINKS = @SYMLINKS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WAVEAUDIO_CFLAGS = @WAVEAUDIO_CFLAGS@
+WAVEAUDIO_LIBS = @WAVEAUDIO_LIBS@
+WAVPACK_CFLAGS = @WAVPACK_CFLAGS@
+WAVPACK_LIBS = @WAVPACK_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+RM = rm -f
+AM_CPPFLAGS = -DLADSPA_PATH="\"@LADSPA_PATH@\"" $(am__append_1) \
+ $(am__append_2) $(am__append_3)
+AM_CFLAGS = @WARN_CFLAGS@ #-Werror
+
+# This is being used as a short cut to turn off versioning of ALL dynamic
+# fmt libraries. If any fmt ever needs to add a specific LDFLAGS
+# then it will need to also add -avoid-version because AM_LDFLAGS
+# is ignored when you specify a more specific one.
+# We want to version libsox and we are OK because they
+# have a more specific LDFLAGS that includes -version-info.
+@HAVE_LIBLTDL_TRUE@AM_LDFLAGS = -avoid-version -module
+# Must match line above.
+@HAVE_WIN32_LTDL_TRUE@AM_LDFLAGS = -avoid-version -module
+lib_LTLIBRARIES = libsox.la
+include_HEADERS = sox.h
+sox_SOURCES = sox.c $(am__append_4)
+sox_LDADD = libsox.la $(am__append_11) $(am__append_15) \
+ $(am__append_19) $(am__append_23) $(am__append_27) \
+ $(am__append_31) $(am__append_35) $(am__append_39) \
+ $(am__append_43) $(am__append_48) $(am__append_52) \
+ $(am__append_56) $(am__append_60) $(am__append_65) \
+ $(am__append_69) $(am__append_73) $(am__append_77) \
+ $(am__append_82)
+example0_SOURCES = example0.c
+example1_SOURCES = example1.c
+example2_SOURCES = example2.c
+example3_SOURCES = example3.c
+example4_SOURCES = example4.c
+example5_SOURCES = example5.c
+example6_SOURCES = example6.c
+sox_sample_test_SOURCES = sox_sample_test.c sox_sample_test.h
+
+######################################################
+# libsox - file format, effects, and utility library #
+######################################################
+
+# Format handlers and utils source
+
+# Effects source
+
+#########################
+# libsox - File Formats #
+#########################
+
+# Uncomment for bit-rot detection on linux
+#libsox_la_SOURCES += coreaudio.c sndio.c sunaudio.c
+#libsox_la_CFLAGS += -Ibit-rot
+libsox_la_SOURCES = adpcms.c adpcms.h aiff.c aiff.h cvsd.c cvsd.h \
+ cvsdfilt.h g711.c g711.h g721.c g723_24.c g723_40.c g72x.c \
+ g72x.h vox.c vox.h raw.c raw.h formats.c formats.h formats_i.c \
+ sox_i.h skelform.c xmalloc.c xmalloc.h getopt.c util.c util.h \
+ libsox.c libsox_i.c sox-fmt.c soxomp.h band.h bend.c biquad.c \
+ biquad.h biquads.c chorus.c compand.c compandt.c compandt.h \
+ contrast.c dcshift.c delay.c dft_filter.c dft_filter.h \
+ dither.c dither.h divide.c downsample.c earwax.c echo.c \
+ echos.c effects.c effects.h effects_i.c effects_i_dsp.c fade.c \
+ fft4g.c fft4g.h fifo.h fir.c firfit.c flanger.c gain.c \
+ hilbert.c input.c ladspa.h ladspa.c loudness.c mcompand.c \
+ mcompand_xover.h noiseprof.c noisered.c noisered.h output.c \
+ overdrive.c pad.c phaser.c rate.c rate_filters.h \
+ rate_half_fir.h rate_poly_fir0.h rate_poly_fir.h remix.c \
+ repeat.c reverb.c reverse.c silence.c sinc.c skeleff.c speed.c \
+ splice.c stat.c stats.c stretch.c swap.c synth.c tempo.c \
+ tremolo.c trim.c upsample.c vad.c vol.c ignore-warning.h \
+ $(am__append_5) $(am__append_7) raw-fmt.c s1-fmt.c s2-fmt.c \
+ s3-fmt.c s4-fmt.c u1-fmt.c u2-fmt.c u3-fmt.c u4-fmt.c al-fmt.c \
+ la-fmt.c ul-fmt.c lu-fmt.c 8svx.c aiff-fmt.c aifc-fmt.c au.c \
+ avr.c cdr.c cvsd-fmt.c dvms-fmt.c dat.c hcom.c htk.c maud.c \
+ prc.c sf.c smp.c sounder.c soundtool.c sphere.c tx16w.c voc.c \
+ vox-fmt.c ima-fmt.c adpcm.c adpcm.h ima_rw.c ima_rw.h wav.c \
+ wve.c xa.c nulfile.c f4-fmt.c f8-fmt.c gsrt.c $(am__append_10) \
+ $(am__append_14) $(am__append_18) $(am__append_22) \
+ $(am__append_26) $(am__append_30) $(am__append_34) \
+ $(am__append_38) $(am__append_42) $(am__append_46) \
+ $(am__append_51) $(am__append_55) $(am__append_59) \
+ $(am__append_63) $(am__append_68) $(am__append_72) \
+ $(am__append_76) $(am__append_80)
+
+# Libraries required by libsox for file handlers, effects, or utils;
+# regardless if libltdl is used or not.
+libsox_la_LIBADD = @PNG_LIBS@ $(am__append_6) @GOMP_LIBS@ @GSM_LIBS@ \
+ @LIBGSM_LIBADD@ @LPC10_LIBS@ @LIBLPC10_LIBADD@ \
+ $(am__append_12) $(am__append_16) $(am__append_20) \
+ $(am__append_24) $(am__append_28) $(am__append_32) \
+ $(am__append_36) $(am__append_40) $(am__append_44) \
+ $(am__append_49) $(am__append_53) $(am__append_57) \
+ $(am__append_61) $(am__append_64) $(am__append_66) \
+ $(am__append_70) $(am__append_74) $(am__append_78) \
+ $(am__append_83)
+libsox_la_CFLAGS = @WARN_CFLAGS@ $(am__append_8) $(am__append_47) \
+ $(am__append_81)
+libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \
+ -export-symbols-regex \
+ '^(sox_.*|lsx_(check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|fail_errno|filelength|find_(enum_(text|value)|file_extension)|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$' \
+ $(am__append_9)
+pkglib_LTLIBRARIES = $(am__append_13) $(am__append_17) \
+ $(am__append_21) $(am__append_25) $(am__append_29) \
+ $(am__append_33) $(am__append_37) $(am__append_41) \
+ $(am__append_45) $(am__append_50) $(am__append_54) \
+ $(am__append_58) $(am__append_62) $(am__append_67) \
+ $(am__append_71) $(am__append_75) $(am__append_79) \
+ $(am__append_84)
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@libsox_fmt_alsa_la_SOURCES = alsa.c
+@HAVE_ALSA_TRUE@@STATIC_ALSA_FALSE@libsox_fmt_alsa_la_LIBADD = libsox.la @ALSA_LIBS@
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@libsox_fmt_amr_nb_la_SOURCES = amr-nb.c amr.h
+@HAVE_AMRNB_TRUE@@STATIC_AMRNB_FALSE@libsox_fmt_amr_nb_la_LIBADD = libsox.la @AMRNB_LIBS@
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@libsox_fmt_amr_wb_la_SOURCES = amr-wb.c amr.h
+@HAVE_AMRWB_TRUE@@STATIC_AMRWB_FALSE@libsox_fmt_amr_wb_la_LIBADD = libsox.la @AMRWB_LIBS@
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@libsox_fmt_ao_la_SOURCES = ao.c
+@HAVE_AO_TRUE@@STATIC_AO_FALSE@libsox_fmt_ao_la_LIBADD = libsox.la @AO_LIBS@
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@libsox_fmt_coreaudio_la_SOURCES = coreaudio.c
+@HAVE_COREAUDIO_TRUE@@STATIC_COREAUDIO_FALSE@libsox_fmt_coreaudio_la_LIBADD = libsox.la @COREAUDIO_LIBS@
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@libsox_fmt_flac_la_SOURCES = flac.c
+@HAVE_FLAC_TRUE@@STATIC_FLAC_FALSE@libsox_fmt_flac_la_LIBADD = libsox.la @FLAC_LIBS@
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@libsox_fmt_gsm_la_SOURCES = gsm.c
+@HAVE_GSM_TRUE@@STATIC_GSM_FALSE@libsox_fmt_gsm_la_LIBADD = libsox.la @GSM_LIBS@
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@libsox_fmt_lpc10_la_SOURCES = lpc10.c
+@HAVE_LPC10_TRUE@@STATIC_LPC10_FALSE@libsox_fmt_lpc10_la_LIBADD = libsox.la @LPC10_LIBS@
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@libsox_fmt_mp3_la_SOURCES = mp3.c mp3-util.h
+@HAVE_MP3_TRUE@@STATIC_MP3_FALSE@libsox_fmt_mp3_la_LIBADD = libsox.la @MP3_LIBS@
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@libsox_fmt_opus_la_SOURCES = opus.c
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@libsox_fmt_opus_la_CFLAGS = @OPUS_CFLAGS@
+@HAVE_OPUS_TRUE@@STATIC_OPUS_FALSE@libsox_fmt_opus_la_LIBADD = libsox.la @OPUS_LIBS@
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@libsox_fmt_oss_la_SOURCES = oss.c
+@HAVE_OSS_TRUE@@STATIC_OSS_FALSE@libsox_fmt_oss_la_LIBADD = libsox.la @OSS_LIBS@
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@libsox_fmt_pulseaudio_la_SOURCES = pulseaudio.c
+@HAVE_PULSEAUDIO_TRUE@@STATIC_PULSEAUDIO_FALSE@libsox_fmt_pulseaudio_la_LIBADD = libsox.la @PULSEAUDIO_LIBS@
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@libsox_fmt_waveaudio_la_SOURCES = waveaudio.c
+@HAVE_WAVEAUDIO_TRUE@@STATIC_WAVEAUDIO_FALSE@libsox_fmt_waveaudio_la_LIBADD = libsox.la @WAVEAUDIO_LIBS@
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@libsox_fmt_sndio_la_SOURCES = sndio.c
+@HAVE_SNDIO_TRUE@@STATIC_SNDIO_FALSE@libsox_fmt_sndio_la_LIBADD = libsox.la @SNDIO_LIBS@
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@libsox_fmt_sunau_la_SOURCES = sunaudio.c
+@HAVE_SUN_AUDIO_TRUE@@STATIC_SUN_AUDIO_FALSE@libsox_fmt_sunau_la_LIBADD = libsox.la @SUN_AUDIO_LIBS@
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@libsox_fmt_vorbis_la_SOURCES = vorbis.c
+@HAVE_OGG_VORBIS_TRUE@@STATIC_OGG_VORBIS_FALSE@libsox_fmt_vorbis_la_LIBADD = libsox.la @OGG_VORBIS_LIBS@
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@libsox_fmt_wavpack_la_SOURCES = wavpack.c
+@HAVE_WAVPACK_TRUE@@STATIC_WAVPACK_FALSE@libsox_fmt_wavpack_la_LIBADD = libsox.la @WAVPACK_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sndfile_la_SOURCES = sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sndfile_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sndfile_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_caf_la_SOURCES = caf.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_caf_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_caf_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat4_la_SOURCES = mat4.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat4_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat4_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat5_la_SOURCES = mat5.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat5_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_mat5_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_paf_la_SOURCES = paf.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_paf_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_paf_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_fap_la_SOURCES = fap.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_fap_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_fap_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_w64_la_SOURCES = w64.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_w64_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_w64_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_xi_la_SOURCES = xi.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_wi_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_xi_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_pvf_la_SOURCES = pvf.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_pvf_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_pvf_la_LIBADD = libsox.la @SNDFILE_LIBS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sd2_la_SOURCES = sd2.c sndfile.c
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sd2_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+@HAVE_SNDFILE_TRUE@@STATIC_SNDFILE_FALSE@libsox_fmt_sd2_la_LIBADD = libsox.la @SNDFILE_LIBS@
+
+# example programs will need same link options as sox does.
+example0_LDADD = ${sox_LDADD}
+example1_LDADD = ${sox_LDADD}
+example2_LDADD = ${sox_LDADD}
+example3_LDADD = ${sox_LDADD}
+example4_LDADD = ${sox_LDADD}
+example5_LDADD = ${sox_LDADD}
+example6_LDADD = ${sox_LDADD}
+EXTRA_DIST = monkey.wav optional-fmts.am \
+ CMakeLists.txt soxconfig.h.cmake \
+ tests.sh testall.sh tests.bat testall.bat test-comments
+
+all: soxconfig.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/optional-fmts.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+$(srcdir)/optional-fmts.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+soxconfig.h: stamp-h1
+ @test -f $@ || rm -f stamp-h1
+ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
+
+stamp-h1: $(srcdir)/soxconfig.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status src/soxconfig.h
+$(srcdir)/soxconfig.h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f soxconfig.h stamp-h1
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
+ }
+
+uninstall-pkglibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
+ done
+
+clean-pkglibLTLIBRARIES:
+ -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
+ @list='$(pkglib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libsox.la: $(libsox_la_OBJECTS) $(libsox_la_DEPENDENCIES) $(EXTRA_libsox_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_la_LINK) -rpath $(libdir) $(libsox_la_OBJECTS) $(libsox_la_LIBADD) $(LIBS)
+
+libsox_fmt_alsa.la: $(libsox_fmt_alsa_la_OBJECTS) $(libsox_fmt_alsa_la_DEPENDENCIES) $(EXTRA_libsox_fmt_alsa_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_alsa_la_rpath) $(libsox_fmt_alsa_la_OBJECTS) $(libsox_fmt_alsa_la_LIBADD) $(LIBS)
+
+libsox_fmt_amr_nb.la: $(libsox_fmt_amr_nb_la_OBJECTS) $(libsox_fmt_amr_nb_la_DEPENDENCIES) $(EXTRA_libsox_fmt_amr_nb_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_amr_nb_la_rpath) $(libsox_fmt_amr_nb_la_OBJECTS) $(libsox_fmt_amr_nb_la_LIBADD) $(LIBS)
+
+libsox_fmt_amr_wb.la: $(libsox_fmt_amr_wb_la_OBJECTS) $(libsox_fmt_amr_wb_la_DEPENDENCIES) $(EXTRA_libsox_fmt_amr_wb_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_amr_wb_la_rpath) $(libsox_fmt_amr_wb_la_OBJECTS) $(libsox_fmt_amr_wb_la_LIBADD) $(LIBS)
+
+libsox_fmt_ao.la: $(libsox_fmt_ao_la_OBJECTS) $(libsox_fmt_ao_la_DEPENDENCIES) $(EXTRA_libsox_fmt_ao_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_ao_la_rpath) $(libsox_fmt_ao_la_OBJECTS) $(libsox_fmt_ao_la_LIBADD) $(LIBS)
+
+libsox_fmt_caf.la: $(libsox_fmt_caf_la_OBJECTS) $(libsox_fmt_caf_la_DEPENDENCIES) $(EXTRA_libsox_fmt_caf_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_caf_la_LINK) $(am_libsox_fmt_caf_la_rpath) $(libsox_fmt_caf_la_OBJECTS) $(libsox_fmt_caf_la_LIBADD) $(LIBS)
+
+libsox_fmt_coreaudio.la: $(libsox_fmt_coreaudio_la_OBJECTS) $(libsox_fmt_coreaudio_la_DEPENDENCIES) $(EXTRA_libsox_fmt_coreaudio_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_coreaudio_la_rpath) $(libsox_fmt_coreaudio_la_OBJECTS) $(libsox_fmt_coreaudio_la_LIBADD) $(LIBS)
+
+libsox_fmt_fap.la: $(libsox_fmt_fap_la_OBJECTS) $(libsox_fmt_fap_la_DEPENDENCIES) $(EXTRA_libsox_fmt_fap_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_fap_la_LINK) $(am_libsox_fmt_fap_la_rpath) $(libsox_fmt_fap_la_OBJECTS) $(libsox_fmt_fap_la_LIBADD) $(LIBS)
+
+libsox_fmt_flac.la: $(libsox_fmt_flac_la_OBJECTS) $(libsox_fmt_flac_la_DEPENDENCIES) $(EXTRA_libsox_fmt_flac_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_flac_la_rpath) $(libsox_fmt_flac_la_OBJECTS) $(libsox_fmt_flac_la_LIBADD) $(LIBS)
+
+libsox_fmt_gsm.la: $(libsox_fmt_gsm_la_OBJECTS) $(libsox_fmt_gsm_la_DEPENDENCIES) $(EXTRA_libsox_fmt_gsm_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_gsm_la_rpath) $(libsox_fmt_gsm_la_OBJECTS) $(libsox_fmt_gsm_la_LIBADD) $(LIBS)
+
+libsox_fmt_lpc10.la: $(libsox_fmt_lpc10_la_OBJECTS) $(libsox_fmt_lpc10_la_DEPENDENCIES) $(EXTRA_libsox_fmt_lpc10_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_lpc10_la_rpath) $(libsox_fmt_lpc10_la_OBJECTS) $(libsox_fmt_lpc10_la_LIBADD) $(LIBS)
+
+libsox_fmt_mat4.la: $(libsox_fmt_mat4_la_OBJECTS) $(libsox_fmt_mat4_la_DEPENDENCIES) $(EXTRA_libsox_fmt_mat4_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_mat4_la_LINK) $(am_libsox_fmt_mat4_la_rpath) $(libsox_fmt_mat4_la_OBJECTS) $(libsox_fmt_mat4_la_LIBADD) $(LIBS)
+
+libsox_fmt_mat5.la: $(libsox_fmt_mat5_la_OBJECTS) $(libsox_fmt_mat5_la_DEPENDENCIES) $(EXTRA_libsox_fmt_mat5_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_mat5_la_LINK) $(am_libsox_fmt_mat5_la_rpath) $(libsox_fmt_mat5_la_OBJECTS) $(libsox_fmt_mat5_la_LIBADD) $(LIBS)
+
+libsox_fmt_mp3.la: $(libsox_fmt_mp3_la_OBJECTS) $(libsox_fmt_mp3_la_DEPENDENCIES) $(EXTRA_libsox_fmt_mp3_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_mp3_la_rpath) $(libsox_fmt_mp3_la_OBJECTS) $(libsox_fmt_mp3_la_LIBADD) $(LIBS)
+
+libsox_fmt_opus.la: $(libsox_fmt_opus_la_OBJECTS) $(libsox_fmt_opus_la_DEPENDENCIES) $(EXTRA_libsox_fmt_opus_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_opus_la_LINK) $(am_libsox_fmt_opus_la_rpath) $(libsox_fmt_opus_la_OBJECTS) $(libsox_fmt_opus_la_LIBADD) $(LIBS)
+
+libsox_fmt_oss.la: $(libsox_fmt_oss_la_OBJECTS) $(libsox_fmt_oss_la_DEPENDENCIES) $(EXTRA_libsox_fmt_oss_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_oss_la_rpath) $(libsox_fmt_oss_la_OBJECTS) $(libsox_fmt_oss_la_LIBADD) $(LIBS)
+
+libsox_fmt_paf.la: $(libsox_fmt_paf_la_OBJECTS) $(libsox_fmt_paf_la_DEPENDENCIES) $(EXTRA_libsox_fmt_paf_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_paf_la_LINK) $(am_libsox_fmt_paf_la_rpath) $(libsox_fmt_paf_la_OBJECTS) $(libsox_fmt_paf_la_LIBADD) $(LIBS)
+
+libsox_fmt_pulseaudio.la: $(libsox_fmt_pulseaudio_la_OBJECTS) $(libsox_fmt_pulseaudio_la_DEPENDENCIES) $(EXTRA_libsox_fmt_pulseaudio_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_pulseaudio_la_rpath) $(libsox_fmt_pulseaudio_la_OBJECTS) $(libsox_fmt_pulseaudio_la_LIBADD) $(LIBS)
+
+libsox_fmt_pvf.la: $(libsox_fmt_pvf_la_OBJECTS) $(libsox_fmt_pvf_la_DEPENDENCIES) $(EXTRA_libsox_fmt_pvf_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_pvf_la_rpath) $(libsox_fmt_pvf_la_OBJECTS) $(libsox_fmt_pvf_la_LIBADD) $(LIBS)
+
+libsox_fmt_sd2.la: $(libsox_fmt_sd2_la_OBJECTS) $(libsox_fmt_sd2_la_DEPENDENCIES) $(EXTRA_libsox_fmt_sd2_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_sd2_la_rpath) $(libsox_fmt_sd2_la_OBJECTS) $(libsox_fmt_sd2_la_LIBADD) $(LIBS)
+
+libsox_fmt_sndfile.la: $(libsox_fmt_sndfile_la_OBJECTS) $(libsox_fmt_sndfile_la_DEPENDENCIES) $(EXTRA_libsox_fmt_sndfile_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_sndfile_la_LINK) $(am_libsox_fmt_sndfile_la_rpath) $(libsox_fmt_sndfile_la_OBJECTS) $(libsox_fmt_sndfile_la_LIBADD) $(LIBS)
+
+libsox_fmt_sndio.la: $(libsox_fmt_sndio_la_OBJECTS) $(libsox_fmt_sndio_la_DEPENDENCIES) $(EXTRA_libsox_fmt_sndio_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_sndio_la_rpath) $(libsox_fmt_sndio_la_OBJECTS) $(libsox_fmt_sndio_la_LIBADD) $(LIBS)
+
+libsox_fmt_sunau.la: $(libsox_fmt_sunau_la_OBJECTS) $(libsox_fmt_sunau_la_DEPENDENCIES) $(EXTRA_libsox_fmt_sunau_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_sunau_la_rpath) $(libsox_fmt_sunau_la_OBJECTS) $(libsox_fmt_sunau_la_LIBADD) $(LIBS)
+
+libsox_fmt_vorbis.la: $(libsox_fmt_vorbis_la_OBJECTS) $(libsox_fmt_vorbis_la_DEPENDENCIES) $(EXTRA_libsox_fmt_vorbis_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_vorbis_la_rpath) $(libsox_fmt_vorbis_la_OBJECTS) $(libsox_fmt_vorbis_la_LIBADD) $(LIBS)
+
+libsox_fmt_w64.la: $(libsox_fmt_w64_la_OBJECTS) $(libsox_fmt_w64_la_DEPENDENCIES) $(EXTRA_libsox_fmt_w64_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libsox_fmt_w64_la_LINK) $(am_libsox_fmt_w64_la_rpath) $(libsox_fmt_w64_la_OBJECTS) $(libsox_fmt_w64_la_LIBADD) $(LIBS)
+
+libsox_fmt_waveaudio.la: $(libsox_fmt_waveaudio_la_OBJECTS) $(libsox_fmt_waveaudio_la_DEPENDENCIES) $(EXTRA_libsox_fmt_waveaudio_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_waveaudio_la_rpath) $(libsox_fmt_waveaudio_la_OBJECTS) $(libsox_fmt_waveaudio_la_LIBADD) $(LIBS)
+
+libsox_fmt_wavpack.la: $(libsox_fmt_wavpack_la_OBJECTS) $(libsox_fmt_wavpack_la_DEPENDENCIES) $(EXTRA_libsox_fmt_wavpack_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_wavpack_la_rpath) $(libsox_fmt_wavpack_la_OBJECTS) $(libsox_fmt_wavpack_la_LIBADD) $(LIBS)
+
+libsox_fmt_xi.la: $(libsox_fmt_xi_la_OBJECTS) $(libsox_fmt_xi_la_DEPENDENCIES) $(EXTRA_libsox_fmt_xi_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(am_libsox_fmt_xi_la_rpath) $(libsox_fmt_xi_la_OBJECTS) $(libsox_fmt_xi_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+example0$(EXEEXT): $(example0_OBJECTS) $(example0_DEPENDENCIES) $(EXTRA_example0_DEPENDENCIES)
+ @rm -f example0$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(example0_OBJECTS) $(example0_LDADD) $(LIBS)
+
+example1$(EXEEXT): $(example1_OBJECTS) $(example1_DEPENDENCIES) $(EXTRA_example1_DEPENDENCIES)
+ @rm -f example1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(example1_OBJECTS) $(example1_LDADD) $(LIBS)
+
+example2$(EXEEXT): $(example2_OBJECTS) $(example2_DEPENDENCIES) $(EXTRA_example2_DEPENDENCIES)
+ @rm -f example2$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(example2_OBJECTS) $(example2_LDADD) $(LIBS)
+
+example3$(EXEEXT): $(example3_OBJECTS) $(example3_DEPENDENCIES) $(EXTRA_example3_DEPENDENCIES)
+ @rm -f example3$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(example3_OBJECTS) $(example3_LDADD) $(LIBS)
+
+example4$(EXEEXT): $(example4_OBJECTS) $(example4_DEPENDENCIES) $(EXTRA_example4_DEPENDENCIES)
+ @rm -f example4$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(example4_OBJECTS) $(example4_LDADD) $(LIBS)
+
+example5$(EXEEXT): $(example5_OBJECTS) $(example5_DEPENDENCIES) $(EXTRA_example5_DEPENDENCIES)
+ @rm -f example5$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(example5_OBJECTS) $(example5_LDADD) $(LIBS)
+
+example6$(EXEEXT): $(example6_OBJECTS) $(example6_DEPENDENCIES) $(EXTRA_example6_DEPENDENCIES)
+ @rm -f example6$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(example6_OBJECTS) $(example6_LDADD) $(LIBS)
+
+sox$(EXEEXT): $(sox_OBJECTS) $(sox_DEPENDENCIES) $(EXTRA_sox_DEPENDENCIES)
+ @rm -f sox$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(sox_OBJECTS) $(sox_LDADD) $(LIBS)
+
+sox_sample_test$(EXEEXT): $(sox_sample_test_OBJECTS) $(sox_sample_test_DEPENDENCIES) $(EXTRA_sox_sample_test_DEPENDENCIES)
+ @rm -f sox_sample_test$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(sox_sample_test_OBJECTS) $(sox_sample_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amr-nb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amr-wb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ao.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coreaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example0.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example4.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example5.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example6.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flac.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_caf_la-caf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_caf_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_fap_la-fap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_fap_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_mat4_la-mat4.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_mat4_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_mat5_la-mat5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_mat5_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_opus_la-opus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_paf_la-paf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_paf_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_sndfile_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_w64_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_fmt_w64_la-w64.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-8svx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-adpcm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-adpcms.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-aifc-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-aiff-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-aiff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-al-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-alsa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-amr-nb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-amr-wb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-ao.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-au.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-avr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-bend.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-biquad.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-biquads.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-caf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-cdr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-chorus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-compand.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-compandt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-contrast.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-coreaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-cvsd-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-cvsd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-dat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-dcshift.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-delay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-dft_filter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-dither.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-divide.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-downsample.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-dvms-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-earwax.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-echo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-echos.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-effects.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-effects_i.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-effects_i_dsp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-f4-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-f8-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-fade.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-fap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-fft4g.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-fir.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-firfit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-flac.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-flanger.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-formats.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-formats_i.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-g711.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-g721.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-g723_24.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-g723_40.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-g72x.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-gain.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-getopt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-gsm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-gsrt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-hcom.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-hilbert.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-htk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-ima-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-ima_rw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-input.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-la-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-ladspa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-libsox.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-libsox_i.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-loudness.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-lpc10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-lu-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-mat4.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-mat5.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-maud.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-mcompand.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-mp3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-noiseprof.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-noisered.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-nulfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-opus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-oss.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-output.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-overdrive.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-pad.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-paf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-phaser.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-prc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-pulseaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-pvf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-rate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-raw-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-raw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-remix.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-repeat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-reverb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-reverse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-s1-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-s2-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-s3-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-s4-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sd2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-silence.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sinc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-skeleff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-skelform.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-smp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sndio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sounder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-soundtool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sox-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-spectrogram.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-speed.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sphere.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-splice.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-stat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-stats.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-stretch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-sunaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-swap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-synth.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-tempo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-tremolo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-trim.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-tx16w.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-u1-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-u2-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-u3-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-u4-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-ul-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-upsample.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-vad.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-voc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-vol.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-vorbis.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-vox-fmt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-vox.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-w64.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-wav.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-waveaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-wavpack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-win32-ltdl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-wve.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-xa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-xi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsox_la-xmalloc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oss.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pulseaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sd2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sox.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sox_sample_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sunaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbis.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/waveaudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wavpack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32-glob.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xi.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+libsox_la-adpcms.lo: adpcms.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-adpcms.lo -MD -MP -MF $(DEPDIR)/libsox_la-adpcms.Tpo -c -o libsox_la-adpcms.lo `test -f 'adpcms.c' || echo '$(srcdir)/'`adpcms.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-adpcms.Tpo $(DEPDIR)/libsox_la-adpcms.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adpcms.c' object='libsox_la-adpcms.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-adpcms.lo `test -f 'adpcms.c' || echo '$(srcdir)/'`adpcms.c
+
+libsox_la-aiff.lo: aiff.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-aiff.lo -MD -MP -MF $(DEPDIR)/libsox_la-aiff.Tpo -c -o libsox_la-aiff.lo `test -f 'aiff.c' || echo '$(srcdir)/'`aiff.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-aiff.Tpo $(DEPDIR)/libsox_la-aiff.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='aiff.c' object='libsox_la-aiff.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-aiff.lo `test -f 'aiff.c' || echo '$(srcdir)/'`aiff.c
+
+libsox_la-cvsd.lo: cvsd.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-cvsd.lo -MD -MP -MF $(DEPDIR)/libsox_la-cvsd.Tpo -c -o libsox_la-cvsd.lo `test -f 'cvsd.c' || echo '$(srcdir)/'`cvsd.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-cvsd.Tpo $(DEPDIR)/libsox_la-cvsd.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cvsd.c' object='libsox_la-cvsd.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-cvsd.lo `test -f 'cvsd.c' || echo '$(srcdir)/'`cvsd.c
+
+libsox_la-g711.lo: g711.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-g711.lo -MD -MP -MF $(DEPDIR)/libsox_la-g711.Tpo -c -o libsox_la-g711.lo `test -f 'g711.c' || echo '$(srcdir)/'`g711.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-g711.Tpo $(DEPDIR)/libsox_la-g711.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='g711.c' object='libsox_la-g711.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-g711.lo `test -f 'g711.c' || echo '$(srcdir)/'`g711.c
+
+libsox_la-g721.lo: g721.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-g721.lo -MD -MP -MF $(DEPDIR)/libsox_la-g721.Tpo -c -o libsox_la-g721.lo `test -f 'g721.c' || echo '$(srcdir)/'`g721.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-g721.Tpo $(DEPDIR)/libsox_la-g721.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='g721.c' object='libsox_la-g721.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-g721.lo `test -f 'g721.c' || echo '$(srcdir)/'`g721.c
+
+libsox_la-g723_24.lo: g723_24.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-g723_24.lo -MD -MP -MF $(DEPDIR)/libsox_la-g723_24.Tpo -c -o libsox_la-g723_24.lo `test -f 'g723_24.c' || echo '$(srcdir)/'`g723_24.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-g723_24.Tpo $(DEPDIR)/libsox_la-g723_24.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='g723_24.c' object='libsox_la-g723_24.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-g723_24.lo `test -f 'g723_24.c' || echo '$(srcdir)/'`g723_24.c
+
+libsox_la-g723_40.lo: g723_40.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-g723_40.lo -MD -MP -MF $(DEPDIR)/libsox_la-g723_40.Tpo -c -o libsox_la-g723_40.lo `test -f 'g723_40.c' || echo '$(srcdir)/'`g723_40.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-g723_40.Tpo $(DEPDIR)/libsox_la-g723_40.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='g723_40.c' object='libsox_la-g723_40.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-g723_40.lo `test -f 'g723_40.c' || echo '$(srcdir)/'`g723_40.c
+
+libsox_la-g72x.lo: g72x.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-g72x.lo -MD -MP -MF $(DEPDIR)/libsox_la-g72x.Tpo -c -o libsox_la-g72x.lo `test -f 'g72x.c' || echo '$(srcdir)/'`g72x.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-g72x.Tpo $(DEPDIR)/libsox_la-g72x.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='g72x.c' object='libsox_la-g72x.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-g72x.lo `test -f 'g72x.c' || echo '$(srcdir)/'`g72x.c
+
+libsox_la-vox.lo: vox.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-vox.lo -MD -MP -MF $(DEPDIR)/libsox_la-vox.Tpo -c -o libsox_la-vox.lo `test -f 'vox.c' || echo '$(srcdir)/'`vox.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-vox.Tpo $(DEPDIR)/libsox_la-vox.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vox.c' object='libsox_la-vox.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-vox.lo `test -f 'vox.c' || echo '$(srcdir)/'`vox.c
+
+libsox_la-raw.lo: raw.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-raw.lo -MD -MP -MF $(DEPDIR)/libsox_la-raw.Tpo -c -o libsox_la-raw.lo `test -f 'raw.c' || echo '$(srcdir)/'`raw.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-raw.Tpo $(DEPDIR)/libsox_la-raw.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='raw.c' object='libsox_la-raw.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-raw.lo `test -f 'raw.c' || echo '$(srcdir)/'`raw.c
+
+libsox_la-formats.lo: formats.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-formats.lo -MD -MP -MF $(DEPDIR)/libsox_la-formats.Tpo -c -o libsox_la-formats.lo `test -f 'formats.c' || echo '$(srcdir)/'`formats.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-formats.Tpo $(DEPDIR)/libsox_la-formats.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='formats.c' object='libsox_la-formats.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-formats.lo `test -f 'formats.c' || echo '$(srcdir)/'`formats.c
+
+libsox_la-formats_i.lo: formats_i.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-formats_i.lo -MD -MP -MF $(DEPDIR)/libsox_la-formats_i.Tpo -c -o libsox_la-formats_i.lo `test -f 'formats_i.c' || echo '$(srcdir)/'`formats_i.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-formats_i.Tpo $(DEPDIR)/libsox_la-formats_i.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='formats_i.c' object='libsox_la-formats_i.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-formats_i.lo `test -f 'formats_i.c' || echo '$(srcdir)/'`formats_i.c
+
+libsox_la-skelform.lo: skelform.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-skelform.lo -MD -MP -MF $(DEPDIR)/libsox_la-skelform.Tpo -c -o libsox_la-skelform.lo `test -f 'skelform.c' || echo '$(srcdir)/'`skelform.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-skelform.Tpo $(DEPDIR)/libsox_la-skelform.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='skelform.c' object='libsox_la-skelform.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-skelform.lo `test -f 'skelform.c' || echo '$(srcdir)/'`skelform.c
+
+libsox_la-xmalloc.lo: xmalloc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-xmalloc.lo -MD -MP -MF $(DEPDIR)/libsox_la-xmalloc.Tpo -c -o libsox_la-xmalloc.lo `test -f 'xmalloc.c' || echo '$(srcdir)/'`xmalloc.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-xmalloc.Tpo $(DEPDIR)/libsox_la-xmalloc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xmalloc.c' object='libsox_la-xmalloc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-xmalloc.lo `test -f 'xmalloc.c' || echo '$(srcdir)/'`xmalloc.c
+
+libsox_la-getopt.lo: getopt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-getopt.lo -MD -MP -MF $(DEPDIR)/libsox_la-getopt.Tpo -c -o libsox_la-getopt.lo `test -f 'getopt.c' || echo '$(srcdir)/'`getopt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-getopt.Tpo $(DEPDIR)/libsox_la-getopt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='getopt.c' object='libsox_la-getopt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-getopt.lo `test -f 'getopt.c' || echo '$(srcdir)/'`getopt.c
+
+libsox_la-util.lo: util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-util.lo -MD -MP -MF $(DEPDIR)/libsox_la-util.Tpo -c -o libsox_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-util.Tpo $(DEPDIR)/libsox_la-util.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util.c' object='libsox_la-util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c
+
+libsox_la-libsox.lo: libsox.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-libsox.lo -MD -MP -MF $(DEPDIR)/libsox_la-libsox.Tpo -c -o libsox_la-libsox.lo `test -f 'libsox.c' || echo '$(srcdir)/'`libsox.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-libsox.Tpo $(DEPDIR)/libsox_la-libsox.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libsox.c' object='libsox_la-libsox.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-libsox.lo `test -f 'libsox.c' || echo '$(srcdir)/'`libsox.c
+
+libsox_la-libsox_i.lo: libsox_i.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-libsox_i.lo -MD -MP -MF $(DEPDIR)/libsox_la-libsox_i.Tpo -c -o libsox_la-libsox_i.lo `test -f 'libsox_i.c' || echo '$(srcdir)/'`libsox_i.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-libsox_i.Tpo $(DEPDIR)/libsox_la-libsox_i.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libsox_i.c' object='libsox_la-libsox_i.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-libsox_i.lo `test -f 'libsox_i.c' || echo '$(srcdir)/'`libsox_i.c
+
+libsox_la-sox-fmt.lo: sox-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sox-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-sox-fmt.Tpo -c -o libsox_la-sox-fmt.lo `test -f 'sox-fmt.c' || echo '$(srcdir)/'`sox-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sox-fmt.Tpo $(DEPDIR)/libsox_la-sox-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sox-fmt.c' object='libsox_la-sox-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sox-fmt.lo `test -f 'sox-fmt.c' || echo '$(srcdir)/'`sox-fmt.c
+
+libsox_la-bend.lo: bend.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-bend.lo -MD -MP -MF $(DEPDIR)/libsox_la-bend.Tpo -c -o libsox_la-bend.lo `test -f 'bend.c' || echo '$(srcdir)/'`bend.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-bend.Tpo $(DEPDIR)/libsox_la-bend.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bend.c' object='libsox_la-bend.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-bend.lo `test -f 'bend.c' || echo '$(srcdir)/'`bend.c
+
+libsox_la-biquad.lo: biquad.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-biquad.lo -MD -MP -MF $(DEPDIR)/libsox_la-biquad.Tpo -c -o libsox_la-biquad.lo `test -f 'biquad.c' || echo '$(srcdir)/'`biquad.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-biquad.Tpo $(DEPDIR)/libsox_la-biquad.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='biquad.c' object='libsox_la-biquad.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-biquad.lo `test -f 'biquad.c' || echo '$(srcdir)/'`biquad.c
+
+libsox_la-biquads.lo: biquads.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-biquads.lo -MD -MP -MF $(DEPDIR)/libsox_la-biquads.Tpo -c -o libsox_la-biquads.lo `test -f 'biquads.c' || echo '$(srcdir)/'`biquads.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-biquads.Tpo $(DEPDIR)/libsox_la-biquads.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='biquads.c' object='libsox_la-biquads.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-biquads.lo `test -f 'biquads.c' || echo '$(srcdir)/'`biquads.c
+
+libsox_la-chorus.lo: chorus.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-chorus.lo -MD -MP -MF $(DEPDIR)/libsox_la-chorus.Tpo -c -o libsox_la-chorus.lo `test -f 'chorus.c' || echo '$(srcdir)/'`chorus.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-chorus.Tpo $(DEPDIR)/libsox_la-chorus.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='chorus.c' object='libsox_la-chorus.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-chorus.lo `test -f 'chorus.c' || echo '$(srcdir)/'`chorus.c
+
+libsox_la-compand.lo: compand.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-compand.lo -MD -MP -MF $(DEPDIR)/libsox_la-compand.Tpo -c -o libsox_la-compand.lo `test -f 'compand.c' || echo '$(srcdir)/'`compand.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-compand.Tpo $(DEPDIR)/libsox_la-compand.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compand.c' object='libsox_la-compand.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-compand.lo `test -f 'compand.c' || echo '$(srcdir)/'`compand.c
+
+libsox_la-compandt.lo: compandt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-compandt.lo -MD -MP -MF $(DEPDIR)/libsox_la-compandt.Tpo -c -o libsox_la-compandt.lo `test -f 'compandt.c' || echo '$(srcdir)/'`compandt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-compandt.Tpo $(DEPDIR)/libsox_la-compandt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compandt.c' object='libsox_la-compandt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-compandt.lo `test -f 'compandt.c' || echo '$(srcdir)/'`compandt.c
+
+libsox_la-contrast.lo: contrast.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-contrast.lo -MD -MP -MF $(DEPDIR)/libsox_la-contrast.Tpo -c -o libsox_la-contrast.lo `test -f 'contrast.c' || echo '$(srcdir)/'`contrast.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-contrast.Tpo $(DEPDIR)/libsox_la-contrast.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='contrast.c' object='libsox_la-contrast.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-contrast.lo `test -f 'contrast.c' || echo '$(srcdir)/'`contrast.c
+
+libsox_la-dcshift.lo: dcshift.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-dcshift.lo -MD -MP -MF $(DEPDIR)/libsox_la-dcshift.Tpo -c -o libsox_la-dcshift.lo `test -f 'dcshift.c' || echo '$(srcdir)/'`dcshift.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-dcshift.Tpo $(DEPDIR)/libsox_la-dcshift.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dcshift.c' object='libsox_la-dcshift.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-dcshift.lo `test -f 'dcshift.c' || echo '$(srcdir)/'`dcshift.c
+
+libsox_la-delay.lo: delay.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-delay.lo -MD -MP -MF $(DEPDIR)/libsox_la-delay.Tpo -c -o libsox_la-delay.lo `test -f 'delay.c' || echo '$(srcdir)/'`delay.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-delay.Tpo $(DEPDIR)/libsox_la-delay.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='delay.c' object='libsox_la-delay.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-delay.lo `test -f 'delay.c' || echo '$(srcdir)/'`delay.c
+
+libsox_la-dft_filter.lo: dft_filter.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-dft_filter.lo -MD -MP -MF $(DEPDIR)/libsox_la-dft_filter.Tpo -c -o libsox_la-dft_filter.lo `test -f 'dft_filter.c' || echo '$(srcdir)/'`dft_filter.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-dft_filter.Tpo $(DEPDIR)/libsox_la-dft_filter.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dft_filter.c' object='libsox_la-dft_filter.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-dft_filter.lo `test -f 'dft_filter.c' || echo '$(srcdir)/'`dft_filter.c
+
+libsox_la-dither.lo: dither.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-dither.lo -MD -MP -MF $(DEPDIR)/libsox_la-dither.Tpo -c -o libsox_la-dither.lo `test -f 'dither.c' || echo '$(srcdir)/'`dither.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-dither.Tpo $(DEPDIR)/libsox_la-dither.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dither.c' object='libsox_la-dither.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-dither.lo `test -f 'dither.c' || echo '$(srcdir)/'`dither.c
+
+libsox_la-divide.lo: divide.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-divide.lo -MD -MP -MF $(DEPDIR)/libsox_la-divide.Tpo -c -o libsox_la-divide.lo `test -f 'divide.c' || echo '$(srcdir)/'`divide.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-divide.Tpo $(DEPDIR)/libsox_la-divide.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='divide.c' object='libsox_la-divide.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-divide.lo `test -f 'divide.c' || echo '$(srcdir)/'`divide.c
+
+libsox_la-downsample.lo: downsample.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-downsample.lo -MD -MP -MF $(DEPDIR)/libsox_la-downsample.Tpo -c -o libsox_la-downsample.lo `test -f 'downsample.c' || echo '$(srcdir)/'`downsample.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-downsample.Tpo $(DEPDIR)/libsox_la-downsample.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='downsample.c' object='libsox_la-downsample.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-downsample.lo `test -f 'downsample.c' || echo '$(srcdir)/'`downsample.c
+
+libsox_la-earwax.lo: earwax.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-earwax.lo -MD -MP -MF $(DEPDIR)/libsox_la-earwax.Tpo -c -o libsox_la-earwax.lo `test -f 'earwax.c' || echo '$(srcdir)/'`earwax.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-earwax.Tpo $(DEPDIR)/libsox_la-earwax.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='earwax.c' object='libsox_la-earwax.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-earwax.lo `test -f 'earwax.c' || echo '$(srcdir)/'`earwax.c
+
+libsox_la-echo.lo: echo.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-echo.lo -MD -MP -MF $(DEPDIR)/libsox_la-echo.Tpo -c -o libsox_la-echo.lo `test -f 'echo.c' || echo '$(srcdir)/'`echo.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-echo.Tpo $(DEPDIR)/libsox_la-echo.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='echo.c' object='libsox_la-echo.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-echo.lo `test -f 'echo.c' || echo '$(srcdir)/'`echo.c
+
+libsox_la-echos.lo: echos.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-echos.lo -MD -MP -MF $(DEPDIR)/libsox_la-echos.Tpo -c -o libsox_la-echos.lo `test -f 'echos.c' || echo '$(srcdir)/'`echos.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-echos.Tpo $(DEPDIR)/libsox_la-echos.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='echos.c' object='libsox_la-echos.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-echos.lo `test -f 'echos.c' || echo '$(srcdir)/'`echos.c
+
+libsox_la-effects.lo: effects.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-effects.lo -MD -MP -MF $(DEPDIR)/libsox_la-effects.Tpo -c -o libsox_la-effects.lo `test -f 'effects.c' || echo '$(srcdir)/'`effects.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-effects.Tpo $(DEPDIR)/libsox_la-effects.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='effects.c' object='libsox_la-effects.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-effects.lo `test -f 'effects.c' || echo '$(srcdir)/'`effects.c
+
+libsox_la-effects_i.lo: effects_i.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-effects_i.lo -MD -MP -MF $(DEPDIR)/libsox_la-effects_i.Tpo -c -o libsox_la-effects_i.lo `test -f 'effects_i.c' || echo '$(srcdir)/'`effects_i.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-effects_i.Tpo $(DEPDIR)/libsox_la-effects_i.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='effects_i.c' object='libsox_la-effects_i.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-effects_i.lo `test -f 'effects_i.c' || echo '$(srcdir)/'`effects_i.c
+
+libsox_la-effects_i_dsp.lo: effects_i_dsp.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-effects_i_dsp.lo -MD -MP -MF $(DEPDIR)/libsox_la-effects_i_dsp.Tpo -c -o libsox_la-effects_i_dsp.lo `test -f 'effects_i_dsp.c' || echo '$(srcdir)/'`effects_i_dsp.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-effects_i_dsp.Tpo $(DEPDIR)/libsox_la-effects_i_dsp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='effects_i_dsp.c' object='libsox_la-effects_i_dsp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-effects_i_dsp.lo `test -f 'effects_i_dsp.c' || echo '$(srcdir)/'`effects_i_dsp.c
+
+libsox_la-fade.lo: fade.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-fade.lo -MD -MP -MF $(DEPDIR)/libsox_la-fade.Tpo -c -o libsox_la-fade.lo `test -f 'fade.c' || echo '$(srcdir)/'`fade.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-fade.Tpo $(DEPDIR)/libsox_la-fade.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fade.c' object='libsox_la-fade.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-fade.lo `test -f 'fade.c' || echo '$(srcdir)/'`fade.c
+
+libsox_la-fft4g.lo: fft4g.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-fft4g.lo -MD -MP -MF $(DEPDIR)/libsox_la-fft4g.Tpo -c -o libsox_la-fft4g.lo `test -f 'fft4g.c' || echo '$(srcdir)/'`fft4g.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-fft4g.Tpo $(DEPDIR)/libsox_la-fft4g.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fft4g.c' object='libsox_la-fft4g.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-fft4g.lo `test -f 'fft4g.c' || echo '$(srcdir)/'`fft4g.c
+
+libsox_la-fir.lo: fir.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-fir.lo -MD -MP -MF $(DEPDIR)/libsox_la-fir.Tpo -c -o libsox_la-fir.lo `test -f 'fir.c' || echo '$(srcdir)/'`fir.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-fir.Tpo $(DEPDIR)/libsox_la-fir.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fir.c' object='libsox_la-fir.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-fir.lo `test -f 'fir.c' || echo '$(srcdir)/'`fir.c
+
+libsox_la-firfit.lo: firfit.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-firfit.lo -MD -MP -MF $(DEPDIR)/libsox_la-firfit.Tpo -c -o libsox_la-firfit.lo `test -f 'firfit.c' || echo '$(srcdir)/'`firfit.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-firfit.Tpo $(DEPDIR)/libsox_la-firfit.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='firfit.c' object='libsox_la-firfit.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-firfit.lo `test -f 'firfit.c' || echo '$(srcdir)/'`firfit.c
+
+libsox_la-flanger.lo: flanger.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-flanger.lo -MD -MP -MF $(DEPDIR)/libsox_la-flanger.Tpo -c -o libsox_la-flanger.lo `test -f 'flanger.c' || echo '$(srcdir)/'`flanger.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-flanger.Tpo $(DEPDIR)/libsox_la-flanger.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='flanger.c' object='libsox_la-flanger.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-flanger.lo `test -f 'flanger.c' || echo '$(srcdir)/'`flanger.c
+
+libsox_la-gain.lo: gain.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-gain.lo -MD -MP -MF $(DEPDIR)/libsox_la-gain.Tpo -c -o libsox_la-gain.lo `test -f 'gain.c' || echo '$(srcdir)/'`gain.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-gain.Tpo $(DEPDIR)/libsox_la-gain.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gain.c' object='libsox_la-gain.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-gain.lo `test -f 'gain.c' || echo '$(srcdir)/'`gain.c
+
+libsox_la-hilbert.lo: hilbert.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-hilbert.lo -MD -MP -MF $(DEPDIR)/libsox_la-hilbert.Tpo -c -o libsox_la-hilbert.lo `test -f 'hilbert.c' || echo '$(srcdir)/'`hilbert.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-hilbert.Tpo $(DEPDIR)/libsox_la-hilbert.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hilbert.c' object='libsox_la-hilbert.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-hilbert.lo `test -f 'hilbert.c' || echo '$(srcdir)/'`hilbert.c
+
+libsox_la-input.lo: input.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-input.lo -MD -MP -MF $(DEPDIR)/libsox_la-input.Tpo -c -o libsox_la-input.lo `test -f 'input.c' || echo '$(srcdir)/'`input.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-input.Tpo $(DEPDIR)/libsox_la-input.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='input.c' object='libsox_la-input.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-input.lo `test -f 'input.c' || echo '$(srcdir)/'`input.c
+
+libsox_la-ladspa.lo: ladspa.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-ladspa.lo -MD -MP -MF $(DEPDIR)/libsox_la-ladspa.Tpo -c -o libsox_la-ladspa.lo `test -f 'ladspa.c' || echo '$(srcdir)/'`ladspa.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-ladspa.Tpo $(DEPDIR)/libsox_la-ladspa.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ladspa.c' object='libsox_la-ladspa.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-ladspa.lo `test -f 'ladspa.c' || echo '$(srcdir)/'`ladspa.c
+
+libsox_la-loudness.lo: loudness.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-loudness.lo -MD -MP -MF $(DEPDIR)/libsox_la-loudness.Tpo -c -o libsox_la-loudness.lo `test -f 'loudness.c' || echo '$(srcdir)/'`loudness.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-loudness.Tpo $(DEPDIR)/libsox_la-loudness.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='loudness.c' object='libsox_la-loudness.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-loudness.lo `test -f 'loudness.c' || echo '$(srcdir)/'`loudness.c
+
+libsox_la-mcompand.lo: mcompand.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-mcompand.lo -MD -MP -MF $(DEPDIR)/libsox_la-mcompand.Tpo -c -o libsox_la-mcompand.lo `test -f 'mcompand.c' || echo '$(srcdir)/'`mcompand.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-mcompand.Tpo $(DEPDIR)/libsox_la-mcompand.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mcompand.c' object='libsox_la-mcompand.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-mcompand.lo `test -f 'mcompand.c' || echo '$(srcdir)/'`mcompand.c
+
+libsox_la-noiseprof.lo: noiseprof.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-noiseprof.lo -MD -MP -MF $(DEPDIR)/libsox_la-noiseprof.Tpo -c -o libsox_la-noiseprof.lo `test -f 'noiseprof.c' || echo '$(srcdir)/'`noiseprof.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-noiseprof.Tpo $(DEPDIR)/libsox_la-noiseprof.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='noiseprof.c' object='libsox_la-noiseprof.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-noiseprof.lo `test -f 'noiseprof.c' || echo '$(srcdir)/'`noiseprof.c
+
+libsox_la-noisered.lo: noisered.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-noisered.lo -MD -MP -MF $(DEPDIR)/libsox_la-noisered.Tpo -c -o libsox_la-noisered.lo `test -f 'noisered.c' || echo '$(srcdir)/'`noisered.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-noisered.Tpo $(DEPDIR)/libsox_la-noisered.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='noisered.c' object='libsox_la-noisered.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-noisered.lo `test -f 'noisered.c' || echo '$(srcdir)/'`noisered.c
+
+libsox_la-output.lo: output.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-output.lo -MD -MP -MF $(DEPDIR)/libsox_la-output.Tpo -c -o libsox_la-output.lo `test -f 'output.c' || echo '$(srcdir)/'`output.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-output.Tpo $(DEPDIR)/libsox_la-output.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='output.c' object='libsox_la-output.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-output.lo `test -f 'output.c' || echo '$(srcdir)/'`output.c
+
+libsox_la-overdrive.lo: overdrive.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-overdrive.lo -MD -MP -MF $(DEPDIR)/libsox_la-overdrive.Tpo -c -o libsox_la-overdrive.lo `test -f 'overdrive.c' || echo '$(srcdir)/'`overdrive.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-overdrive.Tpo $(DEPDIR)/libsox_la-overdrive.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='overdrive.c' object='libsox_la-overdrive.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-overdrive.lo `test -f 'overdrive.c' || echo '$(srcdir)/'`overdrive.c
+
+libsox_la-pad.lo: pad.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-pad.lo -MD -MP -MF $(DEPDIR)/libsox_la-pad.Tpo -c -o libsox_la-pad.lo `test -f 'pad.c' || echo '$(srcdir)/'`pad.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-pad.Tpo $(DEPDIR)/libsox_la-pad.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pad.c' object='libsox_la-pad.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-pad.lo `test -f 'pad.c' || echo '$(srcdir)/'`pad.c
+
+libsox_la-phaser.lo: phaser.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-phaser.lo -MD -MP -MF $(DEPDIR)/libsox_la-phaser.Tpo -c -o libsox_la-phaser.lo `test -f 'phaser.c' || echo '$(srcdir)/'`phaser.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-phaser.Tpo $(DEPDIR)/libsox_la-phaser.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='phaser.c' object='libsox_la-phaser.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-phaser.lo `test -f 'phaser.c' || echo '$(srcdir)/'`phaser.c
+
+libsox_la-rate.lo: rate.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-rate.lo -MD -MP -MF $(DEPDIR)/libsox_la-rate.Tpo -c -o libsox_la-rate.lo `test -f 'rate.c' || echo '$(srcdir)/'`rate.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-rate.Tpo $(DEPDIR)/libsox_la-rate.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='rate.c' object='libsox_la-rate.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-rate.lo `test -f 'rate.c' || echo '$(srcdir)/'`rate.c
+
+libsox_la-remix.lo: remix.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-remix.lo -MD -MP -MF $(DEPDIR)/libsox_la-remix.Tpo -c -o libsox_la-remix.lo `test -f 'remix.c' || echo '$(srcdir)/'`remix.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-remix.Tpo $(DEPDIR)/libsox_la-remix.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='remix.c' object='libsox_la-remix.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-remix.lo `test -f 'remix.c' || echo '$(srcdir)/'`remix.c
+
+libsox_la-repeat.lo: repeat.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-repeat.lo -MD -MP -MF $(DEPDIR)/libsox_la-repeat.Tpo -c -o libsox_la-repeat.lo `test -f 'repeat.c' || echo '$(srcdir)/'`repeat.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-repeat.Tpo $(DEPDIR)/libsox_la-repeat.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='repeat.c' object='libsox_la-repeat.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-repeat.lo `test -f 'repeat.c' || echo '$(srcdir)/'`repeat.c
+
+libsox_la-reverb.lo: reverb.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-reverb.lo -MD -MP -MF $(DEPDIR)/libsox_la-reverb.Tpo -c -o libsox_la-reverb.lo `test -f 'reverb.c' || echo '$(srcdir)/'`reverb.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-reverb.Tpo $(DEPDIR)/libsox_la-reverb.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='reverb.c' object='libsox_la-reverb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-reverb.lo `test -f 'reverb.c' || echo '$(srcdir)/'`reverb.c
+
+libsox_la-reverse.lo: reverse.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-reverse.lo -MD -MP -MF $(DEPDIR)/libsox_la-reverse.Tpo -c -o libsox_la-reverse.lo `test -f 'reverse.c' || echo '$(srcdir)/'`reverse.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-reverse.Tpo $(DEPDIR)/libsox_la-reverse.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='reverse.c' object='libsox_la-reverse.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-reverse.lo `test -f 'reverse.c' || echo '$(srcdir)/'`reverse.c
+
+libsox_la-silence.lo: silence.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-silence.lo -MD -MP -MF $(DEPDIR)/libsox_la-silence.Tpo -c -o libsox_la-silence.lo `test -f 'silence.c' || echo '$(srcdir)/'`silence.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-silence.Tpo $(DEPDIR)/libsox_la-silence.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='silence.c' object='libsox_la-silence.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-silence.lo `test -f 'silence.c' || echo '$(srcdir)/'`silence.c
+
+libsox_la-sinc.lo: sinc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sinc.lo -MD -MP -MF $(DEPDIR)/libsox_la-sinc.Tpo -c -o libsox_la-sinc.lo `test -f 'sinc.c' || echo '$(srcdir)/'`sinc.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sinc.Tpo $(DEPDIR)/libsox_la-sinc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sinc.c' object='libsox_la-sinc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sinc.lo `test -f 'sinc.c' || echo '$(srcdir)/'`sinc.c
+
+libsox_la-skeleff.lo: skeleff.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-skeleff.lo -MD -MP -MF $(DEPDIR)/libsox_la-skeleff.Tpo -c -o libsox_la-skeleff.lo `test -f 'skeleff.c' || echo '$(srcdir)/'`skeleff.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-skeleff.Tpo $(DEPDIR)/libsox_la-skeleff.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='skeleff.c' object='libsox_la-skeleff.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-skeleff.lo `test -f 'skeleff.c' || echo '$(srcdir)/'`skeleff.c
+
+libsox_la-speed.lo: speed.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-speed.lo -MD -MP -MF $(DEPDIR)/libsox_la-speed.Tpo -c -o libsox_la-speed.lo `test -f 'speed.c' || echo '$(srcdir)/'`speed.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-speed.Tpo $(DEPDIR)/libsox_la-speed.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='speed.c' object='libsox_la-speed.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-speed.lo `test -f 'speed.c' || echo '$(srcdir)/'`speed.c
+
+libsox_la-splice.lo: splice.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-splice.lo -MD -MP -MF $(DEPDIR)/libsox_la-splice.Tpo -c -o libsox_la-splice.lo `test -f 'splice.c' || echo '$(srcdir)/'`splice.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-splice.Tpo $(DEPDIR)/libsox_la-splice.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='splice.c' object='libsox_la-splice.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-splice.lo `test -f 'splice.c' || echo '$(srcdir)/'`splice.c
+
+libsox_la-stat.lo: stat.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-stat.lo -MD -MP -MF $(DEPDIR)/libsox_la-stat.Tpo -c -o libsox_la-stat.lo `test -f 'stat.c' || echo '$(srcdir)/'`stat.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-stat.Tpo $(DEPDIR)/libsox_la-stat.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stat.c' object='libsox_la-stat.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-stat.lo `test -f 'stat.c' || echo '$(srcdir)/'`stat.c
+
+libsox_la-stats.lo: stats.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-stats.lo -MD -MP -MF $(DEPDIR)/libsox_la-stats.Tpo -c -o libsox_la-stats.lo `test -f 'stats.c' || echo '$(srcdir)/'`stats.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-stats.Tpo $(DEPDIR)/libsox_la-stats.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stats.c' object='libsox_la-stats.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-stats.lo `test -f 'stats.c' || echo '$(srcdir)/'`stats.c
+
+libsox_la-stretch.lo: stretch.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-stretch.lo -MD -MP -MF $(DEPDIR)/libsox_la-stretch.Tpo -c -o libsox_la-stretch.lo `test -f 'stretch.c' || echo '$(srcdir)/'`stretch.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-stretch.Tpo $(DEPDIR)/libsox_la-stretch.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stretch.c' object='libsox_la-stretch.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-stretch.lo `test -f 'stretch.c' || echo '$(srcdir)/'`stretch.c
+
+libsox_la-swap.lo: swap.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-swap.lo -MD -MP -MF $(DEPDIR)/libsox_la-swap.Tpo -c -o libsox_la-swap.lo `test -f 'swap.c' || echo '$(srcdir)/'`swap.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-swap.Tpo $(DEPDIR)/libsox_la-swap.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='swap.c' object='libsox_la-swap.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-swap.lo `test -f 'swap.c' || echo '$(srcdir)/'`swap.c
+
+libsox_la-synth.lo: synth.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-synth.lo -MD -MP -MF $(DEPDIR)/libsox_la-synth.Tpo -c -o libsox_la-synth.lo `test -f 'synth.c' || echo '$(srcdir)/'`synth.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-synth.Tpo $(DEPDIR)/libsox_la-synth.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='synth.c' object='libsox_la-synth.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-synth.lo `test -f 'synth.c' || echo '$(srcdir)/'`synth.c
+
+libsox_la-tempo.lo: tempo.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-tempo.lo -MD -MP -MF $(DEPDIR)/libsox_la-tempo.Tpo -c -o libsox_la-tempo.lo `test -f 'tempo.c' || echo '$(srcdir)/'`tempo.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-tempo.Tpo $(DEPDIR)/libsox_la-tempo.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tempo.c' object='libsox_la-tempo.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-tempo.lo `test -f 'tempo.c' || echo '$(srcdir)/'`tempo.c
+
+libsox_la-tremolo.lo: tremolo.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-tremolo.lo -MD -MP -MF $(DEPDIR)/libsox_la-tremolo.Tpo -c -o libsox_la-tremolo.lo `test -f 'tremolo.c' || echo '$(srcdir)/'`tremolo.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-tremolo.Tpo $(DEPDIR)/libsox_la-tremolo.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tremolo.c' object='libsox_la-tremolo.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-tremolo.lo `test -f 'tremolo.c' || echo '$(srcdir)/'`tremolo.c
+
+libsox_la-trim.lo: trim.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-trim.lo -MD -MP -MF $(DEPDIR)/libsox_la-trim.Tpo -c -o libsox_la-trim.lo `test -f 'trim.c' || echo '$(srcdir)/'`trim.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-trim.Tpo $(DEPDIR)/libsox_la-trim.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='trim.c' object='libsox_la-trim.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-trim.lo `test -f 'trim.c' || echo '$(srcdir)/'`trim.c
+
+libsox_la-upsample.lo: upsample.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-upsample.lo -MD -MP -MF $(DEPDIR)/libsox_la-upsample.Tpo -c -o libsox_la-upsample.lo `test -f 'upsample.c' || echo '$(srcdir)/'`upsample.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-upsample.Tpo $(DEPDIR)/libsox_la-upsample.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='upsample.c' object='libsox_la-upsample.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-upsample.lo `test -f 'upsample.c' || echo '$(srcdir)/'`upsample.c
+
+libsox_la-vad.lo: vad.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-vad.lo -MD -MP -MF $(DEPDIR)/libsox_la-vad.Tpo -c -o libsox_la-vad.lo `test -f 'vad.c' || echo '$(srcdir)/'`vad.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-vad.Tpo $(DEPDIR)/libsox_la-vad.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vad.c' object='libsox_la-vad.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-vad.lo `test -f 'vad.c' || echo '$(srcdir)/'`vad.c
+
+libsox_la-vol.lo: vol.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-vol.lo -MD -MP -MF $(DEPDIR)/libsox_la-vol.Tpo -c -o libsox_la-vol.lo `test -f 'vol.c' || echo '$(srcdir)/'`vol.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-vol.Tpo $(DEPDIR)/libsox_la-vol.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vol.c' object='libsox_la-vol.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-vol.lo `test -f 'vol.c' || echo '$(srcdir)/'`vol.c
+
+libsox_la-spectrogram.lo: spectrogram.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-spectrogram.lo -MD -MP -MF $(DEPDIR)/libsox_la-spectrogram.Tpo -c -o libsox_la-spectrogram.lo `test -f 'spectrogram.c' || echo '$(srcdir)/'`spectrogram.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-spectrogram.Tpo $(DEPDIR)/libsox_la-spectrogram.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spectrogram.c' object='libsox_la-spectrogram.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-spectrogram.lo `test -f 'spectrogram.c' || echo '$(srcdir)/'`spectrogram.c
+
+libsox_la-win32-ltdl.lo: win32-ltdl.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-win32-ltdl.lo -MD -MP -MF $(DEPDIR)/libsox_la-win32-ltdl.Tpo -c -o libsox_la-win32-ltdl.lo `test -f 'win32-ltdl.c' || echo '$(srcdir)/'`win32-ltdl.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-win32-ltdl.Tpo $(DEPDIR)/libsox_la-win32-ltdl.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='win32-ltdl.c' object='libsox_la-win32-ltdl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-win32-ltdl.lo `test -f 'win32-ltdl.c' || echo '$(srcdir)/'`win32-ltdl.c
+
+libsox_la-raw-fmt.lo: raw-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-raw-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-raw-fmt.Tpo -c -o libsox_la-raw-fmt.lo `test -f 'raw-fmt.c' || echo '$(srcdir)/'`raw-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-raw-fmt.Tpo $(DEPDIR)/libsox_la-raw-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='raw-fmt.c' object='libsox_la-raw-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-raw-fmt.lo `test -f 'raw-fmt.c' || echo '$(srcdir)/'`raw-fmt.c
+
+libsox_la-s1-fmt.lo: s1-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-s1-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-s1-fmt.Tpo -c -o libsox_la-s1-fmt.lo `test -f 's1-fmt.c' || echo '$(srcdir)/'`s1-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-s1-fmt.Tpo $(DEPDIR)/libsox_la-s1-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='s1-fmt.c' object='libsox_la-s1-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-s1-fmt.lo `test -f 's1-fmt.c' || echo '$(srcdir)/'`s1-fmt.c
+
+libsox_la-s2-fmt.lo: s2-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-s2-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-s2-fmt.Tpo -c -o libsox_la-s2-fmt.lo `test -f 's2-fmt.c' || echo '$(srcdir)/'`s2-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-s2-fmt.Tpo $(DEPDIR)/libsox_la-s2-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='s2-fmt.c' object='libsox_la-s2-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-s2-fmt.lo `test -f 's2-fmt.c' || echo '$(srcdir)/'`s2-fmt.c
+
+libsox_la-s3-fmt.lo: s3-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-s3-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-s3-fmt.Tpo -c -o libsox_la-s3-fmt.lo `test -f 's3-fmt.c' || echo '$(srcdir)/'`s3-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-s3-fmt.Tpo $(DEPDIR)/libsox_la-s3-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='s3-fmt.c' object='libsox_la-s3-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-s3-fmt.lo `test -f 's3-fmt.c' || echo '$(srcdir)/'`s3-fmt.c
+
+libsox_la-s4-fmt.lo: s4-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-s4-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-s4-fmt.Tpo -c -o libsox_la-s4-fmt.lo `test -f 's4-fmt.c' || echo '$(srcdir)/'`s4-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-s4-fmt.Tpo $(DEPDIR)/libsox_la-s4-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='s4-fmt.c' object='libsox_la-s4-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-s4-fmt.lo `test -f 's4-fmt.c' || echo '$(srcdir)/'`s4-fmt.c
+
+libsox_la-u1-fmt.lo: u1-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-u1-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-u1-fmt.Tpo -c -o libsox_la-u1-fmt.lo `test -f 'u1-fmt.c' || echo '$(srcdir)/'`u1-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-u1-fmt.Tpo $(DEPDIR)/libsox_la-u1-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='u1-fmt.c' object='libsox_la-u1-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-u1-fmt.lo `test -f 'u1-fmt.c' || echo '$(srcdir)/'`u1-fmt.c
+
+libsox_la-u2-fmt.lo: u2-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-u2-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-u2-fmt.Tpo -c -o libsox_la-u2-fmt.lo `test -f 'u2-fmt.c' || echo '$(srcdir)/'`u2-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-u2-fmt.Tpo $(DEPDIR)/libsox_la-u2-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='u2-fmt.c' object='libsox_la-u2-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-u2-fmt.lo `test -f 'u2-fmt.c' || echo '$(srcdir)/'`u2-fmt.c
+
+libsox_la-u3-fmt.lo: u3-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-u3-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-u3-fmt.Tpo -c -o libsox_la-u3-fmt.lo `test -f 'u3-fmt.c' || echo '$(srcdir)/'`u3-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-u3-fmt.Tpo $(DEPDIR)/libsox_la-u3-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='u3-fmt.c' object='libsox_la-u3-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-u3-fmt.lo `test -f 'u3-fmt.c' || echo '$(srcdir)/'`u3-fmt.c
+
+libsox_la-u4-fmt.lo: u4-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-u4-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-u4-fmt.Tpo -c -o libsox_la-u4-fmt.lo `test -f 'u4-fmt.c' || echo '$(srcdir)/'`u4-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-u4-fmt.Tpo $(DEPDIR)/libsox_la-u4-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='u4-fmt.c' object='libsox_la-u4-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-u4-fmt.lo `test -f 'u4-fmt.c' || echo '$(srcdir)/'`u4-fmt.c
+
+libsox_la-al-fmt.lo: al-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-al-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-al-fmt.Tpo -c -o libsox_la-al-fmt.lo `test -f 'al-fmt.c' || echo '$(srcdir)/'`al-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-al-fmt.Tpo $(DEPDIR)/libsox_la-al-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='al-fmt.c' object='libsox_la-al-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-al-fmt.lo `test -f 'al-fmt.c' || echo '$(srcdir)/'`al-fmt.c
+
+libsox_la-la-fmt.lo: la-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-la-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-la-fmt.Tpo -c -o libsox_la-la-fmt.lo `test -f 'la-fmt.c' || echo '$(srcdir)/'`la-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-la-fmt.Tpo $(DEPDIR)/libsox_la-la-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='la-fmt.c' object='libsox_la-la-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-la-fmt.lo `test -f 'la-fmt.c' || echo '$(srcdir)/'`la-fmt.c
+
+libsox_la-ul-fmt.lo: ul-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-ul-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-ul-fmt.Tpo -c -o libsox_la-ul-fmt.lo `test -f 'ul-fmt.c' || echo '$(srcdir)/'`ul-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-ul-fmt.Tpo $(DEPDIR)/libsox_la-ul-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ul-fmt.c' object='libsox_la-ul-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-ul-fmt.lo `test -f 'ul-fmt.c' || echo '$(srcdir)/'`ul-fmt.c
+
+libsox_la-lu-fmt.lo: lu-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-lu-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-lu-fmt.Tpo -c -o libsox_la-lu-fmt.lo `test -f 'lu-fmt.c' || echo '$(srcdir)/'`lu-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-lu-fmt.Tpo $(DEPDIR)/libsox_la-lu-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lu-fmt.c' object='libsox_la-lu-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-lu-fmt.lo `test -f 'lu-fmt.c' || echo '$(srcdir)/'`lu-fmt.c
+
+libsox_la-8svx.lo: 8svx.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-8svx.lo -MD -MP -MF $(DEPDIR)/libsox_la-8svx.Tpo -c -o libsox_la-8svx.lo `test -f '8svx.c' || echo '$(srcdir)/'`8svx.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-8svx.Tpo $(DEPDIR)/libsox_la-8svx.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='8svx.c' object='libsox_la-8svx.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-8svx.lo `test -f '8svx.c' || echo '$(srcdir)/'`8svx.c
+
+libsox_la-aiff-fmt.lo: aiff-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-aiff-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-aiff-fmt.Tpo -c -o libsox_la-aiff-fmt.lo `test -f 'aiff-fmt.c' || echo '$(srcdir)/'`aiff-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-aiff-fmt.Tpo $(DEPDIR)/libsox_la-aiff-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='aiff-fmt.c' object='libsox_la-aiff-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-aiff-fmt.lo `test -f 'aiff-fmt.c' || echo '$(srcdir)/'`aiff-fmt.c
+
+libsox_la-aifc-fmt.lo: aifc-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-aifc-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-aifc-fmt.Tpo -c -o libsox_la-aifc-fmt.lo `test -f 'aifc-fmt.c' || echo '$(srcdir)/'`aifc-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-aifc-fmt.Tpo $(DEPDIR)/libsox_la-aifc-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='aifc-fmt.c' object='libsox_la-aifc-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-aifc-fmt.lo `test -f 'aifc-fmt.c' || echo '$(srcdir)/'`aifc-fmt.c
+
+libsox_la-au.lo: au.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-au.lo -MD -MP -MF $(DEPDIR)/libsox_la-au.Tpo -c -o libsox_la-au.lo `test -f 'au.c' || echo '$(srcdir)/'`au.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-au.Tpo $(DEPDIR)/libsox_la-au.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='au.c' object='libsox_la-au.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-au.lo `test -f 'au.c' || echo '$(srcdir)/'`au.c
+
+libsox_la-avr.lo: avr.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-avr.lo -MD -MP -MF $(DEPDIR)/libsox_la-avr.Tpo -c -o libsox_la-avr.lo `test -f 'avr.c' || echo '$(srcdir)/'`avr.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-avr.Tpo $(DEPDIR)/libsox_la-avr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='avr.c' object='libsox_la-avr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-avr.lo `test -f 'avr.c' || echo '$(srcdir)/'`avr.c
+
+libsox_la-cdr.lo: cdr.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-cdr.lo -MD -MP -MF $(DEPDIR)/libsox_la-cdr.Tpo -c -o libsox_la-cdr.lo `test -f 'cdr.c' || echo '$(srcdir)/'`cdr.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-cdr.Tpo $(DEPDIR)/libsox_la-cdr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cdr.c' object='libsox_la-cdr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-cdr.lo `test -f 'cdr.c' || echo '$(srcdir)/'`cdr.c
+
+libsox_la-cvsd-fmt.lo: cvsd-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-cvsd-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-cvsd-fmt.Tpo -c -o libsox_la-cvsd-fmt.lo `test -f 'cvsd-fmt.c' || echo '$(srcdir)/'`cvsd-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-cvsd-fmt.Tpo $(DEPDIR)/libsox_la-cvsd-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cvsd-fmt.c' object='libsox_la-cvsd-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-cvsd-fmt.lo `test -f 'cvsd-fmt.c' || echo '$(srcdir)/'`cvsd-fmt.c
+
+libsox_la-dvms-fmt.lo: dvms-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-dvms-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-dvms-fmt.Tpo -c -o libsox_la-dvms-fmt.lo `test -f 'dvms-fmt.c' || echo '$(srcdir)/'`dvms-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-dvms-fmt.Tpo $(DEPDIR)/libsox_la-dvms-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dvms-fmt.c' object='libsox_la-dvms-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-dvms-fmt.lo `test -f 'dvms-fmt.c' || echo '$(srcdir)/'`dvms-fmt.c
+
+libsox_la-dat.lo: dat.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-dat.lo -MD -MP -MF $(DEPDIR)/libsox_la-dat.Tpo -c -o libsox_la-dat.lo `test -f 'dat.c' || echo '$(srcdir)/'`dat.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-dat.Tpo $(DEPDIR)/libsox_la-dat.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dat.c' object='libsox_la-dat.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-dat.lo `test -f 'dat.c' || echo '$(srcdir)/'`dat.c
+
+libsox_la-hcom.lo: hcom.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-hcom.lo -MD -MP -MF $(DEPDIR)/libsox_la-hcom.Tpo -c -o libsox_la-hcom.lo `test -f 'hcom.c' || echo '$(srcdir)/'`hcom.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-hcom.Tpo $(DEPDIR)/libsox_la-hcom.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hcom.c' object='libsox_la-hcom.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-hcom.lo `test -f 'hcom.c' || echo '$(srcdir)/'`hcom.c
+
+libsox_la-htk.lo: htk.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-htk.lo -MD -MP -MF $(DEPDIR)/libsox_la-htk.Tpo -c -o libsox_la-htk.lo `test -f 'htk.c' || echo '$(srcdir)/'`htk.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-htk.Tpo $(DEPDIR)/libsox_la-htk.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='htk.c' object='libsox_la-htk.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-htk.lo `test -f 'htk.c' || echo '$(srcdir)/'`htk.c
+
+libsox_la-maud.lo: maud.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-maud.lo -MD -MP -MF $(DEPDIR)/libsox_la-maud.Tpo -c -o libsox_la-maud.lo `test -f 'maud.c' || echo '$(srcdir)/'`maud.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-maud.Tpo $(DEPDIR)/libsox_la-maud.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='maud.c' object='libsox_la-maud.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-maud.lo `test -f 'maud.c' || echo '$(srcdir)/'`maud.c
+
+libsox_la-prc.lo: prc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-prc.lo -MD -MP -MF $(DEPDIR)/libsox_la-prc.Tpo -c -o libsox_la-prc.lo `test -f 'prc.c' || echo '$(srcdir)/'`prc.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-prc.Tpo $(DEPDIR)/libsox_la-prc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='prc.c' object='libsox_la-prc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-prc.lo `test -f 'prc.c' || echo '$(srcdir)/'`prc.c
+
+libsox_la-sf.lo: sf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sf.lo -MD -MP -MF $(DEPDIR)/libsox_la-sf.Tpo -c -o libsox_la-sf.lo `test -f 'sf.c' || echo '$(srcdir)/'`sf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sf.Tpo $(DEPDIR)/libsox_la-sf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sf.c' object='libsox_la-sf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sf.lo `test -f 'sf.c' || echo '$(srcdir)/'`sf.c
+
+libsox_la-smp.lo: smp.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-smp.lo -MD -MP -MF $(DEPDIR)/libsox_la-smp.Tpo -c -o libsox_la-smp.lo `test -f 'smp.c' || echo '$(srcdir)/'`smp.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-smp.Tpo $(DEPDIR)/libsox_la-smp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='smp.c' object='libsox_la-smp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-smp.lo `test -f 'smp.c' || echo '$(srcdir)/'`smp.c
+
+libsox_la-sounder.lo: sounder.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sounder.lo -MD -MP -MF $(DEPDIR)/libsox_la-sounder.Tpo -c -o libsox_la-sounder.lo `test -f 'sounder.c' || echo '$(srcdir)/'`sounder.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sounder.Tpo $(DEPDIR)/libsox_la-sounder.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sounder.c' object='libsox_la-sounder.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sounder.lo `test -f 'sounder.c' || echo '$(srcdir)/'`sounder.c
+
+libsox_la-soundtool.lo: soundtool.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-soundtool.lo -MD -MP -MF $(DEPDIR)/libsox_la-soundtool.Tpo -c -o libsox_la-soundtool.lo `test -f 'soundtool.c' || echo '$(srcdir)/'`soundtool.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-soundtool.Tpo $(DEPDIR)/libsox_la-soundtool.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='soundtool.c' object='libsox_la-soundtool.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-soundtool.lo `test -f 'soundtool.c' || echo '$(srcdir)/'`soundtool.c
+
+libsox_la-sphere.lo: sphere.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sphere.lo -MD -MP -MF $(DEPDIR)/libsox_la-sphere.Tpo -c -o libsox_la-sphere.lo `test -f 'sphere.c' || echo '$(srcdir)/'`sphere.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sphere.Tpo $(DEPDIR)/libsox_la-sphere.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sphere.c' object='libsox_la-sphere.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sphere.lo `test -f 'sphere.c' || echo '$(srcdir)/'`sphere.c
+
+libsox_la-tx16w.lo: tx16w.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-tx16w.lo -MD -MP -MF $(DEPDIR)/libsox_la-tx16w.Tpo -c -o libsox_la-tx16w.lo `test -f 'tx16w.c' || echo '$(srcdir)/'`tx16w.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-tx16w.Tpo $(DEPDIR)/libsox_la-tx16w.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tx16w.c' object='libsox_la-tx16w.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-tx16w.lo `test -f 'tx16w.c' || echo '$(srcdir)/'`tx16w.c
+
+libsox_la-voc.lo: voc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-voc.lo -MD -MP -MF $(DEPDIR)/libsox_la-voc.Tpo -c -o libsox_la-voc.lo `test -f 'voc.c' || echo '$(srcdir)/'`voc.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-voc.Tpo $(DEPDIR)/libsox_la-voc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='voc.c' object='libsox_la-voc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-voc.lo `test -f 'voc.c' || echo '$(srcdir)/'`voc.c
+
+libsox_la-vox-fmt.lo: vox-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-vox-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-vox-fmt.Tpo -c -o libsox_la-vox-fmt.lo `test -f 'vox-fmt.c' || echo '$(srcdir)/'`vox-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-vox-fmt.Tpo $(DEPDIR)/libsox_la-vox-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vox-fmt.c' object='libsox_la-vox-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-vox-fmt.lo `test -f 'vox-fmt.c' || echo '$(srcdir)/'`vox-fmt.c
+
+libsox_la-ima-fmt.lo: ima-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-ima-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-ima-fmt.Tpo -c -o libsox_la-ima-fmt.lo `test -f 'ima-fmt.c' || echo '$(srcdir)/'`ima-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-ima-fmt.Tpo $(DEPDIR)/libsox_la-ima-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ima-fmt.c' object='libsox_la-ima-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-ima-fmt.lo `test -f 'ima-fmt.c' || echo '$(srcdir)/'`ima-fmt.c
+
+libsox_la-adpcm.lo: adpcm.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-adpcm.lo -MD -MP -MF $(DEPDIR)/libsox_la-adpcm.Tpo -c -o libsox_la-adpcm.lo `test -f 'adpcm.c' || echo '$(srcdir)/'`adpcm.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-adpcm.Tpo $(DEPDIR)/libsox_la-adpcm.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='adpcm.c' object='libsox_la-adpcm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-adpcm.lo `test -f 'adpcm.c' || echo '$(srcdir)/'`adpcm.c
+
+libsox_la-ima_rw.lo: ima_rw.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-ima_rw.lo -MD -MP -MF $(DEPDIR)/libsox_la-ima_rw.Tpo -c -o libsox_la-ima_rw.lo `test -f 'ima_rw.c' || echo '$(srcdir)/'`ima_rw.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-ima_rw.Tpo $(DEPDIR)/libsox_la-ima_rw.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ima_rw.c' object='libsox_la-ima_rw.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-ima_rw.lo `test -f 'ima_rw.c' || echo '$(srcdir)/'`ima_rw.c
+
+libsox_la-wav.lo: wav.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-wav.lo -MD -MP -MF $(DEPDIR)/libsox_la-wav.Tpo -c -o libsox_la-wav.lo `test -f 'wav.c' || echo '$(srcdir)/'`wav.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-wav.Tpo $(DEPDIR)/libsox_la-wav.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wav.c' object='libsox_la-wav.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-wav.lo `test -f 'wav.c' || echo '$(srcdir)/'`wav.c
+
+libsox_la-wve.lo: wve.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-wve.lo -MD -MP -MF $(DEPDIR)/libsox_la-wve.Tpo -c -o libsox_la-wve.lo `test -f 'wve.c' || echo '$(srcdir)/'`wve.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-wve.Tpo $(DEPDIR)/libsox_la-wve.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wve.c' object='libsox_la-wve.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-wve.lo `test -f 'wve.c' || echo '$(srcdir)/'`wve.c
+
+libsox_la-xa.lo: xa.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-xa.lo -MD -MP -MF $(DEPDIR)/libsox_la-xa.Tpo -c -o libsox_la-xa.lo `test -f 'xa.c' || echo '$(srcdir)/'`xa.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-xa.Tpo $(DEPDIR)/libsox_la-xa.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xa.c' object='libsox_la-xa.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-xa.lo `test -f 'xa.c' || echo '$(srcdir)/'`xa.c
+
+libsox_la-nulfile.lo: nulfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-nulfile.lo -MD -MP -MF $(DEPDIR)/libsox_la-nulfile.Tpo -c -o libsox_la-nulfile.lo `test -f 'nulfile.c' || echo '$(srcdir)/'`nulfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-nulfile.Tpo $(DEPDIR)/libsox_la-nulfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nulfile.c' object='libsox_la-nulfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-nulfile.lo `test -f 'nulfile.c' || echo '$(srcdir)/'`nulfile.c
+
+libsox_la-f4-fmt.lo: f4-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-f4-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-f4-fmt.Tpo -c -o libsox_la-f4-fmt.lo `test -f 'f4-fmt.c' || echo '$(srcdir)/'`f4-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-f4-fmt.Tpo $(DEPDIR)/libsox_la-f4-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='f4-fmt.c' object='libsox_la-f4-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-f4-fmt.lo `test -f 'f4-fmt.c' || echo '$(srcdir)/'`f4-fmt.c
+
+libsox_la-f8-fmt.lo: f8-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-f8-fmt.lo -MD -MP -MF $(DEPDIR)/libsox_la-f8-fmt.Tpo -c -o libsox_la-f8-fmt.lo `test -f 'f8-fmt.c' || echo '$(srcdir)/'`f8-fmt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-f8-fmt.Tpo $(DEPDIR)/libsox_la-f8-fmt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='f8-fmt.c' object='libsox_la-f8-fmt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-f8-fmt.lo `test -f 'f8-fmt.c' || echo '$(srcdir)/'`f8-fmt.c
+
+libsox_la-gsrt.lo: gsrt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-gsrt.lo -MD -MP -MF $(DEPDIR)/libsox_la-gsrt.Tpo -c -o libsox_la-gsrt.lo `test -f 'gsrt.c' || echo '$(srcdir)/'`gsrt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-gsrt.Tpo $(DEPDIR)/libsox_la-gsrt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsrt.c' object='libsox_la-gsrt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-gsrt.lo `test -f 'gsrt.c' || echo '$(srcdir)/'`gsrt.c
+
+libsox_la-alsa.lo: alsa.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-alsa.lo -MD -MP -MF $(DEPDIR)/libsox_la-alsa.Tpo -c -o libsox_la-alsa.lo `test -f 'alsa.c' || echo '$(srcdir)/'`alsa.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-alsa.Tpo $(DEPDIR)/libsox_la-alsa.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alsa.c' object='libsox_la-alsa.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-alsa.lo `test -f 'alsa.c' || echo '$(srcdir)/'`alsa.c
+
+libsox_la-amr-nb.lo: amr-nb.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-amr-nb.lo -MD -MP -MF $(DEPDIR)/libsox_la-amr-nb.Tpo -c -o libsox_la-amr-nb.lo `test -f 'amr-nb.c' || echo '$(srcdir)/'`amr-nb.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-amr-nb.Tpo $(DEPDIR)/libsox_la-amr-nb.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='amr-nb.c' object='libsox_la-amr-nb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-amr-nb.lo `test -f 'amr-nb.c' || echo '$(srcdir)/'`amr-nb.c
+
+libsox_la-amr-wb.lo: amr-wb.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-amr-wb.lo -MD -MP -MF $(DEPDIR)/libsox_la-amr-wb.Tpo -c -o libsox_la-amr-wb.lo `test -f 'amr-wb.c' || echo '$(srcdir)/'`amr-wb.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-amr-wb.Tpo $(DEPDIR)/libsox_la-amr-wb.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='amr-wb.c' object='libsox_la-amr-wb.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-amr-wb.lo `test -f 'amr-wb.c' || echo '$(srcdir)/'`amr-wb.c
+
+libsox_la-ao.lo: ao.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-ao.lo -MD -MP -MF $(DEPDIR)/libsox_la-ao.Tpo -c -o libsox_la-ao.lo `test -f 'ao.c' || echo '$(srcdir)/'`ao.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-ao.Tpo $(DEPDIR)/libsox_la-ao.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ao.c' object='libsox_la-ao.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-ao.lo `test -f 'ao.c' || echo '$(srcdir)/'`ao.c
+
+libsox_la-coreaudio.lo: coreaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-coreaudio.lo -MD -MP -MF $(DEPDIR)/libsox_la-coreaudio.Tpo -c -o libsox_la-coreaudio.lo `test -f 'coreaudio.c' || echo '$(srcdir)/'`coreaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-coreaudio.Tpo $(DEPDIR)/libsox_la-coreaudio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='coreaudio.c' object='libsox_la-coreaudio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-coreaudio.lo `test -f 'coreaudio.c' || echo '$(srcdir)/'`coreaudio.c
+
+libsox_la-flac.lo: flac.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-flac.lo -MD -MP -MF $(DEPDIR)/libsox_la-flac.Tpo -c -o libsox_la-flac.lo `test -f 'flac.c' || echo '$(srcdir)/'`flac.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-flac.Tpo $(DEPDIR)/libsox_la-flac.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='flac.c' object='libsox_la-flac.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-flac.lo `test -f 'flac.c' || echo '$(srcdir)/'`flac.c
+
+libsox_la-gsm.lo: gsm.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-gsm.lo -MD -MP -MF $(DEPDIR)/libsox_la-gsm.Tpo -c -o libsox_la-gsm.lo `test -f 'gsm.c' || echo '$(srcdir)/'`gsm.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-gsm.Tpo $(DEPDIR)/libsox_la-gsm.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gsm.c' object='libsox_la-gsm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-gsm.lo `test -f 'gsm.c' || echo '$(srcdir)/'`gsm.c
+
+libsox_la-lpc10.lo: lpc10.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-lpc10.lo -MD -MP -MF $(DEPDIR)/libsox_la-lpc10.Tpo -c -o libsox_la-lpc10.lo `test -f 'lpc10.c' || echo '$(srcdir)/'`lpc10.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-lpc10.Tpo $(DEPDIR)/libsox_la-lpc10.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lpc10.c' object='libsox_la-lpc10.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-lpc10.lo `test -f 'lpc10.c' || echo '$(srcdir)/'`lpc10.c
+
+libsox_la-mp3.lo: mp3.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-mp3.lo -MD -MP -MF $(DEPDIR)/libsox_la-mp3.Tpo -c -o libsox_la-mp3.lo `test -f 'mp3.c' || echo '$(srcdir)/'`mp3.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-mp3.Tpo $(DEPDIR)/libsox_la-mp3.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mp3.c' object='libsox_la-mp3.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-mp3.lo `test -f 'mp3.c' || echo '$(srcdir)/'`mp3.c
+
+libsox_la-opus.lo: opus.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-opus.lo -MD -MP -MF $(DEPDIR)/libsox_la-opus.Tpo -c -o libsox_la-opus.lo `test -f 'opus.c' || echo '$(srcdir)/'`opus.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-opus.Tpo $(DEPDIR)/libsox_la-opus.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='opus.c' object='libsox_la-opus.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-opus.lo `test -f 'opus.c' || echo '$(srcdir)/'`opus.c
+
+libsox_la-oss.lo: oss.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-oss.lo -MD -MP -MF $(DEPDIR)/libsox_la-oss.Tpo -c -o libsox_la-oss.lo `test -f 'oss.c' || echo '$(srcdir)/'`oss.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-oss.Tpo $(DEPDIR)/libsox_la-oss.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oss.c' object='libsox_la-oss.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-oss.lo `test -f 'oss.c' || echo '$(srcdir)/'`oss.c
+
+libsox_la-pulseaudio.lo: pulseaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-pulseaudio.lo -MD -MP -MF $(DEPDIR)/libsox_la-pulseaudio.Tpo -c -o libsox_la-pulseaudio.lo `test -f 'pulseaudio.c' || echo '$(srcdir)/'`pulseaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-pulseaudio.Tpo $(DEPDIR)/libsox_la-pulseaudio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pulseaudio.c' object='libsox_la-pulseaudio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-pulseaudio.lo `test -f 'pulseaudio.c' || echo '$(srcdir)/'`pulseaudio.c
+
+libsox_la-waveaudio.lo: waveaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-waveaudio.lo -MD -MP -MF $(DEPDIR)/libsox_la-waveaudio.Tpo -c -o libsox_la-waveaudio.lo `test -f 'waveaudio.c' || echo '$(srcdir)/'`waveaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-waveaudio.Tpo $(DEPDIR)/libsox_la-waveaudio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='waveaudio.c' object='libsox_la-waveaudio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-waveaudio.lo `test -f 'waveaudio.c' || echo '$(srcdir)/'`waveaudio.c
+
+libsox_la-sndio.lo: sndio.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sndio.lo -MD -MP -MF $(DEPDIR)/libsox_la-sndio.Tpo -c -o libsox_la-sndio.lo `test -f 'sndio.c' || echo '$(srcdir)/'`sndio.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sndio.Tpo $(DEPDIR)/libsox_la-sndio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndio.c' object='libsox_la-sndio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sndio.lo `test -f 'sndio.c' || echo '$(srcdir)/'`sndio.c
+
+libsox_la-sunaudio.lo: sunaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sunaudio.lo -MD -MP -MF $(DEPDIR)/libsox_la-sunaudio.Tpo -c -o libsox_la-sunaudio.lo `test -f 'sunaudio.c' || echo '$(srcdir)/'`sunaudio.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sunaudio.Tpo $(DEPDIR)/libsox_la-sunaudio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sunaudio.c' object='libsox_la-sunaudio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sunaudio.lo `test -f 'sunaudio.c' || echo '$(srcdir)/'`sunaudio.c
+
+libsox_la-vorbis.lo: vorbis.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-vorbis.lo -MD -MP -MF $(DEPDIR)/libsox_la-vorbis.Tpo -c -o libsox_la-vorbis.lo `test -f 'vorbis.c' || echo '$(srcdir)/'`vorbis.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-vorbis.Tpo $(DEPDIR)/libsox_la-vorbis.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vorbis.c' object='libsox_la-vorbis.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-vorbis.lo `test -f 'vorbis.c' || echo '$(srcdir)/'`vorbis.c
+
+libsox_la-wavpack.lo: wavpack.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-wavpack.lo -MD -MP -MF $(DEPDIR)/libsox_la-wavpack.Tpo -c -o libsox_la-wavpack.lo `test -f 'wavpack.c' || echo '$(srcdir)/'`wavpack.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-wavpack.Tpo $(DEPDIR)/libsox_la-wavpack.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wavpack.c' object='libsox_la-wavpack.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-wavpack.lo `test -f 'wavpack.c' || echo '$(srcdir)/'`wavpack.c
+
+libsox_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_la-sndfile.Tpo -c -o libsox_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sndfile.Tpo $(DEPDIR)/libsox_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+libsox_la-caf.lo: caf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-caf.lo -MD -MP -MF $(DEPDIR)/libsox_la-caf.Tpo -c -o libsox_la-caf.lo `test -f 'caf.c' || echo '$(srcdir)/'`caf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-caf.Tpo $(DEPDIR)/libsox_la-caf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='caf.c' object='libsox_la-caf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-caf.lo `test -f 'caf.c' || echo '$(srcdir)/'`caf.c
+
+libsox_la-mat4.lo: mat4.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-mat4.lo -MD -MP -MF $(DEPDIR)/libsox_la-mat4.Tpo -c -o libsox_la-mat4.lo `test -f 'mat4.c' || echo '$(srcdir)/'`mat4.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-mat4.Tpo $(DEPDIR)/libsox_la-mat4.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mat4.c' object='libsox_la-mat4.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-mat4.lo `test -f 'mat4.c' || echo '$(srcdir)/'`mat4.c
+
+libsox_la-mat5.lo: mat5.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-mat5.lo -MD -MP -MF $(DEPDIR)/libsox_la-mat5.Tpo -c -o libsox_la-mat5.lo `test -f 'mat5.c' || echo '$(srcdir)/'`mat5.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-mat5.Tpo $(DEPDIR)/libsox_la-mat5.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mat5.c' object='libsox_la-mat5.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-mat5.lo `test -f 'mat5.c' || echo '$(srcdir)/'`mat5.c
+
+libsox_la-paf.lo: paf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-paf.lo -MD -MP -MF $(DEPDIR)/libsox_la-paf.Tpo -c -o libsox_la-paf.lo `test -f 'paf.c' || echo '$(srcdir)/'`paf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-paf.Tpo $(DEPDIR)/libsox_la-paf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='paf.c' object='libsox_la-paf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-paf.lo `test -f 'paf.c' || echo '$(srcdir)/'`paf.c
+
+libsox_la-fap.lo: fap.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-fap.lo -MD -MP -MF $(DEPDIR)/libsox_la-fap.Tpo -c -o libsox_la-fap.lo `test -f 'fap.c' || echo '$(srcdir)/'`fap.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-fap.Tpo $(DEPDIR)/libsox_la-fap.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fap.c' object='libsox_la-fap.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-fap.lo `test -f 'fap.c' || echo '$(srcdir)/'`fap.c
+
+libsox_la-w64.lo: w64.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-w64.lo -MD -MP -MF $(DEPDIR)/libsox_la-w64.Tpo -c -o libsox_la-w64.lo `test -f 'w64.c' || echo '$(srcdir)/'`w64.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-w64.Tpo $(DEPDIR)/libsox_la-w64.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='w64.c' object='libsox_la-w64.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-w64.lo `test -f 'w64.c' || echo '$(srcdir)/'`w64.c
+
+libsox_la-xi.lo: xi.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-xi.lo -MD -MP -MF $(DEPDIR)/libsox_la-xi.Tpo -c -o libsox_la-xi.lo `test -f 'xi.c' || echo '$(srcdir)/'`xi.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-xi.Tpo $(DEPDIR)/libsox_la-xi.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xi.c' object='libsox_la-xi.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-xi.lo `test -f 'xi.c' || echo '$(srcdir)/'`xi.c
+
+libsox_la-pvf.lo: pvf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-pvf.lo -MD -MP -MF $(DEPDIR)/libsox_la-pvf.Tpo -c -o libsox_la-pvf.lo `test -f 'pvf.c' || echo '$(srcdir)/'`pvf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-pvf.Tpo $(DEPDIR)/libsox_la-pvf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pvf.c' object='libsox_la-pvf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-pvf.lo `test -f 'pvf.c' || echo '$(srcdir)/'`pvf.c
+
+libsox_la-sd2.lo: sd2.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -MT libsox_la-sd2.lo -MD -MP -MF $(DEPDIR)/libsox_la-sd2.Tpo -c -o libsox_la-sd2.lo `test -f 'sd2.c' || echo '$(srcdir)/'`sd2.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_la-sd2.Tpo $(DEPDIR)/libsox_la-sd2.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sd2.c' object='libsox_la-sd2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_la_CFLAGS) $(CFLAGS) -c -o libsox_la-sd2.lo `test -f 'sd2.c' || echo '$(srcdir)/'`sd2.c
+
+libsox_fmt_caf_la-caf.lo: caf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_caf_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_caf_la-caf.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_caf_la-caf.Tpo -c -o libsox_fmt_caf_la-caf.lo `test -f 'caf.c' || echo '$(srcdir)/'`caf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_caf_la-caf.Tpo $(DEPDIR)/libsox_fmt_caf_la-caf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='caf.c' object='libsox_fmt_caf_la-caf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_caf_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_caf_la-caf.lo `test -f 'caf.c' || echo '$(srcdir)/'`caf.c
+
+libsox_fmt_caf_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_caf_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_caf_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_caf_la-sndfile.Tpo -c -o libsox_fmt_caf_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_caf_la-sndfile.Tpo $(DEPDIR)/libsox_fmt_caf_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_fmt_caf_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_caf_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_caf_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+libsox_fmt_fap_la-fap.lo: fap.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_fap_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_fap_la-fap.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_fap_la-fap.Tpo -c -o libsox_fmt_fap_la-fap.lo `test -f 'fap.c' || echo '$(srcdir)/'`fap.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_fap_la-fap.Tpo $(DEPDIR)/libsox_fmt_fap_la-fap.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fap.c' object='libsox_fmt_fap_la-fap.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_fap_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_fap_la-fap.lo `test -f 'fap.c' || echo '$(srcdir)/'`fap.c
+
+libsox_fmt_fap_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_fap_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_fap_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_fap_la-sndfile.Tpo -c -o libsox_fmt_fap_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_fap_la-sndfile.Tpo $(DEPDIR)/libsox_fmt_fap_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_fmt_fap_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_fap_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_fap_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+libsox_fmt_mat4_la-mat4.lo: mat4.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat4_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_mat4_la-mat4.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_mat4_la-mat4.Tpo -c -o libsox_fmt_mat4_la-mat4.lo `test -f 'mat4.c' || echo '$(srcdir)/'`mat4.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_mat4_la-mat4.Tpo $(DEPDIR)/libsox_fmt_mat4_la-mat4.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mat4.c' object='libsox_fmt_mat4_la-mat4.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat4_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_mat4_la-mat4.lo `test -f 'mat4.c' || echo '$(srcdir)/'`mat4.c
+
+libsox_fmt_mat4_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat4_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_mat4_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_mat4_la-sndfile.Tpo -c -o libsox_fmt_mat4_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_mat4_la-sndfile.Tpo $(DEPDIR)/libsox_fmt_mat4_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_fmt_mat4_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat4_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_mat4_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+libsox_fmt_mat5_la-mat5.lo: mat5.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat5_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_mat5_la-mat5.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_mat5_la-mat5.Tpo -c -o libsox_fmt_mat5_la-mat5.lo `test -f 'mat5.c' || echo '$(srcdir)/'`mat5.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_mat5_la-mat5.Tpo $(DEPDIR)/libsox_fmt_mat5_la-mat5.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mat5.c' object='libsox_fmt_mat5_la-mat5.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat5_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_mat5_la-mat5.lo `test -f 'mat5.c' || echo '$(srcdir)/'`mat5.c
+
+libsox_fmt_mat5_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat5_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_mat5_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_mat5_la-sndfile.Tpo -c -o libsox_fmt_mat5_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_mat5_la-sndfile.Tpo $(DEPDIR)/libsox_fmt_mat5_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_fmt_mat5_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_mat5_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_mat5_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+libsox_fmt_opus_la-opus.lo: opus.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_opus_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_opus_la-opus.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_opus_la-opus.Tpo -c -o libsox_fmt_opus_la-opus.lo `test -f 'opus.c' || echo '$(srcdir)/'`opus.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_opus_la-opus.Tpo $(DEPDIR)/libsox_fmt_opus_la-opus.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='opus.c' object='libsox_fmt_opus_la-opus.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_opus_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_opus_la-opus.lo `test -f 'opus.c' || echo '$(srcdir)/'`opus.c
+
+libsox_fmt_paf_la-paf.lo: paf.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_paf_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_paf_la-paf.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_paf_la-paf.Tpo -c -o libsox_fmt_paf_la-paf.lo `test -f 'paf.c' || echo '$(srcdir)/'`paf.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_paf_la-paf.Tpo $(DEPDIR)/libsox_fmt_paf_la-paf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='paf.c' object='libsox_fmt_paf_la-paf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_paf_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_paf_la-paf.lo `test -f 'paf.c' || echo '$(srcdir)/'`paf.c
+
+libsox_fmt_paf_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_paf_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_paf_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_paf_la-sndfile.Tpo -c -o libsox_fmt_paf_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_paf_la-sndfile.Tpo $(DEPDIR)/libsox_fmt_paf_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_fmt_paf_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_paf_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_paf_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+libsox_fmt_sndfile_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_sndfile_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_sndfile_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_sndfile_la-sndfile.Tpo -c -o libsox_fmt_sndfile_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_sndfile_la-sndfile.Tpo $(DEPDIR)/libsox_fmt_sndfile_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_fmt_sndfile_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_sndfile_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_sndfile_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+libsox_fmt_w64_la-w64.lo: w64.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_w64_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_w64_la-w64.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_w64_la-w64.Tpo -c -o libsox_fmt_w64_la-w64.lo `test -f 'w64.c' || echo '$(srcdir)/'`w64.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_w64_la-w64.Tpo $(DEPDIR)/libsox_fmt_w64_la-w64.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='w64.c' object='libsox_fmt_w64_la-w64.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_w64_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_w64_la-w64.lo `test -f 'w64.c' || echo '$(srcdir)/'`w64.c
+
+libsox_fmt_w64_la-sndfile.lo: sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_w64_la_CFLAGS) $(CFLAGS) -MT libsox_fmt_w64_la-sndfile.lo -MD -MP -MF $(DEPDIR)/libsox_fmt_w64_la-sndfile.Tpo -c -o libsox_fmt_w64_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsox_fmt_w64_la-sndfile.Tpo $(DEPDIR)/libsox_fmt_w64_la-sndfile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sndfile.c' object='libsox_fmt_w64_la-sndfile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsox_fmt_w64_la_CFLAGS) $(CFLAGS) -c -o libsox_fmt_w64_la-sndfile.lo `test -f 'sndfile.c' || echo '$(srcdir)/'`sndfile.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) soxconfig.h
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool clean-local clean-pkglibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-local distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES \
+ install-pkglibLTLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLTLIBRARIES uninstall-pkglibLTLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: all install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+ clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool clean-local clean-pkglibLTLIBRARIES \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-local distclean-tags distdir dvi dvi-am html html-am \
+ info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLTLIBRARIES install-man install-pdf \
+ install-pdf-am install-pkglibLTLIBRARIES install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLTLIBRARIES \
+ uninstall-pkglibLTLIBRARIES
+
+
+all: sox$(EXEEXT) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT) sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT)
+
+play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT): sox$(EXEEXT)
+ if test "$(PLAYRECLINKS)" = "yes"; then \
+ test -f sox$(EXEEXT) && ( $(RM) $@ && $(LN_S) sox$(EXEEXT) $@ ) || $(LN_S) sox $@; \
+ fi
+
+install-exec-hook:
+ if test "$(PLAYRECLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) play$(EXEEXT) rec$(EXEEXT); $(LN_S) sox$(EXEEXT) play$(EXEEXT); $(LN_S) sox$(EXEEXT) rec$(EXEEXT); \
+ fi
+ if test "$(SYMLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); $(LN_S) sox$(EXEEXT) soxi$(EXEEXT); \
+ fi
+
+uninstall-hook:
+ if test "$(PLAYRECLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) play$(EXTEXT) rec$(EXEEXT); \
+ fi
+ if test "$(SYMLINKS)" = "yes"; then \
+ cd $(DESTDIR)$(bindir); $(RM) soxi$(EXEEXT); \
+ fi
+
+clean-local:
+ $(RM) play$(EXEEXT) rec$(EXEEXT) soxi$(EXEEXT)
+ $(RM) sox_sample_test$(EXEEXT)
+ $(RM) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) example6$(EXEEXT)
+
+distclean-local:
+
+loc:
+ sloccount \
+ $(include_HEADERS) \
+ $(sox_SOURCES) \
+ $(example0_SOURCES) \
+ $(example1_SOURCES) \
+ $(example2_SOURCES) \
+ $(example3_SOURCES) \
+ $(example4_SOURCES) \
+ $(example5_SOURCES) \
+ $(example6_SOURCES) \
+ $(sox_sample_test_SOURCES) \
+ $(libsox_la_SOURCES)
+
+# Ideally we would use the "check" target so that "make distcheck"
+# would run the test suite, but an uninstalled libltdl build cannot
+# currently load its formats and effects, so the checks would fail.
+installcheck:
+ $(srcdir)/tests.sh --bindir=${bindir} --builddir=${builddir} --srcdir=${srcdir}
+ $(srcdir)/testall.sh --bindir=${bindir} --srcdir=${srcdir}
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/src/adpcm.c b/src/src/adpcm.c
new file mode 100644
index 0000000..012e99c
--- /dev/null
+++ b/src/src/adpcm.c
@@ -0,0 +1,361 @@
+/* adpcm.c codex functions for MS_ADPCM data
+ * (hopefully) provides interoperability with
+ * Microsoft's ADPCM format, but, as usual,
+ * see LACK-OF-WARRANTY information below.
+ *
+ * Copyright (C) 1999 Stanley J. Brooks <stabro@megsinet.net>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/*
+ * November 22, 1999
+ * specs I've seen are unclear about ADPCM supporting more than 2 channels,
+ * but these routines support more channels in a manner which looks (IMHO)
+ * like the most natural extension.
+ *
+ * Remark: code still turbulent, encoding very new.
+ *
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/adpcm.h"
+
+#include <sys/types.h>
+#include <stdio.h>
+
+typedef struct {
+ sox_sample_t step; /* step size */
+ short coef[2];
+} MsState_t;
+
+#define lsbshortldi(x,p) { (x)=((short)((int)(p)[0] + ((int)(p)[1]<<8))); (p) += 2; }
+
+/*
+ * Lookup tables for MS ADPCM format
+ */
+
+/* these are step-size adjust factors, where
+ * 1.0 is scaled to 0x100
+ */
+static const
+sox_sample_t stepAdjustTable[] = {
+ 230, 230, 230, 230, 307, 409, 512, 614,
+ 768, 614, 512, 409, 307, 230, 230, 230
+};
+
+/* TODO : The first 7 lsx_ms_adpcm_i_coef sets are always hardcoded and must
+ appear in the actual WAVE file. They should be read in
+ in case a sound program added extras to the list. */
+
+const short lsx_ms_adpcm_i_coef[7][2] = {
+ { 256, 0},
+ { 512,-256},
+ { 0, 0},
+ { 192, 64},
+ { 240, 0},
+ { 460,-208},
+ { 392,-232}
+};
+
+static inline sox_sample_t AdpcmDecode(sox_sample_t c, MsState_t *state,
+ sox_sample_t sample1, sox_sample_t sample2)
+{
+ sox_sample_t vlin;
+ sox_sample_t sample;
+ sox_sample_t step;
+
+ /** Compute next step value **/
+ step = state->step;
+ {
+ sox_sample_t nstep;
+ nstep = (stepAdjustTable[c] * step) >> 8;
+ state->step = (nstep < 16)? 16:nstep;
+ }
+
+ /** make linear prediction for next sample **/
+ vlin =
+ ((sample1 * state->coef[0]) +
+ (sample2 * state->coef[1])) >> 8;
+ /** then add the code*step adjustment **/
+ c -= (c & 0x08) << 1;
+ sample = (c * step) + vlin;
+
+ if (sample > 0x7fff) sample = 0x7fff;
+ else if (sample < -0x8000) sample = -0x8000;
+
+ return (sample);
+}
+
+/* lsx_ms_adpcm_block_expand_i() outputs interleaved samples into one output buffer */
+const char *lsx_ms_adpcm_block_expand_i(
+ unsigned chans, /* total channels */
+ int nCoef,
+ const short *coef,
+ const unsigned char *ibuff,/* input buffer[blockAlign] */
+ SAMPL *obuff, /* output samples, n*chans */
+ int n /* samples to decode PER channel */
+)
+{
+ const unsigned char *ip;
+ unsigned ch;
+ const char *errmsg = NULL;
+ MsState_t state[4]; /* One decompressor state for each channel */
+
+ /* Read the four-byte header for each channel */
+ ip = ibuff;
+ for (ch = 0; ch < chans; ch++) {
+ unsigned char bpred = *ip++;
+ if (bpred >= nCoef) {
+ errmsg = "MSADPCM bpred >= nCoef, arbitrarily using 0\n";
+ bpred = 0;
+ }
+ state[ch].coef[0] = coef[(int)bpred*2+0];
+ state[ch].coef[1] = coef[(int)bpred*2+1];
+ }
+
+ for (ch = 0; ch < chans; ch++)
+ lsbshortldi(state[ch].step, ip);
+
+ /* sample1's directly into obuff */
+ for (ch = 0; ch < chans; ch++)
+ lsbshortldi(obuff[chans+ch], ip);
+
+ /* sample2's directly into obuff */
+ for (ch = 0; ch < chans; ch++)
+ lsbshortldi(obuff[ch], ip);
+
+ {
+ unsigned ch2;
+ unsigned char b;
+ short *op, *top, *tmp;
+
+ /* already have 1st 2 samples from block-header */
+ op = obuff + 2*chans;
+ top = obuff + n*chans;
+
+ ch2 = 0;
+ while (op < top) { /*** N.B. Without int casts, crashes on 64-bit arch ***/
+ b = *ip++;
+ tmp = op;
+ *op++ = AdpcmDecode(b >> 4, state+ch2, tmp[-(int)chans], tmp[-(int)(2*chans)]);
+ if (++ch2 == chans) ch2 = 0;
+ tmp = op;
+ *op++ = AdpcmDecode(b&0x0f, state+ch2, tmp[-(int)chans], tmp[-(int)(2*chans)]);
+ if (++ch2 == chans) ch2 = 0;
+ }
+ }
+ return errmsg;
+}
+
+static int AdpcmMashS(
+ unsigned ch, /* channel number to encode, REQUIRE 0 <= ch < chans */
+ unsigned chans, /* total channels */
+ SAMPL v[2], /* values to use as starting 2 */
+ const short coef[2],/* lin predictor coeffs */
+ const SAMPL *ibuff, /* ibuff[] is interleaved input samples */
+ int n, /* samples to encode PER channel */
+ int *iostep, /* input/output step, REQUIRE 16 <= *st <= 0x7fff */
+ unsigned char *obuff /* output buffer[blockAlign], or NULL for no output */
+)
+{
+ const SAMPL *ip, *itop;
+ unsigned char *op;
+ int ox = 0; /* */
+ int d, v0, v1, step;
+ double d2; /* long long is okay also, speed abt the same */
+
+ ip = ibuff + ch; /* point ip to 1st input sample for this channel */
+ itop = ibuff + n*chans;
+ v0 = v[0];
+ v1 = v[1];
+ d = *ip - v1; ip += chans; /* 1st input sample for this channel */
+ d2 = d*d; /* d2 will be sum of squares of errors, given input v0 and *st */
+ d = *ip - v0; ip += chans; /* 2nd input sample for this channel */
+ d2 += d*d;
+
+ step = *iostep;
+
+ op = obuff; /* output pointer (or NULL) */
+ if (op) { /* NULL means don't output, just compute the rms error */
+ op += chans; /* skip bpred indices */
+ op += 2*ch; /* channel's stepsize */
+ op[0] = step; op[1] = step>>8;
+ op += 2*chans; /* skip to v0 */
+ op[0] = v0; op[1] = v0>>8;
+ op += 2*chans; /* skip to v1 */
+ op[0] = v1; op[1] = v1>>8;
+ op = obuff+7*chans; /* point to base of output nibbles */
+ ox = 4*ch;
+ }
+ for (; ip < itop; ip+=chans) {
+ int vlin,d3,dp,c;
+
+ /* make linear prediction for next sample */
+ vlin = (v0 * coef[0] + v1 * coef[1]) >> 8;
+ d3 = *ip - vlin; /* difference between linear prediction and current sample */
+ dp = d3 + (step<<3) + (step>>1);
+ c = 0;
+ if (dp>0) {
+ c = dp/step;
+ if (c>15) c = 15;
+ }
+ c -= 8;
+ dp = c * step; /* quantized estimate of samp - vlin */
+ c &= 0x0f; /* mask to 4 bits */
+
+ v1 = v0; /* shift history */
+ v0 = vlin + dp;
+ if (v0<-0x8000) v0 = -0x8000;
+ else if (v0>0x7fff) v0 = 0x7fff;
+
+ d3 = *ip - v0;
+ d2 += d3*d3; /* update square-error */
+
+ if (op) { /* if we want output, put it in proper place */
+ op[ox>>3] |= (ox&4)? c:(c<<4);
+ ox += 4*chans;
+ lsx_debug_more("%.1x",c);
+
+ }
+
+ /* Update the step for the next sample */
+ step = (stepAdjustTable[c] * step) >> 8;
+ if (step < 16) step = 16;
+
+ }
+ if (op) lsx_debug_more("\n");
+ d2 /= n; /* be sure it's non-negative */
+ lsx_debug_more("ch%d: st %d->%d, d %.1f\n", ch, *iostep, step, sqrt(d2));
+ *iostep = step;
+ return (int) sqrt(d2);
+}
+
+static inline void AdpcmMashChannel(
+ unsigned ch, /* channel number to encode, REQUIRE 0 <= ch < chans */
+ unsigned chans, /* total channels */
+ const SAMPL *ip, /* ip[] is interleaved input samples */
+ int n, /* samples to encode PER channel, REQUIRE */
+ int *st, /* input/output steps, 16<=st[i] */
+ unsigned char *obuff /* output buffer[blockAlign] */
+)
+{
+ SAMPL v[2];
+ int n0,s0,s1,ss,smin;
+ int dmin,k,kmin;
+
+ n0 = n/2; if (n0>32) n0=32;
+ if (*st<16) *st = 16;
+ v[1] = ip[ch];
+ v[0] = ip[ch+chans];
+
+ dmin = 0; kmin = 0; smin = 0;
+ /* for each of 7 standard coeff sets, we try compression
+ * beginning with last step-value, and with slightly
+ * forward-adjusted step-value, taking best of the 14
+ */
+ for (k=0; k<7; k++) {
+ int d0,d1;
+ ss = s0 = *st;
+ d0=AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[k], ip, n, &ss, NULL); /* with step s0 */
+
+ s1 = s0;
+ AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[k], ip, n0, &s1, NULL);
+ lsx_debug_more(" s32 %d\n",s1);
+ ss = s1 = (3*s0+s1)/4;
+ d1=AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[k], ip, n, &ss, NULL); /* with step s1 */
+ if (!k || d0<dmin || d1<dmin) {
+ kmin = k;
+ if (d0<=d1) {
+ dmin = d0;
+ smin = s0;
+ }else{
+ dmin = d1;
+ smin = s1;
+ }
+ }
+ }
+ *st = smin;
+ lsx_debug_more("kmin %d, smin %5d, ",kmin,smin);
+ AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[kmin], ip, n, st, obuff);
+ obuff[ch] = kmin;
+}
+
+void lsx_ms_adpcm_block_mash_i(
+ unsigned chans, /* total channels */
+ const SAMPL *ip, /* ip[n*chans] is interleaved input samples */
+ int n, /* samples to encode PER channel */
+ int *st, /* input/output steps, 16<=st[i] */
+ unsigned char *obuff, /* output buffer[blockAlign] */
+ int blockAlign /* >= 7*chans + chans*(n-2)/2.0 */
+)
+{
+ unsigned ch;
+ unsigned char *p;
+
+ lsx_debug_more("AdpcmMashI(chans %d, ip %p, n %d, st %p, obuff %p, bA %d)\n",
+ chans, (void *)ip, n, (void *)st, obuff, blockAlign);
+
+ for (p=obuff+7*chans; p<obuff+blockAlign; p++) *p=0;
+
+ for (ch=0; ch<chans; ch++)
+ AdpcmMashChannel(ch, chans, ip, n, st+ch, obuff);
+}
+
+/*
+ * lsx_ms_adpcm_samples_in(dataLen, chans, blockAlign, samplesPerBlock)
+ * returns the number of samples/channel which would be
+ * in the dataLen, given the other parameters ...
+ * if input samplesPerBlock is 0, then returns the max
+ * samplesPerBlock which would go into a block of size blockAlign
+ * Yes, it is confusing usage.
+ */
+size_t lsx_ms_adpcm_samples_in(
+ size_t dataLen,
+ size_t chans,
+ size_t blockAlign,
+ size_t samplesPerBlock
+){
+ size_t m, n;
+
+ if (samplesPerBlock) {
+ n = (dataLen / blockAlign) * samplesPerBlock;
+ m = (dataLen % blockAlign);
+ } else {
+ n = 0;
+ m = blockAlign;
+ }
+ if (m >= (size_t)(7*chans)) {
+ m -= 7*chans; /* bytes beyond block-header */
+ m = (2*m)/chans + 2; /* nibbles/chans + 2 in header */
+ if (samplesPerBlock && m > samplesPerBlock) m = samplesPerBlock;
+ n += m;
+ }
+ return n;
+}
+
+size_t lsx_ms_adpcm_bytes_per_block(
+ size_t chans,
+ size_t samplesPerBlock
+)
+{
+ size_t n;
+ n = 7*chans; /* header */
+ if (samplesPerBlock > 2)
+ n += (((size_t)samplesPerBlock-2)*chans + 1)/2;
+ return n;
+}
+
diff --git a/src/src/adpcm.h b/src/src/adpcm.h
new file mode 100644
index 0000000..0704564
--- /dev/null
+++ b/src/src/adpcm.h
@@ -0,0 +1,76 @@
+/* adpcm.h codex functions for MS_ADPCM data
+ * (hopefully) provides interoperability with
+ * Microsoft's ADPCM format, but, as usual,
+ * see LACK-OF-WARRANTY information below.
+ *
+ * Copyright (C) 1999 Stanley J. Brooks <stabro@megsinet.net>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#include "third_party/sox/src/src/sox.h"
+
+#ifndef SAMPL
+#define SAMPL short
+#endif
+
+/* default coef sets */
+extern const short lsx_ms_adpcm_i_coef[7][2];
+
+/* lsx_ms_adpcm_block_expand_i() outputs interleaved samples into one output buffer */
+extern const char *lsx_ms_adpcm_block_expand_i(
+ unsigned chans, /* total channels */
+ int nCoef,
+ const short *coef,
+ const unsigned char *ibuff,/* input buffer[blockAlign] */
+ SAMPL *obuff, /* output samples, n*chans */
+ int n /* samples to decode PER channel, REQUIRE n % 8 == 1 */
+);
+
+extern void lsx_ms_adpcm_block_mash_i(
+ unsigned chans, /* total channels */
+ const SAMPL *ip, /* ip[n*chans] is interleaved input samples */
+ int n, /* samples to encode PER channel, REQUIRE */
+ int *st, /* input/output steps, 16<=st[i] */
+ unsigned char *obuff, /* output buffer[blockAlign] */
+ int blockAlign /* >= 7*chans + n/2 */
+);
+
+/* Some helper functions for computing samples/block and blockalign */
+
+/*
+ * lsx_ms_adpcm_samples_in(dataLen, chans, blockAlign, samplesPerBlock)
+ * returns the number of samples/channel which would be
+ * in the dataLen, given the other parameters ...
+ * if input samplesPerBlock is 0, then returns the max
+ * samplesPerBlock which would go into a block of size blockAlign
+ * Yes, it is confusing usage.
+ */
+extern size_t lsx_ms_adpcm_samples_in(
+ size_t dataLen,
+ size_t chans,
+ size_t blockAlign,
+ size_t samplesPerBlock
+);
+
+/*
+ * size_t lsx_ms_adpcm_bytes_per_block(chans, samplesPerBlock)
+ * return minimum blocksize which would be required
+ * to encode number of chans with given samplesPerBlock
+ */
+extern size_t lsx_ms_adpcm_bytes_per_block(
+ size_t chans,
+ size_t samplesPerBlock
+);
diff --git a/src/src/adpcms.c b/src/src/adpcms.c
new file mode 100644
index 0000000..353d8ea
--- /dev/null
+++ b/src/src/adpcms.c
@@ -0,0 +1,322 @@
+/* libSoX ADPCM codecs: IMA, OKI, CL. (c) 2007-8 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/adpcms.h"
+
+static int const ima_steps[89] = { /* ~16-bit precision; 4 bit code */
+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
+ 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230,
+ 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963,
+ 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327,
+ 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442,
+ 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794,
+ 32767};
+
+static int const oki_steps[49] = { /* ~12-bit precision; 4 bit code */
+ 256, 272, 304, 336, 368, 400, 448, 496, 544, 592, 656, 720, 800, 880, 960,
+ 1056, 1168, 1280, 1408, 1552, 1712, 1888, 2080, 2288, 2512, 2768, 3040, 3344,
+ 3680, 4048, 4464, 4912, 5392, 5936, 6528, 7184, 7904, 8704, 9568, 10528,
+ 11584, 12736, 14016, 15408, 16960, 18656, 20512, 22576, 24832};
+
+static int const step_changes[8] = {-1, -1, -1, -1, 2, 4, 6, 8};
+
+/* Creative Labs ~8 bit precision; 4, 3, & 2 bit codes: */
+static int const cl4_steps[4] = {0x100, 0x200, 0x400, 0x800};
+static int const cl4_changes[8] = {-1, 0, 0, 0, 0, 1, 1, 1};
+
+static int const cl3_steps[5] = {0x100, 0x200, 0x400, 0x800, 0xA00};
+static int const cl3_changes[4] = {-1, 0, 0, 1};
+
+static int const cl2_steps[6] = {0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000};
+static int const cl2_changes[2] = {-1, 1};
+
+static adpcm_setup_t const setup_table[] = {
+ {88, 8, 2, ima_steps, step_changes, ~0},
+ {48, 8, 2, oki_steps, step_changes, ~15},
+ { 3, 8, 0, cl4_steps, cl4_changes , ~255},
+ { 4, 4, 0, cl3_steps, cl3_changes , ~255},
+ { 5, 2, 0, cl2_steps, cl2_changes , ~255},
+};
+
+void lsx_adpcm_init(adpcm_t * p, int type, int first_sample)
+{
+ p->setup = setup_table[type];
+ p->last_output = first_sample;
+ p->step_index = 0;
+ p->errors = 0;
+}
+
+#define min_sample -0x8000
+#define max_sample 0x7fff
+
+int lsx_adpcm_decode(int code, adpcm_t * p)
+{
+ int s = ((code & (p->setup.sign - 1)) << 1) | 1;
+ s = ((p->setup.steps[p->step_index] * s) >> (p->setup.shift + 1)) & p->setup.mask;
+ if (code & p->setup.sign)
+ s = -s;
+ s += p->last_output;
+ if (s < min_sample || s > max_sample) {
+ int grace = (p->setup.steps[p->step_index] >> (p->setup.shift + 1)) & p->setup.mask;
+ if (s < min_sample - grace || s > max_sample + grace) {
+ lsx_debug_most("code=%i step=%i grace=%i s=%i",
+ code & (2 * p->setup.sign - 1), p->setup.steps[p->step_index], grace, s);
+ p->errors++;
+ }
+ s = s < min_sample? min_sample : max_sample;
+ }
+ p->step_index += p->setup.changes[code & (p->setup.sign - 1)];
+ p->step_index = range_limit(p->step_index, 0, p->setup.max_step_index);
+ return p->last_output = s;
+}
+
+int lsx_adpcm_encode(int sample, adpcm_t * p)
+{
+ int delta = sample - p->last_output;
+ int sign = 0;
+ int code;
+ if (delta < 0) {
+ sign = p->setup.sign;
+ delta = -delta;
+ }
+ code = (delta << p->setup.shift) / p->setup.steps[p->step_index];
+ code = sign | min(code, p->setup.sign - 1);
+ lsx_adpcm_decode(code, p); /* Update encoder state */
+ return code;
+}
+
+
+/*
+ * Format methods
+ *
+ * Almost like the raw format functions, but cannot be used directly
+ * since they require an additional state parameter.
+ */
+
+/******************************************************************************
+ * Function : lsx_adpcm_reset
+ * Description: Resets the ADPCM codec state.
+ * Parameters : state - ADPCM state structure
+ * type - SOX_ENCODING_OKI_ADPCM or SOX_ENCODING_IMA_ADPCM
+ * Returns :
+ * Exceptions :
+ * Notes : 1. This function is used for framed ADPCM formats to reset
+ * the decoder between frames.
+ ******************************************************************************/
+
+void lsx_adpcm_reset(adpcm_io_t * state, sox_encoding_t type)
+{
+ state->file.count = 0;
+ state->file.pos = 0;
+ state->store.byte = 0;
+ state->store.flag = 0;
+
+ lsx_adpcm_init(&state->encoder, (type == SOX_ENCODING_OKI_ADPCM) ? 1 : 0, 0);
+}
+
+/******************************************************************************
+ * Function : lsx_adpcm_start
+ * Description: Initialises the file parameters and ADPCM codec state.
+ * Parameters : ft - file info structure
+ * state - ADPCM state structure
+ * type - SOX_ENCODING_OKI_ADPCM or SOX_ENCODING_IMA_ADPCM
+ * Returns : int - SOX_SUCCESS
+ * SOX_EOF
+ * Exceptions :
+ * Notes : 1. This function can be used as a startread or
+ * startwrite method.
+ * 2. VOX file format is 4-bit OKI ADPCM that decodes to
+ * to 12 bit signed linear PCM.
+ * 3. Dialogic only supports 6kHz, 8kHz and 11 kHz sampling
+ * rates but the codecs allows any user specified rate.
+ ******************************************************************************/
+
+static int adpcm_start(sox_format_t * ft, adpcm_io_t * state, sox_encoding_t type)
+{
+ /* setup file info */
+ state->file.buf = lsx_malloc(sox_globals.bufsiz);
+ state->file.size = sox_globals.bufsiz;
+ ft->signal.channels = 1;
+
+ lsx_adpcm_reset(state, type);
+
+ return lsx_rawstart(ft, sox_true, sox_false, sox_true, type, 4);
+}
+
+int lsx_adpcm_oki_start(sox_format_t * ft, adpcm_io_t * state)
+{
+ return adpcm_start(ft, state, SOX_ENCODING_OKI_ADPCM);
+}
+
+int lsx_adpcm_ima_start(sox_format_t * ft, adpcm_io_t * state)
+{
+ return adpcm_start(ft, state, SOX_ENCODING_IMA_ADPCM);
+}
+
+/******************************************************************************
+ * Function : lsx_adpcm_read
+ * Description: Converts the OKI ADPCM 4-bit samples to 16-bit signed PCM and
+ * then scales the samples to full sox_sample_t range.
+ * Parameters : ft - file info structure
+ * state - ADPCM state structure
+ * buffer - output buffer
+ * len - size of output buffer
+ * Returns : - number of samples returned in buffer
+ * Exceptions :
+ * Notes :
+ ******************************************************************************/
+
+size_t lsx_adpcm_read(sox_format_t * ft, adpcm_io_t * state, sox_sample_t * buffer, size_t len)
+{
+ size_t n = 0;
+ uint8_t byte;
+ int16_t word;
+
+ if (len && state->store.flag) {
+ word = lsx_adpcm_decode(state->store.byte, &state->encoder);
+ *buffer++ = SOX_SIGNED_16BIT_TO_SAMPLE(word, ft->clips);
+ state->store.flag = 0;
+ ++n;
+ }
+ while (n < len && lsx_read_b_buf(ft, &byte, (size_t) 1) == 1) {
+ word = lsx_adpcm_decode(byte >> 4, &state->encoder);
+ *buffer++ = SOX_SIGNED_16BIT_TO_SAMPLE(word, ft->clips);
+
+ if (++n < len) {
+ word = lsx_adpcm_decode(byte, &state->encoder);
+ *buffer++ = SOX_SIGNED_16BIT_TO_SAMPLE(word, ft->clips);
+ ++n;
+ } else {
+ state->store.byte = byte;
+ state->store.flag = 1;
+ }
+ }
+ return n;
+}
+
+/******************************************************************************
+ * Function : stopread
+ * Description: Frees the internal buffer allocated in voxstart/imastart.
+ * Parameters : ft - file info structure
+ * state - ADPCM state structure
+ * Returns : int - SOX_SUCCESS
+ * Exceptions :
+ * Notes :
+ ******************************************************************************/
+
+int lsx_adpcm_stopread(sox_format_t * ft UNUSED, adpcm_io_t * state)
+{
+ if (state->encoder.errors)
+ lsx_warn("%s: ADPCM state errors: %u", ft->filename, state->encoder.errors);
+ free(state->file.buf);
+
+ return (SOX_SUCCESS);
+}
+
+
+/******************************************************************************
+ * Function : write
+ * Description: Converts the supplied buffer to 12 bit linear PCM and encodes
+ * to OKI ADPCM 4-bit samples (packed a two nibbles per byte).
+ * Parameters : ft - file info structure
+ * state - ADPCM state structure
+ * buffer - output buffer
+ * length - size of output buffer
+ * Returns : int - SOX_SUCCESS
+ * SOX_EOF
+ * Exceptions :
+ * Notes :
+ ******************************************************************************/
+
+size_t lsx_adpcm_write(sox_format_t * ft, adpcm_io_t * state, const sox_sample_t * buffer, size_t length)
+{
+ size_t count = 0;
+ uint8_t byte = state->store.byte;
+ uint8_t flag = state->store.flag;
+ short word;
+
+ while (count < length) {
+ SOX_SAMPLE_LOCALS;
+ word = SOX_SAMPLE_TO_SIGNED_16BIT(*buffer++, ft->clips);
+
+ byte <<= 4;
+ byte |= lsx_adpcm_encode(word, &state->encoder) & 0x0F;
+
+ flag = !flag;
+
+ if (flag == 0) {
+ state->file.buf[state->file.count++] = byte;
+
+ if (state->file.count >= state->file.size) {
+ lsx_writebuf(ft, state->file.buf, state->file.count);
+
+ state->file.count = 0;
+ }
+ }
+
+ count++;
+ }
+
+ /* keep last byte across calls */
+ state->store.byte = byte;
+ state->store.flag = flag;
+ return (count);
+}
+
+/******************************************************************************
+ * Function : lsx_adpcm_flush
+ * Description: Flushes any leftover samples.
+ * Parameters : ft - file info structure
+ * state - ADPCM state structure
+ * Returns :
+ * Exceptions :
+ * Notes : 1. Called directly for writing framed formats
+ ******************************************************************************/
+
+void lsx_adpcm_flush(sox_format_t * ft, adpcm_io_t * state)
+{
+ uint8_t byte = state->store.byte;
+ uint8_t flag = state->store.flag;
+
+ /* flush remaining samples */
+
+ if (flag != 0) {
+ byte <<= 4;
+ state->file.buf[state->file.count++] = byte;
+ }
+ if (state->file.count > 0)
+ lsx_writebuf(ft, state->file.buf, state->file.count);
+}
+
+/******************************************************************************
+ * Function : lsx_adpcm_stopwrite
+ * Description: Flushes any leftover samples and frees the internal buffer
+ * allocated in voxstart/imastart.
+ * Parameters : ft - file info structure
+ * state - ADPCM state structure
+ * Returns : int - SOX_SUCCESS
+ * Exceptions :
+ * Notes :
+ ******************************************************************************/
+
+int lsx_adpcm_stopwrite(sox_format_t * ft, adpcm_io_t * state)
+{
+ lsx_adpcm_flush(ft, state);
+ free(state->file.buf);
+ return (SOX_SUCCESS);
+}
diff --git a/src/src/adpcms.h b/src/src/adpcms.h
new file mode 100644
index 0000000..bac2e2a
--- /dev/null
+++ b/src/src/adpcms.h
@@ -0,0 +1,55 @@
+/* libSoX ADPCM codecs: IMA, OKI, CL. (c) 2007-8 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+typedef struct {
+ int max_step_index;
+ int sign;
+ int shift;
+ int const * steps;
+ int const * changes;
+ int mask;
+} adpcm_setup_t;
+
+typedef struct {
+ adpcm_setup_t setup;
+ int last_output;
+ int step_index;
+ int errors;
+} adpcm_t;
+
+void lsx_adpcm_init(adpcm_t * p, int type, int first_sample);
+int lsx_adpcm_decode(int code, adpcm_t * p);
+int lsx_adpcm_encode(int sample, adpcm_t * p);
+
+typedef struct {
+ adpcm_t encoder;
+ struct {
+ uint8_t byte; /* write store */
+ uint8_t flag;
+ } store;
+ sox_fileinfo_t file;
+} adpcm_io_t;
+
+/* Format methods */
+void lsx_adpcm_reset(adpcm_io_t * state, sox_encoding_t type);
+int lsx_adpcm_oki_start(sox_format_t * ft, adpcm_io_t * state);
+int lsx_adpcm_ima_start(sox_format_t * ft, adpcm_io_t * state);
+size_t lsx_adpcm_read(sox_format_t * ft, adpcm_io_t * state, sox_sample_t *buffer, size_t len);
+int lsx_adpcm_stopread(sox_format_t * ft, adpcm_io_t * state);
+size_t lsx_adpcm_write(sox_format_t * ft, adpcm_io_t * state, const sox_sample_t *buffer, size_t length);
+void lsx_adpcm_flush(sox_format_t * ft, adpcm_io_t * state);
+int lsx_adpcm_stopwrite(sox_format_t * ft, adpcm_io_t * state);
diff --git a/src/src/aifc-fmt.c b/src/src/aifc-fmt.c
new file mode 100644
index 0000000..ba402ee
--- /dev/null
+++ b/src/src/aifc-fmt.c
@@ -0,0 +1,36 @@
+/* File format: AIFF-C (see aiff.c) (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/aiff.h"
+
+LSX_FORMAT_HANDLER(aifc)
+{
+ static char const * const names[] = {"aifc", "aiffc", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 32, 24, 16, 8, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ 0};
+ static sox_format_handler_t const sox_aifc_format = {SOX_LIB_VERSION_CODE,
+ "AIFF-C (not compressed), defined in DAVIC 1.4 Part 9 Annex B",
+ names, SOX_FILE_BIG_END,
+ lsx_aiffstartread, lsx_rawread, lsx_aiffstopread,
+ lsx_aifcstartwrite, lsx_rawwrite, lsx_aifcstopwrite,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &sox_aifc_format;
+}
diff --git a/src/src/aiff-fmt.c b/src/src/aiff-fmt.c
new file mode 100644
index 0000000..34c9e5d
--- /dev/null
+++ b/src/src/aiff-fmt.c
@@ -0,0 +1,33 @@
+/* File format: AIFF (see aiff.c) (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/aiff.h"
+
+LSX_FORMAT_HANDLER(aiff)
+{
+ static char const * const names[] = {"aiff", "aif", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 32, 24, 16, 8, 0, 0};
+ static sox_format_handler_t const sox_aiff_format = {SOX_LIB_VERSION_CODE,
+ "AIFF files used on Apple IIc/IIgs and SGI", names, SOX_FILE_BIG_END,
+ lsx_aiffstartread, lsx_rawread, lsx_aiffstopread,
+ lsx_aiffstartwrite, lsx_rawwrite, lsx_aiffstopwrite,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &sox_aiff_format;
+}
diff --git a/src/src/aiff.c b/src/src/aiff.c
new file mode 100644
index 0000000..99dd1d6
--- /dev/null
+++ b/src/src/aiff.c
@@ -0,0 +1,1141 @@
+/* libSoX SGI/Amiga AIFF format.
+ * Copyright 1991-2007 Guido van Rossum And Sundry Contributors
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Guido van Rossum And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ * Used by SGI on 4D/35 and Indigo.
+ * This is a subformat of the EA-IFF-85 format.
+ * This is related to the IFF format used by the Amiga.
+ * But, apparently, not the same.
+ * Also AIFF-C format output that is defined in DAVIC 1.4 Part 9 Annex B
+ * (usable for japanese-data-broadcasting, specified by ARIB STD-B24.)
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/aiff.h"
+
+#include <time.h> /* for time stamping comments */
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <limits.h>
+
+/* forward declarations */
+static double read_ieee_extended(sox_format_t *);
+static int aiffwriteheader(sox_format_t *, uint64_t);
+static int aifcwriteheader(sox_format_t *, uint64_t);
+static void write_ieee_extended(sox_format_t *, double);
+static double ConvertFromIeeeExtended(unsigned char*);
+static void ConvertToIeeeExtended(double, char *);
+static int textChunk(char **text, char *chunkDescription, sox_format_t * ft);
+static int commentChunk(char **text, char *chunkDescription, sox_format_t * ft);
+static void reportInstrument(sox_format_t * ft);
+
+int lsx_aiffstartread(sox_format_t * ft)
+{
+ char buf[5];
+ uint32_t totalsize;
+ uint32_t chunksize;
+ unsigned short channels = 0;
+ sox_encoding_t enc = SOX_ENCODING_SIGN2;
+ uint32_t frames;
+ unsigned short bits = 0;
+ double rate = 0.0;
+ uint32_t offset = 0;
+ uint32_t blocksize = 0;
+ int foundcomm = 0, foundmark = 0, foundinstr = 0, is_sowt = 0;
+ struct mark {
+ unsigned short id;
+ uint32_t position;
+ char name[40];
+ } marks[32];
+ unsigned short looptype;
+ int i, j;
+ unsigned short nmarks = 0;
+ unsigned short sustainLoopBegin = 0, sustainLoopEnd = 0,
+ releaseLoopBegin = 0, releaseLoopEnd = 0;
+ off_t seekto = 0;
+ size_t ssndsize = 0;
+ char *annotation;
+ char *author;
+ char *comment = NULL;
+ char *copyright;
+ char *nametext;
+
+ uint8_t trash8;
+ uint16_t trash16;
+ uint32_t trash32;
+
+ int rc;
+
+ /* FORM chunk */
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || strncmp(buf, "FORM", (size_t)4) != 0) {
+ lsx_fail_errno(ft,SOX_EHDR,"AIFF header does not begin with magic word `FORM'");
+ return(SOX_EOF);
+ }
+ lsx_readdw(ft, &totalsize);
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || (strncmp(buf, "AIFF", (size_t)4) != 0 &&
+ strncmp(buf, "AIFC", (size_t)4) != 0)) {
+ lsx_fail_errno(ft,SOX_EHDR,"AIFF `FORM' chunk does not specify `AIFF' or `AIFC' as type");
+ return(SOX_EOF);
+ }
+
+
+ /* Skip everything but the COMM chunk and the SSND chunk */
+ /* The SSND chunk must be the last in the file */
+ while (1) {
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF) {
+ if (ssndsize > 0)
+ break;
+ else {
+ lsx_fail_errno(ft,SOX_EHDR,"Missing SSND chunk in AIFF file");
+ return(SOX_EOF);
+ }
+ }
+ if (strncmp(buf, "COMM", (size_t)4) == 0) {
+ /* COMM chunk */
+ lsx_readdw(ft, &chunksize);
+ lsx_readw(ft, &channels);
+ lsx_readdw(ft, &frames);
+ lsx_readw(ft, &bits);
+ rate = read_ieee_extended(ft);
+ chunksize -= 18;
+ if (chunksize > 0) {
+ lsx_reads(ft, buf, (size_t)4);
+ chunksize -= 4;
+ if (strncmp(buf, "sowt", (size_t)4) == 0) {
+ /* CD audio as read on Mac OS machines */
+ /* Need to endian swap all the data */
+ is_sowt = 1;
+ }
+ else if (strncmp(buf, "fl32", (size_t)4) == 0 ||
+ strncmp(buf, "FL32", (size_t)4) == 0) {
+ enc = SOX_ENCODING_FLOAT;
+ if (bits != 32) {
+ lsx_fail_errno(ft, SOX_EHDR,
+ "Sample size of %u is not consistent with `fl32' compression type", bits);
+ return SOX_EOF;
+ }
+ }
+ else if (strncmp(buf, "fl64", (size_t)4) == 0 ||
+ strncmp(buf, "FL64", (size_t)4) == 0) {
+ enc = SOX_ENCODING_FLOAT;
+ if (bits != 64) {
+ lsx_fail_errno(ft, SOX_EHDR,
+ "Sample size of %u is not consistent with `fl64' compression type", bits);
+ return SOX_EOF;
+ }
+ }
+ else if (strncmp(buf, "NONE", (size_t)4) != 0 &&
+ strncmp(buf, "twos", (size_t)4) != 0) {
+ buf[4] = 0;
+ lsx_fail_errno(ft, SOX_EHDR, "Unsupported AIFC compression type `%s'", buf);
+ return(SOX_EOF);
+ }
+ }
+ while(chunksize-- > 0)
+ lsx_readb(ft, &trash8);
+ foundcomm = 1;
+ }
+ else if (strncmp(buf, "SSND", (size_t)4) == 0) {
+ /* SSND chunk */
+ lsx_readdw(ft, &chunksize);
+ lsx_readdw(ft, &offset);
+ lsx_readdw(ft, &blocksize);
+ chunksize -= 8;
+ ssndsize = chunksize;
+ /* word-align chunksize in case it wasn't
+ * done by writing application already.
+ */
+ chunksize += (chunksize % 2);
+ /* if can't seek, just do sound now */
+ if (!ft->seekable)
+ break;
+ /* else, seek to end of sound and hunt for more */
+ seekto = lsx_tell(ft);
+ lsx_seeki(ft, (off_t)chunksize, SEEK_CUR);
+ }
+ else if (strncmp(buf, "MARK", (size_t)4) == 0) {
+ /* MARK chunk */
+ lsx_readdw(ft, &chunksize);
+ if (chunksize >= sizeof(nmarks)) {
+ lsx_readw(ft, &nmarks);
+ chunksize -= sizeof(nmarks);
+ }
+ else nmarks = 0;
+
+ /* Some programs like to always have a MARK chunk
+ * but will set number of marks to 0 and force
+ * software to detect and ignore it.
+ */
+ if (nmarks == 0)
+ foundmark = 0;
+ else
+ foundmark = 1;
+
+ /* Make sure its not larger then we support */
+ if (nmarks > 32)
+ nmarks = 32;
+
+ for(i = 0; i < nmarks && chunksize; i++) {
+ unsigned char len, read_len, tmp_c;
+
+ if (chunksize < 6)
+ break;
+ lsx_readw(ft, &(marks[i].id));
+ lsx_readdw(ft, &(marks[i].position));
+ chunksize -= 6;
+ /* If error reading length then
+ * don't try to read more bytes
+ * based on that value.
+ */
+ if (lsx_readb(ft, &len) != SOX_SUCCESS)
+ break;
+ --chunksize;
+ if (len > chunksize)
+ len = chunksize;
+ read_len = len;
+ if (read_len > 39)
+ read_len = 39;
+ for(j = 0; j < len && chunksize; j++) {
+ lsx_readb(ft, &tmp_c);
+ if (j < read_len)
+ marks[i].name[j] = tmp_c;
+ chunksize--;
+ }
+ marks[i].name[read_len] = 0;
+ if ((len & 1) == 0 && chunksize) {
+ chunksize--;
+ lsx_readb(ft, &trash8);
+ }
+ }
+ /* HA HA! Sound Designer (and others) makes */
+ /* bogus files. It spits out bogus chunksize */
+ /* for MARK field */
+ while(chunksize-- > 0)
+ lsx_readb(ft, &trash8);
+ }
+ else if (strncmp(buf, "INST", (size_t)4) == 0) {
+ /* INST chunk */
+ lsx_readdw(ft, &chunksize);
+ lsx_readsb(ft, &(ft->oob.instr.MIDInote));
+ lsx_readb(ft, &trash8);
+ lsx_readsb(ft, &(ft->oob.instr.MIDIlow));
+ lsx_readsb(ft, &(ft->oob.instr.MIDIhi));
+ /* Low velocity */
+ lsx_readb(ft, &trash8);
+ /* Hi velocity */
+ lsx_readb(ft, &trash8);
+ lsx_readw(ft, &trash16);/* gain */
+ lsx_readw(ft, &looptype); /* sustain loop */
+ ft->oob.loops[0].type = looptype;
+ lsx_readw(ft, &sustainLoopBegin); /* begin marker */
+ lsx_readw(ft, &sustainLoopEnd); /* end marker */
+ lsx_readw(ft, &looptype); /* release loop */
+ ft->oob.loops[1].type = looptype;
+ lsx_readw(ft, &releaseLoopBegin); /* begin marker */
+ lsx_readw(ft, &releaseLoopEnd); /* end marker */
+
+ foundinstr = 1;
+ }
+ else if (strncmp(buf, "APPL", (size_t)4) == 0) {
+ lsx_readdw(ft, &chunksize);
+ /* word-align chunksize in case it wasn't
+ * done by writing application already.
+ */
+ chunksize += (chunksize % 2);
+ while(chunksize-- > 0)
+ lsx_readb(ft, &trash8);
+ }
+ else if (strncmp(buf, "ALCH", (size_t)4) == 0) {
+ /* I think this is bogus and gets grabbed by APPL */
+ /* INST chunk */
+ lsx_readdw(ft, &trash32); /* ENVS - jeez! */
+ lsx_readdw(ft, &chunksize);
+ while(chunksize-- > 0)
+ lsx_readb(ft, &trash8);
+ }
+ else if (strncmp(buf, "ANNO", (size_t)4) == 0) {
+ rc = textChunk(&annotation, "Annotation:", ft);
+ if (rc) {
+ /* Fail already called in function */
+ return(SOX_EOF);
+ }
+ if (annotation)
+ sox_append_comments(&ft->oob.comments, annotation);
+ free(annotation);
+ }
+ else if (strncmp(buf, "COMT", (size_t)4) == 0) {
+ rc = commentChunk(&comment, "Comment:", ft);
+ if (rc) {
+ /* Fail already called in function */
+ return(SOX_EOF);
+ }
+ if (comment)
+ sox_append_comments(&ft->oob.comments, comment);
+ free(comment);
+ }
+ else if (strncmp(buf, "AUTH", (size_t)4) == 0) {
+ /* Author chunk */
+ rc = textChunk(&author, "Author:", ft);
+ if (rc) {
+ /* Fail already called in function */
+ return(SOX_EOF);
+ }
+ free(author);
+ }
+ else if (strncmp(buf, "NAME", (size_t)4) == 0) {
+ /* Name chunk */
+ rc = textChunk(&nametext, "Name:", ft);
+ if (rc) {
+ /* Fail already called in function */
+ return(SOX_EOF);
+ }
+ free(nametext);
+ }
+ else if (strncmp(buf, "(c) ", (size_t)4) == 0) {
+ /* Copyright chunk */
+ rc = textChunk(©right, "Copyright:", ft);
+ if (rc) {
+ /* Fail already called in function */
+ return(SOX_EOF);
+ }
+ free(copyright);
+ }
+ else {
+ if (lsx_eof(ft))
+ break;
+ buf[4] = 0;
+ lsx_debug("AIFFstartread: ignoring `%s' chunk", buf);
+ lsx_readdw(ft, &chunksize);
+ if (lsx_eof(ft))
+ break;
+ /* Skip the chunk using lsx_readb() so we may read
+ from a pipe */
+ while (chunksize-- > 0) {
+ if (lsx_readb(ft, &trash8) == SOX_EOF)
+ break;
+ }
+ }
+ if (lsx_eof(ft))
+ break;
+ }
+
+ /*
+ * if a pipe, we lose all chunks after sound.
+ * Like, say, instrument loops.
+ */
+ if (ft->seekable) {
+ if (seekto > 0)
+ lsx_seeki(ft, seekto, SEEK_SET);
+ else {
+ lsx_fail_errno(ft,SOX_EOF,"AIFF: no sound data on input file");
+ return(SOX_EOF);
+ }
+ }
+ /* SSND chunk just read */
+ if (blocksize != 0)
+ lsx_warn("AIFF header has invalid blocksize. Ignoring but expect a premature EOF");
+
+ ssndsize -= offset;
+ while (offset-- > 0) {
+ if (lsx_readb(ft, &trash8) == SOX_EOF) {
+ lsx_fail_errno(ft,errno,"unexpected EOF while skipping AIFF offset");
+ return(SOX_EOF);
+ }
+ }
+
+ if (foundcomm) {
+ if (bits <= 8) bits = 8;
+ else if (bits <= 16) bits = 16;
+ else if (bits <= 24) bits = 24;
+ else if (bits <= 32) bits = 32;
+ else if (bits == 64 && enc == SOX_ENCODING_FLOAT) /* no-op */;
+ else {
+ lsx_fail_errno(ft,SOX_EFMT,"unsupported sample size in AIFF header: %d", bits);
+ return(SOX_EOF);
+ }
+ } else {
+ if ((ft->signal.channels == SOX_UNSPEC)
+ || (ft->signal.rate == SOX_UNSPEC)
+ || (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ || (ft->encoding.bits_per_sample == 0)) {
+ lsx_report("You must specify # channels, sample rate, signed/unsigned,");
+ lsx_report("and 8/16 on the command line.");
+ lsx_fail_errno(ft,SOX_EFMT,"Bogus AIFF file: no COMM section.");
+ return(SOX_EOF);
+ }
+
+ }
+ ssndsize /= bits >> 3;
+
+ /* Cope with 'sowt' CD tracks as read on Macs */
+ if (is_sowt)
+ ft->encoding.reverse_bytes = !ft->encoding.reverse_bytes;
+
+ if (foundmark && !foundinstr) {
+ lsx_debug("Ignoring MARK chunk since no INSTR found.");
+ foundmark = 0;
+ }
+ if (!foundmark && foundinstr) {
+ lsx_debug("Ignoring INSTR chunk since no MARK found.");
+ foundinstr = 0;
+ }
+ if (foundmark && foundinstr) {
+ int i2;
+ int slbIndex = 0, sleIndex = 0;
+ int rlbIndex = 0, rleIndex = 0;
+
+ /* find our loop markers and save their marker indexes */
+ for(i2 = 0; i2 < nmarks; i2++) {
+ if(marks[i2].id == sustainLoopBegin)
+ slbIndex = i2;
+ if(marks[i2].id == sustainLoopEnd)
+ sleIndex = i2;
+ if(marks[i2].id == releaseLoopBegin)
+ rlbIndex = i2;
+ if(marks[i2].id == releaseLoopEnd)
+ rleIndex = i2;
+ }
+
+ ft->oob.instr.nloops = 0;
+ if (ft->oob.loops[0].type != 0) {
+ ft->oob.loops[0].start = marks[slbIndex].position;
+ ft->oob.loops[0].length =
+ marks[sleIndex].position - marks[slbIndex].position;
+ /* really the loop count should be infinite */
+ ft->oob.loops[0].count = 1;
+ ft->oob.instr.loopmode = SOX_LOOP_SUSTAIN_DECAY | ft->oob.loops[0].type;
+ ft->oob.instr.nloops++;
+ }
+ if (ft->oob.loops[1].type != 0) {
+ ft->oob.loops[1].start = marks[rlbIndex].position;
+ ft->oob.loops[1].length =
+ marks[rleIndex].position - marks[rlbIndex].position;
+ /* really the loop count should be infinite */
+ ft->oob.loops[1].count = 1;
+ ft->oob.instr.loopmode = SOX_LOOP_SUSTAIN_DECAY | ft->oob.loops[1].type;
+ ft->oob.instr.nloops++;
+ }
+ }
+ reportInstrument(ft);
+
+ return lsx_check_read_params(
+ ft, channels, rate, enc, bits, (uint64_t)ssndsize, sox_false);
+}
+
+/* print out the MIDI key allocations, loop points, directions etc */
+static void reportInstrument(sox_format_t * ft)
+{
+ unsigned loopNum;
+
+ if(ft->oob.instr.nloops > 0)
+ lsx_report("AIFF Loop markers:");
+ for(loopNum = 0; loopNum < ft->oob.instr.nloops; loopNum++) {
+ if (ft->oob.loops[loopNum].count) {
+ lsx_report("Loop %d: start: %6lu", loopNum, (unsigned long)ft->oob.loops[loopNum].start);
+ lsx_report(" end: %6lu",
+ (unsigned long)(ft->oob.loops[loopNum].start + ft->oob.loops[loopNum].length));
+ lsx_report(" count: %6d", ft->oob.loops[loopNum].count);
+ lsx_report(" type: ");
+ switch(ft->oob.loops[loopNum].type & ~SOX_LOOP_SUSTAIN_DECAY) {
+ case 0: lsx_report("off"); break;
+ case 1: lsx_report("forward"); break;
+ case 2: lsx_report("forward/backward"); break;
+ }
+ }
+ }
+ lsx_report("Unity MIDI Note: %d", ft->oob.instr.MIDInote);
+ lsx_report("Low MIDI Note: %d", ft->oob.instr.MIDIlow);
+ lsx_report("High MIDI Note: %d", ft->oob.instr.MIDIhi);
+}
+
+/* Process a text chunk, allocate memory, display it if verbose and return */
+static int textChunk(char **text, char *chunkDescription, sox_format_t * ft)
+{
+ uint32_t chunksize0;
+ size_t chunksize;
+ lsx_readdw(ft, &chunksize0);
+ chunksize = chunksize0;
+
+ /* allocate enough memory to hold the text including a terminating \0 */
+ if (chunksize != SOX_SIZE_MAX)
+ *text = lsx_malloc((size_t)chunksize+1);
+ else
+ *text = lsx_malloc((size_t)chunksize);
+
+ if (lsx_readbuf(ft, *text, (size_t) chunksize) != chunksize)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"AIFF: Unexpected EOF in %s header", chunkDescription);
+ return(SOX_EOF);
+ }
+ if (chunksize != SOX_SIZE_MAX)
+ *(*text + chunksize) = '\0';
+ else
+ *(*text + chunksize-1) = '\0';
+ if (chunksize % 2)
+ {
+ /* Read past pad byte */
+ char c;
+ if (lsx_readbuf(ft, &c, (size_t)1) != 1)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"AIFF: Unexpected EOF in %s header", chunkDescription);
+ return(SOX_EOF);
+ }
+ }
+ lsx_debug("%-10s \"%s\"", chunkDescription, *text);
+ return(SOX_SUCCESS);
+}
+
+/* Comment lengths are words, not double words, and we can have several, so
+ we use a special function, not textChunk().;
+ */
+static int commentChunk(char **text, char *chunkDescription, sox_format_t * ft)
+{
+ uint32_t chunksize;
+ unsigned short numComments;
+ uint32_t timeStamp;
+ unsigned short markerId;
+ unsigned short totalCommentLength = 0;
+ unsigned int totalReadLength = 0;
+ unsigned int commentIndex;
+
+ lsx_readdw(ft, &chunksize);
+ lsx_readw(ft, &numComments);
+ totalReadLength += 2; /* chunksize doesn't count */
+ for(commentIndex = 0; commentIndex < numComments; commentIndex++) {
+ unsigned short commentLength;
+
+ lsx_readdw(ft, &timeStamp);
+ lsx_readw(ft, &markerId);
+ lsx_readw(ft, &commentLength);
+ if (((size_t)totalCommentLength) + commentLength > USHRT_MAX) {
+ lsx_fail_errno(ft,SOX_EOF,"AIFF: Comment too long in %s header", chunkDescription);
+ return(SOX_EOF);
+ }
+ totalCommentLength += commentLength;
+ /* allocate enough memory to hold the text including a terminating \0 */
+ if(commentIndex == 0) {
+ *text = lsx_malloc((size_t) totalCommentLength + 1);
+ }
+ else {
+ *text = lsx_realloc(*text, (size_t) totalCommentLength + 1);
+ }
+
+ if (lsx_readbuf(ft, *text + totalCommentLength - commentLength, (size_t) commentLength) != commentLength) {
+ lsx_fail_errno(ft,SOX_EOF,"AIFF: Unexpected EOF in %s header", chunkDescription);
+ return(SOX_EOF);
+ }
+ *(*text + totalCommentLength) = '\0';
+ totalReadLength += totalCommentLength + 4 + 2 + 2; /* include header */
+ if (commentLength % 2) {
+ /* Read past pad byte */
+ char c;
+ if (lsx_readbuf(ft, &c, (size_t)1) != 1) {
+ lsx_fail_errno(ft,SOX_EOF,"AIFF: Unexpected EOF in %s header", chunkDescription);
+ return(SOX_EOF);
+ }
+ totalReadLength += 1;
+ }
+ }
+ lsx_debug("%-10s \"%s\"", chunkDescription, *text);
+ /* make sure we read the whole chunk */
+ if (totalReadLength < chunksize) {
+ size_t i;
+ char c;
+ for (i=0; i < chunksize - totalReadLength; i++ )
+ lsx_readbuf(ft, &c, (size_t)1);
+ }
+ return(SOX_SUCCESS);
+}
+
+int lsx_aiffstopread(sox_format_t * ft)
+{
+ char buf[5];
+ uint32_t chunksize;
+ uint8_t trash;
+
+ if (!ft->seekable)
+ {
+ while (! lsx_eof(ft))
+ {
+ if (lsx_readbuf(ft, buf, (size_t)4) != 4)
+ break;
+
+ lsx_readdw(ft, &chunksize);
+ if (lsx_eof(ft))
+ break;
+ buf[4] = '\0';
+ lsx_warn("Ignoring AIFF tail chunk: `%s', %u bytes long",
+ buf, chunksize);
+ if (! strcmp(buf, "MARK") || ! strcmp(buf, "INST"))
+ lsx_warn(" You're stripping MIDI/loop info!");
+ while (chunksize-- > 0)
+ {
+ if (lsx_readb(ft, &trash) == SOX_EOF)
+ break;
+ }
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+/* When writing, the header is supposed to contain the number of
+ samples and data bytes written.
+ Since we don't know how many samples there are until we're done,
+ we first write the header with an very large number,
+ and at the end we rewind the file and write the header again
+ with the right number. This only works if the file is seekable;
+ if it is not, the very large size remains in the header.
+ Strictly spoken this is not legal, but the playaiff utility
+ will still be able to play the resulting file. */
+
+int lsx_aiffstartwrite(sox_format_t * ft)
+{
+ int rc;
+
+ /* Needed because lsx_rawwrite() */
+ rc = lsx_rawstartwrite(ft);
+ if (rc)
+ return rc;
+
+ /* Compute the "very large number" so that a maximum number
+ of samples can be transmitted through a pipe without the
+ risk of causing overflow when calculating the number of bytes.
+ At 48 kHz, 16 bits stereo, this gives ~3 hours of audio.
+ Sorry, the AIFF format does not provide for an indefinite
+ number of samples. */
+ return(aiffwriteheader(ft, (uint64_t) 0x7f000000 / ((ft->encoding.bits_per_sample>>3)*ft->signal.channels)));
+}
+
+int lsx_aiffstopwrite(sox_format_t * ft)
+{
+ /* If we've written an odd number of bytes, write a padding
+ NUL */
+ if (ft->olength % 2 == 1 && ft->encoding.bits_per_sample == 8 && ft->signal.channels == 1)
+ {
+ sox_sample_t buf = 0;
+ lsx_rawwrite(ft, &buf, (size_t) 1);
+ }
+
+ if (!ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Non-seekable file.");
+ return(SOX_EOF);
+ }
+ if (lsx_seeki(ft, (off_t)0, SEEK_SET) != 0)
+ {
+ lsx_fail_errno(ft,errno,"can't rewind output file to rewrite AIFF header");
+ return(SOX_EOF);
+ }
+ return(aiffwriteheader(ft, ft->olength / ft->signal.channels));
+}
+
+static int aiffwriteheader(sox_format_t * ft, uint64_t nframes)
+{
+ int hsize =
+ 8 /*COMM hdr*/ + 18 /*COMM chunk*/ +
+ 8 /*SSND hdr*/ + 12 /*SSND chunk*/;
+ unsigned bits = 0;
+ unsigned i;
+ uint64_t size;
+ size_t padded_comment_size = 0, comment_size = 0;
+ size_t comment_chunk_size = 0;
+ char * comment = lsx_cat_comments(ft->oob.comments);
+
+ /* MARK and INST chunks */
+ if (ft->oob.instr.nloops) {
+ hsize += 8 /* MARK hdr */ + 2 + 16*ft->oob.instr.nloops;
+ hsize += 8 /* INST hdr */ + 20; /* INST chunk */
+ }
+
+ if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 8)
+ bits = 8;
+ else if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 16)
+ bits = 16;
+ else if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 24)
+ bits = 24;
+ else if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 32)
+ bits = 32;
+ else
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"unsupported output encoding/size for AIFF header");
+ return(SOX_EOF);
+ }
+
+ /* COMT comment chunk -- holds comments text with a timestamp and marker id */
+ /* We calculate the comment_chunk_size if we will be writing a comment */
+ if (ft->oob.comments)
+ {
+ comment_size = strlen(comment);
+ /* Must put an even number of characters out.
+ * True 68k processors OS's seem to require this.
+ */
+ padded_comment_size = ((comment_size % 2) == 0) ?
+ comment_size : comment_size + 1;
+ /* one comment, timestamp, marker ID and text count */
+ comment_chunk_size = (2 + 4 + 2 + 2 + padded_comment_size);
+ hsize += 8 /* COMT hdr */ + comment_chunk_size;
+ }
+
+ lsx_writes(ft, "FORM"); /* IFF header */
+ /* file size */
+ size = hsize + nframes * (ft->encoding.bits_per_sample >> 3) * ft->signal.channels;
+ if (size > UINT_MAX)
+ {
+ lsx_warn("file size too big for accurate AIFF header");
+ size = UINT_MAX;
+ }
+ lsx_writedw(ft, (unsigned)size);
+ lsx_writes(ft, "AIFF"); /* File type */
+
+ /* Now we write the COMT comment chunk using the precomputed sizes */
+ if (ft->oob.comments)
+ {
+ lsx_writes(ft, "COMT");
+ lsx_writedw(ft, (unsigned) comment_chunk_size);
+
+ /* one comment */
+ lsx_writew(ft, 1);
+
+ /* time stamp of comment, Unix knows of time from 1/1/1970,
+ Apple knows time from 1/1/1904 */
+ lsx_writedw(ft, (unsigned)((sox_globals.repeatable? 0 : time(NULL)) + 2082844800));
+
+ /* A marker ID of 0 indicates the comment is not associated
+ with a marker */
+ lsx_writew(ft, 0);
+
+ /* now write the count and the bytes of text */
+ lsx_writew(ft, (unsigned) padded_comment_size);
+ lsx_writes(ft, comment);
+ if (comment_size != padded_comment_size)
+ lsx_writes(ft, " ");
+ }
+ free(comment);
+
+ /* COMM chunk -- describes encoding (and #frames) */
+ lsx_writes(ft, "COMM");
+ lsx_writedw(ft, 18); /* COMM chunk size */
+ lsx_writew(ft, ft->signal.channels); /* nchannels */
+ lsx_writedw(ft, (unsigned) nframes); /* number of frames */
+ lsx_writew(ft, bits); /* sample width, in bits */
+ write_ieee_extended(ft, (double)ft->signal.rate);
+
+ /* MARK chunk -- set markers */
+ if (ft->oob.instr.nloops) {
+ lsx_writes(ft, "MARK");
+ if (ft->oob.instr.nloops > 2)
+ ft->oob.instr.nloops = 2;
+ lsx_writedw(ft, 2 + 16u*ft->oob.instr.nloops);
+ lsx_writew(ft, ft->oob.instr.nloops);
+
+ for(i = 0; i < ft->oob.instr.nloops; i++) {
+ unsigned start = ft->oob.loops[i].start > UINT_MAX
+ ? UINT_MAX
+ : ft->oob.loops[i].start;
+ unsigned end = ft->oob.loops[i].start + ft->oob.loops[i].length > UINT_MAX
+ ? UINT_MAX
+ : ft->oob.loops[i].start + ft->oob.loops[i].length;
+ lsx_writew(ft, i + 1);
+ lsx_writedw(ft, start);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writew(ft, i*2 + 1);
+ lsx_writedw(ft, end);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ }
+
+ lsx_writes(ft, "INST");
+ lsx_writedw(ft, 20);
+ /* random MIDI shit that we default on */
+ lsx_writeb(ft, (uint8_t)ft->oob.instr.MIDInote);
+ lsx_writeb(ft, 0); /* detune */
+ lsx_writeb(ft, (uint8_t)ft->oob.instr.MIDIlow);
+ lsx_writeb(ft, (uint8_t)ft->oob.instr.MIDIhi);
+ lsx_writeb(ft, 1); /* low velocity */
+ lsx_writeb(ft, 127); /* hi velocity */
+ lsx_writew(ft, 0); /* gain */
+
+ /* sustain loop */
+ lsx_writew(ft, ft->oob.loops[0].type);
+ lsx_writew(ft, 1); /* marker 1 */
+ lsx_writew(ft, 3); /* marker 3 */
+ /* release loop, if there */
+ if (ft->oob.instr.nloops == 2) {
+ lsx_writew(ft, ft->oob.loops[1].type);
+ lsx_writew(ft, 2); /* marker 2 */
+ lsx_writew(ft, 4); /* marker 4 */
+ } else {
+ lsx_writew(ft, 0); /* no release loop */
+ lsx_writew(ft, 0);
+ lsx_writew(ft, 0);
+ }
+ }
+
+ /* SSND chunk -- describes data */
+ lsx_writes(ft, "SSND");
+ /* chunk size */
+ lsx_writedw(ft, (unsigned) (8 + nframes * ft->signal.channels * (ft->encoding.bits_per_sample >> 3)));
+ lsx_writedw(ft, 0); /* offset */
+ lsx_writedw(ft, 0); /* block size */
+ return(SOX_SUCCESS);
+}
+
+int lsx_aifcstartwrite(sox_format_t * ft)
+{
+ int rc;
+
+ /* Needed because lsx_rawwrite() */
+ rc = lsx_rawstartwrite(ft);
+ if (rc)
+ return rc;
+
+ /* Compute the "very large number" so that a maximum number
+ of samples can be transmitted through a pipe without the
+ risk of causing overflow when calculating the number of bytes.
+ At 48 kHz, 16 bits stereo, this gives ~3 hours of music.
+ Sorry, the AIFC format does not provide for an "infinite"
+ number of samples. */
+ return(aifcwriteheader(ft, (uint64_t) 0x7f000000 / ((ft->encoding.bits_per_sample >> 3)*ft->signal.channels)));
+}
+
+int lsx_aifcstopwrite(sox_format_t * ft)
+{
+ /* If we've written an odd number of bytes, write a padding
+ NUL */
+ if (ft->olength % 2 == 1 && ft->encoding.bits_per_sample == 8 && ft->signal.channels == 1)
+ {
+ sox_sample_t buf = 0;
+ lsx_rawwrite(ft, &buf, (size_t) 1);
+ }
+
+ if (!ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Non-seekable file.");
+ return(SOX_EOF);
+ }
+ if (lsx_seeki(ft, (off_t)0, SEEK_SET) != 0)
+ {
+ lsx_fail_errno(ft,errno,"can't rewind output file to rewrite AIFC header");
+ return(SOX_EOF);
+ }
+ return(aifcwriteheader(ft, ft->olength / ft->signal.channels));
+}
+
+static int aifcwriteheader(sox_format_t * ft, uint64_t nframes)
+{
+ unsigned hsize;
+ unsigned bits = 0;
+ uint64_t size;
+ char *ctype = NULL, *cname = NULL;
+ unsigned cname_len = 0, comm_len = 0, comm_padding = 0;
+
+ if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 8)
+ bits = 8;
+ else if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 16)
+ bits = 16;
+ else if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 24)
+ bits = 24;
+ else if (ft->encoding.encoding == SOX_ENCODING_SIGN2 &&
+ ft->encoding.bits_per_sample == 32)
+ bits = 32;
+ else if (ft->encoding.encoding == SOX_ENCODING_FLOAT &&
+ ft->encoding.bits_per_sample == 32)
+ bits = 32;
+ else if (ft->encoding.encoding == SOX_ENCODING_FLOAT &&
+ ft->encoding.bits_per_sample == 64)
+ bits = 64;
+ else
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"unsupported output encoding/size for AIFC header");
+ return(SOX_EOF);
+ }
+
+ /* calculate length of COMM chunk (without header) */
+ switch (ft->encoding.encoding) {
+ case SOX_ENCODING_SIGN2:
+ ctype = "NONE";
+ cname = "not compressed";
+ break;
+ case SOX_ENCODING_FLOAT:
+ if (bits == 32) {
+ ctype = "fl32";
+ cname = "32-bit floating point";
+ } else {
+ ctype = "fl64";
+ cname = "64-bit floating point";
+ }
+ break;
+ default: /* can't happen */
+ break;
+ }
+ cname_len = strlen(cname);
+ comm_len = 18+4+1+cname_len;
+ comm_padding = comm_len%2;
+
+ hsize = 12 /*FVER*/ + 8 /*COMM hdr*/ + comm_len+comm_padding /*COMM chunk*/ +
+ 8 /*SSND hdr*/ + 12 /*SSND chunk*/;
+
+ lsx_writes(ft, "FORM"); /* IFF header */
+ /* file size */
+ size = hsize + nframes * (ft->encoding.bits_per_sample >> 3) * ft->signal.channels;
+ if (size > UINT_MAX)
+ {
+ lsx_warn("file size too big for accurate AIFC header");
+ size = UINT_MAX;
+ }
+ lsx_writedw(ft, (unsigned)size);
+ lsx_writes(ft, "AIFC"); /* File type */
+
+ /* FVER chunk */
+ lsx_writes(ft, "FVER");
+ lsx_writedw(ft, 4); /* FVER chunk size */
+ lsx_writedw(ft, 0xa2805140); /* version_date(May23,1990,2:40pm) */
+
+ /* COMM chunk -- describes encoding (and #frames) */
+ lsx_writes(ft, "COMM");
+ lsx_writedw(ft, comm_len+comm_padding); /* COMM chunk size */
+ lsx_writew(ft, ft->signal.channels); /* nchannels */
+ lsx_writedw(ft, (unsigned) nframes); /* number of frames */
+ lsx_writew(ft, bits); /* sample width, in bits */
+ write_ieee_extended(ft, (double)ft->signal.rate);
+
+ lsx_writes(ft, ctype); /*compression_type*/
+ lsx_writeb(ft, cname_len);
+ lsx_writes(ft, cname);
+ if (comm_padding)
+ lsx_writeb(ft, 0);
+
+ /* SSND chunk -- describes data */
+ lsx_writes(ft, "SSND");
+ /* chunk size */
+ lsx_writedw(ft, (unsigned) (8 + nframes * ft->signal.channels * (ft->encoding.bits_per_sample >> 3)));
+ lsx_writedw(ft, 0); /* offset */
+ lsx_writedw(ft, 0); /* block size */
+
+ /* Any Private chunks shall appear after the required chunks (FORM,FVER,COMM,SSND) */
+ return(SOX_SUCCESS);
+}
+
+static double read_ieee_extended(sox_format_t * ft)
+{
+ unsigned char buf[10];
+ if (lsx_readbuf(ft, buf, (size_t)10) != 10)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"EOF while reading IEEE extended number");
+ return(SOX_EOF);
+ }
+ return ConvertFromIeeeExtended(buf);
+}
+
+static void write_ieee_extended(sox_format_t * ft, double x)
+{
+ char buf[10];
+ ConvertToIeeeExtended(x, buf);
+ lsx_debug_more("converted %g to %o %o %o %o %o %o %o %o %o %o",
+ x,
+ buf[0], buf[1], buf[2], buf[3], buf[4],
+ buf[5], buf[6], buf[7], buf[8], buf[9]);
+ (void)lsx_writebuf(ft, buf, (size_t) 10);
+}
+
+
+/*
+ * C O N V E R T T O I E E E E X T E N D E D
+ */
+
+/* Copyright (C) 1988-1991 Apple Computer, Inc.
+ *
+ * All rights reserved.
+ *
+ * Warranty Information
+ * Even though Apple has reviewed this software, Apple makes no warranty
+ * or representation, either express or implied, with respect to this
+ * software, its quality, accuracy, merchantability, or fitness for a
+ * particular purpose. As a result, this software is provided "as is,"
+ * and you, its user, are assuming the entire risk as to its quality
+ * and accuracy.
+ *
+ * Machine-independent I/O routines for IEEE floating-point numbers.
+ *
+ * NaN's and infinities are converted to HUGE_VAL, which
+ * happens to be infinity on IEEE machines. Unfortunately, it is
+ * impossible to preserve NaN's in a machine-independent way.
+ * Infinities are, however, preserved on IEEE machines.
+ *
+ * These routines have been tested on the following machines:
+ * Apple Macintosh, MPW 3.1 C compiler
+ * Apple Macintosh, THINK C compiler
+ * Silicon Graphics IRIS, MIPS compiler
+ * Cray X/MP and Y/MP
+ * Digital Equipment VAX
+ *
+ *
+ * Implemented by Malcolm Slaney and Ken Turkowski.
+ *
+ * Malcolm Slaney contributions during 1988-1990 include big- and little-
+ * endian file I/O, conversion to and from Motorola's extended 80-bit
+ * floating-point format, and conversions to and from IEEE single-
+ * precision floating-point format.
+ *
+ * In 1991, Ken Turkowski implemented the conversions to and from
+ * IEEE double-precision format, added more precision to the extended
+ * conversions, and accommodated conversions involving +/- infinity,
+ * NaN's, and denormalized numbers.
+ */
+
+#define FloatToUnsigned(f) ((uint32_t)(((int32_t)(f - 2147483648.0)) + 2147483647) + 1)
+
+static void ConvertToIeeeExtended(double num, char *bytes)
+{
+ int sign;
+ int expon;
+ double fMant, fsMant;
+ uint32_t hiMant, loMant;
+
+ if (num < 0) {
+ sign = 0x8000;
+ num *= -1;
+ } else {
+ sign = 0;
+ }
+
+ if (num == 0) {
+ expon = 0; hiMant = 0; loMant = 0;
+ }
+ else {
+ fMant = frexp(num, &expon);
+ if ((expon > 16384) || !(fMant < 1)) { /* Infinity or NaN */
+ expon = sign|0x7FFF; hiMant = 0; loMant = 0; /* infinity */
+ }
+ else { /* Finite */
+ expon += 16382;
+ if (expon < 0) { /* denormalized */
+ fMant = ldexp(fMant, expon);
+ expon = 0;
+ }
+ expon |= sign;
+ fMant = ldexp(fMant, 32);
+ fsMant = floor(fMant);
+ hiMant = FloatToUnsigned(fsMant);
+ fMant = ldexp(fMant - fsMant, 32);
+ fsMant = floor(fMant);
+ loMant = FloatToUnsigned(fsMant);
+ }
+ }
+
+ bytes[0] = expon >> 8;
+ bytes[1] = expon;
+ bytes[2] = hiMant >> 24;
+ bytes[3] = hiMant >> 16;
+ bytes[4] = hiMant >> 8;
+ bytes[5] = hiMant;
+ bytes[6] = loMant >> 24;
+ bytes[7] = loMant >> 16;
+ bytes[8] = loMant >> 8;
+ bytes[9] = loMant;
+}
+
+
+/*
+ * C O N V E R T F R O M I E E E E X T E N D E D
+ */
+
+/*
+ * Copyright (C) 1988-1991 Apple Computer, Inc.
+ *
+ * All rights reserved.
+ *
+ * Warranty Information
+ * Even though Apple has reviewed this software, Apple makes no warranty
+ * or representation, either express or implied, with respect to this
+ * software, its quality, accuracy, merchantability, or fitness for a
+ * particular purpose. As a result, this software is provided "as is,"
+ * and you, its user, are assuming the entire risk as to its quality
+ * and accuracy.
+ *
+ * This code may be used and freely distributed as long as it includes
+ * this copyright notice and the above warranty information.
+ *
+ * Machine-independent I/O routines for IEEE floating-point numbers.
+ *
+ * NaN's and infinities are converted to HUGE_VAL, which
+ * happens to be infinity on IEEE machines. Unfortunately, it is
+ * impossible to preserve NaN's in a machine-independent way.
+ * Infinities are, however, preserved on IEEE machines.
+ *
+ * These routines have been tested on the following machines:
+ * Apple Macintosh, MPW 3.1 C compiler
+ * Apple Macintosh, THINK C compiler
+ * Silicon Graphics IRIS, MIPS compiler
+ * Cray X/MP and Y/MP
+ * Digital Equipment VAX
+ *
+ *
+ * Implemented by Malcolm Slaney and Ken Turkowski.
+ *
+ * Malcolm Slaney contributions during 1988-1990 include big- and little-
+ * endian file I/O, conversion to and from Motorola's extended 80-bit
+ * floating-point format, and conversions to and from IEEE single-
+ * precision floating-point format.
+ *
+ * In 1991, Ken Turkowski implemented the conversions to and from
+ * IEEE double-precision format, added more precision to the extended
+ * conversions, and accommodated conversions involving +/- infinity,
+ * NaN's, and denormalized numbers.
+ */
+
+#define UnsignedToFloat(u) (((double)((int32_t)(u - 2147483647 - 1))) + 2147483648.0)
+
+/****************************************************************
+ * Extended precision IEEE floating-point conversion routine.
+ ****************************************************************/
+
+static double ConvertFromIeeeExtended(unsigned char *bytes)
+{
+ double f;
+ int expon;
+ uint32_t hiMant, loMant;
+
+ expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF);
+ hiMant = ((uint32_t)(bytes[2] & 0xFF) << 24)
+ | ((uint32_t)(bytes[3] & 0xFF) << 16)
+ | ((uint32_t)(bytes[4] & 0xFF) << 8)
+ | ((uint32_t)(bytes[5] & 0xFF));
+ loMant = ((uint32_t)(bytes[6] & 0xFF) << 24)
+ | ((uint32_t)(bytes[7] & 0xFF) << 16)
+ | ((uint32_t)(bytes[8] & 0xFF) << 8)
+ | ((uint32_t)(bytes[9] & 0xFF));
+
+ if (expon == 0 && hiMant == 0 && loMant == 0) {
+ f = 0;
+ }
+ else {
+ if (expon == 0x7FFF) { /* Infinity or NaN */
+ f = HUGE_VAL;
+ }
+ else {
+ expon -= 16383;
+ f = ldexp(UnsignedToFloat(hiMant), expon-=31);
+ f += ldexp(UnsignedToFloat(loMant), expon-=32);
+ }
+ }
+
+ if (bytes[0] & 0x80)
+ return -f;
+ else
+ return f;
+}
diff --git a/src/src/aiff.h b/src/src/aiff.h
new file mode 100644
index 0000000..471de06
--- /dev/null
+++ b/src/src/aiff.h
@@ -0,0 +1,22 @@
+/* libSoX SGI/Amiga AIFF format.
+ * Copyright 1991-2007 Guido van Rossum And Sundry Contributors
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Guido van Rossum And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ * Used by SGI on 4D/35 and Indigo.
+ * This is a subformat of the EA-IFF-85 format.
+ * This is related to the IFF format used by the Amiga.
+ * But, apparently, not the same.
+ * Also AIFF-C format output that is defined in DAVIC 1.4 Part 9 Annex B
+ * (usable for japanese-data-broadcasting, specified by ARIB STD-B24.)
+ */
+
+int lsx_aiffstartread(sox_format_t * ft);
+int lsx_aiffstopread(sox_format_t * ft);
+int lsx_aiffstartwrite(sox_format_t * ft);
+int lsx_aiffstopwrite(sox_format_t * ft);
+int lsx_aifcstartwrite(sox_format_t * ft);
+int lsx_aifcstopwrite(sox_format_t * ft);
diff --git a/src/src/al-fmt.c b/src/src/al-fmt.c
new file mode 100644
index 0000000..0657e30
--- /dev/null
+++ b/src/src/al-fmt.c
@@ -0,0 +1,21 @@
+/* File format: raw A-law (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT(al, 8, 0, ALAW)
diff --git a/src/src/alsa.c b/src/src/alsa.c
new file mode 100644
index 0000000..94456f1
--- /dev/null
+++ b/src/src/alsa.c
@@ -0,0 +1,379 @@
+/* libSoX device driver: ALSA (c) 2006-2012 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/alsa_lib/usr_include/alsa/asoundlib.h"
+
+typedef struct {
+ snd_pcm_uframes_t buf_len, period;
+ snd_pcm_t * pcm;
+ char * buf;
+ unsigned int format;
+} priv_t;
+
+static const
+ struct {
+ unsigned int bits;
+ enum _snd_pcm_format alsa_fmt;
+ unsigned int bytes; /* occupied in the buffer per sample */
+ sox_encoding_t enc;
+ } formats[] = {
+ /* order by # of bits; within that, preferred first */
+ { 8, SND_PCM_FORMAT_S8, 1, SOX_ENCODING_SIGN2 },
+ { 8, SND_PCM_FORMAT_U8, 1, SOX_ENCODING_UNSIGNED },
+ { 16, SND_PCM_FORMAT_S16, 2, SOX_ENCODING_SIGN2 },
+ { 16, SND_PCM_FORMAT_U16, 2, SOX_ENCODING_UNSIGNED },
+ { 24, SND_PCM_FORMAT_S24, 4, SOX_ENCODING_SIGN2 },
+ { 24, SND_PCM_FORMAT_U24, 4, SOX_ENCODING_UNSIGNED },
+ { 24, SND_PCM_FORMAT_S24_3LE, 3, SOX_ENCODING_SIGN2 },
+ { 32, SND_PCM_FORMAT_S32, 4, SOX_ENCODING_SIGN2 },
+ { 32, SND_PCM_FORMAT_U32, 4, SOX_ENCODING_UNSIGNED },
+ { 0, 0, 0, SOX_ENCODING_UNKNOWN } /* end of list */
+ };
+
+static int select_format(
+ sox_encoding_t * encoding_,
+ unsigned * nbits_,
+ snd_pcm_format_mask_t const * mask,
+ unsigned int * format)
+{
+ unsigned int from = 0, to; /* NB: "to" actually points one after the last */
+ int cand = -1;
+
+ while (formats[from].bits < *nbits_ && formats[from].bits != 0)
+ from++; /* find the first entry with at least *nbits_ bits */
+ for (to = from; formats[to].bits != 0; to++) ; /* find end of list */
+
+ while (to > 0) {
+ unsigned int i, bits_next = 0;
+ for (i = from; i < to; i++) {
+ lsx_debug_most("select_format: trying #%u", i);
+ if (snd_pcm_format_mask_test(mask, formats[i].alsa_fmt)) {
+ if (formats[i].enc == *encoding_) {
+ cand = i;
+ break; /* found a match */
+ } else if (cand == -1) /* don't overwrite a candidate that
+ was earlier in the list */
+ cand = i; /* will work, but encoding differs */
+ }
+ }
+ if (cand != -1)
+ break;
+ /* no candidate found yet; now try formats with less bits: */
+ to = from;
+ if (from > 0)
+ bits_next = formats[from-1].bits;
+ while (from && formats[from-1].bits == bits_next)
+ from--; /* go back to the first entry with bits_next bits */
+ }
+
+ if (cand == -1) {
+ lsx_debug("select_format: no suitable ALSA format found");
+ return -1;
+ }
+
+ if (*nbits_ != formats[cand].bits || *encoding_ != formats[cand].enc) {
+ lsx_warn("can't encode %u-bit %s", *nbits_,
+ sox_encodings_info[*encoding_].desc);
+ *nbits_ = formats[cand].bits;
+ *encoding_ = formats[cand].enc;
+ }
+ lsx_debug("selecting format %d: %s (%s)", cand,
+ snd_pcm_format_name(formats[cand].alsa_fmt),
+ snd_pcm_format_description(formats[cand].alsa_fmt));
+ *format = cand;
+ return 0;
+}
+
+#define _(x,y) do {if ((err = x y) < 0) {lsx_fail_errno(ft, SOX_EPERM, #x " error: %s", snd_strerror(err)); goto error;} } while (0)
+static int setup(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ snd_pcm_hw_params_t * params = NULL;
+ snd_pcm_format_mask_t * mask = NULL;
+ snd_pcm_uframes_t min, max;
+ unsigned n;
+ int err;
+
+ _(snd_pcm_open, (&p->pcm, ft->filename, ft->mode == 'r'? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, 0));
+ _(snd_pcm_hw_params_malloc, (¶ms));
+ _(snd_pcm_hw_params_any, (p->pcm, params));
+#if SND_LIB_VERSION >= 0x010009 /* Disable alsa-lib resampling: */
+ _(snd_pcm_hw_params_set_rate_resample, (p->pcm, params, 0));
+#endif
+ _(snd_pcm_hw_params_set_access, (p->pcm, params, SND_PCM_ACCESS_RW_INTERLEAVED));
+
+ _(snd_pcm_format_mask_malloc, (&mask)); /* Set format: */
+ snd_pcm_hw_params_get_format_mask(params, mask);
+ _(select_format, (&ft->encoding.encoding, &ft->encoding.bits_per_sample, mask, &p->format));
+ _(snd_pcm_hw_params_set_format, (p->pcm, params, formats[p->format].alsa_fmt));
+ snd_pcm_format_mask_free(mask), mask = NULL;
+
+ n = ft->signal.rate; /* Set rate: */
+ _(snd_pcm_hw_params_set_rate_near, (p->pcm, params, &n, 0));
+ ft->signal.rate = n;
+
+ n = ft->signal.channels; /* Set channels: */
+ _(snd_pcm_hw_params_set_channels_near, (p->pcm, params, &n));
+ ft->signal.channels = n;
+
+ /* Get number of significant bits: */
+ if ((err = snd_pcm_hw_params_get_sbits(params)) > 0)
+ ft->signal.precision = min(err, SOX_SAMPLE_PRECISION);
+ else lsx_debug("snd_pcm_hw_params_get_sbits can't tell precision: %s",
+ snd_strerror(err));
+
+ /* Set buf_len > > sox_globals.bufsiz for no underrun: */
+ p->buf_len = sox_globals.bufsiz * 8 / formats[p->format].bytes /
+ ft->signal.channels;
+ _(snd_pcm_hw_params_get_buffer_size_min, (params, &min));
+ _(snd_pcm_hw_params_get_buffer_size_max, (params, &max));
+ p->period = range_limit(p->buf_len, min, max) / 8;
+ p->buf_len = p->period * 8;
+ _(snd_pcm_hw_params_set_period_size_near, (p->pcm, params, &p->period, 0));
+ _(snd_pcm_hw_params_set_buffer_size_near, (p->pcm, params, &p->buf_len));
+ if (p->period * 2 > p->buf_len) {
+ lsx_fail_errno(ft, SOX_EPERM, "buffer too small");
+ goto error;
+ }
+
+ _(snd_pcm_hw_params, (p->pcm, params)); /* Configure ALSA */
+ snd_pcm_hw_params_free(params), params = NULL;
+ _(snd_pcm_prepare, (p->pcm));
+ p->buf_len *= ft->signal.channels; /* No longer in `frames' */
+ p->buf = lsx_malloc(p->buf_len * formats[p->format].bytes);
+ return SOX_SUCCESS;
+
+error:
+ if (mask) snd_pcm_format_mask_free(mask);
+ if (params) snd_pcm_hw_params_free(params);
+ return SOX_EOF;
+}
+
+static int recover(sox_format_t * ft, snd_pcm_t * pcm, int err)
+{
+ if (err == -EPIPE)
+ lsx_warn("%s-run", ft->mode == 'r'? "over" : "under");
+ else if (err != -ESTRPIPE)
+ lsx_warn("%s", snd_strerror(err));
+ else while ((err = snd_pcm_resume(pcm)) == -EAGAIN) {
+ lsx_report("suspended");
+ sleep(1); /* Wait until the suspend flag is released */
+ }
+ if (err < 0 && (err = snd_pcm_prepare(pcm)) < 0)
+ lsx_fail_errno(ft, SOX_EPERM, "%s", snd_strerror(err));
+ return err;
+}
+
+static size_t read_(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ snd_pcm_sframes_t i, n;
+ size_t done;
+
+ len = min(len, p->buf_len);
+ for (done = 0; done < len; done += n) {
+ do {
+ n = snd_pcm_readi(p->pcm, p->buf, (len - done) / ft->signal.channels);
+ if (n < 0 && recover(ft, p->pcm, (int)n) < 0)
+ return 0;
+ } while (n <= 0);
+
+ i = n *= ft->signal.channels;
+ switch (formats[p->format].alsa_fmt) {
+ case SND_PCM_FORMAT_S8: {
+ int8_t * buf1 = (int8_t *)p->buf;
+ while (i--) *buf++ = SOX_SIGNED_8BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ case SND_PCM_FORMAT_U8: {
+ uint8_t * buf1 = (uint8_t *)p->buf;
+ while (i--) *buf++ = SOX_UNSIGNED_8BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ case SND_PCM_FORMAT_S16: {
+ int16_t * buf1 = (int16_t *)p->buf;
+ if (ft->encoding.reverse_bytes) while (i--)
+ *buf++ = SOX_SIGNED_16BIT_TO_SAMPLE(lsx_swapw(*buf1++),);
+ else
+ while (i--) *buf++ = SOX_SIGNED_16BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ case SND_PCM_FORMAT_U16: {
+ uint16_t * buf1 = (uint16_t *)p->buf;
+ if (ft->encoding.reverse_bytes) while (i--)
+ *buf++ = SOX_UNSIGNED_16BIT_TO_SAMPLE(lsx_swapw(*buf1++),);
+ else
+ while (i--) *buf++ = SOX_UNSIGNED_16BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ case SND_PCM_FORMAT_S24: {
+ sox_int24_t * buf1 = (sox_int24_t *)p->buf;
+ while (i--) *buf++ = SOX_SIGNED_24BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ case SND_PCM_FORMAT_S24_3LE: {
+ unsigned char *buf1 = (unsigned char *)p->buf;
+ while (i--) {
+ uint32_t temp;
+ temp = *buf1++;
+ temp |= *buf1++ << 8;
+ temp |= *buf1++ << 16;
+ *buf++ = SOX_SIGNED_24BIT_TO_SAMPLE((sox_int24_t)temp,);
+ }
+ break;
+ }
+ case SND_PCM_FORMAT_U24: {
+ sox_uint24_t * buf1 = (sox_uint24_t *)p->buf;
+ while (i--) *buf++ = SOX_UNSIGNED_24BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ case SND_PCM_FORMAT_S32: {
+ int32_t * buf1 = (int32_t *)p->buf;
+ while (i--) *buf++ = SOX_SIGNED_32BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ case SND_PCM_FORMAT_U32: {
+ uint32_t * buf1 = (uint32_t *)p->buf;
+ while (i--) *buf++ = SOX_UNSIGNED_32BIT_TO_SAMPLE(*buf1++,);
+ break;
+ }
+ default: lsx_fail_errno(ft, SOX_EFMT, "invalid format");
+ return 0;
+ }
+ }
+ return len;
+}
+
+static size_t write_(sox_format_t * ft, sox_sample_t const * buf, size_t len)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t done, i, n;
+ snd_pcm_sframes_t actual;
+ SOX_SAMPLE_LOCALS;
+
+ for (done = 0; done < len; done += n) {
+ i = n = min(len - done, p->buf_len);
+ switch (formats[p->format].alsa_fmt) {
+ case SND_PCM_FORMAT_S8: {
+ int8_t * buf1 = (int8_t *)p->buf;
+ while (i--) *buf1++ = SOX_SAMPLE_TO_SIGNED_8BIT(*buf++, ft->clips);
+ break;
+ }
+ case SND_PCM_FORMAT_U8: {
+ uint8_t * buf1 = (uint8_t *)p->buf;
+ while (i--) *buf1++ = SOX_SAMPLE_TO_UNSIGNED_8BIT(*buf++, ft->clips);
+ break;
+ }
+ case SND_PCM_FORMAT_S16: {
+ int16_t * buf1 = (int16_t *)p->buf;
+ if (ft->encoding.reverse_bytes) while (i--)
+ *buf1++ = lsx_swapw(SOX_SAMPLE_TO_SIGNED_16BIT(*buf++, ft->clips));
+ else
+ while (i--) *buf1++ = SOX_SAMPLE_TO_SIGNED_16BIT(*buf++, ft->clips);
+ break;
+ }
+ case SND_PCM_FORMAT_U16: {
+ uint16_t * buf1 = (uint16_t *)p->buf;
+ if (ft->encoding.reverse_bytes) while (i--)
+ *buf1++ = lsx_swapw(SOX_SAMPLE_TO_UNSIGNED_16BIT(*buf++, ft->clips));
+ else
+ while (i--) *buf1++ = SOX_SAMPLE_TO_UNSIGNED_16BIT(*buf++, ft->clips);
+ break;
+ }
+ case SND_PCM_FORMAT_S24: {
+ sox_int24_t * buf1 = (sox_int24_t *)p->buf;
+ while (i--) *buf1++ = SOX_SAMPLE_TO_SIGNED_24BIT(*buf++, ft->clips);
+ break;
+ }
+ case SND_PCM_FORMAT_S24_3LE: {
+ unsigned char *buf1 = (unsigned char *)p->buf;
+ while (i--) {
+ uint32_t temp = (uint32_t)SOX_SAMPLE_TO_SIGNED_24BIT(*buf++, ft->clips);
+ *buf1++ = (temp & 0x000000FF);
+ *buf1++ = (temp & 0x0000FF00) >> 8;
+ *buf1++ = (temp & 0x00FF0000) >> 16;
+ }
+ break;
+ }
+ case SND_PCM_FORMAT_U24: {
+ sox_uint24_t * buf1 = (sox_uint24_t *)p->buf;
+ while (i--) *buf1++ = SOX_SAMPLE_TO_UNSIGNED_24BIT(*buf++, ft->clips);
+ break;
+ }
+ case SND_PCM_FORMAT_S32: {
+ int32_t * buf1 = (int32_t *)p->buf;
+ while (i--) *buf1++ = SOX_SAMPLE_TO_SIGNED_32BIT(*buf++, ft->clips);
+ break;
+ }
+ case SND_PCM_FORMAT_U32: {
+ uint32_t * buf1 = (uint32_t *)p->buf;
+ while (i--) *buf1++ = SOX_SAMPLE_TO_UNSIGNED_32BIT(*buf++, ft->clips);
+ break;
+ }
+ default: lsx_fail_errno(ft, SOX_EFMT, "invalid format");
+ return 0;
+ }
+ for (i = 0; i < n; i += actual * ft->signal.channels) do {
+ actual = snd_pcm_writei(p->pcm,
+ p->buf + i * formats[p->format].bytes,
+ (n - i) / ft->signal.channels);
+ if (errno == EAGAIN) /* Happens naturally; don't report it: */
+ errno = 0;
+ if (actual < 0 && recover(ft, p->pcm, (int)actual) < 0)
+ return 0;
+ } while (actual < 0);
+ }
+ return len;
+}
+
+static int stop(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ snd_pcm_close(p->pcm);
+ free(p->buf);
+ return SOX_SUCCESS;
+}
+
+static int stop_write(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t n = ft->signal.channels * p->period, npad = n - (ft->olength % n);
+ sox_sample_t * buf = lsx_calloc(npad, sizeof(*buf)); /* silent samples */
+
+ if (npad != n) /* pad to hardware period: */
+ write_(ft, buf, npad);
+ free(buf);
+ snd_pcm_drain(p->pcm);
+ return stop(ft);
+}
+
+LSX_FORMAT_HANDLER(alsa)
+{
+ static char const * const names[] = {"alsa", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2 , 32, 24, 16, 8, 0,
+ SOX_ENCODING_UNSIGNED, 32, 24, 16, 8, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Advanced Linux Sound Architecture device driver",
+ names, SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ setup, read_, stop, setup, write_, stop_write,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/amr-nb.c b/src/src/amr-nb.c
new file mode 100644
index 0000000..3a627b9
--- /dev/null
+++ b/src/src/amr-nb.c
@@ -0,0 +1,141 @@
+/* File format: AMR-NB (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * In order to use the AMR format with SoX, you need to have an AMR
+ * library installed at SoX build time. Currently, the SoX build system
+ * recognizes two AMR implementations, in the following order:
+ * http://opencore-amr.sourceforge.net/
+ * http://ftp.penguin.cz/pub/users/utx/amr/
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef HAVE_AMRNB
+
+/* Common definitions: */
+
+enum amrnb_mode { amrnb_mode_dummy };
+
+static const unsigned amrnb_block_size[] = {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 1};
+static char const amrnb_magic[] = "#!AMR\n";
+#define amr_block_size amrnb_block_size
+#define amr_magic amrnb_magic
+#define amr_priv_t amrnb_priv_t
+#define amr_opencore_funcs amrnb_opencore_funcs
+#define amr_gp3_funcs amrnb_gp3_funcs
+
+#define AMR_CODED_MAX 32 /* max coded size */
+#define AMR_ENCODING SOX_ENCODING_AMR_NB
+#define AMR_FORMAT_FN lsx_amr_nb_format_fn
+#define AMR_FRAME 160 /* 20ms @ 8kHz */
+#define AMR_MODE_MAX 7
+#define AMR_NAMES "amr-nb", "anb"
+#define AMR_RATE 8000
+#define AMR_DESC "3GPP Adaptive Multi Rate Narrow-Band (AMR-NB) lossy speech compressor"
+
+#if !defined(HAVE_LIBLTDL)
+ #undef DL_AMRNB
+#endif
+
+#ifdef DL_AMRNB
+ #define AMR_FUNC LSX_DLENTRY_DYNAMIC
+#else
+ #define AMR_FUNC LSX_DLENTRY_STATIC
+#endif /* DL_AMRNB */
+
+/* OpenCore definitions: */
+
+#if defined(HAVE_OPENCORE_AMRNB_INTERF_DEC_H) || defined(DL_AMRNB)
+ #define AMR_OPENCORE 1
+ #define AMR_OPENCORE_ENABLE_ENCODE 1
+#endif
+
+#define AMR_OPENCORE_FUNC_ENTRIES(f,x) \
+ AMR_FUNC(f,x, void*, Encoder_Interface_init, (int dtx)) \
+ AMR_FUNC(f,x, int, Encoder_Interface_Encode, (void* state, enum amrnb_mode mode, const short* in, unsigned char* out, int forceSpeech)) \
+ AMR_FUNC(f,x, void, Encoder_Interface_exit, (void* state)) \
+ AMR_FUNC(f,x, void*, Decoder_Interface_init, (void)) \
+ AMR_FUNC(f,x, void, Decoder_Interface_Decode, (void* state, const unsigned char* in, short* out, int bfi)) \
+ AMR_FUNC(f,x, void, Decoder_Interface_exit, (void* state)) \
+
+#define AmrOpencoreEncoderInit() \
+ Encoder_Interface_init(1)
+#define AmrOpencoreEncoderEncode(state, mode, in, out, forceSpeech) \
+ Encoder_Interface_Encode(state, mode, in, out, forceSpeech)
+#define AmrOpencoreEncoderExit(state) \
+ Encoder_Interface_exit(state)
+#define AmrOpencoreDecoderInit() \
+ Decoder_Interface_init()
+#define AmrOpencoreDecoderDecode(state, in, out, bfi) \
+ Decoder_Interface_Decode(state, in, out, bfi)
+#define AmrOpencoreDecoderExit(state) \
+ Decoder_Interface_exit(state)
+
+#define AMR_OPENCORE_DESC "amr-nb OpenCore library"
+static const char* const amr_opencore_library_names[] =
+{
+#ifdef DL_AMRWB
+ "libopencore-amrnb",
+ "libopencore-amrnb-0",
+#endif
+ NULL
+};
+
+/* 3GPP (reference implementation) definitions: */
+
+#if !defined(HAVE_OPENCORE_AMRNB_INTERF_DEC_H) || defined(DL_AMRNB)
+ #define AMR_GP3 1
+#endif
+
+#define AMR_GP3_FUNC_ENTRIES(f,x) \
+ AMR_FUNC(f,x, void*, VADxEncoder_Interface_init, (int dtx, char vad2_code)) \
+ AMR_FUNC(f,x, int, GP3VADxEncoder_Interface_Encode, (void* state, enum amrnb_mode mode, short* in, unsigned char* out, int forceSpeech, char vad2_code)) \
+ AMR_FUNC(f,x, void, Encoder_Interface_exit, (void* state)) \
+ AMR_FUNC(f,x, void*, Decoder_Interface_init, (void)) \
+ AMR_FUNC(f,x, void, GP3Decoder_Interface_Decode, (void* state, unsigned char* in, short* out, int bfi)) \
+ AMR_FUNC(f,x, void, Decoder_Interface_exit, (void* state)) \
+
+#define AmrGp3EncoderInit() \
+ VADxEncoder_Interface_init(1, 0)
+#define AmrGp3EncoderEncode(state, mode, in, out, forceSpeech) \
+ GP3VADxEncoder_Interface_Encode(state, mode, in, out, forceSpeech, 0)
+#define AmrGp3EncoderExit(state) \
+ Encoder_Interface_exit(state)
+#define AmrGp3DecoderInit() \
+ Decoder_Interface_init()
+#define AmrGp3DecoderDecode(state, in, out, bfi) \
+ GP3Decoder_Interface_Decode(state, in, out, bfi)
+#define AmrGp3DecoderExit(state) \
+ Decoder_Interface_exit(state)
+
+#define AMR_GP3_DESC "amr-nb 3GPP reference library"
+static const char* const amr_gp3_library_names[] =
+{
+#ifdef DL_AMRWB
+ "libamrnb-3",
+ "libamrnb",
+ "amrnb",
+ "cygamrnb-3",
+#endif
+ NULL
+};
+
+#include "third_party/sox/src/src/amr.h"
+
+#endif /* HAVE_AMRNB */
+
diff --git a/src/src/amr-wb.c b/src/src/amr-wb.c
new file mode 100644
index 0000000..cc23f8e
--- /dev/null
+++ b/src/src/amr-wb.c
@@ -0,0 +1,129 @@
+/* File format: AMR-WB (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * In order to use the AMR format with SoX, you need to have an AMR
+ * library installed at SoX build time. Currently, the SoX build system
+ * recognizes two AMR implementations, in the following order:
+ * http://opencore-amr.sourceforge.net/
+ * http://ftp.penguin.cz/pub/users/utx/amr/
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef HAVE_AMRWB
+
+/* Common definitions: */
+
+static const uint8_t amrwb_block_size[] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
+static char const amrwb_magic[] = "#!AMR-WB\n";
+#define amr_block_size amrwb_block_size
+#define amr_magic amrwb_magic
+#define amr_priv_t amrwb_priv_t
+#define amr_opencore_funcs amrwb_opencore_funcs
+#define amr_gp3_funcs amrwb_gp3_funcs
+
+#define AMR_CODED_MAX 61 /* NB_SERIAL_MAX */
+#define AMR_ENCODING SOX_ENCODING_AMR_WB
+#define AMR_FORMAT_FN lsx_amr_wb_format_fn
+#define AMR_FRAME 320 /* L_FRAME16k */
+#define AMR_MODE_MAX 8
+#define AMR_NAMES "amr-wb", "awb"
+#define AMR_RATE 16000
+#define AMR_DESC "3GPP Adaptive Multi Rate Wide-Band (AMR-WB) lossy speech compressor"
+
+#if !defined(HAVE_LIBLTDL)
+ #undef DL_AMRWB
+#endif
+
+#ifdef DL_AMRWB
+ #define AMR_FUNC LSX_DLENTRY_DYNAMIC
+#else
+ #define AMR_FUNC LSX_DLENTRY_STATIC
+#endif /* DL_AMRWB */
+
+/* OpenCore definitions: */
+
+#if defined(HAVE_OPENCORE_AMRWB_DEC_IF_H) || defined(DL_AMRWB)
+ #define AMR_OPENCORE 1
+ #define AMR_OPENCORE_ENABLE_ENCODE 0
+#endif
+
+#define AMR_OPENCORE_FUNC_ENTRIES(f,x) \
+ AMR_FUNC(f,x, void*, D_IF_init, (void)) \
+ AMR_FUNC(f,x, void, D_IF_decode, (void* state, const unsigned char* in, short* out, int bfi)) \
+ AMR_FUNC(f,x, void, D_IF_exit, (void* state)) \
+
+#define AmrOpencoreDecoderInit() \
+ D_IF_init()
+#define AmrOpencoreDecoderDecode(state, in, out, bfi) \
+ D_IF_decode(state, in, out, bfi)
+#define AmrOpencoreDecoderExit(state) \
+ D_IF_exit(state)
+
+#define AMR_OPENCORE_DESC "amr-wb OpenCore library"
+static const char* const amr_opencore_library_names[] =
+{
+#ifdef DL_AMRWB
+ "libopencore-amrwb",
+ "libopencore-amrwb-0",
+#endif
+ NULL
+};
+
+/* 3GPP (reference implementation) definitions: */
+
+#if !defined(HAVE_OPENCORE_AMRWB_DEC_IF_H) || defined(DL_AMRWB)
+ #define AMR_GP3 1
+#endif
+
+#define AMR_GP3_FUNC_ENTRIES(f,x) \
+ AMR_FUNC(f,x, void*, E_IF_init, (void)) \
+ AMR_FUNC(f,x, int, GP3E_IF_encode,(void* state, int16_t mode, int16_t* in, uint8_t* out, int16_t dtx)) \
+ AMR_FUNC(f,x, void, E_IF_exit, (void* state)) \
+ AMR_FUNC(f,x, void*, D_IF_init, (void)) \
+ AMR_FUNC(f,x, void, GP3D_IF_decode,(void* state, uint8_t* in, int16_t* out, int32_t bfi)) \
+ AMR_FUNC(f,x, void, D_IF_exit, (void* state)) \
+
+#define AmrGp3EncoderInit() \
+ E_IF_init()
+#define AmrGp3EncoderEncode(state, mode, in, out, forceSpeech) \
+ GP3E_IF_encode(state, mode, in, out, forceSpeech)
+#define AmrGp3EncoderExit(state) \
+ E_IF_exit(state)
+#define AmrGp3DecoderInit() \
+ D_IF_init()
+#define AmrGp3DecoderDecode(state, in, out, bfi) \
+ GP3D_IF_decode(state, in, out, bfi)
+#define AmrGp3DecoderExit(state) \
+ D_IF_exit(state)
+
+#define AMR_GP3_DESC "amr-wb 3GPP reference library"
+static const char* const amr_gp3_library_names[] =
+{
+#ifdef DL_AMRWB
+ "libamrwb-3",
+ "libamrwb",
+ "amrwb",
+ "cygamrwb-3",
+#endif
+ NULL
+};
+
+#include "third_party/sox/src/src/amr.h"
+
+#endif /* HAVE_AMRWB */
diff --git a/src/src/amr.h b/src/src/amr.h
new file mode 100644
index 0000000..65c44d2
--- /dev/null
+++ b/src/src/amr.h
@@ -0,0 +1,338 @@
+/* File format: AMR (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <string.h>
+#include <math.h>
+
+#ifdef AMR_OPENCORE
+
+LSX_DLENTRIES_TO_FUNCTIONS(AMR_OPENCORE_FUNC_ENTRIES)
+
+typedef struct amr_opencore_funcs {
+ LSX_DLENTRIES_TO_PTRS(AMR_OPENCORE_FUNC_ENTRIES, amr_dl);
+} amr_opencore_funcs;
+
+#endif /* AMR_OPENCORE */
+
+#ifdef AMR_GP3
+
+LSX_DLENTRIES_TO_FUNCTIONS(AMR_GP3_FUNC_ENTRIES)
+
+typedef struct amr_gp3_funcs {
+ LSX_DLENTRIES_TO_PTRS(AMR_GP3_FUNC_ENTRIES, amr_dl);
+} amr_gp3_funcs;
+
+#endif /* AMR_GP3 */
+
+#if defined(AMR_OPENCORE) && defined (AMR_GP3)
+ #define AMR_CALL(p, opencoreFunc, gp3Func, args) \
+ ((p)->loaded_opencore ? ((p)->opencore.opencoreFunc args) : ((p)->gp3.gp3Func args))
+ #if AMR_OPENCORE_ENABLE_ENCODE
+ #define AMR_CALL_ENCODER AMR_CALL
+ #else
+ #define AMR_CALL_ENCODER(p, opencoreFunc, gp3Func, args) \
+ ((p)->gp3.gp3Func args)
+ #endif
+#elif defined(AMR_OPENCORE)
+ #define AMR_CALL(p, opencoreFunc, gp3Func, args) \
+ ((p)->opencore.opencoreFunc args)
+ #define AMR_CALL_ENCODER AMR_CALL
+#elif defined(AMR_GP3)
+ #define AMR_CALL(p, opencoreFunc, gp3Func, args) \
+ ((p)->gp3.gp3Func args)
+ #define AMR_CALL_ENCODER AMR_CALL
+#endif
+
+typedef struct amr_priv_t {
+ void* state;
+ unsigned mode;
+ size_t pcm_index;
+ int loaded_opencore;
+#ifdef AMR_OPENCORE
+ amr_opencore_funcs opencore;
+#endif /* AMR_OPENCORE */
+#ifdef AMR_GP3
+ amr_gp3_funcs gp3;
+#endif /* AMR_GP3 */
+ short pcm[AMR_FRAME];
+} priv_t;
+
+static size_t decode_1_frame(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t n_1;
+ uint8_t coded[AMR_CODED_MAX];
+
+ if (lsx_readbuf(ft, &coded[0], (size_t)1) != 1)
+ return AMR_FRAME;
+ n_1 = amr_block_size[(coded[0] >> 3) & 0x0F] - 1;
+ if (lsx_readbuf(ft, &coded[1], n_1) != n_1)
+ return AMR_FRAME;
+ AMR_CALL(p, AmrOpencoreDecoderDecode, AmrGp3DecoderDecode, (p->state, coded, p->pcm, 0));
+ return 0;
+}
+
+static int openlibrary(priv_t* p, int encoding)
+{
+ int open_library_result;
+
+ (void)encoding;
+#ifdef AMR_OPENCORE
+ if (AMR_OPENCORE_ENABLE_ENCODE || !encoding)
+ {
+ LSX_DLLIBRARY_TRYOPEN(
+ 0,
+ &p->opencore,
+ amr_dl,
+ AMR_OPENCORE_FUNC_ENTRIES,
+ AMR_OPENCORE_DESC,
+ amr_opencore_library_names,
+ open_library_result);
+ if (!open_library_result)
+ {
+ p->loaded_opencore = 1;
+ return SOX_SUCCESS;
+ }
+ }
+ else
+ {
+ lsx_report("Not attempting to load " AMR_OPENCORE_DESC " because it does not support encoding.");
+ }
+#endif /* AMR_OPENCORE */
+
+#ifdef AMR_GP3
+ LSX_DLLIBRARY_TRYOPEN(
+ 0,
+ &p->gp3,
+ amr_dl,
+ AMR_GP3_FUNC_ENTRIES,
+ AMR_GP3_DESC,
+ amr_gp3_library_names,
+ open_library_result);
+ if (!open_library_result)
+ return SOX_SUCCESS;
+#endif /* AMR_GP3 */
+
+ lsx_fail(
+ "Unable to open "
+#ifdef AMR_OPENCORE
+ AMR_OPENCORE_DESC
+#endif
+#if defined(AMR_OPENCORE) && defined(AMR_GP3)
+ " or "
+#endif
+#ifdef AMR_GP3
+ AMR_GP3_DESC
+#endif
+ ".");
+ return SOX_EOF;
+}
+
+static void closelibrary(priv_t* p)
+{
+#ifdef AMR_OPENCORE
+ LSX_DLLIBRARY_CLOSE(&p->opencore, amr_dl);
+#endif
+#ifdef AMR_GP3
+ LSX_DLLIBRARY_CLOSE(&p->gp3, amr_dl);
+#endif
+}
+
+static size_t amr_duration_frames(sox_format_t * ft)
+{
+ off_t frame_size, data_start_offset = lsx_tell(ft);
+ size_t frames;
+ uint8_t coded;
+
+ for (frames = 0; lsx_readbuf(ft, &coded, (size_t)1) == 1; ++frames) {
+ frame_size = amr_block_size[coded >> 3 & 15];
+ if (lsx_seeki(ft, frame_size - 1, SEEK_CUR)) {
+ lsx_fail("seek");
+ break;
+ }
+ }
+ lsx_debug("frames=%lu", (unsigned long)frames);
+ lsx_seeki(ft, data_start_offset, SEEK_SET);
+ return frames;
+}
+
+static int startread(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ char buffer[sizeof(amr_magic) - 1];
+ int open_library_result;
+
+ if (lsx_readchars(ft, buffer, sizeof(buffer)))
+ return SOX_EOF;
+ if (memcmp(buffer, amr_magic, sizeof(buffer))) {
+ lsx_fail_errno(ft, SOX_EHDR, "invalid magic number");
+ return SOX_EOF;
+ }
+
+ open_library_result = openlibrary(p, 0);
+ if (open_library_result != SOX_SUCCESS)
+ return open_library_result;
+
+ p->pcm_index = AMR_FRAME;
+ p->state = AMR_CALL(p, AmrOpencoreDecoderInit, AmrGp3DecoderInit, ());
+ if (!p->state)
+ {
+ closelibrary(p);
+ lsx_fail("AMR decoder failed to initialize.");
+ return SOX_EOF;
+ }
+
+ ft->signal.rate = AMR_RATE;
+ ft->encoding.encoding = AMR_ENCODING;
+ ft->signal.channels = 1;
+ ft->signal.length = ft->signal.length != SOX_IGNORE_LENGTH && ft->seekable?
+ (size_t)(amr_duration_frames(ft) * .02 * ft->signal.rate +.5) : SOX_UNSPEC;
+ return SOX_SUCCESS;
+}
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t done;
+
+ for (done = 0; done < len; done++) {
+ if (p->pcm_index >= AMR_FRAME)
+ p->pcm_index = decode_1_frame(ft);
+ if (p->pcm_index >= AMR_FRAME)
+ break;
+ *buf++ = SOX_SIGNED_16BIT_TO_SAMPLE(p->pcm[p->pcm_index++], ft->clips);
+ }
+ return done;
+}
+
+static int stopread(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ AMR_CALL(p, AmrOpencoreDecoderExit, AmrGp3DecoderExit, (p->state));
+ closelibrary(p);
+ return SOX_SUCCESS;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+#if !defined(AMR_GP3) && !AMR_OPENCORE_ENABLE_ENCODE
+ lsx_fail_errno(ft, SOX_EOF, "SoX was compiled without AMR-WB encoding support.");
+ return SOX_EOF;
+#else
+ priv_t * p = (priv_t *)ft->priv;
+ int open_library_result;
+
+ if (ft->encoding.compression != HUGE_VAL) {
+ p->mode = (unsigned)ft->encoding.compression;
+ if (p->mode != ft->encoding.compression || p->mode > AMR_MODE_MAX) {
+ lsx_fail_errno(ft, SOX_EINVAL, "compression level must be a whole number from 0 to %i", AMR_MODE_MAX);
+ return SOX_EOF;
+ }
+ }
+ else p->mode = 0;
+
+ open_library_result = openlibrary(p, 1);
+ if (open_library_result != SOX_SUCCESS)
+ return open_library_result;
+
+#define IGNORE_WARNING \
+ p->state = AMR_CALL_ENCODER(p, AmrOpencoreEncoderInit, AmrGp3EncoderInit, ());
+#include "third_party/sox/src/src/ignore-warning.h"
+ if (!p->state)
+ {
+ closelibrary(p);
+ lsx_fail("AMR encoder failed to initialize.");
+ return SOX_EOF;
+ }
+
+ lsx_writes(ft, amr_magic);
+ p->pcm_index = 0;
+ return SOX_SUCCESS;
+#endif
+}
+
+#if defined(AMR_GP3) || AMR_OPENCORE_ENABLE_ENCODE
+
+static sox_bool encode_1_frame(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ uint8_t coded[AMR_CODED_MAX];
+#define IGNORE_WARNING \
+ int n = AMR_CALL_ENCODER(p, AmrOpencoreEncoderEncode, AmrGp3EncoderEncode, (p->state, p->mode, p->pcm, coded, 1));
+#include "third_party/sox/src/src/ignore-warning.h"
+ sox_bool result = lsx_writebuf(ft, coded, (size_t) (size_t) (unsigned)n) == (unsigned)n;
+ if (!result)
+ lsx_fail_errno(ft, errno, "write error");
+ return result;
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t * buf, size_t len)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t done;
+
+ for (done = 0; done < len; ++done) {
+ SOX_SAMPLE_LOCALS;
+ p->pcm[p->pcm_index++] = SOX_SAMPLE_TO_SIGNED_16BIT(*buf++, ft->clips);
+ if (p->pcm_index == AMR_FRAME) {
+ p->pcm_index = 0;
+ if (!encode_1_frame(ft))
+ return 0;
+ }
+ }
+ return done;
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ int result = SOX_SUCCESS;
+
+ if (p->pcm_index) {
+ do {
+ p->pcm[p->pcm_index++] = 0;
+ } while (p->pcm_index < AMR_FRAME);
+ if (!encode_1_frame(ft))
+ result = SOX_EOF;
+ }
+ AMR_CALL_ENCODER(p, AmrOpencoreEncoderExit, AmrGp3EncoderExit, (p->state));
+ return result;
+}
+
+#else
+
+#define write_samples NULL
+#define stopwrite NULL
+
+#endif /* defined(AMR_GP3) || AMR_OPENCORE_ENABLE_ENCODE */
+
+sox_format_handler_t const * AMR_FORMAT_FN(void);
+sox_format_handler_t const * AMR_FORMAT_FN(void)
+{
+ static char const * const names[] = {AMR_NAMES, NULL};
+ static sox_rate_t const write_rates[] = {AMR_RATE, 0};
+ static unsigned const write_encodings[] = {AMR_ENCODING, 0, 0};
+ static sox_format_handler_t handler = {
+ SOX_LIB_VERSION_CODE,
+ AMR_DESC,
+ names, SOX_FILE_MONO,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, write_rates, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/ao.c b/src/src/ao.c
new file mode 100644
index 0000000..8e03bca
--- /dev/null
+++ b/src/src/ao.c
@@ -0,0 +1,134 @@
+/* libao player support for sox
+ * (c) Reuben Thomas <rrt@sc3d.org> 2007
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ao/ao.h>
+
+typedef struct {
+ int driver_id;
+ ao_device *device;
+ ao_sample_format format;
+ char *buf;
+ size_t buf_size;
+} priv_t;
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * ao = (priv_t *)ft->priv;
+
+ ao->buf_size = sox_globals.bufsiz - (sox_globals.bufsiz % (ft->encoding.bits_per_sample >> 3));
+ ao->buf_size *= (ft->encoding.bits_per_sample >> 3);
+ ao->buf = lsx_malloc(ao->buf_size);
+
+ if (!ao->buf)
+ {
+ lsx_fail_errno(ft, SOX_ENOMEM, "Can not allocate memory for ao driver");
+ return SOX_EOF;
+ }
+
+
+ ao_initialize();
+ if (strcmp(ft->filename,"default") == 0)
+ {
+ if ((ao->driver_id = ao_default_driver_id()) < 0) {
+ lsx_fail("Could not find a default ao driver");
+ return SOX_EOF;
+ }
+ }
+ else
+ {
+ if ((ao->driver_id = ao_driver_id(ft->filename)) < 0) {
+ lsx_fail("Could not find a ao driver %s", ft->filename);
+ return SOX_EOF;
+ }
+ }
+
+ ao->format.bits = ft->encoding.bits_per_sample;
+ ao->format.rate = ft->signal.rate;
+ ao->format.channels = ft->signal.channels;
+ ao->format.byte_format = AO_FMT_NATIVE;
+ if ((ao->device = ao_open_live(ao->driver_id, &ao->format, NULL)) == NULL) {
+ lsx_fail("Could not open device: error %d", errno);
+ return SOX_EOF;
+ }
+
+ return SOX_SUCCESS;
+}
+
+static void sox_sw_write_buf(char *buf1, sox_sample_t const * buf2, size_t len, sox_bool swap, sox_uint64_t * clips)
+{
+ while (len--)
+ {
+ SOX_SAMPLE_LOCALS;
+ uint16_t datum = SOX_SAMPLE_TO_SIGNED_16BIT(*buf2++, *clips);
+ if (swap)
+ datum = lsx_swapw(datum);
+ *(uint16_t *)buf1 = datum;
+ buf1++; buf1++;
+ }
+}
+
+static size_t write_samples(sox_format_t *ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * ao = (priv_t *)ft->priv;
+ uint_32 aobuf_size;
+
+ if (len > ao->buf_size / (ft->encoding.bits_per_sample >> 3))
+ len = ao->buf_size / (ft->encoding.bits_per_sample >> 3);
+
+ aobuf_size = (ft->encoding.bits_per_sample >> 3) * len;
+
+ sox_sw_write_buf(ao->buf, buf, len, ft->encoding.reverse_bytes,
+ &(ft->clips));
+ if (ao_play(ao->device, (void *)ao->buf, aobuf_size) == 0)
+ return 0;
+
+ return len;
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * ao = (priv_t *)ft->priv;
+
+ free(ao->buf);
+
+ if (ao_close(ao->device) == 0) {
+ lsx_fail("Error closing libao output");
+ return SOX_EOF;
+ }
+ ao_shutdown();
+
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(ao)
+{
+ static char const * const names[] = {"ao", NULL};
+ static unsigned const encodings[] = {SOX_ENCODING_SIGN2, 16, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Xiph's libao device driver", names, SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ NULL, NULL, NULL,
+ startwrite, write_samples, stopwrite,
+ NULL, encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/au.c b/src/src/au.c
new file mode 100644
index 0000000..1870555
--- /dev/null
+++ b/src/src/au.c
@@ -0,0 +1,237 @@
+/* libSoX Sun format with header (SunOS 4.1; see /usr/demo/SOUND).
+ * Copyright 1991, 1992, 1993 Guido van Rossum And Sundry Contributors.
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Guido van Rossum And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ * October 7, 1998 - cbagwell@sprynet.com
+ * G.723 was using incorrect # of bits. Corrected to 3 and 5 bits.
+ *
+ * NeXT uses this format also, but has more format codes defined.
+ * DEC uses a slight variation and swaps bytes.
+ * We support only the common formats, plus
+ * CCITT G.721 (32 kbit/s) and G.723 (24/40 kbit/s),
+ * courtesy of Sun's public domain implementation.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g72x.h"
+#include <string.h>
+
+/* Magic numbers used in Sun and NeXT audio files */
+static struct {char str[4]; sox_bool reverse_bytes; char const * desc;} id[] = {
+ {"\x2e\x73\x6e\x64", MACHINE_IS_LITTLEENDIAN, "big-endian `.snd'"},
+ {"\x64\x6e\x73\x2e", MACHINE_IS_BIGENDIAN , "little-endian `.snd'"},
+ {"\x00\x64\x73\x2e", MACHINE_IS_BIGENDIAN , "little-endian `\\0ds.' (for DEC)"},
+ {"\x2e\x73\x64\x00", MACHINE_IS_LITTLEENDIAN, "big-endian `\\0ds.'"},
+ {" ", 0, NULL}
+};
+#define FIXED_HDR 24
+#define SUN_UNSPEC ~0u /* Unspecified data size (this is legal) */
+
+typedef enum {
+ Unspecified, Mulaw_8, Linear_8, Linear_16, Linear_24, Linear_32, Float,
+ Double, Indirect, Nested, Dsp_core, Dsp_data_8, Dsp_data_16, Dsp_data_24,
+ Dsp_data_32, Unknown, Display, Mulaw_squelch, Emphasized, Compressed,
+ Compressed_emphasized, Dsp_commands, Dsp_commands_samples, Adpcm_g721,
+ Adpcm_g722, Adpcm_g723_3, Adpcm_g723_5, Alaw_8, Unknown_other} ft_encoding_t;
+static char const * const str[] = {
+ "Unspecified", "8-bit mu-law", "8-bit signed linear", "16-bit signed linear",
+ "24-bit signed linear", "32-bit signed linear", "Floating-point",
+ "Double precision float", "Fragmented sampled data", "Unknown", "DSP program",
+ "8-bit fixed-point", "16-bit fixed-point", "24-bit fixed-point",
+ "32-bit fixed-point", "Unknown", "Non-audio data", "Mu-law squelch",
+ "16-bit linear with emphasis", "16-bit linear with compression",
+ "16-bit linear with emphasis and compression", "Music Kit DSP commands",
+ "Music Kit DSP samples", "4-bit G.721 ADPCM", "G.722 ADPCM",
+ "3-bit G.723 ADPCM", "5-bit G.723 ADPCM", "8-bit a-law", "Unknown"};
+
+static ft_encoding_t ft_enc(unsigned size, sox_encoding_t encoding)
+{
+ if (encoding == SOX_ENCODING_ULAW && size == 8) return Mulaw_8;
+ if (encoding == SOX_ENCODING_ALAW && size == 8) return Alaw_8;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 8) return Linear_8;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 16) return Linear_16;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 24) return Linear_24;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 32) return Linear_32;
+ if (encoding == SOX_ENCODING_FLOAT && size == 32) return Float;
+ if (encoding == SOX_ENCODING_FLOAT && size == 64) return Double;
+ return Unspecified;
+}
+
+static sox_encoding_t sox_enc(uint32_t ft_encoding, unsigned * size)
+{
+ switch (ft_encoding) {
+ case Mulaw_8 : *size = 8; return SOX_ENCODING_ULAW;
+ case Alaw_8 : *size = 8; return SOX_ENCODING_ALAW;
+ case Linear_8 : *size = 8; return SOX_ENCODING_SIGN2;
+ case Linear_16 : *size = 16; return SOX_ENCODING_SIGN2;
+ case Linear_24 : *size = 24; return SOX_ENCODING_SIGN2;
+ case Linear_32 : *size = 32; return SOX_ENCODING_SIGN2;
+ case Float : *size = 32; return SOX_ENCODING_FLOAT;
+ case Double : *size = 64; return SOX_ENCODING_FLOAT;
+ case Adpcm_g721 : *size = 4; return SOX_ENCODING_G721; /* read-only */
+ case Adpcm_g723_3: *size = 3; return SOX_ENCODING_G723; /* read-only */
+ case Adpcm_g723_5: *size = 5; return SOX_ENCODING_G723; /* read-only */
+ default: return SOX_ENCODING_UNKNOWN;
+ }
+}
+
+typedef struct { /* For G72x decoding: */
+ struct g72x_state state;
+ int (*dec_routine)(int i, int out_coding, struct g72x_state *state_ptr);
+ unsigned int in_buffer;
+ int in_bits;
+} priv_t;
+
+/*
+ * Unpack input codes and pass them back as bytes.
+ * Returns 1 if there is residual input, returns -1 if eof, else returns 0.
+ * (Adapted from Sun's decode.c.)
+ */
+static int unpack_input(sox_format_t * ft, unsigned char *code)
+{
+ priv_t * p = (priv_t *) ft->priv;
+ unsigned char in_byte;
+
+ if (p->in_bits < (int)ft->encoding.bits_per_sample) {
+ if (lsx_read_b_buf(ft, &in_byte, (size_t) 1) != 1) {
+ *code = 0;
+ return -1;
+ }
+ p->in_buffer |= (in_byte << p->in_bits);
+ p->in_bits += 8;
+ }
+ *code = p->in_buffer & ((1 << ft->encoding.bits_per_sample) - 1);
+ p->in_buffer >>= ft->encoding.bits_per_sample;
+ p->in_bits -= ft->encoding.bits_per_sample;
+ return p->in_bits > 0;
+}
+
+static size_t dec_read(sox_format_t *ft, sox_sample_t *buf, size_t samp)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ unsigned char code;
+ size_t done;
+
+ for (done = 0; samp > 0 && unpack_input(ft, &code) >= 0; ++done, --samp)
+ *buf++ = SOX_SIGNED_16BIT_TO_SAMPLE(
+ (*p->dec_routine)(code, AUDIO_ENCODING_LINEAR, &p->state),);
+ return done;
+}
+
+static int startread(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *) ft->priv;
+ char magic[4]; /* These 6 variables represent a Sun sound */
+ uint32_t hdr_size; /* header on disk. The uint32_t are written as */
+ uint32_t data_size; /* big-endians. At least extra bytes (totalling */
+ uint32_t ft_encoding; /* hdr_size - FIXED_HDR) are an "info" field of */
+ uint32_t rate; /* unspecified nature, usually a string. By */
+ uint32_t channels; /* convention the header size is a multiple of 4. */
+ unsigned i, bits_per_sample;
+ sox_encoding_t encoding;
+
+ if (lsx_readchars(ft, magic, sizeof(magic)))
+ return SOX_EOF;
+
+ for (i = 0; id[i].desc && memcmp(magic, id[i].str, sizeof(magic)); ++i);
+ if (!id[i].desc) {
+ lsx_fail_errno(ft, SOX_EHDR, "au: can't find Sun/NeXT/DEC identifier");
+ return SOX_EOF;
+ }
+ lsx_report("found %s identifier", id[i].desc);
+ ft->encoding.reverse_bytes = id[i].reverse_bytes;
+
+ if (lsx_readdw(ft, &hdr_size) ||
+ lsx_readdw(ft, &data_size) || /* Can be SUN_UNSPEC */
+ lsx_readdw(ft, &ft_encoding) ||
+ lsx_readdw(ft, &rate) ||
+ lsx_readdw(ft, &channels))
+ return SOX_EOF;
+
+ if (hdr_size < FIXED_HDR) {
+ lsx_fail_errno(ft, SOX_EHDR, "header size %u is too small", hdr_size);
+ return SOX_EOF;
+ }
+ if (hdr_size < FIXED_HDR + 4)
+ lsx_warn("header size %u is too small", hdr_size);
+
+ if (!(encoding = sox_enc(ft_encoding, &bits_per_sample))) {
+ int n = min(ft_encoding, Unknown_other);
+ lsx_fail_errno(ft, SOX_EFMT, "unsupported encoding `%s' (%#x)", str[n], ft_encoding);
+ return SOX_EOF;
+ }
+
+ switch (ft_encoding) {
+ case Adpcm_g721 : p->dec_routine = g721_decoder ; break;
+ case Adpcm_g723_3: p->dec_routine = g723_24_decoder; break;
+ case Adpcm_g723_5: p->dec_routine = g723_40_decoder; break;
+ }
+ if (p->dec_routine) {
+ g72x_init_state(&p->state);
+ ft->handler.seek = NULL;
+ ft->handler.read = dec_read;
+ }
+
+ if (hdr_size > FIXED_HDR) {
+ size_t info_size = hdr_size - FIXED_HDR;
+ char * buf = lsx_calloc(1, info_size + 1); /* +1 ensures null-terminated */
+ if (lsx_readchars(ft, buf, info_size) != SOX_SUCCESS) {
+ free(buf);
+ return SOX_EOF;
+ }
+ sox_append_comments(&ft->oob.comments, buf);
+ free(buf);
+ }
+ if (data_size == SUN_UNSPEC)
+ data_size = SOX_UNSPEC;
+ return lsx_check_read_params(ft, channels, (sox_rate_t)rate, encoding,
+ bits_per_sample, div_bits(data_size, bits_per_sample), sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ char * comment = lsx_cat_comments(ft->oob.comments);
+ size_t len = strlen(comment) + 1; /* Write out null-terminated */
+ size_t info_len = max(4, (len + 3) & ~3u); /* Minimum & multiple of 4 bytes */
+ int i = ft->encoding.reverse_bytes == MACHINE_IS_BIGENDIAN? 2 : 0;
+ uint64_t size64 = ft->olength ? ft->olength : ft->signal.length;
+ unsigned size = size64 == SOX_UNSPEC
+ ? SUN_UNSPEC
+ : size64*(ft->encoding.bits_per_sample >> 3) > UINT_MAX
+ ? SUN_UNSPEC
+ : (unsigned)(size64*(ft->encoding.bits_per_sample >> 3));
+ sox_bool error = sox_false
+ ||lsx_writechars(ft, id[i].str, sizeof(id[i].str))
+ ||lsx_writedw(ft, FIXED_HDR + (unsigned)info_len)
+ ||lsx_writedw(ft, size)
+ ||lsx_writedw(ft, ft_enc(ft->encoding.bits_per_sample, ft->encoding.encoding))
+ ||lsx_writedw(ft, (unsigned)(ft->signal.rate + .5))
+ ||lsx_writedw(ft, ft->signal.channels)
+ ||lsx_writechars(ft, comment, len)
+ ||lsx_padbytes(ft, info_len - len);
+ free(comment);
+ return error? SOX_EOF: SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(au)
+{
+ static char const * const names[] = {"au", "snd", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_SIGN2, 8, 16, 24, 32, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "PCM file format used widely on Sun systems",
+ names, SOX_FILE_BIG_END | SOX_FILE_REWIND,
+ startread, lsx_rawread, NULL,
+ write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/avr.c b/src/src/avr.c
new file mode 100644
index 0000000..11aa765
--- /dev/null
+++ b/src/src/avr.c
@@ -0,0 +1,287 @@
+/* AVR file format handler for SoX
+ * Copyright (C) 1999 Jan Paul Schmidt <jps@fundament.org>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#define AVR_MAGIC "2BIT"
+
+/* Taken from the Audio File Formats FAQ */
+
+typedef struct {
+ char magic [5]; /* 2BIT */
+ char name [8]; /* null-padded sample name */
+ unsigned short mono; /* 0 = mono, 0xffff = stereo */
+ unsigned short rez; /* 8 = 8 bit, 16 = 16 bit */
+ unsigned short sign; /* 0 = unsigned, 0xffff = signed */
+ unsigned short loop; /* 0 = no loop, 0xffff = looping sample */
+ unsigned short midi; /* 0xffff = no MIDI note assigned,
+ 0xffXX = single key note assignment
+ 0xLLHH = key split, low/hi note */
+ uint32_t rate; /* sample frequency in hertz */
+ uint32_t size; /* sample length in bytes or words (see rez) */
+ uint32_t lbeg; /* offset to start of loop in bytes or words.
+ set to zero if unused. */
+ uint32_t lend; /* offset to end of loop in bytes or words.
+ set to sample length if unused. */
+ unsigned short res1; /* Reserved, MIDI keyboard split */
+ unsigned short res2; /* Reserved, sample compression */
+ unsigned short res3; /* Reserved */
+ char ext[20]; /* Additional filename space, used
+ if (name[7] != 0) */
+ char user[64]; /* User defined. Typically ASCII message. */
+} priv_t;
+
+
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+
+
+static int startread(sox_format_t * ft)
+{
+ priv_t * avr = (priv_t *)ft->priv;
+ int rc;
+
+ lsx_reads(ft, avr->magic, (size_t)4);
+
+ if (strncmp (avr->magic, AVR_MAGIC, (size_t)4)) {
+ lsx_fail_errno(ft,SOX_EHDR,"AVR: unknown header");
+ return(SOX_EOF);
+ }
+
+ lsx_readbuf(ft, avr->name, sizeof(avr->name));
+
+ lsx_readw (ft, &(avr->mono));
+ if (avr->mono) {
+ ft->signal.channels = 2;
+ }
+ else {
+ ft->signal.channels = 1;
+ }
+
+ lsx_readw (ft, &(avr->rez));
+ if (avr->rez == 8) {
+ ft->encoding.bits_per_sample = 8;
+ }
+ else if (avr->rez == 16) {
+ ft->encoding.bits_per_sample = 16;
+ }
+ else {
+ lsx_fail_errno(ft,SOX_EFMT,"AVR: unsupported sample resolution");
+ return(SOX_EOF);
+ }
+
+ lsx_readw (ft, &(avr->sign));
+ if (avr->sign) {
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ }
+ else {
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
+ }
+
+ lsx_readw (ft, &(avr->loop));
+
+ lsx_readw (ft, &(avr->midi));
+
+ lsx_readdw (ft, &(avr->rate));
+ /*
+ * No support for AVRs created by ST-Replay,
+ * Replay Proffesional and PRO-Series 12.
+ *
+ * Just masking the upper byte out.
+ */
+ ft->signal.rate = (avr->rate & 0x00ffffff);
+
+ lsx_readdw (ft, &(avr->size));
+
+ lsx_readdw (ft, &(avr->lbeg));
+
+ lsx_readdw (ft, &(avr->lend));
+
+ lsx_readw (ft, &(avr->res1));
+
+ lsx_readw (ft, &(avr->res2));
+
+ lsx_readw (ft, &(avr->res3));
+
+ lsx_readbuf(ft, avr->ext, sizeof(avr->ext));
+
+ lsx_readbuf(ft, avr->user, sizeof(avr->user));
+
+ rc = lsx_rawstartread (ft);
+ if (rc)
+ return rc;
+
+ return(SOX_SUCCESS);
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * avr = (priv_t *)ft->priv;
+ int rc;
+
+ if (!ft->seekable) {
+ lsx_fail_errno(ft,SOX_EOF,"AVR: file is not seekable");
+ return(SOX_EOF);
+ }
+
+ rc = lsx_rawstartwrite (ft);
+ if (rc)
+ return rc;
+
+ /* magic */
+ lsx_writes(ft, AVR_MAGIC);
+
+ /* name */
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+
+ /* mono */
+ if (ft->signal.channels == 1) {
+ lsx_writew (ft, 0);
+ }
+ else if (ft->signal.channels == 2) {
+ lsx_writew (ft, 0xffff);
+ }
+ else {
+ lsx_fail_errno(ft,SOX_EFMT,"AVR: number of channels not supported");
+ return(0);
+ }
+
+ /* rez */
+ if (ft->encoding.bits_per_sample == 8) {
+ lsx_writew (ft, 8);
+ }
+ else if (ft->encoding.bits_per_sample == 16) {
+ lsx_writew (ft, 16);
+ }
+ else {
+ lsx_fail_errno(ft,SOX_EFMT,"AVR: unsupported sample resolution");
+ return(SOX_EOF);
+ }
+
+ /* sign */
+ if (ft->encoding.encoding == SOX_ENCODING_SIGN2) {
+ lsx_writew (ft, 0xffff);
+ }
+ else if (ft->encoding.encoding == SOX_ENCODING_UNSIGNED) {
+ lsx_writew (ft, 0);
+ }
+ else {
+ lsx_fail_errno(ft,SOX_EFMT,"AVR: unsupported encoding");
+ return(SOX_EOF);
+ }
+
+ /* loop */
+ lsx_writew (ft, 0xffff);
+
+ /* midi */
+ lsx_writew (ft, 0xffff);
+
+ /* rate */
+ lsx_writedw(ft, (unsigned)(ft->signal.rate + .5));
+
+ /* size */
+ /* Don't know the size yet. */
+ lsx_writedw (ft, 0);
+
+ /* lbeg */
+ lsx_writedw (ft, 0);
+
+ /* lend */
+ /* Don't know the size yet, so we can't set lend, either. */
+ lsx_writedw (ft, 0);
+
+ /* res1 */
+ lsx_writew (ft, 0);
+
+ /* res2 */
+ lsx_writew (ft, 0);
+
+ /* res3 */
+ lsx_writew (ft, 0);
+
+ /* ext */
+ lsx_writebuf(ft, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", sizeof(avr->ext));
+
+ /* user */
+ lsx_writebuf(ft,
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0", sizeof (avr->user));
+
+ return(SOX_SUCCESS);
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t nsamp)
+{
+ priv_t * avr = (priv_t *)ft->priv;
+
+ avr->size += nsamp;
+
+ return (lsx_rawwrite (ft, buf, nsamp));
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * avr = (priv_t *)ft->priv;
+
+ unsigned size = avr->size / ft->signal.channels;
+
+ /* Fix size */
+ lsx_seeki(ft, (off_t)26, SEEK_SET);
+ lsx_writedw (ft, size);
+
+ /* Fix lend */
+ lsx_seeki(ft, (off_t)34, SEEK_SET);
+ lsx_writedw (ft, size);
+
+ return(SOX_SUCCESS);
+}
+
+LSX_FORMAT_HANDLER(avr)
+{
+ static char const * const names[] = { "avr", NULL };
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 8, 0,
+ SOX_ENCODING_UNSIGNED, 16, 8, 0,
+ 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Audio Visual Research format; used on the Mac",
+ names, SOX_FILE_BIG_END | SOX_FILE_MONO | SOX_FILE_STEREO,
+ startread, lsx_rawread, NULL,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/band.h b/src/src/band.h
new file mode 100644
index 0000000..5398ff4
--- /dev/null
+++ b/src/src/band.h
@@ -0,0 +1,47 @@
+/* libSoX Bandpass effect file. July 5, 1991
+ * Copyright 1991 Lance Norskog And Sundry Contributors
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ * Algorithm: 2nd order recursive filter.
+ * Formula stolen from MUSIC56K, a toolkit of 56000 assembler stuff.
+ * Quote:
+ * This is a 2nd order recursive band pass filter of the form.
+ * y(n)= a * x(n) - b * y(n-1) - c * y(n-2)
+ * where :
+ * x(n) = "IN"
+ * "OUT" = y(n)
+ * c = EXP(-2*pi*cBW/S_RATE)
+ * b = -4*c/(1+c)*COS(2*pi*cCF/S_RATE)
+ * if cSCL=2 (i.e. noise input)
+ * a = SQT(((1+c)*(1+c)-b*b)*(1-c)/(1+c))
+ * else
+ * a = SQT(1-b*b/(4*c))*(1-c)
+ * endif
+ * note : cCF is the center frequency in Hertz
+ * cBW is the band width in Hertz
+ * cSCL is a scale factor, use 1 for pitched sounds
+ * use 2 for noise.
+ *
+ *
+ * July 1, 1999 - Jan Paul Schmidt <jps@fundament.org>
+ *
+ * This looks like the resonator band pass in SPKit. It's a
+ * second order all-pole (IIR) band-pass filter described
+ * at the pages 186 - 189 in
+ * Dodge, Charles & Jerse, Thomas A. 1985:
+ * Computer Music -- Synthesis, Composition and Performance.
+ * New York: Schirmer Books.
+ * Reference from the SPKit manual.
+ */
+
+ p->a2 = exp(-2 * M_PI * bw_Hz / effp->in_signal.rate);
+ p->a1 = -4 * p->a2 / (1 + p->a2) * cos(2 * M_PI * p->fc / effp->in_signal.rate);
+ p->b0 = sqrt(1 - p->a1 * p->a1 / (4 * p->a2)) * (1 - p->a2);
+ if (p->filter_type == filter_BPF_SPK_N) {
+ mult = sqrt(((1+p->a2) * (1+p->a2) - p->a1*p->a1) * (1-p->a2) / (1+p->a2)) / p->b0;
+ p->b0 *= mult;
+ }
diff --git a/src/src/bend.c b/src/src/bend.c
new file mode 100644
index 0000000..02b2ea6
--- /dev/null
+++ b/src/src/bend.c
@@ -0,0 +1,325 @@
+/* libSoX effect: Pitch Bend (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Portions based on http://www.dspdimension.com/download smbPitchShift.cpp:
+ *
+ * COPYRIGHT 1999-2006 Stephan M. Bernsee <smb [AT] dspdimension [DOT] com>
+ *
+ * The Wide Open License (WOL)
+ *
+ * Permission to use, copy, modify, distribute and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this license appear in all source copies.
+ * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF
+ * ANY KIND. See http://www.dspguru.com/wol.htm for more information.
+ */
+
+#ifdef NDEBUG /* Enable assert always. */
+#undef NDEBUG /* Must undef above assert.h or other that might include it. */
+#endif
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <assert.h>
+
+#define MAX_FRAME_LENGTH 8192
+
+typedef struct {
+ unsigned nbends; /* Number of bends requested */
+ struct {
+ char *str; /* Command-line argument to parse for this bend */
+ uint64_t start; /* Start bending when in_pos equals this */
+ double cents;
+ uint64_t duration; /* Number of samples to bend */
+ } *bends;
+
+ unsigned frame_rate;
+ size_t in_pos; /* Number of samples read from the input stream */
+ unsigned bends_pos; /* Number of bends completed so far */
+
+ double shift;
+
+ float gInFIFO[MAX_FRAME_LENGTH];
+ float gOutFIFO[MAX_FRAME_LENGTH];
+ double gFFTworksp[2 * MAX_FRAME_LENGTH];
+ float gLastPhase[MAX_FRAME_LENGTH / 2 + 1];
+ float gSumPhase[MAX_FRAME_LENGTH / 2 + 1];
+ float gOutputAccum[2 * MAX_FRAME_LENGTH];
+ float gAnaFreq[MAX_FRAME_LENGTH];
+ float gAnaMagn[MAX_FRAME_LENGTH];
+ float gSynFreq[MAX_FRAME_LENGTH];
+ float gSynMagn[MAX_FRAME_LENGTH];
+ long gRover;
+ int fftFrameSize, ovsamp;
+} priv_t;
+
+static int parse(sox_effect_t * effp, char **argv, sox_rate_t rate)
+{
+ priv_t *p = (priv_t *) effp->priv;
+ size_t i;
+ char const *next;
+ uint64_t last_seen = 0;
+ const uint64_t in_length = argv ? 0 :
+ (effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN);
+
+ for (i = 0; i < p->nbends; ++i) {
+ if (argv) /* 1st parse only */
+ p->bends[i].str = lsx_strdup(argv[i]);
+
+ next = lsx_parseposition(rate, p->bends[i].str,
+ argv ? NULL : &p->bends[i].start, last_seen, in_length, '+');
+ last_seen = p->bends[i].start;
+ if (next == NULL || *next != ',')
+ break;
+
+ p->bends[i].cents = strtod(next + 1, (char **)&next);
+ if (p->bends[i].cents == 0 || *next != ',')
+ break;
+
+ next = lsx_parseposition(rate, next + 1,
+ argv ? NULL : &p->bends[i].duration, last_seen, in_length, '+');
+ last_seen = p->bends[i].duration;
+ if (next == NULL || *next != '\0')
+ break;
+
+ /* sanity checks */
+ if (!argv && p->bends[i].duration < p->bends[i].start) {
+ lsx_fail("Bend %" PRIuPTR " has negative width", i+1);
+ break;
+ }
+ if (!argv && i && p->bends[i].start < p->bends[i-1].start) {
+ lsx_fail("Bend %" PRIuPTR " overlaps with previous one", i+1);
+ break;
+ }
+
+ p->bends[i].duration -= p->bends[i].start;
+ }
+ if (i < p->nbends)
+ return lsx_usage(effp);
+ return SOX_SUCCESS;
+}
+
+static int create(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t *p = (priv_t *) effp->priv;
+ char const * opts = "f:o:";
+ int c;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, opts, NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ p->frame_rate = 25;
+ p->ovsamp = 16;
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ GETOPT_NUMERIC(optstate, 'f', frame_rate, 10 , 80)
+ GETOPT_NUMERIC(optstate, 'o', ovsamp, 4 , 32)
+ default: lsx_fail("unknown option `-%c'", optstate.opt); return lsx_usage(effp);
+ }
+ argc -= optstate.ind, argv += optstate.ind;
+
+ p->nbends = argc;
+ p->bends = lsx_calloc(p->nbends, sizeof(*p->bends));
+ return parse(effp, argv, 0.); /* No rate yet; parse with dummy */
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t *p = (priv_t *) effp->priv;
+ unsigned i;
+
+ int n = effp->in_signal.rate / p->frame_rate + .5;
+ for (p->fftFrameSize = 2; n > 2; p->fftFrameSize <<= 1, n >>= 1);
+ assert(p->fftFrameSize <= MAX_FRAME_LENGTH);
+ p->shift = 1;
+ parse(effp, 0, effp->in_signal.rate); /* Re-parse now rate is known */
+ p->in_pos = p->bends_pos = 0;
+ for (i = 0; i < p->nbends; ++i)
+ if (p->bends[i].duration)
+ return SOX_SUCCESS;
+ return SOX_EFF_NULL;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t *p = (priv_t *) effp->priv;
+ size_t i, len = *isamp = *osamp = min(*isamp, *osamp);
+ double magn, phase, tmp, window, real, imag;
+ double freqPerBin, expct;
+ long k, qpd, index, inFifoLatency, stepSize, fftFrameSize2;
+ float pitchShift = p->shift;
+
+ /* set up some handy variables */
+ fftFrameSize2 = p->fftFrameSize / 2;
+ stepSize = p->fftFrameSize / p->ovsamp;
+ freqPerBin = effp->in_signal.rate / p->fftFrameSize;
+ expct = 2. * M_PI * (double) stepSize / (double) p->fftFrameSize;
+ inFifoLatency = p->fftFrameSize - stepSize;
+ if (!p->gRover)
+ p->gRover = inFifoLatency;
+
+ /* main processing loop */
+ for (i = 0; i < len; i++) {
+ SOX_SAMPLE_LOCALS;
+ ++p->in_pos;
+
+ /* As long as we have not yet collected enough data just read in */
+ p->gInFIFO[p->gRover] = SOX_SAMPLE_TO_FLOAT_32BIT(ibuf[i], effp->clips);
+ obuf[i] = SOX_FLOAT_32BIT_TO_SAMPLE(
+ p->gOutFIFO[p->gRover - inFifoLatency], effp->clips);
+ p->gRover++;
+
+ /* now we have enough data for processing */
+ if (p->gRover >= p->fftFrameSize) {
+ if (p->bends_pos != p->nbends && p->in_pos >=
+ p->bends[p->bends_pos].start + p->bends[p->bends_pos].duration) {
+ pitchShift = p->shift *= pow(2., p->bends[p->bends_pos].cents / 1200);
+ ++p->bends_pos;
+ }
+ if (p->bends_pos != p->nbends && p->in_pos >= p->bends[p->bends_pos].start) {
+ double progress = (double)(p->in_pos - p->bends[p->bends_pos].start) /
+ p->bends[p->bends_pos].duration;
+ progress = 1 - cos(M_PI * progress);
+ progress *= p->bends[p->bends_pos].cents * (.5 / 1200);
+ pitchShift = p->shift * pow(2., progress);
+ }
+
+ p->gRover = inFifoLatency;
+
+ /* do windowing and re,im interleave */
+ for (k = 0; k < p->fftFrameSize; k++) {
+ window = -.5 * cos(2 * M_PI * k / (double) p->fftFrameSize) + .5;
+ p->gFFTworksp[2 * k] = p->gInFIFO[k] * window;
+ p->gFFTworksp[2 * k + 1] = 0.;
+ }
+
+ /* ***************** ANALYSIS ******************* */
+ lsx_safe_cdft(2 * p->fftFrameSize, 1, p->gFFTworksp);
+
+ /* this is the analysis step */
+ for (k = 0; k <= fftFrameSize2; k++) {
+ /* de-interlace FFT buffer */
+ real = p->gFFTworksp[2 * k];
+ imag = - p->gFFTworksp[2 * k + 1];
+
+ /* compute magnitude and phase */
+ magn = 2. * sqrt(real * real + imag * imag);
+ phase = atan2(imag, real);
+
+ /* compute phase difference */
+ tmp = phase - p->gLastPhase[k];
+ p->gLastPhase[k] = phase;
+
+ tmp -= (double) k *expct; /* subtract expected phase difference */
+
+ /* map delta phase into +/- Pi interval */
+ qpd = tmp / M_PI;
+ if (qpd >= 0)
+ qpd += qpd & 1;
+ else qpd -= qpd & 1;
+ tmp -= M_PI * (double) qpd;
+
+ /* get deviation from bin frequency from the +/- Pi interval */
+ tmp = p->ovsamp * tmp / (2. * M_PI);
+
+ /* compute the k-th partials' true frequency */
+ tmp = (double) k *freqPerBin + tmp * freqPerBin;
+
+ /* store magnitude and true frequency in analysis arrays */
+ p->gAnaMagn[k] = magn;
+ p->gAnaFreq[k] = tmp;
+
+ }
+
+ /* this does the actual pitch shifting */
+ memset(p->gSynMagn, 0, p->fftFrameSize * sizeof(float));
+ memset(p->gSynFreq, 0, p->fftFrameSize * sizeof(float));
+ for (k = 0; k <= fftFrameSize2; k++) {
+ index = k * pitchShift;
+ if (index <= fftFrameSize2) {
+ p->gSynMagn[index] += p->gAnaMagn[k];
+ p->gSynFreq[index] = p->gAnaFreq[k] * pitchShift;
+ }
+ }
+
+ for (k = 0; k <= fftFrameSize2; k++) { /* SYNTHESIS */
+ /* get magnitude and true frequency from synthesis arrays */
+ magn = p->gSynMagn[k], tmp = p->gSynFreq[k];
+ tmp -= (double) k *freqPerBin; /* subtract bin mid frequency */
+ tmp /= freqPerBin; /* get bin deviation from freq deviation */
+ tmp = 2. * M_PI * tmp / p->ovsamp; /* take p->ovsamp into account */
+ tmp += (double) k *expct; /* add the overlap phase advance back in */
+ p->gSumPhase[k] += tmp; /* accumulate delta phase to get bin phase */
+ phase = p->gSumPhase[k];
+ /* get real and imag part and re-interleave */
+ p->gFFTworksp[2 * k] = magn * cos(phase);
+ p->gFFTworksp[2 * k + 1] = - magn * sin(phase);
+ }
+
+ for (k = p->fftFrameSize + 2; k < 2 * p->fftFrameSize; k++)
+ p->gFFTworksp[k] = 0.; /* zero negative frequencies */
+
+ lsx_safe_cdft(2 * p->fftFrameSize, -1, p->gFFTworksp);
+
+ /* do windowing and add to output accumulator */
+ for (k = 0; k < p->fftFrameSize; k++) {
+ window =
+ -.5 * cos(2. * M_PI * (double) k / (double) p->fftFrameSize) + .5;
+ p->gOutputAccum[k] +=
+ 2. * window * p->gFFTworksp[2 * k] / (fftFrameSize2 * p->ovsamp);
+ }
+ for (k = 0; k < stepSize; k++)
+ p->gOutFIFO[k] = p->gOutputAccum[k];
+
+ memmove(p->gOutputAccum, /* shift accumulator */
+ p->gOutputAccum + stepSize, p->fftFrameSize * sizeof(float));
+
+ for (k = 0; k < inFifoLatency; k++) /* move input FIFO */
+ p->gInFIFO[k] = p->gInFIFO[k + stepSize];
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t *p = (priv_t *) effp->priv;
+
+ if (p->bends_pos != p->nbends)
+ lsx_warn("Input audio too short; bends not applied: %u",
+ p->nbends - p->bends_pos);
+ return SOX_SUCCESS;
+}
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t *p = (priv_t *) effp->priv;
+ unsigned i;
+
+ for (i = 0; i < p->nbends; ++i)
+ free(p->bends[i].str);
+ free(p->bends);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const *lsx_bend_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "bend", "[-f frame-rate(25)] [-o over-sample(16)] {start,cents,end}",
+ 0, create, start, flow, 0, stop, lsx_kill, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/biquad.c b/src/src/biquad.c
new file mode 100644
index 0000000..c943d8d
--- /dev/null
+++ b/src/src/biquad.c
@@ -0,0 +1,178 @@
+/* libSoX Biquad filter common functions (c) 2006-7 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/biquad.h"
+#include <string.h>
+
+typedef biquad_t priv_t;
+
+static char const * const width_str[] = {
+ "band-width(Hz)",
+ "band-width(kHz)",
+ "band-width(Hz, no warp)", /* deprecated */
+ "band-width(octaves)",
+ "Q",
+ "slope",
+};
+static char const all_width_types[] = "hkboqs";
+
+
+int lsx_biquad_getopts(sox_effect_t * effp, int argc, char **argv,
+ int min_args, int max_args, int fc_pos, int width_pos, int gain_pos,
+ char const * allowed_width_types, filter_t filter_type)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ char width_type = *allowed_width_types;
+ char dummy, * dummy_p; /* To check for extraneous chars. */
+ --argc, ++argv;
+
+ p->filter_type = filter_type;
+ if (argc < min_args || argc > max_args ||
+ (argc > fc_pos && ((p->fc = lsx_parse_frequency(argv[fc_pos], &dummy_p)) <= 0 || *dummy_p)) ||
+ (argc > width_pos && ((unsigned)(sscanf(argv[width_pos], "%lf%c %c", &p->width, &width_type, &dummy)-1) > 1 || p->width <= 0)) ||
+ (argc > gain_pos && sscanf(argv[gain_pos], "%lf %c", &p->gain, &dummy) != 1) ||
+ !strchr(allowed_width_types, width_type) || (width_type == 's' && p->width > 1))
+ return lsx_usage(effp);
+ p->width_type = strchr(all_width_types, width_type) - all_width_types;
+ if ((size_t)p->width_type >= strlen(all_width_types))
+ p->width_type = 0;
+ if (p->width_type == width_bw_kHz) {
+ p->width *= 1000;
+ p->width_type = width_bw_Hz;
+ }
+ return SOX_SUCCESS;
+}
+
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ /* Simplify: */
+ p->b2 /= p->a0;
+ p->b1 /= p->a0;
+ p->b0 /= p->a0;
+ p->a2 /= p->a0;
+ p->a1 /= p->a0;
+
+ p->o2 = p->o1 = p->i2 = p->i1 = 0;
+ return SOX_SUCCESS;
+}
+
+
+int lsx_biquad_start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ start(effp);
+
+ if (effp->global_info->plot == sox_plot_octave) {
+ printf(
+ "%% GNU Octave file (may also work with MATLAB(R) )\n"
+ "Fs=%g;minF=10;maxF=Fs/2;\n"
+ "sweepF=logspace(log10(minF),log10(maxF),200);\n"
+ "[h,w]=freqz([%.15e %.15e %.15e],[1 %.15e %.15e],sweepF,Fs);\n"
+ "semilogx(w,20*log10(h))\n"
+ "title('SoX effect: %s gain=%g frequency=%g %s=%g (rate=%g)')\n"
+ "xlabel('Frequency (Hz)')\n"
+ "ylabel('Amplitude Response (dB)')\n"
+ "axis([minF maxF -35 25])\n"
+ "grid on\n"
+ "disp('Hit return to continue')\n"
+ "pause\n"
+ , effp->in_signal.rate, p->b0, p->b1, p->b2, p->a1, p->a2
+ , effp->handler.name, p->gain, p->fc, width_str[p->width_type], p->width
+ , effp->in_signal.rate);
+ return SOX_EOF;
+ }
+ if (effp->global_info->plot == sox_plot_gnuplot) {
+ printf(
+ "# gnuplot file\n"
+ "set title 'SoX effect: %s gain=%g frequency=%g %s=%g (rate=%g)'\n"
+ "set xlabel 'Frequency (Hz)'\n"
+ "set ylabel 'Amplitude Response (dB)'\n"
+ "Fs=%g\n"
+ "b0=%.15e; b1=%.15e; b2=%.15e; a1=%.15e; a2=%.15e\n"
+ "o=2*pi/Fs\n"
+ "H(f)=sqrt((b0*b0+b1*b1+b2*b2+2.*(b0*b1+b1*b2)*cos(f*o)+2.*(b0*b2)*cos(2.*f*o))/(1.+a1*a1+a2*a2+2.*(a1+a1*a2)*cos(f*o)+2.*a2*cos(2.*f*o)))\n"
+ "set logscale x\n"
+ "set samples 250\n"
+ "set grid xtics ytics\n"
+ "set key off\n"
+ "plot [f=10:Fs/2] [-35:25] 20*log10(H(f))\n"
+ "pause -1 'Hit return to continue'\n"
+ , effp->handler.name, p->gain, p->fc, width_str[p->width_type], p->width
+ , effp->in_signal.rate, effp->in_signal.rate
+ , p->b0, p->b1, p->b2, p->a1, p->a2);
+ return SOX_EOF;
+ }
+ if (effp->global_info->plot == sox_plot_data) {
+ printf("# SoX effect: %s gain=%g frequency=%g %s=%g (rate=%g)\n"
+ "# IIR filter\n"
+ "# rate: %g\n"
+ "# name: b\n"
+ "# type: matrix\n"
+ "# rows: 3\n"
+ "# columns: 1\n"
+ "%24.16e\n%24.16e\n%24.16e\n"
+ "# name: a\n"
+ "# type: matrix\n"
+ "# rows: 3\n"
+ "# columns: 1\n"
+ "%24.16e\n%24.16e\n%24.16e\n"
+ , effp->handler.name, p->gain, p->fc, width_str[p->width_type], p->width
+ , effp->in_signal.rate, effp->in_signal.rate
+ , p->b0, p->b1, p->b2, 1. /* a0 */, p->a1, p->a2);
+ return SOX_EOF;
+ }
+ return SOX_SUCCESS;
+}
+
+
+int lsx_biquad_flow(sox_effect_t * effp, const sox_sample_t *ibuf,
+ sox_sample_t *obuf, size_t *isamp, size_t *osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = *isamp = *osamp = min(*isamp, *osamp);
+ while (len--) {
+ double o0 = *ibuf*p->b0 + p->i1*p->b1 + p->i2*p->b2 - p->o1*p->a1 - p->o2*p->a2;
+ p->i2 = p->i1, p->i1 = *ibuf++;
+ p->o2 = p->o1, p->o1 = o0;
+ *obuf++ = SOX_ROUND_CLIP_COUNT(o0, effp->clips);
+ }
+ return SOX_SUCCESS;
+}
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ double * d = &p->b0;
+ char c;
+
+ --argc, ++argv;
+ if (argc == 6)
+ for (; argc && sscanf(*argv, "%lf%c", d, &c) == 1; --argc, ++argv, ++d);
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_biquad_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "biquad", "b0 b1 b2 a0 a1 a2", 0,
+ create, lsx_biquad_start, lsx_biquad_flow, NULL, NULL, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/biquad.h b/src/src/biquad.h
new file mode 100644
index 0000000..42eef8b
--- /dev/null
+++ b/src/src/biquad.h
@@ -0,0 +1,78 @@
+/* libSoX Biquad filter common definitions (c) 2006-7 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef biquad_included
+#define biquad_included
+
+#define LSX_EFF_ALIAS
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef enum {
+ filter_LPF,
+ filter_HPF,
+ filter_BPF_CSG,
+ filter_BPF,
+ filter_notch,
+ filter_APF,
+ filter_peakingEQ,
+ filter_lowShelf,
+ filter_highShelf,
+ filter_LPF_1,
+ filter_HPF_1,
+ filter_BPF_SPK,
+ filter_BPF_SPK_N,
+ filter_AP1,
+ filter_AP2,
+ filter_deemph,
+ filter_riaa
+} filter_t;
+
+typedef enum {
+ width_bw_Hz,
+ width_bw_kHz,
+ /* The old, non-RBJ, non-freq-warped band-pass/reject response;
+ * leaving here for now just in case anybody misses it: */
+ width_bw_old,
+ width_bw_oct,
+ width_Q,
+ width_slope
+} width_t;
+
+/* Private data for the biquad filter effects */
+typedef struct {
+ double gain; /* For EQ filters */
+ double fc; /* Centre/corner/cutoff frequency */
+ double width; /* Filter width; interpreted as per width_type */
+ width_t width_type;
+
+ filter_t filter_type;
+
+ double b0, b1, b2; /* Filter coefficients */
+ double a0, a1, a2; /* Filter coefficients */
+
+ sox_sample_t i1, i2; /* Filter memory */
+ double o1, o2; /* Filter memory */
+} biquad_t;
+
+int lsx_biquad_getopts(sox_effect_t * effp, int n, char **argv,
+ int min_args, int max_args, int fc_pos, int width_pos, int gain_pos,
+ char const * allowed_width_types, filter_t filter_type);
+int lsx_biquad_start(sox_effect_t * effp);
+int lsx_biquad_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp);
+
+#endif
diff --git a/src/src/biquads.c b/src/src/biquads.c
new file mode 100644
index 0000000..feb005b
--- /dev/null
+++ b/src/src/biquads.c
@@ -0,0 +1,410 @@
+/* libSoX Biquad filter effects (c) 2006-8 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *
+ * 2-pole filters designed by Robert Bristow-Johnson <rbj@audioimagination.com>
+ * see http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
+ *
+ * 1-pole filters based on code (c) 2000 Chris Bagwell <cbagwell@sprynet.com>
+ * Algorithms: Recursive single pole low/high pass filter
+ * Reference: The Scientist and Engineer's Guide to Digital Signal Processing
+ *
+ * low-pass: output[N] = input[N] * A + output[N-1] * B
+ * X = exp(-2.0 * pi * Fc)
+ * A = 1 - X
+ * B = X
+ * Fc = cutoff freq / sample rate
+ *
+ * Mimics an RC low-pass filter:
+ *
+ * ---/\/\/\/\----------->
+ * |
+ * --- C
+ * ---
+ * |
+ * |
+ * V
+ *
+ * high-pass: output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1]
+ * X = exp(-2.0 * pi * Fc)
+ * A0 = (1 + X) / 2
+ * A1 = -(1 + X) / 2
+ * B1 = X
+ * Fc = cutoff freq / sample rate
+ *
+ * Mimics an RC high-pass filter:
+ *
+ * || C
+ * ----||--------->
+ * || |
+ * <
+ * > R
+ * <
+ * |
+ * V
+ */
+
+
+#include "third_party/sox/src/src/biquad.h"
+#include <assert.h>
+#include <string.h>
+
+typedef biquad_t priv_t;
+
+
+static int hilo1_getopts(sox_effect_t * effp, int argc, char **argv) {
+ return lsx_biquad_getopts(effp, argc, argv, 1, 1, 0, 1, 2, "",
+ *effp->handler.name == 'l'? filter_LPF_1 : filter_HPF_1);
+}
+
+
+static int hilo2_getopts(sox_effect_t * effp, int argc, char **argv) {
+ priv_t * p = (priv_t *)effp->priv;
+ if (argc > 1 && strcmp(argv[1], "-1") == 0)
+ return hilo1_getopts(effp, argc - 1, argv + 1);
+ if (argc > 1 && strcmp(argv[1], "-2") == 0)
+ ++argv, --argc;
+ p->width = sqrt(0.5); /* Default to Butterworth */
+ return lsx_biquad_getopts(effp, argc, argv, 1, 2, 0, 1, 2, "qohk",
+ *effp->handler.name == 'l'? filter_LPF : filter_HPF);
+}
+
+
+static int bandpass_getopts(sox_effect_t * effp, int argc, char **argv) {
+ filter_t type = filter_BPF;
+ if (argc > 1 && strcmp(argv[1], "-c") == 0)
+ ++argv, --argc, type = filter_BPF_CSG;
+ return lsx_biquad_getopts(effp, argc, argv, 2, 2, 0, 1, 2, "hkqob", type);
+}
+
+
+static int bandrej_getopts(sox_effect_t * effp, int argc, char **argv) {
+ return lsx_biquad_getopts(effp, argc, argv, 2, 2, 0, 1, 2, "hkqob", filter_notch);
+}
+
+
+static int allpass_getopts(sox_effect_t * effp, int argc, char **argv) {
+ filter_t type = filter_APF;
+ int m;
+ if (argc > 1 && strcmp(argv[1], "-1") == 0)
+ ++argv, --argc, type = filter_AP1;
+ else if (argc > 1 && strcmp(argv[1], "-2") == 0)
+ ++argv, --argc, type = filter_AP2;
+ m = 1 + (type == filter_APF);
+ return lsx_biquad_getopts(effp, argc, argv, m, m, 0, 1, 2, "hkqo", type);
+}
+
+
+static int tone_getopts(sox_effect_t * effp, int argc, char **argv) {
+ priv_t * p = (priv_t *)effp->priv;
+ p->width = 0.5;
+ p->fc = *effp->handler.name == 'b'? 100 : 3000;
+ return lsx_biquad_getopts(effp, argc, argv, 1, 3, 1, 2, 0, "shkqo",
+ *effp->handler.name == 'b'? filter_lowShelf: filter_highShelf);
+}
+
+
+static int equalizer_getopts(sox_effect_t * effp, int argc, char **argv) {
+ return lsx_biquad_getopts(effp, argc, argv, 3, 3, 0, 1, 2, "qohk", filter_peakingEQ);
+}
+
+
+static int band_getopts(sox_effect_t * effp, int argc, char **argv) {
+ filter_t type = filter_BPF_SPK;
+ if (argc > 1 && strcmp(argv[1], "-n") == 0)
+ ++argv, --argc, type = filter_BPF_SPK_N;
+ return lsx_biquad_getopts(effp, argc, argv, 1, 2, 0, 1, 2, "hkqo", type);
+}
+
+
+static int deemph_getopts(sox_effect_t * effp, int argc, char **argv) {
+ return lsx_biquad_getopts(effp, argc, argv, 0, 0, 0, 1, 2, "s", filter_deemph);
+}
+
+
+static int riaa_getopts(sox_effect_t * effp, int argc, char **argv) {
+ priv_t * p = (priv_t *)effp->priv;
+ p->filter_type = filter_riaa;
+ (void)argv;
+ return --argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+
+static void make_poly_from_roots(
+ double const * roots, size_t num_roots, double * poly)
+{
+ size_t i, j;
+ poly[0] = 1;
+ poly[1] = -roots[0];
+ memset(poly + 2, 0, (num_roots + 1 - 2) * sizeof(*poly));
+ for (i = 1; i < num_roots; ++i)
+ for (j = num_roots; j > 0; --j)
+ poly[j] -= poly[j - 1] * roots[i];
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ double w0, A, alpha, mult;
+
+ if (p->filter_type == filter_deemph) { /* See deemph.plt for documentation */
+ if (effp->in_signal.rate == 44100) {
+ p->fc = 5283;
+ p->width = 0.4845;
+ p->gain = -9.477;
+ }
+ else if (effp->in_signal.rate == 48000) {
+ p->fc = 5356;
+ p->width = 0.479;
+ p->gain = -9.62;
+ }
+ else {
+ lsx_fail("sample rate must be 44100 (audio-CD) or 48000 (DAT)");
+ return SOX_EOF;
+ }
+ }
+
+ w0 = 2 * M_PI * p->fc / effp->in_signal.rate;
+ A = exp(p->gain / 40 * log(10.));
+ alpha = 0, mult = dB_to_linear(max(p->gain, 0));
+
+ if (w0 > M_PI) {
+ lsx_fail("frequency must be less than half the sample-rate (Nyquist rate)");
+ return SOX_EOF;
+ }
+
+ /* Set defaults: */
+ p->b0 = p->b1 = p->b2 = p->a1 = p->a2 = 0;
+ p->a0 = 1;
+
+ if (p->width) switch (p->width_type) {
+ case width_slope:
+ alpha = sin(w0)/2 * sqrt((A + 1/A)*(1/p->width - 1) + 2);
+ break;
+
+ case width_Q:
+ alpha = sin(w0)/(2*p->width);
+ break;
+
+ case width_bw_oct:
+ alpha = sin(w0)*sinh(log(2.)/2 * p->width * w0/sin(w0));
+ break;
+
+ case width_bw_Hz:
+ alpha = sin(w0)/(2*p->fc/p->width);
+ break;
+
+ case width_bw_kHz: assert(0); /* Shouldn't get here */
+
+ case width_bw_old:
+ alpha = tan(M_PI * p->width / effp->in_signal.rate);
+ break;
+ }
+ switch (p->filter_type) {
+ case filter_LPF: /* H(s) = 1 / (s^2 + s/Q + 1) */
+ p->b0 = (1 - cos(w0))/2;
+ p->b1 = 1 - cos(w0);
+ p->b2 = (1 - cos(w0))/2;
+ p->a0 = 1 + alpha;
+ p->a1 = -2*cos(w0);
+ p->a2 = 1 - alpha;
+ break;
+
+ case filter_HPF: /* H(s) = s^2 / (s^2 + s/Q + 1) */
+ p->b0 = (1 + cos(w0))/2;
+ p->b1 = -(1 + cos(w0));
+ p->b2 = (1 + cos(w0))/2;
+ p->a0 = 1 + alpha;
+ p->a1 = -2*cos(w0);
+ p->a2 = 1 - alpha;
+ break;
+
+ case filter_BPF_CSG: /* H(s) = s / (s^2 + s/Q + 1) (constant skirt gain, peak gain = Q) */
+ p->b0 = sin(w0)/2;
+ p->b1 = 0;
+ p->b2 = -sin(w0)/2;
+ p->a0 = 1 + alpha;
+ p->a1 = -2*cos(w0);
+ p->a2 = 1 - alpha;
+ break;
+
+ case filter_BPF: /* H(s) = (s/Q) / (s^2 + s/Q + 1) (constant 0 dB peak gain) */
+ p->b0 = alpha;
+ p->b1 = 0;
+ p->b2 = -alpha;
+ p->a0 = 1 + alpha;
+ p->a1 = -2*cos(w0);
+ p->a2 = 1 - alpha;
+ break;
+
+ case filter_notch: /* H(s) = (s^2 + 1) / (s^2 + s/Q + 1) */
+ p->b0 = 1;
+ p->b1 = -2*cos(w0);
+ p->b2 = 1;
+ p->a0 = 1 + alpha;
+ p->a1 = -2*cos(w0);
+ p->a2 = 1 - alpha;
+ break;
+
+ case filter_APF: /* H(s) = (s^2 - s/Q + 1) / (s^2 + s/Q + 1) */
+ p->b0 = 1 - alpha;
+ p->b1 = -2*cos(w0);
+ p->b2 = 1 + alpha;
+ p->a0 = 1 + alpha;
+ p->a1 = -2*cos(w0);
+ p->a2 = 1 - alpha;
+ break;
+
+ case filter_peakingEQ: /* H(s) = (s^2 + s*(A/Q) + 1) / (s^2 + s/(A*Q) + 1) */
+ if (A == 1)
+ return SOX_EFF_NULL;
+ p->b0 = 1 + alpha*A;
+ p->b1 = -2*cos(w0);
+ p->b2 = 1 - alpha*A;
+ p->a0 = 1 + alpha/A;
+ p->a1 = -2*cos(w0);
+ p->a2 = 1 - alpha/A;
+ break;
+
+ case filter_lowShelf: /* H(s) = A * (s^2 + (sqrt(A)/Q)*s + A)/(A*s^2 + (sqrt(A)/Q)*s + 1) */
+ if (A == 1)
+ return SOX_EFF_NULL;
+ p->b0 = A*( (A+1) - (A-1)*cos(w0) + 2*sqrt(A)*alpha );
+ p->b1 = 2*A*( (A-1) - (A+1)*cos(w0) );
+ p->b2 = A*( (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha );
+ p->a0 = (A+1) + (A-1)*cos(w0) + 2*sqrt(A)*alpha;
+ p->a1 = -2*( (A-1) + (A+1)*cos(w0) );
+ p->a2 = (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha;
+ break;
+
+ case filter_deemph: /* Falls through to high-shelf... */
+
+ case filter_highShelf: /* H(s) = A * (A*s^2 + (sqrt(A)/Q)*s + 1)/(s^2 + (sqrt(A)/Q)*s + A) */
+ if (!A)
+ return SOX_EFF_NULL;
+ p->b0 = A*( (A+1) + (A-1)*cos(w0) + 2*sqrt(A)*alpha );
+ p->b1 = -2*A*( (A-1) + (A+1)*cos(w0) );
+ p->b2 = A*( (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha );
+ p->a0 = (A+1) - (A-1)*cos(w0) + 2*sqrt(A)*alpha;
+ p->a1 = 2*( (A-1) - (A+1)*cos(w0) );
+ p->a2 = (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha;
+ break;
+
+ case filter_LPF_1: /* single-pole */
+ p->a1 = -exp(-w0);
+ p->b0 = 1 + p->a1;
+ break;
+
+ case filter_HPF_1: /* single-pole */
+ p->a1 = -exp(-w0);
+ p->b0 = (1 - p->a1)/2;
+ p->b1 = -p->b0;
+ break;
+
+ case filter_BPF_SPK: case filter_BPF_SPK_N: {
+ double bw_Hz;
+ if (!p->width)
+ p->width = p->fc / 2;
+ bw_Hz = p->width_type == width_Q? p->fc / p->width :
+ p->width_type == width_bw_Hz? p->width :
+ p->fc * (pow(2., p->width) - 1) * pow(2., -0.5 * p->width); /* bw_oct */
+ #include "third_party/sox/src/src/band.h" /* Has different licence */
+ break;
+ }
+
+ case filter_AP1: /* Experimental 1-pole all-pass from Tom Erbe @ UCSD */
+ p->b0 = exp(-w0);
+ p->b1 = -1;
+ p->a1 = -exp(-w0);
+ break;
+
+ case filter_AP2: /* Experimental 2-pole all-pass from Tom Erbe @ UCSD */
+ p->b0 = 1 - sin(w0);
+ p->b1 = -2 * cos(w0);
+ p->b2 = 1 + sin(w0);
+ p->a0 = 1 + sin(w0);
+ p->a1 = -2 * cos(w0);
+ p->a2 = 1 - sin(w0);
+ break;
+
+ case filter_riaa: /* http://www.dsprelated.com/showmessage/73300/3.php */
+ if (effp->in_signal.rate == 44100) {
+ static const double zeros[] = {-0.2014898, 0.9233820};
+ static const double poles[] = {0.7083149, 0.9924091};
+ make_poly_from_roots(zeros, (size_t)2, &p->b0);
+ make_poly_from_roots(poles, (size_t)2, &p->a0);
+ }
+ else if (effp->in_signal.rate == 48000) {
+ static const double zeros[] = {-0.1766069, 0.9321590};
+ static const double poles[] = {0.7396325, 0.9931330};
+ make_poly_from_roots(zeros, (size_t)2, &p->b0);
+ make_poly_from_roots(poles, (size_t)2, &p->a0);
+ }
+ else if (effp->in_signal.rate == 88200) {
+ static const double zeros[] = {-0.1168735, 0.9648312};
+ static const double poles[] = {0.8590646, 0.9964002};
+ make_poly_from_roots(zeros, (size_t)2, &p->b0);
+ make_poly_from_roots(poles, (size_t)2, &p->a0);
+ }
+ else if (effp->in_signal.rate == 96000) {
+ static const double zeros[] = {-0.1141486, 0.9676817};
+ static const double poles[] = {0.8699137, 0.9966946};
+ make_poly_from_roots(zeros, (size_t)2, &p->b0);
+ make_poly_from_roots(poles, (size_t)2, &p->a0);
+ }
+ else {
+ lsx_fail("Sample rate must be 44.1k, 48k, 88.2k, or 96k");
+ return SOX_EOF;
+ }
+ { /* Normalise to 0dB at 1kHz (Thanks to Glenn Davis) */
+ double y = 2 * M_PI * 1000 / effp->in_signal.rate;
+ double b_re = p->b0 + p->b1 * cos(-y) + p->b2 * cos(-2 * y);
+ double a_re = p->a0 + p->a1 * cos(-y) + p->a2 * cos(-2 * y);
+ double b_im = p->b1 * sin(-y) + p->b2 * sin(-2 * y);
+ double a_im = p->a1 * sin(-y) + p->a2 * sin(-2 * y);
+ double g = 1 / sqrt((sqr(b_re) + sqr(b_im)) / (sqr(a_re) + sqr(a_im)));
+ p->b0 *= g; p->b1 *= g; p->b2 *= g;
+ }
+ mult = (p->b0 + p->b1 + p->b2) / (p->a0 + p->a1 + p->a2);
+ lsx_debug("gain=%f", linear_to_dB(mult));
+ break;
+ }
+ if (effp->in_signal.mult)
+ *effp->in_signal.mult /= mult;
+ return lsx_biquad_start(effp);
+}
+
+
+#define BIQUAD_EFFECT(name,group,usage,flags) \
+sox_effect_handler_t const * lsx_##name##_effect_fn(void) { \
+ static sox_effect_handler_t handler = { \
+ #name, usage, flags, \
+ group##_getopts, start, lsx_biquad_flow, 0, 0, 0, sizeof(biquad_t)\
+ }; \
+ return &handler; \
+}
+
+BIQUAD_EFFECT(highpass, hilo2, "[-1|-2] frequency [width[q|o|h|k](0.707q)]", 0)
+BIQUAD_EFFECT(lowpass, hilo2, "[-1|-2] frequency [width[q|o|h|k]](0.707q)", 0)
+BIQUAD_EFFECT(bandpass, bandpass, "[-c] frequency width[h|k|q|o]", 0)
+BIQUAD_EFFECT(bandreject,bandrej, "frequency width[h|k|q|o]", 0)
+BIQUAD_EFFECT(allpass, allpass, "frequency width[h|k|q|o]", 0)
+BIQUAD_EFFECT(bass, tone, "gain [frequency(100) [width[s|h|k|q|o]](0.5s)]", 0)
+BIQUAD_EFFECT(treble, tone, "gain [frequency(3000) [width[s|h|k|q|o]](0.5s)]", 0)
+BIQUAD_EFFECT(equalizer, equalizer,"frequency width[q|o|h|k] gain", 0)
+BIQUAD_EFFECT(band, band, "[-n] center [width[h|k|q|o]]", 0)
+BIQUAD_EFFECT(deemph, deemph, NULL, 0)
+BIQUAD_EFFECT(riaa, riaa, NULL, 0)
diff --git a/src/src/caf.c b/src/src/caf.c
new file mode 100644
index 0000000..04f7647
--- /dev/null
+++ b/src/src/caf.c
@@ -0,0 +1,39 @@
+/* libSoX file format: CAF Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(caf)
+{
+ static char const * const names[] = {"caf", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 24, 32, 8, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ 0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description = "Apples's Core Audio Format";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/cdr.c b/src/src/cdr.c
new file mode 100644
index 0000000..9271511
--- /dev/null
+++ b/src/src/cdr.c
@@ -0,0 +1,49 @@
+/* libSoX file format: cdda (c) 2006-8 SoX contributors
+ * Based on an original idea by David Elliott
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+static int start(sox_format_t * ft)
+{
+ return lsx_check_read_params(ft, 2, 44100., SOX_ENCODING_SIGN2, 16, (uint64_t)0, sox_true);
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ unsigned const sector_num_samples = 588 * ft->signal.channels;
+ unsigned i = ft->olength % sector_num_samples;
+
+ if (i) while (i++ < sector_num_samples) /* Pad with silence to multiple */
+ lsx_writew(ft, 0); /* of 1/75th of a second. */
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(cdr)
+{
+ static char const * const names[] = {"cdda", "cdr", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 16, 0, 0};
+ static sox_rate_t const write_rates[] = {44100, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Red Book Compact Disc Digital Audio",
+ names, SOX_FILE_BIG_END|SOX_FILE_STEREO,
+ start, lsx_rawread, NULL,
+ NULL, lsx_rawwrite, stopwrite,
+ lsx_rawseek, write_encodings, write_rates, 0
+ };
+ return &handler;
+}
diff --git a/src/src/chorus.c b/src/src/chorus.c
new file mode 100644
index 0000000..2cdd7e0
--- /dev/null
+++ b/src/src/chorus.c
@@ -0,0 +1,351 @@
+/* August 24, 1998
+ * Copyright (C) 1998 Juergen Mueller And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Juergen Mueller And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+/*
+ * Chorus effect.
+ *
+ * Flow diagram scheme for n delays ( 1 <= n <= MAX_CHORUS ):
+ *
+ * * gain-in ___
+ * ibuff -----+--------------------------------------------->| |
+ * | _________ | |
+ * | | | * decay 1 | |
+ * +---->| delay 1 |----------------------------->| |
+ * | |_________| | |
+ * | /|\ | |
+ * : | | |
+ * : +-----------------+ +--------------+ | + |
+ * : | Delay control 1 |<--| mod. speed 1 | | |
+ * : +-----------------+ +--------------+ | |
+ * | _________ | |
+ * | | | * decay n | |
+ * +---->| delay n |----------------------------->| |
+ * |_________| | |
+ * /|\ |___|
+ * | |
+ * +-----------------+ +--------------+ | * gain-out
+ * | Delay control n |<--| mod. speed n | |
+ * +-----------------+ +--------------+ +----->obuff
+ *
+ *
+ * The delay i is controled by a sine or triangle modulation i ( 1 <= i <= n).
+ *
+ * Usage:
+ * chorus gain-in gain-out delay-1 decay-1 speed-1 depth-1 -s1|t1 [
+ * delay-2 decay-2 speed-2 depth-2 -s2|-t2 ... ]
+ *
+ * Where:
+ * gain-in, decay-1 ... decay-n : 0.0 ... 1.0 volume
+ * gain-out : 0.0 ... volume
+ * delay-1 ... delay-n : 20.0 ... 100.0 msec
+ * speed-1 ... speed-n : 0.1 ... 5.0 Hz modulation 1 ... n
+ * depth-1 ... depth-n : 0.0 ... 10.0 msec modulated delay 1 ... n
+ * -s1 ... -sn : modulation by sine 1 ... n
+ * -t1 ... -tn : modulation by triangle 1 ... n
+ *
+ * Note:
+ * when decay is close to 1.0, the samples can begin clipping and the output
+ * can saturate!
+ *
+ * Hint:
+ * 1 / out-gain < gain-in ( 1 + decay-1 + ... + decay-n )
+ *
+*/
+
+/*
+ * libSoX chorus effect file.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdlib.h> /* Harmless, and prototypes atof() etc. --dgc */
+#include <string.h>
+
+#define MOD_SINE 0
+#define MOD_TRIANGLE 1
+#define MAX_CHORUS 7
+
+typedef struct {
+ int num_chorus;
+ int modulation[MAX_CHORUS];
+ int counter;
+ long phase[MAX_CHORUS];
+ float *chorusbuf;
+ float in_gain, out_gain;
+ float delay[MAX_CHORUS], decay[MAX_CHORUS];
+ float speed[MAX_CHORUS], depth[MAX_CHORUS];
+ long length[MAX_CHORUS];
+ int *lookup_tab[MAX_CHORUS];
+ int depth_samples[MAX_CHORUS], samples[MAX_CHORUS];
+ int maxsamples;
+ unsigned int fade_out;
+} priv_t;
+
+/*
+ * Process options
+ */
+static int sox_chorus_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * chorus = (priv_t *) effp->priv;
+ int i;
+ --argc, ++argv;
+
+ chorus->num_chorus = 0;
+ i = 0;
+
+ if ( ( argc < 7 ) || (( argc - 2 ) % 5 ) )
+ return lsx_usage(effp);
+
+ sscanf(argv[i++], "%f", &chorus->in_gain);
+ sscanf(argv[i++], "%f", &chorus->out_gain);
+ while ( i < argc ) {
+ if ( chorus->num_chorus > MAX_CHORUS )
+ {
+ lsx_fail("chorus: to many delays, use less than %i delays", MAX_CHORUS);
+ return (SOX_EOF);
+ }
+ sscanf(argv[i++], "%f", &chorus->delay[chorus->num_chorus]);
+ sscanf(argv[i++], "%f", &chorus->decay[chorus->num_chorus]);
+ sscanf(argv[i++], "%f", &chorus->speed[chorus->num_chorus]);
+ sscanf(argv[i++], "%f", &chorus->depth[chorus->num_chorus]);
+ if ( !strcmp(argv[i], "-s"))
+ chorus->modulation[chorus->num_chorus] = MOD_SINE;
+ else if ( ! strcmp(argv[i], "-t"))
+ chorus->modulation[chorus->num_chorus] = MOD_TRIANGLE;
+ else
+ return lsx_usage(effp);
+ i++;
+ chorus->num_chorus++;
+ }
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Prepare for processing.
+ */
+static int sox_chorus_start(sox_effect_t * effp)
+{
+ priv_t * chorus = (priv_t *) effp->priv;
+ int i;
+ float sum_in_volume;
+
+ chorus->maxsamples = 0;
+
+ if ( chorus->in_gain < 0.0 )
+ {
+ lsx_fail("chorus: gain-in must be positive!");
+ return (SOX_EOF);
+ }
+ if ( chorus->in_gain > 1.0 )
+ {
+ lsx_fail("chorus: gain-in must be less than 1.0!");
+ return (SOX_EOF);
+ }
+ if ( chorus->out_gain < 0.0 )
+ {
+ lsx_fail("chorus: gain-out must be positive!");
+ return (SOX_EOF);
+ }
+ for ( i = 0; i < chorus->num_chorus; i++ ) {
+ chorus->samples[i] = (int) ( ( chorus->delay[i] +
+ chorus->depth[i] ) * effp->in_signal.rate / 1000.0);
+ chorus->depth_samples[i] = (int) (chorus->depth[i] *
+ effp->in_signal.rate / 1000.0);
+
+ if ( chorus->delay[i] < 20.0 )
+ {
+ lsx_fail("chorus: delay must be more than 20.0 msec!");
+ return (SOX_EOF);
+ }
+ if ( chorus->delay[i] > 100.0 )
+ {
+ lsx_fail("chorus: delay must be less than 100.0 msec!");
+ return (SOX_EOF);
+ }
+ if ( chorus->speed[i] < 0.1 )
+ {
+ lsx_fail("chorus: speed must be more than 0.1 Hz!");
+ return (SOX_EOF);
+ }
+ if ( chorus->speed[i] > 5.0 )
+ {
+ lsx_fail("chorus: speed must be less than 5.0 Hz!");
+ return (SOX_EOF);
+ }
+ if ( chorus->depth[i] < 0.0 )
+ {
+ lsx_fail("chorus: delay must be more positive!");
+ return (SOX_EOF);
+ }
+ if ( chorus->depth[i] > 10.0 )
+ {
+ lsx_fail("chorus: delay must be less than 10.0 msec!");
+ return (SOX_EOF);
+ }
+ if ( chorus->decay[i] < 0.0 )
+ {
+ lsx_fail("chorus: decay must be positive!" );
+ return (SOX_EOF);
+ }
+ if ( chorus->decay[i] > 1.0 )
+ {
+ lsx_fail("chorus: decay must be less that 1.0!" );
+ return (SOX_EOF);
+ }
+ chorus->length[i] = effp->in_signal.rate / chorus->speed[i];
+ chorus->lookup_tab[i] = lsx_malloc(sizeof (int) * chorus->length[i]);
+
+ if (chorus->modulation[i] == MOD_SINE)
+ lsx_generate_wave_table(SOX_WAVE_SINE, SOX_INT, chorus->lookup_tab[i],
+ (size_t)chorus->length[i], 0., (double)chorus->depth_samples[i], 0.);
+ else
+ lsx_generate_wave_table(SOX_WAVE_TRIANGLE, SOX_INT, chorus->lookup_tab[i],
+ (size_t)chorus->length[i],
+ (double)(chorus->samples[i] - 1 - 2 * chorus->depth_samples[i]),
+ (double)(chorus->samples[i] - 1), 3 * M_PI_2);
+ chorus->phase[i] = 0;
+
+ if ( chorus->samples[i] > chorus->maxsamples )
+ chorus->maxsamples = chorus->samples[i];
+ }
+
+ /* Be nice and check the hint with warning, if... */
+ sum_in_volume = 1.0;
+ for ( i = 0; i < chorus->num_chorus; i++ )
+ sum_in_volume += chorus->decay[i];
+ if ( chorus->in_gain * ( sum_in_volume ) > 1.0 / chorus->out_gain )
+ lsx_warn("chorus: warning >>> gain-out can cause saturation or clipping of output <<<");
+
+
+ chorus->chorusbuf = lsx_malloc(sizeof (float) * chorus->maxsamples);
+ for ( i = 0; i < chorus->maxsamples; i++ )
+ chorus->chorusbuf[i] = 0.0;
+
+ chorus->counter = 0;
+ chorus->fade_out = chorus->maxsamples;
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* TODO: calculate actual length */
+
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Processed signed long samples from ibuf to obuf.
+ * Return number of samples processed.
+ */
+static int sox_chorus_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * chorus = (priv_t *) effp->priv;
+ int i;
+ float d_in, d_out;
+ sox_sample_t out;
+ size_t len = min(*isamp, *osamp);
+ *isamp = *osamp = len;
+
+ while (len--) {
+ /* Store delays as 24-bit signed longs */
+ d_in = (float) *ibuf++ / 256;
+ /* Compute output first */
+ d_out = d_in * chorus->in_gain;
+ for ( i = 0; i < chorus->num_chorus; i++ )
+ d_out += chorus->chorusbuf[(chorus->maxsamples +
+ chorus->counter - chorus->lookup_tab[i][chorus->phase[i]]) %
+ chorus->maxsamples] * chorus->decay[i];
+ /* Adjust the output volume and size to 24 bit */
+ d_out = d_out * chorus->out_gain;
+ out = SOX_24BIT_CLIP_COUNT((sox_sample_t) d_out, effp->clips);
+ *obuf++ = out * 256;
+ /* Mix decay of delay and input */
+ chorus->chorusbuf[chorus->counter] = d_in;
+ chorus->counter =
+ ( chorus->counter + 1 ) % chorus->maxsamples;
+ for ( i = 0; i < chorus->num_chorus; i++ )
+ chorus->phase[i] =
+ ( chorus->phase[i] + 1 ) % chorus->length[i];
+ }
+ /* processed all samples */
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Drain out reverb lines.
+ */
+static int sox_chorus_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * chorus = (priv_t *) effp->priv;
+ size_t done;
+ int i;
+
+ float d_in, d_out;
+ sox_sample_t out;
+
+ done = 0;
+ while ( ( done < *osamp ) && ( done < chorus->fade_out ) ) {
+ d_in = 0;
+ d_out = 0;
+ /* Compute output first */
+ for ( i = 0; i < chorus->num_chorus; i++ )
+ d_out += chorus->chorusbuf[(chorus->maxsamples +
+ chorus->counter - chorus->lookup_tab[i][chorus->phase[i]]) %
+ chorus->maxsamples] * chorus->decay[i];
+ /* Adjust the output volume and size to 24 bit */
+ d_out = d_out * chorus->out_gain;
+ out = SOX_24BIT_CLIP_COUNT((sox_sample_t) d_out, effp->clips);
+ *obuf++ = out * 256;
+ /* Mix decay of delay and input */
+ chorus->chorusbuf[chorus->counter] = d_in;
+ chorus->counter =
+ ( chorus->counter + 1 ) % chorus->maxsamples;
+ for ( i = 0; i < chorus->num_chorus; i++ )
+ chorus->phase[i] =
+ ( chorus->phase[i] + 1 ) % chorus->length[i];
+ done++;
+ chorus->fade_out--;
+ }
+ /* samples played, it remains */
+ *osamp = done;
+ if (chorus->fade_out == 0)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+/*
+ * Clean up chorus effect.
+ */
+static int sox_chorus_stop(sox_effect_t * effp)
+{
+ priv_t * chorus = (priv_t *) effp->priv;
+ int i;
+
+ free(chorus->chorusbuf);
+ chorus->chorusbuf = NULL;
+ for ( i = 0; i < chorus->num_chorus; i++ ) {
+ free(chorus->lookup_tab[i]);
+ chorus->lookup_tab[i] = NULL;
+ }
+ return (SOX_SUCCESS);
+}
+
+static sox_effect_handler_t sox_chorus_effect = {
+ "chorus",
+ "gain-in gain-out delay decay speed depth [ -s | -t ]",
+ SOX_EFF_LENGTH | SOX_EFF_GAIN,
+ sox_chorus_getopts,
+ sox_chorus_start,
+ sox_chorus_flow,
+ sox_chorus_drain,
+ sox_chorus_stop,
+ NULL, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_chorus_effect_fn(void)
+{
+ return &sox_chorus_effect;
+}
diff --git a/src/src/compand.c b/src/src/compand.c
new file mode 100644
index 0000000..a9669d2
--- /dev/null
+++ b/src/src/compand.c
@@ -0,0 +1,293 @@
+/* libSoX compander effect
+ *
+ * Written by Nick Bailey (nick@bailey-family.org.uk or
+ * n.bailey@elec.gla.ac.uk)
+ *
+ * Copyright 1999 Chris Bagwell And Nick Bailey
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Chris Bagwell And Nick Bailey are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include "third_party/sox/src/src/compandt.h"
+
+/*
+ * Compressor/expander effect for libSoX.
+ *
+ * Flow diagram for one channel:
+ *
+ * ------------ ---------------
+ * | | | | ---
+ * ibuff ---+---| integrator |--->| transfer func |--->| |
+ * | | | | | | |
+ * | ------------ --------------- | | * gain
+ * | | * |----------->obuff
+ * | ------- | |
+ * | | | | |
+ * +----->| delay |-------------------------->| |
+ * | | ---
+ * -------
+ */
+#define compand_usage \
+ "attack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]]\n" \
+ "\twhere {} means optional and repeatable and [] means optional.\n" \
+ "\tdB values are floating point or -inf'; times are in seconds."
+/*
+ * Note: clipping can occur if the transfer function pushes things too
+ * close to 0 dB. In that case, use a negative gain, or reduce the
+ * output level of the transfer function.
+ */
+
+typedef struct {
+ sox_compandt_t transfer_fn;
+
+ struct {
+ double attack_times[2]; /* 0:attack_time, 1:decay_time */
+ double volume; /* Current "volume" of each channel */
+ } * channels;
+ unsigned expectedChannels;/* Also flags that channels aren't to be treated
+ individually when = 1 and input not mono */
+ double delay; /* Delay to apply before companding */
+ sox_sample_t *delay_buf; /* Old samples, used for delay processing */
+ ptrdiff_t delay_buf_size;/* Size of delay_buf in samples */
+ ptrdiff_t delay_buf_index; /* Index into delay_buf */
+ ptrdiff_t delay_buf_cnt; /* No. of active entries in delay_buf */
+ int delay_buf_full; /* Shows buffer situation (important for drain) */
+
+ char *arg0; /* copies of arguments, so that they may be modified */
+ char *arg1;
+ char *arg2;
+} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * l = (priv_t *) effp->priv;
+ char * s;
+ char dummy; /* To check for extraneous chars. */
+ unsigned pairs, i, j, commas;
+
+ --argc, ++argv;
+ if (argc < 2 || argc > 5)
+ return lsx_usage(effp);
+
+ l->arg0 = lsx_strdup(argv[0]);
+ l->arg1 = lsx_strdup(argv[1]);
+ l->arg2 = argc > 2 ? lsx_strdup(argv[2]) : NULL;
+
+ /* Start by checking the attack and decay rates */
+ for (s = l->arg0, commas = 0; *s; ++s) if (*s == ',') ++commas;
+ if ((commas % 2) == 0) {
+ lsx_fail("there must be an even number of attack/decay parameters");
+ return SOX_EOF;
+ }
+ pairs = 1 + commas/2;
+ l->channels = lsx_calloc(pairs, sizeof(*l->channels));
+ l->expectedChannels = pairs;
+
+ /* Now tokenise the rates string and set up these arrays. Keep
+ them in seconds at the moment: we don't know the sample rate yet. */
+ for (i = 0, s = strtok(l->arg0, ","); s != NULL; ++i) {
+ for (j = 0; j < 2; ++j) {
+ if (sscanf(s, "%lf %c", &l->channels[i].attack_times[j], &dummy) != 1) {
+ lsx_fail("syntax error trying to read attack/decay time");
+ return SOX_EOF;
+ } else if (l->channels[i].attack_times[j] < 0) {
+ lsx_fail("attack & decay times can't be less than 0 seconds");
+ return SOX_EOF;
+ }
+ s = strtok(NULL, ",");
+ }
+ }
+
+ if (!lsx_compandt_parse(&l->transfer_fn, l->arg1, l->arg2))
+ return SOX_EOF;
+
+ /* Set the initial "volume" to be attibuted to the input channels.
+ Unless specified, choose 0dB otherwise clipping will
+ result if the user has seleced a long attack time */
+ for (i = 0; i < l->expectedChannels; ++i) {
+ double init_vol_dB = 0;
+ if (argc > 3 && sscanf(argv[3], "%lf %c", &init_vol_dB, &dummy) != 1) {
+ lsx_fail("syntax error trying to read initial volume");
+ return SOX_EOF;
+ } else if (init_vol_dB > 0) {
+ lsx_fail("initial volume is relative to maximum volume so can't exceed 0dB");
+ return SOX_EOF;
+ }
+ l->channels[i].volume = pow(10., init_vol_dB / 20);
+ }
+
+ /* If there is a delay, store it. */
+ if (argc > 4 && sscanf(argv[4], "%lf %c", &l->delay, &dummy) != 1) {
+ lsx_fail("syntax error trying to read delay value");
+ return SOX_EOF;
+ } else if (l->delay < 0) {
+ lsx_fail("delay can't be less than 0 seconds");
+ return SOX_EOF;
+ }
+
+ return SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * l = (priv_t *) effp->priv;
+ unsigned i, j;
+
+ lsx_debug("%i input channel(s) expected: actually %i",
+ l->expectedChannels, effp->out_signal.channels);
+ for (i = 0; i < l->expectedChannels; ++i)
+ lsx_debug("Channel %i: attack = %g decay = %g", i,
+ l->channels[i].attack_times[0], l->channels[i].attack_times[1]);
+ if (!lsx_compandt_show(&l->transfer_fn, effp->global_info->plot))
+ return SOX_EOF;
+
+ /* Convert attack and decay rates using number of samples */
+ for (i = 0; i < l->expectedChannels; ++i)
+ for (j = 0; j < 2; ++j)
+ if (l->channels[i].attack_times[j] > 1.0/effp->out_signal.rate)
+ l->channels[i].attack_times[j] = 1.0 -
+ exp(-1.0/(effp->out_signal.rate * l->channels[i].attack_times[j]));
+ else
+ l->channels[i].attack_times[j] = 1.0;
+
+ /* Allocate the delay buffer */
+ l->delay_buf_size = l->delay * effp->out_signal.rate * effp->out_signal.channels;
+ if (l->delay_buf_size > 0)
+ l->delay_buf = lsx_calloc((size_t)l->delay_buf_size, sizeof(*l->delay_buf));
+ l->delay_buf_index = 0;
+ l->delay_buf_cnt = 0;
+ l->delay_buf_full= 0;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Update a volume value using the given sample
+ * value, the attack rate and decay rate
+ */
+static void doVolume(double *v, double samp, priv_t * l, int chan)
+{
+ double s = -samp / SOX_SAMPLE_MIN;
+ double delta = s - *v;
+
+ if (delta > 0.0) /* increase volume according to attack rate */
+ *v += delta * l->channels[chan].attack_times[0];
+ else /* reduce volume according to decay rate */
+ *v += delta * l->channels[chan].attack_times[1];
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * l = (priv_t *) effp->priv;
+ int len = (*isamp > *osamp) ? *osamp : *isamp;
+ int filechans = effp->out_signal.channels;
+ int idone,odone;
+
+ for (idone = 0,odone = 0; idone < len; ibuf += filechans) {
+ int chan;
+
+ /* Maintain the volume fields by simulating a leaky pump circuit */
+ for (chan = 0; chan < filechans; ++chan) {
+ if (l->expectedChannels == 1 && filechans > 1) {
+ /* User is expecting same compander for all channels */
+ int i;
+ double maxsamp = 0.0;
+ for (i = 0; i < filechans; ++i) {
+ double rect = fabs((double)ibuf[i]);
+ if (rect > maxsamp) maxsamp = rect;
+ }
+ doVolume(&l->channels[0].volume, maxsamp, l, 0);
+ break;
+ } else
+ doVolume(&l->channels[chan].volume, fabs((double)ibuf[chan]), l, chan);
+ }
+
+ /* Volume memory is updated: perform compand */
+ for (chan = 0; chan < filechans; ++chan) {
+ int ch = l->expectedChannels > 1 ? chan : 0;
+ double level_in_lin = l->channels[ch].volume;
+ double level_out_lin = lsx_compandt(&l->transfer_fn, level_in_lin);
+ double checkbuf;
+
+ if (l->delay_buf_size <= 0) {
+ checkbuf = ibuf[chan] * level_out_lin;
+ SOX_SAMPLE_CLIP_COUNT(checkbuf, effp->clips);
+ obuf[odone++] = checkbuf;
+ idone++;
+ } else {
+ if (l->delay_buf_cnt >= l->delay_buf_size) {
+ l->delay_buf_full=1; /* delay buffer is now definitely full */
+ checkbuf = l->delay_buf[l->delay_buf_index] * level_out_lin;
+ SOX_SAMPLE_CLIP_COUNT(checkbuf, effp->clips);
+ obuf[odone] = checkbuf;
+ odone++;
+ idone++;
+ } else {
+ l->delay_buf_cnt++;
+ idone++; /* no "odone++" because we did not fill obuf[...] */
+ }
+ l->delay_buf[l->delay_buf_index++] = ibuf[chan];
+ l->delay_buf_index %= l->delay_buf_size;
+ }
+ }
+ }
+
+ *isamp = idone; *osamp = odone;
+ return (SOX_SUCCESS);
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * l = (priv_t *) effp->priv;
+ size_t chan, done = 0;
+
+ if (l->delay_buf_full == 0)
+ l->delay_buf_index = 0;
+ while (done+effp->out_signal.channels <= *osamp && l->delay_buf_cnt > 0)
+ for (chan = 0; chan < effp->out_signal.channels; ++chan) {
+ int c = l->expectedChannels > 1 ? chan : 0;
+ double level_in_lin = l->channels[c].volume;
+ double level_out_lin = lsx_compandt(&l->transfer_fn, level_in_lin);
+ obuf[done++] = l->delay_buf[l->delay_buf_index++] * level_out_lin;
+ l->delay_buf_index %= l->delay_buf_size;
+ l->delay_buf_cnt--;
+ }
+ *osamp = done;
+ return l->delay_buf_cnt > 0 ? SOX_SUCCESS : SOX_EOF;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * l = (priv_t *) effp->priv;
+
+ free(l->delay_buf);
+ return SOX_SUCCESS;
+}
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * l = (priv_t *) effp->priv;
+
+ lsx_compandt_kill(&l->transfer_fn);
+ free(l->channels);
+ free(l->arg0);
+ free(l->arg1);
+ free(l->arg2);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_compand_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "compand", compand_usage, SOX_EFF_MCHAN | SOX_EFF_GAIN,
+ getopts, start, flow, drain, stop, lsx_kill, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/compandt.c b/src/src/compandt.c
new file mode 100644
index 0000000..a0fd394
--- /dev/null
+++ b/src/src/compandt.c
@@ -0,0 +1,229 @@
+/* libSoX Compander Transfer Function: (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include "third_party/sox/src/src/compandt.h"
+#include <string.h>
+
+#define LOG_TO_LOG10(x) ((x) * 20 / M_LN10)
+
+sox_bool lsx_compandt_show(sox_compandt_t * t, sox_plot_t plot)
+{
+ int i;
+
+ for (i = 1; t->segments[i-1].x; ++i)
+ lsx_debug("TF: %g %g %g %g",
+ LOG_TO_LOG10(t->segments[i].x),
+ LOG_TO_LOG10(t->segments[i].y),
+ LOG_TO_LOG10(t->segments[i].a),
+ LOG_TO_LOG10(t->segments[i].b));
+
+ if (plot == sox_plot_octave) {
+ printf(
+ "%% GNU Octave file (may also work with MATLAB(R) )\n"
+ "in=linspace(-99.5,0,200);\n"
+ "out=[");
+ for (i = -199; i <= 0; ++i) {
+ double in = i/2.;
+ double in_lin = pow(10., in/20);
+ printf("%g ", in + 20 * log10(lsx_compandt(t, in_lin)));
+ }
+ printf(
+ "];\n"
+ "plot(in,out)\n"
+ "title('SoX effect: compand')\n"
+ "xlabel('Input level (dB)')\n"
+ "ylabel('Output level (dB)')\n"
+ "grid on\n"
+ "disp('Hit return to continue')\n"
+ "pause\n");
+ return sox_false;
+ }
+ if (plot == sox_plot_gnuplot) {
+ printf(
+ "# gnuplot file\n"
+ "set title 'SoX effect: compand'\n"
+ "set xlabel 'Input level (dB)'\n"
+ "set ylabel 'Output level (dB)'\n"
+ "set grid xtics ytics\n"
+ "set key off\n"
+ "plot '-' with lines\n");
+ for (i = -199; i <= 0; ++i) {
+ double in = i/2.;
+ double in_lin = pow(10., in/20);
+ printf("%g %g\n", in, in + 20 * log10(lsx_compandt(t, in_lin)));
+ }
+ printf(
+ "e\n"
+ "pause -1 'Hit return to continue'\n");
+ return sox_false;
+ }
+ return sox_true;
+}
+
+static void prepare_transfer_fn(sox_compandt_t * t)
+{
+ int i;
+ double radius = t->curve_dB * M_LN10 / 20;
+
+ for (i = 0; !i || t->segments[i-2].x; i += 2) {
+ t->segments[i].y += t->outgain_dB;
+ t->segments[i].x *= M_LN10 / 20; /* Convert to natural logs */
+ t->segments[i].y *= M_LN10 / 20;
+ }
+
+#define line1 t->segments[i - 4]
+#define curve t->segments[i - 3]
+#define line2 t->segments[i - 2]
+#define line3 t->segments[i - 0]
+ for (i = 4; t->segments[i - 2].x; i += 2) {
+ double x, y, cx, cy, in1, in2, out1, out2, theta, len, r;
+
+ line1.a = 0;
+ line1.b = (line2.y - line1.y) / (line2.x - line1.x);
+
+ line2.a = 0;
+ line2.b = (line3.y - line2.y) / (line3.x - line2.x);
+
+ theta = atan2(line2.y - line1.y, line2.x - line1.x);
+ len = sqrt(pow(line2.x - line1.x, 2.) + pow(line2.y - line1.y, 2.));
+ r = min(radius, len);
+ curve.x = line2.x - r * cos(theta);
+ curve.y = line2.y - r * sin(theta);
+
+ theta = atan2(line3.y - line2.y, line3.x - line2.x);
+ len = sqrt(pow(line3.x - line2.x, 2.) + pow(line3.y - line2.y, 2.));
+ r = min(radius, len / 2);
+ x = line2.x + r * cos(theta);
+ y = line2.y + r * sin(theta);
+
+ cx = (curve.x + line2.x + x) / 3;
+ cy = (curve.y + line2.y + y) / 3;
+
+ line2.x = x;
+ line2.y = y;
+
+ in1 = cx - curve.x;
+ out1 = cy - curve.y;
+ in2 = line2.x - curve.x;
+ out2 = line2.y - curve.y;
+ curve.a = (out2/in2 - out1/in1) / (in2-in1);
+ curve.b = out1/in1 - curve.a*in1;
+ }
+#undef line1
+#undef curve
+#undef line2
+#undef line3
+ t->segments[i - 3].x = 0;
+ t->segments[i - 3].y = t->segments[i - 2].y;
+
+ t->in_min_lin = exp(t->segments[1].x);
+ t->out_min_lin= exp(t->segments[1].y);
+}
+
+static sox_bool parse_transfer_value(char const * text, double * value)
+{
+ char dummy; /* To check for extraneous chars. */
+
+ if (!text) {
+ lsx_fail("syntax error trying to read transfer function value");
+ return sox_false;
+ }
+ if (!strcmp(text, "-inf"))
+ *value = -20 * log10(-(double)SOX_SAMPLE_MIN);
+ else if (sscanf(text, "%lf %c", value, &dummy) != 1) {
+ lsx_fail("syntax error trying to read transfer function value");
+ return sox_false;
+ }
+ else if (*value > 0) {
+ lsx_fail("transfer function values are relative to maximum volume so can't exceed 0dB");
+ return sox_false;
+ }
+ return sox_true;
+}
+
+sox_bool lsx_compandt_parse(sox_compandt_t * t, char * points, char * gain)
+{
+ char const * text = points;
+ unsigned i, j, num, pairs, commas = 0;
+ char dummy; /* To check for extraneous chars. */
+
+ if (sscanf(points, "%lf %c", &t->curve_dB, &dummy) == 2 && dummy == ':')
+ points = strchr(points, ':') + 1;
+ else t->curve_dB = 0;
+ t->curve_dB = max(t->curve_dB, .01);
+
+ while (*text) commas += *text++ == ',';
+ pairs = 1 + commas / 2;
+ ++pairs; /* allow room for extra pair at the beginning */
+ pairs *= 2; /* allow room for the auto-curves */
+ ++pairs; /* allow room for 0,0 at end */
+ t->segments = lsx_calloc(pairs, sizeof(*t->segments));
+
+#define s(n) t->segments[2*((n)+1)]
+ for (i = 0, text = strtok(points, ","); text != NULL; ++i) {
+ if (!parse_transfer_value(text, &s(i).x))
+ return sox_false;
+ if (i && s(i-1).x > s(i).x) {
+ lsx_fail("transfer function input values must be strictly increasing");
+ return sox_false;
+ }
+ if (i || (commas & 1)) {
+ text = strtok(NULL, ",");
+ if (!parse_transfer_value(text, &s(i).y))
+ return sox_false;
+ s(i).y -= s(i).x;
+ }
+ text = strtok(NULL, ",");
+ }
+ num = i;
+
+ if (num == 0 || s(num-1).x) /* Add 0,0 if necessary */
+ ++num;
+#undef s
+
+ if (gain && sscanf(gain, "%lf %c", &t->outgain_dB, &dummy) != 1) {
+ lsx_fail("syntax error trying to read post-processing gain value");
+ return sox_false;
+ }
+
+#define s(n) t->segments[2*(n)]
+ s(0).x = s(1).x - 2 * t->curve_dB; /* Add a tail off segment at the start */
+ s(0).y = s(1).y;
+ ++num;
+
+ for (i = 2; i < num; ++i) { /* Join adjacent colinear segments */
+ double g1 = (s(i-1).y - s(i-2).y) * (s(i-0).x - s(i-1).x);
+ double g2 = (s(i-0).y - s(i-1).y) * (s(i-1).x - s(i-2).x);
+ if (fabs(g1 - g2)) /* fabs stops epsilon problems */
+ continue;
+ --num;
+ for (j = --i; j < num; ++j)
+ s(j) = s(j+1);
+ }
+#undef s
+
+ prepare_transfer_fn(t);
+ return sox_true;
+}
+
+void lsx_compandt_kill(sox_compandt_t * p)
+{
+ free(p->segments);
+}
+
diff --git a/src/src/compandt.h b/src/src/compandt.h
new file mode 100644
index 0000000..75e0349
--- /dev/null
+++ b/src/src/compandt.h
@@ -0,0 +1,52 @@
+/* libSoX Compander Transfer Function (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <math.h>
+
+typedef struct {
+ struct sox_compandt_segment {
+ double x, y; /* 1st point in segment */
+ double a, b; /* Quadratic coeffecients for rest of segment */
+ } * segments;
+ double in_min_lin;
+ double out_min_lin;
+ double outgain_dB; /* Post processor gain */
+ double curve_dB;
+} sox_compandt_t;
+
+sox_bool lsx_compandt_parse(sox_compandt_t * t, char * points, char * gain);
+sox_bool lsx_compandt_show(sox_compandt_t * t, sox_plot_t plot);
+void lsx_compandt_kill(sox_compandt_t * p);
+
+/* Place in header to allow in-lining */
+static double lsx_compandt(sox_compandt_t * t, double in_lin)
+{
+ struct sox_compandt_segment * s;
+ double in_log, out_log;
+
+ if (in_lin <= t->in_min_lin)
+ return t->out_min_lin;
+
+ in_log = log(in_lin);
+
+ for (s = t->segments + 1; in_log > s[1].x; ++s);
+
+ in_log -= s->x;
+ out_log = s->y + in_log * (s->a * in_log + s->b);
+
+ return exp(out_log);
+}
diff --git a/src/src/contrast.c b/src/src/contrast.c
new file mode 100644
index 0000000..5cffefe
--- /dev/null
+++ b/src/src/contrast.c
@@ -0,0 +1,49 @@
+/* libSoX effect: Contrast Enhancement (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {double contrast;} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ p->contrast = 75;
+ --argc, ++argv;
+ do {NUMERIC_PARAMETER(contrast, 0, 100)} while (0);
+ p->contrast /= 750; /* shift range to 0 to 0.1333, default 0.1 */
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = *isamp = *osamp = min(*isamp, *osamp);
+ while (len--) {
+ double d = *ibuf++ * (-M_PI_2 / SOX_SAMPLE_MIN);
+ *obuf++ = sin(d + p->contrast * sin(d * 4)) * SOX_SAMPLE_MAX;
+ }
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_contrast_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"contrast", "[enhancement (75)]",
+ 0, create, NULL, flow, NULL, NULL, NULL, sizeof(priv_t)};
+ return &handler;
+}
diff --git a/src/src/coreaudio.c b/src/src/coreaudio.c
new file mode 100644
index 0000000..4e2dd7b
--- /dev/null
+++ b/src/src/coreaudio.c
@@ -0,0 +1,418 @@
+/* AudioCore sound handler
+ *
+ * Copyright 2008 Chris Bagwell And Sundry Contributors
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <CoreAudio/CoreAudio.h>
+#include <pthread.h>
+
+#define Buffactor 4
+
+typedef struct {
+ AudioDeviceID adid;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ int device_started;
+ size_t bufsize;
+ size_t bufrd;
+ size_t bufwr;
+ size_t bufrdavail;
+ float *buf;
+} priv_t;
+
+static OSStatus PlaybackIOProc(AudioDeviceID inDevice UNUSED,
+ const AudioTimeStamp *inNow UNUSED,
+ const AudioBufferList *inInputData UNUSED,
+ const AudioTimeStamp *inInputTime UNUSED,
+ AudioBufferList *outOutputData,
+ const AudioTimeStamp *inOutputTime UNUSED,
+ void *inClientData)
+{
+ priv_t *ac = (priv_t*)((sox_format_t*)inClientData)->priv;
+ AudioBuffer *buf;
+ size_t copylen, avail;
+
+ pthread_mutex_lock(&ac->mutex);
+
+ for(buf = outOutputData->mBuffers;
+ buf != outOutputData->mBuffers + outOutputData->mNumberBuffers;
+ buf++){
+
+ copylen = buf->mDataByteSize / sizeof(float);
+ if(copylen > ac->bufrdavail)
+ copylen = ac->bufrdavail;
+
+ avail = ac->bufsize - ac->bufrd;
+ if(buf->mData == NULL){
+ /*do nothing-hardware can't play audio*/
+ }else if(copylen > avail){
+ memcpy(buf->mData, ac->buf + ac->bufrd, avail * sizeof(float));
+ memcpy((float*)buf->mData + avail, ac->buf, (copylen - avail) * sizeof(float));
+ }else{
+ memcpy(buf->mData, ac->buf + ac->bufrd, copylen * sizeof(float));
+ }
+
+ buf->mDataByteSize = copylen * sizeof(float);
+ ac->bufrd += copylen;
+ if(ac->bufrd >= ac->bufsize)
+ ac->bufrd -= ac->bufsize;
+ ac->bufrdavail -= copylen;
+ }
+
+ pthread_cond_signal(&ac->cond);
+ pthread_mutex_unlock(&ac->mutex);
+
+ return kAudioHardwareNoError;
+}
+
+static OSStatus RecIOProc(AudioDeviceID inDevice UNUSED,
+ const AudioTimeStamp *inNow UNUSED,
+ const AudioBufferList *inInputData,
+ const AudioTimeStamp *inInputTime UNUSED,
+ AudioBufferList *outOutputData UNUSED,
+ const AudioTimeStamp *inOutputTime UNUSED,
+ void *inClientData)
+{
+ priv_t *ac = (priv_t *)((sox_format_t*)inClientData)->priv;
+ AudioBuffer const *buf;
+ size_t nfree, copylen, avail;
+
+ pthread_mutex_lock(&ac->mutex);
+
+ for(buf = inInputData->mBuffers;
+ buf != inInputData->mBuffers + inInputData->mNumberBuffers;
+ buf++){
+
+ if(buf->mData == NULL)
+ continue;
+
+ copylen = buf->mDataByteSize / sizeof(float);
+ nfree = ac->bufsize - ac->bufrdavail - 1;
+ if(nfree == 0)
+ lsx_warn("coreaudio: unhandled buffer overrun. Data discarded.");
+
+ if(copylen > nfree)
+ copylen = nfree;
+
+ avail = ac->bufsize - ac->bufwr;
+ if(copylen > avail){
+ memcpy(ac->buf + ac->bufwr, buf->mData, avail * sizeof(float));
+ memcpy(ac->buf, (float*)buf->mData + avail, (copylen - avail) * sizeof(float));
+ }else{
+ memcpy(ac->buf + ac->bufwr, buf->mData, copylen * sizeof(float));
+ }
+
+ ac->bufwr += copylen;
+ if(ac->bufwr >= ac->bufsize)
+ ac->bufwr -= ac->bufsize;
+ ac->bufrdavail += copylen;
+ }
+
+ pthread_cond_signal(&ac->cond);
+ pthread_mutex_unlock(&ac->mutex);
+
+ return kAudioHardwareNoError;
+}
+
+static int setup(sox_format_t *ft, int is_input)
+{
+ priv_t *ac = (priv_t *)ft->priv;
+ OSStatus status;
+ UInt32 property_size;
+ struct AudioStreamBasicDescription stream_desc;
+ int32_t buf_size;
+ int rc;
+
+ if (strncmp(ft->filename, "default", (size_t)7) == 0)
+ {
+ property_size = sizeof(ac->adid);
+ if (is_input)
+ status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &property_size, &ac->adid);
+ else
+ status = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &property_size, &ac->adid);
+ }
+ else
+ {
+ Boolean is_writable;
+ status = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &property_size, &is_writable);
+
+ if (status == noErr)
+ {
+ int device_count = property_size/sizeof(AudioDeviceID);
+ AudioDeviceID *devices;
+
+ devices = malloc(property_size);
+ status = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &property_size, devices);
+
+ if (status == noErr)
+ {
+ int i;
+ for (i = 0; i < device_count; i++)
+ {
+ char name[256];
+ status = AudioDeviceGetProperty(devices[i],0,false,kAudioDevicePropertyDeviceName,&property_size,&name);
+
+ lsx_report("Found Audio Device \"%s\"\n",name);
+
+ /* String returned from OS is truncated so only compare
+ * as much as returned.
+ */
+ if (strncmp(name,ft->filename,strlen(name)) == 0)
+ {
+ ac->adid = devices[i];
+ break;
+ }
+ }
+ }
+ free(devices);
+ }
+ }
+
+ if (status || ac->adid == kAudioDeviceUnknown)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "can not open audio device");
+ return SOX_EOF;
+ }
+
+ /* Query device to get initial values */
+ property_size = sizeof(struct AudioStreamBasicDescription);
+ status = AudioDeviceGetProperty(ac->adid, 0, is_input,
+ kAudioDevicePropertyStreamFormat,
+ &property_size, &stream_desc);
+ if (status)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "can not get audio device properties");
+ return SOX_EOF;
+ }
+
+ if (!(stream_desc.mFormatFlags & kLinearPCMFormatFlagIsFloat))
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "audio device does not accept floats");
+ return SOX_EOF;
+ }
+
+ /* OS X effectively only supports these values. */
+ ft->signal.channels = 2;
+ ft->signal.rate = 44100;
+ ft->encoding.bits_per_sample = 32;
+
+ /* TODO: My limited experience with hardware can only get floats working
+ * withh a fixed sample rate and stereo. I know that is a limitiation of
+ * audio device I have so this may not be standard operating orders.
+ * If some hardware supports setting sample rates and channel counts
+ * then should do that over resampling and mixing.
+ */
+#if 0
+ stream_desc.mSampleRate = ft->signal.rate;
+ stream_desc.mChannelsPerFrame = ft->signal.channels;
+
+ /* Write them back */
+ property_size = sizeof(struct AudioStreamBasicDescription);
+ status = AudioDeviceSetProperty(ac->adid, NULL, 0, is_input,
+ kAudioDevicePropertyStreamFormat,
+ property_size, &stream_desc);
+ if (status)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "can not set audio device properties");
+ return SOX_EOF;
+ }
+
+ /* Query device to see if it worked */
+ property_size = sizeof(struct AudioStreamBasicDescription);
+ status = AudioDeviceGetProperty(ac->adid, 0, is_input,
+ kAudioDevicePropertyStreamFormat,
+ &property_size, &stream_desc);
+
+ if (status)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "can not get audio device properties");
+ return SOX_EOF;
+ }
+#endif
+
+ if (stream_desc.mChannelsPerFrame != ft->signal.channels)
+ {
+ lsx_debug("audio device did not accept %d channels. Use %d channels instead.", (int)ft->signal.channels,
+ (int)stream_desc.mChannelsPerFrame);
+ ft->signal.channels = stream_desc.mChannelsPerFrame;
+ }
+
+ if (stream_desc.mSampleRate != ft->signal.rate)
+ {
+ lsx_debug("audio device did not accept %d sample rate. Use %d instead.", (int)ft->signal.rate,
+ (int)stream_desc.mSampleRate);
+ ft->signal.rate = stream_desc.mSampleRate;
+ }
+
+ ac->bufsize = sox_globals.bufsiz / sizeof(sox_sample_t) * Buffactor;
+ ac->bufrd = 0;
+ ac->bufwr = 0;
+ ac->bufrdavail = 0;
+ ac->buf = lsx_malloc(ac->bufsize * sizeof(float));
+
+ buf_size = sox_globals.bufsiz / sizeof(sox_sample_t) * sizeof(float);
+ property_size = sizeof(buf_size);
+ status = AudioDeviceSetProperty(ac->adid, NULL, 0, is_input,
+ kAudioDevicePropertyBufferSize,
+ property_size, &buf_size);
+
+ rc = pthread_mutex_init(&ac->mutex, NULL);
+ if (rc)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "failed initializing mutex");
+ return SOX_EOF;
+ }
+
+ rc = pthread_cond_init(&ac->cond, NULL);
+ if (rc)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "failed initializing condition");
+ return SOX_EOF;
+ }
+
+ ac->device_started = 0;
+
+ /* Registers callback with the device without activating it. */
+ if (is_input)
+ status = AudioDeviceAddIOProc(ac->adid, RecIOProc, (void *)ft);
+ else
+ status = AudioDeviceAddIOProc(ac->adid, PlaybackIOProc, (void *)ft);
+
+ return SOX_SUCCESS;
+}
+
+static int startread(sox_format_t *ft)
+{
+ return setup(ft, 1);
+}
+
+static size_t read_samples(sox_format_t *ft, sox_sample_t *buf, size_t nsamp)
+{
+ priv_t *ac = (priv_t *)ft->priv;
+ size_t len;
+ SOX_SAMPLE_LOCALS;
+
+ if (!ac->device_started) {
+ AudioDeviceStart(ac->adid, RecIOProc);
+ ac->device_started = 1;
+ }
+
+ pthread_mutex_lock(&ac->mutex);
+
+ /* Wait until input buffer has been filled by device driver */
+ while (ac->bufrdavail == 0)
+ pthread_cond_wait(&ac->cond, &ac->mutex);
+
+ len = 0;
+ while(len < nsamp && ac->bufrdavail > 0){
+ buf[len] = SOX_FLOAT_32BIT_TO_SAMPLE(ac->buf[ac->bufrd], ft->clips);
+ len++;
+ ac->bufrd++;
+ if(ac->bufrd == ac->bufsize)
+ ac->bufrd = 0;
+ ac->bufrdavail--;
+ }
+
+ pthread_mutex_unlock(&ac->mutex);
+
+ return len;
+}
+
+static int stopread(sox_format_t * ft)
+{
+ priv_t *ac = (priv_t *)ft->priv;
+
+ AudioDeviceStop(ac->adid, RecIOProc);
+ AudioDeviceRemoveIOProc(ac->adid, RecIOProc);
+ pthread_cond_destroy(&ac->cond);
+ pthread_mutex_destroy(&ac->mutex);
+ free(ac->buf);
+
+ return SOX_SUCCESS;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ return setup(ft, 0);
+}
+
+static size_t write_samples(sox_format_t *ft, const sox_sample_t *buf, size_t nsamp)
+{
+ priv_t *ac = (priv_t *)ft->priv;
+ size_t i;
+
+ SOX_SAMPLE_LOCALS;
+
+ pthread_mutex_lock(&ac->mutex);
+
+ /* Wait to start until mutex is locked to help prevent callback
+ * getting zero samples.
+ */
+ if(!ac->device_started){
+ if(AudioDeviceStart(ac->adid, PlaybackIOProc)){
+ pthread_mutex_unlock(&ac->mutex);
+ return SOX_EOF;
+ }
+ ac->device_started = 1;
+ }
+
+ /* globals.bufsize is in samples
+ * buf_offset is in bytes
+ * buf_size is in bytes
+ */
+ for(i = 0; i < nsamp; i++){
+ while(ac->bufrdavail == ac->bufsize - 1)
+ pthread_cond_wait(&ac->cond, &ac->mutex);
+
+ ac->buf[ac->bufwr] = SOX_SAMPLE_TO_FLOAT_32BIT(buf[i], ft->clips);
+ ac->bufwr++;
+ if(ac->bufwr == ac->bufsize)
+ ac->bufwr = 0;
+ ac->bufrdavail++;
+ }
+
+ pthread_mutex_unlock(&ac->mutex);
+ return nsamp;
+}
+
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t *ac = (priv_t *)ft->priv;
+
+ if(ac->device_started){
+ pthread_mutex_lock(&ac->mutex);
+
+ while (ac->bufrdavail > 0)
+ pthread_cond_wait(&ac->cond, &ac->mutex);
+
+ pthread_mutex_unlock(&ac->mutex);
+
+ AudioDeviceStop(ac->adid, PlaybackIOProc);
+ }
+
+ AudioDeviceRemoveIOProc(ac->adid, PlaybackIOProc);
+ pthread_cond_destroy(&ac->cond);
+ pthread_mutex_destroy(&ac->mutex);
+ free(ac->buf);
+
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(coreaudio)
+{
+ static char const *const names[] = { "coreaudio", NULL };
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_FLOAT, 32, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Mac AudioCore device driver",
+ names, SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/cvsd-fmt.c b/src/src/cvsd-fmt.c
new file mode 100644
index 0000000..914b71b
--- /dev/null
+++ b/src/src/cvsd-fmt.c
@@ -0,0 +1,114 @@
+/* libSoX file format: CVSD (see cvsd.c) (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/cvsd.h"
+
+LSX_FORMAT_HANDLER(cvsd)
+{
+ static char const * const names[] = {"cvsd", "cvs", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_CVSD, 1, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Headerless MIL Std 188 113 Continuously Variable Slope Delta modulation",
+ names, SOX_FILE_MONO,
+ lsx_cvsdstartread, lsx_cvsdread, lsx_cvsdstopread,
+ lsx_cvsdstartwrite, lsx_cvsdwrite, lsx_cvsdstopwrite,
+ lsx_rawseek, write_encodings, NULL, sizeof(cvsd_priv_t)
+ };
+ return &handler;
+}
+
+/* libSoX file format: CVU (c) 2008 robs@users.sourceforge.net
+ * Unfiltered, therefore, on decode, use with either filter -4k or rate 8k */
+
+typedef struct {
+ double sample, step, step_mult, step_add;
+ unsigned last_n_bits;
+ unsigned char byte;
+ off_t bit_count;
+} priv_t;
+
+static int start(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+
+ ft->signal.channels = 1;
+ lsx_rawstart(ft, sox_true, sox_false, sox_true, SOX_ENCODING_CVSD, 1);
+ p->last_n_bits = 5; /* 101 */
+ p->step_mult = exp((-1 / .005 / ft->signal.rate));
+ p->step_add = (1 - p->step_mult) * (.1 * SOX_SAMPLE_MAX);
+ lsx_debug("step_mult=%g step_add=%f", p->step_mult, p->step_add);
+ return SOX_SUCCESS;
+}
+
+static void decode(priv_t * p, int bit)
+{
+ p->last_n_bits = ((p->last_n_bits << 1) | bit) & 7;
+
+ p->step *= p->step_mult;
+ if (p->last_n_bits == 0 || p->last_n_bits == 7)
+ p->step += p->step_add;
+
+ if (p->last_n_bits & 1)
+ p->sample = min(p->step_mult * p->sample + p->step, SOX_SAMPLE_MAX);
+ else
+ p->sample = max(p->step_mult * p->sample - p->step, SOX_SAMPLE_MIN);
+}
+
+static size_t cvsdread(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t i;
+
+ for (i = 0; i < len; ++i) {
+ if (!(p->bit_count & 7))
+ if (lsx_read_b_buf(ft, &p->byte, (size_t)1) != 1)
+ break;
+ ++p->bit_count;
+ decode(p, p->byte & 1);
+ p->byte >>= 1;
+ *buf++ = floor(p->sample + .5);
+ }
+ return i;
+}
+
+static size_t cvsdwrite(sox_format_t * ft, sox_sample_t const * buf, size_t len)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t i;
+
+ for (i = 0; i < len; ++i) {
+ decode(p, *buf++ > p->sample);
+ p->byte >>= 1;
+ p->byte |= p->last_n_bits << 7;
+ if (!(++p->bit_count & 7))
+ if (lsx_writeb(ft, p->byte) != SOX_SUCCESS)
+ break;
+ }
+ return len;
+}
+
+LSX_FORMAT_HANDLER(cvu)
+{
+ static char const * const names[] = {"cvu", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_CVSD, 1, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Headerless Continuously Variable Slope Delta modulation (unfiltered)",
+ names, SOX_FILE_MONO, start, cvsdread, NULL, start, cvsdwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/cvsd.c b/src/src/cvsd.c
new file mode 100644
index 0000000..f5a1c4e
--- /dev/null
+++ b/src/src/cvsd.c
@@ -0,0 +1,680 @@
+/* libSoX CVSD (Continuously Variable Slope Delta modulation)
+ * conversion routines
+ *
+ * The CVSD format is described in the MIL Std 188 113, which is
+ * available from http://bbs.itsi.disa.mil:5580/T3564
+ *
+ * Copyright (C) 1996
+ * Thomas Sailer (sailer@ife.ee.ethz.ch) (HB9JNX/AE4WA)
+ * Swiss Federal Institute of Technology, Electronics Lab
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Change History:
+ *
+ * June 1, 1998 - Chris Bagwell (cbagwell@sprynet.com)
+ * Fixed compile warnings reported by Kjetil Torgrim Homme
+ * <kjetilho@ifi.uio.no>
+ *
+ * June 20, 2006 - Kimberly Rockwell (pyxis13317 (at) yahoo.com)
+ * Speed optimization: Unrolled float_conv() loop in seperate
+ * functions for encoding and decoding. 15% speed up decoding.
+ *
+ * Aug. 24, 2009 - P. Chaintreuil (sox-cvsd-peep (at) parallaxshift.com)
+ * Speed optimization: Replaced calls to memmove() with a
+ * mirrored circular buffer. This doubles the size of the
+ * dec.output_filter (48 -> 96 floats) and enc.input_filter
+ * (16 -> 32 floats), but keeps the memory from having to
+ * be copied so many times. 56% speed increase decoding;
+ * less than 5% encoding speed increase.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/cvsd.h"
+#include "third_party/sox/src/src/cvsdfilt.h"
+
+#include <string.h>
+#include <time.h>
+
+/* ---------------------------------------------------------------------- */
+/*
+ * private data structures
+ */
+
+typedef cvsd_priv_t priv_t;
+
+static int debug_count = 0;
+
+/* ---------------------------------------------------------------------- */
+
+/* This float_conv() function is not used as more specialized/optimized
+ * versions exist below. However, those new versions are tied to
+ * very percise filters defined in cvsdfilt.h. If those are modified
+ * or different filters are found to be required, this function may
+ * be needed. Thus I leave it here for possible future use, but commented
+ * out to avoid compiler warnings about it not being used.
+static float float_conv(float const *fp1, float const *fp2,int n)
+{
+ float res = 0;
+ for(; n > 0; n--)
+ res += (*fp1++) * (*fp2++);
+ return res;
+}
+*/
+
+static float float_conv_enc(float const *fp1, float const *fp2)
+{
+ /* This is a specialzed version of float_conv() for encoding
+ * which simply assumes a CVSD_ENC_FILTERLEN (16) length of
+ * the two arrays and unrolls that loop.
+ *
+ * fp1 should be the enc.input_filter array and must be
+ * CVSD_ENC_FILTERLEN (16) long.
+ *
+ * fp2 should be one of the enc_filter_xx_y() tables listed
+ * in cvsdfilt.h. At minimum, fp2 must be CVSD_ENC_FILTERLEN
+ * (16) entries long.
+ */
+ float res = 0;
+
+ /* unrolling loop */
+ res += fp1[0] * fp2[0];
+ res += fp1[1] * fp2[1];
+ res += fp1[2] * fp2[2];
+ res += fp1[3] * fp2[3];
+ res += fp1[4] * fp2[4];
+ res += fp1[5] * fp2[5];
+ res += fp1[6] * fp2[6];
+ res += fp1[7] * fp2[7];
+ res += fp1[8] * fp2[8];
+ res += fp1[9] * fp2[9];
+ res += fp1[10] * fp2[10];
+ res += fp1[11] * fp2[11];
+ res += fp1[12] * fp2[12];
+ res += fp1[13] * fp2[13];
+ res += fp1[14] * fp2[14];
+ res += fp1[15] * fp2[15];
+
+ return res;
+}
+
+static float float_conv_dec(float const *fp1, float const *fp2)
+{
+ /* This is a specialzed version of float_conv() for decoding
+ * which assumes a specific length and structure to the data
+ * in fp2.
+ *
+ * fp1 should be the dec.output_filter array and must be
+ * CVSD_DEC_FILTERLEN (48) long.
+ *
+ * fp2 should be one of the dec_filter_xx() tables listed
+ * in cvsdfilt.h. fp2 is assumed to be CVSD_DEC_FILTERLEN
+ * (48) entries long, is assumed to have 0.0 in the last
+ * entry, and is a symmetrical mirror around fp2[23] (ie,
+ * fp2[22] == fp2[24], fp2[0] == fp2[47], etc).
+ */
+ float res = 0;
+
+ /* unrolling loop, also taking advantage of the symmetry
+ * of the sampling rate array*/
+ res += (fp1[0] + fp1[46]) * fp2[0];
+ res += (fp1[1] + fp1[45]) * fp2[1];
+ res += (fp1[2] + fp1[44]) * fp2[2];
+ res += (fp1[3] + fp1[43]) * fp2[3];
+ res += (fp1[4] + fp1[42]) * fp2[4];
+ res += (fp1[5] + fp1[41]) * fp2[5];
+ res += (fp1[6] + fp1[40]) * fp2[6];
+ res += (fp1[7] + fp1[39]) * fp2[7];
+ res += (fp1[8] + fp1[38]) * fp2[8];
+ res += (fp1[9] + fp1[37]) * fp2[9];
+ res += (fp1[10] + fp1[36]) * fp2[10];
+ res += (fp1[11] + fp1[35]) * fp2[11];
+ res += (fp1[12] + fp1[34]) * fp2[12];
+ res += (fp1[13] + fp1[33]) * fp2[13];
+ res += (fp1[14] + fp1[32]) * fp2[14];
+ res += (fp1[15] + fp1[31]) * fp2[15];
+ res += (fp1[16] + fp1[30]) * fp2[16];
+ res += (fp1[17] + fp1[29]) * fp2[17];
+ res += (fp1[18] + fp1[28]) * fp2[18];
+ res += (fp1[19] + fp1[27]) * fp2[19];
+ res += (fp1[20] + fp1[26]) * fp2[20];
+ res += (fp1[21] + fp1[25]) * fp2[21];
+ res += (fp1[22] + fp1[24]) * fp2[22];
+ res += (fp1[23]) * fp2[23];
+
+ return res;
+}
+
+/* ---------------------------------------------------------------------- */
+/*
+ * some remarks about the implementation of the CVSD decoder
+ * the principal integrator is integrated into the output filter
+ * to achieve this, the coefficients of the output filter are multiplied
+ * with (1/(1-1/z)) in the initialisation code.
+ * the output filter must have a sharp zero at f=0 (i.e. the sum of the
+ * filter parameters must be zero). This prevents an accumulation of
+ * DC voltage at the principal integration.
+ */
+/* ---------------------------------------------------------------------- */
+
+static void cvsdstartcommon(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+
+ p->cvsd_rate = (ft->signal.rate <= 24000) ? 16000 : 32000;
+ ft->signal.rate = 8000;
+ ft->signal.channels = 1;
+ lsx_rawstart(ft, sox_true, sox_false, sox_true, SOX_ENCODING_CVSD, 1);
+ /*
+ * initialize the decoder
+ */
+ p->com.overload = 0x5;
+ p->com.mla_int = 0;
+ /*
+ * timeconst = (1/e)^(200 / SR) = exp(-200/SR)
+ * SR is the sampling rate
+ */
+ p->com.mla_tc0 = exp((-200.0)/((float)(p->cvsd_rate)));
+ /*
+ * phase_inc = 32000 / SR
+ */
+ p->com.phase_inc = 32000 / p->cvsd_rate;
+ /*
+ * initialize bit shift register
+ */
+ p->bit.shreg = p->bit.cnt = 0;
+ p->bit.mask = 1;
+ /*
+ * count the bytes written
+ */
+ p->bytes_written = 0;
+ p->com.v_min = 1;
+ p->com.v_max = -1;
+ lsx_report("cvsd: bit rate %dbit/s, bits from %s", p->cvsd_rate,
+ ft->encoding.reverse_bits ? "msb to lsb" : "lsb to msb");
+}
+
+/* ---------------------------------------------------------------------- */
+
+int lsx_cvsdstartread(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ float *fp1;
+ int i;
+
+ cvsdstartcommon(ft);
+
+ p->com.mla_tc1 = 0.1 * (1 - p->com.mla_tc0);
+ p->com.phase = 0;
+ /*
+ * initialize the output filter coeffs (i.e. multiply
+ * the coeffs with (1/(1-1/z)) to achieve integration
+ * this is now done in the filter parameter generation utility
+ */
+ /*
+ * zero the filter
+ */
+ for(fp1 = p->c.dec.output_filter, i = CVSD_DEC_FILTERLEN*2; i > 0; i--)
+ *fp1++ = 0;
+ /* initialize mirror circular buffer offset to anything sane. */
+ p->c.dec.offset = CVSD_DEC_FILTERLEN - 1;
+
+ return (SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+int lsx_cvsdstartwrite(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ float *fp1;
+ int i;
+
+ cvsdstartcommon(ft);
+
+ p->com.mla_tc1 = 0.1 * (1 - p->com.mla_tc0);
+ p->com.phase = 4;
+ /*
+ * zero the filter
+ */
+ for(fp1 = p->c.enc.input_filter, i = CVSD_ENC_FILTERLEN*2; i > 0; i--)
+ *fp1++ = 0;
+ p->c.enc.recon_int = 0;
+ /* initialize mirror circular buffer offset to anything sane. */
+ p->c.enc.offset = CVSD_ENC_FILTERLEN - 1;
+
+ return(SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+int lsx_cvsdstopwrite(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+
+ if (p->bit.cnt) {
+ lsx_writeb(ft, p->bit.shreg);
+ p->bytes_written++;
+ }
+ lsx_debug("cvsd: min slope %f, max slope %f",
+ p->com.v_min, p->com.v_max);
+
+ return (SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+int lsx_cvsdstopread(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+
+ lsx_debug("cvsd: min value %f, max value %f",
+ p->com.v_min, p->com.v_max);
+
+ return(SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+size_t lsx_cvsdread(sox_format_t * ft, sox_sample_t *buf, size_t nsamp)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t done = 0;
+ float oval;
+
+ while (done < nsamp) {
+ if (!p->bit.cnt) {
+ if (lsx_read_b_buf(ft, &(p->bit.shreg), (size_t) 1) != 1)
+ return done;
+ p->bit.cnt = 8;
+ p->bit.mask = 1;
+ }
+ /*
+ * handle one bit
+ */
+ p->bit.cnt--;
+ p->com.overload = ((p->com.overload << 1) |
+ (!!(p->bit.shreg & p->bit.mask))) & 7;
+ p->bit.mask <<= 1;
+ p->com.mla_int *= p->com.mla_tc0;
+ if ((p->com.overload == 0) || (p->com.overload == 7))
+ p->com.mla_int += p->com.mla_tc1;
+
+ /* shift output filter window in mirror cirular buffer. */
+ if (p->c.dec.offset != 0)
+ --p->c.dec.offset;
+ else p->c.dec.offset = CVSD_DEC_FILTERLEN - 1;
+ /* write into both halves of the mirror circular buffer */
+ if (p->com.overload & 1)
+ {
+ p->c.dec.output_filter[p->c.dec.offset] = p->com.mla_int;
+ p->c.dec.output_filter[p->c.dec.offset + CVSD_DEC_FILTERLEN] = p->com.mla_int;
+ }
+ else
+ {
+ p->c.dec.output_filter[p->c.dec.offset] = -p->com.mla_int;
+ p->c.dec.output_filter[p->c.dec.offset + CVSD_DEC_FILTERLEN] = -p->com.mla_int;
+ }
+
+ /*
+ * check if the next output is due
+ */
+ p->com.phase += p->com.phase_inc;
+ if (p->com.phase >= 4) {
+ oval = float_conv_dec(
+ p->c.dec.output_filter + p->c.dec.offset,
+ (p->cvsd_rate < 24000) ?
+ dec_filter_16 : dec_filter_32);
+ lsx_debug_more("input %d %f\n", debug_count, p->com.mla_int);
+ lsx_debug_more("recon %d %f\n", debug_count, oval);
+ debug_count++;
+
+ if (oval > p->com.v_max)
+ p->com.v_max = oval;
+ if (oval < p->com.v_min)
+ p->com.v_min = oval;
+ *buf++ = (oval * ((float)SOX_SAMPLE_MAX));
+ done++;
+ }
+ p->com.phase &= 3;
+ }
+ return done;
+}
+
+/* ---------------------------------------------------------------------- */
+
+size_t lsx_cvsdwrite(sox_format_t * ft, const sox_sample_t *buf, size_t nsamp)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t done = 0;
+ float inval;
+
+ for(;;) {
+ /*
+ * check if the next input is due
+ */
+ if (p->com.phase >= 4) {
+ if (done >= nsamp)
+ return done;
+
+ /* shift input filter window in mirror cirular buffer. */
+ if (p->c.enc.offset != 0)
+ --p->c.enc.offset;
+ else p->c.enc.offset = CVSD_ENC_FILTERLEN - 1;
+
+ /* write into both halves of the mirror circular buffer */
+ p->c.enc.input_filter[p->c.enc.offset] =
+ p->c.enc.input_filter[p->c.enc.offset
+ + CVSD_ENC_FILTERLEN] =
+ (*buf++) /
+ ((float)SOX_SAMPLE_MAX);
+ done++;
+ }
+ p->com.phase &= 3;
+ /* insert input filter here! */
+ inval = float_conv_enc(
+ p->c.enc.input_filter + p->c.enc.offset,
+ (p->cvsd_rate < 24000) ?
+ (enc_filter_16[(p->com.phase >= 2)]) :
+ (enc_filter_32[p->com.phase]));
+ /*
+ * encode one bit
+ */
+ p->com.overload = (((p->com.overload << 1) |
+ (inval > p->c.enc.recon_int)) & 7);
+ p->com.mla_int *= p->com.mla_tc0;
+ if ((p->com.overload == 0) || (p->com.overload == 7))
+ p->com.mla_int += p->com.mla_tc1;
+ if (p->com.mla_int > p->com.v_max)
+ p->com.v_max = p->com.mla_int;
+ if (p->com.mla_int < p->com.v_min)
+ p->com.v_min = p->com.mla_int;
+ if (p->com.overload & 1) {
+ p->c.enc.recon_int += p->com.mla_int;
+ p->bit.shreg |= p->bit.mask;
+ } else
+ p->c.enc.recon_int -= p->com.mla_int;
+ if ((++(p->bit.cnt)) >= 8) {
+ lsx_writeb(ft, p->bit.shreg);
+ p->bytes_written++;
+ p->bit.shreg = p->bit.cnt = 0;
+ p->bit.mask = 1;
+ } else
+ p->bit.mask <<= 1;
+ p->com.phase += p->com.phase_inc;
+ lsx_debug_more("input %d %f\n", debug_count, inval);
+ lsx_debug_more("recon %d %f\n", debug_count, p->c.enc.recon_int);
+ debug_count++;
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+/*
+ * DVMS file header
+ */
+
+/* FIXME: eliminate these 4 functions */
+
+static uint32_t get32_le(unsigned char **p)
+{
+ uint32_t val = (((*p)[3]) << 24) | (((*p)[2]) << 16) |
+ (((*p)[1]) << 8) | (**p);
+ (*p) += 4;
+ return val;
+}
+
+static uint16_t get16_le(unsigned char **p)
+{
+ unsigned val = (((*p)[1]) << 8) | (**p);
+ (*p) += 2;
+ return val;
+}
+
+static void put32_le(unsigned char **p, uint32_t val)
+{
+ *(*p)++ = val & 0xff;
+ *(*p)++ = (val >> 8) & 0xff;
+ *(*p)++ = (val >> 16) & 0xff;
+ *(*p)++ = (val >> 24) & 0xff;
+}
+
+static void put16_le(unsigned char **p, unsigned val)
+{
+ *(*p)++ = val & 0xff;
+ *(*p)++ = (val >> 8) & 0xff;
+}
+
+struct dvms_header {
+ char Filename[14];
+ unsigned Id;
+ unsigned State;
+ time_t Unixtime;
+ unsigned Usender;
+ unsigned Ureceiver;
+ size_t Length;
+ unsigned Srate;
+ unsigned Days;
+ unsigned Custom1;
+ unsigned Custom2;
+ char Info[16];
+ char extend[64];
+ unsigned Crc;
+};
+
+#define DVMS_HEADER_LEN 120
+
+/* ---------------------------------------------------------------------- */
+
+static int dvms_read_header(sox_format_t * ft, struct dvms_header *hdr)
+{
+ unsigned char hdrbuf[DVMS_HEADER_LEN];
+ unsigned char *pch = hdrbuf;
+ int i;
+ unsigned sum;
+
+ if (lsx_readbuf(ft, hdrbuf, sizeof(hdrbuf)) != sizeof(hdrbuf))
+ {
+ return (SOX_EOF);
+ }
+ for(i = sizeof(hdrbuf), sum = 0; i > /*2*/3; i--) /* Deti bug */
+ sum += *pch++;
+ pch = hdrbuf;
+ memcpy(hdr->Filename, pch, sizeof(hdr->Filename));
+ pch += sizeof(hdr->Filename);
+ hdr->Id = get16_le(&pch);
+ hdr->State = get16_le(&pch);
+ hdr->Unixtime = get32_le(&pch);
+ hdr->Usender = get16_le(&pch);
+ hdr->Ureceiver = get16_le(&pch);
+ hdr->Length = get32_le(&pch);
+ hdr->Srate = get16_le(&pch);
+ hdr->Days = get16_le(&pch);
+ hdr->Custom1 = get16_le(&pch);
+ hdr->Custom2 = get16_le(&pch);
+ memcpy(hdr->Info, pch, sizeof(hdr->Info));
+ pch += sizeof(hdr->Info);
+ memcpy(hdr->extend, pch, sizeof(hdr->extend));
+ pch += sizeof(hdr->extend);
+ hdr->Crc = get16_le(&pch);
+ if (sum != hdr->Crc)
+ {
+ lsx_report("DVMS header checksum error, read %u, calculated %u",
+ hdr->Crc, sum);
+ return (SOX_EOF);
+ }
+ return (SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+/*
+ * note! file must be seekable
+ */
+static int dvms_write_header(sox_format_t * ft, struct dvms_header *hdr)
+{
+ unsigned char hdrbuf[DVMS_HEADER_LEN];
+ unsigned char *pch = hdrbuf;
+ unsigned char *pchs = hdrbuf;
+ int i;
+ unsigned sum;
+
+ memcpy(pch, hdr->Filename, sizeof(hdr->Filename));
+ pch += sizeof(hdr->Filename);
+ put16_le(&pch, hdr->Id);
+ put16_le(&pch, hdr->State);
+ put32_le(&pch, (unsigned)hdr->Unixtime);
+ put16_le(&pch, hdr->Usender);
+ put16_le(&pch, hdr->Ureceiver);
+ put32_le(&pch, (unsigned) hdr->Length);
+ put16_le(&pch, hdr->Srate);
+ put16_le(&pch, hdr->Days);
+ put16_le(&pch, hdr->Custom1);
+ put16_le(&pch, hdr->Custom2);
+ memcpy(pch, hdr->Info, sizeof(hdr->Info));
+ pch += sizeof(hdr->Info);
+ memcpy(pch, hdr->extend, sizeof(hdr->extend));
+ pch += sizeof(hdr->extend);
+ for(i = sizeof(hdrbuf), sum = 0; i > /*2*/3; i--) /* Deti bug */
+ sum += *pchs++;
+ hdr->Crc = sum;
+ put16_le(&pch, hdr->Crc);
+ if (lsx_seeki(ft, (off_t)0, SEEK_SET) < 0)
+ {
+ lsx_report("seek failed\n: %s",strerror(errno));
+ return (SOX_EOF);
+ }
+ if (lsx_writebuf(ft, hdrbuf, sizeof(hdrbuf)) != sizeof(hdrbuf))
+ {
+ lsx_report("%s",strerror(errno));
+ return (SOX_EOF);
+ }
+ return (SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void make_dvms_hdr(sox_format_t * ft, struct dvms_header *hdr)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t len;
+ char * comment = lsx_cat_comments(ft->oob.comments);
+
+ memset(hdr->Filename, 0, sizeof(hdr->Filename));
+ len = strlen(ft->filename);
+ if (len >= sizeof(hdr->Filename))
+ len = sizeof(hdr->Filename)-1;
+ memcpy(hdr->Filename, ft->filename, len);
+ hdr->Id = hdr->State = 0;
+ hdr->Unixtime = sox_globals.repeatable? 0 : time(NULL);
+ hdr->Usender = hdr->Ureceiver = 0;
+ hdr->Length = p->bytes_written;
+ hdr->Srate = p->cvsd_rate/100;
+ hdr->Days = hdr->Custom1 = hdr->Custom2 = 0;
+ memset(hdr->Info, 0, sizeof(hdr->Info));
+ len = strlen(comment);
+ if (len >= sizeof(hdr->Info))
+ len = sizeof(hdr->Info)-1;
+ memcpy(hdr->Info, comment, len);
+ memset(hdr->extend, 0, sizeof(hdr->extend));
+ free(comment);
+}
+
+/* ---------------------------------------------------------------------- */
+
+int lsx_dvmsstartread(sox_format_t * ft)
+{
+ struct dvms_header hdr;
+ int rc;
+
+ rc = dvms_read_header(ft, &hdr);
+ if (rc){
+ lsx_fail_errno(ft,SOX_EHDR,"unable to read DVMS header");
+ return rc;
+ }
+
+ lsx_debug("DVMS header of source file \"%s\":", ft->filename);
+ lsx_debug(" filename \"%.14s\"", hdr.Filename);
+ lsx_debug(" id 0x%x", hdr.Id);
+ lsx_debug(" state 0x%x", hdr.State);
+ lsx_debug(" time %s", ctime(&hdr.Unixtime)); /* ctime generates lf */
+ lsx_debug(" usender %u", hdr.Usender);
+ lsx_debug(" ureceiver %u", hdr.Ureceiver);
+ lsx_debug(" length %" PRIuPTR, hdr.Length);
+ lsx_debug(" srate %u", hdr.Srate);
+ lsx_debug(" days %u", hdr.Days);
+ lsx_debug(" custom1 %u", hdr.Custom1);
+ lsx_debug(" custom2 %u", hdr.Custom2);
+ lsx_debug(" info \"%.16s\"", hdr.Info);
+ ft->signal.rate = (hdr.Srate < 240) ? 16000 : 32000;
+ lsx_debug("DVMS rate %dbit/s using %gbit/s deviation %g%%",
+ hdr.Srate*100, ft->signal.rate,
+ ((ft->signal.rate - hdr.Srate*100) * 100) / ft->signal.rate);
+ rc = lsx_cvsdstartread(ft);
+ if (rc)
+ return rc;
+
+ return(SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+int lsx_dvmsstartwrite(sox_format_t * ft)
+{
+ struct dvms_header hdr;
+ int rc;
+
+ rc = lsx_cvsdstartwrite(ft);
+ if (rc)
+ return rc;
+
+ make_dvms_hdr(ft, &hdr);
+ rc = dvms_write_header(ft, &hdr);
+ if (rc){
+ lsx_fail_errno(ft,rc,"cannot write DVMS header");
+ return rc;
+ }
+
+ if (!ft->seekable)
+ lsx_warn("Length in output .DVMS header will wrong since can't seek to fix it");
+
+ return(SOX_SUCCESS);
+}
+
+/* ---------------------------------------------------------------------- */
+
+int lsx_dvmsstopwrite(sox_format_t * ft)
+{
+ struct dvms_header hdr;
+ int rc;
+
+ lsx_cvsdstopwrite(ft);
+ if (!ft->seekable)
+ {
+ lsx_warn("File not seekable");
+ return (SOX_EOF);
+ }
+ if (lsx_seeki(ft, (off_t)0, 0) != 0)
+ {
+ lsx_fail_errno(ft,errno,"Can't rewind output file to rewrite DVMS header.");
+ return(SOX_EOF);
+ }
+ make_dvms_hdr(ft, &hdr);
+ rc = dvms_write_header(ft, &hdr);
+ if(rc){
+ lsx_fail_errno(ft,rc,"cannot write DVMS header");
+ return rc;
+ }
+ return rc;
+}
diff --git a/src/src/cvsd.h b/src/src/cvsd.h
new file mode 100644
index 0000000..802cadb
--- /dev/null
+++ b/src/src/cvsd.h
@@ -0,0 +1,68 @@
+/* libSoX DVMS format module (implementation in cvsd.c)
+ *
+ * Copyright (C) 1996-2007 Thomas Sailer and SoX Contributors
+ * Thomas Sailer (sailer@ife.ee.ethz.ch) (HB9JNX/AE4WA)
+ * Swiss Federal Institute of Technology, Electronics Lab
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#include "third_party/sox/src/src/sox_i.h"
+
+#define CVSD_ENC_FILTERLEN 16 /* PCM sampling rate */
+#define CVSD_DEC_FILTERLEN 48 /* CVSD sampling rate */
+
+typedef struct {
+ struct {
+ unsigned overload;
+ float mla_int;
+ float mla_tc0;
+ float mla_tc1;
+ unsigned phase;
+ unsigned phase_inc;
+ float v_min, v_max;
+ } com;
+ union {
+ struct {
+ /* mirror circular buffer */
+ float output_filter[CVSD_DEC_FILTERLEN*2];
+ unsigned offset; /* into output_filter; always in first half */
+ } dec;
+ struct {
+ float recon_int;
+ /* mirror circular buffer */
+ float input_filter[CVSD_ENC_FILTERLEN*2];
+ unsigned offset; /* into input_filter; always in first half */
+ } enc;
+ } c;
+ struct {
+ unsigned char shreg;
+ unsigned mask;
+ unsigned cnt;
+ } bit;
+ unsigned bytes_written;
+ unsigned cvsd_rate;
+} cvsd_priv_t;
+
+int lsx_cvsdstartread(sox_format_t * ft);
+int lsx_cvsdstartwrite(sox_format_t * ft);
+size_t lsx_cvsdread(sox_format_t * ft, sox_sample_t *buf, size_t nsamp);
+size_t lsx_cvsdwrite(sox_format_t * ft, const sox_sample_t *buf, size_t nsamp);
+int lsx_cvsdstopread(sox_format_t * ft);
+int lsx_cvsdstopwrite(sox_format_t * ft);
+
+int lsx_dvmsstartread(sox_format_t * ft);
+int lsx_dvmsstartwrite(sox_format_t * ft);
+int lsx_dvmsstopwrite(sox_format_t * ft);
diff --git a/src/src/cvsdfilt.h b/src/src/cvsdfilt.h
new file mode 100644
index 0000000..c03f841
--- /dev/null
+++ b/src/src/cvsdfilt.h
@@ -0,0 +1,112 @@
+/* libSoX CVSD (Continuously Variable Slope Delta modulation)
+ * conversion routines
+ *
+ * The CVSD format is described in the MIL Std 188 113, which is
+ * available from http://bbs.itsi.disa.mil:5580/T3564
+ *
+ * Copyright (C) 1996
+ * Thomas Sailer (sailer@ife.ee.ethz.ch) (HB9JNX/AE4WA)
+ * Swiss Federal Institute of Technology, Electronics Lab
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static const float dec_filter_16[48] = {
+ 0.001102, 0.001159, 0.000187, -0.000175,
+ 0.002097, 0.006543, 0.009384, 0.008004,
+ 0.006562, 0.013569, 0.030745, 0.047053,
+ 0.050491, 0.047388, 0.062171, 0.109115,
+ 0.167120, 0.197144, 0.195471, 0.222098,
+ 0.354745, 0.599184, 0.849632, 0.956536,
+ 0.849632, 0.599184, 0.354745, 0.222098,
+ 0.195471, 0.197144, 0.167120, 0.109115,
+ 0.062171, 0.047388, 0.050491, 0.047053,
+ 0.030745, 0.013569, 0.006562, 0.008004,
+ 0.009384, 0.006543, 0.002097, -0.000175,
+ 0.000187, 0.001159, 0.001102, 0.000000
+};
+
+/* ---------------------------------------------------------------------- */
+
+static const float dec_filter_32[48] = {
+ 0.001950, 0.004180, 0.006331, 0.007907,
+ 0.008510, 0.008342, 0.008678, 0.011827,
+ 0.020282, 0.035231, 0.055200, 0.075849,
+ 0.091585, 0.098745, 0.099031, 0.101287,
+ 0.120058, 0.170672, 0.262333, 0.392047,
+ 0.542347, 0.684488, 0.786557, 0.823702,
+ 0.786557, 0.684488, 0.542347, 0.392047,
+ 0.262333, 0.170672, 0.120058, 0.101287,
+ 0.099031, 0.098745, 0.091585, 0.075849,
+ 0.055200, 0.035231, 0.020282, 0.011827,
+ 0.008678, 0.008342, 0.008510, 0.007907,
+ 0.006331, 0.004180, 0.001950, -0.000000
+};
+
+/* ---------------------------------------------------------------------- */
+
+static const float enc_filter_16_0[16] = {
+ -0.000362, 0.004648, 0.001381, 0.008312,
+ 0.041490, -0.001410, 0.124061, 0.247446,
+ -0.106761, -0.236326, -0.023798, -0.023506,
+ -0.030097, 0.001493, -0.005363, -0.001672
+};
+
+static const float enc_filter_16_1[16] = {
+ 0.001672, 0.005363, -0.001493, 0.030097,
+ 0.023506, 0.023798, 0.236326, 0.106761,
+ -0.247446, -0.124061, 0.001410, -0.041490,
+ -0.008312, -0.001381, -0.004648, 0.000362
+};
+
+static const float *enc_filter_16[2] = {
+ enc_filter_16_0, enc_filter_16_1
+};
+
+/* ---------------------------------------------------------------------- */
+
+static const float enc_filter_32_0[16] = {
+ -0.000289, 0.002112, 0.001421, 0.002235,
+ 0.021003, 0.001237, 0.047132, 0.129636,
+ -0.027328, -0.126462, -0.021456, -0.008069,
+ -0.017959, 0.000301, -0.002538, -0.001278
+};
+
+static const float enc_filter_32_1[16] = {
+ -0.000010, 0.002787, 0.000055, 0.006813,
+ 0.020249, -0.000995, 0.077912, 0.112870,
+ -0.076980, -0.106971, -0.005096, -0.015449,
+ -0.012591, 0.000813, -0.003003, -0.000527
+};
+
+static const float enc_filter_32_2[16] = {
+ 0.000527, 0.003003, -0.000813, 0.012591,
+ 0.015449, 0.005096, 0.106971, 0.076980,
+ -0.112870, -0.077912, 0.000995, -0.020249,
+ -0.006813, -0.000055, -0.002787, 0.000010
+};
+
+static const float enc_filter_32_3[16] = {
+ 0.001278, 0.002538, -0.000301, 0.017959,
+ 0.008069, 0.021456, 0.126462, 0.027328,
+ -0.129636, -0.047132, -0.001237, -0.021003,
+ -0.002235, -0.001421, -0.002112, 0.000289
+};
+
+static const float *enc_filter_32[4] = {
+ enc_filter_32_0, enc_filter_32_1, enc_filter_32_2, enc_filter_32_3
+};
+
+/* ---------------------------------------------------------------------- */
diff --git a/src/src/dat.c b/src/src/dat.c
new file mode 100644
index 0000000..0716dc7
--- /dev/null
+++ b/src/src/dat.c
@@ -0,0 +1,162 @@
+/* libSoX text format file. Tom Littlejohn, March 93.
+ *
+ * Reads/writes sound files as text.
+ *
+ * Copyright 1998-2006 Chris Bagwell and SoX Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+#define LINEWIDTH (size_t)256
+
+/* Private data for dat file */
+typedef struct {
+ double timevalue, deltat;
+ int buffered;
+ char prevline[LINEWIDTH];
+} priv_t;
+
+static int sox_datstartread(sox_format_t * ft)
+{
+ char inpstr[LINEWIDTH];
+ long rate;
+ int chan;
+ int status;
+ char sc;
+
+ /* Read lines until EOF or first non-comment line */
+ while ((status = lsx_reads(ft, inpstr, LINEWIDTH-1)) != SOX_EOF) {
+ inpstr[LINEWIDTH-1] = 0;
+ if ((sscanf(inpstr," %c", &sc) != 0) && (sc != ';')) break;
+ if (sscanf(inpstr," ; Sample Rate %ld", &rate)) {
+ ft->signal.rate=rate;
+ } else if (sscanf(inpstr," ; Channels %d", &chan)) {
+ ft->signal.channels=chan;
+ }
+ }
+ /* Hold a copy of the last line we read (first non-comment) */
+ if (status != SOX_EOF) {
+ strncpy(((priv_t *)ft->priv)->prevline, inpstr, (size_t)LINEWIDTH);
+ ((priv_t *)ft->priv)->buffered = 1;
+ } else {
+ ((priv_t *)ft->priv)->buffered = 0;
+ }
+
+ /* Default channels to 1 if not found */
+ if (ft->signal.channels == 0)
+ ft->signal.channels = 1;
+
+ ft->encoding.encoding = SOX_ENCODING_FLOAT_TEXT;
+
+ return (SOX_SUCCESS);
+}
+
+static int sox_datstartwrite(sox_format_t * ft)
+{
+ priv_t * dat = (priv_t *) ft->priv;
+ char s[LINEWIDTH];
+
+ dat->timevalue = 0.0;
+ dat->deltat = 1.0 / (double)ft->signal.rate;
+ /* Write format comments to start of file */
+ sprintf(s,"; Sample Rate %ld\015\n", (long)ft->signal.rate);
+ lsx_writes(ft, s);
+ sprintf(s,"; Channels %d\015\n", (int)ft->signal.channels);
+ lsx_writes(ft, s);
+
+ return (SOX_SUCCESS);
+}
+
+static size_t sox_datread(sox_format_t * ft, sox_sample_t *buf, size_t nsamp)
+{
+ char inpstr[LINEWIDTH];
+ int inpPtr = 0;
+ int inpPtrInc = 0;
+ double sampval = 0.0;
+ int retc = 0;
+ char sc = 0;
+ size_t done = 0;
+ size_t i=0;
+
+ /* Always read a complete set of channels */
+ nsamp -= (nsamp % ft->signal.channels);
+
+ while (done < nsamp) {
+
+ /* Read a line or grab the buffered first line */
+ if (((priv_t *)ft->priv)->buffered) {
+ strncpy(inpstr, ((priv_t *)ft->priv)->prevline, (size_t)LINEWIDTH);
+ inpstr[LINEWIDTH-1] = 0;
+ ((priv_t *)ft->priv)->buffered=0;
+ } else {
+ lsx_reads(ft, inpstr, LINEWIDTH-1);
+ inpstr[LINEWIDTH-1] = 0;
+ if (lsx_eof(ft)) return (done);
+ }
+
+ /* Skip over comments - ie. 0 or more whitespace, then ';' */
+ if ((sscanf(inpstr," %c", &sc) != 0) && (sc==';')) continue;
+
+ /* Read a complete set of channels */
+ sscanf(inpstr," %*s%n", &inpPtr);
+ for (i=0; i<ft->signal.channels; i++) {
+ SOX_SAMPLE_LOCALS;
+ retc = sscanf(&inpstr[inpPtr]," %lg%n", &sampval, &inpPtrInc);
+ inpPtr += inpPtrInc;
+ if (retc != 1) {
+ lsx_fail_errno(ft,SOX_EOF,"Unable to read sample.");
+ return 0;
+ }
+ *buf++ = SOX_FLOAT_64BIT_TO_SAMPLE(sampval, ft->clips);
+ done++;
+ }
+ }
+
+ return (done);
+}
+
+static size_t sox_datwrite(sox_format_t * ft, const sox_sample_t *buf, size_t nsamp)
+{
+ priv_t * dat = (priv_t *) ft->priv;
+ size_t done = 0;
+ double sampval=0.0;
+ char s[LINEWIDTH];
+ size_t i=0;
+
+ /* Always write a complete set of channels */
+ nsamp -= (nsamp % ft->signal.channels);
+
+ /* Write time, then sample values, then CRLF newline */
+ while(done < nsamp) {
+ sprintf(s," %15.8g ",dat->timevalue);
+ lsx_writes(ft, s);
+ for (i=0; i<ft->signal.channels; i++) {
+ sampval = SOX_SAMPLE_TO_FLOAT_64BIT(*buf++, ft->clips);
+ sprintf(s," %15.11g", sampval);
+ lsx_writes(ft, s);
+ done++;
+ }
+ sprintf(s," \r\n");
+ lsx_writes(ft, s);
+ dat->timevalue += dat->deltat;
+ }
+ return done;
+}
+
+LSX_FORMAT_HANDLER(dat)
+{
+ static char const * const names[] = {"dat", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_FLOAT_TEXT, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Textual representation of the sampled audio", names, 0,
+ sox_datstartread, sox_datread, NULL,
+ sox_datstartwrite, sox_datwrite, NULL,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/dcshift.c b/src/src/dcshift.c
new file mode 100644
index 0000000..0f1cde5
--- /dev/null
+++ b/src/src/dcshift.c
@@ -0,0 +1,165 @@
+/* libSoX dcshift.c
+ * (c) 2000.04.15 Chris Ausbrooks <weed@bucket.pp.ualr.edu>
+ *
+ * based on vol.c which is
+ * (c) 20/03/2000 Fabien COELHO <fabien@coelho.net> for sox.
+ *
+ * DC shift a sound file, with basic linear amplitude formula.
+ * Beware of saturations! clipping is checked and reported.
+ * Cannot handle different number of channels.
+ * Cannot handle rate change.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {
+ double dcshift; /* DC shift. */
+ int uselimiter; /* boolean: are we using the limiter? */
+ double limiterthreshhold;
+ double limitergain; /* limiter gain. */
+ uint64_t limited; /* number of limited values to report. */
+ uint64_t totalprocessed;
+} priv_t;
+
+/*
+ * Process options: dcshift (double) type (amplitude, power, dB)
+ */
+static int sox_dcshift_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * dcs = (priv_t *) effp->priv;
+ dcs->dcshift = 1.0; /* default is no change */
+ dcs->uselimiter = 0; /* default is no limiter */
+
+ --argc, ++argv;
+ if (argc < 1)
+ return lsx_usage(effp);
+
+ if (argc && (!sscanf(argv[0], "%lf", &dcs->dcshift)))
+ return lsx_usage(effp);
+
+ if (argc>1)
+ {
+ if (!sscanf(argv[1], "%lf", &dcs->limitergain))
+ return lsx_usage(effp);
+
+ dcs->uselimiter = 1; /* ok, we'll use it */
+ /* The following equation is derived so that there is no
+ * discontinuity in output amplitudes */
+ /* and a SOX_SAMPLE_MAX input always maps to a SOX_SAMPLE_MAX output
+ * when the limiter is activated. */
+ /* (NOTE: There **WILL** be a discontinuity in the slope of the
+ * output amplitudes when using the limiter.) */
+ dcs->limiterthreshhold = SOX_SAMPLE_MAX * (1.0 - (fabs(dcs->dcshift) - dcs->limitergain));
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Start processing
+ */
+static int sox_dcshift_start(sox_effect_t * effp)
+{
+ priv_t * dcs = (priv_t *) effp->priv;
+
+ if (dcs->dcshift == 0)
+ return SOX_EFF_NULL;
+
+ dcs->limited = 0;
+ dcs->totalprocessed = 0;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Process data.
+ */
+static int sox_dcshift_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * dcs = (priv_t *) effp->priv;
+ double dcshift = dcs->dcshift;
+ double limitergain = dcs->limitergain;
+ double limiterthreshhold = dcs->limiterthreshhold;
+ double sample;
+ size_t len;
+
+ len = min(*osamp, *isamp);
+
+ /* report back dealt with amount. */
+ *isamp = len; *osamp = len;
+
+ if (dcs->uselimiter)
+ {
+ dcs->totalprocessed += len;
+
+ for (;len>0; len--)
+ {
+ sample = *ibuf++;
+
+ if (sample > limiterthreshhold && dcshift > 0)
+ {
+ sample = (sample - limiterthreshhold) * limitergain / (SOX_SAMPLE_MAX - limiterthreshhold) + limiterthreshhold + dcshift;
+ dcs->limited++;
+ }
+ else if (sample < -limiterthreshhold && dcshift < 0)
+ {
+ /* Note this should really be SOX_SAMPLE_MIN but
+ * the clip() below will take care of the overflow.
+ */
+ sample = (sample + limiterthreshhold) * limitergain / (SOX_SAMPLE_MAX - limiterthreshhold) - limiterthreshhold + dcshift;
+ dcs->limited++;
+ }
+ else
+ {
+ /* Note this should consider SOX_SAMPLE_MIN but
+ * the clip() below will take care of the overflow.
+ */
+ sample = dcshift * SOX_SAMPLE_MAX + sample;
+ }
+
+ SOX_SAMPLE_CLIP_COUNT(sample, effp->clips);
+ *obuf++ = sample;
+ }
+ }
+ else for (; len > 0; --len) { /* quite basic, with clipping */
+ double d = dcshift * (SOX_SAMPLE_MAX + 1.) + *ibuf++;
+ *obuf++ = SOX_ROUND_CLIP_COUNT(d, effp->clips);
+ }
+ return SOX_SUCCESS;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * Don't close input file!
+ */
+static int sox_dcshift_stop(sox_effect_t * effp)
+{
+ priv_t * dcs = (priv_t *) effp->priv;
+
+ if (dcs->limited)
+ {
+ lsx_warn("DCSHIFT limited %" PRIu64 " values (%d percent).",
+ dcs->limited, (int) (dcs->limited * 100.0 / dcs->totalprocessed));
+ }
+ return SOX_SUCCESS;
+}
+
+static sox_effect_handler_t sox_dcshift_effect = {
+ "dcshift",
+ "shift [ limitergain ]\n"
+ "\tThe peak limiter has a gain much less than 1.0 (ie 0.05 or 0.02) which\n"
+ "\tis only used on peaks to prevent clipping. (default is no limiter)",
+ SOX_EFF_MCHAN | SOX_EFF_GAIN,
+ sox_dcshift_getopts,
+ sox_dcshift_start,
+ sox_dcshift_flow,
+ NULL,
+ sox_dcshift_stop,
+ NULL, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_dcshift_effect_fn(void)
+{
+ return &sox_dcshift_effect;
+}
diff --git a/src/src/delay.c b/src/src/delay.c
new file mode 100644
index 0000000..691b5e9
--- /dev/null
+++ b/src/src/delay.c
@@ -0,0 +1,163 @@
+/* libSoX effect: Delay one or more channels (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef struct {
+ size_t argc;
+ struct { char *str; uint64_t delay; } *args;
+ uint64_t *max_delay;
+ uint64_t delay, pre_pad, pad;
+ size_t buffer_size, buffer_index;
+ sox_sample_t * buffer;
+ sox_bool drain_started;
+} priv_t;
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+
+ for (i = 0; i < p->argc; ++i)
+ free(p->args[i].str);
+ free(p->args);
+ free(p->max_delay);
+ return SOX_SUCCESS;
+}
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+
+ --argc, ++argv;
+ p->argc = argc;
+ p->args = lsx_calloc(p->argc, sizeof(*p->args));
+ p->max_delay = lsx_malloc(sizeof(*p->max_delay));
+ for (i = 0; i < p->argc; ++i) {
+ char const * next = lsx_parseposition(0., p->args[i].str = lsx_strdup(argv[i]), NULL, (uint64_t)0, (uint64_t)0, '=');
+ if (!next || *next) {
+ lsx_kill(effp);
+ return lsx_usage(effp);
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ free(p->buffer);
+ return SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ uint64_t max_delay = 0, last_seen = 0, delay;
+ uint64_t in_length = effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN;
+
+ if (effp->flow == 0) {
+ unsigned i;
+ if (p->argc > effp->in_signal.channels) {
+ lsx_fail("too few input channels");
+ return SOX_EOF;
+ }
+ for (i = 0; i < p->argc; ++i) {
+ if (!lsx_parseposition(effp->in_signal.rate, p->args[i].str, &delay, last_seen, in_length, '=') || delay == SOX_UNKNOWN_LEN) {
+ lsx_fail("Position relative to end of audio specified, but audio length is unknown");
+ return SOX_EOF;
+ }
+ p->args[i].delay = last_seen = delay;
+ if (delay > max_delay) {
+ max_delay = delay;
+ }
+ }
+ *p->max_delay = max_delay;
+ if (max_delay == 0)
+ return SOX_EFF_NULL;
+ effp->out_signal.length = effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length + max_delay * effp->in_signal.channels :
+ SOX_UNKNOWN_LEN;
+ lsx_debug("extending audio by %" PRIu64 " samples", max_delay);
+ }
+
+ max_delay = *p->max_delay;
+ if (effp->flow < p->argc)
+ p->buffer_size = p->args[effp->flow].delay;
+ p->buffer_index = p->delay = p->pre_pad = 0;
+ p->pad = max_delay - p->buffer_size;
+ p->buffer = lsx_malloc(p->buffer_size * sizeof(*p->buffer));
+ p->drain_started = sox_false;
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = *isamp = *osamp = min(*isamp, *osamp);
+
+ if (!p->buffer_size)
+ memcpy(obuf, ibuf, len * sizeof(*obuf));
+ else for (; len; --len) {
+ if (p->delay < p->buffer_size) {
+ p->buffer[p->delay++] = *ibuf++;
+ *obuf++ = 0;
+ } else {
+ *obuf++ = p->buffer[p->buffer_index];
+ p->buffer[p->buffer_index++] = *ibuf++;
+ p->buffer_index %= p->buffer_size;
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len;
+ if (! p->drain_started) {
+ p->drain_started = sox_true;
+ p->pre_pad = p->buffer_size - p->delay;
+ /* If the input was too short to fill the buffer completely,
+ flow() has not yet output enough silence to reach the
+ desired delay. */
+ }
+ len = *osamp = min(p->pre_pad + p->delay + p->pad, *osamp);
+
+ for (; p->pre_pad && len; --p->pre_pad, --len)
+ *obuf++ = 0;
+ for (; p->delay && len; --p->delay, --len) {
+ *obuf++ = p->buffer[p->buffer_index++];
+ p->buffer_index %= p->buffer_size;
+ }
+ for (; p->pad && len; --p->pad, --len)
+ *obuf++ = 0;
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_delay_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "delay", "{position}", SOX_EFF_LENGTH | SOX_EFF_MODIFY,
+ create, start, flow, drain, stop, lsx_kill, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/dft_filter.c b/src/src/dft_filter.c
new file mode 100644
index 0000000..cb5bb61
--- /dev/null
+++ b/src/src/dft_filter.c
@@ -0,0 +1,137 @@
+/* Abstract effect: dft filter Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/fft4g.h"
+#include "third_party/sox/src/src/dft_filter.h"
+#include <string.h>
+
+typedef dft_filter_t filter_t;
+typedef dft_filter_priv_t priv_t;
+
+void lsx_set_dft_filter(dft_filter_t *f, double *h, int n, int post_peak)
+{
+ int i;
+ f->num_taps = n;
+ f->post_peak = post_peak;
+ f->dft_length = lsx_set_dft_length(f->num_taps);
+ f->coefs = lsx_calloc(f->dft_length, sizeof(*f->coefs));
+ for (i = 0; i < f->num_taps; ++i)
+ f->coefs[(i + f->dft_length - f->num_taps + 1) & (f->dft_length - 1)] = h[i] / f->dft_length * 2;
+ lsx_safe_rdft(f->dft_length, 1, f->coefs);
+ free(h);
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+
+ fifo_create(&p->input_fifo, (int)sizeof(double));
+ memset(fifo_reserve(&p->input_fifo,
+ p->filter_ptr->post_peak), 0, sizeof(double) * p->filter_ptr->post_peak);
+ fifo_create(&p->output_fifo, (int)sizeof(double));
+ return SOX_SUCCESS;
+}
+
+static void filter(priv_t * p)
+{
+ int i, num_in = max(0, fifo_occupancy(&p->input_fifo));
+ filter_t const * f = p->filter_ptr;
+ int const overlap = f->num_taps - 1;
+ double * output;
+
+ while (num_in >= f->dft_length) {
+ double const * input = fifo_read_ptr(&p->input_fifo);
+ fifo_read(&p->input_fifo, f->dft_length - overlap, NULL);
+ num_in -= f->dft_length - overlap;
+
+ output = fifo_reserve(&p->output_fifo, f->dft_length);
+ fifo_trim_by(&p->output_fifo, overlap);
+ memcpy(output, input, f->dft_length * sizeof(*output));
+
+ lsx_safe_rdft(f->dft_length, 1, output);
+ output[0] *= f->coefs[0];
+ output[1] *= f->coefs[1];
+ for (i = 2; i < f->dft_length; i += 2) {
+ double tmp = output[i];
+ output[i ] = f->coefs[i ] * tmp - f->coefs[i+1] * output[i+1];
+ output[i+1] = f->coefs[i+1] * tmp + f->coefs[i ] * output[i+1];
+ }
+ lsx_safe_rdft(f->dft_length, -1, output);
+ }
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t odone = min(*osamp, (size_t)fifo_occupancy(&p->output_fifo));
+
+ double const * s = fifo_read(&p->output_fifo, (int)odone, NULL);
+ lsx_save_samples(obuf, s, odone, &effp->clips);
+ p->samples_out += odone;
+
+ if (*isamp && odone < *osamp) {
+ double * t = fifo_write(&p->input_fifo, (int)*isamp, NULL);
+ p->samples_in += *isamp;
+ lsx_load_samples(t, ibuf, *isamp);
+ filter(p);
+ }
+ else *isamp = 0;
+ *osamp = odone;
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ static size_t isamp = 0;
+ size_t remaining = p->samples_in > p->samples_out ?
+ (size_t)(p->samples_in - p->samples_out) : 0;
+ double * buff = lsx_calloc(1024, sizeof(*buff));
+
+ if (remaining > 0) {
+ while ((size_t)fifo_occupancy(&p->output_fifo) < remaining) {
+ fifo_write(&p->input_fifo, 1024, buff);
+ p->samples_in += 1024;
+ filter(p);
+ }
+ fifo_trim_to(&p->output_fifo, (int)remaining);
+ p->samples_in = 0;
+ }
+ free(buff);
+ return flow(effp, 0, obuf, &isamp, osamp);
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+
+ fifo_delete(&p->input_fifo);
+ fifo_delete(&p->output_fifo);
+ free(p->filter_ptr->coefs);
+ memset(p->filter_ptr, 0, sizeof(*p->filter_ptr));
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_dft_filter_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ NULL, NULL, SOX_EFF_GAIN, NULL, start, flow, drain, stop, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/dft_filter.h b/src/src/dft_filter.h
new file mode 100644
index 0000000..62d489d
--- /dev/null
+++ b/src/src/dft_filter.h
@@ -0,0 +1,16 @@
+#include "third_party/sox/src/src/fft4g.h"
+#define FIFO_SIZE_T int
+#include "third_party/sox/src/src/fifo.h"
+
+typedef struct {
+ int dft_length, num_taps, post_peak;
+ double * coefs;
+} dft_filter_t;
+
+typedef struct {
+ uint64_t samples_in, samples_out;
+ fifo_t input_fifo, output_fifo;
+ dft_filter_t filter, * filter_ptr;
+} dft_filter_priv_t;
+
+void lsx_set_dft_filter(dft_filter_t * f, double * h, int n, int post_peak);
diff --git a/src/src/dither.c b/src/src/dither.c
new file mode 100644
index 0000000..2fd08a5
--- /dev/null
+++ b/src/src/dither.c
@@ -0,0 +1,436 @@
+/* Effect: dither/noise-shape Copyright (c) 2008-9 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef NDEBUG /* Enable assert always. */
+#undef NDEBUG /* Must undef above assert.h or other that might include it. */
+#endif
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <assert.h>
+
+#undef RANQD1
+#define RANQD1 ranqd1(p->ranqd1)
+
+typedef enum { /* Collection of various filters from the net */
+ Shape_none, Shape_lipshitz, Shape_f_weighted, Shape_modified_e_weighted,
+ Shape_improved_e_weighted, Shape_gesemann, Shape_shibata, Shape_low_shibata, Shape_high_shibata
+} filter_name_t;
+static lsx_enum_item const filter_names[] = {
+ LSX_ENUM_ITEM(Shape_,none)
+ LSX_ENUM_ITEM(Shape_,lipshitz)
+ {"f-weighted", Shape_f_weighted},
+ {"modified-e-weighted", Shape_modified_e_weighted},
+ {"improved-e-weighted", Shape_improved_e_weighted},
+ LSX_ENUM_ITEM(Shape_,gesemann)
+ LSX_ENUM_ITEM(Shape_,shibata)
+ {"low-shibata", Shape_low_shibata},
+ {"high-shibata", Shape_high_shibata},
+ {0, 0}};
+
+typedef struct {
+ sox_rate_t rate;
+ enum {fir, iir} type;
+ size_t len;
+ int gain_cB; /* Chosen so clips are few if any, but not guaranteed none. */
+ double const * coefs;
+ filter_name_t name;
+} filter_t;
+
+static double const lip44[] = {2.033, -2.165, 1.959, -1.590, .6149};
+static double const fwe44[] = {
+ 2.412, -3.370, 3.937, -4.174, 3.353, -2.205, 1.281, -.569, .0847};
+static double const mew44[] = {
+ 1.662, -1.263, .4827, -.2913, .1268, -.1124, .03252, -.01265, -.03524};
+static double const iew44[] = {
+ 2.847, -4.685, 6.214, -7.184, 6.639, -5.032, 3.263, -1.632, .4191};
+static double const ges44[] = {
+ 2.2061, -.4706, -.2534, -.6214, 1.0587, .0676, -.6054, -.2738};
+static double const ges48[] = {
+ 2.2374, -.7339, -.1251, -.6033, .903, .0116, -.5853, -.2571};
+
+static double const shi48[] = {
+ 2.8720729351043701172, -5.0413231849670410156, 6.2442994117736816406,
+ -5.8483986854553222656, 3.7067542076110839844, -1.0495119094848632812,
+ -1.1830236911773681641, 2.1126792430877685547, -1.9094531536102294922,
+ 0.99913084506988525391, -0.17090806365013122559, -0.32615602016448974609,
+ 0.39127644896507263184, -0.26876461505889892578, 0.097676105797290802002,
+ -0.023473845794796943665,
+};
+static double const shi44[] = {
+ 2.6773197650909423828, -4.8308925628662109375, 6.570110321044921875,
+ -7.4572014808654785156, 6.7263274192810058594, -4.8481650352478027344,
+ 2.0412089824676513672, 0.7006359100341796875, -2.9537565708160400391,
+ 4.0800385475158691406, -4.1845216751098632812, 3.3311812877655029297,
+ -2.1179926395416259766, 0.879302978515625, -0.031759146600961685181,
+ -0.42382788658142089844, 0.47882103919982910156, -0.35490813851356506348,
+ 0.17496839165687561035, -0.060908168554306030273,
+};
+static double const shi38[] = {
+ 1.6335992813110351562, -2.2615492343902587891, 2.4077029228210449219,
+ -2.6341717243194580078, 2.1440362930297851562, -1.8153258562088012695,
+ 1.0816224813461303711, -0.70302653312683105469, 0.15991993248462677002,
+ 0.041549518704414367676, -0.29416576027870178223, 0.2518316805362701416,
+ -0.27766478061676025391, 0.15785403549671173096, -0.10165894031524658203,
+ 0.016833892092108726501,
+};
+static double const shi32[] =
+{ /* dmaker 32000: bestmax=4.99659 (inverted) */
+0.82118552923202515,
+-1.0063692331314087,
+0.62341964244842529,
+-1.0447187423706055,
+0.64532512426376343,
+-0.87615132331848145,
+0.52219754457473755,
+-0.67434263229370117,
+0.44954317808151245,
+-0.52557498216629028,
+0.34567299485206604,
+-0.39618203043937683,
+0.26791760325431824,
+-0.28936097025871277,
+0.1883765310049057,
+-0.19097308814525604,
+0.10431359708309174,
+-0.10633844882249832,
+0.046832218766212463,
+-0.039653312414884567,
+};
+static double const shi22[] =
+{ /* dmaker 22050: bestmax=5.77762 (inverted) */
+0.056581053882837296,
+-0.56956905126571655,
+-0.40727734565734863,
+-0.33870288729667664,
+-0.29810553789138794,
+-0.19039161503314972,
+-0.16510021686553955,
+-0.13468159735202789,
+-0.096633769571781158,
+-0.081049129366874695,
+-0.064953058958053589,
+-0.054459091275930405,
+-0.043378707021474838,
+-0.03660014271736145,
+-0.026256965473294258,
+-0.018786206841468811,
+-0.013387725688517094,
+-0.0090983230620622635,
+-0.0026585909072309732,
+-0.00042083300650119781,
+};
+static double const shi16[] =
+{ /* dmaker 16000: bestmax=5.97128 (inverted) */
+-0.37251132726669312,
+-0.81423574686050415,
+-0.55010956525802612,
+-0.47405767440795898,
+-0.32624706625938416,
+-0.3161766529083252,
+-0.2286367267370224,
+-0.22916607558727264,
+-0.19565616548061371,
+-0.18160104751586914,
+-0.15423151850700378,
+-0.14104481041431427,
+-0.11844276636838913,
+-0.097583092749118805,
+-0.076493598520755768,
+-0.068106919527053833,
+-0.041881654411554337,
+-0.036922425031661987,
+-0.019364040344953537,
+-0.014994367957115173,
+};
+static double const shi11[] =
+{ /* dmaker 11025: bestmax=5.9406 (inverted) */
+-0.9264228343963623,
+-0.98695987462997437,
+-0.631156325340271,
+-0.51966935396194458,
+-0.39738872647285461,
+-0.35679301619529724,
+-0.29720726609230042,
+-0.26310476660728455,
+-0.21719355881214142,
+-0.18561814725399017,
+-0.15404847264289856,
+-0.12687471508979797,
+-0.10339745879173279,
+-0.083688631653785706,
+-0.05875682458281517,
+-0.046893671154975891,
+-0.027950936928391457,
+-0.020740609616041183,
+-0.009366452693939209,
+-0.0060260160826146603,
+};
+static double const shi08[] =
+{ /* dmaker 8000: bestmax=5.56234 (inverted) */
+-1.202863335609436,
+-0.94103097915649414,
+-0.67878556251525879,
+-0.57650017738342285,
+-0.50004476308822632,
+-0.44349345564842224,
+-0.37833768129348755,
+-0.34028723835945129,
+-0.29413089156150818,
+-0.24994957447052002,
+-0.21715600788593292,
+-0.18792112171649933,
+-0.15268312394618988,
+-0.12135542929172516,
+-0.099610626697540283,
+-0.075273610651493073,
+-0.048787496984004974,
+-0.042586319148540497,
+-0.028991291299462318,
+-0.011869125068187714,
+};
+static double const shl48[] = {
+ 2.3925774097442626953, -3.4350297451019287109, 3.1853709220886230469,
+ -1.8117271661758422852, -0.20124770700931549072, 1.4759907722473144531,
+ -1.7210904359817504883, 0.97746700048446655273, -0.13790138065814971924,
+ -0.38185903429985046387, 0.27421241998672485352, 0.066584214568138122559,
+ -0.35223302245140075684, 0.37672343850135803223, -0.23964276909828186035,
+ 0.068674825131893157959,
+};
+static double const shl44[] = {
+ 2.0833916664123535156, -3.0418450832366943359, 3.2047898769378662109,
+ -2.7571926116943359375, 1.4978630542755126953, -0.3427594602108001709,
+ -0.71733748912811279297, 1.0737057924270629883, -1.0225815773010253906,
+ 0.56649994850158691406, -0.20968692004680633545, -0.065378531813621520996,
+ 0.10322438180446624756, -0.067442022264003753662, -0.00495197344571352005,
+};
+static double const shh44[] = {
+ 3.0259189605712890625, -6.0268716812133789062, 9.195003509521484375,
+ -11.824929237365722656, 12.767142295837402344, -11.917946815490722656,
+ 9.1739168167114257812, -5.3712320327758789062, 1.1393624544143676758,
+ 2.4484779834747314453, -4.9719839096069335938, 6.0392003059387207031,
+ -5.9359521865844726562, 4.903278350830078125, -3.5527443885803222656,
+ 2.1909697055816650391, -1.1672389507293701172, 0.4903914332389831543,
+ -0.16519790887832641602, 0.023217858746647834778,
+};
+
+static const filter_t filters[] = {
+ {44100, fir, 5, 210, lip44, Shape_lipshitz},
+ {46000, fir, 9, 276, fwe44, Shape_f_weighted},
+ {46000, fir, 9, 160, mew44, Shape_modified_e_weighted},
+ {46000, fir, 9, 321, iew44, Shape_improved_e_weighted},
+ {48000, iir, 4, 220, ges48, Shape_gesemann},
+ {44100, iir, 4, 230, ges44, Shape_gesemann},
+ {48000, fir, 16, 301, shi48, Shape_shibata},
+ {44100, fir, 20, 333, shi44, Shape_shibata},
+ {37800, fir, 16, 240, shi38, Shape_shibata},
+ {32000, fir, 20, 240/*TBD*/, shi32, Shape_shibata},
+ {22050, fir, 20, 240/*TBD*/, shi22, Shape_shibata},
+ {16000, fir, 20, 240/*TBD*/, shi16, Shape_shibata},
+ {11025, fir, 20, 240/*TBD*/, shi11, Shape_shibata},
+ { 8000, fir, 20, 240/*TBD*/, shi08, Shape_shibata},
+ {48000, fir, 16, 250, shl48, Shape_low_shibata},
+ {44100, fir, 15, 250, shl44, Shape_low_shibata},
+ {44100, fir, 20, 383, shh44, Shape_high_shibata},
+ { 0, fir, 0, 0, NULL, Shape_none},
+};
+
+#define MAX_N 20
+
+typedef struct {
+ filter_name_t filter_name;
+ sox_bool auto_detect, alt_tpdf;
+ double dummy;
+
+ double previous_errors[MAX_N * 2];
+ double previous_outputs[MAX_N * 2];
+ size_t pos, prec;
+ uint64_t num_output;
+ int32_t history, ranqd1, r;
+ double const * coefs;
+ sox_bool dither_off;
+ sox_effect_handler_flow flow;
+} priv_t;
+
+#define CONVOLVE _ _ _ _
+#define NAME flow_iir_4
+#define IIR
+#define N 4
+#include "third_party/sox/src/src/dither.h"
+#undef IIR
+#define CONVOLVE _ _ _ _ _
+#define NAME flow_fir_5
+#define N 5
+#include "third_party/sox/src/src/dither.h"
+#define CONVOLVE _ _ _ _ _ _ _ _ _
+#define NAME flow_fir_9
+#define N 9
+#include "third_party/sox/src/src/dither.h"
+#define CONVOLVE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+#define NAME flow_fir_15
+#define N 15
+#include "third_party/sox/src/src/dither.h"
+#define CONVOLVE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+#define NAME flow_fir_16
+#define N 16
+#include "third_party/sox/src/src/dither.h"
+#define CONVOLVE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+#define NAME flow_fir_20
+#define N 20
+#include "third_party/sox/src/src/dither.h"
+
+static int flow_no_shape(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = *isamp = *osamp = min(*isamp, *osamp);
+
+ while (len--) {
+ if (p->auto_detect) {
+ p->history = (p->history << 1) +
+ !!(*ibuf & (((unsigned)-1) >> p->prec));
+ if (p->history && p->dither_off) {
+ p->dither_off = sox_false;
+ lsx_debug("flow %" PRIuPTR ": on @ %" PRIu64, effp->flow, p->num_output);
+ } else if (!p->history && !p->dither_off) {
+ p->dither_off = sox_true;
+ lsx_debug("flow %" PRIuPTR ": off @ %" PRIu64, effp->flow, p->num_output);
+ }
+ }
+
+ if (!p->dither_off) {
+ int32_t r = RANQD1 >> p->prec;
+ double d = ((double)*ibuf++ + r + (p->alt_tpdf? -p->r : (RANQD1 >> p->prec))) / (1 << (32 - p->prec));
+ int i = d < 0? d - .5 : d + .5;
+ p->r = r;
+ if (i <= (-1 << (p->prec-1)))
+ ++effp->clips, *obuf = SOX_SAMPLE_MIN;
+ else if (i > (int)SOX_INT_MAX(p->prec))
+ ++effp->clips, *obuf = SOX_INT_MAX(p->prec) << (32 - p->prec);
+ else *obuf = i << (32 - p->prec);
+ ++obuf;
+ }
+ else
+ *obuf++ = *ibuf++;
+ ++p->num_output;
+ }
+ return SOX_SUCCESS;
+}
+
+static int getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ int c;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, "+aSsf:p:", NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ case 'a': p->auto_detect = sox_true; break;
+ case 'S': p->alt_tpdf = sox_true; break;
+ case 's': p->filter_name = Shape_shibata; break;
+ case 'f':
+ p->filter_name = lsx_enum_option(c, optstate.arg, filter_names);
+ if (p->filter_name == INT_MAX)
+ return SOX_EOF;
+ break;
+ GETOPT_NUMERIC(optstate, 'p', prec, 1, 24)
+ default: lsx_fail("invalid option `-%c'", optstate.opt); return lsx_usage(effp);
+ }
+ argc -= optstate.ind, argv += optstate.ind;
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ double mult = 1; /* Amount the noise shaping multiplies up the TPDF (+/-1) */
+
+ if (p->prec == 0)
+ p->prec = effp->out_signal.precision;
+
+ if (effp->in_signal.precision <= p->prec || p->prec > 24)
+ return SOX_EFF_NULL; /* Dithering not needed at this resolution */
+
+ if (p->prec == 1) {
+ /* The general dither routines don't work in this case, so notify
+ user and leave it at that for now.
+ TODO: Some special-case treatment of 1-bit noise shaping will be
+ needed for meaningful DSD write support. */
+ lsx_warn("Dithering/noise-shaping to 1 bit is currently not supported.");
+ return SOX_EFF_NULL;
+ }
+
+ effp->out_signal.precision = p->prec;
+
+ p->flow = flow_no_shape;
+ if (p->filter_name) {
+ filter_t const * f;
+
+ for (f = filters; f->len && (f->name != p->filter_name || fabs(effp->in_signal.rate - f->rate) / f->rate > .05); ++f); /* 5% leeway on frequency */
+ if (!f->len) {
+ p->alt_tpdf |= effp->in_signal.rate >= 22050;
+ if (!effp->flow)
+ lsx_warn("no `%s' filter is available for rate %g; using %s TPDF",
+ lsx_find_enum_value(p->filter_name, filter_names)->text,
+ effp->in_signal.rate, p->alt_tpdf? "sloped" : "plain");
+ }
+ else {
+ assert(f->len <= MAX_N);
+ if (f->type == fir) switch(f->len) {
+ case 5: p->flow = flow_fir_5 ; break;
+ case 9: p->flow = flow_fir_9 ; break;
+ case 15: p->flow = flow_fir_15; break;
+ case 16: p->flow = flow_fir_16; break;
+ case 20: p->flow = flow_fir_20; break;
+ default: assert(sox_false);
+ } else switch(f->len) {
+ case 4: p->flow = flow_iir_4 ; break;
+ default: assert(sox_false);
+ }
+ p->coefs = f->coefs;
+ mult = dB_to_linear(f->gain_cB * 0.1);
+ }
+ }
+ p->ranqd1 = ranqd1(sox_globals.ranqd1) + effp->flow;
+ if (effp->in_signal.mult) /* (Takes account of ostart mult (sox.c). */
+ *effp->in_signal.mult *= (SOX_SAMPLE_MAX - (1 << (31 - p->prec)) *
+ (2 * mult + 1)) / (SOX_SAMPLE_MAX - (1 << (31 - p->prec)));
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ return p->flow(effp, ibuf, obuf, isamp, osamp);
+}
+
+sox_effect_handler_t const * lsx_dither_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "dither", "[-S|-s|-f filter] [-a] [-p precision]"
+ "\n (none) Use TPDF"
+ "\n -S Use sloped TPDF (without noise shaping)"
+ "\n -s Shape noise (with shibata filter)"
+ "\n -f name Set shaping filter to one of: lipshitz, f-weighted,"
+ "\n modified-e-weighted, improved-e-weighted, gesemann,"
+ "\n shibata, low-shibata, high-shibata."
+ "\n -a Automatically turn on & off dithering as needed (use with caution!)"
+ "\n -p bits Override the target sample precision",
+ SOX_EFF_PREC, getopts, start, flow, 0, 0, 0, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/dither.h b/src/src/dither.h
new file mode 100644
index 0000000..c34b6c3
--- /dev/null
+++ b/src/src/dither.h
@@ -0,0 +1,63 @@
+#ifdef IIR
+#define _ output += p->coefs[j] * p->previous_errors[p->pos + j] \
+ - p->coefs[N + j] * p->previous_outputs[p->pos + j], ++j;
+#else
+#define _ d -= p->coefs[j] * p->previous_errors[p->pos + j], ++j;
+#endif
+static int NAME(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = *isamp = *osamp = min(*isamp, *osamp);
+
+ while (len--) {
+ if (p->auto_detect) {
+ p->history = (p->history << 1) +
+ !!(*ibuf & (((unsigned)-1) >> p->prec));
+ if (p->history && p->dither_off) {
+ p->dither_off = sox_false;
+ lsx_debug("flow %" PRIuPTR ": on @ %" PRIu64, effp->flow, p->num_output);
+ } else if (!p->history && !p->dither_off) {
+ p->dither_off = sox_true;
+ memset(p->previous_errors, 0, sizeof(p->previous_errors));
+ memset(p->previous_outputs, 0, sizeof(p->previous_outputs));
+ lsx_debug("flow %" PRIuPTR ": off @ %" PRIu64, effp->flow, p->num_output);
+ }
+ }
+
+ if (!p->dither_off) {
+ int32_t r1 = RANQD1 >> p->prec, r2 = RANQD1 >> p->prec; /* Defer add! */
+#ifdef IIR
+ double d1, d, output = 0;
+#else
+ double d1, d = *ibuf++;
+#endif
+ int i, j = 0;
+ CONVOLVE
+ assert(j == N);
+ p->pos = p->pos? p->pos - 1 : p->pos - 1 + N;
+#ifdef IIR
+ d = *ibuf++ - output;
+ p->previous_outputs[p->pos + N] = p->previous_outputs[p->pos] = output;
+#endif
+ d1 = (d + r1 + r2) / (1 << (32 - p->prec));
+ i = d1 < 0? d1 - .5 : d1 + .5;
+ p->previous_errors[p->pos + N] = p->previous_errors[p->pos] =
+ (double)i * (1 << (32 - p->prec)) - d;
+ if (i < (-1 << (p->prec-1)))
+ ++effp->clips, *obuf = SOX_SAMPLE_MIN;
+ else if (i > (int)SOX_INT_MAX(p->prec))
+ ++effp->clips, *obuf = SOX_INT_MAX(p->prec) << (32 - p->prec);
+ else *obuf = i << (32 - p->prec);
+ ++obuf;
+ }
+ else
+ *obuf++ = *ibuf++;
+ ++p->num_output;
+ }
+ return SOX_SUCCESS;
+}
+#undef CONVOLVE
+#undef _
+#undef NAME
+#undef N
diff --git a/src/src/divide.c b/src/src/divide.c
new file mode 100644
index 0000000..f0054a2
--- /dev/null
+++ b/src/src/divide.c
@@ -0,0 +1,73 @@
+/* libSoX effect: divide Copyright (c) 2009 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* This is W.I.P. hence marked SOX_EFF_ALPHA for now.
+ * Needs better handling of when the divisor approaches or is zero; some
+ * sort of interpolation of the output values perhaps.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef struct {
+ sox_sample_t * last;
+} priv_t;
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ p->last = lsx_calloc(effp->in_signal.channels, sizeof(*p->last));
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i, len = min(*isamp, *osamp) / effp->in_signal.channels;
+ *osamp = *isamp = len * effp->in_signal.channels;
+
+ while (len--) {
+ double divisor = *obuf++ = *ibuf++;
+ if (divisor) {
+ double out, mult = 1. / SOX_SAMPLE_TO_FLOAT_64BIT(divisor,);
+ for (i = 1; i < effp->in_signal.channels; ++i) {
+ out = *ibuf++ * mult;
+ p->last[i] = *obuf++ = SOX_ROUND_CLIP_COUNT(out, effp->clips);
+ }
+ }
+ else for (i = 1; i < effp->in_signal.channels; ++i, ++ibuf)
+ *obuf++ = p->last[i];
+ }
+ return SOX_SUCCESS;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ free(p->last);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_divide_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "divide", NULL, SOX_EFF_MCHAN | SOX_EFF_GAIN | SOX_EFF_ALPHA,
+ NULL, start, flow, NULL, stop, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/downsample.c b/src/src/downsample.c
new file mode 100644
index 0000000..595f9c6
--- /dev/null
+++ b/src/src/downsample.c
@@ -0,0 +1,85 @@
+/* libSoX effect: Downsample
+ *
+ * First version of this effect written 11/2011 by Ulrich Klauer.
+ *
+ * Copyright 2011 Chris Bagwell and SoX Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {
+ unsigned int factor;
+ unsigned int carry; /* number of samples still to be discarded,
+ carried over from last block */
+} priv_t;
+
+static int create(sox_effect_t *effp, int argc, char **argv)
+{
+ priv_t *p = (priv_t*)effp->priv;
+ p->factor = 2;
+ --argc, ++argv;
+ do { /* break-able block */
+ NUMERIC_PARAMETER(factor, 1, 16384)
+ } while (0);
+ return argc ? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t *effp)
+{
+ priv_t *p = (priv_t*) effp->priv;
+ effp->out_signal.rate = effp->in_signal.rate / p->factor;
+ return p->factor == 1 ? SOX_EFF_NULL : SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t *effp, const sox_sample_t *ibuf,
+ sox_sample_t *obuf, size_t *isamp, size_t *osamp)
+{
+ priv_t *p = (priv_t*)effp->priv;
+ size_t ilen = *isamp, olen = *osamp;
+ size_t t;
+
+ t = min(p->carry, ilen);
+ p->carry -= t;
+ ibuf += t; ilen -= t;
+
+ /* NB: either p->carry (usually) or ilen is now zero; hence, a
+ non-zero value of ilen implies p->carry == 0, and there is no
+ need to test for this in the following while and if. */
+
+ while (ilen >= p->factor && olen) {
+ *obuf++ = *ibuf;
+ ibuf += p->factor;
+ olen--; ilen -= p->factor;
+ }
+
+ if (ilen && olen) {
+ *obuf++ = *ibuf;
+ p->carry = p->factor - ilen;
+ olen--; ilen = 0;
+ }
+
+ *isamp -= ilen, *osamp -= olen;
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const *lsx_downsample_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"downsample", "[factor (2)]",
+ SOX_EFF_RATE | SOX_EFF_MODIFY,
+ create, start, flow, NULL, NULL, NULL, sizeof(priv_t)};
+ return &handler;
+}
diff --git a/src/src/dvms-fmt.c b/src/src/dvms-fmt.c
new file mode 100644
index 0000000..c5ab306
--- /dev/null
+++ b/src/src/dvms-fmt.c
@@ -0,0 +1,32 @@
+/* libSoX file format: DVMS (see cvsd.c) (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/cvsd.h"
+
+LSX_FORMAT_HANDLER(dvms)
+{
+ static char const * const names[] = {"dvms", "vms", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_CVSD, 1, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "MIL Std 188 113 Continuously Variable Slope Delta modulation with header",
+ names, SOX_FILE_MONO,
+ lsx_dvmsstartread, lsx_cvsdread, lsx_cvsdstopread,
+ lsx_dvmsstartwrite, lsx_cvsdwrite, lsx_dvmsstopwrite,
+ NULL, write_encodings, NULL, sizeof(cvsd_priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/earwax.c b/src/src/earwax.c
new file mode 100644
index 0000000..23629f8
--- /dev/null
+++ b/src/src/earwax.c
@@ -0,0 +1,97 @@
+/* libSoX earwax - makes listening to headphones easier November 9, 2000
+ *
+ * Copyright (c) 2000 Edward Beingessner And Sundry Contributors.
+ * This source code is freely redistributable and may be used for any purpose.
+ * This copyright notice must be maintained. Edward Beingessner And Sundry
+ * Contributors are not responsible for the consequences of using this
+ * software.
+ *
+ * This effect takes a 44.1kHz stereo (CD format) signal that is meant to be
+ * listened to on headphones, and adds audio cues to move the soundstage from
+ * inside your head (standard for headphones) to outside and in front of the
+ * listener (standard for speakers). This makes the sound much easier to listen
+ * to on headphones.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+static const sox_sample_t filt[32 * 2] = {
+/* 30° 330° */
+ 4, -6, /* 32 tap stereo FIR filter. */
+ 4, -11, /* One side filters as if the */
+ -1, -5, /* signal was from 30 degrees */
+ 3, 3, /* from the ear, the other as */
+ -2, 5, /* if 330 degrees. */
+ -5, 0,
+ 9, 1,
+ 6, 3, /* Input */
+ -4, -1, /* Left Right */
+ -5, -3, /* __________ __________ */
+ -2, -5, /* | | | | */
+ -7, 1, /* .---| Hh,0(f) | | Hh,0(f) |---. */
+ 6, -7, /* / |__________| |__________| \ */
+ 30, -29, /* / \ / \ */
+ 12, -3, /* / X \ */
+ -11, 4, /* / / \ \ */
+ -3, 7, /* ____V_____ __________V V__________ _____V____ */
+ -20, 23, /* | | | | | | | | */
+ 2, 0, /* | Hh,30(f) | | Hh,330(f)| | Hh,330(f)| | Hh,30(f) | */
+ 1, -6, /* |__________| |__________| |__________| |__________| */
+ -14, -5, /* \ ___ / \ ___ / */
+ 15, -18, /* \ / \ / _____ \ / \ / */
+ 6, 7, /* `->| + |<--' / \ `-->| + |<-' */
+ 15, -10, /* \___/ _/ \_ \___/ */
+ -14, 22, /* \ / \ / \ / */
+ -7, -2, /* `--->| | | |<---' */
+ -4, 9, /* \_/ \_/ */
+ 6, -12, /* */
+ 6, -6, /* Headphones */
+ 0, -11,
+ 0, -5,
+ 4, 0};
+
+#define NUMTAPS array_length(filt)
+typedef struct {sox_sample_t tap[NUMTAPS];} priv_t; /* FIR filter z^-1 delays */
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (effp->in_signal.rate != 44100 || effp->in_signal.channels != 2) {
+ lsx_fail("works only with stereo audio sampled at 44100Hz (i.e. CDDA)");
+ return SOX_EOF;
+ }
+ memset(p->tap, 0, NUMTAPS * sizeof(*p->tap)); /* zero tap memory */
+ if (effp->in_signal.mult)
+ *effp->in_signal.mult *= dB_to_linear(-4.4);
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i, len = *isamp = *osamp = min(*isamp, *osamp);
+
+ while (len--) { /* update taps and calculate output */
+ double output = 0;
+
+ for (i = NUMTAPS - 1; i; --i) {
+ p->tap[i] = p->tap[i - 1];
+ output += p->tap[i] * filt[i];
+ }
+ p->tap[0] = *ibuf++ / 64; /* scale output */
+ output += p->tap[0] * filt[0];
+ *obuf++ = SOX_ROUND_CLIP_COUNT(output, effp->clips);
+ }
+ return SOX_SUCCESS;
+}
+
+/* No drain: preserve audio file length; it's only 32 samples anyway. */
+
+sox_effect_handler_t const *lsx_earwax_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"earwax", NULL, SOX_EFF_MCHAN,
+ NULL, start, flow, NULL, NULL, NULL, sizeof(priv_t)};
+ return &handler;
+}
diff --git a/src/src/echo.c b/src/src/echo.c
new file mode 100644
index 0000000..3dd719b
--- /dev/null
+++ b/src/src/echo.c
@@ -0,0 +1,266 @@
+/* libSoX Echo effect August 24, 1998
+ *
+ * Copyright (C) 1998 Juergen Mueller And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Juergen Mueller And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ *
+ * Flow diagram scheme for n delays ( 1 <= n <= MAX_ECHOS ):
+ *
+ * * gain-in ___
+ * ibuff -----------+------------------------------------------>| |
+ * | _________ | |
+ * | | | * decay 1 | |
+ * +----->| delay 1 |------------------------->| |
+ * | |_________| | |
+ * | _________ | + |
+ * | | | * decay 2 | |
+ * +---------->| delay 2 |-------------------->| |
+ * | |_________| | |
+ * : _________ | |
+ * | | | * decay n | |
+ * +--------------->| delay n |--------------->|___|
+ * |_________| |
+ * | * gain-out
+ * |
+ * +----->obuff
+ * Usage:
+ * echo gain-in gain-out delay-1 decay-1 [delay-2 decay-2 ... delay-n decay-n]
+ *
+ * Where:
+ * gain-in, decay-1 ... decay-n : 0.0 ... 1.0 volume
+ * gain-out : 0.0 ... volume
+ * delay-1 ... delay-n : > 0.0 msec
+ *
+ * Note:
+ * when decay is close to 1.0, the samples can begin clipping and the output
+ * can saturate!
+ *
+ * Hint:
+ * 1 / out-gain > gain-in ( 1 + decay-1 + ... + decay-n )
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdlib.h> /* Harmless, and prototypes atof() etc. --dgc */
+
+#define DELAY_BUFSIZ ( 50 * 50U * 1024 )
+#define MAX_ECHOS 7 /* 24 bit x ( 1 + MAX_ECHOS ) = */
+ /* 24 bit x 8 = 32 bit !!! */
+
+/* Private data for SKEL file */
+typedef struct {
+ int counter;
+ int num_delays;
+ double *delay_buf;
+ float in_gain, out_gain;
+ float delay[MAX_ECHOS], decay[MAX_ECHOS];
+ ptrdiff_t samples[MAX_ECHOS], maxsamples;
+ size_t fade_out;
+} priv_t;
+
+/* Private data for SKEL file */
+
+
+/*
+ * Process options
+ */
+static int sox_echo_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * echo = (priv_t *) effp->priv;
+ int i;
+
+ --argc, ++argv;
+ echo->num_delays = 0;
+
+ if ((argc < 4) || (argc % 2))
+ return lsx_usage(effp);
+
+ i = 0;
+ sscanf(argv[i++], "%f", &echo->in_gain);
+ sscanf(argv[i++], "%f", &echo->out_gain);
+ while (i < argc) {
+ if ( echo->num_delays >= MAX_ECHOS )
+ lsx_fail("echo: to many delays, use less than %i delays",
+ MAX_ECHOS);
+ /* Linux bug and it's cleaner. */
+ sscanf(argv[i++], "%f", &echo->delay[echo->num_delays]);
+ sscanf(argv[i++], "%f", &echo->decay[echo->num_delays]);
+ echo->num_delays++;
+ }
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Prepare for processing.
+ */
+static int sox_echo_start(sox_effect_t * effp)
+{
+ priv_t * echo = (priv_t *) effp->priv;
+ int i;
+ float sum_in_volume;
+ long j;
+
+ echo->maxsamples = 0;
+ if ( echo->in_gain < 0.0 )
+ {
+ lsx_fail("echo: gain-in must be positive!");
+ return (SOX_EOF);
+ }
+ if ( echo->in_gain > 1.0 )
+ {
+ lsx_fail("echo: gain-in must be less than 1.0!");
+ return (SOX_EOF);
+ }
+ if ( echo->out_gain < 0.0 )
+ {
+ lsx_fail("echo: gain-in must be positive!");
+ return (SOX_EOF);
+ }
+ for ( i = 0; i < echo->num_delays; i++ ) {
+ echo->samples[i] = echo->delay[i] * effp->in_signal.rate / 1000.0;
+ if ( echo->samples[i] < 1 )
+ {
+ lsx_fail("echo: delay must be positive!");
+ return (SOX_EOF);
+ }
+ if ( echo->samples[i] > (ptrdiff_t)DELAY_BUFSIZ )
+ {
+ lsx_fail("echo: delay must be less than %g seconds!",
+ DELAY_BUFSIZ / effp->in_signal.rate );
+ return (SOX_EOF);
+ }
+ if ( echo->decay[i] < 0.0 )
+ {
+ lsx_fail("echo: decay must be positive!" );
+ return (SOX_EOF);
+ }
+ if ( echo->decay[i] > 1.0 )
+ {
+ lsx_fail("echo: decay must be less than 1.0!" );
+ return (SOX_EOF);
+ }
+ if ( echo->samples[i] > echo->maxsamples )
+ echo->maxsamples = echo->samples[i];
+ }
+ echo->delay_buf = lsx_malloc(sizeof (double) * echo->maxsamples);
+ for ( j = 0; j < echo->maxsamples; ++j )
+ echo->delay_buf[j] = 0.0;
+ /* Be nice and check the hint with warning, if... */
+ sum_in_volume = 1.0;
+ for ( i = 0; i < echo->num_delays; i++ )
+ sum_in_volume += echo->decay[i];
+ if ( sum_in_volume * echo->in_gain > 1.0 / echo->out_gain )
+ lsx_warn("echo: warning >>> gain-out can cause saturation of output <<<");
+ echo->counter = 0;
+ echo->fade_out = echo->maxsamples;
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* TODO: calculate actual length */
+
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Processed signed long samples from ibuf to obuf.
+ * Return number of samples processed.
+ */
+static int sox_echo_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * echo = (priv_t *) effp->priv;
+ int j;
+ double d_in, d_out;
+ sox_sample_t out;
+ size_t len = min(*isamp, *osamp);
+ *isamp = *osamp = len;
+
+ while (len--) {
+ /* Store delays as 24-bit signed longs */
+ d_in = (double) *ibuf++ / 256;
+ /* Compute output first */
+ d_out = d_in * echo->in_gain;
+ for ( j = 0; j < echo->num_delays; j++ ) {
+ d_out += echo->delay_buf[
+(echo->counter + echo->maxsamples - echo->samples[j]) % echo->maxsamples]
+ * echo->decay[j];
+ }
+ /* Adjust the output volume and size to 24 bit */
+ d_out = d_out * echo->out_gain;
+ out = SOX_24BIT_CLIP_COUNT((sox_sample_t) d_out, effp->clips);
+ *obuf++ = out * 256;
+ /* Store input in delay buffer */
+ echo->delay_buf[echo->counter] = d_in;
+ /* Adjust the counter */
+ echo->counter = ( echo->counter + 1 ) % echo->maxsamples;
+ }
+ /* processed all samples */
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Drain out reverb lines.
+ */
+static int sox_echo_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * echo = (priv_t *) effp->priv;
+ double d_in, d_out;
+ sox_sample_t out;
+ int j;
+ size_t done;
+
+ done = 0;
+ /* drain out delay samples */
+ while ( ( done < *osamp ) && ( done < echo->fade_out ) ) {
+ d_in = 0;
+ d_out = 0;
+ for ( j = 0; j < echo->num_delays; j++ ) {
+ d_out += echo->delay_buf[
+(echo->counter + echo->maxsamples - echo->samples[j]) % echo->maxsamples]
+ * echo->decay[j];
+ }
+ /* Adjust the output volume and size to 24 bit */
+ d_out = d_out * echo->out_gain;
+ out = SOX_24BIT_CLIP_COUNT((sox_sample_t) d_out, effp->clips);
+ *obuf++ = out * 256;
+ /* Store input in delay buffer */
+ echo->delay_buf[echo->counter] = d_in;
+ /* Adjust the counters */
+ echo->counter = ( echo->counter + 1 ) % echo->maxsamples;
+ done++;
+ echo->fade_out--;
+ };
+ /* samples played, it remains */
+ *osamp = done;
+ if (echo->fade_out == 0)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+static int sox_echo_stop(sox_effect_t * effp)
+{
+ priv_t * echo = (priv_t *) effp->priv;
+
+ free(echo->delay_buf);
+ echo->delay_buf = NULL;
+ return (SOX_SUCCESS);
+}
+
+static sox_effect_handler_t sox_echo_effect = {
+ "echo",
+ "gain-in gain-out delay decay [ delay decay ... ]",
+ SOX_EFF_LENGTH | SOX_EFF_GAIN,
+ sox_echo_getopts,
+ sox_echo_start,
+ sox_echo_flow,
+ sox_echo_drain,
+ sox_echo_stop,
+ NULL, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_echo_effect_fn(void)
+{
+ return &sox_echo_effect;
+}
diff --git a/src/src/echos.c b/src/src/echos.c
new file mode 100644
index 0000000..cab4955
--- /dev/null
+++ b/src/src/echos.c
@@ -0,0 +1,278 @@
+/* libSoX Echo effect August 24, 1998
+ *
+ * Copyright (C) 1998 Juergen Mueller And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Juergen Mueller And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ *
+ * Flow diagram scheme for n delays ( 1 <= n <= MAX_ECHOS ):
+ *
+ * * gain-in ___
+ * ibuff --+--------------------------------------------------->| |
+ * | * decay 1 | |
+ * | +----------------------------------->| |
+ * | | * decay 2 | + |
+ * | | +--------------------->| |
+ * | | | * decay n | |
+ * | _________ | _________ | _________ +--->|___|
+ * | | | | | | | | | | |
+ * +-->| delay 1 |-+-| delay 2 |-+...-| delay n |--+ | * gain-out
+ * |_________| |_________| |_________| |
+ * +----->obuff
+ * Usage:
+ * echos gain-in gain-out delay-1 decay-1 [delay-2 decay-2 ... delay-n decay-n]
+ *
+ * Where:
+ * gain-in, decay-1 ... decay-n : 0.0 ... 1.0 volume
+ * gain-out : 0.0 ... volume
+ * delay-1 ... delay-n : > 0.0 msec
+ *
+ * Note:
+ * when decay is close to 1.0, the samples can begin clipping and the output
+ * can saturate!
+ *
+ * Hint:
+ * 1 / out-gain > gain-in ( 1 + decay-1 + ... + decay-n )
+ *
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdlib.h> /* Harmless, and prototypes atof() etc. --dgc */
+
+#define DELAY_BUFSIZ ( 50 * 50U * 1024 )
+#define MAX_ECHOS 7 /* 24 bit x ( 1 + MAX_ECHOS ) = */
+ /* 24 bit x 8 = 32 bit !!! */
+
+/* Private data for SKEL file */
+typedef struct {
+ int counter[MAX_ECHOS];
+ int num_delays;
+ double *delay_buf;
+ float in_gain, out_gain;
+ float delay[MAX_ECHOS], decay[MAX_ECHOS];
+ ptrdiff_t samples[MAX_ECHOS], pointer[MAX_ECHOS];
+ size_t sumsamples;
+} priv_t;
+
+/* Private data for SKEL file */
+
+/*
+ * Process options
+ */
+static int sox_echos_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * echos = (priv_t *) effp->priv;
+ int i;
+
+ echos->num_delays = 0;
+
+ --argc, ++argv;
+ if ((argc < 4) || (argc % 2))
+ return lsx_usage(effp);
+
+ i = 0;
+ sscanf(argv[i++], "%f", &echos->in_gain);
+ sscanf(argv[i++], "%f", &echos->out_gain);
+ while (i < argc) {
+ /* Linux bug and it's cleaner. */
+ sscanf(argv[i++], "%f", &echos->delay[echos->num_delays]);
+ sscanf(argv[i++], "%f", &echos->decay[echos->num_delays]);
+ echos->num_delays++;
+ if ( echos->num_delays > MAX_ECHOS )
+ {
+ lsx_fail("echos: to many delays, use less than %i delays",
+ MAX_ECHOS);
+ return (SOX_EOF);
+ }
+ }
+ echos->sumsamples = 0;
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Prepare for processing.
+ */
+static int sox_echos_start(sox_effect_t * effp)
+{
+ priv_t * echos = (priv_t *) effp->priv;
+ int i;
+ float sum_in_volume;
+ unsigned long j;
+
+ if ( echos->in_gain < 0.0 )
+ {
+ lsx_fail("echos: gain-in must be positive!");
+ return (SOX_EOF);
+ }
+ if ( echos->in_gain > 1.0 )
+ {
+ lsx_fail("echos: gain-in must be less than 1.0!");
+ return (SOX_EOF);
+ }
+ if ( echos->out_gain < 0.0 )
+ {
+ lsx_fail("echos: gain-in must be positive!");
+ return (SOX_EOF);
+ }
+ for ( i = 0; i < echos->num_delays; i++ ) {
+ echos->samples[i] = echos->delay[i] * effp->in_signal.rate / 1000.0;
+ if ( echos->samples[i] < 1 )
+ {
+ lsx_fail("echos: delay must be positive!");
+ return (SOX_EOF);
+ }
+ if ( echos->samples[i] > (ptrdiff_t)DELAY_BUFSIZ )
+ {
+ lsx_fail("echos: delay must be less than %g seconds!",
+ DELAY_BUFSIZ / effp->in_signal.rate );
+ return (SOX_EOF);
+ }
+ if ( echos->decay[i] < 0.0 )
+ {
+ lsx_fail("echos: decay must be positive!" );
+ return (SOX_EOF);
+ }
+ if ( echos->decay[i] > 1.0 )
+ {
+ lsx_fail("echos: decay must be less than 1.0!" );
+ return (SOX_EOF);
+ }
+ echos->counter[i] = 0;
+ echos->pointer[i] = echos->sumsamples;
+ echos->sumsamples += echos->samples[i];
+ }
+ echos->delay_buf = lsx_malloc(sizeof (double) * echos->sumsamples);
+ for ( j = 0; j < echos->sumsamples; ++j )
+ echos->delay_buf[j] = 0.0;
+ /* Be nice and check the hint with warning, if... */
+ sum_in_volume = 1.0;
+ for ( i = 0; i < echos->num_delays; i++ )
+ sum_in_volume += echos->decay[i];
+ if ( sum_in_volume * echos->in_gain > 1.0 / echos->out_gain )
+ lsx_warn("echos: warning >>> gain-out can cause saturation of output <<<");
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* TODO: calculate actual length */
+
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Processed signed long samples from ibuf to obuf.
+ * Return number of samples processed.
+ */
+static int sox_echos_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * echos = (priv_t *) effp->priv;
+ int j;
+ double d_in, d_out;
+ sox_sample_t out;
+ size_t len = min(*isamp, *osamp);
+ *isamp = *osamp = len;
+
+ while (len--) {
+ /* Store delays as 24-bit signed longs */
+ d_in = (double) *ibuf++ / 256;
+ /* Compute output first */
+ d_out = d_in * echos->in_gain;
+ for ( j = 0; j < echos->num_delays; j++ ) {
+ d_out += echos->delay_buf[echos->counter[j] + echos->pointer[j]] * echos->decay[j];
+ }
+ /* Adjust the output volume and size to 24 bit */
+ d_out = d_out * echos->out_gain;
+ out = SOX_24BIT_CLIP_COUNT((sox_sample_t) d_out, effp->clips);
+ *obuf++ = out * 256;
+ /* Mix decay of delays and input */
+ for ( j = 0; j < echos->num_delays; j++ ) {
+ if ( j == 0 )
+ echos->delay_buf[echos->counter[j] + echos->pointer[j]] = d_in;
+ else
+ echos->delay_buf[echos->counter[j] + echos->pointer[j]] =
+ echos->delay_buf[echos->counter[j-1] + echos->pointer[j-1]] + d_in;
+ }
+ /* Adjust the counters */
+ for ( j = 0; j < echos->num_delays; j++ )
+ echos->counter[j] =
+ ( echos->counter[j] + 1 ) % echos->samples[j];
+ }
+ /* processed all samples */
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Drain out reverb lines.
+ */
+static int sox_echos_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * echos = (priv_t *) effp->priv;
+ double d_in, d_out;
+ sox_sample_t out;
+ int j;
+ size_t done;
+
+ done = 0;
+ /* drain out delay samples */
+ while ( ( done < *osamp ) && ( done < echos->sumsamples ) ) {
+ d_in = 0;
+ d_out = 0;
+ for ( j = 0; j < echos->num_delays; j++ ) {
+ d_out += echos->delay_buf[echos->counter[j] + echos->pointer[j]] * echos->decay[j];
+ }
+ /* Adjust the output volume and size to 24 bit */
+ d_out = d_out * echos->out_gain;
+ out = SOX_24BIT_CLIP_COUNT((sox_sample_t) d_out, effp->clips);
+ *obuf++ = out * 256;
+ /* Mix decay of delays and input */
+ for ( j = 0; j < echos->num_delays; j++ ) {
+ if ( j == 0 )
+ echos->delay_buf[echos->counter[j] + echos->pointer[j]] = d_in;
+ else
+ echos->delay_buf[echos->counter[j] + echos->pointer[j]] =
+ echos->delay_buf[echos->counter[j-1] + echos->pointer[j-1]];
+ }
+ /* Adjust the counters */
+ for ( j = 0; j < echos->num_delays; j++ )
+ echos->counter[j] =
+ ( echos->counter[j] + 1 ) % echos->samples[j];
+ done++;
+ echos->sumsamples--;
+ };
+ /* samples played, it remains */
+ *osamp = done;
+ if (echos->sumsamples == 0)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+/*
+ * Clean up echos effect.
+ */
+static int sox_echos_stop(sox_effect_t * effp)
+{
+ priv_t * echos = (priv_t *) effp->priv;
+
+ free(echos->delay_buf);
+ echos->delay_buf = NULL;
+ return (SOX_SUCCESS);
+}
+
+static sox_effect_handler_t sox_echos_effect = {
+ "echos",
+ "gain-in gain-out delay decay [ delay decay ... ]",
+ SOX_EFF_LENGTH | SOX_EFF_GAIN,
+ sox_echos_getopts,
+ sox_echos_start,
+ sox_echos_flow,
+ sox_echos_drain,
+ sox_echos_stop,
+ NULL, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_echos_effect_fn(void)
+{
+ return &sox_echos_effect;
+}
diff --git a/src/src/effects.c b/src/src/effects.c
new file mode 100644
index 0000000..fabf814
--- /dev/null
+++ b/src/src/effects.c
@@ -0,0 +1,669 @@
+/* SoX Effects chain (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define LSX_EFF_ALIAS
+#include "third_party/sox/src/src/sox_i.h"
+#include <assert.h>
+#include <string.h>
+#ifdef HAVE_STRINGS_H
+ #include <strings.h>
+#endif
+
+#define DEBUG_EFFECTS_CHAIN 0
+
+/* Default effect handler functions for do-nothing situations: */
+
+static int default_function(sox_effect_t * effp UNUSED)
+{
+ return SOX_SUCCESS;
+}
+
+/* Pass through samples verbatim */
+int lsx_flow_copy(sox_effect_t * effp UNUSED, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ *isamp = *osamp = min(*isamp, *osamp);
+ memcpy(obuf, ibuf, *isamp * sizeof(*obuf));
+ return SOX_SUCCESS;
+}
+
+/* Inform no more samples to drain */
+static int default_drain(sox_effect_t * effp UNUSED, sox_sample_t *obuf UNUSED, size_t *osamp)
+{
+ *osamp = 0;
+ return SOX_EOF;
+}
+
+/* Check that no parameters have been given */
+static int default_getopts(sox_effect_t * effp, int argc, char **argv UNUSED)
+{
+ return --argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+/* Partially initialise the effect structure; signal info will come later */
+sox_effect_t * sox_create_effect(sox_effect_handler_t const * eh)
+{
+ sox_effect_t * effp = lsx_calloc(1, sizeof(*effp));
+ effp->obuf = NULL;
+
+ effp->global_info = sox_get_effects_globals();
+ effp->handler = *eh;
+ if (!effp->handler.getopts) effp->handler.getopts = default_getopts;
+ if (!effp->handler.start ) effp->handler.start = default_function;
+ if (!effp->handler.flow ) effp->handler.flow = lsx_flow_copy;
+ if (!effp->handler.drain ) effp->handler.drain = default_drain;
+ if (!effp->handler.stop ) effp->handler.stop = default_function;
+ if (!effp->handler.kill ) effp->handler.kill = default_function;
+
+ effp->priv = lsx_calloc(1, effp->handler.priv_size);
+
+ return effp;
+} /* sox_create_effect */
+
+int sox_effect_options(sox_effect_t *effp, int argc, char * const argv[])
+{
+ int result;
+
+ char * * argv2 = lsx_malloc((argc + 1) * sizeof(*argv2));
+ argv2[0] = (char *)effp->handler.name;
+ memcpy(argv2 + 1, argv, argc * sizeof(*argv2));
+ result = effp->handler.getopts(effp, argc + 1, argv2);
+ free(argv2);
+ return result;
+} /* sox_effect_options */
+
+/* Effects chain: */
+
+sox_effects_chain_t * sox_create_effects_chain(
+ sox_encodinginfo_t const * in_enc, sox_encodinginfo_t const * out_enc)
+{
+ sox_effects_chain_t * result = lsx_calloc(1, sizeof(sox_effects_chain_t));
+ result->global_info = *sox_get_effects_globals();
+ result->in_enc = in_enc;
+ result->out_enc = out_enc;
+ return result;
+} /* sox_create_effects_chain */
+
+void sox_delete_effects_chain(sox_effects_chain_t *ecp)
+{
+ if (ecp && ecp->length)
+ sox_delete_effects(ecp);
+ free(ecp->effects);
+ free(ecp);
+} /* sox_delete_effects_chain */
+
+/* Effect can call in start() or flow() to set minimum input size to flow() */
+int lsx_effect_set_imin(sox_effect_t * effp, size_t imin)
+{
+ if (imin > sox_globals.bufsiz / effp->flows) {
+ lsx_fail("sox_bufsiz not big enough");
+ return SOX_EOF;
+ }
+
+ effp->imin = imin;
+ return SOX_SUCCESS;
+}
+
+/* Effects table to be extended in steps of EFF_TABLE_STEP */
+#define EFF_TABLE_STEP 8
+
+/* Add an effect to the chain. *in is the input signal for this effect. *out is
+ * a suggestion as to what the output signal should be, but depending on its
+ * given options and *in, the effect can choose to do differently. Whatever
+ * output rate and channels the effect does produce are written back to *in,
+ * ready for the next effect in the chain.
+ */
+int sox_add_effect(sox_effects_chain_t * chain, sox_effect_t * effp, sox_signalinfo_t * in, sox_signalinfo_t const * out)
+{
+ int ret, (*start)(sox_effect_t * effp) = effp->handler.start;
+ size_t f;
+ sox_effect_t eff0; /* Copy of effect for flow 0 before calling start */
+
+ effp->global_info = &chain->global_info;
+ effp->in_signal = *in;
+ effp->out_signal = *out;
+ effp->in_encoding = chain->in_enc;
+ effp->out_encoding = chain->out_enc;
+ if (!(effp->handler.flags & SOX_EFF_CHAN))
+ effp->out_signal.channels = in->channels;
+ if (!(effp->handler.flags & SOX_EFF_RATE))
+ effp->out_signal.rate = in->rate;
+ if (!(effp->handler.flags & SOX_EFF_PREC))
+ effp->out_signal.precision = (effp->handler.flags & SOX_EFF_MODIFY)?
+ in->precision : SOX_SAMPLE_PRECISION;
+ if (!(effp->handler.flags & SOX_EFF_GAIN))
+ effp->out_signal.mult = in->mult;
+
+ effp->flows =
+ (effp->handler.flags & SOX_EFF_MCHAN)? 1 : effp->in_signal.channels;
+ effp->clips = 0;
+ effp->imin = 0;
+ eff0 = *effp, eff0.priv = lsx_memdup(eff0.priv, eff0.handler.priv_size);
+ eff0.in_signal.mult = NULL; /* Only used in channel 0 */
+ ret = start(effp);
+ if (ret == SOX_EFF_NULL) {
+ lsx_report("has no effect in this configuration");
+ free(eff0.priv);
+ effp->handler.kill(effp);
+ free(effp->priv);
+ effp->priv = NULL;
+ return SOX_SUCCESS;
+ }
+ if (ret != SOX_SUCCESS) {
+ free(eff0.priv);
+ return SOX_EOF;
+ }
+ if (in->mult)
+ lsx_debug("mult=%g", *in->mult);
+
+ if (!(effp->handler.flags & SOX_EFF_LENGTH)) {
+ effp->out_signal.length = in->length;
+ if (effp->out_signal.length != SOX_UNKNOWN_LEN) {
+ if (effp->handler.flags & SOX_EFF_CHAN)
+ effp->out_signal.length =
+ effp->out_signal.length / in->channels * effp->out_signal.channels;
+ if (effp->handler.flags & SOX_EFF_RATE)
+ effp->out_signal.length =
+ effp->out_signal.length / in->rate * effp->out_signal.rate + .5;
+ }
+ }
+
+ *in = effp->out_signal;
+
+ if (chain->length == chain->table_size) {
+ chain->table_size += EFF_TABLE_STEP;
+ lsx_debug_more("sox_add_effect: extending effects table, "
+ "new size = %" PRIuPTR, chain->table_size);
+ lsx_revalloc(chain->effects, chain->table_size);
+ }
+
+ chain->effects[chain->length] =
+ lsx_calloc(effp->flows, sizeof(chain->effects[chain->length][0]));
+ chain->effects[chain->length][0] = *effp;
+
+ for (f = 1; f < effp->flows; ++f) {
+ chain->effects[chain->length][f] = eff0;
+ chain->effects[chain->length][f].flow = f;
+ chain->effects[chain->length][f].priv = lsx_memdup(eff0.priv, eff0.handler.priv_size);
+ if (start(&chain->effects[chain->length][f]) != SOX_SUCCESS) {
+ free(eff0.priv);
+ return SOX_EOF;
+ }
+ }
+
+ ++chain->length;
+ free(eff0.priv);
+ return SOX_SUCCESS;
+}
+
+/* An effect's output buffer (effp->obuf) generally has this layout:
+ * |. . . A1A2A3B1B2B3C1C2C3. . . . . . . . . . . . . . . . . . |
+ * ^0 ^obeg ^oend ^bufsiz
+ * (where A1 is the first sample of channel 1, A2 the first sample of
+ * channel 2, etc.), i.e. the channels are interleaved.
+ * However, while sox_flow_effects() is running, output buffers are
+ * adapted to how the following effect expects its input, to avoid
+ * back-and-forth conversions. If the following effect operates on
+ * each of several channels separately (flows > 1), the layout is
+ * changed to this uninterleaved form:
+ * |. A1B1C1. . . . . . . A2B2C2. . . . . . . A3B3C3. . . . . . |
+ * ^0 ^obeg ^oend ^bufsiz
+ * <--- channel 1 ----><--- channel 2 ----><--- channel 3 ---->
+ * The buffer is logically subdivided into channel buffers of size
+ * bufsiz/flows each, starting at offsets 0, bufsiz/flows,
+ * 2*(bufsiz/flows) etc. Within the channel buffers, the data starts
+ * at position obeg/flows and ends before oend/flows. In case bufsiz
+ * is not evenly divisible by flows, there will be an unused area at
+ * the very end of the output buffer.
+ * The interleave() and deinterleave() functions convert between these
+ * two representations.
+ */
+static void interleave(size_t flows, size_t length, sox_sample_t *from,
+ size_t bufsiz, size_t offset, sox_sample_t *to);
+static void deinterleave(size_t flows, size_t length, sox_sample_t *from,
+ sox_sample_t *to, size_t bufsiz, size_t offset);
+
+static int flow_effect(sox_effects_chain_t * chain, size_t n)
+{
+ sox_effect_t *effp1 = chain->effects[n - 1];
+ sox_effect_t *effp = chain->effects[n];
+ int effstatus = SOX_SUCCESS;
+ size_t f = 0;
+ size_t idone = effp1->oend - effp1->obeg;
+ size_t obeg = sox_globals.bufsiz - effp->oend;
+ sox_bool il_change = (effp->flows == 1) !=
+ (chain->length == n + 1 || chain->effects[n+1]->flows == 1);
+#if DEBUG_EFFECTS_CHAIN
+ size_t pre_idone = idone;
+ size_t pre_odone = obeg;
+#endif
+
+ if (effp->flows == 1) { /* Run effect on all channels at once */
+ idone -= idone % effp->in_signal.channels;
+ effstatus = effp->handler.flow(effp, effp1->obuf + effp1->obeg,
+ il_change ? chain->il_buf : effp->obuf + effp->oend,
+ &idone, &obeg);
+ if (obeg % effp->out_signal.channels != 0) {
+ lsx_fail("multi-channel effect flowed asymmetrically!");
+ effstatus = SOX_EOF;
+ }
+ if (il_change)
+ deinterleave(chain->effects[n+1]->flows, obeg, chain->il_buf,
+ effp->obuf, sox_globals.bufsiz, effp->oend);
+ } else { /* Run effect on each channel individually */
+ sox_sample_t *obuf = il_change ? chain->il_buf : effp->obuf;
+ size_t flow_offs = sox_globals.bufsiz/effp->flows;
+ size_t idone_min = SOX_SIZE_MAX, idone_max = 0;
+ size_t odone_min = SOX_SIZE_MAX, odone_max = 0;
+
+#ifdef HAVE_OPENMP_3_1
+ #pragma omp parallel for \
+ if(sox_globals.use_threads) \
+ schedule(static) default(none) \
+ shared(effp,effp1,idone,obeg,obuf,flow_offs,chain,n,effstatus) \
+ reduction(min:idone_min,odone_min) reduction(max:idone_max,odone_max)
+#elif defined HAVE_OPENMP
+ #pragma omp parallel for \
+ if(sox_globals.use_threads) \
+ schedule(static) default(none) \
+ shared(effp,effp1,idone,obeg,obuf,flow_offs,chain,n,effstatus) \
+ firstprivate(idone_min,odone_min,idone_max,odone_max) \
+ lastprivate(idone_min,odone_min,idone_max,odone_max)
+#endif
+ for (f = 0; f < effp->flows; ++f) {
+ size_t idonec = idone / effp->flows;
+ size_t odonec = obeg / effp->flows;
+ int eff_status_c = effp->handler.flow(&chain->effects[n][f],
+ effp1->obuf + f*flow_offs + effp1->obeg/effp->flows,
+ obuf + f*flow_offs + effp->oend/effp->flows,
+ &idonec, &odonec);
+ idone_min = min(idonec, idone_min); idone_max = max(idonec, idone_max);
+ odone_min = min(odonec, odone_min); odone_max = max(odonec, odone_max);
+
+ if (eff_status_c != SOX_SUCCESS)
+ effstatus = SOX_EOF;
+ }
+
+ if (idone_min != idone_max || odone_min != odone_max) {
+ lsx_fail("flowed asymmetrically!");
+ effstatus = SOX_EOF;
+ }
+ idone = effp->flows * idone_max;
+ obeg = effp->flows * odone_max;
+
+ if (il_change)
+ interleave(effp->flows, obeg, chain->il_buf, sox_globals.bufsiz,
+ effp->oend, effp->obuf + effp->oend);
+ }
+ effp1->obeg += idone;
+ if (effp1->obeg == effp1->oend)
+ effp1->obeg = effp1->oend = 0;
+ else if (effp1->oend - effp1->obeg < effp->imin) { /* Need to refill? */
+ size_t flow_offs = sox_globals.bufsiz/effp->flows;
+ for (f = 0; f < effp->flows; ++f)
+ memcpy(effp1->obuf + f * flow_offs,
+ effp1->obuf + f * flow_offs + effp1->obeg/effp->flows,
+ (effp1->oend - effp1->obeg)/effp->flows * sizeof(*effp1->obuf));
+ effp1->oend -= effp1->obeg;
+ effp1->obeg = 0;
+ }
+
+ effp->oend += obeg;
+
+#if DEBUG_EFFECTS_CHAIN
+ lsx_report("\t" "flow: %2" PRIuPTR " (%1" PRIuPTR ") "
+ "%5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR " "
+ "%5" PRIuPTR " [%" PRIuPTR "-%" PRIuPTR "]",
+ n, effp->flows, pre_idone, pre_odone, idone, obeg,
+ effp1->oend - effp1->obeg, effp1->obeg, effp1->oend);
+#endif
+
+ return effstatus == SOX_SUCCESS? SOX_SUCCESS : SOX_EOF;
+}
+
+/* The same as flow_effect but with no input */
+static int drain_effect(sox_effects_chain_t * chain, size_t n)
+{
+ sox_effect_t *effp = chain->effects[n];
+ int effstatus = SOX_SUCCESS;
+ size_t f = 0;
+ size_t obeg = sox_globals.bufsiz - effp->oend;
+ sox_bool il_change = (effp->flows == 1) !=
+ (chain->length == n + 1 || chain->effects[n+1]->flows == 1);
+#if DEBUG_EFFECTS_CHAIN
+ size_t pre_odone = obeg;
+#endif
+
+ if (effp->flows == 1) { /* Run effect on all channels at once */
+ effstatus = effp->handler.drain(effp,
+ il_change ? chain->il_buf : effp->obuf + effp->oend,
+ &obeg);
+ if (obeg % effp->out_signal.channels != 0) {
+ lsx_fail("multi-channel effect drained asymmetrically!");
+ effstatus = SOX_EOF;
+ }
+ if (il_change)
+ deinterleave(chain->effects[n+1]->flows, obeg, chain->il_buf,
+ effp->obuf, sox_globals.bufsiz, effp->oend);
+ } else { /* Run effect on each channel individually */
+ sox_sample_t *obuf = il_change ? chain->il_buf : effp->obuf;
+ size_t flow_offs = sox_globals.bufsiz/effp->flows;
+ size_t odone_last = 0; /* Initialised to prevent warning */
+
+ for (f = 0; f < effp->flows; ++f) {
+ size_t odonec = obeg / effp->flows;
+ int eff_status_c = effp->handler.drain(&chain->effects[n][f],
+ obuf + f*flow_offs + effp->oend/effp->flows,
+ &odonec);
+ if (f && (odonec != odone_last)) {
+ lsx_fail("drained asymmetrically!");
+ effstatus = SOX_EOF;
+ }
+ odone_last = odonec;
+
+ if (eff_status_c != SOX_SUCCESS)
+ effstatus = SOX_EOF;
+ }
+
+ obeg = effp->flows * odone_last;
+
+ if (il_change)
+ interleave(effp->flows, obeg, chain->il_buf, sox_globals.bufsiz,
+ effp->oend, effp->obuf + effp->oend);
+ }
+ if (!obeg) /* This is the only thing that drain has and flow hasn't */
+ effstatus = SOX_EOF;
+
+ effp->oend += obeg;
+
+#if DEBUG_EFFECTS_CHAIN
+ lsx_report("\t" "drain: %2" PRIuPTR " (%1" PRIuPTR ") "
+ "%5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR,
+ n, effp->flows, (size_t)0, pre_odone, (size_t)0, obeg);
+#endif
+
+ return effstatus == SOX_SUCCESS? SOX_SUCCESS : SOX_EOF;
+}
+
+/* Flow data through the effects chain until an effect or callback gives EOF */
+int sox_flow_effects(sox_effects_chain_t * chain, int (* callback)(sox_bool all_done, void * client_data), void * client_data)
+{
+ int flow_status = SOX_SUCCESS;
+ size_t e, source_e = 0; /* effect indices */
+ size_t max_flows = 0;
+ sox_bool draining = sox_true;
+
+ for (e = 0; e < chain->length; ++e) {
+ sox_effect_t *effp = chain->effects[e];
+ effp->obuf =
+ lsx_realloc(effp->obuf, sox_globals.bufsiz * sizeof(*effp->obuf));
+ /* Memory will be freed by sox_delete_effect() later. */
+ /* Possibly there was already a buffer, if this is a used effect;
+ it may still contain samples in that case. */
+ if (effp->oend > sox_globals.bufsiz) {
+ lsx_warn("buffer size insufficient; buffered samples were dropped");
+ /* can only happen if bufsize has been reduced since the last run */
+ effp->obeg = effp->oend = 0;
+ }
+ max_flows = max(max_flows, effp->flows);
+ }
+ if (max_flows > 1) /* might need interleave buffer */
+ chain->il_buf = lsx_malloc(sox_globals.bufsiz * sizeof(sox_sample_t));
+ else
+ chain->il_buf = NULL;
+
+ /* Go through the effects, and if there are samples in one of the
+ buffers, deinterleave it (if necessary). */
+ for (e = 0; e + 1 < chain->length; e++) {
+ sox_effect_t *effp = chain->effects[e];
+ if (effp->oend > effp->obeg && chain->effects[e+1]->flows > 1) {
+ sox_sample_t *sw = chain->il_buf; chain->il_buf = effp->obuf; effp->obuf = sw;
+ deinterleave(chain->effects[e+1]->flows, effp->oend - effp->obeg,
+ chain->il_buf, effp->obuf, sox_globals.bufsiz, effp->obeg);
+ }
+ }
+
+ e = chain->length - 1;
+ while (source_e < chain->length) {
+#define have_imin (e > 0 && e < chain->length && chain->effects[e - 1]->oend - chain->effects[e - 1]->obeg >= chain->effects[e]->imin)
+ size_t osize = chain->effects[e]->oend - chain->effects[e]->obeg;
+ if (e == source_e && (draining || !have_imin)) {
+ if (drain_effect(chain, e) == SOX_EOF) {
+ ++source_e;
+ draining = sox_false;
+ }
+ } else if (have_imin && flow_effect(chain, e) == SOX_EOF) {
+ flow_status = SOX_EOF;
+ if (e == chain->length - 1)
+ break;
+ source_e = e;
+ draining = sox_true;
+ }
+ if (e < chain->length && chain->effects[e]->oend - chain->effects[e]->obeg > osize) /* False for output */
+ ++e;
+ else if (e == source_e)
+ draining = sox_true;
+ else if (e < source_e)
+ e = source_e;
+ else
+ --e;
+
+ if (callback && callback(source_e == chain->length, client_data) != SOX_SUCCESS) {
+ flow_status = SOX_EOF; /* Client has requested to stop the flow. */
+ break;
+ }
+ }
+
+ /* If an effect's output buffer still has samples, and if it is
+ uninterleaved, then re-interleave it. Necessary since it might
+ be reused, and at that time possibly followed by an MCHAN effect. */
+ for (e = 0; e + 1 < chain->length; e++) {
+ sox_effect_t *effp = chain->effects[e];
+ if (effp->oend > effp->obeg && chain->effects[e+1]->flows > 1) {
+ sox_sample_t *sw = chain->il_buf; chain->il_buf = effp->obuf; effp->obuf = sw;
+ interleave(chain->effects[e+1]->flows, effp->oend - effp->obeg,
+ chain->il_buf, sox_globals.bufsiz, effp->obeg, effp->obuf);
+ }
+ }
+
+ free(chain->il_buf);
+ return flow_status;
+}
+
+sox_uint64_t sox_effects_clips(sox_effects_chain_t * chain)
+{
+ size_t i, f;
+ uint64_t clips = 0;
+ for (i = 1; i < chain->length - 1; ++i)
+ for (f = 0; f < chain->effects[i][0].flows; ++f)
+ clips += chain->effects[i][f].clips;
+ return clips;
+}
+
+sox_uint64_t sox_stop_effect(sox_effect_t *effp)
+{
+ size_t f;
+ uint64_t clips = 0;
+
+ for (f = 0; f < effp->flows; ++f) {
+ effp[f].handler.stop(&effp[f]);
+ clips += effp[f].clips;
+ }
+ return clips;
+}
+
+void sox_push_effect_last(sox_effects_chain_t *chain, sox_effect_t *effp)
+{
+ if (chain->length == chain->table_size) {
+ chain->table_size += EFF_TABLE_STEP;
+ lsx_debug_more("sox_push_effect_last: extending effects table, "
+ "new size = %" PRIuPTR, chain->table_size);
+ lsx_revalloc(chain->effects, chain->table_size);
+ }
+
+ chain->effects[chain->length++] = effp;
+} /* sox_push_effect_last */
+
+sox_effect_t *sox_pop_effect_last(sox_effects_chain_t *chain)
+{
+ if (chain->length > 0)
+ {
+ sox_effect_t *effp;
+ chain->length--;
+ effp = chain->effects[chain->length];
+ chain->effects[chain->length] = NULL;
+ return effp;
+ }
+ else
+ return NULL;
+} /* sox_pop_effect_last */
+
+/* Free resources related to effect.
+ * Note: This currently closes down the effect which might
+ * not be obvious from name.
+ */
+void sox_delete_effect(sox_effect_t *effp)
+{
+ uint64_t clips;
+ size_t f;
+
+ if ((clips = sox_stop_effect(effp)) != 0)
+ lsx_warn("%s clipped %" PRIu64 " samples; decrease volume?",
+ effp->handler.name, clips);
+ if (effp->obeg != effp->oend)
+ lsx_debug("output buffer still held %" PRIuPTR " samples; dropped.",
+ (effp->oend - effp->obeg)/effp->out_signal.channels);
+ /* May or may not indicate a problem; it is normal if the user aborted
+ processing, or if an effect like "trim" stopped early. */
+ effp->handler.kill(effp); /* N.B. only one kill; not one per flow */
+ for (f = 0; f < effp->flows; ++f)
+ free(effp[f].priv);
+ free(effp->obuf);
+ free(effp);
+}
+
+void sox_delete_effect_last(sox_effects_chain_t *chain)
+{
+ if (chain->length > 0)
+ {
+ chain->length--;
+ sox_delete_effect(chain->effects[chain->length]);
+ chain->effects[chain->length] = NULL;
+ }
+} /* sox_delete_effect_last */
+
+/* Remove all effects from the chain.
+ * Note: This currently closes down the effect which might
+ * not be obvious from name.
+ */
+void sox_delete_effects(sox_effects_chain_t * chain)
+{
+ size_t e;
+
+ for (e = 0; e < chain->length; ++e) {
+ sox_delete_effect(chain->effects[e]);
+ chain->effects[e] = NULL;
+ }
+ chain->length = 0;
+}
+
+/*----------------------------- Effects library ------------------------------*/
+
+static sox_effect_fn_t s_sox_effect_fns[] = {
+#define EFFECT(f) lsx_##f##_effect_fn,
+#include "third_party/sox/src/src/effects.h"
+#undef EFFECT
+ NULL
+};
+
+const sox_effect_fn_t*
+sox_get_effect_fns(void)
+{
+ return s_sox_effect_fns;
+}
+
+/* Find a named effect in the effects library */
+sox_effect_handler_t const * sox_find_effect(char const * name)
+{
+ int e;
+ sox_effect_fn_t const * fns = sox_get_effect_fns();
+ for (e = 0; fns[e]; ++e) {
+ const sox_effect_handler_t *eh = fns[e] ();
+ if (eh && eh->name && strcasecmp(eh->name, name) == 0)
+ return eh; /* Found it. */
+ }
+ return NULL;
+}
+
+
+/*----------------------------- Helper functions -----------------------------*/
+
+/* interleave() parameters:
+ * flows: number of samples per wide sample
+ * length: number of samples to copy
+ * [pertaining to the (non-interleaved) source buffer:]
+ * from: start address
+ * bufsiz: total size
+ * offset: position at which to start reading
+ * [pertaining to the (interleaved) destination buffer:]
+ * to: start address
+ */
+static void interleave(size_t flows, size_t length, sox_sample_t *from,
+ size_t bufsiz, size_t offset, sox_sample_t *to)
+{
+ size_t i;
+ const size_t wide_samples = length/flows;
+ const size_t flow_offs = bufsiz/flows;
+ from += offset/flows;
+ for (i = 0; i < wide_samples; i++) {
+ sox_sample_t *inner_from = from + i;
+ sox_sample_t *inner_to = to + i * flows;
+ size_t f;
+ for (f = 0; f < flows; f++) {
+ *inner_to++ = *inner_from;
+ inner_from += flow_offs;
+ }
+ }
+}
+
+/* deinterleave() parameters:
+ * flows: number of samples per wide sample
+ * length: number of samples to copy
+ * [pertaining to the (interleaved) source buffer:]
+ * from: start address
+ * [pertaining to the (non-interleaved) destination buffer:]
+ * to: start address
+ * bufsiz: total size
+ * offset: position at which to start writing
+ */
+static void deinterleave(size_t flows, size_t length, sox_sample_t *from,
+ sox_sample_t *to, size_t bufsiz, size_t offset)
+{
+ const size_t wide_samples = length/flows;
+ const size_t flow_offs = bufsiz/flows;
+ size_t f;
+ to += offset/flows;
+ for (f = 0; f < flows; f++) {
+ sox_sample_t *inner_to = to + f*flow_offs;
+ sox_sample_t *inner_from = from + f;
+ size_t i = wide_samples;
+ while (i--) {
+ *inner_to++ = *inner_from;
+ inner_from += flows;
+ }
+ }
+}
diff --git a/src/src/effects.h b/src/src/effects.h
new file mode 100644
index 0000000..450a5c2
--- /dev/null
+++ b/src/src/effects.h
@@ -0,0 +1,90 @@
+/* This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* FIXME: generate this list automatically */
+
+ EFFECT(allpass)
+ EFFECT(band)
+ EFFECT(bandpass)
+ EFFECT(bandreject)
+ EFFECT(bass)
+ EFFECT(bend)
+ EFFECT(biquad)
+ EFFECT(chorus)
+ EFFECT(channels)
+ EFFECT(compand)
+ EFFECT(contrast)
+ EFFECT(dcshift)
+ EFFECT(deemph)
+ EFFECT(delay)
+ EFFECT(dft_filter) /* abstract */
+ EFFECT(dither)
+ EFFECT(divide)
+ EFFECT(downsample)
+ EFFECT(earwax)
+ EFFECT(echo)
+ EFFECT(echos)
+ EFFECT(equalizer)
+ EFFECT(fade)
+ EFFECT(fir)
+ EFFECT(firfit)
+ EFFECT(flanger)
+ EFFECT(gain)
+ EFFECT(highpass)
+ EFFECT(hilbert)
+ EFFECT(input)
+#ifdef HAVE_LADSPA_H
+ EFFECT(ladspa)
+#endif
+ EFFECT(loudness)
+ EFFECT(lowpass)
+ EFFECT(mcompand)
+ EFFECT(noiseprof)
+ EFFECT(noisered)
+ EFFECT(norm)
+ EFFECT(oops)
+ EFFECT(output)
+ EFFECT(overdrive)
+ EFFECT(pad)
+ EFFECT(phaser)
+ EFFECT(pitch)
+ EFFECT(rate)
+ EFFECT(remix)
+ EFFECT(repeat)
+ EFFECT(reverb)
+ EFFECT(reverse)
+ EFFECT(riaa)
+ EFFECT(silence)
+ EFFECT(sinc)
+#ifdef HAVE_PNG
+ EFFECT(spectrogram)
+#endif
+ EFFECT(speed)
+#ifdef HAVE_SPEEXDSP
+ EFFECT(speexdsp)
+#endif
+ EFFECT(splice)
+ EFFECT(stat)
+ EFFECT(stats)
+ EFFECT(stretch)
+ EFFECT(swap)
+ EFFECT(synth)
+ EFFECT(tempo)
+ EFFECT(treble)
+ EFFECT(tremolo)
+ EFFECT(trim)
+ EFFECT(upsample)
+ EFFECT(vad)
+ EFFECT(vol)
diff --git a/src/src/effects_i.c b/src/src/effects_i.c
new file mode 100644
index 0000000..4dbd448
--- /dev/null
+++ b/src/src/effects_i.c
@@ -0,0 +1,483 @@
+/* Implements a libSoX internal interface for implementing effects.
+ * All public functions & data are prefixed with lsx_ .
+ *
+ * Copyright (c) 2005-2012 Chris Bagwell and SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define LSX_EFF_ALIAS
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+#include <ctype.h>
+
+int lsx_usage(sox_effect_t * effp)
+{
+ if (effp->handler.usage)
+ lsx_fail("usage: %s", effp->handler.usage);
+ else
+ lsx_fail("this effect takes no parameters");
+ return SOX_EOF;
+}
+
+char * lsx_usage_lines(char * * usage, char const * const * lines, size_t n)
+{
+ if (!*usage) {
+ size_t i, len;
+ for (len = i = 0; i < n; len += strlen(lines[i++]) + 1);
+ *usage = lsx_malloc(len); /* FIXME: this memory will never be freed */
+ strcpy(*usage, lines[0]);
+ for (i = 1; i < n; ++i) {
+ strcat(*usage, "\n");
+ strcat(*usage, lines[i]);
+ }
+ }
+ return *usage;
+}
+
+static lsx_enum_item const s_lsx_wave_enum[] = {
+ LSX_ENUM_ITEM(SOX_WAVE_,SINE)
+ LSX_ENUM_ITEM(SOX_WAVE_,TRIANGLE)
+ {0, 0}};
+
+lsx_enum_item const * lsx_get_wave_enum(void)
+{
+ return s_lsx_wave_enum;
+}
+
+void lsx_generate_wave_table(
+ lsx_wave_t wave_type,
+ sox_data_t data_type,
+ void *table,
+ size_t table_size,
+ double min,
+ double max,
+ double phase)
+{
+ uint32_t t;
+ uint32_t phase_offset = phase / M_PI / 2 * table_size + 0.5;
+
+ for (t = 0; t < table_size; t++)
+ {
+ uint32_t point = (t + phase_offset) % table_size;
+ double d;
+ switch (wave_type)
+ {
+ case SOX_WAVE_SINE:
+ d = (sin((double)point / table_size * 2 * M_PI) + 1) / 2;
+ break;
+
+ case SOX_WAVE_TRIANGLE:
+ d = (double)point * 2 / table_size;
+ switch (4 * point / table_size)
+ {
+ case 0: d = d + 0.5; break;
+ case 1: case 2: d = 1.5 - d; break;
+ case 3: d = d - 1.5; break;
+ }
+ break;
+
+ default: /* Oops! FIXME */
+ d = 0.0; /* Make sure we have a value */
+ break;
+ }
+ d = d * (max - min) + min;
+ switch (data_type)
+ {
+ case SOX_FLOAT:
+ {
+ float *fp = (float *)table;
+ *fp++ = (float)d;
+ table = fp;
+ continue;
+ }
+ case SOX_DOUBLE:
+ {
+ double *dp = (double *)table;
+ *dp++ = d;
+ table = dp;
+ continue;
+ }
+ default: break;
+ }
+ d += d < 0? -0.5 : +0.5;
+ switch (data_type)
+ {
+ case SOX_SHORT:
+ {
+ short *sp = table;
+ *sp++ = (short)d;
+ table = sp;
+ continue;
+ }
+ case SOX_INT:
+ {
+ int *ip = table;
+ *ip++ = (int)d;
+ table = ip;
+ continue;
+ }
+ default: break;
+ }
+ }
+}
+
+/*
+ * lsx_parsesamples
+ *
+ * Parse a string for # of samples. The input consists of one or more
+ * parts, with '+' or '-' between them indicating if the sample count
+ * should be added to or subtracted from the previous value.
+ * If a part ends with a 's' then it is interpreted as a
+ * user-calculated # of samples.
+ * If a part contains ':' or '.' but no 'e' or if it ends with a 't'
+ * then it is treated as an amount of time. This is converted into
+ * seconds and fraction of seconds, then the sample rate is used to
+ * calculate # of samples.
+ * Parameter def specifies which interpretation should be the default
+ * for a bare number like "123". It can either be 't' or 's'.
+ * Returns NULL on error, pointer to next char to parse otherwise.
+ */
+static char const * parsesamples(sox_rate_t rate, const char *str0, uint64_t *samples, int def, int combine);
+
+char const * lsx_parsesamples(sox_rate_t rate, const char *str0, uint64_t *samples, int def)
+{
+ *samples = 0;
+ return parsesamples(rate, str0, samples, def, '+');
+}
+
+static char const * parsesamples(sox_rate_t rate, const char *str0, uint64_t *samples, int def, int combine)
+{
+ char * str = (char *)str0;
+
+ do {
+ uint64_t samples_part;
+ sox_bool found_samples = sox_false, found_time = sox_false;
+ char const * end;
+ char const * pos;
+ sox_bool found_colon, found_dot, found_e;
+
+ for (;*str == ' '; ++str);
+ for (end = str; *end && strchr("0123456789:.ets", *end); ++end);
+ if (end == str)
+ return NULL; /* error: empty input */
+
+ pos = strchr(str, ':');
+ found_colon = pos && pos < end;
+
+ pos = strchr(str, '.');
+ found_dot = pos && pos < end;
+
+ pos = strchr(str, 'e');
+ found_e = pos && pos < end;
+
+ if (found_colon || (found_dot && !found_e) || *(end-1) == 't')
+ found_time = sox_true;
+ else if (*(end-1) == 's')
+ found_samples = sox_true;
+
+ if (found_time || (def == 't' && !found_samples)) {
+ int i;
+ if (found_e)
+ return NULL; /* error: e notation in time */
+
+ for (samples_part = 0, i = 0; *str != '.' && i < 3; ++i) {
+ char * last_str = str;
+ long part = strtol(str, &str, 10);
+ if (!i && str == last_str)
+ return NULL; /* error: empty first component */
+ samples_part += rate * part;
+ if (i < 2) {
+ if (*str != ':')
+ break;
+ ++str;
+ samples_part *= 60;
+ }
+ }
+ if (*str == '.') {
+ char * last_str = str;
+ double part = strtod(str, &str);
+ if (str == last_str)
+ return NULL; /* error: empty fractional part */
+ samples_part += rate * part + .5;
+ }
+ if (*str == 't')
+ str++;
+ } else {
+ char * last_str = str;
+ double part = strtod(str, &str);
+ if (str == last_str)
+ return NULL; /* error: no sample count */
+ samples_part = part + .5;
+ if (*str == 's')
+ str++;
+ }
+ if (str != end)
+ return NULL; /* error: trailing characters */
+
+ switch (combine) {
+ case '+': *samples += samples_part; break;
+ case '-': *samples = samples_part <= *samples ?
+ *samples - samples_part : 0;
+ break;
+ }
+ combine = '\0';
+ if (*str && strchr("+-", *str))
+ combine = *str++;
+ } while (combine);
+ return str;
+}
+
+#if 0
+
+#include <assert.h>
+
+#define TEST(st, samp, len) \
+ str = st; \
+ next = lsx_parsesamples(10000, str, &samples, 't'); \
+ assert(samples == samp && next == str + len);
+
+int main(int argc, char * * argv)
+{
+ char const * str, * next;
+ uint64_t samples;
+
+ TEST("0" , 0, 1)
+ TEST("1" , 10000, 1)
+
+ TEST("0s" , 0, 2)
+ TEST("0s,", 0, 2)
+ TEST("0s/", 0, 2)
+ TEST("0s@", 0, 2)
+
+ TEST("0t" , 0, 2)
+ TEST("0t,", 0, 2)
+ TEST("0t/", 0, 2)
+ TEST("0t@", 0, 2)
+
+ TEST("1s" , 1, 2)
+ TEST("1s,", 1, 2)
+ TEST("1s/", 1, 2)
+ TEST("1s@", 1, 2)
+ TEST(" 01s" , 1, 4)
+ TEST("1e6s" , 1000000, 4)
+
+ TEST("1t" , 10000, 2)
+ TEST("1t,", 10000, 2)
+ TEST("1t/", 10000, 2)
+ TEST("1t@", 10000, 2)
+ TEST("1.1t" , 11000, 4)
+ TEST("1.1t,", 11000, 4)
+ TEST("1.1t/", 11000, 4)
+ TEST("1.1t@", 11000, 4)
+ assert(!lsx_parsesamples(10000, "1e6t", &samples, 't'));
+
+ TEST(".0", 0, 2)
+ TEST("0.0", 0, 3)
+ TEST("0:0.0", 0, 5)
+ TEST("0:0:0.0", 0, 7)
+
+ TEST(".1", 1000, 2)
+ TEST(".10", 1000, 3)
+ TEST("0.1", 1000, 3)
+ TEST("1.1", 11000, 3)
+ TEST("1:1.1", 611000, 5)
+ TEST("1:1:1.1", 36611000, 7)
+ TEST("1:1", 610000, 3)
+ TEST("1:01", 610000, 4)
+ TEST("1:1:1", 36610000, 5)
+ TEST("1:", 600000, 2)
+ TEST("1::", 36000000, 3)
+
+ TEST("0.444444", 4444, 8)
+ TEST("0.555555", 5556, 8)
+
+ assert(!lsx_parsesamples(10000, "x", &samples, 't'));
+
+ TEST("1:23+37", 1200000, 7)
+ TEST("12t+12s", 120012, 7)
+ TEST("1e6s-10", 900000, 7)
+ TEST("10-2:00", 0, 7)
+ TEST("123-45+12s+2:00-3e3s@foo", 1977012, 20)
+
+ TEST("1\0" "2", 10000, 1)
+
+ return 0;
+}
+#endif
+
+/*
+ * lsx_parseposition
+ *
+ * Parse a string for an audio position. Similar to lsx_parsesamples
+ * above, but an initial '=', '+' or '-' indicates that the specified time
+ * is relative to the start of audio, last used position or end of audio,
+ * respectively. Parameter def states which of these is the default.
+ * Parameters latest and end are the positions to which '+' and '-' relate;
+ * end may be SOX_UNKNOWN_LEN, in which case "-0" is the only valid
+ * end-relative input and will result in a position of SOX_UNKNOWN_LEN.
+ * Other parameters and return value are the same as for lsx_parsesamples.
+ *
+ * A test parse that only checks for valid syntax can be done by
+ * specifying samples = NULL. If this passes, a later reparse of the same
+ * input will only fail if it is relative to the end ("-"), not "-0", and
+ * the end position is unknown.
+ */
+char const * lsx_parseposition(sox_rate_t rate, const char *str0, uint64_t *samples, uint64_t latest, uint64_t end, int def)
+{
+ char *str = (char *)str0;
+ char anchor, combine;
+
+ if (!strchr("+-=", def))
+ return NULL; /* error: invalid default anchor */
+ anchor = def;
+ if (*str && strchr("+-=", *str))
+ anchor = *str++;
+
+ combine = '+';
+ if (strchr("+-", anchor)) {
+ combine = anchor;
+ if (*str && strchr("+-", *str))
+ combine = *str++;
+ }
+
+ if (!samples) {
+ /* dummy parse, syntax checking only */
+ uint64_t dummy = 0;
+ return parsesamples(0., str, &dummy, 't', '+');
+ }
+
+ switch (anchor) {
+ case '=': *samples = 0; break;
+ case '+': *samples = latest; break;
+ case '-': *samples = end; break;
+ }
+
+ if (anchor == '-' && end == SOX_UNKNOWN_LEN) {
+ /* "-0" only valid input here */
+ char const *l;
+ for (l = str; *l && strchr("0123456789:.ets+-", *l); ++l);
+ if (l == str+1 && *str == '0') {
+ /* *samples already set to SOX_UNKNOWN_LEN */
+ return l;
+ }
+ return NULL; /* error: end-relative position, but end unknown */
+ }
+
+ return parsesamples(rate, str, samples, 't', combine);
+}
+
+/* a note is given as an int,
+ * 0 => 440 Hz = A
+ * >0 => number of half notes 'up',
+ * <0 => number of half notes down,
+ * example 12 => A of next octave, 880Hz
+ *
+ * calculated by freq = 440Hz * 2**(note/12)
+ */
+static double calc_note_freq(double note, int key)
+{
+ if (key != INT_MAX) { /* Just intonation. */
+ static const int n[] = {16, 9, 6, 5, 4, 7}; /* Numerator. */
+ static const int d[] = {15, 8, 5, 4, 3, 5}; /* Denominator. */
+ static double j[13]; /* Just semitones */
+ int i, m = floor(note);
+
+ if (!j[1]) for (i = 1; i <= 12; ++i)
+ j[i] = i <= 6? log((double)n[i - 1] / d[i - 1]) / log(2.) : 1 - j[12 - i];
+ note -= m;
+ m -= key = m - ((INT_MAX / 2 - ((INT_MAX / 2) % 12) + m - key) % 12);
+ return 440 * pow(2., key / 12. + j[m] + (j[m + 1] - j[m]) * note);
+ }
+ return 440 * pow(2., note / 12);
+}
+
+int lsx_parse_note(char const * text, char * * end_ptr)
+{
+ int result = INT_MAX;
+
+ if (*text >= 'A' && *text <= 'G') {
+ result = (int)(5/3. * (*text++ - 'A') + 9.5) % 12 - 9;
+ if (*text == 'b') {--result; ++text;}
+ else if (*text == '#') {++result; ++text;}
+ if (isdigit((unsigned char)*text))
+ result += 12 * (*text++ - '4');
+ }
+ *end_ptr = (char *)text;
+ return result;
+}
+
+/* Read string 'text' and convert to frequency.
+ * 'text' can be a positive number which is the frequency in Hz.
+ * If 'text' starts with a '%' and a following number the corresponding
+ * note is calculated.
+ * Return -1 on error.
+ */
+double lsx_parse_frequency_k(char const * text, char * * end_ptr, int key)
+{
+ double result;
+
+ if (*text == '%') {
+ result = strtod(text + 1, end_ptr);
+ if (*end_ptr == text + 1)
+ return -1;
+ return calc_note_freq(result, key);
+ }
+ if (*text >= 'A' && *text <= 'G') {
+ int result2 = lsx_parse_note(text, end_ptr);
+ return result2 == INT_MAX? - 1 : calc_note_freq((double)result2, key);
+ }
+ result = strtod(text, end_ptr);
+ if (end_ptr) {
+ if (*end_ptr == text)
+ return -1;
+ if (**end_ptr == 'k') {
+ result *= 1000;
+ ++*end_ptr;
+ }
+ }
+ return result < 0 ? -1 : result;
+}
+
+FILE * lsx_open_input_file(sox_effect_t * effp, char const * filename, sox_bool text_mode)
+{
+ FILE * file;
+
+ if (!filename || !strcmp(filename, "-")) {
+ if (effp->global_info->global_info->stdin_in_use_by) {
+ lsx_fail("stdin already in use by `%s'", effp->global_info->global_info->stdin_in_use_by);
+ return NULL;
+ }
+ effp->global_info->global_info->stdin_in_use_by = effp->handler.name;
+ file = stdin;
+ }
+ else if (!(file = fopen(filename, text_mode ? "r" : "rb"))) {
+ lsx_fail("couldn't open file %s: %s", filename, strerror(errno));
+ return NULL;
+ }
+ return file;
+}
+
+int lsx_effects_init(void)
+{
+ init_fft_cache();
+ return SOX_SUCCESS;
+}
+
+int lsx_effects_quit(void)
+{
+ clear_fft_cache();
+ return SOX_SUCCESS;
+}
diff --git a/src/src/effects_i_dsp.c b/src/src/effects_i_dsp.c
new file mode 100644
index 0000000..da35c3a
--- /dev/null
+++ b/src/src/effects_i_dsp.c
@@ -0,0 +1,652 @@
+/* libSoX internal DSP functions.
+ * All public functions & data are prefixed with lsx_ .
+ *
+ * Copyright (c) 2008,2012 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef NDEBUG /* Enable assert always. */
+#undef NDEBUG /* Must undef above assert.h or other that might include it. */
+#endif
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <assert.h>
+#include <string.h>
+
+/* Concurrent Control with "Readers" and "Writers", P.J. Courtois et al, 1971:*/
+
+#if defined HAVE_OPENMP
+
+typedef struct {
+ int readcount, writecount; /* initial value = 0 */
+ omp_lock_t mutex_1, mutex_2, mutex_3, w, r; /* initial value = 1 */
+} ccrw2_t; /* Problem #2: `writers-preference' */
+
+#define ccrw2_become_reader(p) do {\
+ omp_set_lock(&p.mutex_3);\
+ omp_set_lock(&p.r);\
+ omp_set_lock(&p.mutex_1);\
+ if (++p.readcount == 1) omp_set_lock(&p.w);\
+ omp_unset_lock(&p.mutex_1);\
+ omp_unset_lock(&p.r);\
+ omp_unset_lock(&p.mutex_3);\
+} while (0)
+#define ccrw2_cease_reading(p) do {\
+ omp_set_lock(&p.mutex_1);\
+ if (!--p.readcount) omp_unset_lock(&p.w);\
+ omp_unset_lock(&p.mutex_1);\
+} while (0)
+#define ccrw2_become_writer(p) do {\
+ omp_set_lock(&p.mutex_2);\
+ if (++p.writecount == 1) omp_set_lock(&p.r);\
+ omp_unset_lock(&p.mutex_2);\
+ omp_set_lock(&p.w);\
+} while (0)
+#define ccrw2_cease_writing(p) do {\
+ omp_unset_lock(&p.w);\
+ omp_set_lock(&p.mutex_2);\
+ if (!--p.writecount) omp_unset_lock(&p.r);\
+ omp_unset_lock(&p.mutex_2);\
+} while (0)
+#define ccrw2_init(p) do {\
+ omp_init_lock(&p.mutex_1);\
+ omp_init_lock(&p.mutex_2);\
+ omp_init_lock(&p.mutex_3);\
+ omp_init_lock(&p.w);\
+ omp_init_lock(&p.r);\
+} while (0)
+#define ccrw2_clear(p) do {\
+ omp_destroy_lock(&p.r);\
+ omp_destroy_lock(&p.w);\
+ omp_destroy_lock(&p.mutex_3);\
+ omp_destroy_lock(&p.mutex_2);\
+ omp_destroy_lock(&p.mutex_1);\
+} while (0)
+
+#else
+
+#define ccrw2_become_reader(x) (void)0
+#define ccrw2_cease_reading(x) (void)0
+#define ccrw2_become_writer(x) (void)0
+#define ccrw2_cease_writing(x) (void)0
+#define ccrw2_init(x) (void)0
+#define ccrw2_clear(x) (void)0
+
+#endif /* HAVE_OPENMP */
+
+/* Numerical Recipes cubic spline: */
+
+void lsx_prepare_spline3(double const * x, double const * y, int n,
+ double start_1d, double end_1d, double * y_2d)
+{
+ double p, qn, sig, un, * u = lsx_malloc((n - 1) * sizeof(*u));
+ int i;
+
+ if (start_1d == HUGE_VAL)
+ y_2d[0] = u[0] = 0; /* Start with natural spline or */
+ else { /* set the start first derivative */
+ y_2d[0] = -.5;
+ u[0] = (3 / (x[1] - x[0])) * ((y[1] - y[0]) / (x[1] - x[0]) - start_1d);
+ }
+
+ for (i = 1; i < n - 1; ++i) {
+ sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]);
+ p = sig * y_2d[i - 1] + 2;
+ y_2d[i] = (sig - 1) / p;
+ u[i] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]) -
+ (y[i] - y[i - 1]) / (x[i] - x[i - 1]);
+ u[i] = (6 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
+ }
+ if (end_1d == HUGE_VAL)
+ qn = un = 0; /* End with natural spline or */
+ else { /* set the end first derivative */
+ qn = .5;
+ un = 3 / (x[n - 1] - x[n - 2]) * (end_1d - (y[n - 1] - y[n - 2]) / (x[n - 1] - x[n - 2]));
+ }
+ y_2d[n - 1] = (un - qn * u[n - 2]) / (qn * y_2d[n - 2] + 1);
+ for (i = n - 2; i >= 0; --i)
+ y_2d[i] = y_2d[i] * y_2d[i + 1] + u[i];
+ free(u);
+}
+
+double lsx_spline3(double const * x, double const * y, double const * y_2d,
+ int n, double x1)
+{
+ int t, i[2] = {0, 0};
+ double d, a, b;
+
+ for (i[1] = n - 1; i[1] - i[0] > 1; t = (i[1] + i[0]) >> 1, i[x[t] > x1] = t);
+ d = x[i[1]] - x[i[0]];
+ assert(d != 0);
+ a = (x[i[1]] - x1) / d;
+ b = (x1 - x[i[0]]) / d;
+ return a * y[i[0]] + b * y[i[1]] +
+ ((a * a * a - a) * y_2d[i[0]] + (b * b * b - b) * y_2d[i[1]]) * d * d / 6;
+}
+
+double lsx_bessel_I_0(double x)
+{
+ double term = 1, sum = 1, last_sum, x2 = x / 2;
+ int i = 1;
+ do {
+ double y = x2 / i++;
+ last_sum = sum, sum += term *= y * y;
+ } while (sum != last_sum);
+ return sum;
+}
+
+int lsx_set_dft_length(int num_taps) /* Set to 4 x nearest power of 2 */
+{ /* or half of that if danger of causing too many cache misses. */
+ int min = sox_globals.log2_dft_min_size;
+ double d = log((double)num_taps) / log(2.);
+ return 1 << range_limit((int)(d + 2.77), min, max((int)(d + 1.77), 17));
+}
+
+#include "third_party/sox/src/src/fft4g.h"
+static int * lsx_fft_br;
+static double * lsx_fft_sc;
+static int fft_len = -1;
+#if defined HAVE_OPENMP
+static ccrw2_t fft_cache_ccrw;
+#endif
+
+void init_fft_cache(void)
+{
+ assert(lsx_fft_br == NULL);
+ assert(lsx_fft_sc == NULL);
+ assert(fft_len == -1);
+ ccrw2_init(fft_cache_ccrw);
+ fft_len = 0;
+}
+
+void clear_fft_cache(void)
+{
+ assert(fft_len >= 0);
+ ccrw2_clear(fft_cache_ccrw);
+ free(lsx_fft_br);
+ free(lsx_fft_sc);
+ lsx_fft_sc = NULL;
+ lsx_fft_br = NULL;
+ fft_len = -1;
+}
+
+static sox_bool update_fft_cache(int len)
+{
+ assert(lsx_is_power_of_2(len));
+ assert(fft_len >= 0);
+ ccrw2_become_reader(fft_cache_ccrw);
+ if (len > fft_len) {
+ ccrw2_cease_reading(fft_cache_ccrw);
+ ccrw2_become_writer(fft_cache_ccrw);
+ if (len > fft_len) {
+ int old_n = fft_len;
+ fft_len = len;
+ lsx_fft_br = lsx_realloc(lsx_fft_br, dft_br_len(fft_len) * sizeof(*lsx_fft_br));
+ lsx_fft_sc = lsx_realloc(lsx_fft_sc, dft_sc_len(fft_len) * sizeof(*lsx_fft_sc));
+ if (!old_n)
+ lsx_fft_br[0] = 0;
+ return sox_true;
+ }
+ ccrw2_cease_writing(fft_cache_ccrw);
+ ccrw2_become_reader(fft_cache_ccrw);
+ }
+ return sox_false;
+}
+
+static void done_with_fft_cache(sox_bool is_writer)
+{
+ if (is_writer)
+ ccrw2_cease_writing(fft_cache_ccrw);
+ else ccrw2_cease_reading(fft_cache_ccrw);
+}
+
+void lsx_safe_rdft(int len, int type, double * d)
+{
+ sox_bool is_writer = update_fft_cache(len);
+ lsx_rdft(len, type, d, lsx_fft_br, lsx_fft_sc);
+ done_with_fft_cache(is_writer);
+}
+
+void lsx_safe_cdft(int len, int type, double * d)
+{
+ sox_bool is_writer = update_fft_cache(len);
+ lsx_cdft(len, type, d, lsx_fft_br, lsx_fft_sc);
+ done_with_fft_cache(is_writer);
+}
+
+void lsx_power_spectrum(int n, double const * in, double * out)
+{
+ int i;
+ double * work = lsx_memdup(in, n * sizeof(*work));
+ lsx_safe_rdft(n, 1, work);
+ out[0] = sqr(work[0]);
+ for (i = 2; i < n; i += 2)
+ out[i >> 1] = sqr(work[i]) + sqr(work[i + 1]);
+ out[i >> 1] = sqr(work[1]);
+ free(work);
+}
+
+void lsx_power_spectrum_f(int n, float const * in, float * out)
+{
+ int i;
+ double * work = lsx_malloc(n * sizeof(*work));
+ for (i = 0; i< n; ++i) work[i] = in[i];
+ lsx_safe_rdft(n, 1, work);
+ out[0] = sqr(work[0]);
+ for (i = 2; i < n; i += 2)
+ out[i >> 1] = sqr(work[i]) + sqr(work[i + 1]);
+ out[i >> 1] = sqr(work[1]);
+ free(work);
+}
+
+void lsx_apply_hann_f(float h[], const int num_points)
+{
+ int i, m = num_points - 1;
+ for (i = 0; i < num_points; ++i) {
+ double x = 2 * M_PI * i / m;
+ h[i] *= .5 - .5 * cos(x);
+ }
+}
+
+void lsx_apply_hann(double h[], const int num_points)
+{
+ int i, m = num_points - 1;
+ for (i = 0; i < num_points; ++i) {
+ double x = 2 * M_PI * i / m;
+ h[i] *= .5 - .5 * cos(x);
+ }
+}
+
+void lsx_apply_hamming(double h[], const int num_points)
+{
+ int i, m = num_points - 1;
+ for (i = 0; i < num_points; ++i) {
+ double x = 2 * M_PI * i / m;
+ h[i] *= .53836 - .46164 * cos(x);
+ }
+}
+
+void lsx_apply_bartlett(double h[], const int num_points)
+{
+ int i, m = num_points - 1;
+ for (i = 0; i < num_points; ++i) {
+ h[i] *= 2. / m * (m / 2. - fabs(i - m / 2.));
+ }
+}
+
+void lsx_apply_blackman(double h[], const int num_points, double alpha /*.16*/)
+{
+ int i, m = num_points - 1;
+ for (i = 0; i < num_points; ++i) {
+ double x = 2 * M_PI * i / m;
+ h[i] *= (1 - alpha) *.5 - .5 * cos(x) + alpha * .5 * cos(2 * x);
+ }
+}
+
+void lsx_apply_blackman_nutall(double h[], const int num_points)
+{
+ int i, m = num_points - 1;
+ for (i = 0; i < num_points; ++i) {
+ double x = 2 * M_PI * i / m;
+ h[i] *= .3635819 - .4891775 * cos(x) + .1365995 * cos(2 * x) - .0106411 * cos(3 * x);
+ }
+}
+
+double lsx_kaiser_beta(double att, double tr_bw)
+{
+ if (att >= 60) {
+ static const double coefs[][4] = {
+ {-6.784957e-10,1.02856e-05,0.1087556,-0.8988365+.001},
+ {-6.897885e-10,1.027433e-05,0.10876,-0.8994658+.002},
+ {-1.000683e-09,1.030092e-05,0.1087677,-0.9007898+.003},
+ {-3.654474e-10,1.040631e-05,0.1087085,-0.8977766+.006},
+ {8.106988e-09,6.983091e-06,0.1091387,-0.9172048+.015},
+ {9.519571e-09,7.272678e-06,0.1090068,-0.9140768+.025},
+ {-5.626821e-09,1.342186e-05,0.1083999,-0.9065452+.05},
+ {-9.965946e-08,5.073548e-05,0.1040967,-0.7672778+.085},
+ {1.604808e-07,-5.856462e-05,0.1185998,-1.34824+.1},
+ {-1.511964e-07,6.363034e-05,0.1064627,-0.9876665+.18},
+ };
+ double realm = log(tr_bw/.0005)/log(2.);
+ double const * c0 = coefs[range_limit( (int)realm, 0, (int)array_length(coefs)-1)];
+ double const * c1 = coefs[range_limit(1+(int)realm, 0, (int)array_length(coefs)-1)];
+ double b0 = ((c0[0]*att + c0[1])*att + c0[2])*att + c0[3];
+ double b1 = ((c1[0]*att + c1[1])*att + c1[2])*att + c1[3];
+ return b0 + (b1 - b0) * (realm - (int)realm);
+ }
+ if (att > 50 ) return .1102 * (att - 8.7);
+ if (att > 20.96) return .58417 * pow(att -20.96, .4) + .07886 * (att - 20.96);
+ return 0;
+}
+
+void lsx_apply_kaiser(double h[], const int num_points, double beta)
+{
+ int i, m = num_points - 1;
+ for (i = 0; i <= m; ++i) {
+ double x = 2. * i / m - 1;
+ h[i] *= lsx_bessel_I_0(beta * sqrt(1 - x * x)) / lsx_bessel_I_0(beta);
+ }
+}
+
+void lsx_apply_dolph(double h[], const int N, double att)
+{
+ double b = cosh(acosh(pow(10., att/20)) / (N-1)), sum, t, c, norm = 0;
+ int i, j;
+ for (c = 1 - 1 / (b*b), i = (N-1) / 2; i >= 0; --i) {
+ for (sum = !i, b = t = j = 1; j <= i && sum != t; b *= (i-j) * (1./j), ++j)
+ t = sum, sum += (b *= c * (N - i - j) * (1./j));
+ sum /= (N - 1 - i), sum /= (norm = norm? norm : sum);
+ h[i] *= sum, h[N - 1 - i] *= sum;
+ }
+}
+
+double * lsx_make_lpf(int num_taps, double Fc, double beta, double rho,
+ double scale, sox_bool dc_norm)
+{
+ int i, m = num_taps - 1;
+ double * h = malloc(num_taps * sizeof(*h)), sum = 0;
+ double mult = scale / lsx_bessel_I_0(beta), mult1 = 1 / (.5 * m + rho);
+ assert(Fc >= 0 && Fc <= 1);
+ lsx_debug("make_lpf(n=%i Fc=%.7g β=%g ρ=%g dc-norm=%i scale=%g)", num_taps, Fc, beta, rho, dc_norm, scale);
+
+ for (i = 0; i <= m / 2; ++i) {
+ double z = i - .5 * m, x = z * M_PI, y = z * mult1;
+ h[i] = x? sin(Fc * x) / x : Fc;
+ sum += h[i] *= lsx_bessel_I_0(beta * sqrt(1 - y * y)) * mult;
+ if (m - i != i)
+ sum += h[m - i] = h[i];
+ }
+ for (i = 0; dc_norm && i < num_taps; ++i) h[i] *= scale / sum;
+ return h;
+}
+
+void lsx_kaiser_params(double att, double Fc, double tr_bw, double * beta, int * num_taps)
+{
+ *beta = *beta < 0? lsx_kaiser_beta(att, tr_bw * .5 / Fc): *beta;
+ att = att < 60? (att - 7.95) / (2.285 * M_PI * 2) :
+ ((.0007528358-1.577737e-05**beta)**beta+.6248022)**beta+.06186902;
+ *num_taps = !*num_taps? ceil(att/tr_bw + 1) : *num_taps;
+}
+
+double * lsx_design_lpf(
+ double Fp, /* End of pass-band */
+ double Fs, /* Start of stop-band */
+ double Fn, /* Nyquist freq; e.g. 0.5, 1, PI */
+ double att, /* Stop-band attenuation in dB */
+ int * num_taps, /* 0: value will be estimated */
+ int k, /* >0: number of phases; <0: num_taps ≡ 1 (mod -k) */
+ double beta) /* <0: value will be estimated */
+{
+ int n = *num_taps, phases = max(k, 1), modulo = max(-k, 1);
+ double tr_bw, Fc, rho = phases == 1? .5 : att < 120? .63 : .75;
+
+ Fp /= fabs(Fn), Fs /= fabs(Fn); /* Normalise to Fn = 1 */
+ tr_bw = .5 * (Fs - Fp); /* Transition band-width: 6dB to stop points */
+ tr_bw /= phases, Fs /= phases;
+ tr_bw = min(tr_bw, .5 * Fs);
+ Fc = Fs - tr_bw;
+ assert(Fc - tr_bw >= 0);
+ lsx_kaiser_params(att, Fc, tr_bw, &beta, num_taps);
+ if (!n)
+ *num_taps = phases > 1? *num_taps / phases * phases + phases - 1 : (*num_taps + modulo - 2) / modulo * modulo + 1;
+ return Fn < 0? 0 : lsx_make_lpf(
+ *num_taps, Fc, beta, rho, (double)phases, sox_false);
+}
+
+static double safe_log(double x)
+{
+ assert(x >= 0);
+ if (x)
+ return log(x);
+ lsx_debug("log(0)");
+ return -26;
+}
+
+void lsx_fir_to_phase(double * * h, int * len, int * post_len, double phase)
+{
+ double * pi_wraps, * work, phase1 = (phase > 50 ? 100 - phase : phase) / 50;
+ int i, work_len, begin, end, imp_peak = 0, peak = 0;
+ double imp_sum = 0, peak_imp_sum = 0;
+ double prev_angle2 = 0, cum_2pi = 0, prev_angle1 = 0, cum_1pi = 0;
+
+ for (i = *len, work_len = 2 * 2 * 8; i > 1; work_len <<= 1, i >>= 1);
+
+ work = lsx_calloc((size_t)work_len + 2, sizeof(*work)); /* +2: (UN)PACK */
+ pi_wraps = lsx_malloc((((size_t)work_len + 2) / 2) * sizeof(*pi_wraps));
+
+ memcpy(work, *h, *len * sizeof(*work));
+ lsx_safe_rdft(work_len, 1, work); /* Cepstral: */
+ LSX_UNPACK(work, work_len);
+
+ for (i = 0; i <= work_len; i += 2) {
+ double angle = atan2(work[i + 1], work[i]);
+ double detect = 2 * M_PI;
+ double delta = angle - prev_angle2;
+ double adjust = detect * ((delta < -detect * .7) - (delta > detect * .7));
+ prev_angle2 = angle;
+ cum_2pi += adjust;
+ angle += cum_2pi;
+ detect = M_PI;
+ delta = angle - prev_angle1;
+ adjust = detect * ((delta < -detect * .7) - (delta > detect * .7));
+ prev_angle1 = angle;
+ cum_1pi += fabs(adjust); /* fabs for when 2pi and 1pi have combined */
+ pi_wraps[i >> 1] = cum_1pi;
+
+ work[i] = safe_log(sqrt(sqr(work[i]) + sqr(work[i + 1])));
+ work[i + 1] = 0;
+ }
+ LSX_PACK(work, work_len);
+ lsx_safe_rdft(work_len, -1, work);
+ for (i = 0; i < work_len; ++i) work[i] *= 2. / work_len;
+
+ for (i = 1; i < work_len / 2; ++i) { /* Window to reject acausal components */
+ work[i] *= 2;
+ work[i + work_len / 2] = 0;
+ }
+ lsx_safe_rdft(work_len, 1, work);
+
+ for (i = 2; i < work_len; i += 2) /* Interpolate between linear & min phase */
+ work[i + 1] = phase1 * i / work_len * pi_wraps[work_len >> 1] +
+ (1 - phase1) * (work[i + 1] + pi_wraps[i >> 1]) - pi_wraps[i >> 1];
+
+ work[0] = exp(work[0]), work[1] = exp(work[1]);
+ for (i = 2; i < work_len; i += 2) {
+ double x = exp(work[i]);
+ work[i ] = x * cos(work[i + 1]);
+ work[i + 1] = x * sin(work[i + 1]);
+ }
+
+ lsx_safe_rdft(work_len, -1, work);
+ for (i = 0; i < work_len; ++i) work[i] *= 2. / work_len;
+
+ /* Find peak pos. */
+ for (i = 0; i <= (int)(pi_wraps[work_len >> 1] / M_PI + .5); ++i) {
+ imp_sum += work[i];
+ if (fabs(imp_sum) > fabs(peak_imp_sum)) {
+ peak_imp_sum = imp_sum;
+ peak = i;
+ }
+ if (work[i] > work[imp_peak]) /* For debug check only */
+ imp_peak = i;
+ }
+ while (peak && fabs(work[peak-1]) > fabs(work[peak]) && work[peak-1] * work[peak] > 0)
+ --peak;
+
+ if (!phase1)
+ begin = 0;
+ else if (phase1 == 1)
+ begin = peak - *len / 2;
+ else {
+ begin = (.997 - (2 - phase1) * .22) * *len + .5;
+ end = (.997 + (0 - phase1) * .22) * *len + .5;
+ begin = peak - (begin & ~3);
+ end = peak + 1 + ((end + 3) & ~3);
+ *len = end - begin;
+ *h = lsx_realloc(*h, *len * sizeof(**h));
+ }
+ for (i = 0; i < *len; ++i) (*h)[i] =
+ work[(begin + (phase > 50 ? *len - 1 - i : i) + work_len) & (work_len - 1)];
+ *post_len = phase > 50 ? peak - begin : begin + *len - (peak + 1);
+
+ lsx_debug("nPI=%g peak-sum@%i=%g (val@%i=%g); len=%i post=%i (%g%%)",
+ pi_wraps[work_len >> 1] / M_PI, peak, peak_imp_sum, imp_peak,
+ work[imp_peak], *len, *post_len, 100 - 100. * *post_len / (*len - 1));
+ free(pi_wraps), free(work);
+}
+
+void lsx_plot_fir(double * h, int num_points, sox_rate_t rate, sox_plot_t type, char const * title, double y1, double y2)
+{
+ int i, N = lsx_set_dft_length(num_points);
+ if (type == sox_plot_gnuplot) {
+ double * h1 = lsx_calloc(N, sizeof(*h1));
+ double * H = lsx_malloc((N / 2 + 1) * sizeof(*H));
+ memcpy(h1, h, sizeof(*h1) * num_points);
+ lsx_power_spectrum(N, h1, H);
+ printf(
+ "# gnuplot file\n"
+ "set title '%s'\n"
+ "set xlabel 'Frequency (Hz)'\n"
+ "set ylabel 'Amplitude Response (dB)'\n"
+ "set grid xtics ytics\n"
+ "set key off\n"
+ "plot '-' with lines\n"
+ , title);
+ for (i = 0; i <= N/2; ++i)
+ printf("%g %g\n", i * rate / N, 10 * log10(H[i]));
+ printf(
+ "e\n"
+ "pause -1 'Hit return to continue'\n");
+ free(H);
+ free(h1);
+ }
+ else if (type == sox_plot_octave) {
+ printf("%% GNU Octave file (may also work with MATLAB(R) )\nb=[");
+ for (i = 0; i < num_points; ++i)
+ printf("%24.16e\n", h[i]);
+ printf("];\n"
+ "[h,w]=freqz(b,1,%i);\n"
+ "plot(%g*w/pi,20*log10(h))\n"
+ "title('%s')\n"
+ "xlabel('Frequency (Hz)')\n"
+ "ylabel('Amplitude Response (dB)')\n"
+ "grid on\n"
+ "axis([0 %g %g %g])\n"
+ "disp('Hit return to continue')\n"
+ "pause\n"
+ , N, rate * .5, title, rate * .5, y1, y2);
+ }
+ else if (type == sox_plot_data) {
+ printf("# %s\n"
+ "# FIR filter\n"
+ "# rate: %g\n"
+ "# name: b\n"
+ "# type: matrix\n"
+ "# rows: %i\n"
+ "# columns: 1\n", title, rate, num_points);
+ for (i = 0; i < num_points; ++i)
+ printf("%24.16e\n", h[i]);
+ }
+}
+
+#if HAVE_FENV_H
+ #include <fenv.h>
+ #if defined FE_INVALID
+ #if HAVE_LRINT && LONG_MAX == 2147483647
+ #define lrint32 lrint
+ #elif defined __GNUC__ && defined __x86_64__
+ #define lrint32 lrint32
+ // TODO(b/19597760): Fix this MSAN false positive.
+ #ifndef __has_feature
+ # define __has_feature(x) 0
+ #endif
+ #if __has_feature(memory_sanitizer)
+ # include <sanitizer/msan_interface.h>
+ #endif
+ static __inline sox_int32_t lrint32(double input) {
+ sox_int32_t result;
+ __asm__ __volatile__("fistpl %0": "=m"(result): "t"(input): "st");
+ #if __has_feature(memory_sanitizer)
+ __msan_unpoison(&result, 4);
+ #endif
+ return result;
+ }
+ #endif
+ #endif
+#endif
+
+#if defined lrint32
+#define _ dest[i] = lrint32(src[i]), ++i,
+#pragma STDC FENV_ACCESS ON
+
+static void rint_clip(sox_sample_t * const dest, double const * const src,
+ size_t i, size_t const n, sox_uint64_t * const clips)
+{
+ for (; i < n; ++i) {
+ dest[i] = lrint32(src[i]);
+ if (fetestexcept(FE_INVALID)) {
+ feclearexcept(FE_INVALID);
+ dest[i] = src[i] > 0? SOX_SAMPLE_MAX : SOX_SAMPLE_MIN;
+ ++*clips;
+ }
+ }
+}
+
+void lsx_save_samples(sox_sample_t * const dest, double const * const src,
+ size_t const n, sox_uint64_t * const clips)
+{
+ size_t i;
+ feclearexcept(FE_INVALID);
+ for (i = 0; i < (n & ~7);) {
+ _ _ _ _ _ _ _ _ 0;
+ if (fetestexcept(FE_INVALID)) {
+ feclearexcept(FE_INVALID);
+ rint_clip(dest, src, i - 8, i, clips);
+ }
+ }
+ rint_clip(dest, src, i, n, clips);
+}
+
+void lsx_load_samples(double * const dest, sox_sample_t const * const src,
+ size_t const n)
+{
+ size_t i;
+ for (i = 0; i < n; ++i)
+ dest[i] = src[i];
+}
+
+#pragma STDC FENV_ACCESS OFF
+#undef _
+#else
+
+void lsx_save_samples(sox_sample_t * const dest, double const * const src,
+ size_t const n, sox_uint64_t * const clips)
+{
+ SOX_SAMPLE_LOCALS;
+ size_t i;
+ for (i = 0; i < n; ++i)
+ dest[i] = SOX_FLOAT_64BIT_TO_SAMPLE(src[i], *clips);
+}
+
+void lsx_load_samples(double * const dest, sox_sample_t const * const src,
+ size_t const n)
+{
+ size_t i;
+ for (i = 0; i < n; ++i)
+ dest[i] = SOX_SAMPLE_TO_FLOAT_64BIT(src[i],);
+}
+
+#endif
diff --git a/src/src/f4-fmt.c b/src/src/f4-fmt.c
new file mode 100644
index 0000000..392d96a
--- /dev/null
+++ b/src/src/f4-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT1(f4, "f32", 32, 0, FLOAT)
diff --git a/src/src/f8-fmt.c b/src/src/f8-fmt.c
new file mode 100644
index 0000000..bf4e803
--- /dev/null
+++ b/src/src/f8-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT1(f8, "f64", 64, 0, FLOAT)
diff --git a/src/src/fade.c b/src/src/fade.c
new file mode 100644
index 0000000..1492e29
--- /dev/null
+++ b/src/src/fade.c
@@ -0,0 +1,399 @@
+/* Ari Moisio <armoi@sci.fi> Aug 29 2000, based on skeleton effect
+ * Written by Chris Bagwell (cbagwell@sprynet.com) - March 16, 1999
+ *
+ * Copyright 1999 Chris Bagwell And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Chris Bagwell And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+/* Fade curves */
+#define FADE_QUARTER 'q' /* Quarter of sine wave, 0 to pi/2 */
+#define FADE_HALF 'h' /* Half of sine wave, pi/2 to 1.5 * pi
+ * scaled so that -1 means no output
+ * and 1 means 0 db attenuation. */
+#define FADE_LOG 'l' /* Logarithmic curve. Fades -100 db
+ * in given time. */
+#define FADE_TRI 't' /* Linear slope. */
+#define FADE_PAR 'p' /* Inverted parabola. */
+
+#include <string.h>
+
+/* Private data for fade file */
+typedef struct { /* These are measured as samples */
+ uint64_t in_start, in_stop, out_start, out_stop, samplesdone;
+ char *in_stop_str, *out_start_str, *out_stop_str;
+ char in_fadetype, out_fadetype;
+ char do_out;
+ int endpadwarned;
+} priv_t;
+
+/* prototypes */
+static double fade_gain(uint64_t index, uint64_t range, int fadetype);
+
+/*
+ * Process options
+ *
+ * Don't do initialization now.
+ * The 'info' fields are not yet filled in.
+ */
+
+static int sox_fade_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+
+ priv_t * fade = (priv_t *) effp->priv;
+ char t_char[2];
+ int t_argno;
+ uint64_t samples;
+ const char *n;
+ --argc, ++argv;
+
+ if (argc < 1 || argc > 4)
+ return lsx_usage(effp);
+
+ /* because sample rate is unavailable at this point we store the
+ * string off for later computations.
+ */
+
+ if (sscanf(argv[0], "%1[qhltp]", t_char))
+ {
+ fade->in_fadetype = *t_char;
+ fade->out_fadetype = *t_char;
+
+ argv++;
+ argc--;
+ }
+ else
+ {
+ /* No type given. */
+ fade->in_fadetype = 'l';
+ fade->out_fadetype = 'l';
+ }
+
+ fade->in_stop_str = lsx_strdup(argv[0]);
+ /* Do a dummy parse to see if it will fail */
+ n = lsx_parsesamples(0., fade->in_stop_str, &samples, 't');
+ if (!n || *n)
+ return lsx_usage(effp);
+
+ fade->in_stop = samples;
+ fade->out_start_str = fade->out_stop_str = 0;
+
+ for (t_argno = 1; t_argno < argc && t_argno < 3; t_argno++)
+ {
+ /* See if there is fade-in/fade-out times/curves specified. */
+ if(t_argno == 1)
+ {
+ fade->out_stop_str = lsx_strdup(argv[t_argno]);
+
+ /* Do a dummy parse to see if it will fail */
+ n = lsx_parseposition(0., fade->out_stop_str, NULL, (uint64_t)0, (uint64_t)0, '=');
+ if (!n || *n)
+ return lsx_usage(effp);
+ fade->out_stop = samples;
+ }
+ else
+ {
+ fade->out_start_str = lsx_strdup(argv[t_argno]);
+
+ /* Do a dummy parse to see if it will fail */
+ n = lsx_parsesamples(0., fade->out_start_str, &samples, 't');
+ if (!n || *n)
+ return lsx_usage(effp);
+ fade->out_start = samples;
+ }
+ } /* End for(t_argno) */
+
+ return(SOX_SUCCESS);
+}
+
+/*
+ * Prepare processing.
+ * Do all initializations.
+ */
+static int sox_fade_start(sox_effect_t * effp)
+{
+ priv_t * fade = (priv_t *) effp->priv;
+ sox_bool truncate = sox_false;
+ uint64_t samples;
+ uint64_t in_length = effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN;
+
+ /* converting time values to samples */
+ fade->in_start = 0;
+ if (lsx_parsesamples(effp->in_signal.rate, fade->in_stop_str,
+ &samples, 't') == NULL)
+ return lsx_usage(effp);
+
+ fade->in_stop = samples;
+ fade->do_out = 0;
+ /* See if user specified a stop time */
+ if (fade->out_stop_str)
+ {
+ fade->do_out = 1;
+ if (!lsx_parseposition(effp->in_signal.rate, fade->out_stop_str,
+ &samples, (uint64_t)0, in_length, '=') ||
+ samples == SOX_UNKNOWN_LEN) {
+ lsx_fail("audio length is unknown");
+ return SOX_EOF;
+ }
+ fade->out_stop = samples;
+
+ if (!(truncate = !!fade->out_stop)) {
+ fade->out_stop = effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels :
+ 0;
+ if (!fade->out_stop) {
+ lsx_fail("cannot fade out: audio length is neither known nor given");
+ return SOX_EOF;
+ }
+ }
+
+ /* See if user wants to fade out. */
+ if (fade->out_start_str)
+ {
+ if (lsx_parsesamples(effp->in_signal.rate, fade->out_start_str,
+ &samples, 't') == NULL)
+ return lsx_usage(effp);
+ /* Fade time is relative to stop time. */
+ fade->out_start = fade->out_stop - samples;
+ }
+ else
+ /* If user doesn't specify fade out length then
+ * use same length as input side. This is stored
+ * in in_stop.
+ */
+ fade->out_start = fade->out_stop - fade->in_stop;
+ }
+ else
+ /* If not specified then user wants to process all
+ * of file. Use a value of zero to indicate this.
+ */
+ fade->out_stop = 0;
+
+ if (fade->out_start) { /* Sanity check */
+ if (fade->in_stop > fade->out_start)
+ --fade->in_stop; /* 1 sample grace for rounding error. */
+ if (fade->in_stop > fade->out_start) {
+ lsx_fail("fade-out overlaps fade-in");
+ return SOX_EOF;
+ }
+ }
+
+ fade->samplesdone = fade->in_start;
+ fade->endpadwarned = 0;
+
+ lsx_debug("in_start = %" PRIu64 " in_stop = %" PRIu64 " "
+ "out_start = %" PRIu64 " out_stop = %" PRIu64,
+ fade->in_start, fade->in_stop, fade->out_start, fade->out_stop);
+
+ if (fade->in_start == fade->in_stop && !truncate &&
+ fade->out_start == fade->out_stop)
+ return SOX_EFF_NULL;
+
+ effp->out_signal.length = truncate ?
+ fade->out_stop * effp->in_signal.channels : effp->in_signal.length;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Processed signed long samples from ibuf to obuf.
+ * Return number of samples processed.
+ */
+static int sox_fade_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * fade = (priv_t *) effp->priv;
+ /* len is total samples, chcnt counts channels */
+ int len = 0, t_output = 1, more_output = 1;
+ sox_sample_t t_ibuf;
+ size_t chcnt = 0;
+
+ len = ((*isamp > *osamp) ? *osamp : *isamp);
+
+ *osamp = 0;
+ *isamp = 0;
+
+ for(; len && more_output; len--)
+ {
+ t_ibuf = *ibuf;
+
+ if ((fade->samplesdone >= fade->in_start) &&
+ (!fade->do_out || fade->samplesdone < fade->out_stop))
+ { /* something to generate output */
+
+ if (fade->samplesdone < fade->in_stop)
+ { /* fade-in phase, increase gain */
+ *obuf = t_ibuf *
+ fade_gain(fade->samplesdone - fade->in_start,
+ fade->in_stop - fade->in_start,
+ fade->in_fadetype);
+ } /* endif fade-in */
+ else if (!fade->do_out || fade->samplesdone < fade->out_start)
+ { /* steady gain phase */
+ *obuf = t_ibuf;
+ } /* endif steady phase */
+ else
+ { /* fade-out phase, decrease gain */
+ *obuf = t_ibuf *
+ fade_gain(fade->out_stop - fade->samplesdone,
+ fade->out_stop - fade->out_start,
+ fade->out_fadetype);
+ } /* endif fade-out */
+
+ if (!(!fade->do_out || fade->samplesdone < fade->out_stop))
+ more_output = 0;
+
+ t_output = 1;
+ }
+ else
+ { /* No output generated */
+ t_output = 0;
+ } /* endif something to output */
+
+ *isamp += 1;
+ ibuf++;
+
+ if (t_output)
+ { /* Output generated, update pointers and counters */
+ obuf++;
+ *osamp += 1;
+ } /* endif t_output */
+
+ /* Process next channel */
+ chcnt++;
+ if (chcnt >= effp->in_signal.channels)
+ { /* all channels of this sample processed */
+ chcnt = 0;
+ fade->samplesdone += 1;
+ } /* endif all channels */
+ } /* endfor */
+
+ /* If not more samples will be returned, let application know
+ * this.
+ */
+ if (fade->do_out && fade->samplesdone >= fade->out_stop)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+/*
+ * Drain out remaining samples if the effect generates any.
+ */
+static int sox_fade_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * fade = (priv_t *) effp->priv;
+ int len;
+ size_t t_chan = 0;
+
+ len = *osamp;
+ len -= len % effp->in_signal.channels;
+ *osamp = 0;
+
+ if (fade->do_out && fade->samplesdone < fade->out_stop &&
+ !(fade->endpadwarned))
+ { /* Warning about padding silence into end of sample */
+ lsx_warn("End time past end of audio. Padding with silence");
+ fade->endpadwarned = 1;
+ } /* endif endpadwarned */
+
+ for (;len && (fade->do_out &&
+ fade->samplesdone < fade->out_stop); len--)
+ {
+ *obuf = 0;
+ obuf++;
+ *osamp += 1;
+
+ t_chan++;
+ if (t_chan >= effp->in_signal.channels)
+ {
+ fade->samplesdone += 1;
+ t_chan = 0;
+ } /* endif channels */
+ } /* endfor */
+
+ if (fade->do_out && fade->samplesdone >= fade->out_stop)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * (free allocated memory, etc.)
+ */
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * fade = (priv_t *) effp->priv;
+
+ free(fade->in_stop_str);
+ free(fade->out_start_str);
+ free(fade->out_stop_str);
+ return (SOX_SUCCESS);
+}
+
+/* Function returns gain value 0.0 - 1.0 according index / range ratio
+* and -1.0 if type is invalid
+* todo: to optimize performance calculate gain every now and then and interpolate */
+static double fade_gain(uint64_t index, uint64_t range, int type)
+{
+ double retval = 0.0, findex = 0.0;
+
+ /* TODO: does it really have to be contrained to [0.0, 1.0]? */
+ findex = max(0.0, min(1.0, 1.0 * index / range));
+
+ switch (type) {
+ case FADE_TRI : /* triangle */
+ retval = findex;
+ break;
+
+ case FADE_QUARTER : /* quarter of sinewave */
+ retval = sin(findex * M_PI / 2);
+ break;
+
+ case FADE_HALF : /* half of sinewave... eh cosine wave */
+ retval = (1 - cos(findex * M_PI )) / 2 ;
+ break;
+
+ case FADE_LOG : /* logarithmic */
+ /* 5 means 100 db attenuation. */
+ /* TODO: should this be adopted with bit depth */
+ retval = pow(0.1, (1 - findex) * 5);
+ break;
+
+ case FADE_PAR : /* inverted parabola */
+ retval = (1 - (1 - findex) * (1 - findex));
+ break;
+
+ /* TODO: more fade curves? */
+ default : /* Error indicating wrong fade curve */
+ retval = -1.0;
+ break;
+ }
+
+ return retval;
+}
+
+static sox_effect_handler_t sox_fade_effect = {
+ "fade",
+ "[ type ] fade-in-length [ stop-position [ fade-out-length ] ]\n"
+ " Time is in hh:mm:ss.frac format.\n"
+ " Fade type one of q, h, t, l or p.",
+ SOX_EFF_MCHAN | SOX_EFF_LENGTH,
+ sox_fade_getopts,
+ sox_fade_start,
+ sox_fade_flow,
+ sox_fade_drain,
+ NULL,
+ lsx_kill, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_fade_effect_fn(void)
+{
+ return &sox_fade_effect;
+}
diff --git a/src/src/fap.c b/src/src/fap.c
new file mode 100644
index 0000000..1c4c425
--- /dev/null
+++ b/src/src/fap.c
@@ -0,0 +1,35 @@
+/* libSoX file format: FAP Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(fap)
+{
+ static char const * const names[] = {"fap", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 24, 16, 8,0,0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description =
+ "Ensoniq PARIS digitial audio editing system (little endian)";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/fft4g.c b/src/src/fft4g.c
new file mode 100644
index 0000000..e83f531
--- /dev/null
+++ b/src/src/fft4g.c
@@ -0,0 +1,1344 @@
+/* Copyright Takuya OOURA, 1996-2001.
+
+You may use, copy, modify and distribute this code for any
+purpose (include commercial use) and without fee. Please
+refer to this package when you modify this code.
+
+Package home: http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
+
+Fast Fourier/Cosine/Sine Transform
+ dimension :one
+ data length :power of 2
+ decimation :frequency
+ radix :4, 2
+ data :inplace
+ table :use
+functions
+ cdft: Complex Discrete Fourier Transform
+ rdft: Real Discrete Fourier Transform
+ ddct: Discrete Cosine Transform
+ ddst: Discrete Sine Transform
+ dfct: Cosine Transform of RDFT (Real Symmetric DFT)
+ dfst: Sine Transform of RDFT (Real Anti-symmetric DFT)
+function prototypes
+ void cdft(int, int, double *, int *, double *);
+ void rdft(int, int, double *, int *, double *);
+ void ddct(int, int, double *, int *, double *);
+ void ddst(int, int, double *, int *, double *);
+ void dfct(int, double *, double *, int *, double *);
+ void dfst(int, double *, double *, int *, double *);
+
+
+-------- Complex DFT (Discrete Fourier Transform) --------
+ [definition]
+ <case1>
+ X[k] = sum_j=0^n-1 x[j]*exp(2*pi*i*j*k/n), 0<=k<n
+ <case2>
+ X[k] = sum_j=0^n-1 x[j]*exp(-2*pi*i*j*k/n), 0<=k<n
+ (notes: sum_j=0^n-1 is a summation from j=0 to n-1)
+ [usage]
+ <case1>
+ ip[0] = 0; // first time only
+ cdft(2*n, 1, a, ip, w);
+ <case2>
+ ip[0] = 0; // first time only
+ cdft(2*n, -1, a, ip, w);
+ [parameters]
+ 2*n :data length (int)
+ n >= 1, n = power of 2
+ a[0...2*n-1] :input/output data (double *)
+ input data
+ a[2*j] = Re(x[j]),
+ a[2*j+1] = Im(x[j]), 0<=j<n
+ output data
+ a[2*k] = Re(X[k]),
+ a[2*k+1] = Im(X[k]), 0<=k<n
+ ip[0...*] :work area for bit reversal (int *)
+ length of ip >= 2+sqrt(n)
+ strictly,
+ length of ip >=
+ 2+(1<<(int)(log(n+0.5)/log(2))/2).
+ ip[0],ip[1] are pointers of the cos/sin table.
+ w[0...n/2-1] :cos/sin table (double *)
+ w[],ip[] are initialized if ip[0] == 0.
+ [remark]
+ Inverse of
+ cdft(2*n, -1, a, ip, w);
+ is
+ cdft(2*n, 1, a, ip, w);
+ for (j = 0; j <= 2 * n - 1; j++) {
+ a[j] *= 1.0 / n;
+ }
+ .
+
+
+-------- Real DFT / Inverse of Real DFT --------
+ [definition]
+ <case1> RDFT
+ R[k] = sum_j=0^n-1 a[j]*cos(2*pi*j*k/n), 0<=k<=n/2
+ I[k] = sum_j=0^n-1 a[j]*sin(2*pi*j*k/n), 0<k<n/2
+ <case2> IRDFT (excluding scale)
+ a[k] = (R[0] + R[n/2]*cos(pi*k))/2 +
+ sum_j=1^n/2-1 R[j]*cos(2*pi*j*k/n) +
+ sum_j=1^n/2-1 I[j]*sin(2*pi*j*k/n), 0<=k<n
+ [usage]
+ <case1>
+ ip[0] = 0; // first time only
+ rdft(n, 1, a, ip, w);
+ <case2>
+ ip[0] = 0; // first time only
+ rdft(n, -1, a, ip, w);
+ [parameters]
+ n :data length (int)
+ n >= 2, n = power of 2
+ a[0...n-1] :input/output data (double *)
+ <case1>
+ output data
+ a[2*k] = R[k], 0<=k<n/2
+ a[2*k+1] = I[k], 0<k<n/2
+ a[1] = R[n/2]
+ <case2>
+ input data
+ a[2*j] = R[j], 0<=j<n/2
+ a[2*j+1] = I[j], 0<j<n/2
+ a[1] = R[n/2]
+ ip[0...*] :work area for bit reversal (int *)
+ length of ip >= 2+sqrt(n/2)
+ strictly,
+ length of ip >=
+ 2+(1<<(int)(log(n/2+0.5)/log(2))/2).
+ ip[0],ip[1] are pointers of the cos/sin table.
+ w[0...n/2-1] :cos/sin table (double *)
+ w[],ip[] are initialized if ip[0] == 0.
+ [remark]
+ Inverse of
+ rdft(n, 1, a, ip, w);
+ is
+ rdft(n, -1, a, ip, w);
+ for (j = 0; j <= n - 1; j++) {
+ a[j] *= 2.0 / n;
+ }
+ .
+
+
+-------- DCT (Discrete Cosine Transform) / Inverse of DCT --------
+ [definition]
+ <case1> IDCT (excluding scale)
+ C[k] = sum_j=0^n-1 a[j]*cos(pi*j*(k+1/2)/n), 0<=k<n
+ <case2> DCT
+ C[k] = sum_j=0^n-1 a[j]*cos(pi*(j+1/2)*k/n), 0<=k<n
+ [usage]
+ <case1>
+ ip[0] = 0; // first time only
+ ddct(n, 1, a, ip, w);
+ <case2>
+ ip[0] = 0; // first time only
+ ddct(n, -1, a, ip, w);
+ [parameters]
+ n :data length (int)
+ n >= 2, n = power of 2
+ a[0...n-1] :input/output data (double *)
+ output data
+ a[k] = C[k], 0<=k<n
+ ip[0...*] :work area for bit reversal (int *)
+ length of ip >= 2+sqrt(n/2)
+ strictly,
+ length of ip >=
+ 2+(1<<(int)(log(n/2+0.5)/log(2))/2).
+ ip[0],ip[1] are pointers of the cos/sin table.
+ w[0...n*5/4-1] :cos/sin table (double *)
+ w[],ip[] are initialized if ip[0] == 0.
+ [remark]
+ Inverse of
+ ddct(n, -1, a, ip, w);
+ is
+ a[0] *= 0.5;
+ ddct(n, 1, a, ip, w);
+ for (j = 0; j <= n - 1; j++) {
+ a[j] *= 2.0 / n;
+ }
+ .
+
+
+-------- DST (Discrete Sine Transform) / Inverse of DST --------
+ [definition]
+ <case1> IDST (excluding scale)
+ S[k] = sum_j=1^n A[j]*sin(pi*j*(k+1/2)/n), 0<=k<n
+ <case2> DST
+ S[k] = sum_j=0^n-1 a[j]*sin(pi*(j+1/2)*k/n), 0<k<=n
+ [usage]
+ <case1>
+ ip[0] = 0; // first time only
+ ddst(n, 1, a, ip, w);
+ <case2>
+ ip[0] = 0; // first time only
+ ddst(n, -1, a, ip, w);
+ [parameters]
+ n :data length (int)
+ n >= 2, n = power of 2
+ a[0...n-1] :input/output data (double *)
+ <case1>
+ input data
+ a[j] = A[j], 0<j<n
+ a[0] = A[n]
+ output data
+ a[k] = S[k], 0<=k<n
+ <case2>
+ output data
+ a[k] = S[k], 0<k<n
+ a[0] = S[n]
+ ip[0...*] :work area for bit reversal (int *)
+ length of ip >= 2+sqrt(n/2)
+ strictly,
+ length of ip >=
+ 2+(1<<(int)(log(n/2+0.5)/log(2))/2).
+ ip[0],ip[1] are pointers of the cos/sin table.
+ w[0...n*5/4-1] :cos/sin table (double *)
+ w[],ip[] are initialized if ip[0] == 0.
+ [remark]
+ Inverse of
+ ddst(n, -1, a, ip, w);
+ is
+ a[0] *= 0.5;
+ ddst(n, 1, a, ip, w);
+ for (j = 0; j <= n - 1; j++) {
+ a[j] *= 2.0 / n;
+ }
+ .
+
+
+-------- Cosine Transform of RDFT (Real Symmetric DFT) --------
+ [definition]
+ C[k] = sum_j=0^n a[j]*cos(pi*j*k/n), 0<=k<=n
+ [usage]
+ ip[0] = 0; // first time only
+ dfct(n, a, t, ip, w);
+ [parameters]
+ n :data length - 1 (int)
+ n >= 2, n = power of 2
+ a[0...n] :input/output data (double *)
+ output data
+ a[k] = C[k], 0<=k<=n
+ t[0...n/2] :work area (double *)
+ ip[0...*] :work area for bit reversal (int *)
+ length of ip >= 2+sqrt(n/4)
+ strictly,
+ length of ip >=
+ 2+(1<<(int)(log(n/4+0.5)/log(2))/2).
+ ip[0],ip[1] are pointers of the cos/sin table.
+ w[0...n*5/8-1] :cos/sin table (double *)
+ w[],ip[] are initialized if ip[0] == 0.
+ [remark]
+ Inverse of
+ a[0] *= 0.5;
+ a[n] *= 0.5;
+ dfct(n, a, t, ip, w);
+ is
+ a[0] *= 0.5;
+ a[n] *= 0.5;
+ dfct(n, a, t, ip, w);
+ for (j = 0; j <= n; j++) {
+ a[j] *= 2.0 / n;
+ }
+ .
+
+
+-------- Sine Transform of RDFT (Real Anti-symmetric DFT) --------
+ [definition]
+ S[k] = sum_j=1^n-1 a[j]*sin(pi*j*k/n), 0<k<n
+ [usage]
+ ip[0] = 0; // first time only
+ dfst(n, a, t, ip, w);
+ [parameters]
+ n :data length + 1 (int)
+ n >= 2, n = power of 2
+ a[0...n-1] :input/output data (double *)
+ output data
+ a[k] = S[k], 0<k<n
+ (a[0] is used for work area)
+ t[0...n/2-1] :work area (double *)
+ ip[0...*] :work area for bit reversal (int *)
+ length of ip >= 2+sqrt(n/4)
+ strictly,
+ length of ip >=
+ 2+(1<<(int)(log(n/4+0.5)/log(2))/2).
+ ip[0],ip[1] are pointers of the cos/sin table.
+ w[0...n*5/8-1] :cos/sin table (double *)
+ w[],ip[] are initialized if ip[0] == 0.
+ [remark]
+ Inverse of
+ dfst(n, a, t, ip, w);
+ is
+ dfst(n, a, t, ip, w);
+ for (j = 1; j <= n - 1; j++) {
+ a[j] *= 2.0 / n;
+ }
+ .
+
+
+Appendix :
+ The cos/sin table is recalculated when the larger table required.
+ w[] and ip[] are compatible with all routines.
+*/
+
+
+#include <math.h>
+#include "third_party/sox/src/src/fft4g.h"
+
+#ifdef FFT4G_FLOAT
+ #define double float
+ #define sin sinf
+ #define cos cosf
+ #define atan atanf
+
+ #define cdft lsx_cdft_f
+ #define rdft lsx_rdft_f
+ #define ddct lsx_ddct_f
+ #define ddst lsx_ddst_f
+ #define dfct lsx_dfct_f
+ #define dfst lsx_dfst_f
+#else
+ #define cdft lsx_cdft
+ #define rdft lsx_rdft
+ #define ddct lsx_ddct
+ #define ddst lsx_ddst
+ #define dfct lsx_dfct
+ #define dfst lsx_dfst
+#endif
+
+static void bitrv2conj(int n, int *ip, double *a);
+static void bitrv2(int n, int *ip, double *a);
+static void cft1st(int n, double *a, double const *w);
+static void cftbsub(int n, double *a, double const *w);
+static void cftfsub(int n, double *a, double const *w);
+static void cftmdl(int n, int l, double *a, double const *w);
+static void dctsub(int n, double *a, int nc, double const *c);
+static void dstsub(int n, double *a, int nc, double const *c);
+static void makect(int nc, int *ip, double *c);
+static void makewt(int nw, int *ip, double *w);
+static void rftbsub(int n, double *a, int nc, double const *c);
+static void rftfsub(int n, double *a, int nc, double const *c);
+
+
+void cdft(int n, int isgn, double *a, int *ip, double *w)
+{
+ if (n > (ip[0] << 2)) {
+ makewt(n >> 2, ip, w);
+ }
+ if (n > 4) {
+ if (isgn >= 0) {
+ bitrv2(n, ip + 2, a);
+ cftfsub(n, a, w);
+ } else {
+ bitrv2conj(n, ip + 2, a);
+ cftbsub(n, a, w);
+ }
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+}
+
+
+void rdft(int n, int isgn, double *a, int *ip, double *w)
+{
+ int nw, nc;
+ double xi;
+
+ nw = ip[0];
+ if (n > (nw << 2)) {
+ nw = n >> 2;
+ makewt(nw, ip, w);
+ }
+ nc = ip[1];
+ if (n > (nc << 2)) {
+ nc = n >> 2;
+ makect(nc, ip, w + nw);
+ }
+ if (isgn >= 0) {
+ if (n > 4) {
+ bitrv2(n, ip + 2, a);
+ cftfsub(n, a, w);
+ rftfsub(n, a, nc, w + nw);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ xi = a[0] - a[1];
+ a[0] += a[1];
+ a[1] = xi;
+ } else {
+ a[1] = 0.5 * (a[0] - a[1]);
+ a[0] -= a[1];
+ if (n > 4) {
+ rftbsub(n, a, nc, w + nw);
+ bitrv2(n, ip + 2, a);
+ cftbsub(n, a, w);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ }
+}
+
+
+void ddct(int n, int isgn, double *a, int *ip, double *w)
+{
+ int j, nw, nc;
+ double xr;
+
+ nw = ip[0];
+ if (n > (nw << 2)) {
+ nw = n >> 2;
+ makewt(nw, ip, w);
+ }
+ nc = ip[1];
+ if (n > nc) {
+ nc = n;
+ makect(nc, ip, w + nw);
+ }
+ if (isgn < 0) {
+ xr = a[n - 1];
+ for (j = n - 2; j >= 2; j -= 2) {
+ a[j + 1] = a[j] - a[j - 1];
+ a[j] += a[j - 1];
+ }
+ a[1] = a[0] - xr;
+ a[0] += xr;
+ if (n > 4) {
+ rftbsub(n, a, nc, w + nw);
+ bitrv2(n, ip + 2, a);
+ cftbsub(n, a, w);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ }
+ dctsub(n, a, nc, w + nw);
+ if (isgn >= 0) {
+ if (n > 4) {
+ bitrv2(n, ip + 2, a);
+ cftfsub(n, a, w);
+ rftfsub(n, a, nc, w + nw);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ xr = a[0] - a[1];
+ a[0] += a[1];
+ for (j = 2; j < n; j += 2) {
+ a[j - 1] = a[j] - a[j + 1];
+ a[j] += a[j + 1];
+ }
+ a[n - 1] = xr;
+ }
+}
+
+
+void ddst(int n, int isgn, double *a, int *ip, double *w)
+{
+ int j, nw, nc;
+ double xr;
+
+ nw = ip[0];
+ if (n > (nw << 2)) {
+ nw = n >> 2;
+ makewt(nw, ip, w);
+ }
+ nc = ip[1];
+ if (n > nc) {
+ nc = n;
+ makect(nc, ip, w + nw);
+ }
+ if (isgn < 0) {
+ xr = a[n - 1];
+ for (j = n - 2; j >= 2; j -= 2) {
+ a[j + 1] = -a[j] - a[j - 1];
+ a[j] -= a[j - 1];
+ }
+ a[1] = a[0] + xr;
+ a[0] -= xr;
+ if (n > 4) {
+ rftbsub(n, a, nc, w + nw);
+ bitrv2(n, ip + 2, a);
+ cftbsub(n, a, w);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ }
+ dstsub(n, a, nc, w + nw);
+ if (isgn >= 0) {
+ if (n > 4) {
+ bitrv2(n, ip + 2, a);
+ cftfsub(n, a, w);
+ rftfsub(n, a, nc, w + nw);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ xr = a[0] - a[1];
+ a[0] += a[1];
+ for (j = 2; j < n; j += 2) {
+ a[j - 1] = -a[j] - a[j + 1];
+ a[j] -= a[j + 1];
+ }
+ a[n - 1] = -xr;
+ }
+}
+
+
+void dfct(int n, double *a, double *t, int *ip, double *w)
+{
+ int j, k, l, m, mh, nw, nc;
+ double xr, xi, yr, yi;
+
+ nw = ip[0];
+ if (n > (nw << 3)) {
+ nw = n >> 3;
+ makewt(nw, ip, w);
+ }
+ nc = ip[1];
+ if (n > (nc << 1)) {
+ nc = n >> 1;
+ makect(nc, ip, w + nw);
+ }
+ m = n >> 1;
+ yi = a[m];
+ xi = a[0] + a[n];
+ a[0] -= a[n];
+ t[0] = xi - yi;
+ t[m] = xi + yi;
+ if (n > 2) {
+ mh = m >> 1;
+ for (j = 1; j < mh; j++) {
+ k = m - j;
+ xr = a[j] - a[n - j];
+ xi = a[j] + a[n - j];
+ yr = a[k] - a[n - k];
+ yi = a[k] + a[n - k];
+ a[j] = xr;
+ a[k] = yr;
+ t[j] = xi - yi;
+ t[k] = xi + yi;
+ }
+ t[mh] = a[mh] + a[n - mh];
+ a[mh] -= a[n - mh];
+ dctsub(m, a, nc, w + nw);
+ if (m > 4) {
+ bitrv2(m, ip + 2, a);
+ cftfsub(m, a, w);
+ rftfsub(m, a, nc, w + nw);
+ } else if (m == 4) {
+ cftfsub(m, a, w);
+ }
+ a[n - 1] = a[0] - a[1];
+ a[1] = a[0] + a[1];
+ for (j = m - 2; j >= 2; j -= 2) {
+ a[2 * j + 1] = a[j] + a[j + 1];
+ a[2 * j - 1] = a[j] - a[j + 1];
+ }
+ l = 2;
+ m = mh;
+ while (m >= 2) {
+ dctsub(m, t, nc, w + nw);
+ if (m > 4) {
+ bitrv2(m, ip + 2, t);
+ cftfsub(m, t, w);
+ rftfsub(m, t, nc, w + nw);
+ } else if (m == 4) {
+ cftfsub(m, t, w);
+ }
+ a[n - l] = t[0] - t[1];
+ a[l] = t[0] + t[1];
+ k = 0;
+ for (j = 2; j < m; j += 2) {
+ k += l << 2;
+ a[k - l] = t[j] - t[j + 1];
+ a[k + l] = t[j] + t[j + 1];
+ }
+ l <<= 1;
+ mh = m >> 1;
+ for (j = 0; j < mh; j++) {
+ k = m - j;
+ t[j] = t[m + k] - t[m + j];
+ t[k] = t[m + k] + t[m + j];
+ }
+ t[mh] = t[m + mh];
+ m = mh;
+ }
+ a[l] = t[0];
+ a[n] = t[2] - t[1];
+ a[0] = t[2] + t[1];
+ } else {
+ a[1] = a[0];
+ a[2] = t[0];
+ a[0] = t[1];
+ }
+}
+
+
+void dfst(int n, double *a, double *t, int *ip, double *w)
+{
+ int j, k, l, m, mh, nw, nc;
+ double xr, xi, yr, yi;
+
+ nw = ip[0];
+ if (n > (nw << 3)) {
+ nw = n >> 3;
+ makewt(nw, ip, w);
+ }
+ nc = ip[1];
+ if (n > (nc << 1)) {
+ nc = n >> 1;
+ makect(nc, ip, w + nw);
+ }
+ if (n > 2) {
+ m = n >> 1;
+ mh = m >> 1;
+ for (j = 1; j < mh; j++) {
+ k = m - j;
+ xr = a[j] + a[n - j];
+ xi = a[j] - a[n - j];
+ yr = a[k] + a[n - k];
+ yi = a[k] - a[n - k];
+ a[j] = xr;
+ a[k] = yr;
+ t[j] = xi + yi;
+ t[k] = xi - yi;
+ }
+ t[0] = a[mh] - a[n - mh];
+ a[mh] += a[n - mh];
+ a[0] = a[m];
+ dstsub(m, a, nc, w + nw);
+ if (m > 4) {
+ bitrv2(m, ip + 2, a);
+ cftfsub(m, a, w);
+ rftfsub(m, a, nc, w + nw);
+ } else if (m == 4) {
+ cftfsub(m, a, w);
+ }
+ a[n - 1] = a[1] - a[0];
+ a[1] = a[0] + a[1];
+ for (j = m - 2; j >= 2; j -= 2) {
+ a[2 * j + 1] = a[j] - a[j + 1];
+ a[2 * j - 1] = -a[j] - a[j + 1];
+ }
+ l = 2;
+ m = mh;
+ while (m >= 2) {
+ dstsub(m, t, nc, w + nw);
+ if (m > 4) {
+ bitrv2(m, ip + 2, t);
+ cftfsub(m, t, w);
+ rftfsub(m, t, nc, w + nw);
+ } else if (m == 4) {
+ cftfsub(m, t, w);
+ }
+ a[n - l] = t[1] - t[0];
+ a[l] = t[0] + t[1];
+ k = 0;
+ for (j = 2; j < m; j += 2) {
+ k += l << 2;
+ a[k - l] = -t[j] - t[j + 1];
+ a[k + l] = t[j] - t[j + 1];
+ }
+ l <<= 1;
+ mh = m >> 1;
+ for (j = 1; j < mh; j++) {
+ k = m - j;
+ t[j] = t[m + k] + t[m + j];
+ t[k] = t[m + k] - t[m + j];
+ }
+ t[0] = t[m + mh];
+ m = mh;
+ }
+ a[l] = t[0];
+ }
+ a[0] = 0;
+}
+
+
+/* -------- initializing routines -------- */
+
+
+static void makewt(int nw, int *ip, double *w)
+{
+ int j, nwh;
+ double delta, x, y;
+
+ ip[0] = nw;
+ ip[1] = 1;
+ if (nw > 2) {
+ nwh = nw >> 1;
+ delta = atan(1.0) / nwh;
+ w[0] = 1;
+ w[1] = 0;
+ w[nwh] = cos(delta * nwh);
+ w[nwh + 1] = w[nwh];
+ if (nwh > 2) {
+ for (j = 2; j < nwh; j += 2) {
+ x = cos(delta * j);
+ y = sin(delta * j);
+ w[j] = x;
+ w[j + 1] = y;
+ w[nw - j] = y;
+ w[nw - j + 1] = x;
+ }
+ bitrv2(nw, ip + 2, w);
+ }
+ }
+}
+
+
+static void makect(int nc, int *ip, double *c)
+{
+ int j, nch;
+ double delta;
+
+ ip[1] = nc;
+ if (nc > 1) {
+ nch = nc >> 1;
+ delta = atan(1.0) / nch;
+ c[0] = cos(delta * nch);
+ c[nch] = 0.5 * c[0];
+ for (j = 1; j < nch; j++) {
+ c[j] = 0.5 * cos(delta * j);
+ c[nc - j] = 0.5 * sin(delta * j);
+ }
+ }
+}
+
+
+/* -------- child routines -------- */
+
+
+static void bitrv2(int n, int *ip0, double *a)
+{
+ int j, j1, k, k1, l, m, m2, ip[256];
+ double xr, xi, yr, yi;
+
+ (void)ip0;
+ ip[0] = 0;
+ l = n;
+ m = 1;
+ while ((m << 3) < l) {
+ l >>= 1;
+ for (j = 0; j < m; j++) {
+ ip[m + j] = ip[j] + l;
+ }
+ m <<= 1;
+ }
+ m2 = 2 * m;
+ if ((m << 3) == l) {
+ for (k = 0; k < m; k++) {
+ for (j = 0; j < k; j++) {
+ j1 = 2 * j + ip[k];
+ k1 = 2 * k + ip[j];
+ xr = a[j1];
+ xi = a[j1 + 1];
+ yr = a[k1];
+ yi = a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 += 2 * m2;
+ xr = a[j1];
+ xi = a[j1 + 1];
+ yr = a[k1];
+ yi = a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 -= m2;
+ xr = a[j1];
+ xi = a[j1 + 1];
+ yr = a[k1];
+ yi = a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 += 2 * m2;
+ xr = a[j1];
+ xi = a[j1 + 1];
+ yr = a[k1];
+ yi = a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ }
+ j1 = 2 * k + m2 + ip[k];
+ k1 = j1 + m2;
+ xr = a[j1];
+ xi = a[j1 + 1];
+ yr = a[k1];
+ yi = a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ }
+ } else {
+ for (k = 1; k < m; k++) {
+ for (j = 0; j < k; j++) {
+ j1 = 2 * j + ip[k];
+ k1 = 2 * k + ip[j];
+ xr = a[j1];
+ xi = a[j1 + 1];
+ yr = a[k1];
+ yi = a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 += m2;
+ xr = a[j1];
+ xi = a[j1 + 1];
+ yr = a[k1];
+ yi = a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ }
+ }
+ }
+}
+
+
+static void bitrv2conj(int n, int *ip0, double *a)
+{
+ int j, j1, k, k1, l, m, m2, ip[256];
+ double xr, xi, yr, yi;
+
+ (void)ip0;
+ ip[0] = 0;
+ l = n;
+ m = 1;
+ while ((m << 3) < l) {
+ l >>= 1;
+ for (j = 0; j < m; j++) {
+ ip[m + j] = ip[j] + l;
+ }
+ m <<= 1;
+ }
+ m2 = 2 * m;
+ if ((m << 3) == l) {
+ for (k = 0; k < m; k++) {
+ for (j = 0; j < k; j++) {
+ j1 = 2 * j + ip[k];
+ k1 = 2 * k + ip[j];
+ xr = a[j1];
+ xi = -a[j1 + 1];
+ yr = a[k1];
+ yi = -a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 += 2 * m2;
+ xr = a[j1];
+ xi = -a[j1 + 1];
+ yr = a[k1];
+ yi = -a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 -= m2;
+ xr = a[j1];
+ xi = -a[j1 + 1];
+ yr = a[k1];
+ yi = -a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 += 2 * m2;
+ xr = a[j1];
+ xi = -a[j1 + 1];
+ yr = a[k1];
+ yi = -a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ }
+ k1 = 2 * k + ip[k];
+ a[k1 + 1] = -a[k1 + 1];
+ j1 = k1 + m2;
+ k1 = j1 + m2;
+ xr = a[j1];
+ xi = -a[j1 + 1];
+ yr = a[k1];
+ yi = -a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ k1 += m2;
+ a[k1 + 1] = -a[k1 + 1];
+ }
+ } else {
+ a[1] = -a[1];
+ a[m2 + 1] = -a[m2 + 1];
+ for (k = 1; k < m; k++) {
+ for (j = 0; j < k; j++) {
+ j1 = 2 * j + ip[k];
+ k1 = 2 * k + ip[j];
+ xr = a[j1];
+ xi = -a[j1 + 1];
+ yr = a[k1];
+ yi = -a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 += m2;
+ xr = a[j1];
+ xi = -a[j1 + 1];
+ yr = a[k1];
+ yi = -a[k1 + 1];
+ a[j1] = yr;
+ a[j1 + 1] = yi;
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ }
+ k1 = 2 * k + ip[k];
+ a[k1 + 1] = -a[k1 + 1];
+ a[k1 + m2 + 1] = -a[k1 + m2 + 1];
+ }
+ }
+}
+
+
+static void cftfsub(int n, double *a, double const *w)
+{
+ int j, j1, j2, j3, l;
+ double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+ l = 2;
+ if (n > 8) {
+ cft1st(n, a, w);
+ l = 8;
+ while ((l << 2) < n) {
+ cftmdl(n, l, a, w);
+ l <<= 2;
+ }
+ }
+ if ((l << 2) == n) {
+ for (j = 0; j < l; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ a[j2] = x0r - x2r;
+ a[j2 + 1] = x0i - x2i;
+ a[j1] = x1r - x3i;
+ a[j1 + 1] = x1i + x3r;
+ a[j3] = x1r + x3i;
+ a[j3 + 1] = x1i - x3r;
+ }
+ } else {
+ for (j = 0; j < l; j += 2) {
+ j1 = j + l;
+ x0r = a[j] - a[j1];
+ x0i = a[j + 1] - a[j1 + 1];
+ a[j] += a[j1];
+ a[j + 1] += a[j1 + 1];
+ a[j1] = x0r;
+ a[j1 + 1] = x0i;
+ }
+ }
+}
+
+
+static void cftbsub(int n, double *a, double const *w)
+{
+ int j, j1, j2, j3, l;
+ double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+ l = 2;
+ if (n > 8) {
+ cft1st(n, a, w);
+ l = 8;
+ while ((l << 2) < n) {
+ cftmdl(n, l, a, w);
+ l <<= 2;
+ }
+ }
+ if ((l << 2) == n) {
+ for (j = 0; j < l; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = -a[j + 1] - a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = -a[j + 1] + a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i - x2i;
+ a[j2] = x0r - x2r;
+ a[j2 + 1] = x0i + x2i;
+ a[j1] = x1r - x3i;
+ a[j1 + 1] = x1i - x3r;
+ a[j3] = x1r + x3i;
+ a[j3 + 1] = x1i + x3r;
+ }
+ } else {
+ for (j = 0; j < l; j += 2) {
+ j1 = j + l;
+ x0r = a[j] - a[j1];
+ x0i = -a[j + 1] + a[j1 + 1];
+ a[j] += a[j1];
+ a[j + 1] = -a[j + 1] - a[j1 + 1];
+ a[j1] = x0r;
+ a[j1 + 1] = x0i;
+ }
+ }
+}
+
+
+static void cft1st(int n, double *a, double const *w)
+{
+ int j, k1, k2;
+ double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
+ double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+ x0r = a[0] + a[2];
+ x0i = a[1] + a[3];
+ x1r = a[0] - a[2];
+ x1i = a[1] - a[3];
+ x2r = a[4] + a[6];
+ x2i = a[5] + a[7];
+ x3r = a[4] - a[6];
+ x3i = a[5] - a[7];
+ a[0] = x0r + x2r;
+ a[1] = x0i + x2i;
+ a[4] = x0r - x2r;
+ a[5] = x0i - x2i;
+ a[2] = x1r - x3i;
+ a[3] = x1i + x3r;
+ a[6] = x1r + x3i;
+ a[7] = x1i - x3r;
+ wk1r = w[2];
+ x0r = a[8] + a[10];
+ x0i = a[9] + a[11];
+ x1r = a[8] - a[10];
+ x1i = a[9] - a[11];
+ x2r = a[12] + a[14];
+ x2i = a[13] + a[15];
+ x3r = a[12] - a[14];
+ x3i = a[13] - a[15];
+ a[8] = x0r + x2r;
+ a[9] = x0i + x2i;
+ a[12] = x2i - x0i;
+ a[13] = x0r - x2r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[10] = wk1r * (x0r - x0i);
+ a[11] = wk1r * (x0r + x0i);
+ x0r = x3i + x1r;
+ x0i = x3r - x1i;
+ a[14] = wk1r * (x0i - x0r);
+ a[15] = wk1r * (x0i + x0r);
+ k1 = 0;
+ for (j = 16; j < n; j += 16) {
+ k1 += 2;
+ k2 = 2 * k1;
+ wk2r = w[k1];
+ wk2i = w[k1 + 1];
+ wk1r = w[k2];
+ wk1i = w[k2 + 1];
+ wk3r = wk1r - 2 * wk2i * wk1i;
+ wk3i = 2 * wk2i * wk1r - wk1i;
+ x0r = a[j] + a[j + 2];
+ x0i = a[j + 1] + a[j + 3];
+ x1r = a[j] - a[j + 2];
+ x1i = a[j + 1] - a[j + 3];
+ x2r = a[j + 4] + a[j + 6];
+ x2i = a[j + 5] + a[j + 7];
+ x3r = a[j + 4] - a[j + 6];
+ x3i = a[j + 5] - a[j + 7];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ x0r -= x2r;
+ x0i -= x2i;
+ a[j + 4] = wk2r * x0r - wk2i * x0i;
+ a[j + 5] = wk2r * x0i + wk2i * x0r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[j + 2] = wk1r * x0r - wk1i * x0i;
+ a[j + 3] = wk1r * x0i + wk1i * x0r;
+ x0r = x1r + x3i;
+ x0i = x1i - x3r;
+ a[j + 6] = wk3r * x0r - wk3i * x0i;
+ a[j + 7] = wk3r * x0i + wk3i * x0r;
+ wk1r = w[k2 + 2];
+ wk1i = w[k2 + 3];
+ wk3r = wk1r - 2 * wk2r * wk1i;
+ wk3i = 2 * wk2r * wk1r - wk1i;
+ x0r = a[j + 8] + a[j + 10];
+ x0i = a[j + 9] + a[j + 11];
+ x1r = a[j + 8] - a[j + 10];
+ x1i = a[j + 9] - a[j + 11];
+ x2r = a[j + 12] + a[j + 14];
+ x2i = a[j + 13] + a[j + 15];
+ x3r = a[j + 12] - a[j + 14];
+ x3i = a[j + 13] - a[j + 15];
+ a[j + 8] = x0r + x2r;
+ a[j + 9] = x0i + x2i;
+ x0r -= x2r;
+ x0i -= x2i;
+ a[j + 12] = -wk2i * x0r - wk2r * x0i;
+ a[j + 13] = -wk2i * x0i + wk2r * x0r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[j + 10] = wk1r * x0r - wk1i * x0i;
+ a[j + 11] = wk1r * x0i + wk1i * x0r;
+ x0r = x1r + x3i;
+ x0i = x1i - x3r;
+ a[j + 14] = wk3r * x0r - wk3i * x0i;
+ a[j + 15] = wk3r * x0i + wk3i * x0r;
+ }
+}
+
+
+static void cftmdl(int n, int l, double *a, double const *w)
+{
+ int j, j1, j2, j3, k, k1, k2, m, m2;
+ double wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
+ double x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+ m = l << 2;
+ for (j = 0; j < l; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ a[j2] = x0r - x2r;
+ a[j2 + 1] = x0i - x2i;
+ a[j1] = x1r - x3i;
+ a[j1 + 1] = x1i + x3r;
+ a[j3] = x1r + x3i;
+ a[j3 + 1] = x1i - x3r;
+ }
+ wk1r = w[2];
+ for (j = m; j < l + m; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ a[j2] = x2i - x0i;
+ a[j2 + 1] = x0r - x2r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[j1] = wk1r * (x0r - x0i);
+ a[j1 + 1] = wk1r * (x0r + x0i);
+ x0r = x3i + x1r;
+ x0i = x3r - x1i;
+ a[j3] = wk1r * (x0i - x0r);
+ a[j3 + 1] = wk1r * (x0i + x0r);
+ }
+ k1 = 0;
+ m2 = 2 * m;
+ for (k = m2; k < n; k += m2) {
+ k1 += 2;
+ k2 = 2 * k1;
+ wk2r = w[k1];
+ wk2i = w[k1 + 1];
+ wk1r = w[k2];
+ wk1i = w[k2 + 1];
+ wk3r = wk1r - 2 * wk2i * wk1i;
+ wk3i = 2 * wk2i * wk1r - wk1i;
+ for (j = k; j < l + k; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ x0r -= x2r;
+ x0i -= x2i;
+ a[j2] = wk2r * x0r - wk2i * x0i;
+ a[j2 + 1] = wk2r * x0i + wk2i * x0r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[j1] = wk1r * x0r - wk1i * x0i;
+ a[j1 + 1] = wk1r * x0i + wk1i * x0r;
+ x0r = x1r + x3i;
+ x0i = x1i - x3r;
+ a[j3] = wk3r * x0r - wk3i * x0i;
+ a[j3 + 1] = wk3r * x0i + wk3i * x0r;
+ }
+ wk1r = w[k2 + 2];
+ wk1i = w[k2 + 3];
+ wk3r = wk1r - 2 * wk2r * wk1i;
+ wk3i = 2 * wk2r * wk1r - wk1i;
+ for (j = k + m; j < l + (k + m); j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ x0r -= x2r;
+ x0i -= x2i;
+ a[j2] = -wk2i * x0r - wk2r * x0i;
+ a[j2 + 1] = -wk2i * x0i + wk2r * x0r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[j1] = wk1r * x0r - wk1i * x0i;
+ a[j1 + 1] = wk1r * x0i + wk1i * x0r;
+ x0r = x1r + x3i;
+ x0i = x1i - x3r;
+ a[j3] = wk3r * x0r - wk3i * x0i;
+ a[j3 + 1] = wk3r * x0i + wk3i * x0r;
+ }
+ }
+}
+
+
+static void rftfsub(int n, double *a, int nc, double const *c)
+{
+ int j, k, kk, ks, m;
+ double wkr, wki, xr, xi, yr, yi;
+
+ m = n >> 1;
+ ks = 2 * nc / m;
+ kk = 0;
+ for (j = 2; j < m; j += 2) {
+ k = n - j;
+ kk += ks;
+ wkr = 0.5 - c[nc - kk];
+ wki = c[kk];
+ xr = a[j] - a[k];
+ xi = a[j + 1] + a[k + 1];
+ yr = wkr * xr - wki * xi;
+ yi = wkr * xi + wki * xr;
+ a[j] -= yr;
+ a[j + 1] -= yi;
+ a[k] += yr;
+ a[k + 1] -= yi;
+ }
+}
+
+
+static void rftbsub(int n, double *a, int nc, double const *c)
+{
+ int j, k, kk, ks, m;
+ double wkr, wki, xr, xi, yr, yi;
+
+ a[1] = -a[1];
+ m = n >> 1;
+ ks = 2 * nc / m;
+ kk = 0;
+ for (j = 2; j < m; j += 2) {
+ k = n - j;
+ kk += ks;
+ wkr = 0.5 - c[nc - kk];
+ wki = c[kk];
+ xr = a[j] - a[k];
+ xi = a[j + 1] + a[k + 1];
+ yr = wkr * xr + wki * xi;
+ yi = wkr * xi - wki * xr;
+ a[j] -= yr;
+ a[j + 1] = yi - a[j + 1];
+ a[k] += yr;
+ a[k + 1] = yi - a[k + 1];
+ }
+ a[m + 1] = -a[m + 1];
+}
+
+
+static void dctsub(int n, double *a, int nc, double const *c)
+{
+ int j, k, kk, ks, m;
+ double wkr, wki, xr;
+
+ m = n >> 1;
+ ks = nc / n;
+ kk = 0;
+ for (j = 1; j < m; j++) {
+ k = n - j;
+ kk += ks;
+ wkr = c[kk] - c[nc - kk];
+ wki = c[kk] + c[nc - kk];
+ xr = wki * a[j] - wkr * a[k];
+ a[j] = wkr * a[j] + wki * a[k];
+ a[k] = xr;
+ }
+ a[m] *= c[0];
+}
+
+
+static void dstsub(int n, double *a, int nc, double const *c)
+{
+ int j, k, kk, ks, m;
+ double wkr, wki, xr;
+
+ m = n >> 1;
+ ks = nc / n;
+ kk = 0;
+ for (j = 1; j < m; j++) {
+ k = n - j;
+ kk += ks;
+ wkr = c[kk] - c[nc - kk];
+ wki = c[kk] + c[nc - kk];
+ xr = wki * a[k] - wkr * a[j];
+ a[k] = wkr * a[k] + wki * a[j];
+ a[j] = xr;
+ }
+ a[m] *= c[0];
+}
+
diff --git a/src/src/fft4g.h b/src/src/fft4g.h
new file mode 100644
index 0000000..2b8051c
--- /dev/null
+++ b/src/src/fft4g.h
@@ -0,0 +1,35 @@
+/* This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+void lsx_cdft(int, int, double *, int *, double *);
+void lsx_rdft(int, int, double *, int *, double *);
+void lsx_ddct(int, int, double *, int *, double *);
+void lsx_ddst(int, int, double *, int *, double *);
+void lsx_dfct(int, double *, double *, int *, double *);
+void lsx_dfst(int, double *, double *, int *, double *);
+
+void lsx_cdft_f(int, int, float *, int *, float *);
+void lsx_rdft_f(int, int, float *, int *, float *);
+void lsx_ddct_f(int, int, float *, int *, float *);
+void lsx_ddst_f(int, int, float *, int *, float *);
+void lsx_dfct_f(int, float *, float *, int *, float *);
+void lsx_dfst_f(int, float *, float *, int *, float *);
+
+#define dft_br_len(l) (2 + (1 << (int)(log(l / 2 + .5) / log(2.)) / 2))
+#define dft_sc_len(l) (l / 2)
+
+/* Over-allocate h by 2 to use these macros */
+#define LSX_PACK(h, n) h[1] = h[n]
+#define LSX_UNPACK(h, n) h[n] = h[1], h[n + 1] = h[1] = 0;
diff --git a/src/src/fifo.h b/src/src/fifo.h
new file mode 100644
index 0000000..2e65afa
--- /dev/null
+++ b/src/src/fifo.h
@@ -0,0 +1,119 @@
+/* Addressable FIFO buffer Copyright (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef fifo_included
+#define fifo_included
+
+#include <string.h>
+
+#ifndef FIFO_SIZE_T
+#define FIFO_SIZE_T size_t
+#endif
+
+typedef struct {
+ char * data;
+ size_t allocation; /* Number of bytes allocated for data. */
+ size_t item_size; /* Size of each item in data */
+ size_t begin; /* Offset of the first byte to read. */
+ size_t end; /* 1 + Offset of the last byte byte to read. */
+} fifo_t;
+
+#define FIFO_MIN 0x4000
+
+UNUSED static void fifo_clear(fifo_t * f)
+{
+ f->end = f->begin = 0;
+}
+
+UNUSED static void * fifo_reserve(fifo_t * f, FIFO_SIZE_T n)
+{
+ n *= f->item_size;
+
+ if (f->begin == f->end)
+ fifo_clear(f);
+
+ while (1) {
+ if (f->end + n <= f->allocation) {
+ void *p = f->data + f->end;
+
+ f->end += n;
+ return p;
+ }
+ if (f->begin > FIFO_MIN) {
+ memmove(f->data, f->data + f->begin, f->end - f->begin);
+ f->end -= f->begin;
+ f->begin = 0;
+ continue;
+ }
+ f->allocation += n;
+ f->data = lsx_realloc(f->data, f->allocation);
+ }
+}
+
+UNUSED static void * fifo_write(fifo_t * f, FIFO_SIZE_T n, void const * data)
+{
+ void * s = fifo_reserve(f, n);
+ if (data)
+ memcpy(s, data, n * f->item_size);
+ return s;
+}
+
+UNUSED static void fifo_trim_to(fifo_t * f, FIFO_SIZE_T n)
+{
+ n *= f->item_size;
+ f->end = f->begin + n;
+}
+
+UNUSED static void fifo_trim_by(fifo_t * f, FIFO_SIZE_T n)
+{
+ n *= f->item_size;
+ f->end -= n;
+}
+
+UNUSED static FIFO_SIZE_T fifo_occupancy(fifo_t * f)
+{
+ return (f->end - f->begin) / f->item_size;
+}
+
+UNUSED static void * fifo_read(fifo_t * f, FIFO_SIZE_T n, void * data)
+{
+ char * ret = f->data + f->begin;
+ n *= f->item_size;
+ if (n > (FIFO_SIZE_T)(f->end - f->begin))
+ return NULL;
+ if (data)
+ memcpy(data, ret, (size_t)n);
+ f->begin += n;
+ return ret;
+}
+
+#define fifo_read_ptr(f) fifo_read(f, (FIFO_SIZE_T)0, NULL)
+
+UNUSED static void fifo_delete(fifo_t * f)
+{
+ free(f->data);
+}
+
+UNUSED static void fifo_create(fifo_t * f, FIFO_SIZE_T item_size)
+{
+ f->item_size = item_size;
+ f->allocation = FIFO_MIN;
+ f->data = lsx_malloc(f->allocation);
+ fifo_clear(f);
+}
+
+#endif
diff --git a/src/src/fir.c b/src/src/fir.c
new file mode 100644
index 0000000..4a05602
--- /dev/null
+++ b/src/src/fir.c
@@ -0,0 +1,105 @@
+/* Effect: fir filter from coefs Copyright (c) 2009 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/dft_filter.h"
+
+typedef struct {
+ dft_filter_priv_t base;
+ char const * filename;
+ double * h;
+ int n;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ dft_filter_priv_t * b = &p->base;
+ double d;
+ char c;
+
+ b->filter_ptr = &b->filter;
+ --argc, ++argv;
+ if (!argc)
+ p->filename = "-"; /* default to stdin */
+ else if (argc == 1)
+ p->filename = argv[0], --argc;
+ else for (; argc && sscanf(*argv, "%lf%c", &d, &c) == 1; --argc, ++argv) {
+ p->n++;
+ p->h = lsx_realloc(p->h, p->n * sizeof(*p->h));
+ p->h[p->n - 1] = d;
+ }
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ dft_filter_t * f = p->base.filter_ptr;
+ double d;
+ char c;
+ int i;
+
+ if (!f->num_taps) {
+ if (!p->n && p->filename) {
+ FILE * file = lsx_open_input_file(effp, p->filename, sox_true);
+ if (!file)
+ return SOX_EOF;
+ while ((i = fscanf(file, " #%*[^\n]%c", &c)) >= 0) {
+ if (i >= 1) continue; /* found and skipped a comment */
+ if ((i = fscanf(file, "%lf", &d)) > 0) {
+ /* found a coefficient value */
+ p->n++;
+ p->h = lsx_realloc(p->h, p->n * sizeof(*p->h));
+ p->h[p->n - 1] = d;
+ } else break; /* either EOF, or something went wrong
+ (read or syntax error) */
+ }
+ if (!feof(file)) {
+ lsx_fail("error reading coefficient file");
+ if (file != stdin) fclose(file);
+ return SOX_EOF;
+ }
+ if (file != stdin) fclose(file);
+ }
+ lsx_report("%i coefficients", p->n);
+ if (!p->n)
+ return SOX_EFF_NULL;
+ if (effp->global_info->plot != sox_plot_off) {
+ char title[100];
+ sprintf(title, "SoX effect: fir (%d coefficients)", p->n);
+ lsx_plot_fir(p->h, p->n, effp->in_signal.rate,
+ effp->global_info->plot, title, -30., 30.);
+ free(p->h);
+ return SOX_EOF;
+ }
+ lsx_set_dft_filter(f, p->h, p->n, p->n >> 1);
+ }
+ return lsx_dft_filter_effect_fn()->start(effp);
+}
+
+sox_effect_handler_t const * lsx_fir_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_dft_filter_effect_fn();
+ handler.name = "fir";
+ handler.usage = "[coef-file|coefs]";
+ handler.getopts = create;
+ handler.start = start;
+ handler.priv_size = sizeof(priv_t);
+ return &handler;
+}
diff --git a/src/src/firfit.c b/src/src/firfit.c
new file mode 100644
index 0000000..7ecec05
--- /dev/null
+++ b/src/src/firfit.c
@@ -0,0 +1,145 @@
+/* Effect: firfit filter Copyright (c) 2009 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* This is W.I.P. hence marked SOX_EFF_ALPHA for now.
+ * Need to add other interpolation types e.g. linear, bspline, window types,
+ * and filter length, maybe phase response type too.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/dft_filter.h"
+
+typedef struct {
+ dft_filter_priv_t base;
+ char const * filename;
+ struct {double f, gain;} * knots;
+ int num_knots, n;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ dft_filter_priv_t * b = &p->base;
+ b->filter_ptr = &b->filter;
+ --argc, ++argv;
+ if (argc == 1)
+ p->filename = argv[0], --argc;
+ p->n = 2047;
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static double * make_filter(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ double * log_freqs, * gains, * d, * work, * h;
+ sox_rate_t rate = effp->in_signal.rate;
+ int i, work_len;
+
+ lsx_valloc(log_freqs , p->num_knots);
+ lsx_valloc(gains, p->num_knots);
+ lsx_valloc(d , p->num_knots);
+ for (i = 0; i < p->num_knots; ++i) {
+ log_freqs[i] = log(max(p->knots[i].f, 1));
+ gains[i] = p->knots[i].gain;
+ }
+ lsx_prepare_spline3(log_freqs, gains, p->num_knots, HUGE_VAL, HUGE_VAL, d);
+
+ for (work_len = 8192; work_len < rate / 2; work_len <<= 1);
+ work = lsx_calloc(work_len + 2, sizeof(*work));
+ lsx_valloc(h, p->n);
+
+ for (i = 0; i <= work_len; i += 2) {
+ double f = rate * 0.5 * i / work_len;
+ double spl1 = f < max(p->knots[0].f, 1)? gains[0] :
+ f > p->knots[p->num_knots - 1].f? gains[p->num_knots - 1] :
+ lsx_spline3(log_freqs, gains, d, p->num_knots, log(f));
+ work[i] = dB_to_linear(spl1);
+ }
+ LSX_PACK(work, work_len);
+ lsx_safe_rdft(work_len, -1, work);
+ for (i = 0; i < p->n; ++i)
+ h[i] = work[(work_len - p->n / 2 + i) % work_len] * 2. / work_len;
+ lsx_apply_blackman_nutall(h, p->n);
+
+ free(work);
+ return h;
+}
+
+static sox_bool read_knots(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ FILE * file = lsx_open_input_file(effp, p->filename, sox_true);
+ sox_bool result = sox_false;
+ int num_converted = 1;
+ char c;
+
+ if (file) {
+ lsx_valloc(p->knots, 1);
+ while (fscanf(file, " #%*[^\n]%c", &c) >= 0) {
+ num_converted = fscanf(file, "%lf %lf",
+ &p->knots[p->num_knots].f, &p->knots[p->num_knots].gain);
+ if (num_converted == 2) {
+ if (p->num_knots && p->knots[p->num_knots].f <= p->knots[p->num_knots - 1].f) {
+ lsx_fail("knot frequencies must be strictly increasing");
+ break;
+ }
+ lsx_revalloc(p->knots, ++p->num_knots + 1);
+ } else if (num_converted != 0)
+ break;
+ }
+ lsx_report("%i knots", p->num_knots);
+ if (feof(file) && num_converted != 1)
+ result = sox_true;
+ else lsx_fail("error reading knot file `%s', line number %u", p->filename, 1 + p->num_knots);
+ if (file != stdin)
+ fclose(file);
+ }
+ return result;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ dft_filter_t * f = p->base.filter_ptr;
+
+ if (!f->num_taps) {
+ double * h;
+ if (!p->num_knots && !read_knots(effp))
+ return SOX_EOF;
+ h = make_filter(effp);
+ if (effp->global_info->plot != sox_plot_off) {
+ lsx_plot_fir(h, p->n, effp->in_signal.rate,
+ effp->global_info->plot, "SoX effect: firfit", -30., +30.);
+ return SOX_EOF;
+ }
+ lsx_set_dft_filter(f, h, p->n, p->n >> 1);
+ }
+ return lsx_dft_filter_effect_fn()->start(effp);
+}
+
+sox_effect_handler_t const * lsx_firfit_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_dft_filter_effect_fn();
+ handler.name = "firfit";
+ handler.usage = "[knots-file]";
+ handler.flags |= SOX_EFF_ALPHA;
+ handler.getopts = create;
+ handler.start = start;
+ handler.priv_size = sizeof(priv_t);
+ return &handler;
+}
diff --git a/src/src/flac.c b/src/src/flac.c
new file mode 100644
index 0000000..eb003db
--- /dev/null
+++ b/src/src/flac.c
@@ -0,0 +1,604 @@
+/* libSoX file format: FLAC (c) 2006-7 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+/* Next line for systems that don't define off_t when you #include
+ stdio.h; apparently OS/2 has this bug */
+#include <sys/types.h>
+
+#include "third_party/flac/src/include/FLAC/all.h"
+
+#define MAX_COMPRESSION 8
+
+
+typedef struct {
+ /* Info: */
+ unsigned bits_per_sample;
+ unsigned channels;
+ unsigned sample_rate;
+ uint64_t total_samples;
+
+ /* Decode buffer: */
+ sox_sample_t *req_buffer; /* this may be on the stack */
+ size_t number_of_requested_samples;
+ sox_sample_t *leftover_buf; /* heap */
+ unsigned number_of_leftover_samples;
+
+ FLAC__StreamDecoder * decoder;
+ FLAC__bool eof;
+ sox_bool seek_pending;
+ uint64_t seek_offset;
+
+ /* Encode buffer: */
+ FLAC__int32 * decoded_samples;
+ unsigned number_of_samples;
+
+ FLAC__StreamEncoder * encoder;
+ FLAC__StreamMetadata * metadata[2];
+ unsigned num_metadata;
+} priv_t;
+
+
+static FLAC__StreamDecoderReadStatus decoder_read_callback(FLAC__StreamDecoder const* decoder UNUSED, FLAC__byte buffer[], size_t* bytes, void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ if(*bytes > 0) {
+ *bytes = lsx_readbuf(ft, buffer, *bytes);
+ if(lsx_error(ft))
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ else if(*bytes == 0)
+ return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+ else
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ }
+ else
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+}
+
+static FLAC__StreamDecoderSeekStatus decoder_seek_callback(FLAC__StreamDecoder const* decoder UNUSED, FLAC__uint64 absolute_byte_offset, void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ if(lsx_seeki(ft, (off_t)absolute_byte_offset, SEEK_SET) < 0)
+ return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
+ else
+ return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
+}
+
+static FLAC__StreamDecoderTellStatus decoder_tell_callback(FLAC__StreamDecoder const* decoder UNUSED, FLAC__uint64* absolute_byte_offset, void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ off_t pos;
+ if((pos = lsx_tell(ft)) < 0)
+ return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
+ else {
+ *absolute_byte_offset = (FLAC__uint64)pos;
+ return FLAC__STREAM_DECODER_TELL_STATUS_OK;
+ }
+}
+
+static FLAC__StreamDecoderLengthStatus decoder_length_callback(FLAC__StreamDecoder const* decoder UNUSED, FLAC__uint64* stream_length, void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ *stream_length = lsx_filelength(ft);
+ return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
+}
+
+static FLAC__bool decoder_eof_callback(FLAC__StreamDecoder const* decoder UNUSED, void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ return lsx_eof(ft) ? 1 : 0;
+}
+
+static void decoder_metadata_callback(FLAC__StreamDecoder const * const flac, FLAC__StreamMetadata const * const metadata, void * const client_data)
+{
+ sox_format_t * ft = (sox_format_t *) client_data;
+ priv_t * p = (priv_t *)ft->priv;
+
+ (void) flac;
+
+ if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
+ p->bits_per_sample = metadata->data.stream_info.bits_per_sample;
+ p->channels = metadata->data.stream_info.channels;
+ p->sample_rate = metadata->data.stream_info.sample_rate;
+ p->total_samples = metadata->data.stream_info.total_samples;
+ }
+ else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
+ size_t i;
+
+ if (metadata->data.vorbis_comment.num_comments == 0)
+ return;
+
+ if (ft->oob.comments != NULL) {
+ lsx_warn("multiple Vorbis comment block ignored");
+ return;
+ }
+
+ for (i = 0; i < metadata->data.vorbis_comment.num_comments; ++i)
+ sox_append_comment(&ft->oob.comments, (char const *) metadata->data.vorbis_comment.comments[i].entry);
+ }
+}
+
+
+
+static void decoder_error_callback(FLAC__StreamDecoder const * const flac, FLAC__StreamDecoderErrorStatus const status, void * const client_data)
+{
+ sox_format_t * ft = (sox_format_t *) client_data;
+
+ (void) flac;
+
+ lsx_fail_errno(ft, SOX_EINVAL, "%s", FLAC__StreamDecoderErrorStatusString[status]);
+}
+
+
+
+static FLAC__StreamDecoderWriteStatus decoder_write_callback(FLAC__StreamDecoder const * const flac, FLAC__Frame const * const frame, FLAC__int32 const * const buffer[], void * const client_data)
+{
+ sox_format_t * ft = (sox_format_t *) client_data;
+ priv_t * p = (priv_t *)ft->priv;
+ sox_sample_t * dst = p->req_buffer;
+ unsigned channel;
+ unsigned nsamples = frame->header.blocksize;
+ unsigned sample = 0;
+ size_t actual = nsamples * p->channels;
+
+ (void) flac;
+
+ if (frame->header.bits_per_sample != p->bits_per_sample || frame->header.channels != p->channels || frame->header.sample_rate != p->sample_rate) {
+ lsx_fail_errno(ft, SOX_EINVAL, "FLAC ERROR: parameters differ between frame and header");
+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+ }
+ if (dst == NULL) {
+ lsx_warn("FLAC ERROR: entered write callback without a buffer (SoX bug)");
+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+ }
+
+ /* FLAC may give us too much data, prepare the leftover buffer */
+ if (actual > p->number_of_requested_samples) {
+ size_t to_stash = actual - p->number_of_requested_samples;
+
+ p->leftover_buf = lsx_malloc(to_stash * sizeof(sox_sample_t));
+ p->number_of_leftover_samples = to_stash;
+ nsamples = p->number_of_requested_samples / p->channels;
+
+ p->req_buffer += p->number_of_requested_samples;
+ p->number_of_requested_samples = 0;
+ } else {
+ p->req_buffer += actual;
+ p->number_of_requested_samples -= actual;
+ }
+
+leftover_copy:
+
+ for (; sample < nsamples; sample++) {
+ for (channel = 0; channel < p->channels; channel++) {
+ FLAC__int32 d = buffer[channel][sample];
+ switch (p->bits_per_sample) {
+ case 8: *dst++ = SOX_SIGNED_8BIT_TO_SAMPLE(d,); break;
+ case 16: *dst++ = SOX_SIGNED_16BIT_TO_SAMPLE(d,); break;
+ case 24: *dst++ = SOX_SIGNED_24BIT_TO_SAMPLE(d,); break;
+ case 32: *dst++ = SOX_SIGNED_32BIT_TO_SAMPLE(d,); break;
+ }
+ }
+ }
+
+ /* copy into the leftover buffer if we've prepared it */
+ if (sample < frame->header.blocksize) {
+ nsamples = frame->header.blocksize;
+ dst = p->leftover_buf;
+ goto leftover_copy;
+ }
+
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+}
+
+
+
+static int start_read(sox_format_t * const ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ lsx_debug("API version %u", FLAC_API_VERSION_CURRENT);
+ p->decoder = FLAC__stream_decoder_new();
+ if (p->decoder == NULL) {
+ lsx_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the decoder instance");
+ return SOX_EOF;
+ }
+
+ FLAC__stream_decoder_set_md5_checking(p->decoder, sox_true);
+ FLAC__stream_decoder_set_metadata_respond_all(p->decoder);
+ if (FLAC__stream_decoder_init_stream(
+ p->decoder,
+ decoder_read_callback,
+ ft->seekable ? decoder_seek_callback : NULL,
+ ft->seekable ? decoder_tell_callback : NULL,
+ ft->seekable ? decoder_length_callback : NULL,
+ ft->seekable ? decoder_eof_callback : NULL,
+ decoder_write_callback,
+ decoder_metadata_callback,
+ decoder_error_callback,
+ ft) != FLAC__STREAM_DECODER_INIT_STATUS_OK){
+ lsx_fail_errno(ft, SOX_EHDR, "FLAC ERROR initialising decoder");
+ return SOX_EOF;
+ }
+
+ if (!FLAC__stream_decoder_process_until_end_of_metadata(p->decoder)) {
+ lsx_fail_errno(ft, SOX_EHDR, "FLAC ERROR whilst decoding metadata");
+ return SOX_EOF;
+ }
+
+ if (FLAC__stream_decoder_get_state(p->decoder) > FLAC__STREAM_DECODER_END_OF_STREAM) {
+ lsx_fail_errno(ft, SOX_EHDR, "FLAC ERROR during metadata decoding");
+ return SOX_EOF;
+ }
+
+ ft->encoding.encoding = SOX_ENCODING_FLAC;
+ ft->signal.rate = p->sample_rate;
+ ft->encoding.bits_per_sample = p->bits_per_sample;
+ ft->signal.channels = p->channels;
+ ft->signal.length = p->total_samples * p->channels;
+ return SOX_SUCCESS;
+}
+
+
+static size_t read_samples(sox_format_t * const ft, sox_sample_t * sampleBuffer, size_t const requested)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t prev_requested;
+
+ if (p->seek_pending) {
+ p->seek_pending = sox_false;
+
+ /* discard leftover decoded data */
+ free(p->leftover_buf);
+ p->leftover_buf = NULL;
+ p->number_of_leftover_samples = 0;
+
+ p->req_buffer = sampleBuffer;
+ p->number_of_requested_samples = requested;
+
+ /* calls decoder_write_callback */
+ if (!FLAC__stream_decoder_seek_absolute(p->decoder, (FLAC__uint64)(p->seek_offset / ft->signal.channels))) {
+ p->req_buffer = NULL;
+ return 0;
+ }
+ } else if (p->number_of_leftover_samples > 0) {
+
+ /* small request, no need to decode more samples since we have leftovers */
+ if (requested < p->number_of_leftover_samples) {
+ size_t req_bytes = requested * sizeof(sox_sample_t);
+
+ memcpy(sampleBuffer, p->leftover_buf, req_bytes);
+ p->number_of_leftover_samples -= requested;
+ memmove(p->leftover_buf, (char *)p->leftover_buf + req_bytes,
+ (size_t)p->number_of_leftover_samples * sizeof(sox_sample_t));
+ return requested;
+ }
+
+ /* first, give them all of our leftover data: */
+ memcpy(sampleBuffer, p->leftover_buf,
+ p->number_of_leftover_samples * sizeof(sox_sample_t));
+
+ p->req_buffer = sampleBuffer + p->number_of_leftover_samples;
+ p->number_of_requested_samples = requested - p->number_of_leftover_samples;
+
+ free(p->leftover_buf);
+ p->leftover_buf = NULL;
+ p->number_of_leftover_samples = 0;
+
+ /* continue invoking decoder below */
+ } else {
+ p->req_buffer = sampleBuffer;
+ p->number_of_requested_samples = requested;
+ }
+
+ /* invoke the decoder, calls decoder_write_callback */
+ while ((prev_requested = p->number_of_requested_samples) && !p->eof) {
+ if (!FLAC__stream_decoder_process_single(p->decoder))
+ break; /* error, but maybe got earlier in the loop, though */
+
+ /* number_of_requested_samples decrements as the decoder progresses */
+ if (p->number_of_requested_samples == prev_requested)
+ p->eof = sox_true;
+ }
+ p->req_buffer = NULL;
+
+ return requested - p->number_of_requested_samples;
+}
+
+
+
+static int stop_read(sox_format_t * const ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ if (!FLAC__stream_decoder_finish(p->decoder) && p->eof)
+ lsx_warn("decoder MD5 checksum mismatch.");
+ FLAC__stream_decoder_delete(p->decoder);
+
+ free(p->leftover_buf);
+ p->leftover_buf = NULL;
+ p->number_of_leftover_samples = 0;
+ return SOX_SUCCESS;
+}
+
+
+
+static FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], size_t const bytes, unsigned const samples, unsigned const current_frame, void * const client_data)
+{
+ sox_format_t * const ft = (sox_format_t *) client_data;
+ (void) flac, (void) samples, (void) current_frame;
+
+ return lsx_writebuf(ft, buffer, bytes) == bytes ? FLAC__STREAM_ENCODER_WRITE_STATUS_OK : FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
+}
+
+
+
+static void flac_stream_encoder_metadata_callback(FLAC__StreamEncoder const * encoder, FLAC__StreamMetadata const * metadata, void * client_data)
+{
+ (void) encoder, (void) metadata, (void) client_data;
+}
+
+
+
+static FLAC__StreamEncoderSeekStatus flac_stream_encoder_seek_callback(FLAC__StreamEncoder const * encoder, FLAC__uint64 absolute_byte_offset, void * client_data)
+{
+ sox_format_t * const ft = (sox_format_t *) client_data;
+ (void) encoder;
+ if (!ft->seekable)
+ return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
+ else if (lsx_seeki(ft, (off_t)absolute_byte_offset, SEEK_SET) != SOX_SUCCESS)
+ return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
+ else
+ return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
+}
+
+
+
+static FLAC__StreamEncoderTellStatus flac_stream_encoder_tell_callback(FLAC__StreamEncoder const * encoder, FLAC__uint64 * absolute_byte_offset, void * client_data)
+{
+ sox_format_t * const ft = (sox_format_t *) client_data;
+ off_t pos;
+ (void) encoder;
+ if (!ft->seekable)
+ return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
+ else if ((pos = lsx_tell(ft)) < 0)
+ return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
+ else {
+ *absolute_byte_offset = (FLAC__uint64)pos;
+ return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
+ }
+}
+
+
+
+static int start_write(sox_format_t * const ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ FLAC__StreamEncoderState status;
+ unsigned compression_level = MAX_COMPRESSION; /* Default to "best" */
+
+ if (ft->encoding.compression != HUGE_VAL) {
+ compression_level = ft->encoding.compression;
+ if (compression_level != ft->encoding.compression ||
+ compression_level > MAX_COMPRESSION) {
+ lsx_fail_errno(ft, SOX_EINVAL,
+ "FLAC compression level must be a whole number from 0 to %i",
+ MAX_COMPRESSION);
+ return SOX_EOF;
+ }
+ }
+
+ p->encoder = FLAC__stream_encoder_new();
+ if (p->encoder == NULL) {
+ lsx_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the encoder instance");
+ return SOX_EOF;
+ }
+
+ p->bits_per_sample = ft->encoding.bits_per_sample;
+ ft->signal.precision = ft->encoding.bits_per_sample;
+
+ lsx_report("encoding at %i bits per sample", p->bits_per_sample);
+
+ FLAC__stream_encoder_set_channels(p->encoder, ft->signal.channels);
+ FLAC__stream_encoder_set_bits_per_sample(p->encoder, p->bits_per_sample);
+ FLAC__stream_encoder_set_sample_rate(p->encoder, (unsigned)(ft->signal.rate + .5));
+
+ { /* Check if rate is streamable: */
+ static const unsigned streamable_rates[] =
+ {8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000};
+ size_t i;
+ sox_bool streamable = sox_false;
+ for (i = 0; !streamable && i < array_length(streamable_rates); ++i)
+ streamable = (streamable_rates[i] == ft->signal.rate);
+ if (!streamable) {
+ lsx_report("non-standard rate; output may not be streamable");
+ FLAC__stream_encoder_set_streamable_subset(p->encoder, sox_false);
+ }
+ }
+
+#if FLAC_API_VERSION_CURRENT >= 10
+ FLAC__stream_encoder_set_compression_level(p->encoder, compression_level);
+#else
+ {
+ static struct {
+ unsigned blocksize;
+ FLAC__bool do_exhaustive_model_search;
+ FLAC__bool do_mid_side_stereo;
+ FLAC__bool loose_mid_side_stereo;
+ unsigned max_lpc_order;
+ unsigned max_residual_partition_order;
+ unsigned min_residual_partition_order;
+ } const options[MAX_COMPRESSION + 1] = {
+ {1152, sox_false, sox_false, sox_false, 0, 2, 2},
+ {1152, sox_false, sox_true, sox_true, 0, 2, 2},
+ {1152, sox_false, sox_true, sox_false, 0, 3, 0},
+ {4608, sox_false, sox_false, sox_false, 6, 3, 3},
+ {4608, sox_false, sox_true, sox_true, 8, 3, 3},
+ {4608, sox_false, sox_true, sox_false, 8, 3, 3},
+ {4608, sox_false, sox_true, sox_false, 8, 4, 0},
+ {4608, sox_true, sox_true, sox_false, 8, 6, 0},
+ {4608, sox_true, sox_true, sox_false, 12, 6, 0},
+ };
+#define SET_OPTION(x) do {\
+ lsx_report(#x" = %i", options[compression_level].x); \
+ FLAC__stream_encoder_set_##x(p->encoder, options[compression_level].x);\
+} while (0)
+ SET_OPTION(blocksize);
+ SET_OPTION(do_exhaustive_model_search);
+ SET_OPTION(max_lpc_order);
+ SET_OPTION(max_residual_partition_order);
+ SET_OPTION(min_residual_partition_order);
+ if (ft->signal.channels == 2) {
+ SET_OPTION(do_mid_side_stereo);
+ SET_OPTION(loose_mid_side_stereo);
+ }
+#undef SET_OPTION
+ }
+#endif
+
+ if (ft->signal.length != 0) {
+ FLAC__stream_encoder_set_total_samples_estimate(p->encoder, (FLAC__uint64)(ft->signal.length / ft->signal.channels));
+
+ p->metadata[p->num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE);
+ if (p->metadata[p->num_metadata] == NULL) {
+ lsx_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the encoder seek table template");
+ return SOX_EOF;
+ }
+ {
+ if (!FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(p->metadata[p->num_metadata], (unsigned)(10 * ft->signal.rate + .5), (FLAC__uint64)(ft->signal.length/ft->signal.channels))) {
+ lsx_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the encoder seek table points");
+ return SOX_EOF;
+ }
+ }
+ p->metadata[p->num_metadata]->is_last = sox_false; /* the encoder will set this for us */
+ ++p->num_metadata;
+ }
+
+ if (ft->oob.comments) { /* Make the comment structure */
+ FLAC__StreamMetadata_VorbisComment_Entry entry;
+ int i;
+
+ p->metadata[p->num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
+ for (i = 0; ft->oob.comments[i]; ++i) {
+ static const char prepend[] = "Comment=";
+ char * text = lsx_calloc(strlen(prepend) + strlen(ft->oob.comments[i]) + 1, sizeof(*text));
+ /* Prepend `Comment=' if no field-name already in the comment */
+ if (!strchr(ft->oob.comments[i], '='))
+ strcpy(text, prepend);
+ entry.entry = (FLAC__byte *) strcat(text, ft->oob.comments[i]);
+ entry.length = strlen(text);
+ FLAC__metadata_object_vorbiscomment_append_comment(p->metadata[p->num_metadata], entry, /*copy= */ sox_true);
+ free(text);
+ }
+ ++p->num_metadata;
+ }
+
+ if (p->num_metadata)
+ FLAC__stream_encoder_set_metadata(p->encoder, p->metadata, p->num_metadata);
+
+ status = FLAC__stream_encoder_init_stream(p->encoder, flac_stream_encoder_write_callback,
+ flac_stream_encoder_seek_callback, flac_stream_encoder_tell_callback, flac_stream_encoder_metadata_callback, ft);
+
+ if (status != FLAC__STREAM_ENCODER_OK) {
+ lsx_fail_errno(ft, SOX_EINVAL, "%s", FLAC__StreamEncoderStateString[status]);
+ return SOX_EOF;
+ }
+ return SOX_SUCCESS;
+}
+
+
+
+static size_t write_samples(sox_format_t * const ft, sox_sample_t const * const sampleBuffer, size_t const len)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ unsigned i;
+
+ /* allocate or grow buffer */
+ if (p->number_of_samples < len) {
+ p->number_of_samples = len;
+ free(p->decoded_samples);
+ p->decoded_samples = lsx_malloc(p->number_of_samples * sizeof(FLAC__int32));
+ }
+
+ for (i = 0; i < len; ++i) {
+ SOX_SAMPLE_LOCALS;
+ long pcm = SOX_SAMPLE_TO_SIGNED_32BIT(sampleBuffer[i], ft->clips);
+ p->decoded_samples[i] = pcm >> (32 - p->bits_per_sample);
+ switch (p->bits_per_sample) {
+ case 8: p->decoded_samples[i] =
+ SOX_SAMPLE_TO_SIGNED_8BIT(sampleBuffer[i], ft->clips);
+ break;
+ case 16: p->decoded_samples[i] =
+ SOX_SAMPLE_TO_SIGNED_16BIT(sampleBuffer[i], ft->clips);
+ break;
+ case 24: p->decoded_samples[i] = /* sign extension: */
+ SOX_SAMPLE_TO_SIGNED_24BIT(sampleBuffer[i],ft->clips) << 8;
+ p->decoded_samples[i] >>= 8;
+ break;
+ case 32: p->decoded_samples[i] =
+ SOX_SAMPLE_TO_SIGNED_32BIT(sampleBuffer[i],ft->clips);
+ break;
+ }
+ }
+ FLAC__stream_encoder_process_interleaved(p->encoder, p->decoded_samples, (unsigned) len / ft->signal.channels);
+ return FLAC__stream_encoder_get_state(p->encoder) == FLAC__STREAM_ENCODER_OK ? len : 0;
+}
+
+
+
+static int stop_write(sox_format_t * const ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ FLAC__StreamEncoderState state = FLAC__stream_encoder_get_state(p->encoder);
+ unsigned i;
+
+ FLAC__stream_encoder_finish(p->encoder);
+ FLAC__stream_encoder_delete(p->encoder);
+ for (i = 0; i < p->num_metadata; ++i)
+ FLAC__metadata_object_delete(p->metadata[i]);
+ free(p->decoded_samples);
+ if (state != FLAC__STREAM_ENCODER_OK) {
+ lsx_fail_errno(ft, SOX_EINVAL, "FLAC ERROR: failed to encode to end of stream");
+ return SOX_EOF;
+ }
+ return SOX_SUCCESS;
+}
+
+
+
+static int seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ p->seek_offset = offset;
+ p->seek_pending = sox_true;
+ return ft->mode == 'r' ? SOX_SUCCESS : SOX_EOF;
+}
+
+
+
+LSX_FORMAT_HANDLER(flac)
+{
+ static char const * const names[] = {"flac", NULL};
+ static unsigned const encodings[] = {SOX_ENCODING_FLAC, 8, 16, 24, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Free Lossless Audio CODEC compressed audio", names, 0,
+ start_read, read_samples, stop_read,
+ start_write, write_samples, stop_write,
+ seek, encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/flanger.c b/src/src/flanger.c
new file mode 100644
index 0000000..cdf99ae
--- /dev/null
+++ b/src/src/flanger.c
@@ -0,0 +1,275 @@
+/* libSoX effect: Stereo Flanger (c) 2006 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* TODO: Slide in the delay at the start? */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef enum {INTERP_LINEAR, INTERP_QUADRATIC} interp_t;
+
+#define MAX_CHANNELS 4
+
+typedef struct {
+ /* Parameters */
+ double delay_min;
+ double delay_depth;
+ double feedback_gain;
+ double delay_gain;
+ double speed;
+ lsx_wave_t wave_shape;
+ double channel_phase;
+ interp_t interpolation;
+
+ /* Delay buffers */
+ double * delay_bufs[MAX_CHANNELS];
+ size_t delay_buf_length;
+ size_t delay_buf_pos;
+ double delay_last[MAX_CHANNELS];
+
+ /* Low Frequency Oscillator */
+ float * lfo;
+ size_t lfo_length;
+ size_t lfo_pos;
+
+ /* Balancing */
+ double in_gain;
+} priv_t;
+
+
+
+static lsx_enum_item const interp_enum[] = {
+ LSX_ENUM_ITEM(INTERP_,LINEAR)
+ LSX_ENUM_ITEM(INTERP_,QUADRATIC)
+ {0, 0}};
+
+
+
+static int getopts(sox_effect_t * effp, int argc, char *argv[])
+{
+ priv_t * p = (priv_t *) effp->priv;
+ --argc, ++argv;
+
+ /* Set non-zero defaults: */
+ p->delay_depth = 2;
+ p->delay_gain = 71;
+ p->speed = 0.5;
+ p->channel_phase= 25;
+
+ do { /* break-able block */
+ NUMERIC_PARAMETER(delay_min , 0 , 30 )
+ NUMERIC_PARAMETER(delay_depth , 0 , 10 )
+ NUMERIC_PARAMETER(feedback_gain,-95 , 95 )
+ NUMERIC_PARAMETER(delay_gain , 0 , 100)
+ NUMERIC_PARAMETER(speed , 0.1, 10 )
+ TEXTUAL_PARAMETER(wave_shape, lsx_get_wave_enum())
+ NUMERIC_PARAMETER(channel_phase, 0 , 100)
+ TEXTUAL_PARAMETER(interpolation, interp_enum)
+ } while (0);
+
+ if (argc != 0)
+ return lsx_usage(effp);
+
+ lsx_report("parameters:\n"
+ "delay = %gms\n"
+ "depth = %gms\n"
+ "regen = %g%%\n"
+ "width = %g%%\n"
+ "speed = %gHz\n"
+ "shape = %s\n"
+ "phase = %g%%\n"
+ "interp= %s",
+ p->delay_min,
+ p->delay_depth,
+ p->feedback_gain,
+ p->delay_gain,
+ p->speed,
+ lsx_get_wave_enum()[p->wave_shape].text,
+ p->channel_phase,
+ interp_enum[p->interpolation].text);
+
+ /* Scale to unity: */
+ p->feedback_gain /= 100;
+ p->delay_gain /= 100;
+ p->channel_phase /= 100;
+ p->delay_min /= 1000;
+ p->delay_depth /= 1000;
+
+ return SOX_SUCCESS;
+}
+
+
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * f = (priv_t *) effp->priv;
+ int c, channels = effp->in_signal.channels;
+
+ if (channels > MAX_CHANNELS) {
+ lsx_fail("Can not operate with more than %i channels", MAX_CHANNELS);
+ return SOX_EOF;
+ }
+
+ /* Balance output: */
+ f->in_gain = 1 / (1 + f->delay_gain);
+ f->delay_gain /= 1 + f->delay_gain;
+
+ /* Balance feedback loop: */
+ f->delay_gain *= 1 - fabs(f->feedback_gain);
+
+ lsx_debug("in_gain=%g feedback_gain=%g delay_gain=%g\n",
+ f->in_gain, f->feedback_gain, f->delay_gain);
+
+ /* Create the delay buffers, one for each channel: */
+ f->delay_buf_length =
+ (f->delay_min + f->delay_depth) * effp->in_signal.rate + 0.5;
+ ++f->delay_buf_length; /* Need 0 to n, i.e. n + 1. */
+ ++f->delay_buf_length; /* Quadratic interpolator needs one more. */
+ for (c = 0; c < channels; ++c)
+ f->delay_bufs[c] = lsx_calloc(f->delay_buf_length, sizeof(*f->delay_bufs[0]));
+
+ /* Create the LFO lookup table: */
+ f->lfo_length = effp->in_signal.rate / f->speed;
+ f->lfo = lsx_calloc(f->lfo_length, sizeof(*f->lfo));
+ lsx_generate_wave_table(
+ f->wave_shape,
+ SOX_FLOAT,
+ f->lfo,
+ f->lfo_length,
+ floor(f->delay_min * effp->in_signal.rate + .5),
+ f->delay_buf_length - 2.,
+ 3 * M_PI_2); /* Start the sweep at minimum delay (for mono at least) */
+
+ lsx_debug("delay_buf_length=%" PRIuPTR " lfo_length=%" PRIuPTR "\n",
+ f->delay_buf_length, f->lfo_length);
+
+ return SOX_SUCCESS;
+}
+
+
+
+static int flow(sox_effect_t * effp, sox_sample_t const * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * f = (priv_t *) effp->priv;
+ int c, channels = effp->in_signal.channels;
+ size_t len = (*isamp > *osamp ? *osamp : *isamp) / channels;
+
+ *isamp = *osamp = len * channels;
+
+ while (len--) {
+ f->delay_buf_pos =
+ (f->delay_buf_pos + f->delay_buf_length - 1) % f->delay_buf_length;
+ for (c = 0; c < channels; ++c) {
+ double delayed_0, delayed_1;
+ double delayed;
+ double in, out;
+ size_t channel_phase = c * f->lfo_length * f->channel_phase + .5;
+ double delay = f->lfo[(f->lfo_pos + channel_phase) % f->lfo_length];
+ double frac_delay = modf(delay, &delay);
+ size_t int_delay = (size_t)delay;
+
+ in = *ibuf++;
+ f->delay_bufs[c][f->delay_buf_pos] = in + f->delay_last[c] * f->feedback_gain;
+
+ delayed_0 = f->delay_bufs[c]
+ [(f->delay_buf_pos + int_delay++) % f->delay_buf_length];
+ delayed_1 = f->delay_bufs[c]
+ [(f->delay_buf_pos + int_delay++) % f->delay_buf_length];
+
+ if (f->interpolation == INTERP_LINEAR)
+ delayed = delayed_0 + (delayed_1 - delayed_0) * frac_delay;
+ else /* if (f->interpolation == INTERP_QUADRATIC) */
+ {
+ double a, b;
+ double delayed_2 = f->delay_bufs[c]
+ [(f->delay_buf_pos + int_delay++) % f->delay_buf_length];
+ delayed_2 -= delayed_0;
+ delayed_1 -= delayed_0;
+ a = delayed_2 *.5 - delayed_1;
+ b = delayed_1 * 2 - delayed_2 *.5;
+ delayed = delayed_0 + (a * frac_delay + b) * frac_delay;
+ }
+
+ f->delay_last[c] = delayed;
+ out = in * f->in_gain + delayed * f->delay_gain;
+ *obuf++ = SOX_ROUND_CLIP_COUNT(out, effp->clips);
+ }
+ f->lfo_pos = (f->lfo_pos + 1) % f->lfo_length;
+ }
+
+ return SOX_SUCCESS;
+}
+
+
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * f = (priv_t *) effp->priv;
+ int c, channels = effp->in_signal.channels;
+
+ for (c = 0; c < channels; ++c)
+ free(f->delay_bufs[c]);
+
+ free(f->lfo);
+
+ memset(f, 0, sizeof(*f));
+
+ return SOX_SUCCESS;
+}
+
+
+
+sox_effect_handler_t const * lsx_flanger_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "flanger", NULL, SOX_EFF_MCHAN,
+ getopts, start, flow, NULL, stop, NULL, sizeof(priv_t)};
+ static char const * lines[] = {
+ "[delay depth regen width speed shape phase interp]",
+ " .",
+ " /|regen",
+ " / |",
+ " +--( |------------+",
+ " | \\ | | .",
+ " _V_ \\| _______ | |\\ width ___",
+ " | | ' | | | | \\ | |",
+ " +-->| + |---->| DELAY |--+-->| )----->| |",
+ " | |___| |_______| | / | |",
+ " | delay : depth |/ | |",
+ " In | : interp ' | | Out",
+ " --->+ __:__ | + |--->",
+ " | | |speed | |",
+ " | | ~ |shape | |",
+ " | |_____|phase | |",
+ " +------------------------------------->| |",
+ " |___|",
+ " RANGE DEFAULT DESCRIPTION",
+ "delay 0 30 0 base delay in milliseconds",
+ "depth 0 10 2 added swept delay in milliseconds",
+ "regen -95 +95 0 percentage regeneration (delayed signal feedback)",
+ "width 0 100 71 percentage of delayed signal mixed with original",
+ "speed 0.1 10 0.5 sweeps per second (Hz) ",
+ "shape -- sin swept wave shape: sine|triangle",
+ "phase 0 100 25 swept wave percentage phase-shift for multi-channel",
+ " (e.g. stereo) flange; 0 = 100 = same phase on each channel",
+ "interp -- lin delay-line interpolation: linear|quadratic"
+ };
+ static char * usage;
+ handler.usage = lsx_usage_lines(&usage, lines, array_length(lines));
+ return &handler;
+}
diff --git a/src/src/formats.c b/src/src/formats.c
new file mode 100644
index 0000000..77e5c70
--- /dev/null
+++ b/src/src/formats.c
@@ -0,0 +1,1291 @@
+/* Implements the public API for using libSoX file formats.
+ * All public functions & data are prefixed with sox_ .
+ *
+ * (c) 2005-8 Chris Bagwell and SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#ifdef HAVE_IO_H
+ #include <io.h>
+#endif
+
+#if HAVE_MAGIC
+ #include <magic.h>
+#endif
+
+#define PIPE_AUTO_DETECT_SIZE 256 /* Only as much as we can rewind a pipe */
+#define AUTO_DETECT_SIZE 4096 /* For seekable file, so no restriction */
+
+static char const * auto_detect_format(sox_format_t * ft, char const * ext)
+{
+ char data[AUTO_DETECT_SIZE];
+ size_t len = lsx_readbuf(ft, data, ft->seekable? sizeof(data) : PIPE_AUTO_DETECT_SIZE);
+ #define CHECK(type, p2, l2, d2, p1, l1, d1) if (len >= p1 + l1 && \
+ !memcmp(data + p1, d1, (size_t)l1) && !memcmp(data + p2, d2, (size_t)l2)) return #type;
+ CHECK(voc , 0, 0, "" , 0, 20, "Creative Voice File\x1a")
+ CHECK(smp , 0, 0, "" , 0, 17, "SOUND SAMPLE DATA")
+ CHECK(wve , 0, 0, "" , 0, 15, "ALawSoundFile**")
+ CHECK(gsrt , 0, 0, "" , 16, 9, "ring.bin")
+ CHECK(amr-wb, 0, 0, "" , 0, 9, "#!AMR-WB\n")
+ CHECK(prc , 0, 0, "" , 0, 8, "\x37\x00\x00\x10\x6d\x00\x00\x10")
+ CHECK(sph , 0, 0, "" , 0, 7, "NIST_1A")
+ CHECK(amr-nb, 0, 0, "" , 0, 6, "#!AMR\n")
+ CHECK(txw , 0, 0, "" , 0, 6, "LM8953")
+ CHECK(sndt , 0, 0, "" , 0, 6, "SOUND\x1a")
+ CHECK(vorbis, 0, 4, "OggS" , 29, 6, "vorbis")
+ CHECK(opus , 0, 4, "OggS" , 28, 8, "OpusHead")
+ CHECK(speex , 0, 4, "OggS" , 28, 6, "Speex")
+ CHECK(hcom ,65, 4, "FSSD" , 128,4, "HCOM")
+ CHECK(wav , 0, 4, "RIFF" , 8, 4, "WAVE")
+ CHECK(wav , 0, 4, "RIFX" , 8, 4, "WAVE")
+ CHECK(wav , 0, 4, "RF64" , 8, 4, "WAVE")
+ CHECK(aiff , 0, 4, "FORM" , 8, 4, "AIFF")
+ CHECK(aifc , 0, 4, "FORM" , 8, 4, "AIFC")
+ CHECK(8svx , 0, 4, "FORM" , 8, 4, "8SVX")
+ CHECK(maud , 0, 4, "FORM" , 8, 4, "MAUD")
+ CHECK(xa , 0, 0, "" , 0, 4, "XA\0\0")
+ CHECK(xa , 0, 0, "" , 0, 4, "XAI\0")
+ CHECK(xa , 0, 0, "" , 0, 4, "XAJ\0")
+ CHECK(au , 0, 0, "" , 0, 4, ".snd")
+ CHECK(au , 0, 0, "" , 0, 4, "dns.")
+ CHECK(au , 0, 0, "" , 0, 4, "\0ds.")
+ CHECK(au , 0, 0, "" , 0, 4, ".sd\0")
+ CHECK(flac , 0, 0, "" , 0, 4, "fLaC")
+ CHECK(avr , 0, 0, "" , 0, 4, "2BIT")
+ CHECK(caf , 0, 0, "" , 0, 4, "caff")
+ CHECK(wv , 0, 0, "" , 0, 4, "wvpk")
+ CHECK(paf , 0, 0, "" , 0, 4, " paf")
+ CHECK(sf , 0, 0, "" , 0, 4, "\144\243\001\0")
+ CHECK(sf , 0, 0, "" , 0, 4, "\0\001\243\144")
+ CHECK(sf , 0, 0, "" , 0, 4, "\144\243\002\0")
+ CHECK(sf , 0, 0, "" , 0, 4, "\0\002\243\144")
+ CHECK(sf , 0, 0, "" , 0, 4, "\144\243\003\0")
+ CHECK(sf , 0, 0, "" , 0, 4, "\0\003\243\144")
+ CHECK(sf , 0, 0, "" , 0, 4, "\144\243\004\0")
+ CHECK(sox , 0, 0, "" , 0, 4, ".SoX")
+ CHECK(sox , 0, 0, "" , 0, 4, "XoS.")
+
+ if (ext && !strcasecmp(ext, "snd"))
+ CHECK(sndr , 7, 1, "" , 0, 2, "\0")
+ #undef CHECK
+
+#if HAVE_MAGIC
+ if (sox_globals.use_magic) {
+ static magic_t magic;
+ char const * filetype = NULL;
+ if (!magic) {
+ magic = magic_open(MAGIC_MIME | MAGIC_SYMLINK);
+ if (magic)
+ magic_load(magic, NULL);
+ }
+ if (magic)
+ filetype = magic_buffer(magic, data, len);
+ if (filetype && strncmp(filetype, "application/octet-stream", (size_t)24) &&
+ !lsx_strends(filetype, "/unknown") &&
+ strncmp(filetype, "text/plain", (size_t)10) )
+ return filetype;
+ else if (filetype)
+ lsx_debug("libmagic detected %s", filetype);
+ }
+#endif
+ return NULL;
+}
+
+static sox_encodings_info_t const s_sox_encodings_info[] = {
+ {sox_encodings_none , "n/a" , "Unknown or not applicable"},
+ {sox_encodings_none , "Signed PCM" , "Signed Integer PCM"},
+ {sox_encodings_none , "Unsigned PCM" , "Unsigned Integer PCM"},
+ {sox_encodings_none , "F.P. PCM" , "Floating Point PCM"},
+ {sox_encodings_none , "F.P. PCM" , "Floating Point (text) PCM"},
+ {sox_encodings_none , "FLAC" , "FLAC"},
+ {sox_encodings_none , "HCOM" , "HCOM"},
+ {sox_encodings_none , "WavPack" , "WavPack"},
+ {sox_encodings_none , "F.P. WavPack" , "Floating Point WavPack"},
+ {sox_encodings_lossy1, "u-law" , "u-law"},
+ {sox_encodings_lossy1, "A-law" , "A-law"},
+ {sox_encodings_lossy1, "G.721 ADPCM" , "G.721 ADPCM"},
+ {sox_encodings_lossy1, "G.723 ADPCM" , "G.723 ADPCM"},
+ {sox_encodings_lossy1, "CL ADPCM (8)" , "CL ADPCM (from 8-bit)"},
+ {sox_encodings_lossy1, "CL ADPCM (16)", "CL ADPCM (from 16-bit)"},
+ {sox_encodings_lossy1, "MS ADPCM" , "MS ADPCM"},
+ {sox_encodings_lossy1, "IMA ADPCM" , "IMA ADPCM"},
+ {sox_encodings_lossy1, "OKI ADPCM" , "OKI ADPCM"},
+ {sox_encodings_lossy1, "DPCM" , "DPCM"},
+ {sox_encodings_none , "DWVW" , "DWVW"},
+ {sox_encodings_none , "DWVWN" , "DWVWN"},
+ {sox_encodings_lossy2, "GSM" , "GSM"},
+ {sox_encodings_lossy2, "MPEG audio" , "MPEG audio (layer I, II or III)"},
+ {sox_encodings_lossy2, "Vorbis" , "Vorbis"},
+ {sox_encodings_lossy2, "AMR-WB" , "AMR-WB"},
+ {sox_encodings_lossy2, "AMR-NB" , "AMR-NB"},
+ {sox_encodings_lossy2, "CVSD" , "CVSD"},
+ {sox_encodings_lossy2, "LPC10" , "LPC10"},
+ {sox_encodings_lossy2, "Opus" , "Opus"},
+};
+
+assert_static(array_length(s_sox_encodings_info) == SOX_ENCODINGS,
+ SIZE_MISMATCH_BETWEEN_sox_encoding_t_AND_sox_encodings_info);
+
+sox_encodings_info_t const *
+sox_get_encodings_info(void)
+{
+ return s_sox_encodings_info;
+}
+
+unsigned sox_precision(sox_encoding_t encoding, unsigned bits_per_sample)
+{
+ switch (encoding) {
+ case SOX_ENCODING_DWVW: return bits_per_sample;
+ case SOX_ENCODING_DWVWN: return !bits_per_sample? 16: 0; /* ? */
+ case SOX_ENCODING_HCOM: return !(bits_per_sample & 7) && (bits_per_sample >> 3) - 1 < 1? bits_per_sample: 0;
+ case SOX_ENCODING_WAVPACK:
+ case SOX_ENCODING_FLAC: return !(bits_per_sample & 7) && (bits_per_sample >> 3) - 1 < 4? bits_per_sample: 0;
+ case SOX_ENCODING_SIGN2: return bits_per_sample <= 32? bits_per_sample : 0;
+ case SOX_ENCODING_UNSIGNED: return !(bits_per_sample & 7) && (bits_per_sample >> 3) - 1 < 4? bits_per_sample: 0;
+
+ case SOX_ENCODING_ALAW: return bits_per_sample == 8? 13: 0;
+ case SOX_ENCODING_ULAW: return bits_per_sample == 8? 14: 0;
+
+ case SOX_ENCODING_CL_ADPCM: return bits_per_sample? 8: 0;
+ case SOX_ENCODING_CL_ADPCM16: return bits_per_sample == 4? 13: 0;
+ case SOX_ENCODING_MS_ADPCM: return bits_per_sample == 4? 14: 0;
+ case SOX_ENCODING_IMA_ADPCM: return bits_per_sample == 4? 13: 0;
+ case SOX_ENCODING_OKI_ADPCM: return bits_per_sample == 4? 12: 0;
+ case SOX_ENCODING_G721: return bits_per_sample == 4? 12: 0;
+ case SOX_ENCODING_G723: return bits_per_sample == 3? 8:
+ bits_per_sample == 5? 14: 0;
+ case SOX_ENCODING_CVSD: return bits_per_sample == 1? 16: 0;
+ case SOX_ENCODING_DPCM: return bits_per_sample; /* ? */
+
+ case SOX_ENCODING_MP3: return 0; /* Accept the precision returned by the format. */
+
+ case SOX_ENCODING_GSM:
+ case SOX_ENCODING_VORBIS:
+ case SOX_ENCODING_OPUS:
+ case SOX_ENCODING_AMR_WB:
+ case SOX_ENCODING_AMR_NB:
+ case SOX_ENCODING_LPC10: return !bits_per_sample? 16: 0;
+
+ case SOX_ENCODING_WAVPACKF:
+ case SOX_ENCODING_FLOAT: return bits_per_sample == 32 ? 25: bits_per_sample == 64 ? 54: 0;
+ case SOX_ENCODING_FLOAT_TEXT: return !bits_per_sample? 54: 0;
+
+ case SOX_ENCODINGS:
+ case SOX_ENCODING_UNKNOWN: break;
+ }
+ return 0;
+}
+
+void sox_init_encodinginfo(sox_encodinginfo_t * e)
+{
+ e->reverse_bytes = sox_option_default;
+ e->reverse_nibbles = sox_option_default;
+ e->reverse_bits = sox_option_default;
+ e->compression = HUGE_VAL;
+}
+
+/*--------------------------------- Comments ---------------------------------*/
+
+size_t sox_num_comments(sox_comments_t comments)
+{
+ size_t result = 0;
+ if (!comments)
+ return 0;
+ while (*comments++)
+ ++result;
+ return result;
+}
+
+void sox_append_comment(sox_comments_t * comments, char const * comment)
+{
+ size_t n = sox_num_comments(*comments);
+ *comments = lsx_realloc(*comments, (n + 2) * sizeof(**comments));
+ assert(comment);
+ (*comments)[n++] = lsx_strdup(comment);
+ (*comments)[n] = 0;
+}
+
+void sox_append_comments(sox_comments_t * comments, char const * comment)
+{
+ char * end;
+ if (comment) {
+ while ((end = strchr(comment, '\n'))) {
+ size_t len = end - comment;
+ char * c = lsx_malloc((len + 1) * sizeof(*c));
+ strncpy(c, comment, len);
+ c[len] = '\0';
+ sox_append_comment(comments, c);
+ comment += len + 1;
+ free(c);
+ }
+ if (*comment)
+ sox_append_comment(comments, comment);
+ }
+}
+
+sox_comments_t sox_copy_comments(sox_comments_t comments)
+{
+ sox_comments_t result = 0;
+
+ if (comments) while (*comments)
+ sox_append_comment(&result, *comments++);
+ return result;
+}
+
+void sox_delete_comments(sox_comments_t * comments)
+{
+ sox_comments_t p = *comments;
+
+ if (p) while (*p)
+ free(*p++);
+ free(*comments);
+ *comments = 0;
+}
+
+char * lsx_cat_comments(sox_comments_t comments)
+{
+ sox_comments_t p = comments;
+ size_t len = 0;
+ char * result;
+
+ if (p) while (*p)
+ len += strlen(*p++) + 1;
+
+ result = lsx_calloc(len? len : 1, sizeof(*result));
+
+ if ((p = comments) && *p) {
+ strcpy(result, *p);
+ while (*++p)
+ strcat(strcat(result, "\n"), *p);
+ }
+ return result;
+}
+
+char const * sox_find_comment(sox_comments_t comments, char const * id)
+{
+ size_t len = strlen(id);
+
+ if (comments) for (;*comments; ++comments)
+ if (!strncasecmp(*comments, id, len) && (*comments)[len] == '=')
+ return *comments + len + 1;
+ return NULL;
+}
+
+static void set_endiannesses(sox_format_t * ft)
+{
+ if (ft->encoding.opposite_endian)
+ ft->encoding.reverse_bytes = (ft->handler.flags & SOX_FILE_ENDIAN)?
+ !(ft->handler.flags & SOX_FILE_ENDBIG) != MACHINE_IS_BIGENDIAN : sox_true;
+ else if (ft->encoding.reverse_bytes == sox_option_default)
+ ft->encoding.reverse_bytes = (ft->handler.flags & SOX_FILE_ENDIAN)?
+ !(ft->handler.flags & SOX_FILE_ENDBIG) == MACHINE_IS_BIGENDIAN : sox_false;
+
+ /* FIXME: Change reports to suitable warnings if trying
+ * to override something that can't be overridden. */
+
+ if (ft->handler.flags & SOX_FILE_ENDIAN) {
+ if (ft->encoding.reverse_bytes == (sox_option_t)
+ (!(ft->handler.flags & SOX_FILE_ENDBIG) != MACHINE_IS_BIGENDIAN))
+ lsx_report("`%s': overriding file-type byte-order", ft->filename);
+ } else if (ft->encoding.reverse_bytes == sox_option_yes)
+ lsx_report("`%s': overriding machine byte-order", ft->filename);
+
+ if (ft->encoding.reverse_bits == sox_option_default)
+ ft->encoding.reverse_bits = !!(ft->handler.flags & SOX_FILE_BIT_REV);
+ else if (ft->encoding.reverse_bits == !(ft->handler.flags & SOX_FILE_BIT_REV))
+ lsx_report("`%s': overriding file-type bit-order", ft->filename);
+
+ if (ft->encoding.reverse_nibbles == sox_option_default)
+ ft->encoding.reverse_nibbles = !!(ft->handler.flags & SOX_FILE_NIB_REV);
+ else
+ if (ft->encoding.reverse_nibbles == !(ft->handler.flags & SOX_FILE_NIB_REV))
+ lsx_report("`%s': overriding file-type nibble-order", ft->filename);
+}
+
+static sox_bool is_seekable(sox_format_t const * ft)
+{
+ struct stat st;
+
+ assert(ft);
+ if (!ft->fp)
+ return sox_false;
+ if (fstat(fileno((FILE*)ft->fp), &st) != -1) {
+ if ((st.st_mode & S_IFMT) == S_IFREG)
+ return sox_true;
+ }
+ return (fseek((FILE*)ft->fp, 0, SEEK_CUR) != -1);
+}
+
+/* check that all settings have been given */
+static int sox_checkformat(sox_format_t * ft)
+{
+ ft->sox_errno = SOX_SUCCESS;
+
+ if (!ft->signal.rate) {
+ lsx_fail_errno(ft,SOX_EFMT,"sampling rate was not specified");
+ return SOX_EOF;
+ }
+ if (!ft->signal.precision) {
+ lsx_fail_errno(ft,SOX_EFMT,"data encoding or sample size was not specified");
+ return SOX_EOF;
+ }
+ return SOX_SUCCESS;
+}
+
+static sox_bool is_url(char const * text) /* detects only wget-supported URLs */
+{
+ return !(
+ strncasecmp(text, "http:" , (size_t)5) &&
+ strncasecmp(text, "https:", (size_t)6) &&
+ strncasecmp(text, "ftp:" , (size_t)4));
+}
+
+static int xfclose(FILE * file, lsx_io_type io_type)
+{
+ return
+#ifdef HAVE_POPEN
+ io_type != lsx_io_file? pclose(file) :
+#endif
+ fclose(file);
+}
+
+static FILE * xfopen(char const * identifier, char const * mode, lsx_io_type * io_type)
+{
+ *io_type = lsx_io_file;
+
+ if (*identifier == '|') {
+ FILE * f = NULL;
+#ifdef HAVE_POPEN
+#ifndef POPEN_MODE
+#define POPEN_MODE "r"
+#endif
+ f = popen(identifier + 1, POPEN_MODE);
+ *io_type = lsx_io_pipe;
+#else
+ lsx_fail("this build of SoX cannot open pipes");
+#endif
+ return f;
+ }
+ else if (is_url(identifier)) {
+ FILE * f = NULL;
+#ifdef HAVE_POPEN
+ char const * const command_format = "wget -q -O- \"%s\"";
+ char * command = lsx_malloc(strlen(command_format) + strlen(identifier));
+ sprintf(command, command_format, identifier);
+ f = popen(command, POPEN_MODE);
+ free(command);
+ *io_type = lsx_io_url;
+#else
+ lsx_fail("this build of SoX cannot open URLs");
+#endif
+ return f;
+ }
+ return fopen(identifier, mode);
+}
+
+/* Hack to rewind pipes (a small amount).
+ * Works by resetting the FILE buffer pointer */
+static void UNUSED rewind_pipe(FILE * fp)
+{
+/* _FSTDIO is for Torek stdio (i.e. most BSD-derived libc's)
+ * In theory, we no longer need to check _NEWLIB_VERSION or __APPLE__ */
+#if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__
+ fp->_p -= PIPE_AUTO_DETECT_SIZE;
+ fp->_r += PIPE_AUTO_DETECT_SIZE;
+#elif defined __GLIBC__
+ fp->_IO_read_ptr = fp->_IO_read_base;
+#elif defined _MSC_VER || defined _WIN32 || defined _WIN64 || \
+ defined _ISO_STDIO_ISO_H || defined __sgi
+ fp->_ptr = fp->_base;
+#else
+ /* To fix this #error, either simply remove the #error line and live without
+ * file-type detection with pipes, or add support for your compiler in the
+ * lines above. Test with cat monkey.wav | ./sox --info - */
+ #error FIX NEEDED HERE
+ #define NO_REWIND_PIPE
+ (void)fp;
+#endif
+}
+
+static sox_format_t * open_read(
+ char const * path,
+ void * buffer UNUSED,
+ size_t buffer_size UNUSED,
+ sox_signalinfo_t const * signal,
+ sox_encodinginfo_t const * encoding,
+ char const * filetype)
+{
+ sox_format_t * ft = lsx_calloc(1, sizeof(*ft));
+ sox_format_handler_t const * handler;
+ char const * const io_types[] = {"file", "pipe", "file URL"};
+ char const * type = "";
+ size_t input_bufsiz = sox_globals.input_bufsiz?
+ sox_globals.input_bufsiz : sox_globals.bufsiz;
+
+ if (filetype) {
+ if (!(handler = sox_find_format(filetype, sox_false))) {
+ lsx_fail("no handler for given file type `%s'", filetype);
+ goto error;
+ }
+ ft->handler = *handler;
+ }
+
+ if (!(ft->handler.flags & SOX_FILE_NOSTDIO)) {
+ if (!strcmp(path, "-")) { /* Use stdin if the filename is "-" */
+ if (sox_globals.stdin_in_use_by) {
+ lsx_fail("`-' (stdin) already in use by `%s'", sox_globals.stdin_in_use_by);
+ goto error;
+ }
+ sox_globals.stdin_in_use_by = "audio input";
+ SET_BINARY_MODE(stdin);
+ ft->fp = stdin;
+ }
+ else {
+ ft->fp =
+#ifdef HAVE_FMEMOPEN
+ buffer? fmemopen(buffer, buffer_size, "rb") :
+#endif
+ xfopen(path, "rb", &ft->io_type);
+ type = io_types[ft->io_type];
+ if (ft->fp == NULL) {
+ lsx_fail("can't open input %s `%s': %s", type, path, strerror(errno));
+ goto error;
+ }
+ }
+ if (setvbuf (ft->fp, NULL, _IOFBF, sizeof(char) * input_bufsiz)) {
+ lsx_fail("Can't set read buffer");
+ goto error;
+ }
+ ft->seekable = is_seekable(ft);
+ }
+
+ if (!filetype) {
+ if (ft->seekable) {
+ filetype = auto_detect_format(ft, lsx_find_file_extension(path));
+ lsx_rewind(ft);
+ }
+#ifndef NO_REWIND_PIPE
+ else if (!(ft->handler.flags & SOX_FILE_NOSTDIO) &&
+ input_bufsiz >= PIPE_AUTO_DETECT_SIZE) {
+ filetype = auto_detect_format(ft, lsx_find_file_extension(path));
+ rewind_pipe(ft->fp);
+ ft->tell_off = 0;
+ }
+#endif
+
+ if (filetype) {
+ lsx_report("detected file format type `%s'", filetype);
+ if (!(handler = sox_find_format(filetype, sox_false))) {
+ lsx_fail("no handler for detected file type `%s'", filetype);
+ goto error;
+ }
+ }
+ else {
+ if (ft->io_type == lsx_io_pipe) {
+ filetype = "sox"; /* With successful pipe rewind, this isn't useful */
+ lsx_report("assuming input pipe `%s' has file-type `sox'", path);
+ }
+ else if (!(filetype = lsx_find_file_extension(path))) {
+ lsx_fail("can't determine type of %s `%s'", type, path);
+ goto error;
+ }
+ if (!(handler = sox_find_format(filetype, sox_true))) {
+ lsx_fail("no handler for file extension `%s'", filetype);
+ goto error;
+ }
+ }
+ ft->handler = *handler;
+ if (ft->handler.flags & SOX_FILE_NOSTDIO) {
+ xfclose(ft->fp, ft->io_type);
+ ft->fp = NULL;
+ }
+ }
+ if (!ft->handler.startread && !ft->handler.read) {
+ lsx_fail("file type `%s' isn't readable", filetype);
+ goto error;
+ }
+
+ ft->mode = 'r';
+ ft->filetype = lsx_strdup(filetype);
+ ft->filename = lsx_strdup(path);
+ if (signal)
+ ft->signal = *signal;
+
+ if (encoding)
+ ft->encoding = *encoding;
+ else sox_init_encodinginfo(&ft->encoding);
+ set_endiannesses(ft);
+
+ if ((ft->handler.flags & SOX_FILE_DEVICE) && !(ft->handler.flags & SOX_FILE_PHONY))
+ lsx_set_signal_defaults(ft);
+
+ ft->priv = lsx_calloc(1, ft->handler.priv_size);
+ /* Read and write starters can change their formats. */
+ if (ft->handler.startread && (*ft->handler.startread)(ft) != SOX_SUCCESS) {
+ lsx_fail("can't open input %s `%s': %s", type, ft->filename, ft->sox_errstr);
+ goto error;
+ }
+
+ /* Fill in some defaults: */
+ if (sox_precision(ft->encoding.encoding, ft->encoding.bits_per_sample))
+ ft->signal.precision = sox_precision(ft->encoding.encoding, ft->encoding.bits_per_sample);
+ if (!(ft->handler.flags & SOX_FILE_PHONY) && !ft->signal.channels)
+ ft->signal.channels = 1;
+
+ if (sox_checkformat(ft) != SOX_SUCCESS) {
+ lsx_fail("bad input format for %s `%s': %s", type, ft->filename, ft->sox_errstr);
+ goto error;
+ }
+
+ if (signal) {
+ if (signal->rate && signal->rate != ft->signal.rate)
+ lsx_warn("can't set sample rate %g; using %g", signal->rate, ft->signal.rate);
+ if (signal->channels && signal->channels != ft->signal.channels)
+ lsx_warn("can't set %u channels; using %u", signal->channels, ft->signal.channels);
+ }
+ return ft;
+
+error:
+ if (ft->fp && ft->fp != stdin)
+ xfclose(ft->fp, ft->io_type);
+ free(ft->priv);
+ free(ft->filename);
+ free(ft->filetype);
+ free(ft);
+ return NULL;
+}
+
+sox_format_t * sox_open_read(
+ char const * path,
+ sox_signalinfo_t const * signal,
+ sox_encodinginfo_t const * encoding,
+ char const * filetype)
+{
+ return open_read(path, NULL, (size_t)0, signal, encoding, filetype);
+}
+
+sox_format_t * sox_open_mem_read(
+ void * buffer,
+ size_t buffer_size,
+ sox_signalinfo_t const * signal,
+ sox_encodinginfo_t const * encoding,
+ char const * filetype)
+{
+ return open_read("", buffer, buffer_size, signal,encoding,filetype);
+}
+
+sox_bool sox_format_supports_encoding(
+ char const * path,
+ char const * filetype,
+ sox_encodinginfo_t const * encoding)
+{
+ #define enc_arg(T) (T)handler->write_formats[i++]
+ sox_bool is_file_extension = filetype == NULL;
+ sox_format_handler_t const * handler;
+ unsigned i = 0, s;
+ sox_encoding_t e;
+
+ assert(path || filetype);
+ assert(encoding);
+ if (!filetype)
+ filetype = lsx_find_file_extension(path);
+
+ if (!filetype || !(handler = sox_find_format(filetype, is_file_extension)) ||
+ !handler->write_formats)
+ return sox_false;
+ while ((e = enc_arg(sox_encoding_t))) {
+ if (e == encoding->encoding) {
+ sox_bool has_bits;
+ for (has_bits = sox_false; (s = enc_arg(unsigned)); has_bits = sox_true)
+ if (s == encoding->bits_per_sample)
+ return sox_true;
+ if (!has_bits && !encoding->bits_per_sample)
+ return sox_true;
+ break;
+ }
+ while (enc_arg(unsigned));
+ }
+ return sox_false;
+ #undef enc_arg
+}
+
+static void set_output_format(sox_format_t * ft)
+{
+ sox_encoding_t e = SOX_ENCODING_UNKNOWN;
+ unsigned i, s;
+ unsigned const * encodings = ft->handler.write_formats;
+#define enc_arg(T) (T)encodings[i++]
+
+ if (ft->handler.write_rates){
+ if (!ft->signal.rate)
+ ft->signal.rate = ft->handler.write_rates[0];
+ else {
+ sox_rate_t r;
+ i = 0;
+ while ((r = ft->handler.write_rates[i++])) {
+ if (r == ft->signal.rate)
+ break;
+ }
+ if (r != ft->signal.rate) {
+ sox_rate_t given = ft->signal.rate, max = 0;
+ ft->signal.rate = HUGE_VAL;
+ i = 0;
+ while ((r = ft->handler.write_rates[i++])) {
+ if (r > given && r < ft->signal.rate)
+ ft->signal.rate = r;
+ else max = max(r, max);
+ }
+ if (ft->signal.rate == HUGE_VAL)
+ ft->signal.rate = max;
+ lsx_warn("%s can't encode at %gHz; using %gHz", ft->handler.names[0], given, ft->signal.rate);
+ }
+ }
+ }
+ else if (!ft->signal.rate)
+ ft->signal.rate = SOX_DEFAULT_RATE;
+
+ if (ft->handler.flags & SOX_FILE_CHANS) {
+ if (ft->signal.channels == 1 && !(ft->handler.flags & SOX_FILE_MONO)) {
+ ft->signal.channels = (ft->handler.flags & SOX_FILE_STEREO)? 2 : 4;
+ lsx_warn("%s can't encode mono; setting channels to %u", ft->handler.names[0], ft->signal.channels);
+ } else
+ if (ft->signal.channels == 2 && !(ft->handler.flags & SOX_FILE_STEREO)) {
+ ft->signal.channels = (ft->handler.flags & SOX_FILE_QUAD)? 4 : 1;
+ lsx_warn("%s can't encode stereo; setting channels to %u", ft->handler.names[0], ft->signal.channels);
+ } else
+ if (ft->signal.channels == 4 && !(ft->handler.flags & SOX_FILE_QUAD)) {
+ ft->signal.channels = (ft->handler.flags & SOX_FILE_STEREO)? 2 : 1;
+ lsx_warn("%s can't encode quad; setting channels to %u", ft->handler.names[0], ft->signal.channels);
+ }
+ } else ft->signal.channels = max(ft->signal.channels, 1);
+
+ if (!encodings)
+ return;
+ /* If an encoding has been given, check if it supported by this handler */
+ if (ft->encoding.encoding) {
+ i = 0;
+ while ((e = enc_arg(sox_encoding_t))) {
+ if (e == ft->encoding.encoding)
+ break;
+ while (enc_arg(unsigned));
+ }
+ if (e != ft->encoding.encoding) {
+ lsx_warn("%s can't encode %s", ft->handler.names[0], sox_encodings_info[ft->encoding.encoding].desc);
+ ft->encoding.encoding = 0;
+ }
+ else {
+ unsigned max_p = 0;
+ unsigned max_p_s = 0;
+ unsigned given_size = 0;
+ sox_bool found = sox_false;
+ if (ft->encoding.bits_per_sample)
+ given_size = ft->encoding.bits_per_sample;
+ ft->encoding.bits_per_sample = 65;
+ while ((s = enc_arg(unsigned))) {
+ if (s == given_size)
+ found = sox_true;
+ if (sox_precision(e, s) >= ft->signal.precision) {
+ if (s < ft->encoding.bits_per_sample)
+ ft->encoding.bits_per_sample = s;
+ }
+ else if (sox_precision(e, s) > max_p) {
+ max_p = sox_precision(e, s);
+ max_p_s = s;
+ }
+ }
+ if (ft->encoding.bits_per_sample == 65)
+ ft->encoding.bits_per_sample = max_p_s;
+ if (given_size) {
+ if (found)
+ ft->encoding.bits_per_sample = given_size;
+ else lsx_warn("%s can't encode %s to %u-bit", ft->handler.names[0], sox_encodings_info[ft->encoding.encoding].desc, given_size);
+ }
+ }
+ }
+
+ /* If a size has been given, check if it supported by this handler */
+ if (!ft->encoding.encoding && ft->encoding.bits_per_sample) {
+ i = 0;
+ s= 0;
+ while (s != ft->encoding.bits_per_sample && (e = enc_arg(sox_encoding_t)))
+ while ((s = enc_arg(unsigned)) && s != ft->encoding.bits_per_sample);
+ if (s != ft->encoding.bits_per_sample) {
+ lsx_warn("%s can't encode to %u-bit", ft->handler.names[0], ft->encoding.bits_per_sample);
+ ft->encoding.bits_per_sample = 0;
+ }
+ else ft->encoding.encoding = e;
+ }
+
+ /* Find the smallest lossless encoding with precision >= signal.precision */
+ if (!ft->encoding.encoding) {
+ ft->encoding.bits_per_sample = 65;
+ i = 0;
+ while ((e = enc_arg(sox_encoding_t)))
+ while ((s = enc_arg(unsigned)))
+ if (!(sox_encodings_info[e].flags & (sox_encodings_lossy1 | sox_encodings_lossy2)) &&
+ sox_precision(e, s) >= ft->signal.precision && s < ft->encoding.bits_per_sample) {
+ ft->encoding.encoding = e;
+ ft->encoding.bits_per_sample = s;
+ }
+ }
+
+ /* Find the smallest lossy encoding with precision >= signal precision,
+ * or, if none such, the highest precision encoding */
+ if (!ft->encoding.encoding) {
+ unsigned max_p = 0;
+ sox_encoding_t max_p_e = 0;
+ unsigned max_p_s = 0;
+ i = 0;
+ while ((e = enc_arg(sox_encoding_t)))
+ do {
+ s = enc_arg(unsigned);
+ if (sox_precision(e, s) >= ft->signal.precision) {
+ if (s < ft->encoding.bits_per_sample) {
+ ft->encoding.encoding = e;
+ ft->encoding.bits_per_sample = s;
+ }
+ }
+ else if (sox_precision(e, s) > max_p) {
+ max_p = sox_precision(e, s);
+ max_p_e = e;
+ max_p_s = s;
+ }
+ } while (s);
+ if (!ft->encoding.encoding) {
+ ft->encoding.encoding = max_p_e;
+ ft->encoding.bits_per_sample = max_p_s;
+ }
+ }
+ ft->signal.precision = sox_precision(ft->encoding.encoding, ft->encoding.bits_per_sample);
+ #undef enc_arg
+}
+
+sox_format_handler_t const * sox_write_handler(
+ char const * path,
+ char const * filetype,
+ char const * * filetype1)
+{
+ sox_format_handler_t const * handler;
+ if (filetype) {
+ if (!(handler = sox_find_format(filetype, sox_false))) {
+ if (filetype1)
+ lsx_fail("no handler for given file type `%s'", filetype);
+ return NULL;
+ }
+ }
+ else if (path) {
+ if (!(filetype = lsx_find_file_extension(path))) {
+ if (filetype1)
+ lsx_fail("can't determine type of `%s'", path);
+ return NULL;
+ }
+ if (!(handler = sox_find_format(filetype, sox_true))) {
+ if (filetype1)
+ lsx_fail("no handler for file extension `%s'", filetype);
+ return NULL;
+ }
+ }
+ else return NULL;
+ if (!handler->startwrite && !handler->write) {
+ if (filetype1)
+ lsx_fail("file type `%s' isn't writable", filetype);
+ return NULL;
+ }
+ if (filetype1)
+ *filetype1 = filetype;
+ return handler;
+}
+
+static sox_format_t * open_write(
+ char const * path,
+ void * buffer UNUSED,
+ size_t buffer_size UNUSED,
+ char * * buffer_ptr UNUSED,
+ size_t * buffer_size_ptr UNUSED,
+ sox_signalinfo_t const * signal,
+ sox_encodinginfo_t const * encoding,
+ char const * filetype,
+ sox_oob_t const * oob,
+ sox_bool (*overwrite_permitted)(const char *filename))
+{
+ sox_format_t * ft = lsx_calloc(sizeof(*ft), 1);
+ sox_format_handler_t const * handler;
+
+ if (!path || !signal) {
+ lsx_fail("must specify file name and signal parameters to write file");
+ goto error;
+ }
+
+ if (!(handler = sox_write_handler(path, filetype, &filetype)))
+ goto error;
+
+ ft->handler = *handler;
+
+ if (!(ft->handler.flags & SOX_FILE_NOSTDIO)) {
+ if (!strcmp(path, "-")) { /* Use stdout if the filename is "-" */
+ if (sox_globals.stdout_in_use_by) {
+ lsx_fail("`-' (stdout) already in use by `%s'", sox_globals.stdout_in_use_by);
+ goto error;
+ }
+ sox_globals.stdout_in_use_by = "audio output";
+ SET_BINARY_MODE(stdout);
+ ft->fp = stdout;
+ }
+ else {
+ struct stat st;
+ if (!stat(path, &st) && (st.st_mode & S_IFMT) == S_IFREG &&
+ (overwrite_permitted && !overwrite_permitted(path))) {
+ lsx_fail("permission to overwrite `%s' denied", path);
+ goto error;
+ }
+ ft->fp =
+#ifdef HAVE_FMEMOPEN
+ buffer? fmemopen(buffer, buffer_size, "w+b") :
+ buffer_ptr? open_memstream(buffer_ptr, buffer_size_ptr) :
+#endif
+ fopen(path, "w+b");
+ if (ft->fp == NULL) {
+ lsx_fail("can't open output file `%s': %s", path, strerror(errno));
+ goto error;
+ }
+ }
+
+ /* stdout tends to be line-buffered. Override this */
+ /* to be Full Buffering. */
+ if (setvbuf (ft->fp, NULL, _IOFBF, sizeof(char) * sox_globals.bufsiz)) {
+ lsx_fail("Can't set write buffer");
+ goto error;
+ }
+ ft->seekable = is_seekable(ft);
+ }
+
+ ft->filetype = lsx_strdup(filetype);
+ ft->filename = lsx_strdup(path);
+ ft->mode = 'w';
+ ft->signal = *signal;
+
+ if (encoding)
+ ft->encoding = *encoding;
+ else sox_init_encodinginfo(&ft->encoding);
+ set_endiannesses(ft);
+
+ if (oob) {
+ ft->oob = *oob;
+ /* deep copy: */
+ ft->oob.comments = sox_copy_comments(oob->comments);
+ }
+
+ set_output_format(ft);
+
+ /* FIXME: doesn't cover the situation where
+ * codec changes audio length due to block alignment (e.g. 8svx, gsm): */
+ if (signal->rate && signal->channels)
+ ft->signal.length = ft->signal.length * ft->signal.rate / signal->rate *
+ ft->signal.channels / signal->channels + .5;
+
+ if ((ft->handler.flags & SOX_FILE_REWIND) && strcmp(ft->filetype, "sox") && !ft->signal.length && !ft->seekable)
+ lsx_warn("can't seek in output file `%s'; length in file header will be unspecified", ft->filename);
+
+ ft->priv = lsx_calloc(1, ft->handler.priv_size);
+ /* Read and write starters can change their formats. */
+ if (ft->handler.startwrite && (ft->handler.startwrite)(ft) != SOX_SUCCESS){
+ lsx_fail("can't open output file `%s': %s", ft->filename, ft->sox_errstr);
+ goto error;
+ }
+
+ if (sox_checkformat(ft) != SOX_SUCCESS) {
+ lsx_fail("bad format for output file `%s': %s", ft->filename, ft->sox_errstr);
+ goto error;
+ }
+
+ if ((ft->handler.flags & SOX_FILE_DEVICE) && signal) {
+ if (signal->rate && signal->rate != ft->signal.rate)
+ lsx_report("can't set sample rate %g; using %g", signal->rate, ft->signal.rate);
+ if (signal->channels && signal->channels != ft->signal.channels)
+ lsx_report("can't set %u channels; using %u", signal->channels, ft->signal.channels);
+ }
+ return ft;
+
+error:
+ if (ft->fp && ft->fp != stdout)
+ xfclose(ft->fp, ft->io_type);
+ free(ft->priv);
+ free(ft->filename);
+ free(ft->filetype);
+ free(ft);
+ return NULL;
+}
+
+sox_format_t * sox_open_write(
+ char const * path,
+ sox_signalinfo_t const * signal,
+ sox_encodinginfo_t const * encoding,
+ char const * filetype,
+ sox_oob_t const * oob,
+ sox_bool (*overwrite_permitted)(const char *filename))
+{
+ return open_write(path, NULL, (size_t)0, NULL, NULL, signal, encoding, filetype, oob, overwrite_permitted);
+}
+
+sox_format_t * sox_open_mem_write(
+ void * buffer,
+ size_t buffer_size,
+ sox_signalinfo_t const * signal,
+ sox_encodinginfo_t const * encoding,
+ char const * filetype,
+ sox_oob_t const * oob)
+{
+ return open_write("", buffer, buffer_size, NULL, NULL, signal, encoding, filetype, oob, NULL);
+}
+
+sox_format_t * sox_open_memstream_write(
+ char * * buffer_ptr,
+ size_t * buffer_size_ptr,
+ sox_signalinfo_t const * signal,
+ sox_encodinginfo_t const * encoding,
+ char const * filetype,
+ sox_oob_t const * oob)
+{
+ return open_write("", NULL, (size_t)0, buffer_ptr, buffer_size_ptr, signal, encoding, filetype, oob, NULL);
+}
+
+size_t sox_read(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ size_t actual;
+ if (ft->signal.length != SOX_UNSPEC)
+ len = min(len, ft->signal.length - ft->olength);
+ actual = ft->handler.read? (*ft->handler.read)(ft, buf, len) : 0;
+ actual = actual > len? 0 : actual;
+ ft->olength += actual;
+ return actual;
+}
+
+size_t sox_write(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ size_t actual = ft->handler.write? (*ft->handler.write)(ft, buf, len) : 0;
+ ft->olength += actual;
+ return actual;
+}
+
+int sox_close(sox_format_t * ft)
+{
+ int result = SOX_SUCCESS;
+
+ if (ft->mode == 'r')
+ result = ft->handler.stopread? (*ft->handler.stopread)(ft) : SOX_SUCCESS;
+ else {
+ if (ft->handler.flags & SOX_FILE_REWIND) {
+ if (ft->olength != ft->signal.length && ft->seekable) {
+ result = lsx_seeki(ft, (off_t)0, 0);
+ if (result == SOX_SUCCESS)
+ result = ft->handler.stopwrite? (*ft->handler.stopwrite)(ft)
+ : ft->handler.startwrite?(*ft->handler.startwrite)(ft) : SOX_SUCCESS;
+ }
+ }
+ else result = ft->handler.stopwrite? (*ft->handler.stopwrite)(ft) : SOX_SUCCESS;
+ }
+
+ if (ft->fp && ft->fp != stdin && ft->fp != stdout)
+ xfclose(ft->fp, ft->io_type);
+ free(ft->priv);
+ free(ft->filename);
+ free(ft->filetype);
+ sox_delete_comments(&ft->oob.comments);
+
+ free(ft);
+ return result;
+}
+
+int sox_seek(sox_format_t * ft, sox_uint64_t offset, int whence)
+{
+ /* FIXME: Implement SOX_SEEK_CUR and SOX_SEEK_END. */
+ if (whence != SOX_SEEK_SET)
+ return SOX_EOF; /* FIXME: return SOX_EINVAL */
+
+ /* If file is a seekable file and this handler supports seeking,
+ * then invoke handler's function.
+ */
+ if (ft->seekable && ft->handler.seek)
+ return (*ft->handler.seek)(ft, offset);
+ return SOX_EOF; /* FIXME: return SOX_EBADF */
+}
+
+static int strcaseends(char const * str, char const * end)
+{
+ size_t str_len = strlen(str), end_len = strlen(end);
+ return str_len >= end_len && !strcasecmp(str + str_len - end_len, end);
+}
+
+typedef enum {None, M3u, Pls} playlist_t;
+
+static playlist_t playlist_type(char const * filename)
+{
+ char * x, * p;
+ playlist_t result = None;
+
+ if (*filename == '|')
+ return result;
+ if (strcaseends(filename, ".m3u"))
+ return M3u;
+ if (strcaseends(filename, ".pls"))
+ return Pls;
+ x = lsx_strdup(filename);
+ p = strrchr(x, '?');
+ if (p) {
+ *p = '\0';
+ result = playlist_type(x);
+ }
+ free(x);
+ return result;
+}
+
+sox_bool sox_is_playlist(char const * filename)
+{
+ return playlist_type(filename) != None;
+}
+
+int sox_parse_playlist(sox_playlist_callback_t callback, void * p, char const * const listname)
+{
+ sox_bool const is_pls = playlist_type(listname) == Pls;
+ int const comment_char = "#;"[is_pls];
+ size_t text_length = 100;
+ char * text = lsx_malloc(text_length + 1);
+ char * dirname = lsx_strdup(listname);
+ char * slash_pos = LAST_SLASH(dirname);
+ lsx_io_type io_type;
+ FILE * file = xfopen(listname, "r", &io_type);
+ char * filename;
+ int c, result = SOX_SUCCESS;
+
+ if (!slash_pos)
+ *dirname = '\0';
+ else
+ *slash_pos = '\0';
+
+ if (file == NULL) {
+ lsx_fail("Can't open playlist file `%s': %s", listname, strerror(errno));
+ result = SOX_EOF;
+ }
+ else {
+ do {
+ size_t i = 0;
+ size_t begin = 0, end = 0;
+
+ while (isspace(c = getc(file)));
+ if (c == EOF)
+ break;
+ while (c != EOF && !strchr("\r\n", c) && c != comment_char) {
+ if (i == text_length)
+ text = lsx_realloc(text, (text_length <<= 1) + 1);
+ text[i++] = c;
+ if (!strchr(" \t\f", c))
+ end = i;
+ c = getc(file);
+ }
+ if (ferror(file))
+ break;
+ if (c == comment_char) {
+ do c = getc(file);
+ while (c != EOF && !strchr("\r\n", c));
+ if (ferror(file))
+ break;
+ }
+ text[end] = '\0';
+ if (is_pls) {
+ char dummy;
+ if (!strncasecmp(text, "file", (size_t) 4) && sscanf(text + 4, "%*u=%c", &dummy) == 1)
+ begin = strchr(text + 5, '=') - text + 1;
+ else end = 0;
+ }
+ if (begin != end) {
+ char const * id = text + begin;
+
+ if (!dirname[0] || is_url(id) || IS_ABSOLUTE(id))
+ filename = lsx_strdup(id);
+ else {
+ filename = lsx_malloc(strlen(dirname) + strlen(id) + 2);
+ sprintf(filename, "%s/%s", dirname, id);
+ }
+ if (sox_is_playlist(filename))
+ sox_parse_playlist(callback, p, filename);
+ else if (callback(p, filename))
+ c = EOF;
+ free(filename);
+ }
+ } while (c != EOF);
+
+ if (ferror(file)) {
+ lsx_fail("error reading playlist file `%s': %s", listname, strerror(errno));
+ result = SOX_EOF;
+ }
+ if (xfclose(file, io_type) && io_type == lsx_io_url) {
+ lsx_fail("error reading playlist file URL `%s'", listname);
+ result = SOX_EOF;
+ }
+ }
+ free(text);
+ free(dirname);
+ return result;
+}
+
+/*----------------------------- Formats library ------------------------------*/
+
+enum {
+ #define FORMAT(f) f,
+ #include "third_party/sox/src/src/formats.h"
+ #undef FORMAT
+ NSTATIC_FORMATS
+};
+
+static sox_bool plugins_initted = sox_false;
+
+#ifdef HAVE_LIBLTDL /* Plugin format handlers */
+ #define MAX_DYNAMIC_FORMATS 42
+ #define MAX_FORMATS (NSTATIC_FORMATS + MAX_DYNAMIC_FORMATS)
+ #define MAX_FORMATS_1 (MAX_FORMATS + 1)
+ #define MAX_NAME_LEN (size_t)1024 /* FIXME: Use vasprintf */
+#else
+ #define MAX_FORMATS_1
+#endif
+
+#define FORMAT(f) extern sox_format_handler_t const * lsx_##f##_format_fn(void);
+#include "third_party/sox/src/src/formats.h"
+#undef FORMAT
+
+static sox_format_tab_t s_sox_format_fns[MAX_FORMATS_1] = {
+ #define FORMAT(f) {NULL, lsx_##f##_format_fn},
+ #include "third_party/sox/src/src/formats.h"
+ #undef FORMAT
+ {NULL, NULL}
+};
+
+const sox_format_tab_t *
+sox_get_format_fns(void)
+{
+ return s_sox_format_fns;
+}
+
+#ifdef HAVE_LIBLTDL /* Plugin format handlers */
+ static unsigned nformats = NSTATIC_FORMATS;
+
+ static int init_format(const char *file, lt_ptr data)
+ {
+ lt_dlhandle lth = lt_dlopenext(file);
+ const char *end = file + strlen(file);
+ const char prefix[] = "sox_fmt_";
+ char fnname[MAX_NAME_LEN];
+ char *start = strstr(file, prefix);
+
+ (void)data;
+ if (start && (start += sizeof(prefix) - 1) < end) {
+ int ret = snprintf(fnname, MAX_NAME_LEN,
+ "lsx_%.*s_format_fn", (int)(end - start), start);
+ if (ret > 0 && ret < (int)MAX_NAME_LEN) {
+ union {sox_format_fn_t fn; lt_ptr ptr;} ltptr;
+ ltptr.ptr = lt_dlsym(lth, fnname);
+ lsx_debug("opening format plugin `%s': library %p, entry point %p\n",
+ fnname, (void *)lth, ltptr.ptr);
+ if (ltptr.fn && (ltptr.fn()->sox_lib_version_code & ~255) ==
+ (SOX_LIB_VERSION_CODE & ~255)) { /* compatible version check */
+ if (nformats == MAX_FORMATS) {
+ lsx_warn("too many plugin formats");
+ return -1;
+ }
+ s_sox_format_fns[nformats++].fn = ltptr.fn;
+ }
+ }
+ }
+ return 0;
+ }
+#endif
+
+int sox_format_init(void) /* Find & load format handlers. */
+{
+ if (plugins_initted)
+ return SOX_SUCCESS;
+
+ plugins_initted = sox_true;
+#ifdef HAVE_LIBLTDL
+ {
+ int error = lt_dlinit();
+ if (error) {
+ lsx_fail("lt_dlinit failed with %d error(s): %s", error, lt_dlerror());
+ return SOX_EOF;
+ }
+ lt_dlforeachfile(PKGLIBDIR, init_format, NULL);
+ }
+#endif
+ return SOX_SUCCESS;
+}
+
+void sox_format_quit(void) /* Cleanup things. */
+{
+#ifdef HAVE_LIBLTDL
+ int ret;
+ if (plugins_initted && (ret = lt_dlexit()) != 0)
+ lsx_fail("lt_dlexit failed with %d error(s): %s", ret, lt_dlerror());
+ plugins_initted = sox_false;
+ nformats = NSTATIC_FORMATS;
+#endif
+}
+
+/* Find a named format in the formats library.
+ *
+ * (c) 2005-9 Chris Bagwell and SoX contributors.
+ * Copyright 1991 Lance Norskog And Sundry Contributors.
+ *
+ * This source code is freely redistributable and may be used for any
+ * purpose. This copyright notice must be maintained.
+ *
+ * Lance Norskog, Sundry Contributors, Chris Bagwell and SoX contributors
+ * are not responsible for the consequences of using this software.
+ */
+sox_format_handler_t const * sox_find_format(char const * name0, sox_bool no_dev)
+{
+ size_t f, n;
+
+ if (name0) {
+ char * name = lsx_strdup(name0);
+ char * pos = strchr(name, ';');
+ if (pos) /* Use only the 1st clause of a mime string */
+ *pos = '\0';
+ for (f = 0; s_sox_format_fns[f].fn; ++f) {
+ sox_format_handler_t const * handler = s_sox_format_fns[f].fn();
+
+ if (!(no_dev && (handler->flags & SOX_FILE_DEVICE)))
+ for (n = 0; handler->names[n]; ++n)
+ if (!strcasecmp(handler->names[n], name)) {
+ free(name);
+ return handler; /* Found it. */
+ }
+ }
+ free(name);
+ }
+ if (sox_format_init() == SOX_SUCCESS) /* Try again with plugins */
+ return sox_find_format(name0, no_dev);
+ return NULL;
+}
diff --git a/src/src/formats.h b/src/src/formats.h
new file mode 100644
index 0000000..a42ce27
--- /dev/null
+++ b/src/src/formats.h
@@ -0,0 +1,130 @@
+/* libSoX static formats list (c) 2006-9 Chris Bagwell and SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*-------------------------- Static format handlers --------------------------*/
+
+ FORMAT(aifc)
+ FORMAT(aiff)
+ FORMAT(al)
+ FORMAT(au)
+ FORMAT(avr)
+ FORMAT(cdr)
+ FORMAT(cvsd)
+ FORMAT(cvu)
+ FORMAT(dat)
+ FORMAT(dvms)
+ FORMAT(f4)
+ FORMAT(f8)
+ FORMAT(gsrt)
+ FORMAT(hcom)
+ FORMAT(htk)
+ FORMAT(ima)
+ FORMAT(la)
+ FORMAT(lu)
+ FORMAT(maud)
+ FORMAT(nul)
+ FORMAT(prc)
+ FORMAT(raw)
+ FORMAT(s1)
+ FORMAT(s2)
+ FORMAT(s3)
+ FORMAT(s4)
+ FORMAT(sf)
+ FORMAT(sln)
+ FORMAT(smp)
+ FORMAT(sounder)
+ FORMAT(soundtool)
+ FORMAT(sox)
+ FORMAT(sphere)
+ FORMAT(svx)
+ FORMAT(txw)
+ FORMAT(u1)
+ FORMAT(u2)
+ FORMAT(u3)
+ FORMAT(u4)
+ FORMAT(ul)
+ FORMAT(voc)
+ FORMAT(vox)
+ FORMAT(wav)
+ FORMAT(wve)
+ FORMAT(xa)
+
+/*--------------------- Plugin or static format handlers ---------------------*/
+
+#if defined HAVE_ALSA && (defined STATIC_ALSA || !defined HAVE_LIBLTDL)
+ FORMAT(alsa)
+#endif
+#if defined HAVE_AMRNB && (defined STATIC_AMRNB || !defined HAVE_LIBLTDL)
+ FORMAT(amr_nb)
+#endif
+#if defined HAVE_AMRWB && (defined STATIC_AMRWB || !defined HAVE_LIBLTDL)
+ FORMAT(amr_wb)
+#endif
+#if defined HAVE_AO && (defined STATIC_AO || !defined HAVE_LIBLTDL)
+ FORMAT(ao)
+#endif
+#if defined HAVE_COREAUDIO && (defined STATIC_COREAUDIO || !defined HAVE_LIBLTDL)
+ FORMAT(coreaudio)
+#endif
+#if defined HAVE_FLAC && (defined STATIC_FLAC || !defined HAVE_LIBLTDL)
+ FORMAT(flac)
+#endif
+#if defined HAVE_GSM && (defined STATIC_GSM || !defined HAVE_LIBLTDL)
+ FORMAT(gsm)
+#endif
+#if defined HAVE_LPC10 && (defined STATIC_LPC10 || !defined HAVE_LIBLTDL)
+ FORMAT(lpc10)
+#endif
+#if defined HAVE_MP3 && (defined STATIC_MP3 || !defined HAVE_LIBLTDL)
+ FORMAT(mp3)
+#endif
+#if defined HAVE_OPUS && (defined STATIC_OPUS || !defined HAVE_LIBLTDL)
+ FORMAT(opus)
+#endif
+#if defined HAVE_OSS && (defined STATIC_OSS || !defined HAVE_LIBLTDL)
+ FORMAT(oss)
+#endif
+#if defined HAVE_PULSEAUDIO && (defined STATIC_PULSEAUDIO || !defined HAVE_LIBLTDL)
+ FORMAT(pulseaudio)
+#endif
+#if defined HAVE_WAVEAUDIO && (defined STATIC_WAVEAUDIO || !defined HAVE_LIBLTDL)
+ FORMAT(waveaudio)
+#endif
+#if defined HAVE_SNDIO && (defined STATIC_SNDIO || !defined HAVE_LIBLTDL)
+ FORMAT(sndio)
+#endif
+#if defined HAVE_SNDFILE && (defined STATIC_SNDFILE || !defined HAVE_LIBLTDL)
+ FORMAT(sndfile)
+ FORMAT(caf)
+ FORMAT(fap)
+ FORMAT(mat4)
+ FORMAT(mat5)
+ FORMAT(paf)
+ FORMAT(pvf)
+ FORMAT(sd2)
+ FORMAT(w64)
+ FORMAT(xi)
+#endif
+#if defined HAVE_SUN_AUDIO && (defined STATIC_SUN_AUDIO || !defined HAVE_LIBLTDL)
+ FORMAT(sunau)
+#endif
+#if defined HAVE_OGG_VORBIS && (defined STATIC_OGG_VORBIS || !defined HAVE_LIBLTDL)
+ FORMAT(vorbis)
+#endif
+#if defined HAVE_WAVPACK && (defined STATIC_WAVPACK || !defined HAVE_LIBLTDL)
+ FORMAT(wavpack)
+#endif
diff --git a/src/src/formats_i.c b/src/src/formats_i.c
new file mode 100644
index 0000000..c767528
--- /dev/null
+++ b/src/src/formats_i.c
@@ -0,0 +1,485 @@
+/* Implements a libSoX internal interface for use in implementing file formats.
+ * All public functions & data are prefixed with lsx_ .
+ *
+ * (c) 2005-8 Chris Bagwell and SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+#include <sys/stat.h>
+#include <stdarg.h>
+
+void lsx_fail_errno(sox_format_t * ft, int sox_errno, const char *fmt, ...)
+{
+ va_list args;
+
+ ft->sox_errno = sox_errno;
+
+ va_start(args, fmt);
+#ifdef HAVE_VSNPRINTF
+ vsnprintf(ft->sox_errstr, sizeof(ft->sox_errstr), fmt, args);
+#else
+ vsprintf(ft->sox_errstr, fmt, args);
+#endif
+ va_end(args);
+ ft->sox_errstr[255] = '\0';
+}
+
+void lsx_set_signal_defaults(sox_format_t * ft)
+{
+ if (!ft->signal.rate ) ft->signal.rate = SOX_DEFAULT_RATE;
+ if (!ft->signal.precision) ft->signal.precision = SOX_DEFAULT_PRECISION;
+ if (!ft->signal.channels ) ft->signal.channels = SOX_DEFAULT_CHANNELS;
+
+ if (!ft->encoding.bits_per_sample)
+ ft->encoding.bits_per_sample = ft->signal.precision;
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+}
+
+int lsx_check_read_params(sox_format_t * ft, unsigned channels,
+ sox_rate_t rate, sox_encoding_t encoding, unsigned bits_per_sample,
+ uint64_t num_samples, sox_bool check_length)
+{
+ ft->signal.length = ft->signal.length == SOX_IGNORE_LENGTH? SOX_UNSPEC : num_samples;
+
+ if (ft->seekable)
+ ft->data_start = lsx_tell(ft);
+
+ if (channels && ft->signal.channels && ft->signal.channels != channels)
+ lsx_warn("`%s': overriding number of channels", ft->filename);
+ else ft->signal.channels = channels;
+
+ if (rate && ft->signal.rate && ft->signal.rate != rate)
+ lsx_warn("`%s': overriding sample rate", ft->filename);
+ else ft->signal.rate = rate;
+
+ if (encoding && ft->encoding.encoding && ft->encoding.encoding != encoding)
+ lsx_warn("`%s': overriding encoding type", ft->filename);
+ else ft->encoding.encoding = encoding;
+
+ if (bits_per_sample && ft->encoding.bits_per_sample && ft->encoding.bits_per_sample != bits_per_sample)
+ lsx_warn("`%s': overriding encoding size", ft->filename);
+ ft->encoding.bits_per_sample = bits_per_sample;
+
+ if (check_length && ft->encoding.bits_per_sample && lsx_filelength(ft)) {
+ uint64_t calculated_length = div_bits(lsx_filelength(ft) - ft->data_start, ft->encoding.bits_per_sample);
+ if (!ft->signal.length)
+ ft->signal.length = calculated_length;
+ else if (num_samples != calculated_length)
+ lsx_warn("`%s': file header gives the total number of samples as %" PRIu64 " but file length indicates the number is in fact %" PRIu64, ft->filename, num_samples, calculated_length);
+ }
+
+ if (sox_precision(ft->encoding.encoding, ft->encoding.bits_per_sample))
+ return SOX_SUCCESS;
+ lsx_fail_errno(ft, EINVAL, "invalid format for this file type");
+ return SOX_EOF;
+}
+
+/* Read in a buffer of data of length len bytes.
+ * Returns number of bytes read.
+ */
+size_t lsx_readbuf(sox_format_t * ft, void *buf, size_t len)
+{
+ size_t ret = fread(buf, (size_t) 1, len, (FILE*)ft->fp);
+ if (ret != len && ferror((FILE*)ft->fp))
+ lsx_fail_errno(ft, errno, "lsx_readbuf");
+ ft->tell_off += ret;
+ return ret;
+}
+
+/* Skip input without seeking. */
+int lsx_skipbytes(sox_format_t * ft, size_t n)
+{
+ unsigned char trash;
+
+ while (n--)
+ if (lsx_readb(ft, &trash) == SOX_EOF)
+ return (SOX_EOF);
+
+ return (SOX_SUCCESS);
+}
+
+/* Pad output. */
+int lsx_padbytes(sox_format_t * ft, size_t n)
+{
+ while (n--)
+ if (lsx_writeb(ft, '\0') == SOX_EOF)
+ return (SOX_EOF);
+
+ return (SOX_SUCCESS);
+}
+
+/* Write a buffer of data of length bytes.
+ * Returns number of bytes written.
+ */
+size_t lsx_writebuf(sox_format_t * ft, void const * buf, size_t len)
+{
+ size_t ret = fwrite(buf, (size_t) 1, len, (FILE*)ft->fp);
+ if (ret != len) {
+ lsx_fail_errno(ft, errno, "error writing output file");
+ clearerr((FILE*)ft->fp); /* Allows us to seek back to write header */
+ }
+ ft->tell_off += ret;
+ return ret;
+}
+
+sox_uint64_t lsx_filelength(sox_format_t * ft)
+{
+ struct stat st;
+ int ret = ft->fp ? fstat(fileno((FILE*)ft->fp), &st) : 0;
+
+ return (!ret && (st.st_mode & S_IFREG))? (uint64_t)st.st_size : 0;
+}
+
+int lsx_flush(sox_format_t * ft)
+{
+ return fflush((FILE*)ft->fp);
+}
+
+off_t lsx_tell(sox_format_t * ft)
+{
+ return ft->seekable? (off_t)ftello((FILE*)ft->fp) : (off_t)ft->tell_off;
+}
+
+int lsx_eof(sox_format_t * ft)
+{
+ return feof((FILE*)ft->fp);
+}
+
+int lsx_error(sox_format_t * ft)
+{
+ return ferror((FILE*)ft->fp);
+}
+
+void lsx_rewind(sox_format_t * ft)
+{
+ rewind((FILE*)ft->fp);
+ ft->tell_off = 0;
+}
+
+void lsx_clearerr(sox_format_t * ft)
+{
+ clearerr((FILE*)ft->fp);
+ ft->sox_errno = 0;
+}
+
+int lsx_unreadb(sox_format_t * ft, unsigned b)
+{
+ return ungetc((int)b, ft->fp);
+}
+
+/* Implements traditional fseek() behavior. Meant to abstract out
+ * file operations so that they could one day also work on memory
+ * buffers.
+ *
+ * N.B. Can only seek forwards on non-seekable streams!
+ */
+int lsx_seeki(sox_format_t * ft, off_t offset, int whence)
+{
+ if (ft->seekable == 0) {
+ /* If a stream peel off chars else EPERM */
+ if (whence == SEEK_CUR) {
+ while (offset > 0 && !feof((FILE*)ft->fp)) {
+ getc((FILE*)ft->fp);
+ offset--;
+ ++ft->tell_off;
+ }
+ if (offset)
+ lsx_fail_errno(ft,SOX_EOF, "offset past EOF");
+ else
+ ft->sox_errno = SOX_SUCCESS;
+ } else
+ lsx_fail_errno(ft,SOX_EPERM, "file not seekable");
+ } else {
+ if (fseeko((FILE*)ft->fp, offset, whence) == -1)
+ lsx_fail_errno(ft,errno, "%s", strerror(errno));
+ else
+ ft->sox_errno = SOX_SUCCESS;
+ }
+ return ft->sox_errno;
+}
+
+int lsx_offset_seek(sox_format_t * ft, off_t byte_offset, off_t to_sample)
+{
+ double wide_sample = to_sample - (to_sample % ft->signal.channels);
+ double to_d = wide_sample * ft->encoding.bits_per_sample / 8;
+ off_t to = to_d;
+ return (to != to_d)? SOX_EOF : lsx_seeki(ft, (byte_offset + to), SEEK_SET);
+}
+
+/* Read and write known datatypes in "machine format". Swap if indicated.
+ * They all return SOX_EOF on error and SOX_SUCCESS on success.
+ */
+/* Read n-char string (and possibly null-terminating).
+ * Stop reading and null-terminate string if either a 0 or \n is reached.
+ */
+int lsx_reads(sox_format_t * ft, char *c, size_t len)
+{
+ char *sc;
+ char in;
+
+ sc = c;
+ do
+ {
+ if (lsx_readbuf(ft, &in, (size_t)1) != 1)
+ {
+ *sc = 0;
+ return (SOX_EOF);
+ }
+ if (in == 0 || in == '\n')
+ break;
+
+ *sc = in;
+ sc++;
+ } while (sc - c < (ptrdiff_t)len);
+ *sc = 0;
+ return(SOX_SUCCESS);
+}
+
+/* Write null-terminated string (without \0). */
+int lsx_writes(sox_format_t * ft, char const * c)
+{
+ if (lsx_writebuf(ft, c, strlen(c)) != strlen(c))
+ return(SOX_EOF);
+ return(SOX_SUCCESS);
+}
+
+/* return swapped 32-bit float */
+static void lsx_swapf(float * f)
+{
+ union {
+ uint32_t dw;
+ float f;
+ } u;
+
+ u.f= *f;
+ u.dw= (u.dw>>24) | ((u.dw>>8)&0xff00) | ((u.dw<<8)&0xff0000) | (u.dw<<24);
+ *f = u.f;
+}
+
+static void swap(void * data, size_t len)
+{
+ uint8_t * bytes = (uint8_t *)data;
+ size_t i;
+
+ for (i = 0; i < len / 2; ++i) {
+ char tmp = bytes[i];
+ bytes[i] = bytes[len - 1 - i];
+ bytes[len - 1 - i] = tmp;
+ }
+}
+
+static double lsx_swapdf(double data)
+{
+ swap(&data, sizeof(data));
+ return data;
+}
+
+static uint64_t lsx_swapqw(uint64_t data)
+{
+ swap(&data, sizeof(data));
+ return data;
+}
+
+/* Lookup table to reverse the bit order of a byte. ie MSB become LSB */
+static uint8_t const cswap[256] = {
+ 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0,
+ 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
+ 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, 0x04, 0x84, 0x44, 0xC4,
+ 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
+ 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC,
+ 0x3C, 0xBC, 0x7C, 0xFC, 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
+ 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, 0x0A, 0x8A, 0x4A, 0xCA,
+ 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
+ 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6,
+ 0x36, 0xB6, 0x76, 0xF6, 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
+ 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, 0x01, 0x81, 0x41, 0xC1,
+ 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
+ 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9,
+ 0x39, 0xB9, 0x79, 0xF9, 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
+ 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, 0x0D, 0x8D, 0x4D, 0xCD,
+ 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
+ 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3,
+ 0x33, 0xB3, 0x73, 0xF3, 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
+ 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, 0x07, 0x87, 0x47, 0xC7,
+ 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
+ 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF,
+ 0x3F, 0xBF, 0x7F, 0xFF
+};
+
+/* Utilities to byte-swap values, use libc optimized macros if possible */
+#define TWIDDLE_BYTE(ub, type) \
+ do { \
+ if (ft->encoding.reverse_bits) \
+ ub = cswap[ub]; \
+ if (ft->encoding.reverse_nibbles) \
+ ub = ((ub & 15) << 4) | (ub >> 4); \
+ } while (0);
+
+#define TWIDDLE_WORD(uw, type) \
+ if (ft->encoding.reverse_bytes) \
+ uw = lsx_swap ## type(uw);
+
+#define TWIDDLE_FLOAT(f, type) \
+ if (ft->encoding.reverse_bytes) \
+ lsx_swapf(&f);
+
+/* N.B. This macro doesn't work for unaligned types (e.g. 3-byte
+ types). */
+#define READ_FUNC(type, size, ctype, twiddle) \
+ size_t lsx_read_ ## type ## _buf( \
+ sox_format_t * ft, ctype *buf, size_t len) \
+ { \
+ size_t n, nread; \
+ nread = lsx_readbuf(ft, buf, len * size) / size; \
+ for (n = 0; n < nread; n++) \
+ twiddle(buf[n], type); \
+ return nread; \
+ }
+
+/* Unpack a 3-byte value from a uint8_t * */
+#define sox_unpack3(p) (ft->encoding.reverse_bytes == MACHINE_IS_BIGENDIAN? \
+ ((p)[0] | ((p)[1] << 8) | ((p)[2] << 16)) : \
+ ((p)[2] | ((p)[1] << 8) | ((p)[0] << 16)))
+
+/* This (slower) macro works for unaligned types (e.g. 3-byte types)
+ that need to be unpacked. */
+#define READ_FUNC_UNPACK(type, size, ctype, twiddle) \
+ size_t lsx_read_ ## type ## _buf( \
+ sox_format_t * ft, ctype *buf, size_t len) \
+ { \
+ size_t n, nread; \
+ uint8_t *data = lsx_malloc(size * len); \
+ nread = lsx_readbuf(ft, data, len * size) / size; \
+ for (n = 0; n < nread; n++) \
+ buf[n] = sox_unpack ## size(data + n * size); \
+ free(data); \
+ return n; \
+ }
+
+READ_FUNC(b, 1, uint8_t, TWIDDLE_BYTE)
+READ_FUNC(w, 2, uint16_t, TWIDDLE_WORD)
+READ_FUNC_UNPACK(3, 3, sox_uint24_t, TWIDDLE_WORD)
+READ_FUNC(dw, 4, uint32_t, TWIDDLE_WORD)
+READ_FUNC(qw, 8, uint64_t, TWIDDLE_WORD)
+READ_FUNC(f, sizeof(float), float, TWIDDLE_FLOAT)
+READ_FUNC(df, sizeof(double), double, TWIDDLE_WORD)
+
+#define READ1_FUNC(type, ctype) \
+int lsx_read ## type(sox_format_t * ft, ctype * datum) { \
+ if (lsx_read_ ## type ## _buf(ft, datum, (size_t)1) == 1) \
+ return SOX_SUCCESS; \
+ if (!lsx_error(ft)) \
+ lsx_fail_errno(ft, errno, premature_eof); \
+ return SOX_EOF; \
+}
+
+static char const premature_eof[] = "premature EOF";
+
+READ1_FUNC(b, uint8_t)
+READ1_FUNC(w, uint16_t)
+READ1_FUNC(3, sox_uint24_t)
+READ1_FUNC(dw, uint32_t)
+READ1_FUNC(qw, uint64_t)
+READ1_FUNC(f, float)
+READ1_FUNC(df, double)
+
+int lsx_readchars(sox_format_t * ft, char * chars, size_t len)
+{
+ size_t ret = lsx_readbuf(ft, chars, len);
+ if (ret == len)
+ return SOX_SUCCESS;
+ if (!lsx_error(ft))
+ lsx_fail_errno(ft, errno, premature_eof);
+ return SOX_EOF;
+}
+
+/* N.B. This macro doesn't work for unaligned types (e.g. 3-byte
+ types). */
+#define WRITE_FUNC(type, size, ctype, twiddle) \
+ size_t lsx_write_ ## type ## _buf( \
+ sox_format_t * ft, ctype *buf, size_t len) \
+ { \
+ size_t n, nwritten; \
+ for (n = 0; n < len; n++) \
+ twiddle(buf[n], type); \
+ nwritten = lsx_writebuf(ft, buf, len * size); \
+ return nwritten / size; \
+ }
+
+/* Pack a 3-byte value to a uint8_t * */
+#define sox_pack3(p, v) do {if (ft->encoding.reverse_bytes == MACHINE_IS_BIGENDIAN)\
+{(p)[0] = v & 0xff; (p)[1] = (v >> 8) & 0xff; (p)[2] = (v >> 16) & 0xff;} else \
+{(p)[2] = v & 0xff; (p)[1] = (v >> 8) & 0xff; (p)[0] = (v >> 16) & 0xff;} \
+} while (0)
+
+/* This (slower) macro works for unaligned types (e.g. 3-byte types)
+ that need to be packed. */
+#define WRITE_FUNC_PACK(type, size, ctype, twiddle) \
+ size_t lsx_write_ ## type ## _buf( \
+ sox_format_t * ft, ctype *buf, size_t len) \
+ { \
+ size_t n, nwritten; \
+ uint8_t *data = lsx_malloc(size * len); \
+ for (n = 0; n < len; n++) \
+ sox_pack ## size(data + n * size, buf[n]); \
+ nwritten = lsx_writebuf(ft, data, len * size); \
+ free(data); \
+ return nwritten / size; \
+ }
+
+WRITE_FUNC(b, 1, uint8_t, TWIDDLE_BYTE)
+WRITE_FUNC(w, 2, uint16_t, TWIDDLE_WORD)
+WRITE_FUNC_PACK(3, 3, sox_uint24_t, TWIDDLE_WORD)
+WRITE_FUNC(dw, 4, uint32_t, TWIDDLE_WORD)
+WRITE_FUNC(qw, 8, uint64_t, TWIDDLE_WORD)
+WRITE_FUNC(f, sizeof(float), float, TWIDDLE_FLOAT)
+WRITE_FUNC(df, sizeof(double), double, TWIDDLE_WORD)
+
+#define WRITE1U_FUNC(type, ctype) \
+ int lsx_write ## type(sox_format_t * ft, unsigned d) \
+ { ctype datum = (ctype)d; \
+ return lsx_write_ ## type ## _buf(ft, &datum, (size_t)1) == 1 ? SOX_SUCCESS : SOX_EOF; \
+ }
+
+#define WRITE1S_FUNC(type, ctype) \
+ int lsx_writes ## type(sox_format_t * ft, signed d) \
+ { ctype datum = (ctype)d; \
+ return lsx_write_ ## type ## _buf(ft, &datum, (size_t)1) == 1 ? SOX_SUCCESS : SOX_EOF; \
+ }
+
+#define WRITE1_FUNC(type, ctype) \
+ int lsx_write ## type(sox_format_t * ft, ctype datum) \
+ { \
+ return lsx_write_ ## type ## _buf(ft, &datum, (size_t)1) == 1 ? SOX_SUCCESS : SOX_EOF; \
+ }
+
+WRITE1U_FUNC(b, uint8_t)
+WRITE1U_FUNC(w, uint16_t)
+WRITE1U_FUNC(3, sox_uint24_t)
+WRITE1U_FUNC(dw, uint32_t)
+WRITE1_FUNC(qw, uint64_t)
+WRITE1S_FUNC(b, uint8_t)
+WRITE1S_FUNC(w, uint16_t)
+WRITE1_FUNC(df, double)
+
+int lsx_writef(sox_format_t * ft, double datum)
+{
+ float f = datum;
+ return lsx_write_f_buf(ft, &f, (size_t) 1) == 1 ? SOX_SUCCESS : SOX_EOF;
+}
diff --git a/src/src/g711.c b/src/src/g711.c
new file mode 100644
index 0000000..6338799
--- /dev/null
+++ b/src/src/g711.c
@@ -0,0 +1,2421 @@
+/* libSoX G711.c - G711 u-law, A-law and linear PCM conversions.
+ *
+ * Copyright (C) 2001 Chris Bagwell
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. This software is provided "as is" without express or
+ * implied warranty.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g711.h"
+
+const int16_t lsx_alaw2linear16[256] = {
+ -5504, -5248, -6016, -5760, -4480, -4224, -4992,
+ -4736, -7552, -7296, -8064, -7808, -6528, -6272,
+ -7040, -6784, -2752, -2624, -3008, -2880, -2240,
+ -2112, -2496, -2368, -3776, -3648, -4032, -3904,
+ -3264, -3136, -3520, -3392, -22016, -20992, -24064,
+ -23040, -17920, -16896, -19968, -18944, -30208, -29184,
+ -32256, -31232, -26112, -25088, -28160, -27136, -11008,
+ -10496, -12032, -11520, -8960, -8448, -9984, -9472,
+ -15104, -14592, -16128, -15616, -13056, -12544, -14080,
+ -13568, -344, -328, -376, -360, -280, -264,
+ -312, -296, -472, -456, -504, -488, -408,
+ -392, -440, -424, -88, -72, -120, -104,
+ -24, -8, -56, -40, -216, -200, -248,
+ -232, -152, -136, -184, -168, -1376, -1312,
+ -1504, -1440, -1120, -1056, -1248, -1184, -1888,
+ -1824, -2016, -1952, -1632, -1568, -1760, -1696,
+ -688, -656, -752, -720, -560, -528, -624,
+ -592, -944, -912, -1008, -976, -816, -784,
+ -880, -848, 5504, 5248, 6016, 5760, 4480,
+ 4224, 4992, 4736, 7552, 7296, 8064, 7808,
+ 6528, 6272, 7040, 6784, 2752, 2624, 3008,
+ 2880, 2240, 2112, 2496, 2368, 3776, 3648,
+ 4032, 3904, 3264, 3136, 3520, 3392, 22016,
+ 20992, 24064, 23040, 17920, 16896, 19968, 18944,
+ 30208, 29184, 32256, 31232, 26112, 25088, 28160,
+ 27136, 11008, 10496, 12032, 11520, 8960, 8448,
+ 9984, 9472, 15104, 14592, 16128, 15616, 13056,
+ 12544, 14080, 13568, 344, 328, 376, 360,
+ 280, 264, 312, 296, 472, 456, 504,
+ 488, 408, 392, 440, 424, 88, 72,
+ 120, 104, 24, 8, 56, 40, 216,
+ 200, 248, 232, 152, 136, 184, 168,
+ 1376, 1312, 1504, 1440, 1120, 1056, 1248,
+ 1184, 1888, 1824, 2016, 1952, 1632, 1568,
+ 1760, 1696, 688, 656, 752, 720, 560,
+ 528, 624, 592, 944, 912, 1008, 976,
+ 816, 784, 880, 848
+};
+
+const uint8_t lsx_13linear2alaw[0x2000] = {
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x39, 0x39, 0x39, 0x39,
+ 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
+ 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
+ 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
+ 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
+ 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x33, 0x33, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x30, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x36, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6b, 0x6b, 0x6b, 0x6b,
+ 0x6b, 0x6b, 0x6b, 0x6b, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68,
+ 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x69, 0x6e, 0x6e, 0x6e, 0x6e,
+ 0x6e, 0x6e, 0x6e, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f,
+ 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6d, 0x6d, 0x6d, 0x6d,
+ 0x6d, 0x6d, 0x6d, 0x6d, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62,
+ 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x60, 0x60, 0x60, 0x60,
+ 0x60, 0x60, 0x60, 0x60, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x67, 0x67, 0x67,
+ 0x67, 0x67, 0x67, 0x67, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64,
+ 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x7a, 0x7a, 0x7a, 0x7a,
+ 0x7b, 0x7b, 0x7b, 0x7b, 0x78, 0x78, 0x78, 0x78, 0x79, 0x79, 0x79, 0x79,
+ 0x7e, 0x7e, 0x7e, 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7c, 0x7c, 0x7c, 0x7c,
+ 0x7d, 0x7d, 0x7d, 0x7d, 0x72, 0x72, 0x72, 0x72, 0x73, 0x73, 0x73, 0x73,
+ 0x70, 0x70, 0x70, 0x70, 0x71, 0x71, 0x71, 0x71, 0x76, 0x76, 0x76, 0x76,
+ 0x77, 0x77, 0x77, 0x77, 0x74, 0x74, 0x74, 0x74, 0x75, 0x75, 0x75, 0x75,
+ 0x4a, 0x4a, 0x4b, 0x4b, 0x48, 0x48, 0x49, 0x49, 0x4e, 0x4e, 0x4f, 0x4f,
+ 0x4c, 0x4c, 0x4d, 0x4d, 0x42, 0x42, 0x43, 0x43, 0x40, 0x40, 0x41, 0x41,
+ 0x46, 0x46, 0x47, 0x47, 0x44, 0x44, 0x45, 0x45, 0x5a, 0x5a, 0x5b, 0x5b,
+ 0x58, 0x58, 0x59, 0x59, 0x5e, 0x5e, 0x5f, 0x5f, 0x5c, 0x5c, 0x5d, 0x5d,
+ 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51, 0x56, 0x56, 0x57, 0x57,
+ 0x54, 0x54, 0x55, 0x55, 0xd5, 0xd5, 0xd4, 0xd4, 0xd7, 0xd7, 0xd6, 0xd6,
+ 0xd1, 0xd1, 0xd0, 0xd0, 0xd3, 0xd3, 0xd2, 0xd2, 0xdd, 0xdd, 0xdc, 0xdc,
+ 0xdf, 0xdf, 0xde, 0xde, 0xd9, 0xd9, 0xd8, 0xd8, 0xdb, 0xdb, 0xda, 0xda,
+ 0xc5, 0xc5, 0xc4, 0xc4, 0xc7, 0xc7, 0xc6, 0xc6, 0xc1, 0xc1, 0xc0, 0xc0,
+ 0xc3, 0xc3, 0xc2, 0xc2, 0xcd, 0xcd, 0xcc, 0xcc, 0xcf, 0xcf, 0xce, 0xce,
+ 0xc9, 0xc9, 0xc8, 0xc8, 0xcb, 0xcb, 0xca, 0xca, 0xf5, 0xf5, 0xf5, 0xf5,
+ 0xf4, 0xf4, 0xf4, 0xf4, 0xf7, 0xf7, 0xf7, 0xf7, 0xf6, 0xf6, 0xf6, 0xf6,
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf0, 0xf0, 0xf0, 0xf0, 0xf3, 0xf3, 0xf3, 0xf3,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xfd, 0xfd, 0xfd, 0xfd, 0xfc, 0xfc, 0xfc, 0xfc,
+ 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xf9, 0xf9, 0xf9, 0xf9,
+ 0xf8, 0xf8, 0xf8, 0xf8, 0xfb, 0xfb, 0xfb, 0xfb, 0xfa, 0xfa, 0xfa, 0xfa,
+ 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe4, 0xe4, 0xe4, 0xe4,
+ 0xe4, 0xe4, 0xe4, 0xe4, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7, 0xe7,
+ 0xe6, 0xe6, 0xe6, 0xe6, 0xe6, 0xe6, 0xe6, 0xe6, 0xe1, 0xe1, 0xe1, 0xe1,
+ 0xe1, 0xe1, 0xe1, 0xe1, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0,
+ 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe2, 0xe2, 0xe2, 0xe2,
+ 0xe2, 0xe2, 0xe2, 0xe2, 0xed, 0xed, 0xed, 0xed, 0xed, 0xed, 0xed, 0xed,
+ 0xec, 0xec, 0xec, 0xec, 0xec, 0xec, 0xec, 0xec, 0xef, 0xef, 0xef, 0xef,
+ 0xef, 0xef, 0xef, 0xef, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee,
+ 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0xe9, 0xe8, 0xe8, 0xe8, 0xe8,
+ 0xe8, 0xe8, 0xe8, 0xe8, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb,
+ 0xea, 0xea, 0xea, 0xea, 0xea, 0xea, 0xea, 0xea, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xba, 0xba, 0xba, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa
+};
+
+const int16_t lsx_ulaw2linear16[256] = {
+ -32124, -31100, -30076, -29052, -28028, -27004, -25980,
+ -24956, -23932, -22908, -21884, -20860, -19836, -18812,
+ -17788, -16764, -15996, -15484, -14972, -14460, -13948,
+ -13436, -12924, -12412, -11900, -11388, -10876, -10364,
+ -9852, -9340, -8828, -8316, -7932, -7676, -7420,
+ -7164, -6908, -6652, -6396, -6140, -5884, -5628,
+ -5372, -5116, -4860, -4604, -4348, -4092, -3900,
+ -3772, -3644, -3516, -3388, -3260, -3132, -3004,
+ -2876, -2748, -2620, -2492, -2364, -2236, -2108,
+ -1980, -1884, -1820, -1756, -1692, -1628, -1564,
+ -1500, -1436, -1372, -1308, -1244, -1180, -1116,
+ -1052, -988, -924, -876, -844, -812, -780,
+ -748, -716, -684, -652, -620, -588, -556,
+ -524, -492, -460, -428, -396, -372, -356,
+ -340, -324, -308, -292, -276, -260, -244,
+ -228, -212, -196, -180, -164, -148, -132,
+ -120, -112, -104, -96, -88, -80, -72,
+ -64, -56, -48, -40, -32, -24, -16,
+ -8, 0, 32124, 31100, 30076, 29052, 28028,
+ 27004, 25980, 24956, 23932, 22908, 21884, 20860,
+ 19836, 18812, 17788, 16764, 15996, 15484, 14972,
+ 14460, 13948, 13436, 12924, 12412, 11900, 11388,
+ 10876, 10364, 9852, 9340, 8828, 8316, 7932,
+ 7676, 7420, 7164, 6908, 6652, 6396, 6140,
+ 5884, 5628, 5372, 5116, 4860, 4604, 4348,
+ 4092, 3900, 3772, 3644, 3516, 3388, 3260,
+ 3132, 3004, 2876, 2748, 2620, 2492, 2364,
+ 2236, 2108, 1980, 1884, 1820, 1756, 1692,
+ 1628, 1564, 1500, 1436, 1372, 1308, 1244,
+ 1180, 1116, 1052, 988, 924, 876, 844,
+ 812, 780, 748, 716, 684, 652, 620,
+ 588, 556, 524, 492, 460, 428, 396,
+ 372, 356, 340, 324, 308, 292, 276,
+ 260, 244, 228, 212, 196, 180, 164,
+ 148, 132, 120, 112, 104, 96, 88,
+ 80, 72, 64, 56, 48, 40, 32,
+ 24, 16, 8, 0
+};
+
+const uint8_t lsx_14linear2ulaw[0x4000] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
+ 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
+ 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
+ 0x0f, 0x0f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
+ 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
+ 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
+ 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
+ 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a,
+ 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b,
+ 0x1b, 0x1b, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
+ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d,
+ 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
+ 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21,
+ 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
+ 0x23, 0x23, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
+ 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
+ 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
+ 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
+ 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29,
+ 0x29, 0x29, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b,
+ 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,
+ 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
+ 0x2f, 0x2f, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+ 0x32, 0x32, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
+ 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
+ 0x35, 0x35, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
+ 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+ 0x38, 0x38, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
+ 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39,
+ 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
+ 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
+ 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x43, 0x43,
+ 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43,
+ 0x43, 0x43, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
+ 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x46,
+ 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46,
+ 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
+ 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48,
+ 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49,
+ 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
+ 0x49, 0x49, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
+ 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b,
+ 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4c, 0x4c,
+ 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,
+ 0x4c, 0x4c, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d,
+ 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4e, 0x4e, 0x4e, 0x4e, 0x4e, 0x4e,
+ 0x4e, 0x4e, 0x4e, 0x4e, 0x4e, 0x4e, 0x4e, 0x4e, 0x4e, 0x4e, 0x4f, 0x4f,
+ 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
+ 0x4f, 0x4f, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x51, 0x51,
+ 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52,
+ 0x52, 0x52, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x54, 0x54,
+ 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x57, 0x57,
+ 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
+ 0x58, 0x58, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x5a, 0x5a,
+ 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5b, 0x5b, 0x5b, 0x5b, 0x5b, 0x5b,
+ 0x5b, 0x5b, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5d, 0x5d,
+ 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e,
+ 0x5e, 0x5e, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x60, 0x60,
+ 0x60, 0x60, 0x61, 0x61, 0x61, 0x61, 0x62, 0x62, 0x62, 0x62, 0x63, 0x63,
+ 0x63, 0x63, 0x64, 0x64, 0x64, 0x64, 0x65, 0x65, 0x65, 0x65, 0x66, 0x66,
+ 0x66, 0x66, 0x67, 0x67, 0x67, 0x67, 0x68, 0x68, 0x68, 0x68, 0x69, 0x69,
+ 0x69, 0x69, 0x6a, 0x6a, 0x6a, 0x6a, 0x6b, 0x6b, 0x6b, 0x6b, 0x6c, 0x6c,
+ 0x6c, 0x6c, 0x6d, 0x6d, 0x6d, 0x6d, 0x6e, 0x6e, 0x6e, 0x6e, 0x6f, 0x6f,
+ 0x6f, 0x6f, 0x70, 0x70, 0x71, 0x71, 0x72, 0x72, 0x73, 0x73, 0x74, 0x74,
+ 0x75, 0x75, 0x76, 0x76, 0x77, 0x77, 0x78, 0x78, 0x79, 0x79, 0x7a, 0x7a,
+ 0x7b, 0x7b, 0x7c, 0x7c, 0x7d, 0x7d, 0x7e, 0x7e, 0xff, 0xfe, 0xfe, 0xfd,
+ 0xfd, 0xfc, 0xfc, 0xfb, 0xfb, 0xfa, 0xfa, 0xf9, 0xf9, 0xf8, 0xf8, 0xf7,
+ 0xf7, 0xf6, 0xf6, 0xf5, 0xf5, 0xf4, 0xf4, 0xf3, 0xf3, 0xf2, 0xf2, 0xf1,
+ 0xf1, 0xf0, 0xf0, 0xef, 0xef, 0xef, 0xef, 0xee, 0xee, 0xee, 0xee, 0xed,
+ 0xed, 0xed, 0xed, 0xec, 0xec, 0xec, 0xec, 0xeb, 0xeb, 0xeb, 0xeb, 0xea,
+ 0xea, 0xea, 0xea, 0xe9, 0xe9, 0xe9, 0xe9, 0xe8, 0xe8, 0xe8, 0xe8, 0xe7,
+ 0xe7, 0xe7, 0xe7, 0xe6, 0xe6, 0xe6, 0xe6, 0xe5, 0xe5, 0xe5, 0xe5, 0xe4,
+ 0xe4, 0xe4, 0xe4, 0xe3, 0xe3, 0xe3, 0xe3, 0xe2, 0xe2, 0xe2, 0xe2, 0xe1,
+ 0xe1, 0xe1, 0xe1, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf,
+ 0xdf, 0xdf, 0xdf, 0xde, 0xde, 0xde, 0xde, 0xde, 0xde, 0xde, 0xde, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc,
+ 0xdc, 0xdc, 0xdc, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xda,
+ 0xda, 0xda, 0xda, 0xda, 0xda, 0xda, 0xda, 0xd9, 0xd9, 0xd9, 0xd9, 0xd9,
+ 0xd9, 0xd9, 0xd9, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd7,
+ 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6,
+ 0xd6, 0xd6, 0xd6, 0xd5, 0xd5, 0xd5, 0xd5, 0xd5, 0xd5, 0xd5, 0xd5, 0xd4,
+ 0xd4, 0xd4, 0xd4, 0xd4, 0xd4, 0xd4, 0xd4, 0xd3, 0xd3, 0xd3, 0xd3, 0xd3,
+ 0xd3, 0xd3, 0xd3, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, 0xd1,
+ 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0,
+ 0xd0, 0xd0, 0xd0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf,
+ 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xce, 0xce, 0xce, 0xce, 0xce,
+ 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xcd,
+ 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
+ 0xcd, 0xcd, 0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb,
+ 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xca,
+ 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca,
+ 0xca, 0xca, 0xca, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9,
+ 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8,
+ 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc7,
+ 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7,
+ 0xc7, 0xc7, 0xc7, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
+ 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5,
+ 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc4,
+ 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4,
+ 0xc4, 0xc4, 0xc4, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3,
+ 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2,
+ 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc1,
+ 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1,
+ 0xc1, 0xc1, 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
+ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
+ 0xbf, 0xbf, 0xbf, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd,
+ 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc,
+ 0xbc, 0xbc, 0xbc, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
+ 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba,
+ 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9,
+ 0xb9, 0xb9, 0xb9, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8,
+ 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7,
+ 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6,
+ 0xb6, 0xb6, 0xb6, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5,
+ 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4,
+ 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3,
+ 0xb3, 0xb3, 0xb3, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2,
+ 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1,
+ 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0,
+ 0xb0, 0xb0, 0xb0, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
+ 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae,
+ 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad,
+ 0xad, 0xad, 0xad, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
+ 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9,
+ 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8,
+ 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7,
+ 0xa7, 0xa7, 0xa7, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6,
+ 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
+ 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4,
+ 0xa4, 0xa4, 0xa4, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3,
+ 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2,
+ 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1,
+ 0xa1, 0xa1, 0xa1, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0,
+ 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
+ 0x9f, 0x9f, 0x9f, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+ 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d,
+ 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c,
+ 0x9c, 0x9c, 0x9c, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b,
+ 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a,
+ 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
+ 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
+ 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
+ 0x96, 0x96, 0x96, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
+ 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
+ 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
+ 0x93, 0x93, 0x93, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
+ 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
+ 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
+ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e,
+ 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d,
+ 0x8d, 0x8d, 0x8d, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
+ 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b,
+ 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a,
+ 0x8a, 0x8a, 0x8a, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
+ 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
+ 0x87, 0x87, 0x87, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
+ 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
+ 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
+ 0x84, 0x84, 0x84, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
+ 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
+ 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
+ 0x81, 0x81, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80
+};
+
+/* The following code was used to generate the lookup tables */
+#ifdef GENERATE_TABLES
+
+#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */
+#define QUANT_MASK (0xf) /* Quantization field mask. */
+#define NSEGS (8) /* Number of A-law segments. */
+#define SEG_SHIFT (4) /* Left shift for segment number. */
+#define SEG_MASK (0x70) /* Segment field mask. */
+
+static const int16_t seg_aend[8] = {0x1F, 0x3F, 0x7F, 0xFF,
+ 0x1FF, 0x3FF, 0x7FF, 0xFFF};
+static const int16_t seg_uend[8] = {0x3F, 0x7F, 0xFF, 0x1FF,
+ 0x3FF, 0x7FF, 0xFFF, 0x1FFF};
+
+static int16_t search(
+ int16_t val,
+ int16_t *table,
+ int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (val <= *table++)
+ return (i);
+ }
+ return (size);
+}
+
+/*
+ * linear2alaw() accepts an 13-bit signed integer and encodes it as A-law data
+ * stored in a unsigned char. This function should only be called with
+ * the data shifted such that it only contains information in the lower
+ * 13-bits.
+ *
+ * Linear Input Code Compressed Code
+ * ------------------------ ---------------
+ * 0000000wxyza 000wxyz
+ * 0000001wxyza 001wxyz
+ * 000001wxyzab 010wxyz
+ * 00001wxyzabc 011wxyz
+ * 0001wxyzabcd 100wxyz
+ * 001wxyzabcde 101wxyz
+ * 01wxyzabcdef 110wxyz
+ * 1wxyzabcdefg 111wxyz
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley & Sons, pps 98-111 and 472-476.
+ */
+unsigned char sox_13linear2alaw(
+ int16_t pcm_val) /* 2's complement (13-bit range) */
+{
+ int16_t mask;
+ short seg;
+ unsigned char aval;
+
+ /* Have calling software do it since its already doing a shift
+ * from 32-bits down to 16-bits.
+ */
+ /* pcm_val = pcm_val >> 3; */
+
+ if (pcm_val >= 0) {
+ mask = 0xD5; /* sign (7th) bit = 1 */
+ } else {
+ mask = 0x55; /* sign bit = 0 */
+ pcm_val = -pcm_val - 1;
+ }
+
+ /* Convert the scaled magnitude to segment number. */
+ seg = search(pcm_val, seg_aend, 8);
+
+ /* Combine the sign, segment, and quantization bits. */
+
+ if (seg >= 8) /* out of range, return maximum value. */
+ return (unsigned char) (0x7F ^ mask);
+ else {
+ aval = (unsigned char) seg << SEG_SHIFT;
+ if (seg < 2)
+ aval |= (pcm_val >> 1) & QUANT_MASK;
+ else
+ aval |= (pcm_val >> seg) & QUANT_MASK;
+ return (aval ^ mask);
+ }
+}
+
+/*
+ * alaw2linear() - Convert an A-law value to 16-bit signed linear PCM
+ *
+ */
+int16_t sox_alaw2linear16(
+ unsigned char a_val)
+{
+ int16_t t;
+ int16_t seg;
+
+ a_val ^= 0x55;
+
+ t = (a_val & QUANT_MASK) << 4;
+ seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
+ switch (seg) {
+ case 0:
+ t += 8;
+ break;
+ case 1:
+ t += 0x108;
+ break;
+ default:
+ t += 0x108;
+ t <<= seg - 1;
+ }
+ return ((a_val & SIGN_BIT) ? t : -t);
+}
+
+#define BIAS (0x84) /* Bias for linear code. */
+#define CLIP 8159
+
+/*
+ * linear2ulaw() accepts a 14-bit signed integer and encodes it as u-law data
+ * stored in a unsigned char. This function should only be called with
+ * the data shifted such that it only contains information in the lower
+ * 14-bits.
+ *
+ * In order to simplify the encoding process, the original linear magnitude
+ * is biased by adding 33 which shifts the encoding range from (0 - 8158) to
+ * (33 - 8191). The result can be seen in the following encoding table:
+ *
+ * Biased Linear Input Code Compressed Code
+ * ------------------------ ---------------
+ * 00000001wxyza 000wxyz
+ * 0000001wxyzab 001wxyz
+ * 000001wxyzabc 010wxyz
+ * 00001wxyzabcd 011wxyz
+ * 0001wxyzabcde 100wxyz
+ * 001wxyzabcdef 101wxyz
+ * 01wxyzabcdefg 110wxyz
+ * 1wxyzabcdefgh 111wxyz
+ *
+ * Each biased linear code has a leading 1 which identifies the segment
+ * number. The value of the segment number is equal to 7 minus the number
+ * of leading 0's. The quantization interval is directly available as the
+ * four bits wxyz. * The trailing bits (a - h) are ignored.
+ *
+ * Ordinarily the complement of the resulting code word is used for
+ * transmission, and so the code word is complemented before it is returned.
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley & Sons, pps 98-111 and 472-476.
+ */
+unsigned char sox_14linear2ulaw(
+ int16_t pcm_val) /* 2's complement (14-bit range) */
+{
+ int16_t mask;
+ int16_t seg;
+ unsigned char uval;
+
+ /* Have calling software do it since its already doing a shift
+ * from 32-bits down to 16-bits.
+ */
+ /* pcm_val = pcm_val >> 2; */
+
+ /* Get the sign and the magnitude of the value. */
+ if (pcm_val < 0) {
+ pcm_val = -pcm_val;
+ mask = 0x7F;
+ } else {
+ mask = 0xFF;
+ }
+ if ( pcm_val > CLIP ) pcm_val = CLIP; /* clip the magnitude */
+ pcm_val += (BIAS >> 2);
+
+ /* Convert the scaled magnitude to segment number. */
+ seg = search(pcm_val, seg_uend, 8);
+
+ /*
+ * Combine the sign, segment, quantization bits;
+ * and complement the code word.
+ */
+ if (seg >= 8) /* out of range, return maximum value. */
+ return (unsigned char) (0x7F ^ mask);
+ else {
+ uval = (unsigned char) (seg << 4) | ((pcm_val >> (seg + 1)) & 0xF);
+ return (uval ^ mask);
+ }
+
+}
+
+/*
+ * ulaw2linear() - Convert a u-law value to 16-bit linear PCM
+ *
+ * First, a biased linear code is derived from the code word. An unbiased
+ * output can then be obtained by subtracting 33 from the biased code.
+ *
+ * Note that this function expects to be passed the complement of the
+ * original code word. This is in keeping with ISDN conventions.
+ */
+int16_t sox_ulaw2linear16(
+ unsigned char u_val)
+{
+ int16_t t;
+
+ /* Complement to obtain normal u-law value. */
+ u_val = ~u_val;
+
+ /*
+ * Extract and bias the quantization bits. Then
+ * shift up by the segment number and subtract out the bias.
+ */
+ t = ((u_val & QUANT_MASK) << 3) + BIAS;
+ t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
+
+ return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS));
+}
+
+int main(void)
+{
+ int x, y, find2a = 0;
+
+ y = 0;
+ printf("int16_t lsx_alaw2linear16[256] = {\n ");
+ for (x = 0; x < 256; x++)
+ {
+ printf("%8d,", sox_alaw2linear16(x));
+ y++;
+ if (y == 7)
+ {
+ y = 0;
+ printf("\n ");
+ }
+ }
+
+ printf("\n};\n\nuint8_t lsx_13linear2alaw[0x2000] = {\n ");
+ y = 0;
+ for (x = 0; x < 0x2000; x++)
+ {
+ printf(" 0x%02x,", sox_13linear2alaw((-0x1000)+x));
+ y++;
+ if (y == 12)
+ {
+ y = 0;
+ printf("\n ");
+ }
+ }
+
+ printf("\n};\n\nint16_t lsx_ulaw2linear16[256] = {\n ");
+ y = 0;
+ for (x = 0; x < 256; x++)
+ {
+ printf("%8d,", sox_ulaw2linear16(x));
+ y++;
+ if (y == 7)
+ {
+ y = 0;
+ printf("\n ");
+ }
+ }
+
+ printf("\n};\n\nuint8_t lsx_14linear2ulaw[0x4000] = {\n ");
+ y = 0;
+ for (x = 0; x < 0x4000; x++)
+ {
+ printf(" 0x%02x,", sox_14linear2ulaw((-0x2000)+x));
+ y++;
+ if (y == 12)
+ {
+ y = 0;
+ printf("\n ");
+ }
+ }
+ printf("\n};\n");
+
+}
+#endif
diff --git a/src/src/g711.h b/src/src/g711.h
new file mode 100644
index 0000000..06326e0
--- /dev/null
+++ b/src/src/g711.h
@@ -0,0 +1,21 @@
+/* libSoX G711.h - include for G711 u-law and a-law conversion routines
+ *
+ * Copyright (C) 2001 Chris Bagwell
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. This software is provided "as is" without express or
+ * implied warranty.
+ */
+
+extern const uint8_t lsx_13linear2alaw[0x2000];
+extern const int16_t lsx_alaw2linear16[256];
+#define sox_13linear2alaw(sw) (lsx_13linear2alaw[((sw) + 0x1000)])
+#define sox_alaw2linear16(uc) (lsx_alaw2linear16[uc])
+
+extern const uint8_t lsx_14linear2ulaw[0x4000];
+extern const int16_t lsx_ulaw2linear16[256];
+#define sox_14linear2ulaw(sw) (lsx_14linear2ulaw[((sw) + 0x2000)])
+#define sox_ulaw2linear16(uc) (lsx_ulaw2linear16[uc])
diff --git a/src/src/g721.c b/src/src/g721.c
new file mode 100644
index 0000000..43a3f59
--- /dev/null
+++ b/src/src/g721.c
@@ -0,0 +1,167 @@
+/* This source code is a product of Sun Microsystems, Inc. and is provided
+ * for unrestricted use. Users may copy or modify this source code without
+ * charge.
+ *
+ * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
+ * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun source code is provided with no support and without any obligation on
+ * the part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * g721.c
+ *
+ * Description:
+ *
+ * g721_encoder(), g721_decoder()
+ *
+ * These routines comprise an implementation of the CCITT G.721 ADPCM
+ * coding algorithm. Essentially, this implementation is identical to
+ * the bit level description except for a few deviations which
+ * take advantage of work station attributes, such as hardware 2's
+ * complement arithmetic and large memory. Specifically, certain time
+ * consuming operations such as multiplications are replaced
+ * with lookup tables and software 2's complement operations are
+ * replaced with hardware 2's complement.
+ *
+ * The deviation from the bit level specification (lookup tables)
+ * preserves the bit level performance specifications.
+ *
+ * As outlined in the G.721 Recommendation, the algorithm is broken
+ * down into modules. Each section of code below is preceded by
+ * the name of the module which it is implementing.
+ *
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g72x.h"
+#include "third_party/sox/src/src/g711.h"
+
+static const short qtab_721[7] = {-124, 80, 178, 246, 300, 349, 400};
+/*
+ * Maps G.721 code word to reconstructed scale factor normalized log
+ * magnitude values.
+ */
+static const short _dqlntab[16] = {-2048, 4, 135, 213, 273, 323, 373, 425,
+ 425, 373, 323, 273, 213, 135, 4, -2048};
+
+/* Maps G.721 code word to log of scale factor multiplier. */
+static const short _witab[16] = {-12, 18, 41, 64, 112, 198, 355, 1122,
+ 1122, 355, 198, 112, 64, 41, 18, -12};
+/*
+ * Maps G.721 code words to a set of values whose long and short
+ * term averages are computed and then compared to give an indication
+ * how stationary (steady state) the signal is.
+ */
+static const short _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00,
+ 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0};
+
+/*
+ * g721_encoder()
+ *
+ * Encodes the input vale of linear PCM, A-law or u-law data sl and returns
+ * the resulting code. -1 is returned for unknown input coding value.
+ */
+int g721_encoder(int sl, int in_coding, struct g72x_state *state_ptr)
+{
+ short sezi, se, sez; /* ACCUM */
+ short d; /* SUBTA */
+ short sr; /* ADDB */
+ short y; /* MIX */
+ short dqsez; /* ADDC */
+ short dq, i;
+
+ switch (in_coding) { /* linearize input sample to 14-bit PCM */
+ case AUDIO_ENCODING_ALAW:
+ sl = sox_alaw2linear16(sl) >> 2;
+ break;
+ case AUDIO_ENCODING_ULAW:
+ sl = sox_ulaw2linear16(sl) >> 2;
+ break;
+ case AUDIO_ENCODING_LINEAR:
+ sl >>= 2; /* 14-bit dynamic range */
+ break;
+ default:
+ return (-1);
+ }
+
+ sezi = predictor_zero(state_ptr);
+ sez = sezi >> 1;
+ se = (sezi + predictor_pole(state_ptr)) >> 1; /* estimated signal */
+
+ d = sl - se; /* estimation difference */
+
+ /* quantize the prediction difference */
+ y = step_size(state_ptr); /* quantizer step size */
+ i = quantize(d, y, qtab_721, 7); /* i = ADPCM code */
+
+ dq = reconstruct(i & 8, _dqlntab[i], y); /* quantized est diff */
+
+ sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconst. signal */
+
+ dqsez = sr + sez - se; /* pole prediction diff. */
+
+ update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
+
+ return (i);
+}
+
+/*
+ * g721_decoder()
+ *
+ * Description:
+ *
+ * Decodes a 4-bit code of G.721 encoded data of i and
+ * returns the resulting linear PCM, A-law or u-law value.
+ * return -1 for unknown out_coding value.
+ */
+int g721_decoder(int i, int out_coding, struct g72x_state *state_ptr)
+{
+ short sezi, sei, sez, se; /* ACCUM */
+ short y; /* MIX */
+ short sr; /* ADDB */
+ short dq;
+ short dqsez;
+
+ i &= 0x0f; /* mask to get proper bits */
+ sezi = predictor_zero(state_ptr);
+ sez = sezi >> 1;
+ sei = sezi + predictor_pole(state_ptr);
+ se = sei >> 1; /* se = estimated signal */
+
+ y = step_size(state_ptr); /* dynamic quantizer step size */
+
+ dq = reconstruct(i & 0x08, _dqlntab[i], y); /* quantized diff. */
+
+ sr = (dq < 0) ? (se - (dq & 0x3FFF)) : se + dq; /* reconst. signal */
+
+ dqsez = sr - se + sez; /* pole prediction diff. */
+
+ update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
+
+ switch (out_coding) {
+ case AUDIO_ENCODING_ALAW:
+ return (tandem_adjust_alaw(sr, se, y, i, 8, qtab_721));
+ case AUDIO_ENCODING_ULAW:
+ return (tandem_adjust_ulaw(sr, se, y, i, 8, qtab_721));
+ case AUDIO_ENCODING_LINEAR:
+ return (sr << 2); /* sr was 14-bit dynamic range */
+ default:
+ return (-1);
+ }
+}
diff --git a/src/src/g723_24.c b/src/src/g723_24.c
new file mode 100644
index 0000000..e8e6f42
--- /dev/null
+++ b/src/src/g723_24.c
@@ -0,0 +1,151 @@
+/* This source code is a product of Sun Microsystems, Inc. and is provided
+ * for unrestricted use. Users may copy or modify this source code without
+ * charge.
+ *
+ * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
+ * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun source code is provided with no support and without any obligation on
+ * the part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * g723_24.c
+ *
+ * Description:
+ *
+ * g723_24_encoder(), g723_24_decoder()
+ *
+ * These routines comprise an implementation of the CCITT G.723 24 Kbps
+ * ADPCM coding algorithm. Essentially, this implementation is identical to
+ * the bit level description except for a few deviations which take advantage
+ * of workstation attributes, such as hardware 2's complement arithmetic.
+ *
+ */
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g711.h"
+#include "third_party/sox/src/src/g72x.h"
+
+/*
+ * Maps G.723_24 code word to reconstructed scale factor normalized log
+ * magnitude values.
+ */
+static const short _dqlntab[8] = {-2048, 135, 273, 373, 373, 273, 135, -2048};
+
+/* Maps G.723_24 code word to log of scale factor multiplier. */
+static const short _witab[8] = {-128, 960, 4384, 18624, 18624, 4384, 960, -128};
+
+/*
+ * Maps G.723_24 code words to a set of values whose long and short
+ * term averages are computed and then compared to give an indication
+ * how stationary (steady state) the signal is.
+ */
+static const short _fitab[8] = {0, 0x200, 0x400, 0xE00, 0xE00, 0x400, 0x200, 0};
+
+static const short qtab_723_24[3] = {8, 218, 331};
+
+/*
+ * g723_24_encoder()
+ *
+ * Encodes a linear PCM, A-law or u-law input sample and returns its 3-bit code.
+ * Returns -1 if invalid input coding value.
+ */
+int g723_24_encoder(int sl, int in_coding, struct g72x_state *state_ptr)
+{
+ short sei, sezi, se, sez; /* ACCUM */
+ short d; /* SUBTA */
+ short y; /* MIX */
+ short sr; /* ADDB */
+ short dqsez; /* ADDC */
+ short dq, i;
+
+ switch (in_coding) { /* linearize input sample to 14-bit PCM */
+ case AUDIO_ENCODING_ALAW:
+ sl = sox_alaw2linear16(sl) >> 2;
+ break;
+ case AUDIO_ENCODING_ULAW:
+ sl = sox_ulaw2linear16(sl) >> 2;
+ break;
+ case AUDIO_ENCODING_LINEAR:
+ sl >>= 2; /* sl of 14-bit dynamic range */
+ break;
+ default:
+ return (-1);
+ }
+
+ sezi = predictor_zero(state_ptr);
+ sez = sezi >> 1;
+ sei = sezi + predictor_pole(state_ptr);
+ se = sei >> 1; /* se = estimated signal */
+
+ d = sl - se; /* d = estimation diff. */
+
+ /* quantize prediction difference d */
+ y = step_size(state_ptr); /* quantizer step size */
+ i = quantize(d, y, qtab_723_24, 3); /* i = ADPCM code */
+ dq = reconstruct(i & 4, _dqlntab[i], y); /* quantized diff. */
+
+ sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */
+
+ dqsez = sr + sez - se; /* pole prediction diff. */
+
+ update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
+
+ return (i);
+}
+
+/*
+ * g723_24_decoder()
+ *
+ * Decodes a 3-bit CCITT G.723_24 ADPCM code and returns
+ * the resulting 16-bit linear PCM, A-law or u-law sample value.
+ * -1 is returned if the output coding is unknown.
+ */
+int g723_24_decoder(int i, int out_coding, struct g72x_state *state_ptr)
+{
+ short sezi, sei, sez, se; /* ACCUM */
+ short y; /* MIX */
+ short sr; /* ADDB */
+ short dq;
+ short dqsez;
+
+ i &= 0x07; /* mask to get proper bits */
+ sezi = predictor_zero(state_ptr);
+ sez = sezi >> 1;
+ sei = sezi + predictor_pole(state_ptr);
+ se = sei >> 1; /* se = estimated signal */
+
+ y = step_size(state_ptr); /* adaptive quantizer step size */
+ dq = reconstruct(i & 0x04, _dqlntab[i], y); /* unquantize pred diff */
+
+ sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */
+
+ dqsez = sr - se + sez; /* pole prediction diff. */
+
+ update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
+
+ switch (out_coding) {
+ case AUDIO_ENCODING_ALAW:
+ return (tandem_adjust_alaw(sr, se, y, i, 4, qtab_723_24));
+ case AUDIO_ENCODING_ULAW:
+ return (tandem_adjust_ulaw(sr, se, y, i, 4, qtab_723_24));
+ case AUDIO_ENCODING_LINEAR:
+ return (sr << 2); /* sr was of 14-bit dynamic range */
+ default:
+ return (-1);
+ }
+}
diff --git a/src/src/g723_40.c b/src/src/g723_40.c
new file mode 100644
index 0000000..b0adc5d
--- /dev/null
+++ b/src/src/g723_40.c
@@ -0,0 +1,171 @@
+/* This source code is a product of Sun Microsystems, Inc. and is provided
+ * for unrestricted use. Users may copy or modify this source code without
+ * charge.
+ *
+ * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
+ * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun source code is provided with no support and without any obligation on
+ * the part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * g723_40.c
+ *
+ * Description:
+ *
+ * g723_40_encoder(), g723_40_decoder()
+ *
+ * These routines comprise an implementation of the CCITT G.723 40Kbps
+ * ADPCM coding algorithm. Essentially, this implementation is identical to
+ * the bit level description except for a few deviations which
+ * take advantage of workstation attributes, such as hardware 2's
+ * complement arithmetic.
+ *
+ * The deviation from the bit level specification (lookup tables),
+ * preserves the bit level performance specifications.
+ *
+ * As outlined in the G.723 Recommendation, the algorithm is broken
+ * down into modules. Each section of code below is preceded by
+ * the name of the module which it is implementing.
+ *
+ */
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g711.h"
+#include "third_party/sox/src/src/g72x.h"
+
+/*
+ * Maps G.723_40 code word to ructeconstructed scale factor normalized log
+ * magnitude values.
+ */
+static const short _dqlntab[32] = {-2048, -66, 28, 104, 169, 224, 274, 318,
+ 358, 395, 429, 459, 488, 514, 539, 566,
+ 566, 539, 514, 488, 459, 429, 395, 358,
+ 318, 274, 224, 169, 104, 28, -66, -2048};
+
+/* Maps G.723_40 code word to log of scale factor multiplier. */
+static const short _witab[32] = {448, 448, 768, 1248, 1280, 1312, 1856, 3200,
+ 4512, 5728, 7008, 8960, 11456, 14080, 16928, 22272,
+ 22272, 16928, 14080, 11456, 8960, 7008, 5728, 4512,
+ 3200, 1856, 1312, 1280, 1248, 768, 448, 448};
+
+/*
+ * Maps G.723_40 code words to a set of values whose long and short
+ * term averages are computed and then compared to give an indication
+ * how stationary (steady state) the signal is.
+ */
+static const short _fitab[32] = {0, 0, 0, 0, 0, 0x200, 0x200, 0x200,
+ 0x200, 0x200, 0x400, 0x600, 0x800, 0xA00, 0xC00, 0xC00,
+ 0xC00, 0xC00, 0xA00, 0x800, 0x600, 0x400, 0x200, 0x200,
+ 0x200, 0x200, 0x200, 0, 0, 0, 0, 0};
+
+static const short qtab_723_40[15] = {-122, -16, 68, 139, 198, 250, 298, 339,
+ 378, 413, 445, 475, 502, 528, 553};
+
+/*
+ * g723_40_encoder()
+ *
+ * Encodes a 16-bit linear PCM, A-law or u-law input sample and retuens
+ * the resulting 5-bit CCITT G.723 40Kbps code.
+ * Returns -1 if the input coding value is invalid.
+ */
+int g723_40_encoder(int sl, int in_coding, struct g72x_state *state_ptr)
+{
+ short sei, sezi, se, sez; /* ACCUM */
+ short d; /* SUBTA */
+ short y; /* MIX */
+ short sr; /* ADDB */
+ short dqsez; /* ADDC */
+ short dq, i;
+
+ switch (in_coding) { /* linearize input sample to 14-bit PCM */
+ case AUDIO_ENCODING_ALAW:
+ sl = sox_alaw2linear16(sl) >> 2;
+ break;
+ case AUDIO_ENCODING_ULAW:
+ sl = sox_ulaw2linear16(sl) >> 2;
+ break;
+ case AUDIO_ENCODING_LINEAR:
+ sl >>= 2; /* sl of 14-bit dynamic range */
+ break;
+ default:
+ return (-1);
+ }
+
+ sezi = predictor_zero(state_ptr);
+ sez = sezi >> 1;
+ sei = sezi + predictor_pole(state_ptr);
+ se = sei >> 1; /* se = estimated signal */
+
+ d = sl - se; /* d = estimation difference */
+
+ /* quantize prediction difference */
+ y = step_size(state_ptr); /* adaptive quantizer step size */
+ i = quantize(d, y, qtab_723_40, 15); /* i = ADPCM code */
+
+ dq = reconstruct(i & 0x10, _dqlntab[i], y); /* quantized diff */
+
+ sr = (dq < 0) ? se - (dq & 0x7FFF) : se + dq; /* reconstructed signal */
+
+ dqsez = sr + sez - se; /* dqsez = pole prediction diff. */
+
+ update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
+
+ return (i);
+}
+
+/*
+ * g723_40_decoder()
+ *
+ * Decodes a 5-bit CCITT G.723 40Kbps code and returns
+ * the resulting 16-bit linear PCM, A-law or u-law sample value.
+ * -1 is returned if the output coding is unknown.
+ */
+int g723_40_decoder(int i, int out_coding, struct g72x_state *state_ptr)
+{
+ short sezi, sei, sez, se; /* ACCUM */
+ short y; /* MIX */
+ short sr; /* ADDB */
+ short dq;
+ short dqsez;
+
+ i &= 0x1f; /* mask to get proper bits */
+ sezi = predictor_zero(state_ptr);
+ sez = sezi >> 1;
+ sei = sezi + predictor_pole(state_ptr);
+ se = sei >> 1; /* se = estimated signal */
+
+ y = step_size(state_ptr); /* adaptive quantizer step size */
+ dq = reconstruct(i & 0x10, _dqlntab[i], y); /* estimation diff. */
+
+ sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); /* reconst. signal */
+
+ dqsez = sr - se + sez; /* pole prediction diff. */
+
+ update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
+
+ switch (out_coding) {
+ case AUDIO_ENCODING_ALAW:
+ return (tandem_adjust_alaw(sr, se, y, i, 0x10, qtab_723_40));
+ case AUDIO_ENCODING_ULAW:
+ return (tandem_adjust_ulaw(sr, se, y, i, 0x10, qtab_723_40));
+ case AUDIO_ENCODING_LINEAR:
+ return (sr << 2); /* sr was of 14-bit dynamic range */
+ default:
+ return (-1);
+ }
+}
diff --git a/src/src/g72x.c b/src/src/g72x.c
new file mode 100644
index 0000000..368c123
--- /dev/null
+++ b/src/src/g72x.c
@@ -0,0 +1,575 @@
+/* Common routines for G.721 and G.723 conversions.
+ *
+ * (c) SoX Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *
+ * This code is based on code from Sun, which came with the following
+ * copyright notice:
+ * -----------------------------------------------------------------------
+ * This source code is a product of Sun Microsystems, Inc. and is provided
+ * for unrestricted use. Users may copy or modify this source code without
+ * charge.
+ *
+ * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
+ * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun source code is provided with no support and without any obligation on
+ * the part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ * -----------------------------------------------------------------------
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g711.h"
+#include "third_party/sox/src/src/g72x.h"
+
+static const char LogTable256[] =
+{
+ 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
+};
+
+static inline int log2plus1(int val)
+{
+ /* From http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup */
+ unsigned int v = (unsigned int)val; /* 32-bit word to find the log of */
+ unsigned r; /* r will be lg(v) */
+ register unsigned int t, tt; /* temporaries */
+
+ if ((tt = v >> 16))
+ {
+ r = (t = tt >> 8) ? 24 + LogTable256[t] : 16 + LogTable256[tt];
+ }
+ else
+ {
+ r = (t = v >> 8) ? 8 + LogTable256[t] : LogTable256[v];
+ }
+
+ return r + 1;
+}
+
+/*
+ * quan()
+ *
+ * quantizes the input val against the table of size short integers.
+ * It returns i if table[i - 1] <= val < table[i].
+ *
+ * Using linear search for simple coding.
+ */
+static int quan(int val, short const *table, int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++)
+ if (val < *table++)
+ break;
+ return (i);
+}
+
+/*
+ * fmult()
+ *
+ * returns the integer product of the 14-bit integer "an" and
+ * "floating point" representation (4-bit exponent, 6-bit mantessa) "srn".
+ */
+static int fmult(int an, int srn)
+{
+ short anmag, anexp, anmant;
+ short wanexp, wanmant;
+ short retval;
+
+ anmag = (an > 0) ? an : ((-an) & 0x1FFF);
+ anexp = log2plus1(anmag) - 6;
+ anmant = (anmag == 0) ? 32 :
+ (anexp >= 0) ? anmag >> anexp : anmag << -anexp;
+ wanexp = anexp + ((srn >> 6) & 0xF) - 13;
+
+ wanmant = (anmant * (srn & 077) + 0x30) >> 4;
+ retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) :
+ (wanmant >> -wanexp);
+
+ return (((an ^ srn) < 0) ? -retval : retval);
+}
+
+/*
+ * g72x_init_state()
+ *
+ * This routine initializes and/or resets the g72x_state structure
+ * pointed to by 'state_ptr'.
+ * All the initial state values are specified in the CCITT G.721 document.
+ */
+void g72x_init_state(struct g72x_state *state_ptr)
+{
+ int cnta;
+
+ state_ptr->yl = 34816;
+ state_ptr->yu = 544;
+ state_ptr->dms = 0;
+ state_ptr->dml = 0;
+ state_ptr->ap = 0;
+ for (cnta = 0; cnta < 2; cnta++) {
+ state_ptr->a[cnta] = 0;
+ state_ptr->pk[cnta] = 0;
+ state_ptr->sr[cnta] = 32;
+ }
+ for (cnta = 0; cnta < 6; cnta++) {
+ state_ptr->b[cnta] = 0;
+ state_ptr->dq[cnta] = 32;
+ }
+ state_ptr->td = 0;
+}
+
+/*
+ * predictor_zero()
+ *
+ * computes the estimated signal from 6-zero predictor.
+ *
+ */
+int predictor_zero(struct g72x_state *state_ptr)
+{
+ int i;
+ int sezi;
+
+ sezi = fmult(state_ptr->b[0] >> 2, state_ptr->dq[0]);
+ for (i = 1; i < 6; i++) /* ACCUM */
+ sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]);
+ return (sezi);
+}
+/*
+ * predictor_pole()
+ *
+ * computes the estimated signal from 2-pole predictor.
+ *
+ */
+int predictor_pole(struct g72x_state *state_ptr)
+{
+ return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) +
+ fmult(state_ptr->a[0] >> 2, state_ptr->sr[0]));
+}
+/*
+ * step_size()
+ *
+ * computes the quantization step size of the adaptive quantizer.
+ *
+ */
+int step_size(struct g72x_state *state_ptr)
+{
+ int y;
+ int dif;
+ int al;
+
+ if (state_ptr->ap >= 256)
+ return (state_ptr->yu);
+ else {
+ y = state_ptr->yl >> 6;
+ dif = state_ptr->yu - y;
+ al = state_ptr->ap >> 2;
+ if (dif > 0)
+ y += (dif * al) >> 6;
+ else if (dif < 0)
+ y += (dif * al + 0x3F) >> 6;
+ return (y);
+ }
+}
+
+/*
+ * quantize()
+ *
+ * Given a raw sample, 'd', of the difference signal and a
+ * quantization step size scale factor, 'y', this routine returns the
+ * ADPCM codeword to which that sample gets quantized. The step
+ * size scale factor division operation is done in the log base 2 domain
+ * as a subtraction.
+ */
+int quantize(int d, int y, short const *table, int size)
+{
+ short dqm; /* Magnitude of 'd' */
+ short exp; /* Integer part of base 2 log of 'd' */
+ short mant; /* Fractional part of base 2 log */
+ short dl; /* Log of magnitude of 'd' */
+ short dln; /* Step size scale factor normalized log */
+ int i;
+
+ /*
+ * LOG
+ *
+ * Compute base 2 log of 'd', and store in 'dl'.
+ */
+ dqm = abs(d);
+ exp = log2plus1(dqm >> 1);
+ mant = ((dqm << 7) >> exp) & 0x7F; /* Fractional portion. */
+ dl = (exp << 7) + mant;
+
+ /*
+ * SUBTB
+ *
+ * "Divide" by step size multiplier.
+ */
+ dln = dl - (y >> 2);
+
+ /*
+ * QUAN
+ *
+ * Obtain codword i for 'd'.
+ */
+ i = quan(dln, table, size);
+ if (d < 0) /* take 1's complement of i */
+ return ((size << 1) + 1 - i);
+ else if (i == 0) /* take 1's complement of 0 */
+ return ((size << 1) + 1); /* new in 1988 */
+ else
+ return (i);
+}
+/*
+ * reconstruct()
+ *
+ * Returns reconstructed difference signal 'dq' obtained from
+ * codeword 'i' and quantization step size scale factor 'y'.
+ * Multiplication is performed in log base 2 domain as addition.
+ */
+int reconstruct(int sign, int dqln, int y)
+{
+ short dql; /* Log of 'dq' magnitude */
+ short dex; /* Integer part of log */
+ short dqt;
+ short dq; /* Reconstructed difference signal sample */
+
+ dql = dqln + (y >> 2); /* ADDA */
+
+ if (dql < 0) {
+ return ((sign) ? -0x8000 : 0);
+ } else { /* ANTILOG */
+ dex = (dql >> 7) & 15;
+ dqt = 128 + (dql & 127);
+ dq = (dqt << 7) >> (14 - dex);
+ return ((sign) ? (dq - 0x8000) : dq);
+ }
+}
+
+
+/*
+ * update()
+ *
+ * updates the state variables for each output code
+ */
+void update(int code_size, int y, int wi, int fi, int dq, int sr,
+ int dqsez, struct g72x_state *state_ptr)
+{
+ int cnt;
+ short mag, exp; /* Adaptive predictor, FLOAT A */
+ short a2p=0; /* LIMC */
+ short a1ul; /* UPA1 */
+ short pks1; /* UPA2 */
+ short fa1;
+ char tr; /* tone/transition detector */
+ short ylint, thr2, dqthr;
+ short ylfrac, thr1;
+ short pk0;
+
+ pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */
+
+ mag = dq & 0x7FFF; /* prediction difference magnitude */
+ /* TRANS */
+ ylint = state_ptr->yl >> 15; /* exponent part of yl */
+ ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */
+ thr1 = (32 + ylfrac) << ylint; /* threshold */
+ thr2 = (ylint > 9) ? 31 << 10 : thr1; /* limit thr2 to 31 << 10 */
+ dqthr = (thr2 + (thr2 >> 1)) >> 1; /* dqthr = 0.75 * thr2 */
+ if (state_ptr->td == 0) /* signal supposed voice */
+ tr = 0;
+ else if (mag <= dqthr) /* supposed data, but small mag */
+ tr = 0; /* treated as voice */
+ else /* signal is data (modem) */
+ tr = 1;
+
+ /*
+ * Quantizer scale factor adaptation.
+ */
+
+ /* FUNCTW & FILTD & DELAY */
+ /* update non-steady state step size multiplier */
+ state_ptr->yu = y + ((wi - y) >> 5);
+
+ /* LIMB */
+ if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */
+ state_ptr->yu = 544;
+ else if (state_ptr->yu > 5120)
+ state_ptr->yu = 5120;
+
+ /* FILTE & DELAY */
+ /* update steady state step size multiplier */
+ state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6);
+
+ /*
+ * Adaptive predictor coefficients.
+ */
+ if (tr == 1) { /* reset a's and b's for modem signal */
+ state_ptr->a[0] = 0;
+ state_ptr->a[1] = 0;
+ state_ptr->b[0] = 0;
+ state_ptr->b[1] = 0;
+ state_ptr->b[2] = 0;
+ state_ptr->b[3] = 0;
+ state_ptr->b[4] = 0;
+ state_ptr->b[5] = 0;
+ } else { /* update a's and b's */
+ pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */
+
+ /* update predictor pole a[1] */
+ a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7);
+ if (dqsez != 0) {
+ fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0];
+ if (fa1 < -8191) /* a2p = function of fa1 */
+ a2p -= 0x100;
+ else if (fa1 > 8191)
+ a2p += 0xFF;
+ else
+ a2p += fa1 >> 5;
+
+ if (pk0 ^ state_ptr->pk[1])
+ {
+ /* LIMC */
+ if (a2p <= -12160)
+ a2p = -12288;
+ else if (a2p >= 12416)
+ a2p = 12288;
+ else
+ a2p -= 0x80;
+ }
+ else if (a2p <= -12416)
+ a2p = -12288;
+ else if (a2p >= 12160)
+ a2p = 12288;
+ else
+ a2p += 0x80;
+ }
+
+ /* Possible bug: a2p not initialized if dqsez == 0) */
+ /* TRIGB & DELAY */
+ state_ptr->a[1] = a2p;
+
+ /* UPA1 */
+ /* update predictor pole a[0] */
+ state_ptr->a[0] -= state_ptr->a[0] >> 8;
+ if (dqsez != 0)
+ {
+ if (pks1 == 0)
+ state_ptr->a[0] += 192;
+ else
+ state_ptr->a[0] -= 192;
+ }
+ /* LIMD */
+ a1ul = 15360 - a2p;
+ if (state_ptr->a[0] < -a1ul)
+ state_ptr->a[0] = -a1ul;
+ else if (state_ptr->a[0] > a1ul)
+ state_ptr->a[0] = a1ul;
+
+ /* UPB : update predictor zeros b[6] */
+ for (cnt = 0; cnt < 6; cnt++) {
+ if (code_size == 5) /* for 40Kbps G.723 */
+ state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9;
+ else /* for G.721 and 24Kbps G.723 */
+ state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8;
+ if (dq & 0x7FFF) { /* XOR */
+ if ((dq ^ state_ptr->dq[cnt]) >= 0)
+ state_ptr->b[cnt] += 128;
+ else
+ state_ptr->b[cnt] -= 128;
+ }
+ }
+ }
+
+ for (cnt = 5; cnt > 0; cnt--)
+ state_ptr->dq[cnt] = state_ptr->dq[cnt-1];
+ /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */
+ if (mag == 0) {
+ state_ptr->dq[0] = (dq >= 0) ? 0x20 : (short)(unsigned short)0xFC20;
+ } else {
+ exp = log2plus1(mag);
+ state_ptr->dq[0] = (dq >= 0) ?
+ (exp << 6) + ((mag << 6) >> exp) :
+ (exp << 6) + ((mag << 6) >> exp) - 0x400;
+ }
+
+ state_ptr->sr[1] = state_ptr->sr[0];
+ /* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */
+ if (sr == 0) {
+ state_ptr->sr[0] = 0x20;
+ } else if (sr > 0) {
+ exp = log2plus1(sr);
+ state_ptr->sr[0] = (exp << 6) + ((sr << 6) >> exp);
+ } else if (sr > -32768) {
+ mag = -sr;
+ exp = log2plus1(mag);
+ state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400;
+ } else
+ state_ptr->sr[0] = (short)(unsigned short)0xFC20;
+
+ /* DELAY A */
+ state_ptr->pk[1] = state_ptr->pk[0];
+ state_ptr->pk[0] = pk0;
+
+ /* TONE */
+ if (tr == 1) /* this sample has been treated as data */
+ state_ptr->td = 0; /* next one will be treated as voice */
+ else if (a2p < -11776) /* small sample-to-sample correlation */
+ state_ptr->td = 1; /* signal may be data */
+ else /* signal is voice */
+ state_ptr->td = 0;
+
+ /*
+ * Adaptation speed control.
+ */
+ state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */
+ state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */
+
+ if (tr == 1)
+ state_ptr->ap = 256;
+ else if (y < 1536) /* SUBTC */
+ state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
+ else if (state_ptr->td == 1)
+ state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
+ else if (abs((state_ptr->dms << 2) - state_ptr->dml) >=
+ (state_ptr->dml >> 3))
+ state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
+ else
+ state_ptr->ap += (-state_ptr->ap) >> 4;
+}
+
+/*
+ * tandem_adjust(sr, se, y, i, sign)
+ *
+ * At the end of ADPCM decoding, it simulates an encoder which may be receiving
+ * the output of this decoder as a tandem process. If the output of the
+ * simulated encoder differs from the input to this decoder, the decoder output
+ * is adjusted by one level of A-law or u-law codes.
+ *
+ * Input:
+ * sr decoder output linear PCM sample,
+ * se predictor estimate sample,
+ * y quantizer step size,
+ * i decoder input code,
+ * sign sign bit of code i
+ *
+ * Return:
+ * adjusted A-law or u-law compressed sample.
+ */
+int tandem_adjust_alaw(int sr, int se, int y, int i, int sign, short const *qtab)
+{
+ unsigned char sp; /* A-law compressed 8-bit code */
+ short dx; /* prediction error */
+ char id; /* quantized prediction error */
+ int sd; /* adjusted A-law decoded sample value */
+ int im; /* biased magnitude of i */
+ int imx; /* biased magnitude of id */
+
+ if (sr <= -32768)
+ sr = -1;
+ sp = sox_13linear2alaw(((sr >> 1) << 3));/* short to A-law compression */
+ dx = (sox_alaw2linear16(sp) >> 2) - se; /* 16-bit prediction error */
+ id = quantize(dx, y, qtab, sign - 1);
+
+ if (id == i) { /* no adjustment on sp */
+ return (sp);
+ } else { /* sp adjustment needed */
+ /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */
+ im = i ^ sign; /* 2's complement to biased unsigned */
+ imx = id ^ sign;
+
+ if (imx > im) { /* sp adjusted to next lower value */
+ if (sp & 0x80) {
+ sd = (sp == 0xD5) ? 0x55 :
+ ((sp ^ 0x55) - 1) ^ 0x55;
+ } else {
+ sd = (sp == 0x2A) ? 0x2A :
+ ((sp ^ 0x55) + 1) ^ 0x55;
+ }
+ } else { /* sp adjusted to next higher value */
+ if (sp & 0x80)
+ sd = (sp == 0xAA) ? 0xAA :
+ ((sp ^ 0x55) + 1) ^ 0x55;
+ else
+ sd = (sp == 0x55) ? 0xD5 :
+ ((sp ^ 0x55) - 1) ^ 0x55;
+ }
+ return (sd);
+ }
+}
+
+int tandem_adjust_ulaw(int sr, int se, int y, int i, int sign, short const *qtab)
+{
+ unsigned char sp; /* u-law compressed 8-bit code */
+ short dx; /* prediction error */
+ char id; /* quantized prediction error */
+ int sd; /* adjusted u-law decoded sample value */
+ int im; /* biased magnitude of i */
+ int imx; /* biased magnitude of id */
+
+ if (sr <= -32768)
+ sr = 0;
+ sp = sox_14linear2ulaw((sr << 2));/* short to u-law compression */
+ dx = (sox_ulaw2linear16(sp) >> 2) - se; /* 16-bit prediction error */
+ id = quantize(dx, y, qtab, sign - 1);
+ if (id == i) {
+ return (sp);
+ } else {
+ /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */
+ im = i ^ sign; /* 2's complement to biased unsigned */
+ imx = id ^ sign;
+ if (imx > im) { /* sp adjusted to next lower value */
+ if (sp & 0x80)
+ sd = (sp == 0xFF) ? 0x7E : sp + 1;
+ else
+ sd = (sp == 0) ? 0 : sp - 1;
+
+ } else { /* sp adjusted to next higher value */
+ if (sp & 0x80)
+ sd = (sp == 0x80) ? 0x80 : sp - 1;
+ else
+ sd = (sp == 0x7F) ? 0xFE : sp + 1;
+ }
+ return (sd);
+ }
+}
diff --git a/src/src/g72x.h b/src/src/g72x.h
new file mode 100644
index 0000000..7e8d5f2
--- /dev/null
+++ b/src/src/g72x.h
@@ -0,0 +1,157 @@
+/* This source code is a product of Sun Microsystems, Inc. and is provided
+ * for unrestricted use. Users may copy or modify this source code without
+ * charge.
+ *
+ * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
+ * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun source code is provided with no support and without any obligation on
+ * the part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+/*
+ * g72x.h
+ *
+ * Header file for CCITT conversion routines.
+ *
+ */
+#ifndef _G72X_H
+#define _G72X_H
+
+/* aliases */
+#define g721_decoder lsx_g721_decoder
+#define g721_encoder lsx_g721_encoder
+#define g723_24_decoder lsx_g723_24_decoder
+#define g723_24_encoder lsx_g723_24_encoder
+#define g723_40_decoder lsx_g723_40_decoder
+#define g723_40_encoder lsx_g723_40_encoder
+#define g72x_init_state lsx_g72x_init_state
+#define predictor_pole lsx_g72x_predictor_pole
+#define predictor_zero lsx_g72x_predictor_zero
+#define quantize lsx_g72x_quantize
+#define reconstruct lsx_g72x_reconstruct
+#define step_size lsx_g72x_step_size
+#define tandem_adjust_alaw lsx_g72x_tandem_adjust_alaw
+#define tandem_adjust_ulaw lsx_g72x_tandem_adjust_ulaw
+#define update lsx_g72x_update
+
+#define AUDIO_ENCODING_ULAW (1) /* ISDN u-law */
+#define AUDIO_ENCODING_ALAW (2) /* ISDN A-law */
+#define AUDIO_ENCODING_LINEAR (3) /* PCM 2's-complement (0-center) */
+
+/*
+ * The following is the definition of the state structure
+ * used by the G.721/G.723 encoder and decoder to preserve their internal
+ * state between successive calls. The meanings of the majority
+ * of the state structure fields are explained in detail in the
+ * CCITT Recommendation G.721. The field names are essentially indentical
+ * to variable names in the bit level description of the coding algorithm
+ * included in this Recommendation.
+ */
+struct g72x_state {
+ long yl; /* Locked or steady state step size multiplier. */
+ short yu; /* Unlocked or non-steady state step size multiplier. */
+ short dms; /* Short term energy estimate. */
+ short dml; /* Long term energy estimate. */
+ short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */
+
+ short a[2]; /* Coefficients of pole portion of prediction filter. */
+ short b[6]; /* Coefficients of zero portion of prediction filter. */
+ short pk[2]; /*
+ * Signs of previous two samples of a partially
+ * reconstructed signal.
+ */
+ short dq[6]; /*
+ * Previous 6 samples of the quantized difference
+ * signal represented in an internal floating point
+ * format.
+ */
+ short sr[2]; /*
+ * Previous 2 samples of the quantized difference
+ * signal represented in an internal floating point
+ * format.
+ */
+ char td; /* delayed tone detect, new in 1988 version */
+};
+
+/* External function definitions. */
+
+extern void g72x_init_state(struct g72x_state *);
+extern int g721_encoder(
+ int sample,
+ int in_coding,
+ struct g72x_state *state_ptr);
+extern int g721_decoder(
+ int code,
+ int out_coding,
+ struct g72x_state *state_ptr);
+extern int g723_16_encoder(
+ int sample,
+ int in_coding,
+ struct g72x_state *state_ptr);
+extern int g723_16_decoder(
+ int code,
+ int out_coding,
+ struct g72x_state *state_ptr);
+extern int g723_24_encoder(
+ int sample,
+ int in_coding,
+ struct g72x_state *state_ptr);
+extern int g723_24_decoder(
+ int code,
+ int out_coding,
+ struct g72x_state *state_ptr);
+extern int g723_40_encoder(
+ int sample,
+ int in_coding,
+ struct g72x_state *state_ptr);
+extern int g723_40_decoder(
+ int code,
+ int out_coding,
+ struct g72x_state *state_ptr);
+
+int predictor_zero(struct g72x_state *state_ptr);
+int predictor_pole(struct g72x_state *state_ptr);
+int step_size(struct g72x_state *state_ptr);
+int quantize(int d,
+ int y,
+ short const *table,
+ int size);
+int reconstruct(int sign,
+ int dqln,
+ int y);
+void update(int code_size,
+ int y,
+ int wi,
+ int fi,
+ int dq,
+ int sr,
+ int dqsez,
+ struct g72x_state *state_ptr);
+int tandem_adjust_alaw(int sr,
+ int se,
+ int y,
+ int i,
+ int sign,
+ short const *qtab);
+int tandem_adjust_ulaw(int sr,
+ int se,
+ int y,
+ int i,
+ int sign,
+ short const *qtab);
+#endif /* !_G72X_H */
diff --git a/src/src/gain.c b/src/src/gain.c
new file mode 100644
index 0000000..37c0db2
--- /dev/null
+++ b/src/src/gain.c
@@ -0,0 +1,276 @@
+/* libSoX effect: gain/norm/etc. (c) 2008-9 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define LSX_EFF_ALIAS
+#include "third_party/sox/src/src/sox_i.h"
+#include <ctype.h>
+#include <string.h>
+
+typedef struct {
+ sox_bool do_equalise, do_balance, do_balance_no_clip, do_limiter;
+ sox_bool do_restore, make_headroom, do_normalise, do_scan;
+ double fixed_gain; /* Valid only in channel 0 */
+
+ double mult, reclaim, rms, limiter;
+ off_t num_samples;
+ sox_sample_t min, max;
+ FILE * tmp_file;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ char const * q;
+ for (--argc, ++argv; argc && **argv == '-' && argv[0][1] &&
+ !isdigit((unsigned char)argv[0][1]) && argv[0][1] != '.'; --argc, ++argv)
+ for (q = &argv[0][1]; *q; ++q) switch (*q) {
+ case 'n': p->do_scan = p->do_normalise = sox_true; break;
+ case 'e': p->do_scan = p->do_equalise = sox_true; break;
+ case 'B': p->do_scan = p->do_balance = sox_true; break;
+ case 'b': p->do_scan = p->do_balance_no_clip = sox_true; break;
+ case 'r': p->do_scan = p->do_restore = sox_true; break;
+ case 'h': p->make_headroom = sox_true; break;
+ case 'l': p->do_limiter = sox_true; break;
+ default: lsx_fail("invalid option `-%c'", *q); return lsx_usage(effp);
+ }
+ if ((p->do_equalise + p->do_balance + p->do_balance_no_clip + p->do_restore)/ sox_true > 1) {
+ lsx_fail("only one of -e, -B, -b, -r may be given");
+ return SOX_EOF;
+ }
+ if (p->do_normalise && p->do_restore) {
+ lsx_fail("only one of -n, -r may be given");
+ return SOX_EOF;
+ }
+ if (p->do_limiter && p->make_headroom) {
+ lsx_fail("only one of -l, -h may be given");
+ return SOX_EOF;
+ }
+ do {NUMERIC_PARAMETER(fixed_gain, -HUGE_VAL, HUGE_VAL)} while (0);
+ p->fixed_gain = dB_to_linear(p->fixed_gain);
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ if (effp->flow == 0) {
+ if (p->do_restore) {
+ if (!effp->in_signal.mult || *effp->in_signal.mult >= 1) {
+ lsx_fail("can't reclaim headroom");
+ return SOX_EOF;
+ }
+ p->reclaim = 1 / *effp->in_signal.mult;
+ }
+ effp->out_signal.mult = p->make_headroom? &p->fixed_gain : NULL;
+ if (!p->do_equalise && !p->do_balance && !p->do_balance_no_clip)
+ effp->flows = 1; /* essentially a conditional SOX_EFF_MCHAN */
+ }
+ p->mult = 0;
+ p->max = 1;
+ p->min = -1;
+ if (p->do_scan) {
+ p->tmp_file = lsx_tmpfile();
+ if (p->tmp_file == NULL) {
+ lsx_fail("can't create temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ }
+ if (p->do_limiter)
+ p->limiter = (1 - 1 / p->fixed_gain) * (1. / SOX_SAMPLE_MAX);
+ else if (p->fixed_gain == floor(p->fixed_gain) && !p->do_scan)
+ effp->out_signal.precision = effp->in_signal.precision;
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len;
+
+ if (p->do_scan) {
+ if (fwrite(ibuf, sizeof(*ibuf), *isamp, p->tmp_file) != *isamp) {
+ lsx_fail("error writing temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ if (p->do_balance && !p->do_normalise)
+ for (len = *isamp; len; --len, ++ibuf) {
+ double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf, effp->clips);
+ p->rms += sqr(d);
+ ++p->num_samples;
+ }
+ else if (p->do_balance || p->do_balance_no_clip)
+ for (len = *isamp; len; --len, ++ibuf) {
+ double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf, effp->clips);
+ p->rms += sqr(d);
+ ++p->num_samples;
+ p->max = max(p->max, *ibuf);
+ p->min = min(p->min, *ibuf);
+ }
+ else for (len = *isamp; len; --len, ++ibuf) {
+ p->max = max(p->max, *ibuf);
+ p->min = min(p->min, *ibuf);
+ }
+ *osamp = 0; /* samples not output until drain */
+ }
+ else {
+ double mult = ((priv_t *)(effp - effp->flow)->priv)->fixed_gain;
+ len = *isamp = *osamp = min(*isamp, *osamp);
+ if (!p->do_limiter) for (; len; --len, ++ibuf)
+ *obuf++ = SOX_ROUND_CLIP_COUNT(*ibuf * mult, effp->clips);
+ else for (; len; --len, ++ibuf) {
+ double d = *ibuf * mult;
+ *obuf++ = d < 0 ? 1 / (1 / d - p->limiter) - .5 :
+ d > 0 ? 1 / (1 / d + p->limiter) + .5 : 0;
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+static void start_drain(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ double max = SOX_SAMPLE_MAX, max_peak = 0, max_rms = 0;
+ size_t i;
+
+ if (p->do_balance || p->do_balance_no_clip) {
+ for (i = 0; i < effp->flows; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ max_rms = max(max_rms, sqrt(q->rms / q->num_samples));
+ rewind(q->tmp_file);
+ }
+ for (i = 0; i < effp->flows; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ double this_rms = sqrt(q->rms / q->num_samples);
+ double this_peak = max(q->max / max, q->min / (double)SOX_SAMPLE_MIN);
+ q->mult = this_rms != 0? max_rms / this_rms : 1;
+ max_peak = max(max_peak, q->mult * this_peak);
+ q->mult *= p->fixed_gain;
+ }
+ if (p->do_normalise || (p->do_balance_no_clip && max_peak > 1))
+ for (i = 0; i < effp->flows; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ q->mult /= max_peak;
+ }
+ } else if (p->do_equalise && !p->do_normalise) {
+ for (i = 0; i < effp->flows; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ double this_peak = max(q->max / max, q->min / (double)SOX_SAMPLE_MIN);
+ max_peak = max(max_peak, this_peak);
+ q->mult = p->fixed_gain / this_peak;
+ rewind(q->tmp_file);
+ }
+ for (i = 0; i < effp->flows; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ q->mult *= max_peak;
+ }
+ } else {
+ p->mult = min(max / p->max, (double)SOX_SAMPLE_MIN / p->min);
+ if (p->do_restore) {
+ if (p->reclaim > p->mult)
+ lsx_report("%.3gdB not reclaimed", linear_to_dB(p->reclaim / p->mult));
+ else p->mult = p->reclaim;
+ }
+ p->mult *= p->fixed_gain;
+ rewind(p->tmp_file);
+ }
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len;
+ int result = SOX_SUCCESS;
+
+ *osamp -= *osamp % effp->in_signal.channels;
+
+ if (p->do_scan) {
+ if (!p->mult)
+ start_drain(effp);
+ len = fread(obuf, sizeof(*obuf), *osamp, p->tmp_file);
+ if (len != *osamp && !feof(p->tmp_file)) {
+ lsx_fail("error reading temporary file: %s", strerror(errno));
+ result = SOX_EOF;
+ }
+ if (!p->do_limiter) for (*osamp = len; len; --len, ++obuf)
+ *obuf = SOX_ROUND_CLIP_COUNT(*obuf * p->mult, effp->clips);
+ else for (*osamp = len; len; --len) {
+ double d = *obuf * p->mult;
+ *obuf++ = d < 0 ? 1 / (1 / d - p->limiter) - .5 :
+ d > 0 ? 1 / (1 / d + p->limiter) + .5 : 0;
+ }
+ }
+ else *osamp = 0;
+ return result;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (p->do_scan)
+ fclose(p->tmp_file); /* auto-deleted by lsx_tmpfile */
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_gain_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "gain", NULL, SOX_EFF_GAIN,
+ create, start, flow, drain, stop, NULL, sizeof(priv_t)};
+ static char const * lines[] = {
+ "[-e|-b|-B|-r] [-n] [-l|-h] [gain-dB]",
+ "-e\t Equalise channels: peak to that with max peak;",
+ "-B\t Balance channels: rms to that with max rms; no clip protection",
+ "-b\t Balance channels: rms to that with max rms; clip protection",
+ "\t Note -Bn = -bn",
+ "-r\t Reclaim headroom (as much as possible without clipping); see -h",
+ "-n\t Norm file to 0dBfs(output precision); gain-dB, if present, usually <0",
+ "-l\t Use simple limiter",
+ "-h\t Apply attenuation for headroom for subsequent effects; gain-dB, if",
+ "\t present, is subject to reclaim by a subsequent gain -r",
+ "gain-dB\t Apply gain in dB",
+ };
+ static char * usage;
+ handler.usage = lsx_usage_lines(&usage, lines, array_length(lines));
+ return &handler;
+}
+
+/*------------------ emulation of the old `normalise' effect -----------------*/
+
+static int norm_getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ char * argv2[3];
+ int argc2 = 2;
+
+ argv2[0] = argv[0], --argc, ++argv;
+ argv2[1] = "-n";
+ if (argc)
+ argv2[argc2++] = *argv, --argc, ++argv;
+ return argc? lsx_usage(effp) :
+ lsx_gain_effect_fn()->getopts(effp, argc2, argv2);
+}
+
+sox_effect_handler_t const * lsx_norm_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_gain_effect_fn();
+ handler.name = "norm";
+ handler.usage = "[level]";
+ handler.getopts = norm_getopts;
+ return &handler;
+}
diff --git a/src/src/getopt.c b/src/src/getopt.c
new file mode 100644
index 0000000..793f650
--- /dev/null
+++ b/src/src/getopt.c
@@ -0,0 +1,349 @@
+/* lsx_getopt for SoX
+ *
+ * (c) 2011 Doug Cook and SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox.h"
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+void
+lsx_getopt_init(
+ LSX_PARAM_IN int argc, /* Number of arguments in argv */
+ LSX_PARAM_IN_COUNT(argc) char * const * argv, /* Array of arguments */
+ LSX_PARAM_IN_Z char const * shortopts, /* Short option characters */
+ LSX_PARAM_IN_OPT lsx_option_t const * longopts, /* Array of long option descriptors */
+ LSX_PARAM_IN lsx_getopt_flags_t flags, /* Flags for longonly and opterr */
+ LSX_PARAM_IN int first, /* First argument to check (usually 1) */
+ LSX_PARAM_OUT lsx_getopt_t * state) /* State object to initialize */
+{
+ assert(argc >= 0);
+ assert(argv != NULL);
+ assert(shortopts);
+ assert(first >= 0);
+ assert(first <= argc);
+ assert(state);
+ if (state)
+ {
+ if (argc < 0 ||
+ !argv ||
+ !shortopts ||
+ first < 0 ||
+ first > argc)
+ {
+ memset(state, 0, sizeof(*state));
+ }
+ else
+ {
+ state->argc = argc;
+ state->argv = argv;
+ state->shortopts =
+ (shortopts[0] == '+' || shortopts[0] == '-') /* Requesting GNU special behavior? */
+ ? shortopts + 1 /* Ignore request. */
+ : shortopts; /* No special behavior requested. */
+ state->longopts = longopts;
+ state->flags = flags;
+ state->curpos = NULL;
+ state->ind = first;
+ state->opt = '?';
+ state->arg = NULL;
+ state->lngind = -1;
+ }
+ }
+}
+
+static void CheckCurPosEnd(
+ LSX_PARAM_INOUT lsx_getopt_t * state)
+{
+ if (!state->curpos[0])
+ {
+ state->curpos = NULL;
+ state->ind++;
+ }
+}
+
+int
+lsx_getopt(
+ LSX_PARAM_INOUT lsx_getopt_t * state)
+{
+ int oerr;
+ assert(state);
+ if (!state)
+ {
+ lsx_fail("lsx_getopt called with state=NULL");
+ return -1;
+ }
+
+ assert(state->argc >= 0);
+ assert(state->argv != NULL);
+ assert(state->shortopts);
+ assert(state->ind >= 0);
+ assert(state->ind <= state->argc + 1);
+
+ oerr = 0 != (state->flags & lsx_getopt_flag_opterr);
+ state->opt = 0;
+ state->arg = NULL;
+ state->lngind = -1;
+
+ if (state->argc < 0 ||
+ !state->argv ||
+ !state->shortopts ||
+ state->ind < 0)
+ { /* programmer error */
+ lsx_fail("lsx_getopt called with invalid information");
+ state->curpos = NULL;
+ return -1;
+ }
+ else if (
+ state->argc <= state->ind ||
+ !state->argv[state->ind] ||
+ state->argv[state->ind][0] != '-' ||
+ state->argv[state->ind][1] == '\0')
+ { /* return no more options */
+ state->curpos = NULL;
+ return -1;
+ }
+ else if (state->argv[state->ind][1] == '-' && state->argv[state->ind][2] == '\0')
+ { /* skip "--", return no more options. */
+ state->curpos = NULL;
+ state->ind++;
+ return -1;
+ }
+ else
+ { /* Look for the next option */
+ char const * current = state->argv[state->ind];
+ char const * param = current + 1;
+
+ if (state->curpos == NULL ||
+ state->curpos <= param ||
+ param + strlen(param) <= state->curpos)
+ { /* Start parsing a new parameter - check for a long option */
+ state->curpos = NULL;
+
+ if (state->longopts &&
+ (param[0] == '-' || (state->flags & lsx_getopt_flag_longonly)))
+ {
+ size_t nameLen;
+ int doubleDash = param[0] == '-';
+ if (doubleDash)
+ {
+ param++;
+ }
+
+ for (nameLen = 0; param[nameLen] && param[nameLen] != '='; nameLen++)
+ {}
+
+ /* For single-dash, you have to specify at least two letters in the name. */
+ if (doubleDash || nameLen >= 2)
+ {
+ lsx_option_t const * pCur;
+ lsx_option_t const * pMatch = NULL;
+ int matches = 0;
+
+ for (pCur = state->longopts; pCur->name; pCur++)
+ {
+ if (0 == strncmp(pCur->name, param, nameLen))
+ { /* Prefix match. */
+ matches++;
+ pMatch = pCur;
+ if (nameLen == strlen(pCur->name))
+ { /* Exact match - no ambiguity, stop search. */
+ matches = 1;
+ break;
+ }
+ }
+ }
+
+ if (matches == 1)
+ { /* Matched. */
+ state->ind++;
+
+ if (param[nameLen])
+ { /* --name=value */
+ if (pMatch->has_arg)
+ { /* Required or optional arg - done. */
+ state->arg = param + nameLen + 1;
+ }
+ else
+ { /* No arg expected. */
+ if (oerr)
+ {
+ lsx_warn("`%s' did not expect an argument from `%s'",
+ pMatch->name,
+ current);
+ }
+ return '?';
+ }
+ }
+ else if (pMatch->has_arg == lsx_option_arg_required)
+ { /* Arg required. */
+ state->arg = state->argv[state->ind];
+ state->ind++;
+ if (state->ind > state->argc)
+ {
+ if (oerr)
+ {
+ lsx_warn("`%s' requires an argument from `%s'",
+ pMatch->name,
+ current);
+ }
+ return state->shortopts[0] == ':' ? ':' : '?'; /* Missing required value. */
+ }
+ }
+
+ state->lngind = pMatch - state->longopts;
+ if (pMatch->flag)
+ {
+ *pMatch->flag = pMatch->val;
+ return 0;
+ }
+ else
+ {
+ return pMatch->val;
+ }
+ }
+ else if (matches == 0 && doubleDash)
+ { /* No match */
+ if (oerr)
+ {
+ lsx_warn("parameter not recognized from `%s'", current);
+ }
+ state->ind++;
+ return '?';
+ }
+ else if (matches > 1)
+ { /* Ambiguous. */
+ if (oerr)
+ {
+ lsx_warn("parameter `%s' is ambiguous:", current);
+ for (pCur = state->longopts; pCur->name; pCur++)
+ {
+ if (0 == strncmp(pCur->name, param, nameLen))
+ {
+ lsx_warn("parameter `%s' could be `--%s'", current, pCur->name);
+ }
+ }
+ }
+ state->ind++;
+ return '?';
+ }
+ }
+ }
+
+ state->curpos = param;
+ }
+
+ state->opt = state->curpos[0];
+ if (state->opt == ':')
+ { /* ':' is never a valid short option character */
+ if (oerr)
+ {
+ lsx_warn("option `%c' not recognized", state->opt);
+ }
+ state->curpos++;
+ CheckCurPosEnd(state);
+ return '?'; /* unrecognized option */
+ }
+ else
+ { /* Short option needs to be matched from option list */
+ char const * pShortopt = strchr(state->shortopts, state->opt);
+ state->curpos++;
+
+ if (!pShortopt)
+ { /* unrecognized option */
+ if (oerr)
+ {
+ lsx_warn("option `%c' not recognized", state->opt);
+ }
+ CheckCurPosEnd(state);
+ return '?';
+ }
+ else if (pShortopt[1] == ':' && state->curpos[0])
+ { /* Return the rest of the parameter as the option's value */
+ state->arg = state->curpos;
+ state->curpos = NULL;
+ state->ind++;
+ return state->opt;
+ }
+ else if (pShortopt[1] == ':' && pShortopt[2] != ':')
+ { /* Option requires a value */
+ state->curpos = NULL;
+ state->ind++;
+ state->arg = state->argv[state->ind];
+ state->ind++;
+ if (state->ind <= state->argc)
+ { /* A value was present, so we're good. */
+ return state->opt;
+ }
+ else
+ { /* Missing required value. */
+ if (oerr)
+ {
+ lsx_warn("option `%c' requires an argument",
+ state->opt);
+ }
+ return state->shortopts[0] == ':' ? ':' : '?';
+ }
+ }
+ else
+ { /* Option without a value. */
+ CheckCurPosEnd(state);
+ return state->opt;
+ }
+ }
+ }
+}
+
+#ifdef TEST_GETOPT
+
+#include <stdio.h>
+
+int main(int argc, char const * argv[])
+{
+ static int help = 0;
+ static lsx_option_t longopts[] =
+ {
+ {"a11", 0, 0, 101},
+ {"a12", 0, 0, 102},
+ {"a122", 0, 0, 103},
+ {"rarg", 1, 0, 104},
+ {"oarg", 2, 0, 105},
+ {"help", 0, &help, 106},
+ {0}
+ };
+
+ int ch;
+ lsx_getopt_t state;
+ lsx_getopt_init(argc, argv, "abc:d:v::0123456789", longopts, sox_true, 1, &state);
+
+ while (-1 != (ch = lsx_getopt(&state)))
+ {
+ printf(
+ "H=%d ch=%d, ind=%d opt=%d lng=%d arg=%s\n",
+ help,
+ ch,
+ state.ind,
+ state.opt,
+ state.lngind,
+ state.arg ? state.arg : "NULL");
+ }
+
+ return 0;
+}
+
+#endif /* TEST_GETOPT */
diff --git a/src/src/gsm.c b/src/src/gsm.c
new file mode 100644
index 0000000..0e32509
--- /dev/null
+++ b/src/src/gsm.c
@@ -0,0 +1,255 @@
+/* Copyright 1991, 1992, 1993 Guido van Rossum And Sundry Contributors.
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Guido van Rossum And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+/*
+ * GSM 06.10 courtesy Communications and Operating Systems Research Group,
+ * Technische Universitaet Berlin
+ *
+ * More information on this format can be obtained from
+ * http://www.cs.tu-berlin.de/~jutta/toasox.html
+ *
+ * Source is available from ftp://ftp.cs.tu-berlin.de/pub/local/kbs/tubmik/gsm
+ *
+ * Written 26 Jan 1995 by Andrew Pam
+ * Portions Copyright (c) 1995 Serious Cybernetics
+ *
+ * July 19, 1998 - Chris Bagwell (cbagwell@sprynet.com)
+ * Added GSM support to SOX from patches floating around with the help
+ * of Dima Barsky (ess2db@ee.surrey.ac.uk).
+ *
+ * Nov. 26, 1999 - Stan Brooks (stabro@megsinet.com)
+ * Rewritten to support multiple channels
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef EXTERNAL_GSM
+
+#ifdef HAVE_GSM_GSM_H
+#include <gsm/gsm.h>
+#else
+#include <gsm.h>
+#endif
+
+#else
+#include "third_party/sox/src/libgsm/gsm.h"
+#endif
+
+#include <errno.h>
+
+#define MAXCHANS 16
+
+/* sizeof(gsm_frame) */
+#define FRAMESIZE (size_t)33
+/* samples per gsm_frame */
+#define BLOCKSIZE 160
+
+/* Private data */
+typedef struct {
+ unsigned channels;
+ gsm_signal *samples;
+ gsm_signal *samplePtr;
+ gsm_signal *sampleTop;
+ gsm_byte *frames;
+ gsm handle[MAXCHANS];
+} priv_t;
+
+static int gsmstart_rw(sox_format_t * ft, int w)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ unsigned ch;
+
+ ft->encoding.encoding = SOX_ENCODING_GSM;
+ if (!ft->signal.rate)
+ ft->signal.rate = 8000;
+
+ if (ft->signal.channels == 0)
+ ft->signal.channels = 1;
+
+ p->channels = ft->signal.channels;
+ if (p->channels > MAXCHANS || p->channels <= 0)
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"gsm: channels(%d) must be in 1-16", ft->signal.channels);
+ return(SOX_EOF);
+ }
+
+ for (ch=0; ch<p->channels; ch++) {
+ p->handle[ch] = gsm_create();
+ if (!p->handle[ch])
+ {
+ lsx_fail_errno(ft,errno,"unable to create GSM stream");
+ return (SOX_EOF);
+ }
+ }
+ p->frames = lsx_malloc(p->channels*FRAMESIZE);
+ p->samples = lsx_malloc(BLOCKSIZE * (p->channels+1) * sizeof(gsm_signal));
+ p->sampleTop = p->samples + BLOCKSIZE*p->channels;
+ p->samplePtr = (w)? p->samples : p->sampleTop;
+ return (SOX_SUCCESS);
+}
+
+static int sox_gsmstartread(sox_format_t * ft)
+{
+ return gsmstart_rw(ft,0);
+}
+
+static int sox_gsmstartwrite(sox_format_t * ft)
+{
+ return gsmstart_rw(ft,1);
+}
+
+/*
+ * Read up to len samples from file.
+ * Convert to signed longs.
+ * Place in buf[].
+ * Return number of samples read.
+ */
+
+static size_t sox_gsmread(sox_format_t * ft, sox_sample_t *buf, size_t samp)
+{
+ size_t done = 0, r;
+ int ch, chans;
+ gsm_signal *gbuff;
+ priv_t *p = (priv_t *) ft->priv;
+
+ chans = p->channels;
+
+ while (done < samp)
+ {
+ while (p->samplePtr < p->sampleTop && done < samp)
+ buf[done++] =
+ SOX_SIGNED_16BIT_TO_SAMPLE(*(p->samplePtr)++,);
+
+ if (done>=samp) break;
+
+ r = lsx_readbuf(ft, p->frames, p->channels * FRAMESIZE);
+ if (r != p->channels * FRAMESIZE)
+ break;
+
+ p->samplePtr = p->samples;
+ for (ch=0; ch<chans; ch++) {
+ int i;
+ gsm_signal *gsp;
+
+ gbuff = p->sampleTop;
+ if (gsm_decode(p->handle[ch], p->frames + ch*FRAMESIZE, gbuff) < 0)
+ {
+ lsx_fail_errno(ft,errno,"error during GSM decode");
+ return (0);
+ }
+
+ gsp = p->samples + ch;
+ for (i=0; i<BLOCKSIZE; i++) {
+ *gsp = *gbuff++;
+ gsp += chans;
+ }
+ }
+ }
+
+ return done;
+}
+
+static int gsmflush(sox_format_t * ft)
+{
+ int r, ch, chans;
+ gsm_signal *gbuff;
+ priv_t *p = (priv_t *) ft->priv;
+
+ chans = p->channels;
+
+ /* zero-fill samples as needed */
+ while (p->samplePtr < p->sampleTop)
+ *(p->samplePtr)++ = 0;
+
+ gbuff = p->sampleTop;
+ for (ch=0; ch<chans; ch++) {
+ int i;
+ gsm_signal *gsp;
+
+ gsp = p->samples + ch;
+ for (i=0; i<BLOCKSIZE; i++) {
+ gbuff[i] = *gsp;
+ gsp += chans;
+ }
+ gsm_encode(p->handle[ch], gbuff, p->frames);
+ r = lsx_writebuf(ft, p->frames, FRAMESIZE);
+ if (r != FRAMESIZE)
+ {
+ lsx_fail_errno(ft,errno,"write error");
+ return(SOX_EOF);
+ }
+ }
+ p->samplePtr = p->samples;
+
+ return (SOX_SUCCESS);
+}
+
+static size_t sox_gsmwrite(sox_format_t * ft, const sox_sample_t *buf, size_t samp)
+{
+ size_t done = 0;
+ priv_t *p = (priv_t *) ft->priv;
+
+ while (done < samp)
+ {
+ SOX_SAMPLE_LOCALS;
+ while ((p->samplePtr < p->sampleTop) && (done < samp))
+ *(p->samplePtr)++ =
+ SOX_SAMPLE_TO_SIGNED_16BIT(buf[done++], ft->clips);
+
+ if (p->samplePtr == p->sampleTop)
+ {
+ if(gsmflush(ft))
+ {
+ return 0;
+ }
+ }
+ }
+
+ return done;
+}
+
+static int sox_gsmstopread(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ unsigned ch;
+
+ for (ch=0; ch<p->channels; ch++)
+ gsm_destroy(p->handle[ch]);
+
+ free(p->samples);
+ free(p->frames);
+ return (SOX_SUCCESS);
+}
+
+static int sox_gsmstopwrite(sox_format_t * ft)
+{
+ int rc;
+ priv_t *p = (priv_t *) ft->priv;
+
+ if (p->samplePtr > p->samples)
+ {
+ rc = gsmflush(ft);
+ if (rc)
+ return rc;
+ }
+
+ return sox_gsmstopread(ft); /* destroy handles and free buffers */
+}
+
+LSX_FORMAT_HANDLER(gsm)
+{
+ static char const * const names[] = {"gsm", NULL};
+ static sox_rate_t const write_rates[] = {8000, 0};
+ static unsigned const write_encodings[] = {SOX_ENCODING_GSM, 0, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "GSM 06.10 (full-rate) lossy speech compression", names, 0,
+ sox_gsmstartread, sox_gsmread, sox_gsmstopread,
+ sox_gsmstartwrite, sox_gsmwrite, sox_gsmstopwrite,
+ NULL, write_encodings, write_rates, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/gsrt.c b/src/src/gsrt.c
new file mode 100644
index 0000000..81c8484
--- /dev/null
+++ b/src/src/gsrt.c
@@ -0,0 +1,205 @@
+/* libSoX file format: Grandstream ring tone (c) 2009 robs@users.sourceforge.net
+ *
+ * See http://www.grandstream.com/ringtone.html
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <time.h>
+
+#define VERSION_ 0x1000000
+#define MAX_FILE_SIZE 0x10000
+#define HEADER_SIZE (size_t)512
+#define PADDING_SIZE (size_t)478
+
+static char const id[16] = "ring.bin";
+
+typedef struct {
+ char const * string;
+ int ft_encoding;
+ unsigned bits_per_sample;
+ sox_encoding_t sox_encoding;
+} table_t;
+
+static table_t const table[] = {
+ {NULL, 0, 8, SOX_ENCODING_ULAW},
+ {"G726", 2, 0, SOX_ENCODING_UNKNOWN},
+ {NULL, 3, 0, SOX_ENCODING_GSM},
+ {NULL, 4, 0, SOX_ENCODING_G723},
+ {NULL, 8, 8, SOX_ENCODING_ALAW},
+ {"G722", 9, 0, SOX_ENCODING_UNKNOWN},
+ {"G728", 15, 2, SOX_ENCODING_UNKNOWN},
+ {"iLBC", 98, 0, SOX_ENCODING_UNKNOWN},
+};
+
+static int ft_enc(unsigned bits_per_sample, sox_encoding_t encoding)
+{
+ size_t i;
+ for (i = 0; i < array_length(table); ++i) {
+ table_t const * t = &table[i];
+ if (t->sox_encoding == encoding && t->bits_per_sample == bits_per_sample)
+ return t->ft_encoding;
+ }
+ return -1; /* Should never get here. */
+}
+
+static sox_encoding_t sox_enc(int ft_encoding, unsigned * bits_per_sample)
+{
+ size_t i;
+ for (i = 0; i < array_length(table); ++i) {
+ table_t const * t = &table[i];
+ if (t->ft_encoding == ft_encoding) {
+ *bits_per_sample = t->bits_per_sample;
+ if (t->sox_encoding == SOX_ENCODING_UNKNOWN)
+ lsx_report("unsupported encoding: %s", t->string);
+ return t->sox_encoding;
+ }
+ }
+ *bits_per_sample = 0;
+ return SOX_ENCODING_UNKNOWN;
+}
+
+static int start_read(sox_format_t * ft)
+{
+ off_t num_samples;
+ char read_id[array_length(id)];
+ uint32_t file_size;
+ int16_t ft_encoding;
+ sox_encoding_t encoding;
+ unsigned bits_per_sample;
+
+ lsx_readdw(ft, &file_size);
+ num_samples = file_size? file_size * 2 - HEADER_SIZE : SOX_UNSPEC;
+
+ if (file_size >= 2 && ft->seekable) {
+ int i, checksum = (file_size >> 16) + file_size;
+ for (i = file_size - 2; i; --i) {
+ int16_t int16;
+ lsx_readsw(ft, &int16);
+ checksum += int16;
+ }
+ if (lsx_seeki(ft, (off_t)sizeof(file_size), SEEK_SET) != 0)
+ return SOX_EOF;
+ if (checksum & 0xffff)
+ lsx_warn("invalid checksum in input file %s", ft->filename);
+ }
+
+ lsx_skipbytes(ft, (size_t)(2 + 4 + 6)); /* Checksum, version, time stamp. */
+
+ lsx_readchars(ft, read_id, sizeof(read_id));
+ if (memcmp(read_id, id, strlen(id))) {
+ lsx_fail_errno(ft, SOX_EHDR, "gsrt: invalid file name in header");
+ return SOX_EOF;
+ }
+
+ lsx_readsw(ft, &ft_encoding);
+ encoding = sox_enc(ft_encoding, &bits_per_sample);
+ if (encoding != SOX_ENCODING_ALAW &&
+ encoding != SOX_ENCODING_ULAW)
+ ft->handler.read = NULL;
+
+ lsx_skipbytes(ft, PADDING_SIZE);
+
+ return lsx_check_read_params(ft, 1, 8000., encoding,
+ bits_per_sample, (uint64_t)num_samples, sox_true);
+}
+
+static int start_write(sox_format_t * ft)
+{
+ int i, encoding = ft_enc(ft->encoding.bits_per_sample, ft->encoding.encoding);
+ time_t now = sox_globals.repeatable? 0 : time(NULL);
+ struct tm const * t = sox_globals.repeatable? gmtime(&now) : localtime(&now);
+
+ int checksum = (VERSION_ >> 16) + VERSION_;
+ checksum += t->tm_year + 1900;
+ checksum += ((t->tm_mon + 1) << 8) + t->tm_mday;
+ checksum += (t->tm_hour << 8) + t->tm_min;
+ for (i = sizeof(id) - 2; i >= 0; i -= 2)
+ checksum += (id[i] << 8) + id[i + 1];
+ checksum += encoding;
+
+ return lsx_writedw(ft, 0)
+ || lsx_writesw(ft, -checksum)
+ || lsx_writedw(ft, VERSION_)
+ || lsx_writesw(ft, t->tm_year + 1900)
+ || lsx_writesb(ft, t->tm_mon + 1)
+ || lsx_writesb(ft, t->tm_mday)
+ || lsx_writesb(ft, t->tm_hour)
+ || lsx_writesb(ft, t->tm_min)
+ || lsx_writechars(ft, id, sizeof(id))
+ || lsx_writesw(ft, encoding)
+ || lsx_padbytes(ft, PADDING_SIZE) ? SOX_EOF : SOX_SUCCESS;
+}
+
+static size_t write_samples(
+ sox_format_t * ft, sox_sample_t const * buf, size_t nsamp)
+{
+ size_t n = min(nsamp, MAX_FILE_SIZE - (size_t)ft->tell_off);
+ if (n != nsamp)
+ lsx_warn("audio truncated");
+ return lsx_rawwrite(ft, buf, n);
+}
+
+static int stop_write(sox_format_t * ft)
+{
+ long num_samples = ft->tell_off - HEADER_SIZE;
+
+ if (num_samples & 1)
+ lsx_writeb(ft, 0);
+
+ if (ft->seekable) {
+ unsigned i, file_size = ft->tell_off >> 1;
+ int16_t int16;
+ int checksum;
+ if (!lsx_seeki(ft, (off_t)sizeof(uint32_t), SEEK_SET)) {
+ lsx_readsw(ft, &int16);
+ checksum = (file_size >> 16) + file_size - int16;
+ if (!lsx_seeki(ft, (off_t)HEADER_SIZE, SEEK_SET)) {
+ for (i = (num_samples + 1) >> 1; i; --i) {
+ lsx_readsw(ft, &int16);
+ checksum += int16;
+ }
+ if (!lsx_seeki(ft, (off_t)0, SEEK_SET)) {
+ lsx_writedw(ft, file_size);
+ lsx_writesw(ft, -checksum);
+ return SOX_SUCCESS;
+ }
+ }
+ }
+ }
+ lsx_warn("can't seek in output file `%s'; "
+ "length in file header will be unspecified", ft->filename);
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(gsrt)
+{
+ static char const *const names[] = { "gsrt", NULL };
+ static sox_rate_t const write_rates[] = { 8000, 0 };
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ 0
+ };
+ static sox_format_handler_t const handler = {
+ SOX_LIB_VERSION_CODE, "Grandstream ring tone",
+ names, SOX_FILE_BIG_END | SOX_FILE_MONO,
+ start_read, lsx_rawread, NULL,
+ start_write, write_samples, stop_write,
+ lsx_rawseek, write_encodings, write_rates, 0
+ };
+ return &handler;
+}
diff --git a/src/src/hcom.c b/src/src/hcom.c
new file mode 100644
index 0000000..8e8b392
--- /dev/null
+++ b/src/src/hcom.c
@@ -0,0 +1,478 @@
+/* libSoX Macintosh HCOM format.
+ * These are really FSSD type files with Huffman compression,
+ * in MacBinary format.
+ * TODO: make the MacBinary format optional (so that .data files
+ * are also acceptable). (How to do this on output?)
+ *
+ * September 25, 1991
+ * Copyright 1991 Guido van Rossum And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Guido van Rossum And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ * April 28, 1998 - Chris Bagwell (cbagwell@sprynet.com)
+ *
+ * Rearranged some functions so that they are declared before they are
+ * used, clearing up some compiler warnings. Because these functions
+ * passed floats, it helped some dumb compilers pass stuff on the
+ * stack correctly.
+ *
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+/* FIXME: eliminate these 2 functions */
+
+static void put32_be(unsigned char **p, int32_t val)
+{
+ *(*p)++ = (val >> 24) & 0xff;
+ *(*p)++ = (val >> 16) & 0xff;
+ *(*p)++ = (val >> 8) & 0xff;
+ *(*p)++ = val & 0xff;
+}
+
+static void put16_be(unsigned char **p, int val)
+{
+ *(*p)++ = (val >> 8) & 0xff;
+ *(*p)++ = val & 0xff;
+}
+
+/* Dictionary entry for Huffman (de)compression */
+typedef struct {
+ long frequ;
+ short dict_leftson;
+ short dict_rightson;
+} dictent;
+
+typedef struct {
+ /* Static data from the header */
+ dictent *dictionary;
+ int32_t checksum;
+ int deltacompression;
+ /* Engine state */
+ long huffcount;
+ long cksum;
+ int dictentry;
+ int nrbits;
+ uint32_t current;
+ short sample;
+ /* Dictionary */
+ dictent *de;
+ int32_t new_checksum;
+ int nbits;
+ int32_t curword;
+
+ /* Private data used by writer */
+ unsigned char *data; /* Buffer allocated with lsx_malloc */
+ size_t size; /* Size of allocated buffer */
+ size_t pos; /* Where next byte goes */
+} priv_t;
+
+static int startread(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ int i;
+ char buf[5];
+ uint32_t datasize, rsrcsize;
+ uint32_t huffcount, checksum, compresstype, divisor;
+ unsigned short dictsize;
+ int rc;
+
+
+ /* Skip first 65 bytes of header */
+ rc = lsx_skipbytes(ft, (size_t) 65);
+ if (rc)
+ return rc;
+
+ /* Check the file type (bytes 65-68) */
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || strncmp(buf, "FSSD", (size_t)4) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"Mac header type is not FSSD");
+ return (SOX_EOF);
+ }
+
+ /* Skip to byte 83 */
+ rc = lsx_skipbytes(ft, (size_t) 83-69);
+ if (rc)
+ return rc;
+
+ /* Get essential numbers from the header */
+ lsx_readdw(ft, &datasize); /* bytes 83-86 */
+ lsx_readdw(ft, &rsrcsize); /* bytes 87-90 */
+
+ /* Skip the rest of the header (total 128 bytes) */
+ rc = lsx_skipbytes(ft, (size_t) 128-91);
+ if (rc != 0)
+ return rc;
+
+ /* The data fork must contain a "HCOM" header */
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || strncmp(buf, "HCOM", (size_t)4) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"Mac data fork is not HCOM");
+ return (SOX_EOF);
+ }
+
+ /* Then follow various parameters */
+ lsx_readdw(ft, &huffcount);
+ lsx_readdw(ft, &checksum);
+ lsx_readdw(ft, &compresstype);
+ if (compresstype > 1)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"Bad compression type in HCOM header");
+ return (SOX_EOF);
+ }
+ lsx_readdw(ft, &divisor);
+ if (divisor == 0 || divisor > 4)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"Bad sampling rate divisor in HCOM header");
+ return (SOX_EOF);
+ }
+ lsx_readw(ft, &dictsize);
+
+ /* Translate to sox parameters */
+ ft->encoding.encoding = SOX_ENCODING_HCOM;
+ ft->encoding.bits_per_sample = 8;
+ ft->signal.rate = 22050 / divisor;
+ ft->signal.channels = 1;
+
+ /* Allocate memory for the dictionary */
+ p->dictionary = lsx_malloc(511 * sizeof(dictent));
+
+ /* Read dictionary */
+ for(i = 0; i < dictsize; i++) {
+ lsx_readsw(ft, &(p->dictionary[i].dict_leftson));
+ lsx_readsw(ft, &(p->dictionary[i].dict_rightson));
+ lsx_debug("%d %d",
+ p->dictionary[i].dict_leftson,
+ p->dictionary[i].dict_rightson);
+ }
+ rc = lsx_skipbytes(ft, (size_t) 1); /* skip pad byte */
+ if (rc)
+ return rc;
+
+ /* Initialized the decompression engine */
+ p->checksum = checksum;
+ p->deltacompression = compresstype;
+ if (!p->deltacompression)
+ lsx_debug("HCOM data using value compression");
+ p->huffcount = huffcount;
+ p->cksum = 0;
+ p->dictentry = 0;
+ p->nrbits = -1; /* Special case to get first byte */
+
+ return (SOX_SUCCESS);
+}
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ register priv_t *p = (priv_t *) ft->priv;
+ int done = 0;
+ unsigned char sample_rate;
+
+ if (p->nrbits < 0) {
+ /* The first byte is special */
+ if (p->huffcount == 0)
+ return 0; /* Don't know if this can happen... */
+ if (lsx_readb(ft, &sample_rate) == SOX_EOF)
+ {
+ return (0);
+ }
+ p->sample = sample_rate;
+ *buf++ = SOX_UNSIGNED_8BIT_TO_SAMPLE(p->sample,);
+ p->huffcount--;
+ p->nrbits = 0;
+ done++;
+ len--;
+ if (len == 0)
+ return done;
+ }
+
+ while (p->huffcount > 0) {
+ if(p->nrbits == 0) {
+ lsx_readdw(ft, &(p->current));
+ if (lsx_eof(ft))
+ {
+ lsx_fail_errno(ft,SOX_EOF,"unexpected EOF in HCOM data");
+ return (0);
+ }
+ p->cksum += p->current;
+ p->nrbits = 32;
+ }
+ if(p->current & 0x80000000) {
+ p->dictentry =
+ p->dictionary[p->dictentry].dict_rightson;
+ } else {
+ p->dictentry =
+ p->dictionary[p->dictentry].dict_leftson;
+ }
+ p->current = p->current << 1;
+ p->nrbits--;
+ if(p->dictionary[p->dictentry].dict_leftson < 0) {
+ short datum;
+ datum = p->dictionary[p->dictentry].dict_rightson;
+ if (!p->deltacompression)
+ p->sample = 0;
+ p->sample = (p->sample + datum) & 0xff;
+ p->huffcount--;
+ *buf++ = SOX_UNSIGNED_8BIT_TO_SAMPLE(p->sample,);
+ p->dictentry = 0;
+ done++;
+ len--;
+ if (len == 0)
+ break;
+ }
+ }
+
+ return done;
+}
+
+static int stopread(sox_format_t * ft)
+{
+ register priv_t *p = (priv_t *) ft->priv;
+
+ if (p->huffcount != 0)
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"not all HCOM data read");
+ return (SOX_EOF);
+ }
+ if(p->cksum != p->checksum)
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"checksum error in HCOM data");
+ return (SOX_EOF);
+ }
+ free(p->dictionary);
+ p->dictionary = NULL;
+ return (SOX_SUCCESS);
+}
+
+#define BUFINCR (10*BUFSIZ)
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *) ft->priv;
+
+ p->size = BUFINCR;
+ p->pos = 0;
+ p->data = lsx_malloc(p->size);
+ return SOX_SUCCESS;
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ sox_sample_t datum;
+ size_t i;
+
+ if (len == 0)
+ return 0;
+
+ if (p->pos + len > p->size) {
+ p->size = ((p->pos + len) / BUFINCR + 1) * BUFINCR;
+ p->data = lsx_realloc(p->data, p->size);
+ }
+
+ for (i = 0; i < len; i++) {
+ SOX_SAMPLE_LOCALS;
+ datum = *buf++;
+ p->data[p->pos++] = SOX_SAMPLE_TO_UNSIGNED_8BIT(datum, ft->clips);
+ }
+
+ return len;
+}
+
+static void makecodes(int e, int c, int s, int b, dictent newdict[511], long codes[256], long codesize[256])
+{
+ assert(b); /* Prevent stack overflow */
+ if (newdict[e].dict_leftson < 0) {
+ codes[newdict[e].dict_rightson] = c;
+ codesize[newdict[e].dict_rightson] = s;
+ } else {
+ makecodes(newdict[e].dict_leftson, c, s + 1, b << 1, newdict, codes, codesize);
+ makecodes(newdict[e].dict_rightson, c + b, s + 1, b << 1, newdict, codes, codesize);
+ }
+}
+
+static void putcode(sox_format_t * ft, long codes[256], long codesize[256], unsigned c, unsigned char **df)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ long code, size;
+ int i;
+
+ code = codes[c];
+ size = codesize[c];
+ for(i = 0; i < size; i++) {
+ p->curword <<= 1;
+ if (code & 1)
+ p->curword += 1;
+ p->nbits++;
+ if (p->nbits == 32) {
+ put32_be(df, p->curword);
+ p->new_checksum += p->curword;
+ p->nbits = 0;
+ p->curword = 0;
+ }
+ code >>= 1;
+ }
+}
+
+static void compress(sox_format_t * ft, unsigned char **df, int32_t *dl)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ int samplerate;
+ unsigned char *datafork = *df;
+ unsigned char *ddf, *dfp;
+ short dictsize;
+ int frequtable[256];
+ long codes[256], codesize[256];
+ dictent newdict[511];
+ int i, sample, j, k, d, l, frequcount;
+
+ sample = *datafork;
+ memset(frequtable, 0, sizeof(frequtable));
+ memset(codes, 0, sizeof(codes));
+ memset(codesize, 0, sizeof(codesize));
+ memset(newdict, 0, sizeof(newdict));
+
+ for (i = 1; i < *dl; i++) {
+ d = (datafork[i] - (sample & 0xff)) & 0xff; /* creates absolute entries LMS */
+ sample = datafork[i];
+ datafork[i] = d;
+ assert(d >= 0 && d <= 255); /* check our table is accessed correctly */
+ frequtable[d]++;
+ }
+ p->de = newdict;
+ for (i = 0; i < 256; i++)
+ if (frequtable[i] != 0) {
+ p->de->frequ = -frequtable[i];
+ p->de->dict_leftson = -1;
+ p->de->dict_rightson = i;
+ p->de++;
+ }
+ frequcount = p->de - newdict;
+ for (i = 0; i < frequcount; i++) {
+ for (j = i + 1; j < frequcount; j++) {
+ if (newdict[i].frequ > newdict[j].frequ) {
+ k = newdict[i].frequ;
+ newdict[i].frequ = newdict[j].frequ;
+ newdict[j].frequ = k;
+ k = newdict[i].dict_leftson;
+ newdict[i].dict_leftson = newdict[j].dict_leftson;
+ newdict[j].dict_leftson = k;
+ k = newdict[i].dict_rightson;
+ newdict[i].dict_rightson = newdict[j].dict_rightson;
+ newdict[j].dict_rightson = k;
+ }
+ }
+ }
+ while (frequcount > 1) {
+ j = frequcount - 1;
+ p->de->frequ = newdict[j - 1].frequ;
+ p->de->dict_leftson = newdict[j - 1].dict_leftson;
+ p->de->dict_rightson = newdict[j - 1].dict_rightson;
+ l = newdict[j - 1].frequ + newdict[j].frequ;
+ for (i = j - 2; i >= 0 && l < newdict[i].frequ; i--)
+ newdict[i + 1] = newdict[i];
+ i = i + 1;
+ newdict[i].frequ = l;
+ newdict[i].dict_leftson = j;
+ newdict[i].dict_rightson = p->de - newdict;
+ p->de++;
+ frequcount--;
+ }
+ dictsize = p->de - newdict;
+ makecodes(0, 0, 0, 1, newdict, codes, codesize);
+ l = 0;
+ for (i = 0; i < 256; i++)
+ l += frequtable[i] * codesize[i];
+ l = (((l + 31) >> 5) << 2) + 24 + dictsize * 4;
+ lsx_debug(" Original size: %6d bytes", *dl);
+ lsx_debug("Compressed size: %6d bytes", l);
+ datafork = lsx_malloc((size_t)l);
+ ddf = datafork + 22;
+ for(i = 0; i < dictsize; i++) {
+ put16_be(&ddf, newdict[i].dict_leftson);
+ put16_be(&ddf, newdict[i].dict_rightson);
+ }
+ *ddf++ = 0;
+ *ddf++ = *(*df)++;
+ p->new_checksum = 0;
+ p->nbits = 0;
+ p->curword = 0;
+ for (i = 1; i < *dl; i++)
+ putcode(ft, codes, codesize, *(*df)++, &ddf);
+ if (p->nbits != 0) {
+ codes[0] = 0;
+ codesize[0] = 32 - p->nbits;
+ putcode(ft, codes, codesize, 0, &ddf);
+ }
+ memcpy(datafork, "HCOM", (size_t)4);
+ dfp = datafork + 4;
+ put32_be(&dfp, *dl);
+ put32_be(&dfp, p->new_checksum);
+ put32_be(&dfp, 1);
+ samplerate = 22050 / ft->signal.rate + .5;
+ put32_be(&dfp, samplerate);
+ put16_be(&dfp, dictsize);
+ *df = datafork; /* reassign passed pointer to new datafork */
+ *dl = l; /* and its compressed length */
+}
+
+/* End of hcom utility routines */
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ unsigned char *compressed_data = p->data;
+ size_t compressed_len = p->pos;
+ int rc = SOX_SUCCESS;
+
+ /* Compress it all at once */
+ if (compressed_len)
+ compress(ft, &compressed_data, (int32_t *)&compressed_len);
+ free(p->data);
+
+ /* Write the header */
+ lsx_writebuf(ft, "\000\001A", (size_t) 3); /* Dummy file name "A" */
+ lsx_padbytes(ft, (size_t) 65-3);
+ lsx_writes(ft, "FSSD");
+ lsx_padbytes(ft, (size_t) 83-69);
+ lsx_writedw(ft, (unsigned) compressed_len); /* compressed_data size */
+ lsx_writedw(ft, 0); /* rsrc size */
+ lsx_padbytes(ft, (size_t) 128 - 91);
+ if (lsx_error(ft)) {
+ lsx_fail_errno(ft, errno, "write error in HCOM header");
+ rc = SOX_EOF;
+ } else if (lsx_writebuf(ft, compressed_data, compressed_len) != compressed_len) {
+ /* Write the compressed_data fork */
+ lsx_fail_errno(ft, errno, "can't write compressed HCOM data");
+ rc = SOX_EOF;
+ }
+ free(compressed_data);
+
+ if (rc == SOX_SUCCESS)
+ /* Pad the compressed_data fork to a multiple of 128 bytes */
+ lsx_padbytes(ft, 128u - (compressed_len % 128));
+
+ return rc;
+}
+
+LSX_FORMAT_HANDLER(hcom)
+{
+ static char const * const names[] = {"hcom", NULL};
+ static sox_rate_t const write_rates[] = {22050,22050/2,22050/3,22050/4.,0};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_HCOM, 8, 0, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Mac FSSD files with Huffman compression",
+ names, SOX_FILE_BIG_END|SOX_FILE_MONO,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, write_rates, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/hilbert.c b/src/src/hilbert.c
new file mode 100644
index 0000000..8dbc7c4
--- /dev/null
+++ b/src/src/hilbert.c
@@ -0,0 +1,102 @@
+/* libSoX effect: Hilbert transform filter
+ *
+ * First version of this effect written 11/2011 by Ulrich Klauer, using maths
+ * from "Understanding digital signal processing" by Richard G. Lyons.
+ *
+ * Copyright 2011 Chris Bagwell and SoX Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/dft_filter.h"
+
+typedef struct {
+ dft_filter_priv_t base;
+ double *h;
+ int taps;
+} priv_t;
+
+static int getopts(sox_effect_t *effp, int argc, char **argv)
+{
+ lsx_getopt_t optstate;
+ int c;
+ priv_t *p = (priv_t*)effp->priv;
+ dft_filter_priv_t *b = &p->base;
+
+ b->filter_ptr = &b->filter;
+
+ lsx_getopt_init(argc, argv, "+n:", NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ GETOPT_NUMERIC(optstate, 'n', taps, 3, 32767)
+ default: lsx_fail("invalid option `-%c'", optstate.opt); return lsx_usage(effp);
+ }
+ if (p->taps && p->taps%2 == 0) {
+ lsx_fail("only filters with an odd number of taps are supported");
+ return SOX_EOF;
+ }
+ return optstate.ind != argc ? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t *effp)
+{
+ priv_t *p = (priv_t*)effp->priv;
+ dft_filter_t *f = p->base.filter_ptr;
+
+ if (!f->num_taps) {
+ int i;
+ if (!p->taps) {
+ p->taps = effp->in_signal.rate/76.5 + 2;
+ p->taps += 1 - (p->taps%2);
+ /* results in a cutoff frequency of about 75 Hz with a Blackman window */
+ lsx_debug("choosing number of taps = %d (override with -n)", p->taps);
+ }
+ lsx_valloc(p->h, p->taps);
+ for (i = 0; i < p->taps; i++) {
+ int k = -(p->taps/2) + i;
+ if (k%2 == 0) {
+ p->h[i] = 0.0;
+ } else {
+ double pk = M_PI * k;
+ p->h[i] = (1 - cos(pk))/pk;
+ }
+ }
+ lsx_apply_blackman(p->h, p->taps, .16);
+
+ if (effp->global_info->plot != sox_plot_off) {
+ char title[100];
+ sprintf(title, "SoX effect: hilbert (%d taps)", p->taps);
+ lsx_plot_fir(p->h, p->taps, effp->in_signal.rate,
+ effp->global_info->plot, title, -20., 5.);
+ free(p->h);
+ return SOX_EOF;
+ }
+ lsx_set_dft_filter(f, p->h, p->taps, p->taps/2);
+ }
+ return lsx_dft_filter_effect_fn()->start(effp);
+}
+
+sox_effect_handler_t const *lsx_hilbert_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_dft_filter_effect_fn();
+ handler.name = "hilbert";
+ handler.usage = "[-n taps]";
+ handler.getopts = getopts;
+ handler.start = start;
+ handler.priv_size = sizeof(priv_t);
+ return &handler;
+}
diff --git a/src/src/htk.c b/src/src/htk.c
new file mode 100644
index 0000000..c816ee7
--- /dev/null
+++ b/src/src/htk.c
@@ -0,0 +1,80 @@
+/* libSoX file format: HTK (c) 2008 robs@users.sourceforge.net
+ *
+ * See http://labrosa.ee.columbia.edu/doc/HTKBook21/HTKBook.html
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef enum {
+ Waveform, Lpc, Lprefc, Lpcepstra, Lpdelcep, Irefc,
+ Mfcc, Fbank, Melspec, User, Discrete, Unknown} kind_t;
+static char const * const str[] = {
+ "Sampled waveform", "Linear prediction filter", "Linear prediction",
+ "LPC cepstral", "LPC cepstra plus delta", "LPC reflection coef in",
+ "Mel-frequency cepstral", "Log mel-filter bank", "Linear mel-filter bank",
+ "User defined sample", "Vector quantised data", "Unknown"};
+
+static int start_read(sox_format_t * ft)
+{
+ uint32_t period_100ns, num_samples;
+ uint16_t bytes_per_sample, parmKind;
+
+ if (lsx_readdw(ft, &num_samples ) ||
+ lsx_readdw(ft, &period_100ns ) ||
+ lsx_readw (ft, &bytes_per_sample) ||
+ lsx_readw (ft, &parmKind )) return SOX_EOF;
+ if (parmKind != Waveform) {
+ int n = min(parmKind & 077, Unknown);
+ lsx_fail_errno(ft, SOX_EFMT, "unsupported HTK type `%s' (0%o)", str[n], parmKind);
+ return SOX_EOF;
+ }
+ return lsx_check_read_params(ft, 1, 1e7 / period_100ns, SOX_ENCODING_SIGN2,
+ (unsigned)bytes_per_sample << 3, (uint64_t)num_samples, sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ double period_100ns = 1e7 / ft->signal.rate;
+ uint64_t len = ft->olength? ft->olength:ft->signal.length;
+
+ if (len > UINT_MAX)
+ {
+ lsx_warn("length greater than 32 bits - cannot fit actual length in header");
+ len = UINT_MAX;
+ }
+ if (!ft->olength && floor(period_100ns) != period_100ns)
+ lsx_warn("rounding sample period %f (x 100ns) to nearest integer", period_100ns);
+ return lsx_writedw(ft, (unsigned)len)
+ || lsx_writedw(ft, (unsigned)(period_100ns + .5))
+ || lsx_writew(ft, ft->encoding.bits_per_sample >> 3)
+ || lsx_writew(ft, Waveform) ? SOX_EOF : SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(htk)
+{
+ static char const * const names[] = {"htk", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 16, 0, 0};
+ static sox_format_handler_t handler = {
+ SOX_LIB_VERSION_CODE,
+ "PCM format used for Hidden Markov Model speech processing",
+ names, SOX_FILE_BIG_END | SOX_FILE_MONO | SOX_FILE_REWIND,
+ start_read, lsx_rawread, NULL,
+ write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/ignore-warning.h b/src/src/ignore-warning.h
new file mode 100644
index 0000000..d93a5ec
--- /dev/null
+++ b/src/src/ignore-warning.h
@@ -0,0 +1,32 @@
+/* This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#if defined __GNUC__
+ #pragma GCC system_header
+#elif defined __SUNPRO_CC
+ #pragma disable_warn
+#elif defined _MSC_VER
+ #pragma warning(push, 1)
+#endif
+
+ IGNORE_WARNING
+#undef IGNORE_WARNING
+
+
+#if defined __SUNPRO_CC
+ #pragma enable_warn
+#elif defined _MSC_VER
+ #pragma warning(pop)
+#endif
diff --git a/src/src/ima-fmt.c b/src/src/ima-fmt.c
new file mode 100644
index 0000000..84917ac
--- /dev/null
+++ b/src/src/ima-fmt.c
@@ -0,0 +1,33 @@
+/* libSoX format: raw IMA ADPCM (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/adpcms.h"
+#include "third_party/sox/src/src/vox.h"
+
+LSX_FORMAT_HANDLER(ima)
+{
+ static char const * const names[] = {"ima", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_IMA_ADPCM, 4, 0, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Raw IMA ADPCM", names, SOX_FILE_MONO,
+ lsx_ima_start, lsx_vox_read, lsx_vox_stopread,
+ lsx_ima_start, lsx_vox_write, lsx_vox_stopwrite,
+ lsx_rawseek, write_encodings, NULL, sizeof(adpcm_io_t)
+ };
+ return &handler;
+}
diff --git a/src/src/ima_rw.c b/src/src/ima_rw.c
new file mode 100644
index 0000000..c17e4dd
--- /dev/null
+++ b/src/src/ima_rw.c
@@ -0,0 +1,365 @@
+/* libSoX ima_rw.c -- codex utilities for WAV_FORMAT_IMA_ADPCM
+ * Copyright (C) 1999 Stanley J. Brooks <stabro@megsinet.net>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/ima_rw.h"
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+/*
+ *
+ * Lookup tables for IMA ADPCM format
+ *
+ */
+#define ISSTMAX 88
+
+static const int imaStepSizeTable[ISSTMAX + 1] = {
+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34,
+ 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143,
+ 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494,
+ 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552,
+ 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026,
+ 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442,
+ 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623,
+ 27086, 29794, 32767
+};
+
+#define imaStateAdjust(c) (((c)<4)? -1:(2*(c)-6))
+/* +0 - +3, decrease step size */
+/* +4 - +7, increase step size */
+/* -0 - -3, decrease step size */
+/* -4 - -7, increase step size */
+
+static unsigned char imaStateAdjustTable[ISSTMAX+1][8];
+
+void lsx_ima_init_table(void)
+{
+ int i,j,k;
+ for (i=0; i<=ISSTMAX; i++) {
+ for (j=0; j<8; j++) {
+ k = i + imaStateAdjust(j);
+ if (k<0) k=0;
+ else if (k>ISSTMAX) k=ISSTMAX;
+ imaStateAdjustTable[i][j] = k;
+ }
+ }
+}
+
+static void ImaExpandS(
+ unsigned ch, /* channel number to decode, REQUIRE 0 <= ch < chans */
+ unsigned chans, /* total channels */
+ const unsigned char *ibuff,/* input buffer[blockAlign] */
+ SAMPL *obuff, /* obuff[n] will be output samples */
+ int n, /* samples to decode PER channel, REQUIRE n % 8 == 1 */
+ unsigned o_inc /* index difference between successive output samples */
+)
+{
+ const unsigned char *ip;
+ int i_inc;
+ SAMPL *op;
+ int i, val, state;
+
+ ip = ibuff + 4*ch; /* input pointer to 4-byte block state-initializer */
+ i_inc = 4*(chans-1); /* amount by which to incr ip after each 4-byte read */
+ val = (short)(ip[0] + (ip[1]<<8)); /* need cast for sign-extend */
+ state = ip[2];
+ if (state > ISSTMAX) {
+ lsx_warn("IMA_ADPCM block ch%d initial-state (%d) out of range", ch, state);
+ state = 0;
+ }
+ /* specs say to ignore ip[3] , but write it as 0 */
+ ip += 4+i_inc;
+
+ op = obuff;
+ *op = val; /* 1st output sample for this channel */
+ op += o_inc;
+
+ for (i = 1; i < n; i++) {
+ int step,dp,c,cm;
+
+ if (i&1) { /* 1st of pair */
+ cm = *ip & 0x0f;
+ } else {
+ cm = (*ip++)>>4;
+ if ((i&7) == 0) /* ends the 8-sample input block for this channel */
+ ip += i_inc; /* skip ip for next group */
+ }
+
+ step = imaStepSizeTable[state];
+ /* Update the state for the next sample */
+ c = cm & 0x07;
+ state = imaStateAdjustTable[state][c];
+
+ dp = 0;
+ if (c & 4) dp += step;
+ step = step >> 1;
+ if (c & 2) dp += step;
+ step = step >> 1;
+ if (c & 1) dp += step;
+ step = step >> 1;
+ dp += step;
+
+ if (c != cm) {
+ val -= dp;
+ if (val<-0x8000) val = -0x8000;
+ } else {
+ val += dp;
+ if (val>0x7fff) val = 0x7fff;
+ }
+ *op = val;
+ op += o_inc;
+ }
+ return;
+}
+
+/* lsx_ima_block_expand_i() outputs interleaved samples into one output buffer */
+void lsx_ima_block_expand_i(
+ unsigned chans, /* total channels */
+ const unsigned char *ibuff,/* input buffer[blockAlign] */
+ SAMPL *obuff, /* output samples, n*chans */
+ int n /* samples to decode PER channel, REQUIRE n % 8 == 1 */
+)
+{
+ unsigned ch;
+ for (ch=0; ch<chans; ch++)
+ ImaExpandS(ch, chans, ibuff, obuff+ch, n, chans);
+}
+
+/* lsx_ima_block_expand_m() outputs non-interleaved samples into chan separate output buffers */
+void lsx_ima_block_expand_m(
+ unsigned chans, /* total channels */
+ const unsigned char *ibuff,/* input buffer[blockAlign] */
+ SAMPL **obuffs, /* chan output sample buffers, each takes n samples */
+ int n /* samples to decode PER channel, REQUIRE n % 8 == 1 */
+)
+{
+ unsigned ch;
+ for (ch=0; ch<chans; ch++)
+ ImaExpandS(ch, chans, ibuff, obuffs[ch], n, 1);
+}
+
+static int ImaMashS(
+ unsigned ch, /* channel number to encode, REQUIRE 0 <= ch < chans */
+ unsigned chans, /* total channels */
+ int v0, /* value to use as starting prediction0 */
+ const SAMPL *ibuff, /* ibuff[] is interleaved input samples */
+ int n, /* samples to encode PER channel, REQUIRE n % 8 == 1 */
+ int *st, /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */
+ unsigned char *obuff /* output buffer[blockAlign], or NULL for no output */
+)
+{
+ const SAMPL *ip, *itop;
+ unsigned char *op;
+ int o_inc = 0; /* set 0 only to shut up gcc's 'might be uninitialized' */
+ int i, val;
+ int state;
+ double d2; /* long long is okay also, speed abt the same */
+
+ ip = ibuff + ch; /* point ip to 1st input sample for this channel */
+ itop = ibuff + n*chans;
+ val = *ip - v0; ip += chans;/* 1st input sample for this channel */
+ d2 = val*val;/* d2 will be sum of squares of errors, given input v0 and *st */
+ val = v0;
+
+ op = obuff; /* output pointer (or NULL) */
+ if (op) { /* NULL means don't output, just compute the rms error */
+ op += 4*ch; /* where to put this channel's 4-byte block state-initializer */
+ o_inc = 4*(chans-1); /* amount by which to incr op after each 4-byte written */
+ *op++ = val; *op++ = val>>8;
+ *op++ = *st; *op++ = 0; /* they could have put a mid-block state-correction here */
+ op += o_inc; /* _sigh_ NEVER waste a byte. It's a rule! */
+ }
+
+ state = *st;
+
+ for (i = 0; ip < itop; ip+=chans) {
+ int step,d,dp,c;
+
+ d = *ip - val; /* difference between last prediction and current sample */
+
+ step = imaStepSizeTable[state];
+ c = (abs(d)<<2)/step;
+ if (c > 7) c = 7;
+ /* Update the state for the next sample */
+ state = imaStateAdjustTable[state][c];
+
+ if (op) { /* if we want output, put it in proper place */
+ int cm = c;
+ if (d<0) cm |= 8;
+ if (i&1) { /* odd numbered output */
+ *op++ |= (cm<<4);
+ if (i == 7) /* ends the 8-sample output block for this channel */
+ op += o_inc; /* skip op for next group */
+ } else {
+ *op = cm;
+ }
+ i = (i+1) & 0x07;
+ }
+
+ dp = 0;
+ if (c & 4) dp += step;
+ step = step >> 1;
+ if (c & 2) dp += step;
+ step = step >> 1;
+ if (c & 1) dp += step;
+ step = step >> 1;
+ dp += step;
+
+ if (d<0) {
+ val -= dp;
+ if (val<-0x8000) val = -0x8000;
+ } else {
+ val += dp;
+ if (val>0x7fff) val = 0x7fff;
+ }
+
+ {
+ int x = *ip - val;
+ d2 += x*x;
+ }
+
+ }
+ d2 /= n; /* be sure it's non-negative */
+ *st = state;
+ return (int) sqrt(d2);
+}
+
+/* mash one channel... if you want to use opt>0, 9 is a reasonable value */
+inline static void ImaMashChannel(
+ unsigned ch, /* channel number to encode, REQUIRE 0 <= ch < chans */
+ unsigned chans, /* total channels */
+ const SAMPL *ip, /* ip[] is interleaved input samples */
+ int n, /* samples to encode PER channel, REQUIRE n % 8 == 1 */
+ int *st, /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */
+ unsigned char *obuff, /* output buffer[blockAlign] */
+ int opt /* non-zero allows some cpu-intensive code to improve output */
+)
+{
+ int snext;
+ int s0,d0;
+
+ s0 = *st;
+ if (opt>0) {
+ int low,hi,w;
+ int low0,hi0;
+ snext = s0;
+ d0 = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL);
+
+ w = 0;
+ low=hi=s0;
+ low0 = low-opt; if (low0<0) low0=0;
+ hi0 = hi+opt; if (hi0>ISSTMAX) hi0=ISSTMAX;
+ while (low>low0 || hi<hi0) {
+ if (!w && low>low0) {
+ int d2;
+ snext = --low;
+ d2 = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL);
+ if (d2<d0) {
+ d0=d2; s0=low;
+ low0 = low-opt; if (low0<0) low0=0;
+ hi0 = low+opt; if (hi0>ISSTMAX) hi0=ISSTMAX;
+ }
+ }
+ if (w && hi<hi0) {
+ int d2;
+ snext = ++hi;
+ d2 = ImaMashS(ch, chans, ip[0], ip,n,&snext, NULL);
+ if (d2<d0) {
+ d0=d2; s0=hi;
+ low0 = hi-opt; if (low0<0) low0=0;
+ hi0 = hi+opt; if (hi0>ISSTMAX) hi0=ISSTMAX;
+ }
+ }
+ w=1-w;
+ }
+ *st = s0;
+ }
+ ImaMashS(ch, chans, ip[0], ip,n,st, obuff);
+}
+
+/* mash one block. if you want to use opt>0, 9 is a reasonable value */
+void lsx_ima_block_mash_i(
+ unsigned chans, /* total channels */
+ const SAMPL *ip, /* ip[] is interleaved input samples */
+ int n, /* samples to encode PER channel, REQUIRE n % 8 == 1 */
+ int *st, /* input/output state, REQUIRE 0 <= *st <= ISSTMAX */
+ unsigned char *obuff, /* output buffer[blockAlign] */
+ int opt /* non-zero allows some cpu-intensive code to improve output */
+)
+{
+ unsigned ch;
+ for (ch=0; ch<chans; ch++)
+ ImaMashChannel(ch, chans, ip, n, st+ch, obuff, opt);
+}
+
+/*
+ * lsx_ima_samples_in(dataLen, chans, blockAlign, samplesPerBlock)
+ * returns the number of samples/channel which would go
+ * in the dataLen, given the other parameters ...
+ * if input samplesPerBlock is 0, then returns the max
+ * samplesPerBlock which would go into a block of size blockAlign
+ * Yes, it is confusing.
+ */
+size_t lsx_ima_samples_in(
+ size_t dataLen,
+ size_t chans,
+ size_t blockAlign,
+ size_t samplesPerBlock
+)
+{
+ size_t m, n;
+
+ if (samplesPerBlock) {
+ n = (dataLen / blockAlign) * samplesPerBlock;
+ m = (dataLen % blockAlign);
+ } else {
+ n = 0;
+ m = blockAlign;
+ }
+ if (m >= (size_t)4*chans) {
+ m -= 4*chans; /* number of bytes beyond block-header */
+ m /= 4*chans; /* number of 4-byte blocks/channel beyond header */
+ m = 8*m + 1; /* samples/chan beyond header + 1 in header */
+ if (samplesPerBlock && m > samplesPerBlock) m = samplesPerBlock;
+ n += m;
+ }
+ return n;
+ /*wSamplesPerBlock = ((wBlockAlign - 4*wChannels)/(4*wChannels))*8 + 1;*/
+}
+
+/*
+ * size_t lsx_ima_bytes_per_block(chans, samplesPerBlock)
+ * return minimum blocksize which would be required
+ * to encode number of chans with given samplesPerBlock
+ */
+size_t lsx_ima_bytes_per_block(
+ size_t chans,
+ size_t samplesPerBlock
+)
+{
+ size_t n;
+ /* per channel, ima has blocks of len 4, the 1st has 1st sample, the others
+ * up to 8 samples per block,
+ * so number of later blocks is (nsamp-1 + 7)/8, total blocks/chan is
+ * (nsamp-1+7)/8 + 1 = (nsamp+14)/8
+ */
+ n = ((size_t)samplesPerBlock + 14)/8 * 4 * chans;
+ return n;
+}
diff --git a/src/src/ima_rw.h b/src/src/ima_rw.h
new file mode 100644
index 0000000..e6bc2b0
--- /dev/null
+++ b/src/src/ima_rw.h
@@ -0,0 +1,84 @@
+/* libSoX ima_rw.h -- codex utilities for WAV_FORMAT_IMA_ADPCM
+ * Copyright (C) 1999 Stanley J. Brooks <stabro@megsinet.net>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+#include "third_party/sox/src/src/sox.h"
+
+#ifndef SAMPL
+#define SAMPL short
+#endif
+
+/*
+ * call lsx_ima_init_table() before any other Ima* functions,
+ * to create the fast lookup tables
+ */
+extern void lsx_ima_init_table(void);
+
+/* lsx_ima_block_expand_i() outputs interleaved samples into one output buffer */
+extern void lsx_ima_block_expand_i(
+ unsigned chans, /* total channels */
+ const unsigned char *ibuff,/* input buffer[blockAlign] */
+ SAMPL *obuff, /* output samples, n*chans */
+ int n /* samples to decode PER channel, REQUIRE n % 8 == 1 */
+);
+
+/* lsx_ima_block_expand_m() outputs non-interleaved samples into chan separate output buffers */
+extern void lsx_ima_block_expand_m(
+ unsigned chans, /* total channels */
+ const unsigned char *ibuff,/* input buffer[blockAlign] */
+ SAMPL **obuffs, /* chan output sample buffers, each takes n samples */
+ int n /* samples to decode PER channel, REQUIRE n % 8 == 1 */
+);
+
+/* mash one block. if you want to use opt>0, 9 is a reasonable value */
+extern void lsx_ima_block_mash_i(
+ unsigned chans, /* total channels */
+ const SAMPL *ip, /* ip[] is interleaved input samples */
+ int n, /* samples to encode PER channel, REQUIRE n % 8 == 1 */
+ int *st, /* input/output state[chans], REQUIRE 0 <= st[ch] <= ISSTMAX */
+ unsigned char *obuff, /* output buffer[blockAlign] */
+ int opt /* non-zero allows some cpu-intensive code to improve output */
+);
+
+/* Some helper functions for computing samples/block and blockalign */
+
+/*
+ * lsx_ima_samples_in(dataLen, chans, blockAlign, samplesPerBlock)
+ * returns the number of samples/channel which would go
+ * in the dataLen, given the other parameters ...
+ * if input samplesPerBlock is 0, then returns the max
+ * samplesPerBlock which would go into a block of size blockAlign
+ * Yes, it is confusing usage.
+ */
+extern size_t lsx_ima_samples_in(
+ size_t dataLen,
+ size_t chans,
+ size_t blockAlign,
+ size_t samplesPerBlock
+);
+
+/*
+ * size_t lsx_ima_bytes_per_block(chans, samplesPerBlock)
+ * return minimum blocksize which would be required
+ * to encode number of chans with given samplesPerBlock
+ */
+extern size_t lsx_ima_bytes_per_block(
+ size_t chans,
+ size_t samplesPerBlock
+);
+
diff --git a/src/src/input.c b/src/src/input.c
new file mode 100644
index 0000000..f954968
--- /dev/null
+++ b/src/src/input.c
@@ -0,0 +1,58 @@
+/* libSoX effect: Input audio from a file (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {sox_format_t * file;} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (argc != 2 || !(p->file = (sox_format_t *)argv[1]) || p->file->mode != 'r')
+ return SOX_EOF;
+ return SOX_SUCCESS;
+}
+
+static int drain(
+ sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ /* ensure that *osamp is a multiple of the number of channels. */
+ *osamp -= *osamp % effp->out_signal.channels;
+
+ /* Read up to *osamp samples into obuf; store the actual number read
+ * back to *osamp */
+ *osamp = sox_read(p->file, obuf, *osamp);
+
+ /* sox_read may return a number that is less than was requested; only if
+ * 0 samples is returned does it indicate that end-of-file has been reached
+ * or an error has occurred */
+ if (!*osamp && p->file->sox_errno)
+ lsx_fail("%s: %s", p->file->filename, p->file->sox_errstr);
+ return *osamp? SOX_SUCCESS : SOX_EOF;
+}
+
+sox_effect_handler_t const * lsx_input_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "input", NULL, SOX_EFF_MCHAN | SOX_EFF_LENGTH | SOX_EFF_INTERNAL,
+ getopts, NULL, NULL, drain, NULL, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
+
diff --git a/src/src/la-fmt.c b/src/src/la-fmt.c
new file mode 100644
index 0000000..d75e4bf
--- /dev/null
+++ b/src/src/la-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT(la, 8, SOX_FILE_BIT_REV, ALAW)
diff --git a/src/src/ladspa.c b/src/src/ladspa.c
new file mode 100644
index 0000000..94371c9
--- /dev/null
+++ b/src/src/ladspa.c
@@ -0,0 +1,492 @@
+/* LADSPA effect support for sox
+ * (c) Reuben Thomas <rrt@sc3d.org> 2007
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef HAVE_LADSPA_H
+
+#include <assert.h>
+#include <limits.h>
+#include <string.h>
+#include <math.h>
+#include "third_party/sox/src/src/ladspa.h"
+
+/*
+ * Assuming LADSPA_Data == float. This is the case in 2012 and has been
+ * the case for many years now.
+ */
+#define SOX_SAMPLE_TO_LADSPA_DATA(d,clips) \
+ SOX_SAMPLE_TO_FLOAT_32BIT((d),(clips))
+#define LADSPA_DATA_TO_SOX_SAMPLE(d,clips) \
+ SOX_FLOAT_32BIT_TO_SAMPLE((d),(clips))
+
+static sox_effect_handler_t sox_ladspa_effect;
+
+/* Private data for resampling */
+typedef struct {
+ char *name; /* plugin name */
+ lt_dlhandle lth; /* dynamic object handle */
+ sox_bool clone;
+ const LADSPA_Descriptor *desc; /* plugin descriptor */
+ LADSPA_Handle *handles; /* instantiated plugin handles */
+ size_t handle_count;
+ LADSPA_Data *control; /* control ports */
+ unsigned long *inputs;
+ size_t input_count;
+ unsigned long *outputs;
+ size_t output_count;
+ sox_bool latency_compensation;
+ LADSPA_Data *latency_control_port;
+ unsigned long in_latency;
+ unsigned long out_latency;
+} priv_t;
+
+static LADSPA_Data ladspa_default(const LADSPA_PortRangeHint *p)
+{
+ LADSPA_Data d;
+
+ if (LADSPA_IS_HINT_DEFAULT_0(p->HintDescriptor))
+ d = 0.0;
+ else if (LADSPA_IS_HINT_DEFAULT_1(p->HintDescriptor))
+ d = 1.0;
+ else if (LADSPA_IS_HINT_DEFAULT_100(p->HintDescriptor))
+ d = 100.0;
+ else if (LADSPA_IS_HINT_DEFAULT_440(p->HintDescriptor))
+ d = 440.0;
+ else if (LADSPA_IS_HINT_DEFAULT_MINIMUM(p->HintDescriptor))
+ d = p->LowerBound;
+ else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(p->HintDescriptor))
+ d = p->UpperBound;
+ else if (LADSPA_IS_HINT_DEFAULT_LOW(p->HintDescriptor)) {
+ if (LADSPA_IS_HINT_LOGARITHMIC(p->HintDescriptor))
+ d = exp(log(p->LowerBound) * 0.75 + log(p->UpperBound) * 0.25);
+ else
+ d = p->LowerBound * 0.75 + p->UpperBound * 0.25;
+ } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(p->HintDescriptor)) {
+ if (LADSPA_IS_HINT_LOGARITHMIC(p->HintDescriptor))
+ d = exp(log(p->LowerBound) * 0.5 + log(p->UpperBound) * 0.5);
+ else
+ d = p->LowerBound * 0.5 + p->UpperBound * 0.5;
+ } else if (LADSPA_IS_HINT_DEFAULT_HIGH(p->HintDescriptor)) {
+ if (LADSPA_IS_HINT_LOGARITHMIC(p->HintDescriptor))
+ d = exp(log(p->LowerBound) * 0.25 + log(p->UpperBound) * 0.75);
+ else
+ d = p->LowerBound * 0.25 + p->UpperBound * 0.75;
+ } else { /* shouldn't happen */
+ /* FIXME: Deal with this at a higher level */
+ lsx_fail("non-existent default value; using 0.1");
+ d = 0.1; /* Should at least avoid divide by 0 */
+ }
+
+ return d;
+}
+
+/*
+ * Process options
+ */
+static int sox_ladspa_getopts(sox_effect_t *effp, int argc, char **argv)
+{
+ priv_t * l_st = (priv_t *)effp->priv;
+ char *path;
+ int c;
+ union {LADSPA_Descriptor_Function fn; lt_ptr ptr;} ltptr;
+ unsigned long index = 0, i;
+ double arg;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, "+rl", NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ case 'r': l_st->clone = sox_true; break;
+ case 'l': l_st->latency_compensation = sox_true; break;
+ default:
+ lsx_fail("unknown option `-%c'", optstate.opt);
+ return lsx_usage(effp);
+ }
+ argc -= optstate.ind, argv += optstate.ind;
+
+ /* Get module name */
+ if (argc >= 1) {
+ l_st->name = argv[0];
+ argc--; argv++;
+ }
+
+ /* Load module */
+ path = getenv("LADSPA_PATH");
+ if (path == NULL)
+ path = LADSPA_PATH;
+
+ if(lt_dlinit() || lt_dlsetsearchpath(path)
+ || (l_st->lth = lt_dlopenext(l_st->name)) == NULL) {
+ lsx_fail("could not open LADSPA plugin %s", l_st->name);
+ return SOX_EOF;
+ }
+
+ /* Get descriptor function */
+ if ((ltptr.ptr = lt_dlsym(l_st->lth, "ladspa_descriptor")) == NULL) {
+ lsx_fail("could not find ladspa_descriptor");
+ return SOX_EOF;
+ }
+
+ /* If no plugins in this module, complain */
+ if (ltptr.fn(0UL) == NULL) {
+ lsx_fail("no plugins found");
+ return SOX_EOF;
+ }
+
+ /* Get first plugin descriptor */
+ l_st->desc = ltptr.fn(0UL);
+ assert(l_st->desc); /* We already know this will work */
+
+ /* If more than one plugin, or first argument is not a number, try
+ to use first argument as plugin label. */
+ if (argc > 0 && (ltptr.fn(1UL) != NULL || !sscanf(argv[0], "%lf", &arg))) {
+ while (l_st->desc && strcmp(l_st->desc->Label, argv[0]) != 0)
+ l_st->desc = ltptr.fn(++index);
+ if (l_st->desc == NULL) {
+ lsx_fail("no plugin called `%s' found", argv[0]);
+ return SOX_EOF;
+ } else
+ argc--; argv++;
+ }
+
+ /* Scan the ports for inputs and outputs */
+ l_st->control = lsx_calloc(l_st->desc->PortCount, sizeof(LADSPA_Data));
+ l_st->inputs = lsx_malloc(l_st->desc->PortCount * sizeof(unsigned long));
+ l_st->outputs = lsx_malloc(l_st->desc->PortCount * sizeof(unsigned long));
+
+ for (i = 0; i < l_st->desc->PortCount; i++) {
+ const LADSPA_PortDescriptor port = l_st->desc->PortDescriptors[i];
+
+ /* Check port is well specified. All control ports should be
+ inputs, but don't bother checking, as we never rely on this. */
+ if (LADSPA_IS_PORT_INPUT(port) && LADSPA_IS_PORT_OUTPUT(port)) {
+ lsx_fail("port %lu is both input and output", i);
+ return SOX_EOF;
+ } else if (LADSPA_IS_PORT_CONTROL(port) && LADSPA_IS_PORT_AUDIO(port)) {
+ lsx_fail("port %lu is both audio and control", i);
+ return SOX_EOF;
+ }
+
+ if (LADSPA_IS_PORT_AUDIO(port)) {
+ if (LADSPA_IS_PORT_INPUT(port)) {
+ l_st->inputs[l_st->input_count++] = i;
+ } else if (LADSPA_IS_PORT_OUTPUT(port)) {
+ l_st->outputs[l_st->output_count++] = i;
+ }
+ } else { /* Control port */
+ if (l_st->latency_compensation &&
+ LADSPA_IS_PORT_CONTROL(port) &&
+ LADSPA_IS_PORT_OUTPUT(port) &&
+ strcmp(l_st->desc->PortNames[i], "latency") == 0) {
+ /* automatic latency compensation, Ardour does this, too */
+ l_st->latency_control_port = &l_st->control[i];
+ assert(*l_st->latency_control_port == 0);
+ lsx_debug("latency control port is %lu", i);
+ } else if (argc == 0) {
+ if (!LADSPA_IS_HINT_HAS_DEFAULT(l_st->desc->PortRangeHints[i].HintDescriptor)) {
+ lsx_fail("not enough arguments for control ports");
+ return SOX_EOF;
+ }
+ l_st->control[i] = ladspa_default(&(l_st->desc->PortRangeHints[i]));
+ lsx_debug("default argument for port %lu is %f", i, l_st->control[i]);
+ } else {
+ if (!sscanf(argv[0], "%lf", &arg))
+ return lsx_usage(effp);
+ l_st->control[i] = (LADSPA_Data)arg;
+ lsx_debug("argument for port %lu is %f", i, l_st->control[i]);
+ argc--; argv++;
+ }
+ }
+ }
+
+ /* Stop if we have any unused arguments */
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+/*
+ * Prepare processing.
+ */
+static int sox_ladspa_start(sox_effect_t * effp)
+{
+ priv_t * l_st = (priv_t *)effp->priv;
+ unsigned long i;
+ size_t h;
+ unsigned long rate = (unsigned long)effp->in_signal.rate;
+
+ /* Instantiate the plugin */
+ lsx_debug("rate for plugin is %g", effp->in_signal.rate);
+
+ if (l_st->input_count == 1 && l_st->output_count == 1 &&
+ effp->in_signal.channels == effp->out_signal.channels) {
+ /* for mono plugins, they are common */
+
+ if (!l_st->clone && effp->in_signal.channels > 1) {
+ lsx_fail("expected 1 input channel(s), found %u; consider using -r",
+ effp->in_signal.channels);
+ return SOX_EOF;
+ }
+
+ /*
+ * create one handle per channel for mono plugins. ecasound does this, too.
+ * mono LADSPA plugins are common and SoX supported mono LADSPA plugins
+ * exclusively for a while.
+ */
+ l_st->handles = lsx_malloc(effp->in_signal.channels *
+ sizeof(LADSPA_Handle *));
+
+ while (l_st->handle_count < effp->in_signal.channels)
+ l_st->handles[l_st->handle_count++] = l_st->desc->instantiate(l_st->desc, rate);
+
+ } else {
+ /*
+ * assume the plugin is multi-channel capable with one instance,
+ * Some LADSPA plugins are stereo (e.g. bs2b-ladspa)
+ */
+
+ if (l_st->input_count < effp->in_signal.channels) {
+ lsx_fail("fewer plugin input ports than input channels (%u < %u)",
+ (unsigned)l_st->input_count, effp->in_signal.channels);
+ return SOX_EOF;
+ }
+
+ /* warn if LADSPA audio ports are unused. ecasound does this, too */
+ if (l_st->input_count > effp->in_signal.channels)
+ lsx_warn("more plugin input ports than input channels (%u > %u)",
+ (unsigned)l_st->input_count, effp->in_signal.channels);
+
+ /*
+ * some LADSPA plugins increase/decrease the channel count
+ * (e.g. "mixer" in cmt or vocoder):
+ */
+ if (l_st->output_count != effp->out_signal.channels) {
+ lsx_debug("changing output channels to match plugin output ports (%u => %u)",
+ effp->out_signal.channels, (unsigned)l_st->output_count);
+ effp->out_signal.channels = l_st->output_count;
+ }
+
+ l_st->handle_count = 1;
+ l_st->handles = lsx_malloc(sizeof(LADSPA_Handle *));
+ l_st->handles[0] = l_st->desc->instantiate(l_st->desc, rate);
+ }
+
+ /* abandon everything completely on any failed handle instantiation */
+ for (h = 0; h < l_st->handle_count; h++) {
+ if (l_st->handles[h] == NULL) {
+ /* cleanup the handles that did instantiate successfully */
+ for (h = 0; l_st->desc->cleanup && h < l_st->handle_count; h++) {
+ if (l_st->handles[h])
+ l_st->desc->cleanup(l_st->handles[h]);
+ }
+
+ free(l_st->handles);
+ l_st->handle_count = 0;
+ lsx_fail("could not instantiate plugin");
+ return SOX_EOF;
+ }
+ }
+
+ for (i = 0; i < l_st->desc->PortCount; i++) {
+ const LADSPA_PortDescriptor port = l_st->desc->PortDescriptors[i];
+
+ if (LADSPA_IS_PORT_CONTROL(port)) {
+ for (h = 0; h < l_st->handle_count; h++)
+ l_st->desc->connect_port(l_st->handles[h], i, &(l_st->control[i]));
+ }
+ }
+
+ /* If needed, activate the plugin instances */
+ if (l_st->desc->activate) {
+ for (h = 0; h < l_st->handle_count; h++)
+ l_st->desc->activate(l_st->handles[h]);
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Process one bufferful of data.
+ */
+static int sox_ladspa_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * l_st = (priv_t *)effp->priv;
+ size_t i, len = min(*isamp, *osamp);
+ size_t j;
+ size_t h;
+ const size_t total_input_count = l_st->input_count * l_st->handle_count;
+ const size_t total_output_count = l_st->output_count * l_st->handle_count;
+ const size_t input_len = len / total_input_count;
+ size_t output_len = len / total_output_count;
+
+ if (total_output_count < total_input_count)
+ output_len = input_len;
+
+ *isamp = len;
+ *osamp = 0;
+
+ if (len) {
+ LADSPA_Data *buf = lsx_calloc(len, sizeof(LADSPA_Data));
+ LADSPA_Data *outbuf = lsx_calloc(len, sizeof(LADSPA_Data));
+ LADSPA_Handle handle;
+ unsigned long port, l;
+ SOX_SAMPLE_LOCALS;
+
+ /*
+ * prepare buffer for LADSPA input
+ * deinterleave sox samples and write non-interleaved data to
+ * input_port-specific buffer locations
+ */
+ for (i = 0; i < input_len; i++) {
+ for (j = 0; j < total_input_count; j++) {
+ const sox_sample_t s = *ibuf++;
+ buf[j * input_len + i] = SOX_SAMPLE_TO_LADSPA_DATA(s, effp->clips);
+ }
+ }
+
+ /* Connect the LADSPA input port(s) to the prepared buffers */
+ for (j = 0; j < total_input_count; j++) {
+ handle = l_st->handles[j / l_st->input_count];
+ port = l_st->inputs[j / l_st->handle_count];
+ l_st->desc->connect_port(handle, port, buf + j * input_len);
+ }
+
+ /* Connect the LADSPA output port(s) if used */
+ for (j = 0; j < total_output_count; j++) {
+ handle = l_st->handles[j / l_st->output_count];
+ port = l_st->outputs[j / l_st->handle_count];
+ l_st->desc->connect_port(handle, port, outbuf + j * output_len);
+ }
+
+ /* Run the plugin for each handle */
+ for (h = 0; h < l_st->handle_count; h++)
+ l_st->desc->run(l_st->handles[h], input_len);
+
+ /* check the latency control port if we have one */
+ if (l_st->latency_control_port) {
+ lsx_debug("latency detected is %g", *l_st->latency_control_port);
+ l_st->in_latency = (unsigned long)floor(*l_st->latency_control_port);
+
+ /* we will need this later in sox_ladspa_drain */
+ l_st->out_latency = l_st->in_latency;
+
+ /* latency for plugins is constant, only compensate once */
+ l_st->latency_control_port = NULL;
+ }
+
+ /* Grab output if effect produces it, re-interleaving it */
+ l = min(output_len, l_st->in_latency);
+ for (i = l; i < output_len; i++) {
+ for (j = 0; j < total_output_count; j++) {
+ LADSPA_Data d = outbuf[j * output_len + i];
+ *obuf++ = LADSPA_DATA_TO_SOX_SAMPLE(d, effp->clips);
+ (*osamp)++;
+ }
+ }
+ l_st->in_latency -= l;
+
+ free(outbuf);
+ free(buf);
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Nothing to do if the plugin has no latency or latency compensation is
+ * disabled.
+ */
+static int sox_ladspa_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * l_st = (priv_t *)effp->priv;
+ sox_sample_t *ibuf, *dbuf;
+ size_t isamp, dsamp;
+ int r;
+
+ if (l_st->out_latency == 0) {
+ *osamp = 0;
+ return SOX_SUCCESS;
+ }
+
+ /* feed some silence at the end to push the rest of the data out */
+ isamp = l_st->out_latency * effp->in_signal.channels;
+ dsamp = l_st->out_latency * effp->out_signal.channels;
+ ibuf = lsx_calloc(isamp, sizeof(sox_sample_t));
+ dbuf = lsx_calloc(dsamp, sizeof(sox_sample_t));
+
+ r = sox_ladspa_flow(effp, ibuf, dbuf, &isamp, &dsamp);
+ *osamp = min(dsamp, *osamp);
+ memcpy(obuf, dbuf, *osamp * sizeof(sox_sample_t));
+
+ free(ibuf);
+ free(dbuf);
+
+ return r == SOX_SUCCESS ? SOX_EOF : 0;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * Don't close input file!
+ */
+static int sox_ladspa_stop(sox_effect_t * effp)
+{
+ priv_t * l_st = (priv_t *)effp->priv;
+ size_t h;
+
+ for (h = 0; h < l_st->handle_count; h++) {
+ /* If needed, deactivate and cleanup the plugin */
+ if (l_st->desc->deactivate)
+ l_st->desc->deactivate(l_st->handles[h]);
+ if (l_st->desc->cleanup)
+ l_st->desc->cleanup(l_st->handles[h]);
+ }
+ free(l_st->handles);
+ l_st->handle_count = 0;
+
+ return SOX_SUCCESS;
+}
+
+static int sox_ladspa_kill(sox_effect_t * effp)
+{
+ priv_t * l_st = (priv_t *)effp->priv;
+
+ free(l_st->control);
+ free(l_st->inputs);
+ free(l_st->outputs);
+
+ return SOX_SUCCESS;
+}
+
+static sox_effect_handler_t sox_ladspa_effect = {
+ "ladspa",
+ "MODULE [PLUGIN] [ARGUMENT...]",
+ SOX_EFF_MCHAN | SOX_EFF_CHAN | SOX_EFF_GAIN,
+ sox_ladspa_getopts,
+ sox_ladspa_start,
+ sox_ladspa_flow,
+ sox_ladspa_drain,
+ sox_ladspa_stop,
+ sox_ladspa_kill,
+ sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_ladspa_effect_fn(void)
+{
+ return &sox_ladspa_effect;
+}
+
+#endif /* HAVE_LADSPA */
diff --git a/src/src/ladspa.h b/src/src/ladspa.h
new file mode 100644
index 0000000..5c30a8a
--- /dev/null
+++ b/src/src/ladspa.h
@@ -0,0 +1,603 @@
+/* ladspa.h
+
+ Linux Audio Developer's Simple Plugin API Version 1.1[LGPL].
+ Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis,
+ Stefan Westerfeld.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef LADSPA_INCLUDED
+#define LADSPA_INCLUDED
+
+#define LADSPA_VERSION "1.1"
+#define LADSPA_VERSION_MAJOR 1
+#define LADSPA_VERSION_MINOR 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************************************************************/
+
+/* Overview:
+
+ There is a large number of synthesis packages in use or development
+ on the Linux platform at this time. This API (`The Linux Audio
+ Developer's Simple Plugin API') attempts to give programmers the
+ ability to write simple `plugin' audio processors in C/C++ and link
+ them dynamically (`plug') into a range of these packages (`hosts').
+ It should be possible for any host and any plugin to communicate
+ completely through this interface.
+
+ This API is deliberately short and simple. To achieve compatibility
+ with a range of promising Linux sound synthesis packages it
+ attempts to find the `greatest common divisor' in their logical
+ behaviour. Having said this, certain limiting decisions are
+ implicit, notably the use of a fixed type (LADSPA_Data) for all
+ data transfer and absence of a parameterised `initialisation'
+ phase. See below for the LADSPA_Data typedef.
+
+ Plugins are expected to distinguish between control and audio
+ data. Plugins have `ports' that are inputs or outputs for audio or
+ control data and each plugin is `run' for a `block' corresponding
+ to a short time interval measured in samples. Audio data is
+ communicated using arrays of LADSPA_Data, allowing a block of audio
+ to be processed by the plugin in a single pass. Control data is
+ communicated using single LADSPA_Data values. Control data has a
+ single value at the start of a call to the `run()' or `run_adding()'
+ function, and may be considered to remain this value for its
+ duration. The plugin may assume that all its input and output ports
+ have been connected to the relevant data location (see the
+ `connect_port()' function below) before it is asked to run.
+
+ Plugins will reside in shared object files suitable for dynamic
+ linking by dlopen() and family. The file will provide a number of
+ `plugin types' that can be used to instantiate actual plugins
+ (sometimes known as `plugin instances') that can be connected
+ together to perform tasks.
+
+ This API contains very limited error-handling. */
+
+/*****************************************************************************/
+
+/* Fundamental data type passed in and out of plugin. This data type
+ is used to communicate audio samples and control values. It is
+ assumed that the plugin will work sensibly given any numeric input
+ value although it may have a preferred range (see hints below).
+
+ For audio it is generally assumed that 1.0f is the `0dB' reference
+ amplitude and is a `normal' signal level. */
+
+typedef float LADSPA_Data;
+
+/*****************************************************************************/
+
+/* Special Plugin Properties:
+
+ Optional features of the plugin type are encapsulated in the
+ LADSPA_Properties type. This is assembled by ORing individual
+ properties together. */
+
+typedef int LADSPA_Properties;
+
+/* Property LADSPA_PROPERTY_REALTIME indicates that the plugin has a
+ real-time dependency (e.g. listens to a MIDI device) and so its
+ output must not be cached or subject to significant latency. */
+#define LADSPA_PROPERTY_REALTIME 0x1
+
+/* Property LADSPA_PROPERTY_INPLACE_BROKEN indicates that the plugin
+ may cease to work correctly if the host elects to use the same data
+ location for both input and output (see connect_port()). This
+ should be avoided as enabling this flag makes it impossible for
+ hosts to use the plugin to process audio `in-place.' */
+#define LADSPA_PROPERTY_INPLACE_BROKEN 0x2
+
+/* Property LADSPA_PROPERTY_HARD_RT_CAPABLE indicates that the plugin
+ is capable of running not only in a conventional host but also in a
+ `hard real-time' environment. To qualify for this the plugin must
+ satisfy all of the following:
+
+ (1) The plugin must not use malloc(), free() or other heap memory
+ management within its run() or run_adding() functions. All new
+ memory used in run() must be managed via the stack. These
+ restrictions only apply to the run() function.
+
+ (2) The plugin will not attempt to make use of any library
+ functions with the exceptions of functions in the ANSI standard C
+ and C maths libraries, which the host is expected to provide.
+
+ (3) The plugin will not access files, devices, pipes, sockets, IPC
+ or any other mechanism that might result in process or thread
+ blocking.
+
+ (4) The plugin will take an amount of time to execute a run() or
+ run_adding() call approximately of form (A+B*SampleCount) where A
+ and B depend on the machine and host in use. This amount of time
+ may not depend on input signals or plugin state. The host is left
+ the responsibility to perform timings to estimate upper bounds for
+ A and B. */
+#define LADSPA_PROPERTY_HARD_RT_CAPABLE 0x4
+
+#define LADSPA_IS_REALTIME(x) ((x) & LADSPA_PROPERTY_REALTIME)
+#define LADSPA_IS_INPLACE_BROKEN(x) ((x) & LADSPA_PROPERTY_INPLACE_BROKEN)
+#define LADSPA_IS_HARD_RT_CAPABLE(x) ((x) & LADSPA_PROPERTY_HARD_RT_CAPABLE)
+
+/*****************************************************************************/
+
+/* Plugin Ports:
+
+ Plugins have `ports' that are inputs or outputs for audio or
+ data. Ports can communicate arrays of LADSPA_Data (for audio
+ inputs/outputs) or single LADSPA_Data values (for control
+ input/outputs). This information is encapsulated in the
+ LADSPA_PortDescriptor type which is assembled by ORing individual
+ properties together.
+
+ Note that a port must be an input or an output port but not both
+ and that a port must be a control or audio port but not both. */
+
+typedef int LADSPA_PortDescriptor;
+
+/* Property LADSPA_PORT_INPUT indicates that the port is an input. */
+#define LADSPA_PORT_INPUT 0x1
+
+/* Property LADSPA_PORT_OUTPUT indicates that the port is an output. */
+#define LADSPA_PORT_OUTPUT 0x2
+
+/* Property LADSPA_PORT_CONTROL indicates that the port is a control
+ port. */
+#define LADSPA_PORT_CONTROL 0x4
+
+/* Property LADSPA_PORT_AUDIO indicates that the port is a audio
+ port. */
+#define LADSPA_PORT_AUDIO 0x8
+
+#define LADSPA_IS_PORT_INPUT(x) ((x) & LADSPA_PORT_INPUT)
+#define LADSPA_IS_PORT_OUTPUT(x) ((x) & LADSPA_PORT_OUTPUT)
+#define LADSPA_IS_PORT_CONTROL(x) ((x) & LADSPA_PORT_CONTROL)
+#define LADSPA_IS_PORT_AUDIO(x) ((x) & LADSPA_PORT_AUDIO)
+
+/*****************************************************************************/
+
+/* Plugin Port Range Hints:
+
+ The host may wish to provide a representation of data entering or
+ leaving a plugin (e.g. to generate a GUI automatically). To make
+ this more meaningful, the plugin should provide `hints' to the host
+ describing the usual values taken by the data.
+
+ Note that these are only hints. The host may ignore them and the
+ plugin must not assume that data supplied to it is meaningful. If
+ the plugin receives invalid input data it is expected to continue
+ to run without failure and, where possible, produce a sensible
+ output (e.g. a high-pass filter given a negative cutoff frequency
+ might switch to an all-pass mode).
+
+ Hints are meaningful for all input and output ports but hints for
+ input control ports are expected to be particularly useful.
+
+ More hint information is encapsulated in the
+ LADSPA_PortRangeHintDescriptor type which is assembled by ORing
+ individual hint types together. Hints may require further
+ LowerBound and UpperBound information.
+
+ All the hint information for a particular port is aggregated in the
+ LADSPA_PortRangeHint structure. */
+
+typedef int LADSPA_PortRangeHintDescriptor;
+
+/* Hint LADSPA_HINT_BOUNDED_BELOW indicates that the LowerBound field
+ of the LADSPA_PortRangeHint should be considered meaningful. The
+ value in this field should be considered the (inclusive) lower
+ bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
+ specified then the value of LowerBound should be multiplied by the
+ sample rate. */
+#define LADSPA_HINT_BOUNDED_BELOW 0x1
+
+/* Hint LADSPA_HINT_BOUNDED_ABOVE indicates that the UpperBound field
+ of the LADSPA_PortRangeHint should be considered meaningful. The
+ value in this field should be considered the (inclusive) upper
+ bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
+ specified then the value of UpperBound should be multiplied by the
+ sample rate. */
+#define LADSPA_HINT_BOUNDED_ABOVE 0x2
+
+/* Hint LADSPA_HINT_TOGGLED indicates that the data item should be
+ considered a Boolean toggle. Data less than or equal to zero should
+ be considered `off' or `false,' and data above zero should be
+ considered `on' or `true.' LADSPA_HINT_TOGGLED may not be used in
+ conjunction with any other hint except LADSPA_HINT_DEFAULT_0 or
+ LADSPA_HINT_DEFAULT_1. */
+#define LADSPA_HINT_TOGGLED 0x4
+
+/* Hint LADSPA_HINT_SAMPLE_RATE indicates that any bounds specified
+ should be interpreted as multiples of the sample rate. For
+ instance, a frequency range from 0Hz to the Nyquist frequency (half
+ the sample rate) could be requested by this hint in conjunction
+ with LowerBound = 0 and UpperBound = 0.5. Hosts that support bounds
+ at all must support this hint to retain meaning. */
+#define LADSPA_HINT_SAMPLE_RATE 0x8
+
+/* Hint LADSPA_HINT_LOGARITHMIC indicates that it is likely that the
+ user will find it more intuitive to view values using a logarithmic
+ scale. This is particularly useful for frequencies and gains. */
+#define LADSPA_HINT_LOGARITHMIC 0x10
+
+/* Hint LADSPA_HINT_INTEGER indicates that a user interface would
+ probably wish to provide a stepped control taking only integer
+ values. Any bounds set should be slightly wider than the actual
+ integer range required to avoid floating point rounding errors. For
+ instance, the integer set {0,1,2,3} might be described as [-0.1,
+ 3.1]. */
+#define LADSPA_HINT_INTEGER 0x20
+
+/* The various LADSPA_HINT_HAS_DEFAULT_* hints indicate a `normal'
+ value for the port that is sensible as a default. For instance,
+ this value is suitable for use as an initial value in a user
+ interface or as a value the host might assign to a control port
+ when the user has not provided one. Defaults are encoded using a
+ mask so only one default may be specified for a port. Some of the
+ hints make use of lower and upper bounds, in which case the
+ relevant bound or bounds must be available and
+ LADSPA_HINT_SAMPLE_RATE must be applied as usual. The resulting
+ default must be rounded if LADSPA_HINT_INTEGER is present. Default
+ values were introduced in LADSPA v1.1. */
+#define LADSPA_HINT_DEFAULT_MASK 0x3C0
+
+/* This default values indicates that no default is provided. */
+#define LADSPA_HINT_DEFAULT_NONE 0x0
+
+/* This default hint indicates that the suggested lower bound for the
+ port should be used. */
+#define LADSPA_HINT_DEFAULT_MINIMUM 0x40
+
+/* This default hint indicates that a low value between the suggested
+ lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.75 +
+ log(upper) * 0.25). Otherwise, this should be (lower * 0.75 + upper
+ * 0.25). */
+#define LADSPA_HINT_DEFAULT_LOW 0x80
+
+/* This default hint indicates that a middle value between the
+ suggested lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.5 +
+ log(upper) * 0.5). Otherwise, this should be (lower * 0.5 + upper *
+ 0.5). */
+#define LADSPA_HINT_DEFAULT_MIDDLE 0xC0
+
+/* This default hint indicates that a high value between the suggested
+ lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.25 +
+ log(upper) * 0.75). Otherwise, this should be (lower * 0.25 + upper
+ * 0.75). */
+#define LADSPA_HINT_DEFAULT_HIGH 0x100
+
+/* This default hint indicates that the suggested upper bound for the
+ port should be used. */
+#define LADSPA_HINT_DEFAULT_MAXIMUM 0x140
+
+/* This default hint indicates that the number 0 should be used. Note
+ that this default may be used in conjunction with
+ LADSPA_HINT_TOGGLED. */
+#define LADSPA_HINT_DEFAULT_0 0x200
+
+/* This default hint indicates that the number 1 should be used. Note
+ that this default may be used in conjunction with
+ LADSPA_HINT_TOGGLED. */
+#define LADSPA_HINT_DEFAULT_1 0x240
+
+/* This default hint indicates that the number 100 should be used. */
+#define LADSPA_HINT_DEFAULT_100 0x280
+
+/* This default hint indicates that the Hz frequency of `concert A'
+ should be used. This will be 440 unless the host uses an unusual
+ tuning convention, in which case it may be within a few Hz. */
+#define LADSPA_HINT_DEFAULT_440 0x2C0
+
+#define LADSPA_IS_HINT_BOUNDED_BELOW(x) ((x) & LADSPA_HINT_BOUNDED_BELOW)
+#define LADSPA_IS_HINT_BOUNDED_ABOVE(x) ((x) & LADSPA_HINT_BOUNDED_ABOVE)
+#define LADSPA_IS_HINT_TOGGLED(x) ((x) & LADSPA_HINT_TOGGLED)
+#define LADSPA_IS_HINT_SAMPLE_RATE(x) ((x) & LADSPA_HINT_SAMPLE_RATE)
+#define LADSPA_IS_HINT_LOGARITHMIC(x) ((x) & LADSPA_HINT_LOGARITHMIC)
+#define LADSPA_IS_HINT_INTEGER(x) ((x) & LADSPA_HINT_INTEGER)
+
+#define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK)
+#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MINIMUM)
+#define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_LOW)
+#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MIDDLE)
+#define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_HIGH)
+#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MAXIMUM)
+#define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_0)
+#define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_1)
+#define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_100)
+#define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_440)
+
+typedef struct _LADSPA_PortRangeHint {
+
+ /* Hints about the port. */
+ LADSPA_PortRangeHintDescriptor HintDescriptor;
+
+ /* Meaningful when hint LADSPA_HINT_BOUNDED_BELOW is active. When
+ LADSPA_HINT_SAMPLE_RATE is also active then this value should be
+ multiplied by the relevant sample rate. */
+ LADSPA_Data LowerBound;
+
+ /* Meaningful when hint LADSPA_HINT_BOUNDED_ABOVE is active. When
+ LADSPA_HINT_SAMPLE_RATE is also active then this value should be
+ multiplied by the relevant sample rate. */
+ LADSPA_Data UpperBound;
+
+} LADSPA_PortRangeHint;
+
+/*****************************************************************************/
+
+/* Plugin Handles:
+
+ This plugin handle indicates a particular instance of the plugin
+ concerned. It is valid to compare this to NULL (0 for C++) but
+ otherwise the host should not attempt to interpret it. The plugin
+ may use it to reference internal instance data. */
+
+typedef void * LADSPA_Handle;
+
+/*****************************************************************************/
+
+/* Descriptor for a Type of Plugin:
+
+ This structure is used to describe a plugin type. It provides a
+ number of functions to examine the type, instantiate it, link it to
+ buffers and workspaces and to run it. */
+
+typedef struct _LADSPA_Descriptor {
+
+ /* This numeric identifier indicates the plugin type
+ uniquely. Plugin programmers may reserve ranges of IDs from a
+ central body to avoid clashes. Hosts may assume that IDs are
+ below 0x1000000. */
+ unsigned long UniqueID;
+
+ /* This identifier can be used as a unique, case-sensitive
+ identifier for the plugin type within the plugin file. Plugin
+ types should be identified by file and label rather than by index
+ or plugin name, which may be changed in new plugin
+ versions. Labels must not contain white-space characters. */
+ const char * Label;
+
+ /* This indicates a number of properties of the plugin. */
+ LADSPA_Properties Properties;
+
+ /* This member points to the null-terminated name of the plugin
+ (e.g. "Sine Oscillator"). */
+ const char * Name;
+
+ /* This member points to the null-terminated string indicating the
+ maker of the plugin. This can be an empty string but not NULL. */
+ const char * Maker;
+
+ /* This member points to the null-terminated string indicating any
+ copyright applying to the plugin. If no Copyright applies the
+ string "None" should be used. */
+ const char * Copyright;
+
+ /* This indicates the number of ports (input AND output) present on
+ the plugin. */
+ unsigned long PortCount;
+
+ /* This member indicates an array of port descriptors. Valid indices
+ vary from 0 to PortCount-1. */
+ const LADSPA_PortDescriptor * PortDescriptors;
+
+ /* This member indicates an array of null-terminated strings
+ describing ports (e.g. "Frequency (Hz)"). Valid indices vary from
+ 0 to PortCount-1. */
+ const char * const * PortNames;
+
+ /* This member indicates an array of range hints for each port (see
+ above). Valid indices vary from 0 to PortCount-1. */
+ const LADSPA_PortRangeHint * PortRangeHints;
+
+ /* This may be used by the plugin developer to pass any custom
+ implementation data into an instantiate call. It must not be used
+ or interpreted by the host. It is expected that most plugin
+ writers will not use this facility as LADSPA_Handle should be
+ used to hold instance data. */
+ void * ImplementationData;
+
+ /* This member is a function pointer that instantiates a plugin. A
+ handle is returned indicating the new plugin instance. The
+ instantiation function accepts a sample rate as a parameter. The
+ plugin descriptor from which this instantiate function was found
+ must also be passed. This function must return NULL if
+ instantiation fails.
+
+ Note that instance initialisation should generally occur in
+ activate() rather than here. */
+ LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor,
+ unsigned long SampleRate);
+
+ /* This member is a function pointer that connects a port on an
+ instantiated plugin to a memory location at which a block of data
+ for the port will be read/written. The data location is expected
+ to be an array of LADSPA_Data for audio ports or a single
+ LADSPA_Data value for control ports. Memory issues will be
+ managed by the host. The plugin must read/write the data at these
+ locations every time run() or run_adding() is called and the data
+ present at the time of this connection call should not be
+ considered meaningful.
+
+ connect_port() may be called more than once for a plugin instance
+ to allow the host to change the buffers that the plugin is
+ reading or writing. These calls may be made before or after
+ activate() or deactivate() calls.
+
+ connect_port() must be called at least once for each port before
+ run() or run_adding() is called. When working with blocks of
+ LADSPA_Data the plugin should pay careful attention to the block
+ size passed to the run function as the block allocated may only
+ just be large enough to contain the block of samples.
+
+ Plugin writers should be aware that the host may elect to use the
+ same buffer for more than one port and even use the same buffer
+ for both input and output (see LADSPA_PROPERTY_INPLACE_BROKEN).
+ However, overlapped buffers or use of a single buffer for both
+ audio and control data may result in unexpected behaviour. */
+ void (*connect_port)(LADSPA_Handle Instance,
+ unsigned long Port,
+ LADSPA_Data * DataLocation);
+
+ /* This member is a function pointer that initialises a plugin
+ instance and activates it for use. This is separated from
+ instantiate() to aid real-time support and so that hosts can
+ reinitialise a plugin instance by calling deactivate() and then
+ activate(). In this case the plugin instance must reset all state
+ information dependent on the history of the plugin instance
+ except for any data locations provided by connect_port() and any
+ gain set by set_run_adding_gain(). If there is nothing for
+ activate() to do then the plugin writer may provide a NULL rather
+ than an empty function.
+
+ When present, hosts must call this function once before run() (or
+ run_adding()) is called for the first time. This call should be
+ made as close to the run() call as possible and indicates to
+ real-time plugins that they are now live. Plugins should not rely
+ on a prompt call to run() after activate(). activate() may not be
+ called again unless deactivate() is called first. Note that
+ connect_port() may be called before or after a call to
+ activate(). */
+ void (*activate)(LADSPA_Handle Instance);
+
+ /* This method is a function pointer that runs an instance of a
+ plugin for a block. Two parameters are required: the first is a
+ handle to the particular instance to be run and the second
+ indicates the block size (in samples) for which the plugin
+ instance may run.
+
+ Note that if an activate() function exists then it must be called
+ before run() or run_adding(). If deactivate() is called for a
+ plugin instance then the plugin instance may not be reused until
+ activate() has been called again.
+
+ If the plugin has the property LADSPA_PROPERTY_HARD_RT_CAPABLE
+ then there are various things that the plugin should not do
+ within the run() or run_adding() functions (see above). */
+ void (*run)(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+
+ /* This method is a function pointer that runs an instance of a
+ plugin for a block. This has identical behaviour to run() except
+ in the way data is output from the plugin. When run() is used,
+ values are written directly to the memory areas associated with
+ the output ports. However when run_adding() is called, values
+ must be added to the values already present in the memory
+ areas. Furthermore, output values written must be scaled by the
+ current gain set by set_run_adding_gain() (see below) before
+ addition.
+
+ run_adding() is optional. When it is not provided by a plugin,
+ this function pointer must be set to NULL. When it is provided,
+ the function set_run_adding_gain() must be provided also. */
+ void (*run_adding)(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+
+ /* This method is a function pointer that sets the output gain for
+ use when run_adding() is called (see above). If this function is
+ never called the gain is assumed to default to 1. Gain
+ information should be retained when activate() or deactivate()
+ are called.
+
+ This function should be provided by the plugin if and only if the
+ run_adding() function is provided. When it is absent this
+ function pointer must be set to NULL. */
+ void (*set_run_adding_gain)(LADSPA_Handle Instance,
+ LADSPA_Data Gain);
+
+ /* This is the counterpart to activate() (see above). If there is
+ nothing for deactivate() to do then the plugin writer may provide
+ a NULL rather than an empty function.
+
+ Hosts must deactivate all activated units after they have been
+ run() (or run_adding()) for the last time. This call should be
+ made as close to the last run() call as possible and indicates to
+ real-time plugins that they are no longer live. Plugins should
+ not rely on prompt deactivation. Note that connect_port() may be
+ called before or after a call to deactivate().
+
+ Deactivation is not similar to pausing as the plugin instance
+ will be reinitialised when activate() is called to reuse it. */
+ void (*deactivate)(LADSPA_Handle Instance);
+
+ /* Once an instance of a plugin has been finished with it can be
+ deleted using the following function. The instance handle passed
+ ceases to be valid after this call.
+
+ If activate() was called for a plugin instance then a
+ corresponding call to deactivate() must be made before cleanup()
+ is called. */
+ void (*cleanup)(LADSPA_Handle Instance);
+
+} LADSPA_Descriptor;
+
+/**********************************************************************/
+
+/* Accessing a Plugin: */
+
+/* The exact mechanism by which plugins are loaded is host-dependent,
+ however all most hosts will need to know is the name of shared
+ object file containing the plugin types. To allow multiple hosts to
+ share plugin types, hosts may wish to check for environment
+ variable LADSPA_PATH. If present, this should contain a
+ colon-separated path indicating directories that should be searched
+ (in order) when loading plugin types.
+
+ A plugin programmer must include a function called
+ "ladspa_descriptor" with the following function prototype within
+ the shared object file. This function will have C-style linkage (if
+ you are using C++ this is taken care of by the `extern "C"' clause
+ at the top of the file).
+
+ A host will find the plugin shared object file by one means or
+ another, find the ladspa_descriptor() function, call it, and
+ proceed from there.
+
+ Plugin types are accessed by index (not ID) using values from 0
+ upwards. Out of range indexes must result in this function
+ returning NULL, so the plugin count can be determined by checking
+ for the least index that results in NULL being returned. */
+
+const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index);
+
+/* Datatype corresponding to the ladspa_descriptor() function. */
+typedef const LADSPA_Descriptor *
+(*LADSPA_Descriptor_Function)(unsigned long Index);
+
+/**********************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LADSPA_INCLUDED */
+
+/* EOF */
diff --git a/src/src/libsox.c b/src/src/libsox.c
new file mode 100644
index 0000000..89e022c
--- /dev/null
+++ b/src/src/libsox.c
@@ -0,0 +1,236 @@
+/* Implements the public API for libSoX general functions
+ * All public functions & data are prefixed with sox_ .
+ *
+ * (c) 2006-8 Chris Bagwell and SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+const char *sox_version(void)
+{
+ static char versionstr[20];
+
+ sprintf(versionstr, "%d.%d.%d",
+ (SOX_LIB_VERSION_CODE & 0xff0000) >> 16,
+ (SOX_LIB_VERSION_CODE & 0x00ff00) >> 8,
+ (SOX_LIB_VERSION_CODE & 0x0000ff));
+ return(versionstr);
+}
+
+sox_version_info_t const * sox_version_info(void)
+{
+#define STRINGIZE1(x) #x
+#define STRINGIZE(x) STRINGIZE1(x)
+ static char arch[30];
+ static sox_version_info_t info = {
+ /* size */
+ sizeof(sox_version_info_t),
+ /* flags */
+ (sox_version_flags_t)(
+#if HAVE_POPEN
+ sox_version_have_popen +
+#endif
+#if HAVE_MAGIC
+ sox_version_have_magic +
+#endif
+#if HAVE_OPENMP
+ sox_version_have_threads +
+#endif
+#ifdef HAVE_FMEMOPEN
+ sox_version_have_memopen +
+#endif
+ sox_version_none),
+ /* version_code */
+ SOX_LIB_VERSION_CODE,
+ /* version */
+ NULL,
+ /* sox_version_extra */
+#ifdef PACKAGE_EXTRA
+ PACKAGE_EXTRA,
+#else
+ NULL,
+#endif
+ /* sox_time */
+ __DATE__ " " __TIME__,
+ /* sox_distro */
+#ifdef DISTRO
+ DISTRO,
+#else
+ NULL,
+#endif
+ /* sox_compiler */
+#if defined __GNUC__
+ "gcc " __VERSION__,
+#elif defined _MSC_VER
+ "msvc " STRINGIZE(_MSC_FULL_VER),
+#elif defined __SUNPRO_C
+ fprintf(file, "sun c " STRINGIZE(__SUNPRO_C),
+#else
+ NULL,
+#endif
+ /* sox_arch */
+ NULL
+ };
+
+ if (!info.version)
+ {
+ info.version = sox_version();
+ }
+
+ if (!info.arch)
+ {
+ snprintf(arch, sizeof(arch),
+ "%" PRIuPTR "%" PRIuPTR "%" PRIuPTR "%" PRIuPTR
+ " %" PRIuPTR "%" PRIuPTR " %" PRIuPTR "%" PRIuPTR " %c %s",
+ sizeof(char), sizeof(short), sizeof(long), sizeof(off_t),
+ sizeof(float), sizeof(double), sizeof(int *), sizeof(int (*)(void)),
+ MACHINE_IS_BIGENDIAN ? 'B' : 'L',
+ (info.flags & sox_version_have_threads) ? "OMP" : "");
+ arch[sizeof(arch) - 1] = 0;
+ info.arch = arch;
+ }
+
+ return &info;
+}
+
+/* Default routine to output messages; can be overridden */
+static void output_message(
+ unsigned level, const char *filename, const char *fmt, va_list ap)
+{
+ if (sox_globals.verbosity >= level) {
+ char base_name[128];
+ sox_basename(base_name, sizeof(base_name), filename);
+ fprintf(stderr, "%s: ", base_name);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ }
+}
+
+static sox_globals_t s_sox_globals = {
+ 2, /* unsigned verbosity */
+ output_message, /* sox_output_message_handler */
+ sox_false, /* sox_bool repeatable */
+ 8192, /* size_t bufsiz */
+ 0, /* size_t input_bufsiz */
+ 0, /* int32_t ranqd1 */
+ NULL, /* char const * stdin_in_use_by */
+ NULL, /* char const * stdout_in_use_by */
+ NULL, /* char const * subsystem */
+ NULL, /* char * tmp_path */
+ sox_false, /* sox_bool use_magic */
+ sox_false, /* sox_bool use_threads */
+ 10 /* size_t log2_dft_min_size */
+};
+
+sox_globals_t * sox_get_globals(void)
+{
+ return &s_sox_globals;
+}
+
+/* FIXME: Not thread safe using globals */
+static sox_effects_globals_t s_sox_effects_globals =
+ {sox_plot_off, &s_sox_globals};
+
+sox_effects_globals_t *
+sox_get_effects_globals(void)
+{
+ return &s_sox_effects_globals;
+}
+
+char const * sox_strerror(int sox_errno)
+{
+ static char const * const errors[] = {
+ "Invalid Audio Header",
+ "Unsupported data format",
+ "Can't allocate memory",
+ "Operation not permitted",
+ "Operation not supported",
+ "Invalid argument",
+ };
+ if (sox_errno < SOX_EHDR)
+ return strerror(sox_errno);
+ sox_errno -= SOX_EHDR;
+ if (sox_errno < 0 || (size_t)sox_errno >= array_length(errors))
+ return "Unknown error";
+ return errors[sox_errno];
+}
+
+size_t sox_basename(char * base_buffer, size_t base_buffer_len, const char * filename)
+{
+ if (!base_buffer || !base_buffer_len)
+ {
+ return 0;
+ }
+ else
+ {
+ char const * slash_pos = LAST_SLASH(filename);
+ char const * base_name = slash_pos ? slash_pos + 1 : filename;
+ char const * dot_pos = strrchr(base_name, '.');
+ size_t i, len;
+ dot_pos = dot_pos ? dot_pos : base_name + strlen(base_name);
+ len = dot_pos - base_name;
+ len = min(len, base_buffer_len - 1);
+ for (i = 0; i < len; i++)
+ {
+ base_buffer[i] = base_name[i];
+ }
+ base_buffer[i] = 0;
+ return i;
+ }
+}
+
+#define SOX_MESSAGE_FUNCTION(name,level) \
+void name(char const * fmt, ...) { \
+ va_list ap; \
+ va_start(ap, fmt); \
+ if (sox_globals.output_message_handler) \
+ (*sox_globals.output_message_handler)(level,sox_globals.subsystem,fmt,ap); \
+ va_end(ap); \
+}
+
+SOX_MESSAGE_FUNCTION(lsx_fail_impl , 1)
+SOX_MESSAGE_FUNCTION(lsx_warn_impl , 2)
+SOX_MESSAGE_FUNCTION(lsx_report_impl, 3)
+SOX_MESSAGE_FUNCTION(lsx_debug_impl , 4)
+SOX_MESSAGE_FUNCTION(lsx_debug_more_impl , 5)
+SOX_MESSAGE_FUNCTION(lsx_debug_most_impl , 6)
+
+#undef SOX_MESSAGE_FUNCTION
+
+static int init_done = 0;
+
+int sox_init(void)
+{
+ // TODO(acharton): make thread-safe.
+ if (init_done) {
+ return SOX_SUCCESS;
+ }
+ init_done = 1;
+ return lsx_effects_init();
+}
+
+int sox_quit(void)
+{
+ // TODO(acharton): make thread-safe.
+ if (!init_done) {
+ return SOX_SUCCESS;
+ }
+ init_done = 0;
+ sox_format_quit();
+ return lsx_effects_quit();
+}
diff --git a/src/src/libsox_i.c b/src/src/libsox_i.c
new file mode 100644
index 0000000..ba895a9
--- /dev/null
+++ b/src/src/libsox_i.c
@@ -0,0 +1,116 @@
+/* libSoX internal functions that apply to both formats and effects
+ * All public functions & data are prefixed with lsx_ .
+ *
+ * Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef HAVE_IO_H
+ #include <io.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+#endif
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ #define MKTEMP_X _O_BINARY|_O_TEMPORARY
+#else
+ #define MKTEMP_X 0
+#endif
+
+#ifndef HAVE_MKSTEMP
+ #include <fcntl.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #define mkstemp(t) open(mktemp(t), MKTEMP_X|O_RDWR|O_TRUNC|O_CREAT, S_IREAD|S_IWRITE)
+ #define FAKE_MKSTEMP "fake "
+#else
+ #define FAKE_MKSTEMP
+#endif
+
+#ifdef WIN32
+static int check_dir(char * buf, size_t buflen, char const * name)
+{
+ struct stat st;
+ if (!name || stat(name, &st) || (st.st_mode & S_IFMT) != S_IFDIR)
+ {
+ return 0;
+ }
+ else
+ {
+ strncpy(buf, name, buflen);
+ buf[buflen - 1] = 0;
+ return strlen(name) == strlen(buf);
+ }
+}
+#endif
+
+FILE * lsx_tmpfile(void)
+{
+ char const * path = sox_globals.tmp_path;
+
+ /*
+ On Win32, tmpfile() is broken - it creates the file in the root directory of
+ the current drive (the user probably doesn't have permission to write there!)
+ instead of in a valid temporary directory (like TEMP or TMP). So if tmp_path
+ is null, figure out a reasonable default.
+ To force use of tmpfile(), set sox_globals.tmp_path = "".
+ */
+#ifdef WIN32
+ if (!path)
+ {
+ static char default_path[260] = "";
+ if (default_path[0] == 0
+ && !check_dir(default_path, sizeof(default_path), getenv("TEMP"))
+ && !check_dir(default_path, sizeof(default_path), getenv("TMP"))
+ #ifdef __CYGWIN__
+ && !check_dir(default_path, sizeof(default_path), "/tmp")
+ #endif
+ )
+ {
+ strcpy(default_path, ".");
+ }
+
+ path = default_path;
+ }
+#endif
+
+ if (path && path[0]) {
+ /* Emulate tmpfile (delete on close); tmp dir is given tmp_path: */
+ char const * const end = "/libSoX.tmp.XXXXXX";
+ char * name = lsx_malloc(strlen(path) + strlen(end) + 1);
+ int fildes;
+ strcpy(name, path);
+ strcat(name, end);
+ fildes = mkstemp(name);
+#ifdef HAVE_UNISTD_H
+ lsx_debug(FAKE_MKSTEMP "mkstemp, name=%s (unlinked)", name);
+ unlink(name);
+#else
+ lsx_debug(FAKE_MKSTEMP "mkstemp, name=%s (O_TEMPORARY)", name);
+#endif
+ free(name);
+ return fildes == -1? NULL : fdopen(fildes, "w+b");
+ }
+
+ /* Use standard tmpfile (delete on close); tmp dir is undefined: */
+ lsx_debug("tmpfile()");
+ return tmpfile();
+}
diff --git a/src/src/loudness.c b/src/src/loudness.c
new file mode 100644
index 0000000..5ae3866
--- /dev/null
+++ b/src/src/loudness.c
@@ -0,0 +1,129 @@
+/* Effect: loudness filter Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/dft_filter.h"
+#include <string.h>
+
+typedef struct {
+ dft_filter_priv_t base;
+ double delta, start;
+ int n;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ dft_filter_priv_t * b = &p->base;
+ b->filter_ptr = &b->filter;
+ p->delta = -10;
+ p->start = 65;
+ p->n = 1023;
+ --argc, ++argv;
+ do { /* break-able block */
+ NUMERIC_PARAMETER(delta,-50 , 15) /* FIXME expand range */
+ NUMERIC_PARAMETER(start, 50 , 75) /* FIXME expand range */
+ NUMERIC_PARAMETER(n ,127 ,2047)
+ } while (0);
+ p->n = 2 * p->n + 1;
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static double * make_filter(int n, double start, double delta, double rate)
+{
+ static const struct {double f, af, lu, tf;} iso226_table[] = {
+ { 20,0.532,-31.6,78.5},{ 25,0.506,-27.2,68.7},{ 31.5,0.480,-23.0,59.5},
+ { 40,0.455,-19.1,51.1},{ 50,0.432,-15.9,44.0},{ 63,0.409,-13.0,37.5},
+ { 80,0.387,-10.3,31.5},{ 100,0.367, -8.1,26.5},{ 125,0.349, -6.2,22.1},
+ { 160,0.330, -4.5,17.9},{ 200,0.315, -3.1,14.4},{ 250,0.301, -2.0,11.4},
+ { 315,0.288, -1.1, 8.6},{ 400,0.276, -0.4, 6.2},{ 500,0.267, 0.0, 4.4},
+ { 630,0.259, 0.3, 3.0},{ 800,0.253, 0.5, 2.2},{ 1000,0.250, 0.0, 2.4},
+ { 1250,0.246, -2.7, 3.5},{ 1600,0.244, -4.1, 1.7},{ 2000,0.243, -1.0,-1.3},
+ { 2500,0.243, 1.7,-4.2},{ 3150,0.243, 2.5,-6.0},{ 4000,0.242, 1.2,-5.4},
+ { 5000,0.242, -2.1,-1.5},{ 6300,0.245, -7.1, 6.0},{ 8000,0.254,-11.2,12.6},
+ {10000,0.271,-10.7,13.9},{12500,0.301, -3.1,12.3},
+ };
+ #define LEN (array_length(iso226_table) + 2)
+ #define SPL(phon, t) (10 / t.af * log10(4.47e-3 * (pow(10., .025 * (phon)) - \
+ 1.15) + pow(.4 * pow(10., (t.tf + t.lu) / 10 - 9), t.af)) - t.lu + 94)
+ double fs[LEN], spl[LEN], d[LEN], * work, * h;
+ int i, work_len;
+
+ fs[0] = log(1.);
+ spl[0] = delta * .2;
+ for (i = 0; i < (int)LEN - 2; ++i) {
+ spl[i + 1] = SPL(start + delta, iso226_table[i]) -
+ SPL(start , iso226_table[i]);
+ fs[i + 1] = log(iso226_table[i].f);
+ }
+ fs[i + 1] = log(100000.);
+ spl[i + 1] = spl[0];
+ lsx_prepare_spline3(fs, spl, (int)LEN, HUGE_VAL, HUGE_VAL, d);
+
+ for (work_len = 8192; work_len < rate / 2; work_len <<= 1);
+ work = lsx_calloc(work_len, sizeof(*work));
+ h = lsx_calloc(n, sizeof(*h));
+
+ for (i = 0; i <= work_len / 2; ++i) {
+ double f = rate * i / work_len;
+ double spl1 = f < 1? spl[0] : lsx_spline3(fs, spl, d, (int)LEN, log(f));
+ work[i < work_len / 2 ? 2 * i : 1] = dB_to_linear(spl1);
+ }
+ lsx_safe_rdft(work_len, -1, work);
+ for (i = 0; i < n; ++i)
+ h[i] = work[(work_len - n / 2 + i) % work_len] * 2. / work_len;
+ lsx_apply_kaiser(h, n, lsx_kaiser_beta(40 + 2./3 * fabs(delta), .1));
+
+ free(work);
+ return h;
+ #undef SPL
+ #undef LEN
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ dft_filter_t * f = p->base.filter_ptr;
+
+ if (p->delta == 0)
+ return SOX_EFF_NULL;
+
+ if (!f->num_taps) {
+ double * h = make_filter(p->n, p->start, p->delta, effp->in_signal.rate);
+ if (effp->global_info->plot != sox_plot_off) {
+ char title[100];
+ sprintf(title, "SoX effect: loudness %g (%g)", p->delta, p->start);
+ lsx_plot_fir(h, p->n, effp->in_signal.rate,
+ effp->global_info->plot, title, p->delta - 5, 0.);
+ return SOX_EOF;
+ }
+ lsx_set_dft_filter(f, h, p->n, p->n >> 1);
+ }
+ return lsx_dft_filter_effect_fn()->start(effp);
+}
+
+sox_effect_handler_t const * lsx_loudness_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_dft_filter_effect_fn();
+ handler.name = "loudness";
+ handler.usage = "[gain [ref]]";
+ handler.getopts = create;
+ handler.start = start;
+ handler.priv_size = sizeof(priv_t);
+ return &handler;
+}
diff --git a/src/src/lpc10.c b/src/src/lpc10.c
new file mode 100644
index 0000000..8ee3cf4
--- /dev/null
+++ b/src/src/lpc10.c
@@ -0,0 +1,229 @@
+/* libSoX lpc-10 format.
+ *
+ * Copyright 2007 Reuben Thomas <rrt@sc3d.org>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef EXTERNAL_LPC10
+#include <lpc10.h>
+#else
+#include "third_party/sox/src/lpc10/lpc10.h"
+#endif
+
+/* Private data */
+typedef struct {
+ struct lpc10_encoder_state *encst;
+ float speech[LPC10_SAMPLES_PER_FRAME];
+ unsigned samples;
+ struct lpc10_decoder_state *decst;
+} priv_t;
+
+/*
+ Write the bits in bits[0] through bits[len-1] to file f, in "packed"
+ format.
+
+ bits is expected to be an array of len integer values, where each
+ integer is 0 to represent a 0 bit, and any other value represents a
+ 1 bit. This bit string is written to the file f in the form of
+ several 8 bit characters. If len is not a multiple of 8, then the
+ last character is padded with 0 bits -- the padding is in the least
+ significant bits of the last byte. The 8 bit characters are "filled"
+ in order from most significant bit to least significant.
+*/
+static void write_bits(sox_format_t * ft, INT32 *bits, int len)
+{
+ int i;
+ uint8_t mask; /* The next bit position within the variable "data" to
+ place the next bit. */
+ uint8_t data; /* The contents of the next byte to place in the
+ output. */
+
+ /* Fill in the array bits.
+ * The first compressed output bit will be the most significant
+ * bit of the byte, so initialize mask to 0x80. The next byte of
+ * compressed data is initially 0, and the desired bits will be
+ * turned on below.
+ */
+ mask = 0x80;
+ data = 0;
+
+ for (i = 0; i < len; i++) {
+ /* Turn on the next bit of output data, if necessary. */
+ if (bits[i]) {
+ data |= mask;
+ }
+ /*
+ * If the byte data is full, determined by mask becoming 0,
+ * then write the byte to the output file, and reinitialize
+ * data and mask for the next output byte. Also add the byte
+ * if (i == len-1), because if len is not a multiple of 8,
+ * then mask won't yet be 0. */
+ mask >>= 1;
+ if ((mask == 0) || (i == len-1)) {
+ lsx_writeb(ft, data);
+ data = 0;
+ mask = 0x80;
+ }
+ }
+}
+
+/*
+ Read bits from file f into bits[0] through bits[len-1], in "packed"
+ format.
+
+ Read ceiling(len/8) characters from file f, if that many are
+ available to read, otherwise read to the end of the file. The first
+ character's 8 bits, in order from MSB to LSB, are used to fill
+ bits[0] through bits[7]. The second character's bits are used to
+ fill bits[8] through bits[15], and so on. If ceiling(len/8)
+ characters are available to read, and len is not a multiple of 8,
+ then some of the least significant bits of the last character read
+ are completely ignored. Every entry of bits[] that is modified is
+ changed to either a 0 or a 1.
+
+ The number of bits successfully read is returned, and is always in
+ the range 0 to len, inclusive. If it is less than len, it will
+ always be a multiple of 8.
+*/
+static int read_bits(sox_format_t * ft, INT32 *bits, int len)
+{
+ int i;
+ uint8_t c = 0;
+
+ /* Unpack the array bits into coded_frame. */
+ for (i = 0; i < len; i++) {
+ if (i % 8 == 0) {
+ lsx_read_b_buf(ft, &c, (size_t) 1);
+ if (lsx_eof(ft)) {
+ return (i);
+ }
+ }
+ if (c & (0x80 >> (i & 7))) {
+ bits[i] = 1;
+ } else {
+ bits[i] = 0;
+ }
+ }
+ return (len);
+}
+
+static int startread(sox_format_t * ft)
+{
+ priv_t * lpc = (priv_t *)ft->priv;
+
+ if ((lpc->decst = create_lpc10_decoder_state()) == NULL) {
+ fprintf(stderr, "lpc10 could not allocate decoder state");
+ return SOX_EOF;
+ }
+ lpc->samples = LPC10_SAMPLES_PER_FRAME;
+ return lsx_check_read_params(ft, 1, 8000., SOX_ENCODING_LPC10, 0, (uint64_t)0, sox_false);
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * lpc = (priv_t *)ft->priv;
+
+ if ((lpc->encst = create_lpc10_encoder_state()) == NULL) {
+ fprintf(stderr, "lpc10 could not allocate encoder state");
+ return SOX_EOF;
+ }
+ lpc->samples = 0;
+
+ return SOX_SUCCESS;
+}
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * lpc = (priv_t *)ft->priv;
+ size_t nread = 0;
+
+ while (nread < len) {
+ SOX_SAMPLE_LOCALS;
+ /* Read more data if buffer is empty */
+ if (lpc->samples == LPC10_SAMPLES_PER_FRAME) {
+ INT32 bits[LPC10_BITS_IN_COMPRESSED_FRAME];
+
+ if (read_bits(ft, bits, LPC10_BITS_IN_COMPRESSED_FRAME) !=
+ LPC10_BITS_IN_COMPRESSED_FRAME)
+ break;
+ lpc10_decode(bits, lpc->speech, lpc->decst);
+ lpc->samples = 0;
+ }
+
+ while (nread < len && lpc->samples < LPC10_SAMPLES_PER_FRAME)
+ buf[nread++] = SOX_FLOAT_32BIT_TO_SAMPLE(lpc->speech[lpc->samples++], ft->clips);
+ }
+
+ return nread;
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * lpc = (priv_t *)ft->priv;
+ size_t nwritten = 0;
+
+ while (len > 0) {
+ while (len > 0 && lpc->samples < LPC10_SAMPLES_PER_FRAME) {
+ SOX_SAMPLE_LOCALS;
+ lpc->speech[lpc->samples++] = SOX_SAMPLE_TO_FLOAT_32BIT(buf[nwritten++], ft->clips);
+ len--;
+ }
+
+ if (lpc->samples == LPC10_SAMPLES_PER_FRAME) {
+ INT32 bits[LPC10_BITS_IN_COMPRESSED_FRAME];
+
+ lpc10_encode(lpc->speech, bits, lpc->encst);
+ write_bits(ft, bits, LPC10_BITS_IN_COMPRESSED_FRAME);
+ lpc->samples = 0;
+ }
+ }
+
+ return nwritten;
+}
+
+static int stopread(sox_format_t * ft)
+{
+ priv_t * lpc = (priv_t *)ft->priv;
+
+ free(lpc->decst);
+
+ return SOX_SUCCESS;
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * lpc = (priv_t *)ft->priv;
+
+ free(lpc->encst);
+
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(lpc10)
+{
+ static char const * const names[] = {"lpc10", "lpc", NULL};
+ static sox_rate_t const write_rates[] = {8000, 0};
+ static unsigned const write_encodings[] = {SOX_ENCODING_LPC10, 0, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Low bandwidth, robotic sounding speech compression", names, SOX_FILE_MONO,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, write_rates, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/lu-fmt.c b/src/src/lu-fmt.c
new file mode 100644
index 0000000..e1107cb
--- /dev/null
+++ b/src/src/lu-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT(lu, 8, SOX_FILE_BIT_REV, ULAW)
diff --git a/src/src/mat4.c b/src/src/mat4.c
new file mode 100644
index 0000000..3084dda
--- /dev/null
+++ b/src/src/mat4.c
@@ -0,0 +1,37 @@
+/* libSoX file format: MatLab4 Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(mat4)
+{
+ static char const * const names[] = {"mat4", "mat", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 32, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ 0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description = "Gnu Octave 2.0 format";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/mat5.c b/src/src/mat5.c
new file mode 100644
index 0000000..6e7d7d0
--- /dev/null
+++ b/src/src/mat5.c
@@ -0,0 +1,37 @@
+/* libSoX file format: MatLab5 Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(mat5)
+{
+ static char const * const names[] = {"mat5", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 32, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ 0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description = "Gnu Octave 2.1 format";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/maud.c b/src/src/maud.c
new file mode 100644
index 0000000..ceba2c3
--- /dev/null
+++ b/src/src/maud.c
@@ -0,0 +1,344 @@
+/* libSoX MAUD file format handler, by Lutz Vieweg 1993
+ *
+ * supports: mono and stereo, linear, a-law and u-law reading and writing
+ *
+ * an IFF format; description at http://lclevy.free.fr/amiga/MAUDINFO.TXT
+ *
+ * Copyright 1998-2006 Chris Bagwell and SoX Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+/* Private data for MAUD file */
+typedef struct {
+ uint32_t nsamples;
+} priv_t;
+
+static void maudwriteheader(sox_format_t *);
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int startread(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *) ft->priv;
+
+ char buf[12];
+ char *chunk_buf;
+
+ unsigned short bitpersam;
+ uint32_t nom;
+ unsigned short denom;
+ unsigned short chaninf;
+
+ uint32_t chunksize;
+ uint32_t trash32;
+ uint16_t trash16;
+ int rc;
+
+ /* Needed for rawread() */
+ rc = lsx_rawstartread(ft);
+ if (rc)
+ return rc;
+
+ /* read FORM chunk */
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || strncmp(buf, "FORM", (size_t)4) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"MAUD: header does not begin with magic word `FORM'");
+ return (SOX_EOF);
+ }
+
+ lsx_readdw(ft, &trash32); /* totalsize */
+
+ if (lsx_reads(ft, buf, (size_t)4) == SOX_EOF || strncmp(buf, "MAUD", (size_t)4) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"MAUD: `FORM' chunk does not specify `MAUD' as type");
+ return(SOX_EOF);
+ }
+
+ /* read chunks until 'BODY' (or end) */
+
+ while (lsx_reads(ft, buf, (size_t)4) == SOX_SUCCESS && strncmp(buf,"MDAT",(size_t)4) != 0) {
+
+ /*
+ buf[4] = 0;
+ lsx_debug("chunk %s",buf);
+ */
+
+ if (strncmp(buf,"MHDR",(size_t)4) == 0) {
+
+ lsx_readdw(ft, &chunksize);
+ if (chunksize != 8*4)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"MAUD: MHDR chunk has bad size");
+ return(SOX_EOF);
+ }
+
+ /* number of samples stored in MDAT */
+ lsx_readdw(ft, &(p->nsamples));
+
+ /* number of bits per sample as stored in MDAT */
+ lsx_readw(ft, &bitpersam);
+
+ /* number of bits per sample after decompression */
+ lsx_readw(ft, &trash16);
+
+ lsx_readdw(ft, &nom); /* clock source frequency */
+ lsx_readw(ft, &denom); /* clock devide */
+ if (denom == 0)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"MAUD: frequency denominator == 0, failed");
+ return (SOX_EOF);
+ }
+
+ ft->signal.rate = nom / denom;
+
+ lsx_readw(ft, &chaninf); /* channel information */
+ switch (chaninf) {
+ case 0:
+ ft->signal.channels = 1;
+ break;
+ case 1:
+ ft->signal.channels = 2;
+ break;
+ default:
+ lsx_fail_errno(ft,SOX_EFMT,"MAUD: unsupported number of channels in file");
+ return (SOX_EOF);
+ }
+
+ lsx_readw(ft, &chaninf); /* number of channels (mono: 1, stereo: 2, ...) */
+ if (chaninf != ft->signal.channels)
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"MAUD: unsupported number of channels in file");
+ return(SOX_EOF);
+ }
+
+ lsx_readw(ft, &chaninf); /* compression type */
+
+ lsx_readdw(ft, &trash32); /* rest of chunk, unused yet */
+ lsx_readdw(ft, &trash32);
+ lsx_readdw(ft, &trash32);
+
+ if (bitpersam == 8 && chaninf == 0) {
+ ft->encoding.bits_per_sample = 8;
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
+ }
+ else if (bitpersam == 8 && chaninf == 2) {
+ ft->encoding.bits_per_sample = 8;
+ ft->encoding.encoding = SOX_ENCODING_ALAW;
+ }
+ else if (bitpersam == 8 && chaninf == 3) {
+ ft->encoding.bits_per_sample = 8;
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ }
+ else if (bitpersam == 16 && chaninf == 0) {
+ ft->encoding.bits_per_sample = 16;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ }
+ else
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"MAUD: unsupported compression type detected");
+ return(SOX_EOF);
+ }
+
+ continue;
+ }
+
+ if (strncmp(buf,"ANNO",(size_t)4) == 0) {
+ lsx_readdw(ft, &chunksize);
+ if (chunksize & 1)
+ chunksize++;
+ chunk_buf = lsx_malloc(chunksize + (size_t)1);
+ if (lsx_readbuf(ft, chunk_buf, (size_t)chunksize)
+ != chunksize)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"MAUD: Unexpected EOF in ANNO header");
+ return(SOX_EOF);
+ }
+ chunk_buf[chunksize] = '\0';
+ lsx_debug("%s",chunk_buf);
+ free(chunk_buf);
+
+ continue;
+ }
+
+ /* some other kind of chunk */
+ lsx_readdw(ft, &chunksize);
+ if (chunksize & 1)
+ chunksize++;
+ lsx_seeki(ft, (off_t)chunksize, SEEK_CUR);
+ continue;
+
+ }
+
+ if (strncmp(buf,"MDAT",(size_t)4) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EFMT,"MAUD: MDAT chunk not found");
+ return(SOX_EOF);
+ }
+ lsx_readdw(ft, &(p->nsamples));
+ return(SOX_SUCCESS);
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *) ft->priv;
+ int rc;
+
+ /* Needed for rawwrite() */
+ rc = lsx_rawstartwrite(ft);
+ if (rc)
+ return rc;
+
+ /* If you have to seek around the output file */
+ if (! ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Output .maud file must be a file, not a pipe");
+ return (SOX_EOF);
+ }
+ p->nsamples = 0x7f000000;
+ maudwriteheader(ft);
+ p->nsamples = 0;
+ return (SOX_SUCCESS);
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * p = (priv_t *) ft->priv;
+
+ p->nsamples += len;
+
+ return lsx_rawwrite(ft, buf, len);
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ /* All samples are already written out. */
+
+ priv_t *p = (priv_t*)ft->priv;
+ uint32_t mdat_size; /* MDAT chunk size */
+ mdat_size = p->nsamples * (ft->encoding.bits_per_sample >> 3);
+ lsx_padbytes(ft, (size_t) (mdat_size%2));
+
+ if (lsx_seeki(ft, (off_t)0, 0) != 0)
+ {
+ lsx_fail_errno(ft,errno,"can't rewind output file to rewrite MAUD header");
+ return(SOX_EOF);
+ }
+
+ maudwriteheader(ft);
+ return(SOX_SUCCESS);
+}
+
+#define MAUDHEADERSIZE (4+(4+4+32)+(4+4+19+1)+(4+4))
+static void maudwriteheader(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *) ft->priv;
+ uint32_t mdat_size; /* MDAT chunk size */
+
+ mdat_size = p->nsamples * (ft->encoding.bits_per_sample >> 3);
+
+ lsx_writes(ft, "FORM");
+ lsx_writedw(ft, MAUDHEADERSIZE + mdat_size + mdat_size%2); /* size of file */
+ lsx_writes(ft, "MAUD"); /* File type */
+
+ lsx_writes(ft, "MHDR");
+ lsx_writedw(ft, 8*4); /* number of bytes to follow */
+ lsx_writedw(ft, p->nsamples); /* number of samples stored in MDAT */
+
+ switch (ft->encoding.encoding) {
+
+ case SOX_ENCODING_UNSIGNED:
+ lsx_writew(ft, 8); /* number of bits per sample as stored in MDAT */
+ lsx_writew(ft, 8); /* number of bits per sample after decompression */
+ break;
+
+ case SOX_ENCODING_SIGN2:
+ lsx_writew(ft, 16); /* number of bits per sample as stored in MDAT */
+ lsx_writew(ft, 16); /* number of bits per sample after decompression */
+ break;
+
+ case SOX_ENCODING_ALAW:
+ case SOX_ENCODING_ULAW:
+ lsx_writew(ft, 8); /* number of bits per sample as stored in MDAT */
+ lsx_writew(ft, 16); /* number of bits per sample after decompression */
+ break;
+
+ default:
+ break;
+ }
+
+ lsx_writedw(ft, (unsigned)(ft->signal.rate + .5)); /* sample rate, Hz */
+ lsx_writew(ft, (int) 1); /* clock devide */
+
+ if (ft->signal.channels == 1) {
+ lsx_writew(ft, 0); /* channel information */
+ lsx_writew(ft, 1); /* number of channels (mono: 1, stereo: 2, ...) */
+ }
+ else {
+ lsx_writew(ft, 1);
+ lsx_writew(ft, 2);
+ }
+
+ switch (ft->encoding.encoding) {
+
+ case SOX_ENCODING_UNSIGNED:
+ case SOX_ENCODING_SIGN2:
+ lsx_writew(ft, 0); /* no compression */
+ break;
+
+ case SOX_ENCODING_ULAW:
+ lsx_writew(ft, 3);
+ break;
+
+ case SOX_ENCODING_ALAW:
+ lsx_writew(ft, 2);
+ break;
+
+ default:
+ break;
+ }
+
+ lsx_writedw(ft, 0); /* reserved */
+ lsx_writedw(ft, 0); /* reserved */
+ lsx_writedw(ft, 0); /* reserved */
+
+ lsx_writes(ft, "ANNO");
+ lsx_writedw(ft, 19); /* length of block */
+ lsx_writes(ft, "file created by SoX");
+ lsx_padbytes(ft, (size_t)1);
+
+ lsx_writes(ft, "MDAT");
+ lsx_writedw(ft, p->nsamples * (ft->encoding.bits_per_sample >> 3)); /* samples in file */
+}
+
+LSX_FORMAT_HANDLER(maud)
+{
+ static char const * const names[] = {"maud", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 0,
+ SOX_ENCODING_UNSIGNED, 8, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Used with the ‘Toccata’ sound-card on the Amiga",
+ names, SOX_FILE_BIG_END | SOX_FILE_MONO | SOX_FILE_STEREO,
+ startread, lsx_rawread, lsx_rawstopread,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/mcompand.c b/src/src/mcompand.c
new file mode 100644
index 0000000..9677c67
--- /dev/null
+++ b/src/src/mcompand.c
@@ -0,0 +1,524 @@
+/* multiband compander effect for SoX
+ * by Daniel Pouzzner <douzzer@mega.nu> 2002-Oct-8
+ *
+ * Compander code adapted from the SoX compand effect, by Nick Bailey
+ *
+ * SoX is Copyright 1999 Chris Bagwell And Nick Bailey This source code is
+ * freely redistributable and may be used for any purpose. This copyright
+ * notice must be maintained. Chris Bagwell And Nick Bailey are not
+ * responsible for the consequences of using this software.
+ *
+ *
+ * Usage:
+ * mcompand quoted_compand_args [crossover_frequency
+ * quoted_compand_args [...]]
+ *
+ * quoted_compand_args are as for the compand effect:
+ *
+ * attack1,decay1[,attack2,decay2...]
+ * in-dB1,out-dB1[,in-dB2,out-dB2...]
+ * [ gain [ initial-volume [ delay ] ] ]
+ *
+ * Beware a variety of headroom (clipping) bugaboos.
+ *
+ * Implementation details:
+ * The input is divided into bands using 4th order Linkwitz-Riley IIRs.
+ * This is akin to the crossover of a loudspeaker, and results in flat
+ * frequency response absent compander action.
+ *
+ * The outputs of the array of companders is summed, and sample truncation
+ * is done on the final sum.
+ *
+ * Modifications to the predictive compression code properly maintain
+ * alignment of the outputs of the array of companders when the companders
+ * have different prediction intervals (volume application delays). Note
+ * that the predictive mode of the limiter needs some TLC - in fact, a
+ * rewrite - since what's really useful is to assure that a waveform won't
+ * be clipped, by slewing the volume in advance so that the peak is at
+ * limit (or below, if there's a higher subsequent peak visible in the
+ * lookahead window) once it's reached. */
+
+#ifdef NDEBUG /* Enable assert always. */
+#undef NDEBUG /* Must undef above assert.h or other that might include it. */
+#endif
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include "third_party/sox/src/src/compandt.h"
+#include "third_party/sox/src/src/mcompand_xover.h"
+
+typedef struct {
+ sox_compandt_t transfer_fn;
+
+ size_t expectedChannels; /* Also flags that channels aren't to be treated
+ individually when = 1 and input not mono */
+ double *attackRate; /* An array of attack rates */
+ double *decayRate; /* ... and of decay rates */
+ double *volume; /* Current "volume" of each channel */
+ double delay; /* Delay to apply before companding */
+ double topfreq; /* upper bound crossover frequency */
+ crossover_t filter;
+ sox_sample_t *delay_buf; /* Old samples, used for delay processing */
+ size_t delay_size; /* lookahead for this band (in samples) - function of delay, above */
+ ptrdiff_t delay_buf_ptr; /* Index into delay_buf */
+ size_t delay_buf_cnt; /* No. of active entries in delay_buf */
+} comp_band_t;
+
+typedef struct {
+ size_t nBands;
+ sox_sample_t *band_buf1, *band_buf2, *band_buf3;
+ size_t band_buf_len;
+ size_t delay_buf_size;/* Size of delay_buf in samples */
+ comp_band_t *bands;
+
+ char *arg; /* copy of current argument */
+} priv_t;
+
+/*
+ * Process options
+ *
+ * Don't do initialization now.
+ * The 'info' fields are not yet filled in.
+ */
+static int sox_mcompand_getopts_1(comp_band_t * l, size_t n, char **argv)
+{
+ char *s;
+ size_t rates, i, commas;
+
+ /* Start by checking the attack and decay rates */
+
+ for (s = argv[0], commas = 0; *s; ++s)
+ if (*s == ',') ++commas;
+
+ if (commas % 2 == 0) /* There must be an even number of
+ attack/decay parameters */
+ {
+ lsx_fail("compander: Odd number of attack & decay rate parameters");
+ return (SOX_EOF);
+ }
+
+ rates = 1 + commas/2;
+ l->attackRate = lsx_malloc(sizeof(double) * rates);
+ l->decayRate = lsx_malloc(sizeof(double) * rates);
+ l->volume = lsx_malloc(sizeof(double) * rates);
+ l->expectedChannels = rates;
+ l->delay_buf = NULL;
+
+ /* Now tokenise the rates string and set up these arrays. Keep
+ them in seconds at the moment: we don't know the sample rate yet. */
+
+ s = strtok(argv[0], ","); i = 0;
+ do {
+ l->attackRate[i] = atof(s); s = strtok(NULL, ",");
+ l->decayRate[i] = atof(s); s = strtok(NULL, ",");
+ ++i;
+ } while (s != NULL);
+
+ if (!lsx_compandt_parse(&l->transfer_fn, argv[1], n>2 ? argv[2] : 0))
+ return SOX_EOF;
+
+ /* Set the initial "volume" to be attibuted to the input channels.
+ Unless specified, choose 1.0 (maximum) otherwise clipping will
+ result if the user has seleced a long attack time */
+ for (i = 0; i < l->expectedChannels; ++i) {
+ double v = n>=4 ? pow(10.0, atof(argv[3])/20) : 1.0;
+ l->volume[i] = v;
+
+ /* If there is a delay, store it. */
+ if (n >= 5) l->delay = atof(argv[4]);
+ else l->delay = 0.0;
+ }
+ return (SOX_SUCCESS);
+}
+
+static int parse_subarg(char *s, char **subargv, size_t *subargc) {
+ char **ap;
+ char *s_p;
+
+ s_p = s;
+ *subargc = 0;
+ for (ap = subargv; (*ap = strtok(s_p, " \t")) != NULL;) {
+ s_p = NULL;
+ if (*subargc == 5) {
+ ++*subargc;
+ break;
+ }
+ if (**ap != '\0') {
+ ++ap;
+ ++*subargc;
+ }
+ }
+
+ if (*subargc < 2 || *subargc > 5)
+ {
+ lsx_fail("Wrong number of parameters for the compander effect within mcompand; usage:\n"
+ "\tattack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]]\n"
+ "\twhere {} means optional and repeatable and [] means optional.\n"
+ "\tdB values are floating point or -inf'; times are in seconds.");
+ return (SOX_EOF);
+ } else
+ return SOX_SUCCESS;
+}
+
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ char *subargv[6], *cp;
+ size_t subargc, i;
+
+ priv_t * c = (priv_t *) effp->priv;
+ --argc, ++argv;
+
+ c->band_buf1 = c->band_buf2 = c->band_buf3 = 0;
+ c->band_buf_len = 0;
+
+ /* how many bands? */
+ if (! (argc&1)) {
+ lsx_fail("mcompand accepts only an odd number of arguments:\argc"
+ " mcompand quoted_compand_args [crossover_freq quoted_compand_args [...]]");
+ return SOX_EOF;
+ }
+ c->nBands = (argc+1)>>1;
+
+ c->bands = lsx_calloc(c->nBands, sizeof(comp_band_t));
+
+ for (i=0;i<c->nBands;++i) {
+ c->arg = lsx_strdup(argv[i<<1]);
+ if (parse_subarg(c->arg,subargv,&subargc) != SOX_SUCCESS)
+ return SOX_EOF;
+ if (sox_mcompand_getopts_1(&c->bands[i], subargc, &subargv[0]) != SOX_SUCCESS)
+ return SOX_EOF;
+ free(c->arg);
+ c->arg = NULL;
+ if (i == (c->nBands-1))
+ c->bands[i].topfreq = 0;
+ else {
+ c->bands[i].topfreq = lsx_parse_frequency(argv[(i<<1)+1],&cp);
+ if (*cp) {
+ lsx_fail("bad frequency in args to mcompand");
+ return SOX_EOF;
+ }
+ if ((i>0) && (c->bands[i].topfreq < c->bands[i-1].topfreq)) {
+ lsx_fail("mcompand crossover frequencies must be in ascending order.");
+ return SOX_EOF;
+ }
+ }
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Prepare processing.
+ * Do all initializations.
+ */
+static int start(sox_effect_t * effp)
+{
+ priv_t * c = (priv_t *) effp->priv;
+ comp_band_t * l;
+ size_t i;
+ size_t band;
+
+ for (band=0;band<c->nBands;++band) {
+ l = &c->bands[band];
+ l->delay_size = c->bands[band].delay * effp->out_signal.rate * effp->out_signal.channels;
+ if (l->delay_size > c->delay_buf_size)
+ c->delay_buf_size = l->delay_size;
+ }
+
+ for (band=0;band<c->nBands;++band) {
+ l = &c->bands[band];
+ /* Convert attack and decay rates using number of samples */
+
+ for (i = 0; i < l->expectedChannels; ++i) {
+ if (l->attackRate[i] > 1.0/effp->out_signal.rate)
+ l->attackRate[i] = 1.0 -
+ exp(-1.0/(effp->out_signal.rate * l->attackRate[i]));
+ else
+ l->attackRate[i] = 1.0;
+ if (l->decayRate[i] > 1.0/effp->out_signal.rate)
+ l->decayRate[i] = 1.0 -
+ exp(-1.0/(effp->out_signal.rate * l->decayRate[i]));
+ else
+ l->decayRate[i] = 1.0;
+ }
+
+ /* Allocate the delay buffer */
+ if (c->delay_buf_size > 0)
+ l->delay_buf = lsx_calloc(sizeof(long), c->delay_buf_size);
+ l->delay_buf_ptr = 0;
+ l->delay_buf_cnt = 0;
+
+ if (l->topfreq != 0)
+ crossover_setup(effp, &l->filter, l->topfreq);
+ }
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Update a volume value using the given sample
+ * value, the attack rate and decay rate
+ */
+
+static void doVolume(double *v, double samp, comp_band_t * l, size_t chan)
+{
+ double s = samp/(~((sox_sample_t)1<<31));
+ double delta = s - *v;
+
+ if (delta > 0.0) /* increase volume according to attack rate */
+ *v += delta * l->attackRate[chan];
+ else /* reduce volume according to decay rate */
+ *v += delta * l->decayRate[chan];
+}
+
+static int sox_mcompand_flow_1(sox_effect_t * effp, priv_t * c, comp_band_t * l, const sox_sample_t *ibuf, sox_sample_t *obuf, size_t len, size_t filechans)
+{
+ size_t idone, odone;
+
+ for (idone = 0, odone = 0; idone < len; ibuf += filechans) {
+ size_t chan;
+
+ /* Maintain the volume fields by simulating a leaky pump circuit */
+
+ if (l->expectedChannels == 1 && filechans > 1) {
+ /* User is expecting same compander for all channels */
+ double maxsamp = 0.0;
+ for (chan = 0; chan < filechans; ++chan) {
+ double rect = fabs((double)ibuf[chan]);
+ if (rect > maxsamp)
+ maxsamp = rect;
+ }
+ doVolume(&l->volume[0], maxsamp, l, (size_t) 0);
+ } else {
+ for (chan = 0; chan < filechans; ++chan)
+ doVolume(&l->volume[chan], fabs((double)ibuf[chan]), l, chan);
+ }
+
+ /* Volume memory is updated: perform compand */
+ for (chan = 0; chan < filechans; ++chan) {
+ int ch = l->expectedChannels > 1 ? chan : 0;
+ double level_in_lin = l->volume[ch];
+ double level_out_lin = lsx_compandt(&l->transfer_fn, level_in_lin);
+ double checkbuf;
+
+ if (c->delay_buf_size <= 0) {
+ checkbuf = ibuf[chan] * level_out_lin;
+ SOX_SAMPLE_CLIP_COUNT(checkbuf, effp->clips);
+ obuf[odone++] = checkbuf;
+ idone++;
+ } else {
+ /* FIXME: note that this lookahead algorithm is really lame:
+ the response to a peak is released before the peak
+ arrives. */
+
+ /* because volume application delays differ band to band, but
+ total delay doesn't, the volume is applied in an iteration
+ preceding that in which the sample goes to obuf, except in
+ the band(s) with the longest vol app delay.
+
+ the offset between delay_buf_ptr and the sample to apply
+ vol to, is a constant equal to the difference between this
+ band's delay and the longest delay of all the bands. */
+
+ if (l->delay_buf_cnt >= l->delay_size) {
+ checkbuf = l->delay_buf[(l->delay_buf_ptr + c->delay_buf_size - l->delay_size)%c->delay_buf_size] * level_out_lin;
+ SOX_SAMPLE_CLIP_COUNT(checkbuf, effp->clips);
+ l->delay_buf[(l->delay_buf_ptr + c->delay_buf_size - l->delay_size)%c->delay_buf_size] = checkbuf;
+ }
+ if (l->delay_buf_cnt >= c->delay_buf_size) {
+ obuf[odone] = l->delay_buf[l->delay_buf_ptr];
+ odone++;
+ idone++;
+ } else {
+ l->delay_buf_cnt++;
+ idone++; /* no "odone++" because we did not fill obuf[...] */
+ }
+ l->delay_buf[l->delay_buf_ptr++] = ibuf[chan];
+ l->delay_buf_ptr %= c->delay_buf_size;
+ }
+ }
+ }
+
+ if (idone != odone || idone != len) {
+ /* Emergency brake - will lead to memory corruption otherwise since we
+ cannot report back to flow() how many samples were consumed/emitted.
+ Additionally, flow() doesn't know how to handle diverging
+ sub-compander delays. */
+ lsx_fail("Using a compander delay within mcompand is currently not supported");
+ exit(1);
+ /* FIXME */
+ }
+
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Processed signed long samples from ibuf to obuf.
+ * Return number of samples processed.
+ */
+static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp) {
+ priv_t * c = (priv_t *) effp->priv;
+ comp_band_t * l;
+ size_t len = min(*isamp, *osamp);
+ size_t band, i;
+ sox_sample_t *abuf, *bbuf, *cbuf, *oldabuf, *ibuf_copy;
+ double out;
+
+ if (c->band_buf_len < len) {
+ c->band_buf1 = lsx_realloc(c->band_buf1,len*sizeof(sox_sample_t));
+ c->band_buf2 = lsx_realloc(c->band_buf2,len*sizeof(sox_sample_t));
+ c->band_buf3 = lsx_realloc(c->band_buf3,len*sizeof(sox_sample_t));
+ c->band_buf_len = len;
+ }
+
+ len -= len % effp->out_signal.channels;
+
+ ibuf_copy = lsx_malloc(*isamp * sizeof(sox_sample_t));
+ memcpy(ibuf_copy, ibuf, *isamp * sizeof(sox_sample_t));
+
+ /* split ibuf into bands using filters, pipe each band through sox_mcompand_flow_1, then add back together and write to obuf */
+
+ memset(obuf,0,len * sizeof *obuf);
+ for (band=0,abuf=ibuf_copy,bbuf=c->band_buf2,cbuf=c->band_buf1;band<c->nBands;++band) {
+ l = &c->bands[band];
+
+ if (l->topfreq)
+ crossover_flow(effp, &l->filter, abuf, bbuf, cbuf, len);
+ else {
+ bbuf = abuf;
+ abuf = cbuf;
+ }
+ if (abuf == ibuf_copy)
+ abuf = c->band_buf3;
+ (void)sox_mcompand_flow_1(effp, c,l,bbuf,abuf,len, (size_t)effp->out_signal.channels);
+ for (i=0;i<len;++i)
+ {
+ out = (double)obuf[i] + (double)abuf[i];
+ SOX_SAMPLE_CLIP_COUNT(out, effp->clips);
+ obuf[i] = out;
+ }
+ oldabuf = abuf;
+ abuf = cbuf;
+ cbuf = oldabuf;
+ }
+
+ *isamp = *osamp = len;
+
+ free(ibuf_copy);
+
+ return SOX_SUCCESS;
+}
+
+static int sox_mcompand_drain_1(sox_effect_t * effp, priv_t * c, comp_band_t * l, sox_sample_t *obuf, size_t maxdrain)
+{
+ size_t done;
+ double out;
+
+ /*
+ * Drain out delay samples. Note that this loop does all channels.
+ */
+ for (done = 0; done < maxdrain && l->delay_buf_cnt > 0; done++) {
+ out = obuf[done] + l->delay_buf[l->delay_buf_ptr++];
+ SOX_SAMPLE_CLIP_COUNT(out, effp->clips);
+ obuf[done] = out;
+ l->delay_buf_ptr %= c->delay_buf_size;
+ l->delay_buf_cnt--;
+ }
+
+ /* tell caller number of samples played */
+ return done;
+
+}
+
+/*
+ * Drain out compander delay lines.
+ */
+static int drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ size_t band, drained, mostdrained = 0;
+ priv_t * c = (priv_t *)effp->priv;
+ comp_band_t * l;
+
+ *osamp -= *osamp % effp->out_signal.channels;
+
+ memset(obuf,0,*osamp * sizeof *obuf);
+ for (band=0;band<c->nBands;++band) {
+ l = &c->bands[band];
+ drained = sox_mcompand_drain_1(effp, c,l,obuf,*osamp);
+ if (drained > mostdrained)
+ mostdrained = drained;
+ }
+
+ *osamp = mostdrained;
+
+ if (mostdrained)
+ return SOX_SUCCESS;
+ else
+ return SOX_EOF;
+}
+
+/*
+ * Clean up compander effect.
+ */
+static int stop(sox_effect_t * effp)
+{
+ priv_t * c = (priv_t *) effp->priv;
+ comp_band_t * l;
+ size_t band;
+
+ free(c->band_buf1);
+ c->band_buf1 = NULL;
+ free(c->band_buf2);
+ c->band_buf2 = NULL;
+ free(c->band_buf3);
+ c->band_buf3 = NULL;
+
+ for (band = 0; band < c->nBands; band++) {
+ l = &c->bands[band];
+ free(l->delay_buf);
+ if (l->topfreq != 0)
+ free(l->filter.previous);
+ }
+
+ return SOX_SUCCESS;
+}
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * c = (priv_t *) effp->priv;
+ comp_band_t * l;
+ size_t band;
+
+ for (band = 0; band < c->nBands; band++) {
+ l = &c->bands[band];
+ lsx_compandt_kill(&l->transfer_fn);
+ free(l->decayRate);
+ free(l->attackRate);
+ free(l->volume);
+ }
+ free(c->arg);
+ free(c->bands);
+ c->bands = NULL;
+
+ return SOX_SUCCESS;
+}
+
+const sox_effect_handler_t *lsx_mcompand_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "mcompand",
+ "quoted_compand_args [crossover_frequency[k] quoted_compand_args [...]]\n"
+ "\n"
+ "quoted_compand_args are as for the compand effect:\n"
+ "\n"
+ " attack1,decay1[,attack2,decay2...]\n"
+ " in-dB1,out-dB1[,in-dB2,out-dB2...]\n"
+ " [ gain [ initial-volume [ delay ] ] ]",
+ SOX_EFF_MCHAN | SOX_EFF_GAIN,
+ getopts, start, flow, drain, stop, lsx_kill, sizeof(priv_t)
+ };
+
+ return &handler;
+}
diff --git a/src/src/mcompand_xover.h b/src/src/mcompand_xover.h
new file mode 100644
index 0000000..cc2889e
--- /dev/null
+++ b/src/src/mcompand_xover.h
@@ -0,0 +1,106 @@
+/* libSoX Compander Crossover Filter (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define N 4 /* 4th order Linkwitz-Riley IIRs */
+#define CONVOLVE _ _ _ _
+
+typedef struct {double in, out_low, out_high;} previous_t[N * 2];
+
+typedef struct {
+ previous_t * previous;
+ size_t pos;
+ double coefs[3 *(N+1)];
+} crossover_t;
+
+static void square_quadratic(char const * name, double const * x, double * y)
+{
+ assert(N == 4);
+ y[0] = x[0] * x[0];
+ y[1] = 2 * x[0] * x[1];
+ y[2] = 2 * x[0] * x[2] + x[1] * x[1];
+ y[3] = 2 * x[1] * x[2];
+ y[4] = x[2] * x[2];
+ lsx_debug("%s=[%.16g %.16g %.16g %.16g %.16g];", name,
+ y[0], y[1], y[2], y[3], y[4]);
+}
+
+static int crossover_setup(sox_effect_t * effp, crossover_t * p, double frequency)
+{
+ double w0 = 2 * M_PI * frequency / effp->in_signal.rate;
+ double Q = sqrt(.5), alpha = sin(w0)/(2*Q);
+ double x[9], norm;
+ int i;
+
+ if (w0 > M_PI) {
+ lsx_fail("frequency must not exceed half the sample-rate (Nyquist rate)");
+ return SOX_EOF;
+ }
+ x[0] = (1 - cos(w0))/2; /* Cf. filter_LPF in biquads.c */
+ x[1] = 1 - cos(w0);
+ x[2] = (1 - cos(w0))/2;
+ x[3] = (1 + cos(w0))/2; /* Cf. filter_HPF in biquads.c */
+ x[4] = -(1 + cos(w0));
+ x[5] = (1 + cos(w0))/2;
+ x[6] = 1 + alpha;
+ x[7] = -2*cos(w0);
+ x[8] = 1 - alpha;
+ for (norm = x[6], i = 0; i < 9; ++i) x[i] /= norm;
+ square_quadratic("lb", x , p->coefs);
+ square_quadratic("hb", x + 3, p->coefs + 5);
+ square_quadratic("a" , x + 6, p->coefs + 10);
+
+ p->previous = lsx_calloc(effp->in_signal.channels, sizeof(*p->previous));
+ return SOX_SUCCESS;
+}
+
+static int crossover_flow(sox_effect_t * effp, crossover_t * p, sox_sample_t
+ *ibuf, sox_sample_t *obuf_low, sox_sample_t *obuf_high, size_t len0)
+{
+ double out_low, out_high;
+ size_t c, len = len0 / effp->in_signal.channels;
+ assert(len * effp->in_signal.channels == len0);
+
+ while (len--) {
+ p->pos = p->pos? p->pos - 1 : N - 1;
+ for (c = 0; c < effp->in_signal.channels; ++c) {
+#define _ out_low += p->coefs[j] * p->previous[c][p->pos + j].in \
+ - p->coefs[2*N+2 + j] * p->previous[c][p->pos + j].out_low, ++j;
+ {
+ int j = 1;
+ out_low = p->coefs[0] * *ibuf;
+ CONVOLVE
+ assert(j == N+1);
+ *obuf_low++ = SOX_ROUND_CLIP_COUNT(out_low, effp->clips);
+ }
+#undef _
+#define _ out_high += p->coefs[j+N+1] * p->previous[c][p->pos + j].in \
+ - p->coefs[2*N+2 + j] * p->previous[c][p->pos + j].out_high, ++j;
+ {
+ int j = 1;
+ out_high = p->coefs[N+1] * *ibuf;
+ CONVOLVE
+ assert(j == N+1);
+ *obuf_high++ = SOX_ROUND_CLIP_COUNT(out_high, effp->clips);
+ }
+ p->previous[c][p->pos + N].in = p->previous[c][p->pos].in = *ibuf++;
+ p->previous[c][p->pos + N].out_low = p->previous[c][p->pos].out_low = out_low;
+ p->previous[c][p->pos + N].out_high = p->previous[c][p->pos].out_high = out_high;
+ }
+ }
+ return SOX_SUCCESS;
+}
+
diff --git a/src/src/monkey.wav b/src/src/monkey.wav
new file mode 100644
index 0000000..5ce4b2a
--- /dev/null
+++ b/src/src/monkey.wav
Binary files differ
diff --git a/src/src/mp3-util.h b/src/src/mp3-util.h
new file mode 100644
index 0000000..99d35fa
--- /dev/null
+++ b/src/src/mp3-util.h
@@ -0,0 +1,350 @@
+/* libSoX MP3 utilities Copyright (c) 2007-9 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <sys/stat.h>
+
+#ifdef USING_ID3TAG
+
+static char const * id3tagmap[][2] =
+{
+ {"TIT2", "Title"},
+ {"TPE1", "Artist"},
+ {"TALB", "Album"},
+ {"TRCK", "Tracknumber"},
+ {"TDRC", "Year"},
+ {"TCON", "Genre"},
+ {"COMM", "Comment"},
+ {"TPOS", "Discnumber"},
+ {NULL, NULL}
+};
+
+#endif /* USING_ID3TAG */
+
+#if defined(HAVE_LAME)
+
+static void write_comments(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ const char* comment;
+
+ p->id3tag_init(p->gfp);
+ p->id3tag_set_pad(p->gfp, (size_t)ID3PADDING);
+
+ /* Note: id3tag_set_fieldvalue is not present in LAME 3.97, so we're using
+ the 3.97-compatible methods for all of the tags that 3.97 supported. */
+ /* FIXME: This is no more necessary, since support for LAME 3.97 has ended. */
+ if ((comment = sox_find_comment(ft->oob.comments, "Title")))
+ p->id3tag_set_title(p->gfp, comment);
+ if ((comment = sox_find_comment(ft->oob.comments, "Artist")))
+ p->id3tag_set_artist(p->gfp, comment);
+ if ((comment = sox_find_comment(ft->oob.comments, "Album")))
+ p->id3tag_set_album(p->gfp, comment);
+ if ((comment = sox_find_comment(ft->oob.comments, "Tracknumber")))
+ p->id3tag_set_track(p->gfp, comment);
+ if ((comment = sox_find_comment(ft->oob.comments, "Year")))
+ p->id3tag_set_year(p->gfp, comment);
+ if ((comment = sox_find_comment(ft->oob.comments, "Comment")))
+ p->id3tag_set_comment(p->gfp, comment);
+ if ((comment = sox_find_comment(ft->oob.comments, "Genre")))
+ {
+ if (p->id3tag_set_genre(p->gfp, comment))
+ lsx_warn("\"%s\" is not a recognized ID3v1 genre.", comment);
+ }
+
+ if ((comment = sox_find_comment(ft->oob.comments, "Discnumber")))
+ {
+ char* id3tag_buf = lsx_malloc(strlen(comment) + 6);
+ if (id3tag_buf)
+ {
+ sprintf(id3tag_buf, "TPOS=%s", comment);
+ p->id3tag_set_fieldvalue(p->gfp, id3tag_buf);
+ free(id3tag_buf);
+ }
+ }
+}
+
+#endif /* HAVE_LAME */
+
+#ifdef USING_ID3TAG
+
+static id3_utf8_t * utf8_id3tag_findframe(
+ struct id3_tag * tag, const char * const frameid, unsigned index)
+{
+ struct id3_frame const * frame = id3_tag_findframe(tag, frameid, index);
+ if (frame) {
+ union id3_field const * field = id3_frame_field(frame, 1);
+ unsigned nstrings = id3_field_getnstrings(field);
+ while (nstrings--){
+ id3_ucs4_t const * ucs4 = id3_field_getstrings(field, nstrings);
+ if (ucs4)
+ return id3_ucs4_utf8duplicate(ucs4); /* Must call free() on this */
+ }
+ }
+ return NULL;
+}
+
+struct tag_info_node
+{
+ struct tag_info_node * next;
+ off_t start;
+ off_t end;
+};
+
+struct tag_info {
+ sox_format_t * ft;
+ struct tag_info_node * head;
+ struct id3_tag * tag;
+};
+
+static int add_tag(struct tag_info * info)
+{
+ struct tag_info_node * current;
+ off_t start, end;
+ id3_byte_t query[ID3_TAG_QUERYSIZE];
+ id3_byte_t * buffer;
+ long size;
+ int result = 0;
+
+ /* Ensure we're at the start of a valid tag and get its size. */
+ if (ID3_TAG_QUERYSIZE != lsx_readbuf(info->ft, query, ID3_TAG_QUERYSIZE) ||
+ !(size = id3_tag_query(query, ID3_TAG_QUERYSIZE))) {
+ return 0;
+ }
+ if (size < 0) {
+ if (0 != lsx_seeki(info->ft, size, SEEK_CUR) ||
+ ID3_TAG_QUERYSIZE != lsx_readbuf(info->ft, query, ID3_TAG_QUERYSIZE) ||
+ (size = id3_tag_query(query, ID3_TAG_QUERYSIZE)) <= 0) {
+ return 0;
+ }
+ }
+
+ /* Don't read a tag more than once. */
+ start = lsx_tell(info->ft);
+ end = start + size;
+ for (current = info->head; current; current = current->next) {
+ if (start == current->start && end == current->end) {
+ return 1;
+ } else if (start < current->end && current->start < end) {
+ return 0;
+ }
+ }
+
+ buffer = lsx_malloc((size_t)size);
+ if (!buffer) {
+ return 0;
+ }
+ memcpy(buffer, query, ID3_TAG_QUERYSIZE);
+ if ((unsigned long)size - ID3_TAG_QUERYSIZE ==
+ lsx_readbuf(info->ft, buffer + ID3_TAG_QUERYSIZE, (size_t)size - ID3_TAG_QUERYSIZE)) {
+ struct id3_tag * tag = id3_tag_parse(buffer, (size_t)size);
+ if (tag) {
+ current = lsx_malloc(sizeof(struct tag_info_node));
+ if (current) {
+ current->next = info->head;
+ current->start = start;
+ current->end = end;
+ info->head = current;
+ if (info->tag && (info->tag->extendedflags & ID3_TAG_EXTENDEDFLAG_TAGISANUPDATE)) {
+ struct id3_frame * frame;
+ unsigned i;
+ for (i = 0; (frame = id3_tag_findframe(tag, NULL, i)); i++) {
+ id3_tag_attachframe(info->tag, frame);
+ }
+ id3_tag_delete(tag);
+ } else {
+ if (info->tag) {
+ id3_tag_delete(info->tag);
+ }
+ info->tag = tag;
+ }
+ }
+ }
+ }
+ free(buffer);
+ return result;
+}
+
+static void read_comments(sox_format_t * ft)
+{
+ struct tag_info info;
+ id3_utf8_t * utf8;
+ int i;
+ int has_id3v1 = 0;
+
+ info.ft = ft;
+ info.head = NULL;
+ info.tag = NULL;
+
+ /*
+ We look for:
+ ID3v1 at end (EOF - 128).
+ ID3v2 at start.
+ ID3v2 at end (but before ID3v1 from end if there was one).
+ */
+
+ if (0 == lsx_seeki(ft, -128, SEEK_END)) {
+ has_id3v1 =
+ add_tag(&info) &&
+ 1 == ID3_TAG_VERSION_MAJOR(id3_tag_version(info.tag));
+ }
+ if (0 == lsx_seeki(ft, 0, SEEK_SET)) {
+ add_tag(&info);
+ }
+ if (0 == lsx_seeki(ft, has_id3v1 ? -138 : -10, SEEK_END)) {
+ add_tag(&info);
+ }
+ if (info.tag && info.tag->frames) {
+ for (i = 0; id3tagmap[i][0]; ++i) {
+ if ((utf8 = utf8_id3tag_findframe(info.tag, id3tagmap[i][0], 0))) {
+ char * comment = lsx_malloc(strlen(id3tagmap[i][1]) + 1 + strlen((char *)utf8) + 1);
+ sprintf(comment, "%s=%s", id3tagmap[i][1], utf8);
+ sox_append_comment(&ft->oob.comments, comment);
+ free(comment);
+ free(utf8);
+ }
+ }
+ if ((utf8 = utf8_id3tag_findframe(info.tag, "TLEN", 0))) {
+ unsigned long tlen = strtoul((char *)utf8, NULL, 10);
+ if (tlen > 0 && tlen < ULONG_MAX) {
+ ft->signal.length= tlen; /* In ms; convert to samples later */
+ lsx_debug("got exact duration from ID3 TLEN");
+ }
+ free(utf8);
+ }
+ }
+ while (info.head) {
+ struct tag_info_node * head = info.head;
+ info.head = head->next;
+ free(head);
+ }
+ if (info.tag) {
+ id3_tag_delete(info.tag);
+ }
+}
+
+#endif /* USING_ID3TAG */
+
+#ifdef HAVE_MAD_H
+
+static unsigned long xing_frames(priv_t * p, struct mad_bitptr ptr, unsigned bitlen)
+{
+ #define XING_MAGIC ( ('X' << 24) | ('i' << 16) | ('n' << 8) | 'g' )
+ if (bitlen >= 96 && p->mad_bit_read(&ptr, 32) == XING_MAGIC &&
+ (p->mad_bit_read(&ptr, 32) & 1 )) /* XING_FRAMES */
+ return p->mad_bit_read(&ptr, 32);
+ return 0;
+}
+
+static void mad_timer_mult(mad_timer_t * t, double d)
+{
+ t->seconds = (signed long)(d *= (t->seconds + t->fraction * (1. / MAD_TIMER_RESOLUTION)));
+ t->fraction = (unsigned long)((d - t->seconds) * MAD_TIMER_RESOLUTION + .5);
+}
+
+static size_t mp3_duration_ms(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *) ft->priv;
+ struct mad_stream mad_stream;
+ struct mad_header mad_header;
+ struct mad_frame mad_frame;
+ mad_timer_t time = mad_timer_zero;
+ size_t initial_bitrate = 0; /* Initialised to prevent warning */
+ size_t tagsize = 0, consumed = 0, frames = 0;
+ sox_bool vbr = sox_false, depadded = sox_false;
+
+ p->mad_stream_init(&mad_stream);
+ p->mad_header_init(&mad_header);
+ p->mad_frame_init(&mad_frame);
+
+ do { /* Read data from the MP3 file */
+ int read, padding = 0;
+ size_t leftover = mad_stream.bufend - mad_stream.next_frame;
+
+ memmove(p->mp3_buffer, mad_stream.this_frame, leftover);
+ read = lsx_readbuf(ft, p->mp3_buffer + leftover, p->mp3_buffer_size - leftover);
+ if (read <= 0) {
+ lsx_debug("got exact duration by scan to EOF (frames=%" PRIuPTR " leftover=%" PRIuPTR ")", frames, leftover);
+ break;
+ }
+ for (; !depadded && padding < read && !p->mp3_buffer[padding]; ++padding);
+ depadded = sox_true;
+ p->mad_stream_buffer(&mad_stream, p->mp3_buffer + padding, leftover + read - padding);
+
+ while (sox_true) { /* Decode frame headers */
+ mad_stream.error = MAD_ERROR_NONE;
+ if (p->mad_header_decode(&mad_header, &mad_stream) == -1) {
+ if (mad_stream.error == MAD_ERROR_BUFLEN)
+ break; /* Normal behaviour; get some more data from the file */
+ if (!MAD_RECOVERABLE(mad_stream.error)) {
+ lsx_warn("unrecoverable MAD error");
+ break;
+ }
+ if (mad_stream.error == MAD_ERROR_LOSTSYNC) {
+ unsigned available = (mad_stream.bufend - mad_stream.this_frame);
+ tagsize = tagtype(mad_stream.this_frame, (size_t) available);
+ if (tagsize) { /* It's some ID3 tags, so just skip */
+ if (tagsize >= available) {
+ lsx_seeki(ft, (off_t)(tagsize - available), SEEK_CUR);
+ depadded = sox_false;
+ }
+ p->mad_stream_skip(&mad_stream, min(tagsize, available));
+ }
+ else lsx_warn("MAD lost sync");
+ }
+ else lsx_warn("recoverable MAD error");
+ continue; /* Not an audio frame */
+ }
+
+ p->mad_timer_add(&time, mad_header.duration);
+ consumed += mad_stream.next_frame - mad_stream.this_frame;
+
+ lsx_debug_more("bitrate=%lu", mad_header.bitrate);
+ if (!frames) {
+ initial_bitrate = mad_header.bitrate;
+
+ /* Get the precise frame count from the XING header if present */
+ mad_frame.header = mad_header;
+ if (p->mad_frame_decode(&mad_frame, &mad_stream) == -1)
+ if (!MAD_RECOVERABLE(mad_stream.error)) {
+ lsx_warn("unrecoverable MAD error");
+ break;
+ }
+ if ((frames = xing_frames(p, mad_stream.anc_ptr, mad_stream.anc_bitlen))) {
+ p->mad_timer_multiply(&time, (signed long)frames);
+ lsx_debug("got exact duration from XING frame count (%" PRIuPTR ")", frames);
+ break;
+ }
+ }
+ else vbr |= mad_header.bitrate != initial_bitrate;
+
+ /* If not VBR, we can time just a few frames then extrapolate */
+ if (++frames == 25 && !vbr) {
+ mad_timer_mult(&time, (double)(lsx_filelength(ft) - tagsize) / consumed);
+ lsx_debug("got approx. duration by CBR extrapolation");
+ break;
+ }
+ }
+ } while (mad_stream.error == MAD_ERROR_BUFLEN);
+
+ p->mad_frame_finish(&mad_frame);
+ mad_header_finish(&mad_header);
+ p->mad_stream_finish(&mad_stream);
+ lsx_rewind(ft);
+ return p->mad_timer_count(time, MAD_UNITS_MILLISECONDS);
+}
+
+#endif /* HAVE_MAD_H */
diff --git a/src/src/mp3.c b/src/src/mp3.c
new file mode 100644
index 0000000..af2504c
--- /dev/null
+++ b/src/src/mp3.c
@@ -0,0 +1,1299 @@
+/* MP3 support for SoX
+ *
+ * Uses libmad for MP3 decoding
+ * libmp3lame for MP3 encoding
+ * and libtwolame for MP2 encoding
+ *
+ * Written by Fabrizio Gennari <fabrizio.ge@tiscali.it>
+ *
+ * The decoding part is based on the decoder-tutorial program madlld
+ * written by Bertrand Petit <madlld@phoe.fmug.org>,
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+#if defined(HAVE_LAME_LAME_H) || defined(HAVE_LAME_H) || defined(DL_LAME)
+#define HAVE_LAME 1
+#endif
+
+#if defined(HAVE_TWOLAME_H) || defined(DL_TWOLAME)
+ #define HAVE_TWOLAME 1
+#endif
+
+#if defined(HAVE_MAD_H) || defined(HAVE_LAME) || defined(HAVE_TWOLAME)
+
+#ifdef HAVE_MAD_H
+#include "third_party/libmad/mad.h"
+#endif
+
+#if defined(HAVE_LAME_LAME_H)
+#include <lame/lame.h>
+#elif defined(HAVE_LAME_H)
+#include <lame.h>
+#elif defined(DL_LAME)
+typedef struct lame_global_struct lame_global_flags;
+typedef enum {
+ vbr_off=0,
+ vbr_default=4
+} vbr_mode;
+#endif
+
+#if defined(HAVE_ID3TAG) && (defined(HAVE_IO_H) || defined(HAVE_UNISTD_H))
+#define USING_ID3TAG 1
+#endif
+
+#ifdef USING_ID3TAG
+ #include <id3tag.h>
+#if defined(HAVE_UNISTD_H)
+ #include <unistd.h>
+#elif defined(HAVE_IO_H)
+ #include <io.h>
+#endif
+#else
+ #define ID3_TAG_FLAG_FOOTERPRESENT 0x10
+#endif
+
+#ifdef HAVE_TWOLAME_H
+ #include <twolame.h>
+#endif
+
+#ifndef HAVE_LIBLTDL
+ #undef DL_LAME
+ #undef DL_MAD
+#endif
+
+/* Under Windows, importing data from DLLs is a dicey proposition. This is true
+ * when using dlopen, but also true if linking directly against the DLL if the
+ * header does not mark the data as __declspec(dllexport), which mad.h does not.
+ * Sidestep the issue by defining our own mad_timer_zero. This is needed because
+ * mad_timer_zero is used in some of the mad.h macros.
+ */
+#ifdef HAVE_MAD_H
+#define mad_timer_zero mad_timer_zero_stub
+static mad_timer_t const mad_timer_zero_stub = {0, 0};
+#endif
+
+#define MAXFRAMESIZE 2880
+#define ID3PADDING 128
+
+/* LAME takes float values as input. */
+#define MP3_LAME_PRECISION 24
+
+/* MAD returns values with MAD_F_FRACBITS (28) bits of precision, though it's
+ not certain that all of them are meaningful. Default to 16 bits to
+ align with most users expectation of output file should be 16 bits. */
+#define MP3_MAD_PRECISION 16
+
+static const char* const mad_library_names[] =
+{
+#ifdef DL_MAD
+ "libmad",
+ "libmad-0",
+ "cygmad-0",
+#endif
+ NULL
+};
+
+#ifdef DL_MAD
+ #define MAD_FUNC LSX_DLENTRY_DYNAMIC
+#else
+ #define MAD_FUNC LSX_DLENTRY_STATIC
+#endif
+
+#define MAD_FUNC_ENTRIES(f,x) \
+ MAD_FUNC(f,x, void, mad_stream_buffer, (struct mad_stream *, unsigned char const *, unsigned long)) \
+ MAD_FUNC(f,x, void, mad_stream_skip, (struct mad_stream *, unsigned long)) \
+ MAD_FUNC(f,x, int, mad_stream_sync, (struct mad_stream *)) \
+ MAD_FUNC(f,x, void, mad_stream_init, (struct mad_stream *)) \
+ MAD_FUNC(f,x, void, mad_frame_init, (struct mad_frame *)) \
+ MAD_FUNC(f,x, void, mad_synth_init, (struct mad_synth *)) \
+ MAD_FUNC(f,x, int, mad_frame_decode, (struct mad_frame *, struct mad_stream *)) \
+ MAD_FUNC(f,x, void, mad_timer_add, (mad_timer_t *, mad_timer_t)) \
+ MAD_FUNC(f,x, void, mad_synth_frame, (struct mad_synth *, struct mad_frame const *)) \
+ MAD_FUNC(f,x, char const *, mad_stream_errorstr, (struct mad_stream const *)) \
+ MAD_FUNC(f,x, void, mad_frame_finish, (struct mad_frame *)) \
+ MAD_FUNC(f,x, void, mad_stream_finish, (struct mad_stream *)) \
+ MAD_FUNC(f,x, unsigned long, mad_bit_read, (struct mad_bitptr *, unsigned int)) \
+ MAD_FUNC(f,x, int, mad_header_decode, (struct mad_header *, struct mad_stream *)) \
+ MAD_FUNC(f,x, void, mad_header_init, (struct mad_header *)) \
+ MAD_FUNC(f,x, signed long, mad_timer_count, (mad_timer_t, enum mad_units)) \
+ MAD_FUNC(f,x, void, mad_timer_multiply, (mad_timer_t *, signed long))
+
+static const char* const lame_library_names[] =
+{
+#ifdef DL_LAME
+ "libmp3lame",
+ "libmp3lame-0",
+ "lame-enc",
+ "cygmp3lame-0",
+#endif
+ NULL
+};
+
+#ifdef DL_LAME
+
+ /* Expected to be present in all builds of LAME. */
+ #define LAME_FUNC LSX_DLENTRY_DYNAMIC
+
+ /* id3tag support is an optional component of LAME. Use if available. */
+ #define LAME_FUNC_ID3 LSX_DLENTRY_STUB
+
+#else /* DL_LAME */
+
+ /* Expected to be present in all builds of LAME. */
+ #define LAME_FUNC LSX_DLENTRY_STATIC
+
+ /* id3tag support is an optional component of LAME. Use if available. */
+ #ifdef HAVE_LAME_ID3TAG
+ #define LAME_FUNC_ID3 LSX_DLENTRY_STATIC
+ #else
+ #define LAME_FUNC_ID3 LSX_DLENTRY_STUB
+ #endif
+
+#endif /* DL_LAME */
+
+#define LAME_FUNC_ENTRIES(f,x) \
+ LAME_FUNC(f,x, lame_global_flags*, lame_init, (void)) \
+ LAME_FUNC(f,x, int, lame_set_errorf, (lame_global_flags *, void (*)(const char *, va_list))) \
+ LAME_FUNC(f,x, int, lame_set_debugf, (lame_global_flags *, void (*)(const char *, va_list))) \
+ LAME_FUNC(f,x, int, lame_set_msgf, (lame_global_flags *, void (*)(const char *, va_list))) \
+ LAME_FUNC(f,x, int, lame_set_num_samples, (lame_global_flags *, unsigned long)) \
+ LAME_FUNC(f,x, int, lame_get_num_channels, (const lame_global_flags *)) \
+ LAME_FUNC(f,x, int, lame_set_num_channels, (lame_global_flags *, int)) \
+ LAME_FUNC(f,x, int, lame_set_in_samplerate, (lame_global_flags *, int)) \
+ LAME_FUNC(f,x, int, lame_set_out_samplerate, (lame_global_flags *, int)) \
+ LAME_FUNC(f,x, int, lame_set_bWriteVbrTag, (lame_global_flags *, int)) \
+ LAME_FUNC(f,x, int, lame_set_brate, (lame_global_flags *, int)) \
+ LAME_FUNC(f,x, int, lame_set_quality, (lame_global_flags *, int)) \
+ LAME_FUNC(f,x, vbr_mode, lame_get_VBR, (const lame_global_flags *)) \
+ LAME_FUNC(f,x, int, lame_set_VBR, (lame_global_flags *, vbr_mode)) \
+ LAME_FUNC(f,x, int, lame_set_VBR_q, (lame_global_flags *, int)) \
+ LAME_FUNC(f,x, int, lame_init_params, (lame_global_flags *)) \
+ LAME_FUNC(f,x, int, lame_encode_buffer_float, (lame_global_flags *, const float[], const float[], const int, unsigned char *, const int)) \
+ LAME_FUNC(f,x, int, lame_encode_flush, (lame_global_flags *, unsigned char *, int)) \
+ LAME_FUNC(f,x, int, lame_close, (lame_global_flags *)) \
+ LAME_FUNC(f,x, size_t, lame_get_lametag_frame, (const lame_global_flags *, unsigned char*, size_t)) \
+ LAME_FUNC_ID3(f,x, void, id3tag_init, (lame_global_flags *)) \
+ LAME_FUNC_ID3(f,x, void, id3tag_set_title, (lame_global_flags *, const char* title)) \
+ LAME_FUNC_ID3(f,x, void, id3tag_set_artist, (lame_global_flags *, const char* artist)) \
+ LAME_FUNC_ID3(f,x, void, id3tag_set_album, (lame_global_flags *, const char* album)) \
+ LAME_FUNC_ID3(f,x, void, id3tag_set_year, (lame_global_flags *, const char* year)) \
+ LAME_FUNC_ID3(f,x, void, id3tag_set_comment, (lame_global_flags *, const char* comment)) \
+ LAME_FUNC_ID3(f,x, int, id3tag_set_track, (lame_global_flags *, const char* track)) \
+ LAME_FUNC_ID3(f,x, int, id3tag_set_genre, (lame_global_flags *, const char* genre)) \
+ LAME_FUNC_ID3(f,x, size_t, id3tag_set_pad, (lame_global_flags *, size_t)) \
+ LAME_FUNC_ID3(f,x, size_t, lame_get_id3v2_tag, (lame_global_flags *, unsigned char*, size_t)) \
+ LAME_FUNC_ID3(f,x, int, id3tag_set_fieldvalue, (lame_global_flags *, const char *))
+
+static const char* const twolame_library_names[] =
+{
+#ifdef DL_TWOLAME
+ "libtwolame",
+ "libtwolame-0",
+#endif
+ NULL
+};
+
+#ifdef DL_TWOLAME
+ #define TWOLAME_FUNC LSX_DLENTRY_DYNAMIC
+#else
+ #define TWOLAME_FUNC LSX_DLENTRY_STATIC
+#endif
+
+#define TWOLAME_FUNC_ENTRIES(f,x) \
+ TWOLAME_FUNC(f,x, twolame_options*, twolame_init, (void)) \
+ TWOLAME_FUNC(f,x, int, twolame_get_num_channels, (twolame_options*)) \
+ TWOLAME_FUNC(f,x, int, twolame_set_num_channels, (twolame_options*, int)) \
+ TWOLAME_FUNC(f,x, int, twolame_set_in_samplerate, (twolame_options *, int)) \
+ TWOLAME_FUNC(f,x, int, twolame_set_out_samplerate, (twolame_options *, int)) \
+ TWOLAME_FUNC(f,x, int, twolame_set_brate, (twolame_options *, int)) \
+ TWOLAME_FUNC(f,x, int, twolame_init_params, (twolame_options *)) \
+ TWOLAME_FUNC(f,x, int, twolame_encode_buffer_float32_interleaved, (twolame_options *, const float [], int, unsigned char *, int)) \
+ TWOLAME_FUNC(f,x, int, twolame_encode_flush, (twolame_options *, unsigned char *, int)) \
+ TWOLAME_FUNC(f,x, void, twolame_close, (twolame_options **))
+
+/* Private data */
+typedef struct mp3_priv_t {
+ unsigned char *mp3_buffer;
+ size_t mp3_buffer_size;
+
+#ifdef HAVE_MAD_H
+ struct mad_stream Stream;
+ struct mad_frame Frame;
+ struct mad_synth Synth;
+ mad_timer_t Timer;
+ ptrdiff_t cursamp;
+ size_t FrameCount;
+ LSX_DLENTRIES_TO_PTRS(MAD_FUNC_ENTRIES, mad_dl);
+#endif /*HAVE_MAD_H*/
+
+#if defined(HAVE_LAME) || defined(HAVE_TWOLAME)
+ float *pcm_buffer;
+ size_t pcm_buffer_size;
+ char mp2;
+#endif
+
+#ifdef HAVE_LAME
+ lame_global_flags *gfp;
+ uint64_t num_samples;
+ int vbr_tag;
+ LSX_DLENTRIES_TO_PTRS(LAME_FUNC_ENTRIES, lame_dl);
+#endif
+
+#ifdef HAVE_TWOLAME
+ twolame_options *opt;
+ LSX_DLENTRIES_TO_PTRS(TWOLAME_FUNC_ENTRIES, twolame_dl);
+#endif
+} priv_t;
+
+#ifdef HAVE_MAD_H
+
+/* This function merges the functions tagtype() and id3_tag_query()
+ from MAD's libid3tag, so we don't have to link to it
+ Returns 0 if the frame is not an ID3 tag, tag length if it is */
+
+static int tagtype(const unsigned char *data, size_t length)
+{
+ if (length >= 3 && data[0] == 'T' && data[1] == 'A' && data[2] == 'G')
+ {
+ return 128; /* ID3V1 */
+ }
+
+ if (length >= 10 &&
+ (data[0] == 'I' && data[1] == 'D' && data[2] == '3') &&
+ data[3] < 0xff && data[4] < 0xff &&
+ data[6] < 0x80 && data[7] < 0x80 && data[8] < 0x80 && data[9] < 0x80)
+ { /* ID3V2 */
+ unsigned char flags;
+ unsigned int size;
+ flags = data[5];
+ size = 10 + (data[6]<<21) + (data[7]<<14) + (data[8]<<7) + data[9];
+ if (flags & ID3_TAG_FLAG_FOOTERPRESENT)
+ size += 10;
+ for (; size < length && !data[size]; ++size); /* Consume padding */
+ return size;
+ }
+
+ return 0;
+}
+
+#endif /*HAVE_MAD_H*/
+
+#include "third_party/sox/src/src/mp3-util.h"
+
+#ifdef HAVE_MAD_H
+
+/*
+ * (Re)fill the stream buffer that is to be decoded. If any data
+ * still exists in the buffer then they are first shifted to be
+ * front of the stream buffer.
+ */
+static int sox_mp3_input(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t bytes_read;
+ size_t remaining;
+
+ remaining = p->Stream.bufend - p->Stream.next_frame;
+
+ /* libmad does not consume all the buffer it's given. Some
+ * data, part of a truncated frame, is left unused at the
+ * end of the buffer. That data must be put back at the
+ * beginning of the buffer and taken in account for
+ * refilling the buffer. This means that the input buffer
+ * must be large enough to hold a complete frame at the
+ * highest observable bit-rate (currently 448 kb/s).
+ * TODO: Is 2016 bytes the size of the largest frame?
+ * (448000*(1152/32000))/8
+ */
+ memmove(p->mp3_buffer, p->Stream.next_frame, remaining);
+
+ bytes_read = lsx_readbuf(ft, p->mp3_buffer+remaining,
+ p->mp3_buffer_size-remaining);
+ if (bytes_read == 0)
+ {
+ return SOX_EOF;
+ }
+
+ p->mad_stream_buffer(&p->Stream, p->mp3_buffer, bytes_read+remaining);
+ p->Stream.error = 0;
+
+ return SOX_SUCCESS;
+}
+
+/* Attempts to read an ID3 tag at the current location in stream and
+ * consume it all. Returns SOX_EOF if no tag is found. Its up to
+ * caller to recover.
+ * */
+static int sox_mp3_inputtag(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ int rc = SOX_EOF;
+ size_t remaining;
+ size_t tagsize;
+
+
+ /* FIXME: This needs some more work if we are to ever
+ * look at the ID3 frame. This is because the Stream
+ * may not be able to hold the complete ID3 frame.
+ * We should consume the whole frame inside tagtype()
+ * instead of outside of tagframe(). That would support
+ * recovering when Stream contains less then 8-bytes (header)
+ * and also when ID3v2 is bigger then Stream buffer size.
+ * Need to pass in stream so that buffer can be
+ * consumed as well as letting additional data to be
+ * read in.
+ */
+ remaining = p->Stream.bufend - p->Stream.next_frame;
+ if ((tagsize = tagtype(p->Stream.this_frame, remaining)))
+ {
+ p->mad_stream_skip(&p->Stream, tagsize);
+ rc = SOX_SUCCESS;
+ }
+
+ /* We know that a valid frame hasn't been found yet
+ * so help libmad out and go back into frame seek mode.
+ * This is true whether an ID3 tag was found or not.
+ */
+ p->mad_stream_sync(&p->Stream);
+
+ return rc;
+}
+
+static int startread(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t ReadSize;
+ sox_bool ignore_length = ft->signal.length == SOX_IGNORE_LENGTH;
+ int open_library_result;
+
+ LSX_DLLIBRARY_OPEN(
+ p,
+ mad_dl,
+ MAD_FUNC_ENTRIES,
+ "MAD decoder library",
+ mad_library_names,
+ open_library_result);
+ if (open_library_result)
+ return SOX_EOF;
+
+ p->mp3_buffer_size = sox_globals.bufsiz;
+ p->mp3_buffer = lsx_malloc(p->mp3_buffer_size);
+
+ ft->signal.length = SOX_UNSPEC;
+ if (ft->seekable) {
+#ifdef USING_ID3TAG
+ read_comments(ft);
+ lsx_rewind(ft);
+ if (!ft->signal.length)
+#endif
+ if (!ignore_length)
+ ft->signal.length = mp3_duration_ms(ft);
+ }
+
+ p->mad_stream_init(&p->Stream);
+ p->mad_frame_init(&p->Frame);
+ p->mad_synth_init(&p->Synth);
+ mad_timer_reset(&p->Timer);
+
+ ft->encoding.encoding = SOX_ENCODING_MP3;
+
+ /* Decode at least one valid frame to find out the input
+ * format. The decoded frame will be saved off so that it
+ * can be processed later.
+ */
+ ReadSize = lsx_readbuf(ft, p->mp3_buffer, p->mp3_buffer_size);
+ if (ReadSize != p->mp3_buffer_size && lsx_error(ft))
+ return SOX_EOF;
+
+ p->mad_stream_buffer(&p->Stream, p->mp3_buffer, ReadSize);
+
+ /* Find a valid frame before starting up. This makes sure
+ * that we have a valid MP3 and also skips past ID3v2 tags
+ * at the beginning of the audio file.
+ */
+ p->Stream.error = 0;
+ while (p->mad_frame_decode(&p->Frame,&p->Stream))
+ {
+ /* check whether input buffer needs a refill */
+ if (p->Stream.error == MAD_ERROR_BUFLEN)
+ {
+ if (sox_mp3_input(ft) == SOX_EOF)
+ return SOX_EOF;
+
+ continue;
+ }
+
+ /* Consume any ID3 tags */
+ sox_mp3_inputtag(ft);
+
+ /* FIXME: We should probably detect when we've read
+ * a bunch of non-ID3 data and still haven't found a
+ * frame. In that case we can abort early without
+ * scanning the whole file.
+ */
+ p->Stream.error = 0;
+ }
+
+ if (p->Stream.error)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"No valid MP3 frame found");
+ return SOX_EOF;
+ }
+
+ switch(p->Frame.header.mode)
+ {
+ case MAD_MODE_SINGLE_CHANNEL:
+ case MAD_MODE_DUAL_CHANNEL:
+ case MAD_MODE_JOINT_STEREO:
+ case MAD_MODE_STEREO:
+ ft->signal.channels = MAD_NCHANNELS(&p->Frame.header);
+ break;
+ default:
+ lsx_fail_errno(ft, SOX_EFMT, "Cannot determine number of channels");
+ return SOX_EOF;
+ }
+
+ p->FrameCount=1;
+
+ p->mad_timer_add(&p->Timer,p->Frame.header.duration);
+ p->mad_synth_frame(&p->Synth,&p->Frame);
+ ft->signal.precision = MP3_MAD_PRECISION;
+ ft->signal.rate=p->Synth.pcm.samplerate;
+ if (ignore_length)
+ ft->signal.length = SOX_UNSPEC;
+ else {
+ ft->signal.length = (uint64_t)(ft->signal.length * .001 * ft->signal.rate + .5);
+ ft->signal.length *= ft->signal.channels; /* Keep separate from line above! */
+ }
+
+ p->cursamp = 0;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Read up to len samples from p->Synth
+ * If needed, read some more MP3 data, decode them and synth them
+ * Place in buf[].
+ * Return number of samples read.
+ */
+static size_t sox_mp3read(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ size_t donow,i,done=0;
+ mad_fixed_t sample;
+ size_t chan;
+
+ do {
+ size_t x = (p->Synth.pcm.length - p->cursamp)*ft->signal.channels;
+ donow=min(len, x);
+ i=0;
+ while(i<donow){
+ for(chan=0;chan<ft->signal.channels;chan++){
+ sample=p->Synth.pcm.samples[chan][p->cursamp];
+ if (sample < -MAD_F_ONE)
+ sample=-MAD_F_ONE;
+ else if (sample >= MAD_F_ONE)
+ sample=MAD_F_ONE-1;
+ *buf++=(sox_sample_t)(sample<<(32-1-MAD_F_FRACBITS));
+ i++;
+ }
+ p->cursamp++;
+ };
+
+ len-=donow;
+ done+=donow;
+
+ if (len==0) break;
+
+ /* check whether input buffer needs a refill */
+ if (p->Stream.error == MAD_ERROR_BUFLEN)
+ {
+ if (sox_mp3_input(ft) == SOX_EOF) {
+ lsx_debug("sox_mp3_input EOF");
+ break;
+ }
+ }
+
+ if (p->mad_frame_decode(&p->Frame,&p->Stream))
+ {
+ if(MAD_RECOVERABLE(p->Stream.error))
+ {
+ sox_mp3_inputtag(ft);
+ continue;
+ }
+ else
+ {
+ if (p->Stream.error == MAD_ERROR_BUFLEN)
+ continue;
+ else
+ {
+ lsx_report("unrecoverable frame level error (%s).",
+ p->mad_stream_errorstr(&p->Stream));
+ break;
+ }
+ }
+ }
+ p->FrameCount++;
+ p->mad_timer_add(&p->Timer,p->Frame.header.duration);
+ p->mad_synth_frame(&p->Synth,&p->Frame);
+ p->cursamp=0;
+ } while(1);
+
+ return done;
+}
+
+static int stopread(sox_format_t * ft)
+{
+ priv_t *p=(priv_t*) ft->priv;
+
+ mad_synth_finish(&p->Synth);
+ p->mad_frame_finish(&p->Frame);
+ p->mad_stream_finish(&p->Stream);
+
+ free(p->mp3_buffer);
+ LSX_DLLIBRARY_CLOSE(p, mad_dl);
+ return SOX_SUCCESS;
+}
+
+static int sox_mp3seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * p = (priv_t *) ft->priv;
+ size_t initial_bitrate = p->Frame.header.bitrate;
+ size_t tagsize = 0, consumed = 0;
+ sox_bool vbr = sox_false; /* Variable Bit Rate */
+ sox_bool depadded = sox_false;
+ uint64_t to_skip_samples = 0;
+
+ /* Reset all */
+ lsx_rewind(ft);
+ mad_timer_reset(&p->Timer);
+ p->FrameCount = 0;
+
+ /* They where opened in startread */
+ mad_synth_finish(&p->Synth);
+ p->mad_frame_finish(&p->Frame);
+ p->mad_stream_finish(&p->Stream);
+
+ p->mad_stream_init(&p->Stream);
+ p->mad_frame_init(&p->Frame);
+ p->mad_synth_init(&p->Synth);
+
+ offset /= ft->signal.channels;
+ to_skip_samples = offset;
+
+ while(sox_true) { /* Read data from the MP3 file */
+ size_t padding = 0;
+ size_t read;
+ size_t leftover = p->Stream.bufend - p->Stream.next_frame;
+
+ memcpy(p->mp3_buffer, p->Stream.this_frame, leftover);
+ read = lsx_readbuf(ft, p->mp3_buffer + leftover, p->mp3_buffer_size - leftover);
+ if (read == 0) {
+ lsx_debug("seek failure. unexpected EOF (frames=%" PRIuPTR " leftover=%" PRIuPTR ")", p->FrameCount, leftover);
+ break;
+ }
+ for (; !depadded && padding < read && !p->mp3_buffer[padding]; ++padding);
+ depadded = sox_true;
+ p->mad_stream_buffer(&p->Stream, p->mp3_buffer + padding, leftover + read - padding);
+
+ while (sox_true) { /* Decode frame headers */
+ static unsigned short samples;
+ p->Stream.error = MAD_ERROR_NONE;
+
+ /* Not an audio frame */
+ if (p->mad_header_decode(&p->Frame.header, &p->Stream) == -1) {
+ if (p->Stream.error == MAD_ERROR_BUFLEN)
+ break; /* Normal behaviour; get some more data from the file */
+ if (!MAD_RECOVERABLE(p->Stream.error)) {
+ lsx_warn("unrecoverable MAD error");
+ break;
+ }
+ if (p->Stream.error == MAD_ERROR_LOSTSYNC) {
+ unsigned available = (p->Stream.bufend - p->Stream.this_frame);
+ tagsize = tagtype(p->Stream.this_frame, (size_t) available);
+ if (tagsize) { /* It's some ID3 tags, so just skip */
+ if (tagsize >= available) {
+ lsx_seeki(ft, (off_t)(tagsize - available), SEEK_CUR);
+ depadded = sox_false;
+ }
+ p->mad_stream_skip(&p->Stream, min(tagsize, available));
+ }
+ else lsx_warn("MAD lost sync");
+ }
+ else lsx_warn("recoverable MAD error");
+ continue;
+ }
+
+ consumed += p->Stream.next_frame - p->Stream.this_frame;
+ vbr |= (p->Frame.header.bitrate != initial_bitrate);
+
+ samples = 32 * MAD_NSBSAMPLES(&p->Frame.header);
+
+ p->FrameCount++;
+ p->mad_timer_add(&p->Timer, p->Frame.header.duration);
+
+ if(to_skip_samples <= samples)
+ {
+ p->mad_frame_decode(&p->Frame,&p->Stream);
+ p->mad_synth_frame(&p->Synth, &p->Frame);
+ p->cursamp = to_skip_samples;
+ return SOX_SUCCESS;
+ }
+ else to_skip_samples -= samples;
+
+ /* If not VBR, we can extrapolate frame size */
+ if (p->FrameCount == 64 && !vbr) {
+ p->FrameCount = offset / samples;
+ to_skip_samples = offset % samples;
+
+ if (SOX_SUCCESS != lsx_seeki(ft, (off_t)(p->FrameCount * consumed / 64 + tagsize), SEEK_SET))
+ return SOX_EOF;
+
+ /* Reset Stream for refilling buffer */
+ p->mad_stream_finish(&p->Stream);
+ p->mad_stream_init(&p->Stream);
+ break;
+ }
+ }
+ };
+
+ return SOX_EOF;
+}
+#else /* !HAVE_MAD_H */
+static int startread(sox_format_t * ft)
+{
+ lsx_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 decoding support");
+ return SOX_EOF;
+}
+#define sox_mp3read NULL
+#define stopread NULL
+#define sox_mp3seek NULL
+#endif /*HAVE_MAD_H*/
+
+#ifdef HAVE_LAME
+
+/* Adapters for lame message callbacks: */
+
+static void errorf(const char* fmt, va_list va)
+{
+ sox_globals.subsystem=__FILE__;
+ if (sox_globals.output_message_handler)
+ (*sox_globals.output_message_handler)(1,sox_globals.subsystem,fmt,va);
+ return;
+}
+
+static void debugf(const char* fmt, va_list va)
+{
+ sox_globals.subsystem=__FILE__;
+ if (sox_globals.output_message_handler)
+ (*sox_globals.output_message_handler)(4,sox_globals.subsystem,fmt,va);
+ return;
+}
+
+static void msgf(const char* fmt, va_list va)
+{
+ sox_globals.subsystem=__FILE__;
+ if (sox_globals.output_message_handler)
+ (*sox_globals.output_message_handler)(3,sox_globals.subsystem,fmt,va);
+ return;
+}
+
+/* These functions are considered optional. If they aren't present in the
+ library, the stub versions defined here will be used instead. */
+
+UNUSED static void id3tag_init_stub(lame_global_flags * gfp UNUSED)
+ { return; }
+UNUSED static void id3tag_set_title_stub(lame_global_flags * gfp UNUSED, const char* title UNUSED)
+ { return; }
+UNUSED static void id3tag_set_artist_stub(lame_global_flags * gfp UNUSED, const char* artist UNUSED)
+ { return; }
+UNUSED static void id3tag_set_album_stub(lame_global_flags * gfp UNUSED, const char* album UNUSED)
+ { return; }
+UNUSED static void id3tag_set_year_stub(lame_global_flags * gfp UNUSED, const char* year UNUSED)
+ { return; }
+UNUSED static void id3tag_set_comment_stub(lame_global_flags * gfp UNUSED, const char* comment UNUSED)
+ { return; }
+UNUSED static void id3tag_set_track_stub(lame_global_flags * gfp UNUSED, const char* track UNUSED)
+ { return; }
+UNUSED static int id3tag_set_genre_stub(lame_global_flags * gfp UNUSED, const char* genre UNUSED)
+ { return 0; }
+UNUSED static size_t id3tag_set_pad_stub(lame_global_flags * gfp UNUSED, size_t n UNUSED)
+ { return 0; }
+UNUSED static size_t lame_get_id3v2_tag_stub(lame_global_flags * gfp UNUSED, unsigned char * buffer UNUSED, size_t size UNUSED)
+ { return 0; }
+UNUSED static int id3tag_set_fieldvalue_stub(lame_global_flags * gfp UNUSED, const char *fieldvalue UNUSED)
+ { return 0; }
+
+static int get_id3v2_tag_size(sox_format_t * ft)
+{
+ size_t bytes_read;
+ int id3v2_size;
+ unsigned char id3v2_header[10];
+
+ if (lsx_seeki(ft, (off_t)0, SEEK_SET) != 0) {
+ lsx_warn("cannot update id3 tag - failed to seek to beginning");
+ return SOX_EOF;
+ }
+
+ /* read 10 bytes in case there's an ID3 version 2 header here */
+ bytes_read = lsx_readbuf(ft, id3v2_header, sizeof(id3v2_header));
+ if (bytes_read != sizeof(id3v2_header)) {
+ lsx_warn("cannot update id3 tag - failed to read id3 header");
+ return SOX_EOF; /* not readable, maybe opened Write-Only */
+ }
+
+ /* does the stream begin with the ID3 version 2 file identifier? */
+ if (!strncmp((char *) id3v2_header, "ID3", (size_t)3)) {
+ /* the tag size (minus the 10-byte header) is encoded into four
+ * bytes where the most significant bit is clear in each byte */
+ id3v2_size = (((id3v2_header[6] & 0x7f) << 21)
+ | ((id3v2_header[7] & 0x7f) << 14)
+ | ((id3v2_header[8] & 0x7f) << 7)
+ | (id3v2_header[9] & 0x7f))
+ + sizeof(id3v2_header);
+ } else {
+ /* no ID3 version 2 tag in this stream */
+ id3v2_size = 0;
+ }
+ return id3v2_size;
+}
+
+static void rewrite_id3v2_tag(sox_format_t * ft, size_t id3v2_size, uint64_t num_samples)
+{
+ priv_t *p = (priv_t *)ft->priv;
+ size_t new_size;
+ unsigned char * buffer;
+
+ if (LSX_DLFUNC_IS_STUB(p, lame_get_id3v2_tag))
+ {
+ if (p->num_samples)
+ lsx_warn("cannot update track length info - tag update not supported with this version of LAME. Track length will be incorrect.");
+ else
+ lsx_report("cannot update track length info - tag update not supported with this version of LAME. Track length will be unspecified.");
+ return;
+ }
+
+ buffer = lsx_malloc(id3v2_size);
+ if (!buffer)
+ {
+ lsx_warn("cannot update track length info - failed to allocate buffer");
+ return;
+ }
+
+ if (num_samples > ULONG_MAX)
+ {
+ lsx_warn("cannot accurately update track length info - file is too long");
+ num_samples = 0;
+ }
+ p->lame_set_num_samples(p->gfp, (unsigned long)num_samples);
+ lsx_debug("updated MP3 TLEN to %lu samples", (unsigned long)num_samples);
+
+ new_size = p->lame_get_id3v2_tag(p->gfp, buffer, id3v2_size);
+
+ if (new_size != id3v2_size && new_size-ID3PADDING <= id3v2_size) {
+ p->id3tag_set_pad(p->gfp, ID3PADDING + id3v2_size - new_size);
+ new_size = p->lame_get_id3v2_tag(p->gfp, buffer, id3v2_size);
+ }
+
+ if (new_size != id3v2_size) {
+ if (LSX_DLFUNC_IS_STUB(p, id3tag_set_pad))
+ {
+ if (p->num_samples)
+ lsx_warn("cannot update track length info - tag size adjustment not supported with this version of LAME. Track length will be invalid.");
+ else
+ lsx_report("cannot update track length info - tag size adjustment not supported with this version of LAME. Track length will be unspecified.");
+ }
+ else
+ lsx_warn("cannot update track length info - failed to adjust tag size");
+ } else {
+ lsx_seeki(ft, (off_t)0, SEEK_SET);
+ /* Overwrite the Id3v2 tag (this time TLEN should be accurate) */
+ if (lsx_writebuf(ft, buffer, id3v2_size) != 1) {
+ lsx_debug("Rewrote Id3v2 tag (%" PRIuPTR " bytes)", id3v2_size);
+ }
+ }
+
+ free(buffer);
+}
+
+static void rewrite_tags(sox_format_t * ft, uint64_t num_samples)
+{
+ priv_t *p = (priv_t *)ft->priv;
+
+ off_t file_size;
+ size_t id3v2_size;
+
+ if (lsx_seeki(ft, (off_t)0, SEEK_END)) {
+ lsx_warn("cannot update tags - seek to end failed");
+ return;
+ }
+
+ /* Get file size */
+ file_size = lsx_tell(ft);
+
+ if (file_size == 0) {
+ lsx_warn("cannot update tags - file size is 0");
+ return;
+ }
+
+ id3v2_size = get_id3v2_tag_size(ft);
+ if (id3v2_size > 0 && num_samples != p->num_samples) {
+ rewrite_id3v2_tag(ft, id3v2_size, num_samples);
+ }
+
+ if (p->vbr_tag) {
+ size_t lametag_size;
+ uint8_t buffer[MAXFRAMESIZE];
+
+ if (lsx_seeki(ft, (off_t)id3v2_size, SEEK_SET)) {
+ lsx_warn("cannot write VBR tag - seek to tag block failed");
+ return;
+ }
+
+ lametag_size = p->lame_get_lametag_frame(p->gfp, buffer, sizeof(buffer));
+ if (lametag_size > sizeof(buffer)) {
+ lsx_warn("cannot write VBR tag - VBR tag too large for buffer");
+ return;
+ }
+
+ if (lametag_size < 1) {
+ return;
+ }
+
+ if (lsx_writebuf(ft, buffer, lametag_size) != lametag_size) {
+ lsx_warn("cannot write VBR tag - VBR tag write failed");
+ } else {
+ lsx_debug("rewrote VBR tag (%" PRIuPTR " bytes)", lametag_size);
+ }
+ }
+}
+
+#endif /* HAVE_LAME */
+
+#if defined(HAVE_LAME) || defined(HAVE_TWOLAME)
+
+#define LAME_BUFFER_SIZE(num_samples) (((num_samples) + 3) / 4 * 5 + 7200)
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ int openlibrary_result;
+ int fail = 0;
+
+ if (ft->encoding.encoding != SOX_ENCODING_MP3) {
+ if(ft->encoding.encoding != SOX_ENCODING_UNKNOWN)
+ lsx_report("Encoding forced to MP2/MP3");
+ ft->encoding.encoding = SOX_ENCODING_MP3;
+ }
+
+ if(strchr(ft->filetype, '2'))
+ p->mp2 = 1;
+
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ LSX_DLLIBRARY_OPEN(
+ p,
+ twolame_dl,
+ TWOLAME_FUNC_ENTRIES,
+ "Twolame encoder library",
+ twolame_library_names,
+ openlibrary_result);
+#else
+ lsx_fail_errno(ft,SOX_EOF,"SoX was compiled without MP2 encoding support");
+ return SOX_EOF;
+#endif
+ } else {
+#ifdef HAVE_LAME
+ LSX_DLLIBRARY_OPEN(
+ p,
+ lame_dl,
+ LAME_FUNC_ENTRIES,
+ "LAME encoder library",
+ lame_library_names,
+ openlibrary_result);
+#else
+ lsx_fail_errno(ft,SOX_EOF,"SoX was compiled without MP3 encoding support");
+ return SOX_EOF;
+#endif
+ }
+ if (openlibrary_result)
+ return SOX_EOF;
+
+ p->mp3_buffer_size = LAME_BUFFER_SIZE(sox_globals.bufsiz / max(ft->signal.channels, 1));
+ p->mp3_buffer = lsx_malloc(p->mp3_buffer_size);
+
+ p->pcm_buffer_size = sox_globals.bufsiz * sizeof(float);
+ p->pcm_buffer = lsx_malloc(p->pcm_buffer_size);
+
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ p->opt = p->twolame_init();
+
+ if (p->opt == NULL){
+ lsx_fail_errno(ft,SOX_EOF,"Initialization of Twolame library failed");
+ return(SOX_EOF);
+ }
+#endif
+ } else {
+#ifdef HAVE_LAME
+ p->gfp = p->lame_init();
+
+ if (p->gfp == NULL){
+ lsx_fail_errno(ft,SOX_EOF,"Initialization of LAME library failed");
+ return(SOX_EOF);
+ }
+
+ /* First set message callbacks so we don't miss any messages: */
+ p->lame_set_errorf(p->gfp,errorf);
+ p->lame_set_debugf(p->gfp,debugf);
+ p->lame_set_msgf (p->gfp,msgf);
+
+ p->num_samples = ft->signal.length == SOX_IGNORE_LENGTH ? 0 : ft->signal.length / max(ft->signal.channels, 1);
+ p->lame_set_num_samples(p->gfp, p->num_samples > ULONG_MAX ? 0 : (unsigned long)p->num_samples);
+#endif
+ }
+
+ ft->signal.precision = MP3_LAME_PRECISION;
+
+ if (ft->signal.channels != SOX_ENCODING_UNKNOWN) {
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ fail = (p->twolame_set_num_channels(p->opt,(int)ft->signal.channels) != 0);
+#endif
+ } else {
+#ifdef HAVE_LAME
+ fail = (p->lame_set_num_channels(p->gfp,(int)ft->signal.channels) < 0);
+#endif
+ }
+ if (fail) {
+ lsx_fail_errno(ft,SOX_EOF,"Unsupported number of channels");
+ return(SOX_EOF);
+ }
+ }
+ else {
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ ft->signal.channels = p->twolame_get_num_channels(p->opt); /* Twolame default */
+#endif
+ } else {
+#ifdef HAVE_LAME
+ ft->signal.channels = p->lame_get_num_channels(p->gfp); /* LAME default */
+#endif
+ }
+ }
+
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ p->twolame_set_in_samplerate(p->opt,(int)ft->signal.rate);
+ p->twolame_set_out_samplerate(p->opt,(int)ft->signal.rate);
+#endif
+ } else {
+#ifdef HAVE_LAME
+ p->lame_set_in_samplerate(p->gfp,(int)ft->signal.rate);
+ p->lame_set_out_samplerate(p->gfp,(int)ft->signal.rate);
+#endif
+ }
+
+ if (!p->mp2) {
+#ifdef HAVE_LAME
+ if (!LSX_DLFUNC_IS_STUB(p, id3tag_init))
+ write_comments(ft);
+#endif
+ }
+
+ /* The primary parameter to the LAME encoder is the bit rate. If the
+ * value of encoding.compression is a positive integer, it's taken as
+ * the bitrate in kbps (that is if you specify 128, it use 128 kbps).
+ *
+ * The second most important parameter is probably "quality" (really
+ * performance), which allows balancing encoding speed vs. quality.
+ * In LAME, 0 specifies highest quality but is very slow, while
+ * 9 selects poor quality, but is fast. (5 is the default and 2 is
+ * recommended as a good trade-off for high quality encodes.)
+ *
+ * Because encoding.compression is a float, the fractional part is used
+ * to select quality. 128.2 selects 128 kbps encoding with a quality
+ * of 2. There is one problem with this approach. We need 128 to specify
+ * 128 kbps encoding with default quality, so .0 means use default. Instead
+ * of .0 you have to use .01 to specify the highest quality (128.01).
+ *
+ * LAME uses bitrate to specify a constant bitrate, but higher quality
+ * can be achieved using Variable Bit Rate (VBR). VBR quality (really
+ * size) is selected using a number from 0 to 9. Use a value of 0 for high
+ * quality, larger files, and 9 for smaller files of lower quality. 4 is
+ * the default.
+ *
+ * In order to squeeze the selection of VBR into the encoding.compression
+ * float we use negative numbers to select VRR. -4.2 would select default
+ * VBR encoding (size) with high quality (speed). One special case is 0,
+ * which is a valid VBR encoding parameter but not a valid bitrate.
+ * Compression value of 0 is always treated as a high quality vbr, as a
+ * result both -0.2 and 0.2 are treated as highest quality VBR (size) and
+ * high quality (speed).
+ *
+ * Note: It would have been nice to simply use low values, 0-9, to trigger
+ * VBR mode, but 8 kbps is a valid bit rate, so negative values were
+ * used instead.
+ */
+
+ lsx_debug("-C option is %f", ft->encoding.compression);
+
+ if (ft->encoding.compression == HUGE_VAL) {
+ /* Do nothing, use defaults: */
+ lsx_report("using %s encoding defaults", p->mp2? "MP2" : "MP3");
+ } else {
+ double abs_compression = fabs(ft->encoding.compression);
+ double floor_compression = floor(abs_compression);
+ double fraction_compression = abs_compression - floor_compression;
+ int bitrate_q = (int)floor_compression;
+ int encoder_q =
+ fraction_compression == 0.0
+ ? -1
+ : (int)(fraction_compression * 10.0 + 0.5);
+
+ if (ft->encoding.compression < 0.5) {
+ if (p->mp2) {
+ lsx_fail_errno(ft,SOX_EOF,"Variable bitrate encoding not supported for MP2 audio");
+ return(SOX_EOF);
+ }
+#ifdef HAVE_LAME
+ if (p->lame_get_VBR(p->gfp) == vbr_off)
+ p->lame_set_VBR(p->gfp, vbr_default);
+
+ if (ft->seekable) {
+ p->vbr_tag = 1;
+ } else {
+ lsx_warn("unable to write VBR tag because we can't seek");
+ }
+
+ if (p->lame_set_VBR_q(p->gfp, bitrate_q) < 0)
+ {
+ lsx_fail_errno(ft, SOX_EOF,
+ "lame_set_VBR_q(%d) failed (should be between 0 and 9)",
+ bitrate_q);
+ return(SOX_EOF);
+ }
+ lsx_report("lame_set_VBR_q(%d)", bitrate_q);
+#endif
+ } else {
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ fail = (p->twolame_set_brate(p->opt, bitrate_q) != 0);
+#endif
+ } else {
+#ifdef HAVE_LAME
+ fail = (p->lame_set_brate(p->gfp, bitrate_q) < 0);
+#endif
+ }
+ if (fail) {
+ lsx_fail_errno(ft, SOX_EOF,
+ "%slame_set_brate(%d) failed", p->mp2? "two" : "", bitrate_q);
+ return(SOX_EOF);
+ }
+ lsx_report("(two)lame_set_brate(%d)", bitrate_q);
+ }
+
+ /* Set Quality */
+
+ if (encoder_q < 0 || p->mp2) {
+ /* use default quality value */
+ lsx_report("using %s default quality", p->mp2? "MP2" : "MP3");
+ } else {
+#ifdef HAVE_LAME
+ if (p->lame_set_quality(p->gfp, encoder_q) < 0) {
+ lsx_fail_errno(ft, SOX_EOF,
+ "lame_set_quality(%d) failed", encoder_q);
+ return(SOX_EOF);
+ }
+ lsx_report("lame_set_quality(%d)", encoder_q);
+#endif
+ }
+ }
+
+ if (!p->mp2) {
+#ifdef HAVE_LAME
+ p->lame_set_bWriteVbrTag(p->gfp, p->vbr_tag);
+#endif
+ }
+
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ fail = (p->twolame_init_params(p->opt) != 0);
+#endif
+ } else {
+#ifdef HAVE_LAME
+ fail = (p->lame_init_params(p->gfp) < 0);
+#endif
+ }
+ if (fail) {
+ lsx_fail_errno(ft,SOX_EOF,"%s initialization failed", p->mp2? "Twolame" : "LAME");
+ return(SOX_EOF);
+ }
+
+ return(SOX_SUCCESS);
+}
+
+#define MP3_SAMPLE_TO_FLOAT(d,clips) ((float)(32768*SOX_SAMPLE_TO_FLOAT_32BIT(d,clips)))
+
+static size_t sox_mp3write(sox_format_t * ft, const sox_sample_t *buf, size_t samp)
+{
+ priv_t *p = (priv_t *)ft->priv;
+ size_t new_buffer_size;
+ float *buffer_l, *buffer_r = NULL;
+ int nsamples = samp/ft->signal.channels;
+ int i,j;
+ int written = 0;
+ int clips = 0;
+ SOX_SAMPLE_LOCALS;
+
+ new_buffer_size = samp * sizeof(float);
+ if (p->pcm_buffer_size < new_buffer_size) {
+ float *new_buffer = lsx_realloc(p->pcm_buffer, new_buffer_size);
+ if (!new_buffer) {
+ lsx_fail_errno(ft, SOX_ENOMEM, "Out of memory");
+ return 0;
+ }
+ p->pcm_buffer_size = new_buffer_size;
+ p->pcm_buffer = new_buffer;
+ }
+
+ buffer_l = p->pcm_buffer;
+
+ if (p->mp2)
+ {
+ size_t s;
+ for(s = 0; s < samp; s++)
+ buffer_l[s] = SOX_SAMPLE_TO_FLOAT_32BIT(buf[s], clips);
+ }
+ else
+ {
+ if (ft->signal.channels == 2)
+ {
+ /* lame doesn't support interleaved samples for floats so we must break
+ * them out into seperate buffers.
+ */
+ buffer_r = p->pcm_buffer + nsamples;
+ j=0;
+ for (i = 0; i < nsamples; i++)
+ {
+ buffer_l[i] = MP3_SAMPLE_TO_FLOAT(buf[j++], clips);
+ buffer_r[i] = MP3_SAMPLE_TO_FLOAT(buf[j++], clips);
+ }
+ }
+ else
+ {
+ j=0;
+ for (i = 0; i < nsamples; i++) {
+ buffer_l[i] = MP3_SAMPLE_TO_FLOAT(buf[j++], clips);
+ }
+ }
+ }
+
+ new_buffer_size = LAME_BUFFER_SIZE(nsamples);
+ if (p->mp3_buffer_size < new_buffer_size) {
+ unsigned char *new_buffer = lsx_realloc(p->mp3_buffer, new_buffer_size);
+ if (!new_buffer) {
+ lsx_fail_errno(ft, SOX_ENOMEM, "Out of memory");
+ return 0;
+ }
+ p->mp3_buffer_size = new_buffer_size;
+ p->mp3_buffer = new_buffer;
+ }
+
+ if(p->mp2) {
+#ifdef HAVE_TWOLAME
+ written = p->twolame_encode_buffer_float32_interleaved(p->opt, buffer_l,
+ nsamples, p->mp3_buffer, (int)p->mp3_buffer_size);
+#endif
+ } else {
+#ifdef HAVE_LAME
+ written = p->lame_encode_buffer_float(p->gfp, buffer_l, buffer_r,
+ nsamples, p->mp3_buffer, (int)p->mp3_buffer_size);
+#endif
+ }
+ if (written < 0) {
+ lsx_fail_errno(ft,SOX_EOF,"Encoding failed");
+ return 0;
+ }
+
+ if (lsx_writebuf(ft, p->mp3_buffer, (size_t)written) < (size_t)written)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"File write failed");
+ return 0;
+ }
+
+ return samp;
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t *p = (priv_t *) ft->priv;
+ uint64_t num_samples = ft->olength == SOX_IGNORE_LENGTH ? 0 : ft->olength / max(ft->signal.channels, 1);
+ int written = 0;
+
+ if (p->mp2) {
+#ifdef HAVE_TWOLAME
+ written = p->twolame_encode_flush(p->opt, p->mp3_buffer, (int)p->mp3_buffer_size);
+#endif
+ } else {
+#ifdef HAVE_LAME
+ written = p->lame_encode_flush(p->gfp, p->mp3_buffer, (int)p->mp3_buffer_size);
+#endif
+ }
+ if (written < 0)
+ lsx_fail_errno(ft, SOX_EOF, "Encoding failed");
+ else if (lsx_writebuf(ft, p->mp3_buffer, (size_t)written) < (size_t)written)
+ lsx_fail_errno(ft, SOX_EOF, "File write failed");
+ else if (!p->mp2) {
+#ifdef HAVE_LAME
+ if (ft->seekable && (num_samples != p->num_samples || p->vbr_tag))
+ rewrite_tags(ft, num_samples);
+#endif
+ }
+
+ free(p->mp3_buffer);
+ free(p->pcm_buffer);
+
+ if(p->mp2) {
+#ifdef HAVE_TWOLAME
+ p->twolame_close(&p->opt);
+ LSX_DLLIBRARY_CLOSE(p, twolame_dl);
+#endif
+ } else {
+#ifdef HAVE_LAME
+ p->lame_close(p->gfp);
+ LSX_DLLIBRARY_CLOSE(p, lame_dl);
+#endif
+ }
+ return SOX_SUCCESS;
+}
+
+#else /* !(HAVE_LAME || HAVE_TWOLAME) */
+static int startwrite(sox_format_t * ft UNUSED)
+{
+ lsx_fail_errno(ft,SOX_EOF,"SoX was compiled with neither MP2 nor MP3 encoding support");
+ return SOX_EOF;
+}
+#define sox_mp3write NULL
+#define stopwrite NULL
+#endif /* HAVE_LAME || HAVE_TWOLAME */
+
+LSX_FORMAT_HANDLER(mp3)
+{
+ static char const * const names[] = {"mp3", "mp2", "audio/mpeg", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_MP3, 0, 0};
+ static sox_rate_t const write_rates[] = {
+ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "MPEG Layer 2/3 lossy audio compression", names, 0,
+ startread, sox_mp3read, stopread,
+ startwrite, sox_mp3write, stopwrite,
+ sox_mp3seek, write_encodings, write_rates, sizeof(priv_t)
+ };
+ return &handler;
+}
+#endif /* defined(HAVE_MAD_H) || defined(HAVE_LAME) || defined(HAVE_TWOLAME) */
diff --git a/src/src/noiseprof.c b/src/src/noiseprof.c
new file mode 100644
index 0000000..d398bc8
--- /dev/null
+++ b/src/src/noiseprof.c
@@ -0,0 +1,223 @@
+/* noiseprof - SoX Noise Profiling Effect.
+ *
+ * Written by Ian Turner (vectro@vectro.org)
+ * Copyright 1999 Ian Turner and others
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/noisered.h"
+
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+
+typedef struct {
+ float *sum;
+ int *profilecount;
+
+ float *window;
+} chandata_t;
+
+typedef struct {
+ char* output_filename;
+ FILE* output_file;
+
+ chandata_t *chandata;
+ size_t bufdata;
+} priv_t;
+
+/*
+ * Get the filename, if any. We don't open it until sox_noiseprof_start.
+ */
+static int sox_noiseprof_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * data = (priv_t *) effp->priv;
+ --argc, ++argv;
+
+ if (argc == 1) {
+ data->output_filename = argv[0];
+ } else if (argc > 1)
+ return lsx_usage(effp);
+
+ return (SOX_SUCCESS);
+}
+
+/*
+ * Prepare processing.
+ * Do all initializations.
+ */
+static int sox_noiseprof_start(sox_effect_t * effp)
+{
+ priv_t * data = (priv_t *) effp->priv;
+ unsigned channels = effp->in_signal.channels;
+ unsigned i;
+
+ /* Note: don't fall back to stderr if stdout is unavailable
+ * since we already use stderr for diagnostics. */
+ if (!data->output_filename || !strcmp(data->output_filename, "-")) {
+ if (effp->global_info->global_info->stdout_in_use_by) {
+ lsx_fail("stdout already in use by `%s'", effp->global_info->global_info->stdout_in_use_by);
+ return SOX_EOF;
+ }
+ effp->global_info->global_info->stdout_in_use_by = effp->handler.name;
+ data->output_file = stdout;
+ }
+ else if ((data->output_file = fopen(data->output_filename, "wb")) == NULL) {
+ lsx_fail("Couldn't open profile file %s: %s", data->output_filename, strerror(errno));
+ return SOX_EOF;
+ }
+
+ data->chandata = lsx_calloc(channels, sizeof(*(data->chandata)));
+ data->bufdata = 0;
+ for (i = 0; i < channels; i ++) {
+ data->chandata[i].sum = lsx_calloc(FREQCOUNT, sizeof(float));
+ data->chandata[i].profilecount = lsx_calloc(FREQCOUNT, sizeof(int));
+ data->chandata[i].window = lsx_calloc(WINDOWSIZE, sizeof(float));
+ }
+
+ return SOX_SUCCESS;
+}
+
+/* Collect statistics from the complete window on channel chan. */
+static void collect_data(chandata_t* chan) {
+ float *out = lsx_calloc(FREQCOUNT, sizeof(float));
+ int i;
+
+ lsx_power_spectrum_f(WINDOWSIZE, chan->window, out);
+
+ for (i = 0; i < FREQCOUNT; i ++) {
+ if (out[i] > 0) {
+ float value = log(out[i]);
+ chan->sum[i] += value;
+ chan->profilecount[i] ++;
+ }
+ }
+
+ free(out);
+}
+
+/*
+ * Grab what we can from ibuf, and process if we have a whole window.
+ */
+static int sox_noiseprof_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ size_t samp = min(*isamp, *osamp), dummy = 0; /* No need to clip count */
+ size_t chans = effp->in_signal.channels;
+ size_t i, j, n = min(samp / chans, WINDOWSIZE - p->bufdata);
+
+ memcpy(obuf, ibuf, n * chans * sizeof(*obuf)); /* Pass on audio unaffected */
+ *isamp = *osamp = n * chans;
+
+ /* Collect data for every channel. */
+ for (i = 0; i < chans; i ++) {
+ SOX_SAMPLE_LOCALS;
+ chandata_t * chan = &(p->chandata[i]);
+ for (j = 0; j < n; j ++)
+ chan->window[j + p->bufdata] =
+ SOX_SAMPLE_TO_FLOAT_32BIT(ibuf[i + j * chans], dummy);
+ if (n + p->bufdata == WINDOWSIZE)
+ collect_data(chan);
+ }
+
+ p->bufdata += n;
+ assert(p->bufdata <= WINDOWSIZE);
+ if (p->bufdata == WINDOWSIZE)
+ p->bufdata = 0;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Finish off the last window.
+ */
+
+static int sox_noiseprof_drain(sox_effect_t * effp, sox_sample_t *obuf UNUSED, size_t *osamp)
+{
+ priv_t * data = (priv_t *) effp->priv;
+ int tracks = effp->in_signal.channels;
+ int i;
+
+ *osamp = 0;
+
+ if (data->bufdata == 0) {
+ return SOX_EOF;
+ }
+
+ for (i = 0; i < tracks; i ++) {
+ int j;
+ for (j = data->bufdata+1; j < WINDOWSIZE; j ++) {
+ data->chandata[i].window[j] = 0;
+ }
+ collect_data(&(data->chandata[i]));
+ }
+
+ if (data->bufdata == WINDOWSIZE || data->bufdata == 0)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+/*
+ * Print profile and clean up.
+ */
+static int sox_noiseprof_stop(sox_effect_t * effp)
+{
+ priv_t * data = (priv_t *) effp->priv;
+ size_t i;
+
+ for (i = 0; i < effp->in_signal.channels; i ++) {
+ int j;
+ chandata_t* chan = &(data->chandata[i]);
+
+ fprintf(data->output_file, "Channel %lu: ", (unsigned long)i);
+
+ for (j = 0; j < FREQCOUNT; j ++) {
+ double r = chan->profilecount[j] != 0 ?
+ chan->sum[j] / chan->profilecount[j] : 0;
+ fprintf(data->output_file, "%s%f", j == 0 ? "" : ", ", r);
+ }
+ fprintf(data->output_file, "\n");
+
+ free(chan->sum);
+ free(chan->profilecount);
+ }
+
+ free(data->chandata);
+
+ if (data->output_file != stdout)
+ fclose(data->output_file);
+
+ return (SOX_SUCCESS);
+}
+
+static sox_effect_handler_t sox_noiseprof_effect = {
+ "noiseprof",
+ "[profile-file]",
+ SOX_EFF_MCHAN | SOX_EFF_MODIFY,
+ sox_noiseprof_getopts,
+ sox_noiseprof_start,
+ sox_noiseprof_flow,
+ sox_noiseprof_drain,
+ sox_noiseprof_stop,
+ NULL, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_noiseprof_effect_fn(void)
+{
+ return &sox_noiseprof_effect;
+}
diff --git a/src/src/noisered.c b/src/src/noisered.c
new file mode 100644
index 0000000..957a6b1
--- /dev/null
+++ b/src/src/noisered.c
@@ -0,0 +1,357 @@
+/* noisered - Noise Reduction Effect.
+ *
+ * Written by Ian Turner (vectro@vectro.org)
+ *
+ * Copyright 1999 Ian Turner
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Authors are not responsible for the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/noisered.h"
+
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <assert.h>
+
+typedef struct {
+ float *window;
+ float *lastwindow;
+ float *noisegate;
+ float *smoothing;
+} chandata_t;
+
+/* Holds profile information */
+typedef struct {
+ char* profile_filename;
+ float threshold;
+
+ chandata_t *chandata;
+ size_t bufdata;
+} priv_t;
+
+static void FFT(unsigned NumSamples,
+ int InverseTransform,
+ const float *RealIn, float *ImagIn, float *RealOut, float *ImagOut)
+{
+ unsigned i;
+ double * work = malloc(2 * NumSamples * sizeof(*work));
+ for (i = 0; i < 2 * NumSamples; i += 2) {
+ work[i] = RealIn[i >> 1];
+ work[i + 1] = ImagIn? ImagIn[i >> 1] : 0;
+ }
+ lsx_safe_cdft(2 * (int)NumSamples, InverseTransform? -1 : 1, work);
+ if (InverseTransform) for (i = 0; i < 2 * NumSamples; i += 2) {
+ RealOut[i >> 1] = work[i] / NumSamples;
+ ImagOut[i >> 1] = work[i + 1] / NumSamples;
+ }
+ else for (i = 0; i < 2 * NumSamples; i += 2) {
+ RealOut[i >> 1] = work[i];
+ ImagOut[i >> 1] = work[i + 1];
+ }
+ free(work);
+}
+
+/*
+ * Get the options. Default file is stdin (if the audio
+ * input file isn't coming from there, of course!)
+ */
+static int sox_noisered_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ --argc, ++argv;
+
+ if (argc > 0) {
+ p->profile_filename = argv[0];
+ ++argv;
+ --argc;
+ }
+
+ p->threshold = 0.5;
+ do { /* break-able block */
+ NUMERIC_PARAMETER(threshold, 0, 1);
+ } while (0);
+
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+/*
+ * Prepare processing.
+ * Do all initializations.
+ */
+static int sox_noisered_start(sox_effect_t * effp)
+{
+ priv_t * data = (priv_t *) effp->priv;
+ size_t fchannels = 0;
+ size_t channels = effp->in_signal.channels;
+ size_t i;
+ FILE * ifp = lsx_open_input_file(effp, data->profile_filename, sox_false);
+
+ if (!ifp)
+ return SOX_EOF;
+
+ data->chandata = lsx_calloc(channels, sizeof(*(data->chandata)));
+ data->bufdata = 0;
+ for (i = 0; i < channels; i ++) {
+ data->chandata[i].noisegate = lsx_calloc(FREQCOUNT, sizeof(float));
+ data->chandata[i].smoothing = lsx_calloc(FREQCOUNT, sizeof(float));
+ data->chandata[i].lastwindow = NULL;
+ }
+ while (1) {
+ unsigned long i1_ul;
+ size_t i1;
+ float f1;
+ if (2 != fscanf(ifp, " Channel %lu: %f", &i1_ul, &f1))
+ break;
+ i1 = i1_ul;
+ if (i1 != fchannels) {
+ lsx_fail("noisered: Got channel %lu, expected channel %lu.",
+ (unsigned long)i1, (unsigned long)fchannels);
+ return SOX_EOF;
+ }
+
+ data->chandata[fchannels].noisegate[0] = f1;
+ for (i = 1; i < FREQCOUNT; i ++) {
+ if (1 != fscanf(ifp, ", %f", &f1)) {
+ lsx_fail("noisered: Not enough data for channel %lu "
+ "(expected %d, got %lu)", (unsigned long)fchannels, FREQCOUNT, (unsigned long)i);
+ return SOX_EOF;
+ }
+ data->chandata[fchannels].noisegate[i] = f1;
+ }
+ fchannels ++;
+ }
+ if (fchannels != channels) {
+ lsx_fail("noisered: channel mismatch: %lu in input, %lu in profile.",
+ (unsigned long)channels, (unsigned long)fchannels);
+ return SOX_EOF;
+ }
+ if (ifp != stdin)
+ fclose(ifp);
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* TODO: calculate actual length */
+
+ return (SOX_SUCCESS);
+}
+
+/* Mangle a single window. Each output sample (except the first and last
+ * half-window) is the result of two distinct calls to this function,
+ * due to overlapping windows. */
+static void reduce_noise(chandata_t* chan, float* window, double level)
+{
+ float *inr, *ini, *outr, *outi, *power;
+ float *smoothing = chan->smoothing;
+ int i;
+
+ inr = lsx_calloc(WINDOWSIZE * 5, sizeof(float));
+ ini = inr + WINDOWSIZE;
+ outr = ini + WINDOWSIZE;
+ outi = outr + WINDOWSIZE;
+ power = outi + WINDOWSIZE;
+
+ for (i = 0; i < FREQCOUNT; i ++)
+ assert(smoothing[i] >= 0 && smoothing[i] <= 1);
+
+ memcpy(inr, window, WINDOWSIZE*sizeof(float));
+
+ FFT(WINDOWSIZE, 0, inr, NULL, outr, outi);
+
+ memcpy(inr, window, WINDOWSIZE*sizeof(float));
+ lsx_apply_hann_f(inr, WINDOWSIZE);
+ lsx_power_spectrum_f(WINDOWSIZE, inr, power);
+
+ for (i = 0; i < FREQCOUNT; i ++) {
+ float smooth;
+ float plog;
+ plog = log(power[i]);
+ if (power[i] != 0 && plog < chan->noisegate[i] + level*8.0)
+ smooth = 0.0;
+ else
+ smooth = 1.0;
+
+ smoothing[i] = smooth * 0.5 + smoothing[i] * 0.5;
+ }
+
+ /* Audacity says this code will eliminate tinkle bells.
+ * I have no idea what that means. */
+ for (i = 2; i < FREQCOUNT - 2; i ++) {
+ if (smoothing[i]>=0.5 &&
+ smoothing[i]<=0.55 &&
+ smoothing[i-1]<0.1 &&
+ smoothing[i-2]<0.1 &&
+ smoothing[i+1]<0.1 &&
+ smoothing[i+2]<0.1)
+ smoothing[i] = 0.0;
+ }
+
+ outr[0] *= smoothing[0];
+ outi[0] *= smoothing[0];
+ outr[FREQCOUNT-1] *= smoothing[FREQCOUNT-1];
+ outi[FREQCOUNT-1] *= smoothing[FREQCOUNT-1];
+
+ for (i = 1; i < FREQCOUNT-1; i ++) {
+ int j = WINDOWSIZE - i;
+ float smooth = smoothing[i];
+
+ outr[i] *= smooth;
+ outi[i] *= smooth;
+ outr[j] *= smooth;
+ outi[j] *= smooth;
+ }
+
+ FFT(WINDOWSIZE, 1, outr, outi, inr, ini);
+ lsx_apply_hann_f(inr, WINDOWSIZE);
+
+ memcpy(window, inr, WINDOWSIZE*sizeof(float));
+
+ for (i = 0; i < FREQCOUNT; i ++)
+ assert(smoothing[i] >= 0 && smoothing[i] <= 1);
+
+ free(inr);
+}
+
+/* Do window management once we have a complete window, including mangling
+ * the current window. */
+static int process_window(sox_effect_t * effp, priv_t * data, unsigned chan_num, unsigned num_chans,
+ sox_sample_t *obuf, unsigned len) {
+ int j;
+ float* nextwindow;
+ int use = min(len, WINDOWSIZE)-min(len,(WINDOWSIZE/2));
+ chandata_t *chan = &(data->chandata[chan_num]);
+ int first = (chan->lastwindow == NULL);
+ SOX_SAMPLE_LOCALS;
+
+ if ((nextwindow = lsx_calloc(WINDOWSIZE, sizeof(float))) == NULL)
+ return SOX_EOF;
+
+ memcpy(nextwindow, chan->window+WINDOWSIZE/2,
+ sizeof(float)*(WINDOWSIZE/2));
+
+ reduce_noise(chan, chan->window, data->threshold);
+ if (!first) {
+ for (j = 0; j < use; j ++) {
+ float s = chan->window[j] + chan->lastwindow[WINDOWSIZE/2 + j];
+ obuf[chan_num + num_chans * j] =
+ SOX_FLOAT_32BIT_TO_SAMPLE(s, effp->clips);
+ }
+ free(chan->lastwindow);
+ } else {
+ for (j = 0; j < use; j ++) {
+ assert(chan->window[j] >= -1 && chan->window[j] <= 1);
+ obuf[chan_num + num_chans * j] =
+ SOX_FLOAT_32BIT_TO_SAMPLE(chan->window[j], effp->clips);
+ }
+ }
+ chan->lastwindow = chan->window;
+ chan->window = nextwindow;
+
+ return use;
+}
+
+/*
+ * Read in windows, and call process_window once we get a whole one.
+ */
+static int sox_noisered_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * data = (priv_t *) effp->priv;
+ size_t samp = min(*isamp, *osamp);
+ size_t tracks = effp->in_signal.channels;
+ size_t track_samples = samp / tracks;
+ size_t ncopy = min(track_samples, WINDOWSIZE-data->bufdata);
+ size_t whole_window = (ncopy + data->bufdata == WINDOWSIZE);
+ int oldbuf = data->bufdata;
+ size_t i;
+
+ /* FIXME: Make this automatic for all effects */
+ assert(effp->in_signal.channels == effp->out_signal.channels);
+
+ if (whole_window)
+ data->bufdata = WINDOWSIZE/2;
+ else
+ data->bufdata += ncopy;
+
+ /* Reduce noise on every channel. */
+ for (i = 0; i < tracks; i ++) {
+ SOX_SAMPLE_LOCALS;
+ chandata_t* chan = &(data->chandata[i]);
+ size_t j;
+
+ if (chan->window == NULL)
+ chan->window = lsx_calloc(WINDOWSIZE, sizeof(float));
+
+ for (j = 0; j < ncopy; j ++)
+ chan->window[oldbuf + j] =
+ SOX_SAMPLE_TO_FLOAT_32BIT(ibuf[i + tracks * j], effp->clips);
+
+ if (!whole_window)
+ continue;
+ else
+ process_window(effp, data, (unsigned) i, (unsigned) tracks, obuf, (unsigned) (oldbuf + ncopy));
+ }
+
+ *isamp = tracks*ncopy;
+ if (whole_window)
+ *osamp = tracks*(WINDOWSIZE/2);
+ else
+ *osamp = 0;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * We have up to half a window left to dump.
+ */
+
+static int sox_noisered_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * data = (priv_t *)effp->priv;
+ unsigned i;
+ unsigned tracks = effp->in_signal.channels;
+ for (i = 0; i < tracks; i ++)
+ *osamp = process_window(effp, data, i, tracks, obuf, (unsigned) data->bufdata);
+
+ /* FIXME: This is very picky. osamp needs to be big enough to get all
+ * remaining data or it will be discarded.
+ */
+ return (SOX_EOF);
+}
+
+/*
+ * Clean up.
+ */
+static int sox_noisered_stop(sox_effect_t * effp)
+{
+ priv_t * data = (priv_t *) effp->priv;
+ size_t i;
+
+ for (i = 0; i < effp->in_signal.channels; i ++) {
+ chandata_t* chan = &(data->chandata[i]);
+ free(chan->lastwindow);
+ free(chan->window);
+ free(chan->smoothing);
+ free(chan->noisegate);
+ }
+
+ free(data->chandata);
+
+ return (SOX_SUCCESS);
+}
+
+static sox_effect_handler_t sox_noisered_effect = {
+ "noisered",
+ "[profile-file [amount]]",
+ SOX_EFF_MCHAN|SOX_EFF_LENGTH,
+ sox_noisered_getopts,
+ sox_noisered_start,
+ sox_noisered_flow,
+ sox_noisered_drain,
+ sox_noisered_stop,
+ NULL, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_noisered_effect_fn(void)
+{
+ return &sox_noisered_effect;
+}
diff --git a/src/src/noisered.h b/src/src/noisered.h
new file mode 100644
index 0000000..1362f7e
--- /dev/null
+++ b/src/src/noisered.h
@@ -0,0 +1,26 @@
+/* noiseprof.h - Headers for SoX Noise Profiling Effect.
+ *
+ * Written by Ian Turner (vectro@vectro.org)
+ * Copyright 1999 Ian Turner and others
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <math.h>
+
+#define WINDOWSIZE 2048
+#define HALFWINDOW (WINDOWSIZE / 2)
+#define FREQCOUNT (HALFWINDOW + 1)
diff --git a/src/src/nulfile.c b/src/src/nulfile.c
new file mode 100644
index 0000000..9e697ff
--- /dev/null
+++ b/src/src/nulfile.c
@@ -0,0 +1,58 @@
+/* libSoX file format: null (c) 2006-8 SoX contributors
+ * Based on an original idea by Carsten Borchardt
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+static int startread(sox_format_t * ft)
+{
+ if (!ft->signal.rate) {
+ ft->signal.rate = SOX_DEFAULT_RATE;
+ lsx_report("sample rate not specified; using %g", ft->signal.rate);
+ }
+ ft->signal.precision = ft->encoding.bits_per_sample?
+ ft->encoding.bits_per_sample: SOX_SAMPLE_PRECISION;
+ /* Default number of channels is application-dependent */
+ return SOX_SUCCESS;
+}
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ /* Reading from null generates silence i.e. (sox_sample_t)0. */
+ (void)ft;
+ memset(buf, 0, sizeof(sox_sample_t) * len);
+ return len; /* Return number of samples "read". */
+}
+
+static size_t write_samples(
+ sox_format_t * ft, sox_sample_t const * buf, size_t len)
+{
+ /* Writing to null just discards the samples */
+ (void)ft, (void)buf;
+ return len; /* Return number of samples "written". */
+}
+
+LSX_FORMAT_HANDLER(nul)
+{
+ static const char * const names[] = {"null", NULL};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ NULL, names, SOX_FILE_DEVICE | SOX_FILE_PHONY | SOX_FILE_NOSTDIO,
+ startread, read_samples,NULL,NULL, write_samples,NULL,NULL, NULL, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/optional-fmts.am b/src/src/optional-fmts.am
new file mode 100644
index 0000000..f11b65a
--- /dev/null
+++ b/src/src/optional-fmts.am
@@ -0,0 +1,305 @@
+
+
+if HAVE_ALSA
+if STATIC_ALSA
+ libsox_la_SOURCES += alsa.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @ALSA_LIBS@
+else
+ libsox_la_LIBADD += @ALSA_LIBS@
+endif
+else
+ libsox_fmt_alsa_la_SOURCES = alsa.c
+ libsox_fmt_alsa_la_LIBADD = libsox.la @ALSA_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_alsa.la
+endif
+endif
+
+if HAVE_AMRNB
+if STATIC_AMRNB
+ libsox_la_SOURCES += amr-nb.c amr.h
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @AMRNB_LIBS@
+else
+ libsox_la_LIBADD += @AMRNB_LIBS@
+endif
+else
+ libsox_fmt_amr_nb_la_SOURCES = amr-nb.c amr.h
+ libsox_fmt_amr_nb_la_LIBADD = libsox.la @AMRNB_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_amr_nb.la
+endif
+endif
+
+if HAVE_AMRWB
+if STATIC_AMRWB
+ libsox_la_SOURCES += amr-wb.c amr.h
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @AMRWB_LIBS@
+else
+ libsox_la_LIBADD += @AMRWB_LIBS@
+endif
+else
+ libsox_fmt_amr_wb_la_SOURCES = amr-wb.c amr.h
+ libsox_fmt_amr_wb_la_LIBADD = libsox.la @AMRWB_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_amr_wb.la
+endif
+endif
+
+if HAVE_AO
+if STATIC_AO
+ libsox_la_SOURCES += ao.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @AO_LIBS@
+else
+ libsox_la_LIBADD += @AO_LIBS@
+endif
+else
+ libsox_fmt_ao_la_SOURCES = ao.c
+ libsox_fmt_ao_la_LIBADD = libsox.la @AO_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_ao.la
+endif
+endif
+
+if HAVE_COREAUDIO
+if STATIC_COREAUDIO
+ libsox_la_SOURCES += coreaudio.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @COREAUDIO_LIBS@
+else
+ libsox_la_LIBADD += @COREAUDIO_LIBS@
+endif
+else
+ libsox_fmt_coreaudio_la_SOURCES = coreaudio.c
+ libsox_fmt_coreaudio_la_LIBADD = libsox.la @COREAUDIO_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_coreaudio.la
+endif
+endif
+
+if HAVE_FLAC
+if STATIC_FLAC
+ libsox_la_SOURCES += flac.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @FLAC_LIBS@
+else
+ libsox_la_LIBADD += @FLAC_LIBS@
+endif
+else
+ libsox_fmt_flac_la_SOURCES = flac.c
+ libsox_fmt_flac_la_LIBADD = libsox.la @FLAC_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_flac.la
+endif
+endif
+
+if HAVE_GSM
+if STATIC_GSM
+ libsox_la_SOURCES += gsm.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @GSM_LIBS@
+else
+ libsox_la_LIBADD += @GSM_LIBS@
+endif
+else
+ libsox_fmt_gsm_la_SOURCES = gsm.c
+ libsox_fmt_gsm_la_LIBADD = libsox.la @GSM_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_gsm.la
+endif
+endif
+
+if HAVE_LPC10
+if STATIC_LPC10
+ libsox_la_SOURCES += lpc10.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @LPC10_LIBS@
+else
+ libsox_la_LIBADD += @LPC10_LIBS@
+endif
+else
+ libsox_fmt_lpc10_la_SOURCES = lpc10.c
+ libsox_fmt_lpc10_la_LIBADD = libsox.la @LPC10_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_lpc10.la
+endif
+endif
+
+if HAVE_MP3
+if STATIC_MP3
+ libsox_la_SOURCES += mp3.c mp3-util.h
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @MP3_LIBS@
+else
+ libsox_la_LIBADD += @MP3_LIBS@
+endif
+else
+ libsox_fmt_mp3_la_SOURCES = mp3.c mp3-util.h
+ libsox_fmt_mp3_la_LIBADD = libsox.la @MP3_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_mp3.la
+endif
+endif
+
+if HAVE_OPUS
+if STATIC_OPUS
+ libsox_la_SOURCES += opus.c
+ libsox_la_CFLAGS += @OPUS_CFLAGS@
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @OPUS_LIBS@
+else
+ libsox_la_LIBADD += @OPUS_LIBS@
+endif
+else
+ libsox_fmt_opus_la_SOURCES = opus.c
+ libsox_fmt_opus_la_CFLAGS = @OPUS_CFLAGS@
+ libsox_fmt_opus_la_LIBADD = libsox.la @OPUS_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_opus.la
+endif
+endif
+
+if HAVE_OSS
+if STATIC_OSS
+ libsox_la_SOURCES += oss.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @OSS_LIBS@
+else
+ libsox_la_LIBADD += @OSS_LIBS@
+endif
+else
+ libsox_fmt_oss_la_SOURCES = oss.c
+ libsox_fmt_oss_la_LIBADD = libsox.la @OSS_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_oss.la
+endif
+endif
+
+if HAVE_PULSEAUDIO
+if STATIC_PULSEAUDIO
+ libsox_la_SOURCES += pulseaudio.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @PULSEAUDIO_LIBS@
+else
+ libsox_la_LIBADD += @PULSEAUDIO_LIBS@
+endif
+else
+ libsox_fmt_pulseaudio_la_SOURCES = pulseaudio.c
+ libsox_fmt_pulseaudio_la_LIBADD = libsox.la @PULSEAUDIO_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_pulseaudio.la
+endif
+endif
+
+if HAVE_WAVEAUDIO
+if STATIC_WAVEAUDIO
+ libsox_la_SOURCES += waveaudio.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @WAVEAUDIO_LIBS@
+else
+ libsox_la_LIBADD += @WAVEAUDIO_LIBS@
+endif
+else
+ libsox_fmt_waveaudio_la_SOURCES = waveaudio.c
+ libsox_fmt_waveaudio_la_LIBADD = libsox.la @WAVEAUDIO_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_waveaudio.la
+endif
+endif
+
+if HAVE_SNDIO
+if STATIC_SNDIO
+ libsox_la_SOURCES += sndio.c
+ libsox_la_LIBADD += @SNDIO_LIBS@
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @SNDIO_LIBS@
+else
+ libsox_la_LIBADD += @SNDIO_LIBS@
+endif
+else
+ libsox_fmt_sndio_la_SOURCES = sndio.c
+ libsox_fmt_sndio_la_LIBADD = libsox.la @SNDIO_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_sndio.la
+endif
+endif
+
+if HAVE_SUN_AUDIO
+if STATIC_SUN_AUDIO
+ libsox_la_SOURCES += sunaudio.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @SUN_AUDIO_LIBS@
+else
+ libsox_la_LIBADD += @SUN_AUDIO_LIBS@
+endif
+else
+ libsox_fmt_sunau_la_SOURCES = sunaudio.c
+ libsox_fmt_sunau_la_LIBADD = libsox.la @SUN_AUDIO_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_sunau.la
+endif
+endif
+
+if HAVE_OGG_VORBIS
+if STATIC_OGG_VORBIS
+ libsox_la_SOURCES += vorbis.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @OGG_VORBIS_LIBS@
+else
+ libsox_la_LIBADD += @OGG_VORBIS_LIBS@
+endif
+else
+ libsox_fmt_vorbis_la_SOURCES = vorbis.c
+ libsox_fmt_vorbis_la_LIBADD = libsox.la @OGG_VORBIS_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_vorbis.la
+endif
+endif
+
+if HAVE_WAVPACK
+if STATIC_WAVPACK
+ libsox_la_SOURCES += wavpack.c
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @WAVPACK_LIBS@
+else
+ libsox_la_LIBADD += @WAVPACK_LIBS@
+endif
+else
+ libsox_fmt_wavpack_la_SOURCES = wavpack.c
+ libsox_fmt_wavpack_la_LIBADD = libsox.la @WAVPACK_LIBS@
+ pkglib_LTLIBRARIES += libsox_fmt_wavpack.la
+endif
+endif
+
+
+if HAVE_SNDFILE
+if STATIC_SNDFILE
+ libsox_la_SOURCES += sndfile.c caf.c mat4.c mat5.c paf.c fap.c w64.c xi.c pvf.c sd2.c
+ libsox_la_CFLAGS += @SNDFILE_CFLAGS@
+if STATIC_LIBSOX_ONLY
+ sox_LDADD += @SNDFILE_LIBS@
+else
+ libsox_la_LIBADD += @SNDFILE_LIBS@
+endif
+else
+libsox_fmt_sndfile_la_SOURCES = sndfile.c
+libsox_fmt_sndfile_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_sndfile_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_caf_la_SOURCES = caf.c sndfile.c
+libsox_fmt_caf_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_caf_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_mat4_la_SOURCES = mat4.c sndfile.c
+libsox_fmt_mat4_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_mat4_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_mat5_la_SOURCES = mat5.c sndfile.c
+libsox_fmt_mat5_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_mat5_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_paf_la_SOURCES = paf.c sndfile.c
+libsox_fmt_paf_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_paf_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_fap_la_SOURCES = fap.c sndfile.c
+libsox_fmt_fap_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_fap_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_w64_la_SOURCES = w64.c sndfile.c
+libsox_fmt_w64_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_w64_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_xi_la_SOURCES = xi.c sndfile.c
+libsox_fmt_wi_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_xi_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_pvf_la_SOURCES = pvf.c sndfile.c
+libsox_fmt_pvf_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_pvf_la_LIBADD = libsox.la @SNDFILE_LIBS@
+libsox_fmt_sd2_la_SOURCES = sd2.c sndfile.c
+libsox_fmt_sd2_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@
+libsox_fmt_sd2_la_LIBADD = libsox.la @SNDFILE_LIBS@
+pkglib_LTLIBRARIES += libsox_fmt_sndfile.la libsox_fmt_caf.la libsox_fmt_mat4.la libsox_fmt_mat5.la libsox_fmt_paf.la libsox_fmt_fap.la libsox_fmt_w64.la libsox_fmt_xi.la libsox_fmt_pvf.la libsox_fmt_sd2.la
+endif
+endif
+
diff --git a/src/src/opus.c b/src/src/opus.c
new file mode 100644
index 0000000..e0f3cf5
--- /dev/null
+++ b/src/src/opus.c
@@ -0,0 +1,235 @@
+/* libSoX Opus-in-Ogg sound format handler
+ * Copyright (C) 2013 John Stumpo <stump@jstump.com>
+ *
+ * Largely based on vorbis.c:
+ * libSoX Ogg Vorbis sound format handler
+ * Copyright 2001, Stan Seibert <indigo@aztec.asu.edu>
+ *
+ * Portions from oggenc, (c) Michael Smith <msmith@labyrinth.net.au>,
+ * ogg123, (c) Kenneth Arnold <kcarnold@yahoo.com>, and
+ * libvorbisfile (c) Xiphophorus Company
+ *
+ * May 9, 2001 - Stan Seibert (indigo@aztec.asu.edu)
+ * Ogg Vorbis handler initially written.
+ *
+ * July 5, 1991 - Skeleton file
+ * Copyright 1991 Lance Norskog And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <opusfile.h>
+
+#define DEF_BUF_LEN 4096
+
+#define BUF_ERROR -1
+#define BUF_EOF 0
+#define BUF_DATA 1
+
+typedef struct {
+ /* Decoding data */
+ OggOpusFile *of;
+ char *buf;
+ size_t buf_len;
+ size_t start;
+ size_t end; /* Unsent data samples in buf[start] through buf[end-1] */
+ int current_section;
+ int eof;
+} priv_t;
+
+/******** Callback functions used in op_open_callbacks ************/
+
+static int callback_read(void* ft_data, unsigned char* ptr, int nbytes)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ return lsx_readbuf(ft, ptr, (size_t)nbytes);
+}
+
+static int callback_seek(void* ft_data, opus_int64 off, int whence)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ int ret = ft->seekable ? lsx_seeki(ft, (off_t)off, whence) : -1;
+
+ if (ret == EBADF)
+ ret = -1;
+ return ret;
+}
+
+static int callback_close(void* ft_data UNUSED)
+{
+ /* Do nothing so sox can close the file for us */
+ return 0;
+}
+
+static opus_int64 callback_tell(void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ return lsx_tell(ft);
+}
+
+/********************* End callbacks *****************************/
+
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int startread(sox_format_t * ft)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ const OpusTags *ot;
+ int i;
+
+ OpusFileCallbacks callbacks = {
+ callback_read,
+ callback_seek,
+ callback_tell,
+ callback_close
+ };
+
+ /* Init the decoder */
+ vb->of = op_open_callbacks(ft, &callbacks, NULL, (size_t) 0, NULL);
+ if (vb->of == NULL) {
+ lsx_fail_errno(ft, SOX_EHDR, "Input not an Ogg Opus audio stream");
+ return (SOX_EOF);
+ }
+
+ /* Get info about the Opus stream */
+ ot = op_tags(vb->of, -1);
+
+ /* Record audio info */
+ ft->signal.rate = 48000; /* libopusfile always uses 48 kHz */
+ ft->encoding.encoding = SOX_ENCODING_OPUS;
+ ft->signal.channels = op_channel_count(vb->of, -1);
+
+ /* op_pcm_total doesn't work on non-seekable files so
+ * skip that step in that case. Also, it reports
+ * "frame"-ish results so we must * channels.
+ */
+ if (ft->seekable)
+ ft->signal.length = op_pcm_total(vb->of, -1) * ft->signal.channels;
+
+ /* Record comments */
+ for (i = 0; i < ot->comments; i++)
+ sox_append_comment(&ft->oob.comments, ot->user_comments[i]);
+
+ /* Setup buffer */
+ vb->buf_len = DEF_BUF_LEN;
+ vb->buf_len -= vb->buf_len % (ft->signal.channels*2); /* 2 bytes per sample */
+ vb->buf = lsx_calloc(vb->buf_len, sizeof(char));
+ vb->start = vb->end = 0;
+
+ /* Fill in other info */
+ vb->eof = 0;
+ vb->current_section = -1;
+
+ return (SOX_SUCCESS);
+}
+
+
+/* Refill the buffer with samples. Returns BUF_EOF if the end of the
+ * Opus data was reached while the buffer was being filled,
+ * BUF_ERROR is something bad happens, and BUF_DATA otherwise */
+static int refill_buffer(sox_format_t * ft)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ int num_read;
+
+ if (vb->start == vb->end) /* Samples all played */
+ vb->start = vb->end = 0;
+
+ while (vb->end < vb->buf_len) {
+ num_read = op_read(vb->of, (opus_int16*) (vb->buf + vb->end),
+ (int) ((vb->buf_len - vb->end) / sizeof(opus_int16)),
+ &vb->current_section);
+ if (num_read == 0)
+ return (BUF_EOF);
+ else if (num_read == OP_HOLE)
+ lsx_warn("Warning: hole in stream; probably harmless");
+ else if (num_read < 0)
+ return (BUF_ERROR);
+ else
+ vb->end += num_read * sizeof(opus_int16) * ft->signal.channels;
+ }
+ return (BUF_DATA);
+}
+
+
+/*
+ * Read up to len samples from file.
+ * Convert to signed longs.
+ * Place in buf[].
+ * Return number of samples read.
+ */
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ size_t i;
+ int ret;
+ sox_sample_t l;
+
+
+ for (i = 0; i < len; i++) {
+ if (vb->start == vb->end) {
+ if (vb->eof)
+ break;
+ ret = refill_buffer(ft);
+ if (ret == BUF_EOF || ret == BUF_ERROR) {
+ vb->eof = 1;
+ if (vb->end == 0)
+ break;
+ }
+ }
+
+ l = (vb->buf[vb->start + 1] << 24)
+ | (0xffffff & (vb->buf[vb->start] << 16));
+ *(buf + i) = l;
+ vb->start += 2;
+ }
+ return i;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * Don't close input file!
+ */
+static int stopread(sox_format_t * ft)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+
+ free(vb->buf);
+ op_free(vb->of);
+
+ return (SOX_SUCCESS);
+}
+
+static int seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+
+ return op_pcm_seek(vb->of, (opus_int64)(offset / ft->signal.channels))? SOX_EOF:SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(opus)
+{
+ static const char *const names[] = {"opus", NULL};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Xiph.org's Opus lossy compression", names, 0,
+ startread, read_samples, stopread,
+ NULL, NULL, NULL,
+ seek, NULL, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/oss.c b/src/src/oss.c
new file mode 100644
index 0000000..0ffe40c
--- /dev/null
+++ b/src/src/oss.c
@@ -0,0 +1,457 @@
+/* Copyright 1997 Chris Bagwell And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Chris Bagwell And Sundry Contributors are not
+ * responsible for the consequences of using this software.
+ *
+ * Direct to Open Sound System (OSS) sound driver
+ * OSS is a popular unix sound driver for Intel x86 unices (eg. Linux)
+ * and several other unixes (such as SunOS/Solaris).
+ * This driver is compatible with OSS original source that was called
+ * USS, Voxware and TASD.
+ *
+ * added by Chris Bagwell (cbagwell@sprynet.com) on 2/19/96
+ * based on info grabed from vplay.c in Voxware snd-utils-3.5 package.
+ * and on LINUX_PLAYER patches added by Greg Lee
+ * which was originally from Directo to Sound Blaster device driver (sbdsp.c).
+ * SBLAST patches by John T. Kohl.
+ *
+ * Changes:
+ *
+ * Nov. 26, 1999 Stan Brooks <stabro@megsinet.net>
+ * Moved initialization code common to startread and startwrite
+ * into a single function ossdspinit().
+ *
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#ifdef HAVE_SYS_SOUNDCARD_H
+ #include <sys/soundcard.h>
+#endif
+#ifdef HAVE_MACHINE_SOUNDCARD_H
+ #include <machine/soundcard.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/* these appear in the sys/soundcard.h of OSS 4.x, and in Linux's
+ * sound/core/oss/pcm_oss.c (2.6.24 and later), but are typically
+ * not included in system header files.
+ */
+#ifndef AFMT_S32_LE
+#define AFMT_S32_LE 0x00001000
+#endif
+#ifndef AFMT_S32_BE
+#define AFMT_S32_BE 0x00002000
+#endif
+
+#include <sys/ioctl.h>
+
+typedef struct
+{
+ char* pOutput;
+ unsigned cOutput;
+ int device;
+ unsigned sample_shift;
+} priv_t;
+
+/* common r/w initialization code */
+static int ossinit(sox_format_t* ft)
+{
+ int sampletype, samplesize, dsp_stereo;
+ int tmp, rc;
+ char const* szDevname;
+ priv_t* pPriv = (priv_t*)ft->priv;
+
+ if (ft->filename == 0 || ft->filename[0] == 0 || !strcasecmp("default", ft->filename))
+ {
+ szDevname = getenv("OSS_AUDIODEV");
+ if (szDevname != NULL)
+ {
+ lsx_report("Using device name from OSS_AUDIODEV environment variable: %s", szDevname);
+ }
+ else
+ {
+ szDevname = "/dev/dsp";
+ lsx_report("Using default OSS device name: %s", szDevname);
+ }
+ }
+ else
+ {
+ szDevname = ft->filename;
+ lsx_report("Using user-specified device name: %s", szDevname);
+ }
+
+ pPriv->device = open(
+ szDevname,
+ ft->mode == 'r' ? O_RDONLY : O_WRONLY);
+ if (pPriv->device < 0) {
+ lsx_fail_errno(ft, errno, "open failed for device: %s", szDevname);
+ return SOX_EOF;
+ }
+
+ if (ft->encoding.bits_per_sample == 8) {
+ sampletype = AFMT_U8;
+ samplesize = 8;
+ pPriv->sample_shift = 0;
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
+ if (ft->encoding.encoding != SOX_ENCODING_UNSIGNED) {
+ lsx_report("OSS driver only supports unsigned with bytes");
+ lsx_report("Forcing to unsigned");
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
+ }
+ }
+ else if (ft->encoding.bits_per_sample == 16) {
+ /* Attempt to use endian that user specified */
+ if (ft->encoding.reverse_bytes)
+ sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S16_LE : AFMT_S16_BE;
+ else
+ sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S16_BE : AFMT_S16_LE;
+ samplesize = 16;
+ pPriv->sample_shift = 1;
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ if (ft->encoding.encoding != SOX_ENCODING_SIGN2) {
+ lsx_report("OSS driver only supports signed with words");
+ lsx_report("Forcing to signed linear");
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ }
+ }
+ else if (ft->encoding.bits_per_sample == 32) {
+ /* Attempt to use endian that user specified */
+ if (ft->encoding.reverse_bytes)
+ sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S32_LE : AFMT_S32_BE;
+ else
+ sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S32_BE : AFMT_S32_LE;
+ samplesize = 32;
+ pPriv->sample_shift = 2;
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ if (ft->encoding.encoding != SOX_ENCODING_SIGN2) {
+ lsx_report("OSS driver only supports signed with words");
+ lsx_report("Forcing to signed linear");
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ }
+ }
+ else {
+ /* Attempt to use endian that user specified */
+ if (ft->encoding.reverse_bytes)
+ sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S16_LE : AFMT_S16_BE;
+ else
+ sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S16_BE : AFMT_S16_LE;
+ samplesize = 16;
+ pPriv->sample_shift = 1;
+ ft->encoding.bits_per_sample = 16;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ lsx_report("OSS driver only supports bytes and words");
+ lsx_report("Forcing to signed linear word");
+ }
+
+ if (ft->signal.channels > 2) ft->signal.channels = 2;
+
+ if (ioctl(pPriv->device, (size_t) SNDCTL_DSP_RESET, 0) < 0)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Unable to reset OSS device %s. Possibly accessing an invalid file/device", szDevname);
+ return(SOX_EOF);
+ }
+
+ /* Query the supported formats and find the best match
+ */
+ rc = ioctl(pPriv->device, SNDCTL_DSP_GETFMTS, &tmp);
+ if (rc == 0) {
+ if ((tmp & sampletype) == 0)
+ {
+ /* is 16-bit supported? */
+ if (samplesize == 16 && (tmp & (AFMT_S16_LE|AFMT_S16_BE)) == 0)
+ {
+ /* Must not like 16-bits, try 8-bits */
+ ft->encoding.bits_per_sample = 8;
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
+ lsx_report("OSS driver doesn't like signed words");
+ lsx_report("Forcing to unsigned bytes");
+ tmp = sampletype = AFMT_U8;
+ samplesize = 8;
+ pPriv->sample_shift = 0;
+ }
+ /* is 8-bit supported */
+ else if (samplesize == 8 && (tmp & AFMT_U8) == 0)
+ {
+ ft->encoding.bits_per_sample = 16;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ lsx_report("OSS driver doesn't like unsigned bytes");
+ lsx_report("Forcing to signed words");
+ sampletype = (MACHINE_IS_BIGENDIAN) ? AFMT_S16_BE : AFMT_S16_LE;
+ samplesize = 16;
+ pPriv->sample_shift = 1;
+ }
+ /* determine which 16-bit format to use */
+ if (samplesize == 16 && (tmp & sampletype) == 0)
+ {
+ /* Either user requested something not supported
+ * or hardware doesn't support machine endian.
+ * Force to opposite as the above test showed
+ * it supports at least one of the two endians.
+ */
+ sampletype = (sampletype == AFMT_S16_BE) ? AFMT_S16_LE : AFMT_S16_BE;
+ ft->encoding.reverse_bytes = !ft->encoding.reverse_bytes;
+ }
+
+ }
+ tmp = sampletype;
+ rc = ioctl(pPriv->device, SNDCTL_DSP_SETFMT, &tmp);
+ }
+ /* Give up and exit */
+ if (rc < 0 || tmp != sampletype)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Unable to set the sample size to %d", samplesize);
+ return (SOX_EOF);
+ }
+
+ if (ft->signal.channels == 2)
+ dsp_stereo = 1;
+ else
+ dsp_stereo = 0;
+
+ tmp = dsp_stereo;
+ if (ioctl(pPriv->device, SNDCTL_DSP_STEREO, &tmp) < 0)
+ {
+ lsx_warn("Couldn't set to %s", dsp_stereo? "stereo":"mono");
+ dsp_stereo = 0;
+ }
+
+ if (tmp != dsp_stereo)
+ ft->signal.channels = tmp + 1;
+
+ tmp = ft->signal.rate;
+ if (ioctl(pPriv->device, SNDCTL_DSP_SPEED, &tmp) < 0 ||
+ (int)ft->signal.rate != tmp) {
+ /* If the rate the sound card is using is not within 1% of what
+ * the user specified then override the user setting.
+ * The only reason not to always override this is because of
+ * clock-rounding problems. Sound cards will sometimes use
+ * things like 44101 when you ask for 44100. No need overriding
+ * this and having strange output file rates for something that
+ * we can't hear anyways.
+ */
+ if ((int)ft->signal.rate - tmp > (tmp * .01) ||
+ tmp - (int)ft->signal.rate > (tmp * .01))
+ ft->signal.rate = tmp;
+ }
+
+ if (ioctl(pPriv->device, (size_t) SNDCTL_DSP_SYNC, NULL) < 0) {
+ lsx_fail_errno(ft,SOX_EOF,"Unable to sync dsp");
+ return (SOX_EOF);
+ }
+
+ if (ft->mode == 'r') {
+ pPriv->cOutput = 0;
+ pPriv->pOutput = NULL;
+ } else {
+ size_t cbOutput = sox_globals.bufsiz;
+ pPriv->cOutput = cbOutput >> pPriv->sample_shift;
+ pPriv->pOutput = lsx_malloc(cbOutput);
+ }
+
+ return(SOX_SUCCESS);
+}
+
+static int ossstop(sox_format_t* ft)
+{
+ priv_t* pPriv = (priv_t*)ft->priv;
+ if (pPriv->device >= 0) {
+ close(pPriv->device);
+ }
+ if (pPriv->pOutput) {
+ free(pPriv->pOutput);
+ }
+ return SOX_SUCCESS;
+}
+
+static size_t ossread(sox_format_t* ft, sox_sample_t* pOutput, size_t cOutput)
+{
+ priv_t* pPriv = (priv_t*)ft->priv;
+ char* pbOutput = (char*)pOutput;
+ size_t cbOutputLeft = cOutput << pPriv->sample_shift;
+ size_t i, cRead;
+ int cbRead;
+ SOX_SAMPLE_LOCALS;
+ LSX_USE_VAR(sox_macro_temp_double);
+
+ while (cbOutputLeft) {
+ cbRead = read(pPriv->device, pbOutput, cbOutputLeft);
+ if (cbRead <= 0) {
+ if (cbRead < 0) {
+ lsx_fail_errno(ft, errno, "Error reading from device");
+ return 0;
+ }
+ break;
+ }
+ cbOutputLeft -= cbRead;
+ pbOutput += cbRead;
+ }
+
+ /* Convert in-place (backwards) */
+ cRead = cOutput - (cbOutputLeft >> pPriv->sample_shift);
+ if (ft->encoding.reverse_bytes) {
+ switch (pPriv->sample_shift)
+ {
+ case 0:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_UNSIGNED_8BIT_TO_SAMPLE(
+ ((sox_uint8_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ case 1:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_SIGNED_16BIT_TO_SAMPLE(
+ lsx_swapw(((sox_int16_t*)pOutput)[i - 1]),
+ dummy);
+ }
+ break;
+ case 2:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_SIGNED_32BIT_TO_SAMPLE(
+ lsx_swapdw(((sox_int32_t*)pOutput)[i - 1]),
+ dummy);
+ }
+ break;
+ }
+ } else {
+ switch (pPriv->sample_shift)
+ {
+ case 0:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_UNSIGNED_8BIT_TO_SAMPLE(
+ ((sox_uint8_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ case 1:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_SIGNED_16BIT_TO_SAMPLE(
+ ((sox_int16_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ case 2:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_SIGNED_32BIT_TO_SAMPLE(
+ ((sox_int32_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ }
+ }
+
+ return cRead;
+}
+
+static size_t osswrite(
+ sox_format_t* ft,
+ const sox_sample_t* pInput,
+ size_t cInput)
+{
+ priv_t* pPriv = (priv_t*)ft->priv;
+ size_t cInputRemaining = cInput;
+ unsigned cClips = 0;
+ SOX_SAMPLE_LOCALS;
+
+ while (cInputRemaining) {
+ size_t cStride;
+ size_t i;
+ size_t cbStride;
+ int cbWritten;
+
+ cStride = cInput;
+ if (cStride > pPriv->cOutput) {
+ cStride = pPriv->cOutput;
+ }
+
+ if (ft->encoding.reverse_bytes)
+ {
+ switch (pPriv->sample_shift)
+ {
+ case 0:
+ for (i = 0; i != cStride; i++) {
+ ((sox_uint8_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_UNSIGNED_8BIT(pInput[i], cClips);
+ }
+ break;
+ case 1:
+ for (i = 0; i != cStride; i++) {
+ sox_int16_t s16 = SOX_SAMPLE_TO_SIGNED_16BIT(pInput[i], cClips);
+ ((sox_int16_t*)pPriv->pOutput)[i] = lsx_swapw(s16);
+ }
+ break;
+ case 2:
+ for (i = 0; i != cStride; i++) {
+ ((sox_int32_t*)pPriv->pOutput)[i] =
+ lsx_swapdw(SOX_SAMPLE_TO_SIGNED_32BIT(pInput[i], cClips));
+ }
+ break;
+ }
+ } else {
+ switch (pPriv->sample_shift)
+ {
+ case 0:
+ for (i = 0; i != cStride; i++) {
+ ((sox_uint8_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_UNSIGNED_8BIT(pInput[i], cClips);
+ }
+ break;
+ case 1:
+ for (i = 0; i != cStride; i++) {
+ ((sox_int16_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_SIGNED_16BIT(pInput[i], cClips);
+ }
+ break;
+ case 2:
+ for (i = 0; i != cStride; i++) {
+ ((sox_int32_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_SIGNED_32BIT(pInput[i], cClips);
+ }
+ break;
+ }
+ }
+
+ cbStride = cStride << pPriv->sample_shift;
+ i = 0;
+ do {
+ cbWritten = write(pPriv->device, &pPriv->pOutput[i], cbStride - i);
+ i += cbWritten;
+ if (cbWritten <= 0) {
+ lsx_fail_errno(ft, errno, "Error writing to device");
+ return 0;
+ }
+ } while (i != cbStride);
+
+ cInputRemaining -= cStride;
+ pInput += cStride;
+ }
+
+ return cInput;
+}
+
+LSX_FORMAT_HANDLER(oss)
+{
+ static char const* const names[] = {"ossdsp", "oss", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 32, 16, 0,
+ SOX_ENCODING_UNSIGNED, 8, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Open Sound System device driver for unix-like systems",
+ names, SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ ossinit, ossread, ossstop,
+ ossinit, osswrite, ossstop,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/output.c b/src/src/output.c
new file mode 100644
index 0000000..fa6baba
--- /dev/null
+++ b/src/src/output.c
@@ -0,0 +1,59 @@
+/* libSoX effect: Output audio to a file (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {sox_format_t * file;} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (argc != 2 || !(p->file = (sox_format_t *)argv[1]) || p->file->mode != 'w')
+ return SOX_EOF;
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t *effp, sox_sample_t const * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ /* Write out *isamp samples */
+ size_t len = sox_write(p->file, ibuf, *isamp);
+
+ /* len is the number of samples that were actually written out; if this is
+ * different to *isamp, then something has gone wrong--most often, it's
+ * out of disc space */
+ if (len != *isamp) {
+ lsx_fail("%s: %s", p->file->filename, p->file->sox_errstr);
+ return SOX_EOF;
+ }
+
+ /* Outputting is the last `effect' in the effect chain so always passes
+ * 0 samples on to the next effect (as there isn't one!) */
+ (void)obuf, *osamp = 0;
+ return SOX_SUCCESS; /* All samples output successfully */
+}
+
+sox_effect_handler_t const * lsx_output_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "output", NULL, SOX_EFF_MCHAN | SOX_EFF_INTERNAL,
+ getopts, NULL, flow, NULL, NULL, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
+
diff --git a/src/src/overdrive.c b/src/src/overdrive.c
new file mode 100644
index 0000000..f16b438
--- /dev/null
+++ b/src/src/overdrive.c
@@ -0,0 +1,71 @@
+/* libSoX effect: Overdrive (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {
+ double gain, colour, last_in, last_out, b0, b1, a1;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ --argc, ++argv;
+ p->gain = p->colour = 20;
+ do {
+ NUMERIC_PARAMETER(gain, 0, 100)
+ NUMERIC_PARAMETER(colour, 0, 100)
+ } while (0);
+ p->gain = dB_to_linear(p->gain);
+ p->colour /= 200;
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ if (p->gain == 1)
+ return SOX_EFF_NULL;
+
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t dummy = 0, len = *isamp = *osamp = min(*isamp, *osamp);
+ while (len--) {
+ SOX_SAMPLE_LOCALS;
+ double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf++, dummy), d0 = d;
+ d *= p->gain;
+ d += p->colour;
+ d = d < -1? -2./3 : d > 1? 2./3 : d - d * d * d * (1./3);
+ p->last_out = d - p->last_in + .995 * p->last_out;
+ p->last_in = d;
+ *obuf++ = SOX_FLOAT_64BIT_TO_SAMPLE(d0 * .5 + p->last_out * .75, dummy);
+ }
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_overdrive_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"overdrive", "[gain [colour]]",
+ SOX_EFF_GAIN, create, start, flow, NULL, NULL, NULL, sizeof(priv_t)};
+ return &handler;
+}
diff --git a/src/src/pad.c b/src/src/pad.c
new file mode 100644
index 0000000..18d3538
--- /dev/null
+++ b/src/src/pad.c
@@ -0,0 +1,180 @@
+/* libSoX effect: Pad With Silence (c) 2006 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {
+ unsigned npads; /* Number of pads requested */
+ struct {
+ char * str; /* Command-line argument to parse for this pad */
+ uint64_t start; /* Start padding when in_pos equals this */
+ uint64_t pad; /* Number of samples to pad */
+ } * pads;
+
+ uint64_t in_pos; /* Number of samples read from the input stream */
+ unsigned pads_pos; /* Number of pads completed so far */
+ uint64_t pad_pos; /* Number of samples through the current pad */
+} priv_t;
+
+static int parse(sox_effect_t * effp, char * * argv, sox_rate_t rate)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ char const * next;
+ unsigned i;
+ uint64_t last_seen = 0;
+ const uint64_t in_length = argv ? 0 :
+ (effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN);
+
+ for (i = 0; i < p->npads; ++i) {
+ if (argv) /* 1st parse only */
+ p->pads[i].str = lsx_strdup(argv[i]);
+ next = lsx_parsesamples(rate, p->pads[i].str, &p->pads[i].pad, 't');
+ if (next == NULL) break;
+ if (*next == '\0')
+ p->pads[i].start = i? UINT64_MAX : 0;
+ else {
+ if (*next != '@') break;
+ next = lsx_parseposition(rate, next+1, argv ? NULL : &p->pads[i].start,
+ last_seen, in_length, '=');
+ if (next == NULL || *next != '\0') break;
+ last_seen = p->pads[i].start;
+ if (p->pads[i].start == SOX_UNKNOWN_LEN)
+ p->pads[i].start = UINT64_MAX; /* currently the same value, but ... */
+ }
+ if (!argv) {
+ /* Do this check only during the second pass when the actual
+ sample rate is known, otherwise it might fail on legal
+ commands like
+ pad 1@0.5 1@30000s
+ if the rate is, e.g., 48k. */
+ if (i > 0 && p->pads[i].start <= p->pads[i-1].start) break;
+ }
+ }
+ if (i < p->npads)
+ return lsx_usage(effp);
+ return SOX_SUCCESS;
+}
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ --argc, ++argv;
+ p->npads = argc;
+ p->pads = lsx_calloc(p->npads, sizeof(*p->pads));
+ return parse(effp, argv, 1e5); /* No rate yet; parse with dummy */
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+
+ /* Re-parse now rate is known */
+ if (parse(effp, 0, effp->in_signal.rate) != SOX_SUCCESS)
+ return SOX_EOF;
+
+ if ((effp->out_signal.length = effp->in_signal.length) != SOX_UNKNOWN_LEN) {
+ for (i = 0; i < p->npads; ++i)
+ effp->out_signal.length +=
+ p->pads[i].pad * effp->in_signal.channels;
+
+ /* Check that the last pad position (except for "at the end")
+ is within bounds. */
+ i = p->npads;
+ if (i > 0 && p->pads[i-1].start == UINT64_MAX)
+ i--;
+ if (i > 0 &&
+ p->pads[i-1].start * effp->in_signal.channels
+ > effp->in_signal.length)
+ {
+ lsx_fail("pad position after end of audio");
+ return SOX_EOF;
+ }
+ }
+
+ p->in_pos = p->pad_pos = p->pads_pos = 0;
+ for (i = 0; i < p->npads; ++i)
+ if (p->pads[i].pad)
+ return SOX_SUCCESS;
+ return SOX_EFF_NULL;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t c, idone = 0, odone = 0;
+ *isamp /= effp->in_signal.channels;
+ *osamp /= effp->in_signal.channels;
+
+ do {
+ /* Copying: */
+ for (; idone < *isamp && odone < *osamp && !(p->pads_pos != p->npads && p->in_pos == p->pads[p->pads_pos].start); ++idone, ++odone, ++p->in_pos)
+ for (c = 0; c < effp->in_signal.channels; ++c) *obuf++ = *ibuf++;
+
+ /* Padding: */
+ if (p->pads_pos != p->npads && p->in_pos == p->pads[p->pads_pos].start) {
+ for (; odone < *osamp && p->pad_pos < p->pads[p->pads_pos].pad; ++odone, ++p->pad_pos)
+ for (c = 0; c < effp->in_signal.channels; ++c) *obuf++ = 0;
+ if (p->pad_pos == p->pads[p->pads_pos].pad) { /* Move to next pad? */
+ ++p->pads_pos;
+ p->pad_pos = 0;
+ }
+ }
+ } while (idone < *isamp && odone < *osamp);
+
+ *isamp = idone * effp->in_signal.channels;
+ *osamp = odone * effp->in_signal.channels;
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ static size_t isamp = 0;
+ if (p->pads_pos != p->npads && p->in_pos != p->pads[p->pads_pos].start)
+ p->in_pos = UINT64_MAX; /* Invoke the final pad (with no given start) */
+ return flow(effp, 0, obuf, &isamp, osamp);
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (p->pads_pos != p->npads)
+ lsx_warn("Input audio too short; pads not applied: %u", p->npads-p->pads_pos);
+ return SOX_SUCCESS;
+}
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+ for (i = 0; i < p->npads; ++i)
+ free(p->pads[i].str);
+ free(p->pads);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_pad_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "pad", "{length[@position]}", SOX_EFF_MCHAN|SOX_EFF_LENGTH|SOX_EFF_MODIFY,
+ create, start, flow, drain, stop, lsx_kill, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/paf.c b/src/src/paf.c
new file mode 100644
index 0000000..582b1f6
--- /dev/null
+++ b/src/src/paf.c
@@ -0,0 +1,35 @@
+/* libSoX file format: PAF Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(paf)
+{
+ static char const * const names[] = {"paf", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 24, 16, 8,0,0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description =
+ "Ensoniq PARIS digitial audio editing system (big endian)";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/phaser.c b/src/src/phaser.c
new file mode 100644
index 0000000..fcacaf8
--- /dev/null
+++ b/src/src/phaser.c
@@ -0,0 +1,147 @@
+/* Effect: phaser Copyright (C) 1998 Juergen Mueller And Sundry Contributors
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Juergen Mueller And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ * Flow diagram scheme: August 24, 1998
+ *
+ * * gain-in +---+ * gain-out
+ * ibuff ----------->| |----------------------------------> obuff
+ * | + | * decay
+ * | |<------------+
+ * +---+ _______ |
+ * | | | |
+ * +---| delay |---+
+ * |_______|
+ * /|\
+ * |
+ * +---------------+ +------------------+
+ * | Delay control |<-----| modulation speed |
+ * +---------------+ +------------------+
+ *
+ * The delay is controled by a sine or triangle modulation.
+ *
+ * Usage:
+ * phaser gain-in gain-out delay decay speed [ -s | -t ]
+ *
+ * Where:
+ * gain-in, decay : 0.0 .. 1.0 volume
+ * gain-out : 0.0 .. volume
+ * delay : 0.0 .. 5.0 msec
+ * speed : 0.1 .. 2.0 Hz modulation speed
+ * -s : modulation by sine (default)
+ * -t : modulation by triangle
+ *
+ * Note:
+ * When decay is close to 1.0, the samples may begin clipping or the output
+ * can saturate! Hint:
+ * in-gain < (1 - decay * decay)
+ * 1 / out-gain > gain-in / (1 - decay)
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef struct {
+ double in_gain, out_gain, delay_ms, decay, mod_speed;
+ lsx_wave_t mod_type;
+
+ int * mod_buf;
+ size_t mod_buf_len;
+ int mod_pos;
+
+ double * delay_buf;
+ size_t delay_buf_len;
+ int delay_pos;
+} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ char chars[2];
+
+ /* Set non-zero defaults: */
+ p->in_gain = .4;
+ p->out_gain = .74;
+ p->delay_ms = 3.;
+ p->decay = .4;
+ p->mod_speed = .5;
+
+ --argc, ++argv;
+ do { /* break-able block */
+ NUMERIC_PARAMETER(in_gain , .0, 1)
+ NUMERIC_PARAMETER(out_gain , .0, 1e9)
+ NUMERIC_PARAMETER(delay_ms , .0, 5)
+ NUMERIC_PARAMETER(decay , .0, .99)
+ NUMERIC_PARAMETER(mod_speed, .1, 2)
+ } while (0);
+
+ if (argc && sscanf(*argv, "-%1[st]%c", chars, chars + 1) == 1) {
+ p->mod_type = *chars == 's'? SOX_WAVE_SINE : SOX_WAVE_TRIANGLE;
+ --argc, ++argv;
+ }
+
+ if (p->in_gain > (1 - p->decay * p->decay))
+ lsx_warn("warning: gain-in might cause clipping");
+ if (p->in_gain / (1 - p->decay) > 1 / p->out_gain)
+ lsx_warn("warning: gain-out might cause clipping");
+
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+
+ p->delay_buf_len = p->delay_ms * .001 * effp->in_signal.rate + .5;
+ p->delay_buf = lsx_calloc(p->delay_buf_len, sizeof(*p->delay_buf));
+
+ p->mod_buf_len = effp->in_signal.rate / p->mod_speed + .5;
+ p->mod_buf = lsx_malloc(p->mod_buf_len * sizeof(*p->mod_buf));
+ lsx_generate_wave_table(p->mod_type, SOX_INT, p->mod_buf, p->mod_buf_len,
+ 1., (double)p->delay_buf_len, M_PI_2);
+
+ p->delay_pos = p->mod_pos = 0;
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* TODO: calculate actual length */
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t *ibuf,
+ sox_sample_t *obuf, size_t *isamp, size_t *osamp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ size_t len = *isamp = *osamp = min(*isamp, *osamp);
+
+ while (len--) {
+ double d = *ibuf++ * p->in_gain + p->delay_buf[
+ (p->delay_pos + p->mod_buf[p->mod_pos]) % p->delay_buf_len] * p->decay;
+ p->mod_pos = (p->mod_pos + 1) % p->mod_buf_len;
+
+ p->delay_pos = (p->delay_pos + 1) % p->delay_buf_len;
+ p->delay_buf[p->delay_pos] = d;
+
+ *obuf++ = SOX_ROUND_CLIP_COUNT(d * p->out_gain, effp->clips);
+ }
+ return SOX_SUCCESS;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+
+ free(p->delay_buf);
+ free(p->mod_buf);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_phaser_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "phaser", "gain-in gain-out delay decay speed [ -s | -t ]",
+ SOX_EFF_LENGTH | SOX_EFF_GAIN, getopts, start, flow, NULL, stop, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/prc.c b/src/src/prc.c
new file mode 100644
index 0000000..7d752bc
--- /dev/null
+++ b/src/src/prc.c
@@ -0,0 +1,449 @@
+/* Psion Record format (format of sound files used for EPOC machines).
+ * The file normally has no extension, so SoX uses .prc (Psion ReCord).
+ * Based (heavily) on the wve.c format file.
+ * Hacked by Bert van Leeuwen (bert@e.co.za)
+ *
+ * Header check improved, ADPCM encoding added, and other improvements
+ * by Reuben Thomas <rrt@sc3d.org>, using file format info at
+ * http://software.frodo.looijaard.name/psiconv/formats/
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Includes code for ADPCM framing based on code carrying the
+ * following copyright:
+ *
+ *******************************************************************
+ Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The
+ Netherlands.
+
+ All Rights Reserved
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose and without fee is hereby granted,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation, and that the names of Stichting Mathematisch
+ Centrum or CWI not be used in advertising or publicity pertaining to
+ distribution of the software without specific, written prior permission.
+
+ STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+ FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ ******************************************************************/
+
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include "third_party/sox/src/src/adpcms.h"
+
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include <limits.h>
+
+typedef struct {
+ uint32_t nsamp, nbytes;
+ short padding;
+ short repeats;
+ off_t data_start; /* for seeking */
+ adpcm_io_t adpcm;
+ unsigned frame_samp; /* samples left to read in current frame */
+} priv_t;
+
+static void prcwriteheader(sox_format_t * ft);
+
+static int seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ if (ft->encoding.encoding == SOX_ENCODING_ALAW)
+ return lsx_offset_seek(ft, (off_t)p->data_start, (off_t)offset);
+ return SOX_EOF;
+}
+
+/* File header. The first 4 words are fixed; the rest of the header
+ could theoretically be different, and this is the first place to
+ check with apparently invalid files.
+
+ N.B. All offsets are from start of file. */
+static const char prc_header[41] = {
+ /* Header section */
+ '\x37','\x00','\x00','\x10', /* 0x00: File type (UID 1) */
+ '\x6d','\x00','\x00','\x10', /* 0x04: File kind (UID 2) */
+ '\x7e','\x00','\x00','\x10', /* 0x08: Application ID (UID 3) */
+ '\xcf','\xac','\x08','\x55', /* 0x0c: Checksum of UIDs 1-3 */
+ '\x14','\x00','\x00','\x00', /* 0x10: File offset of Section Table Section */
+ /* Section Table Section: a BListL, i.e. a list of longs preceded by
+ length byte.
+ The longs are in (ID, offset) pairs, each pair identifying a
+ section. */
+ '\x04', /* 0x14: List has 4 bytes, i.e. 2 pairs */
+ '\x52','\x00','\x00','\x10', /* 0x15: ID: Record Section */
+ '\x34','\x00','\x00','\x00', /* 0x19: Offset to Record Section */
+ '\x89','\x00','\x00','\x10', /* 0x1d: ID: Application ID Section */
+ '\x25','\x00','\x00','\x00', /* 0x21: Offset to Application ID Section */
+ '\x7e','\x00','\x00','\x10', /* 0x25: Application ID Section:
+ Record.app identifier */
+ /* Next comes the string, which can be either case. */
+};
+
+/* Format of the Record Section (offset 0x34):
+
+00 L Uncompressed data length
+04 ID a1 01 00 10 for ADPCM, 00 00 00 00 for A-law
+08 W number of times sound will be repeated (0 = played once)
+0a B Volume setting (01-05)
+0b B Always 00 (?)
+0c L Time between repeats in usec
+10 LListB (i.e. long giving number of bytes followed by bytes) Sound Data
+*/
+
+static int prc_checkheader(sox_format_t * ft, char *head)
+{
+ lsx_readbuf(ft, head, sizeof(prc_header));
+ return memcmp(head, prc_header, sizeof(prc_header)) == 0;
+}
+
+static int startread(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ char head[sizeof(prc_header)];
+ uint8_t byte;
+ uint16_t reps;
+ uint32_t len, listlen, encoding, repgap;
+ unsigned char volume;
+ char appname[0x40]; /* Maximum possible length of name */
+
+ /* Check the header */
+ if (prc_checkheader(ft, head))
+ lsx_debug("Found Psion Record header");
+ else {
+ lsx_fail_errno(ft,SOX_EHDR,"Not a Psion Record file");
+ return (SOX_EOF);
+ }
+
+ lsx_readb(ft, &byte);
+ if ((byte & 0x3) != 0x2) {
+ lsx_fail_errno(ft, SOX_EHDR, "Invalid length byte for application name string %d", (int)(byte));
+ return SOX_EOF;
+ }
+
+ byte >>= 2;
+ assert(byte < 64);
+ lsx_reads(ft, appname, (size_t)byte);
+ if (strncasecmp(appname, "record.app", (size_t) byte) != 0) {
+ lsx_fail_errno(ft, SOX_EHDR, "Invalid application name string %.63s", appname);
+ return SOX_EOF;
+ }
+
+ lsx_readdw(ft, &len);
+ p->nsamp = len;
+ lsx_debug("Number of samples: %d", len);
+
+ lsx_readdw(ft, &encoding);
+ lsx_debug("Encoding of samples: %x", encoding);
+ if (encoding == 0)
+ ft->encoding.encoding = SOX_ENCODING_ALAW;
+ else if (encoding == 0x100001a1)
+ ft->encoding.encoding = SOX_ENCODING_IMA_ADPCM;
+ else {
+ lsx_fail_errno(ft, SOX_EHDR, "Unrecognised encoding");
+ return SOX_EOF;
+ }
+
+ lsx_readw(ft, &reps); /* Number of repeats */
+ lsx_debug("Repeats: %d", reps);
+
+ lsx_readb(ft, &volume);
+ lsx_debug("Volume: %d", (unsigned)volume);
+ if (volume < 1 || volume > 5)
+ lsx_warn("Volume %d outside range 1..5", volume);
+
+ lsx_readb(ft, &byte); /* Unused and seems always zero */
+
+ lsx_readdw(ft, &repgap); /* Time between repeats in usec */
+ lsx_debug("Time between repeats (usec): %u", repgap);
+
+ lsx_readdw(ft, &listlen); /* Length of samples list */
+ lsx_debug("Number of bytes in samples list: %u", listlen);
+
+ if (ft->signal.rate != 0 && ft->signal.rate != 8000)
+ lsx_report("PRC only supports 8 kHz; overriding.");
+ ft->signal.rate = 8000;
+
+ if (ft->signal.channels != 1 && ft->signal.channels != 0)
+ lsx_report("PRC only supports 1 channel; overriding.");
+ ft->signal.channels = 1;
+
+ p->data_start = lsx_tell(ft);
+ ft->signal.length = p->nsamp / ft->signal.channels;
+
+ if (ft->encoding.encoding == SOX_ENCODING_ALAW) {
+ ft->encoding.bits_per_sample = 8;
+ if (lsx_rawstartread(ft))
+ return SOX_EOF;
+ } else if (ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM) {
+ p->frame_samp = 0;
+ if (lsx_adpcm_ima_start(ft, &p->adpcm))
+ return SOX_EOF;
+ }
+
+ return (SOX_SUCCESS);
+}
+
+/* Read a variable-length encoded count */
+/* Ignore return code of lsx_readb, as it doesn't really matter if EOF
+ is delayed until the caller. */
+static unsigned read_cardinal(sox_format_t * ft)
+{
+ unsigned a;
+ uint8_t byte;
+
+ if (lsx_readb(ft, &byte) == SOX_EOF)
+ return (unsigned)SOX_EOF;
+ lsx_debug_more("Cardinal byte 1: %x", byte);
+ a = byte;
+ if (!(a & 1))
+ a >>= 1;
+ else {
+ if (lsx_readb(ft, &byte) == SOX_EOF)
+ return (unsigned)SOX_EOF;
+ lsx_debug_more("Cardinal byte 2: %x", byte);
+ a |= byte << 8;
+ if (!(a & 2))
+ a >>= 2;
+ else if (!(a & 4)) {
+ if (lsx_readb(ft, &byte) == SOX_EOF)
+ return (unsigned)SOX_EOF;
+ lsx_debug_more("Cardinal byte 3: %x", byte);
+ a |= byte << 16;
+ if (lsx_readb(ft, &byte) == SOX_EOF)
+ return (unsigned)SOX_EOF;
+ lsx_debug_more("Cardinal byte 4: %x", byte);
+ a |= byte << 24;
+ a >>= 3;
+ }
+ }
+
+ return a;
+}
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t samp)
+{
+ priv_t * p = (priv_t *)ft->priv;
+
+ lsx_debug_more("length now = %d", p->nsamp);
+
+ if (ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM) {
+ size_t nsamp, read;
+
+ if (p->frame_samp == 0) {
+ unsigned framelen = read_cardinal(ft);
+ uint32_t trash;
+
+ if (framelen == (unsigned)SOX_EOF)
+ return 0;
+
+ lsx_debug_more("frame length %d", framelen);
+ p->frame_samp = framelen;
+
+ /* Discard length of compressed data */
+ lsx_debug_more("compressed length %d", read_cardinal(ft));
+ /* Discard length of BListL */
+ lsx_readdw(ft, &trash);
+ lsx_debug_more("list length %d", trash);
+
+ /* Reset CODEC for start of frame */
+ lsx_adpcm_reset(&p->adpcm, ft->encoding.encoding);
+ }
+ nsamp = min(p->frame_samp, samp);
+ p->nsamp += nsamp;
+ read = lsx_adpcm_read(ft, &p->adpcm, buf, nsamp);
+ p->frame_samp -= read;
+ lsx_debug_more("samples left in this frame: %d", p->frame_samp);
+ return read;
+ } else {
+ p->nsamp += samp;
+ return lsx_rawread(ft, buf, samp);
+ }
+}
+
+static int stopread(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+
+ if (ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM)
+ return lsx_adpcm_stopread(ft, &p->adpcm);
+ else
+ return SOX_SUCCESS;
+}
+
+/* When writing, the header is supposed to contain the number of
+ data bytes written, unless it is written to a pipe.
+ Since we don't know how many bytes will follow until we're done,
+ we first write the header with an unspecified number of bytes,
+ and at the end we rewind the file and write the header again
+ with the right size. This only works if the file is seekable;
+ if it is not, the unspecified size remains in the header
+ (this is illegal). */
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+
+ if (ft->encoding.encoding == SOX_ENCODING_ALAW) {
+ if (lsx_rawstartwrite(ft))
+ return SOX_EOF;
+ } else if (ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM) {
+ if (lsx_adpcm_ima_start(ft, &p->adpcm))
+ return SOX_EOF;
+ }
+
+ p->nsamp = 0;
+ p->nbytes = 0;
+ if (p->repeats == 0)
+ p->repeats = 1;
+
+ prcwriteheader(ft);
+
+ p->data_start = lsx_tell(ft);
+
+ return SOX_SUCCESS;
+}
+
+static void write_cardinal(sox_format_t * ft, unsigned a)
+{
+ uint8_t byte;
+
+ if (a < 0x80) {
+ byte = a << 1;
+ lsx_debug_more("Cardinal byte 1: %x", byte);
+ lsx_writeb(ft, byte);
+ } else if (a < 0x8000) {
+ byte = (a << 2) | 1;
+ lsx_debug_more("Cardinal byte 1: %x", byte);
+ lsx_writeb(ft, byte);
+ byte = a >> 6;
+ lsx_debug_more("Cardinal byte 2: %x", byte);
+ lsx_writeb(ft, byte);
+ } else {
+ byte = (a << 3) | 3;
+ lsx_debug_more("Cardinal byte 1: %x", byte);
+ lsx_writeb(ft, byte);
+ byte = a >> 5;
+ lsx_debug_more("Cardinal byte 2: %x", byte);
+ lsx_writeb(ft, byte);
+ byte = a >> 13;
+ lsx_debug_more("Cardinal byte 3: %x", byte);
+ lsx_writeb(ft, byte);
+ byte = a >> 21;
+ lsx_debug_more("Cardinal byte 4: %x", byte);
+ lsx_writeb(ft, byte);
+ }
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t nsamp)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ /* Psion Record seems not to be able to handle frames > 800 samples */
+ size_t written = 0;
+ lsx_debug_more("length now = %d", p->nsamp);
+ if (ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM) {
+ while (written < nsamp) {
+ size_t written1, samp = min(nsamp - written, 800);
+
+ write_cardinal(ft, (unsigned) samp);
+ /* Write compressed length */
+ write_cardinal(ft, (unsigned) ((samp / 2) + (samp % 2) + 4));
+ /* Write length again (seems to be a BListL) */
+ lsx_debug_more("list length %lu", (unsigned long)samp);
+ lsx_writedw(ft, (unsigned) samp);
+ lsx_adpcm_reset(&p->adpcm, ft->encoding.encoding);
+ written1 = lsx_adpcm_write(ft, &p->adpcm, buf + written, samp);
+ if (written1 != samp)
+ break;
+ lsx_adpcm_flush(ft, &p->adpcm);
+ written += written1;
+ }
+ } else
+ written = lsx_rawwrite(ft, buf, nsamp);
+ p->nsamp += written;
+ return written;
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+
+ p->nbytes = lsx_tell(ft) - p->data_start;
+
+ if (!ft->seekable) {
+ lsx_warn("Header will have invalid file length since file is not seekable");
+ return SOX_SUCCESS;
+ }
+
+ if (lsx_seeki(ft, (off_t)0, 0) != 0) {
+ lsx_fail_errno(ft,errno,"Can't rewind output file to rewrite Psion header.");
+ return(SOX_EOF);
+ }
+ prcwriteheader(ft);
+ return SOX_SUCCESS;
+}
+
+static void prcwriteheader(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+
+ lsx_writebuf(ft, prc_header, sizeof(prc_header));
+ lsx_writes(ft, "\x2arecord.app");
+
+ lsx_debug("Number of samples: %d",p->nsamp);
+ lsx_writedw(ft, p->nsamp);
+
+ if (ft->encoding.encoding == SOX_ENCODING_ALAW)
+ lsx_writedw(ft, 0);
+ else
+ lsx_writedw(ft, 0x100001a1); /* ADPCM */
+
+ lsx_writew(ft, 0); /* Number of repeats */
+ lsx_writeb(ft, 3); /* Volume: use default value of Record.app */
+ lsx_writeb(ft, 0); /* Unused and seems always zero */
+ lsx_writedw(ft, 0); /* Time between repeats in usec */
+
+ lsx_debug("Number of bytes: %d", p->nbytes);
+ lsx_writedw(ft, p->nbytes); /* Number of bytes of data */
+}
+
+LSX_FORMAT_HANDLER(prc)
+{
+ static char const * const names[] = {"prc", NULL};
+ static sox_rate_t const write_rates[] = {8000, 0};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_IMA_ADPCM, 4, 0,
+ 0};
+ static sox_format_handler_t const handler = {
+ SOX_LIB_VERSION_CODE,
+ "Psion Record; used in EPOC devices (Series 5, Revo and similar)",
+ names, SOX_FILE_LIT_END | SOX_FILE_MONO,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ seek, write_encodings, write_rates, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/pulseaudio.c b/src/src/pulseaudio.c
new file mode 100644
index 0000000..1b16522
--- /dev/null
+++ b/src/src/pulseaudio.c
@@ -0,0 +1,169 @@
+/* Pulse Audio sound handler
+ *
+ * Copyright 2008 Chris Bagwell And Sundry Contributors
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include "third_party/pulseaudio/pulseaudio-4.0/src/pulse/simple.h"
+#include "third_party/pulseaudio/pulseaudio-4.0/src/pulse/error.h"
+
+typedef struct {
+ pa_simple *pasp;
+} priv_t;
+
+static int setup(sox_format_t *ft, int is_input)
+{
+ priv_t *pa = (priv_t *)ft->priv;
+ char *server;
+ pa_stream_direction_t dir;
+ char *app_str;
+ char *dev;
+ pa_sample_spec spec;
+ int error;
+
+ /* TODO: If user specified device of type "server:dev" then
+ * break up and override server.
+ */
+ server = NULL;
+
+ if (is_input)
+ {
+ dir = PA_STREAM_RECORD;
+ app_str = "record";
+ }
+ else
+ {
+ dir = PA_STREAM_PLAYBACK;
+ app_str = "playback";
+ }
+
+ if (strncmp(ft->filename, "default", (size_t)7) == 0)
+ dev = NULL;
+ else
+ dev = ft->filename;
+
+ /* If user doesn't specify, default to some reasonable values.
+ * Since this is mainly for recording case, default to typical
+ * 16-bit values to prevent saving larger files then average user
+ * wants. Power users can override to 32-bit if they wish.
+ */
+ if (ft->signal.channels == 0)
+ ft->signal.channels = 2;
+ if (ft->signal.rate == 0)
+ ft->signal.rate = 44100;
+ if (ft->encoding.bits_per_sample == 0)
+ {
+ ft->encoding.bits_per_sample = 16;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ }
+
+ spec.format = PA_SAMPLE_S32NE;
+ spec.rate = ft->signal.rate;
+ spec.channels = ft->signal.channels;
+
+ pa->pasp = pa_simple_new(server, "SoX", dir, dev, app_str, &spec,
+ NULL, NULL, &error);
+
+ if (pa->pasp == NULL)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "can not open audio device: %s", pa_strerror(error));
+ return SOX_EOF;
+ }
+
+ /* TODO: Is it better to convert format/rates in SoX or in
+ * always let Pulse Audio do it? Since we don't know what
+ * hardware prefers, assume it knows best and give it
+ * what user specifies.
+ */
+
+ return SOX_SUCCESS;
+}
+
+static int startread(sox_format_t *ft)
+{
+ return setup(ft, 1);
+}
+
+static int stopread(sox_format_t * ft)
+{
+ priv_t *pa = (priv_t *)ft->priv;
+
+ pa_simple_free(pa->pasp);
+
+ return SOX_SUCCESS;
+}
+
+static size_t read_samples(sox_format_t *ft, sox_sample_t *buf, size_t nsamp)
+{
+ priv_t *pa = (priv_t *)ft->priv;
+ size_t len;
+ int rc, error;
+
+ /* Pulse Audio buffer lengths are true buffer lengths and not
+ * count of samples. */
+ len = nsamp * sizeof(sox_sample_t);
+
+ rc = pa_simple_read(pa->pasp, buf, len, &error);
+
+ if (rc < 0)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "error reading from pulse audio device: %s", pa_strerror(error));
+ return SOX_EOF;
+ }
+ else
+ return nsamp;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ return setup(ft, 0);
+}
+
+static size_t write_samples(sox_format_t *ft, const sox_sample_t *buf, size_t nsamp)
+{
+ priv_t *pa = (priv_t *)ft->priv;
+ size_t len;
+ int rc, error;
+
+ /* Pulse Audio buffer lengths are true buffer lengths and not
+ * count of samples. */
+ len = nsamp * sizeof(sox_sample_t);
+
+ rc = pa_simple_write(pa->pasp, buf, len, &error);
+
+ if (rc < 0)
+ {
+ lsx_fail_errno(ft, SOX_EPERM, "error writing to pulse audio device: %s", pa_strerror(error));
+ return SOX_EOF;
+ }
+
+ return nsamp;
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t *pa = (priv_t *)ft->priv;
+ int error;
+
+ pa_simple_drain(pa->pasp, &error);
+ pa_simple_free(pa->pasp);
+
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(pulseaudio)
+{
+ static char const *const names[] = { "pulseaudio", NULL };
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 32, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Pulse Audio client",
+ names, SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/pvf.c b/src/src/pvf.c
new file mode 100644
index 0000000..f3bbb86
--- /dev/null
+++ b/src/src/pvf.c
@@ -0,0 +1,34 @@
+/* libSoX file format: PVF Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(pvf)
+{
+ static char const * const names[] = {"pvf", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 32, 16, 8,0,0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description = "Portable Voice Format";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/rate.c b/src/src/rate.c
new file mode 100644
index 0000000..942ae20
--- /dev/null
+++ b/src/src/rate.c
@@ -0,0 +1,697 @@
+/* Effect: change sample rate Copyright (c) 2008,12 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Inspired by, and builds upon some of the ideas presented in:
+ * `The Quest For The Perfect Resampler' by Laurent De Soras;
+ * http://ldesoras.free.fr/doc/articles/resampler-en.pdf */
+
+#ifdef NDEBUG /* Enable assert always. */
+#undef NDEBUG /* Must undef above assert.h or other that might include it. */
+#endif
+
+#define _GNU_SOURCE
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/fft4g.h"
+#include "third_party/sox/src/src/dft_filter.h"
+#include <assert.h>
+#include <string.h>
+
+#define calloc lsx_calloc
+#define malloc lsx_malloc
+#define raw_coef_t double
+
+#if 0 /* For float32 version, as used in foobar */
+ #define sample_t float
+ #define num_coefs4 ((num_coefs + 3) & ~3) /* align coefs for SSE */
+ #define coefs4_check(i) ((i) < num_coefs)
+#else
+ #define sample_t double
+ #define num_coefs4 num_coefs
+ #define coefs4_check(i) 1
+#endif
+
+#if defined M_PIl
+ #define hi_prec_clock_t long double /* __float128 is also a (slow) option */
+#else
+ #define hi_prec_clock_t double
+#endif
+
+#define coef(coef_p, interp_order, fir_len, phase_num, coef_interp_num, fir_coef_num) coef_p[(fir_len) * ((interp_order) + 1) * (phase_num) + ((interp_order) + 1) * (fir_coef_num) + (interp_order - coef_interp_num)]
+
+static sample_t * prepare_coefs(raw_coef_t const * coefs, int num_coefs,
+ int num_phases, int interp_order, int multiplier)
+{
+ int i, j, length = num_coefs4 * num_phases;
+ sample_t * result = malloc(length * (interp_order + 1) * sizeof(*result));
+ double fm1 = coefs[0], f1 = 0, f2 = 0;
+
+ for (i = num_coefs4 - 1; i >= 0; --i)
+ for (j = num_phases - 1; j >= 0; --j) {
+ double f0 = fm1, b = 0, c = 0, d = 0; /* = 0 to kill compiler warning */
+ int pos = i * num_phases + j - 1;
+ fm1 = coefs4_check(i) && pos > 0 ? coefs[pos - 1] * multiplier : 0;
+ switch (interp_order) {
+ case 1: b = f1 - f0; break;
+ case 2: b = f1 - (.5 * (f2+f0) - f1) - f0; c = .5 * (f2+f0) - f1; break;
+ case 3: c=.5*(f1+fm1)-f0;d=(1/6.)*(f2-f1+fm1-f0-4*c);b=f1-f0-d-c; break;
+ default: if (interp_order) assert(0);
+ }
+ #define coef_coef(x) \
+ coef(result, interp_order, num_coefs4, j, x, num_coefs4 - 1 - i)
+ coef_coef(0) = f0;
+ if (interp_order > 0) coef_coef(1) = b;
+ if (interp_order > 1) coef_coef(2) = c;
+ if (interp_order > 2) coef_coef(3) = d;
+ #undef coef_coef
+ f2 = f1, f1 = f0;
+ }
+ return result;
+}
+
+typedef struct { /* So generated filter coefs may be shared between channels */
+ sample_t * poly_fir_coefs;
+ dft_filter_t dft_filter[2];
+} rate_shared_t;
+
+struct stage;
+typedef void (* stage_fn_t)(struct stage * input, fifo_t * output);
+typedef struct stage {
+ /* Common to all stage types: */
+ stage_fn_t fn;
+ fifo_t fifo;
+ int pre; /* Number of past samples to store */
+ int pre_post; /* pre + number of future samples to store */
+ int preload; /* Number of zero samples to pre-load the fifo */
+ double out_in_ratio; /* For buffer management. */
+
+ /* For a stage with variable (run-time generated) filter coefs: */
+ rate_shared_t * shared;
+ int dft_filter_num; /* Which, if any, of the 2 DFT filters to use */
+
+ /* For a stage with variable L/M: */
+ union { /* 32bit.32bit fixed point arithmetic */
+ #if defined(WORDS_BIGENDIAN)
+ struct {int32_t integer; uint32_t fraction;} parts;
+ #else
+ struct {uint32_t fraction; int32_t integer;} parts;
+ #endif
+ int64_t all;
+ #define MULT32 (65536. * 65536.)
+
+ hi_prec_clock_t hi_prec_clock;
+ } at, step;
+ sox_bool use_hi_prec_clock;
+ int L, remL, remM;
+ int n, phase_bits;
+} stage_t;
+
+#define stage_occupancy(s) max(0, fifo_occupancy(&(s)->fifo) - (s)->pre_post)
+#define stage_read_p(s) ((sample_t *)fifo_read_ptr(&(s)->fifo) + (s)->pre)
+
+static void cubic_stage_fn(stage_t * p, fifo_t * output_fifo)
+{
+ int i, num_in = stage_occupancy(p), max_num_out = 1 + num_in*p->out_in_ratio;
+ sample_t const * input = stage_read_p(p);
+ sample_t * output = fifo_reserve(output_fifo, max_num_out);
+
+ for (i = 0; p->at.parts.integer < num_in; ++i, p->at.all += p->step.all) {
+ sample_t const * s = input + p->at.parts.integer;
+ sample_t x = p->at.parts.fraction * (1 / MULT32);
+ sample_t b = .5*(s[1]+s[-1])-*s, a = (1/6.)*(s[2]-s[1]+s[-1]-*s-4*b);
+ sample_t c = s[1]-*s-a-b;
+ output[i] = ((a*x + b)*x + c)*x + *s;
+ }
+ assert(max_num_out - i >= 0);
+ fifo_trim_by(output_fifo, max_num_out - i);
+ fifo_read(&p->fifo, p->at.parts.integer, NULL);
+ p->at.parts.integer = 0;
+}
+
+static void dft_stage_fn(stage_t * p, fifo_t * output_fifo)
+{
+ sample_t * output, tmp;
+ int i, j, num_in = max(0, fifo_occupancy(&p->fifo));
+ rate_shared_t const * s = p->shared;
+ dft_filter_t const * f = &s->dft_filter[p->dft_filter_num];
+ int const overlap = f->num_taps - 1;
+
+ while (p->remL + p->L * num_in >= f->dft_length) {
+ div_t divd = div(f->dft_length - overlap - p->remL + p->L - 1, p->L);
+ sample_t const * input = fifo_read_ptr(&p->fifo);
+ fifo_read(&p->fifo, divd.quot, NULL);
+ num_in -= divd.quot;
+
+ output = fifo_reserve(output_fifo, f->dft_length);
+ if (lsx_is_power_of_2(p->L)) { /* F-domain */
+ int portion = f->dft_length / p->L;
+ memcpy(output, input, (unsigned)portion * sizeof(*output));
+ lsx_safe_rdft(portion, 1, output);
+ for (i = portion + 2; i < (portion << 1); i += 2)
+ output[i] = output[(portion << 1) - i],
+ output[i+1] = -output[(portion << 1) - i + 1];
+ output[portion] = output[1];
+ output[portion + 1] = 0;
+ output[1] = output[0];
+ for (portion <<= 1; i < f->dft_length; i += portion, portion <<= 1) {
+ memcpy(output + i, output, portion * sizeof(*output));
+ output[i + 1] = 0;
+ }
+ } else {
+ if (p->L == 1)
+ memcpy(output, input, f->dft_length * sizeof(*output));
+ else {
+ memset(output, 0, f->dft_length * sizeof(*output));
+ for (j = 0, i = p->remL; i < f->dft_length; ++j, i += p->L)
+ output[i] = input[j];
+ p->remL = p->L - 1 - divd.rem;
+ }
+ lsx_safe_rdft(f->dft_length, 1, output);
+ }
+ output[0] *= f->coefs[0];
+ if (p->step.parts.integer > 0) {
+ output[1] *= f->coefs[1];
+ for (i = 2; i < f->dft_length; i += 2) {
+ tmp = output[i];
+ output[i ] = f->coefs[i ] * tmp - f->coefs[i+1] * output[i+1];
+ output[i+1] = f->coefs[i+1] * tmp + f->coefs[i ] * output[i+1];
+ }
+ lsx_safe_rdft(f->dft_length, -1, output);
+ if (p->step.parts.integer != 1) {
+ for (j = 0, i = p->remM; i < f->dft_length - overlap; ++j,
+ i += p->step.parts.integer)
+ output[j] = output[i];
+ p->remM = i - (f->dft_length - overlap);
+ fifo_trim_by(output_fifo, f->dft_length - j);
+ }
+ else fifo_trim_by(output_fifo, overlap);
+ }
+ else { /* F-domain */
+ int m = -p->step.parts.integer;
+ for (i = 2; i < (f->dft_length >> m); i += 2) {
+ tmp = output[i];
+ output[i ] = f->coefs[i ] * tmp - f->coefs[i+1] * output[i+1];
+ output[i+1] = f->coefs[i+1] * tmp + f->coefs[i ] * output[i+1];
+ }
+ output[1] = f->coefs[i] * output[i] - f->coefs[i+1] * output[i+1];
+ lsx_safe_rdft(f->dft_length >> m, -1, output);
+ fifo_trim_by(output_fifo, (((1 << m) - 1) * f->dft_length + overlap) >>m);
+ }
+ }
+}
+
+static void dft_stage_init(
+ unsigned instance, double Fp, double Fs, double Fn, double att,
+ double phase, stage_t * stage, int L, int M)
+{
+ dft_filter_t * f = &stage->shared->dft_filter[instance];
+
+ if (!f->num_taps) {
+ int num_taps = 0, dft_length, i;
+ int k = phase == 50 && lsx_is_power_of_2(L) && Fn == L? L << 1 : 4;
+ double * h = lsx_design_lpf(Fp, Fs, Fn, att, &num_taps, -k, -1.);
+
+ if (phase != 50)
+ lsx_fir_to_phase(&h, &num_taps, &f->post_peak, phase);
+ else f->post_peak = num_taps / 2;
+
+ dft_length = lsx_set_dft_length(num_taps);
+ f->coefs = calloc(dft_length, sizeof(*f->coefs));
+ for (i = 0; i < num_taps; ++i)
+ f->coefs[(i + dft_length - num_taps + 1) & (dft_length - 1)]
+ = h[i] / dft_length * 2 * L;
+ free(h);
+ f->num_taps = num_taps;
+ f->dft_length = dft_length;
+ lsx_safe_rdft(dft_length, 1, f->coefs);
+ lsx_debug("fir_len=%i dft_length=%i Fp=%g Fs=%g Fn=%g att=%g %i/%i",
+ num_taps, dft_length, Fp, Fs, Fn, att, L, M);
+ }
+ stage->fn = dft_stage_fn;
+ stage->preload = f->post_peak / L;
+ stage->remL = f->post_peak % L;
+ stage->L = L;
+ stage->step.parts.integer = abs(3-M) == 1 && Fs == 1? -M/2 : M;
+ stage->dft_filter_num = instance;
+}
+
+#include "third_party/sox/src/src/rate_filters.h"
+
+typedef struct {
+ double factor;
+ uint64_t samples_in, samples_out;
+ int num_stages;
+ stage_t * stages;
+} rate_t;
+
+#define pre_stage p->stages[shift]
+#define arb_stage p->stages[shift + have_pre_stage]
+#define post_stage p->stages[shift + have_pre_stage + have_arb_stage]
+#define have_pre_stage (preM * preL != 1)
+#define have_arb_stage (arbM * arbL != 1)
+#define have_post_stage (postM * postL != 1)
+
+#define TO_3dB(a) ((1.6e-6*a-7.5e-4)*a+.646)
+#define LOW_Q_BW0_PC (67 + 5 / 8.)
+
+typedef enum {
+ rolloff_none, rolloff_small /* <= 0.01 dB */, rolloff_medium /* <= 0.35 dB */
+} rolloff_t;
+
+static void rate_init(
+ /* Private work areas (to be supplied by the client): */
+ rate_t * p, /* Per audio channel. */
+ rate_shared_t * shared, /* Between channels (undergoing same rate change)*/
+
+ /* Public parameters: Typically */
+ double factor, /* Input rate divided by output rate. */
+ double bits, /* Required bit-accuracy (pass + stop) 16|20|28 */
+ double phase, /* Linear/minimum etc. filter phase. 50 */
+ double bw_pc, /* Pass-band % (0dB pt.) to preserve. 91.3|98.4*/
+ double anti_aliasing_pc, /* % bandwidth without aliasing 100 */
+ rolloff_t rolloff, /* Pass-band roll-off small */
+ sox_bool maintain_3dB_pt, /* true */
+
+ /* Primarily for test/development purposes: */
+ sox_bool use_hi_prec_clock,/* Increase irrational ratio accuracy. false */
+ int interpolator, /* Force a particular coef interpolator. -1 */
+ int max_coefs_size, /* k bytes of coefs to try to keep below. 400 */
+ sox_bool noSmallIntOpt) /* Disable small integer optimisations. false */
+{
+ double att = (bits + 1) * linear_to_dB(2.), attArb = att; /* pass + stop */
+ double tbw0 = 1 - bw_pc / 100, Fs_a = 2 - anti_aliasing_pc / 100;
+ double arbM = factor, tbw_tighten = 1;
+ int n = 0, i, preL = 1, preM = 1, shift = 0, arbL = 1, postL = 1, postM = 1;
+ sox_bool upsample = sox_false, rational = sox_false, iOpt = !noSmallIntOpt;
+ int mode = rolloff > rolloff_small? factor > 1 || bw_pc > LOW_Q_BW0_PC :
+ ceil(2 + (bits - 17) / 4);
+ stage_t * s;
+
+ assert(factor > 0);
+ assert(!bits || (15 <= bits && bits <= 33));
+ assert(0 <= phase && phase <= 100);
+ assert(53 <= bw_pc && bw_pc <= 100);
+ assert(85 <= anti_aliasing_pc && anti_aliasing_pc <= 100);
+
+ p->factor = factor;
+ if (bits) while (!n++) { /* Determine stages: */
+ int try, L, M, x, maxL = interpolator > 0? 1 : mode? 2048 :
+ ceil(max_coefs_size * 1000. / (U100_l * sizeof(sample_t)));
+ double d, epsilon = 0, frac;
+ upsample = arbM < 1;
+ for (i = arbM * .5, shift = 0; i >>= 1; arbM *= .5, ++shift);
+ preM = upsample || (arbM > 1.5 && arbM < 2);
+ postM = 1 + (arbM > 1 && preM), arbM /= postM;
+ preL = 1 + (!preM && arbM < 2) + (upsample && mode), arbM *= preL;
+ if ((frac = arbM - (int)arbM))
+ epsilon = fabs((uint64_t)(frac * MULT32 + .5) / (frac * MULT32) - 1);
+ for (i = 1, rational = !frac; i <= maxL && !rational; ++i) {
+ d = frac * i, try = d + .5;
+ if ((rational = fabs(try / d - 1) <= epsilon)) { /* No long doubles! */
+ if (try == i)
+ arbM = ceil(arbM), shift += arbM > 2, arbM /= 1 + (arbM > 2);
+ else arbM = i * (int)arbM + try, arbL = i;
+ }
+ }
+ L = preL * arbL, M = arbM * postM, x = (L|M)&1, L >>= !x, M >>= !x;
+ if (iOpt && postL == 1 && (d = preL * arbL / arbM) > 4 && d != 5) {
+ for (postL = 4, i = d / 16; i >>= 1; postL <<= 1);
+ arbM = arbM * postL / arbL / preL, arbL = 1, n = 0;
+ } else if (rational && (max(L, M) < 3 + 2 * iOpt || L * M < 6 * iOpt))
+ preL = L, preM = M, arbM = arbL = postM = 1;
+ if (!mode && (!rational || !n))
+ ++mode, n = 0;
+ }
+
+ p->num_stages = shift + have_pre_stage + have_arb_stage + have_post_stage;
+ p->stages = calloc(p->num_stages + 1, sizeof(*p->stages));
+ for (i = 0; i < p->num_stages; ++i)
+ p->stages[i].shared = shared;
+
+ if ((n = p->num_stages) > 1) { /* Att. budget: */
+ if (have_arb_stage)
+ att += linear_to_dB(2.), attArb = att, --n;
+ att += linear_to_dB((double)n);
+ }
+
+ for (n = 0; n + 1u < array_length(half_firs) && att > half_firs[n].att; ++n);
+ for (i = 0, s = p->stages; i < shift; ++i, ++s) {
+ s->fn = half_firs[n].fn;
+ s->pre_post = 4 * half_firs[n].num_coefs;
+ s->preload = s->pre = s->pre_post >> 1;
+ }
+
+ if (have_pre_stage) {
+ if (maintain_3dB_pt && have_post_stage) { /* Trans. bands overlapping. */
+ double tbw3 = tbw0 * TO_3dB(att); /* TODO: consider Fs_a. */
+ double x = ((2.1429e-4 - 5.2083e-7 * att) * att - .015863) * att + 3.95;
+ x = att * pow((tbw0 - tbw3) / (postM / (factor * postL) - 1 + tbw0), x);
+ if (x > .035) {
+ tbw_tighten = ((4.3074e-3 - 3.9121e-4 * x) * x - .040009) * x + 1.0014;
+ lsx_debug("x=%g tbw_tighten=%g", x, tbw_tighten);
+ }
+ }
+ dft_stage_init(0, 1 - tbw0 * tbw_tighten, Fs_a, preM? max(preL, preM) :
+ arbM / arbL, att, phase, &pre_stage, preL, max(preM, 1));
+ }
+
+ if (!bits) { /* Quick and dirty arb stage: */
+ arb_stage.fn = cubic_stage_fn;
+ arb_stage.step.all = arbM * MULT32 + .5;
+ arb_stage.pre_post = max(3, arb_stage.step.parts.integer);
+ arb_stage.preload = arb_stage.pre = 1;
+ arb_stage.out_in_ratio = MULT32 * arbL / arb_stage.step.all;
+ }
+ else if (have_arb_stage) { /* Higher quality arb stage: */
+ poly_fir_t const * f = &poly_firs[6*(upsample + !!preM) + mode - !upsample];
+ int order, num_coefs = f->interp[0].scalar, phase_bits, phases, coefs_size;
+ double x = .5, at, Fp, Fs, Fn, mult = upsample? 1 : arbL / arbM;
+ poly_fir1_t const * f1;
+
+ Fn = !upsample && preM? x = arbM / arbL : 1;
+ Fp = !preM? mult : mode? .5 : 1;
+ Fs = 2 - Fp; /* Ignore Fs_a; it would have little benefit here. */
+ Fp *= 1 - tbw0;
+ if (rolloff > rolloff_small && mode)
+ Fp = !preM? mult * .5 - .125 : mult * .05 + .1;
+ else if (rolloff == rolloff_small)
+ Fp = Fs - (Fs - .148 * x - Fp * .852) * (.00813 * bits + .973);
+
+ i = (interpolator < 0? !rational : max(interpolator, !rational)) - 1;
+ do {
+ f1 = &f->interp[++i];
+ assert(f1->fn);
+ if (i)
+ arbM /= arbL, arbL = 1, rational = sox_false;
+ phase_bits = ceil(f1->scalar + log(mult)/log(2.));
+ phases = !rational? (1 << phase_bits) : arbL;
+ if (!f->interp[0].scalar) {
+ int phases0 = max(phases, 19), n0 = 0;
+ lsx_design_lpf(Fp, Fs, -Fn, attArb, &n0, phases0, f->beta);
+ num_coefs = n0 / phases0 + 1, num_coefs += num_coefs & !preM;
+ }
+ if ((num_coefs & 1) && rational && (arbL & 1))
+ phases <<= 1, arbL <<= 1, arbM *= 2;
+ at = arbL * .5 * (num_coefs & 1);
+ order = i + (i && mode > 4);
+ coefs_size = num_coefs4 * phases * (order + 1) * sizeof(sample_t);
+ } while (interpolator < 0 && i < 2 && f->interp[i+1].fn &&
+ coefs_size / 1000 > max_coefs_size);
+
+ if (!arb_stage.shared->poly_fir_coefs) {
+ int num_taps = num_coefs * phases - 1;
+ raw_coef_t * coefs = lsx_design_lpf(
+ Fp, Fs, Fn, attArb, &num_taps, phases, f->beta);
+ arb_stage.shared->poly_fir_coefs = prepare_coefs(
+ coefs, num_coefs, phases, order, 1);
+ lsx_debug("fir_len=%i phases=%i coef_interp=%i size=%s",
+ num_coefs, phases, order, lsx_sigfigs3((double)coefs_size));
+ free(coefs);
+ }
+ arb_stage.fn = f1->fn;
+ arb_stage.pre_post = num_coefs4 - 1;
+ arb_stage.preload = (num_coefs - 1) >> 1;
+ arb_stage.n = num_coefs4;
+ arb_stage.phase_bits = phase_bits;
+ arb_stage.L = arbL;
+ arb_stage.use_hi_prec_clock = mode > 1 && use_hi_prec_clock && !rational;
+ if (arb_stage.use_hi_prec_clock) {
+ arb_stage.at.hi_prec_clock = at;
+ arb_stage.step.hi_prec_clock = arbM;
+ arb_stage.out_in_ratio = arbL / arb_stage.step.hi_prec_clock;
+ } else {
+ arb_stage.at.all = at * MULT32 + .5;
+ arb_stage.step.all = arbM * MULT32 + .5;
+ arb_stage.out_in_ratio = MULT32 * arbL / arb_stage.step.all;
+ }
+ }
+
+ if (have_post_stage)
+ dft_stage_init(1, 1 - (1 - (1 - tbw0) *
+ (upsample? factor * postL / postM : 1)) * tbw_tighten, Fs_a,
+ (double)max(postL, postM), att, phase, &post_stage, postL, postM);
+
+ for (i = 0, s = p->stages; i < p->num_stages; ++i, ++s) {
+ fifo_create(&s->fifo, (int)sizeof(sample_t));
+ memset(fifo_reserve(&s->fifo, s->preload), 0, sizeof(sample_t)*s->preload);
+ lsx_debug("%5i|%-5i preload=%i remL=%i",
+ s->pre, s->pre_post - s->pre, s->preload, s->remL);
+ }
+ fifo_create(&s->fifo, (int)sizeof(sample_t));
+}
+
+static void rate_process(rate_t * p)
+{
+ stage_t * stage = p->stages;
+ int i;
+
+ for (i = 0; i < p->num_stages; ++i, ++stage)
+ stage->fn(stage, &(stage+1)->fifo);
+}
+
+static sample_t * rate_input(rate_t * p, sample_t const * samples, size_t n)
+{
+ p->samples_in += n;
+ return fifo_write(&p->stages[0].fifo, (int)n, samples);
+}
+
+static sample_t const * rate_output(rate_t * p, sample_t * samples, size_t * n)
+{
+ fifo_t * fifo = &p->stages[p->num_stages].fifo;
+ p->samples_out += *n = min(*n, (size_t)fifo_occupancy(fifo));
+ return fifo_read(fifo, (int)*n, samples);
+}
+
+static void rate_flush(rate_t * p)
+{
+ fifo_t * fifo = &p->stages[p->num_stages].fifo;
+ uint64_t samples_out = p->samples_in / p->factor + .5;
+ size_t remaining = samples_out > p->samples_out ?
+ (size_t)(samples_out - p->samples_out) : 0;
+ sample_t * buff = calloc(1024, sizeof(*buff));
+
+ if (remaining > 0) {
+ while ((size_t)fifo_occupancy(fifo) < remaining) {
+ rate_input(p, buff, (size_t) 1024);
+ rate_process(p);
+ }
+ fifo_trim_to(fifo, (int)remaining);
+ p->samples_in = 0;
+ }
+ free(buff);
+}
+
+static void rate_close(rate_t * p)
+{
+ rate_shared_t * shared = p->stages[0].shared;
+ int i;
+
+ for (i = 0; i <= p->num_stages; ++i)
+ fifo_delete(&p->stages[i].fifo);
+ free(shared->dft_filter[0].coefs);
+ free(shared->dft_filter[1].coefs);
+ free(shared->poly_fir_coefs);
+ memset(shared, 0, sizeof(*shared));
+ free(p->stages);
+}
+
+/*------------------------------- SoX Wrapper --------------------------------*/
+
+typedef struct {
+ sox_rate_t out_rate;
+ int rolloff, coef_interp, max_coefs_size;
+ double bit_depth, phase, bw_0dB_pc, anti_aliasing_pc;
+ sox_bool use_hi_prec_clock, noIOpt, given_0dB_pt;
+ rate_t rate;
+ rate_shared_t shared, * shared_ptr;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ int c, quality;
+ char * dummy_p, * found_at;
+ char const * opts = "+i:c:b:B:A:p:Q:R:d:MILafnost" "qlmghevu";
+ char const * qopts = strchr(opts, 'q');
+ double rej = 0, bw_3dB_pc = 0;
+ sox_bool allow_aliasing = sox_false;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, opts, NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ p->coef_interp = quality = -1;
+ p->rolloff = rolloff_small;
+ p->phase = 50;
+ p->max_coefs_size = 400;
+ p->shared_ptr = &p->shared;
+
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ GETOPT_NUMERIC(optstate, 'i', coef_interp, -1, 2)
+ GETOPT_NUMERIC(optstate, 'c', max_coefs_size, 100, INT_MAX)
+ GETOPT_NUMERIC(optstate, 'p', phase, 0, 100)
+ GETOPT_NUMERIC(optstate, 'B', bw_0dB_pc, 53, 99.5)
+ GETOPT_NUMERIC(optstate, 'A', anti_aliasing_pc, 85, 100)
+ GETOPT_NUMERIC(optstate, 'd', bit_depth, 15, 33)
+ GETOPT_LOCAL_NUMERIC(optstate, 'b', bw_3dB_pc, 74, 99.7)
+ GETOPT_LOCAL_NUMERIC(optstate, 'R', rej, 90, 200)
+ GETOPT_LOCAL_NUMERIC(optstate, 'Q', quality, 0, 7)
+ case 'M': p->phase = 0; break;
+ case 'I': p->phase = 25; break;
+ case 'L': p->phase = 50; break;
+ case 'a': allow_aliasing = sox_true; break;
+ case 'f': p->rolloff = rolloff_none; break;
+ case 'n': p->noIOpt = sox_true; break;
+ case 's': bw_3dB_pc = 99; break;
+ case 't': p->use_hi_prec_clock = sox_true; break;
+ default:
+ if ((found_at = strchr(qopts, c)))
+ quality = found_at - qopts;
+ else {
+ lsx_fail("unknown option `-%c'", optstate.opt);
+ return lsx_usage(effp);
+ }
+ }
+ argc -= optstate.ind, argv += optstate.ind;
+
+ if ((unsigned)quality < 2 && (p->bw_0dB_pc || bw_3dB_pc || p->phase != 50 ||
+ allow_aliasing || rej || p->bit_depth || p->anti_aliasing_pc)) {
+ lsx_fail("override options not allowed with this quality level");
+ return SOX_EOF;
+ }
+ if (quality < 0 && rej == 0 && p->bit_depth == 0)
+ quality = 4;
+ if (rej)
+ p->bit_depth = rej / linear_to_dB(2.);
+ else {
+ if (quality >= 0) {
+ p->bit_depth = quality? 16 + 4 * max(quality - 3, 0) : 0;
+ if (quality <= 2)
+ p->rolloff = rolloff_medium;
+ }
+ rej = p->bit_depth * linear_to_dB(2.);
+ }
+
+ if (bw_3dB_pc && p->bw_0dB_pc) {
+ lsx_fail("conflicting bandwidth options");
+ return SOX_EOF;
+ }
+ allow_aliasing |= p->anti_aliasing_pc != 0;
+ if (!bw_3dB_pc && !p->bw_0dB_pc)
+ p->bw_0dB_pc = quality == 1? LOW_Q_BW0_PC : 100 - 5 / TO_3dB(rej);
+ else if (bw_3dB_pc && bw_3dB_pc < 85 && allow_aliasing) {
+ lsx_fail("minimum allowed 3dB bandwidth with aliasing is %g%%", 85.);
+ return SOX_EOF;
+ }
+ else if (p->bw_0dB_pc && p->bw_0dB_pc < 74 && allow_aliasing) {
+ lsx_fail("minimum allowed bandwidth with aliasing is %g%%", 74.);
+ return SOX_EOF;
+ }
+ if (bw_3dB_pc)
+ p->bw_0dB_pc = 100 - (100 - bw_3dB_pc) / TO_3dB(rej);
+ else {
+ bw_3dB_pc = 100 - (100 - p->bw_0dB_pc) * TO_3dB(rej);
+ p->given_0dB_pt = sox_true;
+ }
+ p->anti_aliasing_pc = p->anti_aliasing_pc? p->anti_aliasing_pc :
+ allow_aliasing? bw_3dB_pc : 100;
+
+ if (argc) {
+ if ((p->out_rate = lsx_parse_frequency(*argv, &dummy_p)) <= 0 || *dummy_p)
+ return lsx_usage(effp);
+ argc--; argv++;
+ effp->out_signal.rate = p->out_rate;
+ }
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ double out_rate = p->out_rate != 0 ? p->out_rate : effp->out_signal.rate;
+
+ if (effp->in_signal.rate == out_rate)
+ return SOX_EFF_NULL;
+
+ if (effp->in_signal.mult)
+ *effp->in_signal.mult *= .705; /* 1/(2/sinc(pi/3)-1); see De Soras 4.1.2 */
+
+ effp->out_signal.channels = effp->in_signal.channels;
+ effp->out_signal.rate = out_rate;
+ rate_init(&p->rate, p->shared_ptr, effp->in_signal.rate/out_rate,p->bit_depth,
+ p->phase, p->bw_0dB_pc, p->anti_aliasing_pc, p->rolloff, !p->given_0dB_pt,
+ p->use_hi_prec_clock, p->coef_interp, p->max_coefs_size, p->noIOpt);
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t odone = *osamp;
+
+ sample_t const * s = rate_output(&p->rate, NULL, &odone);
+ lsx_save_samples(obuf, s, odone, &effp->clips);
+
+ if (*isamp && odone < *osamp) {
+ sample_t * t = rate_input(&p->rate, NULL, *isamp);
+ lsx_load_samples(t, ibuf, *isamp);
+ rate_process(&p->rate);
+ }
+ else *isamp = 0;
+ *osamp = odone;
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ static size_t isamp = 0;
+ rate_flush(&p->rate);
+ return flow(effp, 0, obuf, &isamp, osamp);
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ rate_close(&p->rate);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_rate_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "rate", 0, SOX_EFF_RATE, create, start, flow, drain, stop, 0, sizeof(priv_t)
+ };
+ static char const * lines[] = {
+ "[-q|-l|-m|-h|-v] [override-options] RATE[k]",
+ " BAND-",
+ " QUALITY WIDTH REJ dB TYPICAL USE",
+ " -q quick n/a ~30 @ Fs/4 playback on ancient hardware",
+ " -l low 80% 100 playback on old hardware",
+ " -m medium 95% 100 audio playback",
+ " -h high (default) 95% 125 16-bit mastering (use with dither)",
+ " -v very high 95% 175 24-bit mastering",
+ " OVERRIDE OPTIONS (only with -m, -h, -v)",
+ " -M/-I/-L Phase response = minimum/intermediate/linear(default)",
+ " -s Steep filter (band-width = 99%)",
+ " -a Allow aliasing above the pass-band",
+ " -b 74-99.7 Any band-width %",
+ " -p 0-100 Any phase response (0 = minimum, 25 = intermediate,",
+ " 50 = linear, 100 = maximum)",
+ };
+ static char * usage;
+ handler.usage = lsx_usage_lines(&usage, lines, array_length(lines));
+ return &handler;
+}
diff --git a/src/src/rate_filters.h b/src/src/rate_filters.h
new file mode 100644
index 0000000..1e393bf
--- /dev/null
+++ b/src/src/rate_filters.h
@@ -0,0 +1,187 @@
+/* Effect: change sample rate Copyright (c) 2008,12 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static const sample_t half_fir_coefs_8[] = {
+ 0.3115465451887802, -0.08734497241282892, 0.03681452335604365,
+ -0.01518925831569441, 0.005454118437408876, -0.001564400922162005,
+ 0.0003181701445034203, -3.48001341225749e-5,
+};
+#define FUNCTION h8
+#define CONVOLVE _ _ _ _ _ _ _ _
+#define h8_l 8
+#define COEFS half_fir_coefs_8
+#include "third_party/sox/src/src/rate_half_fir.h"
+
+static const sample_t half_fir_coefs_9[] = {
+ 0.3122703613711853, -0.08922155288172305, 0.03913974805854332,
+ -0.01725059723447163, 0.006858970092378141, -0.002304518467568703,
+ 0.0006096426006051062, -0.0001132393923815236, 1.119795386287666e-5,
+};
+#define FUNCTION h9
+#define CONVOLVE _ _ _ _ _ _ _ _ _
+#define h9_l 9
+#define COEFS half_fir_coefs_9
+#include "third_party/sox/src/src/rate_half_fir.h"
+
+static const sample_t half_fir_coefs_10[] = {
+ 0.3128545521327376, -0.09075671986104322, 0.04109637155154835,
+ -0.01906629512749895, 0.008184039342054333, -0.0030766775017262,
+ 0.0009639607022414314, -0.0002358552746579827, 4.025184282444155e-5,
+ -3.629779111541012e-6,
+};
+#define FUNCTION h10
+#define CONVOLVE _ _ _ _ _ _ _ _ _ _
+#define h10_l 10
+#define COEFS half_fir_coefs_10
+#include "third_party/sox/src/src/rate_half_fir.h"
+
+static const sample_t half_fir_coefs_11[] = {
+ 0.3133358837508807, -0.09203588680609488, 0.04276515428384758,
+ -0.02067356614745591, 0.00942253142371517, -0.003856330993895144,
+ 0.001363470684892284, -0.0003987400965541919, 9.058629923971627e-5,
+ -1.428553070915318e-5, 1.183455238783835e-6,
+};
+#define FUNCTION h11
+#define CONVOLVE _ _ _ _ _ _ _ _ _ _ _
+#define h11_l 11
+#define COEFS half_fir_coefs_11
+#include "third_party/sox/src/src/rate_half_fir.h"
+
+static const sample_t half_fir_coefs_12[] = {
+ 0.3137392991811407, -0.0931182192961332, 0.0442050575271454,
+ -0.02210391200618091, 0.01057473015666001, -0.00462766983973885,
+ 0.001793630226239453, -0.0005961819959665878, 0.0001631475979359577,
+ -3.45557865639653e-5, 5.06188341942088e-6, -3.877010943315563e-7,
+};
+#define FUNCTION h12
+#define CONVOLVE _ _ _ _ _ _ _ _ _ _ _ _
+#define h12_l 12
+#define COEFS half_fir_coefs_12
+#include "third_party/sox/src/src/rate_half_fir.h"
+
+static const sample_t half_fir_coefs_13[] = {
+ 0.3140822554324578, -0.0940458550886253, 0.04545990399121566,
+ -0.02338339450796002, 0.01164429409071052, -0.005380686021429845,
+ 0.002242915773871009, -0.000822047600000082, 0.0002572510962395222,
+ -6.607320708956279e-5, 1.309926399120154e-5, -1.790719575255006e-6,
+ 1.27504961098836e-7,
+};
+#define FUNCTION h13
+#define CONVOLVE _ _ _ _ _ _ _ _ _ _ _ _ _
+#define h13_l 13
+#define COEFS half_fir_coefs_13
+#include "third_party/sox/src/src/rate_half_fir.h"
+
+static struct {int num_coefs; stage_fn_t fn; float att;} const half_firs[] = {
+ { 8, h8 , 136.51},
+ { 9, h9 , 152.32},
+ {10, h10, 168.07},
+ {11, h11, 183.78},
+ {12, h12, 199.44},
+ {13, h13, 212.75},
+};
+
+#define HI_PREC_CLOCK
+
+#define VAR_LENGTH p->n
+#define VAR_CONVOLVE while (j < FIR_LENGTH) _
+#define VAR_POLY_PHASE_BITS p->phase_bits
+
+#define FUNCTION vpoly0
+#define FIR_LENGTH VAR_LENGTH
+#define CONVOLVE VAR_CONVOLVE
+#include "third_party/sox/src/src/rate_poly_fir0.h"
+
+#define FUNCTION vpoly1
+#define COEF_INTERP 1
+#define PHASE_BITS VAR_POLY_PHASE_BITS
+#define FIR_LENGTH VAR_LENGTH
+#define CONVOLVE VAR_CONVOLVE
+#include "third_party/sox/src/src/rate_poly_fir.h"
+
+#define FUNCTION vpoly2
+#define COEF_INTERP 2
+#define PHASE_BITS VAR_POLY_PHASE_BITS
+#define FIR_LENGTH VAR_LENGTH
+#define CONVOLVE VAR_CONVOLVE
+#include "third_party/sox/src/src/rate_poly_fir.h"
+
+#define FUNCTION vpoly3
+#define COEF_INTERP 3
+#define PHASE_BITS VAR_POLY_PHASE_BITS
+#define FIR_LENGTH VAR_LENGTH
+#define CONVOLVE VAR_CONVOLVE
+#include "third_party/sox/src/src/rate_poly_fir.h"
+
+#undef HI_PREC_CLOCK
+
+#define U100_l 42
+#define poly_fir_convolve_U100 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
+#define FUNCTION U100_0
+#define FIR_LENGTH U100_l
+#define CONVOLVE poly_fir_convolve_U100
+#include "third_party/sox/src/src/rate_poly_fir0.h"
+
+#define u100_l 11
+#define poly_fir_convolve_u100 _ _ _ _ _ _ _ _ _ _ _
+#define FUNCTION u100_0
+#define FIR_LENGTH u100_l
+#define CONVOLVE poly_fir_convolve_u100
+#include "third_party/sox/src/src/rate_poly_fir0.h"
+
+#define FUNCTION u100_1
+#define COEF_INTERP 1
+#define PHASE_BITS 8
+#define FIR_LENGTH u100_l
+#define CONVOLVE poly_fir_convolve_u100
+#include "third_party/sox/src/src/rate_poly_fir.h"
+#define u100_1_b 8
+
+#define FUNCTION u100_2
+#define COEF_INTERP 2
+#define PHASE_BITS 6
+#define FIR_LENGTH u100_l
+#define CONVOLVE poly_fir_convolve_u100
+#include "third_party/sox/src/src/rate_poly_fir.h"
+#define u100_2_b 6
+
+typedef struct {float scalar; stage_fn_t fn;} poly_fir1_t;
+typedef struct {float beta; poly_fir1_t interp[3];} poly_fir_t;
+
+static poly_fir_t const poly_firs[] = {
+ {-1, {{0, vpoly0}, { 7.2, vpoly1}, {5.0, vpoly2}}},
+ {-1, {{0, vpoly0}, { 9.4, vpoly1}, {6.7, vpoly2}}},
+ {-1, {{0, vpoly0}, {12.4, vpoly1}, {7.8, vpoly2}}},
+ {-1, {{0, vpoly0}, {13.6, vpoly1}, {9.3, vpoly2}}},
+ {-1, {{0, vpoly0}, {10.5, vpoly2}, {8.4, vpoly3}}},
+ {-1, {{0, vpoly0}, {11.85,vpoly2}, {9.0, vpoly3}}},
+
+ {-1, {{0, vpoly0}, { 8.0, vpoly1}, {5.3, vpoly2}}},
+ {-1, {{0, vpoly0}, { 8.6, vpoly1}, {5.7, vpoly2}}},
+ {-1, {{0, vpoly0}, {10.6, vpoly1}, {6.75,vpoly2}}},
+ {-1, {{0, vpoly0}, {12.6, vpoly1}, {8.6, vpoly2}}},
+ {-1, {{0, vpoly0}, { 9.6, vpoly2}, {7.6, vpoly3}}},
+ {-1, {{0, vpoly0}, {11.4, vpoly2}, {8.65,vpoly3}}},
+
+ {10.62, {{U100_l, U100_0}, {0, 0}, {0, 0}}},
+ {11.28, {{u100_l, u100_0}, {u100_1_b, u100_1}, {u100_2_b, u100_2}}},
+ {-1, {{0, vpoly0}, { 9, vpoly1}, { 6, vpoly2}}},
+ {-1, {{0, vpoly0}, { 11, vpoly1}, { 7, vpoly2}}},
+ {-1, {{0, vpoly0}, { 13, vpoly1}, { 8, vpoly2}}},
+ {-1, {{0, vpoly0}, { 10, vpoly2}, { 8, vpoly3}}},
+ {-1, {{0, vpoly0}, { 12, vpoly2}, { 9, vpoly3}}},
+};
diff --git a/src/src/rate_half_fir.h b/src/src/rate_half_fir.h
new file mode 100644
index 0000000..4327e61
--- /dev/null
+++ b/src/src/rate_half_fir.h
@@ -0,0 +1,39 @@
+/* Effect: change sample rate Copyright (c) 2008,12 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Down-sample by a factor of 2 using a FIR with odd length (LEN).*/
+/* Input must be preceded and followed by LEN >> 1 samples. */
+
+#define _ sum += (input[-(2*j +1)] + input[(2*j +1)]) * COEFS[j], ++j;
+static void FUNCTION(stage_t * p, fifo_t * output_fifo)
+{
+ sample_t const * input = stage_read_p(p);
+ int i, num_out = (stage_occupancy(p) + 1) / 2;
+ sample_t * output = fifo_reserve(output_fifo, num_out);
+
+ for (i = 0; i < num_out; ++i, input += 2) {
+ int j = 0;
+ sample_t sum = input[0] * .5;
+ CONVOLVE
+ output[i] = sum;
+ }
+ fifo_read(&p->fifo, 2 * num_out, NULL);
+}
+#undef _
+#undef COEFS
+#undef CONVOLVE
+#undef FUNCTION
diff --git a/src/src/rate_poly_fir.h b/src/src/rate_poly_fir.h
new file mode 100644
index 0000000..deca303
--- /dev/null
+++ b/src/src/rate_poly_fir.h
@@ -0,0 +1,91 @@
+/* Effect: change sample rate Copyright (c) 2008,12 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Resample using an interpolated poly-phase FIR with length LEN.*/
+/* Input must be followed by LEN-1 samples. */
+
+#define a (coef(p->shared->poly_fir_coefs, COEF_INTERP, FIR_LENGTH, phase, 0,j))
+#define b (coef(p->shared->poly_fir_coefs, COEF_INTERP, FIR_LENGTH, phase, 1,j))
+#define c (coef(p->shared->poly_fir_coefs, COEF_INTERP, FIR_LENGTH, phase, 2,j))
+#define d (coef(p->shared->poly_fir_coefs, COEF_INTERP, FIR_LENGTH, phase, 3,j))
+#if COEF_INTERP == 0
+ #define _ sum += a *in[j], ++j;
+#elif COEF_INTERP == 1
+ #define _ sum += (b *x + a)*in[j], ++j;
+#elif COEF_INTERP == 2
+ #define _ sum += ((c *x + b)*x + a)*in[j], ++j;
+#elif COEF_INTERP == 3
+ #define _ sum += (((d*x + c)*x + b)*x + a)*in[j], ++j;
+#else
+ #error COEF_INTERP
+#endif
+
+static void FUNCTION(stage_t * p, fifo_t * output_fifo)
+{
+ sample_t const * input = stage_read_p(p);
+ int i, num_in = stage_occupancy(p), max_num_out = 1 + num_in*p->out_in_ratio;
+ sample_t * output = fifo_reserve(output_fifo, max_num_out);
+
+#if defined HI_PREC_CLOCK
+ if (p->use_hi_prec_clock) {
+ hi_prec_clock_t at = p->at.hi_prec_clock;
+ for (i = 0; (int)at < num_in; ++i, at += p->step.hi_prec_clock) {
+ sample_t const * in = input + (int)at;
+ hi_prec_clock_t fraction = at - (int)at;
+ int phase = fraction * (1 << PHASE_BITS);
+#if COEF_INTERP > 0
+ sample_t x = fraction * (1 << PHASE_BITS) - phase;
+#endif
+ sample_t sum = 0;
+ int j = 0;
+ CONVOLVE
+ output[i] = sum;
+ }
+ fifo_read(&p->fifo, (int)at, NULL);
+ p->at.hi_prec_clock = at - (int)at;
+ } else
+#endif
+ {
+ for (i = 0; p->at.parts.integer < num_in; ++i, p->at.all += p->step.all) {
+ sample_t const * in = input + p->at.parts.integer;
+ uint32_t fraction = p->at.parts.fraction;
+ int phase = fraction >> (32 - PHASE_BITS); /* high-order bits */
+#if COEF_INTERP > 0 /* low-order bits, scaled to [0,1) */
+ sample_t x = (sample_t) (fraction << PHASE_BITS) * (1 / MULT32);
+#endif
+ sample_t sum = 0;
+ int j = 0;
+ CONVOLVE
+ output[i] = sum;
+ }
+ fifo_read(&p->fifo, p->at.parts.integer, NULL);
+ p->at.parts.integer = 0;
+ }
+ assert(max_num_out - i >= 0);
+ fifo_trim_by(output_fifo, max_num_out - i);
+}
+
+#undef _
+#undef a
+#undef b
+#undef c
+#undef d
+#undef COEF_INTERP
+#undef CONVOLVE
+#undef FIR_LENGTH
+#undef FUNCTION
+#undef PHASE_BITS
diff --git a/src/src/rate_poly_fir0.h b/src/src/rate_poly_fir0.h
new file mode 100644
index 0000000..38790f6
--- /dev/null
+++ b/src/src/rate_poly_fir0.h
@@ -0,0 +1,48 @@
+/* Effect: change sample rate Copyright (c) 2008,12 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Resample using a non-interpolated poly-phase FIR with length LEN.*/
+/* Input must be followed by LEN-1 samples. */
+
+#define _ sum += (coef(p->shared->poly_fir_coefs, 0, FIR_LENGTH, divided.rem, 0, j)) *at[j], ++j;
+
+static void FUNCTION(stage_t * p, fifo_t * output_fifo)
+{
+ sample_t const * input = stage_read_p(p);
+ int i, num_in = stage_occupancy(p), max_num_out = 1 + num_in*p->out_in_ratio;
+ sample_t * output = fifo_reserve(output_fifo, max_num_out);
+ div_t divided2;
+
+ for (i = 0; p->at.parts.integer < num_in * p->L; ++i, p->at.parts.integer += p->step.parts.integer) {
+ div_t divided = div(p->at.parts.integer, p->L);
+ sample_t const * at = input + divided.quot;
+ sample_t sum = 0;
+ int j = 0;
+ CONVOLVE
+ output[i] = sum;
+ }
+ assert(max_num_out - i >= 0);
+ fifo_trim_by(output_fifo, max_num_out - i);
+ divided2 = div(p->at.parts.integer, p->L);
+ fifo_read(&p->fifo, divided2.quot, NULL);
+ p->at.parts.integer = divided2.rem;
+}
+
+#undef _
+#undef CONVOLVE
+#undef FIR_LENGTH
+#undef FUNCTION
diff --git a/src/src/raw-fmt.c b/src/src/raw-fmt.c
new file mode 100644
index 0000000..0223a31
--- /dev/null
+++ b/src/src/raw-fmt.c
@@ -0,0 +1,61 @@
+/* libSoX file formats: raw (c) 2007-11 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+static int raw_start(sox_format_t * ft) {
+ return lsx_rawstart(ft, sox_false, sox_false, sox_true, SOX_ENCODING_UNKNOWN, 0);
+}
+
+LSX_FORMAT_HANDLER(raw)
+{
+ static char const * const names[] = {"raw", NULL};
+ static unsigned const encodings[] = {
+ SOX_ENCODING_SIGN2, 32, 24, 16, 8, 0,
+ SOX_ENCODING_UNSIGNED, 32, 24, 16, 8, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_FLOAT, 64, 32, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Raw PCM, mu-law, or A-law", names, 0,
+ raw_start, lsx_rawread , NULL,
+ raw_start, lsx_rawwrite, NULL,
+ lsx_rawseek, encodings, NULL, 0
+ };
+ return &handler;
+}
+
+static int sln_start(sox_format_t * ft)
+{
+ return lsx_check_read_params(ft, 1, 8000., SOX_ENCODING_SIGN2, 16, (uint64_t)0, sox_false);
+}
+
+LSX_FORMAT_HANDLER(sln)
+{
+ static char const * const names[] = {"sln", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 16, 0, 0};
+ static sox_rate_t const write_rates[] = {8000, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Asterisk PBX headerless format",
+ names, SOX_FILE_LIT_END|SOX_FILE_MONO,
+ sln_start, lsx_rawread, NULL,
+ NULL, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, write_rates, 0
+ };
+ return &handler;
+}
diff --git a/src/src/raw.c b/src/src/raw.c
new file mode 100644
index 0000000..e8ada5e
--- /dev/null
+++ b/src/src/raw.c
@@ -0,0 +1,196 @@
+/* libSoX raw I/O
+ *
+ * Copyright 1991-2007 Lance Norskog And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g711.h"
+
+typedef sox_uint16_t sox_uint14_t;
+typedef sox_uint16_t sox_uint13_t;
+typedef sox_int16_t sox_int14_t;
+typedef sox_int16_t sox_int13_t;
+#define SOX_ULAW_BYTE_TO_SAMPLE(d,clips) SOX_SIGNED_16BIT_TO_SAMPLE(sox_ulaw2linear16(d),clips)
+#define SOX_ALAW_BYTE_TO_SAMPLE(d,clips) SOX_SIGNED_16BIT_TO_SAMPLE(sox_alaw2linear16(d),clips)
+#define SOX_SAMPLE_TO_ULAW_BYTE(d,c) sox_14linear2ulaw(SOX_SAMPLE_TO_UNSIGNED(14,d,c) - 0x2000)
+#define SOX_SAMPLE_TO_ALAW_BYTE(d,c) sox_13linear2alaw(SOX_SAMPLE_TO_UNSIGNED(13,d,c) - 0x1000)
+
+int lsx_rawseek(sox_format_t * ft, uint64_t offset)
+{
+ return lsx_offset_seek(ft, (off_t)ft->data_start, (off_t)offset);
+}
+
+/* Works nicely for starting read and write; lsx_rawstart{read,write}
+ * are #defined in sox_i.h */
+int lsx_rawstart(sox_format_t * ft, sox_bool default_rate,
+ sox_bool default_channels, sox_bool default_length,
+ sox_encoding_t encoding, unsigned size)
+{
+ if (default_rate && ft->signal.rate == 0) {
+ lsx_warn("`%s': sample rate not specified; trying 8kHz", ft->filename);
+ ft->signal.rate = 8000;
+ }
+
+ if (default_channels && ft->signal.channels == 0) {
+ lsx_warn("`%s': # channels not specified; trying mono", ft->filename);
+ ft->signal.channels = 1;
+ }
+
+ if (encoding != SOX_ENCODING_UNKNOWN) {
+ if (ft->mode == 'r' && ft->encoding.encoding != SOX_ENCODING_UNKNOWN &&
+ ft->encoding.encoding != encoding)
+ lsx_report("`%s': Format options overriding file-type encoding",
+ ft->filename);
+ else
+ ft->encoding.encoding = encoding;
+ }
+
+ if (size != 0) {
+ if (ft->mode == 'r' && ft->encoding.bits_per_sample != 0 &&
+ ft->encoding.bits_per_sample != size)
+ lsx_report("`%s': Format options overriding file-type sample-size",
+ ft->filename);
+ else
+ ft->encoding.bits_per_sample = size;
+ }
+
+ if (!ft->signal.length && ft->mode == 'r' && default_length &&
+ ft->encoding.bits_per_sample)
+ ft->signal.length =
+ div_bits(lsx_filelength(ft), ft->encoding.bits_per_sample);
+
+ return SOX_SUCCESS;
+}
+
+#define READ_SAMPLES_FUNC(type, size, sign, ctype, uctype, cast) \
+ static size_t sox_read_ ## sign ## type ## _samples( \
+ sox_format_t * ft, sox_sample_t *buf, size_t len) \
+ { \
+ size_t n, nread; \
+ SOX_SAMPLE_LOCALS; \
+ ctype *data = lsx_malloc(sizeof(ctype) * len); \
+ LSX_USE_VAR(sox_macro_temp_sample), LSX_USE_VAR(sox_macro_temp_double); \
+ nread = lsx_read_ ## type ## _buf(ft, (uctype *)data, len); \
+ for (n = 0; n < nread; n++) \
+ *buf++ = cast(data[n], ft->clips); \
+ free(data); \
+ return nread; \
+ }
+
+READ_SAMPLES_FUNC(b, 1, u, uint8_t, uint8_t, SOX_UNSIGNED_8BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(b, 1, s, int8_t, uint8_t, SOX_SIGNED_8BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(b, 1, ulaw, uint8_t, uint8_t, SOX_ULAW_BYTE_TO_SAMPLE)
+READ_SAMPLES_FUNC(b, 1, alaw, uint8_t, uint8_t, SOX_ALAW_BYTE_TO_SAMPLE)
+READ_SAMPLES_FUNC(w, 2, u, uint16_t, uint16_t, SOX_UNSIGNED_16BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(w, 2, s, int16_t, uint16_t, SOX_SIGNED_16BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(3, 3, u, sox_uint24_t, sox_uint24_t, SOX_UNSIGNED_24BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(3, 3, s, sox_int24_t, sox_uint24_t, SOX_SIGNED_24BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(dw, 4, u, uint32_t, uint32_t, SOX_UNSIGNED_32BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(dw, 4, s, int32_t, uint32_t, SOX_SIGNED_32BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(f, sizeof(float), su, float, float, SOX_FLOAT_32BIT_TO_SAMPLE)
+READ_SAMPLES_FUNC(df, sizeof(double), su, double, double, SOX_FLOAT_64BIT_TO_SAMPLE)
+
+#define WRITE_SAMPLES_FUNC(type, size, sign, ctype, uctype, cast) \
+ static size_t sox_write_ ## sign ## type ## _samples( \
+ sox_format_t * ft, sox_sample_t const * buf, size_t len) \
+ { \
+ SOX_SAMPLE_LOCALS; \
+ size_t n, nwritten; \
+ ctype *data = lsx_malloc(sizeof(ctype) * len); \
+ LSX_USE_VAR(sox_macro_temp_sample), LSX_USE_VAR(sox_macro_temp_double); \
+ for (n = 0; n < len; n++) \
+ data[n] = cast(buf[n], ft->clips); \
+ nwritten = lsx_write_ ## type ## _buf(ft, (uctype *)data, len); \
+ free(data); \
+ return nwritten; \
+ }
+
+
+WRITE_SAMPLES_FUNC(b, 1, u, uint8_t, uint8_t, SOX_SAMPLE_TO_UNSIGNED_8BIT)
+WRITE_SAMPLES_FUNC(b, 1, s, int8_t, uint8_t, SOX_SAMPLE_TO_SIGNED_8BIT)
+WRITE_SAMPLES_FUNC(b, 1, ulaw, uint8_t, uint8_t, SOX_SAMPLE_TO_ULAW_BYTE)
+WRITE_SAMPLES_FUNC(b, 1, alaw, uint8_t, uint8_t, SOX_SAMPLE_TO_ALAW_BYTE)
+WRITE_SAMPLES_FUNC(w, 2, u, uint16_t, uint16_t, SOX_SAMPLE_TO_UNSIGNED_16BIT)
+WRITE_SAMPLES_FUNC(w, 2, s, int16_t, uint16_t, SOX_SAMPLE_TO_SIGNED_16BIT)
+WRITE_SAMPLES_FUNC(3, 3, u, sox_uint24_t, sox_uint24_t, SOX_SAMPLE_TO_UNSIGNED_24BIT)
+WRITE_SAMPLES_FUNC(3, 3, s, sox_int24_t, sox_uint24_t, SOX_SAMPLE_TO_SIGNED_24BIT)
+WRITE_SAMPLES_FUNC(dw, 4, u, uint32_t, uint32_t, SOX_SAMPLE_TO_UNSIGNED_32BIT)
+WRITE_SAMPLES_FUNC(dw, 4, s, int32_t, uint32_t, SOX_SAMPLE_TO_SIGNED_32BIT)
+WRITE_SAMPLES_FUNC(f, sizeof(float), su, float, float, SOX_SAMPLE_TO_FLOAT_32BIT)
+WRITE_SAMPLES_FUNC(df, sizeof (double), su, double, double, SOX_SAMPLE_TO_FLOAT_64BIT)
+
+#define GET_FORMAT(type) \
+static ft_##type##_fn * type##_fn(sox_format_t * ft) { \
+ switch (ft->encoding.bits_per_sample) { \
+ case 8: \
+ switch (ft->encoding.encoding) { \
+ case SOX_ENCODING_SIGN2: return sox_##type##_sb_samples; \
+ case SOX_ENCODING_UNSIGNED: return sox_##type##_ub_samples; \
+ case SOX_ENCODING_ULAW: return sox_##type##_ulawb_samples; \
+ case SOX_ENCODING_ALAW: return sox_##type##_alawb_samples; \
+ default: break; } \
+ break; \
+ case 16: \
+ switch (ft->encoding.encoding) { \
+ case SOX_ENCODING_SIGN2: return sox_##type##_sw_samples; \
+ case SOX_ENCODING_UNSIGNED: return sox_##type##_uw_samples; \
+ default: break; } \
+ break; \
+ case 24: \
+ switch (ft->encoding.encoding) { \
+ case SOX_ENCODING_SIGN2: return sox_##type##_s3_samples; \
+ case SOX_ENCODING_UNSIGNED: return sox_##type##_u3_samples; \
+ default: break; } \
+ break; \
+ case 32: \
+ switch (ft->encoding.encoding) { \
+ case SOX_ENCODING_SIGN2: return sox_##type##_sdw_samples; \
+ case SOX_ENCODING_UNSIGNED: return sox_##type##_udw_samples; \
+ case SOX_ENCODING_FLOAT: return sox_##type##_suf_samples; \
+ default: break; } \
+ break; \
+ case 64: \
+ switch (ft->encoding.encoding) { \
+ case SOX_ENCODING_FLOAT: return sox_##type##_sudf_samples; \
+ default: break; } \
+ break; \
+ default: \
+ lsx_fail_errno(ft, SOX_EFMT, "this handler does not support this data size"); \
+ return NULL; } \
+ lsx_fail_errno(ft, SOX_EFMT, "this encoding is not supported for this data size"); \
+ return NULL; }
+
+typedef size_t(ft_read_fn)
+ (sox_format_t * ft, sox_sample_t * buf, size_t len);
+
+GET_FORMAT(read)
+
+/* Read a stream of some type into SoX's internal buffer format. */
+size_t lsx_rawread(sox_format_t * ft, sox_sample_t * buf, size_t nsamp)
+{
+ ft_read_fn * read_buf = read_fn(ft);
+
+ if (read_buf && nsamp)
+ return read_buf(ft, buf, nsamp);
+ return 0;
+}
+
+typedef size_t(ft_write_fn)
+ (sox_format_t * ft, sox_sample_t const * buf, size_t len);
+
+GET_FORMAT(write)
+
+/* Writes SoX's internal buffer format to buffer of various data types. */
+size_t lsx_rawwrite(
+ sox_format_t * ft, sox_sample_t const * buf, size_t nsamp)
+{
+ ft_write_fn * write_buf = write_fn(ft);
+
+ if (write_buf && nsamp)
+ return write_buf(ft, buf, nsamp);
+ return 0;
+}
diff --git a/src/src/raw.h b/src/src/raw.h
new file mode 100644
index 0000000..6a5c4a5
--- /dev/null
+++ b/src/src/raw.h
@@ -0,0 +1,54 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define RAW_FORMAT0(id, size, flags, encoding) \
+static int id ## _start(sox_format_t * ft) { \
+ return lsx_rawstart(ft, sox_true, sox_true, sox_true, SOX_ENCODING_ ## encoding, size); \
+} \
+const sox_format_handler_t *lsx_ ## id ## _format_fn(void); \
+const sox_format_handler_t *lsx_ ## id ## _format_fn(void) { \
+ static unsigned const write_encodings[] = { \
+ SOX_ENCODING_ ## encoding, size, 0, 0}; \
+ static sox_format_handler_t handler = { \
+ SOX_LIB_VERSION_CODE, "Raw audio", \
+ names, flags, \
+ id ## _start, lsx_rawread , NULL, \
+ id ## _start, lsx_rawwrite, NULL, \
+ NULL, write_encodings, NULL, 0 \
+ }; \
+ return &handler; \
+}
+
+#define RAW_FORMAT(id, size, flags, encoding) \
+ static char const *names[] = {#id, NULL}; \
+ RAW_FORMAT0(id, size, flags, encoding)
+
+#define RAW_FORMAT1(id, alt, size, flags, encoding) \
+ static char const *names[] = {#id, alt, NULL}; \
+ RAW_FORMAT0(id, size, flags, encoding)
+
+#define RAW_FORMAT2(id, alt1, alt2, size, flags, encoding) \
+ static char const *names[] = {#id, alt1, alt2, NULL}; \
+ RAW_FORMAT0(id, size, flags, encoding)
+
+#define RAW_FORMAT3(id, alt1, alt2, alt3, size, flags, encoding) \
+ static char const *names[] = {#id, alt1, alt2, alt3, NULL}; \
+ RAW_FORMAT0(id, size, flags, encoding)
+
+#define RAW_FORMAT4(id, alt1, alt2, alt3, alt4, size, flags, encoding) \
+ static char const *names[] = {#id, alt1, alt2, alt3, alt4, NULL}; \
+ RAW_FORMAT0(id, size, flags, encoding)
diff --git a/src/src/remix.c b/src/src/remix.c
new file mode 100644
index 0000000..f62d495
--- /dev/null
+++ b/src/src/remix.c
@@ -0,0 +1,284 @@
+/* libSoX effect: remix Copyright (c) 2008-9 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef struct {
+ enum {semi, automatic, manual} mode;
+ sox_bool mix_power;
+ unsigned num_out_channels, min_in_channels;
+ struct {
+ char * str; /* Command-line argument to parse for this out_spec */
+ unsigned num_in_channels;
+ struct in_spec {
+ unsigned channel_num;
+ double multiplier;
+ } * in_specs;
+ } * out_specs;
+} priv_t;
+
+#define PARSE(SEP, SCAN, VAR, MIN, SEPARATORS) do {\
+ end = strpbrk(text, SEPARATORS); \
+ if (end == text) \
+ SEP = *text++; \
+ else { \
+ SEP = (SEPARATORS)[strlen(SEPARATORS) - 1]; \
+ n = sscanf(text, SCAN"%c", &VAR, &SEP); \
+ if (n == 0 || VAR < MIN || (n == 2 && !strchr(SEPARATORS, SEP))) \
+ return lsx_usage(effp); \
+ text = end? end + 1 : text + strlen(text); \
+ } \
+} while (0)
+
+static int parse(sox_effect_t * effp, char * * argv, unsigned channels)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i, j;
+ double mult;
+
+ p->min_in_channels = 0;
+ for (i = 0; i < p->num_out_channels; ++i) {
+ sox_bool mul_spec = sox_false;
+ char * text, * end;
+ if (argv) /* 1st parse only */
+ p->out_specs[i].str = lsx_strdup(argv[i]);
+ for (j = 0, text = p->out_specs[i].str; *text;) {
+ static char const separators[] = "-vpi,";
+ char sep1, sep2;
+ int chan1 = 1, chan2 = channels, n;
+ double multiplier = HUGE_VAL;
+
+ PARSE(sep1, "%i", chan1, 0, separators);
+ if (!chan1) {
+ if (j || *text)
+ return lsx_usage(effp);
+ continue;
+ }
+ if (sep1 == '-')
+ PARSE(sep1, "%i", chan2, 0, separators + 1);
+ else chan2 = chan1;
+ if (sep1 != ',') {
+ multiplier = sep1 == 'v' ? 1 : 0;
+ PARSE(sep2, "%lf", multiplier, -HUGE_VAL, separators + 4);
+ if (sep1 != 'v')
+ multiplier = (sep1 == 'p'? 1 : -1) * dB_to_linear(multiplier);
+ mul_spec = sox_true;
+ }
+ if (chan2 < chan1) {int t = chan1; chan1 = chan2; chan2 = t;}
+ p->out_specs[i].in_specs = lsx_realloc(p->out_specs[i].in_specs,
+ (j + chan2 - chan1 + 1) * sizeof(*p->out_specs[i].in_specs));
+ while (chan1 <= chan2) {
+ p->out_specs[i].in_specs[j].channel_num = chan1++ - 1;
+ p->out_specs[i].in_specs[j++].multiplier = multiplier;
+ }
+ p->min_in_channels = max(p->min_in_channels, (unsigned)chan2);
+ }
+ p->out_specs[i].num_in_channels = j;
+ mult = 1. / (p->mix_power? sqrt((double)j) : j);
+ for (j = 0; j < p->out_specs[i].num_in_channels; ++j)
+ if (p->out_specs[i].in_specs[j].multiplier == HUGE_VAL)
+ p->out_specs[i].in_specs[j].multiplier = (p->mode == automatic || (p->mode == semi && !mul_spec)) ? mult : 1;
+ }
+ effp->out_signal.channels = p->num_out_channels;
+ return SOX_SUCCESS;
+}
+
+static int show(priv_t *p)
+{
+ unsigned i, j;
+
+ for (j = 0; j < p->num_out_channels; j++) {
+ lsx_debug("%i: ", j);
+ for (i = 0; i < p->out_specs[j].num_in_channels; i++)
+ lsx_debug("\t%i %g", p->out_specs[j].in_specs[i].channel_num, p->out_specs[j].in_specs[i].multiplier);
+ }
+ return SOX_SUCCESS;
+}
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ --argc, ++argv;
+ if (argc && !strcmp(*argv, "-m")) p->mode = manual , ++argv, --argc;
+ if (argc && !strcmp(*argv, "-a")) p->mode = automatic, ++argv, --argc;
+ if (argc && !strcmp(*argv, "-p")) p->mix_power = sox_true, ++argv, --argc;
+ if (!argc) {
+ lsx_fail("must specify at least one output channel");
+ return SOX_EOF;
+ }
+ p->num_out_channels = argc;
+ p->out_specs = lsx_calloc(p->num_out_channels, sizeof(*p->out_specs));
+ return parse(effp, argv, 1); /* No channels yet; parse with dummy */
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ double max_sum = 0;
+ unsigned i, j;
+ int non_integer = 0;
+
+ parse(effp, NULL, effp->in_signal.channels);
+ if (effp->in_signal.channels < p->min_in_channels) {
+ lsx_fail("too few input channels");
+ return SOX_EOF;
+ }
+
+ for (j = 0; j < effp->out_signal.channels; j++) {
+ double sum = 0;
+ for (i = 0; i < p->out_specs[j].num_in_channels; i++) {
+ double mult = p->out_specs[j].in_specs[i].multiplier;
+ sum += fabs(mult);
+ non_integer += floor(mult) != mult;
+ }
+ max_sum = max(max_sum, sum);
+ }
+ if (effp->in_signal.mult && max_sum > 1)
+ *effp->in_signal.mult /= max_sum;
+ if (!non_integer)
+ effp->out_signal.precision = effp->in_signal.precision;
+ else
+ effp->out_signal.precision = SOX_SAMPLE_PRECISION;
+ show(p);
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i, j, len;
+ len = min(*isamp / effp->in_signal.channels, *osamp / effp->out_signal.channels);
+ *isamp = len * effp->in_signal.channels;
+ *osamp = len * effp->out_signal.channels;
+
+ for (; len--; ibuf += effp->in_signal.channels) for (j = 0; j < effp->out_signal.channels; j++) {
+ double out = 0;
+ for (i = 0; i < p->out_specs[j].num_in_channels; i++)
+ out += ibuf[p->out_specs[j].in_specs[i].channel_num] * p->out_specs[j].in_specs[i].multiplier;
+ *obuf++ = SOX_ROUND_CLIP_COUNT(out, effp->clips);
+ }
+ return SOX_SUCCESS;
+}
+
+static int closedown(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+ for (i = 0; i < p->num_out_channels; ++i) {
+ free(p->out_specs[i].str);
+ free(p->out_specs[i].in_specs);
+ }
+ free(p->out_specs);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_remix_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "remix", "[-m|-a] [-p] <0|in-chan[v|p|i volume]{,in-chan[v|p|i volume]}>",
+ SOX_EFF_MCHAN | SOX_EFF_CHAN | SOX_EFF_GAIN | SOX_EFF_PREC,
+ create, start, flow, NULL, NULL, closedown, sizeof(priv_t)
+ };
+ return &handler;
+}
+
+/*----------------------- The `channels' effect alias ------------------------*/
+
+static int channels_create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ char dummy; /* To check for extraneous chars. */
+
+ if (argc == 2) {
+ if (sscanf(argv[1], "%d %c", (int *)&p->num_out_channels,
+ &dummy) != 1 || (int)p->num_out_channels <= 0)
+ return lsx_usage(effp);
+ effp->out_signal.channels = p->num_out_channels;
+ }
+ else if (argc != 1)
+ return lsx_usage(effp);
+ return SOX_SUCCESS;
+}
+
+static int channels_start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned num_out_channels = p->num_out_channels != 0 ?
+ p->num_out_channels : effp->out_signal.channels;
+ unsigned i, j;
+
+ p->out_specs = lsx_calloc(num_out_channels, sizeof(*p->out_specs));
+ if (effp->in_signal.channels == num_out_channels)
+ return SOX_EFF_NULL;
+
+ if (effp->in_signal.channels > num_out_channels) {
+ for (j = 0; j < num_out_channels; j++) {
+ unsigned in_per_out = (effp->in_signal.channels +
+ num_out_channels - 1 - j) / num_out_channels;
+ lsx_valloc(p->out_specs[j].in_specs, in_per_out);
+ p->out_specs[j].num_in_channels = in_per_out;
+ for (i = 0; i < in_per_out; ++i) {
+ p->out_specs[j].in_specs[i].channel_num = i * num_out_channels + j;
+ p->out_specs[j].in_specs[i].multiplier = 1. / in_per_out;
+ }
+ }
+ }
+ else for (j = 0; j < num_out_channels; j++) {
+ lsx_valloc(p->out_specs[j].in_specs, 1);
+ p->out_specs[j].num_in_channels = 1;
+ p->out_specs[j].in_specs[0].channel_num = j % effp->in_signal.channels;
+ p->out_specs[j].in_specs[0].multiplier = 1;
+ }
+ effp->out_signal.channels = p->num_out_channels = num_out_channels;
+ effp->out_signal.precision = (effp->in_signal.channels > num_out_channels) ?
+ SOX_SAMPLE_PRECISION : effp->in_signal.precision;
+ show(p);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_channels_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_remix_effect_fn();
+ handler.name = "channels";
+ handler.usage = "number";
+ handler.flags &= ~SOX_EFF_GAIN;
+ handler.getopts = channels_create;
+ handler.start = channels_start;
+ return &handler;
+}
+
+/*------------------------- The `oops' effect alias --------------------------*/
+
+static int oops_getopts(sox_effect_t *effp, int argc, char **argv)
+{
+ char *args[] = {0, "1,2i", "1,2i"};
+ args[0] = argv[0];
+ return --argc? lsx_usage(effp) : create(effp, 3, args);
+}
+
+sox_effect_handler_t const * lsx_oops_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_remix_effect_fn();
+ handler.name = "oops";
+ handler.usage = NULL;
+ handler.getopts = oops_getopts;
+ return &handler;
+}
diff --git a/src/src/repeat.c b/src/src/repeat.c
new file mode 100644
index 0000000..52bb285
--- /dev/null
+++ b/src/src/repeat.c
@@ -0,0 +1,114 @@
+/* libSoX repeat effect Copyright (c) 2004 Jan Paul Schmidt <jps@fundament.org>
+ * Re-write (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {
+ unsigned num_repeats, remaining_repeats;
+ uint64_t num_samples, remaining_samples;
+ FILE * tmp_file;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ p->num_repeats = 1;
+ --argc, ++argv;
+ if (argc == 1 && !strcmp(*argv, "-")) {
+ p->num_repeats = UINT_MAX;
+ return SOX_SUCCESS;
+ }
+ do {NUMERIC_PARAMETER(num_repeats, 0, UINT_MAX - 1)} while (0);
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (!p->num_repeats)
+ return SOX_EFF_NULL;
+
+ if (!(p->tmp_file = lsx_tmpfile())) {
+ lsx_fail("can't create temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ p->num_samples = p->remaining_samples = 0;
+ p->remaining_repeats = p->num_repeats;
+ if (effp->in_signal.length != SOX_UNKNOWN_LEN && p->num_repeats != UINT_MAX)
+ effp->out_signal.length = effp->in_signal.length * (p->num_repeats + 1);
+ else
+ effp->out_signal.length = SOX_UNKNOWN_LEN;
+
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = min(*isamp, *osamp);
+ memcpy(obuf, ibuf, len * sizeof(*obuf));
+ if (fwrite(ibuf, sizeof(*ibuf), len, p->tmp_file) != len) {
+ lsx_fail("error writing temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ p->num_samples += len;
+ *isamp = *osamp = len;
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t odone = 0, n;
+
+ *osamp -= *osamp % effp->in_signal.channels;
+
+ while ((p->remaining_samples || p->remaining_repeats) && odone < *osamp) {
+ if (!p->remaining_samples) {
+ p->remaining_samples = p->num_samples;
+ if (p->remaining_repeats != UINT_MAX)
+ --p->remaining_repeats;
+ rewind(p->tmp_file);
+ }
+ n = min(p->remaining_samples, *osamp - odone);
+ if ((fread(obuf + odone, sizeof(*obuf), n, p->tmp_file)) != n) {
+ lsx_fail("error reading temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ p->remaining_samples -= n;
+ odone += n;
+ }
+ *osamp = odone;
+ return p->remaining_samples || p->remaining_repeats? SOX_SUCCESS : SOX_EOF;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ fclose(p->tmp_file); /* auto-deleted by lsx_tmpfile */
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_repeat_effect_fn(void)
+{
+ static sox_effect_handler_t effect = {"repeat", "[count (1)]",
+ SOX_EFF_MCHAN | SOX_EFF_LENGTH | SOX_EFF_MODIFY,
+ create, start, flow, drain, stop, NULL, sizeof(priv_t)};
+ return &effect;
+}
diff --git a/src/src/reverb.c b/src/src/reverb.c
new file mode 100644
index 0000000..e6792a8
--- /dev/null
+++ b/src/src/reverb.c
@@ -0,0 +1,277 @@
+/* libSoX effect: stereo reverberation
+ * Copyright (c) 2007 robs@users.sourceforge.net
+ * Filter design based on freeverb by Jezar at Dreampoint.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/fifo.h"
+
+#define lsx_zalloc(var, n) var = lsx_calloc(n, sizeof(*var))
+#define filter_advance(p) if (--(p)->ptr < (p)->buffer) (p)->ptr += (p)->size
+#define filter_delete(p) free((p)->buffer)
+
+typedef struct {
+ size_t size;
+ float * buffer, * ptr;
+ float store;
+} filter_t;
+
+static float comb_process(filter_t * p, /* gcc -O2 will inline this */
+ float const * input, float const * feedback, float const * hf_damping)
+{
+ float output = *p->ptr;
+ p->store = output + (p->store - output) * *hf_damping;
+ *p->ptr = *input + p->store * *feedback;
+ filter_advance(p);
+ return output;
+}
+
+static float allpass_process(filter_t * p, /* gcc -O2 will inline this */
+ float const * input)
+{
+ float output = *p->ptr;
+ *p->ptr = *input + output * .5;
+ filter_advance(p);
+ return output - *input;
+}
+
+static const size_t /* Filter delay lengths in samples (44100Hz sample-rate) */
+ comb_lengths[] = {1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617},
+ allpass_lengths[] = {225, 341, 441, 556};
+#define stereo_adjust 12
+
+typedef struct {
+ filter_t comb [array_length(comb_lengths)];
+ filter_t allpass[array_length(allpass_lengths)];
+} filter_array_t;
+
+static void filter_array_create(filter_array_t * p, double rate,
+ double scale, double offset)
+{
+ size_t i;
+ double r = rate * (1 / 44100.); /* Compensate for actual sample-rate */
+
+ for (i = 0; i < array_length(comb_lengths); ++i, offset = -offset)
+ {
+ filter_t * pcomb = &p->comb[i];
+ pcomb->size = (size_t)(scale * r * (comb_lengths[i] + stereo_adjust * offset) + .5);
+ pcomb->ptr = lsx_zalloc(pcomb->buffer, pcomb->size);
+ }
+ for (i = 0; i < array_length(allpass_lengths); ++i, offset = -offset)
+ {
+ filter_t * pallpass = &p->allpass[i];
+ pallpass->size = (size_t)(r * (allpass_lengths[i] + stereo_adjust * offset) + .5);
+ pallpass->ptr = lsx_zalloc(pallpass->buffer, pallpass->size);
+ }
+}
+
+static void filter_array_process(filter_array_t * p,
+ size_t length, float const * input, float * output,
+ float const * feedback, float const * hf_damping, float const * gain)
+{
+ while (length--) {
+ float out = 0, in = *input++;
+
+ size_t i = array_length(comb_lengths) - 1;
+ do out += comb_process(p->comb + i, &in, feedback, hf_damping);
+ while (i--);
+
+ i = array_length(allpass_lengths) - 1;
+ do out = allpass_process(p->allpass + i, &out);
+ while (i--);
+
+ *output++ = out * *gain;
+ }
+}
+
+static void filter_array_delete(filter_array_t * p)
+{
+ size_t i;
+
+ for (i = 0; i < array_length(allpass_lengths); ++i)
+ filter_delete(&p->allpass[i]);
+ for (i = 0; i < array_length(comb_lengths); ++i)
+ filter_delete(&p->comb[i]);
+}
+
+typedef struct {
+ float feedback;
+ float hf_damping;
+ float gain;
+ fifo_t input_fifo;
+ filter_array_t chan[2];
+ float * out[2];
+} reverb_t;
+
+static void reverb_create(reverb_t * p, double sample_rate_Hz,
+ double wet_gain_dB,
+ double room_scale, /* % */
+ double reverberance, /* % */
+ double hf_damping, /* % */
+ double pre_delay_ms,
+ double stereo_depth,
+ size_t buffer_size,
+ float * * out)
+{
+ size_t i, delay = pre_delay_ms / 1000 * sample_rate_Hz + .5;
+ double scale = room_scale / 100 * .9 + .1;
+ double depth = stereo_depth / 100;
+ double a = -1 / log(1 - /**/.3 /**/); /* Set minimum feedback */
+ double b = 100 / (log(1 - /**/.98/**/) * a + 1); /* Set maximum feedback */
+
+ memset(p, 0, sizeof(*p));
+ p->feedback = 1 - exp((reverberance - b) / (a * b));
+ p->hf_damping = hf_damping / 100 * .3 + .2;
+ p->gain = dB_to_linear(wet_gain_dB) * .015;
+ fifo_create(&p->input_fifo, sizeof(float));
+ memset(fifo_write(&p->input_fifo, delay, 0), 0, delay * sizeof(float));
+ for (i = 0; i <= ceil(depth); ++i) {
+ filter_array_create(p->chan + i, sample_rate_Hz, scale, i * depth);
+ out[i] = lsx_zalloc(p->out[i], buffer_size);
+ }
+}
+
+static void reverb_process(reverb_t * p, size_t length)
+{
+ size_t i;
+ for (i = 0; i < 2 && p->out[i]; ++i)
+ filter_array_process(p->chan + i, length, (float *) fifo_read_ptr(&p->input_fifo), p->out[i], &p->feedback, &p->hf_damping, &p->gain);
+ fifo_read(&p->input_fifo, length, NULL);
+}
+
+static void reverb_delete(reverb_t * p)
+{
+ size_t i;
+ for (i = 0; i < 2 && p->out[i]; ++i) {
+ free(p->out[i]);
+ filter_array_delete(p->chan + i);
+ }
+ fifo_delete(&p->input_fifo);
+}
+
+/*------------------------------- SoX Wrapper --------------------------------*/
+
+typedef struct {
+ double reverberance, hf_damping, pre_delay_ms;
+ double stereo_depth, wet_gain_dB, room_scale;
+ sox_bool wet_only;
+
+ size_t ichannels, ochannels;
+ struct {
+ reverb_t reverb;
+ float * dry, * wet[2];
+ } chan[2];
+} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ p->reverberance = p->hf_damping = 50; /* Set non-zero defaults */
+ p->stereo_depth = p->room_scale = 100;
+
+ --argc, ++argv;
+ p->wet_only = argc && (!strcmp(*argv, "-w") || !strcmp(*argv, "--wet-only"))
+ && (--argc, ++argv, sox_true);
+ do { /* break-able block */
+ NUMERIC_PARAMETER(reverberance, 0, 100)
+ NUMERIC_PARAMETER(hf_damping, 0, 100)
+ NUMERIC_PARAMETER(room_scale, 0, 100)
+ NUMERIC_PARAMETER(stereo_depth, 0, 100)
+ NUMERIC_PARAMETER(pre_delay_ms, 0, 500)
+ NUMERIC_PARAMETER(wet_gain_dB, -10, 10)
+ } while (0);
+
+ return argc ? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i;
+
+ p->ichannels = p->ochannels = 1;
+ effp->out_signal.rate = effp->in_signal.rate;
+ if (effp->in_signal.channels > 2 && p->stereo_depth) {
+ lsx_warn("stereo-depth not applicable with >2 channels");
+ p->stereo_depth = 0;
+ }
+ if (effp->in_signal.channels == 1 && p->stereo_depth)
+ effp->out_signal.channels = p->ochannels = 2;
+ else effp->out_signal.channels = effp->in_signal.channels;
+ if (effp->in_signal.channels == 2 && p->stereo_depth)
+ p->ichannels = p->ochannels = 2;
+ else effp->flows = effp->in_signal.channels;
+ for (i = 0; i < p->ichannels; ++i) reverb_create(
+ &p->chan[i].reverb, effp->in_signal.rate, p->wet_gain_dB, p->room_scale,
+ p->reverberance, p->hf_damping, p->pre_delay_ms, p->stereo_depth,
+ effp->global_info->global_info->bufsiz / p->ochannels, p->chan[i].wet);
+
+ if (effp->in_signal.mult)
+ *effp->in_signal.mult /= !p->wet_only + 2 * dB_to_linear(max(0,p->wet_gain_dB));
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t c, i, w, len = min(*isamp / p->ichannels, *osamp / p->ochannels);
+ SOX_SAMPLE_LOCALS;
+
+ *isamp = len * p->ichannels, *osamp = len * p->ochannels;
+ for (c = 0; c < p->ichannels; ++c)
+ p->chan[c].dry = fifo_write(&p->chan[c].reverb.input_fifo, len, 0);
+ for (i = 0; i < len; ++i) for (c = 0; c < p->ichannels; ++c)
+ p->chan[c].dry[i] = SOX_SAMPLE_TO_FLOAT_32BIT(*ibuf++, effp->clips);
+ for (c = 0; c < p->ichannels; ++c)
+ reverb_process(&p->chan[c].reverb, len);
+ if (p->ichannels == 2) for (i = 0; i < len; ++i) for (w = 0; w < 2; ++w) {
+ float out = (1 - p->wet_only) * p->chan[w].dry[i] +
+ .5 * (p->chan[0].wet[w][i] + p->chan[1].wet[w][i]);
+ *obuf++ = SOX_FLOAT_32BIT_TO_SAMPLE(out, effp->clips);
+ }
+ else for (i = 0; i < len; ++i) for (w = 0; w < p->ochannels; ++w) {
+ float out = (1 - p->wet_only) * p->chan[0].dry[i] + p->chan[0].wet[w][i];
+ *obuf++ = SOX_FLOAT_32BIT_TO_SAMPLE(out, effp->clips);
+ }
+ return SOX_SUCCESS;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i;
+ for (i = 0; i < p->ichannels; ++i)
+ reverb_delete(&p->chan[i].reverb);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const *lsx_reverb_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"reverb",
+ "[-w|--wet-only]"
+ " [reverberance (50%)"
+ " [HF-damping (50%)"
+ " [room-scale (100%)"
+ " [stereo-depth (100%)"
+ " [pre-delay (0ms)"
+ " [wet-gain (0dB)"
+ "]]]]]]",
+ SOX_EFF_MCHAN, getopts, start, flow, NULL, stop, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/reverse.c b/src/src/reverse.c
new file mode 100644
index 0000000..8ec48e6
--- /dev/null
+++ b/src/src/reverse.c
@@ -0,0 +1,86 @@
+/* June 1, 1992
+ * Copyright 1992 Guido van Rossum And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Guido van Rossum And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+/*
+ * "reverse" effect, uses a temporary file created by lsx_tmpfile().
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef struct {
+ off_t pos;
+ FILE * tmp_file;
+} priv_t;
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ p->pos = 0;
+ p->tmp_file = lsx_tmpfile();
+ if (p->tmp_file == NULL) {
+ lsx_fail("can't create temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (fwrite(ibuf, sizeof(*ibuf), *isamp, p->tmp_file) != *isamp) {
+ lsx_fail("error writing temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ (void)obuf, *osamp = 0; /* samples not output until drain */
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ int i, j;
+
+ if (p->pos == 0) {
+ fflush(p->tmp_file);
+ p->pos = ftello(p->tmp_file);
+ if (p->pos % sizeof(sox_sample_t) != 0) {
+ lsx_fail("temporary file has incorrect size");
+ return SOX_EOF;
+ }
+ p->pos /= sizeof(sox_sample_t);
+ }
+ p->pos -= *osamp = min((off_t)*osamp, p->pos);
+ fseeko(p->tmp_file, (off_t)(p->pos * sizeof(sox_sample_t)), SEEK_SET);
+ if (fread(obuf, sizeof(sox_sample_t), *osamp, p->tmp_file) != *osamp) {
+ lsx_fail("error reading temporary file: %s", strerror(errno));
+ return SOX_EOF;
+ }
+ for (i = 0, j = *osamp - 1; i < j; ++i, --j) { /* reverse the samples */
+ sox_sample_t temp = obuf[i];
+ obuf[i] = obuf[j];
+ obuf[j] = temp;
+ }
+ return p->pos? SOX_SUCCESS : SOX_EOF;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ fclose(p->tmp_file); /* auto-deleted by lsx_tmpfile */
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_reverse_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "reverse", NULL, SOX_EFF_MODIFY, NULL, start, flow, drain, stop, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/s1-fmt.c b/src/src/s1-fmt.c
new file mode 100644
index 0000000..60f6cf0
--- /dev/null
+++ b/src/src/s1-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT2(s1, "s8", "sb", 8, 0, SIGN2)
diff --git a/src/src/s2-fmt.c b/src/src/s2-fmt.c
new file mode 100644
index 0000000..dab9667
--- /dev/null
+++ b/src/src/s2-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT2(s2, "s16", "sw", 16, 0, SIGN2)
diff --git a/src/src/s3-fmt.c b/src/src/s3-fmt.c
new file mode 100644
index 0000000..a308ab1
--- /dev/null
+++ b/src/src/s3-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT1(s3, "s24", 24, 0, SIGN2)
diff --git a/src/src/s4-fmt.c b/src/src/s4-fmt.c
new file mode 100644
index 0000000..29e2d32
--- /dev/null
+++ b/src/src/s4-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT2(s4, "s32", "sl", 32, 0, SIGN2)
diff --git a/src/src/sd2.c b/src/src/sd2.c
new file mode 100644
index 0000000..baf764e
--- /dev/null
+++ b/src/src/sd2.c
@@ -0,0 +1,34 @@
+/* libSoX file format: SD2 Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(sd2)
+{
+ static char const * const names[] = {"sd2", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 24, 16, 8,0,0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description = "Sound Designer II";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/sf.c b/src/src/sf.c
new file mode 100644
index 0000000..f6a1e50
--- /dev/null
+++ b/src/src/sf.c
@@ -0,0 +1,154 @@
+/* libSoX file format: IRCAM SoundFile (c) 2008 robs@users.sourceforge.net
+ *
+ * See http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/IRCAM/IRCAM.html
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+/* Magic numbers used in IRCAM audio files */
+static struct {char str[4]; sox_bool reverse_bytes; char const * desc;} id[] = {
+ {"\144\243\001\0", MACHINE_IS_BIGENDIAN , "little-endian VAX (native)"},
+ {"\0\001\243\144", MACHINE_IS_LITTLEENDIAN, "big-endian VAX"},
+ {"\144\243\002\0", MACHINE_IS_LITTLEENDIAN, "big-endian Sun (native)"},
+ {"\0\002\243\144", MACHINE_IS_BIGENDIAN , "little-endian Sun"},
+ {"\144\243\003\0", MACHINE_IS_BIGENDIAN , "little-endian MIPS (DEC)"},
+ {"\0\003\243\144", MACHINE_IS_LITTLEENDIAN, "big-endian MIPS (SGI)"},
+ {"\144\243\004\0", MACHINE_IS_LITTLEENDIAN, "big-endian NeXT"},
+ {" ", 0, NULL}
+};
+#define FIXED_HDR 1024
+#define SF_COMMENT 2 /* code for "comment line" */
+
+typedef enum {Unspecified,
+ Linear_8 = 0x00001, Alaw_8 = 0x10001, Mulaw_8 = 0x20001, Linear_16 = 0x00002,
+ Linear_24 = 0x00003, Linear_32 = 0x40004, Float = 0x00004, Double = 0x00008
+} ft_encoding_t;
+
+static ft_encoding_t ft_enc(unsigned size, sox_encoding_t encoding)
+{
+ if (encoding == SOX_ENCODING_ULAW && size == 8) return Mulaw_8;
+ if (encoding == SOX_ENCODING_ALAW && size == 8) return Alaw_8;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 8) return Linear_8;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 16) return Linear_16;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 24) return Linear_24;
+ if (encoding == SOX_ENCODING_SIGN2 && size == 32) return Linear_32;
+ if (encoding == SOX_ENCODING_FLOAT && size == 32) return Float;
+ if (encoding == SOX_ENCODING_FLOAT && size == 64) return Double;
+ return Unspecified;
+}
+
+static sox_encoding_t sox_enc(uint32_t ft_encoding, unsigned * size)
+{
+ switch (ft_encoding) {
+ case Mulaw_8 : *size = 8; return SOX_ENCODING_ULAW;
+ case Alaw_8 : *size = 8; return SOX_ENCODING_ALAW;
+ case Linear_8 : *size = 8; return SOX_ENCODING_SIGN2;
+ case Linear_16 : *size = 16; return SOX_ENCODING_SIGN2;
+ case Linear_24 : *size = 24; return SOX_ENCODING_SIGN2;
+ case Linear_32 : *size = 32; return SOX_ENCODING_SIGN2;
+ case Float : *size = 32; return SOX_ENCODING_FLOAT;
+ case Double : *size = 64; return SOX_ENCODING_FLOAT;
+ default: return SOX_ENCODING_UNKNOWN;
+ }
+}
+
+static int startread(sox_format_t * ft)
+{
+ char magic[4];
+ float rate;
+ uint32_t channels, ft_encoding;
+ unsigned i, bits_per_sample;
+ sox_encoding_t encoding;
+ uint16_t code, size;
+
+ if (lsx_readchars(ft, magic, sizeof(magic)))
+ return SOX_EOF;
+
+ for (i = 0; id[i].desc && memcmp(magic, id[i].str, sizeof(magic)); ++i);
+ if (!id[i].desc) {
+ lsx_fail_errno(ft, SOX_EHDR, "sf: can't find IRCAM identifier");
+ return SOX_EOF;
+ }
+ lsx_report("found %s identifier", id[i].desc);
+ ft->encoding.reverse_bytes = id[i].reverse_bytes;
+
+ if (lsx_readf(ft, &rate) || lsx_readdw(ft, &channels) || lsx_readdw(ft, &ft_encoding))
+ return SOX_EOF;
+
+ if (!(encoding = sox_enc(ft_encoding, &bits_per_sample))) {
+ lsx_fail_errno(ft, SOX_EFMT, "sf: unsupported encoding %#x)", ft_encoding);
+ return SOX_EOF;
+ }
+ do {
+ if (lsx_readw(ft, &code) || lsx_readw(ft, &size))
+ return SOX_EOF;
+ if (code == SF_COMMENT) {
+ char * buf = lsx_calloc(1, (size_t)size + 1); /* +1 ensures null-terminated */
+ if (lsx_readchars(ft, buf, (size_t) size) != SOX_SUCCESS) {
+ free(buf);
+ return SOX_EOF;
+ }
+ sox_append_comments(&ft->oob.comments, buf);
+ free(buf);
+ }
+ else if (lsx_skipbytes(ft, (size_t) size))
+ return SOX_EOF;
+ } while (code);
+ if (lsx_skipbytes(ft, FIXED_HDR - (size_t)lsx_tell(ft)))
+ return SOX_EOF;
+
+ return lsx_check_read_params(ft, channels, rate, encoding, bits_per_sample, (uint64_t)0, sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ char * comment = lsx_cat_comments(ft->oob.comments);
+ size_t len = min(FIXED_HDR - 26, strlen(comment)) + 1; /* null-terminated */
+ size_t info_len = max(4, (len + 3) & ~3u); /* Minimum & multiple of 4 bytes */
+ int i = ft->encoding.reverse_bytes == MACHINE_IS_BIGENDIAN? 0 : 2;
+ sox_bool error = sox_false
+ ||lsx_writechars(ft, id[i].str, sizeof(id[i].str))
+ ||lsx_writef(ft, ft->signal.rate)
+ ||lsx_writedw(ft, ft->signal.channels)
+ ||lsx_writedw(ft, ft_enc(ft->encoding.bits_per_sample, ft->encoding.encoding))
+ ||lsx_writew(ft, SF_COMMENT)
+ ||lsx_writew(ft, (unsigned) info_len)
+ ||lsx_writechars(ft, comment, len)
+ ||lsx_padbytes(ft, FIXED_HDR - 20 - len);
+ free(comment);
+ return error? SOX_EOF: SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(sf)
+{
+ static char const * const names[] = {"sf", "ircam", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_SIGN2, 8, 16, 24, 32, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Institut de Recherche et Coordination Acoustique/Musique",
+ names, SOX_FILE_LIT_END,
+ startread, lsx_rawread, NULL,
+ write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/silence.c b/src/src/silence.c
new file mode 100644
index 0000000..1f185ed
--- /dev/null
+++ b/src/src/silence.c
@@ -0,0 +1,690 @@
+/* Silence effect for SoX
+ * by Heikki Leinonen (heilei@iki.fi) 25.03.2001
+ * Major Modifications by Chris Bagwell 06.08.2001
+ * Minor addition by Donnie Smith 13.08.2003
+ *
+ * This effect can delete samples from the start of a sound file
+ * until it sees a specified count of samples exceed a given threshold
+ * (any of the channels).
+ * This effect can also delete samples from the end of a sound file
+ * when it sees a specified count of samples below a given threshold
+ * (all channels).
+ * It may also be used to delete samples anywhere in a sound file.
+ * Thesholds can be given as either a percentage or in decibels.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+
+/* Private data for silence effect. */
+
+#define SILENCE_TRIM 0
+#define SILENCE_TRIM_FLUSH 1
+#define SILENCE_COPY 2
+#define SILENCE_COPY_FLUSH 3
+#define SILENCE_STOP 4
+
+typedef struct {
+ char start;
+ int start_periods;
+ char *start_duration_str;
+ size_t start_duration;
+ double start_threshold;
+ char start_unit; /* "d" for decibels or "%" for percent. */
+ int restart;
+
+ sox_sample_t *start_holdoff;
+ size_t start_holdoff_offset;
+ size_t start_holdoff_end;
+ int start_found_periods;
+
+ char stop;
+ int stop_periods;
+ char *stop_duration_str;
+ size_t stop_duration;
+ double stop_threshold;
+ char stop_unit;
+
+ sox_sample_t *stop_holdoff;
+ size_t stop_holdoff_offset;
+ size_t stop_holdoff_end;
+ int stop_found_periods;
+
+ double *window;
+ double *window_current;
+ double *window_end;
+ size_t window_size;
+ double rms_sum;
+
+ char leave_silence;
+
+ /* State Machine */
+ char mode;
+} priv_t;
+
+static void clear_rms(sox_effect_t * effp)
+
+{
+ priv_t * silence = (priv_t *) effp->priv;
+
+ memset(silence->window, 0,
+ silence->window_size * sizeof(double));
+
+ silence->window_current = silence->window;
+ silence->window_end = silence->window + silence->window_size;
+ silence->rms_sum = 0;
+}
+
+static int sox_silence_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * silence = (priv_t *) effp->priv;
+ int parse_count;
+ uint64_t temp;
+ const char *n;
+ --argc, ++argv;
+
+ /* check for option switches */
+ silence->leave_silence = sox_false;
+ if (argc > 0)
+ {
+ if (!strcmp("-l", *argv)) {
+ argc--; argv++;
+ silence->leave_silence = sox_true;
+ }
+ }
+
+ if (argc < 1)
+ return lsx_usage(effp);
+
+ /* Parse data related to trimming front side */
+ silence->start = sox_false;
+ if (sscanf(argv[0], "%d", &silence->start_periods) != 1)
+ return lsx_usage(effp);
+ if (silence->start_periods < 0)
+ {
+ lsx_fail("Periods must not be negative");
+ return(SOX_EOF);
+ }
+ argv++;
+ argc--;
+
+ if (silence->start_periods > 0)
+ {
+ silence->start = sox_true;
+ if (argc < 2)
+ return lsx_usage(effp);
+
+ /* We do not know the sample rate so we can not fully
+ * parse the duration info yet. So save argument off
+ * for future processing.
+ */
+ silence->start_duration_str = lsx_strdup(argv[0]);
+ /* Perform a fake parse to do error checking */
+ n = lsx_parsesamples(0.,silence->start_duration_str,&temp,'s');
+ if (!n || *n)
+ return lsx_usage(effp);
+ silence->start_duration = temp;
+
+ parse_count = sscanf(argv[1], "%lf%c", &silence->start_threshold,
+ &silence->start_unit);
+ if (parse_count < 1)
+ return lsx_usage(effp);
+ else if (parse_count < 2)
+ silence->start_unit = '%';
+
+ argv++; argv++;
+ argc--; argc--;
+ }
+
+ silence->stop = sox_false;
+ /* Parse data needed for trimming of backside */
+ if (argc > 0)
+ {
+ if (argc < 3)
+ return lsx_usage(effp);
+ if (sscanf(argv[0], "%d", &silence->stop_periods) != 1)
+ return lsx_usage(effp);
+ if (silence->stop_periods < 0)
+ {
+ silence->stop_periods = -silence->stop_periods;
+ silence->restart = 1;
+ }
+ else
+ silence->restart = 0;
+ silence->stop = sox_true;
+ argv++;
+ argc--;
+
+ /* We do not know the sample rate so we can not fully
+ * parse the duration info yet. So save argument off
+ * for future processing.
+ */
+ silence->stop_duration_str = lsx_strdup(argv[0]);
+ /* Perform a fake parse to do error checking */
+ n = lsx_parsesamples(0.,silence->stop_duration_str,&temp,'s');
+ if (!n || *n)
+ return lsx_usage(effp);
+ silence->stop_duration = temp;
+
+ parse_count = sscanf(argv[1], "%lf%c", &silence->stop_threshold,
+ &silence->stop_unit);
+ if (parse_count < 1)
+ return lsx_usage(effp);
+ else if (parse_count < 2)
+ silence->stop_unit = '%';
+
+ argv++; argv++;
+ argc--; argc--;
+ }
+
+ /* Error checking */
+ if (silence->start)
+ {
+ if ((silence->start_unit != '%') && (silence->start_unit != 'd'))
+ {
+ lsx_fail("Invalid unit specified");
+ return lsx_usage(effp);
+ }
+ if ((silence->start_unit == '%') && ((silence->start_threshold < 0.0)
+ || (silence->start_threshold > 100.0)))
+ {
+ lsx_fail("silence threshold should be between 0.0 and 100.0 %%");
+ return (SOX_EOF);
+ }
+ if ((silence->start_unit == 'd') && (silence->start_threshold >= 0.0))
+ {
+ lsx_fail("silence threshold should be less than 0.0 dB");
+ return(SOX_EOF);
+ }
+ }
+
+ if (silence->stop)
+ {
+ if ((silence->stop_unit != '%') && (silence->stop_unit != 'd'))
+ {
+ lsx_fail("Invalid unit specified");
+ return(SOX_EOF);
+ }
+ if ((silence->stop_unit == '%') && ((silence->stop_threshold < 0.0) ||
+ (silence->stop_threshold > 100.0)))
+ {
+ lsx_fail("silence threshold should be between 0.0 and 100.0 %%");
+ return (SOX_EOF);
+ }
+ if ((silence->stop_unit == 'd') && (silence->stop_threshold >= 0.0))
+ {
+ lsx_fail("silence threshold should be less than 0.0 dB");
+ return(SOX_EOF);
+ }
+ }
+ return(SOX_SUCCESS);
+}
+
+static int sox_silence_start(sox_effect_t * effp)
+{
+ priv_t *silence = (priv_t *)effp->priv;
+ uint64_t temp;
+
+ /* When you want to remove silence, small window sizes are
+ * better or else RMS will look like non-silence at
+ * aburpt changes from load to silence.
+ */
+ silence->window_size = (effp->in_signal.rate / 50) *
+ effp->in_signal.channels;
+ silence->window = lsx_malloc(silence->window_size * sizeof(double));
+
+ clear_rms(effp);
+
+ /* Now that we know sample rate, reparse duration. */
+ if (silence->start)
+ {
+ if (lsx_parsesamples(effp->in_signal.rate, silence->start_duration_str,
+ &temp, 's') == NULL)
+ return lsx_usage(effp);
+ silence->start_duration = temp * effp->in_signal.channels;
+ }
+ if (silence->stop)
+ {
+ if (lsx_parsesamples(effp->in_signal.rate,silence->stop_duration_str,
+ &temp,'s') == NULL)
+ return lsx_usage(effp);
+ silence->stop_duration = temp * effp->in_signal.channels;
+ }
+
+ if (silence->start)
+ silence->mode = SILENCE_TRIM;
+ else
+ silence->mode = SILENCE_COPY;
+
+ silence->start_holdoff = lsx_malloc(sizeof(sox_sample_t)*silence->start_duration);
+ silence->start_holdoff_offset = 0;
+ silence->start_holdoff_end = 0;
+ silence->start_found_periods = 0;
+
+ silence->stop_holdoff = lsx_malloc(sizeof(sox_sample_t)*silence->stop_duration);
+ silence->stop_holdoff_offset = 0;
+ silence->stop_holdoff_end = 0;
+ silence->stop_found_periods = 0;
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* depends on input data */
+
+ return(SOX_SUCCESS);
+}
+
+static sox_bool aboveThreshold(sox_effect_t const * effp,
+ sox_sample_t value /* >= 0 */, double threshold, int unit)
+{
+ /* When scaling low bit data, noise values got scaled way up */
+ /* Only consider the original bits when looking for silence */
+ sox_sample_t masked_value = value & (-1 << (32 - effp->in_signal.precision));
+
+ double scaled_value = (double)masked_value / SOX_SAMPLE_MAX;
+
+ if (unit == '%')
+ scaled_value *= 100;
+ else if (unit == 'd')
+ scaled_value = linear_to_dB(scaled_value);
+
+ return scaled_value > threshold;
+}
+
+static sox_sample_t compute_rms(sox_effect_t * effp, sox_sample_t sample)
+{
+ priv_t * silence = (priv_t *) effp->priv;
+ double new_sum;
+ sox_sample_t rms;
+
+ new_sum = silence->rms_sum;
+ new_sum -= *silence->window_current;
+ new_sum += ((double)sample * (double)sample);
+
+ rms = sqrt(new_sum / silence->window_size);
+
+ return (rms);
+}
+
+static void update_rms(sox_effect_t * effp, sox_sample_t sample)
+{
+ priv_t * silence = (priv_t *) effp->priv;
+
+ silence->rms_sum -= *silence->window_current;
+ *silence->window_current = ((double)sample * (double)sample);
+ silence->rms_sum += *silence->window_current;
+
+ silence->window_current++;
+ if (silence->window_current >= silence->window_end)
+ silence->window_current = silence->window;
+}
+
+/* Process signed long samples from ibuf to obuf. */
+/* Return number of samples processed in isamp and osamp. */
+static int sox_silence_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * silence = (priv_t *) effp->priv;
+ int threshold;
+ size_t i, j;
+ size_t nrOfTicks, /* sometimes wide, sometimes non-wide samples */
+ nrOfInSamplesRead, nrOfOutSamplesWritten; /* non-wide samples */
+
+ nrOfInSamplesRead = 0;
+ nrOfOutSamplesWritten = 0;
+
+ switch (silence->mode)
+ {
+ case SILENCE_TRIM:
+ /* Reads and discards all input data until it detects a
+ * sample that is above the specified threshold. Turns on
+ * copy mode when detected.
+ * Need to make sure and copy input in groups of "channels" to
+ * prevent getting buffers out of sync.
+ * nrOfTicks counts wide samples here.
+ */
+silence_trim:
+ nrOfTicks = min((*isamp-nrOfInSamplesRead),
+ (*osamp-nrOfOutSamplesWritten)) /
+ effp->in_signal.channels;
+ for(i = 0; i < nrOfTicks; i++)
+ {
+ threshold = 0;
+ for (j = 0; j < effp->in_signal.channels; j++)
+ {
+ threshold |= aboveThreshold(effp,
+ compute_rms(effp, ibuf[j]),
+ silence->start_threshold,
+ silence->start_unit);
+ }
+
+ if (threshold)
+ {
+ /* Add to holdoff buffer */
+ for (j = 0; j < effp->in_signal.channels; j++)
+ {
+ update_rms(effp, *ibuf);
+ silence->start_holdoff[
+ silence->start_holdoff_end++] = *ibuf++;
+ nrOfInSamplesRead++;
+ }
+
+ if (silence->start_holdoff_end >=
+ silence->start_duration)
+ {
+ if (++silence->start_found_periods >=
+ silence->start_periods)
+ {
+ silence->mode = SILENCE_TRIM_FLUSH;
+ goto silence_trim_flush;
+ }
+ /* Trash holdoff buffer since its not
+ * needed. Start looking again.
+ */
+ silence->start_holdoff_offset = 0;
+ silence->start_holdoff_end = 0;
+ }
+ }
+ else /* !above Threshold */
+ {
+ silence->start_holdoff_end = 0;
+ for (j = 0; j < effp->in_signal.channels; j++)
+ {
+ update_rms(effp, ibuf[j]);
+ }
+ ibuf += effp->in_signal.channels;
+ nrOfInSamplesRead += effp->in_signal.channels;
+ }
+ } /* for nrOfTicks */
+ break;
+
+ case SILENCE_TRIM_FLUSH:
+ /* nrOfTicks counts non-wide samples here. */
+silence_trim_flush:
+ nrOfTicks = min((silence->start_holdoff_end -
+ silence->start_holdoff_offset),
+ (*osamp-nrOfOutSamplesWritten));
+ nrOfTicks -= nrOfTicks % effp->in_signal.channels;
+ for(i = 0; i < nrOfTicks; i++)
+ {
+ *obuf++ = silence->start_holdoff[silence->start_holdoff_offset++];
+ nrOfOutSamplesWritten++;
+ }
+
+ /* If fully drained holdoff then switch to copy mode */
+ if (silence->start_holdoff_offset == silence->start_holdoff_end)
+ {
+ silence->start_holdoff_offset = 0;
+ silence->start_holdoff_end = 0;
+ silence->mode = SILENCE_COPY;
+ goto silence_copy;
+ }
+ break;
+
+ case SILENCE_COPY:
+ /* Attempts to copy samples into output buffer.
+ *
+ * Case B:
+ * If not looking for silence to terminate copy then
+ * blindly copy data into output buffer.
+ *
+ * Case A:
+ *
+ * Case 1a:
+ * If previous silence was detect then see if input sample is
+ * above threshold. If found then flush out hold off buffer
+ * and copy over to output buffer.
+ *
+ * Case 1b:
+ * If no previous silence detect then see if input sample
+ * is above threshold. If found then copy directly
+ * to output buffer.
+ *
+ * Case 2:
+ * If not above threshold then silence is detect so
+ * store in hold off buffer and do not write to output
+ * buffer. Even though it wasn't put in output
+ * buffer, inform user that input was consumed.
+ *
+ * If hold off buffer is full after this then stop
+ * copying data and discard data in hold off buffer.
+ *
+ * Special leave_silence logic:
+ *
+ * During this mode, go ahead and copy input
+ * samples to output buffer instead of holdoff buffer
+ * Then also short ciruit any flushes that would occur
+ * when non-silence is detect since samples were already
+ * copied. This has the effect of always leaving
+ * holdoff[] amount of silence but deleting any
+ * beyond that amount.
+ *
+ * nrOfTicks counts wide samples here.
+ */
+silence_copy:
+ nrOfTicks = min((*isamp-nrOfInSamplesRead),
+ (*osamp-nrOfOutSamplesWritten)) /
+ effp->in_signal.channels;
+ if (silence->stop)
+ {
+ /* Case A */
+ for(i = 0; i < nrOfTicks; i++)
+ {
+ threshold = 1;
+ for (j = 0; j < effp->in_signal.channels; j++)
+ {
+ threshold &= aboveThreshold(effp,
+ compute_rms(effp, ibuf[j]),
+ silence->stop_threshold,
+ silence->stop_unit);
+ }
+
+ /* Case 1a
+ * If above threshold, check to see if we where holding
+ * off previously. If so then flush this buffer.
+ * We haven't incremented any pointers yet so nothing
+ * is lost.
+ *
+ * If user wants to leave_silence, then we
+ * were already copying the data and so no
+ * need to flush the old data. Just resume
+ * copying as if we were not holding off.
+ */
+ if (threshold && silence->stop_holdoff_end
+ && !silence->leave_silence)
+ {
+ silence->mode = SILENCE_COPY_FLUSH;
+ goto silence_copy_flush;
+ }
+ /* Case 1b */
+ else if (threshold)
+ {
+ /* Not holding off so copy into output buffer */
+ for (j = 0; j < effp->in_signal.channels; j++)
+ {
+ update_rms(effp, *ibuf);
+ *obuf++ = *ibuf++;
+ nrOfInSamplesRead++;
+ nrOfOutSamplesWritten++;
+ }
+ }
+ /* Case 2 */
+ else if (!threshold)
+ {
+ /* Add to holdoff buffer */
+ for (j = 0; j < effp->in_signal.channels; j++)
+ {
+ update_rms(effp, *ibuf);
+ if (silence->leave_silence) {
+ *obuf++ = *ibuf;
+ nrOfOutSamplesWritten++;
+ }
+ silence->stop_holdoff[
+ silence->stop_holdoff_end++] = *ibuf++;
+ nrOfInSamplesRead++;
+ }
+
+ /* Check if holdoff buffer is greater than duration
+ */
+ if (silence->stop_holdoff_end >=
+ silence->stop_duration)
+ {
+ /* Increment found counter and see if this
+ * is the last period. If so then exit.
+ */
+ if (++silence->stop_found_periods >=
+ silence->stop_periods)
+ {
+ silence->stop_holdoff_offset = 0;
+ silence->stop_holdoff_end = 0;
+ if (!silence->restart)
+ {
+ *isamp = nrOfInSamplesRead;
+ *osamp = nrOfOutSamplesWritten;
+ silence->mode = SILENCE_STOP;
+ /* Return SOX_EOF since no more processing */
+ return (SOX_EOF);
+ }
+ else
+ {
+ silence->stop_found_periods = 0;
+ silence->start_found_periods = 0;
+ silence->start_holdoff_offset = 0;
+ silence->start_holdoff_end = 0;
+ clear_rms(effp);
+ silence->mode = SILENCE_TRIM;
+
+ goto silence_trim;
+ }
+ }
+ else
+ {
+ /* Flush this buffer and start
+ * looking again.
+ */
+ silence->mode = SILENCE_COPY_FLUSH;
+ goto silence_copy_flush;
+ }
+ break;
+ } /* Filled holdoff buffer */
+ } /* Detected silence */
+ } /* For # of samples */
+ } /* Trimming off backend */
+ else /* !(silence->stop) */
+ {
+ /* Case B */
+ memcpy(obuf, ibuf, sizeof(sox_sample_t)*nrOfTicks*
+ effp->in_signal.channels);
+ nrOfInSamplesRead += (nrOfTicks*effp->in_signal.channels);
+ nrOfOutSamplesWritten += (nrOfTicks*effp->in_signal.channels);
+ }
+ break;
+
+ case SILENCE_COPY_FLUSH:
+ /* nrOfTicks counts non-wide samples here. */
+silence_copy_flush:
+ nrOfTicks = min((silence->stop_holdoff_end -
+ silence->stop_holdoff_offset),
+ (*osamp-nrOfOutSamplesWritten));
+ nrOfTicks -= nrOfTicks % effp->in_signal.channels;
+
+ for(i = 0; i < nrOfTicks; i++)
+ {
+ *obuf++ = silence->stop_holdoff[silence->stop_holdoff_offset++];
+ nrOfOutSamplesWritten++;
+ }
+
+ /* If fully drained holdoff then return to copy mode */
+ if (silence->stop_holdoff_offset == silence->stop_holdoff_end)
+ {
+ silence->stop_holdoff_offset = 0;
+ silence->stop_holdoff_end = 0;
+ silence->mode = SILENCE_COPY;
+ goto silence_copy;
+ }
+ break;
+
+ case SILENCE_STOP:
+ /* This code can't be reached. */
+ nrOfInSamplesRead = *isamp;
+ break;
+ }
+
+ *isamp = nrOfInSamplesRead;
+ *osamp = nrOfOutSamplesWritten;
+
+ return (SOX_SUCCESS);
+}
+
+static int sox_silence_drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * silence = (priv_t *) effp->priv;
+ size_t i;
+ size_t nrOfTicks, nrOfOutSamplesWritten = 0; /* non-wide samples */
+
+ /* Only if in flush mode will there be possible samples to write
+ * out during drain() call.
+ */
+ if (silence->mode == SILENCE_COPY_FLUSH ||
+ silence->mode == SILENCE_COPY)
+ {
+ nrOfTicks = min((silence->stop_holdoff_end -
+ silence->stop_holdoff_offset), *osamp);
+ nrOfTicks -= nrOfTicks % effp->in_signal.channels;
+ for(i = 0; i < nrOfTicks; i++)
+ {
+ *obuf++ = silence->stop_holdoff[silence->stop_holdoff_offset++];
+ nrOfOutSamplesWritten++;
+ }
+
+ /* If fully drained holdoff then stop */
+ if (silence->stop_holdoff_offset == silence->stop_holdoff_end)
+ {
+ silence->stop_holdoff_offset = 0;
+ silence->stop_holdoff_end = 0;
+ silence->mode = SILENCE_STOP;
+ }
+ }
+
+ *osamp = nrOfOutSamplesWritten;
+ if (silence->mode == SILENCE_STOP || *osamp == 0)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+static int sox_silence_stop(sox_effect_t * effp)
+{
+ priv_t * silence = (priv_t *) effp->priv;
+
+ free(silence->window);
+ free(silence->start_holdoff);
+ free(silence->stop_holdoff);
+
+ return(SOX_SUCCESS);
+}
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * silence = (priv_t *) effp->priv;
+
+ free(silence->start_duration_str);
+ free(silence->stop_duration_str);
+
+ return SOX_SUCCESS;
+}
+
+static sox_effect_handler_t sox_silence_effect = {
+ "silence",
+ "[ -l ] above_periods [ duration threshold[d|%] ] [ below_periods duration threshold[d|%] ]",
+ SOX_EFF_MCHAN | SOX_EFF_MODIFY | SOX_EFF_LENGTH,
+ sox_silence_getopts,
+ sox_silence_start,
+ sox_silence_flow,
+ sox_silence_drain,
+ sox_silence_stop,
+ lsx_kill, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_silence_effect_fn(void)
+{
+ return &sox_silence_effect;
+}
diff --git a/src/src/sinc.c b/src/src/sinc.c
new file mode 100644
index 0000000..4ec1f9c
--- /dev/null
+++ b/src/src/sinc.c
@@ -0,0 +1,157 @@
+/* Effect: sinc filters Copyright (c) 2008-9 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/dft_filter.h"
+#include <string.h>
+
+typedef struct {
+ dft_filter_priv_t base;
+ double att, beta, phase, Fc0, Fc1, tbw0, tbw1;
+ int num_taps[2];
+ sox_bool round;
+} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ dft_filter_priv_t * b = &p->base;
+ char * parse_ptr = argv[0];
+ int i = 0;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, "+ra:b:p:MILt:n:", NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ b->filter_ptr = &b->filter;
+ p->phase = 50;
+ p->beta = -1;
+ while (i < 2) {
+ int c = 1;
+ while (c && (c = lsx_getopt(&optstate)) != -1) switch (c) {
+ char * parse_ptr2;
+ case 'r': p->round = sox_true; break;
+ GETOPT_NUMERIC(optstate, 'a', att, 40 , 180)
+ GETOPT_NUMERIC(optstate, 'b', beta, 0 , 256)
+ GETOPT_NUMERIC(optstate, 'p', phase, 0, 100)
+ case 'M': p->phase = 0; break;
+ case 'I': p->phase = 25; break;
+ case 'L': p->phase = 50; break;
+ GETOPT_NUMERIC(optstate, 'n', num_taps[1], 11, 32767)
+ case 't': p->tbw1 = lsx_parse_frequency(optstate.arg, &parse_ptr2);
+ if (p->tbw1 < 1 || *parse_ptr2) return lsx_usage(effp);
+ break;
+ default: c = 0;
+ }
+ if ((p->att && p->beta >= 0) || (p->tbw1 && p->num_taps[1]))
+ return lsx_usage(effp);
+ if (!i || !p->Fc1)
+ p->tbw0 = p->tbw1, p->num_taps[0] = p->num_taps[1];
+ if (!i++ && optstate.ind < argc) {
+ if (*(parse_ptr = argv[optstate.ind++]) != '-')
+ p->Fc0 = lsx_parse_frequency(parse_ptr, &parse_ptr);
+ if (*parse_ptr == '-')
+ p->Fc1 = lsx_parse_frequency(parse_ptr + 1, &parse_ptr);
+ }
+ }
+ return optstate.ind != argc || p->Fc0 < 0 || p->Fc1 < 0 || *parse_ptr ?
+ lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static void invert(double * h, int n)
+{
+ int i;
+ for (i = 0; i < n; ++i)
+ h[i] = -h[i];
+ h[(n - 1) / 2] += 1;
+}
+
+static double * lpf(double Fn, double Fc, double tbw, int * num_taps, double att, double * beta, sox_bool round)
+{
+ int n = *num_taps;
+ if ((Fc /= Fn) <= 0 || Fc >= 1) {
+ *num_taps = 0;
+ return NULL;
+ }
+ att = att? att : 120;
+ lsx_kaiser_params(att, Fc, (tbw? tbw / Fn : .05) * .5, beta, num_taps);
+ if (!n) {
+ n = *num_taps;
+ *num_taps = range_limit(n, 11, 32767);
+ if (round)
+ *num_taps = 1 + 2 * (int)((int)((*num_taps / 2) * Fc + .5) / Fc + .5);
+ lsx_report("num taps = %i (from %i)", *num_taps, n);
+ }
+ return lsx_make_lpf(*num_taps |= 1, Fc, *beta, 0., 1., sox_false);
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ dft_filter_t * f = p->base.filter_ptr;
+
+ if (!f->num_taps) {
+ double Fn = effp->in_signal.rate * .5;
+ double * h[2];
+ int i, n, post_peak, longer;
+
+ if (p->Fc0 >= Fn || p->Fc1 >= Fn) {
+ lsx_fail("filter frequency must be less than sample-rate / 2");
+ return SOX_EOF;
+ }
+ h[0] = lpf(Fn, p->Fc0, p->tbw0, &p->num_taps[0], p->att, &p->beta,p->round);
+ h[1] = lpf(Fn, p->Fc1, p->tbw1, &p->num_taps[1], p->att, &p->beta,p->round);
+ if (h[0])
+ invert(h[0], p->num_taps[0]);
+
+ longer = p->num_taps[1] > p->num_taps[0];
+ n = p->num_taps[longer];
+ if (h[0] && h[1]) {
+ for (i = 0; i < p->num_taps[!longer]; ++i)
+ h[longer][i + (n - p->num_taps[!longer])/2] += h[!longer][i];
+
+ if (p->Fc0 < p->Fc1)
+ invert(h[longer], n);
+
+ free(h[!longer]);
+ }
+ if (p->phase != 50)
+ lsx_fir_to_phase(&h[longer], &n, &post_peak, p->phase);
+ else post_peak = n >> 1;
+
+ if (effp->global_info->plot != sox_plot_off) {
+ char title[100];
+ sprintf(title, "SoX effect: sinc filter freq=%g-%g",
+ p->Fc0, p->Fc1? p->Fc1 : Fn);
+ lsx_plot_fir(h[longer], n, effp->in_signal.rate,
+ effp->global_info->plot, title, -p->beta * 10 - 25, 5.);
+ return SOX_EOF;
+ }
+ lsx_set_dft_filter(f, h[longer], n, post_peak);
+ }
+ return lsx_dft_filter_effect_fn()->start(effp);
+}
+
+sox_effect_handler_t const * lsx_sinc_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_dft_filter_effect_fn();
+ handler.name = "sinc";
+ handler.usage = "[-a att|-b beta] [-p phase|-M|-I|-L] [-t tbw|-n taps] [freqHP][-freqLP [-t tbw|-n taps]]";
+ handler.getopts = create;
+ handler.start = start;
+ handler.priv_size = sizeof(priv_t);
+ return &handler;
+}
diff --git a/src/src/skeleff.c b/src/src/skeleff.c
new file mode 100644
index 0000000..7d6eaf9
--- /dev/null
+++ b/src/src/skeleff.c
@@ -0,0 +1,141 @@
+/* libSoX effect: Skeleton effect used as sample for creating new effects.
+ *
+ * Copyright 1999-2008 Chris Bagwell And SoX Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+/* Private data for effect */
+typedef struct {
+ int localdata;
+} priv_t;
+
+/*
+ * Process command-line options but don't do other
+ * initialization now: effp->in_signal & effp->out_signal are not
+ * yet filled in.
+ */
+static int getopts(sox_effect_t * effp, int argc, char UNUSED **argv)
+{
+ priv_t * UNUSED p = (priv_t *)effp->priv;
+
+ if (argc != 2)
+ return lsx_usage(effp);
+
+ p->localdata = atoi(argv[1]);
+
+ return p->localdata > 0 ? SOX_SUCCESS : SOX_EOF;
+}
+
+/*
+ * Prepare processing.
+ * Do all initializations.
+ */
+static int start(sox_effect_t * effp)
+{
+ if (effp->out_signal.channels == 1) {
+ lsx_fail("Can't run on mono data.");
+ return SOX_EOF;
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Process up to *isamp samples from ibuf and produce up to *osamp samples
+ * in obuf. Write back the actual numbers of samples to *isamp and *osamp.
+ * Return SOX_SUCCESS or, if error occurs, SOX_EOF.
+ */
+static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * UNUSED p = (priv_t *)effp->priv;
+ size_t len, done;
+
+ switch (effp->out_signal.channels) {
+ case 2:
+ /* Length to process will be buffer length / 2 since we
+ * work with two samples at a time.
+ */
+ len = min(*isamp, *osamp) / 2;
+ for (done = 0; done < len; done++)
+ {
+ obuf[0] = ibuf[0];
+ obuf[1] = ibuf[1];
+ /* Advance buffer by 2 samples */
+ ibuf += 2;
+ obuf += 2;
+ }
+
+ *isamp = len * 2;
+ *osamp = len * 2;
+
+ break;
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Drain out remaining samples if the effect generates any.
+ */
+static int drain(sox_effect_t UNUSED * effp, sox_sample_t UNUSED *obuf, size_t *osamp)
+{
+ *osamp = 0;
+ /* Return SOX_EOF when drain
+ * will not output any more samples.
+ * *osamp == 0 also indicates that.
+ */
+ return SOX_EOF;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ */
+static int stop(sox_effect_t UNUSED * effp)
+{
+ return SOX_SUCCESS;
+}
+
+/*
+ * Do anything required when you kill an effect.
+ * (free allocated memory, etc.)
+ */
+static int lsx_kill(sox_effect_t UNUSED * effp)
+{
+ return SOX_SUCCESS;
+}
+
+/*
+ * Function returning effect descriptor. This should be the only
+ * externally visible object.
+ */
+const sox_effect_handler_t *lsx_skel_effect_fn(void);
+const sox_effect_handler_t *lsx_skel_effect_fn(void)
+{
+ /*
+ * Effect descriptor.
+ * If no specific processing is needed for any of
+ * the 6 functions, then the function above can be deleted
+ * and NULL used in place of the its name below.
+ */
+ static sox_effect_handler_t sox_skel_effect = {
+ "skel", "[OPTION]", SOX_EFF_MCHAN,
+ getopts, start, flow, drain, stop, lsx_kill, sizeof(priv_t)
+ };
+ return &sox_skel_effect;
+}
diff --git a/src/src/skelform.c b/src/src/skelform.c
new file mode 100644
index 0000000..36d3655
--- /dev/null
+++ b/src/src/skelform.c
@@ -0,0 +1,218 @@
+/* libSoX skeleton file format handler.
+ *
+ * Copyright 1999 Chris Bagwell And Sundry Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+
+/* Private data for SKEL file */
+typedef struct {
+ size_t remaining_samples;
+} priv_t;
+
+/* Note that if any of your methods doesn't need to do anything, you
+ can instead use the relevant sox_*_nothing* method */
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int startread(sox_format_t * ft)
+{
+ priv_t * sk = (priv_t *)ft->priv;
+ size_t samples_in_file;
+
+ /* If you need to seek around the input file. */
+ if (!ft->seekable) {
+ lsx_fail_errno(ft, SOX_EOF, "skel inputfile must be a file");
+ return SOX_EOF;
+ }
+
+ /*
+ * If your format is headerless and has fixed values for
+ * the following items, you can hard code them here (see cdr.c).
+ * If your format contains a header with format information
+ * then you should set it here.
+ */
+ ft->signal.rate = 44100; /* or 8000, 16000, 32000, 48000, ... */
+ ft->signal.channels = 1; /* or 2 or 3 ... */
+ ft->encoding.bits_per_sample = 8; /* or 16 ... */
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED; /* or SIGN2 ... */
+ sox_append_comment(&ft->oob.comments, "any comment in file header.");
+
+ /* If your format doesn't have a header then samples_in_file
+ * can be determined by the file size.
+ */
+ samples_in_file = lsx_filelength(ft) / (ft->encoding.bits_per_sample >> 3);
+
+ /* If you can detect the length of your file, record it here. */
+ ft->signal.length = samples_in_file;
+ sk->remaining_samples = samples_in_file;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Read up to len samples of type sox_sample_t from file into buf[].
+ * Return number of samples read, or 0 if at end of file.
+ */
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * UNUSED sk = (priv_t *)ft->priv;
+ size_t done;
+ unsigned char sample;
+
+ for (done = 0; done < len; done++) {
+ if (lsx_eof(ft) || lsx_readb(ft, &sample)) /* no more samples */
+ break;
+ switch (ft->encoding.bits_per_sample) {
+ case 8:
+ switch (ft->encoding.encoding) {
+ case SOX_ENCODING_UNSIGNED:
+ *buf++ = SOX_UNSIGNED_8BIT_TO_SAMPLE(sample,);
+ break;
+ default:
+ lsx_fail("Undetected sample encoding in read!");
+ return 0;
+ }
+ break;
+ default:
+ lsx_fail("Undetected bad sample size in read!");
+ return 0;
+ }
+ }
+
+ return done;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * Don't close input file!
+ */
+static int stopread(sox_format_t UNUSED * ft)
+{
+ return SOX_SUCCESS;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * UNUSED sk = (priv_t *)ft->priv;
+
+ /* If you have to seek around the output file. */
+ /* If header contains a length value then seeking will be
+ * required. Instead of failing, it's sometimes nice to
+ * just set the length to max value and not fail.
+ */
+ if (!ft->seekable) {
+ lsx_fail("Output .skel file must be a file, not a pipe");
+ return SOX_EOF;
+ }
+
+ if (ft->signal.rate != 44100)
+ lsx_fail("Output .skel file must have a sample rate of 44100Hz");
+
+ if (ft->encoding.bits_per_sample == 0) {
+ lsx_fail("Did not specify a size for .skel output file");
+ return SOX_EOF;
+ }
+
+ /* error check ft->encoding.encoding */
+ /* error check ft->signal.channels */
+
+ /* Write file header, if any */
+ /* Write comment field, if any */
+
+ return SOX_SUCCESS;
+
+}
+
+/*
+ * Write len samples of type sox_sample_t from buf[] to file.
+ * Return number of samples written.
+ */
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * sk = (priv_t *)ft->priv;
+ size_t done = 0;
+
+ (void)sk;
+ switch (ft->encoding.bits_per_sample) {
+ case 8:
+ switch (ft->encoding.encoding) {
+ SOX_SAMPLE_LOCALS;
+ case SOX_ENCODING_UNSIGNED:
+ while (done < len && lsx_writeb(ft, SOX_SAMPLE_TO_UNSIGNED_8BIT(*buf++, ft->clips)) == SOX_SUCCESS)
+ ++done;
+ break;
+ default:
+ lsx_fail("Undetected bad sample encoding in write!");
+ return 0;
+ }
+ break;
+ default:
+ lsx_fail("Undetected bad sample size in write!");
+ return 0;
+ }
+ return done;
+}
+
+static int stopwrite(sox_format_t UNUSED * ft)
+{
+ /* All samples are already written out. */
+ /* If file header needs fixing up, for example it needs the number
+ of samples in a field, seek back and write them here. */
+ return SOX_SUCCESS;
+}
+
+static int seek(sox_format_t UNUSED * ft, uint64_t UNUSED offset)
+{
+ /* Seek relative to current position. */
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(skel)
+{
+ /* Format file suffixes */
+ static const char *names[] = {"skel",NULL };
+
+ /* Encoding types and sizes that this handler can write */
+ static const unsigned encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 0,
+ SOX_ENCODING_UNSIGNED, 8, 0,
+ 0};
+
+ /* Format descriptor
+ * If no specific processing is needed for any of
+ * the 7 functions, then the function above can be deleted
+ * and NULL used in place of the its name below.
+ */
+ static sox_format_handler_t handler = {
+ SOX_LIB_VERSION_CODE,
+ "My first SoX format!",
+ names, 0,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ seek, encodings, NULL, sizeof(priv_t)
+ };
+
+ return &handler;
+}
diff --git a/src/src/smp.c b/src/src/smp.c
new file mode 100644
index 0000000..c7a20d9
--- /dev/null
+++ b/src/src/smp.c
@@ -0,0 +1,418 @@
+/* libSoX SampleVision file format handler.
+ * Output is always in little-endian (80x86/VAX) order.
+ *
+ * Derived from: libSoX skeleton handler file.
+ *
+ * Add: Loop point verbose info. It's a start, anyway.
+ */
+
+/*
+ * June 30, 1992
+ * Copyright 1992 Leigh Smith And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Leigh Smith And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+#include <errno.h>
+
+#define NAMELEN 30 /* Size of Samplevision name */
+#define COMMENTLEN 60 /* Size of Samplevision comment, not shared */
+#define MIDI_UNITY 60 /* MIDI note number to play sample at unity */
+#define MARKERLEN (size_t)10 /* Size of Marker name */
+
+/* The header preceeding the sample data */
+struct smpheader {
+ char Id[18]; /* File identifier */
+ char version[4]; /* File version */
+ char comments[COMMENTLEN]; /* User comments */
+ char name[NAMELEN + 1]; /* Sample Name, left justified */
+};
+#define HEADERSIZE (sizeof(struct smpheader) - 1) /* -1 for name's \0 */
+
+/* Samplevision loop definition structure */
+struct loop {
+ uint32_t start; /* Sample count into sample data, not byte count */
+ uint32_t end; /* end point */
+ unsigned char type; /* 0 = loop off, 1 = forward, 2 = forw/back */
+ unsigned short count; /* No of times to loop */
+};
+
+/* Samplevision marker definition structure */
+struct marker {
+ char name[MARKERLEN + 1]; /* Ascii Marker name */
+ uint32_t position; /* Sample Number, not byte number */
+};
+
+/* The trailer following the sample data */
+struct smptrailer {
+ struct loop loops[8]; /* loops */
+ struct marker markers[8]; /* markers */
+ int8_t MIDInote; /* for unity pitch playback */
+ uint32_t rate; /* in hertz */
+ uint32_t SMPTEoffset; /* in subframes - huh? */
+ uint32_t CycleSize; /* sample count in one cycle of the */
+ /* sampled sound -1 if unknown */
+};
+
+/* Private data for SMP file */
+typedef struct {
+ uint64_t NoOfSamps; /* Sample data count in words */
+ uint64_t dataStart;
+ /* comment memory resides in private data because it's small */
+ char comment[COMMENTLEN + NAMELEN + 3];
+} priv_t;
+
+static char const *SVmagic = "SOUND SAMPLE DATA ", *SVvers = "2.1 ";
+
+/*
+ * Read the SampleVision trailer structure.
+ * Returns 1 if everything was read ok, 0 if there was an error.
+ */
+static int readtrailer(sox_format_t * ft, struct smptrailer *trailer)
+{
+ int i;
+ uint16_t trash16;
+
+ lsx_readw(ft, &trash16); /* read reserved word */
+ for(i = 0; i < 8; i++) { /* read the 8 loops */
+ lsx_readdw(ft, &(trailer->loops[i].start));
+ ft->oob.loops[i].start = trailer->loops[i].start;
+ lsx_readdw(ft, &(trailer->loops[i].end));
+ ft->oob.loops[i].length =
+ trailer->loops[i].end - trailer->loops[i].start;
+ lsx_readb(ft, &(trailer->loops[i].type));
+ ft->oob.loops[i].type = trailer->loops[i].type;
+ lsx_readw(ft, &(trailer->loops[i].count));
+ ft->oob.loops[i].count = trailer->loops[i].count;
+ }
+ for(i = 0; i < 8; i++) { /* read the 8 markers */
+ if (lsx_readbuf(ft, trailer->markers[i].name, MARKERLEN) != MARKERLEN)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"EOF in SMP");
+ return(SOX_EOF);
+ }
+ trailer->markers[i].name[MARKERLEN] = 0;
+ lsx_readdw(ft, &(trailer->markers[i].position));
+ }
+ lsx_readsb(ft, &(trailer->MIDInote));
+ lsx_readdw(ft, &(trailer->rate));
+ lsx_readdw(ft, &(trailer->SMPTEoffset));
+ lsx_readdw(ft, &(trailer->CycleSize));
+ return(SOX_SUCCESS);
+}
+
+/*
+ * set the trailer data - loops and markers, to reasonably benign values
+ */
+static void settrailer(sox_format_t * ft, struct smptrailer *trailer, sox_rate_t rate)
+{
+ int i;
+
+ for(i = 0; i < 8; i++) { /* copy the 8 loops */
+ if (ft->oob.loops[i].type != 0) {
+ trailer->loops[i].start = ft->oob.loops[i].start > UINT_MAX
+ ? UINT_MAX
+ : ft->oob.loops[i].start;
+ /* to mark it as not set */
+ trailer->loops[i].end = ft->oob.loops[i].start + ft->oob.loops[i].length > UINT_MAX
+ ? UINT_MAX
+ : ft->oob.loops[i].start + ft->oob.loops[i].length;
+ trailer->loops[i].type = ft->oob.loops[i].type;
+ trailer->loops[i].count = ft->oob.loops[i].count;
+ } else {
+ /* set first loop start as FFFFFFFF */
+ trailer->loops[i].start = ~0u;
+ /* to mark it as not set */
+ trailer->loops[i].end = 0;
+ trailer->loops[i].type = 0;
+ trailer->loops[i].count = 0;
+ }
+ }
+ for(i = 0; i < 8; i++) { /* write the 8 markers */
+ strcpy(trailer->markers[i].name, " ");
+ trailer->markers[i].position = ~0u;
+ }
+ trailer->MIDInote = MIDI_UNITY; /* Unity play back */
+ trailer->rate = rate;
+ trailer->SMPTEoffset = 0;
+ trailer->CycleSize = ~0u;
+}
+
+/*
+ * Write the SampleVision trailer structure.
+ * Returns 1 if everything was written ok, 0 if there was an error.
+ */
+static int writetrailer(sox_format_t * ft, struct smptrailer *trailer)
+{
+ int i;
+
+ lsx_writew(ft, 0); /* write the reserved word */
+ for(i = 0; i < 8; i++) { /* write the 8 loops */
+ lsx_writedw(ft, trailer->loops[i].start);
+ lsx_writedw(ft, trailer->loops[i].end);
+ lsx_writeb(ft, trailer->loops[i].type);
+ lsx_writew(ft, trailer->loops[i].count);
+ }
+ for(i = 0; i < 8; i++) { /* write the 8 markers */
+ if (lsx_writes(ft, trailer->markers[i].name) == SOX_EOF)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"EOF in SMP");
+ return(SOX_EOF);
+ }
+ lsx_writedw(ft, trailer->markers[i].position);
+ }
+ lsx_writeb(ft, (uint8_t)(trailer->MIDInote));
+ lsx_writedw(ft, trailer->rate);
+ lsx_writedw(ft, trailer->SMPTEoffset);
+ lsx_writedw(ft, trailer->CycleSize);
+ return(SOX_SUCCESS);
+}
+
+static int sox_smpseek(sox_format_t * ft, uint64_t offset)
+{
+ uint64_t new_offset;
+ size_t channel_block, alignment;
+ priv_t * smp = (priv_t *) ft->priv;
+
+ new_offset = offset * (ft->encoding.bits_per_sample >> 3);
+ /* Make sure request aligns to a channel block (ie left+right) */
+ channel_block = ft->signal.channels * (ft->encoding.bits_per_sample >> 3);
+ alignment = new_offset % channel_block;
+ /* Most common mistaken is to compute something like
+ * "skip everthing upto and including this sample" so
+ * advance to next sample block in this case.
+ */
+ if (alignment != 0)
+ new_offset += (channel_block - alignment);
+ new_offset += smp->dataStart;
+
+ ft->sox_errno = lsx_seeki(ft, (off_t)new_offset, SEEK_SET);
+
+ if( ft->sox_errno == SOX_SUCCESS )
+ smp->NoOfSamps = ft->signal.length - (new_offset / (ft->encoding.bits_per_sample >> 3));
+
+ return(ft->sox_errno);
+}
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int sox_smpstartread(sox_format_t * ft)
+{
+ priv_t * smp = (priv_t *) ft->priv;
+ int namelen, commentlen;
+ off_t samplestart;
+ size_t i;
+ unsigned dw;
+ struct smpheader header;
+ struct smptrailer trailer;
+
+ /* If you need to seek around the input file. */
+ if (! ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"SMP input file must be a file, not a pipe");
+ return(SOX_EOF);
+ }
+
+ /* Read SampleVision header */
+ if (lsx_readbuf(ft, &header, HEADERSIZE) != HEADERSIZE)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"unexpected EOF in SMP header");
+ return(SOX_EOF);
+ }
+ if (strncmp(header.Id, SVmagic, (size_t)17) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"SMP header does not begin with magic word %s", SVmagic);
+ return(SOX_EOF);
+ }
+ if (strncmp(header.version, SVvers, (size_t)4) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"SMP header is not version %s", SVvers);
+ return(SOX_EOF);
+ }
+
+ /* Format the sample name and comments to a single comment */
+ /* string. We decrement the counters till we encounter non */
+ /* padding space chars, so the *lengths* are low by one */
+ for (namelen = NAMELEN-1;
+ namelen >= 0 && header.name[namelen] == ' '; namelen--)
+ ;
+ for (commentlen = COMMENTLEN-1;
+ commentlen >= 0 && header.comments[commentlen] == ' '; commentlen--)
+ ;
+ sprintf(smp->comment, "%.*s: %.*s", namelen+1, header.name,
+ commentlen+1, header.comments);
+ sox_append_comments(&ft->oob.comments, smp->comment);
+
+ /* Extract out the sample size (always intel format) */
+ lsx_readdw(ft, &dw);
+ smp->NoOfSamps = dw;
+ /* mark the start of the sample data */
+ samplestart = lsx_tell(ft);
+
+ /* seek from the current position (the start of sample data) by */
+ /* NoOfSamps * sizeof(int16_t) */
+ if (lsx_seeki(ft, (off_t)(smp->NoOfSamps * 2), 1) == -1)
+ {
+ lsx_fail_errno(ft,errno,"SMP unable to seek to trailer");
+ return(SOX_EOF);
+ }
+ if (readtrailer(ft, &trailer))
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"unexpected EOF in SMP trailer");
+ return(SOX_EOF);
+ }
+
+ /* seek back to the beginning of the data */
+ if (lsx_seeki(ft, (off_t)samplestart, 0) == -1)
+ {
+ lsx_fail_errno(ft,errno,"SMP unable to seek back to start of sample data");
+ return(SOX_EOF);
+ }
+
+ ft->signal.rate = (int) trailer.rate;
+ ft->encoding.bits_per_sample = 16;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ ft->signal.channels = 1;
+ smp->dataStart = samplestart;
+ ft->signal.length = smp->NoOfSamps;
+
+ lsx_report("SampleVision trailer:");
+ for(i = 0; i < 8; i++) if (1 || trailer.loops[i].count) {
+ lsx_report("Loop %lu: start: %6d", (unsigned long)i, trailer.loops[i].start);
+ lsx_report(" end: %6d", trailer.loops[i].end);
+ lsx_report(" count: %6d", trailer.loops[i].count);
+ switch(trailer.loops[i].type) {
+ case 0: lsx_report("type: off"); break;
+ case 1: lsx_report("type: forward"); break;
+ case 2: lsx_report("type: forward/backward"); break;
+ }
+ }
+ lsx_report("MIDI Note number: %d", trailer.MIDInote);
+
+ ft->oob.instr.nloops = 0;
+ for(i = 0; i < 8; i++)
+ if (trailer.loops[i].type)
+ ft->oob.instr.nloops++;
+ for(i = 0; i < ft->oob.instr.nloops; i++) {
+ ft->oob.loops[i].type = trailer.loops[i].type;
+ ft->oob.loops[i].count = trailer.loops[i].count;
+ ft->oob.loops[i].start = trailer.loops[i].start;
+ ft->oob.loops[i].length = trailer.loops[i].end
+ - trailer.loops[i].start;
+ }
+ ft->oob.instr.MIDIlow = ft->oob.instr.MIDIhi =
+ ft->oob.instr.MIDInote = trailer.MIDInote;
+ if (ft->oob.instr.nloops > 0)
+ ft->oob.instr.loopmode = SOX_LOOP_8;
+ else
+ ft->oob.instr.loopmode = SOX_LOOP_NONE;
+
+ return(SOX_SUCCESS);
+}
+
+/*
+ * Read up to len samples from file.
+ * Convert to signed longs.
+ * Place in buf[].
+ * Return number of samples read.
+ */
+static size_t sox_smpread(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * smp = (priv_t *) ft->priv;
+ unsigned short datum;
+ size_t done = 0;
+
+ for(; done < len && smp->NoOfSamps; done++, smp->NoOfSamps--) {
+ lsx_readw(ft, &datum);
+ /* scale signed up to long's range */
+ *buf++ = SOX_SIGNED_16BIT_TO_SAMPLE(datum,);
+ }
+ return done;
+}
+
+static int sox_smpstartwrite(sox_format_t * ft)
+{
+ priv_t * smp = (priv_t *) ft->priv;
+ struct smpheader header;
+ char * comment = lsx_cat_comments(ft->oob.comments);
+
+ /* If you have to seek around the output file */
+ if (! ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Output .smp file must be a file, not a pipe");
+ return(SOX_EOF);
+ }
+
+ memcpy(header.Id, SVmagic, sizeof(header.Id));
+ memcpy(header.version, SVvers, sizeof(header.version));
+ sprintf(header.comments, "%-*s", COMMENTLEN - 1, "Converted using Sox.");
+ sprintf(header.name, "%-*.*s", NAMELEN, NAMELEN, comment);
+ free(comment);
+
+ /* Write file header */
+ if(lsx_writebuf(ft, &header, HEADERSIZE) != HEADERSIZE)
+ {
+ lsx_fail_errno(ft,errno,"SMP: Can't write header completely");
+ return(SOX_EOF);
+ }
+ lsx_writedw(ft, 0); /* write as zero length for now, update later */
+ smp->NoOfSamps = 0;
+
+ return(SOX_SUCCESS);
+}
+
+static size_t sox_smpwrite(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * smp = (priv_t *) ft->priv;
+ int datum;
+ size_t done = 0;
+
+ while(done < len) {
+ SOX_SAMPLE_LOCALS;
+ datum = (int) SOX_SAMPLE_TO_SIGNED_16BIT(*buf++, ft->clips);
+ lsx_writew(ft, (uint16_t)datum);
+ smp->NoOfSamps++;
+ done++;
+ }
+
+ return(done);
+}
+
+static int sox_smpstopwrite(sox_format_t * ft)
+{
+ priv_t * smp = (priv_t *) ft->priv;
+ struct smptrailer trailer;
+
+ /* Assign the trailer data */
+ settrailer(ft, &trailer, ft->signal.rate);
+ writetrailer(ft, &trailer);
+ if (lsx_seeki(ft, (off_t)112, 0) == -1)
+ {
+ lsx_fail_errno(ft,errno,"SMP unable to seek back to save size");
+ return(SOX_EOF);
+ }
+ lsx_writedw(ft, smp->NoOfSamps > UINT_MAX ? UINT_MAX : (unsigned)smp->NoOfSamps);
+
+ return(SOX_SUCCESS);
+}
+
+LSX_FORMAT_HANDLER(smp)
+{
+ static char const * const names[] = {"smp", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 16, 0, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Turtle Beach SampleVision", names, SOX_FILE_LIT_END | SOX_FILE_MONO,
+ sox_smpstartread, sox_smpread, NULL,
+ sox_smpstartwrite, sox_smpwrite, sox_smpstopwrite,
+ sox_smpseek, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/sndfile.c b/src/src/sndfile.c
new file mode 100644
index 0000000..27cc5c4
--- /dev/null
+++ b/src/src/sndfile.c
@@ -0,0 +1,544 @@
+/* libSoX libsndfile formats.
+ *
+ * Copyright 2007 Reuben Thomas <rrt@sc3d.org>
+ * Copyright 1999-2005 Erik de Castro Lopo <eridk@mega-nerd.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef HAVE_SNDFILE
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <sndfile.h>
+
+#define LOG_MAX 2048 /* As per the SFC_GET_LOG_INFO example */
+
+#if !defined(HAVE_LIBLTDL)
+#undef DL_SNDFILE
+#endif
+
+static const char* const sndfile_library_names[] =
+{
+#ifdef DL_SNDFILE
+ "libsndfile",
+ "libsndfile-1",
+ "cygsndfile-1",
+#endif
+ NULL
+};
+
+#ifdef DL_SNDFILE
+ #define SNDFILE_FUNC LSX_DLENTRY_DYNAMIC
+ #define SNDFILE_FUNC_STOP LSX_DLENTRY_STUB
+#else
+ #define SNDFILE_FUNC LSX_DLENTRY_STATIC
+#ifdef HACKED_LSF
+ #define SNDFILE_FUNC_STOP LSX_DLENTRY_STATIC
+#else
+ #define SNDFILE_FUNC_STOP LSX_DLENTRY_STUB
+#endif
+#endif /* DL_SNDFILE */
+
+#define SNDFILE_FUNC_OPEN(f,x) \
+ SNDFILE_FUNC(f,x, SNDFILE*, sf_open_virtual, (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data))
+
+#define SNDFILE_FUNC_ENTRIES(f,x) \
+ SNDFILE_FUNC_OPEN(f,x) \
+ SNDFILE_FUNC_STOP(f,x, int, sf_stop, (SNDFILE *sndfile)) \
+ SNDFILE_FUNC(f,x, int, sf_close, (SNDFILE *sndfile)) \
+ SNDFILE_FUNC(f,x, int, sf_format_check, (const SF_INFO *info)) \
+ SNDFILE_FUNC(f,x, int, sf_command, (SNDFILE *sndfile, int command, void *data, int datasize)) \
+ SNDFILE_FUNC(f,x, sf_count_t, sf_read_int, (SNDFILE *sndfile, int *ptr, sf_count_t items)) \
+ SNDFILE_FUNC(f,x, sf_count_t, sf_write_int, (SNDFILE *sndfile, const int *ptr, sf_count_t items)) \
+ SNDFILE_FUNC(f,x, sf_count_t, sf_seek, (SNDFILE *sndfile, sf_count_t frames, int whence)) \
+ SNDFILE_FUNC(f,x, const char*, sf_strerror, (SNDFILE *sndfile))
+
+/* Private data for sndfile files */
+typedef struct {
+ SNDFILE *sf_file;
+ SF_INFO *sf_info;
+ char * log_buffer;
+ char const * log_buffer_ptr;
+ LSX_DLENTRIES_TO_PTRS(SNDFILE_FUNC_ENTRIES, sndfile_dl);
+} priv_t;
+
+/*
+ * Drain LSF's wonderful log buffer
+ */
+static void drain_log_buffer(sox_format_t * ft)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ sf->sf_command(sf->sf_file, SFC_GET_LOG_INFO, sf->log_buffer, LOG_MAX);
+ while (*sf->log_buffer_ptr) {
+ static char const warning_prefix[] = "*** Warning : ";
+ char const * end = strchr(sf->log_buffer_ptr, '\n');
+ if (!end)
+ end = strchr(sf->log_buffer_ptr, '\0');
+ if (!strncmp(sf->log_buffer_ptr, warning_prefix, strlen(warning_prefix))) {
+ sf->log_buffer_ptr += strlen(warning_prefix);
+ lsx_warn("`%s': %.*s",
+ ft->filename, (int)(end - sf->log_buffer_ptr), sf->log_buffer_ptr);
+ } else
+ lsx_debug("`%s': %.*s",
+ ft->filename, (int)(end - sf->log_buffer_ptr), sf->log_buffer_ptr);
+ sf->log_buffer_ptr = end;
+ if (*sf->log_buffer_ptr == '\n')
+ ++sf->log_buffer_ptr;
+ }
+}
+
+/* Make libsndfile subtype from sample encoding and size */
+static int ft_enc(unsigned size, sox_encoding_t e)
+{
+ if (e == SOX_ENCODING_ULAW && size == 8) return SF_FORMAT_ULAW;
+ if (e == SOX_ENCODING_ALAW && size == 8) return SF_FORMAT_ALAW;
+ if (e == SOX_ENCODING_SIGN2 && size == 8) return SF_FORMAT_PCM_S8;
+ if (e == SOX_ENCODING_SIGN2 && size == 16) return SF_FORMAT_PCM_16;
+ if (e == SOX_ENCODING_SIGN2 && size == 24) return SF_FORMAT_PCM_24;
+ if (e == SOX_ENCODING_SIGN2 && size == 32) return SF_FORMAT_PCM_32;
+ if (e == SOX_ENCODING_UNSIGNED && size == 8) return SF_FORMAT_PCM_U8;
+ if (e == SOX_ENCODING_FLOAT && size == 32) return SF_FORMAT_FLOAT;
+ if (e == SOX_ENCODING_FLOAT && size == 64) return SF_FORMAT_DOUBLE;
+ if (e == SOX_ENCODING_G721 && size == 4) return SF_FORMAT_G721_32;
+ if (e == SOX_ENCODING_G723 && size == 3) return SF_FORMAT_G723_24;
+ if (e == SOX_ENCODING_G723 && size == 5) return SF_FORMAT_G723_40;
+ if (e == SOX_ENCODING_MS_ADPCM && size == 4) return SF_FORMAT_MS_ADPCM;
+ if (e == SOX_ENCODING_IMA_ADPCM && size == 4) return SF_FORMAT_IMA_ADPCM;
+ if (e == SOX_ENCODING_OKI_ADPCM && size == 4) return SF_FORMAT_VOX_ADPCM;
+ if (e == SOX_ENCODING_DPCM && size == 8) return SF_FORMAT_DPCM_8;
+ if (e == SOX_ENCODING_DPCM && size == 16) return SF_FORMAT_DPCM_16;
+ if (e == SOX_ENCODING_DWVW && size == 12) return SF_FORMAT_DWVW_12;
+ if (e == SOX_ENCODING_DWVW && size == 16) return SF_FORMAT_DWVW_16;
+ if (e == SOX_ENCODING_DWVW && size == 24) return SF_FORMAT_DWVW_24;
+ if (e == SOX_ENCODING_DWVWN && size == 0) return SF_FORMAT_DWVW_N;
+ if (e == SOX_ENCODING_GSM && size == 0) return SF_FORMAT_GSM610;
+ if (e == SOX_ENCODING_FLAC && size == 8) return SF_FORMAT_PCM_S8;
+ if (e == SOX_ENCODING_FLAC && size == 16) return SF_FORMAT_PCM_16;
+ if (e == SOX_ENCODING_FLAC && size == 24) return SF_FORMAT_PCM_24;
+ if (e == SOX_ENCODING_FLAC && size == 32) return SF_FORMAT_PCM_32;
+ return 0; /* Bad encoding */
+}
+
+/* Convert format's encoding type to libSoX encoding type & size. */
+static sox_encoding_t sox_enc(int ft_encoding, unsigned * size)
+{
+ int sub = ft_encoding & SF_FORMAT_SUBMASK;
+ int type = ft_encoding & SF_FORMAT_TYPEMASK;
+
+ if (type == SF_FORMAT_FLAC) switch (sub) {
+ case SF_FORMAT_PCM_S8 : *size = 8; return SOX_ENCODING_FLAC;
+ case SF_FORMAT_PCM_16 : *size = 16; return SOX_ENCODING_FLAC;
+ case SF_FORMAT_PCM_24 : *size = 24; return SOX_ENCODING_FLAC;
+ }
+ switch (sub) {
+ case SF_FORMAT_ULAW : *size = 8; return SOX_ENCODING_ULAW;
+ case SF_FORMAT_ALAW : *size = 8; return SOX_ENCODING_ALAW;
+ case SF_FORMAT_PCM_S8 : *size = 8; return SOX_ENCODING_SIGN2;
+ case SF_FORMAT_PCM_16 : *size = 16; return SOX_ENCODING_SIGN2;
+ case SF_FORMAT_PCM_24 : *size = 24; return SOX_ENCODING_SIGN2;
+ case SF_FORMAT_PCM_32 : *size = 32; return SOX_ENCODING_SIGN2;
+ case SF_FORMAT_PCM_U8 : *size = 8; return SOX_ENCODING_UNSIGNED;
+ case SF_FORMAT_FLOAT : *size = 32; return SOX_ENCODING_FLOAT;
+ case SF_FORMAT_DOUBLE : *size = 64; return SOX_ENCODING_FLOAT;
+ case SF_FORMAT_G721_32 : *size = 4; return SOX_ENCODING_G721;
+ case SF_FORMAT_G723_24 : *size = 3; return SOX_ENCODING_G723;
+ case SF_FORMAT_G723_40 : *size = 5; return SOX_ENCODING_G723;
+ case SF_FORMAT_MS_ADPCM : *size = 4; return SOX_ENCODING_MS_ADPCM;
+ case SF_FORMAT_IMA_ADPCM: *size = 4; return SOX_ENCODING_IMA_ADPCM;
+ case SF_FORMAT_VOX_ADPCM: *size = 4; return SOX_ENCODING_OKI_ADPCM;
+ case SF_FORMAT_DPCM_8 : *size = 8; return SOX_ENCODING_DPCM;
+ case SF_FORMAT_DPCM_16 : *size = 16; return SOX_ENCODING_DPCM;
+ case SF_FORMAT_DWVW_12 : *size = 12; return SOX_ENCODING_DWVW;
+ case SF_FORMAT_DWVW_16 : *size = 16; return SOX_ENCODING_DWVW;
+ case SF_FORMAT_DWVW_24 : *size = 24; return SOX_ENCODING_DWVW;
+ case SF_FORMAT_DWVW_N : *size = 0; return SOX_ENCODING_DWVWN;
+ case SF_FORMAT_GSM610 : *size = 0; return SOX_ENCODING_GSM;
+ default : *size = 0; return SOX_ENCODING_UNKNOWN;
+ }
+}
+
+static struct {
+ const char *ext;
+ int format;
+} format_map[] =
+{
+ { "aif", SF_FORMAT_AIFF },
+ { "aiff", SF_FORMAT_AIFF },
+ { "wav", SF_FORMAT_WAV },
+ { "au", SF_FORMAT_AU },
+ { "snd", SF_FORMAT_AU },
+ { "caf", SF_FORMAT_CAF },
+ { "flac", SF_FORMAT_FLAC },
+#ifdef HAVE_SNDFILE_1_0_18
+ { "wve", SF_FORMAT_WVE },
+ { "ogg", SF_FORMAT_OGG },
+#endif
+ { "svx", SF_FORMAT_SVX },
+ { "8svx", SF_FORMAT_SVX },
+ { "paf", SF_ENDIAN_BIG | SF_FORMAT_PAF },
+ { "fap", SF_ENDIAN_LITTLE | SF_FORMAT_PAF },
+ { "gsm", SF_FORMAT_RAW | SF_FORMAT_GSM610 },
+ { "nist", SF_FORMAT_NIST },
+ { "sph", SF_FORMAT_NIST },
+ { "ircam", SF_FORMAT_IRCAM },
+ { "sf", SF_FORMAT_IRCAM },
+ { "voc", SF_FORMAT_VOC },
+ { "w64", SF_FORMAT_W64 },
+ { "raw", SF_FORMAT_RAW },
+ { "mat4", SF_FORMAT_MAT4 },
+ { "mat5", SF_FORMAT_MAT5 },
+ { "mat", SF_FORMAT_MAT4 },
+ { "pvf", SF_FORMAT_PVF },
+ { "sds", SF_FORMAT_SDS },
+ { "sd2", SF_FORMAT_SD2 },
+ { "vox", SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM },
+ { "xi", SF_FORMAT_XI }
+};
+
+static int sf_stop_stub(SNDFILE *sndfile UNUSED)
+{
+ return 1;
+}
+
+static sf_count_t vio_get_filelen(void *user_data)
+{
+ sox_format_t *ft = (sox_format_t *)user_data;
+
+ /* lsf excepts unbuffered I/O behavior for get_filelen() so force that */
+ lsx_flush(ft);
+
+ return (sf_count_t)lsx_filelength((sox_format_t *)user_data);
+}
+
+static sf_count_t vio_seek(sf_count_t offset, int whence, void *user_data)
+{
+ return lsx_seeki((sox_format_t *)user_data, (off_t)offset, whence);
+}
+
+static sf_count_t vio_read(void *ptr, sf_count_t count, void *user_data)
+{
+ return lsx_readbuf((sox_format_t *)user_data, ptr, (size_t)count);
+}
+
+static sf_count_t vio_write(const void *ptr, sf_count_t count, void *user_data)
+{
+ return lsx_writebuf((sox_format_t *)user_data, ptr, (size_t)count);
+}
+
+static sf_count_t vio_tell(void *user_data)
+{
+ return lsx_tell((sox_format_t *)user_data);
+}
+
+static SF_VIRTUAL_IO vio =
+{
+ vio_get_filelen,
+ vio_seek,
+ vio_read,
+ vio_write,
+ vio_tell
+};
+
+/* Convert file name or type to libsndfile format */
+static int name_to_format(const char *name)
+{
+ int k;
+#define FILE_TYPE_BUFLEN (size_t)15
+ char buffer[FILE_TYPE_BUFLEN + 1], *cptr;
+
+ if ((cptr = strrchr(name, '.')) != NULL) {
+ strncpy(buffer, cptr + 1, FILE_TYPE_BUFLEN);
+ buffer[FILE_TYPE_BUFLEN] = '\0';
+
+ for (k = 0; buffer[k]; k++)
+ buffer[k] = tolower((buffer[k]));
+ } else {
+ strncpy(buffer, name, FILE_TYPE_BUFLEN);
+ buffer[FILE_TYPE_BUFLEN] = '\0';
+ }
+
+ for (k = 0; k < (int)(sizeof(format_map) / sizeof(format_map [0])); k++) {
+ if (strcmp(buffer, format_map[k].ext) == 0)
+ return format_map[k].format;
+ }
+
+ return 0;
+}
+
+static int start(sox_format_t * ft)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ int subtype = ft_enc(ft->encoding.bits_per_sample? ft->encoding.bits_per_sample : ft->signal.precision, ft->encoding.encoding);
+ int open_library_result;
+
+ LSX_DLLIBRARY_OPEN(
+ sf,
+ sndfile_dl,
+ SNDFILE_FUNC_ENTRIES,
+ "libsndfile library",
+ sndfile_library_names,
+ open_library_result);
+ if (open_library_result)
+ return SOX_EOF;
+
+ sf->log_buffer_ptr = sf->log_buffer = lsx_malloc((size_t)LOG_MAX);
+ sf->sf_info = lsx_calloc(1, sizeof(SF_INFO));
+
+ /* Copy format info */
+ if (subtype) {
+ if (strcmp(ft->filetype, "sndfile") == 0)
+ sf->sf_info->format = name_to_format(ft->filename) | subtype;
+ else
+ sf->sf_info->format = name_to_format(ft->filetype) | subtype;
+ }
+ sf->sf_info->samplerate = (int)ft->signal.rate;
+ sf->sf_info->channels = ft->signal.channels;
+ if (ft->signal.channels)
+ sf->sf_info->frames = ft->signal.length / ft->signal.channels;
+
+ return SOX_SUCCESS;
+}
+
+static int check_read_params(sox_format_t * ft, unsigned channels,
+ sox_rate_t rate, sox_encoding_t encoding, unsigned bits_per_sample, uint64_t length)
+{
+ ft->signal.length = length;
+
+ if (channels && ft->signal.channels && ft->signal.channels != channels)
+ lsx_warn("`%s': overriding number of channels", ft->filename);
+ else ft->signal.channels = channels;
+
+ if (rate && ft->signal.rate && ft->signal.rate != rate)
+ lsx_warn("`%s': overriding sample rate", ft->filename);
+ else ft->signal.rate = rate;
+
+ if (encoding && ft->encoding.encoding && ft->encoding.encoding != encoding)
+ lsx_warn("`%s': overriding encoding type", ft->filename);
+ else ft->encoding.encoding = encoding;
+
+ if (bits_per_sample && ft->encoding.bits_per_sample && ft->encoding.bits_per_sample != bits_per_sample)
+ lsx_warn("`%s': overriding encoding size", ft->filename);
+ ft->encoding.bits_per_sample = bits_per_sample;
+
+ if (sox_precision(ft->encoding.encoding, ft->encoding.bits_per_sample))
+ return SOX_SUCCESS;
+ lsx_fail_errno(ft, EINVAL, "invalid format for this file type");
+ return SOX_EOF;
+}
+
+/*
+ * Open file in sndfile.
+ */
+static int startread(sox_format_t * ft)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ unsigned bits_per_sample;
+ sox_encoding_t encoding;
+ sox_rate_t rate;
+
+ if (start(ft) == SOX_EOF)
+ return SOX_EOF;
+
+ sf->sf_file = sf->sf_open_virtual(&vio, SFM_READ, sf->sf_info, ft);
+ drain_log_buffer(ft);
+
+ if (sf->sf_file == NULL) {
+ memset(ft->sox_errstr, 0, sizeof(ft->sox_errstr));
+ strncpy(ft->sox_errstr, sf->sf_strerror(sf->sf_file), sizeof(ft->sox_errstr)-1);
+ free(sf->sf_file);
+ return SOX_EOF;
+ }
+
+ if (!(encoding = sox_enc(sf->sf_info->format, &bits_per_sample))) {
+ lsx_fail_errno(ft, SOX_EFMT, "unsupported sndfile encoding %#x", sf->sf_info->format);
+ return SOX_EOF;
+ }
+
+ /* Don't believe LSF's rate for raw files */
+ if ((sf->sf_info->format & SF_FORMAT_TYPEMASK) == SF_FORMAT_RAW && !ft->signal.rate) {
+ lsx_warn("`%s': sample rate not specified; trying 8kHz", ft->filename);
+ rate = 8000;
+ }
+ else rate = sf->sf_info->samplerate;
+
+ if ((sf->sf_info->format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT) {
+ sf->sf_command(sf->sf_file, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE);
+ sf->sf_command(sf->sf_file, SFC_SET_CLIPPING, NULL, SF_TRUE);
+ }
+
+#if 0 /* FIXME */
+ sox_append_comments(&ft->oob.comments, buf);
+#endif
+
+ return check_read_params(ft, (unsigned)sf->sf_info->channels, rate,
+ encoding, bits_per_sample, (uint64_t)(sf->sf_info->frames * sf->sf_info->channels));
+}
+
+/*
+ * Read up to len samples of type sox_sample_t from file into buf[].
+ * Return number of samples read.
+ */
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ /* FIXME: We assume int == sox_sample_t here */
+ return (size_t)sf->sf_read_int(sf->sf_file, (int *)buf, (sf_count_t)len);
+}
+
+/*
+ * Close file for libsndfile (this doesn't close the file handle)
+ */
+static int stopread(sox_format_t * ft)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ sf->sf_stop(sf->sf_file);
+ drain_log_buffer(ft);
+ sf->sf_close(sf->sf_file);
+ LSX_DLLIBRARY_CLOSE(sf, sndfile_dl);
+ return SOX_SUCCESS;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+
+ if (start(ft) == SOX_EOF)
+ return SOX_EOF;
+
+ /* If output format is invalid, try to find a sensible default */
+ if (!sf->sf_format_check(sf->sf_info)) {
+ SF_FORMAT_INFO format_info;
+ int i, count;
+
+ sf->sf_command(sf->sf_file, SFC_GET_SIMPLE_FORMAT_COUNT, &count, (int) sizeof(int));
+ for (i = 0; i < count; i++) {
+ format_info.format = i;
+ sf->sf_command(sf->sf_file, SFC_GET_SIMPLE_FORMAT, &format_info, (int) sizeof(format_info));
+ if ((format_info.format & SF_FORMAT_TYPEMASK) == (sf->sf_info->format & SF_FORMAT_TYPEMASK)) {
+ sf->sf_info->format = format_info.format;
+ /* FIXME: Print out exactly what we chose, needs sndfile ->
+ sox encoding conversion functions */
+ break;
+ }
+ }
+
+ if (!sf->sf_format_check(sf->sf_info)) {
+ lsx_fail("cannot find a usable output encoding");
+ return SOX_EOF;
+ }
+ if ((sf->sf_info->format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW)
+ lsx_warn("cannot use desired output encoding, choosing default");
+ }
+
+ sf->sf_file = sf->sf_open_virtual(&vio, SFM_WRITE, sf->sf_info, ft);
+ drain_log_buffer(ft);
+
+ if (sf->sf_file == NULL) {
+ memset(ft->sox_errstr, 0, sizeof(ft->sox_errstr));
+ strncpy(ft->sox_errstr, sf->sf_strerror(sf->sf_file), sizeof(ft->sox_errstr)-1);
+ free(sf->sf_file);
+ return SOX_EOF;
+ }
+
+#ifdef HAVE_SFC_SET_SCALE_INT_FLOAT_WRITE
+ if ((sf->sf_info->format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT)
+ sf->sf_command(sf->sf_file, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE);
+#endif
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Write len samples of type sox_sample_t from buf[] to file.
+ * Return number of samples written.
+ */
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ /* FIXME: We assume int == sox_sample_t here */
+ return (size_t)sf->sf_write_int(sf->sf_file, (int *)buf, (sf_count_t)len);
+}
+
+/*
+ * Close file for libsndfile (this doesn't close the file handle)
+ */
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ sf->sf_stop(sf->sf_file);
+ drain_log_buffer(ft);
+ sf->sf_close(sf->sf_file);
+ LSX_DLLIBRARY_CLOSE(sf, sndfile_dl);
+ return SOX_SUCCESS;
+}
+
+static int seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * sf = (priv_t *)ft->priv;
+ sf->sf_seek(sf->sf_file, (sf_count_t)(offset / ft->signal.channels), SEEK_CUR);
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(sndfile)
+{
+ static char const * const names[] = {
+ "sndfile", /* Special type to force use of sndfile for the following: */
+ /* LSF implementation of formats built in to SoX: */
+ /* "aif", */
+ /* "au", */
+ /* "gsm", */
+ /* "nist", */
+ /* "raw", */
+ /* "sf", "ircam", */
+ /* "snd", */
+ /* "svx", */
+ /* "voc", */
+ /* "vox", */
+ /* "wav", */
+ /* LSF wrappers of formats already wrapped in SoX: */
+ /* "flac", */
+
+ "sds", /* ?? */
+ NULL
+ };
+
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 24, 32, 8, 0,
+ SOX_ENCODING_UNSIGNED, 8, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_IMA_ADPCM, 4, 0,
+ SOX_ENCODING_MS_ADPCM, 4, 0,
+ SOX_ENCODING_OKI_ADPCM, 4, 0,
+ SOX_ENCODING_GSM, 0,
+ 0};
+
+ static sox_format_handler_t const format = {SOX_LIB_VERSION_CODE,
+ "Pseudo format to use libsndfile", names, 0,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ seek, write_encodings, NULL, sizeof(priv_t)
+ };
+
+ return &format;
+}
+
+#endif
diff --git a/src/src/sndio.c b/src/src/sndio.c
new file mode 100644
index 0000000..e7db04f
--- /dev/null
+++ b/src/src/sndio.c
@@ -0,0 +1,242 @@
+/*
+ * libsndio sound handler
+ *
+ * Copyright (c) 2009 Alexandre Ratchov <alex@caoua.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+#include <sndio.h>
+
+struct sndio_priv {
+ struct sio_hdl *hdl; /* handle to speak to libsndio */
+ struct sio_par par; /* current device parameters */
+#define SNDIO_BUFSZ 0x1000
+ unsigned char buf[SNDIO_BUFSZ]; /* temp buffer for converions */
+};
+
+/*
+ * convert ``count'' samples from sox encoding to sndio encoding
+ */
+static void encode(struct sio_par *par,
+ sox_sample_t const *idata, unsigned char *odata, unsigned count)
+{
+ int obnext, osnext, s, osigbit;
+ unsigned oshift, obps, i;
+
+ obps = par->bps;
+ osigbit = par->sig ? 0 : 1 << (par->bits - 1);
+ oshift = 32 - (par->msb ? par->bps * 8 : par->bits);
+ if (par->le) {
+ obnext = 1;
+ osnext = 0;
+ } else {
+ odata += par->bps - 1;
+ obnext = -1;
+ osnext = 2 * par->bps;
+ }
+ for (; count > 0; count--) {
+ s = (*idata++ >> oshift) ^ osigbit;
+ for (i = obps; i > 0; i--) {
+ *odata = (unsigned char)s;
+ s >>= 8;
+ odata += obnext;
+ }
+ odata += osnext;
+ }
+}
+
+/*
+ * convert ``count'' samples from sndio encoding to sox encoding
+ */
+static void decode(struct sio_par *par,
+ unsigned char *idata, sox_sample_t *odata, unsigned count)
+{
+ unsigned ishift, ibps, i;
+ int s = 0xdeadbeef, ibnext, isnext, isigbit;
+
+ ibps = par->bps;
+ isigbit = par->sig ? 0 : 1 << (par->bits - 1);
+ ishift = 32 - (par->msb ? par->bps * 8 : par->bits);
+ if (par->le) {
+ idata += par->bps - 1;
+ ibnext = -1;
+ isnext = 2 * par->bps;
+ } else {
+ ibnext = 1;
+ isnext = 0;
+ }
+ for (; count > 0; count--) {
+ for (i = ibps; i > 0; i--) {
+ s <<= 8;
+ s |= *idata;
+ idata += ibnext;
+ }
+ idata += isnext;
+ *odata++ = (s ^ isigbit) << ishift;
+ }
+}
+
+static int startany(sox_format_t *ft, unsigned mode)
+{
+ struct sndio_priv *p = (struct sndio_priv *)ft->priv;
+ struct sio_par reqpar;
+ char *device;
+
+ device = ft->filename;
+ if (strcmp("default", device) == 0)
+ device = NULL;
+
+ p->hdl = sio_open(device, mode, 0);
+ if (p->hdl == NULL)
+ return SOX_EOF;
+ /*
+ * set specified parameters, leaving others to the defaults
+ */
+ sio_initpar(&reqpar);
+ if (ft->signal.rate > 0)
+ reqpar.rate = ft->signal.rate;
+ if (ft->signal.channels > 0) {
+ if (mode == SIO_PLAY)
+ reqpar.pchan = ft->signal.channels;
+ else
+ reqpar.rchan = ft->signal.channels;
+ }
+ if (ft->signal.precision > 0)
+ reqpar.bits = ft->signal.precision;
+ switch (ft->encoding.encoding) {
+ case SOX_ENCODING_SIGN2:
+ reqpar.sig = 1;
+ break;
+ case SOX_ENCODING_UNSIGNED:
+ reqpar.sig = 0;
+ break;
+ default:
+ break; /* use device default */
+ }
+ if (ft->encoding.bits_per_sample > 0)
+ reqpar.bits = ft->encoding.bits_per_sample;
+ if (ft->encoding.reverse_bytes != sox_option_default) {
+ reqpar.le = SIO_LE_NATIVE;
+ if (ft->encoding.reverse_bytes)
+ reqpar.le = !reqpar.le;
+ }
+ if (!sio_setpar(p->hdl, &reqpar) ||
+ !sio_getpar(p->hdl, &p->par))
+ goto failed;
+ ft->signal.channels = (mode == SIO_PLAY) ? p->par.pchan : p->par.rchan;
+ ft->signal.precision = p->par.bits;
+ ft->signal.rate = p->par.rate;
+ ft->encoding.encoding = p->par.sig ? SOX_ENCODING_SIGN2 : SOX_ENCODING_UNSIGNED;
+ ft->encoding.bits_per_sample = p->par.bps * 8;
+ ft->encoding.reverse_bytes = SIO_LE_NATIVE ? !p->par.le : p->par.le;
+ ft->encoding.reverse_nibbles = sox_option_no;
+ ft->encoding.reverse_bits = sox_option_no;
+
+ if (!sio_start(p->hdl))
+ goto failed;
+ return SOX_SUCCESS;
+ failed:
+ sio_close(p->hdl);
+ return SOX_EOF;
+}
+
+static int stopany(sox_format_t *ft)
+{
+ sio_close(((struct sndio_priv *)ft->priv)->hdl);
+ return SOX_SUCCESS;
+}
+
+static int startread(sox_format_t *ft)
+{
+ return startany(ft, SIO_REC);
+}
+
+static int startwrite(sox_format_t *ft)
+{
+ return startany(ft, SIO_PLAY);
+}
+
+static size_t readsamples(sox_format_t *ft, sox_sample_t *buf, size_t len)
+{
+ struct sndio_priv *p = (struct sndio_priv *)ft->priv;
+ unsigned char partial[4];
+ unsigned cpb, cc, pc;
+ size_t todo, n;
+
+ pc = 0;
+ todo = len * p->par.bps;
+ cpb = SNDIO_BUFSZ - (SNDIO_BUFSZ % p->par.bps);
+ while (todo > 0) {
+ memcpy(p->buf, partial, (size_t)pc);
+ cc = cpb - pc;
+ if (cc > todo)
+ cc = todo;
+ n = sio_read(p->hdl, p->buf + pc, (size_t)cc);
+ if (n == 0 && sio_eof(p->hdl))
+ break;
+ n += pc;
+ pc = n % p->par.bps;
+ n -= pc;
+ memcpy(partial, p->buf + n, (size_t)pc);
+ decode(&p->par, p->buf, buf, (unsigned)(n / p->par.bps));
+ buf += n / p->par.bps;
+ todo -= n;
+ }
+ return len - todo / p->par.bps;
+}
+
+static size_t writesamples(sox_format_t *ft, const sox_sample_t *buf, size_t len)
+{
+ struct sndio_priv *p = (struct sndio_priv *)ft->priv;
+ unsigned sc, spb;
+ size_t n, todo;
+
+ todo = len;
+ spb = SNDIO_BUFSZ / p->par.bps;
+ while (todo > 0) {
+ sc = spb;
+ if (sc > todo)
+ sc = todo;
+ encode(&p->par, buf, p->buf, sc);
+ n = sio_write(p->hdl, p->buf, (size_t)(sc * p->par.bps));
+ if (n == 0 && sio_eof(p->hdl))
+ break;
+ n /= p->par.bps;
+ todo -= n;
+ buf += n;
+ }
+ return len - todo;
+}
+
+LSX_FORMAT_HANDLER(sndio)
+{
+ static char const * const names[] = {"sndio", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 32, 24, 16, 8, 0,
+ SOX_ENCODING_UNSIGNED, 32, 24, 16, 8, 0,
+ 0
+ };
+ static sox_format_handler_t const handler = {
+ SOX_LIB_VERSION_CODE,
+ "libsndio device driver",
+ names,
+ SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ startread, readsamples, stopany,
+ startwrite, writesamples, stopany,
+ NULL, write_encodings, NULL,
+ sizeof(struct sndio_priv)
+ };
+ return &handler;
+}
diff --git a/src/src/sounder.c b/src/src/sounder.c
new file mode 100644
index 0000000..e224236
--- /dev/null
+++ b/src/src/sounder.c
@@ -0,0 +1,55 @@
+/* libSoX Sounder format handler (c) 2008 robs@users.sourceforge.net
+ * See description in soundr3b.zip on the net.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+static int start_read(sox_format_t * ft)
+{
+ uint16_t type, rate;
+
+ if (lsx_readw(ft, &type) || lsx_readw(ft, &rate) || lsx_skipbytes(ft, (size_t) 4))
+ return SOX_EOF;
+ if (type) {
+ lsx_fail_errno(ft, SOX_EHDR, "invalid Sounder header");
+ return SOX_EOF;
+ }
+ return lsx_check_read_params(ft, 1, (sox_rate_t)rate, SOX_ENCODING_UNSIGNED, 8, (uint64_t)0, sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ return lsx_writew(ft, 0) /* sample type */
+ || lsx_writew(ft, min(65535, (unsigned)(ft->signal.rate + .5)))
+ || lsx_writew(ft, 10) /* speaker driver volume */
+ || lsx_writew(ft, 4)? /* speaker driver DC shift */
+ SOX_EOF : SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(sounder)
+{
+ static char const * const names[] = {"sndr", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_UNSIGNED, 8, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "8-bit linear audio as used by Aaron Wallace's `Sounder' of 1991",
+ names, SOX_FILE_LIT_END | SOX_FILE_MONO,
+ start_read, lsx_rawread, NULL,
+ write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/soundtool.c b/src/src/soundtool.c
new file mode 100644
index 0000000..6129f5e
--- /dev/null
+++ b/src/src/soundtool.c
@@ -0,0 +1,78 @@
+/* libSoX SoundTool format handler (c) 2008 robs@users.sourceforge.net
+ * See description in sndtl26.zip on the net.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+static char const ID1[6] = "SOUND\x1a";
+#define text_field_len (size_t)96 /* Includes null-terminator */
+
+static int start_read(sox_format_t * ft)
+{
+ char id1[sizeof(ID1)], comments[text_field_len + 1];
+ uint32_t nsamples;
+ uint16_t rate;
+
+ if (lsx_readchars(ft, id1, sizeof(ID1)) ||
+ lsx_skipbytes(ft, (size_t) 10) || lsx_readdw(ft, &nsamples) ||
+ lsx_readw(ft, &rate) || lsx_skipbytes(ft, (size_t) 6) ||
+ lsx_readchars(ft, comments, text_field_len))
+ return SOX_EOF;
+ if (memcmp(ID1, id1, sizeof(id1))) {
+ lsx_fail_errno(ft, SOX_EHDR, "soundtool: can't find SoundTool identifier");
+ return SOX_EOF;
+ }
+ comments[text_field_len] = '\0'; /* Be defensive against incorrect files */
+ sox_append_comments(&ft->oob.comments, comments);
+ return lsx_check_read_params(ft, 1, (sox_rate_t)rate, SOX_ENCODING_UNSIGNED, 8, (uint64_t)nsamples, sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ char * comment = lsx_cat_comments(ft->oob.comments);
+ char text_buf[text_field_len];
+ uint64_t length = ft->olength? ft->olength:ft->signal.length;
+
+ memset(text_buf, 0, sizeof(text_buf));
+ strncpy(text_buf, comment, text_field_len - 1);
+ free(comment);
+ return lsx_writechars(ft, ID1, sizeof(ID1))
+ || lsx_writew (ft, 0) /* GSound: not used */
+ || lsx_writedw (ft, (unsigned) length) /* length of complete sample */
+ || lsx_writedw (ft, 0) /* first byte to play from sample */
+ || lsx_writedw (ft, (unsigned) length) /* first byte NOT to play from sample */
+ || lsx_writew (ft, min(65535, (unsigned)(ft->signal.rate + .5)))
+ || lsx_writew (ft, 0) /* sample size/type */
+ || lsx_writew (ft, 10) /* speaker driver volume */
+ || lsx_writew (ft, 4) /* speaker driver DC shift */
+ || lsx_writechars(ft, text_buf, sizeof(text_buf))? SOX_EOF:SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(soundtool)
+{
+ static char const * const names[] = {"sndt", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_UNSIGNED, 8, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "8-bit linear audio as used by Martin Hepperle's `SoundTool' of 1991/2",
+ names, SOX_FILE_LIT_END | SOX_FILE_MONO | SOX_FILE_REWIND,
+ start_read, lsx_rawread, NULL,
+ write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/sox-fmt.c b/src/src/sox-fmt.c
new file mode 100644
index 0000000..8e30fda
--- /dev/null
+++ b/src/src/sox-fmt.c
@@ -0,0 +1,106 @@
+/* libSoX file format: SoX native (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+static char const magic[2][4] = {".SoX", "XoS."};
+#define FIXED_HDR (4 + 8 + 8 + 4 + 4) /* Without magic */
+
+static int startread(sox_format_t * ft)
+{
+ char magic_[sizeof(magic[0])];
+ uint32_t headers_bytes, num_channels, comments_bytes;
+ uint64_t num_samples;
+ double rate;
+
+ if (lsx_readdw(ft, (uint32_t *)&magic_))
+ return SOX_EOF;
+
+ if (memcmp(magic[MACHINE_IS_BIGENDIAN], magic_, sizeof(magic_))) {
+ if (memcmp(magic[MACHINE_IS_LITTLEENDIAN], magic_, sizeof(magic_))) {
+ lsx_fail_errno(ft, SOX_EHDR, "can't find sox file format identifier");
+ return SOX_EOF;
+ }
+ ft->encoding.reverse_bytes = !ft->encoding.reverse_bytes;
+ lsx_report("file is opposite endian");
+ }
+ if (lsx_readdw(ft, &headers_bytes) ||
+ lsx_readqw(ft, &num_samples) ||
+ lsx_readdf(ft, &rate) ||
+ lsx_readdw(ft, &num_channels) ||
+ lsx_readdw(ft, &comments_bytes))
+ return SOX_EOF;
+
+ if (((headers_bytes + 4) & 7) || headers_bytes < FIXED_HDR + comments_bytes ||
+ (num_channels > 65535)) /* Reserve top 16 bits */ {
+ lsx_fail_errno(ft, SOX_EHDR, "invalid sox file format header");
+ return SOX_EOF;
+ }
+
+ if (comments_bytes) {
+ char * buf = lsx_calloc(1, (size_t)comments_bytes + 1); /* ensure nul-terminated */
+ if (lsx_readchars(ft, buf, (size_t)comments_bytes) != SOX_SUCCESS) {
+ free(buf);
+ return SOX_EOF;
+ }
+ sox_append_comments(&ft->oob.comments, buf);
+ free(buf);
+ }
+
+ /* Consume any bytes after the comments and before the start of the audio
+ * block. These may include comment padding up to a multiple of 8 bytes,
+ * and further header information that might be defined in future. */
+ lsx_seeki(ft, (off_t)(headers_bytes - FIXED_HDR - comments_bytes), SEEK_CUR);
+
+ return lsx_check_read_params(
+ ft, num_channels, rate, SOX_ENCODING_SIGN2, 32, num_samples, sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ char * comments = lsx_cat_comments(ft->oob.comments);
+ size_t comments_len = strlen(comments);
+ size_t comments_bytes = (comments_len + 7) & ~7u; /* Multiple of 8 bytes */
+ uint64_t size = ft->olength? ft->olength : ft->signal.length;
+ int error;
+ uint32_t header;
+ memcpy(&header, magic[MACHINE_IS_BIGENDIAN], sizeof(header));
+ error = 0
+ ||lsx_writedw(ft, header)
+ ||lsx_writedw(ft, FIXED_HDR + (unsigned)comments_bytes)
+ ||lsx_writeqw(ft, size)
+ ||lsx_writedf(ft, ft->signal.rate)
+ ||lsx_writedw(ft, ft->signal.channels)
+ ||lsx_writedw(ft, (unsigned)comments_len)
+ ||lsx_writechars(ft, comments, comments_len)
+ ||lsx_padbytes(ft, comments_bytes - comments_len);
+ free(comments);
+ return error? SOX_EOF: SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(sox)
+{
+ static char const * const names[] = {"sox", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 32, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "SoX native intermediate format", names, SOX_FILE_REWIND,
+ startread, lsx_rawread, NULL, write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/sox.c b/src/src/sox.c
new file mode 100644
index 0000000..fef004a
--- /dev/null
+++ b/src/src/sox.c
@@ -0,0 +1,3057 @@
+/* SoX - The Swiss Army Knife of Audio Manipulation.
+ *
+ * This is the main function for the SoX command line programs:
+ * sox, play, rec, soxi.
+ *
+ * Copyright 1998-2009 Chris Bagwell and SoX contributors
+ * Copyright 1991 Lance Norskog And Sundry Contributors
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "third_party/sox/src/src/soxconfig.h"
+#include "third_party/sox/src/src/sox.h"
+#include "third_party/sox/src/src/util.h"
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
+
+#if defined(HAVE_WIN32_GLOB_H)
+ #include "third_party/sox/src/src/win32-glob.h"
+ #define HAVE_GLOB_H 1
+#elif defined(HAVE_GLOB_H)
+ #include <glob.h>
+#endif
+
+#ifdef HAVE_IO_H
+ #include <io.h>
+#endif
+
+#ifdef HAVE_SUN_AUDIOIO_H
+ #include <sun/audioio.h>
+ #define HAVE_AUDIOIO_H 1
+#else
+#ifdef HAVE_SYS_AUDIOIO_H
+ #include <sys/audioio.h>
+ #define HAVE_AUDIOIO_H 1
+#endif
+#endif
+
+#ifdef HAVE_SYS_SOUNDCARD_H
+ #include <sys/soundcard.h>
+ #define HAVE_SOUNDCARD_H 1
+#else
+#ifdef HAVE_MACHINE_SOUNDCARD_H
+ #include <machine/soundcard.h>
+ #define HAVE_SOUNDCARD_H 1
+#endif
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+#endif
+
+#ifdef HAVE_SYS_TIMEB_H
+ #include <sys/timeb.h>
+#endif
+
+#ifdef HAVE_SYS_UTSNAME_H
+ #include <sys/utsname.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+#endif
+
+#ifdef HAVE_GETTIMEOFDAY
+ #define TIME_FRAC 1e6
+#else
+ #define timeval timeb
+ #define gettimeofday(a,b) ftime(a)
+ #define tv_sec time
+ #define tv_usec millitm
+ #define TIME_FRAC 1e3
+#endif
+
+#if !defined(HAVE_CONIO_H) && !defined(HAVE_TERMIOS_H) && (defined(_MSC_VER) || defined(__MINGW32__))
+#define HAVE_CONIO_H 1
+#endif
+
+#ifdef HAVE_CONIO_H
+/* _kbhit and _getch */
+#include <conio.h>
+#undef HAVE_TERMIOS_H
+#endif
+
+/*#define MORE_INTERACTIVE 1*/
+
+#define SOX_OPTS "SOX_OPTS"
+static lsx_getopt_t optstate;
+
+/* argv[0] options */
+
+static char const * myname = NULL;
+static enum {sox_sox, sox_play, sox_rec, sox_soxi} sox_mode;
+
+
+/* gopts */
+
+static enum {
+ sox_sequence, sox_concatenate, sox_mix, sox_mix_power,
+ sox_merge, sox_multiply, sox_default
+} combine_method = sox_default;
+static enum { sox_single, sox_multiple } output_method = sox_single;
+#define is_serial(m) ((m) <= sox_concatenate)
+#define is_parallel(m) (!is_serial(m))
+static sox_bool no_clobber = sox_false, interactive = sox_false;
+static sox_bool uservolume = sox_false;
+typedef enum {RG_off, RG_track, RG_album, RG_default} rg_mode;
+static lsx_enum_item const rg_modes[] = {
+ LSX_ENUM_ITEM(RG_,off)
+ LSX_ENUM_ITEM(RG_,track)
+ LSX_ENUM_ITEM(RG_,album)
+ {0, 0}};
+static rg_mode replay_gain_mode = RG_default;
+static sox_option_t show_progress = sox_option_default;
+
+
+/* Input & output files */
+
+typedef struct {
+ char * filename;
+
+ /* fopts */
+ char const * filetype;
+ sox_signalinfo_t signal;
+ sox_encodinginfo_t encoding;
+ double volume;
+ double replay_gain;
+ sox_oob_t oob;
+ sox_bool no_glob;
+
+ sox_format_t * ft; /* libSoX file descriptor */
+ uint64_t volume_clips;
+ rg_mode replay_gain_mode;
+} file_t;
+
+static file_t * * files = NULL; /* Array tracking input and output files */
+#define ofile files[file_count - 1]
+static size_t file_count = 0;
+static size_t input_count = 0;
+static size_t output_count = 0;
+
+/* Effects */
+
+/* We parse effects into a temporary effects table and then place into
+ * the real effects chain. This allows scanning all effects to give
+ * hints to what input effect options should be as well as determining
+ * when mixer or resample effects need to be auto-inserted as well.
+ */
+static sox_effect_t **user_efftab = NULL;
+static size_t user_efftab_size = 0;
+static sox_effects_chain_t *effects_chain = NULL;
+static sox_effect_t *save_output_eff = NULL;
+
+static struct { char *name; int argc; char **argv; size_t argv_size; } **user_effargs = NULL;
+static size_t *user_effargs_size = NULL; /* array: size of user_effargs for each chain */
+/* Size of memory structures related to effects arguments (user_effargs[i],
+ * user_effargs[i][j].argv) to be extended in steps of EFFARGS_STEP */
+#define EFFARGS_STEP 8
+static size_t *nuser_effects = NULL; /* array: number of effects in each chain */
+static size_t current_eff_chain = 0;
+static size_t eff_chain_count = 0;
+static sox_bool very_first_effchain = sox_true;
+ /* Indicates that not only the first effects chain is in effect (hrm), but
+ also that it has never been restarted. Only then we may use the
+ optimize_trim() hack. */
+static char *effects_filename = NULL;
+static char * play_rate_arg = NULL;
+static char *norm_level = NULL;
+
+/* Flowing */
+
+static sox_signalinfo_t combiner_signal, ofile_signal_options;
+static sox_encodinginfo_t combiner_encoding, ofile_encoding_options;
+static uint64_t mixing_clips = 0;
+static size_t current_input = 0;
+static uint64_t input_wide_samples = 0;
+static uint64_t read_wide_samples = 0;
+static uint64_t output_samples = 0;
+static sox_bool input_eof = sox_false;
+static sox_bool output_eof = sox_false;
+static sox_bool user_abort = sox_false;
+static sox_bool user_skip = sox_false;
+static sox_bool user_restart_eff = sox_false;
+static int success = 0;
+static int cleanup_called = 0;
+static sox_sample_t omax[2], omin[2];
+
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+static struct termios original_termios;
+static sox_bool original_termios_saved = sox_false;
+#endif
+
+static sox_bool stdin_is_a_tty, is_player, is_guarded, do_guarded_norm, no_dither, reported_sox_opts;
+
+struct timeval load_timeofday;
+
+static void cleanup(void)
+{
+ size_t i;
+
+ if (!success && !reported_sox_opts) {
+ char const * env_opts = getenv(SOX_OPTS);
+ if (env_opts && *env_opts)
+ lsx_report("used "SOX_OPTS"=%s", env_opts);
+ }
+ /* Close the input and output files before exiting. */
+ for (i = 0; i < input_count; i++) {
+ if (files[i]->ft) {
+ sox_close(files[i]->ft);
+ }
+ free(files[i]->filename);
+ free(files[i]);
+ }
+
+ if (file_count) {
+ if (ofile->ft) {
+ if (!success && ofile->ft->io_type == lsx_io_file) { /* If we failed part way through */
+ struct stat st; /* writing a normal file, remove it. */
+ if (!stat(ofile->ft->filename, &st) &&
+ (st.st_mode & S_IFMT) == S_IFREG)
+ unlink(ofile->ft->filename);
+ }
+ sox_close(ofile->ft); /* Assume we can unlink a file before closing it. */
+ }
+ free(ofile->filename);
+ free(ofile);
+ }
+
+ free(files);
+
+#ifdef HAVE_TERMIOS_H
+ if (original_termios_saved)
+ tcsetattr(fileno(stdin), TCSANOW, &original_termios);
+#endif
+
+ free(user_efftab);
+
+ free(sox_globals.tmp_path);
+ sox_globals.tmp_path = NULL;
+
+ free(play_rate_arg);
+ free(effects_filename);
+ free(norm_level);
+
+ sox_quit();
+
+ cleanup_called = 1;
+}
+
+/* Cleanup atexit() function, hence always called. */
+static void atexit_cleanup(void)
+{
+ /* Do not call cleanup using atexit() if possible. pthread's can
+ * act unpredictable if called outside of main().
+ */
+ if (!cleanup_called)
+ cleanup();
+}
+
+static char const * str_time(double seconds)
+{
+ static char string[16][50];
+ static int i;
+ int hours, mins = seconds / 60;
+ seconds -= mins * 60;
+ hours = mins / 60;
+ mins -= hours * 60;
+ i = (i+1) & 15;
+ sprintf(string[i], "%02i:%02i:%05.2f", hours, mins, seconds);
+ return string[i];
+}
+
+static char const * size_and_bitrate(sox_format_t * ft, char const * * text)
+{
+ off_t size = lsx_filelength(ft);
+ if (ft->signal.length && ft->signal.channels && ft->signal.rate && text) {
+ double secs = ft->signal.length / ft->signal.channels / ft->signal.rate;
+ *text = lsx_sigfigs3(8. * size / secs);
+ }
+ return lsx_sigfigs3((double)size);
+}
+
+static void play_file_info(sox_format_t * ft, file_t * f, sox_bool full)
+{
+ FILE * const output = sox_mode == sox_soxi? stdout : stderr;
+ char const * text, * text2 = NULL;
+ char buffer[30];
+ uint64_t ws = ft->signal.length / ft->signal.channels;
+ (void)full;
+
+ fprintf(output, "\n");
+ if (ft->filename[0]) {
+ fprintf(output, "%s:", ft->filename);
+ if (strcmp(ft->filename, "-") == 0 || (ft->handler.flags & SOX_FILE_DEVICE))
+ fprintf(output, " (%s)", ft->handler.names[0]);
+ fprintf(output, "\n\n");
+ }
+
+ if ((text = size_and_bitrate(ft, &text2))) {
+ fprintf(output, " File Size: %-10s", text);
+ if (text2)
+ fprintf(output, "Bit Rate: %s", text2);
+ fprintf(output, "\n");
+ }
+
+ fprintf(output, " Encoding: %-14s", sox_encodings_info[ft->encoding.encoding].name);
+ text = sox_find_comment(f->ft->oob.comments, "Comment");
+ if (!text)
+ text = sox_find_comment(f->ft->oob.comments, "Description");
+ if (!text)
+ text = sox_find_comment(f->ft->oob.comments, "Year");
+ if (text)
+ fprintf(output, "Info: %s", text);
+ fprintf(output, "\n");
+
+ sprintf(buffer, " Channels: %u @ %u-bit", ft->signal.channels, ft->signal.precision);
+ fprintf(output, "%-25s", buffer);
+ text = sox_find_comment(f->ft->oob.comments, "Tracknumber");
+ if (text) {
+ fprintf(output, "Track: %s", text);
+ text = sox_find_comment(f->ft->oob.comments, "Tracktotal");
+ if (text)
+ fprintf(output, " of %s", text);
+ }
+ fprintf(output, "\n");
+
+ sprintf(buffer, "Samplerate: %gHz", ft->signal.rate);
+ fprintf(output, "%-25s", buffer);
+ text = sox_find_comment(f->ft->oob.comments, "Album");
+ if (text)
+ fprintf(output, "Album: %s", text);
+ fprintf(output, "\n");
+
+ if (f && f->replay_gain != HUGE_VAL){
+ sprintf(buffer, "%s gain: %+.1fdB", lsx_find_enum_value(f->replay_gain_mode, rg_modes)->text, f->replay_gain);
+ buffer[0] += 'A' - 'a';
+ fprintf(output, "%-24s", buffer);
+ } else
+ fprintf(output, "%-24s", "Replaygain: off");
+ text = sox_find_comment(f->ft->oob.comments, "Artist");
+ if (text)
+ fprintf(output, "Artist: %s", text);
+ fprintf(output, "\n");
+
+ fprintf(output, " Duration: %-13s", ft->signal.length? str_time((double)ws / ft->signal.rate) : "unknown");
+ text = sox_find_comment(f->ft->oob.comments, "Title");
+ if (text)
+ fprintf(output, "Title: %s", text);
+ fprintf(output, "\n\n");
+}
+
+static void display_file_info(sox_format_t * ft, file_t * f, sox_bool full)
+{
+ static char const * const no_yes[] = {"no", "yes"};
+ FILE * const output = sox_mode == sox_soxi? stdout : stderr;
+ char const * filetype = lsx_find_file_extension(ft->filename);
+ sox_bool show_type = sox_true;
+ size_t i;
+
+ if (is_player && sox_globals.verbosity < 3) {
+ play_file_info(ft, f, full);
+ return;
+ }
+
+ fprintf(output, "\n%s: '%s'",
+ ft->mode == 'r'? "Input File " : "Output File ", ft->filename);
+ if (filetype) for (i = 0; ft->handler.names[i] && show_type; ++i)
+ if (!strcasecmp(filetype, ft->handler.names[i]))
+ show_type = sox_false;
+ if (show_type)
+ fprintf(output, " (%s)", ft->handler.names[0]);
+ fprintf(output, "\n");
+
+ fprintf(output,
+ "Channels : %u\n"
+ "Sample Rate : %g\n"
+ "Precision : %u-bit\n",
+ ft->signal.channels,
+ ft->signal.rate,
+ ft->signal.precision);
+
+ if (ft->signal.length && ft->signal.channels && ft->signal.rate) {
+ uint64_t ws = ft->signal.length / ft->signal.channels;
+ char const * text, * text2 = NULL;
+ fprintf(output,
+ "Duration : %s = %" PRIu64 " samples %c %g CDDA sectors\n",
+ str_time((double)ws / ft->signal.rate),
+ ws, "~="[ft->signal.rate == 44100],
+ (double)ws / ft->signal.rate * 44100 / 588);
+ if (ft->mode == 'r' && (text = size_and_bitrate(ft, &text2))) {
+ fprintf(output, "File Size : %s\n", text);
+ if (text2)
+ fprintf(output, "Bit Rate : %s\n", text2);
+ }
+ }
+
+ if (ft->encoding.encoding) {
+ char buffer[20] = {'\0'};
+ if (ft->encoding.bits_per_sample)
+ sprintf(buffer, "%u-bit ", ft->encoding.bits_per_sample);
+
+ fprintf(output, "Sample Encoding: %s%s\n", buffer,
+ sox_encodings_info[ft->encoding.encoding].desc);
+ }
+
+ if (full) {
+ if (ft->encoding.bits_per_sample > 8 || (ft->handler.flags & SOX_FILE_ENDIAN))
+ fprintf(output, "Endian Type : %s\n",
+ ft->encoding.reverse_bytes != MACHINE_IS_BIGENDIAN ? "big" : "little");
+ if (ft->encoding.bits_per_sample)
+ fprintf(output,
+ "Reverse Nibbles: %s\n"
+ "Reverse Bits : %s\n",
+ no_yes[ft->encoding.reverse_nibbles],
+ no_yes[ft->encoding.reverse_bits]);
+ }
+
+ if (f && f->replay_gain != HUGE_VAL)
+ fprintf(output, "Replay gain : %+g dB (%s)\n" , f->replay_gain,
+ lsx_find_enum_value(f->replay_gain_mode, rg_modes)->text);
+ if (f && f->volume != HUGE_VAL)
+ fprintf(output, "Level adjust : %g (linear gain)\n" , f->volume);
+
+ if (!(ft->handler.flags & SOX_FILE_DEVICE) && ft->oob.comments) {
+ if (sox_num_comments(ft->oob.comments) > 1) {
+ sox_comments_t p = ft->oob.comments;
+ fprintf(output, "Comments : \n");
+ do fprintf(output, "%s\n", *p);
+ while (*++p);
+ }
+ else fprintf(output, "Comment : '%s'\n", ft->oob.comments[0]);
+ }
+ fprintf(output, "\n");
+}
+
+static void report_file_info(file_t * f)
+{
+ if (sox_globals.verbosity > 2)
+ display_file_info(f->ft, f, sox_true);
+}
+
+static void progress_to_next_input_file(file_t * f, sox_effect_t * effp)
+{
+ if (user_skip) {
+ user_skip = sox_false;
+ fprintf(stderr, "\nSkipped (Ctrl-C twice to quit).\n");
+ }
+ read_wide_samples = 0;
+ input_wide_samples = f->ft->signal.length / f->ft->signal.channels;
+ if (show_progress && (sox_globals.verbosity < 3 ||
+ (is_serial(combine_method) && input_count > 1)))
+ display_file_info(f->ft, f, sox_false);
+ if (f->volume == HUGE_VAL)
+ f->volume = 1;
+ if (f->replay_gain != HUGE_VAL)
+ f->volume *= pow(10.0, f->replay_gain / 20);
+ if (effp && f->volume != floor(f->volume))
+ effp->out_signal.precision = SOX_SAMPLE_PRECISION;
+ f->ft->sox_errno = errno = 0;
+}
+
+/* Read up to max `wide' samples. A wide sample contains one sample per channel
+ * from the input audio. */
+static size_t sox_read_wide(sox_format_t * ft, sox_sample_t * buf, size_t max)
+{
+ size_t len = max / combiner_signal.channels;
+ len = sox_read(ft, buf, len * ft->signal.channels) / ft->signal.channels;
+ if (!len && ft->sox_errno)
+ lsx_fail("`%s' %s: %s",
+ ft->filename, ft->sox_errstr, sox_strerror(ft->sox_errno));
+ return len;
+}
+
+static void balance_input(sox_sample_t * buf, size_t ws, file_t * f)
+{
+ size_t s = ws * f->ft->signal.channels;
+
+ if (f->volume != 1) while (s--) {
+ double d = f->volume * *buf;
+ *buf++ = SOX_ROUND_CLIP_COUNT(d, f->volume_clips);
+ }
+}
+
+/* The input combiner: contains one sample buffer per input file, but only
+ * needed if is_parallel(combine_method) */
+typedef struct {
+ sox_sample_t * * ibuf;
+ size_t * ilen;
+} input_combiner_t;
+
+static int combiner_start(sox_effect_t *effp)
+{
+ input_combiner_t * z = (input_combiner_t *) effp->priv;
+ uint64_t ws;
+ size_t i;
+
+ if (is_serial(combine_method))
+ progress_to_next_input_file(files[current_input], effp);
+ else {
+ ws = 0;
+ z->ibuf = lsx_malloc(input_count * sizeof(*z->ibuf));
+ for (i = 0; i < input_count; i++) {
+ z->ibuf[i] = lsx_malloc(sox_globals.bufsiz * sizeof(sox_sample_t));
+ progress_to_next_input_file(files[i], effp);
+ ws = max(ws, input_wide_samples);
+ }
+ input_wide_samples = ws; /* Output length is that of longest input file. */
+ }
+ z->ilen = lsx_malloc(input_count * sizeof(*z->ilen));
+ return SOX_SUCCESS;
+}
+
+static sox_bool can_segue(size_t i)
+{
+ return
+ files[i]->ft->signal.channels == files[i - 1]->ft->signal.channels &&
+ files[i]->ft->signal.rate == files[i - 1]->ft->signal.rate;
+}
+
+static int combiner_drain(sox_effect_t *effp, sox_sample_t * obuf, size_t * osamp)
+{
+ input_combiner_t * z = (input_combiner_t *) effp->priv;
+ size_t ws, s, i;
+ size_t olen = 0;
+
+ if (is_serial(combine_method)) {
+ while (sox_true) {
+ if (!user_skip)
+ olen = sox_read_wide(files[current_input]->ft, obuf, *osamp);
+ if (olen == 0) { /* If EOF, go to the next input file. */
+ if (++current_input < input_count) {
+ if (combine_method == sox_sequence && !can_segue(current_input))
+ break;
+ progress_to_next_input_file(files[current_input], NULL);
+ continue;
+ }
+ }
+ balance_input(obuf, olen, files[current_input]);
+ break;
+ } /* while */
+ } /* is_serial */ else { /* else is_parallel() */
+ sox_sample_t * p = obuf;
+ for (i = 0; i < input_count; ++i) {
+ z->ilen[i] = sox_read_wide(files[i]->ft, z->ibuf[i], *osamp);
+ balance_input(z->ibuf[i], z->ilen[i], files[i]);
+ olen = max(olen, z->ilen[i]);
+ }
+ for (ws = 0; ws < olen; ++ws) { /* wide samples */
+ if (combine_method == sox_mix || combine_method == sox_mix_power) {
+ for (s = 0; s < effp->in_signal.channels; ++s, ++p) { /* sum samples */
+ *p = 0;
+ for (i = 0; i < input_count; ++i)
+ if (ws < z->ilen[i] && s < files[i]->ft->signal.channels) {
+ /* Cast to double prevents integer overflow */
+ double sample = *p + (double)z->ibuf[i][ws * files[i]->ft->signal.channels + s];
+ *p = SOX_ROUND_CLIP_COUNT(sample, mixing_clips);
+ }
+ }
+ } /* sox_mix */ else if (combine_method == sox_multiply) {
+ for (s = 0; s < effp->in_signal.channels; ++s, ++p) { /* multiply samples */
+ i = 0;
+ *p = ws < z->ilen[i] && s < files[i]->ft->signal.channels?
+ z->ibuf[i][ws * files[i]->ft->signal.channels + s] : 0;
+ for (++i; i < input_count; ++i) {
+ double sample = *p * (-1. / SOX_SAMPLE_MIN) * (ws < z->ilen[i] && s < files[i]->ft->signal.channels? z->ibuf[i][ws * files[i]->ft->signal.channels + s] : 0);
+ *p = SOX_ROUND_CLIP_COUNT(sample, mixing_clips);
+ }
+ }
+ } /* sox_multiply */ else { /* sox_merge: like a multi-track recorder */
+ for (i = 0; i < input_count; ++i)
+ for (s = 0; s < files[i]->ft->signal.channels; ++s)
+ *p++ = (ws < z->ilen[i]) * z->ibuf[i][ws * files[i]->ft->signal.channels + s];
+ } /* sox_merge */
+ } /* wide samples */
+ } /* is_parallel */
+ read_wide_samples += olen;
+ olen *= effp->in_signal.channels;
+ *osamp = olen;
+
+ input_eof = olen ? sox_false : sox_true;
+
+ if (input_eof && is_parallel(combine_method))
+ current_input += input_count;
+
+ return olen? SOX_SUCCESS : SOX_EOF;
+}
+
+static int combiner_stop(sox_effect_t *effp)
+{
+ input_combiner_t * z = (input_combiner_t *) effp->priv;
+ size_t i;
+
+ if (is_parallel(combine_method)) {
+ /* Free input buffers now that they are not used */
+ for (i = 0; i < input_count; i++)
+ free(z->ibuf[i]);
+ free(z->ibuf);
+ }
+ free(z->ilen);
+
+ return SOX_SUCCESS;
+}
+
+static sox_effect_handler_t const * input_combiner_effect_fn(void)
+{
+ static sox_effect_handler_t handler = { "input", 0, SOX_EFF_MCHAN |
+ SOX_EFF_MODIFY, 0, combiner_start, 0, combiner_drain,
+ combiner_stop, 0, sizeof(input_combiner_t)
+ };
+ return &handler;
+}
+
+static int ostart(sox_effect_t *effp)
+{
+ unsigned prec = effp->out_signal.precision;
+ if (effp->in_signal.mult && effp->in_signal.precision > prec)
+ *effp->in_signal.mult *= 1 - (1 << (31 - prec)) * (1. / SOX_SAMPLE_MAX);
+ return SOX_SUCCESS;
+}
+
+static int output_flow(sox_effect_t *effp, sox_sample_t const * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ size_t len;
+
+ (void)effp, (void)obuf;
+ if (show_progress) for (len = 0; len < *isamp; len += effp->in_signal.channels) {
+ omax[0] = max(omax[0], ibuf[len]);
+ omin[0] = min(omin[0], ibuf[len]);
+ if (effp->in_signal.channels > 1) {
+ omax[1] = max(omax[1], ibuf[len + 1]);
+ omin[1] = min(omin[1], ibuf[len + 1]);
+ }
+ else {
+ omax[1] = omax[0];
+ omin[1] = omin[0];
+ }
+ }
+ *osamp = 0;
+ len = *isamp? sox_write(ofile->ft, ibuf, *isamp) : 0;
+ output_samples += len / ofile->ft->signal.channels;
+ output_eof = (len != *isamp) ? sox_true: sox_false;
+ if (len != *isamp) {
+ if (ofile->ft->sox_errno)
+ lsx_fail("`%s' %s: %s", ofile->ft->filename,
+ ofile->ft->sox_errstr, sox_strerror(ofile->ft->sox_errno));
+ return SOX_EOF;
+ }
+ return SOX_SUCCESS;
+}
+
+static sox_effect_handler_t const * output_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"output", 0, SOX_EFF_MCHAN |
+ SOX_EFF_MODIFY | SOX_EFF_PREC, NULL, ostart, output_flow, NULL, NULL, NULL, 0
+ };
+ return &handler;
+}
+
+static void auto_effect(sox_effects_chain_t *, char const *, int, char **,
+ sox_signalinfo_t *, int *);
+
+static int add_effect(sox_effects_chain_t * chain, sox_effect_t * effp,
+ sox_signalinfo_t * in, sox_signalinfo_t const * out, int * guard) {
+ int no_guard = -1;
+ switch (*guard) {
+ case 0: if (!(effp->handler.flags & SOX_EFF_GAIN)) {
+ char * arg = "-h";
+ auto_effect(chain, "gain", 1, &arg, in, &no_guard);
+ ++*guard;
+ }
+ break;
+ case 1: if (effp->handler.flags & SOX_EFF_GAIN) {
+ char * arg = "-r";
+ auto_effect(chain, "gain", 1, &arg, in, &no_guard);
+ --*guard;
+ }
+ break;
+ case 2: if (!(effp->handler.flags & SOX_EFF_MODIFY)) {
+ lsx_warn("%s: effects that modify audio should not follow dither",
+ effp->handler.name);
+ }
+ break;
+ }
+ return sox_add_effect(chain, effp, in, out);
+}
+
+static void auto_effect(sox_effects_chain_t *chain, char const *name, int argc,
+ char *argv[], sox_signalinfo_t *signal, int * guard)
+{
+ sox_effect_t * effp;
+
+ effp = sox_create_effect(sox_find_effect(name)); /* Should always succeed. */
+
+ if (sox_effect_options(effp, argc, argv) == SOX_EOF)
+ exit(1); /* The failing effect should have displayed an error message */
+
+ if (add_effect(chain, effp, signal, &ofile->ft->signal, guard) != SOX_SUCCESS)
+ exit(2); /* The effects chain should have displayed an error message */
+ free(effp);
+}
+
+/* add_eff_chain() - NOTE: this only adds memory for one
+ * additional effects chain beyond value of eff_chain_count. It
+ * does not unconditionally increase size of effects chain.
+ */
+static void add_eff_chain(void)
+{
+ lsx_revalloc(user_effargs, eff_chain_count+1);
+ user_effargs[eff_chain_count] = lsx_malloc(sizeof(**user_effargs));
+
+ lsx_revalloc(user_effargs_size, eff_chain_count+1);
+ user_effargs_size[eff_chain_count] = 0;
+ lsx_revalloc(nuser_effects, eff_chain_count+1);
+ nuser_effects[eff_chain_count] = 0;
+} /* add_eff_chain */
+
+/* free_eff_chain() - the inverse of add_eff_chain(). Frees
+ * one effects chain (with index eff_chain_count) such that
+ * there are eff_chain_count left, the last having index
+ * eff_chain_count-1.
+ */
+static void free_eff_chain(void)
+{
+ size_t j;
+ int k;
+ for (j = 0; j < nuser_effects[eff_chain_count]; j++)
+ {
+ free(user_effargs[eff_chain_count][j].name);
+ user_effargs[eff_chain_count][j].name = NULL;
+ for (k = 0; k < user_effargs[eff_chain_count][j].argc; k++)
+ {
+ free(user_effargs[eff_chain_count][j].argv[k]);
+ user_effargs[eff_chain_count][j].argv[k] = NULL;
+ }
+ user_effargs[eff_chain_count][j].argc = 0;
+ free(user_effargs[eff_chain_count][j].argv);
+ user_effargs[eff_chain_count][j].argv = NULL;
+ user_effargs[eff_chain_count][j].argv_size = 0;
+ }
+ nuser_effects[eff_chain_count] = 0;
+ free(user_effargs[eff_chain_count]);
+} /* free_eff_chain */
+
+static void delete_eff_chains(void)
+{
+ while (eff_chain_count > 0) {
+ eff_chain_count--;
+ free_eff_chain();
+ }
+ free(user_effargs);
+ free(user_effargs_size);
+ free(nuser_effects);
+ user_effargs = NULL;
+ user_effargs_size = NULL;
+ nuser_effects = NULL;
+} /* delete_eff_chains */
+
+static sox_bool is_pseudo_effect(const char *s)
+{
+ if (s)
+ if (strcmp("newfile", s) == 0 ||
+ strcmp("restart", s) == 0 ||
+ strcmp(":", s) == 0)
+ return sox_true;
+ return sox_false;
+} /* is_pseudo_effect */
+
+static void parse_effects(int argc, char ** argv)
+{
+ while (optstate.ind < argc) {
+ size_t eff_offset, j;
+ int newline_mode = 0;
+
+ eff_offset = nuser_effects[eff_chain_count];
+ if (eff_offset == user_effargs_size[eff_chain_count]) {
+ size_t i = user_effargs_size[eff_chain_count];
+ user_effargs_size[eff_chain_count] += EFFARGS_STEP;
+ lsx_revalloc(user_effargs[eff_chain_count], user_effargs_size[eff_chain_count]);
+ for (; i < user_effargs_size[eff_chain_count]; i++) {
+ user_effargs[eff_chain_count][i].argv = NULL;
+ user_effargs[eff_chain_count][i].argv_size = 0;
+ }
+ }
+
+ /* pseudo-effect ":" is used to create a new effects chain */
+ if (strcmp(argv[optstate.ind], ":") == 0)
+ {
+ /* Only create a new chain if current one has effects.
+ * Error checking will be done when loop is restarted.
+ */
+ if (nuser_effects[eff_chain_count] != 0)
+ {
+ eff_chain_count++;
+ add_eff_chain();
+ }
+ optstate.ind++;
+ continue;
+ }
+
+ if (strcmp(argv[optstate.ind], "newfile") == 0)
+ {
+ /* Start a new effect chain for newfile if user doesn't
+ * manually do it. Restart loop without advancing
+ * optstate.ind to do error checking.
+ */
+ if (nuser_effects[eff_chain_count] != 0)
+ {
+ eff_chain_count++;
+ add_eff_chain();
+ continue;
+ }
+ newline_mode = 1;
+ output_method = sox_multiple;
+ }
+ else if (strcmp(argv[optstate.ind], "restart") == 0)
+ {
+ /* Start a new effect chain for restart if user doesn't
+ * manually do it. Restart loop without advancing
+ * optstate.ind to do error checking.
+ */
+ if (nuser_effects[eff_chain_count] != 0)
+ {
+ eff_chain_count++;
+ add_eff_chain();
+ continue;
+ }
+ newline_mode = 1;
+ }
+
+ /* Name should always be correct! */
+ user_effargs[eff_chain_count][eff_offset].name = lsx_strdup(argv[optstate.ind]);
+ optstate.ind++;
+ for (j = 0; j < (size_t)(argc - optstate.ind) && !sox_find_effect(argv[optstate.ind + j]) &&
+ !is_pseudo_effect(argv[optstate.ind + j]); ++j) {
+ if (j >= user_effargs[eff_chain_count][eff_offset].argv_size) {
+ user_effargs[eff_chain_count][eff_offset].argv_size += EFFARGS_STEP;
+ lsx_revalloc(user_effargs[eff_chain_count][eff_offset].argv,
+ user_effargs[eff_chain_count][eff_offset].argv_size);
+ }
+ user_effargs[eff_chain_count][eff_offset].argv[j] = lsx_strdup(argv[optstate.ind + j]);
+ }
+ user_effargs[eff_chain_count][eff_offset].argc = j;
+
+ optstate.ind += j; /* Skip past the effect arguments */
+ nuser_effects[eff_chain_count]++;
+ if (newline_mode)
+ {
+ eff_chain_count++;
+ add_eff_chain();
+ }
+ }
+} /* parse_effects */
+
+static char * * strtoargv(char * s, int * argc)
+{
+ sox_bool squote = sox_false; /* Single quote mode (') is in effect. */
+ sox_bool dquote = sox_false; /* Double quote mode (") is in effect. */
+ sox_bool esc = sox_false; /* Escape mode (\) is in effect. */
+ char * t, * * argv = NULL;
+
+ for (*argc = 0; *s;) {
+ for (; isspace(*s); ++s); /* Skip past any (more) white space. */
+ if (*s) { /* Found an arg. */
+ lsx_revalloc(argv, *argc + 1);
+ argv[(*argc)++] = s; /* Store pointer to start of arg. */
+ /* Find the end of the arg: */
+ for (t = s; *s && (esc || squote || dquote || !isspace(*s)); ++s)
+ if (!esc && !squote && *s == '"')
+ dquote = !dquote; /* Toggle double quote mode. */
+ else if (!esc && !dquote && *s == '\'')
+ squote = !squote; /* Toggle single quote mode. */
+ else if (!(esc = !esc && *s == '\\' && s[1] &&
+ (!squote && (s[1] == '"' || !dquote))))
+ *t++ = *s; /* Only copy if not an active ', ", or \ */
+ s = *s ? s + 1 : s; /* Skip the 1st white space char. */
+ *t = '\0'; /* Terminate the arg. */
+ }
+ }
+ return argv;
+} /* strtoargv */
+
+static void read_user_effects(char const *filename)
+{
+ FILE *file = fopen(filename, "r");
+ const size_t buffer_size_step = 1024;
+ size_t buffer_size = buffer_size_step;
+ char *s = lsx_malloc(buffer_size); /* buffer for one input line */
+ int pos = 0;
+ int argc;
+ char * * argv;
+ sox_bool last_was_colon = sox_false; /* last line read consisted of ":" only */
+
+ /* Free any command line options and then re-initialize to
+ * starter user_effargs.
+ */
+ delete_eff_chains();
+ current_eff_chain = 0;
+ add_eff_chain();
+
+ if (!file) {
+ lsx_fail("Cannot open effects file `%s': %s", filename, strerror(errno));
+ exit(1);
+ }
+
+ lsx_report("Reading effects from file `%s'", filename);
+
+ while(fgets(s + pos, (int) (buffer_size - pos), file)) {
+ int len = strlen(s + pos);
+ if (len && s[pos+len-1] == '\n')
+ s[pos+len-1] = '\0', pos = 0; /* we've read a complete line */
+ else if (len == (int)(buffer_size - pos - 1)) {
+ /* line was longer than buffer size */
+ buffer_size += buffer_size_step;
+ s = lsx_realloc(s, buffer_size);
+ pos += len;
+ continue; /* read next part */
+ } else {
+ /* something strange happened; the file might have ended
+ without a '\n', might contain '\0', or a read error
+ occurred */
+ if (ferror(file))
+ break; /* use error reporting after loop */
+ lsx_fail("Error reading effects file `%s' (not a text file?)", filename);
+ exit(1);
+ }
+
+ last_was_colon = sox_false;
+
+ argv = strtoargv(s, &argc);
+
+ if (argv && argc == 1 && strcmp(argv[0], ":") == 0)
+ last_was_colon = sox_true;
+
+ if (argv) {
+ /* Make sure first option is an effect name. */
+ if (!sox_find_effect(argv[0]) && !is_pseudo_effect(argv[0]))
+ {
+ lsx_fail("Cannot find an effect called `%s'.", argv[0]);
+ exit(1);
+ }
+
+ /* parse_effects normally parses options from command line.
+ * Reset opt index so it thinks its back at beginning of
+ * main()'s argv[].
+ */
+ optstate.ind = 0;
+ parse_effects(argc, argv);
+
+ /* Advance to next effect but only if current chain has been
+ * filled in. This recovers from side affects of pseudo-effects.
+ */
+ if (nuser_effects[eff_chain_count] > 0) {
+ eff_chain_count++;
+ add_eff_chain();
+ }
+
+ free(argv);
+ }
+ }
+ if (ferror(file)) {
+ lsx_fail("Error reading effects file `%s': %s", filename, strerror(errno));
+ exit(1);
+ }
+ fclose(file);
+ free(s);
+
+ if (last_was_colon || eff_chain_count == 0) {
+ /* user explicitly wanted an empty last effects chain,
+ or didn't specify any chains at all */
+ eff_chain_count++;
+ } else {
+ /* there's one unneeded effects chain */
+ free_eff_chain();
+ }
+} /* read_user_effects */
+
+/* Creates users effects and passes in user specified options.
+ * This is done without putting anything into the effects chain
+ * because an effect may set the effp->in_format and we may want
+ * to copy that back into the input/combiner before opening and
+ * inserting it.
+ * Similarly, we may want to use effp->out_format to override the
+ * default values of output file before we open it.
+ * To keep things simple, we create all user effects. Later, when
+ * we add them, some may already be in the chain and we will need to free
+ * them.
+ */
+static void create_user_effects(void)
+{
+ size_t i;
+ sox_effect_t *effp;
+ size_t num_effects = nuser_effects[current_eff_chain];
+
+ /* extend user_efftab, if needed */
+ if (user_efftab_size < num_effects) {
+ user_efftab_size = num_effects;
+ lsx_revalloc(user_efftab, num_effects);
+ }
+
+ for (i = 0; i < num_effects; i++) {
+ effp = sox_create_effect(sox_find_effect(user_effargs[current_eff_chain][i].name));
+
+ if (effp->handler.flags & SOX_EFF_DEPRECATED)
+ lsx_warn("effect `%s' is deprecated; see sox(1) for an alternative",
+ effp->handler.name);
+ else if (effp->handler.flags & SOX_EFF_ALPHA)
+ lsx_warn("effect `%s' is experimental/incomplete", effp->handler.name);
+ else if (effp->handler.flags & SOX_EFF_INTERNAL) {
+ lsx_fail("`%s' is a libSoX-only effect", effp->handler.name);
+ exit(1);
+ }
+
+ /* The failing effect should have displayed an error message */
+ if (sox_effect_options(effp, user_effargs[current_eff_chain][i].argc,
+ user_effargs[current_eff_chain][i].argv) == SOX_EOF)
+ exit(1);
+
+ user_efftab[i] = effp;
+ }
+}
+
+/* Add all user effects to the chain. If the output effect's rate or
+ * channel count do not match the end of the effects chain then
+ * insert effects to correct this.
+ *
+ * This can be called with the input effect already in the effects
+ * chain from a previous run. Also, it use a pre-existing
+ * output effect if its been saved into save_output_eff.
+ */
+static void add_effects(sox_effects_chain_t *chain)
+{
+ sox_signalinfo_t signal = combiner_signal;
+ int guard = is_guarded - 1;
+ size_t i;
+ sox_effect_t * effp;
+ char * rate_arg = is_player ? (play_rate_arg ? play_rate_arg : "-l") : NULL;
+
+ /* 1st `effect' in the chain is the input combiner_signal.
+ * add it only if its not there from a previous run. */
+ if (chain->length == 0) {
+ effp = sox_create_effect(input_combiner_effect_fn());
+ sox_add_effect(chain, effp, &signal, &ofile->ft->signal);
+ free(effp);
+ }
+
+ /* Add user specified effects; stop before `dither' */
+ for (i = 0; i < nuser_effects[current_eff_chain] &&
+ strcmp(user_efftab[i]->handler.name, "dither"); i++) {
+ if (add_effect(chain, user_efftab[i], &signal, &ofile->ft->signal,
+ &guard) != SOX_SUCCESS)
+ exit(2); /* Effects chain should have displayed an error message */
+ free(user_efftab[i]);
+ }
+
+ /* Add auto effects if still needed at this point */
+ if (signal.channels < ofile->ft->signal.channels &&
+ signal.rate != ofile->ft->signal.rate)
+ auto_effect(chain, "rate", rate_arg != NULL, &rate_arg, &signal, &guard);
+ if (signal.channels != ofile->ft->signal.channels)
+ auto_effect(chain, "channels", 0, NULL, &signal, &guard);
+ if (signal.rate != ofile->ft->signal.rate)
+ auto_effect(chain, "rate", rate_arg != NULL, &rate_arg, &signal, &guard);
+
+ if (is_guarded && (do_guarded_norm || !(signal.mult && *signal.mult == 1))) {
+ char *args[2];
+ int no_guard = -1;
+ args[0] = do_guarded_norm? "-nh" : guard? "-rh" : "-h";
+ args[1] = norm_level;
+ auto_effect(chain, "gain", norm_level ? 2 : 1, args, &signal, &no_guard);
+ guard = 1;
+ }
+
+ if (i == nuser_effects[current_eff_chain] && !no_dither && signal.precision >
+ ofile->ft->signal.precision && ofile->ft->signal.precision < 24)
+ auto_effect(chain, "dither", 0, NULL, &signal, &guard);
+
+ /* Add user specified effects from `dither' onwards */
+ for (; i < nuser_effects[current_eff_chain]; i++, guard = 2) {
+ if (add_effect(chain, user_efftab[i], &signal, &ofile->ft->signal,
+ &guard) != SOX_SUCCESS)
+ exit(2); /* Effects chain should have displayed an error message */
+ free(user_efftab[i]);
+ }
+
+ if (!save_output_eff)
+ {
+ /* Last `effect' in the chain is the output file */
+ effp = sox_create_effect(output_effect_fn());
+ if (sox_add_effect(chain, effp, &signal, &ofile->ft->signal) != SOX_SUCCESS)
+ exit(2);
+ free(effp);
+ }
+ else
+ {
+ sox_push_effect_last(chain, save_output_eff);
+ save_output_eff = NULL;
+ }
+
+ for (i = 0; i < chain->length; ++i) {
+ char const * format = sox_globals.verbosity > 3?
+ "effects chain: %-10s %7gHz %2u channels %7s %2u bits %s" :
+ "effects chain: %-10s %7gHz %2u channels";
+ sox_effect_t const * effp = &chain->effects[i][0];
+ lsx_report(format, effp->handler.name, effp->out_signal.rate,
+ effp->out_signal.channels,
+ (effp->handler.flags & SOX_EFF_MCHAN)? "(multi)" : "",
+ effp->out_signal.precision,
+ effp->out_signal.length != SOX_UNKNOWN_LEN ?
+ str_time(effp->out_signal.length/effp->out_signal.channels/effp->out_signal.rate) :
+ "unknown length"
+ );
+ }
+}
+
+static int advance_eff_chain(void)
+{
+ sox_bool reuse_output = sox_true;
+
+ very_first_effchain = sox_false;
+
+ /* If input file reached EOF then delete all effects in current
+ * chain and restart the current chain.
+ *
+ * This is only used with sox_sequence combine mode even though
+ * we do not specifically check for that method.
+ */
+ if (input_eof)
+ sox_delete_effects(effects_chain);
+ else
+ {
+ /* If user requested to restart this effect chain then
+ * do not advance to next. Usually, this is because
+ * an option to current effect was changed.
+ */
+ if (user_restart_eff)
+ user_restart_eff = sox_false;
+ /* Effect chain stopped so advance to next effect chain but
+ * quite if no more chains exist.
+ */
+ else if (++current_eff_chain >= eff_chain_count)
+ return SOX_EOF;
+
+ while (nuser_effects[current_eff_chain] == 1 &&
+ is_pseudo_effect(user_effargs[current_eff_chain][0].name))
+ {
+ if (strcmp("newfile", user_effargs[current_eff_chain][0].name) == 0)
+ {
+ if (++current_eff_chain >= eff_chain_count)
+ return SOX_EOF;
+ reuse_output = sox_false;
+ }
+ else if (strcmp("restart", user_effargs[current_eff_chain][0].name) == 0)
+ current_eff_chain = 0;
+ }
+
+ if (reuse_output)
+ save_output_eff = sox_pop_effect_last(effects_chain);
+
+ while (effects_chain->length > 1)
+ sox_delete_effect_last(effects_chain);
+ }
+ return SOX_SUCCESS;
+} /* advance_eff_chain */
+
+static uint64_t total_clips(void)
+{
+ size_t i;
+ uint64_t clips = 0;
+ for (i = 0; i < file_count; ++i)
+ clips += files[i]->ft->clips + files[i]->volume_clips;
+ return clips + mixing_clips + sox_effects_clips(effects_chain);
+}
+
+static sox_bool since(struct timeval * then, double secs, sox_bool always_reset)
+{
+ sox_bool ret;
+ struct timeval now;
+ time_t d;
+ gettimeofday(&now, NULL);
+ d = now.tv_sec - then->tv_sec;
+ ret = d > ceil(secs) || now.tv_usec - then->tv_usec + d * TIME_FRAC >= secs * TIME_FRAC;
+ if (ret || always_reset)
+ *then = now;
+ return ret;
+}
+
+#define MIN_HEADROOM 6.
+static double min_headroom = MIN_HEADROOM;
+
+static char const * vu(unsigned channel)
+{
+ static struct timeval then;
+ static char const * const text[][2] = {
+ /* White: 2dB steps */
+ {"", ""}, {"-", "-"}, {"=", "="}, {"-=", "=-"},
+ {"==", "=="}, {"-==", "==-"}, {"===", "==="}, {"-===", "===-"},
+ {"====", "===="}, {"-====", "====-"}, {"=====", "====="},
+ {"-=====", "=====-"}, {"======", "======"},
+ /* Red: 1dB steps */
+ {"!=====", "=====!"},
+ };
+ int const red = 1, white = array_length(text) - red;
+ double const MAX = SOX_SAMPLE_MAX, MIN = SOX_SAMPLE_MIN;
+ double linear = max(omax[channel] / MAX, omin[channel] / MIN);
+ double dB = linear_to_dB(linear);
+ int vu_dB = linear? floor(2 * white + red + dB) : 0;
+ int index = vu_dB < 2 * white? max(vu_dB / 2, 0) : min(vu_dB - white, red + white - 1);
+ omax[channel] = omin[channel] = 0;
+ if (-dB < min_headroom) {
+ gettimeofday(&then, NULL);
+ min_headroom = -dB;
+ }
+ else if (since(&then, 3., sox_false))
+ min_headroom = -dB;
+
+ return text[index][channel];
+}
+
+static char * headroom(void)
+{
+ if (min_headroom < MIN_HEADROOM) {
+ static char buff[10];
+ unsigned h = (unsigned)(min_headroom * 10);
+ sprintf(buff, "Hd:%u.%u", h /10, h % 10);
+ return buff;
+ }
+ return " ";
+}
+
+static void display_status(sox_bool all_done)
+{
+ static struct timeval then;
+ if (!show_progress)
+ return;
+ if (all_done || since(&then, .1, sox_false)) {
+ double read_time = (double)read_wide_samples / combiner_signal.rate;
+ double left_time = 0, in_time = 0, percentage = 0;
+
+ if (input_wide_samples) {
+ in_time = (double)input_wide_samples / combiner_signal.rate;
+ left_time = max(in_time - read_time, 0);
+ percentage = max(100. * read_wide_samples / input_wide_samples, 0);
+ }
+ fprintf(stderr, "\rIn:%-5s %s [%s] Out:%-5s [%6s|%-6s] %s Clip:%-5s",
+ lsx_sigfigs3p(percentage), str_time(read_time), str_time(left_time),
+ lsx_sigfigs3((double)output_samples),
+ vu(0), vu(1), headroom(), lsx_sigfigs3((double)total_clips()));
+ }
+ if (all_done)
+ fputc('\n', stderr);
+}
+
+#ifdef HAVE_TERMIOS_H
+static int kbhit(void)
+{
+ struct timeval time_val = {0, 0};
+ fd_set fdset;
+
+ FD_ZERO(&fdset);
+ FD_SET(fileno(stdin), &fdset);
+ select(fileno(stdin) + 1, &fdset, NULL, NULL, &time_val);
+ return FD_ISSET(fileno(stdin), &fdset);
+}
+#elif !defined(HAVE_CONIO_H)
+#define kbhit() 0
+#endif
+
+#ifdef HAVE_SOUNDCARD_H
+#include <sys/ioctl.h>
+static void adjust_volume(int delta)
+{
+ char * from_env = getenv("MIXERDEV");
+ int vol1 = 0, vol2 = 0, fd = open(from_env? from_env : "/dev/mixer", O_RDWR);
+ if (fd >= 0) {
+ if (ioctl(fd, MIXER_READ(SOUND_MIXER_PCM), &vol1) != -1) {
+ int side1 = vol1 & 0xff, side2 = (vol1 >> 8) & 0xff;
+ delta = delta < 0? max(delta, -min(side1, side2)) :
+ min(delta, 100 - max(side1, side2));
+ vol2 = ((side2 + delta) << 8) + side1 + delta;
+ lsx_debug("%04x %04x", vol1, vol2);
+ if (vol1 != vol2 && ioctl(fd, MIXER_WRITE(SOUND_MIXER_PCM), &vol2) < 0)
+ vol2 = vol1;
+ }
+ close(fd);
+ }
+ if (vol1 == vol2)
+ putc('\a', stderr);
+}
+#elif defined(HAVE_AUDIOIO_H)
+static void adjust_volume(int delta)
+{
+ int vol1 = 0, vol2 = 0, fd = fileno((FILE*)ofile->ft->fp);
+ if (fd >= 0) {
+ audio_info_t audio_info;
+ if (ioctl(fd, AUDIO_GETINFO, &audio_info) >= 0) {
+ vol1 = (audio_info.play.gain * 100 + (AUDIO_MAX_GAIN >> 1)) / AUDIO_MAX_GAIN;
+ vol2 = range_limit(vol1 + delta, 0, 100);
+ AUDIO_INITINFO(&audio_info);
+ audio_info.play.gain = (vol2 * AUDIO_MAX_GAIN + 50) / 100;
+ audio_info.output_muted = 0;
+ lsx_debug("%04x %04x", vol1, vol2);
+ if (vol1 != vol2 && ioctl(fd, AUDIO_SETINFO, &audio_info) < 0)
+ vol2 = vol1;
+ }
+ }
+ if (vol1 == vol2)
+ putc('\a', stderr);
+}
+#else
+static void adjust_volume(int delta)
+{
+ (void)delta;
+ putc('\a', stderr);
+}
+#endif
+
+static int update_status(sox_bool all_done, void * client_data)
+{
+ (void)client_data;
+ if (interactive) while (kbhit()) {
+#ifdef HAVE_CONIO_H
+ int ch = _getch();
+#else
+ int ch = getchar();
+#endif
+
+#ifdef MORE_INTERACTIVE
+ if (files[current_input]->ft->handler.seek &&
+ files[current_input]->ft->seekable)
+ {
+ if (ch == '>')
+ {
+ uint64_t jump = files[current_input]->ft->signal.rate*30; /* 30 sec. */
+ if (input_wide_samples == 0 ||
+ read_wide_samples+jump < input_wide_samples) {
+ read_wide_samples += jump;
+ sox_seek(files[current_input]->ft, read_wide_samples,
+ SOX_SEEK_SET);
+ /* FIXME: Do something if seek fails. */
+ }
+ }
+ if (ch == '<')
+ {
+ uint64_t jump = files[current_input]->ft->signal.rate*30; /* 30 sec. */
+ read_wide_samples = jump < read_wide_samples ?
+ read_wide_samples-jump : 0;
+ sox_seek(files[current_input]->ft, read_wide_samples,
+ SOX_SEEK_SET);
+ /* FIXME: Do something if seek fails. */
+ }
+ }
+ if (ch == 'R')
+ {
+ /* Not very useful, eh! Sample though of the place you
+ * could change the value to effects options
+ * like vol or speed or remix.
+ * Modify values in user_effargs[current_eff_chain][xxx]
+ * and then chain will be drain()ed and restarted whence
+ * this function is existed.
+ */
+ user_restart_eff = sox_true;
+ }
+#endif
+ switch (ch) {
+ case 'V': adjust_volume(+7); break;
+ case 'v': adjust_volume(-7); break;
+ }
+ }
+
+ display_status(all_done || user_abort);
+ return (user_abort || user_restart_eff) ? SOX_EOF : SOX_SUCCESS;
+}
+
+static void optimize_trim(void)
+{
+ /* Speed hack. If the "trim" effect is the first effect then peek inside its
+ * "effect descriptor" and see what the start location is. This has to be
+ * done after its start() is called to have the correct location. Also, only
+ * do this when only working with one input file. This is because the logic
+ * to do it for multiple files is complex and probably never used. The same
+ * is true for a restarted or additional effects chain (relative positioning
+ * within the file and possible samples still buffered in the input effect
+ * would have to be taken into account). This hack is a huge time savings
+ * when trimming gigs of audio data into managable chunks. */
+ if (input_count == 1 && very_first_effchain && effects_chain->length > 1 &&
+ strcmp(effects_chain->effects[1][0].handler.name, "trim") == 0) {
+ if (files[0]->ft->handler.seek && files[0]->ft->seekable){
+ uint64_t offset = sox_trim_get_start(&effects_chain->effects[1][0]);
+ if (offset && sox_seek(files[0]->ft, offset, SOX_SEEK_SET) == SOX_SUCCESS) {
+ read_wide_samples = offset / files[0]->ft->signal.channels;
+ /* Assuming a failed seek stayed where it was. If the seek worked then
+ * reset the start location of trim so that it thinks user didn't
+ * request a skip. */
+ sox_trim_clear_start(&effects_chain->effects[1][0]);
+ lsx_debug("optimize_trim successful");
+ }
+ }
+ }
+}
+
+static sox_bool overwrite_permitted(char const * filename)
+{
+ char c;
+
+ if (!no_clobber) {
+ lsx_report("Overwriting `%s'", filename);
+ return sox_true;
+ }
+ lsx_warn("Output file `%s' already exists", filename);
+ if (!stdin_is_a_tty)
+ return sox_false;
+ do fprintf(stderr, "%s sox: overwrite `%s' (y/n)? ", myname, filename);
+ while (scanf(" %c%*[^\n]", &c) != 1 || !strchr("yYnN", c));
+ return c == 'y' || c == 'Y';
+}
+
+static char *fndup_with_count(const char *filename, size_t count)
+{
+ char *expand_fn, *efn;
+ const char *fn, *ext, *end;
+ sox_bool found_marker = sox_false;
+
+ fn = filename;
+
+ efn = expand_fn = lsx_malloc((size_t)FILENAME_MAX);
+
+ /* Find extension in case user didn't specify a substitution
+ * marker.
+ */
+ end = ext = filename + strlen(filename);
+ while (ext > filename && *ext != '.')
+ ext--;
+
+ /* In case extension not found, point back to end of string to do less
+ * copying later.
+ */
+ if (*ext != '.')
+ ext = end;
+
+ while (fn < end)
+ {
+ /* Look for %n. If found, replace with count. Can specify an
+ * option width of 1-9.
+ */
+ if (*fn == '%')
+ {
+ char width = 0;
+ fn++;
+ if (*fn >= '1' && *fn <= '9')
+ {
+ width = *fn++;
+ }
+ if (*fn == 'n')
+ {
+ char format[5];
+
+ found_marker = sox_true;
+
+ if (width)
+ {
+ sprintf(format, "%%0%cd", width);
+ }
+ else
+ {
+ strcpy(format, "%02d");
+ }
+
+ efn += sprintf(efn, format, count);
+ fn++;
+ }
+ else
+ *efn++ = *fn++;
+ }
+ else
+ *efn++ = *fn++;
+ }
+
+ *efn = 0;
+
+ /* If user didn't tell us what to do then default to putting
+ * the count right before file extension.
+ */
+ if (!found_marker)
+ {
+ efn -= strlen (ext);
+
+ sprintf(efn, "%03lu", (unsigned long)count);
+ efn = efn + 3;
+ strcat(efn, ext);
+ }
+
+ return expand_fn;
+}
+
+static void open_output_file(void)
+{
+ double factor;
+ int i;
+ sox_comments_t p = ofile->oob.comments;
+ sox_oob_t oob = files[0]->ft->oob;
+ char *expand_fn;
+
+ /* Skip opening file if we are not recreating output effect */
+ if (save_output_eff)
+ return;
+
+ oob.comments = sox_copy_comments(files[0]->ft->oob.comments);
+
+ if (!oob.comments && !p)
+ sox_append_comment(&oob.comments, "Processed by SoX");
+ else if (p) {
+ if (!(*p)[0]) {
+ sox_delete_comments(&oob.comments);
+ ++p;
+ }
+ while (*p)
+ sox_append_comment(&oob.comments, *p++);
+ }
+
+ /* Copy loop info, resizing appropriately it's in samples, so # channels
+ * don't matter FIXME: This doesn't work for multi-file processing or effects
+ * that change file length. */
+ factor = (double) ofile->signal.rate / combiner_signal.rate;
+ for (i = 0; i < SOX_MAX_NLOOPS; i++) {
+ double scaled_start = oob.loops[i].start * factor;
+ double scaled_length = oob.loops[i].length * factor;
+ oob.loops[i].start = scaled_start > UINT_MAX ? UINT_MAX : scaled_start;
+ oob.loops[i].length = scaled_length > UINT_MAX ? UINT_MAX : scaled_length;
+ }
+
+ if (output_method == sox_multiple)
+ expand_fn = fndup_with_count(ofile->filename, ++output_count);
+ else
+ expand_fn = lsx_strdup(ofile->filename);
+ ofile->ft = sox_open_write(expand_fn, &ofile->signal, &ofile->encoding,
+ ofile->filetype, &oob, overwrite_permitted);
+ sox_delete_comments(&oob.comments);
+ free(expand_fn);
+
+ if (!ofile->ft)
+ /* sox_open_write() will call lsx_warn for most errors.
+ * Rely on that printing something. */
+ exit(2);
+
+ /* If whether to enable the progress display (similar to that of ogg123) has
+ * not been specified by the user, auto turn on when outputting to an audio
+ * device: */
+ if (show_progress == sox_option_default)
+ show_progress = (ofile->ft->handler.flags & SOX_FILE_DEVICE) != 0 &&
+ (ofile->ft->handler.flags & SOX_FILE_PHONY) == 0;
+
+ report_file_info(ofile);
+}
+
+static void sigint(int s)
+{
+ static struct timeval then;
+ if (input_count > 1 && show_progress && s == SIGINT &&
+ is_serial(combine_method) && since(&then, 1.0, sox_true))
+ {
+ signal(SIGINT, sigint);
+ user_skip = sox_true;
+ }
+ else user_abort = sox_true;
+}
+
+static void calculate_combiner_signal_parameters(void)
+{
+ size_t i;
+
+ /* If user didn't specify # of channels then see if an effect
+ * is specifying them. This is of most use currently with the
+ * synth effect were user can use null input handler and specify
+ * channel counts directly in effect. Forcing to use -c with
+ * -n isn't as convenient.
+ */
+ for (i = 0; i < input_count; i++) {
+ size_t j;
+ for (j =0; j < nuser_effects[current_eff_chain] &&
+ !files[i]->ft->signal.channels; ++j)
+ files[i]->ft->signal.channels = user_efftab[j]->in_signal.channels;
+ /* For historical reasons, default to one channel if not specified. */
+ if (!files[i]->ft->signal.channels)
+ files[i]->ft->signal.channels = 1;
+ }
+
+ /* Set the combiner output signal attributes to those of the 1st/next input
+ * file. If we are in sox_sequence mode then we don't need to check the
+ * attributes of the other inputs, otherwise, it is mandatory that all input
+ * files have the same sample rate, and for sox_concatenate, it is mandatory
+ * that they have the same number of channels, otherwise, the number of
+ * channels at the output of the combiner is calculated according to the
+ * combiner mode. */
+ combiner_signal = files[current_input]->ft->signal;
+ if (combine_method == sox_sequence) {
+ /* Report all input files; do this only the 1st time process() is called: */
+ if (!current_input) for (i = 0; i < input_count; i++)
+ report_file_info(files[i]);
+ combiner_signal.length = SOX_UNKNOWN_LEN;
+ } else {
+ size_t total_channels = 0;
+ size_t min_channels = SOX_SIZE_MAX;
+ size_t max_channels = 0;
+ size_t min_rate = SOX_SIZE_MAX;
+ size_t max_rate = 0;
+ uint64_t total_length = 0, max_length_ws = 0;
+
+ /* Report all input files and gather info on differing rates & numbers of
+ * channels, and on the resulting output audio length: */
+ for (i = 0; i < input_count; i++) {
+ report_file_info(files[i]);
+ total_channels += files[i]->ft->signal.channels;
+ min_channels = min(min_channels, files[i]->ft->signal.channels);
+ max_channels = max(max_channels, files[i]->ft->signal.channels);
+ min_rate = min(min_rate , files[i]->ft->signal.rate);
+ max_rate = max(max_rate , files[i]->ft->signal.rate);
+ max_length_ws = files[i]->ft->signal.length ?
+ max(max_length_ws, files[i]->ft->signal.length / files[i]->ft->signal.channels) :
+ SOX_UNKNOWN_LEN;
+ if (total_length != SOX_UNKNOWN_LEN && files[i]->ft->signal.length)
+ total_length += files[i]->ft->signal.length;
+ else
+ total_length = SOX_UNKNOWN_LEN;
+ }
+
+ /* Check for invalid/unusual rate or channel combinations: */
+ if (min_rate != max_rate)
+ lsx_fail("Input files must have the same sample-rate");
+ /* Don't exit quite yet; give the user any other message 1st */
+ if (min_channels != max_channels) {
+ if (combine_method == sox_concatenate) {
+ lsx_fail("Input files must have the same # channels");
+ exit(1);
+ } else if (combine_method != sox_merge)
+ lsx_warn("Input files don't have the same # channels");
+ }
+ if (min_rate != max_rate)
+ exit(1);
+
+ /* Store the calculated # of combined channels: */
+ combiner_signal.channels =
+ combine_method == sox_merge? total_channels : max_channels;
+
+ if (combine_method == sox_concatenate)
+ combiner_signal.length = total_length;
+ else if (is_parallel(combine_method))
+ combiner_signal.length = max_length_ws != SOX_UNKNOWN_LEN ?
+ max_length_ws * combiner_signal.channels : SOX_UNKNOWN_LEN;
+ }
+} /* calculate_combiner_signal_parameters */
+
+static void calculate_output_signal_parameters(void)
+{
+ sox_bool known_length = combine_method != sox_sequence;
+ size_t i;
+ uint64_t olen = 0;
+
+ /* Report all input files and gather info on differing rates & numbers of
+ * channels, and on the resulting output audio length: */
+ for (i = 0; i < input_count; i++) {
+ known_length = known_length && files[i]->ft->signal.length != SOX_UNSPEC;
+ if (combine_method == sox_concatenate)
+ olen += files[i]->ft->signal.length / files[i]->ft->signal.channels;
+ else
+ olen = max(olen, files[i]->ft->signal.length / files[i]->ft->signal.channels);
+ }
+
+ /* Determine the output file signal attributes; set from user options
+ * if given: */
+ ofile->signal = ofile_signal_options;
+
+ /* If no user option for output rate or # of channels, set from the last
+ * effect that sets these, or from the input combiner if there is none such */
+ for (i = 0; i < nuser_effects[current_eff_chain] && !ofile->signal.rate; ++i)
+ ofile->signal.rate = user_efftab[nuser_effects[current_eff_chain] - 1 - i]->out_signal.rate;
+ for (i = 0; i < nuser_effects[current_eff_chain] && !ofile->signal.channels; ++i)
+ ofile->signal.channels = user_efftab[nuser_effects[current_eff_chain] - 1 - i]->out_signal.channels;
+ if (!ofile->signal.rate)
+ ofile->signal.rate = combiner_signal.rate;
+ if (!ofile->signal.channels)
+ ofile->signal.channels = combiner_signal.channels;
+
+ /* FIXME: comment this: */
+ ofile->signal.precision = combiner_signal.precision;
+
+ /* If any given user effect modifies the audio length, then we assume that
+ * we don't know what the output length will be. FIXME: in most cases,
+ * an effect that modifies length will be able to determine by how much from
+ * its getopts parameters, so olen should be calculable. */
+ for (i = 0; i < nuser_effects[current_eff_chain]; i++)
+ known_length = known_length && !(user_efftab[i]->handler.flags & SOX_EFF_LENGTH);
+
+ if (!known_length)
+ olen = 0;
+ ofile->signal.length = (uint64_t)(olen * ofile->signal.channels * ofile->signal.rate / combiner_signal.rate + .5);
+}
+
+static void set_combiner_and_output_encoding_parameters(void)
+{
+ /* The input encoding parameters passed to the effects chain are those of
+ * the first input file (for each segued block if sox_sequence):*/
+ combiner_encoding = files[current_input]->ft->encoding;
+
+ /* Determine the output file encoding attributes; set from user options
+ * if given: */
+ ofile->encoding = ofile_encoding_options;
+
+ /* Get unspecified output file encoding attributes from the input file and
+ * set the output file to the resultant encoding if this is supported by the
+ * output file type; if not, the output file handler should select an
+ * encoding suitable for the output signal and its precision. */
+ {
+ sox_encodinginfo_t t = ofile->encoding;
+ if (!t.encoding)
+ t.encoding = combiner_encoding.encoding;
+ if (!t.bits_per_sample)
+ t.bits_per_sample = combiner_encoding.bits_per_sample;
+ if (sox_format_supports_encoding(ofile->filename, ofile->filetype, &t))
+ ofile->encoding = t;
+ }
+}
+
+static int process(void)
+{ /* Input(s) -> Balancing -> Combiner -> Effects -> Output */
+ int flow_status;
+
+ create_user_effects();
+
+ calculate_combiner_signal_parameters();
+ set_combiner_and_output_encoding_parameters();
+ calculate_output_signal_parameters();
+ open_output_file();
+
+ if (!effects_chain)
+ effects_chain = sox_create_effects_chain(&combiner_encoding,
+ &ofile->ft->encoding);
+ add_effects(effects_chain);
+
+ if (very_first_effchain)
+ optimize_trim();
+
+#if defined(HAVE_TERMIOS_H) || defined(HAVE_CONIO_H)
+ if (stdin_is_a_tty) {
+ if (show_progress && is_player && !interactive) {
+ lsx_debug("automatically entering interactive mode");
+ interactive = sox_true;
+ }
+ } else if (interactive) {
+ /* User called for interactive mode, but ... */
+ lsx_warn("Standard input has to be a terminal for interactive mode");
+ interactive = sox_false;
+ }
+#endif
+#ifdef HAVE_TERMIOS_H
+ /* Prepare terminal for interactive mode and save the original termios
+ settings. Do this only once, otherwise the "original" settings won't
+ be original anymore after a second call to process() (next/restarted
+ effects chain). */
+ if (interactive && !original_termios_saved) {
+ struct termios modified_termios;
+
+ original_termios_saved = sox_true;
+ tcgetattr(fileno(stdin), &original_termios);
+ modified_termios = original_termios;
+ modified_termios.c_lflag &= ~(ICANON | ECHO);
+ modified_termios.c_cc[VMIN] = modified_termios.c_cc[VTIME] = 0;
+ tcsetattr(fileno(stdin), TCSANOW, &modified_termios);
+ }
+#endif
+
+ signal(SIGTERM, sigint); /* Stop gracefully, as soon as we possibly can. */
+ signal(SIGINT , sigint); /* Either skip current input or behave as SIGTERM. */
+ if (very_first_effchain) {
+ struct timeval now;
+ double d;
+ gettimeofday(&now, NULL);
+ d = now.tv_sec - load_timeofday.tv_sec + (now.tv_usec - load_timeofday.tv_usec) / TIME_FRAC;
+ lsx_debug("start-up time = %g", d);
+ }
+ flow_status = sox_flow_effects(effects_chain, update_status, NULL);
+
+ /* Don't return SOX_EOF if
+ * 1) input reach EOF and there are more input files to process or
+ * 2) output didn't return EOF (disk full?) there are more
+ * effect chains.
+ * For case #2, something else must decide when to stop processing.
+ */
+ if ((input_eof && current_input < input_count) ||
+ (!output_eof && current_eff_chain < eff_chain_count))
+ flow_status = SOX_SUCCESS;
+
+ return flow_status;
+}
+
+static void display_SoX_version(FILE * file)
+{
+#if HAVE_SYS_UTSNAME_H
+ struct utsname uts;
+#endif
+ const sox_version_info_t* info = sox_version_info();
+
+ fprintf(file, "%s: SoX v%s%s%s\n",
+ myname,
+ info->version,
+ info->version_extra ? "-" : "",
+ info->version_extra ? info->version_extra : "");
+
+ if (sox_globals.verbosity > 3) {
+ if (info->time)
+ fprintf(file, "time: %s\n", info->time);
+ if (info->distro)
+ fprintf(file, "issue: %s\n", info->distro);
+#if HAVE_SYS_UTSNAME_H
+ if (!uname(&uts))
+ fprintf(file, "uname: %s %s %s %s %s\n", uts.sysname, uts.nodename,
+ uts.release, uts.version, uts.machine);
+#endif
+ if (info->compiler)
+ fprintf(file, "compiler: %s\n", info->compiler);
+ if (info->arch)
+ fprintf(file, "arch: %s\n", info->arch);
+ }
+}
+
+static int strcmp_p(const void *p1, const void *p2)
+{
+ return strcmp(*(const char **)p1, *(const char **)p2);
+}
+
+static void display_supported_formats(void)
+{
+ size_t i, formats;
+ char const * * format_list;
+ char const * const * names;
+
+ sox_format_init();
+ for (i = formats = 0; sox_format_fns[i].fn; ++i) {
+ char const * const *names = sox_format_fns[i].fn()->names;
+ while (*names++)
+ formats++;
+ }
+ format_list = lsx_malloc(formats * sizeof(*format_list));
+
+ printf("AUDIO FILE FORMATS:");
+ for (i = formats = 0; sox_format_fns[i].fn; ++i) {
+ sox_format_handler_t const * handler = sox_format_fns[i].fn();
+ if (!(handler->flags & SOX_FILE_DEVICE))
+ for (names = handler->names; *names; ++names)
+ if (!strchr(*names, '/'))
+ format_list[formats++] = *names;
+ }
+ qsort((void*)format_list, formats, sizeof(*format_list), strcmp_p);
+ for (i = 0; i < formats; i++)
+ printf(" %s", format_list[i]);
+ putchar('\n');
+
+ printf("PLAYLIST FORMATS: m3u pls\nAUDIO DEVICE DRIVERS:");
+ for (i = formats = 0; sox_format_fns[i].fn; ++i) {
+ sox_format_handler_t const * handler = sox_format_fns[i].fn();
+ if ((handler->flags & SOX_FILE_DEVICE) && !(handler->flags & SOX_FILE_PHONY))
+ for (names = handler->names; *names; ++names)
+ format_list[formats++] = *names;
+ }
+ qsort((void*)format_list, formats, sizeof(*format_list), strcmp_p);
+ for (i = 0; i < formats; i++)
+ printf(" %s", format_list[i]);
+ puts("\n");
+
+ free((void*)format_list);
+}
+
+static void display_supported_effects(void)
+{
+ size_t i;
+ const sox_effect_handler_t *e;
+
+ printf("EFFECTS:");
+ for (i = 0; sox_effect_fns[i]; i++) {
+ e = sox_effect_fns[i]();
+ if (e && e->name)
+ printf(" %s%s", e->name, (e->flags & SOX_EFF_DEPRECATED)? "*" : (e->flags & SOX_EFF_ALPHA)? "+" : (e->flags & SOX_EFF_INTERNAL)? "#" : "");
+ }
+ puts("\n * Deprecated effect + Experimental effect # LibSoX-only effect");
+}
+
+static void usage(char const * message)
+{
+ const sox_version_info_t * info = sox_version_info();
+ size_t i;
+ static char const * const lines1[] = {
+"SPECIAL FILENAMES (infile, outfile):",
+"- Pipe/redirect input/output (stdin/stdout); may need -t",
+"-d, --default-device Use the default audio device (where available)",
+"-n, --null Use the `null' file handler; e.g. with synth effect",
+"-p, --sox-pipe Alias for `-t sox -'"
+ };
+ static char const * const linesPopen[] = {
+"\nSPECIAL FILENAMES (infile only):",
+"\"|program [options] ...\" Pipe input from external program (where supported)",
+"http://server/file Use the given URL as input file (where supported)"
+ };
+ static char const * const lines2[] = {
+"",
+"GLOBAL OPTIONS (gopts) (can be specified at any point before the first effect):",
+"--buffer BYTES Set the size of all processing buffers (default 8192)",
+"--clobber Don't prompt to overwrite output file (default)",
+"--combine concatenate Concatenate all input files (default for sox, rec)",
+"--combine sequence Sequence all input files (default for play)",
+"-D, --no-dither Don't dither automatically",
+"--dft-min NUM Minimum size (log2) for DFT processing (default 10)",
+"--effects-file FILENAME File containing effects and options",
+"-G, --guard Use temporary files to guard against clipping",
+"-h, --help Display version number and usage information",
+"--help-effect NAME Show usage of effect NAME, or NAME=all for all",
+"--help-format NAME Show info on format NAME, or NAME=all for all",
+"--i, --info Behave as soxi(1)",
+"--input-buffer BYTES Override the input buffer size (default: as --buffer)",
+"--no-clobber Prompt to overwrite output file",
+"-m, --combine mix Mix multiple input files (instead of concatenating)",
+"--combine mix-power Mix to equal power (instead of concatenating)",
+"-M, --combine merge Merge multiple input files (instead of concatenating)"
+ };
+ static char const * const linesMagic[] = {
+"--magic Use `magic' file-type detection"
+ };
+ static char const * const linesThreads[] = {
+"--multi-threaded Enable parallel effects channels processing"
+ };
+ static char const * const lines3[] = {
+"--norm Guard (see --guard) & normalise",
+"--play-rate-arg ARG Default `rate' argument for auto-resample with `play'",
+"--plot gnuplot|octave Generate script to plot response of filter effect",
+"-q, --no-show-progress Run in quiet mode; opposite of -S",
+"--replay-gain track|album|off Default: off (sox, rec), track (play)",
+"-R Use default random numbers (same on each run of SoX)",
+"-S, --show-progress Display progress while processing audio data",
+"--single-threaded Disable parallel effects channels processing",
+"--temp DIRECTORY Specify the directory to use for temporary files",
+"-T, --combine multiply Multiply samples of corresponding channels from all",
+" input files (instead of concatenating)",
+"--version Display version number of SoX and exit",
+"-V[LEVEL] Increment or set verbosity level (default 2); levels:",
+" 1: failure messages",
+" 2: warnings",
+" 3: details of processing",
+" 4-6: increasing levels of debug messages",
+"FORMAT OPTIONS (fopts):",
+"Input file format options need only be supplied for files that are headerless.",
+"Output files will have the same format as the input file where possible and not",
+"overridden by any of various means including providing output format options.",
+"",
+"-v|--volume FACTOR Input file volume adjustment factor (real number)",
+"--ignore-length Ignore input file length given in header; read to EOF",
+"-t|--type FILETYPE File type of audio",
+"-e|--encoding ENCODING Set encoding (ENCODING may be one of signed-integer,",
+" unsigned-integer, floating-point, mu-law, a-law,",
+" ima-adpcm, ms-adpcm, gsm-full-rate)",
+"-b|--bits BITS Encoded sample size in bits",
+"-N|--reverse-nibbles Encoded nibble-order",
+"-X|--reverse-bits Encoded bit-order",
+"--endian little|big|swap Encoded byte-order; swap means opposite to default",
+"-L/-B/-x Short options for the above",
+"-c|--channels CHANNELS Number of channels of audio data; e.g. 2 = stereo",
+"-r|--rate RATE Sample rate of audio",
+"-C|--compression FACTOR Compression factor for output format",
+"--add-comment TEXT Append output file comment",
+"--comment TEXT Specify comment text for the output file",
+"--comment-file FILENAME File containing comment text for the output file",
+#if HAVE_GLOB_H
+"--no-glob Don't `glob' wildcard match the following filename",
+#endif
+""};
+
+ if (!(sox_globals.verbosity > 2)) {
+ display_SoX_version(stdout);
+ putchar('\n');
+ }
+
+ if (message)
+ lsx_fail("%s\n", message); /* N.B. stderr */
+
+ printf("Usage summary: [gopts] [[fopts] infile]... [fopts]%s [effect [effopt]]...\n\n",
+ sox_mode == sox_play? "" : " outfile");
+ for (i = 0; i < array_length(lines1); ++i)
+ puts(lines1[i]);
+ if (info->flags & sox_version_have_popen)
+ for (i = 0; i < array_length(linesPopen); ++i)
+ puts(linesPopen[i]);
+ for (i = 0; i < array_length(lines2); ++i)
+ puts(lines2[i]);
+ if (info->flags & sox_version_have_magic)
+ for (i = 0; i < array_length(linesMagic); ++i)
+ puts(linesMagic[i]);
+ if (info->flags & sox_version_have_threads)
+ for (i = 0; i < array_length(linesThreads); ++i)
+ puts(linesThreads[i]);
+ for (i = 0; i < array_length(lines3); ++i)
+ puts(lines3[i]);
+ display_supported_formats();
+ display_supported_effects();
+ printf("EFFECT OPTIONS (effopts): effect dependent; see --help-effect\n");
+ exit(message != NULL);
+}
+
+static void usage_effect(char const * name)
+{
+ size_t i;
+
+ display_SoX_version(stdout);
+ putchar('\n');
+
+ if (strcmp("all", name) && !sox_find_effect(name)) {
+ printf("Cannot find an effect called `%s'.\n", name);
+ display_supported_effects();
+ }
+ else {
+ printf("Effect usage:\n\n");
+
+ for (i = 0; sox_effect_fns[i]; i++) {
+ const sox_effect_handler_t *e = sox_effect_fns[i]();
+ if (e && e->name && (!strcmp("all", name) || !strcmp(e->name, name))) {
+ printf("%s %s\n", e->name, e->usage? e->usage : "");
+ if (e->flags & (SOX_EFF_DEPRECATED | SOX_EFF_ALPHA | SOX_EFF_INTERNAL))
+ putchar('\n');
+ if (e->flags & SOX_EFF_DEPRECATED)
+ printf("`%s' is deprecated\n", e->name);
+ if (e->flags & SOX_EFF_ALPHA)
+ printf("`%s' is experimental/incomplete\n", e->name);
+ if (e->flags & SOX_EFF_INTERNAL)
+ printf("`%s' is libSoX-only\n", e->name);
+ printf("\n\n");
+ }
+ }
+ }
+ exit(1);
+}
+
+static void usage_format1(sox_format_handler_t const * f)
+{
+ char const * const * names;
+
+ printf("\nFormat: %s\n", f->names[0]);
+ printf("Description: %s\n", f->description);
+ if (f->names[1]) {
+ printf("Also handles:");
+ for (names = f->names + 1; *names; ++names)
+ printf(" %s", *names);
+ putchar('\n');
+ }
+ if (f->flags & SOX_FILE_CHANS) {
+ printf("Channels restricted to:");
+ if (f->flags & SOX_FILE_MONO) printf(" mono");
+ if (f->flags & SOX_FILE_STEREO) printf(" stereo");
+ if (f->flags & SOX_FILE_QUAD) printf(" quad");
+ putchar('\n');
+ }
+ if (f->write_rates) {
+ sox_rate_t const * p = f->write_rates;
+ printf("Sample-rate restricted to:");
+ while (*p)
+ printf(" %g", *p++);
+ putchar('\n');
+ }
+ printf("Reads: %s\n", f->startread || f->read? "yes" : "no");
+ if (f->startwrite || f->write) {
+ if (f->write_formats) {
+ sox_encoding_t e;
+ unsigned i, s;
+#define enc_arg(T) (T)f->write_formats[i++]
+ i = 0;
+ puts("Writes:");
+ while ((e = enc_arg(sox_encoding_t)))
+ do {
+ s = enc_arg(unsigned);
+ if (sox_precision(e, s)) {
+ printf(" ");
+ if (s)
+ printf("%2u-bit ", s);
+ printf("%s (%u-bit precision)\n", sox_encodings_info[e].desc, sox_precision(e, s));
+ }
+ } while (s);
+ }
+ else puts("Writes: yes");
+ }
+ else puts("Writes: no");
+}
+
+static void usage_format(char const * name)
+{
+ sox_format_handler_t const * f;
+ unsigned i;
+
+ display_SoX_version(stdout);
+
+ if (strcmp("all", name)) {
+ if (!(f = sox_find_format(name, sox_false))) {
+ printf("Cannot find a format called `%s'.\n", name);
+ display_supported_formats();
+ }
+ else usage_format1(f);
+ }
+ else {
+ for (i = 0; sox_format_fns[i].fn; ++i) {
+ sox_format_handler_t const * f = sox_format_fns[i].fn();
+ if (!(f->flags & SOX_FILE_PHONY))
+ usage_format1(f);
+ }
+ }
+ exit(1);
+}
+
+static void read_comment_file(sox_comments_t * comments, char const * const filename)
+{
+ int c;
+ size_t text_length = 100;
+ char * text = lsx_malloc(text_length + 1);
+ FILE * file = fopen(filename, "r");
+
+ if (file == NULL) {
+ lsx_fail("Cannot open comment file `%s'", filename);
+ exit(1);
+ }
+ do {
+ size_t i = 0;
+
+ while ((c = getc(file)) != EOF && !strchr("\r\n", c)) {
+ if (i == text_length)
+ text = lsx_realloc(text, (text_length <<= 1) + 1);
+ text[i++] = c;
+ }
+ if (ferror(file)) {
+ lsx_fail("Error reading comment file `%s'", filename);
+ exit(1);
+ }
+ if (i) {
+ text[i] = '\0';
+ sox_append_comment(comments, text);
+ }
+ } while (c != EOF);
+
+ fclose(file);
+ free(text);
+}
+
+static char const * const getoptstr =
+ "+b:c:de:hmnpqr:t:v:xBC:DGLMNRSTV::X";
+
+static struct lsx_option_t const long_options[] = {
+ {"add-comment" , lsx_option_arg_required, NULL, 0},
+ {"buffer" , lsx_option_arg_required, NULL, 0},
+ {"combine" , lsx_option_arg_required, NULL, 0},
+ {"comment-file" , lsx_option_arg_required, NULL, 0},
+ {"comment" , lsx_option_arg_required, NULL, 0},
+ {"endian" , lsx_option_arg_required, NULL, 0},
+ {"input-buffer" , lsx_option_arg_required, NULL, 0},
+ {"interactive" , lsx_option_arg_none , NULL, 0},
+ {"help-effect" , lsx_option_arg_required, NULL, 0},
+ {"help-format" , lsx_option_arg_required, NULL, 0},
+ {"no-glob" , lsx_option_arg_none , NULL, 0},
+ {"plot" , lsx_option_arg_required, NULL, 0},
+ {"replay-gain" , lsx_option_arg_required, NULL, 0},
+ {"version" , lsx_option_arg_none , NULL, 0},
+ {"output" , lsx_option_arg_required, NULL, 0},
+ {"effects-file" , lsx_option_arg_required, NULL, 0},
+ {"temp" , lsx_option_arg_required, NULL, 0},
+ {"single-threaded" , lsx_option_arg_none , NULL, 0},
+ {"ignore-length" , lsx_option_arg_none , NULL, 0},
+ {"norm" , lsx_option_arg_optional, NULL, 0},
+ {"magic" , lsx_option_arg_none , NULL, 0},
+ {"play-rate-arg" , lsx_option_arg_required, NULL, 0},
+ {"clobber" , lsx_option_arg_none , NULL, 0},
+ {"no-clobber" , lsx_option_arg_none , NULL, 0},
+ {"multi-threaded" , lsx_option_arg_none , NULL, 0},
+ {"dft-min" , lsx_option_arg_required, NULL, 0},
+
+ {"bits" , lsx_option_arg_required, NULL, 'b'},
+ {"channels" , lsx_option_arg_required, NULL, 'c'},
+ {"compression" , lsx_option_arg_required, NULL, 'C'},
+ {"default-device" , lsx_option_arg_none , NULL, 'd'},
+ {"no-dither" , lsx_option_arg_none , NULL, 'D'},
+ {"encoding" , lsx_option_arg_required, NULL, 'e'},
+ {"help" , lsx_option_arg_none , NULL, 'h'},
+ {"null" , lsx_option_arg_none , NULL, 'n'},
+ {"no-show-progress", lsx_option_arg_none , NULL, 'q'},
+ {"pipe" , lsx_option_arg_none , NULL, 'p'},
+ {"rate" , lsx_option_arg_required, NULL, 'r'},
+ {"reverse-bits" , lsx_option_arg_none , NULL, 'X'},
+ {"reverse-nibbles" , lsx_option_arg_none , NULL, 'N'},
+ {"show-progress" , lsx_option_arg_none , NULL, 'S'},
+ {"type" , lsx_option_arg_required, NULL, 't'},
+ {"volume" , lsx_option_arg_required, NULL, 'v'},
+ {"guard" , lsx_option_arg_none , NULL, 'G'},
+
+ {NULL, 0, NULL, 0}
+};
+
+static int opt_index(int val)
+{
+ int i;
+ for (i = 0; long_options[i].name; ++i)
+ if (long_options[i].val == val)
+ return i;
+ return -1;
+}
+
+static lsx_enum_item const combine_methods[] = {
+ LSX_ENUM_ITEM(sox_,sequence)
+ LSX_ENUM_ITEM(sox_,concatenate)
+ LSX_ENUM_ITEM(sox_,mix)
+ {"mix-power", sox_mix_power},
+ LSX_ENUM_ITEM(sox_,merge)
+ LSX_ENUM_ITEM(sox_,multiply)
+ {0, 0}};
+
+enum {ENDIAN_little, ENDIAN_big, ENDIAN_swap};
+static lsx_enum_item const endian_options[] = {
+ LSX_ENUM_ITEM(ENDIAN_,little)
+ LSX_ENUM_ITEM(ENDIAN_,big)
+ LSX_ENUM_ITEM(ENDIAN_,swap)
+ {0, 0}};
+
+static lsx_enum_item const plot_methods[] = {
+ LSX_ENUM_ITEM(sox_plot_,off)
+ LSX_ENUM_ITEM(sox_plot_,octave)
+ LSX_ENUM_ITEM(sox_plot_,gnuplot)
+ LSX_ENUM_ITEM(sox_plot_,data)
+ {0, 0}};
+
+enum {
+ encoding_signed_integer, encoding_unsigned_integer, encoding_floating_point,
+ encoding_ms_adpcm, encoding_ima_adpcm, encoding_oki_adpcm,
+ encoding_gsm_full_rate, encoding_u_law, encoding_a_law};
+
+static lsx_enum_item const encodings[] = {
+ {"signed-integer", encoding_signed_integer},
+ {"unsigned-integer", encoding_unsigned_integer},
+ {"floating-point", encoding_floating_point},
+ {"ms-adpcm", encoding_ms_adpcm},
+ {"ima-adpcm", encoding_ima_adpcm},
+ {"oki-adpcm", encoding_oki_adpcm},
+ {"gsm-full-rate", encoding_gsm_full_rate},
+ {"u-law", encoding_u_law},
+ {"mu-law", encoding_u_law},
+ {"a-law", encoding_a_law},
+ {0, 0}};
+
+static int enum_option(char const * arg, int option_index, lsx_enum_item const * items)
+{
+ lsx_enum_item const * p = lsx_find_enum_text(arg, items, 0);
+ if (p == NULL) {
+ size_t len = 1;
+ char * set = lsx_malloc(len);
+ *set = 0;
+ for (p = items; p->text; ++p) {
+ set = lsx_realloc(set, len += 2 + strlen(p->text));
+ strcat(set, ", "); strcat(set, p->text);
+ }
+ lsx_fail("--%s: `%s' is not one of: %s.",
+ long_options[option_index].name, arg, set + 2);
+ free(set);
+ exit(1);
+ }
+ return p->value;
+}
+
+static char parse_gopts_and_fopts(file_t * f)
+{
+ const sox_version_info_t* info = sox_version_info();
+ while (sox_true) {
+ int c;
+ int i; /* sscanf silently accepts negative numbers for %u :( */
+ char dummy; /* To check for extraneous chars in optarg. */
+
+ switch (c=lsx_getopt(&optstate)) {
+ case -1: /* @ one of: file-name, effect name, end of arg-list. */
+ return '\0'; /* i.e. not device. */
+
+ case 0: /* Long options with no short equivalent. */
+ switch (optstate.lngind) {
+ case 0:
+ if (optstate.arg)
+ sox_append_comment(&f->oob.comments, optstate.arg);
+ break;
+
+ case 1:
+#define SOX_BUFMIN 16
+ if (sscanf(optstate.arg, "%i %c", &i, &dummy) != 1 || i <= SOX_BUFMIN) {
+ lsx_fail("Buffer size `%s' must be > %d", optstate.arg, SOX_BUFMIN);
+ exit(1);
+ }
+ sox_globals.bufsiz = i;
+ break;
+
+ case 2:
+ combine_method = enum_option(optstate.arg, optstate.lngind, combine_methods);
+ break;
+
+ case 3:
+ sox_append_comment(&f->oob.comments, "");
+ read_comment_file(&f->oob.comments, optstate.arg);
+ break;
+
+ case 4:
+ sox_append_comment(&f->oob.comments, "");
+ if (*optstate.arg)
+ sox_append_comment(&f->oob.comments, optstate.arg);
+ break;
+
+ case 5:
+ if (f->encoding.reverse_bytes != sox_option_default || f->encoding.opposite_endian)
+ usage("only one endian option per file is allowed");
+ switch (enum_option(optstate.arg, optstate.lngind, endian_options)) {
+ case ENDIAN_little: f->encoding.reverse_bytes = MACHINE_IS_BIGENDIAN; break;
+ case ENDIAN_big: f->encoding.reverse_bytes = MACHINE_IS_LITTLEENDIAN; break;
+ case ENDIAN_swap: f->encoding.opposite_endian = sox_true; break;
+ }
+ break;
+
+ case 6:
+ if (sscanf(optstate.arg, "%i %c", &i, &dummy) != 1 || i <= SOX_BUFMIN) {
+ lsx_fail("Buffer size `%s' must be > %d", optstate.arg, SOX_BUFMIN);
+ exit(1);
+ }
+ sox_globals.input_bufsiz = i;
+ break;
+
+ case 7:
+#if defined(HAVE_TERMIOS_H) || defined(HAVE_CONIO_H)
+ interactive = sox_true; break;
+#else
+ lsx_fail("Interactive mode has not been enabled at compile time.");
+ exit(1); break;
+#endif
+ case 8: usage_effect(optstate.arg); break;
+ case 9: usage_format(optstate.arg); break;
+ case 10: f->no_glob = sox_true; break;
+ case 11:
+ sox_effects_globals.plot = enum_option(optstate.arg, optstate.lngind, plot_methods);
+ break;
+ case 12: replay_gain_mode = enum_option(optstate.arg, optstate.lngind, rg_modes); break;
+ case 13: display_SoX_version(stdout); exit(0); break;
+ case 14: break;
+ case 15: effects_filename = lsx_strdup(optstate.arg); break;
+ case 16: sox_globals.tmp_path = lsx_strdup(optstate.arg); break;
+ case 17: sox_globals.use_threads = sox_false; break;
+ case 18: f->signal.length = SOX_IGNORE_LENGTH; break;
+ case 19: do_guarded_norm = is_guarded = sox_true;
+ norm_level = lsx_strdup(optstate.arg);
+ break;
+ case 20:
+ if (info->flags & sox_version_have_magic)
+ sox_globals.use_magic = sox_true;
+ else
+ lsx_warn("this build of SoX does not include `magic'");
+ break;
+ case 21: play_rate_arg = lsx_strdup(optstate.arg); break;
+ case 22: no_clobber = sox_false; break;
+ case 23: no_clobber = sox_true; break;
+ case 24: sox_globals.use_threads = sox_true; break;
+ case 25:
+ if (sscanf(optstate.arg, "%i %c", &i, &dummy) != 1 || i < 8 || i > 16) {
+ lsx_fail("Min DFT size must be in range 8 to 16");
+ exit(1);
+ }
+ sox_globals.log2_dft_min_size = i;
+ break;
+ }
+ break;
+
+ case 'G': is_guarded = sox_true; break;
+ case 'm': combine_method = sox_mix; break;
+ case 'M': combine_method = sox_merge; break;
+ case 'T': combine_method = sox_multiply; break;
+
+ case 'R': /* Useful for regression testing. */
+ sox_globals.repeatable = sox_true;
+ break;
+
+ case 'd': case 'n': case 'p':
+ optstate.ind = optstate.ind;
+ return c;
+
+ case 'h':
+ usage(NULL);
+ break;
+
+ case '?':
+ usage("invalid option"); /* No return */
+ break;
+
+ case 't':
+ f->filetype = optstate.arg;
+ if (f->filetype[0] == '.')
+ f->filetype++;
+ break;
+
+ case 'r': {
+ char k = 0;
+ size_t n = sscanf(optstate.arg, "%lf %c %c", &f->signal.rate, &k, &dummy);
+ if (n < 1 || f->signal.rate <= 0 || (n > 1 && k != 'k') || n > 2) {
+ lsx_fail("Rate value `%s' is not a positive number", optstate.arg);
+ exit(1);
+ }
+ f->signal.rate *= k == 'k'? 1000. : 1.;
+ break;
+ }
+
+ case 'v':
+ if (sscanf(optstate.arg, "%lf %c", &f->volume, &dummy) != 1) {
+ lsx_fail("Volume value `%s' is not a number", optstate.arg);
+ exit(1);
+ }
+ uservolume = sox_true;
+ if (f->volume < 0.0)
+ lsx_report("Volume adjustment is negative; "
+ "this will result in a phase change");
+ break;
+
+ case 'c':
+ if (sscanf(optstate.arg, "%d %c", &i, &dummy) != 1 || i <= 0) {
+ lsx_fail("Channels value `%s' is not a positive integer", optstate.arg);
+ exit(1);
+ }
+ f->signal.channels = i;
+ break;
+
+ case 'C':
+ if (sscanf(optstate.arg, "%lf %c", &f->encoding.compression, &dummy) != 1) {
+ lsx_fail("Compression value `%s' is not a number", optstate.arg);
+ exit(1);
+ }
+ break;
+
+ case 'b':
+ if (sscanf(optstate.arg, "%d %c", &i, &dummy) != 1 || i <= 0) {
+ lsx_fail("Bits value `%s' is not a positive integer", optstate.arg);
+ exit(1);
+ }
+ f->encoding.bits_per_sample = i;
+ break;
+
+ case 'e': switch (enum_option(optstate.arg, opt_index('e'), encodings)) {
+ case encoding_signed_integer: f->encoding.encoding = SOX_ENCODING_SIGN2; break;
+ case encoding_unsigned_integer: f->encoding.encoding = SOX_ENCODING_UNSIGNED; break;
+ case encoding_floating_point: f->encoding.encoding = SOX_ENCODING_FLOAT; break;
+ case encoding_ms_adpcm: f->encoding.encoding = SOX_ENCODING_MS_ADPCM; break;
+ case encoding_ima_adpcm: f->encoding.encoding = SOX_ENCODING_IMA_ADPCM; break;
+ case encoding_oki_adpcm: f->encoding.encoding = SOX_ENCODING_OKI_ADPCM; break;
+ case encoding_gsm_full_rate: f->encoding.encoding = SOX_ENCODING_GSM; break;
+ case encoding_u_law: f->encoding.encoding = SOX_ENCODING_ULAW;
+ if (f->encoding.bits_per_sample == 0)
+ f->encoding.bits_per_sample = 8;
+ break;
+ case encoding_a_law: f->encoding.encoding = SOX_ENCODING_ALAW;
+ if (f->encoding.bits_per_sample == 0)
+ f->encoding.bits_per_sample = 8;
+ break;
+ }
+ break;
+
+ case 'L': case 'B': case 'x':
+ if (f->encoding.reverse_bytes != sox_option_default || f->encoding.opposite_endian)
+ usage("only one endian option per file is allowed");
+ switch (c) {
+ case 'L': f->encoding.reverse_bytes = MACHINE_IS_BIGENDIAN; break;
+ case 'B': f->encoding.reverse_bytes = MACHINE_IS_LITTLEENDIAN; break;
+ case 'x': f->encoding.opposite_endian = sox_true; break;
+ }
+ break;
+ case 'X': f->encoding.reverse_bits = sox_option_yes; break;
+ case 'N': f->encoding.reverse_nibbles = sox_option_yes; break;
+
+ case 'S': show_progress = sox_option_yes; break;
+ case 'q': show_progress = sox_option_no; break;
+ case 'D': no_dither = sox_true; break;
+
+ case 'V':
+ if (optstate.arg == NULL)
+ ++sox_globals.verbosity;
+ else {
+ if (sscanf(optstate.arg, "%d %c", &i, &dummy) != 1 || i < 0) {
+ sox_globals.verbosity = 2;
+ lsx_fail("Verbosity value `%s' is not a non-negative integer", optstate.arg);
+ exit(1);
+ }
+ sox_globals.verbosity = (unsigned)i;
+ }
+ break;
+ }
+ }
+}
+
+static char const * device_name(char const * const type)
+{
+ char * name = NULL, * from_env = getenv("AUDIODEV");
+
+ if (!type)
+ return NULL;
+
+ if (0
+ || !strcmp(type, "sunau")
+ || !strcmp(type, "oss" )
+ || !strcmp(type, "ossdsp")
+ || !strcmp(type, "alsa")
+ || !strcmp(type, "ao")
+ || !strcmp(type, "sndio")
+ || !strcmp(type, "coreaudio")
+ || !strcmp(type, "pulseaudio")
+ || !strcmp(type, "waveaudio")
+ )
+ name = "default";
+
+ return name? from_env? from_env : name : NULL;
+}
+
+static char const * try_device(char const * name)
+{
+ sox_format_handler_t const * handler = sox_find_format(name, sox_false);
+ if (handler) {
+ sox_format_t format, * ft = &format;
+ lsx_debug("Looking for a default device: trying format `%s'", name);
+ memset(ft, 0, sizeof(*ft));
+ ft->filename = (char *)device_name(name);
+ ft->priv = lsx_calloc(1, handler->priv_size);
+ if (handler->startwrite(ft) == SOX_SUCCESS) {
+ handler->stopwrite(ft);
+ free(ft->priv);
+ return name;
+ }
+ free(ft->priv);
+ }
+ return NULL;
+}
+
+static char const * set_default_device(file_t * f)
+{
+ /* Default audio driver type in order of preference: */
+ if (!f->filetype) f->filetype = getenv("AUDIODRIVER");
+ if (!f->filetype) f->filetype = try_device("coreaudio");
+ if (!f->filetype) f->filetype = try_device("pulseaudio");
+ if (!f->filetype) f->filetype = try_device("alsa");
+ if (!f->filetype) f->filetype = try_device("waveaudio");
+ if (!f->filetype) f->filetype = try_device("sndio");
+ if (!f->filetype) f->filetype = try_device("oss");
+ if (!f->filetype) f->filetype = try_device("sunau");
+ if (!f->filetype && file_count) /*!rec*/
+ f->filetype = try_device("ao");
+
+ if (!f->filetype) {
+ lsx_fail("Sorry, there is no default audio device configured");
+ exit(1);
+ }
+ return device_name(f->filetype);
+}
+
+static int add_file(file_t const * const opts, char const * const filename)
+{
+ file_t * f = lsx_malloc(sizeof(*f));
+
+ *f = *opts;
+ if (!filename)
+ usage("missing filename"); /* No return */
+ f->filename = lsx_strdup(filename);
+ files = lsx_realloc(files, (file_count + 1) * sizeof(*files));
+ files[file_count++] = f;
+ return 0;
+}
+
+#if HAVE_GLOB_H
+#ifndef GLOB_BRACE
+#define GLOB_BRACE 0
+#endif
+#ifndef GLOB_TILDE
+#define GLOB_TILDE 0
+#endif
+static int add_glob_file(file_t const * const opts, char const * const filename)
+{
+ glob_t globbuf;
+ size_t i;
+
+ if (opts->no_glob)
+ return add_file(opts, filename);
+
+ if (glob(filename, GLOB_BRACE | GLOB_TILDE | GLOB_NOCHECK, NULL, &globbuf)) {
+ lsx_fail("glob: %s", strerror(errno));
+ exit(1);
+ }
+ for (i = 0; i < globbuf.gl_pathc; ++i)
+ add_file(opts, globbuf.gl_pathv[i]);
+ globfree(&globbuf);
+ return 0;
+}
+#else
+ #define add_glob_file add_file
+#endif
+
+static void init_file(file_t * f)
+{
+ memset(f, 0, sizeof(*f));
+ sox_init_encodinginfo(&f->encoding);
+ f->volume = HUGE_VAL;
+ f->replay_gain = HUGE_VAL;
+}
+
+static void parse_options_and_filenames(int argc, char **argv)
+{
+ char const * env_opts = getenv(SOX_OPTS);
+ file_t opts, opts_none;
+ init_file(&opts), init_file(&opts_none);
+
+ if (sox_mode == sox_rec)
+ add_file(&opts, set_default_device(&opts)), init_file(&opts);
+
+ if (env_opts && *env_opts) {
+ char * * argv2, * str = lsx_malloc(strlen(argv[0]) + strlen(env_opts) + 2);
+ int argc2;
+ strcpy(str, argv[0]);
+ strcat(str, " ");
+ strcat(str, env_opts);
+ argv2 = strtoargv(str, &argc2);
+ lsx_getopt_init(argc2, argv2, getoptstr, long_options, lsx_getopt_flag_opterr, 1, &optstate);
+ if (parse_gopts_and_fopts(&opts)) {
+ lsx_fail("invalid option for "SOX_OPTS);
+ exit(1);
+ }
+ free(str);
+ free(argv2);
+ }
+
+ lsx_getopt_init(argc, argv, getoptstr, long_options, lsx_getopt_flag_opterr, 1, &optstate);
+ for (; optstate.ind < argc && !sox_find_effect(argv[optstate.ind]); init_file(&opts)) {
+ char c = parse_gopts_and_fopts(&opts);
+ if (c == 'n') { /* is null file? */
+ if (opts.filetype != NULL && strcmp(opts.filetype, "null") != 0)
+ lsx_warn("ignoring `-t %s'.", opts.filetype);
+ opts.filetype = "null";
+ add_file(&opts, "");
+ }
+ else if (c == 'd') /* is default device? */
+ add_file(&opts, set_default_device(&opts));
+ else if (c == 'p') { /* is sox pipe? */
+ if (opts.filetype != NULL && strcmp(opts.filetype, "sox") != 0)
+ lsx_warn("ignoring `-t %s'.", opts.filetype);
+ opts.filetype = "sox";
+ add_file(&opts, "-");
+ }
+ else if (optstate.ind >= argc || sox_find_effect(argv[optstate.ind]))
+ break;
+ else if (!sox_is_playlist(argv[optstate.ind]))
+ add_glob_file(&opts, argv[optstate.ind++]);
+ else if (sox_parse_playlist((sox_playlist_callback_t)add_file, &opts, argv[optstate.ind++]) != SOX_SUCCESS)
+ exit(1);
+ }
+ if (env_opts && *env_opts) {
+ lsx_report("using "SOX_OPTS"=%s", env_opts);
+ reported_sox_opts = sox_true;
+ }
+ if (sox_mode == sox_play)
+ add_file(&opts, set_default_device(&opts));
+ else if (memcmp(&opts, &opts_none, sizeof(opts))) /* fopts but no file */
+ add_file(&opts, device_name(opts.filetype));
+}
+
+static double soxi_total;
+static size_t soxi_file_count;
+
+typedef enum {Full, Type, Rate, Channels, Samples, Duration, Duration_secs,
+ Bits, Bitrate, Precision, Encoding, Annotation} soxi_t;
+
+static int soxi1(soxi_t const * type, char const * filename)
+{
+ sox_format_t * ft = sox_open_read(filename, NULL, NULL, NULL);
+ double secs;
+ uint64_t ws;
+ char const * text = NULL;
+
+ if (!ft)
+ return 1;
+ ws = ft->signal.length / max(ft->signal.channels, 1);
+ secs = (double)ws / max(ft->signal.rate, 1);
+ ++soxi_file_count;
+ if (soxi_total >= 0 && !ws)
+ soxi_total = -2;
+ if (soxi_total >= 0) soxi_total += *type == Samples? ws : secs;
+
+ switch (*type) {
+ case Type: printf("%s\n", ft->filetype); break;
+ case Rate: printf("%g\n", ft->signal.rate); break;
+ case Channels: printf("%u\n", ft->signal.channels); break;
+ case Samples: if (soxi_total ==-1) printf("%" PRIu64 "\n", ws); break;
+ case Duration: if (soxi_total ==-1) printf("%s\n", str_time(secs)); break;
+ case Duration_secs: if (soxi_total ==-1) printf("%f\n", secs); break;
+ case Bits: printf("%u\n", ft->encoding.bits_per_sample); break;
+ case Bitrate: size_and_bitrate(ft, &text); puts(text? text : "0"); break;
+ case Precision: printf("%u\n", ft->signal.precision); break;
+ case Encoding: printf("%s\n", sox_encodings_info[ft->encoding.encoding].desc); break;
+ case Annotation: if (ft->oob.comments) {
+ sox_comments_t p = ft->oob.comments;
+ do printf("%s\n", *p); while (*++p);
+ }
+ break;
+ case Full: display_file_info(ft, NULL, sox_false); break;
+ }
+ return !!sox_close(ft);
+}
+
+static void soxi_usage(int return_code)
+{
+ display_SoX_version(stdout);
+ printf(
+ "\n"
+ "Usage: soxi [-V[level]] [-T] [-t|-r|-c|-s|-d|-D|-b|-B|-p|-e|-a] infile1 ...\n"
+ "\n"
+ "-V[n]\tIncrement or set verbosity level (default is 2)\n"
+ "-T\tWith -s, -d or -D, display the total across all given files\n"
+ "\n"
+ "-t\tShow detected file-type\n"
+ "-r\tShow sample-rate\n"
+ "-c\tShow number of channels\n"
+ ); printf(
+ "-s\tShow number of samples (0 if unavailable)\n"
+ "-d\tShow duration in hours, minutes and seconds (0 if unavailable)\n"
+ "-D\tShow duration in seconds (0 if unavailable)\n"
+ "-b\tShow number of bits per sample (0 if not applicable)\n"
+ "-B\tShow the bitrate averaged over the whole file (0 if unavailable)\n"
+ "-p\tShow estimated sample precision in bits\n"
+ "-e\tShow the name of the audio encoding\n"
+ "-a\tShow file comments (annotations) if available\n"
+ "\n"
+ "With no options, as much information as is available is shown for\n"
+ "each given file.\n"
+ );
+ exit(return_code);
+}
+
+static int soxi(int argc, char * const * argv)
+{
+ static char const opts[] = "trcsdDbBpea?TV::";
+ soxi_t type = Full;
+ int opt, num_errors = 0;
+ sox_bool do_total = sox_false;
+
+ if (argc < 2)
+ soxi_usage(0);
+ lsx_getopt_init(argc, argv, opts, NULL, lsx_getopt_flag_opterr, 1, &optstate);
+ while ((opt = lsx_getopt(&optstate)) > 0) /* act only on last option */
+ if (opt == 'V') {
+ int i; /* sscanf silently accepts negative numbers for %u :( */
+ char dummy; /* To check for extraneous chars in optstate.arg. */
+ if (optstate.arg == NULL)
+ ++sox_globals.verbosity;
+ else {
+ if (sscanf(optstate.arg, "%d %c", &i, &dummy) != 1 || i < 0) {
+ sox_globals.verbosity = 2;
+ lsx_fail("Verbosity value `%s' is not a non-negative integer", optstate.arg);
+ exit(1);
+ }
+ sox_globals.verbosity = (unsigned)i;
+ }
+ }
+ else if (opt == 'T')
+ do_total = sox_true;
+ else if ((type = 1 + (strchr(opts, opt) - opts)) > Annotation)
+ soxi_usage(1);
+
+ if (type == Full)
+ do_total = sox_true;
+ else if (do_total && (type < Samples || type > Duration_secs)) {
+ fprintf(stderr, "soxi: ignoring -T; n/a with other given option");
+ do_total = sox_false;
+ }
+ soxi_total = -!do_total;
+ for (; optstate.ind < argc; ++optstate.ind) {
+ if (sox_is_playlist(argv[optstate.ind]))
+ num_errors += (sox_parse_playlist((sox_playlist_callback_t)soxi1, &type, argv[optstate.ind]) != SOX_SUCCESS);
+ else num_errors += soxi1(&type, argv[optstate.ind]);
+ }
+ if (type == Full) {
+ if (soxi_file_count > 1 && soxi_total > 0)
+ printf("Total Duration of %u files: %s\n", (unsigned)soxi_file_count, str_time(soxi_total));
+ }
+ else if (do_total) {
+ if (soxi_total < 0)
+ puts("0");
+ else if (type == Duration)
+ printf("%s\n", str_time(soxi_total));
+ else printf("%f\n", soxi_total);
+ }
+ return num_errors;
+}
+
+static void set_replay_gain(sox_comments_t comments, file_t * f)
+{
+ rg_mode rg = replay_gain_mode;
+ int try = 2; /* Will try to find the other GAIN if preferred one not found */
+ size_t i, n = sox_num_comments(comments);
+
+ if (rg != RG_off) while (try--) {
+ char const * target =
+ rg == RG_track? "REPLAYGAIN_TRACK_GAIN=" : "REPLAYGAIN_ALBUM_GAIN=";
+ for (i = 0; i < n; ++i) {
+ if (strncasecmp(comments[i], target, strlen(target)) == 0) {
+ f->replay_gain = atof(comments[i] + strlen(target));
+ f->replay_gain_mode = rg;
+ return;
+ }
+ }
+ rg ^= RG_track ^ RG_album;
+ }
+}
+
+static void output_message(unsigned level, const char *filename, const char *fmt, va_list ap)
+{
+ char const * const str[] = {"FAIL", "WARN", "INFO", "DBUG"};
+ if (sox_globals.verbosity >= level) {
+ char base_name[128];
+ sox_basename(base_name, sizeof(base_name), filename);
+ fprintf(stderr, "%s %s %s: ", myname, str[min(level - 1, 3)], base_name);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ }
+}
+
+static sox_bool cmp_comment_text(char const * c1, char const * c2)
+{
+ return c1 && c2 && !strcasecmp(c1, c2);
+}
+
+#ifndef SOX_NO_MAIN
+int main(int argc, char **argv)
+{
+ size_t i;
+ char mybase[6];
+
+ gettimeofday(&load_timeofday, NULL);
+ myname = argv[0];
+ sox_globals.output_message_handler = output_message;
+
+ if (0 != sox_basename(mybase, sizeof(mybase), myname))
+ {
+ if (0 == lsx_strcasecmp(mybase, "play"))
+ sox_mode = sox_play;
+ else if (0 == lsx_strcasecmp(mybase, "rec"))
+ sox_mode = sox_rec;
+ else if (0 == lsx_strcasecmp(mybase, "soxi"))
+ sox_mode = sox_soxi;
+ }
+
+ if (!sox_mode && argc > 1 &&
+ (!strcmp(argv[1], "--i") || !strcmp(argv[1], "--info")))
+ --argc, ++argv, sox_mode = sox_soxi;
+
+ if (sox_init() != SOX_SUCCESS)
+ exit(1);
+
+ stdin_is_a_tty = isatty(fileno(stdin));
+ errno = 0; /* Both isatty & fileno may set errno. */
+
+ atexit(atexit_cleanup);
+
+ if (sox_mode == sox_soxi)
+ exit(soxi(argc, argv));
+
+ parse_options_and_filenames(argc, argv);
+
+ if (sox_globals.verbosity > 2)
+ display_SoX_version(stderr);
+
+ input_count = file_count ? file_count - 1 : 0;
+
+ if (file_count) {
+ sox_format_handler_t const * handler =
+ sox_write_handler(ofile->filename, ofile->filetype, NULL);
+ is_player = handler &&
+ (handler->flags & SOX_FILE_DEVICE) && !(handler->flags & SOX_FILE_PHONY);
+ }
+
+ if (combine_method == sox_default)
+ combine_method = is_player? sox_sequence : sox_concatenate;
+
+ /* Allow e.g. known length processing in this case */
+ if (combine_method == sox_sequence && input_count == 1)
+ combine_method = sox_concatenate;
+
+ /* Make sure we got at least the required # of input filenames */
+ if (input_count < (size_t)(is_serial(combine_method) ? 1 : 2))
+ usage("Not enough input filenames specified");
+
+ /* Check for misplaced input/output-specific options */
+ for (i = 0; i < input_count; ++i) {
+ if (files[i]->encoding.compression != HUGE_VAL)
+ usage("A compression factor can be given only for an output file");
+ if (files[i]->oob.comments != NULL)
+ usage("Comments can be given only for an output file");
+ }
+ if (ofile->volume != HUGE_VAL)
+ usage("-v can be given only for an input file;\n"
+ "\tuse the `gain' or `vol' effect to set the output file volume");
+ if (ofile->signal.length != SOX_UNSPEC)
+ usage("--ignore-length can be given only for an input file");
+
+ signal(SIGINT, SIG_IGN); /* So child pipes aren't killed by track skip */
+ for (i = 0; i < input_count; i++) {
+ size_t j = input_count - 1 - i; /* Open in reverse order 'cos of rec (below) */
+ file_t * f = files[j];
+
+ /* When mixing audio, default to input side volume adjustments that will
+ * make sure no clipping will occur. Users probably won't be happy with
+ * this, and will override it, possibly causing clipping to occur. */
+ if (combine_method == sox_mix && !uservolume)
+ f->volume = 1.0 / input_count;
+ else if (combine_method == sox_mix_power && !uservolume)
+ f->volume = 1.0 / sqrt((double)input_count);
+
+ if (sox_mode == sox_rec && !j) { /* Set the recording parameters: */
+ if (input_count > 1) { /* from the (just openned) next */
+ f->signal = files[1]->ft->signal; /* input file, or from the output */
+ f->encoding = files[1]->ft->encoding;
+ } else {
+ f->signal = files[1]->signal; /* file (which is not open yet). */
+ f->encoding = files[1]->encoding;
+ }
+ }
+ files[j]->ft = sox_open_read(f->filename, &f->signal, &f->encoding, f->filetype);
+ if (!files[j]->ft)
+ /* sox_open_read() will call lsx_warn for most errors.
+ * Rely on that printing something. */
+ exit(2);
+ if (show_progress == sox_option_default &&
+ (files[j]->ft->handler.flags & SOX_FILE_DEVICE) != 0 &&
+ (files[j]->ft->handler.flags & SOX_FILE_PHONY) == 0)
+ show_progress = sox_option_yes;
+ }
+
+ if (replay_gain_mode == RG_default)
+ replay_gain_mode = is_player?
+ input_count > 1 && /* Simple heuristic to determine if */
+ cmp_comment_text( /* replay-gain should be in album mode */
+ sox_find_comment(files[0]->ft->oob.comments, "artist"),
+ sox_find_comment(files[1]->ft->oob.comments, "artist")) &&
+ cmp_comment_text(
+ sox_find_comment(files[0]->ft->oob.comments, "album"),
+ sox_find_comment(files[1]->ft->oob.comments, "album"))?
+ RG_album : RG_track : RG_off;
+
+ for (i = 0; i < input_count; i++)
+ set_replay_gain(files[i]->ft->oob.comments, files[i]);
+
+ signal(SIGINT, SIG_DFL);
+
+ /* Loop through the rest of the arguments looking for effects */
+ add_eff_chain();
+ parse_effects(argc, argv);
+ eff_chain_count++;
+ /* Note: Purposely not calling add_eff_chain() to save some
+ * memory although it would be more consistent to do so.
+ */
+
+ /* Not the best way for users to do this; now deprecated in favour of soxi. */
+ if (!show_progress && !nuser_effects[current_eff_chain] &&
+ ofile->filetype && !strcmp(ofile->filetype, "null")) {
+ for (i = 0; i < input_count; i++)
+ report_file_info(files[i]);
+ exit(0);
+ }
+
+ if (!sox_globals.repeatable) {/* Re-seed PRNG? */
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ sox_globals.ranqd1 = (int32_t)(now.tv_sec - now.tv_usec);
+ }
+
+ /* Save things that sox_sequence needs to be reinitialised for each segued
+ * block of input files.*/
+ ofile_signal_options = ofile->signal;
+ ofile_encoding_options = ofile->encoding;
+
+ /* If user specified an effects filename then use that file
+ * to load user effects. Free any previously specified options
+ * from the command line.
+ */
+ if (effects_filename)
+ {
+ read_user_effects(effects_filename);
+ }
+
+ while (process() != SOX_EOF && !user_abort && current_input < input_count)
+ {
+ if (advance_eff_chain() == SOX_EOF)
+ break;
+
+ if (!save_output_eff)
+ {
+ sox_close(ofile->ft);
+ ofile->ft = NULL;
+ }
+ }
+
+ sox_delete_effects_chain(effects_chain);
+ delete_eff_chains();
+
+ for (i = 0; i < file_count; ++i)
+ if (files[i]->ft->clips != 0)
+ lsx_warn(i < input_count?"`%s' input clipped %" PRIu64 " samples" :
+ "`%s' output clipped %" PRIu64 " samples; decrease volume?",
+ (files[i]->ft->handler.flags & SOX_FILE_DEVICE)?
+ files[i]->ft->handler.names[0] : files[i]->ft->filename,
+ files[i]->ft->clips);
+
+ if (mixing_clips > 0)
+ lsx_warn("mix-combining clipped %" PRIu64 " samples; decrease volume?", mixing_clips);
+
+ for (i = 0; i < file_count; i++)
+ if (files[i]->volume_clips > 0)
+ lsx_warn("`%s' balancing clipped %" PRIu64 " samples; decrease volume?",
+ files[i]->filename, files[i]->volume_clips);
+
+ if (show_progress) {
+ if (user_abort)
+ fprintf(stderr, "Aborted.\n");
+ else if (user_skip && sox_mode != sox_rec)
+ fprintf(stderr, "Skipped.\n");
+ else
+ fprintf(stderr, "Done.\n");
+ }
+
+ success = 1; /* Signal success to cleanup so the output file isn't removed. */
+
+ cleanup();
+
+ return 0;
+}
+#endif
diff --git a/src/src/sox.h b/src/src/sox.h
new file mode 100644
index 0000000..31fa99c
--- /dev/null
+++ b/src/src/sox.h
@@ -0,0 +1,2628 @@
+/* libSoX Library Public Interface
+ *
+ * Copyright 1999-2012 Chris Bagwell and SoX Contributors.
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Chris Bagwell And SoX Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+/** @file
+Contains the interface exposed to clients of the libSoX library.
+Symbols starting with "sox_" or "SOX_" are part of the public interface for
+libSoX clients (applications that consume libSoX). Symbols starting with
+"lsx_" or "LSX_" are internal use by libSoX and plugins.
+LSX_ and lsx_ symbols should not be used by libSoX-based applications.
+*/
+
+#ifndef SOX_H
+#define SOX_H /**< Client API: This macro is defined if sox.h has been included. */
+
+#include <limits.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* Suppress warnings from use of type long long. */
+#if defined __GNUC__
+#pragma GCC system_header
+#endif
+
+/*****************************************************************************
+API decoration macros:
+Mostly for documentation purposes. For some compilers, decorations also affect
+code generation, influence compiler warnings or activate compiler
+optimizations.
+*****************************************************************************/
+
+/**
+Plugins API:
+Attribute required on all functions exported by libSoX and on all function
+pointer types used by the libSoX API.
+*/
+#ifdef __GNUC__
+#define LSX_API __attribute__ ((cdecl)) /* libSoX function */
+#elif _MSC_VER
+#define LSX_API __cdecl /* libSoX function */
+#else
+#define LSX_API /* libSoX function */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter or local variable to suppress warnings about
+the variable being unused (especially in macro-generated code).
+*/
+#ifdef __GNUC__
+#define LSX_UNUSED __attribute__ ((unused)) /* Parameter or local variable is intentionally unused. */
+#else
+#define LSX_UNUSED /* Parameter or local variable is intentionally unused. */
+#endif
+
+/**
+Plugins API:
+LSX_PRINTF12: Attribute applied to a function to indicate that it requires
+a printf-style format string for arg1 and that printf parameters start at
+arg2.
+*/
+#ifdef __GNUC__
+#define LSX_PRINTF12 __attribute__ ((format (printf, 1, 2))) /* Function has printf-style arguments. */
+#else
+#define LSX_PRINTF12 /* Function has printf-style arguments. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that it has no side effects and
+depends only its input parameters and global memory. If called repeatedly, it
+returns the same result each time.
+*/
+#ifdef __GNUC__
+#define LSX_RETURN_PURE __attribute__ ((pure)) /* Function is pure. */
+#else
+#define LSX_RETURN_PURE /* Function is pure. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the
+return value is always a pointer to a valid object (never NULL).
+*/
+#ifdef _Ret_
+#define LSX_RETURN_VALID _Ret_ /* Function always returns a valid object (never NULL). */
+#else
+#define LSX_RETURN_VALID /* Function always returns a valid object (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the return value is always a
+pointer to a valid array (never NULL).
+*/
+#ifdef _Ret_valid_
+#define LSX_RETURN_ARRAY _Ret_valid_ /* Function always returns a valid array (never NULL). */
+#else
+#define LSX_RETURN_ARRAY /* Function always returns a valid array (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the return value is always a
+pointer to a valid 0-terminated array (never NULL).
+*/
+#ifdef _Ret_z_
+#define LSX_RETURN_VALID_Z _Ret_z_ /* Function always returns a 0-terminated array (never NULL). */
+#else
+#define LSX_RETURN_VALID_Z /* Function always returns a 0-terminated array (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a function to indicate that the returned pointer may be
+null.
+*/
+#ifdef _Ret_opt_
+#define LSX_RETURN_OPT _Ret_opt_ /* Function may return NULL. */
+#else
+#define LSX_RETURN_OPT /* Function may return NULL. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to one const element of the pointed-to type (never NULL).
+*/
+#ifdef _In_
+#define LSX_PARAM_IN _In_ /* Required const pointer to a valid object (never NULL). */
+#else
+#define LSX_PARAM_IN /* Required const pointer to a valid object (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to a const 0-terminated string (never NULL).
+*/
+#ifdef _In_z_
+#define LSX_PARAM_IN_Z _In_z_ /* Required const pointer to 0-terminated string (never NULL). */
+#else
+#define LSX_PARAM_IN_Z /* Required const pointer to 0-terminated string (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a const
+pointer to a 0-terminated printf format string.
+*/
+#ifdef _Printf_format_string_
+#define LSX_PARAM_IN_PRINTF _Printf_format_string_ /* Required const pointer to 0-terminated printf format string (never NULL). */
+#else
+#define LSX_PARAM_IN_PRINTF /* Required const pointer to 0-terminated printf format string (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to (len) const initialized elements of the pointed-to type, where
+(len) is the name of another parameter.
+@param len The parameter that contains the number of elements in the array.
+*/
+#ifdef _In_count_
+#define LSX_PARAM_IN_COUNT(len) _In_count_(len) /* Required const pointer to (len) valid objects (never NULL). */
+#else
+#define LSX_PARAM_IN_COUNT(len) /* Required const pointer to (len) valid objects (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to (len) const bytes of initialized data, where (len) is the name of
+another parameter.
+@param len The parameter that contains the number of bytes in the array.
+*/
+#ifdef _In_bytecount_
+#define LSX_PARAM_IN_BYTECOUNT(len) _In_bytecount_(len) /* Required const pointer to (len) bytes of data (never NULL). */
+#else
+#define LSX_PARAM_IN_BYTECOUNT(len) /* Required const pointer to (len) bytes of data (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is either NULL
+or a valid pointer to one const element of the pointed-to type.
+*/
+#ifdef _In_opt_
+#define LSX_PARAM_IN_OPT _In_opt_ /* Optional const pointer to a valid object (may be NULL). */
+#else
+#define LSX_PARAM_IN_OPT /* Optional const pointer to a valid object (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is either NULL
+or a valid pointer to a const 0-terminated string.
+*/
+#ifdef _In_opt_z_
+#define LSX_PARAM_IN_OPT_Z _In_opt_z_ /* Optional const pointer to 0-terminated string (may be NULL). */
+#else
+#define LSX_PARAM_IN_OPT_Z /* Optional const pointer to 0-terminated string (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to one initialized element of the pointed-to type (never NULL). The
+function may modify the element.
+*/
+#ifdef _Inout_
+#define LSX_PARAM_INOUT _Inout_ /* Required pointer to a valid object (never NULL). */
+#else
+#define LSX_PARAM_INOUT /* Required pointer to a valid object (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to (len) initialized elements of the pointed-to type (never NULL). The
+function may modify the elements.
+@param len The parameter that contains the number of elements in the array.
+*/
+#ifdef _Inout_count_x_
+#define LSX_PARAM_INOUT_COUNT(len) _Inout_count_x_(len) /* Required pointer to (len) valid objects (never NULL). */
+#else
+#define LSX_PARAM_INOUT_COUNT(len) /* Required pointer to (len) valid objects (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for one element of the pointed-to type (never
+NULL). The function will initialize the element.
+*/
+#ifdef _Out_
+#define LSX_PARAM_OUT _Out_ /* Required pointer to an object to be initialized (never NULL). */
+#else
+#define LSX_PARAM_OUT /* Required pointer to an object to be initialized (never NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for (len) bytes of data (never NULL), where (len)
+is the name of another parameter. The function may write up to len bytes of
+data to this memory.
+@param len The parameter that contains the number of bytes in the array.
+*/
+#ifdef _Out_bytecap_
+#define LSX_PARAM_OUT_BYTECAP(len) _Out_bytecap_(len) /* Required pointer to writable buffer with room for len bytes. */
+#else
+#define LSX_PARAM_OUT_BYTECAP(len) /* Required pointer to writable buffer with room for len bytes. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for (len) elements of the pointed-to type (never
+NULL), where (len) is the name of another parameter. On return, (filled)
+elements will have been initialized, where (filled) is either the dereference
+of another pointer parameter (for example "*written") or the "return"
+parameter (indicating that the function returns the number of elements
+written).
+@param len The parameter that contains the number of elements in the array.
+@param filled The dereference of the parameter that receives the number of elements written to the array, or "return" if the value is returned.
+*/
+#ifdef _Out_cap_post_count_
+#define LSX_PARAM_OUT_CAP_POST_COUNT(len,filled) _Out_cap_post_count_(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */
+#else
+#define LSX_PARAM_OUT_CAP_POST_COUNT(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled) elements will have been initialized. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer to memory sufficient for (len) elements of the pointed-to type (never
+NULL), where (len) is the name of another parameter. On return, (filled+1)
+elements will have been initialized, with the last element having been
+initialized to 0, where (filled) is either the dereference of another pointer
+parameter (for example, "*written") or the "return" parameter (indicating that
+the function returns the number of elements written).
+@param len The parameter that contains the number of elements in the array.
+@param filled The dereference of the parameter that receives the number of elements written to the array (not counting the terminating null), or "return" if the value is returned.
+*/
+#ifdef _Out_z_cap_post_count_
+#define LSX_PARAM_OUT_Z_CAP_POST_COUNT(len,filled) _Out_z_cap_post_count_(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled+1) elements will have been initialized, and the array will be 0-terminated. */
+#else
+#define LSX_PARAM_OUT_Z_CAP_POST_COUNT(len,filled) /* Required pointer to buffer for (len) elements (never NULL); on return, (filled+1) elements will have been initialized, and the array will be 0-terminated. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is either NULL
+or a valid pointer to memory sufficient for one element of the pointed-to
+type. The function will initialize the element.
+*/
+#ifdef _Out_opt_
+#define LSX_PARAM_OUT_OPT _Out_opt_ /* Optional pointer to an object to be initialized (may be NULL). */
+#else
+#define LSX_PARAM_OUT_OPT /* Optional pointer to an object to be initialized (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer (never NULL) to another pointer which may be NULL when the function is
+invoked.
+*/
+#ifdef _Deref_pre_maybenull_
+#define LSX_PARAM_DEREF_PRE_MAYBENULL _Deref_pre_maybenull_ /* Required pointer (never NULL) to another pointer (may be NULL). */
+#else
+#define LSX_PARAM_DEREF_PRE_MAYBENULL /* Required pointer (never NULL) to another pointer (may be NULL). */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer (never NULL) to another pointer which will be NULL when the function
+returns.
+*/
+#ifdef _Deref_post_null_
+#define LSX_PARAM_DEREF_POST_NULL _Deref_post_null_ /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
+#else
+#define LSX_PARAM_DEREF_POST_NULL /* Required pointer (never NULL) to another pointer, which will be NULL on exit. */
+#endif
+
+/**
+Plugins API:
+Attribute applied to a parameter to indicate that the parameter is a valid
+pointer (never NULL) to another pointer which will be non-NULL when the
+function returns.
+*/
+#ifdef _Deref_post_notnull_
+#define LSX_PARAM_DEREF_POST_NOTNULL _Deref_post_notnull_ /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
+#else
+#define LSX_PARAM_DEREF_POST_NOTNULL /* Required pointer (never NULL) to another pointer, which will be valid (not NULL) on exit. */
+#endif
+
+/**
+Plugins API:
+Expression that "uses" a potentially-unused variable to avoid compiler
+warnings (especially in macro-generated code).
+*/
+#ifdef _PREFAST_
+#define LSX_USE_VAR(x) ((void)(x=0)) /* During static analysis, initialize unused variables to 0. */
+#else
+#define LSX_USE_VAR(x) ((void)(x)) /* Parameter or variable is intentionally unused. */
+#endif
+
+/**
+Plugins API:
+Compile-time assertion. Causes a compile error if the expression is false.
+@param e The expression to test. If expression is false, compilation will fail.
+@param f A unique identifier for the test, for example foo_must_not_be_zero.
+*/
+#define lsx_static_assert(e,f) enum {lsx_static_assert_##f = 1/((e) ? 1 : 0)}
+
+/*****************************************************************************
+Basic typedefs:
+*****************************************************************************/
+
+/**
+Client API:
+Signed twos-complement 8-bit type. Typically defined as signed char.
+*/
+#if SCHAR_MAX==127 && SCHAR_MIN==(-128)
+typedef signed char sox_int8_t;
+#elif CHAR_MAX==127 && CHAR_MIN==(-128)
+typedef char sox_int8_t;
+#else
+#error Unable to determine an appropriate definition for sox_int8_t.
+#endif
+
+/**
+Client API:
+Unsigned 8-bit type. Typically defined as unsigned char.
+*/
+#if UCHAR_MAX==0xff
+typedef unsigned char sox_uint8_t;
+#elif CHAR_MAX==0xff && CHAR_MIN==0
+typedef char sox_uint8_t;
+#else
+#error Unable to determine an appropriate definition for sox_uint8_t.
+#endif
+
+/**
+Client API:
+Signed twos-complement 16-bit type. Typically defined as short.
+*/
+#if SHRT_MAX==32767 && SHRT_MIN==(-32768)
+typedef short sox_int16_t;
+#elif INT_MAX==32767 && INT_MIN==(-32768)
+typedef int sox_int16_t;
+#else
+#error Unable to determine an appropriate definition for sox_int16_t.
+#endif
+
+/**
+Client API:
+Unsigned 16-bit type. Typically defined as unsigned short.
+*/
+#if USHRT_MAX==0xffff
+typedef unsigned short sox_uint16_t;
+#elif UINT_MAX==0xffff
+typedef unsigned int sox_uint16_t;
+#else
+#error Unable to determine an appropriate definition for sox_uint16_t.
+#endif
+
+/**
+Client API:
+Signed twos-complement 32-bit type. Typically defined as int.
+*/
+#if INT_MAX==2147483647 && INT_MIN==(-2147483647-1)
+typedef int sox_int32_t;
+#elif LONG_MAX==2147483647 && LONG_MIN==(-2147483647-1)
+typedef long sox_int32_t;
+#else
+#error Unable to determine an appropriate definition for sox_int32_t.
+#endif
+
+/**
+Client API:
+Unsigned 32-bit type. Typically defined as unsigned int.
+*/
+#if UINT_MAX==0xffffffff
+typedef unsigned int sox_uint32_t;
+#elif ULONG_MAX==0xffffffff
+typedef unsigned long sox_uint32_t;
+#else
+#error Unable to determine an appropriate definition for sox_uint32_t.
+#endif
+
+/**
+Client API:
+Signed twos-complement 64-bit type. Typically defined as long or long long.
+*/
+#if LONG_MAX==9223372036854775807 && LONG_MIN==(-9223372036854775807-1)
+typedef long sox_int64_t;
+#elif defined(_MSC_VER)
+typedef __int64 sox_int64_t;
+#else
+typedef long long sox_int64_t;
+#endif
+
+/**
+Client API:
+Unsigned 64-bit type. Typically defined as unsigned long or unsigned long long.
+*/
+#if ULONG_MAX==0xffffffffffffffff
+typedef unsigned long sox_uint64_t;
+#elif defined(_MSC_VER)
+typedef unsigned __int64 sox_uint64_t;
+#else
+typedef unsigned long long sox_uint64_t;
+#endif
+
+#ifndef _DOXYGEN_
+lsx_static_assert(sizeof(sox_int8_t)==1, sox_int8_size);
+lsx_static_assert(sizeof(sox_uint8_t)==1, sox_uint8_size);
+lsx_static_assert(sizeof(sox_int16_t)==2, sox_int16_size);
+lsx_static_assert(sizeof(sox_uint16_t)==2, sox_uint16_size);
+lsx_static_assert(sizeof(sox_int32_t)==4, sox_int32_size);
+lsx_static_assert(sizeof(sox_uint32_t)==4, sox_uint32_size);
+lsx_static_assert(sizeof(sox_int64_t)==8, sox_int64_size);
+lsx_static_assert(sizeof(sox_uint64_t)==8, sox_uint64_size);
+#endif
+
+/**
+Client API:
+Alias for sox_int32_t (beware of the extra byte).
+*/
+typedef sox_int32_t sox_int24_t;
+
+/**
+Client API:
+Alias for sox_uint32_t (beware of the extra byte).
+*/
+typedef sox_uint32_t sox_uint24_t;
+
+/**
+Client API:
+Native SoX audio sample type (alias for sox_int32_t).
+*/
+typedef sox_int32_t sox_sample_t;
+
+/**
+Client API:
+Samples per second is stored as a double.
+*/
+typedef double sox_rate_t;
+
+/**
+Client API:
+File's metadata, access via sox_*_comments functions.
+*/
+typedef char * * sox_comments_t;
+
+/*****************************************************************************
+Enumerations:
+*****************************************************************************/
+
+/**
+Client API:
+Boolean type, assignment (but not necessarily binary) compatible with C++ bool.
+*/
+typedef enum sox_bool {
+ sox_bool_dummy = -1, /* Ensure a signed type */
+ sox_false, /**< False = 0. */
+ sox_true /**< True = 1. */
+} sox_bool;
+
+/**
+Client API:
+no, yes, or default (default usually implies some kind of auto-detect logic).
+*/
+typedef enum sox_option_t {
+ sox_option_no, /**< Option specified as no = 0. */
+ sox_option_yes, /**< Option specified as yes = 1. */
+ sox_option_default /**< Option unspecified = 2. */
+} sox_option_t;
+
+/**
+Client API:
+The libSoX-specific error codes.
+libSoX functions may return these codes or others that map from errno codes.
+*/
+enum sox_error_t {
+ SOX_SUCCESS = 0, /**< Function succeeded = 0 */
+ SOX_EOF = -1, /**< End Of File or other error = -1 */
+ SOX_EHDR = 2000, /**< Invalid Audio Header = 2000 */
+ SOX_EFMT, /**< Unsupported data format = 2001 */
+ SOX_ENOMEM, /**< Can't alloc memory = 2002 */
+ SOX_EPERM, /**< Operation not permitted = 2003 */
+ SOX_ENOTSUP, /**< Operation not supported = 2004 */
+ SOX_EINVAL /**< Invalid argument = 2005 */
+};
+
+/**
+Client API:
+Flags indicating whether optional features are present in this build of libSoX.
+*/
+typedef enum sox_version_flags_t {
+ sox_version_none = 0, /**< No special features = 0. */
+ sox_version_have_popen = 1, /**< popen = 1. */
+ sox_version_have_magic = 2, /**< magic = 2. */
+ sox_version_have_threads = 4, /**< threads = 4. */
+ sox_version_have_memopen = 8 /**< memopen = 8. */
+} sox_version_flags_t;
+
+/**
+Client API:
+Format of sample data.
+*/
+typedef enum sox_encoding_t {
+ SOX_ENCODING_UNKNOWN , /**< encoding has not yet been determined */
+
+ SOX_ENCODING_SIGN2 , /**< signed linear 2's comp: Mac */
+ SOX_ENCODING_UNSIGNED , /**< unsigned linear: Sound Blaster */
+ SOX_ENCODING_FLOAT , /**< floating point (binary format) */
+ SOX_ENCODING_FLOAT_TEXT, /**< floating point (text format) */
+ SOX_ENCODING_FLAC , /**< FLAC compression */
+ SOX_ENCODING_HCOM , /**< Mac FSSD files with Huffman compression */
+ SOX_ENCODING_WAVPACK , /**< WavPack with integer samples */
+ SOX_ENCODING_WAVPACKF , /**< WavPack with float samples */
+ SOX_ENCODING_ULAW , /**< u-law signed logs: US telephony, SPARC */
+ SOX_ENCODING_ALAW , /**< A-law signed logs: non-US telephony, Psion */
+ SOX_ENCODING_G721 , /**< G.721 4-bit ADPCM */
+ SOX_ENCODING_G723 , /**< G.723 3 or 5 bit ADPCM */
+ SOX_ENCODING_CL_ADPCM , /**< Creative Labs 8 --> 2,3,4 bit Compressed PCM */
+ SOX_ENCODING_CL_ADPCM16, /**< Creative Labs 16 --> 4 bit Compressed PCM */
+ SOX_ENCODING_MS_ADPCM , /**< Microsoft Compressed PCM */
+ SOX_ENCODING_IMA_ADPCM , /**< IMA Compressed PCM */
+ SOX_ENCODING_OKI_ADPCM , /**< Dialogic/OKI Compressed PCM */
+ SOX_ENCODING_DPCM , /**< Differential PCM: Fasttracker 2 (xi) */
+ SOX_ENCODING_DWVW , /**< Delta Width Variable Word */
+ SOX_ENCODING_DWVWN , /**< Delta Width Variable Word N-bit */
+ SOX_ENCODING_GSM , /**< GSM 6.10 33byte frame lossy compression */
+ SOX_ENCODING_MP3 , /**< MP3 compression */
+ SOX_ENCODING_VORBIS , /**< Vorbis compression */
+ SOX_ENCODING_AMR_WB , /**< AMR-WB compression */
+ SOX_ENCODING_AMR_NB , /**< AMR-NB compression */
+ SOX_ENCODING_CVSD , /**< Continuously Variable Slope Delta modulation */
+ SOX_ENCODING_LPC10 , /**< Linear Predictive Coding */
+ SOX_ENCODING_OPUS , /**< Opus compression */
+
+ SOX_ENCODINGS /**< End of list marker */
+} sox_encoding_t;
+
+/**
+Client API:
+Flags for sox_encodings_info_t: lossless/lossy1/lossy2.
+*/
+typedef enum sox_encodings_flags_t {
+ sox_encodings_none = 0, /**< no flags specified (implies lossless encoding) = 0. */
+ sox_encodings_lossy1 = 1, /**< encode, decode: lossy once = 1. */
+ sox_encodings_lossy2 = 2 /**< encode, decode, encode, decode: lossy twice = 2. */
+} sox_encodings_flags_t;
+
+/**
+Client API:
+Type of plot.
+*/
+typedef enum sox_plot_t {
+ sox_plot_off, /**< No plot = 0. */
+ sox_plot_octave, /**< Octave plot = 1. */
+ sox_plot_gnuplot, /**< Gnuplot plot = 2. */
+ sox_plot_data /**< Plot data = 3. */
+} sox_plot_t;
+
+/**
+Client API:
+Loop modes: upper 4 bits mask the loop blass, lower 4 bits describe
+the loop behaviour, for example single shot, bidirectional etc.
+*/
+enum sox_loop_flags_t {
+ sox_loop_none = 0, /**< single-shot = 0 */
+ sox_loop_forward = 1, /**< forward loop = 1 */
+ sox_loop_forward_back = 2, /**< forward/back loop = 2 */
+ sox_loop_8 = 32, /**< 8 loops (??) = 32 */
+ sox_loop_sustain_decay = 64 /**< AIFF style, one sustain & one decay loop = 64 */
+};
+
+/**
+Plugins API:
+Is file a real file, a pipe, or a url?
+*/
+typedef enum lsx_io_type
+{
+ lsx_io_file, /**< File is a real file = 0. */
+ lsx_io_pipe, /**< File is a pipe (no seeking) = 1. */
+ lsx_io_url /**< File is a URL (no seeking) = 2. */
+} lsx_io_type;
+
+/*****************************************************************************
+Macros:
+*****************************************************************************/
+
+/**
+Client API:
+Compute a 32-bit integer API version from three 8-bit parts.
+@param a Major version.
+@param b Minor version.
+@param c Revision or build number.
+@returns 32-bit integer API version 0x000a0b0c.
+*/
+#define SOX_LIB_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+
+/**
+Client API:
+The API version of the sox.h file. It is not meant to follow the version
+number of SoX but it has historically. Please do not count on
+SOX_LIB_VERSION_CODE staying in sync with the libSoX version.
+*/
+#define SOX_LIB_VERSION_CODE SOX_LIB_VERSION(14, 4, 2)
+
+/**
+Client API:
+Returns the smallest (negative) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer;
+for example, SOX_INT_MIN(8) = 0x80, SOX_INT_MIN(16) = 0x8000, etc.
+@param bits Size of value for which to calculate minimum.
+@returns the smallest (negative) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer.
+*/
+#define SOX_INT_MIN(bits) (1 <<((bits)-1))
+
+/**
+Client API:
+Returns the largest (positive) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer;
+for example, SOX_INT_MAX(8) = 0x7F, SOX_INT_MAX(16) = 0x7FFF, etc.
+@param bits Size of value for which to calculate maximum.
+@returns the largest (positive) value storable in a twos-complement signed
+integer with the specified number of bits, cast to an unsigned integer.
+*/
+#define SOX_INT_MAX(bits) (((unsigned)-1)>>(33-(bits)))
+
+/**
+Client API:
+Returns the largest value storable in an unsigned integer with the specified
+number of bits; for example, SOX_UINT_MAX(8) = 0xFF,
+SOX_UINT_MAX(16) = 0xFFFF, etc.
+@param bits Size of value for which to calculate maximum.
+@returns the largest value storable in an unsigned integer with the specified
+number of bits.
+*/
+#define SOX_UINT_MAX(bits) (SOX_INT_MIN(bits)|SOX_INT_MAX(bits))
+
+/**
+Client API:
+Returns 0x7F.
+*/
+#define SOX_INT8_MAX SOX_INT_MAX(8)
+
+/**
+Client API:
+Returns 0x7FFF.
+*/
+#define SOX_INT16_MAX SOX_INT_MAX(16)
+
+/**
+Client API:
+Returns 0x7FFFFF.
+*/
+#define SOX_INT24_MAX SOX_INT_MAX(24)
+
+/**
+Client API:
+Returns 0x7FFFFFFF.
+*/
+#define SOX_INT32_MAX SOX_INT_MAX(32)
+
+/**
+Client API:
+Bits in a sox_sample_t = 32.
+*/
+#define SOX_SAMPLE_PRECISION 32
+
+/**
+Client API:
+Max value for sox_sample_t = 0x7FFFFFFF.
+*/
+#define SOX_SAMPLE_MAX (sox_sample_t)SOX_INT_MAX(32)
+
+/**
+Client API:
+Min value for sox_sample_t = 0x80000000.
+*/
+#define SOX_SAMPLE_MIN (sox_sample_t)SOX_INT_MIN(32)
+
+
+/* Conversions: Linear PCM <--> sox_sample_t
+ *
+ * I/O Input sox_sample_t Clips? Input sox_sample_t Clips?
+ * Format Minimum Minimum I O Maximum Maximum I O
+ * ------ --------- ------------ -- -- -------- ------------ -- --
+ * Float -inf -1 y n inf 1 - 5e-10 y n
+ * Int8 -128 -128 n n 127 127.9999999 n y
+ * Int16 -32768 -32768 n n 32767 32767.99998 n y
+ * Int24 -8388608 -8388608 n n 8388607 8388607.996 n y
+ * Int32 -2147483648 -2147483648 n n 2147483647 2147483647 n n
+ *
+ * Conversions are as accurate as possible (with rounding).
+ *
+ * Rounding: halves toward +inf, all others to nearest integer.
+ *
+ * Clips? shows whether on not there is the possibility of a conversion
+ * clipping to the minimum or maximum value when inputing from or outputing
+ * to a given type.
+ *
+ * Unsigned integers are converted to and from signed integers by flipping
+ * the upper-most bit then treating them as signed integers.
+ */
+
+/**
+Client API:
+Declares the temporary local variables that are required when using SOX
+conversion macros.
+*/
+#define SOX_SAMPLE_LOCALS sox_sample_t sox_macro_temp_sample LSX_UNUSED; \
+ double sox_macro_temp_double LSX_UNUSED
+
+/**
+Client API:
+Sign bit for sox_sample_t = 0x80000000.
+*/
+#define SOX_SAMPLE_NEG SOX_INT_MIN(32)
+
+/**
+Client API:
+Converts sox_sample_t to an unsigned integer of width (bits).
+@param bits Width of resulting sample (1 through 32).
+@param d Input sample to be converted.
+@param clips Variable that is incremented if the result is too big.
+@returns Unsigned integer of width (bits).
+*/
+#define SOX_SAMPLE_TO_UNSIGNED(bits,d,clips) \
+ (sox_uint##bits##_t)(SOX_SAMPLE_TO_SIGNED(bits,d,clips)^SOX_INT_MIN(bits))
+
+/**
+Client API:
+Converts sox_sample_t to a signed integer of width (bits).
+@param bits Width of resulting sample (1 through 32).
+@param d Input sample to be converted.
+@param clips Variable that is incremented if the result is too big.
+@returns Signed integer of width (bits).
+*/
+#define SOX_SAMPLE_TO_SIGNED(bits,d,clips) \
+ (sox_int##bits##_t)(LSX_USE_VAR(sox_macro_temp_double),sox_macro_temp_sample=(d),sox_macro_temp_sample>SOX_SAMPLE_MAX-(1<<(31-bits))?++(clips),SOX_INT_MAX(bits):((sox_uint32_t)(sox_macro_temp_sample+(1<<(31-bits))))>>(32-bits))
+
+/**
+Client API:
+Converts signed integer of width (bits) to sox_sample_t.
+@param bits Width of input sample (1 through 32).
+@param d Input sample to be converted.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_TO_SAMPLE(bits,d)((sox_sample_t)(d)<<(32-bits))
+
+/**
+Client API:
+Converts unsigned integer of width (bits) to sox_sample_t.
+@param bits Width of input sample (1 through 32).
+@param d Input sample to be converted.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_TO_SAMPLE(bits,d)(SOX_SIGNED_TO_SAMPLE(bits,d)^SOX_SAMPLE_NEG)
+
+/**
+Client API:
+Converts unsigned 8-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_8BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(8,d)
+
+/**
+Client API:
+Converts signed 8-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_8BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(8,d)
+
+/**
+Client API:
+Converts unsigned 16-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_16BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(16,d)
+
+/**
+Client API:
+Converts signed 16-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_16BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(16,d)
+
+/**
+Client API:
+Converts unsigned 24-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_24BIT_TO_SAMPLE(d,clips) SOX_UNSIGNED_TO_SAMPLE(24,d)
+
+/**
+Client API:
+Converts signed 24-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_24BIT_TO_SAMPLE(d,clips) SOX_SIGNED_TO_SAMPLE(24,d)
+
+/**
+Client API:
+Converts unsigned 32-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_UNSIGNED_32BIT_TO_SAMPLE(d,clips) ((sox_sample_t)(d)^SOX_SAMPLE_NEG)
+
+/**
+Client API:
+Converts signed 32-bit integer to sox_sample_t.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+@returns SoX native sample value.
+*/
+#define SOX_SIGNED_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(d)
+
+/**
+Client API:
+Converts 32-bit float to sox_sample_t.
+@param d Input sample to be converted, range [-1, 1).
+@param clips Variable to increment if the input sample is too large or too small.
+@returns SoX native sample value.
+*/
+#define SOX_FLOAT_32BIT_TO_SAMPLE(d,clips) (sox_sample_t)(LSX_USE_VAR(sox_macro_temp_sample),sox_macro_temp_double=(d)*(SOX_SAMPLE_MAX+1.),sox_macro_temp_double<SOX_SAMPLE_MIN?++(clips),SOX_SAMPLE_MIN:sox_macro_temp_double>=SOX_SAMPLE_MAX+1.?sox_macro_temp_double>SOX_SAMPLE_MAX+1.?++(clips),SOX_SAMPLE_MAX:SOX_SAMPLE_MAX:sox_macro_temp_double)
+
+/**
+Client API:
+Converts 64-bit float to sox_sample_t.
+@param d Input sample to be converted, range [-1, 1).
+@param clips Variable to increment if the input sample is too large or too small.
+@returns SoX native sample value.
+*/
+#define SOX_FLOAT_64BIT_TO_SAMPLE(d,clips) (sox_sample_t)(LSX_USE_VAR(sox_macro_temp_sample),sox_macro_temp_double=(d)*(SOX_SAMPLE_MAX+1.),sox_macro_temp_double<0?sox_macro_temp_double<=SOX_SAMPLE_MIN-.5?++(clips),SOX_SAMPLE_MIN:sox_macro_temp_double-.5:sox_macro_temp_double>=SOX_SAMPLE_MAX+.5?sox_macro_temp_double>SOX_SAMPLE_MAX+1.?++(clips),SOX_SAMPLE_MAX:SOX_SAMPLE_MAX:sox_macro_temp_double+.5)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 8-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_8BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(8,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an signed 8-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_SIGNED_8BIT(d,clips) SOX_SAMPLE_TO_SIGNED(8,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 16-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_16BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(16,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to a signed 16-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_SIGNED_16BIT(d,clips) SOX_SAMPLE_TO_SIGNED(16,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 24-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_24BIT(d,clips) SOX_SAMPLE_TO_UNSIGNED(24,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to a signed 24-bit integer.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_SIGNED_24BIT(d,clips) SOX_SAMPLE_TO_SIGNED(24,d,clips)
+
+/**
+Client API:
+Converts SoX native sample to an unsigned 32-bit integer.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+*/
+#define SOX_SAMPLE_TO_UNSIGNED_32BIT(d,clips) (sox_uint32_t)((d)^SOX_SAMPLE_NEG)
+
+/**
+Client API:
+Converts SoX native sample to a signed 32-bit integer.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+*/
+#define SOX_SAMPLE_TO_SIGNED_32BIT(d,clips) (sox_int32_t)(d)
+
+/**
+Client API:
+Converts SoX native sample to a 32-bit float.
+@param d Input sample to be converted.
+@param clips Variable to increment if input sample is too large.
+*/
+#define SOX_SAMPLE_TO_FLOAT_32BIT(d,clips) (LSX_USE_VAR(sox_macro_temp_double),sox_macro_temp_sample=(d),sox_macro_temp_sample>SOX_SAMPLE_MAX-64?++(clips),1:(((sox_macro_temp_sample+64)&~127)*(1./(SOX_SAMPLE_MAX+1.))))
+
+/**
+Client API:
+Converts SoX native sample to a 64-bit float.
+@param d Input sample to be converted.
+@param clips The parameter is not used.
+*/
+#define SOX_SAMPLE_TO_FLOAT_64BIT(d,clips) ((d)*(1./(SOX_SAMPLE_MAX+1.)))
+
+/**
+Client API:
+Clips a value of a type that is larger then sox_sample_t (for example, int64)
+to sox_sample_t's limits and increment a counter if clipping occurs.
+@param samp Value (lvalue) to be clipped, updated as necessary.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+*/
+#define SOX_SAMPLE_CLIP_COUNT(samp, clips) \
+ do { \
+ if (samp > SOX_SAMPLE_MAX) \
+ { samp = SOX_SAMPLE_MAX; clips++; } \
+ else if (samp < SOX_SAMPLE_MIN) \
+ { samp = SOX_SAMPLE_MIN; clips++; } \
+ } while (0)
+
+/**
+Client API:
+Clips a value of a type that is larger then sox_sample_t (for example, int64)
+to sox_sample_t's limits and increment a counter if clipping occurs.
+@param d Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_ROUND_CLIP_COUNT(d, clips) \
+ ((d) < 0? (d) <= SOX_SAMPLE_MIN - 0.5? ++(clips), SOX_SAMPLE_MIN: (d) - 0.5 \
+ : (d) >= SOX_SAMPLE_MAX + 0.5? ++(clips), SOX_SAMPLE_MAX: (d) + 0.5)
+
+/**
+Client API:
+Clips a value to the limits of a signed integer of the specified width
+and increment a counter if clipping occurs.
+@param bits Width (in bits) of target integer type.
+@param i Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_INTEGER_CLIP_COUNT(bits,i,clips) ( \
+ (i) >(1 << ((bits)-1))- 1? ++(clips),(1 << ((bits)-1))- 1 : \
+ (i) <-1 << ((bits)-1) ? ++(clips),-1 << ((bits)-1) : (i))
+
+/**
+Client API:
+Clips a value to the limits of a 16-bit signed integer and increment a counter
+if clipping occurs.
+@param i Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_16BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(16,i,clips)
+
+/**
+Client API:
+Clips a value to the limits of a 24-bit signed integer and increment a counter
+if clipping occurs.
+@param i Value (rvalue) to be clipped.
+@param clips Value (lvalue) that is incremented if clipping is needed.
+@returns Clipped value.
+*/
+#define SOX_24BIT_CLIP_COUNT(i,clips) SOX_INTEGER_CLIP_COUNT(24,i,clips)
+
+#define SOX_SIZE_MAX ((size_t)(-1)) /**< Client API: Maximum value of size_t. */
+
+#define SOX_UNSPEC 0 /**< Client API: Members of sox_signalinfo_t are set to SOX_UNSPEC (= 0) if the actual value is not yet known. */
+#define SOX_UNKNOWN_LEN (sox_uint64_t)(-1) /**< Client API: sox_signalinfo_t.length is set to SOX_UNKNOWN_LEN (= -1) within the effects chain if the actual length is not known. Format handlers currently use SOX_UNSPEC instead. */
+#define SOX_IGNORE_LENGTH (sox_uint64_t)(-2) /**< Client API: sox_signalinfo_t.length is set to SOX_IGNORE_LENGTH (= -2) to indicate that a format handler should ignore length information in file headers. */
+
+#define SOX_DEFAULT_CHANNELS 2 /**< Client API: Default channel count is 2 (stereo). */
+#define SOX_DEFAULT_RATE 48000 /**< Client API: Default rate is 48000Hz. */
+#define SOX_DEFAULT_PRECISION 16 /**< Client API: Default precision is 16 bits per sample. */
+#define SOX_DEFAULT_ENCODING SOX_ENCODING_SIGN2 /**< Client API: Default encoding is SIGN2 (linear 2's complement PCM). */
+
+#define SOX_LOOP_NONE ((unsigned char)sox_loop_none) /**< Client API: single-shot = 0 */
+#define SOX_LOOP_8 ((unsigned char)sox_loop_8) /**< Client API: 8 loops = 32 */
+#define SOX_LOOP_SUSTAIN_DECAY ((unsigned char)sox_loop_sustain_decay) /**< Client API: AIFF style, one sustain & one decay loop = 64 */
+
+#define SOX_MAX_NLOOPS 8 /**< Client API: Maximum number of loops supported by sox_oob_t = 8. */
+
+#define SOX_FILE_NOSTDIO 0x0001 /**< Client API: Does not use stdio routines */
+#define SOX_FILE_DEVICE 0x0002 /**< Client API: File is an audio device */
+#define SOX_FILE_PHONY 0x0004 /**< Client API: Phony file/device (for example /dev/null) */
+#define SOX_FILE_REWIND 0x0008 /**< Client API: File should be rewound to write header */
+#define SOX_FILE_BIT_REV 0x0010 /**< Client API: Is file bit-reversed? */
+#define SOX_FILE_NIB_REV 0x0020 /**< Client API: Is file nibble-reversed? */
+#define SOX_FILE_ENDIAN 0x0040 /**< Client API: Is file format endian? */
+#define SOX_FILE_ENDBIG 0x0080 /**< Client API: For endian file format, is it big endian? */
+#define SOX_FILE_MONO 0x0100 /**< Client API: Do channel restrictions allow mono? */
+#define SOX_FILE_STEREO 0x0200 /**< Client API: Do channel restrictions allow stereo? */
+#define SOX_FILE_QUAD 0x0400 /**< Client API: Do channel restrictions allow quad? */
+
+#define SOX_FILE_CHANS (SOX_FILE_MONO | SOX_FILE_STEREO | SOX_FILE_QUAD) /**< Client API: No channel restrictions */
+#define SOX_FILE_LIT_END (SOX_FILE_ENDIAN | 0) /**< Client API: File is little-endian */
+#define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG) /**< Client API: File is big-endian */
+
+#define SOX_EFF_CHAN 1 /**< Client API: Effect might alter the number of channels */
+#define SOX_EFF_RATE 2 /**< Client API: Effect might alter sample rate */
+#define SOX_EFF_PREC 4 /**< Client API: Effect does its own calculation of output sample precision (otherwise a default value is taken, depending on the presence of SOX_EFF_MODIFY) */
+#define SOX_EFF_LENGTH 8 /**< Client API: Effect might alter audio length (as measured in time units, not necessarily in samples) */
+#define SOX_EFF_MCHAN 16 /**< Client API: Effect handles multiple channels internally */
+#define SOX_EFF_NULL 32 /**< Client API: Effect does nothing (can be optimized out of chain) */
+#define SOX_EFF_DEPRECATED 64 /**< Client API: Effect will soon be removed from SoX */
+#define SOX_EFF_GAIN 128 /**< Client API: Effect does not support gain -r */
+#define SOX_EFF_MODIFY 256 /**< Client API: Effect does not modify sample values (but might remove or duplicate samples or insert zeros) */
+#define SOX_EFF_ALPHA 512 /**< Client API: Effect is experimental/incomplete */
+#define SOX_EFF_INTERNAL 1024 /**< Client API: Effect present in libSoX but not valid for use by SoX command-line tools */
+
+/**
+Client API:
+When used as the "whence" parameter of sox_seek, indicates that the specified
+offset is relative to the beginning of the file.
+*/
+#define SOX_SEEK_SET 0
+
+/*****************************************************************************
+Forward declarations:
+*****************************************************************************/
+
+typedef struct sox_format_t sox_format_t;
+typedef struct sox_effect_t sox_effect_t;
+typedef struct sox_effect_handler_t sox_effect_handler_t;
+typedef struct sox_format_handler_t sox_format_handler_t;
+
+/*****************************************************************************
+Function pointers:
+*****************************************************************************/
+
+/**
+Client API:
+Callback to write a message to an output device (console or log file),
+used by sox_globals_t.output_message_handler.
+*/
+typedef void (LSX_API * sox_output_message_handler_t)(
+ unsigned level, /**< 1 = FAIL, 2 = WARN, 3 = INFO, 4 = DEBUG, 5 = DEBUG_MORE, 6 = DEBUG_MOST. */
+ LSX_PARAM_IN_Z char const * filename, /**< Source code __FILENAME__ from which message originates. */
+ LSX_PARAM_IN_PRINTF char const * fmt, /**< Message format string. */
+ LSX_PARAM_IN va_list ap /**< Message format parameters. */
+ );
+
+/**
+Client API:
+Callback to retrieve information about a format handler,
+used by sox_format_tab_t.fn.
+@returns format handler information.
+*/
+typedef sox_format_handler_t const * (LSX_API * sox_format_fn_t)(void);
+
+/**
+Client API:
+Callback to get information about an effect handler,
+used by the table returned from sox_get_effect_fns(void).
+@returns Pointer to information about an effect handler.
+*/
+typedef sox_effect_handler_t const * (LSX_API *sox_effect_fn_t)(void);
+
+/**
+Client API:
+Callback to initialize reader (decoder), used by
+sox_format_handler.startread.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_startread)(
+ LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+ );
+
+/**
+Client API:
+Callback to read (decode) a block of samples,
+used by sox_format_handler.read.
+@returns number of samples read, or 0 if unsuccessful.
+*/
+typedef size_t (LSX_API * sox_format_handler_read)(
+ LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+ LSX_PARAM_OUT_CAP_POST_COUNT(len,return) sox_sample_t *buf, /**< Buffer from which to read samples. */
+ size_t len /**< Number of samples available in buf. */
+ );
+
+/**
+Client API:
+Callback to close reader (decoder),
+used by sox_format_handler.stopread.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_stopread)(
+ LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+ );
+
+/**
+Client API:
+Callback to initialize writer (encoder),
+used by sox_format_handler.startwrite.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_startwrite)(
+ LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+ );
+
+/**
+Client API:
+Callback to write (encode) a block of samples,
+used by sox_format_handler.write.
+@returns number of samples written, or 0 if unsuccessful.
+*/
+typedef size_t (LSX_API * sox_format_handler_write)(
+ LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+ LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf, /**< Buffer to which samples are written. */
+ size_t len /**< Capacity of buf, measured in samples. */
+ );
+
+/**
+Client API:
+Callback to close writer (decoder),
+used by sox_format_handler.stopwrite.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_stopwrite)(
+ LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+ );
+
+/**
+Client API:
+Callback to reposition reader,
+used by sox_format_handler.seek.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_format_handler_seek)(
+ LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+ sox_uint64_t offset /**< Sample offset to which reader should be positioned. */
+ );
+
+/**
+Client API:
+Callback to parse command-line arguments (called once per effect),
+used by sox_effect_handler.getopts.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_getopts)(
+ LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect pointer. */
+ int argc, /**< Number of arguments in argv. */
+ LSX_PARAM_IN_COUNT(argc) char *argv[] /**< Array of command-line arguments. */
+ );
+
+/**
+Client API:
+Callback to initialize effect (called once per flow),
+used by sox_effect_handler.start.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_start)(
+ LSX_PARAM_INOUT sox_effect_t * effp /**< Effect pointer. */
+ );
+
+/**
+Client API:
+Callback to process samples,
+used by sox_effect_handler.flow.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_flow)(
+ LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect pointer. */
+ LSX_PARAM_IN_COUNT(*isamp) sox_sample_t const * ibuf, /**< Buffer from which to read samples. */
+ LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t * obuf, /**< Buffer to which samples are written. */
+ LSX_PARAM_INOUT size_t *isamp, /**< On entry, contains capacity of ibuf; on exit, contains number of samples consumed. */
+ LSX_PARAM_INOUT size_t *osamp /**< On entry, contains capacity of obuf; on exit, contains number of samples written. */
+ );
+
+/**
+Client API:
+Callback to finish getting output after input is complete,
+used by sox_effect_handler.drain.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_drain)(
+ LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect pointer. */
+ LSX_PARAM_OUT_CAP_POST_COUNT(*osamp,*osamp) sox_sample_t *obuf, /**< Buffer to which samples are written. */
+ LSX_PARAM_INOUT size_t *osamp /**< On entry, contains capacity of obuf; on exit, contains number of samples written. */
+ );
+
+/**
+Client API:
+Callback to shut down effect (called once per flow),
+used by sox_effect_handler.stop.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_stop)(
+ LSX_PARAM_INOUT sox_effect_t * effp /**< Effect pointer. */
+ );
+
+/**
+Client API:
+Callback to shut down effect (called once per effect),
+used by sox_effect_handler.kill.
+@returns SOX_SUCCESS if successful.
+*/
+typedef int (LSX_API * sox_effect_handler_kill)(
+ LSX_PARAM_INOUT sox_effect_t * effp /**< Effect pointer. */
+ );
+
+/**
+Client API:
+Callback called while flow is running (called once per buffer),
+used by sox_flow_effects.callback.
+@returns SOX_SUCCESS to continue, other value to abort flow.
+*/
+typedef int (LSX_API * sox_flow_effects_callback)(
+ sox_bool all_done,
+ void * client_data
+ );
+
+/**
+Client API:
+Callback for enumerating the contents of a playlist,
+used by the sox_parse_playlist function.
+@returns SOX_SUCCESS if successful, any other value to abort playlist enumeration.
+*/
+typedef int (LSX_API * sox_playlist_callback_t)(
+ void * callback_data,
+ LSX_PARAM_IN_Z char const * filename
+ );
+
+/*****************************************************************************
+Structures:
+*****************************************************************************/
+
+/**
+Client API:
+Information about a build of libSoX, returned from the sox_version_info
+function.
+*/
+typedef struct sox_version_info_t {
+ size_t size; /**< structure size = sizeof(sox_version_info_t) */
+ sox_version_flags_t flags; /**< feature flags = popen | magic | threads | memopen */
+ sox_uint32_t version_code; /**< version number = 0x140400 */
+ char const * version; /**< version string = sox_version(), for example, "14.4.0" */
+ char const * version_extra;/**< version extra info or null = "PACKAGE_EXTRA", for example, "beta" */
+ char const * time; /**< build time = "__DATE__ __TIME__", for example, "Jan 7 2010 03:31:50" */
+ char const * distro; /**< distro or null = "DISTRO", for example, "Debian" */
+ char const * compiler; /**< compiler info or null, for example, "msvc 160040219" */
+ char const * arch; /**< arch, for example, "1248 48 44 L OMP" */
+ /* new info should be added at the end for version backwards-compatibility. */
+} sox_version_info_t;
+
+/**
+Client API:
+Global parameters (for effects & formats), returned from the sox_get_globals
+function.
+*/
+typedef struct sox_globals_t {
+/* public: */
+ unsigned verbosity; /**< messages are only written if globals.verbosity >= message.level */
+ sox_output_message_handler_t output_message_handler; /**< client-specified message output callback */
+ sox_bool repeatable; /**< true to use pre-determined timestamps and PRNG seed */
+
+ /**
+ Default size (in bytes) used by libSoX for blocks of sample data.
+ Plugins should use similarly-sized buffers to get best performance.
+ */
+ size_t bufsiz;
+
+ /**
+ Default size (in bytes) used by libSoX for blocks of input sample data.
+ Plugins should use similarly-sized buffers to get best performance.
+ */
+ size_t input_bufsiz;
+
+ sox_int32_t ranqd1; /**< Can be used to re-seed libSoX's PRNG */
+
+ char const * stdin_in_use_by; /**< Private: tracks the name of the handler currently using stdin */
+ char const * stdout_in_use_by; /**< Private: tracks the name of the handler currently using stdout */
+ char const * subsystem; /**< Private: tracks the name of the handler currently writing an output message */
+ char * tmp_path; /**< Private: client-configured path to use for temporary files */
+ sox_bool use_magic; /**< Private: true if client has requested use of 'magic' file-type detection */
+ sox_bool use_threads; /**< Private: true if client has requested parallel effects processing */
+
+ /**
+ Log to base 2 of minimum size (in bytes) used by libSoX for DFT (filtering).
+ Plugins should use similarly-sized DFTs to get best performance.
+ */
+ size_t log2_dft_min_size;
+} sox_globals_t;
+
+/**
+Client API:
+Signal parameters; members should be set to SOX_UNSPEC (= 0) if unknown.
+*/
+typedef struct sox_signalinfo_t {
+ sox_rate_t rate; /**< samples per second, 0 if unknown */
+ unsigned channels; /**< number of sound channels, 0 if unknown */
+ unsigned precision; /**< bits per sample, 0 if unknown */
+ sox_uint64_t length; /**< samples * chans in file, 0 if unknown, -1 if unspecified */
+ double * mult; /**< Effects headroom multiplier; may be null */
+} sox_signalinfo_t;
+
+/**
+Client API:
+Basic information about an encoding.
+*/
+typedef struct sox_encodings_info_t {
+ sox_encodings_flags_t flags; /**< lossy once (lossy1), lossy twice (lossy2), or lossless (none). */
+ char const * name; /**< encoding name. */
+ char const * desc; /**< encoding description. */
+} sox_encodings_info_t;
+
+/**
+Client API:
+Encoding parameters.
+*/
+typedef struct sox_encodinginfo_t {
+ sox_encoding_t encoding; /**< format of sample numbers */
+ unsigned bits_per_sample;/**< 0 if unknown or variable; uncompressed value if lossless; compressed value if lossy */
+ double compression; /**< compression factor (where applicable) */
+
+ /**
+ Should bytes be reversed? If this is default during sox_open_read or
+ sox_open_write, libSoX will set them to either no or yes according to the
+ machine or format default.
+ */
+ sox_option_t reverse_bytes;
+
+ /**
+ Should nibbles be reversed? If this is default during sox_open_read or
+ sox_open_write, libSoX will set them to either no or yes according to the
+ machine or format default.
+ */
+ sox_option_t reverse_nibbles;
+
+ /**
+ Should bits be reversed? If this is default during sox_open_read or
+ sox_open_write, libSoX will set them to either no or yes according to the
+ machine or format default.
+ */
+ sox_option_t reverse_bits;
+
+ /**
+ If set to true, the format should reverse its default endianness.
+ */
+ sox_bool opposite_endian;
+} sox_encodinginfo_t;
+
+/**
+Client API:
+Looping parameters (out-of-band data).
+*/
+typedef struct sox_loopinfo_t {
+ sox_uint64_t start; /**< first sample */
+ sox_uint64_t length; /**< length */
+ unsigned count; /**< number of repeats, 0=forever */
+ unsigned char type; /**< 0=no, 1=forward, 2=forward/back (see sox_loop_* for valid values). */
+} sox_loopinfo_t;
+
+/**
+Client API:
+Instrument information.
+*/
+typedef struct sox_instrinfo_t{
+ signed char MIDInote; /**< for unity pitch playback */
+ signed char MIDIlow; /**< MIDI pitch-bend low range */
+ signed char MIDIhi; /**< MIDI pitch-bend high range */
+ unsigned char loopmode; /**< 0=no, 1=forward, 2=forward/back (see sox_loop_* values) */
+ unsigned nloops; /**< number of active loops (max SOX_MAX_NLOOPS). */
+} sox_instrinfo_t;
+
+/**
+Client API:
+File buffer info. Holds info so that data can be read in blocks.
+*/
+typedef struct sox_fileinfo_t {
+ char *buf; /**< Pointer to data buffer */
+ size_t size; /**< Size of buffer in bytes */
+ size_t count; /**< Count read into buffer */
+ size_t pos; /**< Position in buffer */
+} sox_fileinfo_t;
+
+/**
+Client API:
+Handler structure defined by each format.
+*/
+struct sox_format_handler_t {
+ unsigned sox_lib_version_code; /**< Checked on load; must be 1st in struct*/
+ char const * description; /**< short description of format */
+ char const * const * names; /**< null-terminated array of filename extensions that are handled by this format */
+ unsigned int flags; /**< File flags (SOX_FILE_* values). */
+ sox_format_handler_startread startread; /**< called to initialize reader (decoder) */
+ sox_format_handler_read read; /**< called to read (decode) a block of samples */
+ sox_format_handler_stopread stopread; /**< called to close reader (decoder); may be null if no closing necessary */
+ sox_format_handler_startwrite startwrite; /**< called to initialize writer (encoder) */
+ sox_format_handler_write write; /**< called to write (encode) a block of samples */
+ sox_format_handler_stopwrite stopwrite; /**< called to close writer (decoder); may be null if no closing necessary */
+ sox_format_handler_seek seek; /**< called to reposition reader; may be null if not supported */
+
+ /**
+ Array of values indicating the encodings and precisions supported for
+ writing (encoding). Precisions specified with default precision first.
+ Encoding, precision, precision, ..., 0, repeat. End with one more 0.
+ Example:
+ unsigned const * formats = {
+ SOX_ENCODING_SIGN2, 16, 24, 0, // Support SIGN2 at 16 and 24 bits, default to 16 bits.
+ SOX_ENCODING_UNSIGNED, 8, 0, // Support UNSIGNED at 8 bits, default to 8 bits.
+ 0 // No more supported encodings.
+ };
+ */
+ unsigned const * write_formats;
+
+ /**
+ Array of sample rates (samples per second) supported for writing (encoding).
+ NULL if all (or almost all) rates are supported. End with 0.
+ */
+ sox_rate_t const * write_rates;
+
+ /**
+ SoX will automatically allocate a buffer in which the handler can store data.
+ Specify the size of the buffer needed here. Usually this will be sizeof(your_struct).
+ The buffer will be allocated and zeroed before the call to startread/startwrite.
+ The buffer will be freed after the call to stopread/stopwrite.
+ The buffer will be provided via format.priv in each call to the handler.
+ */
+ size_t priv_size;
+};
+
+/**
+Client API:
+Comments, instrument info, loop info (out-of-band data).
+*/
+typedef struct sox_oob_t{
+ /* Decoded: */
+ sox_comments_t comments; /**< Comment strings in id=value format. */
+ sox_instrinfo_t instr; /**< Instrument specification */
+ sox_loopinfo_t loops[SOX_MAX_NLOOPS]; /**< Looping specification */
+
+ /* TBD: Non-decoded chunks, etc: */
+} sox_oob_t;
+
+/**
+Client API:
+Data passed to/from the format handler
+*/
+struct sox_format_t {
+ char * filename; /**< File name */
+
+ /**
+ Signal specifications for reader (decoder) or writer (encoder):
+ sample rate, number of channels, precision, length, headroom multiplier.
+ Any info specified by the user is here on entry to startread or
+ startwrite. Info will be SOX_UNSPEC if the user provided no info.
+ At exit from startread, should be completely filled in, using
+ either data from the file's headers (if available) or whatever
+ the format is guessing/assuming (if header data is not available).
+ At exit from startwrite, should be completely filled in, using
+ either the data that was specified, or values chosen by the format
+ based on the format's defaults or capabilities.
+ */
+ sox_signalinfo_t signal;
+
+ /**
+ Encoding specifications for reader (decoder) or writer (encoder):
+ encoding (sample format), bits per sample, compression rate, endianness.
+ Should be filled in by startread. Values specified should be used
+ by startwrite when it is configuring the encoding parameters.
+ */
+ sox_encodinginfo_t encoding;
+
+ char * filetype; /**< Type of file, as determined by header inspection or libmagic. */
+ sox_oob_t oob; /**< comments, instrument info, loop info (out-of-band data) */
+ sox_bool seekable; /**< Can seek on this file */
+ char mode; /**< Read or write mode ('r' or 'w') */
+ sox_uint64_t olength; /**< Samples * chans written to file */
+ sox_uint64_t clips; /**< Incremented if clipping occurs */
+ int sox_errno; /**< Failure error code */
+ char sox_errstr[256]; /**< Failure error text */
+ void * fp; /**< File stream pointer */
+ lsx_io_type io_type; /**< Stores whether this is a file, pipe or URL */
+ sox_uint64_t tell_off; /**< Current offset within file */
+ sox_uint64_t data_start; /**< Offset at which headers end and sound data begins (set by lsx_check_read_params) */
+ sox_format_handler_t handler; /**< Format handler for this file */
+ void * priv; /**< Format handler's private data area */
+};
+
+/**
+Client API:
+Information about a loaded format handler, including the format name and a
+function pointer that can be invoked to get additional information about the
+format.
+*/
+typedef struct sox_format_tab_t {
+ char *name; /**< Name of format handler */
+ sox_format_fn_t fn; /**< Function to call to get format handler's information */
+} sox_format_tab_t;
+
+/**
+Client API:
+Global parameters for effects.
+*/
+typedef struct sox_effects_globals_t {
+ sox_plot_t plot; /**< To help the user choose effect & options */
+ sox_globals_t * global_info; /**< Pointer to associated SoX globals */
+} sox_effects_globals_t;
+
+/**
+Client API:
+Effect handler information.
+*/
+struct sox_effect_handler_t {
+ char const * name; /**< Effect name */
+ char const * usage; /**< Short explanation of parameters accepted by effect */
+ unsigned int flags; /**< Combination of SOX_EFF_* flags */
+ sox_effect_handler_getopts getopts; /**< Called to parse command-line arguments (called once per effect). */
+ sox_effect_handler_start start; /**< Called to initialize effect (called once per flow). */
+ sox_effect_handler_flow flow; /**< Called to process samples. */
+ sox_effect_handler_drain drain; /**< Called to finish getting output after input is complete. */
+ sox_effect_handler_stop stop; /**< Called to shut down effect (called once per flow). */
+ sox_effect_handler_kill kill; /**< Called to shut down effect (called once per effect). */
+ size_t priv_size; /**< Size of private data SoX should pre-allocate for effect */
+};
+
+/**
+Client API:
+Effect information.
+*/
+struct sox_effect_t {
+ sox_effects_globals_t * global_info; /**< global effect parameters */
+ sox_signalinfo_t in_signal; /**< Information about the incoming data stream */
+ sox_signalinfo_t out_signal; /**< Information about the outgoing data stream */
+ sox_encodinginfo_t const * in_encoding; /**< Information about the incoming data encoding */
+ sox_encodinginfo_t const * out_encoding; /**< Information about the outgoing data encoding */
+ sox_effect_handler_t handler; /**< The handler for this effect */
+ sox_uint64_t clips; /**< increment if clipping occurs */
+ size_t flows; /**< 1 if MCHAN, number of chans otherwise */
+ size_t flow; /**< flow number */
+ void * priv; /**< Effect's private data area (each flow has a separate copy) */
+ /* The following items are private to the libSoX effects chain functions. */
+ sox_sample_t * obuf; /**< output buffer */
+ size_t obeg; /**< output buffer: start of valid data section */
+ size_t oend; /**< output buffer: one past valid data section (oend-obeg is length of current content) */
+ size_t imin; /**< minimum input buffer content required for calling this effect's flow function; set via lsx_effect_set_imin() */
+};
+
+/**
+Client API:
+Chain of effects to be applied to a stream.
+*/
+typedef struct sox_effects_chain_t {
+ sox_effect_t **effects; /**< Table of effects to be applied to a stream */
+ size_t length; /**< Number of effects to be applied */
+ sox_effects_globals_t global_info; /**< Copy of global effects settings */
+ sox_encodinginfo_t const * in_enc; /**< Input encoding */
+ sox_encodinginfo_t const * out_enc; /**< Output encoding */
+ /* The following items are private to the libSoX effects chain functions. */
+ size_t table_size; /**< Size of effects table (including unused entries) */
+ sox_sample_t *il_buf; /**< Channel interleave buffer */
+} sox_effects_chain_t;
+
+/*****************************************************************************
+Functions:
+*****************************************************************************/
+
+/**
+Client API:
+Returns version number string of libSoX, for example, "14.4.0".
+@returns The version number string of libSoX, for example, "14.4.0".
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+char const *
+LSX_API
+sox_version(void);
+
+/**
+Client API:
+Returns information about this build of libsox.
+@returns Pointer to a version information structure.
+*/
+LSX_RETURN_VALID LSX_RETURN_PURE
+sox_version_info_t const *
+LSX_API
+sox_version_info(void);
+
+/**
+Client API:
+Returns a pointer to the structure with libSoX's global settings.
+@returns a pointer to the structure with libSoX's global settings.
+*/
+LSX_RETURN_VALID LSX_RETURN_PURE
+sox_globals_t *
+LSX_API
+sox_get_globals(void);
+
+/**
+Client API:
+Deprecated macro that returns the structure with libSoX's global settings
+as an lvalue.
+*/
+#define sox_globals (*sox_get_globals())
+
+/**
+Client API:
+Returns a pointer to the list of available encodings.
+End of list indicated by name == NULL.
+@returns pointer to the list of available encodings.
+*/
+LSX_RETURN_ARRAY LSX_RETURN_PURE
+sox_encodings_info_t const *
+LSX_API
+sox_get_encodings_info(void);
+
+/**
+Client API:
+Deprecated macro that returns the list of available encodings.
+End of list indicated by name == NULL.
+*/
+#define sox_encodings_info (sox_get_encodings_info())
+
+/**
+Client API:
+Fills in an encodinginfo with default values.
+*/
+void
+LSX_API
+sox_init_encodinginfo(
+ LSX_PARAM_OUT sox_encodinginfo_t * e /**< Pointer to uninitialized encoding info structure to be initialized. */
+ );
+
+/**
+Client API:
+Given an encoding (for example, SIGN2) and the encoded bits_per_sample (for
+example, 16), returns the number of useful bits per sample in the decoded data
+(for example, 16), or returns 0 to indicate that the value returned by the
+format handler should be used instead of a pre-determined precision.
+@returns the number of useful bits per sample in the decoded data (for example
+16), or returns 0 to indicate that the value returned by the format handler
+should be used instead of a pre-determined precision.
+*/
+LSX_RETURN_PURE
+unsigned
+LSX_API
+sox_precision(
+ sox_encoding_t encoding, /**< Encoding for which to lookup precision information. */
+ unsigned bits_per_sample /**< The number of encoded bits per sample. */
+ );
+
+/**
+Client API:
+Returns the number of items in the metadata block.
+@returns the number of items in the metadata block.
+*/
+size_t
+LSX_API
+sox_num_comments(
+ LSX_PARAM_IN_OPT sox_comments_t comments /**< Metadata block. */
+ );
+
+/**
+Client API:
+Adds an "id=value" item to the metadata block.
+*/
+void
+LSX_API
+sox_append_comment(
+ LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t * comments, /**< Metadata block. */
+ LSX_PARAM_IN_Z char const * item /**< Item to be added in "id=value" format. */
+ );
+
+/**
+Client API:
+Adds a newline-delimited list of "id=value" items to the metadata block.
+*/
+void
+LSX_API
+sox_append_comments(
+ LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NOTNULL sox_comments_t * comments, /**< Metadata block. */
+ LSX_PARAM_IN_Z char const * items /**< Newline-separated list of items to be added, for example "id1=value1\\nid2=value2". */
+ );
+
+/**
+Client API:
+Duplicates the metadata block.
+@returns the copied metadata block.
+*/
+LSX_RETURN_OPT
+sox_comments_t
+LSX_API
+sox_copy_comments(
+ LSX_PARAM_IN_OPT sox_comments_t comments /**< Metadata block to copy. */
+ );
+
+/**
+Client API:
+Frees the metadata block.
+*/
+void
+LSX_API
+sox_delete_comments(
+ LSX_PARAM_DEREF_PRE_MAYBENULL LSX_PARAM_DEREF_POST_NULL sox_comments_t * comments /**< Metadata block. */
+ );
+
+/**
+Client API:
+If "id=value" is found, return value, else return null.
+@returns value, or null if value not found.
+*/
+LSX_RETURN_OPT
+char const *
+LSX_API
+sox_find_comment(
+ LSX_PARAM_IN_OPT sox_comments_t comments, /**< Metadata block in which to search. */
+ LSX_PARAM_IN_Z char const * id /**< Id for which to search */
+ );
+
+/**
+Client API:
+Find and load format handler plugins.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_format_init(void);
+
+/**
+Client API:
+Unload format handler plugins.
+*/
+void
+LSX_API
+sox_format_quit(void);
+
+/**
+Client API:
+Initialize effects library.
+@returns SOX_SUCCESS if successful or already initialized.
+*/
+int
+LSX_API
+sox_init(void);
+
+/**
+Client API:
+Close effects library and unload format handler plugins.
+@returns SOX_SUCCESS if successful or already closed.
+*/
+int
+LSX_API
+sox_quit(void);
+
+/**
+Client API:
+Returns the table of format handler names and functions.
+@returns the table of format handler names and functions.
+*/
+LSX_RETURN_ARRAY LSX_RETURN_PURE
+sox_format_tab_t const *
+LSX_API
+sox_get_format_fns(void);
+
+/**
+Client API:
+Deprecated macro that returns the table of format handler names and functions.
+*/
+#define sox_format_fns (sox_get_format_fns())
+
+/**
+Client API:
+Opens a decoding session for a file. Returned handle must be closed with sox_close().
+@returns The handle for the new session, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_read(
+ LSX_PARAM_IN_Z char const * path, /**< Path to file to be opened (required). */
+ LSX_PARAM_IN_OPT sox_signalinfo_t const * signal, /**< Information already known about audio stream, or NULL if none. */
+ LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding, /**< Information already known about sample encoding, or NULL if none. */
+ LSX_PARAM_IN_OPT_Z char const * filetype /**< Previously-determined file type, or NULL to auto-detect. */
+ );
+
+/**
+Client API:
+Opens a decoding session for a memory buffer. Returned handle must be closed with sox_close().
+@returns The handle for the new session, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_mem_read(
+ LSX_PARAM_IN_BYTECOUNT(buffer_size) void * buffer, /**< Pointer to audio data buffer (required). */
+ size_t buffer_size,/**< Number of bytes to read from audio data buffer. */
+ LSX_PARAM_IN_OPT sox_signalinfo_t const * signal, /**< Information already known about audio stream, or NULL if none. */
+ LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding, /**< Information already known about sample encoding, or NULL if none. */
+ LSX_PARAM_IN_OPT_Z char const * filetype /**< Previously-determined file type, or NULL to auto-detect. */
+ );
+
+/**
+Client API:
+Returns true if the format handler for the specified file type supports the specified encoding.
+@returns true if the format handler for the specified file type supports the specified encoding.
+*/
+sox_bool
+LSX_API
+sox_format_supports_encoding(
+ LSX_PARAM_IN_OPT_Z char const * path, /**< Path to file to be examined (required if filetype is NULL). */
+ LSX_PARAM_IN_OPT_Z char const * filetype, /**< Previously-determined file type, or NULL to use extension from path. */
+ LSX_PARAM_IN sox_encodinginfo_t const * encoding /**< Encoding for which format handler should be queried. */
+ );
+
+/**
+Client API:
+Gets the format handler for a specified file type.
+@returns The found format handler, or null if not found.
+*/
+LSX_RETURN_OPT
+sox_format_handler_t const *
+LSX_API
+sox_write_handler(
+ LSX_PARAM_IN_OPT_Z char const * path, /**< Path to file (required if filetype is NULL). */
+ LSX_PARAM_IN_OPT_Z char const * filetype, /**< Filetype for which handler is needed, or NULL to use extension from path. */
+ LSX_PARAM_OUT_OPT char const * * filetype1 /**< Receives the filetype that was detected. Pass NULL if not needed. */
+ );
+
+/**
+Client API:
+Opens an encoding session for a file. Returned handle must be closed with sox_close().
+@returns The new session handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_write(
+ LSX_PARAM_IN_Z char const * path, /**< Path to file to be written (required). */
+ LSX_PARAM_IN sox_signalinfo_t const * signal, /**< Information about desired audio stream (required). */
+ LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding, /**< Information about desired sample encoding, or NULL to use defaults. */
+ LSX_PARAM_IN_OPT_Z char const * filetype, /**< Previously-determined file type, or NULL to auto-detect. */
+ LSX_PARAM_IN_OPT sox_oob_t const * oob, /**< Out-of-band data to add to file, or NULL if none. */
+ LSX_PARAM_IN_OPT sox_bool (LSX_API * overwrite_permitted)(LSX_PARAM_IN_Z char const * filename) /**< Called if file exists to determine whether overwrite is ok. */
+ );
+
+/**
+Client API:
+Opens an encoding session for a memory buffer. Returned handle must be closed with sox_close().
+@returns The new session handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_mem_write(
+ LSX_PARAM_OUT_BYTECAP(buffer_size) void * buffer, /**< Pointer to audio data buffer that receives data (required). */
+ LSX_PARAM_IN size_t buffer_size, /**< Maximum number of bytes to write to audio data buffer. */
+ LSX_PARAM_IN sox_signalinfo_t const * signal, /**< Information about desired audio stream (required). */
+ LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding, /**< Information about desired sample encoding, or NULL to use defaults. */
+ LSX_PARAM_IN_OPT_Z char const * filetype, /**< Previously-determined file type, or NULL to auto-detect. */
+ LSX_PARAM_IN_OPT sox_oob_t const * oob /**< Out-of-band data to add to file, or NULL if none. */
+ );
+
+/**
+Client API:
+Opens an encoding session for a memstream buffer. Returned handle must be closed with sox_close().
+@returns The new session handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_format_t *
+LSX_API
+sox_open_memstream_write(
+ LSX_PARAM_OUT char * * buffer_ptr, /**< Receives pointer to audio data buffer that receives data (required). */
+ LSX_PARAM_OUT size_t * buffer_size_ptr, /**< Receives size of data written to audio data buffer (required). */
+ LSX_PARAM_IN sox_signalinfo_t const * signal, /**< Information about desired audio stream (required). */
+ LSX_PARAM_IN_OPT sox_encodinginfo_t const * encoding, /**< Information about desired sample encoding, or NULL to use defaults. */
+ LSX_PARAM_IN_OPT_Z char const * filetype, /**< Previously-determined file type, or NULL to auto-detect. */
+ LSX_PARAM_IN_OPT sox_oob_t const * oob /**< Out-of-band data to add to file, or NULL if none. */
+ );
+
+/**
+Client API:
+Reads samples from a decoding session into a sample buffer.
+@returns Number of samples decoded, or 0 for EOF.
+*/
+size_t
+LSX_API
+sox_read(
+ LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+ LSX_PARAM_OUT_CAP_POST_COUNT(len,return) sox_sample_t *buf, /**< Buffer from which to read samples. */
+ size_t len /**< Number of samples available in buf. */
+ );
+
+/**
+Client API:
+Writes samples to an encoding session from a sample buffer.
+@returns Number of samples encoded.
+*/
+size_t
+LSX_API
+sox_write(
+ LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+ LSX_PARAM_IN_COUNT(len) sox_sample_t const * buf, /**< Buffer from which to read samples. */
+ size_t len /**< Number of samples available in buf. */
+ );
+
+/**
+Client API:
+Closes an encoding or decoding session.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_close(
+ LSX_PARAM_INOUT sox_format_t * ft /**< Format pointer. */
+ );
+
+/**
+Client API:
+Sets the location at which next samples will be decoded. Returns SOX_SUCCESS if successful.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_seek(
+ LSX_PARAM_INOUT sox_format_t * ft, /**< Format pointer. */
+ sox_uint64_t offset, /**< Sample offset at which to position reader. */
+ int whence /**< Set to SOX_SEEK_SET. */
+ );
+
+/**
+Client API:
+Finds a format handler by name.
+@returns Format handler data, or null if not found.
+*/
+LSX_RETURN_OPT
+sox_format_handler_t const *
+LSX_API
+sox_find_format(
+ LSX_PARAM_IN_Z char const * name, /**< Name of format handler to find. */
+ sox_bool ignore_devices /**< Set to true to ignore device names. */
+ );
+
+/**
+Client API:
+Returns global parameters for effects
+@returns global parameters for effects.
+*/
+LSX_RETURN_VALID LSX_RETURN_PURE
+sox_effects_globals_t *
+LSX_API
+sox_get_effects_globals(void);
+
+/**
+Client API:
+Deprecated macro that returns global parameters for effects.
+*/
+#define sox_effects_globals (*sox_get_effects_globals())
+
+/**
+Client API:
+Finds the effect handler with the given name.
+@returns Effect pointer, or null if not found.
+*/
+LSX_RETURN_OPT LSX_RETURN_PURE
+sox_effect_handler_t const *
+LSX_API
+sox_find_effect(
+ LSX_PARAM_IN_Z char const * name /**< Name of effect to find. */
+ );
+
+/**
+Client API:
+Creates an effect using the given handler.
+@returns The new effect, or null if not found.
+*/
+LSX_RETURN_OPT
+sox_effect_t *
+LSX_API
+sox_create_effect(
+ LSX_PARAM_IN sox_effect_handler_t const * eh /**< Handler to use for effect. */
+ );
+
+/**
+Client API:
+Applies the command-line options to the effect.
+@returns the number of arguments consumed.
+*/
+int
+LSX_API
+sox_effect_options(
+ LSX_PARAM_IN sox_effect_t *effp, /**< Effect pointer on which to set options. */
+ int argc, /**< Number of arguments in argv. */
+ LSX_PARAM_IN_COUNT(argc) char * const argv[] /**< Array of command-line options. */
+ );
+
+/**
+Client API:
+Returns an array containing the known effect handlers.
+@returns An array containing the known effect handlers.
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+sox_effect_fn_t const *
+LSX_API
+sox_get_effect_fns(void);
+
+/**
+Client API:
+Deprecated macro that returns an array containing the known effect handlers.
+*/
+#define sox_effect_fns (sox_get_effect_fns())
+
+/**
+Client API:
+Initializes an effects chain. Returned handle must be closed with sox_delete_effects_chain().
+@returns Handle, or null on failure.
+*/
+LSX_RETURN_OPT
+sox_effects_chain_t *
+LSX_API
+sox_create_effects_chain(
+ LSX_PARAM_IN sox_encodinginfo_t const * in_enc, /**< Input encoding. */
+ LSX_PARAM_IN sox_encodinginfo_t const * out_enc /**< Output encoding. */
+ );
+
+/**
+Client API:
+Closes an effects chain.
+*/
+void
+LSX_API
+sox_delete_effects_chain(
+ LSX_PARAM_INOUT sox_effects_chain_t *ecp /**< Effects chain pointer. */
+ );
+
+/**
+Client API:
+Adds an effect to the effects chain, returns SOX_SUCCESS if successful.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_add_effect(
+ LSX_PARAM_INOUT sox_effects_chain_t * chain, /**< Effects chain to which effect should be added . */
+ LSX_PARAM_INOUT sox_effect_t * effp, /**< Effect to be added. */
+ LSX_PARAM_INOUT sox_signalinfo_t * in, /**< Input format. */
+ LSX_PARAM_IN sox_signalinfo_t const * out /**< Output format. */
+ );
+
+/**
+Client API:
+Runs the effects chain, returns SOX_SUCCESS if successful.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_flow_effects(
+ LSX_PARAM_INOUT sox_effects_chain_t * chain, /**< Effects chain to run. */
+ LSX_PARAM_IN_OPT sox_flow_effects_callback callback, /**< Callback for monitoring flow progress. */
+ LSX_PARAM_IN_OPT void * client_data /**< Data to pass into callback. */
+ );
+
+/**
+Client API:
+Gets the number of clips that occurred while running an effects chain.
+@returns the number of clips that occurred while running an effects chain.
+*/
+sox_uint64_t
+LSX_API
+sox_effects_clips(
+ LSX_PARAM_IN sox_effects_chain_t * chain /**< Effects chain from which to read clip information. */
+ );
+
+/**
+Client API:
+Shuts down an effect (calls stop on each of its flows).
+@returns the number of clips from all flows.
+*/
+sox_uint64_t
+LSX_API
+sox_stop_effect(
+ LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t * effp /**< Effect to stop. */
+ );
+
+/**
+Client API:
+Adds an already-initialized effect to the end of the chain.
+*/
+void
+LSX_API
+sox_push_effect_last(
+ LSX_PARAM_INOUT sox_effects_chain_t * chain, /**< Effects chain to which effect should be added. */
+ LSX_PARAM_INOUT sox_effect_t * effp /**< Effect to be added. */
+ );
+
+/**
+Client API:
+Removes and returns an effect from the end of the chain.
+@returns the removed effect, or null if no effects.
+*/
+LSX_RETURN_OPT
+sox_effect_t *
+LSX_API
+sox_pop_effect_last(
+ LSX_PARAM_INOUT sox_effects_chain_t *chain /**< Effects chain from which to remove an effect. */
+ );
+
+/**
+Client API:
+Shut down and delete an effect.
+*/
+void
+LSX_API
+sox_delete_effect(
+ LSX_PARAM_INOUT_COUNT(effp->flows) sox_effect_t *effp /**< Effect to be deleted. */
+ );
+
+/**
+Client API:
+Shut down and delete the last effect in the chain.
+*/
+void
+LSX_API
+sox_delete_effect_last(
+ LSX_PARAM_INOUT sox_effects_chain_t *chain /**< Effects chain from which to remove the last effect. */
+ );
+
+/**
+Client API:
+Shut down and delete all effects in the chain.
+*/
+void
+LSX_API
+sox_delete_effects(
+ LSX_PARAM_INOUT sox_effects_chain_t *chain /**< Effects chain from which to delete effects. */
+ );
+
+/**
+Client API:
+Gets the sample offset of the start of the trim, useful for efficiently
+skipping the part that will be trimmed anyway (get trim start, seek, then
+clear trim start).
+@returns the sample offset of the start of the trim.
+*/
+sox_uint64_t
+LSX_API
+sox_trim_get_start(
+ LSX_PARAM_IN sox_effect_t * effp /**< Trim effect. */
+ );
+
+/**
+Client API:
+Clears the start of the trim to 0.
+*/
+void
+LSX_API
+sox_trim_clear_start(
+ LSX_PARAM_INOUT sox_effect_t * effp /**< Trim effect. */
+ );
+
+/**
+Client API:
+Returns true if the specified file is a known playlist file type.
+@returns true if the specified file is a known playlist file type.
+*/
+sox_bool
+LSX_API
+sox_is_playlist(
+ LSX_PARAM_IN_Z char const * filename /**< Name of file to examine. */
+ );
+
+/**
+Client API:
+Parses the specified playlist file.
+@returns SOX_SUCCESS if successful.
+*/
+int
+LSX_API
+sox_parse_playlist(
+ LSX_PARAM_IN sox_playlist_callback_t callback, /**< Callback to call for each item in the playlist. */
+ void * p, /**< Data to pass to callback. */
+ LSX_PARAM_IN char const * const listname /**< Filename of playlist file. */
+ );
+
+/**
+Client API:
+Converts a SoX error code into an error string.
+@returns error string corresponding to the specified error code,
+or a generic message if the error code is not recognized.
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+char const *
+LSX_API
+sox_strerror(
+ int sox_errno /**< Error code to look up. */
+ );
+
+/**
+Client API:
+Gets the basename of the specified file; for example, the basename of
+"/a/b/c.d" would be "c".
+@returns the number of characters written to base_buffer, excluding the null,
+or 0 on failure.
+*/
+size_t
+LSX_API
+sox_basename(
+ LSX_PARAM_OUT_Z_CAP_POST_COUNT(base_buffer_len,return) char * base_buffer, /**< Buffer into which basename should be written. */
+ size_t base_buffer_len, /**< Size of base_buffer, in bytes. */
+ LSX_PARAM_IN_Z char const * filename /**< Filename from which to extract basename. */
+ );
+
+/*****************************************************************************
+Internal API:
+WARNING - The items in this section are subject to instability. They only
+exist in the public header because sox (the application) currently uses them.
+These may be changed or removed in future versions of libSoX.
+*****************************************************************************/
+
+/**
+Plugins API:
+Print a fatal error in libSoX.
+*/
+void
+LSX_API
+lsx_fail_impl(
+ LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+ ...)
+ LSX_PRINTF12;
+
+/**
+Plugins API:
+Print a warning in libSoX.
+*/
+void
+LSX_API
+lsx_warn_impl(
+ LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+ ...)
+ LSX_PRINTF12;
+
+/**
+Plugins API:
+Print an informational message in libSoX.
+*/
+void
+LSX_API
+lsx_report_impl(
+ LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+ ...)
+ LSX_PRINTF12;
+
+/**
+Plugins API:
+Print a debug message in libSoX.
+*/
+void
+LSX_API
+lsx_debug_impl(
+ LSX_PARAM_IN_PRINTF char const * fmt, /**< printf-style format string. */
+ ...)
+ LSX_PRINTF12;
+
+/**
+Plugins API:
+Report a fatal error in libSoX; printf-style arguments must follow.
+*/
+#define lsx_fail sox_get_globals()->subsystem=__FILE__,lsx_fail_impl
+
+/**
+Plugins API:
+Report a warning in libSoX; printf-style arguments must follow.
+*/
+#define lsx_warn sox_get_globals()->subsystem=__FILE__,lsx_warn_impl
+
+/**
+Plugins API:
+Report an informational message in libSoX; printf-style arguments must follow.
+*/
+#define lsx_report sox_get_globals()->subsystem=__FILE__,lsx_report_impl
+
+/**
+Plugins API:
+Report a debug message in libSoX; printf-style arguments must follow.
+*/
+#define lsx_debug sox_get_globals()->subsystem=__FILE__,lsx_debug_impl
+
+/**
+Plugins API:
+String name and integer values for enumerated types (type metadata), for use
+with LSX_ENUM_ITEM, lsx_find_enum_text, and lsx_find_enum_value.
+*/
+typedef struct lsx_enum_item {
+ char const *text; /**< String name of enumeration. */
+ unsigned value; /**< Integer value of enumeration. */
+} lsx_enum_item;
+
+/**
+Plugins API:
+Declares a static instance of an lsx_enum_item structure in format
+{ "item", prefixitem }, for use in declaring lsx_enum_item[] arrays.
+@param prefix The prefix to prepend to the item in the enumeration symbolic name.
+@param item The user-visible text name of the item (must also be a valid C symbol name).
+*/
+#define LSX_ENUM_ITEM(prefix, item) {#item, prefix##item},
+
+/**
+Plugins API:
+Flags for use with lsx_find_enum_item.
+*/
+enum
+{
+ lsx_find_enum_item_none = 0, /**< Default parameters (case-insensitive). */
+ lsx_find_enum_item_case_sensitive = 1 /**< Enable case-sensitive search. */
+};
+
+/**
+Plugins API:
+Looks up an enumeration by name in an array of lsx_enum_items.
+@returns the corresponding item, or null if not found.
+*/
+LSX_RETURN_OPT LSX_RETURN_PURE
+lsx_enum_item const *
+LSX_API
+lsx_find_enum_text(
+ LSX_PARAM_IN_Z char const * text, /**< Name of enumeration to find. */
+ LSX_PARAM_IN lsx_enum_item const * lsx_enum_items, /**< Array of items to search, with text == NULL for last item. */
+ int flags /**< Search flags: 0 (case-insensitive) or lsx_find_enum_item_case_sensitive (case-sensitive). */
+ );
+
+/**
+Plugins API:
+Looks up an enumeration by value in an array of lsx_enum_items.
+@returns the corresponding item, or null if not found.
+*/
+LSX_RETURN_OPT LSX_RETURN_PURE
+lsx_enum_item const *
+LSX_API
+lsx_find_enum_value(
+ unsigned value, /**< Enumeration value to find. */
+ LSX_PARAM_IN lsx_enum_item const * lsx_enum_items /**< Array of items to search, with text == NULL for last item. */
+ );
+
+/**
+Plugins API:
+Looks up a command-line argument in a set of enumeration names, showing an
+error message if the argument is not found in the set of names.
+@returns The enumeration value corresponding to the matching enumeration, or
+INT_MAX if the argument does not match any enumeration name.
+*/
+LSX_RETURN_PURE
+int
+LSX_API
+lsx_enum_option(
+ int c, /**< Option character to which arg is associated, for example with -a, c would be 'a'. */
+ LSX_PARAM_IN_Z char const * arg, /**< Argument to find in enumeration list. */
+ LSX_PARAM_IN lsx_enum_item const * items /**< Array of items to search, with text == NULL for last item. */
+ );
+
+/**
+Plugins API:
+Determines whether the specified string ends with the specified suffix (case-sensitive).
+@returns true if the specified string ends with the specified suffix.
+*/
+LSX_RETURN_PURE
+sox_bool
+LSX_API
+lsx_strends(
+ LSX_PARAM_IN_Z char const * str, /**< String to search. */
+ LSX_PARAM_IN_Z char const * end /**< Suffix to search for. */
+ );
+
+/**
+Plugins API:
+Finds the file extension for a filename.
+@returns the file extension, not including the '.', or null if filename does
+not have an extension.
+*/
+LSX_RETURN_VALID_Z LSX_RETURN_PURE
+char const *
+LSX_API
+lsx_find_file_extension(
+ LSX_PARAM_IN_Z char const * pathname /**< Filename to search for extension. */
+ );
+
+/**
+Plugins API:
+Formats the specified number with up to three significant figures and adds a
+metric suffix in place of the exponent, such as 1.23G.
+@returns A static buffer with the formatted number, valid until the next time
+this function is called (note: not thread safe).
+*/
+LSX_RETURN_VALID_Z
+char const *
+LSX_API
+lsx_sigfigs3(
+ double number /**< Number to be formatted. */
+ );
+
+/**
+Plugins API:
+Formats the specified number as a percentage, showing up to three significant
+figures.
+@returns A static buffer with the formatted number, valid until the next time
+this function is called (note: not thread safe).
+*/
+LSX_RETURN_VALID_Z
+char const *
+LSX_API
+lsx_sigfigs3p(
+ double percentage /**< Number to be formatted. */
+ );
+
+/**
+Plugins API:
+Allocates, deallocates, or resizes; like C's realloc, except that this version
+terminates the running application if unable to allocate the requested memory.
+@returns New buffer, or null if buffer was freed.
+*/
+LSX_RETURN_OPT
+void *
+LSX_API
+lsx_realloc(
+ LSX_PARAM_IN_OPT void *ptr, /**< Pointer to be freed or resized, or null if allocating a new buffer. */
+ size_t newsize /**< New size for buffer, or 0 to free the buffer. */
+ );
+
+/**
+Plugins API:
+Like strcmp, except that the characters are compared without regard to case.
+@returns 0 (s1 == s2), negative (s1 < s2), or positive (s1 > s2).
+*/
+LSX_RETURN_PURE
+int
+LSX_API
+lsx_strcasecmp(
+ LSX_PARAM_IN_Z char const * s1, /**< First string. */
+ LSX_PARAM_IN_Z char const * s2 /**< Second string. */
+ );
+
+
+/**
+Plugins API:
+Like strncmp, except that the characters are compared without regard to case.
+@returns 0 (s1 == s2), negative (s1 < s2), or positive (s1 > s2).
+*/
+LSX_RETURN_PURE
+int
+LSX_API
+lsx_strncasecmp(
+ LSX_PARAM_IN_Z char const * s1, /**< First string. */
+ LSX_PARAM_IN_Z char const * s2, /**< Second string. */
+ size_t n /**< Maximum number of characters to examine. */
+ );
+
+/**
+Plugins API:
+Is option argument unsupported, required, or optional.
+*/
+typedef enum lsx_option_arg_t {
+ lsx_option_arg_none, /**< Option does not have an argument. */
+ lsx_option_arg_required, /**< Option requires an argument. */
+ lsx_option_arg_optional /**< Option can optionally be followed by an argument. */
+} lsx_option_arg_t;
+
+/**
+Plugins API:
+lsx_getopt_init options.
+*/
+typedef enum lsx_getopt_flags_t {
+ lsx_getopt_flag_none = 0, /**< no flags (no output, not long-only) */
+ lsx_getopt_flag_opterr = 1, /**< if set, invalid options trigger lsx_warn output */
+ lsx_getopt_flag_longonly = 2 /**< if set, recognize -option as a long option */
+} lsx_getopt_flags_t;
+
+/**
+Plugins API:
+lsx_getopt long option descriptor.
+*/
+typedef struct lsx_option_t {
+ char const * name; /**< Name of the long option. */
+ lsx_option_arg_t has_arg; /**< Whether the long option supports an argument and, if so, whether the argument is required or optional. */
+ int * flag; /**< Flag to set if argument is present. */
+ int val; /**< Value to put in flag if argument is present. */
+} lsx_option_t;
+
+/**
+Plugins API:
+lsx_getopt session information (initialization data and state).
+*/
+typedef struct lsx_getopt_t {
+ int argc; /**< IN argc: Number of arguments in argv */
+ char * const * argv; /**< IN argv: Array of arguments */
+ char const * shortopts;/**< IN shortopts: Short option characters */
+ lsx_option_t const * longopts; /**< IN longopts: Array of long option descriptors */
+ lsx_getopt_flags_t flags; /**< IN flags: Flags for longonly and opterr */
+ char const * curpos; /**< INOUT curpos: Maintains state between calls to lsx_getopt */
+ int ind; /**< INOUT optind: Maintains the index of next element to be processed */
+ int opt; /**< OUT optopt: Receives the option character that caused error */
+ char const * arg; /**< OUT optarg: Receives the value of the option's argument */
+ int lngind; /**< OUT lngind: Receives the index of the matched long option or -1 if not a long option */
+} lsx_getopt_t;
+
+/**
+Plugins API:
+Initializes an lsx_getopt_t structure for use with lsx_getopt.
+*/
+void
+LSX_API
+lsx_getopt_init(
+ LSX_PARAM_IN int argc, /**< Number of arguments in argv */
+ LSX_PARAM_IN_COUNT(argc) char * const * argv, /**< Array of arguments */
+ LSX_PARAM_IN_Z char const * shortopts, /**< Short options, for example ":abc:def::ghi" (+/- not supported) */
+ LSX_PARAM_IN_OPT lsx_option_t const * longopts, /**< Array of long option descriptors */
+ LSX_PARAM_IN lsx_getopt_flags_t flags, /**< Flags for longonly and opterr */
+ LSX_PARAM_IN int first, /**< First argv to check (usually 1) */
+ LSX_PARAM_OUT lsx_getopt_t * state /**< State object to be initialized */
+ );
+
+/**
+Plugins API:
+Gets the next option. Options are parameters that start with "-" or "--".
+If no more options, returns -1. If unrecognized short option, returns '?'.
+If a recognized short option is missing a required argument,
+return (shortopts[0]==':' ? ':' : '?'). If successfully recognized short
+option, return the recognized character. If successfully recognized long
+option, returns (option.flag ? 0 : option.val).
+Note: lsx_getopt does not permute the non-option arguments.
+@returns option character (short), val or 0 (long), or -1 (no more).
+*/
+int
+LSX_API
+lsx_getopt(
+ LSX_PARAM_INOUT lsx_getopt_t * state /**< The getopt state pointer. */
+ );
+
+/**
+Plugins API:
+Gets the file length, or 0 if the file is not seekable/normal.
+@returns The file length, or 0 if the file is not seekable/normal.
+*/
+sox_uint64_t
+LSX_API
+lsx_filelength(
+ LSX_PARAM_IN sox_format_t * ft
+ );
+
+/* WARNING END */
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* SOX_H */
diff --git a/src/src/sox_i.h b/src/src/sox_i.h
new file mode 100644
index 0000000..605e28b
--- /dev/null
+++ b/src/src/sox_i.h
@@ -0,0 +1,418 @@
+/* libSoX Internal header
+ *
+ * This file is meant for libSoX internal use only
+ *
+ * Copyright 2001-2012 Chris Bagwell and SoX Contributors
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Chris Bagwell And SoX Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#ifndef SOX_I_H
+#define SOX_I_H
+
+#include "third_party/sox/src/src/soxomp.h" /* Note: soxomp.h includes soxconfig.h */
+#include "third_party/sox/src/src/sox.h"
+
+#if defined HAVE_FMEMOPEN
+#define _GNU_SOURCE
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "third_party/sox/src/src/util.h"
+
+#if defined(LSX_EFF_ALIAS)
+#undef lsx_debug
+#undef lsx_fail
+#undef lsx_report
+#undef lsx_warn
+#define lsx_debug sox_globals.subsystem=effp->handler.name,lsx_debug_impl
+#define lsx_fail sox_globals.subsystem=effp->handler.name,lsx_fail_impl
+#define lsx_report sox_globals.subsystem=effp->handler.name,lsx_report_impl
+#define lsx_warn sox_globals.subsystem=effp->handler.name,lsx_warn_impl
+#endif
+
+#define RANQD1 ranqd1(sox_globals.ranqd1)
+#define DRANQD1 dranqd1(sox_globals.ranqd1)
+
+typedef enum {SOX_SHORT, SOX_INT, SOX_FLOAT, SOX_DOUBLE} sox_data_t;
+typedef enum {SOX_WAVE_SINE, SOX_WAVE_TRIANGLE} lsx_wave_t;
+lsx_enum_item const * lsx_get_wave_enum(void);
+
+/* Define fseeko and ftello for platforms lacking them */
+#ifndef HAVE_FSEEKO
+#define fseeko fseek
+#define ftello ftell
+#endif
+
+#ifdef _FILE_OFFSET_BITS
+assert_static(sizeof(off_t) == _FILE_OFFSET_BITS >> 3, OFF_T_BUILD_PROBLEM);
+#endif
+
+FILE * lsx_tmpfile(void);
+
+void lsx_debug_more_impl(char const * fmt, ...) LSX_PRINTF12;
+void lsx_debug_most_impl(char const * fmt, ...) LSX_PRINTF12;
+
+#define lsx_debug_more sox_get_globals()->subsystem=__FILE__,lsx_debug_more_impl
+#define lsx_debug_most sox_get_globals()->subsystem=__FILE__,lsx_debug_most_impl
+
+/* Digitise one cycle of a wave and store it as
+ * a table of samples of a specified data-type.
+ */
+void lsx_generate_wave_table(
+ lsx_wave_t wave_type,
+ sox_data_t data_type,
+ void * table, /* Really of type indicated by data_type. */
+ size_t table_size, /* Number of points on the x-axis. */
+ double min, /* Minimum value on the y-axis. (e.g. -1) */
+ double max, /* Maximum value on the y-axis. (e.g. +1) */
+ double phase); /* Phase at 1st point; 0..2pi. (e.g. pi/2 for cosine) */
+char const * lsx_parsesamples(sox_rate_t rate, const char *str, uint64_t *samples, int def);
+char const * lsx_parseposition(sox_rate_t rate, const char *str, uint64_t *samples, uint64_t latest, uint64_t end, int def);
+int lsx_parse_note(char const * text, char * * end_ptr);
+double lsx_parse_frequency_k(char const * text, char * * end_ptr, int key);
+#define lsx_parse_frequency(a, b) lsx_parse_frequency_k(a, b, INT_MAX)
+FILE * lsx_open_input_file(sox_effect_t * effp, char const * filename, sox_bool text_mode);
+
+void lsx_prepare_spline3(double const * x, double const * y, int n,
+ double start_1d, double end_1d, double * y_2d);
+double lsx_spline3(double const * x, double const * y, double const * y_2d,
+ int n, double x1);
+
+double lsx_bessel_I_0(double x);
+int lsx_set_dft_length(int num_taps);
+void init_fft_cache(void);
+void clear_fft_cache(void);
+#define lsx_is_power_of_2(x) !(x < 2 || (x & (x - 1)))
+void lsx_safe_rdft(int len, int type, double * d);
+void lsx_safe_cdft(int len, int type, double * d);
+void lsx_power_spectrum(int n, double const * in, double * out);
+void lsx_power_spectrum_f(int n, float const * in, float * out);
+void lsx_apply_hann_f(float h[], const int num_points);
+void lsx_apply_hann(double h[], const int num_points);
+void lsx_apply_hamming(double h[], const int num_points);
+void lsx_apply_bartlett(double h[], const int num_points);
+void lsx_apply_blackman(double h[], const int num_points, double alpha);
+void lsx_apply_blackman_nutall(double h[], const int num_points);
+double lsx_kaiser_beta(double att, double tr_bw);
+void lsx_apply_kaiser(double h[], const int num_points, double beta);
+void lsx_apply_dolph(double h[], const int num_points, double att);
+double * lsx_make_lpf(int num_taps, double Fc, double beta, double rho,
+ double scale, sox_bool dc_norm);
+void lsx_kaiser_params(double att, double Fc, double tr_bw, double * beta, int * num_taps);
+double * lsx_design_lpf(
+ double Fp, /* End of pass-band */
+ double Fs, /* Start of stop-band */
+ double Fn, /* Nyquist freq; e.g. 0.5, 1, PI; < 0: dummy run */
+ double att, /* Stop-band attenuation in dB */
+ int * num_taps, /* 0: value will be estimated */
+ int k, /* >0: number of phases; <0: num_taps ≡ 1 (mod -k) */
+ double beta); /* <0: value will be estimated */
+void lsx_fir_to_phase(double * * h, int * len,
+ int * post_len, double phase0);
+void lsx_plot_fir(double * h, int num_points, sox_rate_t rate, sox_plot_t type, char const * title, double y1, double y2);
+void lsx_save_samples(sox_sample_t * const dest, double const * const src,
+ size_t const n, sox_uint64_t * const clips);
+void lsx_load_samples(double * const dest, sox_sample_t const * const src,
+ size_t const n);
+
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#define lsx_swapw(x) bswap_16(x)
+#define lsx_swapdw(x) bswap_32(x)
+#elif defined(_MSC_VER)
+#define lsx_swapw(x) _byteswap_ushort(x)
+#define lsx_swapdw(x) _byteswap_ulong(x)
+#else
+#define lsx_swapw(uw) (((uw >> 8) | (uw << 8)) & 0xffff)
+#define lsx_swapdw(udw) ((udw >> 24) | ((udw >> 8) & 0xff00) | ((udw << 8) & 0xff0000) | (udw << 24))
+#endif
+
+
+
+/*------------------------ Implemented in libsoxio.c -------------------------*/
+
+/* Read and write basic data types from "ft" stream. */
+size_t lsx_readbuf(sox_format_t * ft, void *buf, size_t len);
+int lsx_skipbytes(sox_format_t * ft, size_t n);
+int lsx_padbytes(sox_format_t * ft, size_t n);
+size_t lsx_writebuf(sox_format_t * ft, void const *buf, size_t len);
+int lsx_reads(sox_format_t * ft, char *c, size_t len);
+int lsx_writes(sox_format_t * ft, char const * c);
+void lsx_set_signal_defaults(sox_format_t * ft);
+#define lsx_writechars(ft, chars, len) (lsx_writebuf(ft, chars, len) == len? SOX_SUCCESS : SOX_EOF)
+
+size_t lsx_read_3_buf(sox_format_t * ft, sox_uint24_t *buf, size_t len);
+size_t lsx_read_b_buf(sox_format_t * ft, uint8_t *buf, size_t len);
+size_t lsx_read_df_buf(sox_format_t * ft, double *buf, size_t len);
+size_t lsx_read_dw_buf(sox_format_t * ft, uint32_t *buf, size_t len);
+size_t lsx_read_qw_buf(sox_format_t * ft, uint64_t *buf, size_t len);
+size_t lsx_read_f_buf(sox_format_t * ft, float *buf, size_t len);
+size_t lsx_read_w_buf(sox_format_t * ft, uint16_t *buf, size_t len);
+
+size_t lsx_write_3_buf(sox_format_t * ft, sox_uint24_t *buf, size_t len);
+size_t lsx_write_b_buf(sox_format_t * ft, uint8_t *buf, size_t len);
+size_t lsx_write_df_buf(sox_format_t * ft, double *buf, size_t len);
+size_t lsx_write_dw_buf(sox_format_t * ft, uint32_t *buf, size_t len);
+size_t lsx_write_qw_buf(sox_format_t * ft, uint64_t *buf, size_t len);
+size_t lsx_write_f_buf(sox_format_t * ft, float *buf, size_t len);
+size_t lsx_write_w_buf(sox_format_t * ft, uint16_t *buf, size_t len);
+
+int lsx_read3(sox_format_t * ft, sox_uint24_t * u3);
+int lsx_readb(sox_format_t * ft, uint8_t * ub);
+int lsx_readchars(sox_format_t * ft, char * chars, size_t len);
+int lsx_readdf(sox_format_t * ft, double * d);
+int lsx_readdw(sox_format_t * ft, uint32_t * udw);
+int lsx_readqw(sox_format_t * ft, uint64_t * udw);
+int lsx_readf(sox_format_t * ft, float * f);
+int lsx_readw(sox_format_t * ft, uint16_t * uw);
+
+#if 1 /* FIXME: use defines */
+UNUSED static int lsx_readsb(sox_format_t * ft, int8_t * sb)
+{return lsx_readb(ft, (uint8_t *)sb);}
+UNUSED static int lsx_readsw(sox_format_t * ft, int16_t * sw)
+{return lsx_readw(ft, (uint16_t *)sw);}
+#else
+#define lsx_readsb(ft, sb) lsx_readb(ft, (uint8_t *)sb)
+#define lsx_readsw(ft, sw) lsx_readb(ft, (uint16_t *)sw)
+#endif
+
+int lsx_write3(sox_format_t * ft, unsigned u3);
+int lsx_writeb(sox_format_t * ft, unsigned ub);
+int lsx_writedf(sox_format_t * ft, double d);
+int lsx_writedw(sox_format_t * ft, unsigned udw);
+int lsx_writeqw(sox_format_t * ft, uint64_t uqw);
+int lsx_writef(sox_format_t * ft, double f);
+int lsx_writew(sox_format_t * ft, unsigned uw);
+
+int lsx_writesb(sox_format_t * ft, signed);
+int lsx_writesw(sox_format_t * ft, signed);
+
+int lsx_eof(sox_format_t * ft);
+int lsx_error(sox_format_t * ft);
+int lsx_flush(sox_format_t * ft);
+int lsx_seeki(sox_format_t * ft, off_t offset, int whence);
+int lsx_unreadb(sox_format_t * ft, unsigned ub);
+/* uint64_t lsx_filelength(sox_format_t * ft); Temporarily Moved to sox.h. */
+off_t lsx_tell(sox_format_t * ft);
+void lsx_clearerr(sox_format_t * ft);
+void lsx_rewind(sox_format_t * ft);
+
+int lsx_offset_seek(sox_format_t * ft, off_t byte_offset, off_t to_sample);
+
+void lsx_fail_errno(sox_format_t *, int, const char *, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 3, 4)));
+#else
+;
+#endif
+
+typedef struct sox_formats_globals { /* Global parameters (for formats) */
+ sox_globals_t * global_info;
+} sox_formats_globals;
+
+
+
+/*------------------------------ File Handlers -------------------------------*/
+
+int lsx_check_read_params(sox_format_t * ft, unsigned channels,
+ sox_rate_t rate, sox_encoding_t encoding, unsigned bits_per_sample,
+ uint64_t num_samples, sox_bool check_length);
+#define LSX_FORMAT_HANDLER(name) \
+sox_format_handler_t const * lsx_##name##_format_fn(void); \
+sox_format_handler_t const * lsx_##name##_format_fn(void)
+#define div_bits(size, bits) ((uint64_t)(size) * 8 / bits)
+
+/* Raw I/O */
+int lsx_rawstartread(sox_format_t * ft);
+size_t lsx_rawread(sox_format_t * ft, sox_sample_t *buf, size_t nsamp);
+int lsx_rawstopread(sox_format_t * ft);
+int lsx_rawstartwrite(sox_format_t * ft);
+size_t lsx_rawwrite(sox_format_t * ft, const sox_sample_t *buf, size_t nsamp);
+int lsx_rawseek(sox_format_t * ft, uint64_t offset);
+int lsx_rawstart(sox_format_t * ft, sox_bool default_rate, sox_bool default_channels, sox_bool default_length, sox_encoding_t encoding, unsigned bits_per_sample);
+#define lsx_rawstartread(ft) lsx_rawstart(ft, sox_false, sox_false, sox_false, SOX_ENCODING_UNKNOWN, 0)
+#define lsx_rawstartwrite lsx_rawstartread
+#define lsx_rawstopread NULL
+#define lsx_rawstopwrite NULL
+
+extern sox_format_handler_t const * lsx_sndfile_format_fn(void);
+
+char * lsx_cat_comments(sox_comments_t comments);
+
+/*--------------------------------- Effects ----------------------------------*/
+
+int lsx_flow_copy(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp);
+int lsx_usage(sox_effect_t * effp);
+char * lsx_usage_lines(char * * usage, char const * const * lines, size_t n);
+#define EFFECT(f) extern sox_effect_handler_t const * lsx_##f##_effect_fn(void);
+#include "third_party/sox/src/src/effects.h"
+#undef EFFECT
+
+#define NUMERIC_PARAMETER(name, min, max) { \
+ char * end_ptr; \
+ double d; \
+ if (argc == 0) break; \
+ d = strtod(*argv, &end_ptr); \
+ if (end_ptr != *argv) { \
+ if (d < min || d > max || *end_ptr != '\0') {\
+ lsx_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
+ return lsx_usage(effp); \
+ } \
+ p->name = d; \
+ --argc, ++argv; \
+ } \
+}
+
+#define TEXTUAL_PARAMETER(name, enum_table) { \
+ lsx_enum_item const * e; \
+ if (argc == 0) break; \
+ e = lsx_find_enum_text(*argv, enum_table, 0); \
+ if (e != NULL) { \
+ p->name = e->value; \
+ --argc, ++argv; \
+ } \
+}
+
+#define GETOPT_LOCAL_NUMERIC(state, ch, name, min, max) case ch:{ \
+ char * end_ptr; \
+ double d = strtod(state.arg, &end_ptr); \
+ if (end_ptr == state.arg || d < min || d > max || *end_ptr != '\0') {\
+ lsx_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
+ return lsx_usage(effp); \
+ } \
+ name = d; \
+ break; \
+}
+#define GETOPT_NUMERIC(state, ch, name, min, max) GETOPT_LOCAL_NUMERIC(state, ch, p->name, min, max)
+
+int lsx_effect_set_imin(sox_effect_t * effp, size_t imin);
+
+int lsx_effects_init(void);
+int lsx_effects_quit(void);
+
+/*--------------------------------- Dynamic Library ----------------------------------*/
+
+#if defined(HAVE_WIN32_LTDL_H)
+ #include "third_party/sox/src/src/win32-ltdl.h"
+ #define HAVE_LIBLTDL 1
+ typedef lt_dlhandle lsx_dlhandle;
+#elif defined(HAVE_LIBLTDL)
+ #include <ltdl.h>
+ typedef lt_dlhandle lsx_dlhandle;
+#else
+ struct lsx_dlhandle_tag;
+ typedef struct lsx_dlhandle_tag *lsx_dlhandle;
+#endif
+
+typedef void (*lsx_dlptr)(void);
+
+typedef struct lsx_dlfunction_info
+{
+ const char* name;
+ lsx_dlptr static_func;
+ lsx_dlptr stub_func;
+} lsx_dlfunction_info;
+
+int lsx_open_dllibrary(
+ int show_error_on_failure,
+ const char* library_description,
+ const char * const library_names[],
+ const lsx_dlfunction_info func_infos[],
+ lsx_dlptr selected_funcs[],
+ lsx_dlhandle* pdl);
+
+void lsx_close_dllibrary(
+ lsx_dlhandle dl);
+
+#define LSX_DLENTRIES_APPLY__(entries, f, x) entries(f, x)
+
+#define LSX_DLENTRY_TO_PTR__(unused, func_return, func_name, func_args, static_func, stub_func, func_ptr) \
+ func_return (*func_ptr) func_args;
+
+#define LSX_DLENTRIES_TO_FUNCTIONS__(unused, func_return, func_name, func_args, static_func, stub_func, func_ptr) \
+ func_return func_name func_args;
+
+/* LSX_DLENTRIES_TO_PTRS: Given an ENTRIES macro and the name of the dlhandle
+ variable, declares the corresponding function pointer variables and the
+ dlhandle variable. */
+#define LSX_DLENTRIES_TO_PTRS(entries, dlhandle) \
+ LSX_DLENTRIES_APPLY__(entries, LSX_DLENTRY_TO_PTR__, 0) \
+ lsx_dlhandle dlhandle
+
+/* LSX_DLENTRIES_TO_FUNCTIONS: Given an ENTRIES macro, declares the corresponding
+ functions. */
+#define LSX_DLENTRIES_TO_FUNCTIONS(entries) \
+ LSX_DLENTRIES_APPLY__(entries, LSX_DLENTRIES_TO_FUNCTIONS__, 0)
+
+#define LSX_DLLIBRARY_OPEN1__(unused, func_return, func_name, func_args, static_func, stub_func, func_ptr) \
+ { #func_name, (lsx_dlptr)(static_func), (lsx_dlptr)(stub_func) },
+
+#define LSX_DLLIBRARY_OPEN2__(ptr_container, func_return, func_name, func_args, static_func, stub_func, func_ptr) \
+ (ptr_container)->func_ptr = (func_return (*)func_args)lsx_dlfunction_open_library_funcs[lsx_dlfunction_open_library_index++];
+
+/* LSX_DLLIBRARY_OPEN: Input an ENTRIES macro, the library's description,
+ a null-terminated list of library names (i.e. { "libmp3-0", "libmp3", NULL }),
+ the name of the dlhandle variable, the name of the structure that contains
+ the function pointer and dlhandle variables, and the name of the variable in
+ which the result of the lsx_open_dllibrary call should be stored. This will
+ call lsx_open_dllibrary and copy the resulting function pointers into the
+ structure members. If the library cannot be opened, show a failure message. */
+#define LSX_DLLIBRARY_OPEN(ptr_container, dlhandle, entries, library_description, library_names, return_var) \
+ LSX_DLLIBRARY_TRYOPEN(1, ptr_container, dlhandle, entries, library_description, library_names, return_var)
+
+/* LSX_DLLIBRARY_TRYOPEN: Input an ENTRIES macro, the library's description,
+ a null-terminated list of library names (i.e. { "libmp3-0", "libmp3", NULL }),
+ the name of the dlhandle variable, the name of the structure that contains
+ the function pointer and dlhandle variables, and the name of the variable in
+ which the result of the lsx_open_dllibrary call should be stored. This will
+ call lsx_open_dllibrary and copy the resulting function pointers into the
+ structure members. If the library cannot be opened, show a report or a failure
+ message, depending on whether error_on_failure is non-zero. */
+#define LSX_DLLIBRARY_TRYOPEN(error_on_failure, ptr_container, dlhandle, entries, library_description, library_names, return_var) \
+ do { \
+ lsx_dlfunction_info lsx_dlfunction_open_library_infos[] = { \
+ LSX_DLENTRIES_APPLY__(entries, LSX_DLLIBRARY_OPEN1__, 0) \
+ {NULL,NULL,NULL} }; \
+ int lsx_dlfunction_open_library_index = 0; \
+ lsx_dlptr lsx_dlfunction_open_library_funcs[sizeof(lsx_dlfunction_open_library_infos)/sizeof(lsx_dlfunction_open_library_infos[0])]; \
+ (return_var) = lsx_open_dllibrary((error_on_failure), (library_description), (library_names), lsx_dlfunction_open_library_infos, lsx_dlfunction_open_library_funcs, &(ptr_container)->dlhandle); \
+ LSX_DLENTRIES_APPLY__(entries, LSX_DLLIBRARY_OPEN2__, ptr_container) \
+ } while(0)
+
+#define LSX_DLLIBRARY_CLOSE(ptr_container, dlhandle) \
+ lsx_close_dllibrary((ptr_container)->dlhandle)
+
+ /* LSX_DLENTRY_STATIC: For use in creating an ENTRIES macro. func is
+ expected to be available at link time. If not present, link will fail. */
+#define LSX_DLENTRY_STATIC(f,x, ret, func, args) f(x, ret, func, args, func, NULL, func)
+
+ /* LSX_DLENTRY_DYNAMIC: For use in creating an ENTRIES macro. func need
+ not be available at link time (and if present, the link time version will
+ not be used). func will be loaded via dlsym. If this function is not
+ found in the shared library, the shared library will not be used. */
+#define LSX_DLENTRY_DYNAMIC(f,x, ret, func, args) f(x, ret, func, args, NULL, NULL, func)
+
+ /* LSX_DLENTRY_STUB: For use in creating an ENTRIES macro. func need not
+ be available at link time (and if present, the link time version will not
+ be used). If using DL_LAME, the func may be loaded via dlopen/dlsym, but
+ if not found, the shared library will still be used if all of the
+ non-stub functions are found. If the function is not found via dlsym (or
+ if we are not loading any shared libraries), the stub will be used. This
+ assumes that the name of the stub function is the name of the function +
+ "_stub". */
+#define LSX_DLENTRY_STUB(f,x, ret, func, args) f(x, ret, func, args, NULL, func##_stub, func)
+
+ /* LSX_DLFUNC_IS_STUB: returns true if the named function is a do-nothing
+ stub. Assumes that the name of the stub function is the name of the
+ function + "_stub". */
+#define LSX_DLFUNC_IS_STUB(ptr_container, func) ((ptr_container)->func == func##_stub)
+
+#endif
diff --git a/src/src/sox_sample_test.c b/src/src/sox_sample_test.c
new file mode 100644
index 0000000..bdc6dca
--- /dev/null
+++ b/src/src/sox_sample_test.c
@@ -0,0 +1,18 @@
+/* libSoX test code copyright (c) 2006 robs@users.sourceforge.net
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "third_party/sox/src/src/sox_sample_test.h"
diff --git a/src/src/sox_sample_test.h b/src/src/sox_sample_test.h
new file mode 100644
index 0000000..3bd10d0
--- /dev/null
+++ b/src/src/sox_sample_test.h
@@ -0,0 +1,203 @@
+/* libSoX test code copyright (c) 2006 robs@users.sourceforge.net
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef NDEBUG /* Enable assert always. */
+#undef NDEBUG /* Must undef above assert.h or other that might include it. */
+#endif
+#include <assert.h>
+#include "third_party/sox/src/src/sox.h"
+
+#define TEST_UINT(bits) \
+ uint##bits = 0; \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,uint##bits); \
+ assert(sample == SOX_SAMPLE_MIN); \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == 0 && clips == 0); \
+ \
+ uint##bits = 1; \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,uint##bits); \
+ assert(sample > SOX_SAMPLE_MIN && sample < 0); \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == 1 && clips == 0); \
+ \
+ uint##bits = SOX_INT_MAX(bits); \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,uint##bits); \
+ assert(sample * SOX_INT_MAX(bits) == SOX_UNSIGNED_TO_SAMPLE(bits,1)); \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == SOX_INT_MAX(bits) && clips == 0); \
+ \
+ sample =SOX_UNSIGNED_TO_SAMPLE(bits,1)+SOX_UNSIGNED_TO_SAMPLE(bits,SOX_INT_MAX(bits))/2; \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == 1 && clips == 0); \
+ \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,1)+SOX_UNSIGNED_TO_SAMPLE(bits,SOX_INT_MAX(bits))/2-1; \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == 0 && clips == 0); \
+ \
+ uint##bits = (0^SOX_INT_MIN(bits)); \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,uint##bits); \
+ assert(sample == 0); \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == (0^SOX_INT_MIN(bits)) && clips == 0); \
+ \
+ uint##bits = ((0^SOX_INT_MIN(bits))+1); \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,uint##bits); \
+ assert(sample > 0 && sample < SOX_SAMPLE_MAX); \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == ((0^SOX_INT_MIN(bits))+1) && clips == 0); \
+ \
+ uint##bits = SOX_UINT_MAX(bits); \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,uint##bits); \
+ assert(sample == SOX_INT_MAX(bits) * SOX_UNSIGNED_TO_SAMPLE(bits,((0^SOX_INT_MIN(bits))+1))); \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == SOX_UINT_MAX(bits) && clips == 0); \
+ \
+ sample =SOX_UNSIGNED_TO_SAMPLE(bits,SOX_UINT_MAX(bits))+SOX_UNSIGNED_TO_SAMPLE(bits,((0^SOX_INT_MIN(bits))+1))/2-1; \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == SOX_UINT_MAX(bits) && clips == 0); \
+ \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,SOX_UINT_MAX(bits))+SOX_UNSIGNED_TO_SAMPLE(bits,((0^SOX_INT_MIN(bits))+1))/2; \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == SOX_UINT_MAX(bits) && --clips == 0); \
+ \
+ sample = SOX_SAMPLE_MAX; \
+ uint##bits = SOX_SAMPLE_TO_UNSIGNED(bits,sample, clips); \
+ assert(uint##bits == SOX_UINT_MAX(bits) && --clips == 0); \
+
+#define TEST_SINT(bits) \
+ int##bits = SOX_INT_MIN(bits); \
+ sample = SOX_SIGNED_TO_SAMPLE(bits,int##bits); \
+ assert(sample == SOX_SAMPLE_MIN); \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ int##bits = SOX_INT_MIN(bits)+1; \
+ sample = SOX_SIGNED_TO_SAMPLE(bits,int##bits); \
+ assert(sample > SOX_SAMPLE_MIN && sample < 0); \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ int##bits = SOX_UINT_MAX(bits) /* i.e. -1 */; \
+ sample = SOX_SIGNED_TO_SAMPLE(bits,int##bits); \
+ assert(sample * SOX_INT_MAX(bits) == SOX_SIGNED_TO_SAMPLE(bits,SOX_INT_MIN(bits)+1)); \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ int##bits = SOX_INT_MIN(bits)+1; \
+ sample =SOX_UNSIGNED_TO_SAMPLE(bits,1)+SOX_UNSIGNED_TO_SAMPLE(bits,SOX_INT_MAX(bits))/2; \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ int##bits = SOX_INT_MIN(bits); \
+ sample = SOX_UNSIGNED_TO_SAMPLE(bits,1)+SOX_UNSIGNED_TO_SAMPLE(bits,SOX_INT_MAX(bits))/2-1; \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ int##bits = 0; \
+ sample = SOX_SIGNED_TO_SAMPLE(bits,int##bits); \
+ assert(sample == 0); \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ int##bits = 1; \
+ sample = SOX_SIGNED_TO_SAMPLE(bits,int##bits); \
+ assert(sample > 0 && sample < SOX_SAMPLE_MAX); \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ int##bits = SOX_INT_MAX(bits); \
+ sample = SOX_SIGNED_TO_SAMPLE(bits,int##bits); \
+ assert(sample == SOX_INT_MAX(bits) * SOX_SIGNED_TO_SAMPLE(bits,1)); \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ sample =SOX_UNSIGNED_TO_SAMPLE(bits,SOX_UINT_MAX(bits))+SOX_UNSIGNED_TO_SAMPLE(bits,((0^SOX_INT_MIN(bits))+1))/2-1; \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && clips == 0); \
+ \
+ sample =SOX_UNSIGNED_TO_SAMPLE(bits,SOX_UINT_MAX(bits))+SOX_UNSIGNED_TO_SAMPLE(bits,((0^SOX_INT_MIN(bits))+1))/2; \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && --clips == 0); \
+ \
+ sample = SOX_SAMPLE_MAX; \
+ int##bits##_2 = SOX_SAMPLE_TO_SIGNED(bits,sample, clips); \
+ assert(int##bits##_2 == int##bits && --clips == 0);
+
+#if defined __GNUC__
+ #pragma GCC system_header
+#elif defined __SUNPRO_CC
+ #pragma disable_warn
+#elif defined _MSC_VER
+ #pragma warning(push, 1)
+#endif
+
+int main()
+{
+ sox_int8_t int8;
+ sox_int16_t int16;
+ sox_int24_t int24;
+
+ sox_uint8_t uint8;
+ sox_uint16_t uint16;
+ sox_uint24_t uint24;
+
+ sox_int8_t int8_2;
+ sox_int16_t int16_2;
+ sox_int24_t int24_2;
+
+ sox_sample_t sample;
+ size_t clips = 0;
+
+ double d;
+ SOX_SAMPLE_LOCALS;
+
+ TEST_UINT(8)
+ TEST_UINT(16)
+ TEST_UINT(24)
+
+ TEST_SINT(8)
+ TEST_SINT(16)
+ TEST_SINT(24)
+
+ d = -1.000000001;
+ sample = SOX_FLOAT_64BIT_TO_SAMPLE(d, clips);
+ assert(sample == SOX_SAMPLE_MIN && --clips == 0);
+
+ d = -1;
+ sample = SOX_FLOAT_64BIT_TO_SAMPLE(d, clips);
+ assert(sample == SOX_SAMPLE_MIN && clips == 0);
+ d = SOX_SAMPLE_TO_FLOAT_64BIT(sample,clips);
+ assert(d == -1 && clips == 0);
+
+ d = 1;
+ sample = SOX_FLOAT_64BIT_TO_SAMPLE(d, clips);
+ assert(sample == SOX_SAMPLE_MAX && clips == 0);
+ d = SOX_SAMPLE_TO_FLOAT_64BIT(sample,clips);
+ assert(fabs(d - 1) < 1e-9 && clips == 0);
+
+ d = 1.0000000001;
+ sample = SOX_FLOAT_64BIT_TO_SAMPLE(d, clips);
+ assert(sample == SOX_SAMPLE_MAX && --clips == 0);
+
+ return 0;
+}
+
+#if defined __SUNPRO_CC
+ #pragma enable_warn
+#elif defined _MSC_VER
+ #pragma warning(pop)
+#endif
diff --git a/src/src/soxconfig.h b/src/src/soxconfig.h
new file mode 100644
index 0000000..3cbd047
--- /dev/null
+++ b/src/src/soxconfig.h
@@ -0,0 +1,371 @@
+/* src/soxconfig.h. Generated from soxconfig.h.in by configure. */
+/* src/soxconfig.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define to dlopen() amrnb. */
+/* #undef DL_AMRNB */
+
+/* Define to dlopen() amrwb. */
+/* #undef DL_AMRWB */
+
+/* Define to dlopen() lame. */
+/* #undef DL_LAME */
+
+/* Define to dlopen() mad. */
+/* #undef DL_MAD */
+
+/* Define to dlopen() sndfile. */
+/* #undef DL_SNDFILE */
+
+/* Define to dlopen() libtwolame. */
+/* #undef DL_TWOLAME */
+
+/* Define if SSP C support is enabled. */
+/* #undef ENABLE_SSP_CC */
+
+/* Define if you are using an external GSM library */
+/* #undef EXTERNAL_GSM */
+
+/* Define if you are using an external LPC10 library */
+/* #undef EXTERNAL_LPC10 */
+
+/* Define to 1 if you have alsa. */
+/* #undef HAVE_ALSA */
+
+/* Define to 1 if you have amrnb. */
+/* #undef HAVE_AMRNB */
+
+/* Define to 1 if you have amrwb. */
+/* #undef HAVE_AMRWB */
+
+/* Define to 1 if you have the <amrwb/dec.h> header file. */
+/* #undef HAVE_AMRWB_DEC_H */
+
+/* Define to 1 if you have ao. */
+/* #undef HAVE_AO */
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+#define HAVE_BYTESWAP_H 1
+
+/* Define to 1 if you have coreaudio. */
+/* #undef HAVE_COREAUDIO */
+
+/* 1 if DISTRO is defined */
+/* #undef HAVE_DISTRO */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the <fenv.h> header file. */
+#define HAVE_FENV_H 1
+
+/* Define to 1 if you have flac. */
+/* #undef HAVE_FLAC */
+
+/* Define to 1 if you have the `fmemopen' function. */
+#define HAVE_FMEMOPEN 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#define HAVE_FSEEKO 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <glob.h> header file. */
+#define HAVE_GLOB_H 1
+
+/* Define to 1 if you have gsm. */
+#define HAVE_GSM 1
+
+/* Define to 1 if you have the <gsm/gsm.h> header file. */
+/* #undef HAVE_GSM_GSM_H */
+
+/* Define to 1 if you have the <gsm.h> header file. */
+/* #undef HAVE_GSM_H */
+
+/* Define to 1 if you have id3tag. */
+/* #undef HAVE_ID3TAG */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* 1 if should enable LADSPA */
+/* #undef HAVE_LADSPA_H */
+
+/* Define to 1 if you have the <lame.h> header file. */
+/* #undef HAVE_LAME_H */
+
+/* Define to 1 if lame supports optional ID3 tags. */
+/* #undef HAVE_LAME_ID3TAG */
+
+/* Define to 1 if you have the <lame/lame.h> header file. */
+/* #undef HAVE_LAME_LAME_H */
+
+/* Define to 1 if you have libltdl */
+/* #undef HAVE_LIBLTDL */
+
+/* Define to 1 if you have the <libpng/png.h> header file. */
+/* #undef HAVE_LIBPNG_PNG_H */
+
+/* Define to 1 if you have lpc10. */
+#define HAVE_LPC10 1
+
+/* Define to 1 if you have the <lpc10.h> header file. */
+/* #undef HAVE_LPC10_H */
+
+/* Define to 1 if you have the `lrint' function. */
+#define HAVE_LRINT 1
+
+/* Define to 1 if you have the <ltdl.h> header file. */
+/* #undef HAVE_LTDL_H */
+
+/* Define to 1 if you have the <machine/soundcard.h> header file. */
+/* #undef HAVE_MACHINE_SOUNDCARD_H */
+
+/* Define to 1 if you have the <mad.h> header file. */
+/* #undef HAVE_MAD_H */
+
+/* Define to 1 if you have magic. */
+/* #undef HAVE_MAGIC */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
+/* Define to 1 if you have mp3. */
+/* #undef HAVE_MP3 */
+
+/* Define to 1 if you have oggvorbis. */
+/* #undef HAVE_OGG_VORBIS */
+
+/* Define to 1 if you have the <opencore-amrnb/interf_dec.h> header file. */
+/* #undef HAVE_OPENCORE_AMRNB_INTERF_DEC_H */
+
+/* Define to 1 if you have the <opencore-amrwb/dec_if.h> header file. */
+/* #undef HAVE_OPENCORE_AMRWB_DEC_IF_H */
+
+/* Define to 1 if you have opus. */
+/* #undef HAVE_OPUS */
+
+/* Define to 1 if you have oss. */
+#define HAVE_OSS 1
+
+/* Define to 1 if you have PNG. */
+/* #undef HAVE_PNG */
+
+/* Define to 1 if you have the <png.h> header file. */
+/* #undef HAVE_PNG_H */
+
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
+
+/* Define to 1 if you have pulseaudio. */
+/* #undef HAVE_PULSEAUDIO */
+
+/* Define if you have libsndfile with SFC_SFC_SET_SCALE_INT_FLOAT_WRITE */
+/* #undef HAVE_SFC_SET_SCALE_INT_FLOAT_WRITE */
+
+/* Define to 1 if you have sndfile. */
+/* #undef HAVE_SNDFILE */
+
+/* Define if you have libsndfile >= 1.0.18 */
+/* #undef HAVE_SNDFILE_1_0_18 */
+
+/* Define if you have <sndfile.h> */
+/* #undef HAVE_SNDFILE_H */
+
+/* Define to 1 if you have sndio. */
+/* #undef HAVE_SNDIO */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have sunaudio. */
+/* #undef HAVE_SUN_AUDIO */
+
+/* Define to 1 if you have the <sun/audioio.h> header file. */
+/* #undef HAVE_SUN_AUDIOIO_H */
+
+/* Define to 1 if you have the <sys/audioio.h> header file. */
+/* #undef HAVE_SYS_AUDIOIO_H */
+
+/* Define to 1 if you have the <sys/soundcard.h> header file. */
+#define HAVE_SYS_SOUNDCARD_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#define HAVE_SYS_TIMEB_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#define HAVE_SYS_UTSNAME_H 1
+
+/* Define to 1 if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define to 1 if you have the <twolame.h> header file. */
+/* #undef HAVE_TWOLAME_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have waveaudio. */
+/* #undef HAVE_WAVEAUDIO */
+
+/* Define to 1 if you have wavpack. */
+/* #undef HAVE_WAVPACK */
+
+/* Define to 1 to use win32 glob */
+/* #undef HAVE_WIN32_GLOB_H */
+
+/* Define to 1 to use internal win32 ltdl */
+/* #undef HAVE_WIN32_LTDL_H */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "sox"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "sox-devel@lists.sourceforge.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "SoX"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "SoX 14.4.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "sox"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "14.4.2"
+
+/* Define to 1 if you have static alsa. */
+/* #undef STATIC_ALSA */
+
+/* Define to 1 if you have static amrnb. */
+/* #undef STATIC_AMRNB */
+
+/* Define to 1 if you have static amrwb. */
+/* #undef STATIC_AMRWB */
+
+/* Define to 1 if you have static ao. */
+/* #undef STATIC_AO */
+
+/* Define to 1 if you have static coreaudio. */
+/* #undef STATIC_COREAUDIO */
+
+/* Define to 1 if you have static flac. */
+/* #undef STATIC_FLAC */
+
+/* Define to 1 if you have static gsm. */
+#define STATIC_GSM 1
+
+/* Define to 1 if you have static lpc10. */
+#define STATIC_LPC10 1
+
+/* Define to 1 if you have static mp3. */
+/* #undef STATIC_MP3 */
+
+/* Define to 1 if you have static oggvorbis. */
+/* #undef STATIC_OGG_VORBIS */
+
+/* Define to 1 if you have static opus. */
+/* #undef STATIC_OPUS */
+
+/* Define to 1 if you have static oss. */
+#define STATIC_OSS 1
+
+/* Define to 1 if you have static pulseaudio. */
+/* #undef STATIC_PULSEAUDIO */
+
+/* Define to 1 if you have static sndfile. */
+/* #undef STATIC_SNDFILE */
+
+/* Define to 1 if you have static sndio. */
+/* #undef STATIC_SNDIO */
+
+/* Define to 1 if you have static sunaudio. */
+/* #undef STATIC_SUN_AUDIO */
+
+/* Define to 1 if you have static waveaudio. */
+/* #undef STATIC_WAVEAUDIO */
+
+/* Define to 1 if you have static wavpack. */
+/* #undef STATIC_WAVPACK */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "14.4.2"
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#define _FILE_OFFSET_BITS 64
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#define _LARGEFILE_SOURCE 1
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
diff --git a/src/src/soxconfig.h.cmake b/src/src/soxconfig.h.cmake
new file mode 100644
index 0000000..69f4640
--- /dev/null
+++ b/src/src/soxconfig.h.cmake
@@ -0,0 +1,58 @@
+#define PACKAGE_VERSION "14.4.2"
+
+#cmakedefine EXTERNAL_GSM 1
+#cmakedefine EXTERNAL_LPC10 1
+#cmakedefine HAVE_ALSA 1
+#cmakedefine HAVE_AMRNB 1
+#cmakedefine HAVE_AMRWB 1
+#cmakedefine HAVE_AO 1
+#cmakedefine HAVE_BYTESWAP_H 1
+#cmakedefine HAVE_COREAUDIO 1
+#cmakedefine HAVE_FENV_H 1
+#cmakedefine HAVE_FLAC 1
+#cmakedefine HAVE_FMEMOPEN 1
+#cmakedefine HAVE_FSEEKO 1
+#cmakedefine HAVE_GETTIMEOFDAY 1
+#cmakedefine HAVE_GLOB_H 1
+#define HAVE_GSM 1
+#cmakedefine HAVE_ID3TAG 1
+#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_IO_H 1
+#cmakedefine HAVE_LAME_LAME_H 1
+#cmakedefine HAVE_LAME_SET_VBR_QUALITY 1
+#define HAVE_LPC10 1
+#cmakedefine HAVE_LRINT 1
+#cmakedefine HAVE_LTDL_H 1
+#cmakedefine HAVE_MACHINE_SOUNDCARD_H 1
+#cmakedefine HAVE_MAD_H 1
+#cmakedefine HAVE_MAGIC 1
+#cmakedefine HAVE_MKSTEMP 1
+#cmakedefine HAVE_MP3 1
+#cmakedefine HAVE_OGG_VORBIS 1
+#cmakedefine HAVE_OSS 1
+#cmakedefine HAVE_PNG 1
+#cmakedefine HAVE_POPEN 1
+#cmakedefine HAVE_PULSEAUDIO 1
+#cmakedefine HAVE_SNDFILE 1
+#cmakedefine HAVE_SNDFILE_1_0_18 1
+#cmakedefine HAVE_SNDIO 1
+#cmakedefine HAVE_SPEEXDSP 1
+#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_STRCASECMP 1
+#cmakedefine HAVE_STRING_H 1
+#cmakedefine HAVE_STRINGS_H 1
+#cmakedefine HAVE_STRRSTR 1
+#cmakedefine HAVE_SUN_AUDIO 1
+#cmakedefine HAVE_SUN_AUDIOIO_H 1
+#cmakedefine HAVE_SYS_AUDIOIO_H 1
+#cmakedefine HAVE_SYS_SOUNDCARD_H 1
+#cmakedefine HAVE_SYS_STAT_H 1
+#cmakedefine HAVE_SYS_TIMEB_H 1
+#cmakedefine HAVE_SYS_TIME_H 1
+#cmakedefine HAVE_SYS_TYPES_H 1
+#cmakedefine HAVE_SYS_UTSNAME_H 1
+#cmakedefine HAVE_TERMIOS_H 1
+#cmakedefine HAVE_UNISTD_H 1
+#cmakedefine HAVE_VSNPRINTF 1
+#cmakedefine HAVE_WAVPACK 1
+#cmakedefine WORDS_BIGENDIAN 1
diff --git a/src/src/soxconfig.h.in b/src/src/soxconfig.h.in
new file mode 100644
index 0000000..0a181a6
--- /dev/null
+++ b/src/src/soxconfig.h.in
@@ -0,0 +1,370 @@
+/* src/soxconfig.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to dlopen() amrnb. */
+#undef DL_AMRNB
+
+/* Define to dlopen() amrwb. */
+#undef DL_AMRWB
+
+/* Define to dlopen() lame. */
+#undef DL_LAME
+
+/* Define to dlopen() mad. */
+#undef DL_MAD
+
+/* Define to dlopen() sndfile. */
+#undef DL_SNDFILE
+
+/* Define to dlopen() libtwolame. */
+#undef DL_TWOLAME
+
+/* Define if SSP C support is enabled. */
+#undef ENABLE_SSP_CC
+
+/* Define if you are using an external GSM library */
+#undef EXTERNAL_GSM
+
+/* Define if you are using an external LPC10 library */
+#undef EXTERNAL_LPC10
+
+/* Define to 1 if you have alsa. */
+#undef HAVE_ALSA
+
+/* Define to 1 if you have amrnb. */
+#undef HAVE_AMRNB
+
+/* Define to 1 if you have amrwb. */
+#undef HAVE_AMRWB
+
+/* Define to 1 if you have the <amrwb/dec.h> header file. */
+#undef HAVE_AMRWB_DEC_H
+
+/* Define to 1 if you have ao. */
+#undef HAVE_AO
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+#undef HAVE_BYTESWAP_H
+
+/* Define to 1 if you have coreaudio. */
+#undef HAVE_COREAUDIO
+
+/* 1 if DISTRO is defined */
+#undef HAVE_DISTRO
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the <fenv.h> header file. */
+#undef HAVE_FENV_H
+
+/* Define to 1 if you have flac. */
+#undef HAVE_FLAC
+
+/* Define to 1 if you have the `fmemopen' function. */
+#undef HAVE_FMEMOPEN
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#undef HAVE_FSEEKO
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <glob.h> header file. */
+#undef HAVE_GLOB_H
+
+/* Define to 1 if you have gsm. */
+#undef HAVE_GSM
+
+/* Define to 1 if you have the <gsm/gsm.h> header file. */
+#undef HAVE_GSM_GSM_H
+
+/* Define to 1 if you have the <gsm.h> header file. */
+#undef HAVE_GSM_H
+
+/* Define to 1 if you have id3tag. */
+#undef HAVE_ID3TAG
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* 1 if should enable LADSPA */
+#undef HAVE_LADSPA_H
+
+/* Define to 1 if you have the <lame.h> header file. */
+#undef HAVE_LAME_H
+
+/* Define to 1 if lame supports optional ID3 tags. */
+#undef HAVE_LAME_ID3TAG
+
+/* Define to 1 if you have the <lame/lame.h> header file. */
+#undef HAVE_LAME_LAME_H
+
+/* Define to 1 if you have libltdl */
+#undef HAVE_LIBLTDL
+
+/* Define to 1 if you have the <libpng/png.h> header file. */
+#undef HAVE_LIBPNG_PNG_H
+
+/* Define to 1 if you have lpc10. */
+#undef HAVE_LPC10
+
+/* Define to 1 if you have the <lpc10.h> header file. */
+#undef HAVE_LPC10_H
+
+/* Define to 1 if you have the `lrint' function. */
+#undef HAVE_LRINT
+
+/* Define to 1 if you have the <ltdl.h> header file. */
+#undef HAVE_LTDL_H
+
+/* Define to 1 if you have the <machine/soundcard.h> header file. */
+#undef HAVE_MACHINE_SOUNDCARD_H
+
+/* Define to 1 if you have the <mad.h> header file. */
+#undef HAVE_MAD_H
+
+/* Define to 1 if you have magic. */
+#undef HAVE_MAGIC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mkstemp' function. */
+#undef HAVE_MKSTEMP
+
+/* Define to 1 if you have mp3. */
+#undef HAVE_MP3
+
+/* Define to 1 if you have oggvorbis. */
+#undef HAVE_OGG_VORBIS
+
+/* Define to 1 if you have the <opencore-amrnb/interf_dec.h> header file. */
+#undef HAVE_OPENCORE_AMRNB_INTERF_DEC_H
+
+/* Define to 1 if you have the <opencore-amrwb/dec_if.h> header file. */
+#undef HAVE_OPENCORE_AMRWB_DEC_IF_H
+
+/* Define to 1 if you have opus. */
+#undef HAVE_OPUS
+
+/* Define to 1 if you have oss. */
+#undef HAVE_OSS
+
+/* Define to 1 if you have PNG. */
+#undef HAVE_PNG
+
+/* Define to 1 if you have the <png.h> header file. */
+#undef HAVE_PNG_H
+
+/* Define to 1 if you have the `popen' function. */
+#undef HAVE_POPEN
+
+/* Define to 1 if you have pulseaudio. */
+#undef HAVE_PULSEAUDIO
+
+/* Define if you have libsndfile with SFC_SFC_SET_SCALE_INT_FLOAT_WRITE */
+#undef HAVE_SFC_SET_SCALE_INT_FLOAT_WRITE
+
+/* Define to 1 if you have sndfile. */
+#undef HAVE_SNDFILE
+
+/* Define if you have libsndfile >= 1.0.18 */
+#undef HAVE_SNDFILE_1_0_18
+
+/* Define if you have <sndfile.h> */
+#undef HAVE_SNDFILE_H
+
+/* Define to 1 if you have sndio. */
+#undef HAVE_SNDIO
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have sunaudio. */
+#undef HAVE_SUN_AUDIO
+
+/* Define to 1 if you have the <sun/audioio.h> header file. */
+#undef HAVE_SUN_AUDIOIO_H
+
+/* Define to 1 if you have the <sys/audioio.h> header file. */
+#undef HAVE_SYS_AUDIOIO_H
+
+/* Define to 1 if you have the <sys/soundcard.h> header file. */
+#undef HAVE_SYS_SOUNDCARD_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#undef HAVE_SYS_TIMEB_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define to 1 if you have the <twolame.h> header file. */
+#undef HAVE_TWOLAME_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have waveaudio. */
+#undef HAVE_WAVEAUDIO
+
+/* Define to 1 if you have wavpack. */
+#undef HAVE_WAVPACK
+
+/* Define to 1 to use win32 glob */
+#undef HAVE_WIN32_GLOB_H
+
+/* Define to 1 to use internal win32 ltdl */
+#undef HAVE_WIN32_LTDL_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have static alsa. */
+#undef STATIC_ALSA
+
+/* Define to 1 if you have static amrnb. */
+#undef STATIC_AMRNB
+
+/* Define to 1 if you have static amrwb. */
+#undef STATIC_AMRWB
+
+/* Define to 1 if you have static ao. */
+#undef STATIC_AO
+
+/* Define to 1 if you have static coreaudio. */
+#undef STATIC_COREAUDIO
+
+/* Define to 1 if you have static flac. */
+#undef STATIC_FLAC
+
+/* Define to 1 if you have static gsm. */
+#undef STATIC_GSM
+
+/* Define to 1 if you have static lpc10. */
+#undef STATIC_LPC10
+
+/* Define to 1 if you have static mp3. */
+#undef STATIC_MP3
+
+/* Define to 1 if you have static oggvorbis. */
+#undef STATIC_OGG_VORBIS
+
+/* Define to 1 if you have static opus. */
+#undef STATIC_OPUS
+
+/* Define to 1 if you have static oss. */
+#undef STATIC_OSS
+
+/* Define to 1 if you have static pulseaudio. */
+#undef STATIC_PULSEAUDIO
+
+/* Define to 1 if you have static sndfile. */
+#undef STATIC_SNDFILE
+
+/* Define to 1 if you have static sndio. */
+#undef STATIC_SNDIO
+
+/* Define to 1 if you have static sunaudio. */
+#undef STATIC_SUN_AUDIO
+
+/* Define to 1 if you have static waveaudio. */
+#undef STATIC_WAVEAUDIO
+
+/* Define to 1 if you have static wavpack. */
+#undef STATIC_WAVPACK
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
diff --git a/src/src/soxomp.h b/src/src/soxomp.h
new file mode 100644
index 0000000..61a4cb5
--- /dev/null
+++ b/src/src/soxomp.h
@@ -0,0 +1,47 @@
+#include "third_party/sox/src/src/soxconfig.h"
+
+#ifdef _OPENMP
+ #if _OPENMP >= 200805 /* OpenMP 3.0 */
+ #define HAVE_OPENMP 1
+ #endif
+ #if _OPENMP >= 201107 /* OpenMP 3.1 */
+ #define HAVE_OPENMP_3_1 1
+ #endif
+#endif
+
+#ifdef HAVE_OPENMP
+ #include <omp.h>
+#else
+
+typedef int omp_lock_t;
+typedef int omp_nest_lock_t;
+
+#define omp_set_num_threads(int) (void)0
+#define omp_get_num_threads() 1
+#define omp_get_max_threads() 1
+#define omp_get_thread_num() 0
+#define omp_get_num_procs() 1
+#define omp_in_parallel() 1
+
+#define omp_set_dynamic(int) (void)0
+#define omp_get_dynamic() 0
+
+#define omp_set_nested(int) (void)0
+#define omp_get_nested() 0
+
+#define omp_init_lock(omp_lock_t) (void)0
+#define omp_destroy_lock(omp_lock_t) (void)0
+#define omp_set_lock(omp_lock_t) (void)0
+#define omp_unset_lock(omp_lock_t) (void)0
+#define omp_test_lock(omp_lock_t) 0
+
+#define omp_init_nest_lock(omp_nest_lock_t) (void)0
+#define omp_destroy_nest_lock(omp_nest_lock_t) (void)0
+#define omp_set_nest_lock(omp_nest_lock_t) (void)0
+#define omp_unset_nest_lock(omp_nest_lock_t) (void)0
+#define omp_test_nest_lock(omp_nest_lock_t) 0
+
+#define omp_get_wtime() 0
+#define omp_get_wtick() 0
+
+#endif
diff --git a/src/src/spectrogram.c b/src/src/spectrogram.c
new file mode 100644
index 0000000..13f35dc
--- /dev/null
+++ b/src/src/spectrogram.c
@@ -0,0 +1,698 @@
+/* libSoX effect: Spectrogram (c) 2008-9 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef NDEBUG /* Enable assert always. */
+#undef NDEBUG /* Must undef above assert.h or other that might include it. */
+#endif
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/fft4g.h"
+#include <assert.h>
+#include <math.h>
+#ifdef HAVE_LIBPNG_PNG_H
+#include <libpng/png.h>
+#else
+#include "third_party/png/v1_2_49/png.h"
+#endif
+#include <zlib.h>
+
+/* For SET_BINARY_MODE: */
+#include <fcntl.h>
+#ifdef HAVE_IO_H
+ #include <io.h>
+#endif
+
+#define MAX_FFT_SIZE 4096
+#define is_p2(x) !(x & (x - 1))
+
+#define MAX_X_SIZE 200000
+
+typedef enum {Window_Hann, Window_Hamming, Window_Bartlett, Window_Rectangular, Window_Kaiser, Window_Dolph} win_type_t;
+static lsx_enum_item const window_options[] = {
+ LSX_ENUM_ITEM(Window_,Hann)
+ LSX_ENUM_ITEM(Window_,Hamming)
+ LSX_ENUM_ITEM(Window_,Bartlett)
+ LSX_ENUM_ITEM(Window_,Rectangular)
+ LSX_ENUM_ITEM(Window_,Kaiser)
+ LSX_ENUM_ITEM(Window_,Dolph)
+ {0, 0}};
+
+typedef struct {
+ /* Parameters */
+ double pixels_per_sec, window_adjust;
+ int x_size0, y_size, Y_size, dB_range, gain, spectrum_points, perm;
+ sox_bool monochrome, light_background, high_colour, slack_overlap, no_axes;
+ sox_bool raw, alt_palette, truncate;
+ win_type_t win_type;
+ char const * out_name, * title, * comment;
+ char const *duration_str, *start_time_str;
+ sox_bool using_stdout; /* output image to stdout */
+
+ /* Shared work area */
+ double * shared, * * shared_ptr;
+
+ /* Per-channel work area */
+ int WORK; /* Start of work area is marked by this dummy variable. */
+ uint64_t skip;
+ int dft_size, step_size, block_steps, block_num, rows, cols, read;
+ int x_size, end, end_min, last_end;
+ sox_bool truncated;
+ double buf[MAX_FFT_SIZE], dft_buf[MAX_FFT_SIZE], window[MAX_FFT_SIZE+1];
+ double block_norm, max, magnitudes[(MAX_FFT_SIZE>>1) + 1];
+ float * dBfs;
+} priv_t;
+
+#define secs(cols) \
+ ((double)(cols) * p->step_size * p->block_steps / effp->in_signal.rate)
+
+static unsigned char const alt_palette[] =
+ "\0\0\0\0\0\3\0\1\5\0\1\10\0\1\12\0\1\13\0\1\16\1\2\20\1\2\22\1\2\25\1\2\26"
+ "\1\2\30\1\3\33\1\3\35\1\3\37\1\3\40\1\3\"\1\3$\1\3%\1\3'\1\3(\1\3*\1\3,\1"
+ "\3.\1\3/\1\3""0\1\3""2\1\3""4\2\3""6\4\3""8\5\3""9\7\3;\11\3=\13\3?\16\3"
+ "A\17\2B\21\2D\23\2F\25\2H\27\2J\30\2K\32\2M\35\2O\40\2Q$\2S(\2U+\2W0\2Z3"
+ "\2\\7\2_;\2a>\2cB\2eE\2hI\2jM\2lQ\2nU\2pZ\2r_\2tc\2uh\2vl\2xp\3zu\3|z\3}"
+ "~\3~\203\3\200\207\3\202\214\3\204\220\3\205\223\3\203\226\3\200\230\3~\233"
+ "\3|\236\3z\240\3x\243\3u\246\3s\251\3q\253\3o\256\3m\261\3j\263\3h\266\3"
+ "f\272\3b\274\3^\300\3Z\303\3V\307\3R\312\3N\315\3J\321\3F\324\3C\327\3>\333"
+ "\3:\336\3""6\342\3""2\344\3/\346\7-\350\15,\352\21+\354\27*\355\33)\356\40"
+ "(\360&'\362*&\364/$\3654#\3669#\370>!\372C\40\374I\40\374O\"\374V&\374]*"
+ "\374d,\374k0\374r3\374z7\375\201;\375\210>\375\217B\375\226E\375\236I\375"
+ "\245M\375\254P\375\261T\375\267X\375\274\\\375\301a\375\306e\375\313i\375"
+ "\320m\376\325q\376\332v\376\337z\376\344~\376\351\202\376\356\206\376\363"
+ "\213\375\365\217\374\366\223\373\367\230\372\367\234\371\370\241\370\371"
+ "\245\367\371\252\366\372\256\365\372\263\364\373\267\363\374\274\361\375"
+ "\300\360\375\305\360\376\311\357\376\314\357\376\317\360\376\321\360\376"
+ "\324\360\376\326\360\376\330\360\376\332\361\377\335\361\377\337\361\377"
+ "\341\361\377\344\361\377\346\362\377\350\362\377\353";
+#define alt_palette_len ((array_length(alt_palette) - 1) / 3)
+
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ uint64_t dummy;
+ char const * next;
+ int c;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, "+S:d:x:X:y:Y:z:Z:q:p:W:w:st:c:AarmlhTo:", NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ p->dB_range = 120, p->spectrum_points = 249, p->perm = 1; /* Non-0 defaults */
+ p->out_name = "spectrogram.png", p->comment = "Created by SoX";
+
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ GETOPT_NUMERIC(optstate, 'x', x_size0 , 100, MAX_X_SIZE)
+ GETOPT_NUMERIC(optstate, 'X', pixels_per_sec, 1 , 5000)
+ GETOPT_NUMERIC(optstate, 'y', y_size , 64 , 1200)
+ GETOPT_NUMERIC(optstate, 'Y', Y_size , 130, MAX_FFT_SIZE / 2 + 2)
+ GETOPT_NUMERIC(optstate, 'z', dB_range , 20 , 180)
+ GETOPT_NUMERIC(optstate, 'Z', gain ,-100, 100)
+ GETOPT_NUMERIC(optstate, 'q', spectrum_points, 0 , p->spectrum_points)
+ GETOPT_NUMERIC(optstate, 'p', perm , 1 , 6)
+ GETOPT_NUMERIC(optstate, 'W', window_adjust , -10, 10)
+ case 'w': p->win_type = lsx_enum_option(c, optstate.arg, window_options); break;
+ case 's': p->slack_overlap = sox_true; break;
+ case 'A': p->alt_palette = sox_true; break;
+ case 'a': p->no_axes = sox_true; break;
+ case 'r': p->raw = sox_true; break;
+ case 'm': p->monochrome = sox_true; break;
+ case 'l': p->light_background = sox_true; break;
+ case 'h': p->high_colour = sox_true; break;
+ case 'T': p->truncate = sox_true; break;
+ case 't': p->title = optstate.arg; break;
+ case 'c': p->comment = optstate.arg; break;
+ case 'o': p->out_name = optstate.arg; break;
+ case 'S': next = lsx_parseposition(0., optstate.arg, NULL, (uint64_t)0, (uint64_t)0, '=');
+ if (next && !*next) {p->start_time_str = lsx_strdup(optstate.arg); break;}
+ return lsx_usage(effp);
+ case 'd': next = lsx_parsesamples(1e5, optstate.arg, &dummy, 't');
+ if (next && !*next) {p->duration_str = lsx_strdup(optstate.arg); break;}
+ return lsx_usage(effp);
+ default: lsx_fail("invalid option `-%c'", optstate.opt); return lsx_usage(effp);
+ }
+ if (!!p->x_size0 + !!p->pixels_per_sec + !!p->duration_str > 2) {
+ lsx_fail("only two of -x, -X, -d may be given");
+ return SOX_EOF;
+ }
+ if (p->y_size && p->Y_size) {
+ lsx_fail("only one of -y, -Y may be given");
+ return SOX_EOF;
+ }
+ p->gain = -p->gain;
+ --p->perm;
+ p->spectrum_points += 2;
+ if (p->alt_palette)
+ p->spectrum_points = min(p->spectrum_points, (int)alt_palette_len);
+ p->shared_ptr = &p->shared;
+ if (!strcmp(p->out_name, "-")) {
+ if (effp->global_info->global_info->stdout_in_use_by) {
+ lsx_fail("stdout already in use by `%s'", effp->global_info->global_info->stdout_in_use_by);
+ return SOX_EOF;
+ }
+ effp->global_info->global_info->stdout_in_use_by = effp->handler.name;
+ p->using_stdout = sox_true;
+ }
+ return optstate.ind !=argc || p->win_type == INT_MAX? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static double make_window(priv_t * p, int end)
+{
+ double sum = 0, * w = end < 0? p->window : p->window + end;
+ int i, n = 1 + p->dft_size - abs(end);
+
+ if (end) memset(p->window, 0, sizeof(p->window));
+ for (i = 0; i < n; ++i) w[i] = 1;
+ switch (p->win_type) {
+ case Window_Hann: lsx_apply_hann(w, n); break;
+ case Window_Hamming: lsx_apply_hamming(w, n); break;
+ case Window_Bartlett: lsx_apply_bartlett(w, n); break;
+ case Window_Rectangular: break;
+ case Window_Kaiser: lsx_apply_kaiser(w, n, lsx_kaiser_beta(
+ (p->dB_range + p->gain) * (1.1 + p->window_adjust / 50), .1)); break;
+ default: lsx_apply_dolph(w, n,
+ (p->dB_range + p->gain) * (1.005 + p->window_adjust / 50) + 6);
+ }
+ for (i = 0; i < p->dft_size; ++i) sum += p->window[i];
+ for (--n, i = 0; i < p->dft_size; ++i) p->window[i] *= 2 / sum
+ * sqr((double)n / p->dft_size); /* empirical small window adjustment */
+ return sum;
+}
+
+static double * rdft_init(int n)
+{
+ double * q = lsx_malloc(2 * (n / 2 + 1) * n * sizeof(*q)), * p = q;
+ int i, j;
+ for (j = 0; j <= n / 2; ++j) for (i = 0; i < n; ++i)
+ *p++ = cos(2 * M_PI * j * i / n), *p++ = sin(2 * M_PI * j * i / n);
+ return q;
+}
+
+#define _ re += in[i] * *q++, im += in[i++] * *q++,
+static void rdft_p(double const * q, double const * in, double * out, int n)
+{
+ int i, j;
+ for (j = 0; j <= n / 2; ++j) {
+ double re = 0, im = 0;
+ for (i = 0; i < (n & ~7);) _ _ _ _ _ _ _ _ 0;
+ while (i < n) _ 0;
+ *out++ += re * re + im * im;
+ }
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ double actual, duration = 0.0, start_time = 0.0,
+ pixels_per_sec = p->pixels_per_sec;
+ uint64_t d;
+
+ memset(&p->WORK, 0, sizeof(*p) - field_offset(priv_t, WORK));
+
+ if (p->duration_str) {
+ lsx_parsesamples(effp->in_signal.rate, p->duration_str, &d, 't');
+ duration = d / effp->in_signal.rate;
+ }
+ if (p->start_time_str) {
+ uint64_t in_length = effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN;
+ if (!lsx_parseposition(effp->in_signal.rate, p->start_time_str, &d, (uint64_t)0, in_length, '=') || d == SOX_UNKNOWN_LEN) {
+ lsx_fail("-S option: audio length is unknown");
+ return SOX_EOF;
+ }
+ start_time = d / effp->in_signal.rate;
+ p->skip = d;
+ }
+
+ p->x_size = p->x_size0;
+ while (sox_true) {
+ if (!pixels_per_sec && p->x_size && duration)
+ pixels_per_sec = min(5000, p->x_size / duration);
+ else if (!p->x_size && pixels_per_sec && duration)
+ p->x_size = min(MAX_X_SIZE, (int)(pixels_per_sec * duration + .5));
+ if (!duration && effp->in_signal.length != SOX_UNKNOWN_LEN) {
+ duration = effp->in_signal.length / (effp->in_signal.rate * effp->in_signal.channels);
+ duration -= start_time;
+ if (duration <= 0)
+ duration = 1;
+ continue;
+ } else if (!p->x_size) {
+ p->x_size = 800;
+ continue;
+ } else if (!pixels_per_sec) {
+ pixels_per_sec = 100;
+ continue;
+ }
+ break;
+ }
+
+ if (p->y_size) {
+ p->dft_size = 2 * (p->y_size - 1);
+ if (!is_p2(p->dft_size) && !effp->flow)
+ p->shared = rdft_init(p->dft_size);
+ } else {
+ int y = max(32, (p->Y_size? p->Y_size : 550) / effp->in_signal.channels - 2);
+ for (p->dft_size = 128; p->dft_size <= y; p->dft_size <<= 1);
+ }
+ if (is_p2(p->dft_size) && !effp->flow)
+ lsx_safe_rdft(p->dft_size, 1, p->dft_buf);
+ lsx_debug("duration=%g x_size=%i pixels_per_sec=%g dft_size=%i", duration, p->x_size, pixels_per_sec, p->dft_size);
+
+ p->end = p->dft_size;
+ p->rows = (p->dft_size >> 1) + 1;
+ actual = make_window(p, p->last_end = 0);
+ lsx_debug("window_density=%g", actual / p->dft_size);
+ p->step_size = (p->slack_overlap? sqrt(actual * p->dft_size) : actual) + .5;
+ p->block_steps = effp->in_signal.rate / pixels_per_sec;
+ p->step_size = p->block_steps / ceil((double)p->block_steps / p->step_size) +.5;
+ p->block_steps = floor((double)p->block_steps / p->step_size +.5);
+ p->block_norm = 1. / p->block_steps;
+ actual = effp->in_signal.rate / p->step_size / p->block_steps;
+ if (!effp->flow && actual != pixels_per_sec)
+ lsx_report("actual pixels/s = %g", actual);
+ lsx_debug("step_size=%i block_steps=%i", p->step_size, p->block_steps);
+ p->max = -p->dB_range;
+ p->read = (p->step_size - p->dft_size) / 2;
+ return SOX_SUCCESS;
+}
+
+static int do_column(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ int i;
+
+ if (p->cols == p->x_size) {
+ p->truncated = sox_true;
+ if (!effp->flow)
+ lsx_report("PNG truncated at %g seconds", secs(p->cols));
+ return p->truncate? SOX_EOF : SOX_SUCCESS;
+ }
+ ++p->cols;
+ p->dBfs = lsx_realloc(p->dBfs, p->cols * p->rows * sizeof(*p->dBfs));
+ /* FIXME: allocate in larger steps (for several columns) */
+ for (i = 0; i < p->rows; ++i) {
+ double dBfs = 10 * log10(p->magnitudes[i] * p->block_norm);
+ p->dBfs[(p->cols - 1) * p->rows + i] = dBfs + p->gain;
+ p->max = max(dBfs, p->max);
+ }
+ memset(p->magnitudes, 0, p->rows * sizeof(*p->magnitudes));
+ p->block_num = 0;
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp,
+ const sox_sample_t * ibuf, sox_sample_t * obuf,
+ size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = *isamp = *osamp = min(*isamp, *osamp);
+ int i;
+
+ memcpy(obuf, ibuf, len * sizeof(*obuf)); /* Pass on audio unaffected */
+
+ if (p->skip) {
+ if (p->skip >= len) {
+ p->skip -= len;
+ return SOX_SUCCESS;
+ }
+ ibuf += p->skip;
+ len -= p->skip;
+ p->skip = 0;
+ }
+ while (!p->truncated) {
+ if (p->read == p->step_size) {
+ memmove(p->buf, p->buf + p->step_size,
+ (p->dft_size - p->step_size) * sizeof(*p->buf));
+ p->read = 0;
+ }
+ for (; len && p->read < p->step_size; --len, ++p->read, --p->end)
+ p->buf[p->dft_size - p->step_size + p->read] =
+ SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf++,);
+ if (p->read != p->step_size)
+ break;
+
+ if ((p->end = max(p->end, p->end_min)) != p->last_end)
+ make_window(p, p->last_end = p->end);
+ for (i = 0; i < p->dft_size; ++i) p->dft_buf[i] = p->buf[i] * p->window[i];
+ if (is_p2(p->dft_size)) {
+ lsx_safe_rdft(p->dft_size, 1, p->dft_buf);
+ p->magnitudes[0] += sqr(p->dft_buf[0]);
+ for (i = 1; i < p->dft_size >> 1; ++i)
+ p->magnitudes[i] += sqr(p->dft_buf[2*i]) + sqr(p->dft_buf[2*i+1]);
+ p->magnitudes[p->dft_size >> 1] += sqr(p->dft_buf[1]);
+ }
+ else rdft_p(*p->shared_ptr, p->dft_buf, p->magnitudes, p->dft_size);
+ if (++p->block_num == p->block_steps && do_column(effp) == SOX_EOF)
+ return SOX_EOF;
+ }
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf_, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ if (!p->truncated) {
+ sox_sample_t * ibuf = lsx_calloc(p->dft_size, sizeof(*ibuf));
+ sox_sample_t * obuf = lsx_calloc(p->dft_size, sizeof(*obuf));
+ size_t isamp = (p->dft_size - p->step_size) / 2;
+ int left_over = (isamp + p->read) % p->step_size;
+
+ if (left_over >= p->step_size >> 1)
+ isamp += p->step_size - left_over;
+ lsx_debug("cols=%i left=%i end=%i", p->cols, p->read, p->end);
+ p->end = 0, p->end_min = -p->dft_size;
+ if (flow(effp, ibuf, obuf, &isamp, &isamp) == SOX_SUCCESS && p->block_num) {
+ p->block_norm *= (double)p->block_steps / p->block_num;
+ do_column(effp);
+ }
+ lsx_debug("flushed cols=%i left=%i end=%i", p->cols, p->read, p->end);
+ free(obuf);
+ free(ibuf);
+ }
+ (void)obuf_, *osamp = 0;
+ return SOX_SUCCESS;
+}
+
+enum {Background, Text, Labels, Grid, fixed_palette};
+
+static unsigned colour(priv_t const * p, double x)
+{
+ unsigned c = x < -p->dB_range? 0 : x >= 0? p->spectrum_points - 1 :
+ 1 + (1 + x / p->dB_range) * (p->spectrum_points - 2);
+ return fixed_palette + c;
+}
+
+static void make_palette(priv_t const * p, png_color * palette)
+{
+ int i;
+
+ if (p->light_background) {
+ memcpy(palette++, (p->monochrome)? "\337\337\337":"\335\330\320", (size_t)3);
+ memcpy(palette++, "\0\0\0" , (size_t)3);
+ memcpy(palette++, "\077\077\077", (size_t)3);
+ memcpy(palette++, "\077\077\077", (size_t)3);
+ } else {
+ memcpy(palette++, "\0\0\0" , (size_t)3);
+ memcpy(palette++, "\377\377\377", (size_t)3);
+ memcpy(palette++, "\277\277\277", (size_t)3);
+ memcpy(palette++, "\177\177\177", (size_t)3);
+ }
+ for (i = 0; i < p->spectrum_points; ++i) {
+ double c[3], x = (double)i / (p->spectrum_points - 1);
+ int at = p->light_background? p->spectrum_points - 1 - i : i;
+ if (p->monochrome) {
+ c[2] = c[1] = c[0] = x;
+ if (p->high_colour) {
+ c[(1 + p->perm) % 3] = x < .4? 0 : 5 / 3. * (x - .4);
+ if (p->perm < 3)
+ c[(2 + p->perm) % 3] = x < .4? 0 : 5 / 3. * (x - .4);
+ }
+ palette[at].red = .5 + 255 * c[0];
+ palette[at].green= .5 + 255 * c[1];
+ palette[at].blue = .5 + 255 * c[2];
+ continue;
+ }
+ if (p->high_colour) {
+ static const int states[3][7] = {
+ {4,5,0,0,2,1,1}, {0,0,2,1,1,3,2}, {4,1,1,3,0,0,2}};
+ int j, phase_num = min(7 * x, 6);
+ for (j = 0; j < 3; ++j) switch (states[j][phase_num]) {
+ case 0: c[j] = 0; break;
+ case 1: c[j] = 1; break;
+ case 2: c[j] = sin((7 * x - phase_num) * M_PI / 2); break;
+ case 3: c[j] = cos((7 * x - phase_num) * M_PI / 2); break;
+ case 4: c[j] = 7 * x - phase_num; break;
+ case 5: c[j] = 1 - (7 * x - phase_num); break;
+ }
+ } else if (p->alt_palette) {
+ int n = (double)i / (p->spectrum_points - 1) * (alt_palette_len - 1) + .5;
+ c[0] = alt_palette[3 * n + 0] / 255.;
+ c[1] = alt_palette[3 * n + 1] / 255.;
+ c[2] = alt_palette[3 * n + 2] / 255.;
+ } else {
+ if (x < .13) c[0] = 0;
+ else if (x < .73) c[0] = 1 * sin((x - .13) / .60 * M_PI / 2);
+ else c[0] = 1;
+ if (x < .60) c[1] = 0;
+ else if (x < .91) c[1] = 1 * sin((x - .60) / .31 * M_PI / 2);
+ else c[1] = 1;
+ if (x < .60) c[2] = .5 * sin((x - .00) / .60 * M_PI);
+ else if (x < .78) c[2] = 0;
+ else c[2] = (x - .78) / .22;
+ }
+ palette[at].red = .5 + 255 * c[p->perm % 3];
+ palette[at].green= .5 + 255 * c[(1 + p->perm + (p->perm % 2)) % 3];
+ palette[at].blue = .5 + 255 * c[(2 + p->perm - (p->perm % 2)) % 3];
+ }
+}
+
+static const Bytef fixed[] =
+ "x\332eT\241\266\2450\fDVV>Y\371$re%2\237\200|2\22YY\211D\"+\337'<y\345\312"
+ "\375\fd\345f\222\224\313\236\235{\270\344L\247a\232\4\246\351\201d\230\222"
+ "\304D\364^ \352\362S\"m\347\311\237\237\27\64K\243\2302\265\35\v\371<\363y"
+ "\354_\226g\354\214)e \2458\341\17\20J4\215[z<\271\277\367\0\63\64@\177\330c"
+ "\227\204 Ir.\5$U\200\260\224\326S\17\200=\\k\20QA\334%\342\20*\303P\234\211"
+ "\366\36#\370R\276_\316s-\345\222Dlz\363my*;\217\373\346z\267\343\236\364\246"
+ "\236\365\2419\305p\333\267\23(\207\265\333\233\325Y\342\243\265\357\262\215"
+ "\263t\271$\276\226ea\271.\367&\320\347\202_\234\27\377\345\222\253?\3422\364"
+ "\207y\256\236\229\331\33\f\376\227\266\"\356\253j\366\363\347\334US\34]\371?"
+ "\255\371\336\372z\265v\34\226\247\32\324\217\334\337\317U4\16\316{N\370\31"
+ "\365\357iL\231y\33y\264\211D7\337\4\244\261\220D\346\1\261\357\355>\3\342"
+ "\223\363\0\303\277\f[\214A,p\34`\255\355\364\37\372\224\342\277\f\207\255\36"
+ "_V\7\34\241^\316W\257\177\b\242\300\34\f\276\33?/9_\331f\346\36\25Y)\2301"
+ "\257\2414|\35\365\237\3424k\3\244\3\242\261\6\b\275>z$\370\215:\270\363w\36/"
+ "\265kF\v\20o6\242\301\364\336\27\325\257\321\364fs\231\215G\32=\257\305Di"
+ "\304^\177\304R\364Q=\225\373\33\320\375\375\372\200\337\37\374}\334\337\20"
+ "\364\310(]\304\267b\177\326Yrj\312\277\373\233\37\340";
+static unsigned char * font;
+#define font_x 5
+#define font_y 12
+#define font_X (font_x + 1)
+
+#define pixel(x,y) pixels[(y) * cols + (x)]
+#define print_at(x,y,c,t) print_at_(pixels,cols,x,y,c,t,0)
+#define print_up(x,y,c,t) print_at_(pixels,cols,x,y,c,t,1)
+
+static void print_at_(png_byte * pixels, int cols, int x, int y, int c, char const * text, int orientation)
+{
+ for (;*text; ++text) {
+ int pos = ((*text < ' ' || *text > '~'? '~' + 1 : *text) - ' ') * font_y;
+ int i, j;
+ for (i = 0; i < font_y; ++i) {
+ unsigned line = font[pos++];
+ for (j = 0; j < font_x; ++j, line <<= 1)
+ if (line & 0x80) switch (orientation) {
+ case 0: pixel(x + j, y - i) = c; break;
+ case 1: pixel(x + i, y + j) = c; break;
+ }
+ }
+ switch (orientation) {
+ case 0: x += font_X; break;
+ case 1: y += font_X; break;
+ }
+ }
+}
+
+static int axis(double to, int max_steps, double * limit, char * * prefix)
+{
+ double scale = 1, step = max(1, 10 * to);
+ int i, prefix_num = 0;
+ if (max_steps) {
+ double try, log_10 = HUGE_VAL, min_step = (to *= 10) / max_steps;
+ for (i = 5; i; i >>= 1) if ((try = ceil(log10(min_step * i))) <= log_10)
+ step = pow(10., log_10 = try) / i, log_10 -= i > 1;
+ prefix_num = floor(log_10 / 3);
+ scale = pow(10., -3. * prefix_num);
+ }
+ *prefix = "pnum-kMGTPE" + prefix_num + (prefix_num? 4 : 11);
+ *limit = to * scale;
+ return step * scale + .5;
+}
+
+#define below 48
+#define left 58
+#define between 37
+#define spectrum_width 14
+#define right 35
+
+static int stop(sox_effect_t * effp) /* only called, by end(), on flow 0 */
+{
+ priv_t * p = (priv_t *) effp->priv;
+ FILE * file;
+ uLong font_len = 96 * font_y;
+ int chans = effp->in_signal.channels;
+ int c_rows = p->rows * chans + chans - 1;
+ int rows = p->raw? c_rows : below + c_rows + 30 + 20 * !!p->title;
+ int cols = p->raw? p->cols : left + p->cols + between + spectrum_width + right;
+ png_byte * pixels = lsx_malloc(cols * rows * sizeof(*pixels));
+ png_bytepp png_rows = lsx_malloc(rows * sizeof(*png_rows));
+ png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0,0);
+ png_infop png_info = png_create_info_struct(png);
+ png_color palette[256];
+ int i, j, k, base, step, tick_len = 3 - p->no_axes;
+ char text[200], * prefix;
+ double limit;
+
+ free(p->shared);
+ if (p->using_stdout) {
+ SET_BINARY_MODE(stdout);
+ file = stdout;
+ } else {
+ file = fopen(p->out_name, "wb");
+ if (!file) {
+ lsx_fail("failed to create `%s': %s", p->out_name, strerror(errno));
+ goto error;
+ }
+ }
+ lsx_debug("signal-max=%g", p->max);
+ font = lsx_malloc(font_len);
+ assert(uncompress(font, &font_len, fixed, sizeof(fixed)-1) == Z_OK);
+ make_palette(p, palette);
+ memset(pixels, Background, cols * rows * sizeof(*pixels));
+ png_init_io(png, file);
+ png_set_PLTE(png, png_info, palette, fixed_palette + p->spectrum_points);
+ png_set_IHDR(png, png_info, (png_uint_32)cols, (png_uint_32)rows, 8,
+ PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+ for (j = 0; j < rows; ++j) /* Put (0,0) at bottom-left of PNG */
+ png_rows[rows - 1 - j] = (png_bytep)(pixels + j * cols);
+
+ /* Spectrogram */
+ for (k = 0; k < chans; ++k) {
+ priv_t * q = (priv_t *)(effp - effp->flow + k)->priv;
+ base = !p->raw * below + (chans - 1 - k) * (p->rows + 1);
+ for (j = 0; j < p->rows; ++j) {
+ for (i = 0; i < p->cols; ++i)
+ pixel(!p->raw * left + i, base + j) = colour(p, q->dBfs[i*p->rows + j]);
+ if (!p->raw && !p->no_axes) /* Y-axis lines */
+ pixel(left - 1, base + j) = pixel(left + p->cols, base + j) = Grid;
+ }
+ if (!p->raw && !p->no_axes) for (i = -1; i <= p->cols; ++i) /* X-axis lines */
+ pixel(left + i, base - 1) = pixel(left + i, base + p->rows) = Grid;
+ }
+
+ if (!p->raw) {
+ if (p->title && (i = (int)strlen(p->title) * font_X) < cols + 1) /* Title */
+ print_at((cols - i) / 2, rows - font_y, Text, p->title);
+
+ if ((int)strlen(p->comment) * font_X < cols + 1) /* Footer comment */
+ print_at(1, font_y, Text, p->comment);
+
+ /* X-axis */
+ step = axis(secs(p->cols), p->cols / (font_X * 9 / 2), &limit, &prefix);
+ sprintf(text, "Time (%.1ss)", prefix); /* Axis label */
+ print_at(left + (p->cols - font_X * (int)strlen(text)) / 2, 24, Text, text);
+ for (i = 0; i <= limit; i += step) {
+ int y, x = limit? (double)i / limit * p->cols + .5 : 0;
+ for (y = 0; y < tick_len; ++y) /* Ticks */
+ pixel(left-1+x, below-1-y) = pixel(left-1+x, below+c_rows+y) = Grid;
+ if (step == 5 && (i%10))
+ continue;
+ sprintf(text, "%g", .1 * i); /* Tick labels */
+ x = left + x - 3 * strlen(text);
+ print_at(x, below - 6, Labels, text);
+ print_at(x, below + c_rows + 14, Labels, text);
+ }
+
+ /* Y-axis */
+ step = axis(effp->in_signal.rate / 2,
+ (p->rows - 1) / ((font_y * 3 + 1) >> 1), &limit, &prefix);
+ sprintf(text, "Frequency (%.1sHz)", prefix); /* Axis label */
+ print_up(10, below + (c_rows - font_X * (int)strlen(text)) / 2, Text, text);
+ for (k = 0; k < chans; ++k) {
+ base = below + k * (p->rows + 1);
+ for (i = 0; i <= limit; i += step) {
+ int x, y = limit? (double)i / limit * (p->rows - 1) + .5 : 0;
+ for (x = 0; x < tick_len; ++x) /* Ticks */
+ pixel(left-1-x, base+y) = pixel(left+p->cols+x, base+y) = Grid;
+ if ((step == 5 && (i%10)) || (!i && k && chans > 1))
+ continue;
+ sprintf(text, i?"%5g":" DC", .1 * i); /* Tick labels */
+ print_at(left - 4 - font_X * 5, base + y + 5, Labels, text);
+ sprintf(text, i?"%g":"DC", .1 * i);
+ print_at(left + p->cols + 6, base + y + 5, Labels, text);
+ }
+ }
+
+ /* Z-axis */
+ k = min(400, c_rows);
+ base = below + (c_rows - k) / 2;
+ print_at(cols - right - 2 - font_X, base - 13, Text, "dBFS");/* Axis label */
+ for (j = 0; j < k; ++j) { /* Spectrum */
+ png_byte b = colour(p, p->dB_range * (j / (k - 1.) - 1));
+ for (i = 0; i < spectrum_width; ++i)
+ pixel(cols - right - 1 - i, base + j) = b;
+ }
+ step = 10 * ceil(p->dB_range / 10. * (font_y + 2) / (k - 1));
+ for (i = 0; i <= p->dB_range; i += step) { /* (Tick) labels */
+ int y = (double)i / p->dB_range * (k - 1) + .5;
+ sprintf(text, "%+i", i - p->gain - p->dB_range);
+ print_at(cols - right + 1, base + y + 5, Labels, text);
+ }
+ }
+ free(font);
+ png_set_rows(png, png_info, png_rows);
+ png_write_png(png, png_info, PNG_TRANSFORM_IDENTITY, NULL);
+ if (!p->using_stdout)
+ fclose(file);
+error: png_destroy_write_struct(&png, &png_info);
+ free(png_rows);
+ free(pixels);
+ free(p->dBfs);
+ return SOX_SUCCESS;
+}
+
+static int end(sox_effect_t * effp)
+{
+ priv_t *p = (priv_t *)effp->priv;
+ if (effp->flow == 0)
+ return stop(effp);
+ free(p->dBfs);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_spectrogram_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"spectrogram", 0, SOX_EFF_MODIFY,
+ getopts, start, flow, drain, end, 0, sizeof(priv_t)};
+ static char const * lines[] = {
+ "[options]",
+ "\t-x num\tX-axis size in pixels; default derived or 800",
+ "\t-X num\tX-axis pixels/second; default derived or 100",
+ "\t-y num\tY-axis size in pixels (per channel); slow if not 1 + 2^n",
+ "\t-Y num\tY-height total (i.e. not per channel); default 550",
+ "\t-z num\tZ-axis range in dB; default 120",
+ "\t-Z num\tZ-axis maximum in dBFS; default 0",
+ "\t-q num\tZ-axis quantisation (0 - 249); default 249",
+ "\t-w name\tWindow: Hann(default)/Hamming/Bartlett/Rectangular/Kaiser/Dolph",
+ "\t-W num\tWindow adjust parameter (-10 - 10); applies only to Kaiser/Dolph",
+ "\t-s\tSlack overlap of windows",
+ "\t-a\tSuppress axis lines",
+ "\t-r\tRaw spectrogram; no axes or legends",
+ "\t-l\tLight background",
+ "\t-m\tMonochrome",
+ "\t-h\tHigh colour",
+ "\t-p num\tPermute colours (1 - 6); default 1",
+ "\t-A\tAlternative, inferior, fixed colour-set (for compatibility only)",
+ "\t-t text\tTitle text",
+ "\t-c text\tComment text",
+ "\t-o text\tOutput file name; default `spectrogram.png'",
+ "\t-d time\tAudio duration to fit to X-axis; e.g. 1:00, 48",
+ "\t-S position\tStart the spectrogram at the given input position",
+ };
+ static char * usage;
+ handler.usage = lsx_usage_lines(&usage, lines, array_length(lines));
+ return &handler;
+}
diff --git a/src/src/speed.c b/src/src/speed.c
new file mode 100644
index 0000000..0deba24
--- /dev/null
+++ b/src/src/speed.c
@@ -0,0 +1,73 @@
+/* libSoX Effect: Adjust the audio speed (pitch and tempo together)
+ * (c) 2006,8 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *
+ * Adjustment is given as the ratio of the new speed to the old speed, or as
+ * a number of cents (100ths of a semitone) to change. Speed change is
+ * actually performed by whichever resampling effect is in effect.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef struct {
+ double factor;
+} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ sox_bool is_cents = sox_false;
+
+ --argc, ++argv;
+ if (argc == 1) {
+ char c, dummy;
+ int scanned = sscanf(*argv, "%lf%c %c", &p->factor, &c, &dummy);
+ if (scanned == 1 || (scanned == 2 && c == 'c')) {
+ is_cents |= scanned == 2;
+ if (is_cents || p->factor > 0) {
+ p->factor = is_cents? pow(2., p->factor / 1200) : p->factor;
+ return SOX_SUCCESS;
+ }
+ }
+ }
+ return lsx_usage(effp);
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+
+ if (p->factor == 1)
+ return SOX_EFF_NULL;
+
+ effp->out_signal.rate = effp->in_signal.rate * p->factor;
+
+ effp->out_signal.length = effp->in_signal.length;
+ /* audio length if measured in samples doesn't change */
+
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_speed_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "speed", "factor[c]",
+ SOX_EFF_MCHAN | SOX_EFF_RATE | SOX_EFF_LENGTH | SOX_EFF_MODIFY,
+ getopts, start, lsx_flow_copy, 0, 0, 0, sizeof(priv_t)};
+ return &handler;
+}
diff --git a/src/src/sphere.c b/src/src/sphere.c
new file mode 100644
index 0000000..2ce1c87
--- /dev/null
+++ b/src/src/sphere.c
@@ -0,0 +1,199 @@
+/* libSoX NIST Sphere file format handler.
+ *
+ * August 7, 2000
+ *
+ * Copyright (C) 2000 Chris Bagwell (cbagwell@sprynet.com)
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+static int start_read(sox_format_t * ft)
+{
+ unsigned long header_size_ul = 0, num_samples_ul = 0;
+ sox_encoding_t encoding = SOX_ENCODING_SIGN2;
+ size_t header_size, bytes_read;
+ size_t num_samples = 0;
+ unsigned bytes_per_sample = 0;
+ unsigned channels = 1;
+ unsigned rate = 16000;
+ char fldname[64], fldtype[16], fldsval[128];
+ char * buf;
+
+ /* Magic header */
+ if (lsx_reads(ft, fldname, (size_t)8) || strncmp(fldname, "NIST_1A", (size_t)7) != 0) {
+ lsx_fail_errno(ft, SOX_EHDR, "Sphere header does not begin with magic word `NIST_1A'");
+ return (SOX_EOF);
+ }
+
+ if (lsx_reads(ft, fldsval, (size_t)8)) {
+ lsx_fail_errno(ft, SOX_EHDR, "Error reading Sphere header");
+ return (SOX_EOF);
+ }
+
+ /* Determine header size, and allocate a buffer large enough to hold it. */
+ sscanf(fldsval, "%lu", &header_size_ul);
+ if (header_size_ul < 16) {
+ lsx_fail_errno(ft, SOX_EHDR, "Error reading Sphere header");
+ return (SOX_EOF);
+ }
+
+ buf = lsx_malloc(header_size = header_size_ul);
+
+ /* Skip what we have read so far */
+ header_size -= 16;
+
+ if (lsx_reads(ft, buf, header_size) == SOX_EOF) {
+ lsx_fail_errno(ft, SOX_EHDR, "Error reading Sphere header");
+ free(buf);
+ return (SOX_EOF);
+ }
+
+ header_size -= (strlen(buf) + 1);
+
+ while (strncmp(buf, "end_head", (size_t)8) != 0) {
+ if (strncmp(buf, "sample_n_bytes", (size_t)14) == 0)
+ sscanf(buf, "%63s %15s %u", fldname, fldtype, &bytes_per_sample);
+ else if (strncmp(buf, "channel_count", (size_t)13) == 0)
+ sscanf(buf, "%63s %15s %u", fldname, fldtype, &channels);
+ else if (strncmp(buf, "sample_count ", (size_t)13) == 0)
+ sscanf(buf, "%53s %15s %lu", fldname, fldtype, &num_samples_ul);
+ else if (strncmp(buf, "sample_rate ", (size_t)12) == 0)
+ sscanf(buf, "%53s %15s %u", fldname, fldtype, &rate);
+ else if (strncmp(buf, "sample_coding", (size_t)13) == 0) {
+ sscanf(buf, "%63s %15s %127s", fldname, fldtype, fldsval);
+ if (!strcasecmp(fldsval, "ulaw") || !strcasecmp(fldsval, "mu-law"))
+ encoding = SOX_ENCODING_ULAW;
+ else if (!strcasecmp(fldsval, "pcm"))
+ encoding = SOX_ENCODING_SIGN2;
+ else {
+ lsx_fail_errno(ft, SOX_EFMT, "sph: unsupported coding `%s'", fldsval);
+ free(buf);
+ return SOX_EOF;
+ }
+ }
+ else if (strncmp(buf, "sample_byte_format", (size_t)18) == 0) {
+ sscanf(buf, "%53s %15s %127s", fldname, fldtype, fldsval);
+ if (strcmp(fldsval, "01") == 0) /* Data is little endian. */
+ ft->encoding.reverse_bytes = MACHINE_IS_BIGENDIAN;
+ else if (strcmp(fldsval, "10") == 0) /* Data is big endian. */
+ ft->encoding.reverse_bytes = MACHINE_IS_LITTLEENDIAN;
+ else if (strcmp(fldsval, "1")) {
+ lsx_fail_errno(ft, SOX_EFMT, "sph: unsupported coding `%s'", fldsval);
+ free(buf);
+ return SOX_EOF;
+ }
+ }
+
+ if (lsx_reads(ft, buf, header_size) == SOX_EOF) {
+ lsx_fail_errno(ft, SOX_EHDR, "Error reading Sphere header");
+ free(buf);
+ return (SOX_EOF);
+ }
+
+ header_size -= (strlen(buf) + 1);
+ }
+
+ if (!bytes_per_sample)
+ bytes_per_sample = encoding == SOX_ENCODING_ULAW? 1 : 2;
+
+ while (header_size) {
+ bytes_read = lsx_readbuf(ft, buf, header_size);
+ if (bytes_read == 0) {
+ free(buf);
+ return (SOX_EOF);
+ }
+ header_size -= bytes_read;
+ }
+ free(buf);
+
+ if (ft->seekable) {
+ /* Check first four bytes of data to see if it's shorten compressed. */
+ char shorten_check[4];
+
+ if (lsx_readchars(ft, shorten_check, sizeof(shorten_check)))
+ return SOX_EOF;
+ lsx_seeki(ft, -(off_t)sizeof(shorten_check), SEEK_CUR);
+
+ if (!memcmp(shorten_check, "ajkg", sizeof(shorten_check))) {
+ lsx_fail_errno(ft, SOX_EFMT,
+ "File uses shorten compression, cannot handle this.");
+ return (SOX_EOF);
+ }
+ }
+
+ num_samples = num_samples_ul;
+ return lsx_check_read_params(ft, channels, (sox_rate_t)rate, encoding,
+ bytes_per_sample << 3, (uint64_t)num_samples * channels, sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ char buf[128];
+ uint64_t samples = (ft->olength ? ft->olength : ft->signal.length) / ft->signal.channels;
+
+ lsx_writes(ft, "NIST_1A\n");
+ lsx_writes(ft, " 1024\n");
+
+ if (samples) {
+ sprintf(buf, "sample_count -i %" PRIu64 "\n", samples);
+ lsx_writes(ft, buf);
+ }
+
+ sprintf(buf, "sample_n_bytes -i %d\n", ft->encoding.bits_per_sample >> 3);
+ lsx_writes(ft, buf);
+
+ sprintf(buf, "channel_count -i %d\n", ft->signal.channels);
+ lsx_writes(ft, buf);
+
+ if (ft->encoding.bits_per_sample == 8)
+ sprintf(buf, "sample_byte_format -s1 1\n");
+ else
+ sprintf(buf, "sample_byte_format -s2 %s\n",
+ ft->encoding.reverse_bytes != MACHINE_IS_BIGENDIAN ? "10" : "01");
+ lsx_writes(ft, buf);
+
+ sprintf(buf, "sample_rate -i %u\n", (unsigned) (ft->signal.rate + .5));
+ lsx_writes(ft, buf);
+
+ if (ft->encoding.encoding == SOX_ENCODING_ULAW)
+ lsx_writes(ft, "sample_coding -s4 ulaw\n");
+ else
+ lsx_writes(ft, "sample_coding -s3 pcm\n");
+
+ lsx_writes(ft, "end_head\n");
+
+ lsx_padbytes(ft, 1024 - (size_t)lsx_tell(ft));
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(sphere)
+{
+ static char const *const names[] = {"sph", "nist", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 8, 16, 24, 32, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ 0
+ };
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "SPeech HEader Resources; defined by NIST", names, SOX_FILE_REWIND,
+ start_read, lsx_rawread, NULL,
+ write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, NULL, 0
+ };
+ return &handler;
+}
diff --git a/src/src/splice.c b/src/src/splice.c
new file mode 100644
index 0000000..225093a
--- /dev/null
+++ b/src/src/splice.c
@@ -0,0 +1,302 @@
+/* libSoX effect: splice audio Copyright (c) 2008-9 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+static double difference(
+ const sox_sample_t * a, const sox_sample_t * b, size_t length)
+{
+ double diff = 0;
+ size_t i = 0;
+
+ #define _ diff += sqr((double)a[i] - b[i]), ++i; /* Loop optimisation */
+ do {_ _ _ _ _ _ _ _} while (i < length); /* N.B. length ≡ 0 (mod 8) */
+ #undef _
+ return diff;
+}
+
+/* Find where the two segments are most alike over the overlap period. */
+static size_t best_overlap_position(sox_sample_t const * f1,
+ sox_sample_t const * f2, uint64_t overlap, uint64_t search, size_t channels)
+{
+ size_t i, best_pos = 0;
+ double diff, least_diff = difference(f2, f1, (size_t) (channels * overlap));
+
+ for (i = 1; i < search; ++i) { /* linear search */
+ diff = difference(f2 + channels * i, f1, (size_t) (channels * overlap));
+ if (diff < least_diff)
+ least_diff = diff, best_pos = i;
+ }
+ return best_pos;
+}
+
+
+typedef struct {
+ enum {Cosine_2, Cosine_4, Triangular} fade_type;
+ unsigned nsplices; /* Number of splices requested */
+ struct {
+ char * str; /* Command-line argument to parse for this splice */
+ uint64_t overlap; /* Number of samples to overlap */
+ uint64_t search; /* Number of samples to search */
+ uint64_t start; /* Start splicing when in_pos equals this */
+ } * splices;
+
+ uint64_t in_pos; /* Number of samples read from the input stream */
+ unsigned splices_pos; /* Number of splices completed so far */
+ size_t buffer_pos; /* Number of samples through the current splice */
+ size_t max_buffer_size;
+ sox_sample_t * buffer;
+ unsigned state;
+} priv_t;
+
+static void splice(sox_effect_t * effp, const sox_sample_t * in1, const
+ sox_sample_t * in2, sox_sample_t * output, uint64_t overlap, size_t channels)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i, j, k = 0;
+
+ if (p->fade_type == Cosine_4) {
+ double fade_step = M_PI_2 / overlap;
+ for (i = 0; i < overlap; ++i) {
+ double fade_in = sin(i * fade_step);
+ double fade_out = cos(i * fade_step); /* constant RMS level (`power') */
+ for (j = 0; j < channels; ++j, ++k) {
+ double d = in1[k] * fade_out + in2[k] * fade_in;
+ output[k] = SOX_ROUND_CLIP_COUNT(d, effp->clips); /* Might clip */
+ }
+ }
+ }
+ else if (p->fade_type == Cosine_2) {
+ double fade_step = M_PI / overlap;
+ for (i = 0; i < overlap; ++i) {
+ double fade_in = .5 - .5 * cos(i * fade_step);
+ double fade_out = 1 - fade_in; /* constant peak level (`gain') */
+ for (j = 0; j < channels; ++j, ++k) {
+ double d = in1[k] * fade_out + in2[k] * fade_in;
+ output[k] = SOX_ROUND_CLIP_COUNT(d, effp->clips); /* Should not clip */
+ }
+ }
+ }
+ else /* Triangular */ {
+ double fade_step = 1. / overlap;
+ for (i = 0; i < overlap; ++i) {
+ double fade_in = fade_step * i;
+ double fade_out = 1 - fade_in; /* constant peak level (`gain') */
+ for (j = 0; j < channels; ++j, ++k) {
+ double d = in1[k] * fade_out + in2[k] * fade_in;
+ output[k] = SOX_ROUND_CLIP_COUNT(d, effp->clips); /* Should not clip */
+ }
+ }
+ }
+}
+
+static uint64_t do_splice(sox_effect_t * effp,
+ sox_sample_t * f, uint64_t overlap, uint64_t search, size_t channels)
+{
+ uint64_t offset = search? best_overlap_position(
+ f, f + overlap * channels, overlap, search, channels) : 0;
+ splice(effp, f, f + (overlap + offset) * channels,
+ f + (overlap + offset) * channels, overlap, channels);
+ return overlap + offset;
+}
+
+static int parse(sox_effect_t * effp, char * * argv, sox_rate_t rate)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ char const * next;
+ size_t i, buffer_size;
+ uint64_t last_seen = 0;
+ const uint64_t in_length = argv ? 0 :
+ (effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN);
+
+ p->max_buffer_size = 0;
+ for (i = 0; i < p->nsplices; ++i) {
+ if (argv) /* 1st parse only */
+ p->splices[i].str = lsx_strdup(argv[i]);
+
+ p->splices[i].overlap = rate * 0.01 + .5;
+ p->splices[i].search = p->fade_type == Cosine_4? 0 : p->splices[i].overlap;
+
+ next = lsx_parseposition(rate, p->splices[i].str,
+ argv ? NULL : &p->splices[i].start, last_seen, in_length, '=');
+ if (next == NULL) break;
+ last_seen = p->splices[i].start;
+
+ if (*next == ',') {
+ next = lsx_parsesamples(rate, next + 1, &p->splices[i].overlap, 't');
+ if (next == NULL) break;
+ p->splices[i].overlap *= 2;
+ if (*next == ',') {
+ next = lsx_parsesamples(rate, next + 1, &p->splices[i].search, 't');
+ if (next == NULL) break;
+ p->splices[i].search *= 2;
+ }
+ }
+ if (*next != '\0') break;
+ p->splices[i].overlap = max(p->splices[i].overlap + 4, 16);
+ p->splices[i].overlap &= ~7; /* Make divisible by 8 for loop optimisation */
+
+ if (!argv) {
+ if (i > 0 && p->splices[i].start <= p->splices[i-1].start) break;
+ if (p->splices[i].start < p->splices[i].overlap) break;
+ p->splices[i].start -= p->splices[i].overlap;
+ buffer_size = 2 * p->splices[i].overlap + p->splices[i].search;
+ p->max_buffer_size = max(p->max_buffer_size, buffer_size);
+ }
+ }
+ if (i < p->nsplices)
+ return lsx_usage(effp);
+ return SOX_SUCCESS;
+}
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ --argc, ++argv;
+ if (argc) {
+ if (!strcmp(*argv, "-t")) p->fade_type = Triangular, --argc, ++argv;
+ else if (!strcmp(*argv, "-q")) p->fade_type = Cosine_4 , --argc, ++argv;
+ else if (!strcmp(*argv, "-h")) p->fade_type = Cosine_2 , --argc, ++argv;
+ }
+ p->nsplices = argc;
+ p->splices = lsx_calloc(p->nsplices, sizeof(*p->splices));
+ return parse(effp, argv, 1e5); /* No rate yet; parse with dummy */
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+
+ parse(effp, 0, effp->in_signal.rate); /* Re-parse now rate is known */
+ p->buffer = lsx_calloc(p->max_buffer_size * effp->in_signal.channels, sizeof(*p->buffer));
+ p->in_pos = p->buffer_pos = p->splices_pos = 0;
+ p->state = p->splices_pos != p->nsplices && p->in_pos == p->splices[p->splices_pos].start;
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* depends on input data */
+ for (i = 0; i < p->nsplices; ++i)
+ if (p->splices[i].overlap) {
+ if (p->fade_type == Cosine_4 && effp->in_signal.mult)
+ *effp->in_signal.mult *= pow(.5, .5);
+ return SOX_SUCCESS;
+ }
+ return SOX_EFF_NULL;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t c, idone = 0, odone = 0;
+ *isamp /= effp->in_signal.channels;
+ *osamp /= effp->in_signal.channels;
+
+ while (sox_true) {
+copying:
+ if (p->state == 0) {
+ for (; idone < *isamp && odone < *osamp; ++idone, ++odone, ++p->in_pos) {
+ if (p->splices_pos != p->nsplices && p->in_pos == p->splices[p->splices_pos].start) {
+ p->state = 1;
+ goto buffering;
+ }
+ for (c = 0; c < effp->in_signal.channels; ++c)
+ *obuf++ = *ibuf++;
+ }
+ break;
+ }
+
+buffering:
+ if (p->state == 1) {
+ size_t buffer_size = (2 * p->splices[p->splices_pos].overlap + p->splices[p->splices_pos].search) * effp->in_signal.channels;
+ for (; idone < *isamp; ++idone, ++p->in_pos) {
+ if (p->buffer_pos == buffer_size) {
+ p->buffer_pos = do_splice(effp, p->buffer,
+ p->splices[p->splices_pos].overlap,
+ p->splices[p->splices_pos].search,
+ (size_t)effp->in_signal.channels) * effp->in_signal.channels;
+ p->state = 2;
+ goto flushing;
+ break;
+ }
+ for (c = 0; c < effp->in_signal.channels; ++c)
+ p->buffer[p->buffer_pos++] = *ibuf++;
+ }
+ break;
+ }
+
+flushing:
+ if (p->state == 2) {
+ size_t buffer_size = (2 * p->splices[p->splices_pos].overlap + p->splices[p->splices_pos].search) * effp->in_signal.channels;
+ for (; odone < *osamp; ++odone) {
+ if (p->buffer_pos == buffer_size) {
+ p->buffer_pos = 0;
+ ++p->splices_pos;
+ p->state = p->splices_pos != p->nsplices && p->in_pos == p->splices[p->splices_pos].start;
+ goto copying;
+ }
+ for (c = 0; c < effp->in_signal.channels; ++c)
+ *obuf++ = p->buffer[p->buffer_pos++];
+ }
+ break;
+ }
+ }
+
+ *isamp = idone * effp->in_signal.channels;
+ *osamp = odone * effp->in_signal.channels;
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ size_t isamp = 0;
+ return flow(effp, 0, obuf, &isamp, osamp);
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ if (p->splices_pos != p->nsplices)
+ lsx_warn("Input audio too short; splices not made: %u", p->nsplices - p->splices_pos);
+ free(p->buffer);
+ return SOX_SUCCESS;
+}
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+ for (i = 0; i < p->nsplices; ++i)
+ free(p->splices[i].str);
+ free(p->splices);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_splice_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "splice", "[-h|-t|-q] {position[,excess[,leeway]]}"
+ "\n -h Half sine fade (default); constant gain (for correlated audio)"
+ "\n -t Triangular (linear) fade; constant gain (for correlated audio)"
+ "\n -q Quarter sine fade; constant power (for correlated audio e.g. x-fade)"
+ "\n position The length of part 1 (including the excess)"
+ "\n excess At the end of part 1 & the start of part2 (default 0.005)"
+ "\n leeway Before part2 (default 0.005; set to 0 for cross-fade)",
+ SOX_EFF_MCHAN | SOX_EFF_LENGTH,
+ create, start, flow, drain, stop, lsx_kill, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/stamp-h1 b/src/src/stamp-h1
new file mode 100644
index 0000000..75dd6ac
--- /dev/null
+++ b/src/src/stamp-h1
@@ -0,0 +1 @@
+timestamp for src/soxconfig.h
diff --git a/src/src/stat.c b/src/src/stat.c
new file mode 100644
index 0000000..5e00d13
--- /dev/null
+++ b/src/src/stat.c
@@ -0,0 +1,336 @@
+/* libSoX statistics "effect" file.
+ *
+ * Compute various statistics on file and print them.
+ *
+ * Output is unmodified from input.
+ *
+ * July 5, 1991
+ * Copyright 1991 Lance Norskog And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+
+/* Private data for stat effect */
+typedef struct {
+ double min, max, mid;
+ double asum;
+ double sum1, sum2; /* amplitudes */
+ double dmin, dmax;
+ double dsum1, dsum2; /* deltas */
+ double scale; /* scale-factor */
+ double last; /* previous sample */
+ uint64_t read; /* samples processed */
+ int volume;
+ int srms;
+ int fft;
+ unsigned long bin[4];
+ float *re_in;
+ float *re_out;
+ unsigned long fft_size;
+ unsigned long fft_offset;
+} priv_t;
+
+
+/*
+ * Process options
+ */
+static int sox_stat_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * stat = (priv_t *) effp->priv;
+
+ stat->scale = SOX_SAMPLE_MAX;
+ stat->volume = 0;
+ stat->srms = 0;
+ stat->fft = 0;
+
+ --argc, ++argv;
+ for (; argc > 0; argc--, argv++) {
+ if (!(strcmp(*argv, "-v")))
+ stat->volume = 1;
+ else if (!(strcmp(*argv, "-s"))) {
+ if (argc <= 1) {
+ lsx_fail("-s option: invalid argument");
+ return SOX_EOF;
+ }
+ argc--, argv++; /* Move to next argument. */
+ if (!sscanf(*argv, "%lf", &stat->scale)) {
+ lsx_fail("-s option: invalid argument");
+ return SOX_EOF;
+ }
+ } else if (!(strcmp(*argv, "-rms")))
+ stat->srms = 1;
+ else if (!(strcmp(*argv, "-freq")))
+ stat->fft = 1;
+ else if (!(strcmp(*argv, "-d")))
+ stat->volume = 2;
+ else {
+ lsx_fail("Summary effect: unknown option");
+ return SOX_EOF;
+ }
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Prepare processing.
+ */
+static int sox_stat_start(sox_effect_t * effp)
+{
+ priv_t * stat = (priv_t *) effp->priv;
+ int i;
+
+ stat->min = stat->max = stat->mid = 0;
+ stat->asum = 0;
+ stat->sum1 = stat->sum2 = 0;
+
+ stat->dmin = stat->dmax = 0;
+ stat->dsum1 = stat->dsum2 = 0;
+
+ stat->last = 0;
+ stat->read = 0;
+
+ for (i = 0; i < 4; i++)
+ stat->bin[i] = 0;
+
+ stat->fft_size = 4096;
+ stat->re_in = stat->re_out = NULL;
+
+ if (stat->fft) {
+ stat->fft_offset = 0;
+ stat->re_in = lsx_malloc(sizeof(float) * stat->fft_size);
+ stat->re_out = lsx_malloc(sizeof(float) * (stat->fft_size / 2 + 1));
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Print power spectrum to given stream
+ */
+static void print_power_spectrum(unsigned samples, double rate, float *re_in, float *re_out)
+{
+ float ffa = rate / samples;
+ unsigned i;
+
+ lsx_power_spectrum_f((int)samples, re_in, re_out);
+ for (i = 0; i < samples / 2; i++) /* FIXME: should be <= samples / 2 */
+ fprintf(stderr, "%f %f\n", ffa * i, re_out[i]);
+}
+
+/*
+ * Processed signed long samples from ibuf to obuf.
+ * Return number of samples processed.
+ */
+static int sox_stat_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * stat = (priv_t *) effp->priv;
+ int done, x, len = min(*isamp, *osamp);
+ short count = 0;
+
+ if (len) {
+ if (stat->read == 0) /* 1st sample */
+ stat->min = stat->max = stat->mid = stat->last = (*ibuf)/stat->scale;
+
+ if (stat->fft) {
+ for (x = 0; x < len; x++) {
+ SOX_SAMPLE_LOCALS;
+ stat->re_in[stat->fft_offset++] = SOX_SAMPLE_TO_FLOAT_32BIT(ibuf[x], effp->clips);
+
+ if (stat->fft_offset >= stat->fft_size) {
+ stat->fft_offset = 0;
+ print_power_spectrum((unsigned) stat->fft_size, effp->in_signal.rate, stat->re_in, stat->re_out);
+ }
+
+ }
+ }
+
+ for (done = 0; done < len; done++) {
+ long lsamp = *ibuf++;
+ double delta, samp = (double)lsamp / stat->scale;
+ /* work in scaled levels for both sample and delta */
+ stat->bin[(lsamp >> 30) + 2]++;
+ *obuf++ = lsamp;
+
+ if (stat->volume == 2) {
+ fprintf(stderr,"%08lx ",lsamp);
+ if (count++ == 5) {
+ fprintf(stderr,"\n");
+ count = 0;
+ }
+ }
+
+ /* update min/max */
+ if (stat->min > samp)
+ stat->min = samp;
+ else if (stat->max < samp)
+ stat->max = samp;
+ stat->mid = stat->min / 2 + stat->max / 2;
+
+ stat->sum1 += samp;
+ stat->sum2 += samp*samp;
+ stat->asum += fabs(samp);
+
+ delta = fabs(samp - stat->last);
+ if (delta < stat->dmin)
+ stat->dmin = delta;
+ else if (delta > stat->dmax)
+ stat->dmax = delta;
+
+ stat->dsum1 += delta;
+ stat->dsum2 += delta*delta;
+
+ stat->last = samp;
+ }
+ stat->read += len;
+ }
+
+ *isamp = *osamp = len;
+ /* Process all samples */
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Process tail of input samples.
+ */
+static int sox_stat_drain(sox_effect_t * effp, sox_sample_t *obuf UNUSED, size_t *osamp)
+{
+ priv_t * stat = (priv_t *) effp->priv;
+
+ /* When we run out of samples, then we need to pad buffer with
+ * zeros and then run FFT one last time to process any unprocessed
+ * samples.
+ */
+ if (stat->fft && stat->fft_offset) {
+ unsigned int x;
+
+ for (x = stat->fft_offset; x < stat->fft_size; x++)
+ stat->re_in[x] = 0;
+
+ print_power_spectrum((unsigned) stat->fft_size, effp->in_signal.rate, stat->re_in, stat->re_out);
+ }
+
+ *osamp = 0;
+ return SOX_EOF;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * Don't close input file!
+ */
+static int sox_stat_stop(sox_effect_t * effp)
+{
+ priv_t * stat = (priv_t *) effp->priv;
+ double amp, scale, rms = 0, freq;
+ double x, ct;
+
+ ct = stat->read;
+
+ if (stat->srms) { /* adjust results to units of rms */
+ double f;
+ rms = sqrt(stat->sum2/ct);
+ f = 1.0/rms;
+ stat->max *= f;
+ stat->min *= f;
+ stat->mid *= f;
+ stat->asum *= f;
+ stat->sum1 *= f;
+ stat->sum2 *= f*f;
+ stat->dmax *= f;
+ stat->dmin *= f;
+ stat->dsum1 *= f;
+ stat->dsum2 *= f*f;
+ stat->scale *= rms;
+ }
+
+ scale = stat->scale;
+
+ amp = -stat->min;
+ if (amp < stat->max)
+ amp = stat->max;
+
+ /* Just print the volume adjustment */
+ if (stat->volume == 1 && amp > 0) {
+ fprintf(stderr, "%.3f\n", SOX_SAMPLE_MAX/(amp*scale));
+ return SOX_SUCCESS;
+ }
+ if (stat->volume == 2)
+ fprintf(stderr, "\n\n");
+ /* print out the info */
+ fprintf(stderr, "Samples read: %12" PRIu64 "\n", stat->read);
+ fprintf(stderr, "Length (seconds): %12.6f\n", (double)stat->read/effp->in_signal.rate/effp->in_signal.channels);
+ if (stat->srms)
+ fprintf(stderr, "Scaled by rms: %12.6f\n", rms);
+ else
+ fprintf(stderr, "Scaled by: %12.1f\n", scale);
+ fprintf(stderr, "Maximum amplitude: %12.6f\n", stat->max);
+ fprintf(stderr, "Minimum amplitude: %12.6f\n", stat->min);
+ fprintf(stderr, "Midline amplitude: %12.6f\n", stat->mid);
+ fprintf(stderr, "Mean norm: %12.6f\n", stat->asum/ct);
+ fprintf(stderr, "Mean amplitude: %12.6f\n", stat->sum1/ct);
+ fprintf(stderr, "RMS amplitude: %12.6f\n", sqrt(stat->sum2/ct));
+
+ fprintf(stderr, "Maximum delta: %12.6f\n", stat->dmax);
+ fprintf(stderr, "Minimum delta: %12.6f\n", stat->dmin);
+ fprintf(stderr, "Mean delta: %12.6f\n", stat->dsum1/(ct-1));
+ fprintf(stderr, "RMS delta: %12.6f\n", sqrt(stat->dsum2/(ct-1)));
+ freq = sqrt(stat->dsum2/stat->sum2)*effp->in_signal.rate/(M_PI*2);
+ fprintf(stderr, "Rough frequency: %12d\n", (int)freq);
+
+ if (amp>0)
+ fprintf(stderr, "Volume adjustment: %12.3f\n", SOX_SAMPLE_MAX/(amp*scale));
+
+ if (stat->bin[2] == 0 && stat->bin[3] == 0)
+ fprintf(stderr, "\nProbably text, not sound\n");
+ else {
+
+ x = (float)(stat->bin[0] + stat->bin[3]) / (float)(stat->bin[1] + stat->bin[2]);
+
+ if (x >= 3.0) { /* use opposite encoding */
+ if (effp->in_encoding->encoding == SOX_ENCODING_UNSIGNED)
+ fprintf(stderr,"\nTry: -t raw -e signed-integer -b 8 \n");
+ else
+ fprintf(stderr,"\nTry: -t raw -e unsigned-integer -b 8 \n");
+ } else if (x <= 1.0 / 3.0)
+ ; /* correctly decoded */
+ else if (x >= 0.5 && x <= 2.0) { /* use ULAW */
+ if (effp->in_encoding->encoding == SOX_ENCODING_ULAW)
+ fprintf(stderr,"\nTry: -t raw -e unsigned-integer -b 8 \n");
+ else
+ fprintf(stderr,"\nTry: -t raw -e mu-law -b 8 \n");
+ } else
+ fprintf(stderr, "\nCan't guess the type\n");
+ }
+
+ /* Release FFT memory */
+ free(stat->re_in);
+ free(stat->re_out);
+
+ return SOX_SUCCESS;
+
+}
+
+static sox_effect_handler_t sox_stat_effect = {
+ "stat",
+ "[ -s N ] [ -rms ] [-freq] [ -v ] [ -d ]",
+ SOX_EFF_MCHAN | SOX_EFF_MODIFY,
+ sox_stat_getopts,
+ sox_stat_start,
+ sox_stat_flow,
+ sox_stat_drain,
+ sox_stat_stop,
+ NULL, sizeof(priv_t)
+};
+
+const sox_effect_handler_t *lsx_stat_effect_fn(void)
+{
+ return &sox_stat_effect;
+}
diff --git a/src/src/stats.c b/src/src/stats.c
new file mode 100644
index 0000000..5ed62e2
--- /dev/null
+++ b/src/src/stats.c
@@ -0,0 +1,299 @@
+/* libSoX effect: stats (c) 2009 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <ctype.h>
+#include <string.h>
+
+typedef struct {
+ int scale_bits, hex_bits;
+ double time_constant, scale;
+
+ double last, sigma_x, sigma_x2, avg_sigma_x2, min_sigma_x2, max_sigma_x2;
+ double min, max, mult, min_run, min_runs, max_run, max_runs;
+ off_t num_samples, tc_samples, min_count, max_count;
+ uint32_t mask;
+} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ int c;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, "+x:b:w:s:", NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ p->time_constant = .05;
+ p->scale = 1;
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ GETOPT_NUMERIC(optstate, 'x', hex_bits , 2 , 32)
+ GETOPT_NUMERIC(optstate, 'b', scale_bits , 2 , 32)
+ GETOPT_NUMERIC(optstate, 'w', time_constant , .01 , 10)
+ GETOPT_NUMERIC(optstate, 's', scale , -99, 99)
+ default: lsx_fail("invalid option `-%c'", optstate.opt); return lsx_usage(effp);
+ }
+ if (p->hex_bits)
+ p->scale_bits = p->hex_bits;
+ return optstate.ind != argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ p->last = 0;
+ p->mult = exp((-1 / p->time_constant / effp->in_signal.rate));
+ p->tc_samples = 5 * p->time_constant * effp->in_signal.rate + .5;
+ p->sigma_x = p->sigma_x2 = p->avg_sigma_x2 = p->max_sigma_x2 = 0;
+ p->min = p->min_sigma_x2 = 2;
+ p->max = -p->min;
+ p->num_samples = 0;
+ p->mask = 0;
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * ilen, size_t * olen)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t len = *ilen = *olen = min(*ilen, *olen);
+ memcpy(obuf, ibuf, len * sizeof(*obuf));
+
+ for (; len--; ++ibuf, ++p->num_samples) {
+ double d = SOX_SAMPLE_TO_FLOAT_64BIT(*ibuf,);
+
+ if (d < p->min)
+ p->min = d, p->min_count = 1, p->min_run = 1, p->min_runs = 0;
+ else if (d == p->min) {
+ ++p->min_count;
+ p->min_run = d == p->last? p->min_run + 1 : 1;
+ }
+ else if (p->last == p->min)
+ p->min_runs += sqr(p->min_run);
+
+ if (d > p->max)
+ p->max = d, p->max_count = 1, p->max_run = 1, p->max_runs = 0;
+ else if (d == p->max) {
+ ++p->max_count;
+ p->max_run = d == p->last? p->max_run + 1 : 1;
+ }
+ else if (p->last == p->max)
+ p->max_runs += sqr(p->max_run);
+
+ p->sigma_x += d;
+ p->sigma_x2 += sqr(d);
+ p->avg_sigma_x2 = p->avg_sigma_x2 * p->mult + (1 - p->mult) * sqr(d);
+
+ if (p->num_samples >= p->tc_samples) {
+ if (p->avg_sigma_x2 > p->max_sigma_x2)
+ p->max_sigma_x2 = p->avg_sigma_x2;
+ if (p->avg_sigma_x2 < p->min_sigma_x2)
+ p->min_sigma_x2 = p->avg_sigma_x2;
+ }
+ p->last = d;
+ p->mask |= *ibuf;
+ }
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * olen)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ if (p->last == p->min)
+ p->min_runs += sqr(p->min_run);
+ if (p->last == p->max)
+ p->max_runs += sqr(p->max_run);
+
+ (void)obuf, *olen = 0;
+ return SOX_SUCCESS;
+}
+
+static unsigned bit_depth(uint32_t mask, double min, double max, unsigned * x)
+{
+ SOX_SAMPLE_LOCALS;
+ unsigned result = 32, dummy = 0;
+
+ for (; result && !(mask & 1); --result, mask >>= 1);
+ if (x)
+ *x = result;
+ mask = SOX_FLOAT_64BIT_TO_SAMPLE(max, dummy);
+ if (min < 0)
+ mask |= ~(SOX_FLOAT_64BIT_TO_SAMPLE(min, dummy) << 1);
+ for (; result && !(mask & SOX_SAMPLE_MIN); --result, mask <<= 1);
+ return result;
+}
+
+static void output(priv_t const * p, double x)
+{
+ if (p->scale_bits) {
+ unsigned mult = 1 << (p->scale_bits - 1);
+ int i;
+ x = floor(x * mult + .5);
+ i = min(x, mult - 1.);
+ if (p->hex_bits)
+ if (x < 0) {
+ char buf[30];
+ sprintf(buf, "%x", -i);
+ fprintf(stderr, " %*c%s", 9 - (int)strlen(buf), '-', buf);
+ }
+ else fprintf(stderr, " %9x", i);
+ else fprintf(stderr, " %9i", i);
+ }
+ else fprintf(stderr, " %9.*f", fabs(p->scale) < 10 ? 6 : 5, p->scale * x);
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ if (!effp->flow) {
+ double min_runs = 0, max_count = 0, min = 2, max = -2, max_sigma_x = 0, sigma_x = 0, sigma_x2 = 0, min_sigma_x2 = 2, max_sigma_x2 = 0, avg_peak = 0;
+ off_t num_samples = 0, min_count = 0, max_runs = 0;
+ uint32_t mask = 0;
+ unsigned b1, b2, i, n = effp->flows > 1 ? effp->flows : 0;
+
+ for (i = 0; i < effp->flows; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ min = min(min, q->min);
+ max = max(max, q->max);
+ if (q->num_samples < q->tc_samples)
+ q->min_sigma_x2 = q->max_sigma_x2 = q->sigma_x2 / q->num_samples;
+ min_sigma_x2 = min(min_sigma_x2, q->min_sigma_x2);
+ max_sigma_x2 = max(max_sigma_x2, q->max_sigma_x2);
+ sigma_x += q->sigma_x;
+ sigma_x2 += q->sigma_x2;
+ num_samples += q->num_samples;
+ mask |= q->mask;
+ if (fabs(q->sigma_x) > fabs(max_sigma_x))
+ max_sigma_x = q->sigma_x;
+ min_count += q->min_count;
+ min_runs += q->min_runs;
+ max_count += q->max_count;
+ max_runs += q->max_runs;
+ avg_peak += max(-q->min, q->max);
+ }
+ avg_peak /= effp->flows;
+
+ if (!num_samples) {
+ lsx_warn("no audio");
+ return SOX_SUCCESS;
+ }
+
+ if (n == 2)
+ fprintf(stderr, " Overall Left Right\n");
+ else if (n) {
+ fprintf(stderr, " Overall");
+ for (i = 0; i < n; ++i)
+ fprintf(stderr, " Ch%-3i", i + 1);
+ fprintf(stderr, "\n");
+ }
+
+ fprintf(stderr, "DC offset ");
+ output(p, max_sigma_x / p->num_samples);
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ output(p, q->sigma_x / q->num_samples);
+ }
+
+ fprintf(stderr, "\nMin level ");
+ output(p, min);
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ output(p, q->min);
+ }
+
+ fprintf(stderr, "\nMax level ");
+ output(p, max);
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ output(p, q->max);
+ }
+
+ fprintf(stderr, "\nPk lev dB %10.2f", linear_to_dB(max(-min, max)));
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ fprintf(stderr, "%10.2f", linear_to_dB(max(-q->min, q->max)));
+ }
+
+ fprintf(stderr, "\nRMS lev dB%10.2f", linear_to_dB(sqrt(sigma_x2 / num_samples)));
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ fprintf(stderr, "%10.2f", linear_to_dB(sqrt(q->sigma_x2 / q->num_samples)));
+ }
+
+ fprintf(stderr, "\nRMS Pk dB %10.2f", linear_to_dB(sqrt(max_sigma_x2)));
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ fprintf(stderr, "%10.2f", linear_to_dB(sqrt(q->max_sigma_x2)));
+ }
+
+ fprintf(stderr, "\nRMS Tr dB ");
+ if (min_sigma_x2 != 1)
+ fprintf(stderr, "%10.2f", linear_to_dB(sqrt(min_sigma_x2)));
+ else fprintf(stderr, " -");
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ if (q->min_sigma_x2 != 1)
+ fprintf(stderr, "%10.2f", linear_to_dB(sqrt(q->min_sigma_x2)));
+ else fprintf(stderr, " -");
+ }
+
+ if (effp->flows > 1)
+ fprintf(stderr, "\nCrest factor -");
+ else fprintf(stderr, "\nCrest factor %7.2f", sigma_x2 ? avg_peak / sqrt(sigma_x2 / num_samples) : 1);
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ fprintf(stderr, "%10.2f", q->sigma_x2? max(-q->min, q->max) / sqrt(q->sigma_x2 / q->num_samples) : 1);
+ }
+
+ fprintf(stderr, "\nFlat factor%9.2f", linear_to_dB((min_runs + max_runs) / (min_count + max_count)));
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ fprintf(stderr, " %9.2f", linear_to_dB((q->min_runs + q->max_runs) / (q->min_count + q->max_count)));
+ }
+
+ fprintf(stderr, "\nPk count %9s", lsx_sigfigs3((min_count + max_count) / effp->flows));
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ fprintf(stderr, " %9s", lsx_sigfigs3((double)(q->min_count + q->max_count)));
+ }
+
+ b1 = bit_depth(mask, min, max, &b2);
+ fprintf(stderr, "\nBit-depth %2u/%-2u", b1, b2);
+ for (i = 0; i < n; ++i) {
+ priv_t * q = (priv_t *)(effp - effp->flow + i)->priv;
+ b1 = bit_depth(q->mask, q->min, q->max, &b2);
+ fprintf(stderr, " %2u/%-2u", b1, b2);
+ }
+
+ fprintf(stderr, "\nNum samples%9s", lsx_sigfigs3((double)p->num_samples));
+ fprintf(stderr, "\nLength s %9.3f", p->num_samples / effp->in_signal.rate);
+ fprintf(stderr, "\nScale max ");
+ output(p, 1.);
+ fprintf(stderr, "\nWindow s %9.3f", p->time_constant);
+ fprintf(stderr, "\n");
+ }
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_stats_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "stats", "[-b bits|-x bits|-s scale] [-w window-time]", SOX_EFF_MODIFY,
+ getopts, start, flow, drain, stop, NULL, sizeof(priv_t)};
+ return &handler;
+}
diff --git a/src/src/stretch.c b/src/src/stretch.c
new file mode 100644
index 0000000..cd00849
--- /dev/null
+++ b/src/src/stretch.c
@@ -0,0 +1,326 @@
+/* libSoX Basic time stretcher.
+ * (c) march/april 2000 Fabien COELHO <fabien@coelho.net> for sox.
+ *
+ * cross fade samples so as to go slower or faster.
+ *
+ * The filter is based on 6 parameters:
+ * - stretch factor f
+ * - window size w
+ * - input step i
+ * output step o=f*i
+ * - steady state of window s, ss = s*w
+ *
+ * I decided of the default values of these parameters based
+ * on some small non extensive tests. maybe better defaults
+ * can be suggested.
+ */
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define DEFAULT_SLOW_SHIFT_RATIO 0.8
+#define DEFAULT_FAST_SHIFT_RATIO 1.0
+
+#define DEFAULT_STRETCH_WINDOW 20.0 /* ms */
+
+typedef enum { input_state, output_state } stretch_status_t;
+
+typedef struct {
+ /* options
+ * FIXME: maybe shift could be allowed > 1.0 with factor < 1.0 ???
+ */
+ double factor; /* strech factor. 1.0 means copy. */
+ double window; /* window in ms */
+ double shift; /* shift ratio wrt window. <1.0 */
+ double fading; /* fading ratio wrt window. <0.5 */
+
+ /* internal stuff */
+ stretch_status_t state; /* automaton status */
+
+ size_t segment; /* buffer size */
+ size_t index; /* next available element */
+ sox_sample_t *ibuf; /* input buffer */
+ size_t ishift; /* input shift */
+
+ size_t oindex; /* next evailable element */
+ double * obuf; /* output buffer */
+ size_t oshift; /* output shift */
+
+ size_t overlap; /* fading size */
+ double * fade_coefs; /* fading, 1.0 -> 0.0 */
+
+} priv_t;
+
+/*
+ * Process options
+ */
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ --argc, ++argv;
+
+ /* default options */
+ p->factor = 1.0; /* default is no change */
+ p->window = DEFAULT_STRETCH_WINDOW;
+
+ if (argc > 0 && !sscanf(argv[0], "%lf", &p->factor)) {
+ lsx_fail("error while parsing factor");
+ return lsx_usage(effp);
+ }
+
+ if (argc > 1 && !sscanf(argv[1], "%lf", &p->window)) {
+ lsx_fail("error while parsing window size");
+ return lsx_usage(effp);
+ }
+
+ if (argc > 2) {
+ switch (argv[2][0]) {
+ case 'l':
+ case 'L':
+ break;
+ default:
+ lsx_fail("error while parsing fade type");
+ return lsx_usage(effp);
+ }
+ }
+
+ /* default shift depends whether we go slower or faster */
+ p->shift = (p->factor <= 1.0) ?
+ DEFAULT_FAST_SHIFT_RATIO: DEFAULT_SLOW_SHIFT_RATIO;
+
+ if (argc > 3 && !sscanf(argv[3], "%lf", &p->shift)) {
+ lsx_fail("error while parsing shift ratio");
+ return lsx_usage(effp);
+ }
+
+ if (p->shift > 1.0 || p->shift <= 0.0) {
+ lsx_fail("error with shift ratio value");
+ return lsx_usage(effp);
+ }
+
+ /* default fading stuff...
+ it makes sense for factor >= 0.5 */
+ if (p->factor < 1.0)
+ p->fading = 1.0 - (p->factor * p->shift);
+ else
+ p->fading = 1.0 - p->shift;
+ if (p->fading > 0.5)
+ p->fading = 0.5;
+
+ if (argc > 4 && !sscanf(argv[4], "%lf", &p->fading)) {
+ lsx_fail("error while parsing fading ratio");
+ return lsx_usage(effp);
+ }
+
+ if (p->fading > 0.5 || p->fading < 0.0) {
+ lsx_fail("error with fading ratio value");
+ return lsx_usage(effp);
+ }
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Start processing
+ */
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i;
+
+ if (p->factor == 1)
+ return SOX_EFF_NULL;
+
+ p->state = input_state;
+
+ p->segment = (int)(effp->out_signal.rate * 0.001 * p->window);
+ /* start in the middle of an input to avoid initial fading... */
+ p->index = p->segment / 2;
+ p->ibuf = lsx_malloc(p->segment * sizeof(sox_sample_t));
+
+ /* the shift ratio deal with the longest of ishift/oshift
+ hence ishift<=segment and oshift<=segment. */
+ if (p->factor < 1.0) {
+ p->ishift = p->shift * p->segment;
+ p->oshift = p->factor * p->ishift;
+ } else {
+ p->oshift = p->shift * p->segment;
+ p->ishift = p->oshift / p->factor;
+ }
+ assert(p->ishift <= p->segment);
+ assert(p->oshift <= p->segment);
+
+ p->oindex = p->index; /* start as synchronized */
+ p->obuf = lsx_malloc(p->segment * sizeof(double));
+ p->overlap = (int)(p->fading * p->segment);
+ p->fade_coefs = lsx_malloc(p->overlap * sizeof(double));
+
+ /* initialize buffers */
+ for (i = 0; i<p->segment; i++)
+ p->ibuf[i] = 0;
+
+ for (i = 0; i<p->segment; i++)
+ p->obuf[i] = 0.0;
+
+ if (p->overlap>1) {
+ double slope = 1.0 / (p->overlap - 1);
+ p->fade_coefs[0] = 1.0;
+ for (i = 1; i < p->overlap - 1; i++)
+ p->fade_coefs[i] = slope * (p->overlap - i - 1);
+ p->fade_coefs[p->overlap - 1] = 0.0;
+ } else if (p->overlap == 1)
+ p->fade_coefs[0] = 1.0;
+
+ lsx_debug("start: (factor=%g segment=%g shift=%g overlap=%g)\nstate=%d\n"
+ "segment=%" PRIuPTR "\nindex=%" PRIuPTR "\n"
+ "ishift=%" PRIuPTR "\noindex=%" PRIuPTR "\n"
+ "oshift=%" PRIuPTR "\noverlap=%" PRIuPTR,
+ p->factor, p->window, p->shift, p->fading, p->state,
+ p->segment, p->index, p->ishift, p->oindex, p->oshift, p->overlap);
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* TODO: calculate actual length */
+ return SOX_SUCCESS;
+}
+
+/* accumulates input ibuf to output obuf with fading fade_coefs */
+static void combine(priv_t * p)
+{
+ size_t i;
+
+ /* fade in */
+ for (i = 0; i < p->overlap; i++)
+ p->obuf[i] += p->fade_coefs[p->overlap - 1 - i] * p->ibuf[i];
+
+ /* steady state */
+ for (; i < p->segment - p->overlap; i++)
+ p->obuf[i] += p->ibuf[i];
+
+ /* fade out */
+ for (; i<p->segment; i++)
+ p->obuf[i] += p->fade_coefs[i - p->segment + p->overlap] * p->ibuf[i];
+}
+
+/*
+ * Processes flow.
+ */
+static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ size_t iindex = 0, oindex = 0;
+ size_t i;
+
+ while (iindex<*isamp && oindex<*osamp) {
+ if (p->state == input_state) {
+ size_t tocopy = min(*isamp-iindex,
+ p->segment-p->index);
+
+ memcpy(p->ibuf + p->index, ibuf + iindex, tocopy * sizeof(sox_sample_t));
+
+ iindex += tocopy;
+ p->index += tocopy;
+
+ if (p->index == p->segment) {
+ /* compute */
+ combine(p);
+
+ /* shift input */
+ for (i = 0; i + p->ishift < p->segment; i++)
+ p->ibuf[i] = p->ibuf[i+p->ishift];
+
+ p->index -= p->ishift;
+
+ /* switch to output state */
+ p->state = output_state;
+ }
+ }
+
+ if (p->state == output_state) {
+ while (p->oindex < p->oshift && oindex < *osamp) {
+ float f;
+ f = p->obuf[p->oindex++];
+ SOX_SAMPLE_CLIP_COUNT(f, effp->clips);
+ obuf[oindex++] = f;
+ }
+
+ if (p->oindex >= p->oshift && oindex<*osamp) {
+ p->oindex -= p->oshift;
+
+ /* shift internal output buffer */
+ for (i = 0; i + p->oshift < p->segment; i++)
+ p->obuf[i] = p->obuf[i + p->oshift];
+
+ /* pad with 0 */
+ for (; i < p->segment; i++)
+ p->obuf[i] = 0.0;
+
+ p->state = input_state;
+ }
+ }
+ }
+
+ *isamp = iindex;
+ *osamp = oindex;
+
+ return SOX_SUCCESS;
+}
+
+
+/*
+ * Drain buffer at the end
+ * maybe not correct ? end might be artificially faded?
+ */
+static int drain(sox_effect_t * effp, sox_sample_t *obuf, size_t *osamp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ size_t i;
+ size_t oindex = 0;
+
+ if (p->state == input_state) {
+ for (i=p->index; i<p->segment; i++)
+ p->ibuf[i] = 0;
+
+ combine(p);
+
+ p->state = output_state;
+ }
+
+ while (oindex<*osamp && p->oindex<p->index) {
+ float f = p->obuf[p->oindex++];
+ SOX_SAMPLE_CLIP_COUNT(f, effp->clips);
+ obuf[oindex++] = f;
+ }
+
+ *osamp = oindex;
+
+ if (p->oindex == p->index)
+ return SOX_EOF;
+ else
+ return SOX_SUCCESS;
+}
+
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+
+ free(p->ibuf);
+ free(p->obuf);
+ free(p->fade_coefs);
+ return SOX_SUCCESS;
+}
+
+const sox_effect_handler_t *lsx_stretch_effect_fn(void)
+{
+ static const sox_effect_handler_t handler = {
+ "stretch",
+ "factor [window fade shift fading]\n"
+ " (expansion, frame in ms, lin/..., unit<1.0, unit<0.5)\n"
+ " (defaults: 1.0 20 lin ...)",
+ SOX_EFF_LENGTH,
+ getopts, start, flow, drain, stop, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/sunaudio.c b/src/src/sunaudio.c
new file mode 100644
index 0000000..c24cd59
--- /dev/null
+++ b/src/src/sunaudio.c
@@ -0,0 +1,520 @@
+/* libSoX direct to Sun Audio Driver
+ *
+ * Added by Chris Bagwell (cbagwell@sprynet.com) on 2/26/96
+ * Based on oss handler.
+ *
+ * Cleaned up changes of format somewhat in sunstartwrite on 03/31/98
+ *
+ */
+
+/*
+ * Copyright 1997 Chris Bagwell And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Rick Richardson, Lance Norskog And Sundry Contributors are not
+ * responsible for the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g711.h"
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#ifdef HAVE_SUN_AUDIOIO_H
+ #include <sun/audioio.h>
+#else
+ #include <sys/audioio.h>
+#endif
+#include <errno.h>
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
+#include <stropts.h>
+#endif
+#include <stdlib.h>
+#include <fcntl.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+typedef struct
+{
+ char* pOutput;
+ unsigned cOutput;
+ int device;
+ unsigned sample_shift;
+} priv_t;
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int sunstartread(sox_format_t * ft)
+{
+ char const* szDevname;
+ priv_t* pPriv = (priv_t*)ft->priv;
+
+ size_t samplesize, encoding;
+ audio_info_t audio_if;
+#ifdef __SVR4
+ audio_device_t audio_dev;
+#endif
+ char simple_hw=0;
+
+ lsx_set_signal_defaults(ft);
+
+ if (ft->filename == 0 || ft->filename[0] == 0 || !strcasecmp("default", ft->filename)) {
+ szDevname = "/dev/audio";
+ } else {
+ szDevname = ft->filename;
+ }
+
+ pPriv->device = open(szDevname, O_RDONLY);
+ if (pPriv->device < 0) {
+ lsx_fail_errno(ft, errno, "open failed for device %s", szDevname);
+ return SOX_EOF;
+ }
+
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN) ft->encoding.encoding = SOX_ENCODING_ULAW;
+
+#ifdef __SVR4
+ /* Read in old values, change to what we need and then send back */
+ if (ioctl(pPriv->device, AUDIO_GETDEV, &audio_dev) < 0) {
+ lsx_fail_errno(ft,errno,"Unable to get information for device %s", szDevname);
+ return(SOX_EOF);
+ }
+ lsx_report("Hardware detected: %s",audio_dev.name);
+ if (strcmp("SUNW,am79c30",audio_dev.name) == 0)
+ {
+ simple_hw = 1;
+ }
+#endif
+
+ /* If simple hardware detected in force data to ulaw. */
+ if (simple_hw)
+ {
+ if (ft->encoding.bits_per_sample == 8)
+ {
+ if (ft->encoding.encoding != SOX_ENCODING_ULAW &&
+ ft->encoding.encoding != SOX_ENCODING_ALAW)
+ {
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ }
+ }
+ else if (ft->encoding.bits_per_sample == 16)
+ {
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ ft->encoding.bits_per_sample = 8;
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ }
+ }
+
+ if (ft->encoding.bits_per_sample == 8) {
+ samplesize = 8;
+ pPriv->sample_shift = 0;
+ if (ft->encoding.encoding != SOX_ENCODING_ULAW &&
+ ft->encoding.encoding != SOX_ENCODING_ALAW &&
+ ft->encoding.encoding != SOX_ENCODING_SIGN2) {
+ lsx_fail_errno(ft,SOX_EFMT,"Sun audio driver only supports ULAW, ALAW, and signed linear for bytes.");
+ return (SOX_EOF);
+ }
+ if ((ft->encoding.encoding == SOX_ENCODING_ULAW ||
+ ft->encoding.encoding == SOX_ENCODING_ALAW) &&
+ ft->signal.channels == 2)
+ {
+ lsx_report("Warning: only support mono for ULAW and ALAW data. Forcing to mono.");
+ ft->signal.channels = 1;
+ }
+ }
+ else if (ft->encoding.bits_per_sample == 16) {
+ samplesize = 16;
+ pPriv->sample_shift = 1;
+ if (ft->encoding.encoding != SOX_ENCODING_SIGN2) {
+ lsx_fail_errno(ft,SOX_EFMT,"Sun audio driver only supports signed linear for words.");
+ return(SOX_EOF);
+ }
+ }
+ else {
+ lsx_fail_errno(ft,SOX_EFMT,"Sun audio driver only supports bytes and words");
+ return(SOX_EOF);
+ }
+
+ if (ft->signal.channels == 0)
+ ft->signal.channels = 1;
+ else if (ft->signal.channels > 1) {
+ lsx_report("Warning: some Sun audio devices can not play stereo");
+ lsx_report("at all or sometimes only with signed words. If the");
+ lsx_report("sound seems sluggish then this is probably the case.");
+ lsx_report("Try forcing output to signed words or use the avg");
+ lsx_report("filter to reduce the number of channels.");
+ ft->signal.channels = 2;
+ }
+
+ /* Read in old values, change to what we need and then send back */
+ if (ioctl(pPriv->device, AUDIO_GETINFO, &audio_if) < 0) {
+ lsx_fail_errno(ft,errno,"Unable to initialize %s", szDevname);
+ return(SOX_EOF);
+ }
+ audio_if.record.precision = samplesize;
+ audio_if.record.channels = ft->signal.channels;
+ audio_if.record.sample_rate = ft->signal.rate;
+ if (ft->encoding.encoding == SOX_ENCODING_ULAW)
+ encoding = AUDIO_ENCODING_ULAW;
+ else if (ft->encoding.encoding == SOX_ENCODING_ALAW)
+ encoding = AUDIO_ENCODING_ALAW;
+ else
+ encoding = AUDIO_ENCODING_LINEAR;
+ audio_if.record.encoding = encoding;
+
+ ioctl(pPriv->device, AUDIO_SETINFO, &audio_if);
+ if (audio_if.record.precision != samplesize) {
+ lsx_fail_errno(ft,errno,"Unable to initialize sample size for %s", szDevname);
+ return(SOX_EOF);
+ }
+ if (audio_if.record.channels != ft->signal.channels) {
+ lsx_fail_errno(ft,errno,"Unable to initialize number of channels for %s", szDevname);
+ return(SOX_EOF);
+ }
+ if (audio_if.record.sample_rate != ft->signal.rate) {
+ lsx_fail_errno(ft,errno,"Unable to initialize rate for %s", szDevname);
+ return(SOX_EOF);
+ }
+ if (audio_if.record.encoding != encoding) {
+ lsx_fail_errno(ft,errno,"Unable to initialize encoding for %s", szDevname);
+ return(SOX_EOF);
+ }
+ /* Flush any data in the buffers - its probably in the wrong format */
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ ioctl(pPriv->device, AUDIO_FLUSH);
+#elif defined __GLIBC__
+ ioctl(pPriv->device, (unsigned long int)I_FLUSH, FLUSHR);
+#else
+ ioctl(pPriv->device, I_FLUSH, FLUSHR);
+#endif
+
+ pPriv->cOutput = 0;
+ pPriv->pOutput = NULL;
+
+ return (SOX_SUCCESS);
+}
+
+static int sunstartwrite(sox_format_t * ft)
+{
+ size_t samplesize, encoding;
+ audio_info_t audio_if;
+#ifdef __SVR4
+ audio_device_t audio_dev;
+#endif
+ char simple_hw=0;
+ char const* szDevname;
+ priv_t* pPriv = (priv_t*)ft->priv;
+
+ if (ft->filename == 0 || ft->filename[0] == 0 || !strcasecmp("default", ft->filename)) {
+ szDevname = "/dev/audio";
+ } else {
+ szDevname = ft->filename;
+ }
+
+ pPriv->device = open(szDevname, O_WRONLY);
+ if (pPriv->device < 0) {
+ lsx_fail_errno(ft, errno, "open failed for device: %s", szDevname);
+ return SOX_EOF;
+ }
+
+#ifdef __SVR4
+ /* Read in old values, change to what we need and then send back */
+ if (ioctl(pPriv->device, AUDIO_GETDEV, &audio_dev) < 0) {
+ lsx_fail_errno(ft,errno,"Unable to get device information.");
+ return(SOX_EOF);
+ }
+ lsx_report("Hardware detected: %s",audio_dev.name);
+ if (strcmp("SUNW,am79c30",audio_dev.name) == 0)
+ {
+ simple_hw = 1;
+ }
+#endif
+
+ if (simple_hw)
+ {
+ if (ft->encoding.bits_per_sample == 8)
+ {
+ if (ft->encoding.encoding != SOX_ENCODING_ULAW &&
+ ft->encoding.encoding != SOX_ENCODING_ALAW)
+ {
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ }
+ }
+ else if (ft->encoding.bits_per_sample == 16)
+ {
+ lsx_report("Warning: Detected simple hardware. Forcing output to ULAW");
+ ft->encoding.bits_per_sample = 8;
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ }
+ }
+
+ if (ft->encoding.bits_per_sample == 8)
+ {
+ samplesize = 8;
+ pPriv->sample_shift = 0;
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ else if (ft->encoding.encoding != SOX_ENCODING_ULAW &&
+ ft->encoding.encoding != SOX_ENCODING_ALAW &&
+ ft->encoding.encoding != SOX_ENCODING_SIGN2) {
+ lsx_report("Sun Audio driver only supports ULAW, ALAW, and Signed Linear for bytes.");
+ lsx_report("Forcing to ULAW");
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ }
+ if ((ft->encoding.encoding == SOX_ENCODING_ULAW ||
+ ft->encoding.encoding == SOX_ENCODING_ALAW) &&
+ ft->signal.channels == 2)
+ {
+ lsx_report("Warning: only support mono for ULAW and ALAW data. Forcing to mono.");
+ ft->signal.channels = 1;
+ }
+
+ }
+ else if (ft->encoding.bits_per_sample == 16) {
+ samplesize = 16;
+ pPriv->sample_shift = 1;
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ else if (ft->encoding.encoding != SOX_ENCODING_SIGN2) {
+ lsx_report("Sun Audio driver only supports Signed Linear for words.");
+ lsx_report("Forcing to Signed Linear");
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ }
+ }
+ else {
+ lsx_report("Sun Audio driver only supports bytes and words");
+ ft->encoding.bits_per_sample = 16;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ samplesize = 16;
+ pPriv->sample_shift = 1;
+ }
+
+ if (ft->signal.channels > 1) ft->signal.channels = 2;
+
+ /* Read in old values, change to what we need and then send back */
+ if (ioctl(pPriv->device, AUDIO_GETINFO, &audio_if) < 0) {
+ lsx_fail_errno(ft,errno,"Unable to initialize /dev/audio");
+ return(SOX_EOF);
+ }
+ audio_if.play.precision = samplesize;
+ audio_if.play.channels = ft->signal.channels;
+ audio_if.play.sample_rate = ft->signal.rate;
+ if (ft->encoding.encoding == SOX_ENCODING_ULAW)
+ encoding = AUDIO_ENCODING_ULAW;
+ else if (ft->encoding.encoding == SOX_ENCODING_ALAW)
+ encoding = AUDIO_ENCODING_ALAW;
+ else
+ encoding = AUDIO_ENCODING_LINEAR;
+ audio_if.play.encoding = encoding;
+
+ ioctl(pPriv->device, AUDIO_SETINFO, &audio_if);
+ if (audio_if.play.precision != samplesize) {
+ lsx_fail_errno(ft,errno,"Unable to initialize sample size for /dev/audio");
+ return(SOX_EOF);
+ }
+ if (audio_if.play.channels != ft->signal.channels) {
+ lsx_fail_errno(ft,errno,"Unable to initialize number of channels for /dev/audio");
+ return(SOX_EOF);
+ }
+ if (audio_if.play.sample_rate != ft->signal.rate) {
+ lsx_fail_errno(ft,errno,"Unable to initialize rate for /dev/audio");
+ return(SOX_EOF);
+ }
+ if (audio_if.play.encoding != encoding) {
+ lsx_fail_errno(ft,errno,"Unable to initialize encoding for /dev/audio");
+ return(SOX_EOF);
+ }
+
+ pPriv->cOutput = sox_globals.bufsiz >> pPriv->sample_shift;
+ pPriv->pOutput = lsx_malloc((size_t)pPriv->cOutput << pPriv->sample_shift);
+
+ return (SOX_SUCCESS);
+}
+
+static int sunstop(sox_format_t* ft)
+{
+ priv_t* pPriv = (priv_t*)ft->priv;
+ if (pPriv->device >= 0) {
+ close(pPriv->device);
+ }
+ if (pPriv->pOutput) {
+ free(pPriv->pOutput);
+ }
+ return SOX_SUCCESS;
+}
+
+typedef sox_uint16_t sox_uint14_t;
+typedef sox_uint16_t sox_uint13_t;
+typedef sox_int16_t sox_int14_t;
+typedef sox_int16_t sox_int13_t;
+#define SOX_ULAW_BYTE_TO_SAMPLE(d,clips) SOX_SIGNED_16BIT_TO_SAMPLE(sox_ulaw2linear16(d),clips)
+#define SOX_ALAW_BYTE_TO_SAMPLE(d,clips) SOX_SIGNED_16BIT_TO_SAMPLE(sox_alaw2linear16(d),clips)
+#define SOX_SAMPLE_TO_ULAW_BYTE(d,c) sox_14linear2ulaw(SOX_SAMPLE_TO_UNSIGNED(14,d,c) - 0x2000)
+#define SOX_SAMPLE_TO_ALAW_BYTE(d,c) sox_13linear2alaw(SOX_SAMPLE_TO_UNSIGNED(13,d,c) - 0x1000)
+
+static size_t sunread(sox_format_t* ft, sox_sample_t* pOutput, size_t cOutput)
+{
+ priv_t* pPriv = (priv_t*)ft->priv;
+ char* pbOutput = (char*)pOutput;
+ size_t cbOutputLeft = cOutput << pPriv->sample_shift;
+ size_t i, cRead;
+ int cbRead;
+ SOX_SAMPLE_LOCALS;
+ LSX_USE_VAR(sox_macro_temp_double);
+
+ while (cbOutputLeft) {
+ cbRead = read(pPriv->device, pbOutput, cbOutputLeft);
+ if (cbRead <= 0) {
+ if (cbRead < 0) {
+ lsx_fail_errno(ft, errno, "Error reading from device");
+ return 0;
+ }
+ break;
+ }
+ cbOutputLeft -= cbRead;
+ pbOutput += cbRead;
+ }
+
+ /* Convert in-place (backwards) */
+ cRead = cOutput - (cbOutputLeft >> pPriv->sample_shift);
+ switch (pPriv->sample_shift)
+ {
+ case 0:
+ switch (ft->encoding.encoding)
+ {
+ case SOX_ENCODING_SIGN2:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_UNSIGNED_8BIT_TO_SAMPLE(
+ ((sox_uint8_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ case SOX_ENCODING_ULAW:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_ULAW_BYTE_TO_SAMPLE(
+ ((sox_uint8_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ case SOX_ENCODING_ALAW:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_ALAW_BYTE_TO_SAMPLE(
+ ((sox_uint8_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ default:
+ return 0;
+ }
+ break;
+ case 1:
+ for (i = cRead; i != 0; i--) {
+ pOutput[i - 1] = SOX_SIGNED_16BIT_TO_SAMPLE(
+ ((sox_int16_t*)pOutput)[i - 1],
+ dummy);
+ }
+ break;
+ }
+
+ return cRead;
+}
+
+static size_t sunwrite(
+ sox_format_t* ft,
+ const sox_sample_t* pInput,
+ size_t cInput)
+{
+ priv_t* pPriv = (priv_t*)ft->priv;
+ size_t cInputRemaining = cInput;
+ unsigned cClips = 0;
+ SOX_SAMPLE_LOCALS;
+
+ while (cInputRemaining) {
+ size_t cStride;
+ size_t i;
+ size_t cbStride;
+ int cbWritten;
+
+ cStride = cInput;
+ if (cStride > pPriv->cOutput) {
+ cStride = pPriv->cOutput;
+ }
+
+ switch (pPriv->sample_shift)
+ {
+ case 0:
+ switch (ft->encoding.encoding)
+ {
+ case SOX_ENCODING_SIGN2:
+ for (i = 0; i != cStride; i++) {
+ ((sox_uint8_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_UNSIGNED_8BIT(pInput[i], cClips);
+ }
+ break;
+ case SOX_ENCODING_ULAW:
+ for (i = 0; i != cStride; i++) {
+ ((sox_uint8_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_ULAW_BYTE(pInput[i], cClips);
+ }
+ break;
+ case SOX_ENCODING_ALAW:
+ for (i = 0; i != cStride; i++) {
+ ((sox_uint8_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_ALAW_BYTE(pInput[i], cClips);
+ }
+ break;
+ default:
+ return 0;
+ }
+ break;
+ case 1:
+ for (i = 0; i != cStride; i++) {
+ ((sox_int16_t*)pPriv->pOutput)[i] =
+ SOX_SAMPLE_TO_SIGNED_16BIT(pInput[i], cClips);
+ }
+ break;
+ }
+
+ cbStride = cStride << pPriv->sample_shift;
+ i = 0;
+ do {
+ cbWritten = write(pPriv->device, &pPriv->pOutput[i], cbStride - i);
+ i += cbWritten;
+ if (cbWritten <= 0) {
+ lsx_fail_errno(ft, errno, "Error writing to device");
+ return 0;
+ }
+ } while (i != cbStride);
+
+ cInputRemaining -= cStride;
+ pInput += cStride;
+ }
+
+ return cInput;
+}
+
+LSX_FORMAT_HANDLER(sunau)
+{
+ static char const * const names[] = {"sunau", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_SIGN2, 8, 16, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Sun audio device driver",
+ names, SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ sunstartread, sunread, sunstop,
+ sunstartwrite, sunwrite, sunstop,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/swap.c b/src/src/swap.c
new file mode 100644
index 0000000..4ec6dc1
--- /dev/null
+++ b/src/src/swap.c
@@ -0,0 +1,62 @@
+/* libSoX effect: swap pairs of audio channels
+ *
+ * First version written 01/2012 by Ulrich Klauer.
+ * Replaces an older swap effect originally written by Chris Bagwell
+ * on March 16, 1999.
+ *
+ * Copyright 2012 Chris Bagwell and SoX Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+static int start(sox_effect_t *effp)
+{
+ return effp->in_signal.channels >= 2 ? SOX_SUCCESS : SOX_EFF_NULL;
+}
+
+static int flow(sox_effect_t *effp, const sox_sample_t *ibuf,
+ sox_sample_t *obuf, size_t *isamp, size_t *osamp)
+{
+ size_t len = min(*isamp, *osamp);
+ size_t channels = effp->in_signal.channels;
+ len /= channels;
+ *isamp = *osamp = len * channels;
+
+ while (len--) {
+ size_t i;
+ for (i = 0; i + 1 < channels; i += 2) {
+ *obuf++ = ibuf[1];
+ *obuf++ = ibuf[0];
+ ibuf += 2;
+ }
+ if (channels % 2)
+ *obuf++ = *ibuf++;
+ }
+
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const *lsx_swap_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "swap", NULL,
+ SOX_EFF_MCHAN | SOX_EFF_MODIFY,
+ NULL, start, flow, NULL, NULL, NULL,
+ 0
+ };
+ return &handler;
+}
diff --git a/src/src/synth.c b/src/src/synth.c
new file mode 100644
index 0000000..c6f5384
--- /dev/null
+++ b/src/src/synth.c
@@ -0,0 +1,689 @@
+/* libSoX synth - Synthesizer Effect.
+ *
+ * Copyright (c) 2001-2009 SoX contributors
+ * Copyright (c) Jan 2001 Carsten Borchardt
+ *
+ * This source code is freely redistributable and may be used for any purpose.
+ * This copyright notice must be maintained. The authors are not responsible
+ * for the consequences of using this software.
+ *
+ * Except for synth types: pluck, tpdf, pinknoise, & brownnoise, and
+ * sweep types: linear, square & exp, which are:
+ *
+ * Copyright (c) 2006-2013 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+#include <ctype.h>
+
+typedef enum {
+ synth_sine,
+ synth_square,
+ synth_sawtooth,
+ synth_triangle,
+ synth_trapezium,
+ synth_trapetz = synth_trapezium, /* Deprecated name for trapezium */
+ synth_exp,
+ /* Tones above, noises below */
+ synth_whitenoise,
+ synth_noise = synth_whitenoise, /* Just a handy alias */
+ synth_tpdfnoise,
+ synth_pinknoise,
+ synth_brownnoise,
+ synth_pluck
+} type_t;
+
+static lsx_enum_item const synth_type[] = {
+ LSX_ENUM_ITEM(synth_, sine)
+ LSX_ENUM_ITEM(synth_, square)
+ LSX_ENUM_ITEM(synth_, sawtooth)
+ LSX_ENUM_ITEM(synth_, triangle)
+ LSX_ENUM_ITEM(synth_, trapezium)
+ LSX_ENUM_ITEM(synth_, trapetz)
+ LSX_ENUM_ITEM(synth_, exp)
+ LSX_ENUM_ITEM(synth_, whitenoise)
+ LSX_ENUM_ITEM(synth_, noise)
+ LSX_ENUM_ITEM(synth_, tpdfnoise)
+ LSX_ENUM_ITEM(synth_, pinknoise)
+ LSX_ENUM_ITEM(synth_, brownnoise)
+ LSX_ENUM_ITEM(synth_, pluck)
+ {0, 0}
+};
+
+typedef enum {synth_create, synth_mix, synth_amod, synth_fmod} combine_t;
+
+static lsx_enum_item const combine_type[] = {
+ LSX_ENUM_ITEM(synth_, create)
+ LSX_ENUM_ITEM(synth_, mix)
+ LSX_ENUM_ITEM(synth_, amod)
+ LSX_ENUM_ITEM(synth_, fmod)
+ {0, 0}
+};
+
+
+
+typedef enum {Linear, Square, Exp, Exp_cycle} sweep_t;
+
+typedef struct {
+ /* options */
+ type_t type;
+ combine_t combine;
+ double freq, freq2, mult;
+ sweep_t sweep;
+ double offset, phase;
+ double p1, p2, p3; /* Use depends on synth type */
+
+ /* internal stuff */
+ double lp_last_out, hp_last_out, hp_last_in, ap_last_out, ap_last_in;
+ double cycle_start_time_s, c0, c1, c2, c3, c4, c5, c6;
+
+ double * buffer;
+ size_t buffer_len, pos;
+} channel_t;
+
+
+
+/* Private data for the synthesizer */
+typedef struct {
+ char * length_str;
+ channel_t * getopts_channels;
+ size_t getopts_nchannels;
+ uint64_t samples_done;
+ uint64_t samples_to_do;
+ channel_t * channels;
+ size_t number_of_channels;
+ sox_bool no_headroom;
+ double gain;
+} priv_t;
+
+
+
+static void create_channel(channel_t * chan)
+{
+ memset(chan, 0, sizeof(*chan));
+ chan->freq2 = chan->freq = 440;
+ chan->p3 = chan->p2 = chan->p1 = -1;
+}
+
+
+
+static void set_default_parameters(channel_t * chan)
+{
+ switch (chan->type) {
+ case synth_square: /* p1 is pulse width */
+ if (chan->p1 < 0)
+ chan->p1 = 0.5; /* default to 50% duty cycle */
+ break;
+
+ case synth_triangle: /* p1 is position of maximum */
+ if (chan->p1 < 0)
+ chan->p1 = 0.5;
+ break;
+
+ case synth_trapezium:
+ /* p1 is length of rising slope,
+ * p2 position where falling slope begins
+ * p3 position of end of falling slope
+ */
+ if (chan->p1 < 0) {
+ chan->p1 = 0.1;
+ chan->p2 = 0.5;
+ chan->p3 = 0.6;
+ } else if (chan->p2 < 0) { /* try a symmetric waveform */
+ if (chan->p1 <= 0.5) {
+ chan->p2 = (1 - 2 * chan->p1) / 2;
+ chan->p3 = chan->p2 + chan->p1;
+ } else {
+ /* symetric is not possible, fall back to asymmetrical triangle */
+ chan->p2 = chan->p1;
+ chan->p3 = 1;
+ }
+ } else if (chan->p3 < 0)
+ chan->p3 = 1; /* simple falling slope to the end */
+ break;
+
+ case synth_exp:
+ if (chan->p1 < 0) /* p1 is position of maximum */
+ chan->p1 = 0.5;
+ if (chan->p2 < 0) /* p2 is amplitude */
+ chan->p2 = .5;
+ break;
+
+ case synth_pluck:
+ if (chan->p1 < 0)
+ chan->p1 = .4;
+ if (chan->p2 < 0)
+ chan->p2 = .2, chan->p3 = .9;
+
+ default: break;
+ }
+}
+
+
+
+#undef NUMERIC_PARAMETER
+#define NUMERIC_PARAMETER(p, min, max) { \
+char * end_ptr_np; \
+double d_np = strtod(argv[argn], &end_ptr_np); \
+if (end_ptr_np == argv[argn]) \
+ break; \
+if (d_np < min || d_np > max || *end_ptr_np != '\0') { \
+ lsx_fail("parameter error"); \
+ return SOX_EOF; \
+} \
+chan->p = d_np / 100; /* adjust so abs(parameter) <= 1 */\
+if (++argn == argc) \
+ break; \
+}
+
+
+
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ channel_t master, * chan = &master;
+ int key = INT_MAX, argn = 0;
+ char dummy, * end_ptr;
+ const char *n;
+ --argc, ++argv;
+
+ if (argc && !strcmp(*argv, "-n")) p->no_headroom = sox_true, ++argv, --argc;
+
+ if (argc > 1 && !strcmp(*argv, "-j") && (
+ sscanf(argv[1], "%i %c", &key, &dummy) == 1 || (
+ (key = lsx_parse_note(argv[1], &end_ptr)) != INT_MAX &&
+ !*end_ptr))) {
+ argc -= 2;
+ argv += 2;
+ }
+
+ /* Get duration if given (if first arg starts with digit) */
+ if (argc && (isdigit((int)argv[argn][0]) || argv[argn][0] == '.')) {
+ p->length_str = lsx_strdup(argv[argn]);
+ /* Do a dummy parse of to see if it will fail */
+ n = lsx_parsesamples(0., p->length_str, &p->samples_to_do, 't');
+ if (!n || *n)
+ return lsx_usage(effp);
+ argn++;
+ }
+
+ create_channel(chan);
+ if (argn < argc) { /* [off [ph [p1 [p2 [p3]]]]]] */
+ do { /* break-able block */
+ NUMERIC_PARAMETER(offset,-100, 100)
+ NUMERIC_PARAMETER(phase , 0, 100)
+ NUMERIC_PARAMETER(p1, 0, 100)
+ NUMERIC_PARAMETER(p2, 0, 100)
+ NUMERIC_PARAMETER(p3, 0, 100)
+ } while (0);
+ }
+
+ while (argn < argc) { /* type [combine] [f1[-f2] [off [ph [p1 [p2 [p3]]]]]] */
+ lsx_enum_item const * enum_p = lsx_find_enum_text(argv[argn], synth_type, lsx_find_enum_item_case_sensitive);
+
+ if (enum_p == NULL) {
+ lsx_fail("no type given");
+ return SOX_EOF;
+ }
+ p->getopts_channels = lsx_realloc(p->getopts_channels, sizeof(*p->getopts_channels) * (p->getopts_nchannels + 1));
+ chan = &p->getopts_channels[p->getopts_nchannels++];
+ memcpy(chan, &master, sizeof(*chan));
+ chan->type = enum_p->value;
+ if (++argn == argc)
+ break;
+
+ /* maybe there is a combine-type in next arg */
+ enum_p = lsx_find_enum_text(argv[argn], combine_type, lsx_find_enum_item_case_sensitive);
+ if (enum_p != NULL) {
+ chan->combine = enum_p->value;
+ if (++argn == argc)
+ break;
+ }
+
+ /* read frequencies if given */
+ if (!lsx_find_enum_text(argv[argn], synth_type, lsx_find_enum_item_case_sensitive) &&
+ argv[argn][0] != '-') {
+ static const char sweeps[] = ":+/-";
+
+ chan->freq2 = chan->freq = lsx_parse_frequency_k(argv[argn], &end_ptr, key);
+ if (chan->freq < (chan->type == synth_pluck? 27.5 : 0) ||
+ (chan->type == synth_pluck && chan->freq > 4220)) {
+ lsx_fail("invalid freq");
+ return SOX_EOF;
+ }
+ if (*end_ptr && strchr(sweeps, *end_ptr)) { /* freq2 given? */
+ if (chan->type >= synth_noise) {
+ lsx_fail("can't sweep this type");
+ return SOX_EOF;
+ }
+ chan->sweep = strchr(sweeps, *end_ptr) - sweeps;
+ chan->freq2 = lsx_parse_frequency_k(end_ptr + 1, &end_ptr, key);
+ if (chan->freq2 < 0) {
+ lsx_fail("invalid freq2");
+ return SOX_EOF;
+ }
+ if (p->length_str == NULL) {
+ lsx_fail("duration must be given when using freq2");
+ return SOX_EOF;
+ }
+ }
+ if (*end_ptr) {
+ lsx_fail("frequency: invalid trailing character");
+ return SOX_EOF;
+ }
+ if (chan->sweep >= Exp && chan->freq * chan->freq2 == 0) {
+ lsx_fail("invalid frequency for exponential sweep");
+ return SOX_EOF;
+ }
+
+ if (++argn == argc)
+ break;
+ }
+
+ /* read rest of parameters */
+ do { /* break-able block */
+ NUMERIC_PARAMETER(offset,-100, 100)
+ NUMERIC_PARAMETER(phase , 0, 100)
+ NUMERIC_PARAMETER(p1, 0, 100)
+ NUMERIC_PARAMETER(p2, 0, 100)
+ NUMERIC_PARAMETER(p3, 0, 100)
+ } while (0);
+ }
+
+ /* If no channel parameters were given, create one default channel: */
+ if (!p->getopts_nchannels) {
+ p->getopts_channels = lsx_malloc(sizeof(*p->getopts_channels));
+ memcpy(&p->getopts_channels[0], &master, sizeof(channel_t));
+ ++p->getopts_nchannels;
+ }
+
+ if (!effp->in_signal.channels)
+ effp->in_signal.channels = p->getopts_nchannels;
+
+ return SOX_SUCCESS;
+}
+
+
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i, j, k;
+
+ p->samples_done = 0;
+
+ if (p->length_str) {
+ if (lsx_parsesamples(effp->in_signal.rate, p->length_str, &p->samples_to_do, 't') == NULL)
+ return lsx_usage(effp);
+ } else
+ p->samples_to_do = effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : 0;
+
+ p->number_of_channels = effp->in_signal.channels;
+ p->channels = lsx_calloc(p->number_of_channels, sizeof(*p->channels));
+ for (i = 0; i < p->number_of_channels; ++i) {
+ channel_t * chan = &p->channels[i];
+ *chan = p->getopts_channels[i % p->getopts_nchannels];
+ set_default_parameters(chan);
+ if (chan->type == synth_pluck) {
+ double min, max, frac, p2;
+
+ /* Low pass: */
+ double const decay_rate = -2; /* dB / s */
+ double const decay_f = min(912, 266 + 106 * log(chan->freq));
+ double d = sqr(dB_to_linear(decay_rate / chan->freq));
+ d = (d * cos(2 * M_PI * decay_f / effp->in_signal.rate) - 1) / (d - 1);
+ chan->c0 = d - sqrt(d * d - 1);
+ chan->c1 = 1 - chan->c0;
+
+ /* Single-pole low pass is very rate-dependent: */
+ if (effp->in_signal.rate < 44100 || effp->in_signal.rate > 48000) {
+ lsx_fail(
+ "sample rate for pluck must be 44100-48000; use `rate' to resample");
+ return SOX_EOF;
+ }
+ /* Decay: */
+ chan->c1 *= exp(-2e4/ (.05+chan->p1)/ chan->freq/ effp->in_signal.rate);
+
+ /* High pass (DC-block): */
+ chan->c2 = exp(-2 * M_PI * 10 / effp->in_signal.rate);
+ chan->c3 = (1 + chan->c2) * .5;
+
+ /* All pass (for fractional delay): */
+ d = chan->c0 / (chan->c0 + chan->c1);
+ chan->buffer_len = effp->in_signal.rate / chan->freq - d;
+ frac = effp->in_signal.rate / chan->freq - d - chan->buffer_len;
+ chan->c4 = (1 - frac) / (1 + frac);
+ chan->pos = 0;
+
+ /* Exitation: */
+ chan->buffer = lsx_calloc(chan->buffer_len, sizeof(*chan->buffer));
+ for (k = 0, p2 = chan->p2; k < 2 && p2 >= 0; ++k, p2 = chan->p3) {
+ double d1 = 0, d2, colour = pow(2., 4 * (p2 - 1));
+ int32_t r = p2 * 100 + .5;
+ for (j = 0; j < chan->buffer_len; ++j) {
+ do d2 = d1 + (chan->phase? DRANQD1:dranqd1(r)) * colour;
+ while (fabs(d2) > 1);
+ chan->buffer[j] += d2 * (1 - .3 * k);
+ d1 = d2 * (colour != 1);
+#ifdef TEST_PLUCK
+ chan->buffer[j] = sin(2 * M_PI * j / chan->buffer_len);
+#endif
+ }
+ }
+
+ /* In-delay filter graduation: */
+ for (j = 0, min = max = 0; j < chan->buffer_len; ++j) {
+ double d2, t = (double)j / chan->buffer_len;
+ chan->lp_last_out = d2 =
+ chan->buffer[j] * chan->c1 + chan->lp_last_out * chan->c0;
+
+ chan->ap_last_out =
+ d2 * chan->c4 + chan->ap_last_in - chan->ap_last_out * chan->c4;
+ chan->ap_last_in = d2;
+
+ chan->buffer[j] = chan->buffer[j] * (1 - t) + chan->ap_last_out * t;
+ min = min(min, chan->buffer[j]);
+ max = max(max, chan->buffer[j]);
+ }
+
+ /* Normalise: */
+ for (j = 0, d = 0; j < chan->buffer_len; ++j) {
+ chan->buffer[j] = (2 * chan->buffer[j] - max - min) / (max - min);
+ d += sqr(chan->buffer[j]);
+ }
+ lsx_debug("rms=%f c0=%f c1=%f df=%f d3f=%f c2=%f c3=%f c4=%f frac=%f",
+ 10 * log(d / chan->buffer_len), chan->c0, chan->c1, decay_f,
+ log(chan->c0)/ -2 / M_PI * effp->in_signal.rate,
+ chan->c2, chan->c3, chan->c4, frac);
+ }
+ switch (chan->sweep) {
+ case Linear: chan->mult = p->samples_to_do?
+ (chan->freq2 - chan->freq) / p->samples_to_do / 2 : 0;
+ break;
+ case Square: chan->mult = p->samples_to_do?
+ sqrt(fabs(chan->freq2 - chan->freq)) / p->samples_to_do / sqrt(3.) : 0;
+ if (chan->freq > chan->freq2)
+ chan->mult = -chan->mult;
+ break;
+ case Exp: chan->mult = p->samples_to_do?
+ log(chan->freq2 / chan->freq) / p->samples_to_do * effp->in_signal.rate : 1;
+ chan->freq /= chan->mult;
+ break;
+ case Exp_cycle: chan->mult = p->samples_to_do?
+ (log(chan->freq2) - log(chan->freq)) / p->samples_to_do : 1;
+ break;
+ }
+ lsx_debug("type=%s, combine=%s, samples_to_do=%" PRIu64 ", f1=%g, f2=%g, "
+ "offset=%g, phase=%g, p1=%g, p2=%g, p3=%g mult=%g",
+ lsx_find_enum_value(chan->type, synth_type)->text,
+ lsx_find_enum_value(chan->combine, combine_type)->text,
+ p->samples_to_do, chan->freq, chan->freq2,
+ chan->offset, chan->phase, chan->p1, chan->p2, chan->p3, chan->mult);
+ }
+ p->gain = 1;
+ effp->out_signal.mult = p->no_headroom? NULL : &p->gain;
+ effp->out_signal.length = p->samples_to_do ?
+ p->samples_to_do * effp->out_signal.channels : SOX_UNKNOWN_LEN;
+ return SOX_SUCCESS;
+}
+
+#define elapsed_time_s p->samples_done / effp->in_signal.rate
+
+static sox_sample_t clamp_double_to_sample(double val)
+{
+ if (val > SOX_SAMPLE_MAX) {
+ return SOX_SAMPLE_MAX;
+ } else if (val < SOX_SAMPLE_MIN) {
+ return SOX_SAMPLE_MIN;
+ } else {
+ return val;
+ }
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf, sox_sample_t * obuf,
+ size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ unsigned len = min(*isamp, *osamp) / effp->in_signal.channels;
+ unsigned c, done;
+ int result = SOX_SUCCESS;
+
+ for (done = 0; done < len && result == SOX_SUCCESS; ++done) {
+ for (c = 0; c < effp->in_signal.channels; c++) {
+ sox_sample_t synth_input = *ibuf++;
+ channel_t * chan = &p->channels[c];
+ double synth_out; /* [-1, 1] */
+
+ if (chan->type < synth_noise) { /* Need to calculate phase: */
+ double phase; /* [0, 1) */
+ switch (chan->sweep) {
+ case Linear:
+ phase = (chan->freq + p->samples_done * chan->mult) *
+ elapsed_time_s;
+ break;
+ case Square:
+ phase = (chan->freq + sign(chan->mult) *
+ sqr(p->samples_done * chan->mult)) * elapsed_time_s;
+ break;
+ case Exp:
+ phase = chan->freq * exp(chan->mult * elapsed_time_s);
+ break;
+ case Exp_cycle: default: {
+ double f = chan->freq * exp(p->samples_done * chan->mult);
+ double cycle_elapsed_time_s = elapsed_time_s - chan->cycle_start_time_s;
+ if (f * cycle_elapsed_time_s >= 1) { /* move to next cycle */
+ chan->cycle_start_time_s += 1 / f;
+ cycle_elapsed_time_s = elapsed_time_s - chan->cycle_start_time_s;
+ }
+ phase = f * cycle_elapsed_time_s;
+ break;
+ }
+ }
+ phase = fmod(phase + chan->phase, 1.0);
+
+ switch (chan->type) {
+ case synth_sine:
+ synth_out = sin(2 * M_PI * phase);
+ break;
+
+ case synth_square:
+ /* |_______ | +1
+ * | | |
+ * |_______|__________| 0
+ * | | |
+ * | |__________| -1
+ * | |
+ * 0 p1 1
+ */
+ synth_out = -1 + 2 * (phase < chan->p1);
+ break;
+
+ case synth_sawtooth:
+ /* | __| +1
+ * | __/ |
+ * |_______/_____| 0
+ * | __/ |
+ * |_/ | -1
+ * | |
+ * 0 1
+ */
+ synth_out = -1 + 2 * phase;
+ break;
+
+ case synth_triangle:
+ /* | . | +1
+ * | / \ |
+ * |__/___\__| 0
+ * | / \ |
+ * |/ \| -1
+ * | |
+ * 0 p1 1
+ */
+
+ if (phase < chan->p1)
+ synth_out = -1 + 2 * phase / chan->p1; /* In rising part of period */
+ else
+ synth_out = 1 - 2 * (phase - chan->p1) / (1 - chan->p1); /* In falling part */
+ break;
+
+ case synth_trapezium:
+ /* | ______ |+1
+ * | / \ |
+ * |__/________\___________| 0
+ * | / \ |
+ * |/ \_________|-1
+ * | |
+ * 0 p1 p2 p3 1
+ */
+ if (phase < chan->p1) /* In rising part of period */
+ synth_out = -1 + 2 * phase / chan->p1;
+ else if (phase < chan->p2) /* In high part of period */
+ synth_out = 1;
+ else if (phase < chan->p3) /* In falling part */
+ synth_out = 1 - 2 * (phase - chan->p2) / (chan->p3 - chan->p2);
+ else /* In low part of period */
+ synth_out = -1;
+ break;
+
+ case synth_exp:
+ /* | | | +1
+ * | | | |
+ * | _| |_ | 0
+ * | __- -__ |
+ * |____--- ---____ | f(p2)
+ * | |
+ * 0 p1 1
+ */
+ synth_out = dB_to_linear(chan->p2 * -200); /* 0 .. 1 */
+ if (phase < chan->p1)
+ synth_out = synth_out * exp(phase * log(1 / synth_out) / chan->p1);
+ else
+ synth_out = synth_out * exp((1 - phase) * log(1 / synth_out) / (1 - chan->p1));
+ synth_out = synth_out * 2 - 1; /* map 0 .. 1 to -1 .. +1 */
+ break;
+
+ default: synth_out = 0;
+ }
+ } else switch (chan->type) {
+ case synth_whitenoise:
+ synth_out = DRANQD1;
+ break;
+
+ case synth_tpdfnoise:
+ synth_out = .5 * (DRANQD1 + DRANQD1);
+ break;
+
+ case synth_pinknoise: { /* "Paul Kellet's refined method" */
+#define _ .125 / (65536. * 32768.)
+ double d = RANQD1;
+ chan->c0 = .99886 * chan->c0 + d * (.0555179*_);
+ chan->c1 = .99332 * chan->c1 + d * (.0750759*_);
+ chan->c2 = .96900 * chan->c2 + d * (.1538520*_);
+ chan->c3 = .86650 * chan->c3 + d * (.3104856*_);
+ chan->c4 = .55000 * chan->c4 + d * (.5329522*_);
+ chan->c5 = -.7616 * chan->c5 - d * (.0168980*_);
+ synth_out = chan->c0 + chan->c1 + chan->c2 + chan->c3
+ + chan->c4 + chan->c5 + chan->c6 + d * (.5362*_);
+ chan->c6 = d * (.115926*_);
+ break;
+#undef _
+ }
+
+ case synth_brownnoise:
+ do synth_out = chan->lp_last_out + DRANQD1 * (1. / 16);
+ while (fabs(synth_out) > 1);
+ chan->lp_last_out = synth_out;
+ break;
+
+ case synth_pluck: {
+ double d = chan->buffer[chan->pos];
+
+ chan->hp_last_out =
+ (d - chan->hp_last_in) * chan->c3 + chan->hp_last_out * chan->c2;
+ chan->hp_last_in = d;
+
+ synth_out = range_limit(chan->hp_last_out, -1, 1);
+
+ chan->lp_last_out = d = d * chan->c1 + chan->lp_last_out * chan->c0;
+
+ chan->ap_last_out = chan->buffer[chan->pos] =
+ (d - chan->ap_last_out) * chan->c4 + chan->ap_last_in;
+ chan->ap_last_in = d;
+
+ chan->pos = chan->pos + 1 == chan->buffer_len? 0 : chan->pos + 1;
+ break;
+ }
+
+ default: synth_out = 0;
+ }
+
+ /* Add offset, but prevent clipping: */
+ synth_out = synth_out * (1 - fabs(chan->offset)) + chan->offset;
+
+ switch (chan->combine) {
+ case synth_create: synth_out *= SOX_SAMPLE_MAX; break;
+ case synth_mix : synth_out = (synth_out * SOX_SAMPLE_MAX + synth_input) * .5; break;
+ case synth_amod : synth_out = (synth_out + 1) * synth_input * .5; break;
+ case synth_fmod : synth_out *= synth_input; break;
+ }
+ *obuf++ = clamp_double_to_sample(
+ synth_out < 0? synth_out * p->gain - .5 : synth_out * p->gain + .5);
+ }
+ if (++p->samples_done == p->samples_to_do)
+ result = SOX_EOF;
+ }
+ *isamp = *osamp = done * effp->in_signal.channels;
+ return result;
+}
+
+
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ size_t i;
+
+ for (i = 0; i < p->number_of_channels; ++i)
+ free(p->channels[i].buffer);
+ free(p->channels);
+ return SOX_SUCCESS;
+}
+
+
+
+static int lsx_kill(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ free(p->getopts_channels);
+ free(p->length_str);
+ return SOX_SUCCESS;
+}
+
+
+
+const sox_effect_handler_t *lsx_synth_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "synth", "[-j KEY] [-n] [length [offset [phase [p1 [p2 [p3]]]]]]] {type [combine] [[%]freq[k][:|+|/|-[%]freq2[k]] [offset [phase [p1 [p2 [p3]]]]]]}",
+ SOX_EFF_MCHAN | SOX_EFF_LENGTH | SOX_EFF_GAIN,
+ getopts, start, flow, 0, stop, lsx_kill, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/tempo.c b/src/src/tempo.c
new file mode 100644
index 0000000..61dba32
--- /dev/null
+++ b/src/src/tempo.c
@@ -0,0 +1,360 @@
+/* libSoX effect: change tempo (and duration) or pitch (maintain duration)
+ * Copyright (c) 2007,8 robs@users.sourceforge.net
+ * Based on ideas from Olli Parviainen's SoundTouch Library.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/fifo.h"
+#include <math.h>
+
+typedef struct {
+ /* Configuration parameters: */
+ size_t channels;
+ sox_bool quick_search; /* Whether to quick search or linear search */
+ double factor; /* 1 for no change, < 1 for slower, > 1 for faster. */
+ size_t search; /* Wide samples to search for best overlap position */
+ size_t segment; /* Processing segment length in wide samples */
+ size_t overlap; /* In wide samples */
+
+ size_t process_size; /* # input wide samples needed to process 1 segment */
+
+ /* Buffers: */
+ fifo_t input_fifo;
+ float * overlap_buf;
+ fifo_t output_fifo;
+
+ /* Counters: */
+ uint64_t samples_in;
+ uint64_t samples_out;
+ uint64_t segments_total;
+ uint64_t skip_total;
+} tempo_t;
+
+/* Waveform Similarity by least squares; works across multi-channels */
+static float difference(const float * a, const float * b, size_t length)
+{
+ float diff = 0;
+ size_t i = 0;
+
+ #define _ diff += sqr(a[i] - b[i]), ++i; /* Loop optimisation */
+ do {_ _ _ _ _ _ _ _} while (i < length); /* N.B. length ≡ 0 (mod 8) */
+ #undef _
+ return diff;
+}
+
+/* Find where the two segments are most alike over the overlap period. */
+static size_t tempo_best_overlap_position(tempo_t * t, float const * new_win)
+{
+ float * f = t->overlap_buf;
+ size_t j, best_pos, prev_best_pos = (t->search + 1) >> 1, step = 64;
+ size_t i = best_pos = t->quick_search? prev_best_pos : 0;
+ float diff, least_diff = difference(new_win + t->channels * i, f, t->channels * t->overlap);
+ int k = 0;
+
+ if (t->quick_search) do { /* hierarchical search */
+ for (k = -1; k <= 1; k += 2) for (j = 1; j < 4 || step == 64; ++j) {
+ i = prev_best_pos + k * j * step;
+ if ((int)i < 0 || i >= t->search)
+ break;
+ diff = difference(new_win + t->channels * i, f, t->channels * t->overlap);
+ if (diff < least_diff)
+ least_diff = diff, best_pos = i;
+ }
+ prev_best_pos = best_pos;
+ } while (step >>= 2);
+ else for (i = 1; i < t->search; i++) { /* linear search */
+ diff = difference(new_win + t->channels * i, f, t->channels * t->overlap);
+ if (diff < least_diff)
+ least_diff = diff, best_pos = i;
+ }
+ return best_pos;
+}
+
+static void tempo_overlap(
+ tempo_t * t, const float * in1, const float * in2, float * output)
+{
+ size_t i, j, k = 0;
+ float fade_step = 1.0f / (float) t->overlap;
+
+ for (i = 0; i < t->overlap; ++i) {
+ float fade_in = fade_step * (float) i;
+ float fade_out = 1.0f - fade_in;
+ for (j = 0; j < t->channels; ++j, ++k)
+ output[k] = in1[k] * fade_out + in2[k] * fade_in;
+ }
+}
+
+static void tempo_process(tempo_t * t)
+{
+ while (fifo_occupancy(&t->input_fifo) >= t->process_size) {
+ size_t skip, offset;
+
+ /* Copy or overlap the first bit to the output */
+ if (!t->segments_total) {
+ offset = t->search / 2;
+ fifo_write(&t->output_fifo, t->overlap, (float *) fifo_read_ptr(&t->input_fifo) + t->channels * offset);
+ } else {
+ offset = tempo_best_overlap_position(t, fifo_read_ptr(&t->input_fifo));
+ tempo_overlap(t, t->overlap_buf,
+ (float *) fifo_read_ptr(&t->input_fifo) + t->channels * offset,
+ fifo_write(&t->output_fifo, t->overlap, NULL));
+ }
+ /* Copy the middle bit to the output */
+ fifo_write(&t->output_fifo, t->segment - 2 * t->overlap,
+ (float *) fifo_read_ptr(&t->input_fifo) +
+ t->channels * (offset + t->overlap));
+
+ /* Copy the end bit to overlap_buf ready to be mixed with
+ * the beginning of the next segment. */
+ memcpy(t->overlap_buf,
+ (float *) fifo_read_ptr(&t->input_fifo) +
+ t->channels * (offset + t->segment - t->overlap),
+ t->channels * t->overlap * sizeof(*(t->overlap_buf)));
+
+ /* Advance through the input stream */
+ skip = t->factor * (++t->segments_total * (t->segment - t->overlap)) + 0.5;
+ t->skip_total += skip -= t->skip_total;
+ fifo_read(&t->input_fifo, skip, NULL);
+ }
+}
+
+static float * tempo_input(tempo_t * t, float const * samples, size_t n)
+{
+ t->samples_in += n;
+ return fifo_write(&t->input_fifo, n, samples);
+}
+
+static float const * tempo_output(tempo_t * t, float * samples, size_t * n)
+{
+ t->samples_out += *n = min(*n, fifo_occupancy(&t->output_fifo));
+ return fifo_read(&t->output_fifo, *n, samples);
+}
+
+/* Flush samples remaining in overlap_buf & input_fifo to the output. */
+static void tempo_flush(tempo_t * t)
+{
+ uint64_t samples_out = t->samples_in / t->factor + .5;
+ size_t remaining = samples_out > t->samples_out ?
+ (size_t)(samples_out - t->samples_out) : 0;
+ float * buff = lsx_calloc(128 * t->channels, sizeof(*buff));
+
+ if (remaining > 0) {
+ while (fifo_occupancy(&t->output_fifo) < remaining) {
+ tempo_input(t, buff, (size_t) 128);
+ tempo_process(t);
+ }
+ fifo_trim_to(&t->output_fifo, remaining);
+ t->samples_in = 0;
+ }
+ free(buff);
+}
+
+static void tempo_setup(tempo_t * t,
+ double sample_rate, sox_bool quick_search, double factor,
+ double segment_ms, double search_ms, double overlap_ms)
+{
+ size_t max_skip;
+ t->quick_search = quick_search;
+ t->factor = factor;
+ t->segment = sample_rate * segment_ms / 1000 + .5;
+ t->search = sample_rate * search_ms / 1000 + .5;
+ t->overlap = max(sample_rate * overlap_ms / 1000 + 4.5, 16);
+ t->overlap &= ~7; /* Make divisible by 8 for loop optimisation */
+ if (t->overlap * 2 > t->segment)
+ t->overlap -= 8;
+ t->overlap_buf = lsx_malloc(t->overlap * t->channels * sizeof(*t->overlap_buf));
+ max_skip = ceil(factor * (t->segment - t->overlap));
+ t->process_size = max(max_skip + t->overlap, t->segment) + t->search;
+ memset(fifo_reserve(&t->input_fifo, t->search / 2), 0, (t->search / 2) * t->channels * sizeof(float));
+}
+
+static void tempo_delete(tempo_t * t)
+{
+ free(t->overlap_buf);
+ fifo_delete(&t->output_fifo);
+ fifo_delete(&t->input_fifo);
+ free(t);
+}
+
+static tempo_t * tempo_create(size_t channels)
+{
+ tempo_t * t = lsx_calloc(1, sizeof(*t));
+ t->channels = channels;
+ fifo_create(&t->input_fifo, t->channels * sizeof(float));
+ fifo_create(&t->output_fifo, t->channels * sizeof(float));
+ return t;
+}
+
+/*------------------------------- SoX Wrapper --------------------------------*/
+
+typedef struct {
+ tempo_t * tempo;
+ sox_bool quick_search;
+ double factor, segment_ms, search_ms, overlap_ms;
+} priv_t;
+
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ enum {Default, Music, Speech, Linear} profile = Default;
+ static const double segments_ms [] = { 82,82, 35 , 20};
+ static const double segments_pow[] = { 0, 1, .33 , 1};
+ static const double overlaps_div[] = {6.833, 7, 2.5 , 2};
+ static const double searches_div[] = {5.587, 6, 2.14, 2};
+ int c;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, "+qmls", NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ p->segment_ms = p->search_ms = p->overlap_ms = HUGE_VAL;
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ case 'q': p->quick_search = sox_true; break;
+ case 'm': profile = Music; break;
+ case 's': profile = Speech; break;
+ case 'l': profile = Linear; p->search_ms = 0; break;
+ default: lsx_fail("unknown option `-%c'", optstate.opt); return lsx_usage(effp);
+ }
+ argc -= optstate.ind, argv += optstate.ind;
+ do { /* break-able block */
+ NUMERIC_PARAMETER(factor ,0.1 , 100 )
+ NUMERIC_PARAMETER(segment_ms , 10 , 120)
+ NUMERIC_PARAMETER(search_ms , 0 , 30 )
+ NUMERIC_PARAMETER(overlap_ms , 0 , 30 )
+ } while (0);
+
+ if (p->segment_ms == HUGE_VAL)
+ p->segment_ms = max(10, segments_ms[profile] / max(pow(p->factor, segments_pow[profile]), 1));
+ if (p->overlap_ms == HUGE_VAL)
+ p->overlap_ms = p->segment_ms / overlaps_div[profile];
+ if (p->search_ms == HUGE_VAL)
+ p->search_ms = p->segment_ms / searches_div[profile];
+
+ p->overlap_ms = min(p->overlap_ms, p->segment_ms / 2);
+ lsx_report("quick_search=%u factor=%g segment=%g search=%g overlap=%g",
+ p->quick_search, p->factor, p->segment_ms, p->search_ms, p->overlap_ms);
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+
+ if (p->factor == 1)
+ return SOX_EFF_NULL;
+
+ p->tempo = tempo_create((size_t)effp->in_signal.channels);
+ tempo_setup(p->tempo, effp->in_signal.rate, p->quick_search, p->factor,
+ p->segment_ms, p->search_ms, p->overlap_ms);
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN;
+ if (effp->in_signal.length != SOX_UNKNOWN_LEN) {
+ uint64_t in_length = effp->in_signal.length / effp->in_signal.channels;
+ uint64_t out_length = in_length / p->factor + .5;
+ effp->out_signal.length = out_length * effp->in_signal.channels;
+ }
+
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t i, odone = *osamp /= effp->in_signal.channels;
+ float const * s = tempo_output(p->tempo, NULL, &odone);
+ SOX_SAMPLE_LOCALS;
+
+ for (i = 0; i < odone * effp->in_signal.channels; ++i)
+ *obuf++ = SOX_FLOAT_32BIT_TO_SAMPLE(*s++, effp->clips);
+
+ if (*isamp && odone < *osamp) {
+ float * t = tempo_input(p->tempo, NULL, *isamp / effp->in_signal.channels);
+ for (i = *isamp; i; --i)
+ *t++ = SOX_SAMPLE_TO_FLOAT_32BIT(*ibuf++, effp->clips);
+ tempo_process(p->tempo);
+ }
+ else *isamp = 0;
+
+ *osamp = odone * effp->in_signal.channels;
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ static size_t isamp = 0;
+ tempo_flush(p->tempo);
+ return flow(effp, 0, obuf, &isamp, osamp);
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ tempo_delete(p->tempo);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_tempo_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "tempo", "[-q] [-m | -s | -l] factor [segment-ms [search-ms [overlap-ms]]]",
+ SOX_EFF_MCHAN | SOX_EFF_LENGTH,
+ getopts, start, flow, drain, stop, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
+
+/*---------------------------------- pitch -----------------------------------*/
+
+static int pitch_getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ double d;
+ char dummy, arg[100], **argv2 = lsx_malloc(argc * sizeof(*argv2));
+ int result, pos = (argc > 1 && !strcmp(argv[1], "-q"))? 2 : 1;
+
+ if (argc <= pos || sscanf(argv[pos], "%lf %c", &d, &dummy) != 1)
+ return lsx_usage(effp);
+
+ d = pow(2., d / 1200); /* cents --> factor */
+ sprintf(arg, "%g", 1 / d);
+ memcpy(argv2, argv, argc * sizeof(*argv2));
+ argv2[pos] = arg;
+ result = getopts(effp, argc, argv2);
+ free(argv2);
+ return result;
+}
+
+static int pitch_start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ int result = start(effp);
+
+ effp->out_signal.rate = effp->in_signal.rate / p->factor;
+ return result;
+}
+
+sox_effect_handler_t const * lsx_pitch_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_tempo_effect_fn();
+ handler.name = "pitch";
+ handler.usage = "[-q] shift-in-cents [segment-ms [search-ms [overlap-ms]]]",
+ handler.getopts = pitch_getopts;
+ handler.start = pitch_start;
+ handler.flags &= ~SOX_EFF_LENGTH;
+ handler.flags |= SOX_EFF_RATE;
+ return &handler;
+}
diff --git a/src/src/test-comments b/src/src/test-comments
new file mode 100755
index 0000000..291ffa1
--- /dev/null
+++ b/src/src/test-comments
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+tmp=/tmp/`basename $0`-$$
+input=$tmp.wav # no comment support
+
+check_file () {
+ ./sox --i -a $1 > $tmp.comments
+ cmp $tmp.comments $2 || exit 1
+}
+
+check () {
+ f=$1; shift
+ : > $tmp.expected
+ while [ $# != 0 ]; do
+ echo "$1" >> $tmp.expected
+ shift
+ done
+ check_file $f $tmp.expected
+}
+
+com0="Processed by SoX"
+com1="foo bar"
+com2="bar foo"
+
+./sox -n $input trim 0 .1
+
+./sox $input $tmp.au # Apply default comment
+check $tmp.au "$com0"
+
+cp $tmp.au $tmp.comment.au
+
+cat > $tmp.i << .
+TITLE=First Track
+ARTIST=A Band
+ALBUM=A Collection Of Songs
+TRACKNUMBER=01
+.
+
+./sox $input --comment-file $tmp.i $tmp.comments.au
+check_file $tmp.comments.au $tmp.i
+
+./sox $input --comment= $tmp.au # Don't apply default comment
+check $tmp.au
+
+./sox $input --add-comment "$com1" $tmp.au
+check $tmp.au "$com1"
+
+./sox $tmp.comment.au --add-comment "$com1" $tmp.au
+check $tmp.au "$com0" "$com1"
+
+./sox $input --add-comment "$com1" --add-comment "$com2" $tmp.au
+check $tmp.au "$com1" "$com2"
+
+./sox $tmp.comment.au --add-comment "$com1" --add-comment "$com2" $tmp.au
+check $tmp.au "$com0" "$com1" "$com2"
+
+./sox $tmp.comments.au --comment= $tmp.au
+check $tmp.au
+
+./sox $tmp.comments.au --comment "$com1" $tmp.au
+check $tmp.au "$com1"
+
+./sox $tmp.comments.au --add-comment "$com1" $tmp.au
+cp $tmp.i $tmp.j
+echo "$com1" >> $tmp.j
+check_file $tmp.au $tmp.j
+
+./sox $tmp.comments.au --add-comment "$com1" --add-comment "$com2" $tmp.au
+echo "$com2" >> $tmp.j
+check_file $tmp.au $tmp.j
+
+# FIXME: smp mp3
+./sox $tmp.comments.au $tmp.aiff
+./sox $tmp.aiff $tmp.flac
+./sox $tmp.flac $tmp.sf
+./sox $tmp.sf $tmp.ogg
+./sox $tmp.ogg $tmp.sndt
+./sox $tmp.sndt $tmp.sox
+./sox $tmp.sox $tmp.au
+check_file $tmp.au $tmp.i
+
+rm -f $tmp.*
+exit 0
diff --git a/src/src/testall.bat b/src/src/testall.bat
new file mode 100644
index 0000000..84a8a69
--- /dev/null
+++ b/src/src/testall.bat
@@ -0,0 +1,48 @@
+@echo off
+
+rem First create a working copy of t.bat. Note optional cls and pause.
+
+echo @echo off >t.bat
+echo set format=%%1 >>t.bat
+echo shift >>t.bat
+echo set opts=%%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >>t.bat
+echo. >>t.bat
+echo cls >>t.bat
+echo echo Format: %%format%% Options: %%opts%% >>t.bat
+echo echo on >>t.bat
+echo .\sox monkey.wav %%opts%% %%tmp%%\monkey.%%format%% %%effect%% >>t.bat
+echo .\sox %%opts%% %%tmp%%\monkey.%%format%% %%tmp%%\monkey1.wav %%effect%% >>t.bat
+echo @echo off >>t.bat
+echo echo. >>t.bat
+echo set format=>>t.bat
+echo set opts=>>t.bat
+echo pause >>t.bat
+
+rem Now set up any global effects and call the batch file. Note that
+rem this needs extra work to cope with DOS's limitation of 3-character
+rem extensions on the filename.
+
+set effect=%1 %2 %3 %4 %5 %6 %7 %8 %9
+
+call t.bat 8svx
+call t.bat aiff
+call t.bat aifc
+call t.bat au
+call t.bat avr -e unsigned-integer
+call t.bat cdr
+call t.bat cvs
+call t.bat dat
+call t.bat vms
+call t.bat hcom -r 22050
+call t.bat maud
+call t.bat raw -r 8130 -t ub
+call t.bat sf
+call t.bat smp
+call t.bat sndt
+call t.bat txw
+call t.bat voc
+call t.bat vox -r 8130
+call t.bat wav
+call t.bat wve
+
+del t.bat
diff --git a/src/src/testall.sh b/src/src/testall.sh
new file mode 100755
index 0000000..e739837
--- /dev/null
+++ b/src/src/testall.sh
@@ -0,0 +1,69 @@
+bindir="."
+srcdir="."
+effect=""
+
+if [ -f ./sox.exe ] ; then
+ EXEEXT=".exe"
+else
+ EXEEXXT=""
+fi
+
+# Allow user to override paths. Useful for testing an installed
+# sox.
+while [ $# -ne 0 ]; do
+ case "$1" in
+ --bindir=*)
+ bindir=`echo $1 | sed 's/.*=//'`
+ ;;
+
+ -i)
+ shift
+ bindir=$1
+ ;;
+
+ --srcdir=*)
+ srcdir=`echo $1 | sed 's/.*=//'`
+ ;;
+
+ -c)
+ shift
+ srcdir=$1
+ ;;
+
+ *)
+ effect="$effect $1"
+ esac
+ shift
+done
+
+t() {
+ format=$1
+ shift
+ opts="$*"
+
+ echo "Format: $format Options: $opts"
+ ${bindir}/sox${EXEEXT} ${srcdir}/monkey.wav $opts /tmp/monkey.$format $effect
+ ${bindir}/sox${EXEEXT} $opts /tmp/monkey.$format /tmp/monkey1.wav $effect
+}
+t 8svx
+t aiff
+t aifc
+t au
+t avr -e unsigned-integer
+t cdr
+t cvs
+t dat
+t hcom -r 22050
+t maud
+t prc
+t prc -e signed-integer
+t sf
+t smp
+t sndt
+t txw
+t ub -r 8130
+t vms
+t voc
+t vox -r 8130
+t wav
+t wve
diff --git a/src/src/tests.bat b/src/src/tests.bat
new file mode 100644
index 0000000..e4fb318
--- /dev/null
+++ b/src/src/tests.bat
@@ -0,0 +1,81 @@
+@echo off
+
+rem Test script for sox under DOS derived from tests.sh. This should
+rem run without core-dumping or printing any error messages.
+
+set file=monkey
+
+rem verbose options
+
+rem set noise=-V
+
+del out.raw
+del out2.raw
+del in.raw
+cls
+
+echo on
+.\sox %noise% %file%.wav ub.raw
+.\sox %noise% -t raw -r 8196 -u -1 -c 1 ub.raw -r 8196 -s -1 sb.raw
+.\sox %noise% -t raw -r 8196 -s -1 -c 1 sb.raw -r 8196 -u -1 ub2.raw
+.\sox %noise% -r 8196 -u -1 -c 1 ub2.raw -r 8196 ub2.wav
+@echo off
+
+echo.
+dir ub.raw
+dir ub2.raw
+echo.
+echo The two filesizes above should be the same.
+pause
+echo.
+echo.
+
+echo Skip checksum and rate byte. DOS isn't good at this, so just use a
+echo rough test.
+
+echo.
+dir %file%.wav
+dir ub2.wav
+echo.
+echo The two filesizes above should be the same.
+pause
+cls
+
+del ub.raw
+del sb.raw
+del ub2.raw
+del ub2.wav
+
+echo on
+.\sox %noise% %file%.au -u -r 8192 -u -1 ub.raw
+.\sox %noise% -r 8192 -u -1 ub.raw -U -1 ub.au
+.\sox %noise% ub.au -u ub2.raw
+.\sox %noise% ub.au -2 ub2.sf
+@echo off
+
+del ub.raw
+del ub.au
+del ub2.raw
+rem del ub.sf
+
+echo on
+.\sox %noise% ub2.sf ub2.aif
+.\sox %noise% ub2.aif ub3.sf
+@echo off
+
+echo Skip comment field containing different filenames. Again, DOS sucks.
+
+echo.
+dir ub2.sf
+dir ub3.sf
+echo.
+echo The two filesizes above should be the same.
+pause
+cls
+
+del ub2.sf
+del ub2.aif
+del ub3.sf
+
+set file=
+set noise=
diff --git a/src/src/tests.sh b/src/src/tests.sh
new file mode 100755
index 0000000..51a6ede
--- /dev/null
+++ b/src/src/tests.sh
@@ -0,0 +1,272 @@
+#!/bin/sh
+#
+# SoX Regression Test script: Lossless file conversion
+
+bindir="."
+builddir="."
+srcdir="."
+
+if [ -f ./sox.exe ] ; then
+ EXEEXT=".exe"
+else
+ EXEEXT=""
+fi
+
+# Set options & allow user to override paths. Useful for testing an
+# installed sox.
+while [ $# -ne 0 ]; do
+ case "$1" in
+ -e)
+ echo=$1
+ ;;
+
+ -V)
+ verbose=$1
+ echo=$1
+ ;;
+
+ -a) # Perform each test up to 3 times with different #s of
+ all=all # channels; probably enough coverage without this though.
+ ;;
+
+ --bindir=*)
+ bindir=`echo $1 | sed 's/.*=//'`
+ ;;
+
+ -i)
+ shift
+ bindir=$1
+ ;;
+
+ --builddir=*)
+ builddir=`echo $1 | sed 's/.*=//'`
+ ;;
+
+ -b)
+ shift
+ builddir=$1
+ ;;
+
+ --srcdir=*)
+ srcdir=`echo $1 | sed 's/.*=//'`
+ ;;
+
+ -c)
+ shift
+ srcdir=$1
+ ;;
+
+ *)
+ echo "Unknown option"
+ exit 1
+ esac
+ shift
+done
+
+getFormat () {
+ formatExt=$1; formatText=$1; formatFlags=""
+ case $1 in
+ al ) formatText="alaw" ;;
+ ul ) formatText="ulaw" ;;
+ wavu8)formatText="u8 in wav"; formatFlags="-e unsigned -b 8"; formatExt="wav" ;;
+ s1X ) formatText="s8 (swap bits)"; formatExt="s8"; formatFlags="-X" ;;
+ s1N ) formatText="s8 (swap nibbles)"; formatExt="s8"; formatFlags="-N" ;;
+ s1XN) formatText="s8 (swap nibbles & bits)"; formatExt="s8"; formatFlags="-X -N" ;;
+ esac
+}
+
+execute() {
+ if [ "${echo}x" != "x" ] ; then
+ echo $*
+ fi
+ cmd=$1
+ shift
+ echo $* | xargs $cmd
+}
+
+convertToAndFrom () {
+ while [ $# != 0 ]; do
+ if [ "${skip}x" != "x" ] ; then
+ format1_skip=`echo ${skip} | grep ${format1}`
+ from_skip=`echo ${skip} | grep ${1}`
+ fi
+ if [ "${format1_skip}x" = "x" -a "${from_skip}x" = "x" ] ; then
+ getFormat ${format1}; format1Ext=$formatExt; format1Text=$formatText; format1Flags=$formatFlags
+ getFormat $1; format2Ext=$formatExt; format2Text=$formatText; format2Flags=$formatFlags
+ execute ${bindir}/sox${EXEEXT} $verbose -RD -r $rate -c $channels -n $format1Flags input.$format1Ext synth $samples's' sin 300-3300 noise trapezium
+ execute ${bindir}/sox${EXEEXT} $verbose -RD -r $rate -c $channels $format1Flags input.$format1Ext $format2Flags intermediate.$format2Ext
+ execute ${bindir}/sox${EXEEXT} $verbose -RD -r $rate -c $channels $format2Flags intermediate.$format2Ext $format1Flags output.$format1Ext
+ intermediateReference=vectors/intermediate`echo "$channels $rate $format1Flags $format1Ext $format2Flags"|tr " " "_"`.$format2Ext
+
+ # Uncomment to generate new reference files
+ # N.B. new reference files must be manually checked for correctness
+ #cp -i intermediate.$format2Ext $intermediateReference
+
+ if test -f $intermediateReference
+ then
+ cmp -s $intermediateReference intermediate.$format2Ext
+ if [ "$?" != "0" ]
+ then
+ echo "*FAIL vector* channels=$channels \"$format1Text\" ---> \"$format2Text\"."
+ exit 1 # This allows failure inspection.
+ fi
+ vectors=`expr $vectors + 1`
+ fi
+
+ if cmp -s input.$format1Ext output.$format1Ext
+ then
+ echo "ok channels=$channels \"$format1Text\" <--> \"$format2Text\"."
+ else
+ echo "*FAIL* channels=$channels \"$format1Text\" <--> \"$format2Text\"."
+ exit 1 # This allows failure inspection.
+ fi
+ rm -f input.$format1Ext intermediate.$format2Ext output.$format1Ext
+ fi
+ shift
+ done
+}
+
+do_multichannel_formats () {
+ format1=u8
+ convertToAndFrom s8 u8 s16 u16 s24 u24 s32 u32 f32 f64 dat au wav aiff aifc flac caf sph wv sox
+
+ format1=s16
+ convertToAndFrom s16 u16 s24 u24 s32 u32 f32 f64 dat au wav aiff aifc flac caf sph wv sox
+
+ format1=u24
+ convertToAndFrom s24 u24 s32 u32 f32 f64 wav aiff aifc flac sph wv sox
+ (samples=23500; convertToAndFrom paf) || exit 1
+
+ format1=s32
+ convertToAndFrom s32 u32 f64 wav aiff aifc caf sph wv mat4 mat5 sox
+
+ format1=al
+ convertToAndFrom al s16 u16 s32 f32 f64 dat aiff aifc flac caf w64
+
+ format1=ul
+ convertToAndFrom ul s16 u16 s32 f32 f64 dat aiff aifc flac caf sph
+
+ format1=wavu8
+ convertToAndFrom wavu8 aiff aifc au dat sf flac caf sph
+}
+
+do_twochannel_formats () {
+ format1=wavu8
+ convertToAndFrom avr maud
+ (rate=8000; convertToAndFrom voc) || exit 1 # Fixed rate
+ (samples=23492; convertToAndFrom 8svx) || exit 1 # Even number of samples only
+}
+
+do_singlechannel_formats () {
+ format1=vox
+ convertToAndFrom vox s16 u16 s24 u24 s32 u32 f32 f64 dat au wav aiff aifc flac caf sox
+
+ format1=ima
+ convertToAndFrom ima s16 u16 s24 u24 s32 u32 f32 f64 dat au aiff aifc flac caf # FIXME: wav
+
+ format1=wavu8
+ convertToAndFrom smp s8 s1X s1N s1XN sndt sndr
+ #(rate=50000; convertToAndFrom txw) || exit 1 # FIXME
+ (rate=11025; convertToAndFrom hcom) || exit 1 # Fixed rates
+
+ format1=wve
+ (rate=8000; convertToAndFrom al s16 u16 s32 f32 f64 dat) || exit 1 # Fixed rate
+
+ format1=prc
+ (rate=8000; convertToAndFrom al s16 u16 s32 f32 f64 dat) || exit 1 # Fixed rate
+}
+
+stderr_time () {
+ egrep -v "^real |^user |^sys " $1 1>&2
+ grep "^user " $1 | sed "s/^user //"
+}
+
+# Reading and writing performance test
+time="/usr/bin/time -p"
+timeIO () {
+ $time ${bindir}/sox${EXEEXT} -c $channels -r $rate -n tmp.sox synth $samples's' saw 0:`expr $rate / 2` noise brown vol .9 2> tmp.write
+ echo TIME synth channels=$channels samples=$samples `stderr_time tmp.write`s
+ if [ `uname` != SunOS ]; then
+ while [ $# != 0 ]; do
+ if [ "${skip}x" != "x" ] ; then
+ from_skip=`echo ${skip} | grep ${1}`
+ fi
+ if [ "${from_skip}x" = "x" ] ; then
+ getFormat $1;
+ ($time ${bindir}/sox${EXEEXT} $verbose -D tmp.sox $formatFlags -t $1 - 2> tmp.read) | \
+ ($time ${bindir}/sox${EXEEXT} $verbose -t $1 -c $channels -r $rate - -t sox /dev/null 2> tmp.write)
+ echo "TIME `printf %4s $formatText` write=`stderr_time tmp.write`s read=`stderr_time tmp.read`s"
+ fi
+ shift
+ done
+ fi
+ rm -f tmp.sox tmp.write tmp.read
+}
+
+# Don't try to test un-built formats
+skip_check () {
+ while [ $# -ne 0 ]; do
+ ${bindir}/sox${EXEEXT} --help|grep "^AUDIO FILE.*\<$1\>">/dev/null || skip="$1 $skip"
+ shift
+ done
+}
+
+
+# Run tests
+
+${builddir}/sox_sample_test${EXEEXT} || exit 1
+
+skip_check caf flac mat4 mat5 paf w64 wv
+
+vectors=0
+
+rate=44100
+samples=23493
+
+channels=3
+do_multichannel_formats
+
+channels=2
+if [ "$all" = "all" ]; then
+ do_multichannel_formats
+fi
+do_twochannel_formats
+format1=cdda # 2-channel only
+convertToAndFrom s16 u24 aiff
+
+channels=1
+if [ "$all" = "all" ]; then
+ do_multichannel_formats
+ do_twochannel_formats
+fi
+do_singlechannel_formats
+
+if false; then # needs skip & dir work for general use
+${srcdir}/test-comments
+if [ $? -eq 0 ]; then
+ echo "ok comments"
+else
+ echo "*FAIL* comments"
+ exit 1
+fi
+fi
+
+${bindir}/sox${EXEEXT} -c 1 -r 44100 -n output.u8 synth .01 vol .5
+if [ `wc -c <output.u8` = 441 ]; then
+ echo "ok synth size"
+else
+ echo "*FAIL* synth size"
+fi
+rm output.u8
+
+echo "Checked $vectors vectors"
+
+channels=2
+samples=1e7
+timeIO s8 u8 s16 u16 s24 u24 s32 u32 f32 f64 au wav aiff aifc sph # FIXME?: caf flac dat
+
+test -n "$skip" && echo "Skipped: $skip"
+
+# Run one last command so return code is not error
+# when $skip is empty.
+echo "done."
diff --git a/src/src/tremolo.c b/src/src/tremolo.c
new file mode 100644
index 0000000..6c13f3b
--- /dev/null
+++ b/src/src/tremolo.c
@@ -0,0 +1,47 @@
+/* libSoX effect: tremolo (c) 2007 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+static int getopts(sox_effect_t * effp, int argc, char * * argv)
+{
+ double speed, depth = 40;
+ char dummy; /* To check for extraneous chars. */
+ char offset[100];
+ char * args[] = {0, "sine", "fmod", 0, 0, "25"};
+
+ if (argc < 2 || argc > 3 ||
+ sscanf(argv[1], "%lf %c", &speed, &dummy) != 1 || speed < 0 ||
+ (argc > 2 && sscanf(argv[2], "%lf %c", &depth, &dummy) != 1) ||
+ depth <= 0 || depth > 100)
+ return lsx_usage(effp);
+ args[0] = argv[0];
+ args[3] = argv[1];
+ sprintf(offset, "%g", 100 - depth / 2);
+ args[4] = offset;
+ return lsx_synth_effect_fn()->getopts(effp, (int)array_length(args), args);
+}
+
+sox_effect_handler_t const * lsx_tremolo_effect_fn(void)
+{
+ static sox_effect_handler_t handler;
+ handler = *lsx_synth_effect_fn();
+ handler.name = "tremolo";
+ handler.usage = "speed_Hz [depth_percent]";
+ handler.getopts = getopts;
+ return &handler;
+}
diff --git a/src/src/trim.c b/src/src/trim.c
new file mode 100644
index 0000000..85b4128
--- /dev/null
+++ b/src/src/trim.c
@@ -0,0 +1,216 @@
+/* libSoX effect: trim - cut portions out of the audio
+ *
+ * First version written 01/2012 by Ulrich Klauer.
+ * Replaces an older trim effect originally written by Curt Zirzow in 2000.
+ *
+ * Copyright 2012 Chris Bagwell and SoX Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {
+ /* parameters */
+ unsigned int num_pos;
+ struct {
+ uint64_t sample; /* NB: wide samples */
+ char *argstr;
+ } *pos;
+ /* state */
+ unsigned int current_pos;
+ uint64_t samples_read; /* NB: wide samples */
+ sox_bool copying;
+} priv_t;
+
+static int parse(sox_effect_t *effp, int argc, char **argv)
+{
+ priv_t *p = (priv_t*) effp->priv;
+ unsigned int i;
+ --argc, ++argv;
+ p->num_pos = argc;
+ lsx_Calloc(p->pos, p->num_pos);
+ for (i = 0; i < p->num_pos; i++) {
+ const char *arg = argv[i];
+ p->pos[i].argstr = lsx_strdup(arg);
+ /* dummy parse to check for syntax errors */
+ arg = lsx_parseposition(0., arg, NULL, (uint64_t)0, (uint64_t)0, '+');
+ if (!arg || *arg) {
+ lsx_fail("Error parsing position %u", i+1);
+ return lsx_usage(effp);
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+static int start(sox_effect_t *effp)
+{
+ priv_t *p = (priv_t*) effp->priv;
+ uint64_t in_length = effp->in_signal.length != SOX_UNKNOWN_LEN ?
+ effp->in_signal.length / effp->in_signal.channels : SOX_UNKNOWN_LEN;
+ uint64_t last_seen = 0;
+ sox_bool open_end;
+ unsigned int i;
+
+ p->copying = sox_false;
+
+ /* calculate absolute positions */
+ for (i = 0; i < p->num_pos; i++) {
+ if (!lsx_parseposition(effp->in_signal.rate, p->pos[i].argstr, &p->pos[i].sample, last_seen, in_length, '+')) {
+ lsx_fail("Position %u is relative to end of audio, but audio length is unknown", i+1);
+ return SOX_EOF;
+ }
+ last_seen = p->pos[i].sample;
+ lsx_debug_more("position %u at %" PRIu64, i+1, last_seen);
+ }
+
+ /* sanity checks */
+ last_seen = 0;
+ for (i = 0; i < p->num_pos; i++) {
+ if (p->pos[i].sample < last_seen) {
+ lsx_fail("Position %u is behind the following position.", i);
+ return SOX_EOF;
+ }
+ last_seen = p->pos[i].sample;
+ }
+ if (p->num_pos && in_length != SOX_UNKNOWN_LEN)
+ if (p->pos[0].sample > in_length ||
+ p->pos[p->num_pos-1].sample > in_length)
+ lsx_warn("%s position is after expected end of audio.",
+ p->pos[0].sample > in_length ? "Start" : "End");
+
+ /* avoid unnecessary work */
+ if (in_length == SOX_UNKNOWN_LEN)
+ while (p->num_pos && p->pos[p->num_pos-1].sample == SOX_UNKNOWN_LEN) {
+ lsx_debug_more("removing `-0' position");
+ p->num_pos--;
+ free(p->pos[p->num_pos].argstr);
+ }
+ if (p->num_pos == 1 && !p->pos[0].sample)
+ return SOX_EFF_NULL;
+
+ /* calculate output length */
+ open_end = p->num_pos % 2;
+ if (open_end && in_length == SOX_UNKNOWN_LEN)
+ effp->out_signal.length = SOX_UNKNOWN_LEN;
+ else {
+ effp->out_signal.length = 0;
+ for (i = 0; i+1 < p->num_pos ; i += 2)
+ effp->out_signal.length +=
+ min(p->pos[i+1].sample, in_length) - min(p->pos[i].sample, in_length);
+ if (open_end)
+ effp->out_signal.length +=
+ in_length - min(p->pos[p->num_pos-1].sample, in_length);
+ effp->out_signal.length *= effp->in_signal.channels;
+ }
+
+ return SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t *effp, const sox_sample_t *ibuf,
+ sox_sample_t *obuf, size_t *isamp, size_t *osamp)
+{
+ priv_t *p = (priv_t*) effp->priv;
+ size_t len = min(*isamp, *osamp);
+ size_t channels = effp->in_signal.channels;
+ len /= channels;
+ *isamp = *osamp = 0;
+
+ while (len) {
+ size_t chunk;
+
+ if (p->current_pos < p->num_pos &&
+ p->samples_read == p->pos[p->current_pos].sample) {
+ p->copying = !p->copying;
+ p->current_pos++;
+ }
+
+ if (p->current_pos >= p->num_pos && !p->copying)
+ return SOX_EOF;
+
+ chunk = p->current_pos < p->num_pos ?
+ min(len, p->pos[p->current_pos].sample - p->samples_read) : len;
+ if (p->copying) {
+ memcpy(obuf, ibuf, chunk * channels * sizeof(*obuf));
+ obuf += chunk * channels, *osamp += chunk * channels;
+ }
+ ibuf += chunk * channels; *isamp += chunk * channels;
+ p->samples_read += chunk, len -= chunk;
+ }
+
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t *effp, sox_sample_t *obuf UNUSED, size_t *osamp)
+{
+ priv_t *p = (priv_t*) effp->priv;
+ *osamp = 0; /* only checking for errors */
+
+ if (p->current_pos + 1 == p->num_pos &&
+ p->pos[p->current_pos].sample == p->samples_read &&
+ p->copying) /* would stop here anyway */
+ p->current_pos++;
+ if (p->current_pos < p->num_pos)
+ lsx_warn("Last %u position(s) not reached%s.",
+ p->num_pos - p->current_pos,
+ (effp->in_signal.length == SOX_UNKNOWN_LEN ||
+ effp->in_signal.length/effp->in_signal.channels == p->samples_read) ?
+ "" /* unknown length, or did already warn during start() */ :
+ " (audio shorter than expected)"
+ );
+ return SOX_EOF;
+}
+
+static int lsx_kill(sox_effect_t *effp)
+{
+ unsigned int i;
+ priv_t *p = (priv_t*) effp->priv;
+ for (i = 0; i < p->num_pos; i++)
+ free(p->pos[i].argstr);
+ free(p->pos);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const *lsx_trim_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "trim", "{position}",
+ SOX_EFF_MCHAN | SOX_EFF_LENGTH | SOX_EFF_MODIFY,
+ parse, start, flow, drain, NULL, lsx_kill,
+ sizeof(priv_t)
+ };
+ return &handler;
+}
+
+/* The following functions allow a libSoX client to do a speed
+ * optimization, by asking for the number of samples to be skipped
+ * at the beginning of the audio with sox_trim_get_start(), skipping
+ * that many samples in an efficient way such as seeking within the
+ * input file, then telling us it has been done by calling
+ * sox_trim_clear_start() (the name is historical).
+ * Note that sox_trim_get_start() returns the number of non-wide
+ * samples. */
+
+sox_uint64_t sox_trim_get_start(sox_effect_t *effp)
+{
+ priv_t *p = (priv_t*) effp->priv;
+ return p->num_pos ? p->pos[0].sample * effp->in_signal.channels : 0;
+}
+
+void sox_trim_clear_start(sox_effect_t *effp)
+{
+ priv_t *p = (priv_t*) effp->priv;
+ p->samples_read = p->num_pos ? p->pos[0].sample : 0;
+}
diff --git a/src/src/tx16w.c b/src/src/tx16w.c
new file mode 100644
index 0000000..f385e41
--- /dev/null
+++ b/src/src/tx16w.c
@@ -0,0 +1,382 @@
+/* libSoX Yamaha TX-16W sampler file support
+ *
+ * May 20, 1993
+ * Copyright 1993 Rob Talley (rob@aii.com)
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice and the following copyright
+ * notice must be maintained intact. No warranty whatsoever is
+ * provided. This code is furnished AS-IS as a component of the
+ * larger work Copyright 1991 Lance Norskog and Sundry Contributors.
+ * Much appreciation to ross-c for his sampConv utility for SGI/IRIX
+ * from where these methods were derived.
+ *
+ * Jan 24, 1994
+ * Pat McElhatton, HP Media Technology Lab <patmc@apollo.hp.com>
+ * Handles reading of files which do not have the sample rate field
+ * set to one of the expected by looking at some other bytes in the
+ * attack/loop length fields, and defaulting to 33kHz if the sample
+ * rate is still unknown.
+ *
+ * January 12, 1995
+ * Copyright 1995 Mark Lakata (lakata@physics.berkeley.edu)
+ * Additions to tx16w.c SOX handler. This version writes as well as
+ * reads TX16W format.
+ *
+ * July 31, 1998
+ * Cleaned up by Leigh Smith (leigh@psychokiller.dialix.oz.au)
+ * for incorporation into the main sox distribution.
+ *
+ * September 24, 1998
+ * Forced output to mono signed words to match input. It was basically
+ * doing this anyways but now the user will see a display that it's been
+ * overridden. cbagwell@sprynet.com
+ *
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <stdio.h>
+#include <string.h>
+
+#define TXMAXLEN 0x3FF80
+
+/* Private data for TX16 file */
+typedef struct {
+ size_t samples_out;
+ size_t bytes_out;
+ size_t rest; /* bytes remaining in sample file */
+ sox_sample_t odd;
+ sox_bool odd_flag;
+} priv_t;
+
+struct WaveHeader_ {
+ char filetype[6]; /* = "LM8953", */
+ unsigned char
+ nulls[10],
+ dummy_aeg[6], /* space for the AEG (never mind this) */
+ format, /* 0x49 = looped, 0xC9 = non-looped */
+ sample_rate, /* 1 = 33 kHz, 2 = 50 kHz, 3 = 16 kHz */
+ atc_length[3], /* I'll get to this... */
+ rpt_length[3],
+ unused[2]; /* set these to null, to be on the safe side */
+};
+
+static const unsigned char magic1[4] = {0, 0x06, 0x10, 0xF6};
+static const unsigned char magic2[4] = {0, 0x52, 0x00, 0x52};
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int startread(sox_format_t * ft)
+{
+ int c;
+ char filetype[7];
+ int8_t format;
+ unsigned char sample_rate;
+ size_t num_samp_bytes = 0;
+ unsigned char gunk[8];
+ int blewIt;
+ uint8_t trash;
+
+ priv_t * sk = (priv_t *) ft->priv;
+ /* If you need to seek around the input file. */
+ if (! ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"txw input file must be a file, not a pipe");
+ return(SOX_EOF);
+ }
+
+ /* This is dumb but portable, just count the bytes til EOF */
+ while (lsx_read_b_buf(ft, &trash, (size_t) 1) == 1)
+ num_samp_bytes++;
+ num_samp_bytes -= 32; /* calculate num samples by sub header size */
+ lsx_seeki(ft, (off_t)0, 0); /* rewind file */
+ sk->rest = num_samp_bytes; /* set how many sample bytes to read */
+
+ /* first 6 bytes are file type ID LM8953 */
+ lsx_readchars(ft, filetype, sizeof(filetype) - 1);
+ filetype[6] = '\0';
+ for( c = 16; c > 0 ; c-- ) /* Discard next 16 bytes */
+ lsx_readb(ft, &trash);
+ lsx_readsb(ft, &format);
+ lsx_readb(ft, &sample_rate);
+ /*
+ * save next 8 bytes - if sample rate is 0, then we need
+ * to look at gunk[2] and gunk[5] to get real rate
+ */
+ for( c = 0; c < 8; c++ )
+ lsx_readb(ft, &(gunk[c]));
+ /*
+ * We should now be pointing at start of raw sample data in file
+ */
+
+ /* Check to make sure we got a good filetype ID from file */
+ lsx_debug("Found header filetype %s",filetype);
+ if(strcmp(filetype,"LM8953"))
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"Invalid filetype ID in input file header, != LM8953");
+ return(SOX_EOF);
+ }
+ /*
+ * Set up the sample rate as indicated by the header
+ */
+
+ switch( sample_rate ) {
+ case 1:
+ ft->signal.rate = 1e5 / 3;
+ break;
+ case 2:
+ ft->signal.rate = 1e5 / 2;
+ break;
+ case 3:
+ ft->signal.rate = 1e5 / 6;
+ break;
+ default:
+ blewIt = 1;
+ switch( gunk[2] & 0xFE ) {
+ case 0x06:
+ if ( (gunk[5] & 0xFE) == 0x52 ) {
+ blewIt = 0;
+ ft->signal.rate = 1e5 / 3;
+ }
+ break;
+ case 0x10:
+ if ( (gunk[5] & 0xFE) == 0x00 ) {
+ blewIt = 0;
+ ft->signal.rate = 1e5 / 2;
+ }
+ break;
+ case 0xF6:
+ if ( (gunk[5] & 0xFE) == 0x52 ) {
+ blewIt = 0;
+ ft->signal.rate = 1e5 / 6;
+ }
+ break;
+ }
+ if ( blewIt ) {
+ lsx_debug("Invalid sample rate identifier found %d", sample_rate);
+ ft->signal.rate = 1e5 / 3;
+ }
+ }
+ lsx_debug("Sample rate = %g", ft->signal.rate);
+
+ ft->signal.channels = 1 ; /* not sure about stereo sample data yet ??? */
+ ft->encoding.bits_per_sample = 12;
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+
+ return(SOX_SUCCESS);
+}
+
+/*
+ * Read up to len samples from file.
+ * Convert to sox_sample_t.
+ * Place in buf[].
+ * Return number of samples read.
+ */
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * sk = (priv_t *) ft->priv;
+ size_t done = 0;
+ unsigned char uc1,uc2,uc3;
+ unsigned short s1,s2;
+
+ /*
+ * This gets called by the top level 'process' routine.
+ * We will essentially get called with a buffer pointer
+ * and a max length to read. Graciously, it is always
+ * an even amount so we don't have to worry about
+ * hanging onto the left over odd samples since there
+ * won't be any. Something to look out for though :-(
+ * We return the number of samples we read.
+ * We will get called over and over again until we return
+ * 0 bytes read.
+ */
+
+ /*
+ * This is ugly but it's readable!
+ * Read three bytes from stream, then decompose these into
+ * two unsigned short samples.
+ * TCC 3.0 appeared to do unwanted things, so we really specify
+ * exactly what we want to happen.
+ * Convert unsigned short to sox_sample_t then shift up the result
+ * so that the 12-bit sample lives in the most significant
+ * 12-bits of the sox_sample_t.
+ * This gets our two samples into the internal format which we
+ * deposit into the given buffer and adjust our counts respectivly.
+ */
+ for(done = 0; done < len; ) {
+ if(sk->rest < 3) break; /* Finished reading from file? */
+ lsx_readb(ft, &uc1);
+ lsx_readb(ft, &uc2);
+ lsx_readb(ft, &uc3);
+ sk->rest -= 3; /* adjust remaining for bytes we just read */
+ s1 = (unsigned short) (uc1 << 4) | (((uc2 >> 4) & 017));
+ s2 = (unsigned short) (uc3 << 4) | (( uc2 & 017 ));
+ *buf = (sox_sample_t) s1;
+ *buf = (*buf << 20);
+ buf++; /* sample one is done */
+ *buf = (sox_sample_t) s2;
+ *buf = (*buf << 20);
+ buf++; /* sample two is done */
+ done += 2; /* adjust converted & stored sample count */
+ }
+ return done;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * sk = (priv_t *) ft->priv;
+ struct WaveHeader_ WH;
+
+ lsx_debug("tx16w selected output");
+
+ memset(&WH, 0, sizeof(struct WaveHeader_));
+
+ /* If you have to seek around the output file */
+ if (! ft->seekable)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Output .txw file must be a file, not a pipe");
+ return(SOX_EOF);
+ }
+
+ /* dummy numbers, just for place holder, real header is written
+ at end of processing, since byte count is needed */
+
+ lsx_writebuf(ft, &WH, (size_t) 32);
+ sk->bytes_out = 32;
+ return(SOX_SUCCESS);
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len0)
+{
+ priv_t * sk = (priv_t *) ft->priv;
+ size_t last_i, i = 0, len = min(len0, TXMAXLEN - sk->samples_out);
+ sox_sample_t w1, w2;
+
+ while (i < len) {
+ last_i = i;
+ if (sk->odd_flag) {
+ w1 = sk->odd;
+ sk->odd_flag = sox_false;
+ }
+ else w1 = *buf++ >> 20, ++i;
+
+ if (i < len) {
+ w2 = *buf++ >> 20, ++i;
+ if (lsx_writesb(ft, (w1 >> 4) & 0xFF) ||
+ lsx_writesb(ft, (((w1 & 0x0F) << 4) | (w2 & 0x0F)) & 0xFF) ||
+ lsx_writesb(ft, (w2 >> 4) & 0xFF)) {
+ i = last_i;
+ break;
+ }
+ sk->samples_out += 2;
+ sk->bytes_out += 3;
+ }
+ else {
+ sk->odd = w1;
+ sk->odd_flag = sox_true;
+ }
+ }
+ return i;
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * sk = (priv_t *) ft->priv;
+ struct WaveHeader_ WH;
+ int AttackLength, LoopLength, i;
+
+ if (sk->odd_flag) {
+ sox_sample_t pad = 0;
+ write_samples(ft, &pad, (size_t) 1);
+ }
+
+ /* All samples are already written out. */
+ /* If file header needs fixing up, for example it needs the */
+ /* the number of samples in a field, seek back and write them here. */
+
+ lsx_debug("tx16w:output finished");
+
+ memset(&WH, 0, sizeof(struct WaveHeader_));
+ strncpy(WH.filetype,"LM8953",(size_t)6);
+ for (i=0;i<10;i++) WH.nulls[i]=0;
+ for (i=0;i<6;i++) WH.dummy_aeg[i]=0;
+ for (i=0;i<2;i++) WH.unused[i]=0;
+ for (i=0;i<2;i++) WH.dummy_aeg[i] = 0;
+ for (i=2;i<6;i++) WH.dummy_aeg[i] = 0x7F;
+
+ WH.format = 0xC9; /* loop off */
+
+ /* the actual sample rate is not that important ! */
+ if (ft->signal.rate < 24000) WH.sample_rate = 3;
+ else if (ft->signal.rate < 41000) WH.sample_rate = 1;
+ else WH.sample_rate = 2;
+
+ if (sk->samples_out >= TXMAXLEN) {
+ lsx_warn("Sound too large for TX16W. Truncating, Loop Off");
+ AttackLength = TXMAXLEN/2;
+ LoopLength = TXMAXLEN/2;
+ }
+ else if (sk->samples_out >=TXMAXLEN/2) {
+ AttackLength = TXMAXLEN/2;
+ LoopLength = sk->samples_out - TXMAXLEN/2;
+ if (LoopLength < 0x40) {
+ LoopLength +=0x40;
+ AttackLength -= 0x40;
+ }
+ }
+ else if (sk->samples_out >= 0x80) {
+ AttackLength = sk->samples_out -0x40;
+ LoopLength = 0x40;
+ }
+ else {
+ AttackLength = 0x40;
+ LoopLength = 0x40;
+ for(i=sk->samples_out;i<0x80;i++) {
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ lsx_writeb(ft, 0);
+ sk->bytes_out += 3;
+ }
+ }
+
+ /* Fill up to 256 byte blocks; the TX16W seems to like that */
+
+ while ((sk->bytes_out % 0x100) != 0) {
+ lsx_writeb(ft, 0);
+ sk->bytes_out++;
+ }
+
+ WH.atc_length[0] = 0xFF & AttackLength;
+ WH.atc_length[1] = 0xFF & (AttackLength >> 8);
+ WH.atc_length[2] = (0x01 & (AttackLength >> 16)) +
+ magic1[WH.sample_rate];
+
+ WH.rpt_length[0] = 0xFF & LoopLength;
+ WH.rpt_length[1] = 0xFF & (LoopLength >> 8);
+ WH.rpt_length[2] = (0x01 & (LoopLength >> 16)) +
+ magic2[WH.sample_rate];
+
+ lsx_rewind(ft);
+ lsx_writebuf(ft, &WH, (size_t) 32);
+
+ return(SOX_SUCCESS);
+}
+
+LSX_FORMAT_HANDLER(txw)
+{
+ static char const * const names[] = {"txw", NULL};
+ static sox_rate_t const write_rates[] = {1e5/6, 1e5/3, 1e5/2, 0};
+ static unsigned const write_encodings[] = {SOX_ENCODING_SIGN2, 12, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Yamaha TX-16W sampler", names, SOX_FILE_MONO,
+ startread, read_samples, NULL,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, write_rates, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/u1-fmt.c b/src/src/u1-fmt.c
new file mode 100644
index 0000000..91221c0
--- /dev/null
+++ b/src/src/u1-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT4(u1, "u8", "ub", "sou", "fssd", 8, 0, UNSIGNED)
diff --git a/src/src/u2-fmt.c b/src/src/u2-fmt.c
new file mode 100644
index 0000000..b071d61
--- /dev/null
+++ b/src/src/u2-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT2(u2, "u16", "uw", 16, 0, UNSIGNED)
diff --git a/src/src/u3-fmt.c b/src/src/u3-fmt.c
new file mode 100644
index 0000000..f1f6a8a
--- /dev/null
+++ b/src/src/u3-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT1(u3, "u24", 24, 0, UNSIGNED)
diff --git a/src/src/u4-fmt.c b/src/src/u4-fmt.c
new file mode 100644
index 0000000..a128d24
--- /dev/null
+++ b/src/src/u4-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT1(u4, "u32", 32, 0, UNSIGNED)
diff --git a/src/src/ul-fmt.c b/src/src/ul-fmt.c
new file mode 100644
index 0000000..437a35a
--- /dev/null
+++ b/src/src/ul-fmt.c
@@ -0,0 +1,21 @@
+/* libSoX file formats: raw (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/raw.h"
+
+RAW_FORMAT(ul, 8, 0, ULAW)
diff --git a/src/src/upsample.c b/src/src/upsample.c
new file mode 100644
index 0000000..cc96324
--- /dev/null
+++ b/src/src/upsample.c
@@ -0,0 +1,64 @@
+/* libSoX effect: Upsample (zero stuff) (c) 2011 robs@users.sourceforge.net
+ *
+ * Sometimes filters perform better at higher sampling rates, so e.g.
+ * sox -r 48k input output upsample 4 filter rate 48k vol 4
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {unsigned factor, pos;} priv_t;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ p->factor = 2;
+ --argc, ++argv;
+ do {NUMERIC_PARAMETER(factor, 1, 256)} while (0);
+ return argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *) effp->priv;
+ effp->out_signal.rate = effp->in_signal.rate * p->factor;
+ return p->factor == 1? SOX_EFF_NULL : SOX_SUCCESS;
+}
+
+static int flow(sox_effect_t * effp, const sox_sample_t * ibuf,
+ sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t ilen = *isamp, olen = *osamp;
+ while (sox_true) {
+ for (; p->pos && olen; p->pos = (p->pos + 1) % p->factor, --olen)
+ *obuf++ = 0;
+ if (!ilen || !olen)
+ break;
+ *obuf++ = *ibuf++;
+ --olen, --ilen;
+ ++p->pos;
+ }
+ *isamp -= ilen, *osamp -= olen;
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_upsample_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"upsample", "[factor (2)]",
+ SOX_EFF_RATE | SOX_EFF_MODIFY, create, start, flow, NULL, NULL, NULL, sizeof(priv_t)};
+ return &handler;
+}
diff --git a/src/src/util.c b/src/src/util.c
new file mode 100644
index 0000000..3a769f3
--- /dev/null
+++ b/src/src/util.c
@@ -0,0 +1,304 @@
+/* General purpose, i.e. non SoX specific, utility functions.
+ * Copyright (c) 2007-8 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <ctype.h>
+#include <stdio.h>
+
+int lsx_strcasecmp(const char * s1, const char * s2)
+{
+#if defined(HAVE_STRCASECMP)
+ return strcasecmp(s1, s2);
+#elif defined(_MSC_VER)
+ return _stricmp(s1, s2);
+#else
+ while (*s1 && (toupper(*s1) == toupper(*s2)))
+ s1++, s2++;
+ return toupper(*s1) - toupper(*s2);
+#endif
+}
+
+int lsx_strncasecmp(char const * s1, char const * s2, size_t n)
+{
+#if defined(HAVE_STRCASECMP)
+ return strncasecmp(s1, s2, n);
+#elif defined(_MSC_VER)
+ return _strnicmp(s1, s2, n);
+#else
+ while (--n && *s1 && (toupper(*s1) == toupper(*s2)))
+ s1++, s2++;
+ return toupper(*s1) - toupper(*s2);
+#endif
+}
+
+sox_bool lsx_strends(char const * str, char const * end)
+{
+ size_t str_len = strlen(str), end_len = strlen(end);
+ return str_len >= end_len && !strcmp(str + str_len - end_len, end);
+}
+
+char const * lsx_find_file_extension(char const * pathname)
+{
+ /* First, chop off any path portions of filename. This
+ * prevents the next search from considering that part. */
+ char const * result = LAST_SLASH(pathname);
+ if (!result)
+ result = pathname;
+
+ /* Now look for an filename extension */
+ result = strrchr(result, '.');
+ if (result)
+ ++result;
+ return result;
+}
+
+lsx_enum_item const * lsx_find_enum_text(char const * text, lsx_enum_item const * enum_items, int flags)
+{
+ lsx_enum_item const * result = NULL; /* Assume not found */
+ sox_bool sensitive = !!(flags & lsx_find_enum_item_case_sensitive);
+
+ while (enum_items->text) {
+ if ((!sensitive && !strcasecmp(text, enum_items->text)) ||
+ ( sensitive && ! strcmp(text, enum_items->text)))
+ return enum_items; /* Found exact match */
+ if ((!sensitive && !strncasecmp(text, enum_items->text, strlen(text))) ||
+ ( sensitive && ! strncmp(text, enum_items->text, strlen(text)))) {
+ if (result != NULL && result->value != enum_items->value)
+ return NULL; /* Found ambiguity */
+ result = enum_items; /* Found sub-string match */
+ }
+ ++enum_items;
+ }
+ return result;
+}
+
+lsx_enum_item const * lsx_find_enum_value(unsigned value, lsx_enum_item const * enum_items)
+{
+ for (;enum_items->text; ++enum_items)
+ if (value == enum_items->value)
+ return enum_items;
+ return NULL;
+}
+
+int lsx_enum_option(int c, char const * arg, lsx_enum_item const * items)
+{
+ lsx_enum_item const * p = lsx_find_enum_text(arg, items, sox_false);
+ if (p == NULL) {
+ size_t len = 1;
+ char * set = lsx_malloc(len);
+ *set = 0;
+ for (p = items; p->text; ++p) {
+ set = lsx_realloc(set, len += 2 + strlen(p->text));
+ strcat(set, ", "); strcat(set, p->text);
+ }
+ lsx_fail("-%c: `%s' is not one of: %s.", c, arg, set + 2);
+ free(set);
+ return INT_MAX;
+ }
+ return p->value;
+}
+
+char const * lsx_sigfigs3(double number)
+{
+ static char const symbols[] = "\0kMGTPEZY";
+ static char string[16][10]; /* FIXME: not thread-safe */
+ static unsigned n; /* ditto */
+ unsigned a, b, c;
+ sprintf(string[n = (n+1) & 15], "%#.3g", number);
+ switch (sscanf(string[n], "%u.%ue%u", &a, &b, &c)) {
+ case 2: if (b) return string[n]; /* Can fall through */
+ case 1: c = 2; break;
+ case 3: a = 100*a + b; break;
+ }
+ if (c < array_length(symbols) * 3 - 3) switch (c%3) {
+ case 0: sprintf(string[n], "%u.%02u%c", a/100,a%100, symbols[c/3]); break;
+ case 1: sprintf(string[n], "%u.%u%c" , a/10 ,a%10 , symbols[c/3]); break;
+ case 2: sprintf(string[n], "%u%c" , a , symbols[c/3]); break;
+ }
+ return string[n];
+}
+
+char const * lsx_sigfigs3p(double percentage)
+{
+ static char string[16][10];
+ static unsigned n;
+ sprintf(string[n = (n+1) & 15], "%.1f%%", percentage);
+ if (strlen(string[n]) < 5)
+ sprintf(string[n], "%.2f%%", percentage);
+ else if (strlen(string[n]) > 5)
+ sprintf(string[n], "%.0f%%", percentage);
+ return string[n];
+}
+
+int lsx_open_dllibrary(
+ int show_error_on_failure,
+ const char* library_description,
+ const char* const library_names[] UNUSED,
+ const lsx_dlfunction_info func_infos[],
+ lsx_dlptr selected_funcs[],
+ lsx_dlhandle* pdl)
+{
+ int failed = 0;
+ lsx_dlhandle dl = NULL;
+
+ /* Track enough information to give a good error message about one failure.
+ * Let failed symbol load override failed library open, and let failed
+ * library open override missing static symbols.
+ */
+ const char* failed_libname = NULL;
+ const char* failed_funcname = NULL;
+
+#ifdef HAVE_LIBLTDL
+ if (library_names && library_names[0])
+ {
+ const char* const* libname;
+ if (lt_dlinit())
+ {
+ lsx_fail(
+ "Unable to load %s - failed to initialize ltdl.",
+ library_description);
+ return 1;
+ }
+
+ for (libname = library_names; *libname; libname++)
+ {
+ lsx_debug("Attempting to open %s (%s).", library_description, *libname);
+ dl = lt_dlopenext(*libname);
+ if (dl)
+ {
+ size_t i;
+ lsx_debug("Opened %s (%s).", library_description, *libname);
+ for (i = 0; func_infos[i].name; i++)
+ {
+ union {lsx_dlptr fn; lt_ptr ptr;} func;
+ func.ptr = lt_dlsym(dl, func_infos[i].name);
+ selected_funcs[i] = func.fn ? func.fn : func_infos[i].stub_func;
+ if (!selected_funcs[i])
+ {
+ lt_dlclose(dl);
+ dl = NULL;
+ failed_libname = *libname;
+ failed_funcname = func_infos[i].name;
+ lsx_debug("Cannot use %s (%s) - missing function \"%s\".", library_description, failed_libname, failed_funcname);
+ break;
+ }
+ }
+
+ if (dl)
+ break;
+ }
+ else if (!failed_libname)
+ {
+ failed_libname = *libname;
+ }
+ }
+
+ if (!dl)
+ lt_dlexit();
+ }
+#endif /* HAVE_LIBLTDL */
+
+ if (!dl)
+ {
+ size_t i;
+ for (i = 0; func_infos[i].name; i++)
+ {
+ selected_funcs[i] =
+ func_infos[i].static_func
+ ? func_infos[i].static_func
+ : func_infos[i].stub_func;
+ if (!selected_funcs[i])
+ {
+ if (!failed_libname)
+ {
+ failed_libname = "static";
+ failed_funcname = func_infos[i].name;
+ }
+
+ failed = 1;
+ break;
+ }
+ }
+ }
+
+ if (failed)
+ {
+ size_t i;
+ for (i = 0; func_infos[i].name; i++)
+ selected_funcs[i] = NULL;
+#ifdef HAVE_LIBLTDL
+#define LTDL_MISSING ""
+#else
+#define LTDL_MISSING " (Dynamic library support not configured.)"
+#endif /* HAVE_LIBLTDL */
+ if (failed_funcname)
+ {
+ if (show_error_on_failure)
+ lsx_fail(
+ "Unable to load %s (%s) function \"%s\"." LTDL_MISSING,
+ library_description,
+ failed_libname,
+ failed_funcname);
+ else
+ lsx_report(
+ "Unable to load %s (%s) function \"%s\"." LTDL_MISSING,
+ library_description,
+ failed_libname,
+ failed_funcname);
+ }
+ else if (failed_libname)
+ {
+ if (show_error_on_failure)
+ lsx_fail(
+ "Unable to load %s (%s)." LTDL_MISSING,
+ library_description,
+ failed_libname);
+ else
+ lsx_report(
+ "Unable to load %s (%s)." LTDL_MISSING,
+ library_description,
+ failed_libname);
+ }
+ else
+ {
+ if (show_error_on_failure)
+ lsx_fail(
+ "Unable to load %s - no dynamic library names selected." LTDL_MISSING,
+ library_description);
+ else
+ lsx_report(
+ "Unable to load %s - no dynamic library names selected." LTDL_MISSING,
+ library_description);
+ }
+ }
+
+ *pdl = dl;
+ return failed;
+}
+
+void lsx_close_dllibrary(
+ lsx_dlhandle dl UNUSED)
+{
+#ifdef HAVE_LIBLTDL
+ if (dl)
+ {
+ lt_dlclose(dl);
+ lt_dlexit();
+ }
+#endif /* HAVE_LIBLTDL */
+}
diff --git a/src/src/util.h b/src/src/util.h
new file mode 100644
index 0000000..a489eee
--- /dev/null
+++ b/src/src/util.h
@@ -0,0 +1,232 @@
+/* General purpose, i.e. non SoX specific, utility functions and macros.
+ *
+ * (c) 2006-8 Chris Bagwell and SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "third_party/sox/src/src/soxconfig.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h> /* For off_t not found in stdio.h */
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h> /* Needs to be included before we redefine off_t. */
+#endif
+
+#include "third_party/sox/src/src/xmalloc.h"
+
+/*---------------------------- Portability stuff -----------------------------*/
+
+#if defined(HAVE_INTTYPES_H)
+ #include <inttypes.h>
+#elif defined(HAVE_STDINT_H)
+ #include <stdint.h>
+#else
+ typedef sox_int8_t int8_t;
+ typedef sox_uint8_t uint8_t;
+ typedef sox_int16_t int16_t;
+ typedef sox_uint16_t uint16_t;
+ typedef sox_int32_t int32_t;
+ typedef sox_uint32_t uint32_t;
+ typedef sox_int64_t int64_t;
+ typedef sox_uint64_t uint64_t;
+ #define UINT64_MAX ((uint64_t)-1)
+#endif
+
+/* Define the format specifier to use for int64_t values.
+ * Example: printf("You may have already won $ %" PRId64 " !!!", n64); */
+#ifndef PRId64 /* Maybe <inttypes.h> already defined this. */
+#if defined(_MSC_VER) || defined(__MINGW32__) /* Older versions of msvcrt.dll don't recognize %lld. */
+#define PRId64 "I64d"
+#elif LONG_MAX==9223372036854775807
+#define PRId64 "ld"
+#else
+#define PRId64 "lld"
+#endif
+#endif /* PRId64 */
+
+/* Define the format specifier to use for uint64_t values. */
+#ifndef PRIu64 /* Maybe <inttypes.h> already defined this. */
+#if defined(_MSC_VER) || defined(__MINGW32__) /* Older versions of msvcrt.dll don't recognize %llu. */
+#define PRIu64 "I64u"
+#elif ULONG_MAX==0xffffffffffffffff
+#define PRIu64 "lu"
+#else
+#define PRIu64 "llu"
+#endif
+#endif /* PRIu64 */
+
+/* Define the format specifier to use for size_t values.
+ * Example: printf("Sizeof(x) = %" PRIuPTR " bytes", sizeof(x)); */
+#ifndef PRIuPTR /* Maybe <inttypes.h> already defined this. */
+#if defined(_MSC_VER) || defined(__MINGW32__) /* Older versions of msvcrt.dll don't recognize %zu. */
+#define PRIuPTR "Iu"
+#else
+#define PRIuPTR "zu"
+#endif
+#endif /* PRIuPTR */
+
+#ifdef __GNUC__
+#define NORET __attribute__((noreturn))
+#define UNUSED __attribute__ ((unused))
+#else
+#define NORET
+#define UNUSED
+#endif
+
+#ifdef _MSC_VER
+
+#define __STDC__ 1
+#define O_BINARY _O_BINARY
+#define O_CREAT _O_CREAT
+#define O_RDWR _O_RDWR
+#define O_TRUNC _O_TRUNC
+#define S_IFMT _S_IFMT
+#define S_IFREG _S_IFREG
+#define S_IREAD _S_IREAD
+#define S_IWRITE _S_IWRITE
+#define close _close
+#define dup _dup
+#define fdopen _fdopen
+#define fileno _fileno
+
+#ifdef _fstati64
+#define fstat _fstati64
+#else
+#define fstat _fstat
+#endif
+
+#define ftime _ftime
+#define inline __inline
+#define isatty _isatty
+#define kbhit _kbhit
+#define mktemp _mktemp
+#define off_t _off_t
+#define open _open
+#define pclose _pclose
+#define popen _popen
+#define setmode _setmode
+#define snprintf _snprintf
+
+#ifdef _stati64
+#define stat _stati64
+#else
+#define stat _stat
+#endif
+
+#define strdup _strdup
+#define timeb _timeb
+#define unlink _unlink
+
+#if defined(HAVE__FSEEKI64) && !defined(HAVE_FSEEKO)
+#undef off_t
+#define fseeko _fseeki64
+#define ftello _ftelli64
+#define off_t __int64
+#define HAVE_FSEEKO 1
+#endif
+
+#elif defined(__MINGW32__)
+
+#if !defined(HAVE_FSEEKO)
+#undef off_t
+#define fseeko fseeko64
+#define fstat _fstati64
+#define ftello ftello64
+#define off_t off64_t
+#define stat _stati64
+#define HAVE_FSEEKO 1
+#endif
+
+#endif
+
+#if defined(DOS) || defined(WIN32) || defined(__NT__) || defined(__DJGPP__) || defined(__OS2__)
+ #define LAST_SLASH(path) max(strrchr(path, '/'), strrchr(path, '\\'))
+ #define IS_ABSOLUTE(path) ((path)[0] == '/' || (path)[0] == '\\' || (path)[1] == ':')
+ #define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+ #define POPEN_MODE "rb"
+#else
+ #define LAST_SLASH(path) strrchr(path, '/')
+ #define IS_ABSOLUTE(path) ((path)[0] == '/')
+ #define SET_BINARY_MODE(file)
+#endif
+
+#ifdef WORDS_BIGENDIAN
+ #define MACHINE_IS_BIGENDIAN 1
+ #define MACHINE_IS_LITTLEENDIAN 0
+#else
+ #define MACHINE_IS_BIGENDIAN 0
+ #define MACHINE_IS_LITTLEENDIAN 1
+#endif
+
+/*--------------------------- Language extensions ----------------------------*/
+
+/* Compile-time ("static") assertion */
+/* e.g. assert_static(sizeof(int) >= 4, int_type_too_small) */
+#define assert_static(e,f) enum {assert_static__##f = 1/(e)}
+#define array_length(a) (sizeof(a)/sizeof(a[0]))
+#define field_offset(type, field) ((size_t)&(((type *)0)->field))
+#define unless(x) if (!(x))
+
+/*------------------------------- Maths stuff --------------------------------*/
+
+#include <math.h>
+
+#ifdef min
+#undef min
+#endif
+#define min(a, b) ((a) <= (b) ? (a) : (b))
+
+#ifdef max
+#undef max
+#endif
+#define max(a, b) ((a) >= (b) ? (a) : (b))
+
+#define range_limit(x, lower, upper) (min(max(x, lower), upper))
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#ifndef M_PI_2
+#define M_PI_2 1.57079632679489661923 /* pi/2 */
+#endif
+#ifndef M_LN10
+#define M_LN10 2.30258509299404568402 /* natural log of 10 */
+#endif
+#ifndef M_SQRT2
+#define M_SQRT2 sqrt(2.)
+#endif
+
+#define sqr(a) ((a) * (a))
+#define sign(x) ((x) < 0? -1 : 1)
+
+/* Numerical Recipes in C, p. 284 */
+#define ranqd1(x) ((x) = 1664525L * (x) + 1013904223L) /* int32_t x */
+#define dranqd1(x) (ranqd1(x) * (1. / (65536. * 32768.))) /* [-1,1) */
+
+#define dB_to_linear(x) exp((x) * M_LN10 * 0.05)
+#define linear_to_dB(x) (log10(x) * 20)
+
+extern int lsx_strcasecmp(const char *s1, const char *st);
+extern int lsx_strncasecmp(char const *s1, char const *s2, size_t n);
+
+#ifndef HAVE_STRCASECMP
+#define strcasecmp(s1, s2) lsx_strcasecmp((s1), (s2))
+#define strncasecmp(s1, s2, n) lsx_strncasecmp((s1), (s2), (n))
+#endif
diff --git a/src/src/vad.c b/src/src/vad.c
new file mode 100644
index 0000000..28d49ac
--- /dev/null
+++ b/src/src/vad.c
@@ -0,0 +1,329 @@
+/* libSoX effect: Voice Activity Detector (c) 2009 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+typedef struct {
+ double * dftBuf, * noiseSpectrum, * spectrum, * measures, meanMeas;
+} chan_t;
+
+typedef struct { /* Configuration parameters: */
+ double bootTime, noiseTcUp, noiseTcDown, noiseReductionAmount;
+ double measureFreq, measureDuration, measureTc, preTriggerTime;
+ double hpFilterFreq, lpFilterFreq, hpLifterFreq, lpLifterFreq;
+ double triggerTc, triggerLevel, searchTime, gapTime;
+ /* Working variables: */
+ sox_sample_t * samples;
+ unsigned dftLen_ws, samplesLen_ns, samplesIndex_ns, flushedLen_ns, gapLen;
+ unsigned measurePeriod_ns, measuresLen, measuresIndex;
+ unsigned measureTimer_ns, measureLen_ws, measureLen_ns;
+ unsigned spectrumStart, spectrumEnd, cepstrumStart, cepstrumEnd; /* bins */
+ int bootCountMax, bootCount;
+ double noiseTcUpMult, noiseTcDownMult;
+ double measureTcMult, triggerMeasTcMult;
+ double * spectrumWindow, * cepstrumWindow;
+ chan_t * channels;
+} priv_t;
+
+#define GETOPT_FREQ(optstate, c, name, min) \
+ case c: p->name = lsx_parse_frequency(optstate.arg, &parseIndex); \
+ if (p->name < min || *parseIndex) return lsx_usage(effp); \
+ break;
+
+static int create(sox_effect_t * effp, int argc, char * * argv)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ #define opt_str "+b:N:n:r:f:m:M:h:l:H:L:T:t:s:g:p:"
+ int c;
+ lsx_getopt_t optstate;
+ lsx_getopt_init(argc, argv, opt_str, NULL, lsx_getopt_flag_none, 1, &optstate);
+
+ p->bootTime = .35;
+ p->noiseTcUp = .1;
+ p->noiseTcDown = .01;
+ p->noiseReductionAmount = 1.35;
+
+ p->measureFreq = 20;
+ p->measureDuration = 2 / p->measureFreq; /* 50% overlap */
+ p->measureTc = .4;
+
+ p->hpFilterFreq = 50;
+ p->lpFilterFreq = 6000;
+ p->hpLifterFreq = 150;
+ p->lpLifterFreq = 2000;
+
+ p->triggerTc = .25;
+ p->triggerLevel = 7;
+
+ p->searchTime = 1;
+ p->gapTime = .25;
+
+ while ((c = lsx_getopt(&optstate)) != -1) switch (c) {
+ char * parseIndex;
+ GETOPT_NUMERIC(optstate, 'b', bootTime , .1 , 10)
+ GETOPT_NUMERIC(optstate, 'N', noiseTcUp , .1 , 10)
+ GETOPT_NUMERIC(optstate, 'n', noiseTcDown ,.001 , .1)
+ GETOPT_NUMERIC(optstate, 'r', noiseReductionAmount,0 , 2)
+ GETOPT_NUMERIC(optstate, 'f', measureFreq , 5 , 50)
+ GETOPT_NUMERIC(optstate, 'm', measureDuration, .01 , 1)
+ GETOPT_NUMERIC(optstate, 'M', measureTc , .1 , 1)
+ GETOPT_FREQ( optstate, 'h', hpFilterFreq , 10)
+ GETOPT_FREQ( optstate, 'l', lpFilterFreq , 1000)
+ GETOPT_FREQ( optstate, 'H', hpLifterFreq , 10)
+ GETOPT_FREQ( optstate, 'L', lpLifterFreq , 1000)
+ GETOPT_NUMERIC(optstate, 'T', triggerTc , .01 , 1)
+ GETOPT_NUMERIC(optstate, 't', triggerLevel , 0 , 20)
+ GETOPT_NUMERIC(optstate, 's', searchTime , .1 , 4)
+ GETOPT_NUMERIC(optstate, 'g', gapTime , .1 , 1)
+ GETOPT_NUMERIC(optstate, 'p', preTriggerTime, 0 , 4)
+ default: lsx_fail("invalid option `-%c'", optstate.opt); return lsx_usage(effp);
+ }
+ return optstate.ind !=argc? lsx_usage(effp) : SOX_SUCCESS;
+}
+
+static int start(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i, fixedPreTriggerLen_ns, searchPreTriggerLen_ns;
+
+ fixedPreTriggerLen_ns = p->preTriggerTime * effp->in_signal.rate + .5;
+ fixedPreTriggerLen_ns *= effp->in_signal.channels;
+
+ p->measureLen_ws = effp->in_signal.rate * p->measureDuration + .5;
+ p->measureLen_ns = p->measureLen_ws * effp->in_signal.channels;
+ for (p->dftLen_ws = 16; p->dftLen_ws < p->measureLen_ws; p->dftLen_ws <<= 1);
+ lsx_debug("dftLen_ws=%u measureLen_ws=%u", p->dftLen_ws, p->measureLen_ws);
+
+ p->measurePeriod_ns = effp->in_signal.rate / p->measureFreq + .5;
+ p->measurePeriod_ns *= effp->in_signal.channels;
+ p->measuresLen = ceil(p->searchTime * p->measureFreq);
+ searchPreTriggerLen_ns = p->measuresLen * p->measurePeriod_ns;
+ p->gapLen = p->gapTime * p->measureFreq + .5;
+
+ p->samplesLen_ns =
+ fixedPreTriggerLen_ns + searchPreTriggerLen_ns + p->measureLen_ns;
+ lsx_Calloc(p->samples, p->samplesLen_ns);
+
+ lsx_Calloc(p->channels, effp->in_signal.channels);
+ for (i = 0; i < effp->in_signal.channels; ++i) {
+ chan_t * c = &p->channels[i];
+ lsx_Calloc(c->dftBuf, p->dftLen_ws);
+ lsx_Calloc(c->spectrum, p->dftLen_ws);
+ lsx_Calloc(c->noiseSpectrum, p->dftLen_ws);
+ lsx_Calloc(c->measures, p->measuresLen);
+ }
+
+ lsx_Calloc(p->spectrumWindow, p->measureLen_ws);
+ for (i = 0; i < p->measureLen_ws; ++i)
+ p->spectrumWindow[i] = -2./ SOX_SAMPLE_MIN / sqrt((double)p->measureLen_ws);
+ lsx_apply_hann(p->spectrumWindow, (int)p->measureLen_ws);
+
+ p->spectrumStart = p->hpFilterFreq / effp->in_signal.rate * p->dftLen_ws + .5;
+ p->spectrumStart = max(p->spectrumStart, 1);
+ p->spectrumEnd = p->lpFilterFreq / effp->in_signal.rate * p->dftLen_ws + .5;
+ p->spectrumEnd = min(p->spectrumEnd, p->dftLen_ws / 2);
+
+ lsx_Calloc(p->cepstrumWindow, p->spectrumEnd - p->spectrumStart);
+ for (i = 0; i < p->spectrumEnd - p->spectrumStart; ++i)
+ p->cepstrumWindow[i] = 2 / sqrt((double)p->spectrumEnd - p->spectrumStart);
+ lsx_apply_hann(p->cepstrumWindow,(int)(p->spectrumEnd - p->spectrumStart));
+
+ p->cepstrumStart = ceil(effp->in_signal.rate * .5 / p->lpLifterFreq);
+ p->cepstrumEnd = floor(effp->in_signal.rate * .5 / p->hpLifterFreq);
+ p->cepstrumEnd = min(p->cepstrumEnd, p->dftLen_ws / 4);
+ if (p->cepstrumEnd <= p->cepstrumStart)
+ return SOX_EOF;
+
+ p->noiseTcUpMult = exp(-1 / (p->noiseTcUp * p->measureFreq));
+ p->noiseTcDownMult = exp(-1 / (p->noiseTcDown * p->measureFreq));
+ p->measureTcMult = exp(-1 / (p->measureTc * p->measureFreq));
+ p->triggerMeasTcMult = exp(-1 / (p->triggerTc * p->measureFreq));
+
+ p->bootCountMax = p->bootTime * p->measureFreq - .5;
+ p->measureTimer_ns = p->measureLen_ns;
+ p->bootCount = p->measuresIndex = p->flushedLen_ns = p->samplesIndex_ns = 0;
+
+ effp->out_signal.length = SOX_UNKNOWN_LEN; /* depends on input data */
+ return SOX_SUCCESS;
+}
+
+static int flowFlush(sox_effect_t * effp, sox_sample_t const * ibuf,
+ sox_sample_t * obuf, size_t * ilen, size_t * olen)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ size_t odone = min(p->samplesLen_ns - p->flushedLen_ns, *olen);
+ size_t odone1 = min(odone, p->samplesLen_ns - p->samplesIndex_ns);
+
+ memcpy(obuf, p->samples + p->samplesIndex_ns, odone1 * sizeof(*obuf));
+ if ((p->samplesIndex_ns += odone1) == p->samplesLen_ns) {
+ memcpy(obuf + odone1, p->samples, (odone - odone1) * sizeof(*obuf));
+ p->samplesIndex_ns = odone - odone1;
+ }
+ if ((p->flushedLen_ns += odone) == p->samplesLen_ns) {
+ size_t olen1 = *olen - odone;
+ (effp->handler.flow = lsx_flow_copy)(effp, ibuf, obuf +odone, ilen, &olen1);
+ odone += olen1;
+ }
+ else *ilen = 0;
+ *olen = odone;
+ return SOX_SUCCESS;
+}
+
+static double measure(
+ priv_t * p, chan_t * c, size_t index_ns, unsigned step_ns, int bootCount)
+{
+ double mult, result = 0;
+ size_t i;
+
+ for (i = 0; i < p->measureLen_ws; ++i, index_ns = (index_ns + step_ns) % p->samplesLen_ns)
+ c->dftBuf[i] = p->samples[index_ns] * p->spectrumWindow[i];
+ memset(c->dftBuf + i, 0, (p->dftLen_ws - i) * sizeof(*c->dftBuf));
+ lsx_safe_rdft((int)p->dftLen_ws, 1, c->dftBuf);
+
+ memset(c->dftBuf, 0, p->spectrumStart * sizeof(*c->dftBuf));
+ for (i = p->spectrumStart; i < p->spectrumEnd; ++i) {
+ double d = sqrt(sqr(c->dftBuf[2 * i]) + sqr(c->dftBuf[2 * i + 1]));
+ mult = bootCount >= 0? bootCount / (1. + bootCount) : p->measureTcMult;
+ c->spectrum[i] = c->spectrum[i] * mult + d * (1 - mult);
+ d = sqr(c->spectrum[i]);
+ mult = bootCount >= 0? 0 :
+ d > c->noiseSpectrum[i]? p->noiseTcUpMult : p->noiseTcDownMult;
+ c->noiseSpectrum[i] = c->noiseSpectrum[i] * mult + d * (1 - mult);
+ d = sqrt(max(0, d - p->noiseReductionAmount * c->noiseSpectrum[i]));
+ c->dftBuf[i] = d * p->cepstrumWindow[i - p->spectrumStart];
+ }
+ memset(c->dftBuf + i, 0, ((p->dftLen_ws >> 1) - i) * sizeof(*c->dftBuf));
+ lsx_safe_rdft((int)p->dftLen_ws >> 1, 1, c->dftBuf);
+
+ for (i = p->cepstrumStart; i < p->cepstrumEnd; ++i)
+ result += sqr(c->dftBuf[2 * i]) + sqr(c->dftBuf[2 * i + 1]);
+ result = log(result / (p->cepstrumEnd - p->cepstrumStart));
+ return max(0, 21 + result);
+}
+
+static int flowTrigger(sox_effect_t * effp, sox_sample_t const * ibuf,
+ sox_sample_t * obuf, size_t * ilen, size_t * olen)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ sox_bool hasTriggered = sox_false;
+ size_t i, idone = 0, numMeasuresToFlush = 0;
+
+ while (idone < *ilen && !hasTriggered) {
+ p->measureTimer_ns -= effp->in_signal.channels;
+ for (i = 0; i < effp->in_signal.channels; ++i, ++idone) {
+ chan_t * c = &p->channels[i];
+ p->samples[p->samplesIndex_ns++] = *ibuf++;
+ if (!p->measureTimer_ns) {
+ size_t x = (p->samplesIndex_ns + p->samplesLen_ns - p->measureLen_ns) % p->samplesLen_ns;
+ double meas = measure(p, c, x, effp->in_signal.channels, p->bootCount);
+ c->measures[p->measuresIndex] = meas;
+ c->meanMeas = c->meanMeas * p->triggerMeasTcMult +
+ meas *(1 - p->triggerMeasTcMult);
+
+ if (hasTriggered |= c->meanMeas >= p->triggerLevel) {
+ unsigned n = p->measuresLen, k = p->measuresIndex;
+ unsigned j, jTrigger = n, jZero = n;
+ for (j = 0; j < n; ++j, k = (k + n - 1) % n)
+ if (c->measures[k] >= p->triggerLevel && j <= jTrigger + p->gapLen)
+ jZero = jTrigger = j;
+ else if (!c->measures[k] && jTrigger >= jZero)
+ jZero = j;
+ j = min(j, jZero);
+ numMeasuresToFlush = range_limit(j, numMeasuresToFlush, n);
+ }
+ lsx_debug_more("%12g %12g %u",
+ meas, c->meanMeas, (unsigned)numMeasuresToFlush);
+ }
+ }
+ if (p->samplesIndex_ns == p->samplesLen_ns)
+ p->samplesIndex_ns = 0;
+ if (!p->measureTimer_ns) {
+ p->measureTimer_ns = p->measurePeriod_ns;
+ ++p->measuresIndex;
+ p->measuresIndex %= p->measuresLen;
+ if (p->bootCount >= 0)
+ p->bootCount = p->bootCount == p->bootCountMax? -1 : p->bootCount + 1;
+ }
+ }
+ if (hasTriggered) {
+ size_t ilen1 = *ilen - idone;
+ p->flushedLen_ns = (p->measuresLen - numMeasuresToFlush) * p->measurePeriod_ns;
+ p->samplesIndex_ns = (p->samplesIndex_ns + p->flushedLen_ns) % p->samplesLen_ns;
+ (effp->handler.flow = flowFlush)(effp, ibuf, obuf, &ilen1, olen);
+ idone += ilen1;
+ }
+ else *olen = 0;
+ *ilen = idone;
+ return SOX_SUCCESS;
+}
+
+static int drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * olen)
+{
+ size_t ilen = 0;
+ return effp->handler.flow(effp, NULL, obuf, &ilen, olen);
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * p = (priv_t *)effp->priv;
+ unsigned i;
+
+ for (i = 0; i < effp->in_signal.channels; ++i) {
+ chan_t * c = &p->channels[i];
+ free(c->measures);
+ free(c->noiseSpectrum);
+ free(c->spectrum);
+ free(c->dftBuf);
+ }
+ free(p->channels);
+ free(p->cepstrumWindow);
+ free(p->spectrumWindow);
+ free(p->samples);
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_vad_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {"vad", NULL,
+ SOX_EFF_MCHAN | SOX_EFF_LENGTH | SOX_EFF_MODIFY,
+ create, start, flowTrigger, drain, stop, NULL, sizeof(priv_t)
+ };
+ static char const * lines[] = {
+ "[options]",
+ "\t-t trigger-level (7)",
+ "\t-T trigger-time-constant (0.25 s)",
+ "\t-s search-time (1 s)",
+ "\t-g allowed-gap (0.25 s)",
+ "\t-p pre-trigger-time (0 s)",
+ "Advanced options:",
+ "\t-b noise-est-boot-time (0.35 s)",
+ "\t-N noise-est-time-constant-up (0.1 s)",
+ "\t-n noise-est-time-constant-down (0.01 s)",
+ "\t-r noise-reduction-amount (1.35)",
+ "\t-f measurement-frequency (20 Hz)",
+ "\t-m measurement-duration (0.1 s)",
+ "\t-M measurement-time-constant (0.4 s)",
+ "\t-h high-pass-filter (50 Hz)",
+ "\t-l low-pass-filter (6000 Hz)",
+ "\t-H high-pass-lifter (150 Hz)",
+ "\t-L low-pass-lifter (2000 Hz)",
+ };
+ static char * usage;
+ handler.usage = lsx_usage_lines(&usage, lines, array_length(lines));
+ return &handler;
+}
diff --git a/src/src/voc.c b/src/src/voc.c
new file mode 100644
index 0000000..6dd8a61
--- /dev/null
+++ b/src/src/voc.c
@@ -0,0 +1,789 @@
+/* libSoX Sound Blaster VOC handler sources.
+ * Copyright 1991 Lance Norskog And Sundry Contributors
+ *
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ *
+ * September 8, 1993
+ * Copyright 1993 T. Allen Grider - for changes to support block type 9
+ * and word sized samples. Same caveats and disclaimer as above.
+ *
+ * February 22, 1996
+ * by Chris Bagwell (cbagwell@sprynet.com)
+ * Added support for block type 8 (extended) which allows for 8-bit stereo
+ * files. Added support for saving stereo files and 16-bit files.
+ * Added VOC format info from audio format FAQ so I don't have to keep
+ * looking around for it.
+ *
+ * February 5, 2001
+ * For sox-12-17 by Annonymous (see notes ANN)
+ * Added comments and notes for each procedure.
+ * Fixed so this now works with pipes, input does not have to
+ * be seekable anymore (in startread() )
+ * Added support for uLAW and aLaw (aLaw not tested).
+ * Fixed support of multi-part VOC files, and files with
+ * block 9 but no audio in the block....
+ * The following need to be tested: 16-bit, 2 channel, and aLaw.
+ *
+ * December 10, 2001
+ * For sox-12-17-3 by Annonymous (see notes ANN)
+ * Patch for sox-12-17 merged with sox-12-17-3-pre3 code.
+ *
+ */
+
+/*------------------------------------------------------------------------
+The following is taken from the Audio File Formats FAQ dated 2-Jan-1995
+and submitted by Guido van Rossum <guido@cwi.nl>.
+--------------------------------------------------------------------------
+Creative Voice (VOC) file format
+--------------------------------
+
+From: galt@dsd.es.com
+
+(byte numbers are hex!)
+
+ HEADER (bytes 00-19)
+ Series of DATA BLOCKS (bytes 1A+) [Must end w/ Terminator Block]
+
+- ---------------------------------------------------------------
+
+HEADER:
+-------
+ byte # Description
+ ------ ------------------------------------------
+ 00-12 "Creative Voice File"
+ 13 1A (eof to abort printing of file)
+ 14-15 Offset of first datablock in .voc file (std 1A 00
+ in Intel Notation)
+ 16-17 Version number (minor,major) (VOC-HDR puts 0A 01)
+ 18-19 2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11)
+
+- ---------------------------------------------------------------
+
+DATA BLOCK:
+-----------
+
+ Data Block: TYPE(1-byte), SIZE(3-bytes), INFO(0+ bytes)
+ NOTE: Terminator Block is an exception -- it has only the TYPE byte.
+
+ TYPE Description Size (3-byte int) Info
+ ---- ----------- ----------------- -----------------------
+ 00 Terminator (NONE) (NONE)
+ 01 Sound data 2+length of data *
+ 02 Sound continue length of data Voice Data
+ 03 Silence 3 **
+ 04 Marker 2 Marker# (2 bytes)
+ 05 ASCII length of string null terminated string
+ 06 Repeat 2 Count# (2 bytes)
+ 07 End repeat 0 (NONE)
+ 08 Extended 4 ***
+ 09 New Header 16 see below
+
+
+ *Sound Info Format: **Silence Info Format:
+ --------------------- ----------------------------
+ 00 Sample Rate 00-01 Length of silence - 1
+ 01 Compression Type 02 Sample Rate
+ 02+ Voice Data
+
+ ***Extended Info Format:
+ ---------------------
+ 00-01 Time Constant: Mono: 65536 - (256000000/sample_rate)
+ Stereo: 65536 - (25600000/(2*sample_rate))
+ 02 Pack
+ 03 Mode: 0 = mono
+ 1 = stereo
+
+
+ Marker# -- Driver keeps the most recent marker in a status byte
+ Count# -- Number of repetitions + 1
+ Count# may be 1 to FFFE for 0 - FFFD repetitions
+ or FFFF for endless repetitions
+ Sample Rate -- SR byte = 256-(1000000/sample_rate)
+ Length of silence -- in units of sampling cycle
+ Compression Type -- of voice data
+ 8-bits = 0
+ 4-bits = 1
+ 2.6-bits = 2
+ 2-bits = 3
+ Multi DAC = 3+(# of channels) [interesting--
+ this isn't in the developer's manual]
+
+Detailed description of new data blocks (VOC files version 1.20 and above):
+
+ (Source is fax from Barry Boone at Creative Labs, 405/742-6622)
+
+BLOCK 8 - digitized sound attribute extension, must preceed block 1.
+ Used to define stereo, 8 bit audio
+ BYTE bBlockID; // = 8
+ BYTE nBlockLen[3]; // 3 byte length
+ WORD wTimeConstant; // time constant = same as block 1
+ BYTE bPackMethod; // same as in block 1
+ BYTE bVoiceMode; // 0-mono, 1-stereo
+
+ Data is stored left, right
+
+BLOCK 9 - data block that supersedes blocks 1 and 8.
+ Used for stereo, 16 bit (and uLaw, aLaw).
+
+ BYTE bBlockID; // = 9
+ BYTE nBlockLen[3]; // length 12 plus length of sound
+ DWORD dwSamplesPerSec; // samples per second, not time const.
+ BYTE bBitsPerSample; // e.g., 8 or 16
+ BYTE bChannels; // 1 for mono, 2 for stereo
+ WORD wFormat; // see below
+ BYTE reserved[4]; // pad to make block w/o data
+ // have a size of 16 bytes
+
+ Valid values of wFormat are:
+
+ 0x0000 8-bit unsigned PCM
+ 0x0001 Creative 8-bit to 4-bit ADPCM
+ 0x0002 Creative 8-bit to 3-bit ADPCM
+ 0x0003 Creative 8-bit to 2-bit ADPCM
+ 0x0004 16-bit signed PCM
+ 0x0006 CCITT a-Law
+ 0x0007 CCITT u-Law
+ 0x02000 Creative 16-bit to 4-bit ADPCM
+
+ Data is stored left, right
+
+ ANN: Multi-byte quantities are in Intel byte order (Little Endian).
+
+------------------------------------------------------------------------*/
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/g711.h"
+#include "third_party/sox/src/src/adpcms.h"
+#include <assert.h>
+#include <string.h>
+
+/* Private data for VOC file */
+typedef struct {
+ long block_remaining; /* bytes remaining in current block */
+ long rate; /* rate code (byte) of this chunk */
+ int silent; /* sound or silence? */
+ long srate; /* rate code (byte) of silence */
+ size_t blockseek; /* start of current output block */
+ long samples; /* number of samples output */
+ uint16_t format; /* VOC audio format */
+ int size; /* word length of data */
+ unsigned char channels; /* number of sound channels */
+ long total_size; /* total size of all audio in file */
+ int extended; /* Has an extended block been read? */
+ adpcm_t adpcm;
+} priv_t;
+
+#define VOC_TERM 0
+#define VOC_DATA 1
+#define VOC_CONT 2
+#define VOC_SILENCE 3
+#define VOC_MARKER 4
+#define VOC_TEXT 5
+#define VOC_LOOP 6
+#define VOC_LOOPEND 7
+#define VOC_EXTENDED 8
+#define VOC_DATA_16 9
+
+/* ANN: Format encoding types */
+#define VOC_FMT_LIN8U 0 /* 8 bit unsigned linear PCM */
+#define VOC_FMT_CRLADPCM4 1 /* Creative 8-bit to 4-bit ADPCM */
+#define VOC_FMT_CRLADPCM3 2 /* Creative 8-bit to 3-bit ADPCM */
+#define VOC_FMT_CRLADPCM2 3 /* Creative 8-bit to 2-bit ADPCM */
+#define VOC_FMT_LIN16 4 /* 16-bit signed PCM */
+#define VOC_FMT_ALAW 6 /* CCITT a-Law 8-bit PCM */
+#define VOC_FMT_MU255 7 /* CCITT u-Law 8-bit PCM */
+#define VOC_FMT_CRLADPCM4A 0x200 /* Creative 16-bit to 4-bit ADPCM */
+
+/* Prototypes for internal functions */
+static int getblock(sox_format_t *);
+static void blockstart(sox_format_t *);
+
+/* Conversion macros (from raw.c) */
+#define SOX_ALAW_BYTE_TO_SAMPLE(d) ((sox_sample_t)(sox_alaw2linear16(d)) << 16)
+#define SOX_ULAW_BYTE_TO_SAMPLE(d) ((sox_sample_t)(sox_ulaw2linear16(d)) << 16)
+
+/* public VOC functions for SOX */
+
+/*-----------------------------------------------------------------
+ * startread() -- start reading a VOC file
+ *-----------------------------------------------------------------*/
+static int startread(sox_format_t * ft)
+{
+ char header[20];
+ priv_t * v = (priv_t *) ft->priv;
+ unsigned short sbseek;
+ int rc;
+ int ii; /* for getting rid of lseek */
+ unsigned char uc;
+
+ if (lsx_readbuf(ft, header, (size_t)20) != 20) {
+ lsx_fail_errno(ft, SOX_EHDR, "unexpected EOF in VOC header");
+ return (SOX_EOF);
+ }
+ if (strncmp(header, "Creative Voice File\032", (size_t)19)) {
+ lsx_fail_errno(ft, SOX_EHDR, "VOC file header incorrect");
+ return (SOX_EOF);
+ }
+
+ /* read the offset to data, from start of file */
+ /* after this read we have read 20 bytes of header + 2 */
+ lsx_readw(ft, &sbseek);
+
+ /* ANN: read to skip the header, instead of lseek */
+ /* this should allow use with pipes.... */
+ for (ii = 22; ii < sbseek; ii++)
+ lsx_readb(ft, &uc);
+
+ v->rate = -1;
+ v->block_remaining = 0;
+ v->total_size = 0; /* ANN added */
+ v->extended = 0;
+
+ /* read until we get the format information.... */
+ rc = getblock(ft);
+ if (rc)
+ return rc;
+
+ /* get rate of data */
+ if (v->rate == -1) {
+ lsx_fail_errno(ft, SOX_EOF, "Input .voc file had no sound!");
+ return (SOX_EOF);
+ }
+
+ /* setup word length of data */
+
+ /* ANN: Check VOC format and map to the proper libSoX format value */
+ switch (v->format) {
+ case VOC_FMT_LIN8U: /* 0 8 bit unsigned linear PCM */
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
+ v->size = 8;
+ break;
+ case VOC_FMT_CRLADPCM4: /* 1 Creative 8-bit to 4-bit ADPCM */
+ ft->encoding.encoding = SOX_ENCODING_CL_ADPCM;
+ v->size = 4;
+ break;
+ case VOC_FMT_CRLADPCM3: /* 2 Creative 8-bit to 3-bit ADPCM */
+ ft->encoding.encoding = SOX_ENCODING_CL_ADPCM;
+ v->size = 3;
+ break;
+ case VOC_FMT_CRLADPCM2: /* 3 Creative 8-bit to 2-bit ADPCM */
+ ft->encoding.encoding = SOX_ENCODING_CL_ADPCM;
+ v->size = 2;
+ break;
+ case VOC_FMT_LIN16: /* 4 16-bit signed PCM */
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ v->size = 16;
+ break;
+ case VOC_FMT_ALAW: /* 6 CCITT a-Law 8-bit PCM */
+ ft->encoding.encoding = SOX_ENCODING_ALAW;
+ v->size = 8;
+ break;
+ case VOC_FMT_MU255: /* 7 CCITT u-Law 8-bit PCM */
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ v->size = 8;
+ break;
+ case VOC_FMT_CRLADPCM4A: /*0x200 Creative 16-bit to 4-bit ADPCM */
+ ft->encoding.encoding = SOX_ENCODING_CL_ADPCM16;
+ v->size = 4;
+ break;
+ default:
+ lsx_fail("Unknown VOC format %d", v->format);
+ break;
+ }
+ ft->encoding.bits_per_sample = v->size;
+
+ /* setup number of channels */
+ if (ft->signal.channels == 0)
+ ft->signal.channels = v->channels;
+
+ return (SOX_SUCCESS);
+}
+
+/*-----------------------------------------------------------------
+ * read() -- read data from a VOC file
+ * ANN: Major changes here to support multi-part files and files
+ * that do not have audio in block 9's.
+ *-----------------------------------------------------------------*/
+static size_t read_samples(sox_format_t * ft, sox_sample_t * buf,
+ size_t len)
+{
+ priv_t * v = (priv_t *) ft->priv;
+ size_t done = 0;
+ int rc = 0;
+ int16_t sw;
+ unsigned char uc;
+
+ if (v->block_remaining == 0) { /* handle getting another cont. buffer */
+ rc = getblock(ft);
+ if (rc)
+ return 0;
+ }
+
+ if (v->block_remaining == 0) /* if no more data, return 0, i.e., done */
+ return 0;
+
+ if (v->silent) {
+ for (; v->block_remaining && (done < len); v->block_remaining--, done++)
+ *buf++ = 0; /* Fill in silence */
+ } else { /* not silence; read len samples of audio from the file */
+ size_t per = max(1, 9 / v->size);
+
+ for (; (done + per <= len); done += per) {
+ if (v->block_remaining == 0) { /* IF no more in this block, get another */
+ while (v->block_remaining == 0) { /* until have either EOF or a block with data */
+ rc = getblock(ft);
+ if (rc)
+ break;
+ }
+ if (rc) /* IF EOF, break out, no more data, next will return 0 */
+ break;
+ }
+
+ /* Read the data in the file */
+ if (v->size <= 4) {
+ if (!v->adpcm.setup.sign) {
+ SOX_SAMPLE_LOCALS;
+ if (lsx_readb(ft, &uc) == SOX_EOF) {
+ lsx_warn("VOC input: short file");
+ v->block_remaining = 0;
+ return done;
+ }
+ *buf = SOX_UNSIGNED_8BIT_TO_SAMPLE(uc,);
+ lsx_adpcm_init(&v->adpcm, 6 - v->size, SOX_SAMPLE_TO_SIGNED_16BIT(*buf, ft->clips));
+ ++buf;
+ --v->block_remaining;
+ ++done;
+ }
+ if (lsx_readb(ft, &uc) == SOX_EOF) {
+ lsx_warn("VOC input: short file");
+ v->block_remaining = 0;
+ return done;
+ }
+ switch (v->size) {
+ case 2:
+ if (v->format == VOC_FMT_CRLADPCM2) {
+ int u = uc;
+
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u >> 6, &v->adpcm),);
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u >> 4, &v->adpcm),);
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u >> 2, &v->adpcm),);
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u , &v->adpcm),);
+ }
+ break;
+ case 3:
+ if (v->format == VOC_FMT_CRLADPCM3) {
+ int u = uc;
+
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u >> 5, &v->adpcm),);
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u >> 2, &v->adpcm),);
+ *buf++ = /* A bit from nowhere! */
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u << 1, &v->adpcm),);
+ }
+ break;
+ case 4:
+ if (v->format == VOC_FMT_CRLADPCM4) {
+ int u = uc;
+
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u >> 4, &v->adpcm),);
+ *buf++ =
+ SOX_SIGNED_16BIT_TO_SAMPLE(lsx_adpcm_decode (u , &v->adpcm),);
+ }
+ break;
+ }
+ } else
+ switch (v->size) {
+ case 8:
+ if (lsx_readb(ft, &uc) == SOX_EOF) {
+ lsx_warn("VOC input: short file");
+ v->block_remaining = 0;
+ return done;
+ }
+ if (v->format == VOC_FMT_MU255) {
+ *buf++ = SOX_ULAW_BYTE_TO_SAMPLE(uc);
+ } else if (v->format == VOC_FMT_ALAW) {
+ *buf++ = SOX_ALAW_BYTE_TO_SAMPLE(uc);
+ } else {
+ *buf++ = SOX_UNSIGNED_8BIT_TO_SAMPLE(uc,);
+ }
+ break;
+ case 16:
+ lsx_readsw(ft, &sw);
+ if (lsx_eof(ft)) {
+ lsx_warn("VOC input: short file");
+ v->block_remaining = 0;
+ return done;
+ }
+ *buf++ = SOX_SIGNED_16BIT_TO_SAMPLE(sw,);
+ v->block_remaining--; /* Processed 2 bytes so update */
+ break;
+ }
+ /* decrement count of processed bytes */
+ v->block_remaining--;
+ }
+ }
+ v->total_size += done;
+ return done;
+}
+
+
+/* When saving samples in VOC format the following outline is followed:
+ * If an 8-bit mono sample then use a VOC_DATA header.
+ * If an 8-bit stereo sample then use a VOC_EXTENDED header followed
+ * by a VOC_DATA header.
+ * If a 16-bit sample (either stereo or mono) then save with a
+ * VOC_DATA_16 header.
+ *
+ * ANN: Not supported: uLaw and aLaw output VOC files....
+ *
+ * This approach will cause the output to be an its most basic format
+ * which will work with the oldest software (eg. an 8-bit mono sample
+ * will be able to be played with a really old SB VOC player.)
+ */
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * v = (priv_t *) ft->priv;
+
+ if (!ft->seekable) {
+ lsx_fail_errno(ft, SOX_EOF,
+ "Output .voc file must be a file, not a pipe");
+ return (SOX_EOF);
+ }
+
+ v->samples = 0;
+
+ /* File format name and a ^Z (aborts printing under DOS) */
+ lsx_writes(ft, "Creative Voice File\032");
+ lsx_writew(ft, 26); /* size of header */
+ lsx_writew(ft, 0x10a); /* major/minor version number */
+ lsx_writew(ft, 0x1129); /* checksum of version number */
+
+ return (SOX_SUCCESS);
+}
+
+/*-----------------------------------------------------------------
+ * write() -- write a VOC file
+ *-----------------------------------------------------------------*/
+static size_t write_samples(sox_format_t * ft, const sox_sample_t * buf,
+ size_t len)
+{
+ priv_t * v = (priv_t *) ft->priv;
+ unsigned char uc;
+ int16_t sw;
+ size_t done = 0;
+
+ if (len && v->samples == 0) {
+ /* No silence packing yet. */
+ v->silent = 0;
+ blockstart(ft);
+ }
+ v->samples += len;
+ while (done < len) {
+ SOX_SAMPLE_LOCALS;
+ if (ft->encoding.bits_per_sample == 8) {
+ uc = SOX_SAMPLE_TO_UNSIGNED_8BIT(*buf++, ft->clips);
+ lsx_writeb(ft, uc);
+ } else {
+ sw = (int) SOX_SAMPLE_TO_SIGNED_16BIT(*buf++, ft->clips);
+ lsx_writesw(ft, sw);
+ }
+ done++;
+ }
+ return done;
+}
+
+/*-----------------------------------------------------------------
+ * blockstop() -- stop an output block
+ * End the current data or silence block.
+ *-----------------------------------------------------------------*/
+static void blockstop(sox_format_t * ft)
+{
+ priv_t * v = (priv_t *) ft->priv;
+ sox_sample_t datum;
+
+ lsx_writeb(ft, 0); /* End of file block code */
+ lsx_seeki(ft, (off_t) v->blockseek, 0); /* seek back to block length */
+ lsx_seeki(ft, (off_t)1, 1); /* seek forward one */
+ if (v->silent) {
+ lsx_writesw(ft, (signed)v->samples);
+ } else {
+ if (ft->encoding.bits_per_sample == 8) {
+ if (ft->signal.channels > 1) {
+ lsx_seeki(ft, (off_t)8, 1); /* forward 7 + 1 for new block header */
+ }
+ }
+ v->samples += 2; /* adjustment: SBDK pp. 3-5 */
+ datum = (v->samples * (ft->encoding.bits_per_sample >> 3)) & 0xff;
+ lsx_writesb(ft, datum); /* low byte of length */
+ datum = ((v->samples * (ft->encoding.bits_per_sample >> 3)) >> 8) & 0xff;
+ lsx_writesb(ft, datum); /* middle byte of length */
+ datum = ((v->samples * (ft->encoding.bits_per_sample >> 3)) >> 16) & 0xff;
+ lsx_writesb(ft, datum); /* high byte of length */
+ }
+}
+
+/*-----------------------------------------------------------------
+ * stopwrite() -- stop writing a VOC file
+ *-----------------------------------------------------------------*/
+static int stopwrite(sox_format_t * ft)
+{
+ blockstop(ft);
+ return (SOX_SUCCESS);
+}
+
+/*-----------------------------------------------------------------
+ * Voc-file handlers (static, private to this module)
+ *-----------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------
+ * getblock() -- Read next block header, save info,
+ * leave position at start of dat
+ *-----------------------------------------------------------------*/
+static int getblock(sox_format_t * ft)
+{
+ priv_t * v = (priv_t *) ft->priv;
+ unsigned char uc, block;
+ sox_uint24_t sblen;
+ uint16_t new_rate_16;
+ uint32_t new_rate_32;
+
+ v->silent = 0;
+ /* DO while we have no audio to read */
+ while (v->block_remaining == 0) {
+ if (lsx_eof(ft))
+ return SOX_EOF;
+
+ if (lsx_readb(ft, &block) == SOX_EOF)
+ return SOX_EOF;
+
+ if (block == VOC_TERM)
+ return SOX_EOF;
+
+ if (lsx_eof(ft))
+ return SOX_EOF;
+
+ lsx_read3(ft, &sblen);
+
+ /* Based on VOC block type, process the block */
+ /* audio may be in one or multiple blocks */
+ switch (block) {
+ case VOC_DATA:
+ lsx_readb(ft, &uc);
+ /* When DATA block preceeded by an EXTENDED */
+ /* block, the DATA blocks rate value is invalid */
+ if (!v->extended) {
+ if (uc == 0) {
+ lsx_fail_errno(ft, SOX_EFMT, "Sample rate is zero?");
+ return (SOX_EOF);
+ }
+ if ((v->rate != -1) && (uc != v->rate)) {
+ lsx_fail_errno(ft, SOX_EFMT,
+ "sample rate codes differ: %ld != %d", v->rate,
+ uc);
+ return (SOX_EOF);
+ }
+ v->rate = uc;
+ ft->signal.rate = 1000000.0 / (256 - v->rate);
+ v->channels = 1;
+ }
+ lsx_readb(ft, &uc);
+ v->format = uc;
+ v->extended = 0;
+ v->block_remaining = sblen - 2;
+ return (SOX_SUCCESS);
+ case VOC_DATA_16:
+ lsx_readdw(ft, &new_rate_32);
+ if (new_rate_32 == 0) {
+ lsx_fail_errno(ft, SOX_EFMT, "Sample rate is zero?");
+ return (SOX_EOF);
+ }
+ if ((v->rate != -1) && ((long) new_rate_32 != v->rate)) {
+ lsx_fail_errno(ft, SOX_EFMT, "sample rate codes differ: %ld != %d",
+ v->rate, new_rate_32);
+ return (SOX_EOF);
+ }
+ v->rate = new_rate_32;
+ ft->signal.rate = new_rate_32;
+ lsx_readb(ft, &uc);
+ v->size = uc;
+ lsx_readb(ft, &(v->channels));
+ lsx_readw(ft, &(v->format)); /* ANN: added format */
+ lsx_skipbytes(ft, (size_t) 4);
+ v->block_remaining = sblen - 12;
+ return (SOX_SUCCESS);
+ case VOC_CONT:
+ v->block_remaining = sblen;
+ return (SOX_SUCCESS);
+ case VOC_SILENCE:
+ {
+ unsigned short period;
+
+ lsx_readw(ft, &period);
+ lsx_readb(ft, &uc);
+ if (uc == 0) {
+ lsx_fail_errno(ft, SOX_EFMT, "Silence sample rate is zero");
+ return (SOX_EOF);
+ }
+ /*
+ * Some silence-packed files have gratuitously
+ * different sample rate codes in silence.
+ * Adjust period.
+ */
+ if ((v->rate != -1) && (uc != v->rate))
+ period = (period * (256. - uc)) / (256 - v->rate) + .5;
+ else
+ v->rate = uc;
+ v->block_remaining = period;
+ v->silent = 1;
+ return (SOX_SUCCESS);
+ }
+ case VOC_MARKER:
+ lsx_readb(ft, &uc);
+ lsx_readb(ft, &uc);
+ /* Falling! Falling! */
+ case VOC_TEXT:
+ {
+ uint32_t i = sblen;
+ int8_t c /*, line_buf[80];
+ * int len = 0 */ ;
+
+ lsx_warn("VOC TEXT");
+ while (i--) {
+ lsx_readsb(ft, &c);
+ /* FIXME: this needs to be tested but I couldn't
+ * find a voc file with a VOC_TEXT chunk :(
+ if (c != '\0' && c != '\r')
+ line_buf[len++] = c;
+ if (len && (c == '\0' || c == '\r' ||
+ i == 0 || len == sizeof(line_buf) - 1))
+ {
+ lsx_report("%s", line_buf);
+ line_buf[len] = '\0';
+ len = 0;
+ }
+ */
+ }
+ }
+ continue; /* get next block */
+ case VOC_LOOP:
+ case VOC_LOOPEND:
+ lsx_debug("skipping repeat loop");
+ lsx_skipbytes(ft, (size_t) sblen);
+ break;
+ case VOC_EXTENDED:
+ /* An Extended block is followed by a data block */
+ /* Set this byte so we know to use the rate */
+ /* value from the extended block and not the */
+ /* data block. */
+ v->extended = 1;
+ lsx_readw(ft, &new_rate_16);
+ if (new_rate_16 == 0) {
+ lsx_fail_errno(ft, SOX_EFMT, "Sample rate is zero?");
+ return (SOX_EOF);
+ }
+ if ((v->rate != -1) && (new_rate_16 != v->rate)) {
+ lsx_fail_errno(ft, SOX_EFMT, "sample rate codes differ: %ld != %d",
+ v->rate, new_rate_16);
+ return (SOX_EOF);
+ }
+ v->rate = new_rate_16;
+ lsx_readb(ft, &uc); /* bits_per_sample */
+ lsx_readb(ft, &uc);
+ ft->signal.channels = uc? 2 : 1; /* Stereo */
+ /* Needed number of channels before finishing
+ * compute for rate */
+ ft->signal.rate = (256e6 / (65536 - v->rate)) / ft->signal.channels;
+ /* An extended block must be followed by a data */
+ /* block to be valid so loop back to top so it */
+ /* can be grabed. */
+ continue;
+ default:
+ lsx_debug("skipping unknown block code %d", block);
+ lsx_skipbytes(ft, (size_t) sblen);
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+/*-----------------------------------------------------------------
+ * vlockstart() -- start an output block
+ *-----------------------------------------------------------------*/
+static void blockstart(sox_format_t * ft)
+{
+ priv_t * v = (priv_t *) ft->priv;
+
+ v->blockseek = lsx_tell(ft);
+ if (v->silent) {
+ lsx_writeb(ft, VOC_SILENCE); /* Silence block code */
+ lsx_writeb(ft, 0); /* Period length */
+ lsx_writeb(ft, 0); /* Period length */
+ lsx_writesb(ft, (signed)v->rate); /* Rate code */
+ } else {
+ if (ft->encoding.bits_per_sample == 8) {
+ /* 8-bit sample section. By always setting the correct */
+ /* rate value in the DATA block (even when its preceeded */
+ /* by an EXTENDED block) old software can still play stereo */
+ /* files in mono by just skipping over the EXTENDED block. */
+ /* Prehaps the rate should be doubled though to make up for */
+ /* double amount of samples for a given time???? */
+ if (ft->signal.channels > 1) {
+ lsx_writeb(ft, VOC_EXTENDED); /* Voice Extended block code */
+ lsx_writeb(ft, 4); /* block length = 4 */
+ lsx_writeb(ft, 0); /* block length = 4 */
+ lsx_writeb(ft, 0); /* block length = 4 */
+ v->rate = 65536 - (256000000.0 / (2 * ft->signal.rate)) + .5;
+ lsx_writesw(ft, (signed) v->rate); /* Rate code */
+ lsx_writeb(ft, 0); /* File is not packed */
+ lsx_writeb(ft, 1); /* samples are in stereo */
+ }
+ lsx_writeb(ft, VOC_DATA); /* Voice Data block code */
+ lsx_writeb(ft, 0); /* block length (for now) */
+ lsx_writeb(ft, 0); /* block length (for now) */
+ lsx_writeb(ft, 0); /* block length (for now) */
+ v->rate = 256 - (1000000.0 / ft->signal.rate) + .5;
+ lsx_writesb(ft, (signed) v->rate); /* Rate code */
+ lsx_writeb(ft, 0); /* 8-bit raw data */
+ } else {
+ lsx_writeb(ft, VOC_DATA_16); /* Voice Data block code */
+ lsx_writeb(ft, 0); /* block length (for now) */
+ lsx_writeb(ft, 0); /* block length (for now) */
+ lsx_writeb(ft, 0); /* block length (for now) */
+ v->rate = ft->signal.rate + .5;
+ lsx_writedw(ft, (unsigned) v->rate); /* Rate code */
+ lsx_writeb(ft, 16); /* Sample Size */
+ lsx_writeb(ft, ft->signal.channels); /* Sample Size */
+ lsx_writew(ft, 0x0004); /* Encoding */
+ lsx_writeb(ft, 0); /* Unused */
+ lsx_writeb(ft, 0); /* Unused */
+ lsx_writeb(ft, 0); /* Unused */
+ lsx_writeb(ft, 0); /* Unused */
+ }
+ }
+}
+
+LSX_FORMAT_HANDLER(voc)
+{
+ static char const *const names[] = { "voc", NULL };
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 0,
+ SOX_ENCODING_UNSIGNED, 8, 0,
+ 0
+ };
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Creative Technology Sound Blaster format",
+ names, SOX_FILE_LIT_END | SOX_FILE_MONO | SOX_FILE_STEREO,
+ startread, read_samples, NULL,
+ startwrite, write_samples, stopwrite,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/vol.c b/src/src/vol.c
new file mode 100644
index 0000000..b96031b
--- /dev/null
+++ b/src/src/vol.c
@@ -0,0 +1,184 @@
+/* Copyright (c) 20/03/2000 Fabien COELHO <fabien@coelho.net>
+ * Copyright (c) 2000-2007 SoX contributors
+ *
+ * SoX vol effect; change volume with basic linear amplitude formula.
+ * Beware of saturations! Clipping is checked and reported.
+ *
+ * FIXME: deprecate or remove the limiter in favour of compand.
+ */
+#define vol_usage \
+ "GAIN [TYPE [LIMITERGAIN]]\n" \
+ "\t(default TYPE=amplitude: 1 is constant, < 0 change phase;\n" \
+ "\tTYPE=power 1 is constant; TYPE=dB: 0 is constant, +6 doubles ampl.)\n" \
+ "\tThe peak limiter has a gain much less than 1 (e.g. 0.05 or 0.02) and\n" \
+ "\tis only used on peaks (to prevent clipping); default is no limiter."
+
+#include "third_party/sox/src/src/sox_i.h"
+
+typedef struct {
+ double gain; /* amplitude gain. */
+ sox_bool uselimiter;
+ double limiterthreshhold;
+ double limitergain;
+ uint64_t limited; /* number of limited values to report. */
+ uint64_t totalprocessed;
+} priv_t;
+
+enum {vol_amplitude, vol_dB, vol_power};
+
+static lsx_enum_item const vol_types[] = {
+ LSX_ENUM_ITEM(vol_,amplitude)
+ LSX_ENUM_ITEM(vol_,dB)
+ LSX_ENUM_ITEM(vol_,power)
+ {0, 0}};
+
+/*
+ * Process options: gain (float) type (amplitude, power, dB)
+ */
+static int getopts(sox_effect_t * effp, int argc, char **argv)
+{
+ priv_t * vol = (priv_t *) effp->priv;
+ char type_string[11];
+ char * type_ptr = type_string;
+ char dummy; /* To check for extraneous chars. */
+ sox_bool have_type;
+ --argc, ++argv;
+
+ vol->gain = 1; /* Default is no change. */
+ vol->uselimiter = sox_false; /* Default is no limiter. */
+
+ /* Get the vol, and the type if it's in the same arg. */
+ if (!argc || (have_type = sscanf(argv[0], "%lf %10s %c", &vol->gain, type_string, &dummy) - 1) > 1)
+ return lsx_usage(effp);
+ ++argv, --argc;
+
+ /* No type yet? Get it from the next arg: */
+ if (!have_type && argc) {
+ have_type = sox_true;
+ type_ptr = *argv;
+ ++argv, --argc;
+ }
+
+ if (have_type) {
+ lsx_enum_item const * p = lsx_find_enum_text(type_ptr, vol_types, 0);
+ if (!p)
+ return lsx_usage(effp);
+ switch (p->value) {
+ case vol_dB: vol->gain = dB_to_linear(vol->gain); break;
+ case vol_power: /* power to amplitude, keep phase change */
+ vol->gain = vol->gain > 0 ? sqrt(vol->gain) : -sqrt(-vol->gain);
+ break;
+ }
+ }
+
+ if (argc) {
+ if (fabs(vol->gain) < 1 || sscanf(*argv, "%lf %c", &vol->limitergain, &dummy) != 1 || vol->limitergain <= 0 || vol->limitergain >= 1)
+ return lsx_usage(effp);
+
+ vol->uselimiter = sox_true;
+ /* The following equation is derived so that there is no
+ * discontinuity in output amplitudes */
+ /* and a SOX_SAMPLE_MAX input always maps to a SOX_SAMPLE_MAX output
+ * when the limiter is activated. */
+ /* (NOTE: There **WILL** be a discontinuity in the slope
+ * of the output amplitudes when using the limiter.) */
+ vol->limiterthreshhold = SOX_SAMPLE_MAX * (1.0 - vol->limitergain) / (fabs(vol->gain) - vol->limitergain);
+ }
+ lsx_debug("mult=%g limit=%g", vol->gain, vol->limitergain);
+ return SOX_SUCCESS;
+}
+
+/*
+ * Start processing
+ */
+static int start(sox_effect_t * effp)
+{
+ priv_t * vol = (priv_t *) effp->priv;
+
+ if (vol->gain == 1)
+ return SOX_EFF_NULL;
+
+ vol->limited = 0;
+ vol->totalprocessed = 0;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Process data.
+ */
+static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf,
+ size_t *isamp, size_t *osamp)
+{
+ priv_t * vol = (priv_t *) effp->priv;
+ register double gain = vol->gain;
+ register double limiterthreshhold = vol->limiterthreshhold;
+ register double sample;
+ register size_t len;
+
+ len = min(*osamp, *isamp);
+
+ /* report back dealt with amount. */
+ *isamp = len; *osamp = len;
+
+ if (vol->uselimiter)
+ {
+ vol->totalprocessed += len;
+
+ for (;len>0; len--)
+ {
+ sample = *ibuf++;
+
+ if (sample > limiterthreshhold)
+ {
+ sample = (SOX_SAMPLE_MAX - vol->limitergain * (SOX_SAMPLE_MAX - sample));
+ vol->limited++;
+ }
+ else if (sample < -limiterthreshhold)
+ {
+ sample = -(SOX_SAMPLE_MAX - vol->limitergain * (SOX_SAMPLE_MAX + sample));
+ /* FIXME: MIN is (-MAX)-1 so need to make sure we
+ * don't go over that. Probably could do this
+ * check inside the above equation but I didn't
+ * think it thru.
+ */
+ if (sample < SOX_SAMPLE_MIN)
+ sample = SOX_SAMPLE_MIN;
+ vol->limited++;
+ } else
+ sample = gain * sample;
+
+ SOX_SAMPLE_CLIP_COUNT(sample, effp->clips);
+ *obuf++ = sample;
+ }
+ }
+ else
+ {
+ /* quite basic, with clipping */
+ for (;len>0; len--)
+ {
+ sample = gain * *ibuf++;
+ SOX_SAMPLE_CLIP_COUNT(sample, effp->clips);
+ *obuf++ = sample;
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+static int stop(sox_effect_t * effp)
+{
+ priv_t * vol = (priv_t *) effp->priv;
+ if (vol->limited) {
+ lsx_warn("limited %" PRIu64 " values (%d percent).",
+ vol->limited, (int) (vol->limited * 100.0 / vol->totalprocessed));
+ }
+ return SOX_SUCCESS;
+}
+
+sox_effect_handler_t const * lsx_vol_effect_fn(void)
+{
+ static sox_effect_handler_t handler = {
+ "vol", vol_usage, SOX_EFF_MCHAN | SOX_EFF_GAIN, getopts, start, flow, 0, stop, 0, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/vorbis.c b/src/src/vorbis.c
new file mode 100644
index 0000000..54d0cfa
--- /dev/null
+++ b/src/src/vorbis.c
@@ -0,0 +1,428 @@
+/* libSoX Ogg Vorbis sound format handler
+ * Copyright 2001, Stan Seibert <indigo@aztec.asu.edu>
+ *
+ * Portions from oggenc, (c) Michael Smith <msmith@labyrinth.net.au>,
+ * ogg123, (c) Kenneth Arnold <kcarnold@yahoo.com>, and
+ * libvorbisfile (c) Xiphophorus Company
+ *
+ * May 9, 2001 - Stan Seibert (indigo@aztec.asu.edu)
+ * Ogg Vorbis handler initially written.
+ *
+ * July 5, 1991 - Skeleton file
+ * Copyright 1991 Lance Norskog And Sundry Contributors
+ * This source code is freely redistributable and may be used for
+ * any purpose. This copyright notice must be maintained.
+ * Lance Norskog And Sundry Contributors are not responsible for
+ * the consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include "third_party/libogg/include/ogg/ogg.h"
+#include "third_party/libvorbis/include/vorbis/codec.h"
+#include "third_party/libvorbis/include/vorbis/vorbisfile.h"
+#include "third_party/libvorbis/include/vorbis/vorbisenc.h"
+
+#define DEF_BUF_LEN 4096
+
+#define BUF_ERROR -1
+#define BUF_EOF 0
+#define BUF_DATA 1
+
+#define HEADER_ERROR 0
+#define HEADER_OK 1
+
+/* Private data for Ogg Vorbis file */
+typedef struct {
+ ogg_stream_state os;
+ ogg_page og;
+ ogg_packet op;
+
+ vorbis_dsp_state vd;
+ vorbis_block vb;
+ vorbis_info vi;
+} vorbis_enc_t;
+
+typedef struct {
+ /* Decoding data */
+ OggVorbis_File *vf;
+ char *buf;
+ size_t buf_len;
+ size_t start;
+ size_t end; /* Unsent data samples in buf[start] through buf[end-1] */
+ int current_section;
+ int eof;
+
+ vorbis_enc_t *vorbis_enc_data;
+} priv_t;
+
+/******** Callback functions used in ov_open_callbacks ************/
+
+static size_t callback_read(void* ptr, size_t size, size_t nmemb, void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ size_t ret = lsx_readbuf(ft, ptr, size * nmemb);
+ return ret / size;
+}
+
+static int callback_seek(void* ft_data, ogg_int64_t off, int whence)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ int ret = ft->seekable ? lsx_seeki(ft, (off_t)off, whence) : -1;
+
+ if (ret == EBADF)
+ ret = -1;
+ return ret;
+}
+
+static int callback_close(void* ft_data UNUSED)
+{
+ /* Do nothing so sox can close the file for us */
+ return 0;
+}
+
+static long callback_tell(void* ft_data)
+{
+ sox_format_t* ft = (sox_format_t*)ft_data;
+ return lsx_tell(ft);
+}
+
+/********************* End callbacks *****************************/
+
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int startread(sox_format_t * ft)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ vorbis_info *vi;
+ vorbis_comment *vc;
+ int i;
+
+ ov_callbacks callbacks = {
+ callback_read,
+ callback_seek,
+ callback_close,
+ callback_tell
+ };
+
+ /* Allocate space for decoding structure */
+ vb->vf = lsx_malloc(sizeof(OggVorbis_File));
+
+ /* Init the decoder */
+ if (ov_open_callbacks(ft, vb->vf, NULL, (size_t) 0, callbacks) < 0) {
+ lsx_fail_errno(ft, SOX_EHDR, "Input not an Ogg Vorbis audio stream");
+ return (SOX_EOF);
+ }
+
+ /* Get info about the Ogg Vorbis stream */
+ vi = ov_info(vb->vf, -1);
+ vc = ov_comment(vb->vf, -1);
+
+ /* Record audio info */
+ ft->signal.rate = vi->rate;
+ ft->encoding.encoding = SOX_ENCODING_VORBIS;
+ ft->signal.channels = vi->channels;
+
+ /* ov_pcm_total doesn't work on non-seekable files so
+ * skip that step in that case. Also, it reports
+ * "frame"-ish results so we must * channels.
+ */
+ if (ft->seekable)
+ ft->signal.length = ov_pcm_total(vb->vf, -1) * ft->signal.channels;
+
+ /* Record comments */
+ for (i = 0; i < vc->comments; i++)
+ sox_append_comment(&ft->oob.comments, vc->user_comments[i]);
+
+ /* Setup buffer */
+ vb->buf_len = DEF_BUF_LEN;
+ vb->buf_len -= vb->buf_len % (vi->channels*2); /* 2 bytes per sample */
+ vb->buf = lsx_calloc(vb->buf_len, sizeof(char));
+ vb->start = vb->end = 0;
+
+ /* Fill in other info */
+ vb->eof = 0;
+ vb->current_section = -1;
+
+ return (SOX_SUCCESS);
+}
+
+
+/* Refill the buffer with samples. Returns BUF_EOF if the end of the
+ * vorbis data was reached while the buffer was being filled,
+ * BUF_ERROR is something bad happens, and BUF_DATA otherwise */
+static int refill_buffer(priv_t * vb)
+{
+ int num_read;
+
+ if (vb->start == vb->end) /* Samples all played */
+ vb->start = vb->end = 0;
+
+ while (vb->end < vb->buf_len) {
+ num_read = ov_read(vb->vf, vb->buf + vb->end,
+ (int) (vb->buf_len - vb->end), 0, 2, 1, &vb->current_section);
+ if (num_read == 0)
+ return (BUF_EOF);
+ else if (num_read == OV_HOLE)
+ lsx_warn("Warning: hole in stream; probably harmless");
+ else if (num_read < 0)
+ return (BUF_ERROR);
+ else
+ vb->end += num_read;
+ }
+ return (BUF_DATA);
+}
+
+
+/*
+ * Read up to len samples from file.
+ * Convert to signed longs.
+ * Place in buf[].
+ * Return number of samples read.
+ */
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ size_t i;
+ int ret;
+ sox_sample_t l;
+
+
+ for (i = 0; i < len; i++) {
+ if (vb->start == vb->end) {
+ if (vb->eof)
+ break;
+ ret = refill_buffer(vb);
+ if (ret == BUF_EOF || ret == BUF_ERROR) {
+ vb->eof = 1;
+ if (vb->end == 0)
+ break;
+ }
+ }
+
+ l = (vb->buf[vb->start + 1] << 24)
+ | (0xffffff & (vb->buf[vb->start] << 16));
+ *(buf + i) = l;
+ vb->start += 2;
+ }
+ return i;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * Don't close input file!
+ */
+static int stopread(sox_format_t * ft)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+
+ free(vb->buf);
+ ov_clear(vb->vf);
+ free(vb->vf);
+
+ return (SOX_SUCCESS);
+}
+
+/* Write a page of ogg data to a file. Taken directly from encode.c in
+ * oggenc. Returns the number of bytes written. */
+static int oe_write_page(ogg_page * page, sox_format_t * ft)
+{
+ int written;
+
+ written = lsx_writebuf(ft, page->header, (size_t) page->header_len);
+ written += lsx_writebuf(ft, page->body, (size_t) page->body_len);
+
+ return written;
+}
+
+/* Write out the header packets. Derived mostly from encode.c in oggenc.
+ * Returns HEADER_OK if the header can be written, HEADER_ERROR otherwise. */
+static int write_vorbis_header(sox_format_t * ft, vorbis_enc_t * ve)
+{
+ ogg_packet header_main;
+ ogg_packet header_comments;
+ ogg_packet header_codebooks;
+ vorbis_comment vc;
+ int i, ret = HEADER_OK;
+
+ memset(&vc, 0, sizeof(vc));
+ vc.comments = sox_num_comments(ft->oob.comments);
+ if (vc.comments) { /* Make the comment structure */
+ vc.comment_lengths = lsx_calloc((size_t)vc.comments, sizeof(*vc.comment_lengths));
+ vc.user_comments = lsx_calloc((size_t)vc.comments, sizeof(*vc.user_comments));
+ for (i = 0; i < vc.comments; ++i) {
+ static const char prepend[] = "Comment=";
+ char * text = lsx_calloc(strlen(prepend) + strlen(ft->oob.comments[i]) + 1, sizeof(*text));
+ /* Prepend `Comment=' if no field-name already in the comment */
+ if (!strchr(ft->oob.comments[i], '='))
+ strcpy(text, prepend);
+ vc.user_comments[i] = strcat(text, ft->oob.comments[i]);
+ vc.comment_lengths[i] = strlen(text);
+ }
+ }
+ vorbis_analysis_headerout( /* Build the packets */
+ &ve->vd, &vc, &header_main, &header_comments, &header_codebooks);
+
+ ogg_stream_packetin(&ve->os, &header_main); /* And stream them out */
+ ogg_stream_packetin(&ve->os, &header_comments);
+ ogg_stream_packetin(&ve->os, &header_codebooks);
+
+ while (ogg_stream_flush(&ve->os, &ve->og) && ret == HEADER_OK)
+ if (!oe_write_page(&ve->og, ft))
+ ret = HEADER_ERROR;
+ for (i = 0; i < vc.comments; ++i)
+ free(vc.user_comments[i]);
+ free(vc.user_comments);
+ free(vc.comment_lengths);
+ return ret;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ vorbis_enc_t *ve;
+ long rate;
+ double quality = 3; /* Default compression quality gives ~112kbps */
+
+ ft->encoding.encoding = SOX_ENCODING_VORBIS;
+
+ /* Allocate memory for all of the structures */
+ ve = vb->vorbis_enc_data = lsx_malloc(sizeof(vorbis_enc_t));
+
+ vorbis_info_init(&ve->vi);
+
+ /* TODO */
+ rate = ft->signal.rate;
+ if (rate)
+ lsx_fail_errno(ft, SOX_EHDR,
+ "Error setting-up Ogg Vorbis encoder; check sample-rate & # of channels");
+
+ /* Use encoding to average bit rate of VBR as specified by the -C option */
+ if (ft->encoding.compression != HUGE_VAL) {
+ if (ft->encoding.compression < -1 || ft->encoding.compression > 10) {
+ lsx_fail_errno(ft, SOX_EINVAL,
+ "Vorbis compression quality nust be between -1 and 10");
+ return SOX_EOF;
+ }
+ quality = ft->encoding.compression;
+ }
+#define IGNORE_WARNING \
+ if (vorbis_encode_init_vbr(&ve->vi, ft->signal.channels, ft->signal.rate + .5, quality / 10))
+#include "third_party/sox/src/src/ignore-warning.h"
+ {
+ lsx_fail_errno(ft, SOX_EFMT, "libVorbis cannot encode this sample-rate or # of channels");
+ return SOX_EOF;
+ }
+
+ vorbis_analysis_init(&ve->vd, &ve->vi);
+ vorbis_block_init(&ve->vd, &ve->vb);
+
+ ogg_stream_init(&ve->os, INT_MAX & (int)RANQD1); /* Random serial number */
+
+ if (write_vorbis_header(ft, ve) == HEADER_ERROR) {
+ lsx_fail_errno(ft, SOX_EHDR,
+ "Error writing header for Ogg Vorbis audio stream");
+ return (SOX_EOF);
+ }
+
+ return (SOX_SUCCESS);
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t * buf,
+ size_t len)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ vorbis_enc_t *ve = vb->vorbis_enc_data;
+ size_t samples = len / ft->signal.channels;
+ float **buffer = vorbis_analysis_buffer(&ve->vd, (int) samples);
+ size_t i, j;
+ int ret;
+ int eos = 0;
+
+ /* Copy samples into vorbis buffer */
+ for (i = 0; i < samples; i++)
+ for (j = 0; j < ft->signal.channels; j++)
+ buffer[j][i] = buf[i * ft->signal.channels + j]
+ / ((float) SOX_SAMPLE_MAX);
+
+ vorbis_analysis_wrote(&ve->vd, (int) samples);
+
+ while (vorbis_analysis_blockout(&ve->vd, &ve->vb) == 1) {
+ /* Do the main analysis, creating a packet */
+ vorbis_analysis(&ve->vb, &ve->op);
+ vorbis_bitrate_addblock(&ve->vb);
+
+ /* Add packet to bitstream */
+ while (vorbis_bitrate_flushpacket(&ve->vd, &ve->op)) {
+ ogg_stream_packetin(&ve->os, &ve->op);
+
+ /* If we've gone over a page boundary, we can do actual
+ * output, so do so (for however many pages are available)
+ */
+
+ while (!eos) {
+ int result = ogg_stream_pageout(&ve->os, &ve->og);
+
+ if (!result)
+ break;
+
+ ret = oe_write_page(&ve->og, ft);
+ if (!ret)
+ return 0;
+
+ if (ogg_page_eos(&ve->og))
+ eos = 1;
+ }
+ }
+ }
+
+ return (len);
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+ vorbis_enc_t *ve = vb->vorbis_enc_data;
+
+ /* Close out the remaining data */
+ write_samples(ft, NULL, (size_t) 0);
+
+ ogg_stream_clear(&ve->os);
+ vorbis_block_clear(&ve->vb);
+ vorbis_dsp_clear(&ve->vd);
+ vorbis_info_clear(&ve->vi);
+ free(ve);
+
+ return (SOX_SUCCESS);
+}
+
+static int seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * vb = (priv_t *) ft->priv;
+
+ return ov_pcm_seek(vb->vf, (ogg_int64_t)(offset / ft->signal.channels))? SOX_EOF:SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(vorbis)
+{
+ static const char *names[] = {"vorbis", "ogg", NULL};
+ static const unsigned encodings[] = {SOX_ENCODING_VORBIS, 0, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Xiph.org's ogg-vorbis lossy compression", names, 0,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ seek, encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/vox-fmt.c b/src/src/vox-fmt.c
new file mode 100644
index 0000000..4948e18
--- /dev/null
+++ b/src/src/vox-fmt.c
@@ -0,0 +1,33 @@
+/* libSoX file format: raw Dialogic/OKI ADPCM (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/adpcms.h"
+#include "third_party/sox/src/src/vox.h"
+
+LSX_FORMAT_HANDLER(vox)
+{
+ static char const * const names[] = {"vox", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_OKI_ADPCM, 4, 0, 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Raw OKI/Dialogic ADPCM", names, SOX_FILE_MONO,
+ lsx_vox_start, lsx_vox_read, lsx_vox_stopread,
+ lsx_vox_start, lsx_vox_write, lsx_vox_stopwrite,
+ lsx_rawseek, write_encodings, NULL, sizeof(adpcm_io_t)
+ };
+ return &handler;
+}
diff --git a/src/src/vox.c b/src/src/vox.c
new file mode 100644
index 0000000..9b6ff66
--- /dev/null
+++ b/src/src/vox.c
@@ -0,0 +1,47 @@
+/* libSoX file format handler for Dialogic/Oki ADPCM VOX files.
+ *
+ * Copyright 1991-2007 Tony Seebregts And Sundry Contributors
+ *
+ * This source code is freely redistributable and may be used for any
+ * purpose. This copyright notice must be maintained.
+ *
+ * Tony Seebregts And Sundry Contributors are not responsible for the
+ * consequences of using this software.
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include "third_party/sox/src/src/vox.h"
+#include "third_party/sox/src/src/adpcms.h"
+
+/* .vox doesn't need any private state over and above adpcm_io_t *, so
+ just have simple wrappers that pass it on directly. */
+
+int lsx_vox_start(sox_format_t * ft)
+{
+ return lsx_adpcm_oki_start(ft, (adpcm_io_t *)ft->priv);
+}
+
+int lsx_ima_start(sox_format_t * ft)
+{
+ return lsx_adpcm_ima_start(ft, (adpcm_io_t *)ft->priv);
+}
+
+size_t lsx_vox_read(sox_format_t * ft, sox_sample_t *buffer, size_t len)
+{
+ return lsx_adpcm_read(ft, (adpcm_io_t *)ft->priv, buffer, len);
+}
+
+int lsx_vox_stopread(sox_format_t * ft)
+{
+ return lsx_adpcm_stopread(ft, (adpcm_io_t *)ft->priv);
+}
+
+size_t lsx_vox_write(sox_format_t * ft, const sox_sample_t *buffer, size_t length)
+{
+ return lsx_adpcm_write(ft, (adpcm_io_t *)ft->priv, buffer, length);
+}
+
+int lsx_vox_stopwrite(sox_format_t * ft)
+{
+ return lsx_adpcm_stopwrite(ft, (adpcm_io_t *)ft->priv);
+}
diff --git a/src/src/vox.h b/src/src/vox.h
new file mode 100644
index 0000000..b81d20b
--- /dev/null
+++ b/src/src/vox.h
@@ -0,0 +1,23 @@
+/* (c) 2007-8 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+int lsx_vox_start(sox_format_t * ft);
+int lsx_ima_start(sox_format_t * ft);
+size_t lsx_vox_read(sox_format_t * ft, sox_sample_t *buffer, size_t len);
+int lsx_vox_stopread(sox_format_t * ft);
+size_t lsx_vox_write(sox_format_t * ft, const sox_sample_t *buffer, size_t length);
+int lsx_vox_stopwrite(sox_format_t * ft);
diff --git a/src/src/w64.c b/src/src/w64.c
new file mode 100644
index 0000000..c2e738c
--- /dev/null
+++ b/src/src/w64.c
@@ -0,0 +1,43 @@
+/* libSoX file format: W64 Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(w64)
+{
+ static char const * const names[] = {"w64", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 24, 32, 0,
+ SOX_ENCODING_UNSIGNED, 8, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_IMA_ADPCM, 4, 0,
+ SOX_ENCODING_MS_ADPCM, 4, 0,
+ SOX_ENCODING_GSM, 0,
+ 0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description = "Sound Forge Audio Format";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/wav.c b/src/src/wav.c
new file mode 100644
index 0000000..d0f7c8c
--- /dev/null
+++ b/src/src/wav.c
@@ -0,0 +1,1785 @@
+/* libSoX microsoft's WAVE sound format handler
+ *
+ * Copyright 1998-2006 Chris Bagwell and SoX Contributors
+ * Copyright 1997 Graeme W. Gill, 93/5/17
+ * Copyright 1992 Rick Richardson
+ * Copyright 1991 Lance Norskog And Sundry Contributors
+ *
+ * Info for format tags can be found at:
+ * http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
+ *
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "third_party/sox/src/src/ima_rw.h"
+#include "third_party/sox/src/src/adpcm.h"
+#ifdef EXTERNAL_GSM
+
+#ifdef HAVE_GSM_GSM_H
+#include <gsm/gsm.h>
+#else
+#include <gsm.h>
+#endif
+
+#else
+#include "third_party/sox/src/libgsm/gsm.h"
+#endif
+
+/* Magic length writen when its not possible to write valid lengths.
+ * This can be either because of non-seekable output or because
+ * the length can not be represented by the 32-bits used in WAV files.
+ * When magic length is detected on inputs, disable any length
+ * logic.
+ */
+#define MS_UNSPEC 0x7ffff000
+
+#define WAVE_FORMAT_UNKNOWN (0x0000U)
+#define WAVE_FORMAT_PCM (0x0001U)
+#define WAVE_FORMAT_ADPCM (0x0002U)
+#define WAVE_FORMAT_IEEE_FLOAT (0x0003U)
+#define WAVE_FORMAT_ALAW (0x0006U)
+#define WAVE_FORMAT_MULAW (0x0007U)
+#define WAVE_FORMAT_OKI_ADPCM (0x0010U)
+#define WAVE_FORMAT_IMA_ADPCM (0x0011U)
+#define WAVE_FORMAT_DIGISTD (0x0015U)
+#define WAVE_FORMAT_DIGIFIX (0x0016U)
+#define WAVE_FORMAT_DOLBY_AC2 (0x0030U)
+#define WAVE_FORMAT_GSM610 (0x0031U)
+#define WAVE_FORMAT_ROCKWELL_ADPCM (0x003bU)
+#define WAVE_FORMAT_ROCKWELL_DIGITALK (0x003cU)
+#define WAVE_FORMAT_G721_ADPCM (0x0040U)
+#define WAVE_FORMAT_G728_CELP (0x0041U)
+#define WAVE_FORMAT_MPEG (0x0050U)
+#define WAVE_FORMAT_MPEGLAYER3 (0x0055U)
+#define WAVE_FORMAT_G726_ADPCM (0x0064U)
+#define WAVE_FORMAT_G722_ADPCM (0x0065U)
+#define WAVE_FORMAT_EXTENSIBLE (0xfffeU)
+
+/* To allow padding to samplesPerBlock. Works, but currently never true. */
+static const size_t pad_nsamps = sox_false;
+
+/* Private data for .wav file */
+typedef struct {
+ /* samples/channel reading: starts at total count and decremented */
+ /* writing: starts at 0 and counts samples written */
+ uint64_t numSamples;
+ size_t dataLength; /* needed for ADPCM writing */
+ unsigned short formatTag; /* What type of encoding file is using */
+ unsigned short samplesPerBlock;
+ unsigned short blockAlign;
+ size_t dataStart; /* need to for seeking */
+ char * comment;
+ int ignoreSize; /* ignoreSize allows us to process 32-bit WAV files that are
+ * greater then 2 Gb and can't be represented by the
+ * 32-bit size field. */
+ /* FIXME: Have some front-end code which sets this flag. */
+
+ /* following used by *ADPCM wav files */
+ unsigned short nCoefs; /* ADPCM: number of coef sets */
+ short *lsx_ms_adpcm_i_coefs; /* ADPCM: coef sets */
+ unsigned char *packet; /* Temporary buffer for packets */
+ short *samples; /* interleaved samples buffer */
+ short *samplePtr; /* Pointer to current sample */
+ short *sampleTop; /* End of samples-buffer */
+ unsigned short blockSamplesRemaining;/* Samples remaining per channel */
+ int state[16]; /* step-size info for *ADPCM writes */
+
+ /* following used by GSM 6.10 wav */
+ gsm gsmhandle;
+ gsm_signal *gsmsample;
+ int gsmindex;
+ size_t gsmbytecount; /* counts bytes written to data block */
+ sox_bool isRF64; /* True if file being read is a RF64 */
+ uint64_t ds64_dataSize; /* Size of data chunk from ds64 header */
+} priv_t;
+
+static char *wav_format_str(unsigned wFormatTag);
+
+static int wavwritehdr(sox_format_t *, int);
+
+
+/****************************************************************************/
+/* IMA ADPCM Support Functions Section */
+/****************************************************************************/
+
+/*
+ *
+ * ImaAdpcmReadBlock - Grab and decode complete block of samples
+ *
+ */
+static unsigned short ImaAdpcmReadBlock(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ size_t bytesRead;
+ int samplesThisBlock;
+
+ /* Pull in the packet and check the header */
+ bytesRead = lsx_readbuf(ft, wav->packet, (size_t)wav->blockAlign);
+ samplesThisBlock = wav->samplesPerBlock;
+ if (bytesRead < wav->blockAlign)
+ {
+ /* If it looks like a valid header is around then try and */
+ /* work with partial blocks. Specs say it should be null */
+ /* padded but I guess this is better than trailing quiet. */
+ samplesThisBlock = lsx_ima_samples_in((size_t)0, (size_t)ft->signal.channels, bytesRead, (size_t) 0);
+ if (samplesThisBlock == 0)
+ {
+ lsx_warn("Premature EOF on .wav input file");
+ return 0;
+ }
+ }
+
+ wav->samplePtr = wav->samples;
+
+ /* For a full block, the following should be true: */
+ /* wav->samplesPerBlock = blockAlign - 8byte header + 1 sample in header */
+ lsx_ima_block_expand_i(ft->signal.channels, wav->packet, wav->samples, samplesThisBlock);
+ return samplesThisBlock;
+
+}
+
+/****************************************************************************/
+/* MS ADPCM Support Functions Section */
+/****************************************************************************/
+
+/*
+ *
+ * AdpcmReadBlock - Grab and decode complete block of samples
+ *
+ */
+static unsigned short AdpcmReadBlock(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ size_t bytesRead;
+ int samplesThisBlock;
+ const char *errmsg;
+
+ /* Pull in the packet and check the header */
+ bytesRead = lsx_readbuf(ft, wav->packet, (size_t) wav->blockAlign);
+ samplesThisBlock = wav->samplesPerBlock;
+ if (bytesRead < wav->blockAlign)
+ {
+ /* If it looks like a valid header is around then try and */
+ /* work with partial blocks. Specs say it should be null */
+ /* padded but I guess this is better than trailing quiet. */
+ samplesThisBlock = lsx_ms_adpcm_samples_in((size_t)0, (size_t)ft->signal.channels, bytesRead, (size_t)0);
+ if (samplesThisBlock == 0 || samplesThisBlock > wav->samplesPerBlock)
+ {
+ lsx_warn("Premature EOF on .wav input file");
+ return 0;
+ }
+ }
+
+ errmsg = lsx_ms_adpcm_block_expand_i(ft->signal.channels, wav->nCoefs, wav->lsx_ms_adpcm_i_coefs, wav->packet, wav->samples, samplesThisBlock);
+
+ if (errmsg)
+ lsx_warn("%s", errmsg);
+
+ return samplesThisBlock;
+}
+
+/****************************************************************************/
+/* Common ADPCM Write Function */
+/****************************************************************************/
+
+static int xxxAdpcmWriteBlock(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ size_t chans, ct;
+ short *p;
+
+ chans = ft->signal.channels;
+ p = wav->samplePtr;
+ ct = p - wav->samples;
+ if (ct>=chans) {
+ /* zero-fill samples if needed to complete block */
+ for (p = wav->samplePtr; p < wav->sampleTop; p++) *p=0;
+ /* compress the samples to wav->packet */
+ if (wav->formatTag == WAVE_FORMAT_ADPCM) {
+ lsx_ms_adpcm_block_mash_i((unsigned) chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, wav->blockAlign);
+ }else{ /* WAVE_FORMAT_IMA_ADPCM */
+ lsx_ima_block_mash_i((unsigned) chans, wav->samples, wav->samplesPerBlock, wav->state, wav->packet, 9);
+ }
+ /* write the compressed packet */
+ if (lsx_writebuf(ft, wav->packet, (size_t) wav->blockAlign) != wav->blockAlign)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"write error");
+ return (SOX_EOF);
+ }
+ /* update lengths and samplePtr */
+ wav->dataLength += wav->blockAlign;
+ if (pad_nsamps)
+ wav->numSamples += wav->samplesPerBlock;
+ else
+ wav->numSamples += ct/chans;
+ wav->samplePtr = wav->samples;
+ }
+ return (SOX_SUCCESS);
+}
+
+/****************************************************************************/
+/* WAV GSM6.10 support functions */
+/****************************************************************************/
+/* create the gsm object, malloc buffer for 160*2 samples */
+static int wavgsminit(sox_format_t * ft)
+{
+ int valueP=1;
+ priv_t * wav = (priv_t *) ft->priv;
+ wav->gsmbytecount=0;
+ wav->gsmhandle=gsm_create();
+ if (!wav->gsmhandle)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"cannot create GSM object");
+ return (SOX_EOF);
+ }
+
+ if(gsm_option(wav->gsmhandle,GSM_OPT_WAV49,&valueP) == -1){
+ lsx_fail_errno(ft,SOX_EOF,"error setting gsm_option for WAV49 format. Recompile gsm library with -DWAV49 option and relink sox");
+ return (SOX_EOF);
+ }
+
+ wav->gsmsample=lsx_malloc(sizeof(gsm_signal)*160*2);
+ wav->gsmindex=0;
+ return (SOX_SUCCESS);
+}
+
+/*destroy the gsm object and free the buffer */
+static void wavgsmdestroy(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ gsm_destroy(wav->gsmhandle);
+ free(wav->gsmsample);
+}
+
+static size_t wavgsmread(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ size_t done=0;
+ int bytes;
+ gsm_byte frame[65];
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ /* copy out any samples left from the last call */
+ while(wav->gsmindex && (wav->gsmindex<160*2) && (done < len))
+ buf[done++]=SOX_SIGNED_16BIT_TO_SAMPLE(wav->gsmsample[wav->gsmindex++],);
+
+ /* read and decode loop, possibly leaving some samples in wav->gsmsample */
+ while (done < len) {
+ wav->gsmindex=0;
+ bytes = lsx_readbuf(ft, frame, (size_t)65);
+ if (bytes <=0)
+ return done;
+ if (bytes<65) {
+ lsx_warn("invalid wav gsm frame size: %d bytes",bytes);
+ return done;
+ }
+ /* decode the long 33 byte half */
+ if(gsm_decode(wav->gsmhandle,frame, wav->gsmsample)<0)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"error during gsm decode");
+ return 0;
+ }
+ /* decode the short 32 byte half */
+ if(gsm_decode(wav->gsmhandle,frame+33, wav->gsmsample+160)<0)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"error during gsm decode");
+ return 0;
+ }
+
+ while ((wav->gsmindex <160*2) && (done < len)){
+ buf[done++]=SOX_SIGNED_16BIT_TO_SAMPLE(wav->gsmsample[(wav->gsmindex)++],);
+ }
+ }
+
+ return done;
+}
+
+static int wavgsmflush(sox_format_t * ft)
+{
+ gsm_byte frame[65];
+ priv_t * wav = (priv_t *) ft->priv;
+
+ /* zero fill as needed */
+ while(wav->gsmindex<160*2)
+ wav->gsmsample[wav->gsmindex++]=0;
+
+ /*encode the even half short (32 byte) frame */
+ gsm_encode(wav->gsmhandle, wav->gsmsample, frame);
+ /*encode the odd half long (33 byte) frame */
+ gsm_encode(wav->gsmhandle, wav->gsmsample+160, frame+32);
+ if (lsx_writebuf(ft, frame, (size_t) 65) != 65)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"write error");
+ return (SOX_EOF);
+ }
+ wav->gsmbytecount += 65;
+
+ wav->gsmindex = 0;
+ return (SOX_SUCCESS);
+}
+
+static size_t wavgsmwrite(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ size_t done = 0;
+ int rc;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ while (done < len) {
+ SOX_SAMPLE_LOCALS;
+ while ((wav->gsmindex < 160*2) && (done < len))
+ wav->gsmsample[(wav->gsmindex)++] =
+ SOX_SAMPLE_TO_SIGNED_16BIT(buf[done++], ft->clips);
+
+ if (wav->gsmindex < 160*2)
+ break;
+
+ rc = wavgsmflush(ft);
+ if (rc)
+ return 0;
+ }
+ return done;
+
+}
+
+static void wavgsmstopwrite(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ if (wav->gsmindex)
+ wavgsmflush(ft);
+
+ /* Add a pad byte if amount of written bytes is not even. */
+ if (wav->gsmbytecount && wav->gsmbytecount % 2){
+ if(lsx_writeb(ft, 0))
+ lsx_fail_errno(ft,SOX_EOF,"write error");
+ else
+ wav->gsmbytecount += 1;
+ }
+
+ wavgsmdestroy(ft);
+}
+
+/****************************************************************************/
+/* General Sox WAV file code */
+/****************************************************************************/
+
+static int sndfile_workaround(uint64_t *len, sox_format_t *ft) {
+ char magic[5];
+ off_t here;
+
+ here = lsx_tell(ft);
+
+ lsx_debug("Attempting work around for bad ds64 length bug");
+
+ /* Seek to last four bytes of chunk, assuming size is correct. */
+ if (lsx_seeki(ft, (off_t)(*len)-4, SEEK_CUR) != SOX_SUCCESS)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "WAV chunk appears to have invalid size %ld.", *len);
+ return SOX_EOF;
+ }
+
+ /* Get the last four bytes to see if it is an "fmt " chunk */
+ if (lsx_reads(ft, magic, (size_t)4) == SOX_EOF)
+ {
+ lsx_fail_errno(ft,SOX_EHDR, "WAV chunk appears to have invalid size %ld.", *len);
+ return SOX_EOF;
+ }
+
+ /* Seek back to where we were, which won't work if you're piping */
+ if (lsx_seeki(ft, here, SEEK_SET)!=SOX_SUCCESS)
+ {
+ lsx_fail_errno(ft,SOX_EHDR, "Cannot seek backwards to work around possible broken header.");
+ return SOX_EOF;
+ }
+ if (memcmp(magic, "fmt ", (size_t)4)==0)
+ {
+ /* If the last four bytes were "fmt ", len is almost certainly four bytes too big. */
+ lsx_debug("File had libsndfile bug, working around tell=%ld", lsx_tell(ft));
+ *len -= 4;
+ }
+ return SOX_SUCCESS;
+}
+
+static int findChunk(sox_format_t * ft, const char *Label, uint64_t *len)
+{
+ char magic[5];
+ priv_t *wav = (priv_t *) ft->priv;
+ uint32_t len_tmp;
+
+ lsx_debug("Searching for %2x %2x %2x %2x", Label[0], Label[1], Label[2], Label[3]);
+ for (;;)
+ {
+ if (lsx_reads(ft, magic, (size_t)4) == SOX_EOF)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "WAVE file has missing %s chunk",
+ Label);
+ return SOX_EOF;
+ }
+ lsx_debug("WAV Chunk %s", magic);
+ if (lsx_readdw(ft, &len_tmp) == SOX_EOF)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "WAVE file %s chunk is too short",
+ magic);
+ return SOX_EOF;
+ }
+
+ if (len_tmp == 0xffffffff && wav->isRF64==sox_true)
+ {
+ /* Chunk length should come from ds64 header */
+ if (memcmp(magic, "data", (size_t)4)==0)
+ {
+ *len = wav->ds64_dataSize;
+ }
+ else
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "Cannot yet read block sizes of arbitary RF64 chunks, cannot find chunk '%s'", Label);
+ return SOX_EOF;
+ }
+ }
+ else {
+ *len = len_tmp;
+ }
+
+ /* Work around for a bug in libsndfile
+ * https://github.com/erikd/libsndfile/commit/7fa1c57c37844a9d44642ea35e6638238b8af19e#src/rf64.c
+ The ds64 chunk should be 0x1c bytes, not 0x20.
+ */
+ if ((*len) == 0x20 && memcmp(Label, "ds64", (size_t)4)==0)
+ {
+ int fail;
+ if ((fail = sndfile_workaround(len, ft)) != SOX_SUCCESS) {
+ return fail;
+ }
+ }
+
+ if (memcmp(Label, magic, (size_t)4) == 0)
+ break; /* Found the given chunk */
+
+ /* Chunks are required to be word aligned. */
+ if ((*len) % 2) (*len)++;
+
+ /* skip to next chunk */
+ if (*len > 0 && lsx_seeki(ft, (off_t)(*len), SEEK_CUR) != SOX_SUCCESS)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,
+ "WAV chunk appears to have invalid size %ld.", *len);
+ return SOX_EOF;
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+
+static int wavfail(sox_format_t * ft, const char *format)
+{
+ lsx_fail_errno(ft, SOX_EHDR, "WAV file encoding `%s' is not supported", format);
+ return SOX_EOF;
+}
+
+/*
+ * Do anything required before you start reading samples.
+ * Read file header.
+ * Find out sampling rate,
+ * size and encoding of samples,
+ * mono/stereo/quad.
+ */
+static int startread(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ char magic[5];
+ uint64_t len;
+
+ /* wave file characteristics */
+ uint64_t qwRiffLength;
+ uint32_t dwRiffLength_tmp;
+ unsigned short wChannels; /* number of channels */
+ uint32_t dwSamplesPerSecond; /* samples per second per channel */
+ uint32_t dwAvgBytesPerSec;/* estimate of bytes per second needed */
+ uint16_t wBitsPerSample; /* bits per sample */
+ uint32_t wFmtSize;
+ uint16_t wExtSize = 0; /* extended field for non-PCM */
+
+ uint64_t qwDataLength; /* length of sound data in bytes */
+ size_t bytesPerBlock = 0;
+ int bytespersample; /* bytes per sample (per channel */
+ char text[256];
+ uint32_t dwLoopPos;
+
+ ft->sox_errno = SOX_SUCCESS;
+ wav->ignoreSize = ft->signal.length == SOX_IGNORE_LENGTH;
+
+ if (lsx_reads(ft, magic, (size_t)4) == SOX_EOF || (strncmp("RIFF", magic, (size_t)4) != 0 &&
+ strncmp("RIFX", magic, (size_t)4) != 0 && strncmp("RF64", magic, (size_t)4)!=0 ))
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE: RIFF header not found");
+ return SOX_EOF;
+ }
+
+ /* RIFX is a Big-endian RIFF */
+ if (strncmp("RIFX", magic, (size_t)4) == 0)
+ {
+ lsx_debug("Found RIFX header");
+ ft->encoding.reverse_bytes = MACHINE_IS_LITTLEENDIAN;
+ }
+ else ft->encoding.reverse_bytes = MACHINE_IS_BIGENDIAN;
+
+ if (strncmp("RF64", magic, (size_t)4) == 0)
+ {
+ wav->isRF64 = sox_true;
+ }
+ else
+ {
+ wav->isRF64 = sox_false;
+ }
+
+ lsx_readdw(ft, &dwRiffLength_tmp);
+ qwRiffLength = dwRiffLength_tmp;
+
+ if (lsx_reads(ft, magic, (size_t)4) == SOX_EOF || strncmp("WAVE", magic, (size_t)4))
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE header not found");
+ return SOX_EOF;
+ }
+
+ if (wav->isRF64 && findChunk(ft, "ds64", &len) != SOX_EOF) {
+ lsx_debug("Found ds64 header");
+
+ if (dwRiffLength_tmp==0xffffffff)
+ {
+ lsx_readqw(ft, &qwRiffLength);
+ }
+ else
+ {
+ lsx_skipbytes(ft, (size_t)8);
+ }
+ lsx_readqw(ft, &wav->ds64_dataSize);
+ lsx_skipbytes(ft, (size_t)len-16);
+ }
+
+ /* Now look for the format chunk */
+ if (findChunk(ft, "fmt ", &len) == SOX_EOF)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE chunk fmt not found");
+ return SOX_EOF;
+ }
+ wFmtSize = len;
+
+ if (wFmtSize < 16)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE file fmt chunk is too short");
+ return SOX_EOF;
+ }
+
+ lsx_readw(ft, &(wav->formatTag));
+ lsx_readw(ft, &wChannels);
+ lsx_readdw(ft, &dwSamplesPerSecond);
+ lsx_readdw(ft, &dwAvgBytesPerSec); /* Average bytes/second */
+ lsx_readw(ft, &(wav->blockAlign)); /* Block align */
+ lsx_readw(ft, &wBitsPerSample); /* bits per sample per channel */
+ len -= 16;
+
+ if (wav->formatTag == WAVE_FORMAT_EXTENSIBLE)
+ {
+ uint16_t extensionSize;
+ uint16_t numberOfValidBits;
+ uint32_t speakerPositionMask;
+ uint16_t subFormatTag;
+ uint8_t dummyByte;
+ int i;
+
+ if (wFmtSize < 18)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE file fmt chunk is too short");
+ return SOX_EOF;
+ }
+ lsx_readw(ft, &extensionSize);
+ len -= 2;
+ if (extensionSize < 22)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE file fmt chunk is too short");
+ return SOX_EOF;
+ }
+ lsx_readw(ft, &numberOfValidBits);
+ lsx_readdw(ft, &speakerPositionMask);
+ lsx_readw(ft, &subFormatTag);
+ for (i = 0; i < 14; ++i) lsx_readb(ft, &dummyByte);
+ len -= 22;
+ if (numberOfValidBits != wBitsPerSample)
+ {
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE file fmt with padded samples is not supported yet");
+ return SOX_EOF;
+ }
+ wav->formatTag = subFormatTag;
+ lsx_report("EXTENSIBLE");
+ }
+
+ switch (wav->formatTag)
+ {
+ case WAVE_FORMAT_UNKNOWN:
+ lsx_fail_errno(ft,SOX_EHDR,"WAVE file is in unsupported Microsoft Official Unknown format.");
+ return SOX_EOF;
+
+ case WAVE_FORMAT_PCM:
+ /* Default (-1) depends on sample size. Set that later on. */
+ if (ft->encoding.encoding != SOX_ENCODING_UNKNOWN && ft->encoding.encoding != SOX_ENCODING_UNSIGNED &&
+ ft->encoding.encoding != SOX_ENCODING_SIGN2)
+ lsx_report("User options overriding encoding read in .wav header");
+ break;
+
+ case WAVE_FORMAT_IMA_ADPCM:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM)
+ ft->encoding.encoding = SOX_ENCODING_IMA_ADPCM;
+ else
+ lsx_report("User options overriding encoding read in .wav header");
+ break;
+
+ case WAVE_FORMAT_ADPCM:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_MS_ADPCM)
+ ft->encoding.encoding = SOX_ENCODING_MS_ADPCM;
+ else
+ lsx_report("User options overriding encoding read in .wav header");
+ break;
+
+ case WAVE_FORMAT_IEEE_FLOAT:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_FLOAT)
+ ft->encoding.encoding = SOX_ENCODING_FLOAT;
+ else
+ lsx_report("User options overriding encoding read in .wav header");
+ break;
+
+ case WAVE_FORMAT_ALAW:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_ALAW)
+ ft->encoding.encoding = SOX_ENCODING_ALAW;
+ else
+ lsx_report("User options overriding encoding read in .wav header");
+ break;
+
+ case WAVE_FORMAT_MULAW:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_ULAW)
+ ft->encoding.encoding = SOX_ENCODING_ULAW;
+ else
+ lsx_report("User options overriding encoding read in .wav header");
+ break;
+
+ case WAVE_FORMAT_OKI_ADPCM:
+ return wavfail(ft, "OKI ADPCM");
+ case WAVE_FORMAT_DIGISTD:
+ return wavfail(ft, "Digistd");
+ case WAVE_FORMAT_DIGIFIX:
+ return wavfail(ft, "Digifix");
+ case WAVE_FORMAT_DOLBY_AC2:
+ return wavfail(ft, "Dolby AC2");
+ case WAVE_FORMAT_GSM610:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN || ft->encoding.encoding == SOX_ENCODING_GSM )
+ ft->encoding.encoding = SOX_ENCODING_GSM;
+ else
+ lsx_report("User options overriding encoding read in .wav header");
+ break;
+ case WAVE_FORMAT_ROCKWELL_ADPCM:
+ return wavfail(ft, "Rockwell ADPCM");
+ case WAVE_FORMAT_ROCKWELL_DIGITALK:
+ return wavfail(ft, "Rockwell DIGITALK");
+ case WAVE_FORMAT_G721_ADPCM:
+ return wavfail(ft, "G.721 ADPCM");
+ case WAVE_FORMAT_G728_CELP:
+ return wavfail(ft, "G.728 CELP");
+ case WAVE_FORMAT_MPEG:
+ return wavfail(ft, "MPEG");
+ case WAVE_FORMAT_MPEGLAYER3:
+ return wavfail(ft, "MP3");
+ case WAVE_FORMAT_G726_ADPCM:
+ return wavfail(ft, "G.726 ADPCM");
+ case WAVE_FORMAT_G722_ADPCM:
+ return wavfail(ft, "G.722 ADPCM");
+ default:
+ lsx_fail_errno(ft, SOX_EHDR, "Unknown WAV file encoding (type %x)", wav->formatTag);
+ return SOX_EOF;
+ }
+
+ /* User options take precedence */
+ if (ft->signal.channels == 0 || ft->signal.channels == wChannels)
+ ft->signal.channels = wChannels;
+ else
+ lsx_report("User options overriding channels read in .wav header");
+
+ if (ft->signal.rate == 0 || ft->signal.rate == dwSamplesPerSecond)
+ ft->signal.rate = dwSamplesPerSecond;
+ else
+ lsx_report("User options overriding rate read in .wav header");
+
+
+ wav->lsx_ms_adpcm_i_coefs = NULL;
+ wav->packet = NULL;
+ wav->samples = NULL;
+
+ /* non-PCM formats except alaw and mulaw formats have extended fmt chunk.
+ * Check for those cases.
+ */
+ if (wav->formatTag != WAVE_FORMAT_PCM &&
+ wav->formatTag != WAVE_FORMAT_ALAW &&
+ wav->formatTag != WAVE_FORMAT_MULAW) {
+ if (len >= 2) {
+ lsx_readw(ft, &wExtSize);
+ len -= 2;
+ } else {
+ lsx_warn("wave header missing extended part of fmt chunk");
+ }
+ }
+
+ if (wExtSize > len)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"wave header error: wExtSize inconsistent with wFmtLen");
+ return SOX_EOF;
+ }
+
+ switch (wav->formatTag)
+ {
+ case WAVE_FORMAT_ADPCM:
+ if (wExtSize < 4)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"format[%s]: expects wExtSize >= %d",
+ wav_format_str(wav->formatTag), 4);
+ return SOX_EOF;
+ }
+
+ if (wBitsPerSample != 4)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Can only handle 4-bit MS ADPCM in wav files");
+ return SOX_EOF;
+ }
+
+ lsx_readw(ft, &(wav->samplesPerBlock));
+ bytesPerBlock = lsx_ms_adpcm_bytes_per_block((size_t) ft->signal.channels, (size_t) wav->samplesPerBlock);
+ if (bytesPerBlock > wav->blockAlign)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"format[%s]: samplesPerBlock(%d) incompatible with blockAlign(%d)",
+ wav_format_str(wav->formatTag), wav->samplesPerBlock, wav->blockAlign);
+ return SOX_EOF;
+ }
+
+ lsx_readw(ft, &(wav->nCoefs));
+ if (wav->nCoefs < 7 || wav->nCoefs > 0x100) {
+ lsx_fail_errno(ft,SOX_EOF,"ADPCM file nCoefs (%.4hx) makes no sense", wav->nCoefs);
+ return SOX_EOF;
+ }
+ wav->packet = lsx_malloc((size_t)wav->blockAlign);
+
+ len -= 4;
+
+ if (wExtSize < 4 + 4*wav->nCoefs)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"wave header error: wExtSize(%d) too small for nCoefs(%d)", wExtSize, wav->nCoefs);
+ return SOX_EOF;
+ }
+
+ wav->samples = lsx_malloc(wChannels*wav->samplesPerBlock*sizeof(short));
+
+ /* nCoefs, lsx_ms_adpcm_i_coefs used by adpcm.c */
+ wav->lsx_ms_adpcm_i_coefs = lsx_malloc(wav->nCoefs * 2 * sizeof(short));
+ {
+ int i, errct=0;
+ for (i=0; len>=2 && i < 2*wav->nCoefs; i++) {
+ lsx_readsw(ft, &(wav->lsx_ms_adpcm_i_coefs[i]));
+ len -= 2;
+ if (i<14) errct += (wav->lsx_ms_adpcm_i_coefs[i] != lsx_ms_adpcm_i_coef[i/2][i%2]);
+ /* lsx_debug("lsx_ms_adpcm_i_coefs[%2d] %4d",i,wav->lsx_ms_adpcm_i_coefs[i]); */
+ }
+ if (errct) lsx_warn("base lsx_ms_adpcm_i_coefs differ in %d/14 positions",errct);
+ }
+
+ bytespersample = 2; /* AFTER de-compression */
+ break;
+
+ case WAVE_FORMAT_IMA_ADPCM:
+ if (wExtSize < 2)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"format[%s]: expects wExtSize >= %d",
+ wav_format_str(wav->formatTag), 2);
+ return SOX_EOF;
+ }
+
+ if (wBitsPerSample != 4)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Can only handle 4-bit IMA ADPCM in wav files");
+ return SOX_EOF;
+ }
+
+ lsx_readw(ft, &(wav->samplesPerBlock));
+ bytesPerBlock = lsx_ima_bytes_per_block((size_t) ft->signal.channels, (size_t) wav->samplesPerBlock);
+ if (bytesPerBlock > wav->blockAlign || wav->samplesPerBlock%8 != 1)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"format[%s]: samplesPerBlock(%d) incompatible with blockAlign(%d)",
+ wav_format_str(wav->formatTag), wav->samplesPerBlock, wav->blockAlign);
+ return SOX_EOF;
+ }
+
+ wav->packet = lsx_malloc((size_t)wav->blockAlign);
+ len -= 2;
+
+ wav->samples = lsx_malloc(wChannels*wav->samplesPerBlock*sizeof(short));
+
+ bytespersample = 2; /* AFTER de-compression */
+ break;
+
+ /* GSM formats have extended fmt chunk. Check for those cases. */
+ case WAVE_FORMAT_GSM610:
+ if (wExtSize < 2)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"format[%s]: expects wExtSize >= %d",
+ wav_format_str(wav->formatTag), 2);
+ return SOX_EOF;
+ }
+ lsx_readw(ft, &wav->samplesPerBlock);
+ bytesPerBlock = 65;
+ if (wav->blockAlign != 65)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"format[%s]: expects blockAlign(%d) = %d",
+ wav_format_str(wav->formatTag), wav->blockAlign, 65);
+ return SOX_EOF;
+ }
+ if (wav->samplesPerBlock != 320)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"format[%s]: expects samplesPerBlock(%d) = %d",
+ wav_format_str(wav->formatTag), wav->samplesPerBlock, 320);
+ return SOX_EOF;
+ }
+ bytespersample = 2; /* AFTER de-compression */
+ len -= 2;
+ break;
+
+ default:
+ bytespersample = (wBitsPerSample + 7)/8;
+
+ }
+
+ /* User options take precedence */
+ if (!ft->encoding.bits_per_sample || ft->encoding.bits_per_sample == wBitsPerSample)
+ ft->encoding.bits_per_sample = wBitsPerSample;
+ else
+ lsx_warn("User options overriding size read in .wav header");
+
+ /* Now we have enough information to set default encodings. */
+ switch (bytespersample)
+ {
+ case 1:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_UNSIGNED;
+ break;
+
+ case 2: case 3: case 4:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+ break;
+
+ case 8:
+ if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
+ ft->encoding.encoding = SOX_ENCODING_FLOAT;
+ break;
+
+ default:
+ lsx_fail_errno(ft,SOX_EFMT,"Sorry, don't understand .wav size");
+ return SOX_EOF;
+ }
+
+ /* Skip anything left over from fmt chunk */
+ lsx_seeki(ft, (off_t)len, SEEK_CUR);
+
+ /* for non-PCM formats, there's a 'fact' chunk before
+ * the upcoming 'data' chunk */
+
+ /* Now look for the wave data chunk */
+ if (findChunk(ft, "data", &len) == SOX_EOF)
+ {
+ lsx_fail_errno(ft, SOX_EOF, "Could not find data chunk.");
+ return SOX_EOF;
+ }
+
+ /* ds64 size will have been applied in findChunk */
+ qwDataLength = len;
+ /* XXX - does MS_UNSPEC apply to RF64 files? */
+ if (qwDataLength == MS_UNSPEC) {
+ wav->ignoreSize = 1;
+ lsx_debug("WAV Chunk data's length is value often used in pipes or 4G files. Ignoring length.");
+ }
+
+
+ /* Data starts here */
+ wav->dataStart = lsx_tell(ft);
+
+ switch (wav->formatTag)
+ {
+
+ case WAVE_FORMAT_ADPCM:
+ wav->numSamples =
+ lsx_ms_adpcm_samples_in((size_t)qwDataLength, (size_t)ft->signal.channels,
+ (size_t)wav->blockAlign, (size_t)wav->samplesPerBlock);
+ lsx_debug_more("datalen %ld, numSamples %lu",qwDataLength, (unsigned long)wav->numSamples);
+ wav->blockSamplesRemaining = 0; /* Samples left in buffer */
+ ft->signal.length = wav->numSamples*ft->signal.channels;
+ break;
+
+ case WAVE_FORMAT_IMA_ADPCM:
+ /* Compute easiest part of number of samples. For every block, there
+ are samplesPerBlock samples to read. */
+ wav->numSamples =
+ lsx_ima_samples_in((size_t)qwDataLength, (size_t)ft->signal.channels,
+ (size_t)wav->blockAlign, (size_t)wav->samplesPerBlock);
+ lsx_debug_more("datalen %ld, numSamples %lu",qwDataLength, (unsigned long)wav->numSamples);
+ wav->blockSamplesRemaining = 0; /* Samples left in buffer */
+ lsx_ima_init_table();
+ ft->signal.length = wav->numSamples*ft->signal.channels;
+ break;
+
+ case WAVE_FORMAT_GSM610:
+ wav->numSamples = ((qwDataLength / wav->blockAlign) * wav->samplesPerBlock);
+ wavgsminit(ft);
+ ft->signal.length = wav->numSamples*ft->signal.channels;
+ break;
+
+ default:
+ wav->numSamples = div_bits(qwDataLength, ft->encoding.bits_per_sample) / ft->signal.channels;
+ ft->signal.length = wav->numSamples * ft->signal.channels;
+ }
+
+ /* When ignoring size, reset length so that output files do
+ * not mistakenly depend on it.
+ */
+ if (wav->ignoreSize)
+ ft->signal.length = SOX_UNSPEC;
+
+ lsx_debug("Reading Wave file: %s format, %d channel%s, %d samp/sec",
+ wav_format_str(wav->formatTag), ft->signal.channels,
+ wChannels == 1 ? "" : "s", dwSamplesPerSecond);
+ lsx_debug(" %d byte/sec, %d block align, %d bits/samp, %lu data bytes",
+ dwAvgBytesPerSec, wav->blockAlign, wBitsPerSample, qwDataLength);
+
+ /* Can also report extended fmt information */
+ switch (wav->formatTag)
+ {
+ case WAVE_FORMAT_ADPCM:
+ lsx_debug(" %d Extsize, %d Samps/block, %lu bytes/block %d Num Coefs, %lu Samps/chan",
+ wExtSize,wav->samplesPerBlock,
+ (unsigned long)bytesPerBlock,wav->nCoefs,
+ (unsigned long)wav->numSamples);
+ break;
+
+ case WAVE_FORMAT_IMA_ADPCM:
+ lsx_debug(" %d Extsize, %d Samps/block, %lu bytes/block %lu Samps/chan",
+ wExtSize, wav->samplesPerBlock,
+ (unsigned long)bytesPerBlock,
+ (unsigned long)wav->numSamples);
+ break;
+
+ case WAVE_FORMAT_GSM610:
+ lsx_debug("GSM .wav: %d Extsize, %d Samps/block, %lu Samples/chan",
+ wExtSize, wav->samplesPerBlock,
+ (unsigned long)wav->numSamples);
+ break;
+
+ default:
+ lsx_debug(" %lu Samps/chans",
+ (unsigned long)wav->numSamples);
+ }
+
+ /* Horrible way to find Cool Edit marker points. Taken from Quake source*/
+ ft->oob.loops[0].start = SOX_IGNORE_LENGTH;
+ if(ft->seekable){
+ /*Got this from the quake source. I think it 32bit aligns the chunks
+ * doubt any machine writing Cool Edit Chunks writes them at an odd
+ * offset */
+ len = (len + 1) & ~1u;
+ if (lsx_seeki(ft, (off_t)len, SEEK_CUR) == SOX_SUCCESS &&
+ findChunk(ft, "LIST", &len) != SOX_EOF)
+ {
+ wav->comment = lsx_malloc((size_t)256);
+ /* Initialize comment to a NULL string */
+ wav->comment[0] = 0;
+ while(!lsx_eof(ft))
+ {
+ if (lsx_reads(ft,magic,(size_t)4) == SOX_EOF)
+ break;
+
+ /* First look for type fields for LIST Chunk and
+ * skip those if found. Since a LIST is a list
+ * of Chunks, treat the remaining data as Chunks
+ * again.
+ */
+ if (strncmp(magic, "INFO", (size_t)4) == 0)
+ {
+ /*Skip*/
+ lsx_debug("Type INFO");
+ }
+ else if (strncmp(magic, "adtl", (size_t)4) == 0)
+ {
+ /* Skip */
+ lsx_debug("Type adtl");
+ }
+ else
+ {
+ uint32_t len_tmp;
+ if (lsx_readdw(ft,&len_tmp) == SOX_EOF)
+ break;
+ len = len_tmp;
+ if (strncmp(magic,"ICRD",(size_t)4) == 0)
+ {
+ lsx_debug("Chunk ICRD");
+ if (len > 254)
+ {
+ lsx_warn("Possible buffer overflow hack attack (ICRD)!");
+ break;
+ }
+ lsx_reads(ft,text, (size_t)len);
+ if (strlen(wav->comment) + strlen(text) < 254)
+ {
+ if (wav->comment[0] != 0)
+ strcat(wav->comment,"\n");
+
+ strcat(wav->comment,text);
+ }
+ if (strlen(text) < len)
+ lsx_seeki(ft, (off_t)(len - strlen(text)), SEEK_CUR);
+ }
+ else if (strncmp(magic,"ISFT",(size_t)4) == 0)
+ {
+ lsx_debug("Chunk ISFT");
+ if (len > 254)
+ {
+ lsx_warn("Possible buffer overflow hack attack (ISFT)!");
+ break;
+ }
+ lsx_reads(ft,text, (size_t)len);
+ if (strlen(wav->comment) + strlen(text) < 254)
+ {
+ if (wav->comment[0] != 0)
+ strcat(wav->comment,"\n");
+
+ strcat(wav->comment,text);
+ }
+ if (strlen(text) < len)
+ lsx_seeki(ft, (off_t)(len - strlen(text)), SEEK_CUR);
+ }
+ else if (strncmp(magic,"cue ",(size_t)4) == 0)
+ {
+ lsx_debug("Chunk cue ");
+ lsx_seeki(ft,(off_t)(len-4),SEEK_CUR);
+ lsx_readdw(ft,&dwLoopPos);
+ ft->oob.loops[0].start = dwLoopPos;
+ }
+ else if (strncmp(magic,"ltxt",(size_t)4) == 0)
+ {
+ lsx_debug("Chunk ltxt");
+ lsx_readdw(ft,&dwLoopPos);
+ ft->oob.loops[0].length = dwLoopPos - ft->oob.loops[0].start;
+ if (len > 4)
+ lsx_seeki(ft, (off_t)(len - 4), SEEK_CUR);
+ }
+ else
+ {
+ lsx_debug("Attempting to seek beyond unsupported chunk `%c%c%c%c' of length %ld bytes", magic[0], magic[1], magic[2], magic[3], len);
+ len = (len + 1) & ~1u;
+ lsx_seeki(ft, (off_t)len, SEEK_CUR);
+ }
+ }
+ }
+ }
+ lsx_clearerr(ft);
+ lsx_seeki(ft,(off_t)wav->dataStart,SEEK_SET);
+ }
+ return lsx_rawstartread(ft);
+}
+
+
+/*
+ * Read up to len samples from file.
+ * Convert to signed longs.
+ * Place in buf[].
+ * Return number of samples read.
+ */
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ size_t done;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ /* If file is in ADPCM encoding then read in multiple blocks else */
+ /* read as much as possible and return quickly. */
+ switch (ft->encoding.encoding)
+ {
+ case SOX_ENCODING_IMA_ADPCM:
+ case SOX_ENCODING_MS_ADPCM:
+
+ if (!wav->ignoreSize && len > (wav->numSamples*ft->signal.channels))
+ len = (wav->numSamples*ft->signal.channels);
+
+ done = 0;
+ while (done < len) { /* Still want data? */
+ /* See if need to read more from disk */
+ if (wav->blockSamplesRemaining == 0) {
+ if (wav->formatTag == WAVE_FORMAT_IMA_ADPCM)
+ wav->blockSamplesRemaining = ImaAdpcmReadBlock(ft);
+ else
+ wav->blockSamplesRemaining = AdpcmReadBlock(ft);
+ if (wav->blockSamplesRemaining == 0)
+ {
+ /* Don't try to read any more samples */
+ wav->numSamples = 0;
+ return done;
+ }
+ wav->samplePtr = wav->samples;
+ }
+
+ /* Copy interleaved data into buf, converting to sox_sample_t */
+ {
+ short *p, *top;
+ size_t ct;
+ ct = len-done;
+ if (ct > (wav->blockSamplesRemaining*ft->signal.channels))
+ ct = (wav->blockSamplesRemaining*ft->signal.channels);
+
+ done += ct;
+ wav->blockSamplesRemaining -= (ct/ft->signal.channels);
+ p = wav->samplePtr;
+ top = p+ct;
+ /* Output is already signed */
+ while (p<top)
+ *buf++ = SOX_SIGNED_16BIT_TO_SAMPLE((*p++),);
+
+ wav->samplePtr = p;
+ }
+ }
+ /* "done" for ADPCM equals total data processed and not
+ * total samples procesed. The only way to take care of that
+ * is to return here and not fall thru.
+ */
+ wav->numSamples -= (done / ft->signal.channels);
+ return done;
+ break;
+
+ case SOX_ENCODING_GSM:
+ if (!wav->ignoreSize && len > wav->numSamples*ft->signal.channels)
+ len = (wav->numSamples*ft->signal.channels);
+
+ done = wavgsmread(ft, buf, len);
+ if (done == 0 && wav->numSamples != 0 && !wav->ignoreSize)
+ lsx_warn("Premature EOF on .wav input file");
+ break;
+
+ default: /* assume PCM or float encoding */
+ if (!wav->ignoreSize && len > wav->numSamples*ft->signal.channels)
+ len = (wav->numSamples*ft->signal.channels);
+
+ done = lsx_rawread(ft, buf, len);
+ /* If software thinks there are more samples but I/O */
+ /* says otherwise, let the user know about this. */
+ if (done == 0 && wav->numSamples != 0 && !wav->ignoreSize)
+ lsx_warn("Premature EOF on .wav input file");
+ }
+
+ /* Only return buffers that contain a totally playable
+ * amount of audio.
+ */
+ done -= done % ft->signal.channels;
+ if (done/ft->signal.channels > wav->numSamples)
+ wav->numSamples = 0;
+ else
+ wav->numSamples -= (done/ft->signal.channels);
+ return done;
+}
+
+/*
+ * Do anything required when you stop reading samples.
+ * Don't close input file!
+ */
+static int stopread(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ free(wav->packet);
+ free(wav->samples);
+ free(wav->lsx_ms_adpcm_i_coefs);
+ free(wav->comment);
+ wav->comment = NULL;
+
+ switch (ft->encoding.encoding)
+ {
+ case SOX_ENCODING_GSM:
+ wavgsmdestroy(ft);
+ break;
+ case SOX_ENCODING_IMA_ADPCM:
+ case SOX_ENCODING_MS_ADPCM:
+ break;
+ default:
+ break;
+ }
+ return SOX_SUCCESS;
+}
+
+static int startwrite(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ int rc;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ if (ft->encoding.encoding != SOX_ENCODING_MS_ADPCM &&
+ ft->encoding.encoding != SOX_ENCODING_IMA_ADPCM &&
+ ft->encoding.encoding != SOX_ENCODING_GSM)
+ {
+ rc = lsx_rawstartwrite(ft);
+ if (rc)
+ return rc;
+ }
+
+ wav->numSamples = 0;
+ wav->dataLength = 0;
+ if (!ft->signal.length && !ft->seekable)
+ lsx_warn("Length in output .wav header will be wrong since can't seek to fix it");
+
+ rc = wavwritehdr(ft, 0); /* also calculates various wav->* info */
+ if (rc != 0)
+ return rc;
+
+ wav->packet = NULL;
+ wav->samples = NULL;
+ wav->lsx_ms_adpcm_i_coefs = NULL;
+ switch (wav->formatTag)
+ {
+ size_t ch, sbsize;
+
+ case WAVE_FORMAT_IMA_ADPCM:
+ lsx_ima_init_table();
+ /* intentional case fallthru! */
+ case WAVE_FORMAT_ADPCM:
+ /* #channels already range-checked for overflow in wavwritehdr() */
+ for (ch=0; ch<ft->signal.channels; ch++)
+ wav->state[ch] = 0;
+ sbsize = ft->signal.channels * wav->samplesPerBlock;
+ wav->packet = lsx_malloc((size_t)wav->blockAlign);
+ wav->samples = lsx_malloc(sbsize*sizeof(short));
+ wav->sampleTop = wav->samples + sbsize;
+ wav->samplePtr = wav->samples;
+ break;
+
+ case WAVE_FORMAT_GSM610:
+ return wavgsminit(ft);
+
+ default:
+ break;
+ }
+ return SOX_SUCCESS;
+}
+
+/* wavwritehdr: write .wav headers as follows:
+
+bytes variable description
+0 - 3 'RIFF'/'RIFX' Little/Big-endian
+4 - 7 wRiffLength length of file minus the 8 byte riff header
+8 - 11 'WAVE'
+12 - 15 'fmt '
+16 - 19 wFmtSize length of format chunk minus 8 byte header
+20 - 21 wFormatTag identifies PCM, ULAW etc
+22 - 23 wChannels
+24 - 27 dwSamplesPerSecond samples per second per channel
+28 - 31 dwAvgBytesPerSec non-trivial for compressed formats
+32 - 33 wBlockAlign basic block size
+34 - 35 wBitsPerSample non-trivial for compressed formats
+
+PCM formats then go straight to the data chunk:
+36 - 39 'data'
+40 - 43 dwDataLength length of data chunk minus 8 byte header
+44 - (dwDataLength + 43) the data
+(+ a padding byte if dwDataLength is odd)
+
+non-PCM formats must write an extended format chunk and a fact chunk:
+
+ULAW, ALAW formats:
+36 - 37 wExtSize = 0 the length of the format extension
+38 - 41 'fact'
+42 - 45 dwFactSize = 4 length of the fact chunk minus 8 byte header
+46 - 49 dwSamplesWritten actual number of samples written out
+50 - 53 'data'
+54 - 57 dwDataLength length of data chunk minus 8 byte header
+58 - (dwDataLength + 57) the data
+(+ a padding byte if dwDataLength is odd)
+
+
+GSM6.10 format:
+36 - 37 wExtSize = 2 the length in bytes of the format-dependent extension
+38 - 39 320 number of samples per block
+40 - 43 'fact'
+44 - 47 dwFactSize = 4 length of the fact chunk minus 8 byte header
+48 - 51 dwSamplesWritten actual number of samples written out
+52 - 55 'data'
+56 - 59 dwDataLength length of data chunk minus 8 byte header
+60 - (dwDataLength + 59) the data (including a padding byte, if necessary,
+ so dwDataLength is always even)
+
+
+note that header contains (up to) 3 separate ways of describing the
+length of the file, all derived here from the number of (input)
+samples wav->numSamples in a way that is non-trivial for the blocked
+and padded compressed formats:
+
+wRiffLength - (riff header) the length of the file, minus 8
+dwSamplesWritten - (fact header) the number of samples written (after padding
+ to a complete block eg for GSM)
+dwDataLength - (data chunk header) the number of (valid) data bytes written
+
+*/
+
+static int wavwritehdr(sox_format_t * ft, int second_header)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+
+ /* variables written to wav file header */
+ /* RIFF header */
+ uint32_t wRiffLength ; /* length of file after 8 byte riff header */
+ /* fmt chunk */
+ uint16_t wFmtSize = 16; /* size field of the fmt chunk */
+ uint16_t wFormatTag = 0; /* data format */
+ uint16_t wChannels; /* number of channels */
+ uint32_t dwSamplesPerSecond; /* samples per second per channel*/
+ uint32_t dwAvgBytesPerSec=0; /* estimate of bytes per second needed */
+ uint16_t wBlockAlign=0; /* byte alignment of a basic sample block */
+ uint16_t wBitsPerSample=0; /* bits per sample */
+ /* fmt chunk extension (not PCM) */
+ uint16_t wExtSize=0; /* extra bytes in the format extension */
+ uint16_t wSamplesPerBlock; /* samples per channel per block */
+ /* wSamplesPerBlock and other things may go into format extension */
+
+ /* fact chunk (not PCM) */
+ uint32_t dwFactSize=4; /* length of the fact chunk */
+ uint32_t dwSamplesWritten=0; /* windows doesnt seem to use this*/
+
+ /* data chunk */
+ uint32_t dwDataLength; /* length of sound data in bytes */
+ /* end of variables written to header */
+
+ /* internal variables, intermediate values etc */
+ int bytespersample; /* (uncompressed) bytes per sample (per channel) */
+ long blocksWritten = 0;
+ sox_bool isExtensible = sox_false; /* WAVE_FORMAT_EXTENSIBLE? */
+
+ dwSamplesPerSecond = ft->signal.rate;
+ wChannels = ft->signal.channels;
+ wBitsPerSample = ft->encoding.bits_per_sample;
+ wSamplesPerBlock = 1; /* common default for PCM data */
+
+ switch (ft->encoding.encoding)
+ {
+ case SOX_ENCODING_UNSIGNED:
+ case SOX_ENCODING_SIGN2:
+ wFormatTag = WAVE_FORMAT_PCM;
+ bytespersample = (wBitsPerSample + 7)/8;
+ wBlockAlign = wChannels * bytespersample;
+ break;
+ case SOX_ENCODING_FLOAT:
+ wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
+ bytespersample = (wBitsPerSample + 7)/8;
+ wBlockAlign = wChannels * bytespersample;
+ break;
+ case SOX_ENCODING_ALAW:
+ wFormatTag = WAVE_FORMAT_ALAW;
+ wBlockAlign = wChannels;
+ break;
+ case SOX_ENCODING_ULAW:
+ wFormatTag = WAVE_FORMAT_MULAW;
+ wBlockAlign = wChannels;
+ break;
+ case SOX_ENCODING_IMA_ADPCM:
+ if (wChannels>16)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Channels(%d) must be <= 16",wChannels);
+ return SOX_EOF;
+ }
+ wFormatTag = WAVE_FORMAT_IMA_ADPCM;
+ wBlockAlign = wChannels * 256; /* reasonable default */
+ wBitsPerSample = 4;
+ wExtSize = 2;
+ wSamplesPerBlock = lsx_ima_samples_in((size_t) 0, (size_t) wChannels, (size_t) wBlockAlign, (size_t) 0);
+ break;
+ case SOX_ENCODING_MS_ADPCM:
+ if (wChannels>16)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Channels(%d) must be <= 16",wChannels);
+ return SOX_EOF;
+ }
+ wFormatTag = WAVE_FORMAT_ADPCM;
+ wBlockAlign = ft->signal.rate / 11008;
+ wBlockAlign = max(wBlockAlign, 1) * wChannels * 256;
+ wBitsPerSample = 4;
+ wExtSize = 4+4*7; /* Ext fmt data length */
+ wSamplesPerBlock = lsx_ms_adpcm_samples_in((size_t) 0, (size_t) wChannels, (size_t) wBlockAlign, (size_t) 0);
+ break;
+ case SOX_ENCODING_GSM:
+ if (wChannels!=1)
+ {
+ lsx_report("Overriding GSM audio from %d channel to 1",wChannels);
+ if (!second_header)
+ ft->signal.length /= max(1, ft->signal.channels);
+ wChannels = ft->signal.channels = 1;
+ }
+ wFormatTag = WAVE_FORMAT_GSM610;
+ /* dwAvgBytesPerSec = 1625*(dwSamplesPerSecond/8000.)+0.5; */
+ wBlockAlign=65;
+ wBitsPerSample=0; /* not representable as int */
+ wExtSize=2; /* length of format extension */
+ wSamplesPerBlock = 320;
+ break;
+ default:
+ break;
+ }
+ wav->formatTag = wFormatTag;
+ wav->blockAlign = wBlockAlign;
+ wav->samplesPerBlock = wSamplesPerBlock;
+
+ /* When creating header, use length hint given by input file. If no
+ * hint then write default value. Also, use default value even
+ * on header update if more then 32-bit length needs to be written.
+ */
+ if ((!second_header && !ft->signal.length) ||
+ wav->numSamples > 0xffffffff) {
+ /* adjust for blockAlign */
+ blocksWritten = MS_UNSPEC/wBlockAlign;
+ dwDataLength = blocksWritten * wBlockAlign;
+ dwSamplesWritten = blocksWritten * wSamplesPerBlock;
+ } else { /* fixup with real length */
+ dwSamplesWritten =
+ second_header? wav->numSamples : ft->signal.length / wChannels;
+ blocksWritten = (dwSamplesWritten+wSamplesPerBlock-1)/wSamplesPerBlock;
+ dwDataLength = blocksWritten * wBlockAlign;
+ }
+
+ if (wFormatTag == WAVE_FORMAT_GSM610)
+ dwDataLength = (dwDataLength+1) & ~1u; /* round up to even */
+
+ if (wFormatTag == WAVE_FORMAT_PCM && (wBitsPerSample > 16 || wChannels > 2)
+ && strcmp(ft->filetype, "wavpcm")) {
+ isExtensible = sox_true;
+ wFmtSize += 2 + 22;
+ }
+ else if (wFormatTag != WAVE_FORMAT_PCM)
+ wFmtSize += 2+wExtSize; /* plus ExtData */
+
+ wRiffLength = 4 + (8+wFmtSize) + (8+dwDataLength+dwDataLength%2);
+ if (isExtensible || wFormatTag != WAVE_FORMAT_PCM) /* PCM omits the "fact" chunk */
+ wRiffLength += (8+dwFactSize);
+
+ /* dwAvgBytesPerSec <-- this is BEFORE compression, isn't it? guess not. */
+ dwAvgBytesPerSec = (double)wBlockAlign*ft->signal.rate / (double)wSamplesPerBlock + 0.5;
+
+ /* figured out header info, so write it */
+
+ /* If user specified opposite swap than we think, assume they are
+ * asking to write a RIFX file.
+ */
+ if (ft->encoding.reverse_bytes == MACHINE_IS_LITTLEENDIAN)
+ {
+ if (!second_header)
+ lsx_report("Requested to swap bytes so writing RIFX header");
+ lsx_writes(ft, "RIFX");
+ }
+ else
+ lsx_writes(ft, "RIFF");
+ lsx_writedw(ft, wRiffLength);
+ lsx_writes(ft, "WAVE");
+ lsx_writes(ft, "fmt ");
+ lsx_writedw(ft, wFmtSize);
+ lsx_writew(ft, isExtensible ? WAVE_FORMAT_EXTENSIBLE : wFormatTag);
+ lsx_writew(ft, wChannels);
+ lsx_writedw(ft, dwSamplesPerSecond);
+ lsx_writedw(ft, dwAvgBytesPerSec);
+ lsx_writew(ft, wBlockAlign);
+ lsx_writew(ft, wBitsPerSample); /* end info common to all fmts */
+
+ if (isExtensible) {
+ uint32_t dwChannelMask=0; /* unassigned speaker mapping by default */
+ static unsigned char const guids[][14] = {
+ "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71", /* wav */
+ "\x00\x00\x21\x07\xd3\x11\x86\x44\xc8\xc1\xca\x00\x00\x00"}; /* amb */
+
+ /* if not amb, assume most likely channel masks from number of channels; not
+ * ideal solution, but will make files playable in many/most situations
+ */
+ if (strcmp(ft->filetype, "amb")) {
+ if (wChannels == 1) dwChannelMask = 0x4; /* 1 channel (mono) = FC */
+ else if (wChannels == 2) dwChannelMask = 0x3; /* 2 channels (stereo) = FL, FR */
+ else if (wChannels == 4) dwChannelMask = 0x33; /* 4 channels (quad) = FL, FR, BL, BR */
+ else if (wChannels == 6) dwChannelMask = 0x3F; /* 6 channels (5.1) = FL, FR, FC, LF, BL, BR */
+ else if (wChannels == 8) dwChannelMask = 0x63F; /* 8 channels (7.1) = FL, FR, FC, LF, BL, BR, SL, SR */
+ }
+
+ lsx_writew(ft, 22);
+ lsx_writew(ft, wBitsPerSample); /* No padding in container */
+ lsx_writedw(ft, dwChannelMask); /* Speaker mapping is something reasonable */
+ lsx_writew(ft, wFormatTag);
+ lsx_writebuf(ft, guids[!strcmp(ft->filetype, "amb")], (size_t)14);
+ }
+ else
+ /* if not PCM, we need to write out wExtSize even if wExtSize=0 */
+ if (wFormatTag != WAVE_FORMAT_PCM)
+ lsx_writew(ft,wExtSize);
+
+ switch (wFormatTag)
+ {
+ int i;
+ case WAVE_FORMAT_IMA_ADPCM:
+ lsx_writew(ft, wSamplesPerBlock);
+ break;
+ case WAVE_FORMAT_ADPCM:
+ lsx_writew(ft, wSamplesPerBlock);
+ lsx_writew(ft, 7); /* nCoefs */
+ for (i=0; i<7; i++) {
+ lsx_writew(ft, (uint16_t)(lsx_ms_adpcm_i_coef[i][0]));
+ lsx_writew(ft, (uint16_t)(lsx_ms_adpcm_i_coef[i][1]));
+ }
+ break;
+ case WAVE_FORMAT_GSM610:
+ lsx_writew(ft, wSamplesPerBlock);
+ break;
+ default:
+ break;
+ }
+
+ /* if not PCM, write the 'fact' chunk */
+ if (isExtensible || wFormatTag != WAVE_FORMAT_PCM){
+ lsx_writes(ft, "fact");
+ lsx_writedw(ft,dwFactSize);
+ lsx_writedw(ft,dwSamplesWritten);
+ }
+
+ lsx_writes(ft, "data");
+ lsx_writedw(ft, dwDataLength); /* data chunk size */
+
+ if (!second_header) {
+ lsx_debug("Writing Wave file: %s format, %d channel%s, %d samp/sec",
+ wav_format_str(wFormatTag), wChannels,
+ wChannels == 1 ? "" : "s", dwSamplesPerSecond);
+ lsx_debug(" %d byte/sec, %d block align, %d bits/samp",
+ dwAvgBytesPerSec, wBlockAlign, wBitsPerSample);
+ } else {
+ lsx_debug("Finished writing Wave file, %u data bytes %lu samples",
+ dwDataLength, (unsigned long)wav->numSamples);
+ if (wFormatTag == WAVE_FORMAT_GSM610){
+ lsx_debug("GSM6.10 format: %li blocks %u padded samples %u padded data bytes",
+ blocksWritten, dwSamplesWritten, dwDataLength);
+ if (wav->gsmbytecount != dwDataLength)
+ lsx_warn("help ! internal inconsistency - data_written %u gsmbytecount %lu",
+ dwDataLength, (unsigned long)wav->gsmbytecount);
+
+ }
+ }
+ return SOX_SUCCESS;
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t *buf, size_t len)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+ ptrdiff_t total_len = len;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ switch (wav->formatTag)
+ {
+ case WAVE_FORMAT_IMA_ADPCM:
+ case WAVE_FORMAT_ADPCM:
+ while (len>0) {
+ short *p = wav->samplePtr;
+ short *top = wav->sampleTop;
+
+ if (top>p+len) top = p+len;
+ len -= top-p; /* update residual len */
+ while (p < top)
+ *p++ = (*buf++) >> 16;
+
+ wav->samplePtr = p;
+ if (p == wav->sampleTop)
+ xxxAdpcmWriteBlock(ft);
+
+ }
+ return total_len - len;
+ break;
+
+ case WAVE_FORMAT_GSM610:
+ len = wavgsmwrite(ft, buf, len);
+ wav->numSamples += (len/ft->signal.channels);
+ return len;
+ break;
+
+ default:
+ len = lsx_rawwrite(ft, buf, len);
+ wav->numSamples += (len/ft->signal.channels);
+ return len;
+ }
+}
+
+static int stopwrite(sox_format_t * ft)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+
+ /* Call this to flush out any remaining data. */
+ switch (wav->formatTag)
+ {
+ case WAVE_FORMAT_IMA_ADPCM:
+ case WAVE_FORMAT_ADPCM:
+ xxxAdpcmWriteBlock(ft);
+ break;
+ case WAVE_FORMAT_GSM610:
+ wavgsmstopwrite(ft);
+ break;
+ }
+
+ /* Add a pad byte if the number of data bytes is odd.
+ See wavwritehdr() above for the calculation. */
+ if (wav->formatTag != WAVE_FORMAT_GSM610)
+ lsx_padbytes(ft, (size_t)((wav->numSamples + wav->samplesPerBlock - 1)/wav->samplesPerBlock*wav->blockAlign) % 2);
+
+ free(wav->packet);
+ free(wav->samples);
+ free(wav->lsx_ms_adpcm_i_coefs);
+
+ /* All samples are already written out. */
+ /* If file header needs fixing up, for example it needs the */
+ /* the number of samples in a field, seek back and write them here. */
+ if (ft->signal.length && wav->numSamples <= 0xffffffff &&
+ wav->numSamples == ft->signal.length)
+ return SOX_SUCCESS;
+ if (!ft->seekable)
+ return SOX_EOF;
+
+ if (lsx_seeki(ft, (off_t)0, SEEK_SET) != 0)
+ {
+ lsx_fail_errno(ft,SOX_EOF,"Can't rewind output file to rewrite .wav header.");
+ return SOX_EOF;
+ }
+
+ return (wavwritehdr(ft, 1));
+}
+
+/*
+ * Return a string corresponding to the wave format type.
+ */
+static char *wav_format_str(unsigned wFormatTag)
+{
+ switch (wFormatTag)
+ {
+ case WAVE_FORMAT_UNKNOWN:
+ return "Microsoft Official Unknown";
+ case WAVE_FORMAT_PCM:
+ return "Microsoft PCM";
+ case WAVE_FORMAT_ADPCM:
+ return "Microsoft ADPCM";
+ case WAVE_FORMAT_IEEE_FLOAT:
+ return "IEEE Float";
+ case WAVE_FORMAT_ALAW:
+ return "Microsoft A-law";
+ case WAVE_FORMAT_MULAW:
+ return "Microsoft U-law";
+ case WAVE_FORMAT_OKI_ADPCM:
+ return "OKI ADPCM format.";
+ case WAVE_FORMAT_IMA_ADPCM:
+ return "IMA ADPCM";
+ case WAVE_FORMAT_DIGISTD:
+ return "Digistd format.";
+ case WAVE_FORMAT_DIGIFIX:
+ return "Digifix format.";
+ case WAVE_FORMAT_DOLBY_AC2:
+ return "Dolby AC2";
+ case WAVE_FORMAT_GSM610:
+ return "GSM 6.10";
+ case WAVE_FORMAT_ROCKWELL_ADPCM:
+ return "Rockwell ADPCM";
+ case WAVE_FORMAT_ROCKWELL_DIGITALK:
+ return "Rockwell DIGITALK";
+ case WAVE_FORMAT_G721_ADPCM:
+ return "G.721 ADPCM";
+ case WAVE_FORMAT_G728_CELP:
+ return "G.728 CELP";
+ case WAVE_FORMAT_MPEG:
+ return "MPEG";
+ case WAVE_FORMAT_MPEGLAYER3:
+ return "MPEG Layer 3";
+ case WAVE_FORMAT_G726_ADPCM:
+ return "G.726 ADPCM";
+ case WAVE_FORMAT_G722_ADPCM:
+ return "G.722 ADPCM";
+ default:
+ return "Unknown";
+ }
+}
+
+static int seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * wav = (priv_t *) ft->priv;
+
+ if (ft->encoding.bits_per_sample & 7)
+ lsx_fail_errno(ft, SOX_ENOTSUP, "seeking not supported with this encoding");
+ else if (wav->formatTag == WAVE_FORMAT_GSM610) {
+ int alignment;
+ size_t gsmoff;
+
+ /* rounding bytes to blockAlign so that we
+ * don't have to decode partial block. */
+ gsmoff = offset * wav->blockAlign / wav->samplesPerBlock +
+ wav->blockAlign * ft->signal.channels / 2;
+ gsmoff -= gsmoff % (wav->blockAlign * ft->signal.channels);
+
+ ft->sox_errno = lsx_seeki(ft, (off_t)(gsmoff + wav->dataStart), SEEK_SET);
+ if (ft->sox_errno == SOX_SUCCESS) {
+ /* offset is in samples */
+ uint64_t new_offset = offset;
+ alignment = offset % wav->samplesPerBlock;
+ if (alignment != 0)
+ new_offset += (wav->samplesPerBlock - alignment);
+ wav->numSamples = ft->signal.length - (new_offset / ft->signal.channels);
+ }
+ } else {
+ double wide_sample = offset - (offset % ft->signal.channels);
+ double to_d = wide_sample * ft->encoding.bits_per_sample / 8;
+ off_t to = to_d;
+ ft->sox_errno = (to != to_d)? SOX_EOF : lsx_seeki(ft, (off_t)wav->dataStart + (off_t)to, SEEK_SET);
+ if (ft->sox_errno == SOX_SUCCESS)
+ wav->numSamples -= (size_t)wide_sample / ft->signal.channels;
+ }
+
+ return ft->sox_errno;
+}
+
+LSX_FORMAT_HANDLER(wav)
+{
+ static char const * const names[] = {"wav", "wavpcm", "amb", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 16, 24, 32, 0,
+ SOX_ENCODING_UNSIGNED, 8, 0,
+ SOX_ENCODING_ULAW, 8, 0,
+ SOX_ENCODING_ALAW, 8, 0,
+ SOX_ENCODING_GSM, 0,
+ SOX_ENCODING_MS_ADPCM, 4, 0,
+ SOX_ENCODING_IMA_ADPCM, 4, 0,
+ SOX_ENCODING_FLOAT, 32, 64, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Microsoft audio format", names, SOX_FILE_LIT_END,
+ startread, read_samples, stopread,
+ startwrite, write_samples, stopwrite,
+ seek, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/waveaudio.c b/src/src/waveaudio.c
new file mode 100644
index 0000000..88bae2c
--- /dev/null
+++ b/src/src/waveaudio.c
@@ -0,0 +1,534 @@
+/* libSoX device driver: MS-Windows audio (c) 2009 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <windows.h>
+#include <mmsystem.h>
+#include <mmreg.h>
+
+/* Larger means more latency (difference between the status line and the audio you hear),
+ * but it means lower chance of stuttering/glitching. 2 buffers is usually enough. Use
+ * 4 if you want to be extra-safe.
+ */
+#define num_buffers 4
+
+typedef struct waveaudio_priv_t
+{
+ /* Handle to the input device (microphone, line in, etc.). NULL if playing. */
+ HWAVEIN hin;
+
+ /* Handle to the output device (speakers, line out, etc.). NULL if recording. */
+ HWAVEOUT hout;
+
+ /* Event that becomes signaled when a the system has finished processing a buffer. */
+ HANDLE block_finished_event;
+
+ /* Data transfer buffers. The lpData member of the first buffer points at
+ * data[buf_len*sample_size*0], the second buffer's lpData points at
+ * data[buf_len*sample_size*1], etc. The dwUser field contains the number
+ * of samples of this buffer that have already been processed.
+ */
+ WAVEHDR headers[num_buffers];
+
+ /* The combined data area shared by all transfer buffers.
+ * size = (bufsiz rounded up to a multiple of 32 samples) * num_buffers.
+ */
+ char * data;
+
+ /* The number of samples that can fit into one transfer buffer. */
+ size_t buf_len;
+
+ /* Index of the buffer that we're currently processing. For playback, this is the buffer
+ * that will receive the next samples. For recording, this is the buffer from which we'll
+ * be getting the next samples. If no buffers are ready for processing, this is the buffer
+ * that will be the next to become ready.
+ */
+ unsigned current;
+
+ /* Shift sample count by this many to get byte count:
+ * 0 for 8-bit samples, 1 for 16-bit samples, or 2 for 32-bit samples.
+ */
+ unsigned char sample_shift;
+} priv_t;
+
+static void fail(sox_format_t* ft, unsigned code, const char* context)
+{
+ char message[256];
+ unsigned formatMessageOk = FormatMessageA(
+ FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ code,
+ 0,
+ message,
+ sizeof(message) / sizeof(message[0]),
+ NULL);
+ if (formatMessageOk)
+ lsx_fail_errno(ft, SOX_EOF, "WaveAudio %s failed with code %d: %s", context, (int)code, message);
+ else
+ lsx_fail_errno(ft, SOX_EOF, "WaveAudio %s failed with unrecognized MMSYSERR code: %d", context, (int)code);
+}
+
+static int stop(sox_format_t* ft)
+{
+ priv_t *priv = (priv_t*)ft->priv;
+ if (priv == NULL) return SOX_EOF;
+
+ if (priv->hin)
+ {
+ waveInReset(priv->hin);
+ waveInClose(priv->hin);
+ }
+
+ if (priv->hout)
+ {
+ waveOutReset(priv->hout);
+ waveOutClose(priv->hout);
+ }
+
+ if (priv->block_finished_event)
+ CloseHandle(priv->block_finished_event);
+
+ if (priv->data)
+ free(priv->data);
+
+ return SOX_SUCCESS;
+}
+
+static unsigned check_format(
+ WAVEFORMATEXTENSIBLE* pfmt,
+ int recording,
+ unsigned dev,
+ unsigned channels,
+ unsigned width,
+ unsigned hertz)
+{
+ /* GUID: KSDATAFORMAT_SUBTYPE_PCM */
+ static unsigned char const SubformatPcm[] =
+ "\x01\x00\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71";
+
+ const unsigned bytewidth = width > 16 ? 4 : width > 8 ? 2 : 1;
+ const int extend = channels > 2 || width > 16;
+ unsigned error;
+
+ pfmt->Format.wFormatTag = extend ? WAVE_FORMAT_EXTENSIBLE : WAVE_FORMAT_PCM;
+ pfmt->Format.nChannels = channels;
+ pfmt->Format.nSamplesPerSec = hertz;
+ pfmt->Format.nAvgBytesPerSec = channels * bytewidth * hertz;
+ pfmt->Format.nBlockAlign = channels * bytewidth;
+ pfmt->Format.wBitsPerSample = bytewidth * 8;
+ pfmt->Format.cbSize = extend ? 22 : 0;
+ pfmt->Samples.wValidBitsPerSample = width;
+ pfmt->dwChannelMask = 0;
+ memcpy(&pfmt->SubFormat, SubformatPcm, 16);
+
+ if (recording)
+ error = waveInOpen(0, dev, &pfmt->Format, 0, 0, WAVE_FORMAT_QUERY);
+ else
+ error = waveOutOpen(0, dev, &pfmt->Format, 0, 0, WAVE_FORMAT_QUERY);
+
+ lsx_debug(
+ "%s(QUERY: Dev %d %uHz %uCh %uPrec %uWide) returned %u",
+ recording ? "waveInOpen" : "waveOutOpen",
+ dev,
+ hertz,
+ channels,
+ bytewidth * 8,
+ width,
+ error);
+ return error;
+}
+
+static unsigned negotiate_format(sox_format_t* ft, WAVEFORMATEXTENSIBLE* pfmt, unsigned dev)
+{
+ int recording = ft->mode == 'r';
+ unsigned error = 0;
+
+ unsigned precision = ft->encoding.bits_per_sample;
+ if (precision > 32)
+ precision = 32;
+ else if (precision < 8)
+ precision = 8;
+
+ while (precision > 0)
+ {
+ error = check_format(pfmt, recording, dev, ft->signal.channels, precision, (unsigned)ft->signal.rate);
+ if (error == MMSYSERR_NOERROR)
+ return MMSYSERR_NOERROR;
+ precision = (precision - 1) & ~(7u);
+ }
+
+ return error;
+}
+
+static int start(sox_format_t* ft)
+{
+ size_t i;
+ unsigned dev;
+ WAVEFORMATEXTENSIBLE fmt;
+ int recording = ft->mode == 'r';
+ unsigned error;
+ priv_t *priv = (priv_t*)ft->priv;
+ if (priv == NULL) return SOX_EOF;
+ memset(&fmt, 0, sizeof(fmt));
+
+ /* Handle AUDIODEV device selection:
+ * NULL, blank, or "default" gets you the default device (WAVE_MAPPER = -1).
+ * An integer value gets you the device with that device number, if it exists (counting starts at 0).
+ * A string gets you the device with that name, if it exists.
+ */
+ if (ft->filename == 0 || ft->filename[0] == 0 || !strcasecmp("default", ft->filename))
+ {
+ dev = WAVE_MAPPER;
+ }
+ else
+ {
+ WAVEINCAPSA incaps;
+ WAVEOUTCAPSA outcaps;
+ const char *dev_name;
+ char* dev_num_end;
+ dev = strtoul(ft->filename, &dev_num_end, 0);
+ if (dev_num_end[0] == 0)
+ {
+ if (recording)
+ error = waveInGetDevCapsA(dev, &incaps, sizeof(incaps));
+ else
+ error = waveOutGetDevCapsA(dev, &outcaps, sizeof(outcaps));
+
+ if (error)
+ {
+ lsx_fail_errno(ft, ENODEV, "WaveAudio device not found.");
+ return SOX_EOF;
+ }
+ }
+ else
+ {
+ unsigned dev_count = recording ? waveInGetNumDevs() : waveOutGetNumDevs();
+ size_t name_len = strlen(ft->filename);
+ if (name_len > 31)
+ name_len = 31;
+ for (dev = WAVE_MAPPER; dev != dev_count; dev++)
+ {
+ if (recording)
+ {
+ error = waveInGetDevCapsA(dev, &incaps, sizeof(incaps));
+ dev_name = incaps.szPname;
+ lsx_debug("Enumerating input device %2d: \"%s\"", dev, dev_name);
+ }
+ else
+ {
+ error = waveOutGetDevCapsA(dev, &outcaps, sizeof(outcaps));
+ dev_name = outcaps.szPname;
+ lsx_debug("Enumerating output device %2d: \"%s\"", dev, dev_name);
+ }
+
+ if (error)
+ {
+ fail(ft, error, recording ? "waveInGetDevCapsA" : "waveOutGetDevCapsA");
+ return SOX_EOF;
+ }
+
+ if (!strncasecmp(ft->filename, dev_name, name_len))
+ {
+ lsx_report("Requested name \"%s\" matched device %d: \"%s\"", ft->filename, dev, dev_name);
+ break;
+ }
+ }
+
+ if (dev == dev_count)
+ {
+ lsx_fail_errno(ft, ENODEV, "The requested WaveAudio device was not found.");
+ return SOX_EOF;
+ }
+ }
+ }
+
+ error = negotiate_format(ft, &fmt, dev);
+ if (error != MMSYSERR_NOERROR)
+ {
+ fail(ft, error, "sample format negotiation");
+ return SOX_EOF;
+ }
+
+ switch (fmt.Format.wBitsPerSample)
+ {
+ case 8:
+ priv->sample_shift = 0;
+ break;
+ case 16:
+ priv->sample_shift = 1;
+ break;
+ case 32:
+ priv->sample_shift = 2;
+ break;
+ default:
+ lsx_fail_errno(ft, E2BIG, "Unexpected value for WaveAudio wBitsPerSample: %u", fmt.Format.wBitsPerSample);
+ return SOX_EOF;
+ }
+
+ ft->signal.precision = fmt.Samples.wValidBitsPerSample;
+ ft->signal.channels = fmt.Format.nChannels;
+ if (dev == WAVE_MAPPER)
+ {
+ lsx_report(
+ "Using default %s device at %uHz %uCh %uPrec %uWide.",
+ recording ? "input" : "output",
+ (unsigned)fmt.Format.nSamplesPerSec,
+ (unsigned)fmt.Format.nChannels,
+ (unsigned)fmt.Samples.wValidBitsPerSample,
+ (unsigned)fmt.Format.wBitsPerSample);
+ }
+ else
+ {
+ lsx_report(
+ "Using %s device #%d at %uHz %uCh %uPrec %uWide.",
+ recording ? "input" : "output",
+ (int)dev,
+ (unsigned)fmt.Format.nSamplesPerSec,
+ (unsigned)fmt.Format.nChannels,
+ (unsigned)fmt.Samples.wValidBitsPerSample,
+ (unsigned)fmt.Format.wBitsPerSample);
+ }
+
+ priv->buf_len = ((sox_globals.bufsiz >> priv->sample_shift) + 31) & ~31u;
+ priv->data = lsx_malloc((priv->buf_len * num_buffers) << priv->sample_shift);
+ if (!priv->data)
+ {
+ lsx_fail_errno(ft, SOX_ENOMEM, "Out of memory.");
+ return SOX_EOF;
+ }
+
+ priv->block_finished_event = CreateEventA(NULL, FALSE, FALSE, NULL);
+ if (!priv->block_finished_event)
+ {
+ error = GetLastError();
+ fail(ft, error, "CreateEventA");
+ stop(ft);
+ return SOX_EOF;
+ }
+
+ if (recording)
+ {
+ error = waveInOpen(
+ &priv->hin,
+ dev,
+ &fmt.Format,
+ (DWORD_PTR)priv->block_finished_event,
+ 0,
+ CALLBACK_EVENT);
+ }
+ else
+ {
+ error = waveOutOpen(
+ &priv->hout,
+ dev,
+ &fmt.Format,
+ (DWORD_PTR)priv->block_finished_event,
+ 0,
+ CALLBACK_EVENT);
+ }
+
+ if (error != MMSYSERR_NOERROR)
+ {
+ fail(ft, error, recording ? "waveInOpen" : "waveOutOpen");
+ stop(ft);
+ return SOX_EOF;
+ }
+
+ for (i = 0; i != num_buffers; i++)
+ {
+ priv->headers[i].lpData = priv->data + ((priv->buf_len * i) << priv->sample_shift);
+ priv->headers[i].dwBufferLength = priv->buf_len << priv->sample_shift;
+
+ if (recording)
+ error = waveInPrepareHeader(priv->hin, &priv->headers[i], sizeof(priv->headers[i]));
+ else
+ error = waveOutPrepareHeader(priv->hout, &priv->headers[i], sizeof(priv->headers[i]));
+
+ if (error != MMSYSERR_NOERROR)
+ {
+ fail(ft, error, recording ? "waveInPrepareHeader" : "waveOutPrepareHeader");
+ stop(ft);
+ return SOX_EOF;
+ }
+
+ if (recording)
+ {
+ error = waveInAddBuffer(priv->hin, &priv->headers[i], sizeof(priv->headers[i]));
+ if (error != MMSYSERR_NOERROR)
+ {
+ fail(ft, error, "waveInAddBuffer");
+ stop(ft);
+ return SOX_EOF;
+ }
+ }
+ }
+
+ if (recording)
+ {
+ error = waveInStart(priv->hin);
+ if (error != MMSYSERR_NOERROR)
+ {
+ fail(ft, error, "waveInStart");
+ stop(ft);
+ return SOX_EOF;
+ }
+ }
+
+ return SOX_SUCCESS;
+}
+
+static size_t waveread(sox_format_t * ft, sox_sample_t* buf, size_t len)
+{
+ size_t copied = 0;
+ priv_t *priv = (priv_t*)ft->priv;
+ unsigned error = 0;
+
+ if (priv == NULL)
+ return (size_t)SOX_EOF;
+
+ while (!error && copied < len)
+ {
+ LPWAVEHDR header = &priv->headers[priv->current];
+ if (0 == (header->dwFlags & WHDR_INQUEUE) ||
+ 0 != (header->dwFlags & WHDR_DONE))
+ {
+ size_t length = header->dwBytesRecorded >> priv->sample_shift;
+ size_t ready = min(len - copied, length - header->dwUser);
+ size_t i;
+
+ switch (priv->sample_shift)
+ {
+ case 0:
+ for (i = 0; i < ready; ++i)
+ {
+ buf[copied++] = SOX_UNSIGNED_8BIT_TO_SAMPLE(((uint8_t *)header->lpData)[header->dwUser++], dummy);
+ }
+ break;
+ case 1:
+ for (i = 0; i < ready; ++i)
+ {
+ buf[copied++] = SOX_SIGNED_16BIT_TO_SAMPLE(((int16_t *)header->lpData)[header->dwUser++], dummy);
+ }
+ break;
+ case 2:
+ for (i = 0; i < ready; ++i)
+ {
+ buf[copied++] = SOX_SIGNED_32BIT_TO_SAMPLE(((int32_t *)header->lpData)[header->dwUser++], dummy);
+ }
+ break;
+ }
+
+ if (header->dwUser == length)
+ {
+ error = waveInAddBuffer(priv->hin, header, sizeof(*header));
+ priv->current = (priv->current + 1) % num_buffers;
+ priv->headers[priv->current].dwUser = 0;
+ if (error)
+ {
+ fail(ft, error, "waveInAddBuffer");
+ copied = 0;
+ }
+ }
+ }
+ else
+ {
+ WaitForSingleObject(priv->block_finished_event, INFINITE);
+ }
+ }
+
+ return copied;
+}
+
+static size_t wavewrite(sox_format_t * ft, const sox_sample_t* buf, size_t len)
+{
+ size_t copied = 0;
+ priv_t *priv = (priv_t*)ft->priv;
+ unsigned error = 0;
+ unsigned clips = 0;
+
+ if (priv == NULL)
+ return (size_t)SOX_EOF;
+
+ while (!error && copied < len)
+ {
+ LPWAVEHDR header = &priv->headers[priv->current];
+ if (0 == (header->dwFlags & WHDR_INQUEUE) ||
+ 0 != (header->dwFlags & WHDR_DONE))
+ {
+ size_t ready = min(len - copied, priv->buf_len - header->dwUser);
+ size_t i;
+
+ switch (priv->sample_shift)
+ {
+ case 0:
+ for (i = 0; i < ready; ++i)
+ {
+ SOX_SAMPLE_LOCALS;
+ ((uint8_t *)header->lpData)[header->dwUser++] = SOX_SAMPLE_TO_UNSIGNED_8BIT(buf[copied++], clips);
+ }
+ break;
+ case 1:
+ for (i = 0; i < ready; ++i)
+ {
+ SOX_SAMPLE_LOCALS;
+ ((int16_t *)header->lpData)[header->dwUser++] = SOX_SAMPLE_TO_SIGNED_16BIT(buf[copied++], clips);
+ }
+ break;
+ case 2:
+ for (i = 0; i < ready; ++i)
+ {
+ ((int32_t *)header->lpData)[header->dwUser++] = SOX_SAMPLE_TO_SIGNED_32BIT(buf[copied++], clips);
+ }
+ break;
+ }
+
+ header->dwBufferLength = header->dwUser << priv->sample_shift;
+ error = waveOutWrite(priv->hout, header, sizeof(*header));
+ priv->current = (priv->current + 1) % num_buffers;
+ priv->headers[priv->current].dwUser = 0;
+
+ if (error)
+ {
+ fail(ft, error, "waveOutWrite");
+ copied = 0;
+ }
+ }
+ else
+ {
+ WaitForSingleObject(priv->block_finished_event, INFINITE);
+ }
+ }
+
+ return copied;
+}
+
+LSX_FORMAT_HANDLER(waveaudio)
+{
+ static const char * const names[] = {"waveaudio", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_SIGN2, 32, 24, 16, 8, 0,
+ 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Windows Multimedia Audio", names,
+ SOX_FILE_DEVICE | SOX_FILE_NOSTDIO,
+ start, waveread, stop,
+ start, wavewrite, stop,
+ NULL, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/wavpack.c b/src/src/wavpack.c
new file mode 100644
index 0000000..69a584a
--- /dev/null
+++ b/src/src/wavpack.c
@@ -0,0 +1,198 @@
+/* libSoX file format: WavPack (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#ifdef HAVE_WAVPACK_H
+#define HAVE_WAVPACK 1
+#endif
+
+#ifdef HAVE_WAVPACK
+
+#ifdef HAVE_WAVPACK_H
+#include <wavpack.h>
+#else
+#include <wavpack/wavpack.h>
+#endif
+
+typedef struct {
+ WavpackContext * codec;
+ size_t first_block_size;
+} priv_t;
+
+static int32_t ft_read_b_buf(void * ft, void * buf, int32_t len) {
+ return (int32_t)lsx_read_b_buf((sox_format_t *)ft, buf, (size_t)len);}
+static uint32_t ft_tell(void * ft) {
+ return lsx_tell((sox_format_t *)ft);}
+static int ft_seek_abs(void * ft, uint32_t offset) {
+ return lsx_seeki((sox_format_t *)ft, (off_t)offset, SEEK_SET);}
+static int ft_seek_rel(void * ft, int32_t offset, int mode) {
+ return lsx_seeki((sox_format_t *)ft, (off_t)offset, mode);}
+static int ft_unreadb(void * ft, int b) {
+ return lsx_unreadb((sox_format_t *)ft, (unsigned)b);}
+static uint32_t ft_filelength(void * ft) {
+ return (uint32_t)lsx_filelength((sox_format_t *)ft);}
+static int ft_is_seekable(void *ft) {
+ return ((sox_format_t *)ft)->seekable;}
+static int32_t ft_write_b_buf(void * ft, void * buf, int32_t len) {
+ priv_t * p = (priv_t *)((sox_format_t *)ft)->priv;
+ if (!p->first_block_size)
+ p->first_block_size = len;
+ return (int32_t)lsx_write_b_buf((sox_format_t *)ft, buf, (size_t)len);}
+
+static WavpackStreamReader io_fns = {
+ ft_read_b_buf, ft_tell, ft_seek_abs, ft_seek_rel,
+ ft_unreadb, ft_filelength, ft_is_seekable, ft_write_b_buf
+};
+
+static int start_read(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ char msg[80];
+
+ p->codec = WavpackOpenFileInputEx(&io_fns, ft, NULL, msg, OPEN_NORMALIZE, 0);
+ ft->encoding.bits_per_sample = WavpackGetBytesPerSample(p->codec) << 3;
+ ft->signal.channels = WavpackGetNumChannels(p->codec);
+ if (WavpackGetSampleRate(p->codec) && ft->signal.rate && ft->signal.rate != WavpackGetSampleRate(p->codec))
+ lsx_warn("`%s': overriding sample rate", ft->filename);
+ else ft->signal.rate = WavpackGetSampleRate(p->codec);
+
+ ft->signal.length = (uint64_t)WavpackGetNumSamples(p->codec) * ft->signal.channels;
+ ft->encoding.encoding = (WavpackGetMode(p->codec) & MODE_FLOAT)?
+ SOX_ENCODING_WAVPACKF : SOX_ENCODING_WAVPACK;
+ return SOX_SUCCESS;
+}
+
+static size_t read_samples(sox_format_t * ft, sox_sample_t * buf, size_t len)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t i, actual = WavpackUnpackSamples(p->codec, buf, (uint32_t) len / ft->signal.channels) * ft->signal.channels;
+ for (i = 0; i < actual; ++i) switch (ft->encoding.bits_per_sample) {
+ SOX_SAMPLE_LOCALS;
+ case 8: buf[i] = SOX_SIGNED_8BIT_TO_SAMPLE(buf[i],); break;
+ case 16: buf[i] = SOX_SIGNED_16BIT_TO_SAMPLE(buf[i],); break;
+ case 24: buf[i] = SOX_SIGNED_24BIT_TO_SAMPLE(buf[i],); break;
+ case 32: buf[i] = ft->encoding.encoding == SOX_ENCODING_WAVPACKF?
+ SOX_FLOAT_32BIT_TO_SAMPLE(*(float *)&buf[i], ft->clips) :
+ SOX_SIGNED_32BIT_TO_SAMPLE(buf[i],);
+ break;
+ }
+ return actual;
+}
+
+static int stop_read(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ WavpackCloseFile(p->codec);
+ return SOX_SUCCESS;
+}
+
+static int start_write(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ WavpackConfig config;
+ uint64_t size64;
+
+ p->codec = WavpackOpenFileOutput(ft_write_b_buf, ft, NULL);
+ memset(&config, 0, sizeof(config));
+ config.bytes_per_sample = ft->encoding.bits_per_sample >> 3;
+ config.bits_per_sample = ft->encoding.bits_per_sample;
+ config.channel_mask = ft->signal.channels == 1? 4 :
+ ft->signal.channels == 2? 3 : (1 << ft->signal.channels) - 1;
+ config.num_channels = ft->signal.channels;
+ config.sample_rate = (int32_t)(ft->signal.rate + .5);
+ config.flags = CONFIG_VERY_HIGH_FLAG;
+ size64 = ft->signal.length / ft->signal.channels;
+ if (!WavpackSetConfiguration(p->codec, &config, size64 && size64 <= UINT_MAX ? (uint32_t)size64 : (uint32_t)-1)) {
+ lsx_fail_errno(ft, SOX_EHDR, "%s", WavpackGetErrorMessage(p->codec));
+ return SOX_EOF;
+ }
+ WavpackPackInit(p->codec);
+ return SOX_SUCCESS;
+}
+
+static size_t write_samples(sox_format_t * ft, const sox_sample_t * buf, size_t len)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ size_t i;
+ int32_t * obuf = lsx_malloc(len * sizeof(*obuf));
+ int result;
+
+ for (i = 0; i < len; ++i) switch (ft->encoding.bits_per_sample) {
+ SOX_SAMPLE_LOCALS;
+ case 8: obuf[i] = SOX_SAMPLE_TO_SIGNED_8BIT(buf[i], ft->clips); break;
+ case 16: obuf[i] = SOX_SAMPLE_TO_SIGNED_16BIT(buf[i], ft->clips); break;
+ case 24: obuf[i] = SOX_SAMPLE_TO_SIGNED_24BIT(buf[i], ft->clips) << 8;
+ obuf[i] >>= 8; break;
+ case 32: obuf[i] = ft->encoding.encoding == SOX_ENCODING_WAVPACKF?
+ SOX_SAMPLE_TO_SIGNED_24BIT(*(float *)&buf[i], ft->clips) :
+ SOX_SAMPLE_TO_SIGNED_32BIT(buf[i], ft->clips);
+ break;
+ }
+ result = WavpackPackSamples(p->codec, obuf, (uint32_t) len / ft->signal.channels);
+ free(obuf);
+ return result? len : 0;
+}
+
+static int stop_write(sox_format_t * ft)
+{
+ priv_t * p = (priv_t *)ft->priv;
+ WavpackFlushSamples(p->codec);
+ if (!WavpackFlushSamples(p->codec)) {
+ lsx_fail_errno(ft, SOX_EINVAL, "%s", WavpackGetErrorMessage(p->codec));
+ return SOX_EOF;
+ }
+ if (ft->seekable && WavpackGetNumSamples(p->codec) != WavpackGetSampleIndex(p->codec) && p->first_block_size >= 4) {
+ char * buf = lsx_malloc(p->first_block_size);
+ lsx_rewind(ft);
+ lsx_readchars(ft, buf, p->first_block_size);
+ if (!memcmp(buf, "wvpk", (size_t)4)) {
+ WavpackUpdateNumSamples(p->codec, buf);
+ lsx_rewind(ft);
+ lsx_writebuf(ft, buf, p->first_block_size);
+ }
+ free(buf);
+ }
+ p->codec = WavpackCloseFile(p->codec);
+ return SOX_SUCCESS;
+}
+
+static int seek(sox_format_t * ft, uint64_t offset)
+{
+ priv_t * p = (priv_t *)ft->priv;
+
+ return WavpackSeekSample(p->codec, (uint32_t) (offset / ft->signal.channels))? SOX_SUCCESS : SOX_EOF;
+}
+
+LSX_FORMAT_HANDLER(wavpack)
+{
+ static char const * const names[] = {"wv", NULL};
+ static unsigned const write_encodings[] = {
+ SOX_ENCODING_WAVPACK, 8, 16, 24, 32, 0,
+ SOX_ENCODING_WAVPACKF, 32, 0,
+ 0};
+ static sox_format_handler_t handler = {SOX_LIB_VERSION_CODE,
+ "Lossless, lossy, and hybrid audio compression",
+ names, 0,
+ start_read, read_samples, stop_read,
+ start_write, write_samples, stop_write,
+ seek, write_encodings, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
+
+#endif /* HAVE_WAVPACK */
diff --git a/src/src/win32-glob.c b/src/src/win32-glob.c
new file mode 100644
index 0000000..7ac09f7
--- /dev/null
+++ b/src/src/win32-glob.c
@@ -0,0 +1,169 @@
+/* libSoX minimal glob for MS-Windows: (c) 2009 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/win32-glob.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+
+typedef struct file_entry
+{
+ char name[MAX_PATH];
+ struct file_entry *next;
+} file_entry;
+
+static int
+insert(
+ const char* path,
+ const char* name,
+ file_entry** phead)
+{
+ int len;
+ file_entry* cur = malloc(sizeof(file_entry));
+ if (!cur)
+ {
+ return ENOMEM;
+ }
+
+ len = _snprintf(cur->name, MAX_PATH, "%s%s", path, name);
+ cur->name[MAX_PATH - 1] = 0;
+ cur->next = *phead;
+ *phead = cur;
+
+ return len < 0 || len >= MAX_PATH ? ENAMETOOLONG : 0;
+}
+
+static int
+entry_comparer(
+ const void* pv1,
+ const void* pv2)
+{
+ const file_entry* const * pe1 = pv1;
+ const file_entry* const * pe2 = pv2;
+ return _stricmp((*pe1)->name, (*pe2)->name);
+}
+
+int
+glob(
+ const char *pattern,
+ int flags,
+ void *unused,
+ glob_t *pglob)
+{
+ char path[MAX_PATH];
+ file_entry *head = NULL;
+ int err = 0;
+ size_t len;
+ unsigned entries = 0;
+ WIN32_FIND_DATAA finddata;
+ HANDLE hfindfile = FindFirstFileA(pattern, &finddata);
+
+ if (!pattern || flags != (flags & GLOB_FLAGS) || unused || !pglob)
+ {
+ errno = EINVAL;
+ return EINVAL;
+ }
+
+ path[MAX_PATH - 1] = 0;
+ strncpy(path, pattern, MAX_PATH);
+ if (path[MAX_PATH - 1] != 0)
+ {
+ errno = ENAMETOOLONG;
+ return ENAMETOOLONG;
+ }
+
+ len = strlen(path);
+ while (len > 0 && path[len - 1] != '/' && path[len - 1] != '\\')
+ len--;
+ path[len] = 0;
+
+ if (hfindfile == INVALID_HANDLE_VALUE)
+ {
+ if (flags & GLOB_NOCHECK)
+ {
+ err = insert("", pattern, &head);
+ entries++;
+ }
+ }
+ else
+ {
+ do
+ {
+ err = insert(path, finddata.cFileName, &head);
+ entries++;
+ } while (!err && FindNextFileA(hfindfile, &finddata));
+
+ FindClose(hfindfile);
+ }
+
+ if (err == 0)
+ {
+ pglob->gl_pathv = malloc((entries + 1) * sizeof(char*));
+ if (pglob->gl_pathv)
+ {
+ pglob->gl_pathc = entries;
+ pglob->gl_pathv[entries] = NULL;
+ for (; head; head = head->next, entries--)
+ pglob->gl_pathv[entries - 1] = (char*)head;
+ qsort(pglob->gl_pathv, pglob->gl_pathc, sizeof(char*), entry_comparer);
+ }
+ else
+ {
+ pglob->gl_pathc = 0;
+ err = ENOMEM;
+ }
+ }
+ else if (pglob)
+ {
+ pglob->gl_pathc = 0;
+ pglob->gl_pathv = NULL;
+ }
+
+ if (err)
+ {
+ file_entry *cur;
+ while (head)
+ {
+ cur = head;
+ head = head->next;
+ free(cur);
+ }
+
+ errno = err;
+ }
+
+ return err;
+}
+
+void
+globfree(
+ glob_t* pglob)
+{
+ if (pglob)
+ {
+ char** cur;
+ for (cur = pglob->gl_pathv; *cur; cur++)
+ {
+ free(*cur);
+ }
+
+ pglob->gl_pathc = 0;
+ pglob->gl_pathv = NULL;
+ }
+}
diff --git a/src/src/win32-glob.h b/src/src/win32-glob.h
new file mode 100644
index 0000000..30f4179
--- /dev/null
+++ b/src/src/win32-glob.h
@@ -0,0 +1,49 @@
+/* libSoX minimal glob for MS-Windows: (c) 2009 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef GLOB_H
+#define GLOB_H 1
+
+#define GLOB_NOCHECK (16)
+#define GLOB_FLAGS (GLOB_NOCHECK)
+
+typedef struct glob_t
+{
+ unsigned gl_pathc;
+ char **gl_pathv;
+} glob_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int
+glob(
+ const char *pattern,
+ int flags,
+ void *unused,
+ glob_t *pglob);
+
+void
+globfree(
+ glob_t* pglob);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef GLOB_H */
diff --git a/src/src/win32-ltdl.c b/src/src/win32-ltdl.c
new file mode 100644
index 0000000..083be53
--- /dev/null
+++ b/src/src/win32-ltdl.c
@@ -0,0 +1,385 @@
+/* libSoX minimal libtool-ltdl for MS-Windows: (c) 2009 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/win32-ltdl.h"
+#include <stdio.h>
+#include <stdlib.h>
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+
+#ifndef _countof
+#define _countof(A) (sizeof(A)/sizeof((A)[0]))
+#endif
+
+static DWORD
+s_dwLastError;
+
+static char
+s_szLastError[MAX_PATH];
+
+static char
+s_szSearchPath[MAX_PATH];
+
+static int
+CopyPath(
+ const char* szSource,
+ char* szDest,
+ unsigned cchDest,
+ int chStop)
+{
+ unsigned i = 0;
+ char ch;
+ if (szSource != 0 && cchDest != 0)
+ {
+ for (; i < cchDest - 1 && (ch = szSource[i]) != 0 && ch != chStop; i++)
+ {
+ if (ch == '/')
+ {
+ ch = '\\';
+ }
+
+ szDest[i] = ch;
+ }
+ }
+
+ if (cchDest != 0)
+ {
+ szDest[i] = 0;
+ }
+
+ return i;
+}
+
+static lt_dlhandle
+LoadLib(
+ const char* szFileName,
+ const char* const szExtensions[])
+{
+ lt_dlhandle hMod = 0;
+ char szFull[MAX_PATH];
+ const char* szExt;
+ unsigned iPath;
+ unsigned iExtension;
+ unsigned iCur;
+ unsigned iEnd = 0;
+ unsigned cPaths = 0;
+ const char* szPaths[2];
+
+ if (!szFileName || !szFileName[0])
+ {
+ s_dwLastError = ERROR_INVALID_PARAMETER;
+ goto Done;
+ }
+
+ /* Search starting with current directory */
+ szPaths[cPaths++] = "";
+
+ /* If the file name doesn't already have a path, also search the search path. */
+ if (s_szSearchPath[0] &&
+ szFileName[0] != '/' &&
+ szFileName[0] != '\\' &&
+ szFileName[1] != ':')
+ {
+ szPaths[cPaths++] = s_szSearchPath;
+ }
+
+ for (iPath = 0; !hMod && iPath < cPaths; iPath++)
+ {
+ iEnd = 0;
+
+ /* Add search path only if non-empty and filename does not
+ * contain absolute path.
+ */
+ if (szPaths[iPath][0])
+ {
+ iEnd += CopyPath(szPaths[iPath], szFull, _countof(szFull), 0);
+
+ if (szFull[iEnd - 1] != '\\' && iEnd < _countof(szFull))
+ {
+ szFull[iEnd++] = '\\';
+ }
+ }
+
+ iEnd += CopyPath(szFileName, &szFull[iEnd], _countof(szFull)-iEnd, 0);
+ if (iEnd == _countof(szFull))
+ {
+ s_dwLastError = ERROR_BUFFER_OVERFLOW;
+ goto Done;
+ }
+
+ for (iExtension = 0; !hMod && szExtensions[iExtension]; iExtension++)
+ {
+ szExt = szExtensions[iExtension];
+ for (iCur = 0; szExt[iCur] && iEnd + iCur < _countof(szFull); iCur++)
+ {
+ szFull[iEnd + iCur] = szExt[iCur];
+ }
+
+ if (iEnd + iCur >= _countof(szFull))
+ {
+ s_dwLastError = ERROR_BUFFER_OVERFLOW;
+ goto Done;
+ }
+ else
+ {
+ szFull[iEnd + iCur] = 0;
+ }
+
+ hMod = (lt_dlhandle)LoadLibraryA(szFull);
+ }
+ }
+
+ s_dwLastError = hMod ? 0 : GetLastError();
+
+Done:
+ return hMod;
+}
+
+int
+lt_dlinit(void)
+{
+ int cErrors = 0;
+ s_dwLastError = 0;
+ return cErrors;
+}
+
+int
+lt_dlexit(void)
+{
+ int cErrors = 0;
+ s_dwLastError = 0;
+ s_szSearchPath[0] = 0;
+ return cErrors;
+}
+
+int
+lt_dlsetsearchpath(const char *szSearchPath)
+{
+ int cErrors=0;
+ s_dwLastError = 0;
+ s_szSearchPath[0] = 0;
+ if (szSearchPath)
+ {
+ int iEnd = CopyPath(szSearchPath, s_szSearchPath, _countof(s_szSearchPath), 0);
+ if (szSearchPath[iEnd])
+ {
+ /* path was truncated. */
+ cErrors++;
+ s_dwLastError = ERROR_BUFFER_OVERFLOW;
+ s_szSearchPath[0] = 0;
+ }
+ }
+
+ return cErrors;
+}
+
+int
+lt_dlforeachfile(
+ const char *szSearchPath,
+ int (*pfCallback)(const char *szFileName, lt_ptr pData),
+ lt_ptr pData)
+{
+ char szExePath[MAX_PATH];
+ char szOnePath[MAX_PATH];
+ int cErrors = 0;
+ unsigned iSearchPath = 0;
+ unsigned iOnePath;
+ unsigned iExePath = 0;
+ unsigned cchCopied;
+ HANDLE hFind;
+ WIN32_FIND_DATAA data;
+
+ szExePath[0] = 0;
+
+ if (pfCallback == 0)
+ {
+ s_dwLastError = ERROR_INVALID_PARAMETER;
+ cErrors++;
+ goto Done;
+ }
+
+ if (szSearchPath != 0)
+ {
+ while (1)
+ {
+ while (szSearchPath[iSearchPath] == LT_PATHSEP_CHAR)
+ {
+ iSearchPath++;
+ }
+
+ if (szSearchPath[iSearchPath] == 0)
+ {
+ s_dwLastError = 0;
+ break;
+ }
+
+ if (szSearchPath[iSearchPath] == '.' &&
+ (szSearchPath[iSearchPath + 1] == '\\' || szSearchPath[iSearchPath + 1] == '/'))
+ {
+ if (szExePath[0] == 0)
+ {
+ iExePath = GetModuleFileNameA(0, szExePath, _countof(szExePath));
+ if (iExePath == 0)
+ {
+ s_dwLastError = GetLastError();
+ cErrors++;
+ goto Done;
+ }
+ else if (iExePath == _countof(szExePath))
+ {
+ s_dwLastError = ERROR_BUFFER_OVERFLOW;
+ cErrors++;
+ goto Done;
+ }
+
+ while (iExePath > 0 && szExePath[iExePath - 1] != '\\')
+ {
+ iExePath--;
+ }
+
+ if (iExePath > 0)
+ {
+ iExePath--;
+ }
+
+ szExePath[iExePath] = 0;
+ }
+
+ strcpy(szOnePath, szExePath);
+ iOnePath = iExePath;
+ iSearchPath++;
+ }
+ else
+ {
+ iOnePath = 0;
+ }
+
+ cchCopied = CopyPath(
+ szSearchPath + iSearchPath,
+ szOnePath + iOnePath,
+ _countof(szOnePath) - iOnePath,
+ LT_PATHSEP_CHAR);
+ iSearchPath += cchCopied;
+ iOnePath += cchCopied;
+
+ if (0 < iOnePath && iOnePath + 1 < _countof(szOnePath) && szOnePath[iOnePath - 1] != '\\')
+ {
+ szOnePath[iOnePath++] = '\\';
+ }
+
+ if (iOnePath + 1 >= _countof(szOnePath))
+ {
+ s_dwLastError = ERROR_BUFFER_OVERFLOW;
+ cErrors++;
+ goto Done;
+ }
+
+ szOnePath[iOnePath++] = '*';
+ szOnePath[iOnePath] = 0;
+
+ hFind = FindFirstFileA(szOnePath, &data);
+ while (hFind != INVALID_HANDLE_VALUE)
+ {
+ if (0 == (data.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_OFFLINE)))
+ {
+ cErrors = pfCallback(data.cFileName, pData);
+ if (cErrors)
+ {
+ s_dwLastError = ERROR_CANCELLED;
+ FindClose(hFind);
+ goto Done;
+ }
+ }
+
+ if (!FindNextFileA(hFind, &data))
+ {
+ s_dwLastError = ERROR_SUCCESS;
+ FindClose(hFind);
+ hFind = INVALID_HANDLE_VALUE;
+ }
+ }
+ }
+ }
+
+Done:
+ return cErrors;
+}
+
+lt_dlhandle
+lt_dlopen(
+ const char *szFileName)
+{
+ const char* const szExtensions[] = { ".", 0 };
+ lt_dlhandle hModule = LoadLib(szFileName, szExtensions);
+ return hModule;
+}
+
+lt_dlhandle
+lt_dlopenext(
+ const char *szFileName)
+{
+ const char* const szExtensions[] = { ".", ".la.", ".dll.", 0 };
+ lt_dlhandle hModule = LoadLib(szFileName, szExtensions);
+ return hModule;
+}
+
+int
+lt_dlclose(
+ lt_dlhandle handle)
+{
+ int cErrors = 0;
+ if (FreeLibrary((HMODULE)handle))
+ {
+ s_dwLastError = 0;
+ }
+ else
+ {
+ s_dwLastError = GetLastError();
+ cErrors++;
+ }
+
+ return cErrors;
+}
+
+lt_ptr
+lt_dlsym(
+ lt_dlhandle hModule,
+ const char *szSymbolName)
+{
+ union {FARPROC fn; lt_ptr ptr;} func;
+ func.fn = GetProcAddress((HMODULE)hModule, szSymbolName);
+ s_dwLastError = func.fn ? 0 : GetLastError();
+ return func.ptr;
+}
+
+const char *
+lt_dlerror(void)
+{
+ if (!FormatMessageA(
+ FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ 0,
+ s_dwLastError,
+ 0,
+ s_szLastError,
+ _countof(s_szLastError),
+ 0))
+ {
+ _snprintf(s_szLastError, _countof(s_szLastError), "Unknown error %u occurred.", s_dwLastError);
+ }
+
+ return s_szLastError;
+}
diff --git a/src/src/win32-ltdl.h b/src/src/win32-ltdl.h
new file mode 100644
index 0000000..b11d5d4
--- /dev/null
+++ b/src/src/win32-ltdl.h
@@ -0,0 +1,71 @@
+/* libSoX minimal libtool-ltdl for MS-Windows: (c) 2009 SoX contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef LTDL_H
+#define LTDL_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LT_PATHSEP_CHAR ';'
+#define LT_DIRSEP_CHAR '\\'
+
+struct lt__handle;
+typedef struct lt__handle *lt_dlhandle;
+typedef void *lt_ptr;
+
+int
+lt_dlinit(void);
+
+int
+lt_dlexit(void);
+
+int
+lt_dlsetsearchpath(const char *search_path);
+
+int
+lt_dlforeachfile(
+ const char *szSearchPath,
+ int (*pfCallback)(const char *szFileName, lt_ptr pData),
+ lt_ptr pData);
+
+lt_dlhandle
+lt_dlopen(
+ const char *szFileName);
+
+lt_dlhandle
+lt_dlopenext(
+ const char *szFileName);
+
+lt_ptr
+lt_dlsym(
+ lt_dlhandle hModule,
+ const char *szSymbolName);
+
+const char *
+lt_dlerror(void);
+
+int
+lt_dlclose(
+ lt_dlhandle handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ifndef LTDL_H */
diff --git a/src/src/wve.c b/src/src/wve.c
new file mode 100644
index 0000000..55fea5f
--- /dev/null
+++ b/src/src/wve.c
@@ -0,0 +1,63 @@
+/* libSoX file format: Psion wve (c) 2008 robs@users.sourceforge.net
+ *
+ * See http://filext.com/file-extension/WVE
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <string.h>
+
+static char const ID1[18] = "ALawSoundFile**\0\017\020";
+static char const ID2[] = {0,0,0,1,0,0,0,0,0,0}; /* pad & repeat info: ignore */
+
+static int start_read(sox_format_t * ft)
+{
+ char buf[sizeof(ID1)];
+ uint32_t num_samples;
+
+ if (lsx_readchars(ft, buf, sizeof(buf)) || lsx_readdw(ft, &num_samples) ||
+ lsx_skipbytes(ft, sizeof(ID2)))
+ return SOX_EOF;
+ if (memcmp(ID1, buf, sizeof(buf))) {
+ lsx_fail_errno(ft, SOX_EHDR, "wve: can't find Psion identifier");
+ return SOX_EOF;
+ }
+ return lsx_check_read_params(ft, 1, 8000., SOX_ENCODING_ALAW, 8, (uint64_t)num_samples, sox_true);
+}
+
+static int write_header(sox_format_t * ft)
+{
+ uint64_t size64 = ft->olength? ft->olength:ft->signal.length;
+ unsigned size = size64 > UINT_MAX ? 0 : (unsigned)size64;
+ return lsx_writechars(ft, ID1, sizeof(ID1))
+ || lsx_writedw(ft, size)
+ || lsx_writechars(ft, ID2, sizeof(ID2))? SOX_EOF:SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(wve)
+{
+ static char const * const names[] = {"wve", NULL};
+ static sox_rate_t const write_rates[] = {8000, 0};
+ static unsigned const write_encodings[] = {SOX_ENCODING_ALAW, 8, 0, 0};
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "Psion 3 audio format",
+ names, SOX_FILE_BIG_END | SOX_FILE_MONO | SOX_FILE_REWIND,
+ start_read, lsx_rawread, NULL,
+ write_header, lsx_rawwrite, NULL,
+ lsx_rawseek, write_encodings, write_rates, 0
+ };
+ return &handler;
+}
diff --git a/src/src/xa.c b/src/src/xa.c
new file mode 100644
index 0000000..10acfbc
--- /dev/null
+++ b/src/src/xa.c
@@ -0,0 +1,291 @@
+/* libSoX xa.c Support for Maxis .XA file format
+ *
+ * Copyright (C) 2006 Dwayne C. Litzenberger <dlitz@dlitz.net>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Thanks to Valery V. Anisimovsky <samael@avn.mccme.ru> for the
+ * "Maxis XA Audio File Format Description", dated 5-01-2002. */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define HNIBBLE(byte) (((byte) >> 4) & 0xf)
+#define LNIBBLE(byte) ((byte) & 0xf)
+
+/* .xa file header */
+typedef struct {
+ char magic[4]; /* "XA\0\0", "XAI\0" (sound/speech), or "XAJ\0" (music) */
+ uint32_t outSize; /* decompressed size of the stream (in bytes) */
+
+ /* WAVEFORMATEX structure for the decompressed data */
+ uint16_t tag; /* 0x0001 - PCM data */
+ uint16_t channels; /* number of channels */
+ uint32_t sampleRate; /* sample rate (samples/sec) */
+ uint32_t avgByteRate; /* sampleRate * align */
+ uint16_t align; /* bits / 8 * channels */
+ uint16_t bits; /* 8 or 16 */
+} xa_header_t;
+
+typedef struct {
+ int32_t curSample; /* current sample */
+ int32_t prevSample; /* previous sample */
+ int32_t c1;
+ int32_t c2;
+ unsigned int shift;
+} xa_state_t;
+
+/* Private data for .xa file */
+typedef struct {
+ xa_header_t header;
+ xa_state_t *state;
+ unsigned int blockSize;
+ unsigned int bufPos; /* position within the current block */
+ unsigned char *buf; /* buffer for the current block */
+ unsigned int bytesDecoded; /* number of decompressed bytes read */
+} priv_t;
+
+/* coefficients for EA ADPCM */
+static const int32_t EA_ADPCM_Table[]= {
+ 0, 240, 460, 392,
+ 0, 0, -208, -220,
+ 0, 1, 3, 4,
+ 7, 8, 10, 11,
+ 0, -1, -3, -4
+};
+
+/* Clip sample to 16 bits */
+static inline int32_t clip16(int32_t sample)
+{
+ if (sample > 32767) {
+ return 32767;
+ } else if (sample < -32768) {
+ return -32768;
+ } else {
+ return sample;
+ }
+}
+
+static int startread(sox_format_t * ft)
+{
+ priv_t * xa = (priv_t *) ft->priv;
+ char *magic = xa->header.magic;
+
+ /* Check for the magic value */
+ if (lsx_readbuf(ft, xa->header.magic, (size_t)4) != 4 ||
+ (memcmp("XA\0\0", xa->header.magic, (size_t)4) != 0 &&
+ memcmp("XAI\0", xa->header.magic, (size_t)4) != 0 &&
+ memcmp("XAJ\0", xa->header.magic, (size_t)4) != 0))
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "XA: Header not found");
+ return SOX_EOF;
+ }
+
+ /* Read the rest of the header */
+ if (lsx_readdw(ft, &xa->header.outSize) != SOX_SUCCESS) return SOX_EOF;
+ if (lsx_readw(ft, &xa->header.tag) != SOX_SUCCESS) return SOX_EOF;
+ if (lsx_readw(ft, &xa->header.channels) != SOX_SUCCESS) return SOX_EOF;
+ if (lsx_readdw(ft, &xa->header.sampleRate) != SOX_SUCCESS) return SOX_EOF;
+ if (lsx_readdw(ft, &xa->header.avgByteRate) != SOX_SUCCESS) return SOX_EOF;
+ if (lsx_readw(ft, &xa->header.align) != SOX_SUCCESS) return SOX_EOF;
+ if (lsx_readw(ft, &xa->header.bits) != SOX_SUCCESS) return SOX_EOF;
+
+ /* Output the data from the header */
+ lsx_debug("XA Header:");
+ lsx_debug(" szID: %02x %02x %02x %02x |%c%c%c%c|",
+ magic[0], magic[1], magic[2], magic[3],
+ (magic[0] >= 0x20 && magic[0] <= 0x7e) ? magic[0] : '.',
+ (magic[1] >= 0x20 && magic[1] <= 0x7e) ? magic[1] : '.',
+ (magic[2] >= 0x20 && magic[2] <= 0x7e) ? magic[2] : '.',
+ (magic[3] >= 0x20 && magic[3] <= 0x7e) ? magic[3] : '.');
+ lsx_debug(" dwOutSize: %u", xa->header.outSize);
+ lsx_debug(" wTag: 0x%04x", xa->header.tag);
+ lsx_debug(" wChannels: %u", xa->header.channels);
+ lsx_debug(" dwSampleRate: %u", xa->header.sampleRate);
+ lsx_debug(" dwAvgByteRate: %u", xa->header.avgByteRate);
+ lsx_debug(" wAlign: %u", xa->header.align);
+ lsx_debug(" wBits: %u", xa->header.bits);
+
+ /* Populate the sox_soundstream structure */
+ ft->encoding.encoding = SOX_ENCODING_SIGN2;
+
+ if (!ft->encoding.bits_per_sample || ft->encoding.bits_per_sample == xa->header.bits) {
+ ft->encoding.bits_per_sample = xa->header.bits;
+ } else {
+ lsx_report("User options overriding size read in .xa header");
+ }
+
+ if (ft->signal.channels == 0 || ft->signal.channels == xa->header.channels) {
+ ft->signal.channels = xa->header.channels;
+ } else {
+ lsx_report("User options overriding channels read in .xa header");
+ }
+
+ if (ft->signal.rate == 0 || ft->signal.rate == xa->header.sampleRate) {
+ ft->signal.rate = xa->header.sampleRate;
+ } else {
+ lsx_report("User options overriding rate read in .xa header");
+ }
+
+ /* Check for supported formats */
+ if (ft->encoding.bits_per_sample != 16) {
+ lsx_fail_errno(ft, SOX_EFMT, "%d-bit sample resolution not supported.",
+ ft->encoding.bits_per_sample);
+ return SOX_EOF;
+ }
+
+ /* Validate the header */
+ if (xa->header.bits != ft->encoding.bits_per_sample) {
+ lsx_report("Invalid sample resolution %d bits. Assuming %d bits.",
+ xa->header.bits, ft->encoding.bits_per_sample);
+ xa->header.bits = ft->encoding.bits_per_sample;
+ }
+ if (xa->header.align != (ft->encoding.bits_per_sample >> 3) * xa->header.channels) {
+ lsx_report("Invalid sample alignment value %d. Assuming %d.",
+ xa->header.align, (ft->encoding.bits_per_sample >> 3) * xa->header.channels);
+ xa->header.align = (ft->encoding.bits_per_sample >> 3) * xa->header.channels;
+ }
+ if (xa->header.avgByteRate != (xa->header.align * xa->header.sampleRate)) {
+ lsx_report("Invalid dwAvgByteRate value %d. Assuming %d.",
+ xa->header.avgByteRate, xa->header.align * xa->header.sampleRate);
+ xa->header.avgByteRate = xa->header.align * xa->header.sampleRate;
+ }
+
+ /* Set up the block buffer */
+ xa->blockSize = ft->signal.channels * 0xf;
+ xa->bufPos = xa->blockSize;
+
+ /* Allocate memory for the block buffer */
+ xa->buf = lsx_calloc(1, (size_t)xa->blockSize);
+
+ /* Allocate memory for the state */
+ xa->state = lsx_calloc(sizeof(xa_state_t), ft->signal.channels);
+
+ /* Final initialization */
+ xa->bytesDecoded = 0;
+
+ return SOX_SUCCESS;
+}
+
+/*
+ * Read up to len samples from a file, converted to signed longs.
+ * Return the number of samples read.
+ */
+static size_t read_samples(sox_format_t * ft, sox_sample_t *buf, size_t len)
+{
+ priv_t * xa = (priv_t *) ft->priv;
+ int32_t sample;
+ unsigned char inByte;
+ size_t i, done, bytes;
+
+ ft->sox_errno = SOX_SUCCESS;
+ done = 0;
+ while (done < len) {
+ if (xa->bufPos >= xa->blockSize) {
+ /* Read the next block */
+ bytes = lsx_readbuf(ft, xa->buf, (size_t) xa->blockSize);
+ if (bytes < xa->blockSize) {
+ if (lsx_eof(ft)) {
+ if (done > 0) {
+ return done;
+ }
+ lsx_fail_errno(ft,SOX_EOF,"Premature EOF on .xa input file");
+ return 0;
+ } else {
+ /* error */
+ lsx_fail_errno(ft,SOX_EOF,"read error on input stream");
+ return 0;
+ }
+ }
+ xa->bufPos = 0;
+
+ for (i = 0; i < ft->signal.channels; i++) {
+ inByte = xa->buf[i];
+ xa->state[i].c1 = EA_ADPCM_Table[HNIBBLE(inByte)];
+ xa->state[i].c2 = EA_ADPCM_Table[HNIBBLE(inByte) + 4];
+ xa->state[i].shift = LNIBBLE(inByte) + 8;
+ }
+ xa->bufPos += ft->signal.channels;
+ } else {
+ /* Process the block */
+ for (i = 0; i < ft->signal.channels && done < len; i++) {
+ /* high nibble */
+ sample = HNIBBLE(xa->buf[xa->bufPos+i]);
+ sample = (sample << 28) >> xa->state[i].shift;
+ sample = (sample +
+ xa->state[i].curSample * xa->state[i].c1 +
+ xa->state[i].prevSample * xa->state[i].c2 + 0x80) >> 8;
+ sample = clip16(sample);
+ xa->state[i].prevSample = xa->state[i].curSample;
+ xa->state[i].curSample = sample;
+
+ buf[done++] = SOX_SIGNED_16BIT_TO_SAMPLE(sample,);
+ xa->bytesDecoded += (ft->encoding.bits_per_sample >> 3);
+ }
+ for (i = 0; i < ft->signal.channels && done < len; i++) {
+ /* low nibble */
+ sample = LNIBBLE(xa->buf[xa->bufPos+i]);
+ sample = (sample << 28) >> xa->state[i].shift;
+ sample = (sample +
+ xa->state[i].curSample * xa->state[i].c1 +
+ xa->state[i].prevSample * xa->state[i].c2 + 0x80) >> 8;
+ sample = clip16(sample);
+ xa->state[i].prevSample = xa->state[i].curSample;
+ xa->state[i].curSample = sample;
+
+ buf[done++] = SOX_SIGNED_16BIT_TO_SAMPLE(sample,);
+ xa->bytesDecoded += (ft->encoding.bits_per_sample >> 3);
+ }
+
+ xa->bufPos += ft->signal.channels;
+ }
+ }
+ if (done == 0) {
+ return 0;
+ }
+ return done;
+}
+
+static int stopread(sox_format_t * ft)
+{
+ priv_t * xa = (priv_t *) ft->priv;
+
+ ft->sox_errno = SOX_SUCCESS;
+
+ /* Free memory */
+ free(xa->buf);
+ xa->buf = NULL;
+ free(xa->state);
+ xa->state = NULL;
+
+ return SOX_SUCCESS;
+}
+
+LSX_FORMAT_HANDLER(xa)
+{
+ static char const * const names[] = {"xa", NULL };
+ static sox_format_handler_t const handler = {SOX_LIB_VERSION_CODE,
+ "16-bit ADPCM audio files used by Maxis games",
+ names, SOX_FILE_LIT_END,
+ startread, read_samples, stopread,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL, sizeof(priv_t)
+ };
+ return &handler;
+}
diff --git a/src/src/xi.c b/src/src/xi.c
new file mode 100644
index 0000000..aac3b35
--- /dev/null
+++ b/src/src/xi.c
@@ -0,0 +1,34 @@
+/* libSoX file format: XI Copyright (c) 2008 robs@users.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+
+#if defined HAVE_SNDFILE
+
+LSX_FORMAT_HANDLER(xi)
+{
+ static char const * const names[] = {"xi", NULL};
+ static unsigned const write_encodings[] = {SOX_ENCODING_DPCM, 16, 8, 0, 0};
+ static sox_format_handler_t handler;
+ handler = *lsx_sndfile_format_fn();
+ handler.description = "Fasttracker 2";
+ handler.names = names;
+ handler.write_formats = write_encodings;
+ return &handler;
+}
+
+#endif
diff --git a/src/src/xmalloc.c b/src/src/xmalloc.c
new file mode 100644
index 0000000..b8a0ea3
--- /dev/null
+++ b/src/src/xmalloc.c
@@ -0,0 +1,43 @@
+/* SoX Memory allocation functions
+ *
+ * Copyright (c) 2005-2006 Reuben Thomas. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "third_party/sox/src/src/sox_i.h"
+#include <stdlib.h>
+
+/* Resize an allocated memory area; abort if not possible.
+ *
+ * For malloc, `If the size of the space requested is zero, the behavior is
+ * implementation defined: either a null pointer is returned, or the
+ * behavior is as if the size were some nonzero value, except that the
+ * returned pointer shall not be used to access an object'
+ */
+void *lsx_realloc(void *ptr, size_t newsize)
+{
+ if (ptr && newsize == 0) {
+ free(ptr);
+ return NULL;
+ }
+
+ if ((ptr = realloc(ptr, newsize)) == NULL) {
+ lsx_fail("out of memory");
+ exit(2);
+ }
+
+ return ptr;
+}
diff --git a/src/src/xmalloc.h b/src/src/xmalloc.h
new file mode 100644
index 0000000..9ee77f6
--- /dev/null
+++ b/src/src/xmalloc.h
@@ -0,0 +1,34 @@
+/* libSoX Memory allocation functions
+ *
+ * Copyright (c) 2005-2006 Reuben Thomas. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library 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 Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef LSX_MALLOC_H
+#define LSX_MALLOC_H
+
+#include <stddef.h>
+#include <string.h>
+
+#define lsx_malloc(size) lsx_realloc(NULL, (size))
+#define lsx_calloc(n,s) (((n)*(s))? memset(lsx_malloc((n)*(s)),0,(n)*(s)) : NULL)
+#define lsx_Calloc(v,n) v = lsx_calloc(n,sizeof(*(v)))
+#define lsx_strdup(p) ((p)? strcpy((char *)lsx_malloc(strlen(p) + 1), p) : NULL)
+#define lsx_memdup(p,s) ((p)? memcpy(lsx_malloc(s), p, s) : NULL)
+#define lsx_valloc(v,n) v = lsx_malloc((n)*sizeof(*(v)))
+#define lsx_revalloc(v,n) v = lsx_realloc(v, (n)*sizeof(*(v)))
+
+#endif